/** * Declaration for OctTerm object * * @version a1 Oct 1996 * @author Francis Chan */ public class OctTerm extends OctObject{ // class info public static final String className = "OctTerm"; public static final int octFields = 4; // fields /** * Name of the terminal */ public String name; /** * objectId of the instance (if actual terminal) * OCT.NULL_ID, if formal terminal */ public int instanceId; /** * externalId of the formal terminal (may be not assigned) */ public int formalExternalId; /** * Width of the terminal */ public int width; /** * Constructor of an OctTerm (for dynamic creation) * @param octCell The OctCell that the object resides in * @param name The name of the terminal * @param instanceId objectId of the instance to which it belongs * @param formalExternalId externalId of the formal terminal that the actual * terminal represents * @param width The width of the terminal */ public OctTerm(OctCell octCell, String name, int instanceId, int formalExternalId, int width) { this.name = name; this.instanceId = instanceId; this.formalExternalId = formalExternalId; 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 OctTerm (for loading from data back-end server) * @param octCell The OctCell that the object resides in */ public OctTerm(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.instanceId, PersistentObject.INT); SetField(2, this.formalExternalId, PersistentObject.INT); SetField(3, this.width, PersistentObject.INT); OctSetField(octFields); } /** * Loads the fields of an OctTerm 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 // this.name = GetField(0, PersistentObject.STRING_INDICATOR); this.instanceId = GetField(1, PersistentObject.INT_INDICATOR); this.formalExternalId = GetField(2, PersistentObject.INT_INDICATOR); this.width = GetField(3, 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; } }