K - type of key (usually identifier) of the sorted itemV - type of sorted itempublic class BasicTopoNode<K,V> extends Object implements TopoNode<K,V>
TopoNode
that exposes convenient static methods for easier instantiation.| Modifier | Constructor and Description |
|---|---|
protected |
BasicTopoNode(K key,
V value)
Instantiates a new node with empty set of dependencies.
|
| Modifier and Type | Method and Description |
|---|---|
static <K1,V1> BasicTopoNode<K1,V1> |
create(K1 key,
V1 value)
Creates an instance of topological sorting node for sorting item
value identified by key key without any dependencies. |
static <K1,V1> BasicTopoNode<K1,V1> |
createWithDependencies(K1 key,
V1 value,
Collection<? extends K1> dependencies)
Creates an instance of topological sorting node for sorting item
value identified by key key with an initial set of dependencies
defined by argument dependencies. |
static <K1,V1> BasicTopoNode<K1,V1> |
createWithDependencies(K1 key,
V1 value,
K1... dependencies)
Creates an instance of topological sorting node for sorting item
value identified by key key with an initial set of dependencies
defined by argument dependencies. |
boolean |
equals(Object obj)
Determines whether the given object is an instance of
TopoNode
that has a key equal to the key of this node. |
Set<K> |
getRemainingTopoDependencies()
Obtains a set of keys that represent prerequisite items that this
item depends on.
|
K |
getTopoKey()
Obtains the key of sorted item represented by this node.
|
V |
getValue()
Obtains the sorted item that is represented by this node.
|
int |
hashCode()
Returns hash code of the item's key.
|
protected void |
setDependencies(Collection<? extends K> deps)
Sets the dependencies of this node.
|
String |
toString()
Returns text representation of the item's key.
|
public static <K1,V1> BasicTopoNode<K1,V1> create(K1 key, V1 value)
value identified by key key without any dependencies.K1 - type of key (usually identifier) of the sorted itemV1 - type of sorted itemkey - key of the sorted itemvalue - sorted itemNullPointerException - if key is nullpublic static <K1,V1> BasicTopoNode<K1,V1> createWithDependencies(K1 key, V1 value, Collection<? extends K1> dependencies)
value identified by key key with an initial set of dependencies
defined by argument dependencies.K1 - type of key (usually identifier) of the sorted itemV1 - type of sorted itemkey - key of the sorted itemvalue - sorted itemdependencies - collection of keys of items that are prerequisities for the item valueNullPointerException - if key is nullpublic static <K1,V1> BasicTopoNode<K1,V1> createWithDependencies(K1 key, V1 value, K1... dependencies)
value identified by key key with an initial set of dependencies
defined by argument dependencies.K1 - type of key (usually identifier) of the sorted itemV1 - type of sorted itemkey - key of the sorted itemvalue - sorted itemdependencies - array of keys of items that are prerequisities for the item valueNullPointerException - if key is nullpublic K getTopoKey()
TopoNodegetTopoKey in interface TopoNode<K,V>public V getValue()
TopoNodepublic final Set<K> getRemainingTopoDependencies()
TopoNode
Provided that the sorted item represented by this
node depends on nodes A, B, C, that have
their respective keys Ak, Bk, Ck, this
method initially returs a set of (Ak, Bk, Ck).
During processing of topological sorting algorithm, the returned set will be modified; unless a cycle is detected, at the end of the algorithm this set will be empty.
Notice that the returned set must be mutable. This implies
that an instance of TopoNode may not be used in two invocations
of topological sorting.
getRemainingTopoDependencies in interface TopoNode<K,V>public int hashCode()
public boolean equals(Object obj)
TopoNode
that has a key equal to the key of this node.public String toString()
protected void setDependencies(Collection<? extends K> deps)
deps - collection of keys of item that are prerequisities
for the item represented by this nodeCopyright © 2014 Boleslav Bobcik - Auderis. All rights reserved.