/*This code was generated using the UMPLE modeling language!
 Date of generation: 2008/07/30 10:05:36*/
/*This class drives: */

package MFP.core.green;

import MFP.*;
import MFP.core.red.*;
import MFP.core.black.*;
import MFP.core.blue.*;
import MFP.json.*;

public class Bin {
  //Class datatypes
  private String number;

  //Class association variables
  private ProductType productType;

  //Registry of our system.
  MFPRegistry registry = MFPRegistry.getInstance();

  //Constructor
  public Bin(String aNumber, ProductType aProductType) {
    number = aNumber;
    productType = aProductType;
    productType.addKeptIn(this);

  }

  public boolean setNumber(String aNumber) {
    number = aNumber;
    return true;
  }

  public String getNumber() {
    return number;
  }

  public ProductType getProductType() {
    return productType;
  }

  /* This class does not drive ProductType and therefore sets the association unidirectionally.*/
  public void setProductType(ProductType aProductType) {
    productType = aProductType;
  }

  public void delete() {
    //Delete all 1 ends.
    productType.deleteKeptIn(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));
    obj.put("number", getNumber());
    return obj;
  }

}