/*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 java.util.*; import Warehouse.*; import Warehouse.json.*; public class DeliverOrShipmentBOM { //Class datatypes private double startTimeLoadOrUnload; private double endTimeExpected; //Class association variables private Truck truck; private LoadingGate sentThrough; private LoadingGate arriveAt; private List boxOrPallets; //Registry of our system. WarehouseRegistry registry = WarehouseRegistry.getInstance(); //Constructor public DeliverOrShipmentBOM(double aStartTimeLoadOrUnload, double aEndTimeExpected, Truck aTruck) { startTimeLoadOrUnload = aStartTimeLoadOrUnload; endTimeExpected = aEndTimeExpected; truck = aTruck; truck.addDeliverOrShipmentBOM(this); boxOrPallets = new ArrayList(); registry.add(boxOrPallets); } public boolean setStartTimeLoadOrUnload(double aStartTimeLoadOrUnload) { startTimeLoadOrUnload = aStartTimeLoadOrUnload; return true; } public boolean setEndTimeExpected(double aEndTimeExpected) { endTimeExpected = aEndTimeExpected; return true; } public double getStartTimeLoadOrUnload() { return startTimeLoadOrUnload; } public double getEndTimeExpected() { return endTimeExpected; } public Truck getTruck() { return truck; } public LoadingGate getSentThrough() { return sentThrough; } public LoadingGate getArriveAt() { return arriveAt; } public List getBoxOrPallets() { return boxOrPallets; } public BoxOrPallet addBoxOrPallet(int aRFIDTagNumber, double aLengthINmm, double aWidthINmm, double aHeightINmm, double aWeightINkg, String aContentType) { BoxOrPallet newBoxOrPallet; newBoxOrPallet = new BoxOrPallet(aRFIDTagNumber, aLengthINmm, aWidthINmm, aHeightINmm, aWeightINkg, aContentType); if (!boxOrPallets.contains(newBoxOrPallet)) { registry.add(newBoxOrPallet); boxOrPallets.add(newBoxOrPallet); } return newBoxOrPallet; } public BoxOrPallet addBoxOrPallet(BoxOrPallet aBoxOrPallet) { if (!boxOrPallets.contains(aBoxOrPallet)) boxOrPallets.add(aBoxOrPallet); return aBoxOrPallet; } /* This class does not drive Truck and therefore sets the association unidirectionally.*/ public void setTruck(Truck aTruck) { truck = aTruck; } /* This class does not drive LoadingGate and therefore sets the association unidirectionally.*/ public void setSentThrough(LoadingGate aSentThrough) { sentThrough = aSentThrough; } /* This class does not drive LoadingGate and therefore sets the association unidirectionally.*/ public void setArriveAt(LoadingGate aArriveAt) { arriveAt = aArriveAt; } public void delete() { //Delete all 1 ends. truck.deleteDeliverOrShipmentBOM(this); } public void deleteSentThrough(LoadingGate aLoadingGate) { if (aLoadingGate.equals(sentThrough)) { sentThrough = null; registry.removeObj(registry.getKey(aLoadingGate)); } else //Throw an UmpleException .. to be implemented. { } } public void deleteArriveAt(LoadingGate aLoadingGate) { if (aLoadingGate.equals(arriveAt)) { arriveAt = null; registry.removeObj(registry.getKey(aLoadingGate)); } else //Throw an UmpleException .. to be implemented. { } } public void deleteBoxOrPallet(BoxOrPallet aBoxOrPallet) { if (boxOrPallets.contains(aBoxOrPallet)) { boxOrPallets.remove(aBoxOrPallet); //registry.removeObj(registry.getKey(aBoxOrPallet)); } else //Throw an UmpleException .. to be implemented. { } } 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("startTimeLoadOrUnload", getStartTimeLoadOrUnload()); obj.put("endTimeExpected", getEndTimeExpected()); return obj; } }