standup.lexicon
Class WordStruct

java.lang.Object
  extended by standup.lexicon.StructElement
      extended by standup.lexicon.WordStruct
All Implemented Interfaces:
XMLizable

public class WordStruct
extends StructElement

A structure that has a label and a sequence of StructElements, which can be one of Lexeme, WordForm, WordString or WordStruct. This enables the construction of hierarchical structures, for example:

Author:
Ruli Manurung

Field Summary
private  String label
           
private  List<? extends StructElement> structElements
           
 
Constructor Summary
WordStruct(String _l, List<? extends StructElement> _se)
          Constructor that provides the required label and list of StructElements.
 
Method Summary
 boolean equals(Object obj)
           
 WordSequence getSpelling()
          Returns the linearized surface form of this WordStruct as a WordSequence.
 List<? extends StructElement> getWordStructAsList()
          Returns the List of StructElements belonging to this WordStruct.
 int hashCode()
           
static WordStruct readXML(Element e)
          Returns an instance of a WordStruct whose contents are specified within the given XML Element.
 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

label

private final String label

structElements

private final List<? extends StructElement> structElements
Constructor Detail

WordStruct

public WordStruct(String _l,
                  List<? extends StructElement> _se)
Constructor that provides the required label and list of StructElements.

Parameters:
_l -
_se -
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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

getWordStructAsList

public List<? extends StructElement> getWordStructAsList()
Returns the List of StructElements belonging to this WordStruct.

Returns:

getSpelling

public WordSequence getSpelling()
Returns the linearized surface form of this WordStruct as a WordSequence.

Specified by:
getSpelling in class StructElement
Returns:

toString

public String toString()
Overrides:
toString in class Object

writeXML

public void writeXML(Writer out,
                     String indent)
              throws IOException,
                     XMLException
Implementation of XMLizable.writeXML(Writer, String). Writes out this WordStruct's contents in a struct tag.

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 WordStruct readXML(Element e)
Returns an instance of a WordStruct whose contents are specified within the given XML Element.

Parameters:
e -
Returns: