|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object standup.joke.JokeSet
public class JokeSet
This class represents a set of JokeStructure
s. It defines all
functions for manipulating sets of jokes, i.e. mutator methods:
Additionally, JokeSet
s can be loaded from/saved to XML-based files
with a .jokes
extension.
Field Summary | |
---|---|
private Set<JokeStructure> |
jokes
This Set contains the jokes themselves. |
Constructor Summary | |
---|---|
JokeSet()
|
Method Summary | |
---|---|
int |
add(JokeSet js)
|
boolean |
add(JokeStructure j)
================ ACCESSOR METHODS ================ |
boolean |
contains(JokeStructure j)
Checks whether the given Joke j is contained within this JokeSet. |
JokeSet |
duplicate()
Returns a shallow copy of this JokeSet -- but then again JokeStructures should be immutable objects so it shouldn't make a difference... |
int |
getCount()
|
JokeStructure |
getJokeByID(String id)
Returns the JokeStructure contained in this JokeSet
specified by the given id argument, or null
if no such joke is found. |
JokeSet |
getJokes(JokeConstraints jcs)
|
(package private) JokeSet |
getJokes(String schemaLabel)
This function is only used when checking schema instantiations against the generated joke log. |
Set<JokeStructure> |
getJokesAsSet()
|
JokeStructure |
getRandom()
|
boolean |
isEmpty()
|
static JokeSet |
load(File file)
|
static JokeSet |
load(URL url)
|
static JokeSet |
readXML(Element doc)
|
void |
remove(JokeSet js)
|
void |
remove(JokeStructure j)
|
JokeStructure |
removeRandom()
|
void |
save(File file)
This method saves the necessary information contained within an instance to an XML file. |
String |
toString()
|
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, wait, wait, wait |
Field Detail |
---|
private Set<JokeStructure> jokes
Constructor Detail |
---|
public JokeSet()
Method Detail |
---|
public JokeStructure getJokeByID(String id)
JokeStructure
contained in this JokeSet
specified by the given id
argument, or null
if no such joke is found.
id
-
public JokeSet duplicate()
public boolean add(JokeStructure j)
public int add(JokeSet js)
public void remove(JokeStructure j)
public void remove(JokeSet js)
public Set<JokeStructure> getJokesAsSet()
public boolean contains(JokeStructure j)
j
-
public JokeSet getJokes(JokeConstraints jcs)
JokeSet getJokes(String schemaLabel)
schemaLabel
-
public boolean isEmpty()
public int getCount()
public JokeStructure getRandom()
public JokeStructure removeRandom()
public String toString()
toString
in class Object
public void writeXML(Writer out, String indent) throws IOException, XMLException
XMLizable
writeXML
in interface 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 static JokeSet readXML(Element doc)
public void save(File file)
XMLsaveable
file
,XMLizable.writeXML(java.io.Writer, String)
, and
save
in interface XMLsaveable
file
- The file to be saved.public static JokeSet load(URL url)
public static JokeSet load(File file)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |