/** * Declaration for OctInstance object * * @version a1 Oct 1996 * @author Francis Chan */ public class OctInstance extends OctObject{ // class name and number of fields public static final String className= "OctInstance"; public static final int octFields = 6; public static final int objFields = 1; /** * Tranformation */ public OctTransform transform; /** * Name of the instance */ public String name; /** * Name of the master */ public String master; /** * Name of the view */ public String view; /** * Name of the facet */ public String facet; /** * Version number (default to OCT.CURRENT_VERSION) */ public int version; /** * * Constructor of an OctInstance (for dynamic creation) * @param octCell The OctCell that the object resides in * @param name The name of the instance * @param view The view of the cell master * @param master The master of the instance * @param version The version of the instance * @param transform The transform of the cell * */ public OctInstance(OctCell octCell, OctTransform transform, String name, String master, String view, String facet, int version) { this.name = name; this.master = master; this.view = view; this.facet = facet; this.version = version; this.transform = transform; this.octCell = octCell; octCell.AddElement(this); // for data backend management OctObjSetup(octCell.port, octFields, className); SetNumObjField(objFields); } /*----------------------------------------------------------- * * the code below is for data backend management * *-----------------------------------------------------------*/ /** * Constructor of an OctInstance (for loading from data back-end server) * @param octCell The OctCell that the object resides in */ public OctInstance(OctCell octCell) { this.octCell = octCell; OctObjSetup(octCell.port, octFields, className); // testNoNet = !(octSys.network); } /** * 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.master, PersistentObject.STRING); SetField(2, this.view, PersistentObject.STRING); SetField(3, this.facet, PersistentObject.STRING); SetField(4, this.version, PersistentObject.INT); SetField(5, this.transform, PersistentObject.OBJECT); OctSetField(octFields); // SetField(5, this.mode, PersistentObject.OBJECT); // SetField(6, this.mode, PersistentObject.OBJECT); } /** * Loads the fields of an OctInstance 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.master = GetField(1, PersistentObject.STRING_INDICATOR); this.view = GetField(2, PersistentObject.STRING_INDICATOR); this.facet = GetField(3, PersistentObject.STRING_INDICATOR); this.version = GetField(4, PersistentObject.INT_INDICATOR); OctGetField(octFields); octCell.AddElement(this); OctObjSetup(octCell.port, octFields, className); SetNumObjField(objFields); GetObjFields(); return succeedTransmit; } /** * Should not be called */ public boolean Load(String strId) { return false; } /** * Filled if any of the fields are objects */ protected int GetObjFields() { this.transform = (OctTransform) GetField(5, PersistentObject.OBJECT_INDICATOR, 0); return OCT.OK; } }