Additional top-level class in compilation unit: PartialOrderIterator.
Objects with pairwise orderings between them.
The iterator method provides the elements in
topologically sorted order. Elements participating in a cycle
are not returned.
Unlike the SortedSet and SortedMap
interfaces, which require their elements to implement the
Comparable interface, this class receives ordering
information via its setOrdering and
unsetPreference methods. This difference is due to
the fact that the relevant ordering between elements is unlikely to
be inherent in the elements themselves; rather, it is set
dynamically according to application policy. For example, in a
service provider registry situation, an application might allow the
user to set a preference order for service provider objects
supplied by a trusted vendor over those supplied by another.
| Modifier and Type | Field and Description |
|---|---|
| private final Map |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | add(E o)
Overrides java. Implements java. Adds an |
| public void | clear()
Overrides java. Implements java. Removes all of the elements from this set (optional operation). |
| public boolean | contains(Object o)
Overrides java. Implements java. Returns |
| public boolean | |
| public Iterator | iterator()
Implements abstract java. Implements java. Returns an iterator over the elements contained in this
collection, with an ordering that respects the orderings set
by the |
| public boolean | remove(Object o)
Overrides java. Implements java. Removes an |
| public boolean | Returns: true if no prior ordering existed
between the nodes, false otherwise.Sets an ordering between two nodes. |
| public int | size()
Implements abstract java. Implements java. Returns the number of elements in this set (its cardinality). |
| public boolean | Returns: true if a prior prefence existed between the nodes.Removes any ordering between two nodes. |
| poNodes | back to summary |
|---|---|
| private final Map<E, DigraphNode<E>> poNodes | |
| PartiallyOrderedSet | back to summary |
|---|---|
| public PartiallyOrderedSet() Constructs a | |
| add | back to summary |
|---|---|
| public boolean add(E o) Overrides java. Implements java. Adds an | |
| clear | back to summary |
|---|---|
| public void clear() Overrides java. Implements java. Doc from java. Removes all of the elements from this set (optional operation). The set will be empty after this call returns. | |
| contains | back to summary |
|---|---|
| public boolean contains(Object o) Overrides java. Implements java. Doc from java. Returns | |
| hasOrdering | back to summary |
|---|---|
| public boolean hasOrdering(E preferred, E other) Returns | |
| iterator | back to summary |
|---|---|
| public Iterator Implements abstract java. Implements java. Returns an iterator over the elements contained in this
collection, with an ordering that respects the orderings set
by the | |
| remove | back to summary |
|---|---|
| public boolean remove(Object o) Overrides java. Implements java. Removes an | |
| setOrdering | back to summary |
|---|---|
| public boolean setOrdering(E first, E second) Sets an ordering between two nodes. When an iterator is requested, the first node will appear earlier in the sequence than the second node. If a prior ordering existed between the nodes in the opposite order, it is removed.
| |
| size | back to summary |
|---|---|
| public int size() Implements abstract java. Implements java. Doc from java. Returns the number of elements in this set (its cardinality). If this
set contains more than | |
| unsetOrdering | back to summary |
|---|---|
| public boolean unsetOrdering(E first, E second) Removes any ordering between two nodes.
| |