|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplanet.commonapi.Id
This interface is an abstraction of an Id (or key) from the CommonAPI paper.
Any class that extends this Id for a specific overlay, must offer
as least the no argument constructor.
The value for any built Id will be made with the related setValues()
method. If any of them is nonapplicable to any Id implementation,
an InitializationException must be thrown.
InitializationException
,
Serialized FormConstructor Summary | |
Id()
|
Method Summary | |
abstract Id |
add(Id offset)
Returns an Id corresponding to this Id plus a given distance |
abstract boolean |
between(Id ccw,
Id cw)
Checks if this Id is between two given ids ccw (inclusive) and cw (exclusive) on the circle |
boolean |
betweenE(Id init,
Id end)
Checks if this Id is in interval (init,end] |
abstract boolean |
clockwise(Id nid)
Checks to see if the Id nid is clockwise or counterclockwise from this, on the ring. |
static Id |
divide(int numberOfNodes)
Divides the maximum domain of the node Id in numberOfNodes, to offers the offset between two consecutive nodes. |
abstract Id |
divideOn(int divisor)
This method returns the arithmetical result of this division: thisId/divisor |
boolean |
Ebetween(Id init,
Id end)
Checks if this Id is in interval [init,end) |
static Id |
getMaximum()
This method returns the maximum value for an Id that is possible to build. |
abstract java.lang.Object |
getValue()
Returns the internal representation value of this Id. |
void |
setValue(Id newValue)
Sets the new value with Id newValue. |
abstract void |
setValue(java.lang.Object newValue)
Sets the new value to this Id with newValue |
abstract Id |
setValues(java.math.BigInteger newValue)
Sets the new value for this Id, based on a BigInteger value. |
abstract Id |
setValues(byte[] newValue)
Sets the new value for this Id, based on a byte[] value. |
abstract Id |
setValues(double newValue)
Sets the new value for this Id, based on a double value. |
abstract Id |
setValues(int newValue)
Sets the new value for this Id, based on an integer value. |
abstract Id |
setValues(int[] newValue)
Sets the new value for this Id, based on an int[] value. |
abstract Id |
setValues(java.util.Random valueGenerator)
Sets the new value for this Id, based on a randomly generated value. |
abstract Id |
setValues(java.lang.String newValue)
Sets the new value for this Id, based on a String value. |
Id |
setValues(java.lang.String material,
java.lang.String algorithm)
Sets the new value for this Id, based on a hashed value. |
abstract Id |
shift(int cnt,
int fill)
Shift operator. shift(-1,0) multiplies value of this by two, shift(1,0) divides by 2 |
abstract Id |
subtract(Id offset)
Returns an Id corresponding to this Id minus a given distance |
abstract byte[] |
toByteArray()
Returns a (mutable) byte array representing this Id |
abstract java.lang.String |
toStringFull()
Returns a string representing the full length of this Id. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.lang.Comparable |
compareTo |
Constructor Detail |
public Id()
Method Detail |
public abstract boolean between(Id ccw, Id cw)
ccw
- the counterclockwise idcw
- the clockwise id
public boolean Ebetween(Id init, Id end)
init
- Id that open the interval
public boolean betweenE(Id init, Id end)
init
- Id that open the interval
public abstract boolean clockwise(Id nid)
nid
- The id to compare to
public abstract Id add(Id offset)
offset
- the distance to add
public abstract Id subtract(Id offset)
offset
- the distance to subtract
public abstract Id 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 abstract byte[] toByteArray()
public abstract java.lang.String toStringFull()
public void setValue(Id newValue)
newValue
- Id with the new value.setValue(planet.commonapi.Id)
public abstract void setValue(java.lang.Object newValue)
newValue
- Internal representation with the new value
to set to this Id.public abstract java.lang.Object getValue()
public static Id getMaximum()
public static Id divide(int numberOfNodes)
numberOfNodes
- Number of nodes in the network.
public abstract Id divideOn(int divisor)
divisor
- The number of parts to divide this Id.
public abstract Id setValues(int newValue)
newValue
- The new value.
public abstract Id setValues(double newValue)
newValue
- The new value.
public abstract Id setValues(byte[] newValue)
newValue
- The new value.
setValues(String, String)
public abstract Id setValues(int[] newValue)
newValue
- The new value.
public abstract Id setValues(java.lang.String newValue)
newValue
- The new value.
public abstract Id setValues(java.math.BigInteger newValue)
newValue
- The new value.
public abstract Id setValues(java.util.Random valueGenerator)
valueGenerator
- The new value.
public Id setValues(java.lang.String material, java.lang.String algorithm) throws InitializationException
material
- The input for the algorithm.algorithm
- One-way hashing algorithm such as "SHA" or "MD5".
InitializationException
- if the material is null or
the algorithm is not found.setValues(byte[])
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |