|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.objects.util.DistanceRankedObject<T>
T
- the encapsulated object classpublic class DistanceRankedObject<T>
Ranked object where the rank is based on distances.
Field Summary |
---|
Fields inherited from interface messif.objects.util.DistanceRanked |
---|
comparator |
Constructor Summary | |
---|---|
DistanceRankedObject(T object,
float distance)
Creates a new instance of DistanceRankedObject that encapsulates a given object. |
Method Summary | |
---|---|
DistanceRankedObject<T> |
clone(float newDistance)
Clone this ranked object and change the distance of the clonned one |
int |
compareTo(DistanceRankedObject<?> o)
Compares this object with the specified object for order. |
boolean |
equals(java.lang.Object obj)
Returns true if this encapsulated object is equal to the specified DistanceRankedObject encapsulated object. |
float |
getDistance()
Returns the measured distance. |
T |
getObject()
Returns the encapsulated object. |
int |
hashCode()
Returns a hash code value for the stored distance. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DistanceRankedObject(T object, float distance)
object
- the encapsulated objectdistance
- the distance specifying object's rankMethod Detail |
---|
public T getObject()
public float getDistance()
getDistance
in interface DistanceRanked
public boolean equals(java.lang.Object obj)
DistanceRankedObject
encapsulated object. Null values
are handled correctly.
Note that the equality defined by this method is inconsistent with compareTo(messif.objects.util.DistanceRankedObject>)
.
equals
in class java.lang.Object
obj
- the reference object with which to compare
true
if this object is the same as the obj argument; false
otherwisepublic int hashCode()
hashCode
in class java.lang.Object
public int compareTo(DistanceRankedObject<?> o)
Note that the natural order defined by this method is inconsistent with equals(java.lang.Object)
.
compareTo
in interface java.lang.Comparable<DistanceRankedObject<?>>
o
- the object to be compared
public DistanceRankedObject<T> clone(float newDistance)
newDistance
- distance to be set for the clonned object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |