cz.cuni.mff.mirovsky.trees
Class NGTreeHead

java.lang.Object
  extended by cz.cuni.mff.mirovsky.trees.NGTreeHead

public class NGTreeHead
extends java.lang.Object

A class representing a head of a forest. It keeps information about the attributes in the forest.


Field Summary
 int H
          an index of hide attribute in the head (counted from zero).
static java.lang.String META_ATTR_NODE_NAME
          a name of meta-attribute _name
static java.lang.String META_ATTR_OCCURRENCES
          a name of meta-attribute _#occurrences
static java.lang.String META_ATTR_OPTIONAL
          a name of meta-attribute _optional
static java.lang.String META_ATTR_OPTIONAL_TRUE
          value true of meta-attribute _optional
static java.lang.String META_ATTR_TRANSITIVE
          a name of meta-attribute _transitive
static java.lang.String META_ATTR_TRANSITIVE_EXCLUSIVE
          value exclusive of meta-attribute _transitive
static java.lang.String META_ATTR_TRANSITIVE_TRUE
          value true of meta-attribute _transitive
 int N
          an index of numerical attribute in the head (counted from zero).
static java.lang.String NODE_REFERENCE_ATTR_NAME_DELIMITER
          a character that separates first two parts of a reference
static java.lang.String NODE_REFERENCE_END
          a character that ends a reference
static java.lang.String NODE_REFERENCE_CHARACTER_ORDER_DELIMITER
          a character that separates second two parts of a reference
static java.lang.String NODE_REFERENCE_CHARACTER_ORDER_UNSPECIFIED
          an unspecified character order for references.
static java.lang.String NODE_REFERENCE_START
          a character that starts a reference
 int V
          an index of value attribute in the head (counted from zero).
 int W
          an index of word order attribute in the head (counted from zero).
 
Constructor Summary
NGTreeHead(ShowMessagesAble p_mess)
          Creates a new empty head.
 
Method Summary
 void addAttribute(Attribute a)
          Adds an attribute at the end of the list of attributes
 void deleteAttributes()
          Deletes all attributes in the forest head.
 Attribute getAttribute(java.lang.String name)
          Returns an attribute with the specified name.
 Attribute getAttributeAt(int index)
          Gets an attribute at the specified position; null if there is not any like that
 NGTreeHead getClone()
          Returns a deep clone of the head.
 int getIndexOfAttribute(java.lang.String name)
          Return the index of an attribute with the specified name.
 javax.swing.DefaultListModel getModel()
          Returns a list of attributes in the head.
 javax.swing.DefaultListModel getPossibleValues(java.lang.String name)
          Returns a list of possible values for an attribute with the specified name.
 int getSize()
          Returns the number of attributes in the head.
 boolean isAttribute(java.lang.String name)
          Returns true iff an attribute with the specified name exists.
 int readTreeHead(char[] source, int start_position)
          Reads a head from an input char field.
 java.lang.String toFSString()
          Return FS representation of the head.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

META_ATTR_NODE_NAME

public static final java.lang.String META_ATTR_NODE_NAME
a name of meta-attribute _name

See Also:
Constant Field Values

META_ATTR_TRANSITIVE

public static final java.lang.String META_ATTR_TRANSITIVE
a name of meta-attribute _transitive

See Also:
Constant Field Values

META_ATTR_TRANSITIVE_TRUE

public static final java.lang.String META_ATTR_TRANSITIVE_TRUE
value true of meta-attribute _transitive

See Also:
Constant Field Values

META_ATTR_TRANSITIVE_EXCLUSIVE

public static final java.lang.String META_ATTR_TRANSITIVE_EXCLUSIVE
value exclusive of meta-attribute _transitive

See Also:
Constant Field Values

META_ATTR_OPTIONAL

public static final java.lang.String META_ATTR_OPTIONAL
a name of meta-attribute _optional

See Also:
Constant Field Values

META_ATTR_OPTIONAL_TRUE

