/*This code was generated using the UMPLE modeling language! Date of generation: 2008/07/30 13:12:55*/ /*This class drives: */ package Warehouse.core; import Warehouse.*; import Warehouse.json.*; public class Slot { //Class datatypes private int number; private double width; //Class association variables private SlotSet slotSet; private Level level; //Registry of our system. WarehouseRegistry registry = WarehouseRegistry.getInstance(); //Constructor public Slot(int aNumber, double aWidth, SlotSet aSlotSet, Level aLevel) { number = aNumber; width = aWidth; slotSet = aSlotSet; slotSet.addSlot(this); level = aLevel; level.addSlot(this); } public boolean setNumber(int aNumber) { number = aNumber; return true; } public boolean setWidth(double aWidth) { width = aWidth; return true; } public int getNumber() { return number; } public double getWidth() { return width; } public SlotSet getSlotSet() { return slotSet; } public Level getLevel() { return level; } /* This class does not drive SlotSet and therefore sets the association unidirectionally.*/ public void setSlotSet(SlotSet aSlotSet) { slotSet = aSlotSet; } /* This class does not drive Level and therefore sets the association unidirectionally.*/ public void setLevel(Level aLevel) { level = aLevel; } public void delete() { //Delete all 1 ends. slotSet.deleteSlot(this); level.deleteSlot(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()); obj.put("width", getWidth()); return obj; } }