public class PQRTree<E>
extends java.lang.Object
implements java.lang.Iterable<E>
| Modifier and Type | Class and Description |
|---|---|
static class |
PQRTree.Color
Types of node colors.
|
class |
PQRTree.Leaf
A node that has a value
|
class |
PQRTree.Node
Represents a PQR Tree node
|
static class |
PQRTree.NodeType
Node types.
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
currentConstraintSetId
Id of the constraint set for which we are currently working
|
protected boolean |
hasRNode
TRUE if the tree has an R-node (and is thus unsolveable)
|
protected java.util.Map<E,PQRTree.Leaf> |
leafMap
Serves to find out where an element is in the tree
|
protected PQRTree.Node |
root
Holds the root of the tree
|
| Constructor and Description |
|---|
PQRTree(java.util.Collection<E> elements)
Constructs a PQR tree with initial leaves
|
PQRTree(E... elements)
Constructs a PQR tree with initial leaves
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addConstraint(java.util.Collection<E> elements)
Adds a constraint.
|
boolean |
addConstraint(E... elements)
Adds a constraint
|
boolean |
isSolveable()
Says whether the the tree has no R-node
|
PeekIterator<E> |
iterator()
Iterates over the leaves in the right order
|
static void |
main(java.lang.String[] args)
Test method
|
java.lang.String |
toString() |
protected java.util.Map<E,PQRTree.Leaf> leafMap
protected boolean hasRNode
protected PQRTree.Node root
protected int currentConstraintSetId
public PQRTree(java.util.Collection<E> elements)
public PQRTree(E... elements)
public boolean isSolveable()
public boolean addConstraint(E... elements)
public boolean addConstraint(java.util.Collection<E> elements)
public PeekIterator<E> iterator()
iterator in interface java.lang.Iterable<E>public java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception