FileDocCategorySizeDatePackage
Node.javaAPI DocGlassfish v2 API10810Tue May 22 16:54:38 BST 2007oracle.toplink.essentials.internal.parsing

Node

public class Node extends Object
INTERNAL

Purpose: This is the superclass for all Nodes.

Responsibilities:

  • Answer default answers for all method calls
  • Delegate most responsibilities to the sub-classes
author
Jon Driscoll and Joel Lucuik
since
TopLink 4.0

Fields Summary
private int
line
private int
column
protected Node
left
protected Node
right
private Object
type
public boolean
shouldGenerateExpression
Constructors Summary
public Node()
Return a new Node.


             
      
        super();
    
Methods Summary
public oracle.toplink.essentials.expressions.ExpressionaddToExpression(oracle.toplink.essentials.expressions.Expression parentExpression, oracle.toplink.essentials.internal.parsing.GenerationContext context)
INTERNAL Add my expression semantics to the parentExpression. Each subclass will add a different expression and thus will need to override this method

        return parentExpression;
    
public oracle.toplink.essentials.expressions.ExpressionappendExpression(oracle.toplink.essentials.expressions.Expression left, oracle.toplink.essentials.expressions.Expression right)
INTERNAL Returns left.and(right) if both are defined.

        Expression expr = null;
        if (left == null) {
            expr = right;
        } else if (right == null) {
            expr = left;
        } else {
            expr = left.and(right);
        }
        return expr;
    
public voidapplyToQuery(oracle.toplink.essentials.queryframework.ObjectLevelReadQuery theQuery, oracle.toplink.essentials.internal.parsing.GenerationContext context)
INTERNAL Apply this node to the passed query

    
public oracle.toplink.essentials.expressions.ExpressiongenerateExpression(oracle.toplink.essentials.internal.parsing.GenerationContext context)
INTERNAL Generate an expression for the node. Each subclass will generate a different expression and thus will need to override this method

        return null;
    
public java.lang.StringgetAsString()
INTERNAL Get the string representation of this node. By default return toString()

        return toString();
    
public intgetColumn()

        return column;
    
public oracle.toplink.essentials.internal.parsing.NodegetLeft()
INTERNAL Return the left node

        return left;
    
public intgetLine()

        return line;
    
public oracle.toplink.essentials.internal.parsing.NodegetRight()
INTERNAL Return the right node

        return right;
    
public java.lang.ObjectgetType()
INTERNAL Return the type of this node.

        return type;
    
public booleanhasLeft()
INTERNAL Does this node have a left

        return getLeft() != null;
    
public booleanhasRight()
INTERNAL Does this node have a right

        return getRight() != null;
    
public booleanisAggregateNode()
INTERNAL Is this node an Aggregate node

        return false;
    
public booleanisAttributeNode()
INTERNAL Is this node an AttributeNode

        return false;
    
public booleanisConstructorNode()
INTERNAL Is this node a ConstructorNode

        return false;
    
public booleanisCountNode()
INTERNAL Is this node a CountNode

        return false;
    
public booleanisDivideNode()
INTERNAL Is this node a Divide node

        return false;
    
public booleanisDotNode()
INTERNAL Is this node a Dot node

        return false;
    
public booleanisEscape()
INTERNAL Is this an escape node

        return false;// no it is not
    
public booleanisLiteralNode()
INTERNAL Is this a literal node

        return false;
    
public booleanisMinusNode()
INTERNAL Is this node a Minus node

        return false;
    
public booleanisMultiplyNode()
INTERNAL Is this node a Multiply node

        return false;
    
public booleanisNotNode()
INTERNAL Is this node a Not node

        return false;
    
public booleanisParameterNode()
INTERNAL Is this a Parameter node

        return false;
    
public booleanisPlusNode()
INTERNAL Is this node a Plus node

        return false;
    
public booleanisSubqueryNode()
INTERNAL Is this node a SubqueryNode

        return false;
    
public booleanisVariableNode()
INTERNAL Is this node a VariableNode

        return false;
    
public oracle.toplink.essentials.internal.parsing.NodequalifyAttributeAccess(oracle.toplink.essentials.internal.parsing.ParseTreeContext context)
INTERNAL Check the child node for an unqualified field access and if so, replace it by a qualified field access.

        if (left != null) {
            left = left.qualifyAttributeAccess(context);
        }
        if (right != null) {
            right = right.qualifyAttributeAccess(context);
        }
        return this;
    
public java.lang.StringresolveAttribute()
resolveAttribute(): Answer the name of the attribute which is represented by the receiver. Subclasses should override this.

        return "";
    
public java.lang.ClassresolveClass(oracle.toplink.essentials.internal.parsing.GenerationContext context)
resolveClass: Answer the class associated with the content of this node. Default is to return null. Subclasses should override this.

        return null;
    
public java.lang.ClassresolveClass(oracle.toplink.essentials.internal.parsing.GenerationContext context, java.lang.Class ownerClass)
resolveClass: Answer the class associated with the content of this node. Default is to return null. Subclasses should override this.

        return null;
    
public oracle.toplink.essentials.mappings.DatabaseMappingresolveMapping(oracle.toplink.essentials.internal.parsing.GenerationContext context)
resolveMapping: Answer the mapping associated with the contained nodes. Subclasses should override this.

        return null;
    
public oracle.toplink.essentials.mappings.DatabaseMappingresolveMapping(oracle.toplink.essentials.internal.parsing.GenerationContext context, java.lang.Class ownerClass)
resolveMapping: Answer the mapping associated with the contained nodes. Use the provided class as the context. Subclasses should override this.

        return null;
    
public voidsetColumn(int column)

        this.column = column;
    
public voidsetLeft(oracle.toplink.essentials.internal.parsing.Node newLeft)
INTERNAL Set the left node to the passed value

        left = newLeft;
    
public voidsetLine(int line)

        this.line = line;
    
public voidsetRight(oracle.toplink.essentials.internal.parsing.Node newRight)
INTERNAL Set the right for this node

        right = newRight;
    
public voidsetType(java.lang.Object type)
INTERNAL Set this node's type.

        this.type = type;
    
public java.lang.StringtoString()

        try {
            return toString(1);
        } catch (Throwable t) {
            return t.toString();
        }
    
public java.lang.StringtoString(int indent)

        StringBuffer buffer = new StringBuffer();
        buffer.append(toStringDisplayName());
        buffer.append("\r\n");
        toStringIndent(indent, buffer);
        if (hasLeft()) {
            buffer.append("Left: " + getLeft().toString(indent + 1));
        } else {
            buffer.append("Left: null");
        }

        buffer.append("\r\n");
        toStringIndent(indent, buffer);
        if (hasRight()) {
            buffer.append("Right: " + getRight().toString(indent + 1));
        } else {
            buffer.append("Right: null");
        }
        return buffer.toString();
    
public java.lang.StringtoStringDisplayName()

        return getClass().toString().substring(getClass().toString().lastIndexOf('.") + 1, getClass().toString().length());
    
public voidtoStringIndent(int indent, java.lang.StringBuffer buffer)

        for (int i = 0; i < indent; i++) {
            buffer.append("  ");
        }
        ;
    
public voidvalidate(oracle.toplink.essentials.internal.parsing.ParseTreeContext context)
INTERNAL Validate node and calculate its type.

        // Nothing to be validated here, but delegate to the child nodes.
        if (left != null) {
            left.validate(context);
        }
        if (right != null) {
            right.validate(context);
        }
    
public voidvalidateParameter(oracle.toplink.essentials.internal.parsing.ParseTreeContext context, java.lang.Object contextType)
INTERNAL

        // nothing to be done