FileDocCategorySizeDatePackage
Operation.javaAPI DocJava SE 6 API5644Tue Jun 10 00:23:16 BST 2008com.sun.org.apache.xpath.internal.operations

Operation

public class Operation extends Expression implements ExpressionOwner
The baseclass for a binary operation.

Fields Summary
static final long
serialVersionUID
protected Expression
m_left
The left operand expression.
protected Expression
m_right
The right operand expression.
Constructors Summary
Methods Summary
public voidcallVisitors(com.sun.org.apache.xpath.internal.ExpressionOwner owner, com.sun.org.apache.xpath.internal.XPathVisitor visitor)

see
com.sun.org.apache.xpath.internal.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor)

  	if(visitor.visitBinaryOperation(owner, this))
  	{
  		m_left.callVisitors(new LeftExprOwner(), visitor);
  		m_right.callVisitors(this, visitor);
  	}
  
public booleancanTraverseOutsideSubtree()
Tell if this expression or it's subexpressions can traverse outside the current subtree.

return
true if traversal outside the context node's subtree can occur.


    if (null != m_left && m_left.canTraverseOutsideSubtree())
      return true;

    if (null != m_right && m_right.canTraverseOutsideSubtree())
      return true;

    return false;
  
public booleandeepEquals(com.sun.org.apache.xpath.internal.Expression expr)

see
Expression#deepEquals(Expression)

  	if(!isSameClass(expr))
  		return false;
  		
  	if(!m_left.deepEquals(((Operation)expr).m_left))
  		return false;
  		
  	if(!m_right.deepEquals(((Operation)expr).m_right))
  		return false;
  		
  	return true;
  
public com.sun.org.apache.xpath.internal.objects.XObjectexecute(com.sun.org.apache.xpath.internal.XPathContext xctxt)
Execute a binary operation by calling execute on each of the operands, and then calling the operate method on the derived class.

param
xctxt The runtime execution context.
return
The XObject result of the operation.
throws
javax.xml.transform.TransformerException


    XObject left = m_left.execute(xctxt, true);
    XObject right = m_right.execute(xctxt, true);

    XObject result = operate(left, right);
    left.detach();
    right.detach();
    return result;
  
public voidfixupVariables(java.util.Vector vars, int globalsSize)
This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time.

param
vars List of QNames that correspond to variables. This list should be searched backwards for the first qualified name that corresponds to the variable reference qname. The position of the QName in the vector from the start of the vector will be its position in the stack frame (but variables above the globalsTop value will need to be offset to the current stack frame).

  
                                                                                               
       
  
    m_left.fixupVariables(vars, globalsSize);
    m_right.fixupVariables(vars, globalsSize);
  
public com.sun.org.apache.xpath.internal.ExpressiongetExpression()

see
ExpressionOwner#getExpression()

    return m_right;
  
public com.sun.org.apache.xpath.internal.ExpressiongetLeftOperand()

return
the left operand of binary operation, as an Expression.

    return m_left;
  
public com.sun.org.apache.xpath.internal.ExpressiongetRightOperand()

return
the right operand of binary operation, as an Expression.

    return m_right;
  
public com.sun.org.apache.xpath.internal.objects.XObjectoperate(com.sun.org.apache.xpath.internal.objects.XObject left, com.sun.org.apache.xpath.internal.objects.XObject right)
Apply the operation to two operands, and return the result.

param
left non-null reference to the evaluated left operand.
param
right non-null reference to the evaluated right operand.
return
non-null reference to the XObject that represents the result of the operation.
throws
javax.xml.transform.TransformerException

    return null;  // no-op
  
public voidsetExpression(com.sun.org.apache.xpath.internal.Expression exp)

see
ExpressionOwner#setExpression(Expression)

  	exp.exprSetParent(this);
  	m_right = exp;
  
public voidsetLeftRight(com.sun.org.apache.xpath.internal.Expression l, com.sun.org.apache.xpath.internal.Expression r)
Set the left and right operand expressions for this operation.

param
l The left expression operand.
param
r The right expression operand.

    m_left = l;
    m_right = r;
    l.exprSetParent(this);
    r.exprSetParent(this);