edu.upenn.cis.ptb
Interface PTBTreeNode

All Superinterfaces:
javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
All Known Implementing Classes:
PTBTreeNodeImpl

public interface PTBTreeNode
extends javax.swing.tree.MutableTreeNode

A node in the PTB. The label of the node is PTBLabel. This is similar to various other interfaces to the PTB, but Java™'s treatment of method namespaces results in incompatibilities between the Swing interfaces and/or DOM and other treebank interfaces. The intended uses for this interface are mainly querying and display.

The setter methods here are for internal use only with the exception of setLabel, and ptbAppendChild, and implementations may impose their own semantics. To mutate the tree, use the methods provided by the MutableTreeNode superinterface. Also note that the label and userObject are separate.

To avoid name clashes, some commonly used methods are prefixed with ptb.

Version 2 Changes: Two methods: "ptbSetAttribute" and "ptbGetAttribute" have been removed for performance reasons. There is no way to add custom attributes now. PTBLabel has a corresponding change.

Since:
0.1
Version:
2
Author:
nikhild
See Also:
PTBNavigator

Field Summary
static java.lang.String GapIndexAttributeQName
           
static java.lang.String MovementIndexAttributeQName
           
static java.util.regex.Pattern NonPunctPOSPattern
           
static java.lang.String RawAttributeQName
           
static java.lang.String RolesAttributeQName
           
static java.lang.String TypeAttributeQName
           
 
Method Summary
 PTBLabel getLabel()
          Get the associated PTBLabel
 java.lang.Object getUserObject()
           
 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 newChild)
          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 prevSibling)
          Implementation specific.
 void save(java.io.Writer writer)
           
 void save(java.io.Writer writer, int indent, int indentIncr)
           
 void setLabel(PTBLabel label)
          Sets the label
 
Methods inherited from interface javax.swing.tree.MutableTreeNode
insert, remove, remove, removeFromParent, setParent, setUserObject
 
Methods inherited from interface javax.swing.tree.TreeNode
children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf
 

Field Detail

NonPunctPOSPattern

public static final java.util.regex.Pattern NonPunctPOSPattern

TypeAttributeQName

public static final java.lang.String TypeAttributeQName
See Also:
Constant Field Values

RolesAttributeQName

public static final java.lang.String RolesAttributeQName
See Also:
Constant Field Values

MovementIndexAttributeQName

public static final java.lang.String MovementIndexAttributeQName
See Also:
Constant Field Values

GapIndexAttributeQName

public static final java.lang.String GapIndexAttributeQName
See Also:
Constant Field Values

RawAttributeQName

public static final java.lang.String RawAttributeQName
See Also:
Constant Field Values
Method Detail

getLabel

public PTBLabel getLabel()
Get the associated PTBLabel


setLabel

public void setLabel(PTBLabel label)
Sets the label


isTerminal

public boolean isTerminal()
Equivalent to isLeaf()


isTraceTerminal

public boolean isTraceTerminal()
Equivalent to getParent().isTracePreterminal()


isPreterminal

public boolean isPreterminal()
Equivalent to getChildCount() == 1 && getChildAt(0).isLeaf()


isTracePreterminal

public boolean isTracePreterminal()
Equivalent to isPreterminal() && hasRole("NONE")


isPunctPreterminal

public boolean isPunctPreterminal()
isPreterminal(), and getLabel().getType() is not in NonPunctuationPOS


isPunct

public boolean isPunct()
Equivalent to getParent().isPunctPreterminal()


ptbGetFirstChild

public PTBTreeNode ptbGetFirstChild()
The first child of this node or null if it is a leaf.


ptbGetLastChild

public PTBTreeNode ptbGetLastChild()
The last child of this node or null if it is a leaf


ptbGetPreviousSibling

public PTBTreeNode ptbGetPreviousSibling()
The previous sibling if one exists, null otherwise.


ptbGetNextSibling

public PTBTreeNode ptbGetNextSibling()
The next sibling if one exists, null otherwise.


ptbSetFirstChild

public void ptbSetFirstChild(PTBTreeNode firstChild)
Implementation specific.


ptbSetLastChild

public void ptbSetLastChild(PTBTreeNode lastChild)
Implementation specific.


ptbSetPreviousSibling

public void ptbSetPreviousSibling(PTBTreeNode prevSibling)
Implementation specific.


ptbSetNextSibling

public void ptbSetNextSibling(PTBTreeNode nextSibling)
Implementation specific.


ptbAppendChild

public void ptbAppendChild(javax.swing.tree.MutableTreeNode newChild)
Adds the node supplied as the last child of this node.


ptbGetAttributes

public java.util.Enumeration ptbGetAttributes()

getUserObject

public java.lang.Object getUserObject()

save

public void save(java.io.Writer writer)
          throws java.io.IOException
Throws:
java.io.IOException

save

public void save(java.io.Writer writer,
                 int indent,
                 int indentIncr)
          throws java.io.IOException
Throws:
java.io.IOException