gate.creole.gazetteer
Class GazetteerNode

java.lang.Object
  extended by gate.creole.gazetteer.GazetteerNode

public class GazetteerNode
extends Object

A node in a gazetteer list allowing an arbitary amount of features to be added as metadata to an entry, e.g.:

With the separator set to '\t', if a gazetteer entry looked like this:

Vodaphone	type=mobile phone company

Then the GazetteerNode would consist of an entry "Vodaphone", with a featureMap containing the key "type", mapped to "mobile phone company".

Author:
JLy

Constructor Summary
GazetteerNode(String node)
          Parses and create a gazetteer node from a string using no separator, i.e.
GazetteerNode(String entry, Map featureMap)
          Constructor.
GazetteerNode(String node, String separator)
          Parses and create a gazetteer node from a string
GazetteerNode(String node, String separator, boolean isOrdered)
          Parses and create a gazetteer node from a string
 
Method Summary
 boolean equals(Object o)
          Checks this node vs another one for equality.
 String featureMapToString(Map featureMap)
          Converts a featureMap to separated name value pairs.
 String getEntry()
           
 Map getFeatureMap()
           
 String getSeparator()
           
 int hashCode()
           
 void setEntry(String entry)
           
 void setFeatureMap(Map featureMap)
           
 void setSeparator(String separator)
           
 String toString()
          Gets the string representation of this node
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GazetteerNode

public GazetteerNode(String entry,
                     Map featureMap)
Constructor. Uses the default separator.

Parameters:
entry - the gazetteer entry
featureMap - a map of name-value pairs

GazetteerNode

public GazetteerNode(String node)
Parses and create a gazetteer node from a string using no separator, i.e. the whole node is considered as the string to match, and there are no additional features.

Parameters:
node - the gazetteer node to be parsed

GazetteerNode

public GazetteerNode(String node,
                     String separator)
Parses and create a gazetteer node from a string

Parameters:
node - the gazetteer node to be parsed
separator - the separator used in the gazetteer node string to delimit each name-value pair of features. If the separator is null, then the whole node will be used as the gazetteer entry

GazetteerNode

public GazetteerNode(String node,
                     String separator,
                     boolean isOrdered)
Parses and create a gazetteer node from a string

Parameters:
node - the gazetteer node to be parsed
separator - the separator used in the gazetteer node string to delimit each name-value pair of features. If the separator is null, then the whole node will be used as the gazetteer entry
isOrdered - true if the feature maps used should be ordered
Method Detail

featureMapToString

public String featureMapToString(Map featureMap)
Converts a featureMap to separated name value pairs. Note: the string will begin with the separator character.

Parameters:
featureMap - map to be converted
Returns:
string of name/value pairs

toString

public String toString()
Gets the string representation of this node

Overrides:
toString in class Object
Returns:
the string representation of this node

equals

public boolean equals(Object o)
Checks this node vs another one for equality.

Overrides:
equals in class Object
Parameters:
o - another node
Returns:
true if the string representation of the entry and weighting match.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getEntry

public String getEntry()
Returns:
the entry

setEntry

public void setEntry(String entry)
Parameters:
entry - the entry to set

getFeatureMap

public Map getFeatureMap()
Returns:
the featureMap

setFeatureMap

public void setFeatureMap(Map featureMap)
Parameters:
featureMap - the featureMap to set

getSeparator

public String getSeparator()
Returns:
the separator

setSeparator

public void setSeparator(String separator)
Parameters:
separator - the separator to set