|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.amis.pogamut.base.communication.worldview.object.WorldObjectId
public class WorldObjectId
Interface that is returning an unique id of the world object. The id must be unique among all the objects in the world.
Every implementations MUST implement equals() and hashCode() correctly as we will use this inside hashmaps/sets.
Field Summary | |
---|---|
protected boolean |
isDouble
Whether the id wolds 'double' inside token . |
protected boolean |
isLong
Whether the id wolds 'long' inside token . |
protected cz.cuni.amis.utils.token.Token |
token
Unique representation of this id, contains ints that uniquely identifies it. |
Constructor Summary | |
---|---|
protected |
WorldObjectId(double id)
Instantiates a new object with id of 'id'. |
protected |
WorldObjectId(long id)
Instantiates a new object with id of 'id'. |
protected |
WorldObjectId(String name)
Instantiates a new object with id of 'name'. |
protected |
WorldObjectId(cz.cuni.amis.utils.token.Token token)
|
Method Summary | |
---|---|
boolean |
equals(Object o)
|
static WorldObjectId |
get(double objId)
Returns shared instance of the WorldObjectId for 'objId'. |
static WorldObjectId |
get(long objId)
Returns shared instance of the WorldObjectId for 'objId'. |
static WorldObjectId |
get(String name)
Returns shared instance of the WorldObjectId for 'name'. |
double |
getDoubleId()
Returns id as 'double', only iff isDoubleId() , otherwise it raises a PogamutException . |
long |
getLongId()
Returns id as 'long', only iff isLongId() , otherwise it raises a PogamutException . |
String |
getStringId()
Always returns a string representation of the ID. |
int |
hashCode()
|
boolean |
isDoubleId()
Whether the is is a double one. |
boolean |
isLongId()
Whether the id is a long one. |
boolean |
isNumericId()
Whether the id holds a numeric value (i.e., it is either isLongId() or isDoubleId() ). |
String |
toString()
Returns string representation of the id, format: WorldObjectId[id] |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected cz.cuni.amis.utils.token.Token token
protected boolean isLong
token
.
protected boolean isDouble
token
.
Constructor Detail |
---|
protected WorldObjectId(String name)
name
- protected WorldObjectId(long id)
id
- protected WorldObjectId(double id)
id
- protected WorldObjectId(cz.cuni.amis.utils.token.Token token)
Method Detail |
---|
public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
public String getStringId()
public boolean isNumericId()
isLongId()
or isDoubleId()
).
public boolean isLongId()
public boolean isDoubleId()
public long getLongId()
isLongId()
, otherwise it raises a PogamutException
.
public double getDoubleId()
isDoubleId()
, otherwise it raises a PogamutException
.
public String toString()
toString
in class Object
public static WorldObjectId get(String name)
WorldObjectId
for 'name'. If no WorldObjectId
exists for 'name',
new one is created.
THREAD-SAFE!
name
-
public static WorldObjectId get(long objId)
WorldObjectId
for 'objId'. If no WorldObjectId
exists for 'objId',
new one is created.
THREAD-SAFE!
name
-
public static WorldObjectId get(double objId)
WorldObjectId
for 'objId'. If no WorldObjectId
exists for 'objId',
new one is created.
THREAD-SAFE!
name
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |