javatools.datatypes
Class PQRTree<E>

java.lang.Object
  extended by javatools.datatypes.PQRTree<E>
All Implemented Interfaces:
java.lang.Iterable<E>

public class PQRTree<E>
extends java.lang.Object
implements java.lang.Iterable<E>

This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools). It is licensed under the Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0) by the YAGO-NAGA team (see http://mpii.de/yago-naga). This class implements the datastructure of PQR trees


Nested Class Summary
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.
 
Constructor Summary
PQRTree(java.util.Collection<E> elements)
          Constructs a PQR tree with initial leaves
PQRTree(E... elements)
          Constructs a PQR tree with initial leaves
 
Method Summary
 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()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PQRTree

public PQRTree(java.util.Collection<E> elements)
Constructs a PQR tree with initial leaves


PQRTree

public PQRTree(E... elements)
Constructs a PQR tree with initial leaves

Method Detail

isSolveable

public boolean isSolveable()
Says whether the the tree has no R-node


addConstraint

public boolean addConstraint(E... elements)
Adds a constraint


addConstraint

public boolean addConstraint(java.util.Collection<E> elements)
Adds a constraint. FALSE if an R node was introduced


iterator

public PeekIterator<E> iterator()
Iterates over the leaves in the right order

Specified by:
iterator in interface java.lang.Iterable<E>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Test method

Throws:
java.lang.Exception