|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.mff.mirovsky.trees.NGTree
public class NGTree
A class containing a single tree
Field Summary | |
---|---|
static char |
MATCHING_NODES_DELIMITER
a delimiter of pairs of numbers of matching query nodes and result tree nodes. |
static char |
MATCHING_NODES_QUERY_DELIMITER
a delimiter of a number of a query node and a number of its matching result tree node. |
static char |
MATCHING_NODES_TREES_DELIMITER
a delimiter of query trees in lists of matching nodes. |
Constructor Summary | |
---|---|
NGTree(ShowMessagesAble p_mess)
Creates an empty tree |
Method Summary | |
---|---|
void |
addAttributes(int number)
It increases number of attributes at all nodes by number. |
TNode |
findNodeById(int id_index,
java.lang.String value)
Searches for a node in the tree that has a given id. |
NGTree |
getClone()
Returns a deep copy of the tree |
int |
getDepth(TNode node)
Returns the distance between the node and the root of the tree. |
int |
getFirstMatchingNodeDepthOrder(boolean count_hidden)
Searches for the depth-first order of the node in the tree that matches the root of the first tree of the query, counted from 1. |
boolean |
getFlagTreeChanged()
Says whether the tree has changed and coordinates of its nodes must be calculated. |
int |
getHeight()
Returns the height of the tree in pixels. |
TNode |
getChosenNode()
Returns the actually selected node. |
int |
getChosenNodeDepthOrder(boolean count_hidden)
Returns depth-first order of the chosen node, counted from 1. |
java.lang.String |
getId(NGTreeHead head)
Returns an id of the tree. |
TNode[] |
getNodesArray()
Returns a new array of all nodes in the tree. |
int |
getNumberOfHiddenNodes()
Returns the number of hidden nodes in the tree. |
int |
getNumberOfNodes()
Returns the total number of nodes in the tree. |
TNode |
getRoot()
Returns the root of the tree. |
java.lang.String |
getSentenceString(NGTreeHead head)
Assembles and returns the sentence belonging to the tree. |
int |
getWidth()
Returns the width of the tree in pixels. |
int |
getXStart()
Returns the x-coordinate of the top-left corner of the tree in a forest. |
int |
getYStart()
Returns the y-coordinate of the top-left corner of the tree in a forest. |
boolean |
isEmpty()
Signals whether the tree is empty |
int |
readTree(NGTreeHead head,
char[] p_source,
int start_position,
int p_number_of_attributes)
Reads a whole tree from p_source in FS format (without a head). |
void |
setFlagTreeChanged(boolean new_flag)
Signals whether the tree has changed and coordinates of its nodes must be calculated. |
void |
setHeight(int tree_height)
Sets the height of the tree in pixels. |
int |
setChosenByPosition(int x,
int y,
int dosah_mysi,
boolean allow_hidden)
Marks a node at given coordinates as selected. |
void |
setChosenNodeByDepthOrder(int order)
Marks a node with given order as selected. |
void |
setMatchingMetaTags(NGTreeHead head)
It sets the matching meta tag at the matching nodes of the tree. |
void |
setMatchingNodes(java.lang.String s)
Sets nodes matching a query according to a given list of matching nodes. |
void |
setWidth(int tree_width)
Sets the width of the tree in pixels. |
void |
setXStart(int x_start)
Sets the x-coordinate of the top-left corner of the tree in a forest. |
void |
setYStart(int y_start)
Sets the y-coordinate of the top-left corner of the tree in a forest. |
java.lang.String |
toFSString(boolean with_head,
NGTreeHead head)
Returns FS representation of the tree (with or without the head). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char MATCHING_NODES_DELIMITER
public static final char MATCHING_NODES_QUERY_DELIMITER
public static final char MATCHING_NODES_TREES_DELIMITER
Constructor Detail |
---|
public NGTree(ShowMessagesAble p_mess)
p_mess
- an object capable of displaying messagesMethod Detail |
---|
public NGTree getClone()
public int getWidth()
public void setWidth(int tree_width)
tree_width
- the width of the tree in pixelspublic int getHeight()
public void setHeight(int tree_height)
tree_height
- the height of the tree in pixelspublic int getXStart()
public void setXStart(int x_start)
x_start
- the x-coordinate of the top-left corner fo the tree in a forestpublic int getYStart()
public void setYStart(int y_start)
y_start
- the y-coordinate of the top-left corner fo the tree in a forestpublic java.lang.String toFSString(boolean with_head, NGTreeHead head)
with_head
- says if the head should be included in the FS representationhead
- the head belonging to the tree
public void setFlagTreeChanged(boolean new_flag)
new_flag
- value true signals that the coordinates need to be calculatedpublic boolean getFlagTreeChanged()
public boolean isEmpty()
public TNode getRoot()
public int getNumberOfNodes()
public int getNumberOfHiddenNodes()
public int readTree(NGTreeHead head, char[] p_source, int start_position, int p_number_of_attributes)
head
- a head belonging to the treep_source
- the source in FS formatstart_position
- a position in p_source of the first character to be readp_number_of_attributes
- number of attributes in the head
public void addAttributes(int number)
number
- number of attributes to be addedpublic void setMatchingMetaTags(NGTreeHead head)
head
- a head belonging to the treepublic TNode getChosenNode()
public int getChosenNodeDepthOrder(boolean count_hidden)
count_hidden
- says if hidden nodes should be counted
public void setChosenNodeByDepthOrder(int order)
order
- depth-first order of the node to be selected. The root has order 1.public int setChosenByPosition(int x, int y, int dosah_mysi, boolean allow_hidden)
x
- the x-coordinate in pixelsy
- the y-coordinate in pixelsdosah_mysi
- a maximum allowed distance of the node from the coordinates if the node is to be selectedallow_hidden
- controls if a hidden node can be selected
public void setMatchingNodes(java.lang.String s)
s
- list of matching nodespublic int getFirstMatchingNodeDepthOrder(boolean count_hidden)
count_hidden
- says if hidden nodes should be counted
public java.lang.String getSentenceString(NGTreeHead head)
head
- a head belonging to the tree
public java.lang.String getId(NGTreeHead head)
head
- a head belonging to the tree
public TNode[] getNodesArray()
public int getDepth(TNode node)
node
- a node in the tree
public TNode findNodeById(int id_index, java.lang.String value)
id_index
- an index of id-attribute in the head of the treevalue
- a given id
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |