/** * Declaration for OctNet object * * @version a1 Oct 1996 * @author Francis Chan */ public class OctNet extends OctObject{ // class info public static final String className = "OctNet"; public static final int octFields = 2; // fields /** * The name of the OctNet */ public String name; /** * The name of the OctNet */ public int width; /** * Constructor of an OctNet (for dynamic creation) * @param octCell The OctCell that the object resides in * @param name The name of the OctNet * @param width The width of the OctNet */ public OctNet(OctCell octCell, String name, int width) { this.name = name; this.width = width; this.octCell = octCell; octCell.AddElement(this); OctObjSetup(octCell.port, octFields, className); } /*----------------------------------------------------------- * * the code below is for data backend management * *-----------------------------------------------------------*/ /** * Constructor of an OctNet (for loading from data back-end server) * @param octCell The OctCell that the object resides in */ public OctNet(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.name, PersistentObject.STRING); SetField(1, this.width, PersistentObject.INT); OctSetField(octFields); } /** * Loads the fields of an OctNet 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.name = GetField(0, PersistentObject.STRING_INDICATOR); this.width = 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; } }