standup.joke
Class JokeConstraintAllowedSchemas

java.lang.Object
  extended by standup.joke.JokeConstraintAllowedSchemas
All Implemented Interfaces:
JokeConstraint

public class JokeConstraintAllowedSchemas
extends Object
implements JokeConstraint

A JokeConstraint that constrains a joke to use one from a given set of Schemas.

Author:
Ruli Manurung

Field Summary
private  List<String> schemaLabels
           
 
Constructor Summary
JokeConstraintAllowedSchemas(List<String> l)
          Constructor that provides the labels of the allowed schemas
 
Method Summary
 List<SchemaTemplatePair> pruneSchemas(List<SchemaTemplatePair> masterSTPs)
           
 String toString()
           
 boolean validate(JokeStructure j)
          Returns true if the given JokeStructure satisfies this constraint, and false if not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

schemaLabels

private final List<String> schemaLabels
Constructor Detail

JokeConstraintAllowedSchemas

public JokeConstraintAllowedSchemas(List<String> l)
Constructor that provides the labels of the allowed schemas

Parameters:
l -
Method Detail

validate

public boolean validate(JokeStructure j)
Description copied from interface: JokeConstraint
Returns true if the given JokeStructure satisfies this constraint, and false if not.

Specified by:
validate in interface JokeConstraint
Parameters:
j - the JokeStructure being validated
Returns:
-- true if j satisfies this constraint, false otherwise.

pruneSchemas

public List<SchemaTemplatePair> pruneSchemas(List<SchemaTemplatePair> masterSTPs)

toString

public String toString()
Overrides:
toString in class Object