standup.joke
Class JokeConstraintType
java.lang.Object
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. |
type
private JokeType type
- The JokeType which the joke is required to use.
JokeConstraintType
public JokeConstraintType(JokeType _t)
- Constructor must provide the JokeType.
- Parameters:
_t
- the
- joke type
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