/*This code was generated using the UMPLE modeling language!
 Date of generation: 2008/07/29 14:56:52*/
/*This class drives: */

package PoliticalEntities.core;

import PoliticalEntities.*;
import PoliticalEntities.json.*;

public class StateOrProvince extends Territory {
  //Class datatypes

  //Class association variables
  private Country country;

  //Registry of our system.
  PoliticalEntitiesRegistry registry = PoliticalEntitiesRegistry.getInstance();

  //Constructor
  public StateOrProvince(String aName, Country aCountry) {
    super(aName);
    country = aCountry;
    country.addStateOrProvince(this);

  }

  public Country getCountry() {
    return country;
  }

  /* This class does not drive Country and therefore sets the association unidirectionally.*/
  public void setCountry(Country aCountry) {
    country = aCountry;
  }

  public void delete() {
    //Delete all 1 ends.
    country.deleteStateOrProvince(this);
  }

  public boolean areManyEndsNull() {
    return true;
  }

  /***********************************
   * Returns the attribute list along with the  
   * class ID in JSON format.
   ***********************************/
  public JSONObject getAttributes() throws JSONException {
    JSONObject obj = new JSONObject();
    obj.put("CLASS_ID", registry.getKey(this));
    return obj;
  }

}