|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.messaging.SortKey
A utility class used to manipulate sort keys for messages. Sort keys are used to encode the structure of a set of message threads as follows:
message sort key ---------- ----------- msg1 05a msg2 05a000 msg3 05a001 msg5 05a001000 msg6 05a001001 ... msg95 05a00101X msg4 05b
Sort keys are base-62 numbers that are encoded using the alphanumeric characters 0-9, A-Z, and a-z to represent digits 0 through 61. This maps to the following character range:
00-09 '0'-'9' 10-35 'A'-'Z' 36-61 'a'-'z'
A tree structure like the one pictured above is respresented with 3 digits for each level (238328 keys) and an unlimited number of levels. Child keys are generated by extending the parent's key 3 digits to the right. In the example above you can observe this by comparing the sort keys for msg2 and msg1, for example.
There are several advantages to this:
Field Summary | |
static String |
versionId
|
Constructor Summary | |
SortKey()
Creates a new sort key and initializes it to the zero value. |
|
SortKey(SortKey parent)
Takes a parent sort key and returns its first child. |
|
SortKey(String sortkey)
Takes the given string and converts it into a sort key. |
Method Summary | |
SortKey |
getChild()
Gets the first child of this sort key. |
int |
getDepth()
Gets the depth of the current sort key in the tree. |
SortKey |
getParent()
Gets the parent of this sort key. |
int |
intValue()
Returns the value of the sort key as an integer. |
int |
length()
Gets the length of the sort key, in other words the number of digits it contains. |
void |
next()
Increments the value of the sort key to the next element of the sequence. |
String |
toString()
Returns a string representation of this sort key. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String versionId
Constructor Detail |
public SortKey()
public SortKey(String sortkey)
public SortKey(SortKey parent)
Method Detail |
public SortKey getChild()
public SortKey getParent()
public String toString()
public int getDepth()
public int length()
public void next()
public int intValue()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |