|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.vt.marian.common.FullID
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.
Field Summary | |
static int |
BAD_PARAMS
|
protected int |
classID
|
protected Debug |
debug
just for debugging |
protected int |
instanceID
|
protected static int |
MAX_CLASS_ID
|
protected static int |
MAX_INSTANCE_ID
|
static int |
NULL_STREAM
|
static int |
OK
return values for methods of this class |
Constructor Summary | |
FullID(java.io.BufferedReader br,
Debug debug)
Create a full id object from the specified stream. |
|
FullID(Debug debug)
Create an empty full id object where both classID and instanceID have been set to 0 (ABSURD). |
|
FullID(FullID id,
Debug debug)
Create a full id object from another one. |
|
FullID(int clID,
int instID,
Debug debug)
Create a full id object with the specified class id and instance id values. |
Method Summary | |
boolean |
equals(java.lang.Object o)
Tell whether this object has the same class id and instance id as the parameter object. |
int |
getClassID()
Return the class id of this object. |
int |
getInstanceID()
Return the instance id of this object. |
int |
hashCode()
Generate a hash value suitable for java.util.HashTable. |
boolean |
isValid()
Test whether or not the fullID is valid. |
int |
readPacked(java.io.ByteArrayInputStream bis)
Read this out of compact storage in a byte array. |
int |
setClassID(int clID)
Set the class id of this object. |
int |
setInstanceID(int instID)
Set the instance id of this object. |
int |
toStream(java.io.PrintWriter pw)
Print the content of this object to a specified stream. |
java.lang.String |
toString()
Convert this to a human-readable string. |
int |
writePacked(java.io.ByteArrayOutputStream bos)
Pack this into a byte array for compact storage. |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected Debug debug
protected int classID
protected int instanceID
protected static final int MAX_CLASS_ID
protected static final int MAX_INSTANCE_ID
public static final int OK
public static final int BAD_PARAMS
public static final int NULL_STREAM
Constructor Detail |
public FullID(Debug debug)
debug
- used for debuggingpublic FullID(int clID, int instID, Debug debug)
clID
- class ID value;instID
- instance ID value;debug
- used for debuggingpublic FullID(FullID id, Debug debug)
id
- the object to be copieddebug
- used for debuggingpublic FullID(java.io.BufferedReader br, Debug debug)
br
- the stream to read out a full id object;debug
- used for debuggingMethod Detail |
public boolean isValid()
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.
public int setClassID(int clID)
uses the services of class(es): none
clID
- the class id of this object will be set to this value.public int getClassID()
public int setInstanceID(int instID)
instID
- the instance id of this object will be set to this
valuepublic int getInstanceID()
public boolean equals(java.lang.Object o)
id
- the object used to compare with this objectpublic int hashCode()
public int writePacked(java.io.ByteArrayOutputStream bos)
bos
- a ByteArrayOutputStream into which to pack this.public int readPacked(java.io.ByteArrayInputStream bis)
bis
- a ByteArrayInputStream from which to unpack this.public java.lang.String toString()
public int toStream(java.io.PrintWriter pw)
pw
- the stream to write this object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |