edu.iastate.jtm.util
Class ParenParser

java.lang.Object
  extended by edu.iastate.jtm.util.ParenParser

public class ParenParser
extends java.lang.Object

Parse parentheses into a DOM tree. ParenFinder: messy but possibly faster. ParenParser: neat but possibly slower.

Author:
Jing Ding edu.iastate.jtm.util jtm

Field Summary
static int LEFT
           
static CharType LOOSE_TYPE
           
static int RIGHT
           
static CharType STRICT_TYPE
           
 
Constructor Summary
ParenParser()
           
ParenParser(boolean strict)
           
ParenParser(CharType parens)
           
 
Method Summary
 org.dom4j.Element getChild(org.dom4j.Element self, int id)
           
 int getChildCount(org.dom4j.Element self)
           
 org.dom4j.Element getParen(org.dom4j.Element tree, int id)
           
 org.dom4j.Element getParen(int id)
           
 int getParenCount()
          Get number of parenthesis pairs.
 int getParenCount(org.dom4j.Element tree)
           
 org.dom4j.Element getParseTree()
           
 org.dom4j.Element inParen(org.dom4j.Element tree, int pos, boolean innermost)
           
 org.dom4j.Element inParen(int pos, boolean inmost)
           
 int left(org.dom4j.Element self)
           
 int level(org.dom4j.Element self)
           
static void main(java.lang.String[] args)
           
 org.dom4j.Element onParen(org.dom4j.Element tree, int pos)
           
 org.dom4j.Element onParen(int pos)
           
 org.dom4j.Element parse(java.lang.CharSequence sen)
           
 int right(org.dom4j.Element self)
           
 org.dom4j.Element upLevel(org.dom4j.Element self)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values

STRICT_TYPE

public static final CharType STRICT_TYPE

LOOSE_TYPE

public static final CharType LOOSE_TYPE
Constructor Detail

ParenParser

public ParenParser(CharType parens)

ParenParser

public ParenParser(boolean strict)

ParenParser

public ParenParser()
Method Detail

parse

public org.dom4j.Element parse(java.lang.CharSequence sen)

getParseTree

public org.dom4j.Element getParseTree()

left

public int left(org.dom4j.Element self)

right

public int right(org.dom4j.Element self)

level

public int level(org.dom4j.Element self)

upLevel

public org.dom4j.Element upLevel(org.dom4j.Element self)

getParenCount

public int getParenCount()
Get number of parenthesis pairs.

Returns:
number of parenthesis pairs.

getParenCount

public int getParenCount(org.dom4j.Element tree)

getParen

public org.dom4j.Element getParen(org.dom4j.Element tree,
                                  int id)

getParen

public org.dom4j.Element getParen(int id)

getChildCount

public int getChildCount(org.dom4j.Element self)

getChild

public org.dom4j.Element getChild(org.dom4j.Element self,
                                  int id)

inParen

public org.dom4j.Element inParen(org.dom4j.Element tree,
                                 int pos,
                                 boolean innermost)

inParen

public org.dom4j.Element inParen(int pos,
                                 boolean inmost)

onParen

public org.dom4j.Element onParen(org.dom4j.Element tree,
                                 int pos)

onParen

public org.dom4j.Element onParen(int pos)

main

public static void main(java.lang.String[] args)