edu.upenn.cis.pdtb.util
Class GornAddressUtils

java.lang.Object
  extended byedu.upenn.cis.pdtb.util.GornAddressUtils

public class GornAddressUtils
extends java.lang.Object

Several utility methods for working with Gorn addresses.

Author:
nikhild
See Also:
GornAddressList

Constructor Summary
GornAddressUtils()
          Creates a new instance of GornAddressUtils
 
Method Summary
static boolean dominates(GornAddressList addList1, GornAddressList addList2)
          Returns true iff every address in addList2 is has a prefix in addList1.
static int[] getGornAddress(javax.swing.tree.TreeNode node)
          Gets the address of a node.
static javax.swing.tree.TreeNode getNode(int[] gornAddress, javax.swing.tree.TreeNode root)
          Get the node correponding to the address.
static java.util.Enumeration getNodes(GornAddressList gal, javax.swing.tree.TreeNode root)
          Gets the nodes denoted by the Gorn address list.
static java.lang.String getText(GornAddressList addList, PTBTreeNode root)
           
static java.lang.String getText(PTBTreeNode node)
           
static boolean isPrefix(int[] address, GornAddressList gal)
          Returns true iff the address is a prefix (denoting an ancestor) of all the addresses in the list.
static boolean prefixExists(int[] address, GornAddressList gal)
          Returns true iff the address has a prefix (an ancestor) in the list.
static void printAddress(int[] address)
          Convenience method for debugging.
static java.lang.String printTrees(PTBTreeNode root)
           
static GornAddressList subtract(int[] address, GornAddressList addList, javax.swing.tree.TreeNode root)
          Tree subtraction operator, useful in detecting arguments.
static GornAddressList union(java.util.Enumeration gornAddressLists)
          Same as the other union method.
static GornAddressList union(java.util.Iterator gornAddressLists)
          Produces a list containing all the addresses in the lists iterated over.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GornAddressUtils

public GornAddressUtils()
Creates a new instance of GornAddressUtils

Method Detail

getGornAddress

public static int[] getGornAddress(javax.swing.tree.TreeNode node)
Gets the address of a node.

Parameters:
node - The node
Returns:
The address.

getNode

public static javax.swing.tree.TreeNode getNode(int[] gornAddress,
                                                javax.swing.tree.TreeNode root)
Get the node correponding to the address.

Parameters:
gornAddress - the address
root - the root of the tree from which the address is to be interpreted
Returns:
the node if it exists. A runtime exception (NPE) will be thrown if the node does not exist.

getNodes

public static java.util.Enumeration getNodes(GornAddressList gal,
                                             javax.swing.tree.TreeNode root)
Gets the nodes denoted by the Gorn address list.

Parameters:
gal - the list
root - the root of the tree from which addresses are interpreted
Returns:
an enumeration containing the nodes.

printAddress

public static void printAddress(int[] address)
Convenience method for debugging. Prints to STDERR.


union

public static GornAddressList union(java.util.Iterator gornAddressLists)
Produces a list containing all the addresses in the lists iterated over.


union

public static GornAddressList union(java.util.Enumeration gornAddressLists)
Same as the other union method.


isPrefix

public static boolean isPrefix(int[] address,
                               GornAddressList gal)
Returns true iff the address is a prefix (denoting an ancestor) of all the addresses in the list.


prefixExists

public static boolean prefixExists(int[] address,
                                   GornAddressList gal)
Returns true iff the address has a prefix (an ancestor) in the list.


subtract

public static GornAddressList subtract(int[] address,
                                       GornAddressList addList,
                                       javax.swing.tree.TreeNode root)
Tree subtraction operator, useful in detecting arguments. See Dinesh et. al 2005 "Attribution and the Non-Alignment of Syntactic and Discourse Arguments of Connectives".


getText

public static java.lang.String getText(GornAddressList addList,
                                       PTBTreeNode root)

getText

public static java.lang.String getText(PTBTreeNode node)

dominates

public static boolean dominates(GornAddressList addList1,
                                GornAddressList addList2)
Returns true iff every address in addList2 is has a prefix in addList1.


printTrees

public static java.lang.String printTrees(PTBTreeNode root)