standup.joke
Class BackendSQL
java.lang.Object
standup.joke.Backend
standup.joke.BackendSQL
- All Implemented Interfaces:
- Profileable
public class BackendSQL
- extends Backend
A subclass of Backend
that always genuinely generates new jokes.
- Author:
- Ruli Manurung
Constructor Summary |
BackendSQL()
Default constructor |
Methods inherited from class standup.joke.Backend |
addToFavourites, buildUserProfileConstraints, createProfile, getCurrentUserUsedJokeTypes, getFavouriteJokes, getGenerator, getLexicalComponents, getNewJoke, getNewJoke, getNewJoke, getNewJoke, getNewJoke, getNewJoke, getOldJokes, getOldJokes, getOldJokes, getOldJokes, getOldJokes, getOldJokes, getProfile, getProfileFilename, getRootTopic, loadProfile |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BackendSQL
public BackendSQL()
throws STANDUPSQLException,
GeneratorException
- Default constructor
- Parameters:
cla
-
- Throws:
STANDUPSQLException
GeneratorException
setProfile
public boolean setProfile(Profile profile,
boolean repeat)
- Sets this
Backend
to use the specified joke generation profile.
It also sets up the schema instantiation exclusion (temporary) tables
on the SQL database.
- Specified by:
setProfile
in interface Profileable
- Overrides:
setProfile
in class Backend
- Parameters:
profile
- the Profile
to be usedrepeat
- whether this is the first time a profile is being set for the
current user during this session
- Returns:
true
if successful, false
otherwise (e.g. if the
given profile was not an instance of
ProfileJokeGeneration
.- See Also:
Generator.setupExclusionTable(JokeSet, String)
generateNewJoke
JokeStructure generateNewJoke(String newJokeID,
JokeConstraints jcs)
- Generates a new one that satisfies the given
JokeConstraints
and
labels it with the given joke ID.
- Specified by:
generateNewJoke
in class Backend
- Parameters:
newJokeID
- the joke ID for the generated jokejcs
- the constraints on the joke to be generated
- Returns:
- a joke that satisfies
jcs
, or null
if none could
be generated - See Also:
Generator.generateJoke(String, JokeConstraints)