1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

Add a nodes value to DynamicGraph.

This commit is contained in:
Cedric Beust 2015-10-12 20:20:39 -07:00
parent 44b3814d5a
commit 410b497ec2

View file

@ -104,6 +104,7 @@ public class DynamicGraph<T> : KobaltLogger {
* Add a node to the graph.
*/
public fun addNode(value: T) : T {
nodes.add(value)
nodesReady.add(value)
return value
}
@ -113,6 +114,8 @@ public class DynamicGraph<T> : KobaltLogger {
* (they will be added by this method). Makes "to" depend on "from".
*/
public fun addEdge(from: T, to: T) {
nodes.add(from)
nodes.add(to)
val fromNode = addNode(from)
val toNode = addNode(to)
dependingOn.put(toNode, fromNode)
@ -234,7 +237,7 @@ public class DynamicGraph<T> : KobaltLogger {
return result.toString();
}
val nodes : Set<T> get() = nodesReady
val nodes = hashSetOf<T>()
fun dump() : String {
val result = StringBuffer()