standup.lexicon
Class WordSequence

java.lang.Object
  extended by standup.lexicon.WordSequence
All Implemented Interfaces:
Serializable, Comparable, XMLizable

public class WordSequence
extends Object
implements XMLizable, Comparable, Serializable

Unsurprisingly, a sequence of words. More specifically, contains a Listof WordStrings. A WordSequence is used to represent the orthographic spelling of a Lexeme or a WordForm, or any other span of text.

Author:
Ruli Manurung
See Also:
Serialized Form

Field Summary
private  List<WordString> seq
          A List of WordStrings.
private static long serialVersionUID
           
 
Constructor Summary
WordSequence()
          Default class constructor creates an empty WordSequence.
WordSequence(List<WordString> _seq)
          Constructor which creates a WordSequence containing the given WordStrings.
WordSequence(String ortho)
          Constructs a WordSequence from the given String by splitting it into separate WordStrings using possible separator characters ' ', '_', and '-'.
 
Method Summary
 void add(String string)
          Append a String to the end of this WordSequence.
 void add(WordSequence _w)
          Append a WordSequence to the end of this WordSequence.
 void add(WordString _w)
          Append a WordString to the end of this WordSequence.
 int compareTo(Object arg0)
           
 boolean equals(Object obj)
           
 List<WordString> getList()
          Return the List of WordStrings in this WordSequence.
 int hashCode()
           
static WordSequence readXML(Element e)
          Returns an instance of a WordSequence whose contents are specified within the given XML Element.
private  List<WordString> splitString(String string)
          Splites the given String into separate WordStrings using possible separator characters ' ', '_', and '-'.
 String toString()
           
 void writeXML(Writer out, String indent)
          Implementation of XMLizable.writeXML(Writer, String).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

seq

private final List<WordString> seq
A List of WordStrings.

Constructor Detail

WordSequence

public WordSequence()
Default class constructor creates an empty WordSequence.


WordSequence

public WordSequence(List<WordString> _seq)
Constructor which creates a WordSequence containing the given WordStrings.

Parameters:
_seq -

WordSequence

public WordSequence(String ortho)
Constructs a WordSequence from the given String by splitting it into separate WordStrings using possible separator characters ' ', '_', and '-'.

Parameters:
ortho -
Method Detail

splitString

private List<WordString> splitString(String string)
Splites the given String into separate WordStrings using possible separator characters ' ', '_', and '-'.

Parameters:
string - the String to be split
Returns:

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

compareTo

public int compareTo(Object arg0)
Specified by:
compareTo in interface Comparable

toString

public String toString()
Overrides:
toString in class Object

add

public void add(String string)
Append a String to the end of this WordSequence. It may be split into separate WordStrings using possible separator characters ' ', '_', and '-'.

Parameters:
string -

add

public void add(WordString _w)
Append a WordString to the end of this WordSequence.

Parameters:
_w -

add

public void add(WordSequence _w)
Append a WordSequence to the end of this WordSequence.

Parameters:
_w -

getList

public List<WordString> getList()
Return the List of WordStrings in this WordSequence.

Returns:

writeXML

public void writeXML(Writer out,
                     String indent)
              throws IOException,
                     XMLException
Implementation of XMLizable.writeXML(Writer, String). Writes out this WordSequence's contents in a wordseq tag, e.g.
   <wordseq>
    <string>what</string>
    <string>do</string>
    <string>you</string>
    <string>call</string>
   </wordseq>
 

Specified by:
writeXML in interface XMLizable
Parameters:
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.
Throws:
IOException
XMLException

readXML

public static WordSequence readXML(Element e)
Returns an instance of a WordSequence whose contents are specified within the given XML Element.

Parameters:
e -
Returns: