OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library dependency_graph; | 5 library dependency_graph; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'utils.dart'; | 8 import 'utils.dart'; |
9 | 9 |
10 /* | 10 /* |
11 * [Graph] represents a datastructure for representing an DAG (directed acyclic | 11 * [Graph] represents a datastructure for representing an DAG (directed acyclic |
12 * graph). Each node in the graph is in a given [NodeState] and can have data | 12 * graph). Each node in the graph is in a given [NodeState] and can have data |
13 * attachted to it with [Node.userData]. | 13 * attached to it with [Node.userData]. |
14 * | 14 * |
15 * It's interface consists basically of these methods: | 15 * It's interface consists basically of these methods: |
16 * - newNode: Adds a new node to the graph with the given dependencies and | 16 * - newNode: Adds a new node to the graph with the given dependencies and |
17 * the given user data. The node is in the [NodeState.Initialized] | 17 * the given user data. The node is in the [NodeState.Initialized] |
18 * state. | 18 * state. |
19 * - changeState: Changes the state of a node. | 19 * - changeState: Changes the state of a node. |
20 * - sealGraph: Makes the graph immutable. | 20 * - sealGraph: Makes the graph immutable. |
21 * - stateCount: Counts the number of nodes who are in a given [NodeState]. | 21 * - stateCount: Counts the number of nodes who are in a given [NodeState]. |
22 * | 22 * |
23 * Users of a [Graph] can listen for events by subscribing to the [events] | 23 * Users of a [Graph] can listen for events by subscribing to the [events] |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 NodeAddedEvent(this.node); | 137 NodeAddedEvent(this.node); |
138 } | 138 } |
139 | 139 |
140 class StateChangedEvent extends GraphEvent { | 140 class StateChangedEvent extends GraphEvent { |
141 final Node node; | 141 final Node node; |
142 final NodeState from; | 142 final NodeState from; |
143 final NodeState to; | 143 final NodeState to; |
144 | 144 |
145 StateChangedEvent(this.node, this.from, this.to); | 145 StateChangedEvent(this.node, this.from, this.to); |
146 } | 146 } |
OLD | NEW |