|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.raritantechnologies.vqlparser.Node
This class represents an element in the parse tree resulting from breaking apart a query string. (see Lexer.java)
| Constructor Summary | |
Node(Node n)
Constructor to clone a node Note: MUST setLeft(), setRight(), setParent() on the new node. |
|
Node(java.lang.String nm,
Lexer l,
int t,
int a,
int p)
Constructor which bypasses the table lookup. |
|
Node(java.lang.String nm,
Lexer l,
SymbolTable st)
Constructor which performs a symbol table lookup if the symbol is not found, assume it is a word. |
|
Node(java.lang.String nm,
Node n)
Constructor to clone a node Note: MUST setLeft(), setRight(), setParent() on the new node. |
|
| Method Summary | |
void |
adjustLevel(int adjust)
adjusts the level (paranthetical) from this point down. |
Node |
applyRules(QueryRules qr,
java.lang.String field)
turns: X |
Node |
applyRules(QueryRules qr,
java.lang.String field,
java.lang.String defaultField)
|
void |
breakOnEOSChars()
Breaks strings on EOS characters (?, !, and . |
void |
breakOnEOSChars(java.lang.String eos)
|
Node |
bypassPrefixOps()
turns: |
boolean |
checkPrefix()
checks whether the prefix proximity/evidence operator is operating on a list. |
java.lang.Object |
clone()
Clones a tree (or sub-tree) and returns the root of the new tree. |
Node |
combineFields()
Combines the |
int |
findAllFields(java.util.HashSet fields)
Looks for all fields within this subtree. |
boolean |
findField(java.lang.String field)
Looks for a field within this subtree. |
void |
getAllValues(java.util.LinkedList a)
Pull all values out of the query. |
void |
getAllValues(java.util.LinkedList a,
boolean bPrint,
boolean bReplace)
Pull all values out of the query. |
java.lang.String |
getAmount()
Returns the amount of this node. |
int |
getArity()
Returns the arity of this node. |
java.lang.String |
getAttributeField()
Returns the string for attributeField. |
Node |
getLeft()
Get the left child of this node. |
boolean |
getLeftPrune()
Returns the left_prune of this node. |
int |
getLevel()
Returns the depth that this node is nested within parens. |
java.lang.String |
getName()
Returns the string for the human readable name of the symbol. |
Node |
getParent()
Get the parent of this node. |
int |
getPrecedence()
Returns the precedence of this node. |
Node |
getRight()
Get the right child of this node. |
boolean |
getRightPrune()
Returns the right_prune of this node. |
java.lang.String |
getRulesValueString()
Pull all values out of the query. |
int |
getType()
Returns the type of this node. |
void |
getValues(java.util.HashSet a)
Pull all values out of the query. |
void |
getValues(java.util.HashSet a,
boolean bPrint,
boolean bReplace)
Pull all values out of the query. |
java.util.HashSet |
getWords()
Returns a HashSet containing all (unidentified) field nodes |
boolean |
hasBoolOp()
Does this tree contain a boolean operator? |
boolean |
hasIN()
Sees if the subtree contains an |
boolean |
hasPrefixOps()
Checks whether prefix ops are used. |
boolean |
identifyFields(java.util.HashMap fields)
Scans the tree from this point to lookup field names. |
boolean |
identifyFields(java.util.HashMap fields,
java.util.HashMap isAttributeOf)
This version also sets the isAttributeOf field. |
Node |
insertNode(Node newNode,
Node current)
Inserts a node starting at current level, then bubbles up to the proper precedence level. |
boolean |
isBoolOp()
Is this a boolean operator? |
Node |
isolateField(java.lang.String field,
java.util.HashMap fields)
turns: XX |
boolean |
isPrefix()
Is this a prefix operator? |
int |
isSubtreeWrapped(java.lang.String field)
Scans the tree from this point to find a "parent" field. |
boolean |
markFields(java.util.HashMap fields)
internal method. |
boolean |
markFields(java.util.HashMap fields,
java.util.HashMap isAttributeOf)
This version also sets the isAttributeOf field. |
void |
print_debug()
|
java.lang.String |
probeParentField()
Scans the tree from this point to find a "parent" field. |
Node |
reduceField(java.lang.String field)
|
Node |
reduceField(java.lang.String field,
Node subTree)
turns: (X |
void |
reduceParens()
reduces any extraneous parenthesis around single fields, values. |
Node |
reducePrefixBools()
reduces any AND/OR prefix ops with a single clause. |
void |
removeCharacter(char c)
ONLY do this after identifyFields() |
void |
removeCharacters(java.lang.String remove)
ONLY do this after identifyFields() |
Node |
removeField(java.lang.String field)
Removes a field from a list. |
Node |
replaceField(java.lang.String field,
Node newFields)
Replaces a field with either another field or a (sub)list of fields. |
void |
setAmount(java.lang.String a)
Sets the amount of this node. |
void |
setArity(int a)
Set the arity of this node. |
void |
setAttributeField(java.lang.String n)
Sets the attributeField string. |
void |
setLeft(Node n)
Set the left child of this node. |
void |
setLevel(int l)
Sets the level or parenthesis depth . |
void |
setName(java.lang.String n)
Sets the name string. |
void |
setParent(Node n)
Set the parent of this node. |
void |
setPrecedence(int p)
Sets the precedence of this node. |
void |
setPrefix(boolean p)
Set the prefix status of this node. |
void |
setRight(Node n)
Set the right child of this node. |
void |
setType(int t)
Set the type of this node. |
java.lang.String |
toEnglishString()
|
java.lang.String |
toEnglishString(java.util.HashMap fields)
if the fields HashMap is not null it contains the fieldId -> fieldName mapping. |
java.lang.String |
toHighlightString(java.util.HashMap replace,
java.lang.String ignore)
Same as toString except removes all ignore characters from values. |
java.lang.String |
toString()
Convert to a string using a preorder scan of the tree. |
java.lang.String |
toString(java.util.HashMap replace)
Convert to a string using a preorder scan of the tree. |
java.lang.String |
toString(java.util.HashMap replace,
java.util.HashMap pre_wrap,
java.util.HashMap post_wrap)
Convert to a string using a preorder scan of the tree. |
java.lang.String |
toTreeString()
|
java.lang.String |
toTreeString(int level)
|
Node |
wrapFields(java.lang.String field,
java.util.HashMap fields)
Wraps fields not in zone or field ops with |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Node(java.lang.String nm,
Lexer l,
int t,
int a,
int p)
nm - the name of the symbol.l - the level of the symbol.t - the type of the symbol.p - the precedence of the symbol.
public Node(java.lang.String nm,
Lexer l,
SymbolTable st)
l - the instance of the lexer.nm - the name of the symbol.
public Node(java.lang.String nm,
Node n)
n - the node to be clonedpublic Node(Node n)
n - the node to be cloned| Method Detail |
public java.lang.String getName()
public void setAttributeField(java.lang.String n)
public java.lang.String getAttributeField()
public void setName(java.lang.String n)
public int getLevel()
public void setLevel(int l)
public java.lang.String getAmount()
public void setAmount(java.lang.String a)
public int getType()
public void setType(int t)
public int getArity()
public void setArity(int a)
public int getPrecedence()
public void setPrecedence(int p)
public boolean getLeftPrune()
public boolean getRightPrune()
public Node getParent()
public void setParent(Node n)
public Node getLeft()
public void setLeft(Node n)
public Node getRight()
public void setRight(Node n)
public void setPrefix(boolean p)
public boolean isPrefix()
public boolean hasBoolOp()
public boolean isBoolOp()
public Node insertNode(Node newNode,
Node current)
public java.lang.String probeParentField()
public int isSubtreeWrapped(java.lang.String field)
public boolean identifyFields(java.util.HashMap fields)
public boolean markFields(java.util.HashMap fields)
public boolean identifyFields(java.util.HashMap fields,
java.util.HashMap isAttributeOf)
public boolean markFields(java.util.HashMap fields,
java.util.HashMap isAttributeOf)
public boolean hasIN()
public Node wrapFields(java.lang.String field,
java.util.HashMap fields)
public java.util.HashSet getWords()
public Node replaceField(java.lang.String field,
Node newFields)
public Node removeField(java.lang.String field)
public void removeCharacters(java.lang.String remove)
public void removeCharacter(char c)
public void breakOnEOSChars()
public void breakOnEOSChars(java.lang.String eos)
public java.lang.Object clone()
public Node isolateField(java.lang.String field,
java.util.HashMap fields)
public Node reduceField(java.lang.String field)
public Node reduceField(java.lang.String field,
Node subTree)
public Node combineFields()
public Node bypassPrefixOps()
public boolean hasPrefixOps()
public Node applyRules(QueryRules qr,
java.lang.String field)
public Node applyRules(QueryRules qr,
java.lang.String field,
java.lang.String defaultField)
public boolean checkPrefix()
public void reduceParens()
public Node reducePrefixBools()
public boolean findField(java.lang.String field)
public int findAllFields(java.util.HashSet fields)
public void adjustLevel(int adjust)
public void print_debug()
public java.lang.String getRulesValueString()
public void getAllValues(java.util.LinkedList a)
public void getAllValues(java.util.LinkedList a,
boolean bPrint,
boolean bReplace)
public void getValues(java.util.HashSet a)
public void getValues(java.util.HashSet a,
boolean bPrint,
boolean bReplace)
public java.lang.String toString()
public java.lang.String toString(java.util.HashMap replace)
public java.lang.String toHighlightString(java.util.HashMap replace,
java.lang.String ignore)
public java.lang.String toString(java.util.HashMap replace,
java.util.HashMap pre_wrap,
java.util.HashMap post_wrap)
public java.lang.String toTreeString()
public java.lang.String toTreeString(int level)
public java.lang.String toEnglishString()
public java.lang.String toEnglishString(java.util.HashMap fields)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||