edu.upenn.cis.ptb
Class PTBTreeNodeImpl

java.lang.Object
  extended byedu.upenn.cis.ptb.PTBTreeNodeImpl
All Implemented Interfaces:
javax.swing.tree.MutableTreeNode, PTBTreeNode, javax.swing.tree.TreeNode

public class PTBTreeNodeImpl
extends java.lang.Object
implements PTBTreeNode

Author:
nikhild

Nested Class Summary
 class PTBTreeNodeImpl.PTBAttributeImpl
           
 
Field Summary
protected  PTBTreeNode firstChild
           
protected  PTBLabel label
           
protected  PTBTreeNode lastChild
           
protected  PTBTreeNode nextSibling
           
protected  javax.swing.tree.MutableTreeNode parent
           
protected  PTBTreeNode previousSibling
           
protected  java.lang.Object userObject
           
 
Fields inherited from interface edu.upenn.cis.ptb.PTBTreeNode
GapIndexAttributeQName, MovementIndexAttributeQName, NonPunctPOSPattern, RawAttributeQName, RolesAttributeQName, TypeAttributeQName
 
Constructor Summary
PTBTreeNodeImpl(PTBLabel label)
          Creates a new instance of PTBTreeNodeImpl
 
Method Summary
 java.util.Enumeration children()
           
 boolean getAllowsChildren()
           
 javax.swing.tree.TreeNode getChildAt(int childIndex)
           
 int getChildCount()
           
 int getIndex(javax.swing.tree.TreeNode node)
           
 PTBLabel getLabel()
          Get the associated PTBLabel
 javax.swing.tree.TreeNode getParent()
           
 java.lang.Object getUserObject()
           
 void insert(javax.swing.tree.MutableTreeNode nc, int index)
           
 boolean isLeaf()
           
 boolean isPreterminal()
          Equivalent to getChildCount() == 1 && getChildAt(0).isLeaf()
 boolean isPunct()
          Equivalent to getParent().isPunctPreterminal()
 boolean isPunctPreterminal()
          isPreterminal(), and getLabel().getType() is not in NonPunctuationPOS
 boolean isTerminal()
          Equivalent to isLeaf()
 boolean isTracePreterminal()
          Equivalent to isPreterminal() && hasRole("NONE")
 boolean isTraceTerminal()
          Equivalent to getParent().isTracePreterminal()
 void ptbAppendChild(javax.swing.tree.MutableTreeNode nc)
          Adds the node supplied as the last child of this node.
 java.util.Enumeration ptbGetAttributes()
           
 PTBTreeNode ptbGetFirstChild()
          The first child of this node or null if it is a leaf.
 PTBTreeNode ptbGetLastChild()
          The last child of this node or null if it is a leaf
 PTBTreeNode ptbGetNextSibling()
          The next sibling if one exists, null otherwise.
 PTBTreeNode ptbGetPreviousSibling()
          The previous sibling if one exists, null otherwise.
 void ptbSetFirstChild(PTBTreeNode firstChild)
          Implementation specific.
 void ptbSetLastChild(PTBTreeNode lastChild)
          Implementation specific.
 void ptbSetNextSibling(PTBTreeNode nextSibling)
          Implementation specific.
 void ptbSetPreviousSibling(PTBTreeNode previousSibling)
          Implementation specific.
 void remove(int index)
           
 void remove(javax.swing.tree.MutableTreeNode aChild)
           
 void removeFromParent()
           
 void save(java.io.Writer writer)
           
 void save(java.io.Writer writer, int indent, int indentIncr)
           
 void setLabel(PTBLabel label)
          Sets the label
 void setParent(javax.swing.tree.MutableTreeNode parent)
           
 void setUserObject(java.lang.Object userObject)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

previousSibling

protected PTBTreeNode previousSibling

nextSibling

protected PTBTreeNode nextSibling

firstChild

protected PTBTreeNode firstChild

lastChild

protected PTBTreeNode lastChild

label

protected PTBLabel label

parent

protected javax.swing.tree.MutableTreeNode parent

userObject

protected java.lang.Object userObject
Constructor Detail

PTBTreeNodeImpl

public PTBTreeNodeImpl(PTBLabel label)
Creates a new instance of PTBTreeNodeImpl

Method Detail

getLabel

public PTBLabel getLabel()
Description copied from interface: PTBTreeNode
Get the associated PTBLabel

Specified by:
getLabel in interface PTBTreeNode

isPreterminal

public boolean isPreterminal()
Description copied from interface: PTBTreeNode
Equivalent to getChildCount() == 1 && getChildAt(0).isLeaf()

Specified by:
isPreterminal in interface PTBTreeNode

isTerminal

public boolean isTerminal()
Description copied from interface: PTBTreeNode
Equivalent to isLeaf()

Specified by:
isTerminal in interface PTBTreeNode

isTracePreterminal

public boolean isTracePreterminal()
Description copied from interface: PTBTreeNode
Equivalent to isPreterminal() && hasRole("NONE")

Specified by:
isTracePreterminal in interface PTBTreeNode

isTraceTerminal

