standup.joke
Class InstantiationConstraintLexemeSchema

java.lang.Object
  extended by standup.joke.InstantiationConstraintLexeme
      extended by standup.joke.InstantiationConstraintLexemeSchema
All Implemented Interfaces:
InstantiationConstraint, JokeConstraint

public class InstantiationConstraintLexemeSchema
extends InstantiationConstraintLexeme

An InstantiationConstraint that constrains a joke to make use of a specific Lexeme in its answer.

Author:
Ruli Manurung

Field Summary
 
Fields inherited from class standup.joke.InstantiationConstraintLexeme
lex
 
Constructor Summary
InstantiationConstraintLexemeSchema(Lexeme _lex)
           
 
Method Summary
 String getSQLConstraint(Clause s, List<SQLSelectElement> taqlsses)
          Returns an SQL code snippet that is to be appended to the WHERE clause of the SQL query when instantiating the given Clause.
 String toString()
           
 boolean validate(JokeStructure j)
          Returns true if the given JokeStructure satisfies this constraint, and false if not.
 
Methods inherited from class standup.joke.InstantiationConstraintLexeme
handleSchema
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InstantiationConstraintLexemeSchema

public InstantiationConstraintLexemeSchema(Lexeme _lex)
Method Detail

getSQLConstraint

public String getSQLConstraint(Clause s,
                               List<SQLSelectElement> taqlsses)
Description copied from interface: InstantiationConstraint
Returns an SQL code snippet that is to be appended to the WHERE clause of the SQL query when instantiating the given Clause.

Specified by:
getSQLConstraint in interface InstantiationConstraint
Overrides:
getSQLConstraint in class InstantiationConstraintLexeme
Parameters:
s - the Clause being instantiated.
Returns:
-- the String to be appended to the WHERE clause. As a contract, we require that it appear between parentheses, e.g. "(...)" for readability purposes.

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
Overrides:
validate in class InstantiationConstraintLexeme
Parameters:
j - the JokeStructure being validated
Returns:
-- true if j satisfies this constraint, false otherwise.

toString

public String toString()
Overrides:
toString in class InstantiationConstraintLexeme