Constraints
Class SiteConstraints

java.lang.Object
  extended by Constraints.SiteConstraints

public class SiteConstraints
extends java.lang.Object

Stores the constraints for a single site

Version:
1.0

Constructor Summary
SiteConstraints(java.util.Set<java.lang.String> allStates)
          Standard constructor that creates an object with no constraints
 
Method Summary
 void addConstraint(java.lang.String n, java.util.Set<java.lang.String> c)
          Adds a constraint
 void addConstraint(java.lang.String n, java.lang.String c)
          Adds a constraint where a node is constrained to a single state
 SiteConstraints clone()
           
 java.util.Set<java.lang.String> getConstraint(java.lang.String n)
          Gets the constraints for a node
 boolean meetsConstrains(Site s)
          Tests whether a given site (that should include data for internal nodes) meets the defined constraints
 boolean nodeIsConstrained(java.lang.String n)
          Tests whether a node has a constraint
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SiteConstraints

public SiteConstraints(java.util.Set<java.lang.String> allStates)
Standard constructor that creates an object with no constraints

Parameters:
allStates - The set of all possible states
Method Detail

addConstraint

public void addConstraint(java.lang.String n,
                          java.lang.String c)
Adds a constraint where a node is constrained to a single state

Parameters:
n - The node
c - The state it is constrained to

addConstraint

public void addConstraint(java.lang.String n,
                          java.util.Set<java.lang.String> c)
Adds a constraint

Parameters:
n - The node to add the constraint to
c - The states the node is constrained to

getConstraint

public java.util.Set<java.lang.String> getConstraint(java.lang.String n)
Gets the constraints for a node

Parameters:
n - The node to get constraints for
Returns:
The states that node is constrained to

meetsConstrains

public boolean meetsConstrains(Site s)
Tests whether a given site (that should include data for internal nodes) meets the defined constraints

Parameters:
s - The site
Returns:
Whether the constraints are met

nodeIsConstrained

public boolean nodeIsConstrained(java.lang.String n)
Tests whether a node has a constraint

Parameters:
n - The node
Returns:
Whether the node is constrained

clone

public SiteConstraints clone()
Overrides:
clone in class java.lang.Object