|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.pastry.Id.Distance
public static class Id.Distance
A class for representing and manipulating the distance between two Ids on the circle.
Constructor Summary | |
---|---|
Id.Distance()
Constructor. |
|
Id.Distance(byte[] diff)
Constructor. |
|
Id.Distance(int[] diff)
Constructor. |
Method Summary | |
---|---|
void |
blit(byte[] target)
Blits the distance into a target array. |
void |
blit(byte[] target,
int offset)
Blits the distance into a target array, starting at the given offset. |
int |
compareTo(java.lang.Object obj)
Comparison operator. |
byte[] |
copy()
Copy the distance into a freshly generated array. |
boolean |
equals(java.lang.Object obj)
Equality operator. |
int |
hashCode()
Hash codes. |
Id.Distance |
shift(int cnt,
int fill)
Shift operator. |
Id.Distance |
shift(int cnt,
int fill,
boolean roundUp)
Shift operator. |
Id.Distance |
shiftDistance(int cnt,
int fill)
Shift operator. |
java.lang.String |
toString()
Returns a string representation of the distance The string is a byte string from most to least significant. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Id.Distance()
public Id.Distance(byte[] diff)
diff
- The different, as a byte arraypublic Id.Distance(int[] diff)
diff
- The difference, as an int arrayMethod Detail |
---|
public void blit(byte[] target)
target
- an array of length at least IdBitLength/8 for the distance to be stored in.public void blit(byte[] target, int offset)
offset
- The offset to start attarget
- an array of length at least IdBitLength/8 for the distance to be stored in.public byte[] copy()
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
obj
- the Distance to compare with.
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- another Distance.
public Id.Distance shift(int cnt, int fill)
cnt
- the number of bits to shift, negative shifts left, positive shifts rightfill
- value of bit shifted in (0 if fill == 0, 1 otherwise)
public Id.Distance shift(int cnt, int fill, boolean roundUp)
cnt
- the number of bits to shift, negative shifts left, positive shifts rightfill
- value of bit shifted in (0 if fill == 0, 1 otherwise)roundUp
- if true, round up the results after right shifting
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public Id.Distance shiftDistance(int cnt, int fill)
shiftDistance
in interface Id.Distance
cnt
- the number of bits to shift, negative shifts left, positive shifts rightfill
- value of bit shifted in (0 if fill == 0, 1 otherwise)
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |