All Packages Class Hierarchy This Package Previous Next Index
Class edu.vt.marian.common.FullID
java.lang.Object
|
+----edu.vt.marian.common.FullID
- public class FullID
- extends Object
The identifier of an object in the MARIAN universe is composed
of class id and instance id. Class id can be regarded as database id and
instance id can be regarded as a unique id in that database.
NOTE: classID is properly an unsigned 16-bit quantity; instanceID an unsigned
32-bit. Unfortunately there are no unsigneds in Java, so we use an int for
classID and test the bounds. Properly, we should use a long for instanceID,
but that's a lot of unused bits so we'll use an int and keep our fingers
crossed.
-
BAD_PARAMS
-
-
classID
-
-
debug
- just for debugging
-
instanceID
-
-
MAX_CLASS_ID
-
-
MAX_INSTANCE_ID
-
-
NULL_STREAM
-
-
OK
- return values for methods of this class
-
FullID(BufferedReader, Debug)
- Create a full id object from the specified stream.
-
FullID(Debug)
- Create an empty full id object
where both classID and instanceID have been set to 0 (ABSURD).
-
FullID(FullID, Debug)
- Create a full id object
from another one.
-
FullID(int, int, Debug)
- Create a full id object
with the specified class id and instance id values.
-
equals(Object)
- Tell whether this object has the
same class id and instance id as the parameter object.
-
getClassID()
- Return the class id of this object.
-
getInstanceID()
- Return the instance id of this object.
-
hashCode()
- Generate a hash value suitable for java.util.HashTable.
-
isValid()
- Test whether or not the fullID is valid.
-
readPacked(ByteArrayInputStream)
- Read this out of compact storage in a byte array.
-
setClassID(int)
- Set the class id of this object.
-
setInstanceID(int)
- Set the instance id of this object.
-
toStream(PrintWriter)
- Print the content of this object to a specified stream.
-
toString()
- Convert this to a human-readable string.
-
writePacked(ByteArrayOutputStream)
- Pack this into a byte array for compact storage.
debug
protected Debug debug
- just for debugging
classID
protected int classID
instanceID
protected int instanceID
MAX_CLASS_ID
protected static final int MAX_CLASS_ID
MAX_INSTANCE_ID
protected static final int MAX_INSTANCE_ID
OK
public static final int OK
- return values for methods of this class
BAD_PARAMS
public static final int BAD_PARAMS
NULL_STREAM
public static final int NULL_STREAM
FullID
public FullID(Debug debug)
- Create an empty full id object
where both classID and instanceID have been set to 0 (ABSURD).
- Parameters:
- debug - used for debugging
FullID
public FullID(int clID,
int instID,
Debug debug)
- Create a full id object
with the specified class id and instance id values.
- Parameters:
- clID - class ID value;
- instID - instance ID value;
- debug - used for debugging
FullID
public FullID(FullID id,
Debug debug)
- Create a full id object
from another one. The created object will have
the same class id and instance id as the parameter object.
- Parameters:
- id - the object to be copied
- debug - used for debugging
FullID
public FullID(BufferedReader br,
Debug debug)
- Create a full id object from the specified stream.
- Parameters:
- br - the stream to read out a full id object;
- debug - used for debugging
isValid
public boolean isValid()
- Test whether or not the fullID is valid.
Note: The null object of any class (#classID:0#) is always valid.
However, objects with a null classID are not. This is
because the null class (CLASS_ABSURD) has no members.
- Returns:
- true / false
setClassID
public int setClassID(int clID)
- Set the class id of this object.
uses the services of class(es): none
- Parameters:
- clID - the class id of this object will be set to this value.
- Returns:
- OK == the value has been set;
BAD_PARAMS == invalid value for clID.
getClassID
public int getClassID()
- Return the class id of this object.
- Returns:
- the class id of this object as an integer
setInstanceID
public int setInstanceID(int instID)
- Set the instance id of this object.
- Parameters:
- instID - the instance id of this object will be set to this
value
- Returns:
- OK == the value has been set;
BAD_PARAMS == invalid value for instID.
getInstanceID
public int getInstanceID()
- Return the instance id of this object.
- Returns:
- the instance id of this object as an integer
equals
public boolean equals(Object o)
- Tell whether this object has the
same class id and instance id as the parameter object.
- Parameters:
- id - the object used to compare with this object
- Returns:
- true == this object has the same class id and instance id as the
parameter object.
false == this object doesn't have the same class id and instance id
as the parameter object.
- Overrides:
- equals in class Object
hashCode
public int hashCode()
- Generate a hash value suitable for java.util.HashTable.
- Returns:
- a positive integer.
- Overrides:
- hashCode in class Object
writePacked
public int writePacked(ByteArrayOutputStream bos)
- Pack this into a byte array for compact storage.
- Parameters:
- bos - a ByteArrayOutputStream into which to pack this.
- Returns:
- OK == all jake.
NULL_STREAM == could not write.
readPacked
public int readPacked(ByteArrayInputStream bis)
- Read this out of compact storage in a byte array.
- Parameters:
- bis - a ByteArrayInputStream from which to unpack this.
- Returns:
- OK == all jake.
NULL_STREAM == could not read.
toString
public String toString()
- Convert this to a human-readable string.
- Returns:
- "@null@" if this is not a valid fullID;
"#classID:instanceID#" if it is.
- Overrides:
- toString in class Object
toStream
public int toStream(PrintWriter pw)
- Print the content of this object to a specified stream.
- Parameters:
- pw - the stream to write this object
- Returns:
- OK == this object has been write to the stream correctly.
NULL_STREAM == could not read.
All Packages Class Hierarchy This Package Previous Next Index