standup.joke
Class JokeConstraintType

java.lang.Object
  extended by standup.joke.JokeConstraintType
All Implemented Interfaces:
JokeConstraint
Direct Known Subclasses:
JokeConstraintTypes

public class JokeConstraintType
extends Object
implements JokeConstraint

A JokeConstraint that constrains a joke to be of a given JokeType.

Author:
Ruli Manurung

Field Summary
private  JokeType type
          The JokeType which the joke is required to use.
 
Constructor Summary
JokeConstraintType(JokeType _t)
          Constructor must provide the JokeType.
 
Method Summary
 List<SchemaTemplatePair> getSchemaTemplatePairs()
           
 String toString()
           
 boolean validate(JokeStructure j)
          Returns true if the given joke is of the designated type, and false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

private JokeType type
The JokeType which the joke is required to use.

Constructor Detail

JokeConstraintType

public JokeConstraintType(JokeType _t)
Constructor must provide the JokeType.

Parameters:
_t -
the - joke type
Method Detail

validate

public boolean validate(JokeStructure j)
Returns true if the given joke is of the designated type, and false otherwise.

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

getSchemaTemplatePairs

public List<SchemaTemplatePair> getSchemaTemplatePairs()

toString

public String toString()
Overrides:
toString in class Object