cz.cuni.mff.mirovsky.trees
Class Attribute

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

public class Attribute
extends java.lang.Object

Class Attribute keeps general properties of an attribute of nodes in trees.


Constructor Summary
Attribute()
          Creates an attribute with default properties.
Attribute(java.lang.String p_name)
          Creates an attribute with a given name and default properties.
Attribute(java.lang.String p_name, int p_type)
          Creates an attribute with given properties.
Attribute(java.lang.String p_name, int p_type, java.lang.String p_values)
          Creates an attribute with given properties.
Attribute(java.lang.String p_name, int p_type, java.lang.String p_values, boolean p_displayed)
          Creates an attribute with given properties.
Attribute(java.lang.String p_name, int p_type, java.lang.String p_values, boolean p_displayed, java.awt.Color p_color)
          Creates an attribute with given properties.
 
Method Summary
 Attribute getClone()
          Returns a deep copy of the Attribute
 java.awt.Color getColor()
          Returns the color in which the attribute should be displayd in the trees.
 boolean getDisplayed()
          Returns true iff the attribute should be displayed in the trees.
 javax.swing.DefaultListModel getListOfValues()
          Gets a list of possible values for this attribute.
 java.lang.String getName()
          Returns the name of the attribute.
 int getType()
          Returns the type of the attribute.
 java.lang.String getValue()
          Returns the value of the attribute.
 java.lang.String getValues()
          Returns possible values of the attribute (space-separated).
 void setColor(java.awt.Color p_color)
          Sets the color in which the attribute should be displayd in the trees.
 void setDisplayed(boolean p_displayed)
          Sets if the attribute should be displayed in trees.
 void setName(java.lang.String p_name)
          Sets the name of the attribute.
 void setValue(java.lang.String p_value)
          Sets the value of the attribute.
 java.lang.String toFSString()
          Returns the FS representation of the attribute for the FS head.
 java.lang.String toFSString(boolean[] set_attributes)
          Returns the FS representation of the attribute for the FS head.
 java.lang.String toString()
          Returns the String representation of the attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attribute

public Attribute()
Creates an attribute with default properties.


Attribute

public Attribute(java.lang.String p_name)
Creates an attribute with a given name and default properties.

Parameters:
p_name - the name of the attribute

Attribute

public Attribute(java.lang.String p_name,
                 int p_type)
Creates an attribute with given properties.

Parameters:
p_name - the name of the attribute
p_type - a type of the attribute. Individual bits have the following meaning:
    1 - P (positional)
    2 - O (obligatory)
    4 - N (numeric attribute - controls the order of nodes in the tree from left to right; can only be set once in the head
    8 - V (value attribute - the sentence belonging to the tree is assembled from values of this attribute; can only be set once in the head
    16 - L (list attribute - all its possible values are listed in the head)
    32 - W (word order attribute - the order of tokens in the sentence is controlled by this attribute)
    64 - H (hidden - marks hidden nodes; can only be set once in the head)
    128 - first of bits controlling the way of displaying the attribute; is not used in Netgraph

some values have a special meaning:
    0 - K (key attribute - not used in Netgraph; can only be set once in the head)


Attribute

public Attribute(java.lang.String p_name,
                 int p_type,
                 java.lang.String p_values)
Creates an attribute with given properties.

Parameters:
p_name - the name of the attribute
p_type - a type of the attribute. Individual bits have the following meaning:
    1 - P (positional)
    2 - O (obligatory)
    4 - N (numeric attribute - controls the order of nodes in the tree from left to right; can only be set once in the head
    8 - V (value attribute - the sentence belonging to the tree is assembled from values of this attribute; can only be set once in the head
    16 - L (list attribute - all its possible values are listed in the head)
    32 - W (word order attribute - the order of tokens in the sentence is controlled by this attribute)
    64 - H (hidden - marks hidden nodes; can only be set once in the head)
    128 - first of bits controlling the way of displaying the attribute; is not used in Netgraph

some values have a special meaning:
    0 - K (key attribute - not used in Netgraph; can only be set once in the head)

p_values - possible values of the attribute, separated by a space

Attribute

public Attribute(java.lang.String p_name,
                 int p_type,
                 java.lang.String p_values,
                 boolean p_displayed)
Creates an attribute with given properties.

Parameters:
p_name - the name of the attribute
p_type - a type of the attribute. Individual bits have the following meaning:
    1 - P (positional)
    2 - O (obligatory)
    4 - N (numeric attribute - controls the order of nodes in the tree from left to right; can only be set once in the head
    8 - V (value attribute - the sentence belonging to the tree is assembled from values of this attribute; can only be set once in the head
    16 - L (list attribute - all its possible values are listed in the head)
    32 - W (word order attribute - the order of tokens in the sentence is controlled by this attribute)
    64 - H (hidden - marks hidden nodes; can only be set once in the head)
    128 - first of bits controlling the way of displaying the attribute; is not used in Netgraph

some values have a special meaning:
    0 - K (key attribute - not used in Netgraph; can only be set once in the head)

p_values - possible values of the attribute, separated by a space
p_displayed - says if the attribute should be displayed at nodes in the tree

Attribute

public Attribute(java.lang.String p_name,
                 int p_type,
                 java.lang.String p_values,
                 boolean p_displayed,
                 java.awt.Color p_color)
Creates an attribute with given properties.

Parameters:
p_name - the name of the attribute
p_type - a type of the attribute. Individual bits have the following meaning:
    1 - P (positional)
    2 - O (obligatory)
    4 - N (numeric attribute - controls the order of nodes in the tree from left to right; can only be set once in the head
    8 - V (value attribute - the sentence belonging to the tree is assembled from values of this attribute; can only be set once in the head
    16 - L (list attribute - all its possible values are listed in the head)
    32 - W (word order attribute - the order of tokens in the sentence is controlled by this attribute)
    64 - H (hidden - marks hidden nodes; can only be set once in the head)
    128 - first of bits controlling the way of displaying the attribute; is not used in Netgraph

some values have a special meaning:
    0 - K (key attribute - not used in Netgraph; can only be set once in the head)

p_values - possible values of the attribute, separated by a space
p_displayed - says if the attribute should be displayed at nodes in the tree
p_color - color of the attribute (not used in Netgraph)
Method Detail

getClone

public Attribute getClone()
Returns a deep copy of the Attribute

Returns:
a deep copy of the Attribute

toFSString

public java.lang.String toFSString()
Returns the FS representation of the attribute for the FS head.

Returns:
the FS representation of the attribute for the FS head

toFSString

public java.lang.String toFSString(boolean[] set_attributes)
Returns the FS representation of the attribute for the FS head.

Parameters:
set_attributes - an array of attribute types that can only be set once in the head. The array signals whether the attributes have already been set in the head. Their order is: N, V, W, H, K
Returns:
the FS representation of the attribute for the FS head

getName

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

Returns:
the name of the attribute

setName

public void setName(java.lang.String p_name)
Sets the name of the attribute.

Parameters:
p_name - the name of the attribute

getType

public int getType()
Returns the type of the attribute.

Returns:
the type of the attribute

getValues

public java.lang.String getValues()
Returns possible values of the attribute (space-separated).

Returns:
possible values of the attribute (space-separated) or null if they have not been set

getValue

public java.lang.String getValue()
Returns the value of the attribute. It is used in the list of values of attributes of the selected node.

Returns:
the value of the attribute

setValue

public void setValue(java.lang.String p_value)
Sets the value of the attribute. It is used in the list of values of attributes of the selected node.

Parameters:
p_value - the value of the attribute

getDisplayed

public boolean getDisplayed()
Returns true iff the attribute should be displayed in the trees.

Returns:
true iff the attribute should be displayed in the trees

getColor

public java.awt.Color getColor()
Returns the color in which the attribute should be displayd in the trees. It is not used in Netgraph.

Returns:
the color

setColor

public void setColor(java.awt.Color p_color)
Sets the color in which the attribute should be displayd in the trees. It is not used in Netgraph.

Parameters:
p_color - the color

setDisplayed

public void setDisplayed(boolean p_displayed)
Sets if the attribute should be displayed in trees.

Parameters:
p_displayed - true iff it should be displayed

toString

public java.lang.String toString()
Returns the String representation of the attribute. Actually, it returns the name of the attribute

Overrides:
toString in class java.lang.Object
Returns:
String representation of the attribute

getListOfValues

public javax.swing.DefaultListModel getListOfValues()
Gets a list of possible values for this attribute.

Returns:
the list of possible values if they have been specified. Otherwise returns null.