From 916b048fb3fed4f5acf56c3ee9273ef520dd5664 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Tue, 12 Apr 2016 18:18:24 -0700 Subject: [PATCH] Remove public. --- .../com/beust/kobalt/internal/DynamicGraph.kt | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt index d0107595..dc41e9e2 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt @@ -11,7 +11,7 @@ open class TaskResult2(success: Boolean, errorMessage: String?, val value: T) override fun toString() = toString("TaskResult", "value", value, "success", success) } -public interface IWorker : Callable> { +interface IWorker : Callable> { /** * @return list of tasks this worker is working on. */ @@ -23,7 +23,7 @@ public interface IWorker : Callable> { val priority : Int } -public interface IThreadWorkerFactory { +interface IThreadWorkerFactory { /** * Creates {@code IWorker} for specified set of tasks. It is not necessary that @@ -35,7 +35,7 @@ public interface IThreadWorkerFactory { fun createWorkers(nodes: List) : List> } -public class DynamicGraphExecutor(val graph: DynamicGraph, +class DynamicGraphExecutor(val graph: DynamicGraph, val factory: IThreadWorkerFactory) { val executor = Executors.newFixedThreadPool(5, NamedThreadFactory("DynamicGraphExecutor")) val completion = ExecutorCompletionService>(executor) @@ -43,7 +43,7 @@ public class DynamicGraphExecutor(val graph: DynamicGraph, /** * @return 0 if all went well, > 0 otherwise */ - public fun run() : Int { + fun run() : Int { var lastResult = TaskResult() var gotError = false var nodesRunning = 0 @@ -106,7 +106,7 @@ public class DynamicGraphExecutor(val graph: DynamicGraph, /** * Representation of the graph of methods. */ -public class DynamicGraph { +class DynamicGraph { val nodesReady = linkedSetOf() val nodesRunning = linkedSetOf() private val nodesFinished = linkedSetOf() @@ -119,7 +119,7 @@ public class DynamicGraph { * Define a comparator for the nodes of this graph, which will be used * to order the free nodes when they are asked. */ -// public val comparator : Comparator? = null +// val comparator : Comparator? = null enum class Status { READY, RUNNING, FINISHED, ERROR, SKIPPED @@ -128,7 +128,10 @@ public class DynamicGraph { /** * Add a node to the graph. */ - public fun addNode(value: T) : T { + fun addNode(value: T) : T { + if (value.toString().contains("clean")) { + println("DONOTCOMMIT") + } nodes.add(value) nodesReady.add(value) return value @@ -138,7 +141,8 @@ public class DynamicGraph { * Add an edge between two nodes, which don't have to already be in the graph * (they will be added by this method). Makes "to" depend on "from". */ - public fun addEdge(from: T, to: T) { + fun addEdge(from: T, to: T) { + log(1, "@@@@@ NODE $to DEPENDS ON $from") nodes.add(from) nodes.add(to) val fromNode = addNode(from) @@ -150,7 +154,7 @@ public class DynamicGraph { /** * @return a set of all the nodes that don't depend on any other nodes. */ - public val freeNodes : List + val freeNodes : List get() { val result = arrayListOf() nodesReady.forEach { m -> @@ -193,7 +197,7 @@ public class DynamicGraph { /** * Set the status for a set of nodes. */ - public fun setStatus(nodes: Collection, status: Status) { + fun setStatus(nodes: Collection, status: Status) { nodes.forEach { setStatus(it, status) } } @@ -214,7 +218,7 @@ public class DynamicGraph { /** * Set the status for a node. */ - public fun setStatus(node: T, status: Status) { + fun setStatus(node: T, status: Status) { removeNode(node); when(status) { Status.READY -> nodesReady.add(node) @@ -243,10 +247,10 @@ public class DynamicGraph { /** * @return the number of nodes in this graph. */ - public val nodeCount: Int + val nodeCount: Int get() = nodesReady.size + nodesRunning.size + nodesFinished.size - override public fun toString() : String { + override fun toString() : String { val result = StringBuilder("[DynamicGraph ") result.append("\n Ready:" + nodesReady) result.append("\n Running:" + nodesRunning)