edu.buffalo.nsf.xmlcqa.data.dtd
Class Tag

java.lang.Object
  extended byedu.buffalo.nsf.xmlcqa.data.dtd.NDFA
      extended byedu.buffalo.nsf.xmlcqa.data.dtd.RegExpr
          extended byedu.buffalo.nsf.xmlcqa.data.dtd.Tag
All Implemented Interfaces:
Constants

public final class Tag
extends RegExpr

Class representing tag label of a document. It's assumed that the number of all tags processed by the system is small enought to be stored in memeory at any time. Therefore we use exactly one object to represent the same labels and comparison of two objects of this class can be done by simple pointer comparison. Also, we identify this object with an integer idetifier. Tags can be accessed using two methods: get(String tagName) and getTag(int tagID). The number of currenty known tags can be obtained with getCount() method. Tags are number with consequitive integers starting with 0. It is important to realize that if new, previously unknown tags are being created between two calls to the method getCount(), then the returned values will be different. Therefore it is advised to create in advance all tags that are expected to be used, so that after this process the method getCount() resturns a constant value.

A tag is also a regular expression specifying only one word: the word consisting of only the tag's name (accssesible with getName()).

Author:
staworko

Field Summary
protected  int hash
           
 int ID
          A field storing identifier of the tag.
protected  java.lang.String name
           
static Tag PCDATA_TAG
          A constant tag used to label text nodes in the input document.
protected static java.util.List tagList
          A list of currently known tags.
protected static java.util.Map tags
          A map between names of already created tags and thier instantions.
 
Fields inherited from class edu.buffalo.nsf.xmlcqa.data.dtd.NDFA
EPSILON
 
Fields inherited from interface edu.buffalo.nsf.xmlcqa.Constants
INF
 
Constructor Summary
protected Tag(java.lang.String name, int ID)
           
 
Method Summary
protected  void _fillDelta(boolean[][][] delta, int offset)
          Used to fill tag driven part of the transition table of a regular expression whose position if relative to offset.
protected  void _fillEpsilonDelta(boolean[][] delta, int offset)
          Used to fill epsilon part of the transition talbe of a regular expressio whose possition is relative to offset.
protected  void _fillFinalStates(boolean[] f, int offset)
          Used to indicate final states of a regular expression whose position is relative to offset.
protected  int _getStateCount()
          Should return the number of states the implementation is using.
 int _hashCode()
           
static Tag get(java.lang.String tagName)
          A method used to obtain a Tag instance with a given name.
static int getCount()
           
 java.lang.String getName()
          Returns the name of the tag.
static Tag getTag(int tagID)
          A method used to obtain a Tag of a given identifier.
 int hashCode()
          Returns the hash code value for this tag.
 java.lang.String toString()
          Returns the string representation of this resulr expression.
 
Methods inherited from class edu.buffalo.nsf.xmlcqa.data.dtd.RegExpr
getDelta, getEpsilonDelta, getFinalStates, getFstIndTrDelta, getFstTagTrDelta, getMinCostDelta, getStateCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

hash

protected int hash

ID

public final int ID
A field storing identifier of the tag. This field is final and therefore is unmodifiable.


name

protected java.lang.String name

PCDATA_TAG

public static Tag PCDATA_TAG
A constant tag used to label text nodes in the input document.


tagList

protected static java.util.List tagList
A list of currently known tags. Facilitates fast access to a tag with a given identifier.


tags

protected static java.util.Map tags
A map between names of already created tags and thier instantions.

Constructor Detail

Tag

protected Tag(java.lang.String name,
              int ID)
Method Detail

_fillDelta

protected void _fillDelta(boolean[][][] delta,
                          int offset)
Description copied from class: RegExpr
Used to fill tag driven part of the transition table of a regular expression whose position if relative to offset. The implementing class doesn't have indicate transitions obtained in a consequence of clousure under epsilon transition. This clousure will be computed automatically by this class.

Specified by:
_fillDelta in class RegExpr

_fillEpsilonDelta

protected void _fillEpsilonDelta(boolean[][] delta,
                                 int offset)
Description copied from class: RegExpr
Used to fill epsilon part of the transition talbe of a regular expressio whose possition is relative to offset. The implementing class doesn't have indicate transitions obtained in the consequence of the clousure. This clousure will be computed by this class.

Specified by:
_fillEpsilonDelta in class RegExpr

_fillFinalStates

protected void _fillFinalStates(boolean[] f,
                                int offset)
Description copied from class: RegExpr
Used to indicate final states of a regular expression whose position is relative to offset.

Specified by:
_fillFinalStates in class RegExpr

_getStateCount

protected int _getStateCount()
Description copied from class: RegExpr
Should return the number of states the implementation is using. This method will be executed only once and its result stored and returned with each call of RegExpr.getStateCount() method (memoization).

Specified by:
_getStateCount in class RegExpr

_hashCode

public int _hashCode()

get

public static Tag get(java.lang.String tagName)
A method used to obtain a Tag instance with a given name. If such a tag is not known, it's being created and stored.


getCount

public static int getCount()

getName

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


getTag

public static Tag getTag(int tagID)
A method used to obtain a Tag of a given identifier. If the tagID is greater than the number of currently known tags a ArrayIndexOutOfBoundsException will be thrown.


hashCode

public int hashCode()
Returns the hash code value for this tag. This value is equal to the hash code value of the tag's name.


toString

public java.lang.String toString()
Returns the string representation of this resulr expression.