|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.xml.TagContainer
public class TagContainer
This class manages tag sequences by keeping track of names and appearances of tags. It is a helper class used for XML adjustment. Instances of this class are not thread-safe.
Constructor Summary | |
---|---|
TagContainer()
Creates a new instance. |
Method Summary | |
---|---|
boolean |
contains(String tagname)
Checks whether this instance contains at least one appearance of the specified tag. |
TagConstituent |
findFirst(String tagname)
Finds the first appearance of a tag. |
TagConstituent |
findInSeries(String tagname,
int markupSeriesNo,
boolean returnFirst)
Finds the appearance of a tag within a specified markup series. |
void |
forceRemove(TagConstituent tag)
Forces the removal of a single appearance of a tag from the container. |
protected Map |
getTagMap()
Grants subclasses direct access to the map that is used internally for managing the tags. |
boolean |
isEmpty()
Whether this tag container is empty. |
void |
push(TagConstituent tag)
Inserts an appearance of a tag into the container. |
void |
push(TagConstituent tag,
boolean appendAtEnd)
Inserts an appearance of a tag into the container. |
boolean |
remove(TagConstituent tag)
Removes a single appearance of a tag from the container. |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TagContainer()
Method Detail |
---|
public boolean contains(String tagname)
tagname
- the name of the tag to check
true
iff the container contains one or more
appearances of the specified tagpublic TagConstituent findFirst(String tagname)
null
is returned instead.
tagname
- the name of the tag to check
null
if no
matching appearance was foundpublic TagConstituent findInSeries(String tagname, int markupSeriesNo, boolean returnFirst)
null
is returned instead.
tagname
- the name of the tag to checkmarkupSeriesNo
- the markup series number to matchreturnFirst
- whether to return the first or the last
appearance of the tag within the specified series, if several
appearances are found
null
if no
matching appearance was foundpublic final void forceRemove(TagConstituent tag) throws RuntimeException
tag
- the tag to remove
RuntimeException
- stating an "Implementation error" if the
specified tag appearance could not be removedpublic boolean isEmpty()
true
iff this container is empty, i.e. doesn't
contain any tagsprotected Map getTagMap()
public final void push(TagConstituent tag)
tag
- the tag to insertpublic void push(TagConstituent tag, boolean appendAtEnd) throws UnsupportedOperationException
tag
- the tag to insertappendAtEnd
- whether to insert the tag at the end or at the begin
of appearances within a series
UnsupportedOperationException
- might be thrown by child classes
that don't support prepending if appendAtEnd
is
false
public boolean remove(TagConstituent tag)
tag
- the tag to remove
true
if the specified TagConstituent was
removed successfully; false
otherwise (the specified
constituent wasn't found in the container)public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |