ooc
Class Tag

java.lang.Object
  extended byooc.Tag

public class Tag
extends java.lang.Object

Represents a tag in the XML code.


Method Summary
 boolean extending(Tag tag)
          Return true if this tag is extending the given tag.
 boolean extendingOneOrMore(java.util.Iterator tags)
           
 java.util.Iterator getAncestorIterator()
           
 java.lang.Object getAttribute(java.lang.String attributeName)
           
 java.lang.Object getAttribute(java.lang.String attributeName, Dependencies dependencies)
           
 java.lang.Object getAttribute(java.lang.String attributeName, java.lang.Object key, java.lang.Object value)
           
 boolean getAttributeBoolean(java.lang.String attributeName)
           
 boolean getAttributeBoolean(java.lang.String attributeName, Dependencies dependencies)
          Returns a parsed boolean value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).
 double getAttributeDouble(java.lang.String attributeName)
           
 double getAttributeDouble(java.lang.String attributeName, Dependencies dependencies)
          Returns a parsed double value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).
 float getAttributeFloat(java.lang.String attributeName)
           
 float getAttributeFloat(java.lang.String attributeName, Dependencies dependencies)
          Returns a parsed float value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).
 int getAttributeInteger(java.lang.String attributeName)
           
 int getAttributeInteger(java.lang.String attributeName, Dependencies dependencies)
          Returns a parsed int value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).
 java.util.Iterator getAttributeKeyIterator()
           
 java.util.List getAttributeList(java.lang.String attributeName)
           
 java.util.List getAttributeList(java.lang.String attributeName, Dependencies dependencies)
           
 long getAttributeLong(java.lang.String attributeName)
           
 long getAttributeLong(java.lang.String attributeName, Dependencies dependencies)
          Returns a parsed long value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).
 java.lang.String getAttributeRef(java.lang.String attributeName)
           
 java.lang.String getAttributeRef(TagAttribute attribute)
           
 short getAttributeShort(java.lang.String attributeName)
           
 short getAttributeShort(java.lang.String attributeName, Dependencies dependencies)
          Returns a parsed short value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).
 java.lang.String getAttributeString(java.lang.String attributeName)
           
 java.lang.String getAttributeString(java.lang.String attributeName, Dependencies dependencies)
          Returns a string using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).
 Tag getAttributeTag(java.lang.String attributeName)
           
 Tag getAttributeTag(java.lang.String attributeName, Dependencies dependencies)
          Returns a Tag using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).
 java.util.Iterator getChildIterator()
          Returns an iterator of the children of this tag.
 java.util.Iterator getChildIterator(Tag superTag)
          Returns an iterator of the children of this tag such that all retained from the iterator extends superTag.
 java.util.Iterator getChildIteratorByName(java.lang.String tagName)
          Returns an iterator with child tags such that their name is as given.
 Container getContainer()
          Returns the Container instance that this tag belong to.
 Tag getContainerTag(java.lang.String tagId)
           
 java.util.Iterator getDescendentIterator()
           
 Tag getFirstChildTag(Tag tag)
          Returns the first child tag extending the given name.
 Tag getFirstChildTagByName(java.lang.String tagName)
          Returns the first child tag with the given name.
 Tag getParentTag()
          Returns the parent tag of this tag.
 int getSourceLine()
          Returns the number of the line of the source where this tag was parsed.
 SourceTagHolder getSourceTagHolder()
          Returns the source tag holder where this tag resides.
 java.lang.String getTagId()
          Returns the value of the did attribute.
 java.lang.Object getTagInstance()
           
 java.lang.Object getTagInstance(Dependencies dependencies)
           
 java.lang.Object getTagInstance(java.lang.Object key, java.lang.Object obj)
           
 java.lang.Object getTagInstance(java.lang.Object key1, java.lang.Object obj1, java.lang.Object key2, java.lang.Object obj2)
           
 java.lang.String getTagName()
          Returns the name of the tag.
 java.lang.String getTagRef()
          Returns a reference to this tag.
 java.lang.String getText()
          Returns the text in this tag.
 boolean hasAncestorTags()
           
 boolean hasAttributeConverter(java.lang.String attributeName)
           
 boolean hasAttributeValue(java.lang.String attributeName)
           
 boolean hasChildTag(Tag superTag)
           
 boolean hasChildTagByName(java.lang.String tagName)
          Returns true if there exists a child tag with the given name, else false.
 boolean hasChildTags()
          Returns true if this tag has child tags.
 boolean hasDescendentTags()
           
 boolean hasParentTag()
          Returns true if this tag has a parent tag, else false.
 boolean isTagAbstract()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getContainer

