standup.joke
Class InstantiationConstraintNovelty

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

public class InstantiationConstraintNovelty
extends Object
implements InstantiationConstraint

An InstantiationConstraint that constrains the Backend to only generate/retrieve a joke that does not appear in the current user's generated joke log.

Author:
Ruli Manurung

Field Summary
private  JokeSet generatedJokeLog
           
 
Constructor Summary
InstantiationConstraintNovelty(JokeSet generatedJokeLog)
           
 
Method Summary
 String getSQLConstraint(Clause clause, 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.
 void handleSchema(SQLQuerySchema schemaSQLQuery)
          Modifies the given SQLQuerySchema to reflect this constraint.
 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, toString, wait, wait, wait
 

Field Detail

generatedJokeLog

private JokeSet generatedJokeLog
Constructor Detail

InstantiationConstraintNovelty

public InstantiationConstraintNovelty(JokeSet generatedJokeLog)
Method Detail

handleSchema

public void handleSchema(SQLQuerySchema schemaSQLQuery)
Description copied from interface: InstantiationConstraint
Modifies the given SQLQuerySchema to reflect this constraint.

Specified by:
handleSchema in interface InstantiationConstraint

getSQLConstraint

public String getSQLConstraint(Clause clause,
                               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
Parameters:
clause - 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
Parameters:
j - the JokeStructure being validated
Returns:
-- true if j satisfies this constraint, false otherwise.