public boolean isTraceTerminal()
Description copied from interface: PTBTreeNode
Equivalent to getParent().isTracePreterminal()

Specified by:
isTraceTerminal in interface PTBTreeNode

setLabel

public void setLabel(PTBLabel label)
Description copied from interface: PTBTreeNode
Sets the label

Specified by:
setLabel in interface PTBTreeNode

ptbSetFirstChild

public void ptbSetFirstChild(PTBTreeNode firstChild)
Description copied from interface: PTBTreeNode
Implementation specific.

Specified by:
ptbSetFirstChild in interface PTBTreeNode

ptbSetLastChild

public void ptbSetLastChild(PTBTreeNode lastChild)
Description copied from interface: PTBTreeNode
Implementation specific.

Specified by:
ptbSetLastChild in interface PTBTreeNode

ptbSetPreviousSibling

public void ptbSetPreviousSibling(PTBTreeNode previousSibling)
Description copied from interface: PTBTreeNode
Implementation specific.

Specified by:
ptbSetPreviousSibling in interface PTBTreeNode

ptbSetNextSibling

public void ptbSetNextSibling(PTBTreeNode nextSibling)
Description copied from interface: PTBTreeNode
Implementation specific.

Specified by:
ptbSetNextSibling in interface PTBTreeNode

setParent

public void setParent(javax.swing.tree.MutableTreeNode parent)
Specified by:
setParent in interface javax.swing.tree.MutableTreeNode

ptbGetFirstChild

public PTBTreeNode ptbGetFirstChild()
Description copied from interface: PTBTreeNode
The first child of this node or null if it is a leaf.

Specified by:
ptbGetFirstChild in interface PTBTreeNode

ptbGetLastChild

public PTBTreeNode ptbGetLastChild()
Description copied from interface: PTBTreeNode
The last child of this node or null if it is a leaf

Specified by:
ptbGetLastChild in interface PTBTreeNode

ptbGetNextSibling

public PTBTreeNode ptbGetNextSibling()
Description copied from interface: PTBTreeNode
The next sibling if one exists, null otherwise.

Specified by:
ptbGetNextSibling in interface PTBTreeNode

ptbGetPreviousSibling

public PTBTreeNode ptbGetPreviousSibling()
Description copied from interface: PTBTreeNode
The previous sibling if one exists, null otherwise.

Specified by:
ptbGetPreviousSibling in interface PTBTreeNode

getParent

public javax.swing.tree.TreeNode getParent()
Specified by:
getParent in interface javax.swing.tree.TreeNode

toString

public java.lang.String toString()

getChildAt

public javax.swing.tree.TreeNode getChildAt(int childIndex)
Specified by:
getChildAt in interface javax.swing.tree.TreeNode

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface javax.swing.tree.TreeNode

getIndex

public int getIndex(javax.swing.tree.TreeNode node)
Specified by:
getIndex in interface javax.swing.tree.TreeNode

getAllowsChildren

public boolean getAllowsChildren()
Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode

isLeaf

public boolean isLeaf()
Specified by:
isLeaf in interface javax.swing.tree.TreeNode

children

public java.util.Enumeration children()
Specified by:
children in interface javax.swing.tree.TreeNode

ptbAppendChild

public void ptbAppendChild(javax.swing.tree.MutableTreeNode nc)
Description copied from interface: PTBTreeNode
Adds the node supplied as the last child of this node.

Specified by:
ptbAppendChild in interface PTBTreeNode

insert

public void insert(javax.swing.tree.MutableTreeNode nc,
                   int index)
Specified by:
insert in interface javax.swing.tree.MutableTreeNode

remove

public void remove(int index)
Specified by:
remove in interface javax.swing.tree.MutableTreeNode

remove

public void remove(javax.swing.tree.MutableTreeNode aChild)
Specified by:
remove in interface javax.swing.tree.MutableTreeNode

removeFromParent

public void removeFromParent()
Specified by:
removeFromParent in interface javax.swing.tree.MutableTreeNode

getUserObject

public java.lang.Object getUserObject()
Specified by:
getUserObject in interface PTBTreeNode

setUserObject

public void setUserObject(java.lang.Object userObject)
Specified by:
setUserObject in interface javax.swing.tree.MutableTreeNode

isPunct

public boolean isPunct()
Description copied from interface: PTBTreeNode
Equivalent to getParent().isPunctPreterminal()

Specified by:
isPunct in interface PTBTreeNode

isPunctPreterminal

public boolean isPunctPreterminal()
Description copied from interface: PTBTreeNode
isPreterminal(), and getLabel().getType() is not in NonPunctuationPOS

Specified by:
isPunctPreterminal in interface PTBTreeNode

ptbGetAttributes

public java.util.Enumeration ptbGetAttributes()
Specified by:
ptbGetAttributes in interface PTBTreeNode

save

public void save(java.io.Writer writer)
          throws java.io.IOException
Specified by:
save in interface PTBTreeNode
Throws:
java.io.IOException

save

public void save(java.io.Writer writer,
                 int indent,
                 int indentIncr)
          throws java.io.IOException
Specified by:
save in interface PTBTreeNode
Throws:
java.io.IOException