public Container getContainer()
Returns the Container instance that this tag belong to.

Returns:
the Container instance that this tag belong to.

getSourceTagHolder

public SourceTagHolder getSourceTagHolder()
Returns the source tag holder where this tag resides.

Returns:
the source tag holder where this tag resides.

getSourceLine

public int getSourceLine()
Returns the number of the line of the source where this tag was parsed.

Returns:
the number of the line of the source where this tag was parsed.
See Also:
Source, SourceContext

getTagId

public java.lang.String getTagId()
Returns the value of the did attribute.

Returns:
the value of the did attribute.

getContainerTag

public Tag getContainerTag(java.lang.String tagId)

hasAncestorTags

public boolean hasAncestorTags()

getAncestorIterator

public java.util.Iterator getAncestorIterator()

hasDescendentTags

public boolean hasDescendentTags()

getDescendentIterator

public java.util.Iterator getDescendentIterator()

hasParentTag

public boolean hasParentTag()
Returns true if this tag has a parent tag, else false. With parent tag means the tag above this tag in the XML code.

Returns:
true if this tag has a parent tag, else false.

getParentTag

public Tag getParentTag()
Returns the parent tag of this tag. With parent tag means the tag above this tag in the XML code.

Returns:
the parent tag of this tag.
Throws:
OocException - if no parent tag exists.

getTagRef

public java.lang.String getTagRef()
Returns a reference to this tag. An example of use is String exp = "The tag "+myTag.getTagRef()+" is ..."; can give: "The tag car(def.xml:10) is ...". This means that the tag car can be found in file def.xml at row 10.

Returns:
a reference to this tag.

getAttributeRef

public java.lang.String getAttributeRef(java.lang.String attributeName)

getAttributeRef

public java.lang.String getAttributeRef(TagAttribute attribute)

getTagName

public java.lang.String getTagName()
Returns the name of the tag.

Returns:
the name of the tag.

getText

public java.lang.String getText()
Returns the text in this tag.

Returns:
the text in this tag.

isTagAbstract

public boolean isTagAbstract()

getAttribute

public java.lang.Object getAttribute(java.lang.String attributeName,
                                     java.lang.Object key,
                                     java.lang.Object value)

getAttribute

public java.lang.Object getAttribute(java.lang.String attributeName)

getAttribute

public java.lang.Object getAttribute(java.lang.String attributeName,
                                     Dependencies dependencies)

hasAttributeValue

public boolean hasAttributeValue(java.lang.String attributeName)

hasAttributeConverter

public boolean hasAttributeConverter(java.lang.String attributeName)

getAttributeKeyIterator

public java.util.Iterator getAttributeKeyIterator()

extending

public boolean extending(Tag tag)
Return true if this tag is extending the given tag. Calling this method on it self returns true.

Parameters:
tag - is a tag.
Returns:
true if given tag is extending this tag.

extendingOneOrMore

public boolean extendingOneOrMore(java.util.Iterator tags)

getAttributeList

public java.util.List getAttributeList(java.lang.String attributeName)

getAttributeList

public java.util.List getAttributeList(java.lang.String attributeName,
                                       Dependencies dependencies)

getAttributeTag

public Tag getAttributeTag(java.lang.String attributeName,
                           Dependencies dependencies)
Returns a Tag using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).

Parameters:
attributeName - is the name of the attribute.
dependencies - is a map over any objects needed to retain this attribute value.
Returns:
a string using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).

getAttributeTag

public Tag getAttributeTag(java.lang.String attributeName)

getAttributeString

public java.lang.String getAttributeString(java.lang.String attributeName,
                                           Dependencies dependencies)
Returns a string using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).

Parameters:
attributeName - is the name of the attribute.
dependencies - is a map over any objects needed to retain this attribute value.
Returns:
a string using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).

getAttributeString

public java.lang.String getAttributeString(java.lang.String attributeName)

getAttributeShort

public short getAttributeShort(java.lang.String attributeName,
                               Dependencies dependencies)
Returns a parsed short value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).

