|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplanet.symphony.SortedKList
public class SortedKList
A SortedKList is a list of objects kept in sorted order. A Comparer object is needed to compare objects in the list, as there is no standard compare operation for objects. Comparer class for standard types are found in the package planet.symphony. Moreover, the SortedKList needs from a referee object and bound k. These two modifiers are used to filter elements on the SortedKList. The others are removed. This data structure is useful to maintain neighbour's set of nodes. The nodes befores the referee are its predecessors, the nodes after the referee are its successors.
Also the SortedKList deletes duplicates.
Constructor Summary | |
---|---|
SortedKList(Comparer listOrder,
java.lang.Object referee,
int k)
Create a new SortedKList using the Comparer interface to define the order on elements. |
Method Summary | |
---|---|
boolean |
add(java.lang.Object o)
Adds a object to the sortedKList. |
boolean |
addAll(java.util.Collection c)
Adds a collection of elements inside the SortedKList. |
boolean |
contains(java.lang.Object o)
Tests if the specified object is a component in this sortedList. |
java.lang.Object |
get(int index)
Returns the element at the specified position in this sorted list. |
Comparer |
getComparer()
Returns the comparer object used to order list. |
java.lang.Object |
getFirstPred()
Returns the first predecessor. |
java.lang.Object |
getFirstSucc()
Returns the first successor. |
java.util.Collection |
getNeighbourSet()
|
java.util.Vector |
getPredList(int max)
Returns the predecessor list. |
java.lang.Object |
getReferee()
Returns the referee's object. |
java.util.Collection |
getSortedSet()
|
java.util.Vector |
getSuccList(int max)
Returns the successor list. |
boolean |
hasNeighbour()
|
boolean |
isEmpty()
Tests if this vector has no components. |
java.util.Iterator |
iterator()
|
boolean |
remove(java.lang.Object o)
Removes an object from neighbour's Set. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SortedKList(Comparer listOrder, java.lang.Object referee, int k)
listOrder
- Comparer used to sort the list.referee
- The referee used to filter objects.k
- The bound used to filter objects.Comparer
Method Detail |
---|
public Comparer getComparer()
public boolean add(java.lang.Object o)
o
- Object to add.
public java.lang.Object getReferee()
public boolean addAll(java.util.Collection c)
c
- Collection of elements to add.
public java.util.Collection getNeighbourSet()
public java.util.Iterator iterator()
public java.util.Collection getSortedSet()
public boolean contains(java.lang.Object o)
o
- An object.
public boolean hasNeighbour()
public boolean remove(java.lang.Object o)
o
- The object to remove.
public boolean isEmpty()
public java.lang.Object get(int index)
index
- Index of element to return.
java.lang.ArrayIndexOutOfBoundsException
- - index is out of range (index < 0 || index >= size()).public java.lang.Object getFirstSucc()
public java.lang.Object getFirstPred()
public java.util.Vector getSuccList(int max)
max
- Maximum number of successors.
public java.util.Vector getPredList(int max)
max
- Maximum number of predecessor.
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 |