Class StatementTree

java.lang.Object
com.mckoi.database.StatementTree
All Implemented Interfaces:
Serializable, Cloneable

public final class StatementTree extends Object implements Serializable, Cloneable
A serializable container class for a parsed query language statement. The structure of the tree is entirely dependant on the grammar that was used to create the tree. This object is a convenient form that can be cached and serialized to be stored.

Think of this as the model of a query after the grammar has been parsed and before it is evaluated.

Author:
Tobias Downer
See Also:
  • Constructor Details

    • StatementTree

      public StatementTree(String statement_class)
      Constructs the StatementTree.
      Parameters:
      statement_class - the name of the class that interpretes this statement (eg. com.mckoi.database.interpret.Select).
  • Method Details

    • putObject

      public void putObject(String entry_name, Object ob)
      Puts a new entry into the statement tree map.
    • putBoolean

      public void putBoolean(String entry_name, boolean b)
      Puts a boolean into the statement tree map.
    • putInt

      public void putInt(String entry_name, int v)
      Puts an integer into the statement tree map.
    • getObject

      public Object getObject(String entry_name)
      Gets an object entry from the statement tree.
    • getBoolean

      public boolean getBoolean(String entry_name)
      Gets a boolean entry from the statement tree.
    • getInt

      public int getInt(String entry_name)
      Gets an integer entry from the statement tree.
    • getClassName

      public String getClassName()
      Gets the interpreter class that services this tree.
    • prepareAllExpressions

      public void prepareAllExpressions(ExpressionPreparer preparer) throws DatabaseException
      For each expression in this StatementTree this method will call the 'prepare' method in each expression. The prepare method is intended to mutate each expression so that references can be qualified, sub-queries can be resolved, and variable substitutions can be substituted.
      Throws:
      DatabaseException
    • cloneSingleObject

      public static Object cloneSingleObject(Object entry) throws CloneNotSupportedException
      Clones a single object.
      Throws:
      CloneNotSupportedException
    • clone

      public Object clone() throws CloneNotSupportedException
      Performs a deep clone of this object, calling 'clone' on any elements that are mutable or shallow copying immutable members.
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • toString

      public String toString()
      For diagnostic.
      Overrides:
      toString in class Object