csPartialOrder< T > Class Template Reference
A generic finite partial order class. More...
#include <csutil/partialorder.h>
Public Member Functions | |
void | Add (const T &node) |
Add a node. If the node is already present, has no effect. | |
bool | AddOrder (const T &node1, const T &node2) |
Add an ordering constraint (node1 precedes node2). | |
void | ClearMark () |
Clear all "marked" flags. | |
void | ClearMark (const T &node) |
Clear the "marked" flag for a given node. | |
bool | Contains (const T &node) |
Query a node's presence. | |
csPartialOrder (const csPartialOrder *other) | |
Copy constructor. | |
csPartialOrder (const csPartialOrder &other) | |
Copy constructor. | |
csPartialOrder () | |
Create a partial order graph. | |
void | Delete (const T &node) |
Delete a node and all edges connected to it. | |
void | DeleteOrder (const T &node1, const T &node2) |
Remove an ordering constraint (node1 precedes node2). | |
const T | GetByIndex (size_t i) |
Return a node with a given index (0 through Size()-1). | |
const T | GetEnabled (T fail) |
Return an enabled node. | |
bool | HasEnabled () |
Return true if any node is enabled. | |
bool | IsEnabled (const T &node) |
Return true if all of the node's (zero or more) predecessors have been marked and the node itself has not. | |
bool | IsMarked (const T &node) |
Query whether a given node is "marked". | |
void | Mark (const T &node) |
Set the "marked" flag for a given node. | |
size_t | Size () |
Number of nodes in the graph. | |
void | Solve (csList< const T > &result) |
Produce a valid "solution" to the partial order graph, i.e., a sequence of nodes that violates no constraints. | |
Protected Member Functions | |
bool | CycleTest (const T &node) |
bool | InternalCycleTest (size_t n) |
bool | InternalCycleTest (size_t n1, size_t n2) |
bool | InternalIsEnabled (size_t i) |
void | SanityCheck () |
Protected Attributes | |
csHash< size_t, const T > | NodeMap |
csArray< Node > | Nodes |
Classes | |
class | Node |
Detailed Description
template<class T>
class csPartialOrder< T >
A generic finite partial order class.
A finite partial order is a graph with the following properties:
- A finite number of nodes (of type T).
- A finite number of reflexive tuple relations T1 <= T2.
- An absense of any non-trivial cycles, e.g., T1 < T2 < T1 where T1!=T2.
An insert of an edge which violates the third constraint will fail (return false and have no effect).
There must be a csHashComputer for type T.
Definition at line 51 of file partialorder.h.
Constructor & Destructor Documentation
|
Create a partial order graph.
Definition at line 77 of file partialorder.h. |
|
Copy constructor.
Definition at line 84 of file partialorder.h. |
|
Copy constructor.
Definition at line 91 of file partialorder.h. |
Member Function Documentation
|
Add a node. If the node is already present, has no effect.
Definition at line 98 of file partialorder.h. |
|
Add an ordering constraint (node1 precedes node2). Edge addition is not idempotent, i.e., if you add an edge three times, it must be removed three times before it will disappear from the graph. Definition at line 173 of file partialorder.h. |
|
Clear all "marked" flags.
Definition at line 303 of file partialorder.h. |
|
Clear the "marked" flag for a given node.
Definition at line 293 of file partialorder.h. |
|
Query a node's presence.
Definition at line 109 of file partialorder.h. |
|
Delete a node and all edges connected to it.
Definition at line 115 of file partialorder.h. |
|
Remove an ordering constraint (node1 precedes node2).
Definition at line 200 of file partialorder.h. |
|
Return a node with a given index (0 through Size()-1).
Definition at line 219 of file partialorder.h. |
|
Return an enabled node.
Definition at line 338 of file partialorder.h. |
|
Return true if any node is enabled.
Definition at line 325 of file partialorder.h. |
|
Return true if all of the node's (zero or more) predecessors have been marked and the node itself has not.
Definition at line 315 of file partialorder.h. |
|
Query whether a given node is "marked".
Definition at line 283 of file partialorder.h. |
|
Set the "marked" flag for a given node. This is useful for implementing your own graph iterators. Definition at line 273 of file partialorder.h. |
|
Number of nodes in the graph.
Definition at line 213 of file partialorder.h. |
|
Produce a valid "solution" to the partial order graph, i.e., a sequence of nodes that violates no constraints.
Definition at line 228 of file partialorder.h. |
The documentation for this class was generated from the following file:
- csutil/partialorder.h
Generated for Crystal Space by doxygen 1.4.6