|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object standup.profiling.Profile standup.joke.ProfileJokeGeneration
public class ProfileJokeGeneration
A Profile
relating to joke generation. It contains:
OptionsJokeGeneration
Field Summary | |
---|---|
private String |
favouriteJokesFilename
|
private JokeSet |
favourites
A JokeSet representing the user's favourite jokes. |
static String |
FILENAME_FAVOURITE_JOKES
|
static String |
FILENAME_GENERATED_JOKE_LOG
|
private JokeSet |
generatedJokeLog
A JokeSet representing previously generated jokes. |
private String |
generatedJokeLogFilename
|
private int |
jokeIDCounter
Not a user option, but a counter of jokes generated |
static String |
XMLTAG
|
Constructor Summary | |
---|---|
ProfileJokeGeneration(File proFile)
Constructor method where the Options is supplied from an appropriate file. |
|
ProfileJokeGeneration(File dir,
Element profileElement)
|
|
ProfileJokeGeneration(File dir,
OptionsJokeGeneration opty,
int idc,
String _gjl,
String _fav)
Constructor method where the parameters are supplied directly |
Method Summary | |
---|---|
void |
addUserConstraints(JokeConstraints jcs,
JokeTypeSet allJokeTypes,
LexicalComponents lxc)
Constructs the various constraints found in this profile relating to joke generation, and adds them to the given JokeConstraints . |
OptionsJokeGeneration |
createDefaultOptions()
Returns an appropriate instance of Options with default values,
i.e. |
String |
getFavouriteJokesFilename()
|
JokeSet |
getFavourites()
|
JokeSet |
getGeneratedJokeLog()
|
String |
getGeneratedJokeLogFilename()
|
int |
getNextJokeCounter()
|
OptionsJokeGeneration |
getOptions()
Returns the Options contained within this Profile . |
void |
incrementJokeIDCounter()
|
OptionsJokeGeneration |
loadOptions(Element element)
Returns an appropriate instance of Options whose values are taken
from the given XML Element. |
void |
quickSave(File file)
This saves the ProfileGeneration XML file but *not* the associated files, i.e. |
void |
save(File file)
This saves the ProfileGeneration XML file and also saves the associated files, i.e. |
void |
saveFavourites(File dir)
|
void |
saveJokeLog(File dir)
|
boolean |
setOptions(Options incomingOptions)
Makes the given Options the one used within this Profile . |
void |
writeXML(Writer out,
String indent)
This method writes the necessary information contained within an instance to an XML file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String XMLTAG
public static final String FILENAME_GENERATED_JOKE_LOG
public static final String FILENAME_FAVOURITE_JOKES
private int jokeIDCounter
private final JokeSet generatedJokeLog
private final String generatedJokeLogFilename
private final JokeSet favourites
private final String favouriteJokesFilename
Constructor Detail |
---|
public ProfileJokeGeneration(File dir, OptionsJokeGeneration opty, int idc, String _gjl, String _fav)
proFile
- public ProfileJokeGeneration(File dir, Element profileElement)
public ProfileJokeGeneration(File proFile)
proFile
- Method Detail |
---|
public OptionsJokeGeneration getOptions()
Profile
Options
contained within this Profile
. It
might be useful to override this method to return the options cast as the
appropriate specific Options
subclass.
getOptions
in class Profile
public boolean setOptions(Options incomingOptions)
Profile
Options
the one used within this Profile
.
Always returns true
. Override this method to do validation that
the given Options
is indeed appropriate for the particular
subclass of Profile
.
setOptions
in class Profile
public void addUserConstraints(JokeConstraints jcs, JokeTypeSet allJokeTypes, LexicalComponents lxc)
JokeConstraints
.
It currently handles the following constraints:
JokeConstraintTypes
: Used joke typesJokeConstraintAllowedSchemas
: Allowed schemasInstantiationConstraintFLevel
: Minimum keyword F-levelInstantiationConstraintAmbiguity
: Allowable keyword
ambiguityInstantiationConstraintPhoneticSimilarity
: Minimum phonetic
similarity ratingInstantiationConstraintNovelty
is not handled
here, as this method is intended for both new and old jokes. If it was
added here, no old jokes would ever be retrieved!
jcs
- the JokeConstraints
that is to contain the various
user constraintsallJokeTypes
- a JokeTypeSet
containing all known JokeType
s --
required for the construction of JokeConstraintTypes
public void writeXML(Writer out, String indent) throws IOException, XMLException
XMLizable
out
- The output stream for the XML file, which is assumed to be
already opened and writable.indent
- A string to be prepended before every line written by this
method. If passed appropriate white space, e.g.
XMLUtils.xmlIndent
, it can be used to control
indentation.
IOException
XMLException
public int getNextJokeCounter()
public void incrementJokeIDCounter()
public String getGeneratedJokeLogFilename()
public JokeSet getGeneratedJokeLog()
public void saveJokeLog(File dir)
public String getFavouriteJokesFilename()
public JokeSet getFavourites()
public void saveFavourites(File dir)
public void quickSave(File file) throws XMLException
quickSave
in class Profile
file
- File where this ProfileGeneration is to be saved.
XMLException
public void save(File file) throws XMLException
file
- File where this ProfileGeneration is to be saved.
XMLException
public OptionsJokeGeneration createDefaultOptions() throws ProfileException
Profile
Options
with default values,
i.e. those contained with the default options package (see
ProfileManager.getDefaultOptionsPackage()
).
createDefaultOptions
in class Profile
ProfileException
public OptionsJokeGeneration loadOptions(Element element)
Profile
Options
whose values are taken
from the given XML Element.
loadOptions
in class Profile
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |