|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--torero.gui.GrammarNode
This class is an hybrid class betweem gui and model components. It is derived from a gui class, the TreeNode which is used by the JTree per default, and encapsulates the model information (a symbol with attributes) for a node in a tree view. Accutally a tree in torero is build up from NodeWrapper classes, but they hold a referece to a grammar node. Note that there is a specialized class for the root grammar node (GrammarRoot). Implementation details: Grammar node hold a lookup cache (destlookup) with an entry for every assignment which has this GrammarNode as its destination. The keys (destination) are of type Attribute, the values (sources) are of type SrcAtt (encapsulating a GrammarNode and an Attribute. This information is used for an (efficient) routing algorithm of attribute connections.
GrammarRoot
,
MyTreeUI
,
NodeWrapper
Field Summary | |
protected int |
chldcnt
Number of sources of assignments from children to this node. |
protected OneToManyMap |
destlookup
A lookup cache containing all destinations of assignments from this node to other nodes. |
protected int |
parcnt
Number of sources of assignments from the nodes parent to this node. |
protected int |
sibcnt
Number of sources of assignments from siblings to this node. |
protected int |
slfcnt
Number of sources of assignments from the nodes itself to the node itself. |
Constructor Summary | |
GrammarNode(AttributeGrammar ag,
Derivat derivat,
Production.ListElement node,
GrammarNode parent)
Creates a new grammar node. |
Method Summary | |
protected void |
ACDCacheInit()
|
protected GrammarNode |
checkIfChildSource(GrammarNode mgtn)
For every assignment from the given GrammarNode mgtn (which must be a child of this) to itself (this), it put's an entry in the destination lookup chache. |
protected void |
checkIfParentSource()
For every assignment from the node's parent to itself (this), it put's an entry in the destination lookup chache. |
protected void |
checkIfSelfTraversalSource()
For every assignment (with destination of type traversal) from the node to itself (this), it put's an entry in the destination lookup chache. |
protected GrammarNode |
checkIfSiblingSource(GrammarNode mgtn)
For every assignment from the given GrammarNode mgtn (which must be a "sibling" of this, or the node itself (mgtn=this)) to itself (this), it put's an entry in the destination lookup chache. |
Enumeration |
children()
Tells this node to produce its children acording to the derivat object. |
void |
clearDestLookupCache()
Empties the destination lookup cache. |
protected int |
getACDPos(Attribute atr)
Get the position of the given attribute (traversal). |
int |
getACDSize()
Get the number of attributes+traversals assigned to this node. |
Iterator |
getAllDests()
Get all destination (key values) from the destination lookup cache (see class description of GrammarNode). |
boolean |
getAllowsChildren()
See if this node can procduce children. |
int |
getAttribHeigh()
Get the height of the attributes+traversals displayed by this node. return the height of the attriubtes+traversals [pixel]. |
int |
getAttribPosY(Attribute a)
Get the relative y position of the given attribute (traversal). |
Object[] |
getAttributeCellDataArray()
Get all ACDCache entries as object arrray. |
AttributeGrammar |
getAttributeGrammar()
Get the referenced AttributeGrammar. |
int |
getAttribWidth()
Get the width of the attribute (traversal) part of this node, it's the maximum of all attributes in the node. |
TreeNode |
getChildAt(int childIndex)
Get the child object at the given position (from left to right). |
int |
getChildCount()
Get the actual (none are produced by this call) number of children. |
Derivat |
getDerivat()
Get the referenced derivat. |
int |
getDestCnt()
Get the number of displayed attributes+traversals of this node. |
int |
getIndex(TreeNode tn)
Get the position of the given (child) object. |
Derivat |
getItsSubDerivation()
Get the derivat object that can be produced by extending this node in the tree. |
Production.ListElement |
getListElement()
Get the referenced listelement. |
int |
getNodeWidth()
Get the width of the node, actually this is the width of the symbol. |
TreeNode |
getParent()
Get the parent TreeNode of the this node. |
int |
getselectedAttrib()
Get the selected attribute (traversal). |
Iterator |
getSources(Attribute destattrib)
Get all source values for a given key attribute (destination) from the destination lookup cache (see class description of GrammarNode). |
int |
getSymbolHeigh()
Get the height of the referenced symbol [pixel] |
boolean |
isLeaf()
See if this node can be expanded. |
boolean |
isRoot()
Returns false for this class. |
protected void |
NodeInit()
Initializes the GrammarNode, is called by the constructior, after ACDCacheInit(). |
void |
processMouseEvent(int xrel,
int yrel,
MouseEvent e,
DefaultTreeModel tm)
Tells the node that a mouseevent has occured in it's area of interest. |
void |
setAttribHeight(int h)
Do not use this function. |
protected void |
setAttribWidth(int w)
Do not use this function. |
void |
setNodeWidth(int w)
Do not use this function. |
void |
setSymbolHeight(int h)
Do not use this function. |
String |
toString()
Get a textual representation of this node, actually calls the toString method on the referenced Symbol. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected OneToManyMap destlookup
protected int sibcnt
protected int chldcnt
protected int parcnt
protected int slfcnt
Constructor Detail |
public GrammarNode(AttributeGrammar ag, Derivat derivat, Production.ListElement node, GrammarNode parent)
ag
- a reference to the attribute grammarderivat
- this node can be expanded by using this derivatnode
- the listelement this grammar node encapsulatesparent
- the parent of this grammar nodeProduction.ListElement
Method Detail |
protected void ACDCacheInit()
public int getACDSize()
protected void NodeInit()
public boolean isRoot()
GrammarRoot
public String toString()
toString
in class Object
public Production.ListElement getListElement()
public Derivat getDerivat()
public AttributeGrammar getAttributeGrammar()
public Derivat getItsSubDerivation()
public TreeNode getChildAt(int childIndex)
getChildAt
in interface TreeNode
public int getChildCount()
getChildCount
in interface TreeNode
public TreeNode getParent()
getParent
in interface TreeNode
GrammarRoot
public int getIndex(TreeNode tn)
getIndex
in interface TreeNode
public boolean getAllowsChildren()
getAllowsChildren
in interface TreeNode
public boolean isLeaf()
isLeaf
in interface TreeNode
public Enumeration children()
children
in interface TreeNode
public void processMouseEvent(int xrel, int yrel, MouseEvent e, DefaultTreeModel tm)
xrel,
- yrel the relative [pixel] coordinates between the nodes x and y position and the mouseclick's position.e
- the mouseeventtm
- a reference to the treemodel used, for callback functionalitypublic int getselectedAttrib()
public int getDestCnt()
public int getSymbolHeigh()
public void setSymbolHeight(int h)
public int getAttribHeigh()
public void setAttribHeight(int h)
public void setNodeWidth(int w)
public int getNodeWidth()
protected int getACDPos(Attribute atr)
public int getAttribPosY(Attribute a)
protected void setAttribWidth(int w)
public int getAttribWidth()
public Iterator getAllDests()
public Iterator getSources(Attribute destattrib)
public void clearDestLookupCache()
protected void checkIfParentSource()
protected GrammarNode checkIfSiblingSource(GrammarNode mgtn)
mgtn
- the given node (source) to test.protected void checkIfSelfTraversalSource()
protected GrammarNode checkIfChildSource(GrammarNode mgtn)
mgtn
- the given node (source) to test.public Object[] getAttributeCellDataArray()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |