org.cdlib.xtf.textEngine.freeform
Class FreeformQueryParser.FNode

Object
  extended by FreeformQueryParser.FNode
Enclosing class:
FreeformQueryParser

public class FreeformQueryParser.FNode
extends Object

The result of a parse. A very simple hierarchical structure, basically mirroring the XML that would be generated for an XTF query.


Field Summary
 ArrayList<FreeformQueryParser.FNode> children
           
 String field
           
 String name
           
 String text
           
 
Constructor Summary
FreeformQueryParser.FNode(String n)
          Private constructor
FreeformQueryParser.FNode(String n, String t)
          Private constructor
 
Method Summary
private  void add(FreeformQueryParser.FNode n)
          Add a child to this node
private  void clearFields()
          Clear the 'field' on this node and all descendants
private  void fixNots()
          In XTF, "not" is always implemented as AND-NOT.
private  String indent(int level)
          Return a string with two spaces per level, used for indenting XML.
private  FreeformQueryParser.FNode promoteSingle()
          If we only have one child, return it.
private  void resolveFields(int level)
          Carry field identifiers to the right.
 String toString()
          Convert the query to something more compact than XML
 String toXML()
          Generate XML for this node and its descendants.
private  void toXML(int level, StringBuffer buf)
          Workhorse XML generator
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public String name

text

public String text

field

public String field

children

public ArrayList<FreeformQueryParser.FNode> children
Constructor Detail

FreeformQueryParser.FNode

FreeformQueryParser.FNode(String n)
Private constructor


FreeformQueryParser.FNode

FreeformQueryParser.FNode(String n,
                          String t)
Private constructor

Method Detail

toXML

public String toXML()
Generate XML for this node and its descendants.


toXML

private void toXML(int level,
                   StringBuffer buf)
Workhorse XML generator


toString

public String toString()
Convert the query to something more compact than XML

Overrides:
toString in class Object

indent

private String indent(int level)
Return a string with two spaces per level, used for indenting XML.


add

private void add(FreeformQueryParser.FNode n)
Add a child to this node


promoteSingle

private FreeformQueryParser.FNode promoteSingle()
If we only have one child, return it. Else, return 'this'.


clearFields

private void clearFields()
Clear the 'field' on this node and all descendants


resolveFields

private void resolveFields(int level)
Carry field identifiers to the right. If all fields at one level are the same, move them up to the parent.


fixNots

private void fixNots()
In XTF, "not" is always implemented as AND-NOT. So make sure that every not is part of an AND, if necessary sticking an query onto it.