public static final java.lang.String META_ATTR_OPTIONAL_TRUE
value true of meta-attribute _optional

See Also:
Constant Field Values

META_ATTR_OCCURRENCES

public static final java.lang.String META_ATTR_OCCURRENCES
a name of meta-attribute _#occurrences

See Also:
Constant Field Values

NODE_REFERENCE_CHARACTER_ORDER_UNSPECIFIED

public static final java.lang.String NODE_REFERENCE_CHARACTER_ORDER_UNSPECIFIED
an unspecified character order for references. The reference is to the whole value then.

See Also:
Constant Field Values

NODE_REFERENCE_START

public static final java.lang.String NODE_REFERENCE_START
a character that starts a reference

See Also:
Constant Field Values

NODE_REFERENCE_END

public static final java.lang.String NODE_REFERENCE_END
a character that ends a reference

See Also:
Constant Field Values

NODE_REFERENCE_ATTR_NAME_DELIMITER

public static final java.lang.String NODE_REFERENCE_ATTR_NAME_DELIMITER
a character that separates first two parts of a reference

See Also:
Constant Field Values

NODE_REFERENCE_CHARACTER_ORDER_DELIMITER

public static final java.lang.String NODE_REFERENCE_CHARACTER_ORDER_DELIMITER
a character that separates second two parts of a reference

See Also:
Constant Field Values

N

public int N
an index of numerical attribute in the head (counted from zero). This attribute controls the order of nodes in each tree from left to right.


V

public int V
an index of value attribute in the head (counted from zero). This attribute values the sentence is assembled from.


W

public int W
an index of word order attribute in the head (counted from zero). This attribute controls the order of tokens in the sentence.


H

public int H
an index of hide attribute in the head (counted from zero). This attribute controls whether a node is hidden or not.

Constructor Detail

NGTreeHead

public NGTreeHead(ShowMessagesAble p_mess)
Creates a new empty head.

Parameters:
p_mess - an object capable of displaying messages
Method Detail

toFSString

public java.lang.String toFSString()
Return FS representation of the head.

Returns:
FS representation of the head

getModel

public javax.swing.DefaultListModel getModel()
Returns a list of attributes in the head.

Returns:
a list of attributes in the head

getSize

public int getSize()
Returns the number of attributes in the head.

Returns:
the number of attributes in the head

getClone

public NGTreeHead getClone()
Returns a deep clone of the head.

Returns:
a deep clone of the head

addAttribute

public void addAttribute(Attribute a)
Adds an attribute at the end of the list of attributes

Parameters:
a - an attribute to be added

getAttribute

public Attribute getAttribute(java.lang.String name)
Returns an attribute with the specified name.

Parameters:
name - a name of an attribute
Returns:
an attribute with the specified name; null if there is not any like that

isAttribute

public boolean isAttribute(java.lang.String name)
Returns true iff an attribute with the specified name exists.

Parameters:
name - a name of an attribute
Returns:
true iff an attribute with the specified name exists

getAttributeAt

public Attribute getAttributeAt(int index)
Gets an attribute at the specified position; null if there is not any like that

Parameters:
index - the index of the attribute, counted from zero
Returns:
an attribute at the specified position; null if there is no such index

getIndexOfAttribute

public int getIndexOfAttribute(java.lang.String name)
Return the index of an attribute with the specified name.

Parameters:
name - a name of an attribute
Returns:
the index of an attribute with the specified name; -1 if there is not such attribute

getPossibleValues

public javax.swing.DefaultListModel getPossibleValues(java.lang.String name)
Returns a list of possible values for an attribute with the specified name.

Parameters:
name - a name of an attribute
Returns:
a list of possible values for an attribute with the specified name. If the values are not specified, returns null

readTreeHead

public int readTreeHead(char[] source,
                        int start_position)
Reads a head from an input char field.

Parameters:
source - a source for reading
start_position - the position of the first character to be read in the source
Returns:
number of read characters

deleteAttributes

public void deleteAttributes()
Deletes all attributes in the forest head.