|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tp.LockableID
public class LockableID
A generic ID that encapsulate a string. You can compose two identifiers to create a hierarchy. The internal representation is just a string. The hierarchy is represented as a standard path (i.e., '/' delimited string except the last component of the path).
For example, you can use this class to represent a reservation record
by constructing a hierarchy of Customer
and RID
as follow.
Customer customer; RID resource; LockableID id = new LockableID(customer,resource);
Please feel free to modify this class.
Constructor Summary | |
---|---|
LockableID(Lockable item)
|
|
LockableID(Lockable prefix,
Lockable item)
|
|
LockableID(Lockable prefix,
String item)
|
|
LockableID(String id)
|
|
LockableID(String prefix,
Lockable item)
|
Method Summary | |
---|---|
int |
compareTo(LockableID o)
|
LockableID |
concat(Lockable other)
Construct a composite ID using this id as prefix. |
boolean |
equals(Object o)
|
String |
getName()
Get the last component of this id. |
LockableID |
getPrefix()
Get the prefix of this id. |
int |
hashCode()
|
boolean |
isPrefixOf(LockableID other)
check whether this object is prefix of the other . |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LockableID(String id)
public LockableID(Lockable item)
public LockableID(String prefix, Lockable item)
public LockableID(Lockable prefix, Lockable item)
public LockableID(Lockable prefix, String item)
Method Detail |
---|
public LockableID concat(Lockable other)
other
- id to compose
public boolean isPrefixOf(LockableID other)
this
object is prefix of the other
.
other
- tested id
true
if this object is prefix of the other.public LockableID getPrefix()
null
if this id is a root.public String getName()
public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
public String toString()
toString
in class Object
public int compareTo(LockableID o)
compareTo
in interface Comparable<LockableID>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |