cz.cuni.mff.mirovsky.trees
Class ReferencePattern

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

public class ReferencePattern
extends java.lang.Object

A class for keeping one pattern of references in trees.


Field Summary
static int SHAPE_DASHES_DARC
          an arc shape - a dashed arc, curved downwards
 
Constructor Summary
ReferencePattern()
          Creates an empty pattern.
ReferencePattern(ShowMessagesAble p_mess)
          Creates an empty pattern.
 
Method Summary
 void addEndNodeIgnoreValue(java.lang.String value)
          Adds a value that should be ignored at the end node.
 void addStartNodeIgnoreValue(java.lang.String value)
          Adds a value that should be ignored at the start node.
 void addValueDependentRule(java.lang.String value, java.awt.Color color, int shape)
          Adds a rule to influence the way of displaying the reference.
 void clearEndNodeIgnoreValues()
          Clears the list of values to be ignored at the end node.
 void clearStartNodeIgnoreValues()
          Clears the list of values to be ignored at the start node.
 void clearValueDependentValues()
          Clears the rules of displaying the reference according to a value of another attribute.
 ReferencePattern getClone()
          Returns a deep copy of the reference pattern
 boolean getDisplay()
          Returns true iff the reference should be displayed.
 java.lang.String getDisplayMode()
          Returns the display mode for the reference.
 java.lang.String getEndAttrNodeName()
          Returns the name of an attribute that contains an identifier of a node refered to in the reference.
 javax.swing.DefaultListModel getEndNodeIgnoreValues()
          Returns the list of values that should be ignored at the end node.
 boolean getEndNodeNilArrow()
          Returns true iff an arrow should be displayed if no ending node matches the starting node in the actual tree.
 java.awt.Color getGeneralColor()
          Returns a general color for the reference arrow.
 int getGeneralShape()
          Returns the general shape for the reference arrow.
 java.lang.String getName()
          Returns the name of the reference pattern.
 java.lang.String getStartAttrNodeName()
          Returns the name of an attribute that can contain a reference to a node in this reference pattern.
 javax.swing.DefaultListModel getStartNodeIgnoreValues()
          Returns the list of values that should be ignored at the start node.
 boolean getStartNodeNilArrow()
          Returns true iff an arrow should be displayed if no starting node matches the ending node in the actual tree.
 java.lang.String getValueDependentAttrName()
          Returns the name of an attribute that controlls the shape and color of the reference.
 java.awt.Color getValueDependentColor(java.lang.String value)
          Gives a color to be used with a value of the value dependent attribute.
 int getValueDependentShape(java.lang.String value)
          Gives a shape to be used with a value of the value dependent attribute.
 javax.swing.DefaultListModel getValueDependentValues()
          Gets a list of all values that sets the way of displaying the reference.
 boolean changeDisplay()
          Changes the state of displaying the reference if editable.
 boolean isEditable()
          Informs whether the reference pattern allows changing its state
 void readPatternFromString(java.lang.String line)
          Reads a pattern from String.
 boolean setDisplay(boolean display)
          Sets whether the reference should be displayed (if editable).
 void setDisplayMode(java.lang.String display)
          Sets the display mode of the reference.
 void setEndAttrNodeName(java.lang.String name)
          Sets the name of an attribute that contains an identifier of a node refered to in the reference.
 void setEndNodeNilArrow(boolean display)
          Sets whether an arrow should be displayed if no ending node matches the starting node in the actual tree.
 void setGeneralColor(java.awt.Color color)
          Sets a general color for the reference arrow.
 void setGeneralShape(int shape)
          Sets a general shape for the reference arrow.
 void setName(java.lang.String name)
          Sets the name of the reference pattern.
 void setStartAttrNodeName(java.lang.String name)
          Sets the name of an attribute that can contain a reference to a node in this reference pattern.
 void setStartNodeNilArrow(boolean display)
          Sets whether an arrow should be displayed if no starting node matches the ending node in the actual tree.
 void setValueDependentAttrName(java.lang.String name)
          Sets a name of an attribute that controlls the shape and color of the reference.
 java.lang.String toString()
          Returns a String representation of the reference pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SHAPE_DASHES_DARC

public static final int SHAPE_DASHES_DARC
an arc shape - a dashed arc, curved downwards

See Also:
Constant Field Values
Constructor Detail

ReferencePattern

public ReferencePattern()
Creates an empty pattern.


ReferencePattern

public ReferencePattern(ShowMessagesAble p_mess)
Creates an empty pattern.

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

getClone

public ReferencePattern getClone()
Returns a deep copy of the reference pattern

Returns:
a deep copy of the pattern

toString

public java.lang.String toString()
Returns a String representation of the reference pattern.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of the reference pattern

setName

public void setName(java.lang.String name)
Sets the name of the reference pattern.

Parameters:
name - the name of the reference pattern

getName

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

Returns:
the name of the reference pattern

setDisplayMode

public void setDisplayMode(java.lang.String display)
Sets the display mode of the reference. The possibilities are:
VALUE_ALWAYS - the reference will not be displayed
VALUE_NEVER - the reference will be displayed
VALUE_USER_CONTROLLED_DEFAULT_YES - the visibility of the reference can be set by the user; defaultly it is displayed
VALUE_USER_CONTROLLED_DEFAULT_NO - the visibility of the reference can be set by the user; defaultly it is not displayed

Parameters:
display - the display mode

getDisplayMode

public java.lang.String getDisplayMode()
Returns the display mode for the reference.

Returns:
the display mode

setDisplay

public boolean setDisplay(boolean display)
Sets whether the reference should be displayed (if editable). If the pattern is not editable, the property is not changed.

Parameters:
display - true means that it should be displayed
Returns:
the result state of the property

getDisplay

public boolean getDisplay()
Returns true iff the reference should be displayed.

Returns:
true iff the reference should be displayed

changeDisplay

public boolean changeDisplay()
Changes the state of displaying the reference if editable.

Returns:
the resulting state

isEditable

public boolean isEditable()
Informs whether the reference pattern allows changing its state

Returns:
true if change is allowed; false otherwise

setStartNodeNilArrow

public void setStartNodeNilArrow(boolean display)
Sets whether an arrow should be displayed if no starting node matches the ending node in the actual tree.

Parameters:
display - true iff it should be displayed

getStartNodeNilArrow

public boolean getStartNodeNilArrow()
Returns true iff an arrow should be displayed if no starting node matches the ending node in the actual tree.

Returns:
true iff it should be displayed

setEndNodeNilArrow

public void setEndNodeNilArrow(boolean display)
Sets whether an arrow should be displayed if no ending node matches the starting node in the actual tree.

Parameters:
display - true iff it should be displayed

getEndNodeNilArrow

public boolean getEndNodeNilArrow()
Returns true iff an arrow should be displayed if no ending node matches the starting node in the actual tree.

Returns:
true iff it should be displayed

setStartAttrNodeName

public void setStartAttrNodeName(java.lang.String name)
Sets the name of an attribute that can contain a reference to a node in this reference pattern.

Parameters:
name - the name of the attribute

getStartAttrNodeName

public java.lang.String getStartAttrNodeName()
Returns the name of an attribute that can contain a reference to a node in this reference pattern.

Returns:
the name of the attribute

setEndAttrNodeName

public void setEndAttrNodeName(java.lang.String name)
Sets the name of an attribute that contains an identifier of a node refered to in the reference.

Parameters:
name - the name of the attribute

getEndAttrNodeName

public java.lang.String getEndAttrNodeName()
Returns the name of an attribute that contains an identifier of a node refered to in the reference.

Returns:
the name of the attribute

addStartNodeIgnoreValue

public void addStartNodeIgnoreValue(java.lang.String value)
Adds a value that should be ignored at the start node. No reference is considered to start at a node if this value is found.

Parameters:
value - the value to be ignored

clearStartNodeIgnoreValues

public void clearStartNodeIgnoreValues()
Clears the list of values to be ignored at the start node.


getStartNodeIgnoreValues

public javax.swing.DefaultListModel getStartNodeIgnoreValues()
Returns the list of values that should be ignored at the start node. No reference is considered to start at a node if one of these values is found.

Returns:
the list of values to be ignored

addEndNodeIgnoreValue

public void addEndNodeIgnoreValue(java.lang.String value)
Adds a value that should be ignored at the end node. No reference is considered to end at a node if this value is found.

Parameters:
value - the value to be ignored

clearEndNodeIgnoreValues

public void clearEndNodeIgnoreValues()
Clears the list of values to be ignored at the end node.


getEndNodeIgnoreValues

public javax.swing.DefaultListModel getEndNodeIgnoreValues()
Returns the list of values that should be ignored at the end node. No reference is considered to end at a node if one of these values is found.

Returns:
the list of values to be ignored

setGeneralColor

public void setGeneralColor(java.awt.Color color)
Sets a general color for the reference arrow.

Parameters:
color - a general color for the reference arrow

getGeneralColor

public java.awt.Color getGeneralColor()
Returns a general color for the reference arrow.

Returns:
a general color for the reference arrow

setGeneralShape

public void setGeneralShape(int shape)
Sets a general shape for the reference arrow.

Parameters:
shape - a general shape for the reference arrow

getGeneralShape

public int getGeneralShape()
Returns the general shape for the reference arrow.

Returns:
the general shape for the reference arrow

setValueDependentAttrName

public void setValueDependentAttrName(java.lang.String name)
Sets a name of an attribute that controlls the shape and color of the reference.

Parameters:
name - a name of an attribute that controlls the shape and color of the reference

getValueDependentAttrName

public java.lang.String getValueDependentAttrName()
Returns the name of an attribute that controlls the shape and color of the reference.

Returns:
the name of an attribute that controlls the shape and color of the reference

addValueDependentRule

public void addValueDependentRule(java.lang.String value,
                                  java.awt.Color color,
                                  int shape)
Adds a rule to influence the way of displaying the reference.

Parameters:
value - a value that sets a certain way of displaying the reference
color - this color will be used with the value
shape - this shape will be used with the value

getValueDependentValues

public javax.swing.DefaultListModel getValueDependentValues()
Gets a list of all values that sets the way of displaying the reference.

Returns:
the list of values

getValueDependentColor

public java.awt.Color getValueDependentColor(java.lang.String value)
Gives a color to be used with a value of the value dependent attribute. If no such rule exists, the general color is given.

Parameters:
value - String
Returns:
Color

getValueDependentShape

public int getValueDependentShape(java.lang.String value)
Gives a shape to be used with a value of the value dependent attribute. If no such rule exists, the general shape is given.

Parameters:
value - String
Returns:
int

clearValueDependentValues

public void clearValueDependentValues()
Clears the rules of displaying the reference according to a value of another attribute.


readPatternFromString

public void readPatternFromString(java.lang.String line)
Reads a pattern from String.

Parameters:
line - a pattern
Example of the String: "start_attr=coref, end_attr=AID, start_ignore= , start_ignore=null, end_ignore= , end_ignore=null, start_nill_arrow=true, end_nill_arrow=true, general_color=#231812, general_shape=1, value_depend_attr=cortype, value_depend=grammatical;#202020;0, value_depend=textual;#402010;0"