/** * Declaration for OctPoint object * * @version a1 Oct 1996 * @author Francis Chan */ public class OctPoint extends OctObject{ // class name public static final String className= "OctPoint"; public static final int octFields = 2; /** * The x-coordinate of the OctPoint */ public int x; /** * The y-coordinate of the OctPoint */ public int y; /** * Constructor of an OctPoint (for dynamic creation) * @param octCell The OctCell that the object resides in * @param x The x-coordinate of the OctPoint * @param y The y-coordinate of the OctPoint */ public OctPoint(OctCell octCell, int x, int y) { this.x = x; this.y = y; this.octCell = octCell; octCell.AddElement(this); OctObjSetup(octCell.port, octFields, className); } /*----------------------------------------------------------- * * the code below is for data backend management * *-----------------------------------------------------------*/ /** * Constructor of an OctPoint (for loading from data back-end server) * @param octCell The OctCell that the object resides in */ public OctPoint(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.x, PersistentObject.INT); SetField(1, this.y, PersistentObject.INT); OctSetField(octFields); } /** * Loads the fields of an OctPoint from data back-end * @param objectId The String Id for the object (may not be applicable) * @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 // this.x = GetField(0, PersistentObject.INT_INDICATOR); this.y = GetField(1, PersistentObject.INT_INDICATOR); OctGetField(octFields); octCell.AddElement(this); OctObjSetup(octCell.port, octFields, className); return succeedTransmit; } /** * Should not be called */ public boolean Load(String strId) { return false; } /** * Does not require filling since the object has no object fields */ protected int GetObjFields() { return OCT.OK; } }