/** * Declaration for OctBox object * * @version a1 Oct 1996 * @author Francis Chan */ public class OctBox extends OctObject{ // class name public static final String className= "OctBox"; public static final int octFields = 2; public static final int objFields = 2; // class info public OctPoint lowerLeft; public OctPoint upperRight; /** * Constructor of an OctBox (for dynamic creation) * * @param octCell The OctCell that the object resides in * @param lowerLeft Lower left point of the box * @param upperRight Upper right point of the box */ public OctBox(OctCell octCell, OctPoint lowerLeft, OctPoint upperRight) { this.lowerLeft = lowerLeft; this.upperRight = upperRight; this.octCell = octCell; octCell.AddElement(this); OctObjSetup(octCell.port, octFields, className); SetNumObjField(objFields); } /*----------------------------------------------------------- * * the code below is for data backend management * *-----------------------------------------------------------*/ /** * Constructor of an OctBox (for loading from data back-end server) * @param octCell The OctCell that the object resides in */ public OctBox(OctCell octCell) { this.octCell = octCell; OctObjSetup(octCell.port, octFields, className); } /** * Performs the neccessary overhead to allow this object to be * manipulated over the network */ protected void SetObjFields() { SetField(0, this.lowerLeft, PersistentObject.OBJECT); SetField(1, this.upperRight, PersistentObject.OBJECT); OctSetField(octFields); } /** * Loads the fields of an OctBag from data back-end * * @param intId The integer (unique) Id for the object */ public boolean Load(int intId) { if (LoadObject(this.objectClassName, null, intId) == false) { System.out.println("Couldn't load object " + className + " with intId " + intId); return false; } // sets up paramVector so it's ready for field assignment // OctGetField(octFields); octCell.AddElement(this); OctObjSetup(octCell.port, octFields, className); SetNumObjField(objFields); GetObjFields(); return succeedTransmit; } /** * Filled if any of the fields are objects */ protected int GetObjFields() { this.lowerLeft = (OctPoint) GetField(0, PersistentObject.OBJECT_INDICATOR, 0); System.out.println("Before GetField " + objectClassName); this.upperRight = (OctPoint) GetField(1, PersistentObject.OBJECT_INDICATOR, 1); return OCT.OK; } /** * Should not be called */ public boolean Load(String strId) { return false; } }