Parameters:
attributeName - is the name of the attribute.
dependencies - is a map over any objects needed to retain this attribute value.
Returns:
a parsed short value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).

getAttributeShort

public short getAttributeShort(java.lang.String attributeName)

getAttributeInteger

public int getAttributeInteger(java.lang.String attributeName,
                               Dependencies dependencies)
Returns a parsed int value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).

Parameters:
attributeName - is the name of the attribute.
dependencies - is a map over any objects needed to retain this attribute value.
Returns:
a parsed int value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).

getAttributeInteger

public int getAttributeInteger(java.lang.String attributeName)

getAttributeLong

public long getAttributeLong(java.lang.String attributeName,
                             Dependencies dependencies)
Returns a parsed long value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).

Parameters:
attributeName - is the name of the attribute.
dependencies - is a map over any objects needed to retain this attribute value.
Returns:
a parsed long value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).

getAttributeLong

public long getAttributeLong(java.lang.String attributeName)

getAttributeDouble

public double getAttributeDouble(java.lang.String attributeName,
                                 Dependencies dependencies)
Returns a parsed double value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).

Parameters:
attributeName - is the name of attribute.
dependencies - is a map over any objects needed to retain this attribute value.
Returns:
a parsed double value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).

getAttributeDouble

public double getAttributeDouble(java.lang.String attributeName)

getAttributeFloat

public float getAttributeFloat(java.lang.String attributeName,
                               Dependencies dependencies)
Returns a parsed float value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).

Parameters:
attributeName - is the name of attribute.
dependencies - is a map over any objects needed to retain this attribute value.
Returns:
a parsed float value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).

getAttributeFloat

public float getAttributeFloat(java.lang.String attributeName)

getAttributeBoolean

public boolean getAttributeBoolean(java.lang.String attributeName,
                                   Dependencies dependencies)
Returns a parsed boolean value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object). The attribute value can only be yes or no.

Parameters:
attributeName - is the name of the attribute.
dependencies - is a map over any objects needed to retain this attribute value.
Returns:
a parsed boolean value using method getAttribute(java.lang.String, java.lang.Object, java.lang.Object).
Throws:
OocException - if attribute does not exist or contain anything else then yes or no.

getAttributeBoolean

public boolean getAttributeBoolean(java.lang.String attributeName)

hasChildTags

public boolean hasChildTags()
Returns true if this tag has child tags.

Returns:
true if this tag has child tags.

getChildIteratorByName

public java.util.Iterator getChildIteratorByName(java.lang.String tagName)
Returns an iterator with child tags such that their name is as given.

Parameters:
tagName - is the name of the tags returned.
Returns:
a iterator with child tags such that their name is as given.

getChildIterator

public java.util.Iterator getChildIterator(Tag superTag)
Returns an iterator of the children of this tag such that all retained from the iterator extends superTag.

Parameters:
superTag - is the super tag of all tags returned by the iterator.
Returns:
an iterator

getChildIterator

public java.util.Iterator getChildIterator()
Returns an iterator of the children of this tag.

Returns:
an iterator of the children of this tag.

hasChildTagByName

public boolean hasChildTagByName(java.lang.String tagName)
Returns true if there exists a child tag with the given name, else false.

Parameters:
tagName - is the name of the tag.
Returns:
true if there exists a child tag with the given name, else false.

getFirstChildTagByName

public Tag getFirstChildTagByName(java.lang.String tagName)
Returns the first child tag with the given name.

Parameters:
tagName - is the name of the tag.
Returns:
the first child tag with the given name.
Throws:
OocException - if there does not exist a child tag with the given name.

hasChildTag

public boolean hasChildTag(Tag superTag)

getFirstChildTag

public Tag getFirstChildTag(Tag tag)
Returns the first child tag extending the given name.

Parameters:
tag - is the given tag.
Returns:
the first child tag extending the given name.
Throws:
OocException - if a child tag does not exists.

getTagInstance

public java.lang.Object getTagInstance(java.lang.Object key,
                                       java.lang.Object obj)

getTagInstance

public java.lang.Object getTagInstance(java.lang.Object key1,
                                       java.lang.Object obj1,
                                       java.lang.Object key2,
                                       java.lang.Object obj2)

getTagInstance

public java.lang.Object getTagInstance()

getTagInstance

public java.lang.Object getTagInstance(Dependencies dependencies)