Java Code Examples for com.sun.org.apache.xpath.internal.Expression

The following examples show how to use com.sun.org.apache.xpath.internal.Expression. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hottub   Source File: UnionPathIterator.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add an iterator to the union list.
 *
 * @param expr non-null reference to a location path iterator.
 */
public void addIterator(DTMIterator expr)
{

  // Increase array size by only 1 at a time.  Fix this
  // if it looks to be a problem.
  if (null == m_iterators)
  {
    m_iterators = new DTMIterator[1];
    m_iterators[0] = expr;
  }
  else
  {
    DTMIterator[] exprs = m_iterators;
    int len = m_iterators.length;

    m_iterators = new DTMIterator[len + 1];

    System.arraycopy(exprs, 0, m_iterators, 0, len);

    m_iterators[len] = expr;
  }
  expr.nextNode();
  if(expr instanceof Expression)
      ((Expression)expr).exprSetParent(this);
}
 
Example 2
Source Project: jdk8u60   Source File: PredicatedNodeTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
  if (!super.deepEquals(expr))
        return false;

  PredicatedNodeTest pnt = (PredicatedNodeTest) expr;
  if (null != m_predicates)
  {

    int n = m_predicates.length;
    if ((null == pnt.m_predicates) || (pnt.m_predicates.length != n))
          return false;
    for (int i = 0; i < n; i++)
    {
      if (!m_predicates[i].deepEquals(pnt.m_predicates[i]))
            return false;
    }
  }
  else if (null != pnt.m_predicates)
          return false;

  return true;
}
 
Example 3
Source Project: jdk8u60   Source File: WalkingIterator.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
  if (!super.deepEquals(expr))
            return false;

  AxesWalker walker1 = m_firstWalker;
  AxesWalker walker2 = ((WalkingIterator)expr).m_firstWalker;
  while ((null != walker1) && (null != walker2))
  {
    if(!walker1.deepEquals(walker2))
            return false;
    walker1 = walker1.getNextWalker();
    walker2 = walker2.getNextWalker();
  }

  if((null != walker1) || (null != walker2))
    return false;

  return true;
}
 
Example 4
Source Project: hottub   Source File: Function3Args.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
      if(!super.deepEquals(expr))
              return false;

      if(null != m_arg2)
      {
              if(null == ((Function3Args)expr).m_arg2)
                      return false;

              if(!m_arg2.deepEquals(((Function3Args)expr).m_arg2))
                      return false;
      }
      else if (null != ((Function3Args)expr).m_arg2)
              return false;

      return true;
}
 
Example 5
Source Project: openjdk-8   Source File: UnionPathIterator.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see ExpressionOwner#setExpression(Expression)
 */
public void setExpression(Expression exp)
{

    if(!(exp instanceof LocPathIterator))
    {
            // Yuck.  Need FilterExprIter.  Or make it so m_exprs can be just
            // plain expressions?
            WalkingIterator wi = new WalkingIterator(getPrefixResolver());
            FilterExprWalker few = new FilterExprWalker(wi);
            wi.setFirstWalker(few);
            few.setInnerExpression(exp);
            wi.exprSetParent(UnionPathIterator.this);
            few.exprSetParent(wi);
            exp.exprSetParent(few);
            exp = wi;
    }
    else
            exp.exprSetParent(UnionPathIterator.this);
    m_exprs[m_index] = (LocPathIterator)exp;
}
 
Example 6
Source Project: jdk8u60   Source File: Function3Args.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
      if(!super.deepEquals(expr))
              return false;

      if(null != m_arg2)
      {
              if(null == ((Function3Args)expr).m_arg2)
                      return false;

              if(!m_arg2.deepEquals(((Function3Args)expr).m_arg2))
                      return false;
      }
      else if (null != ((Function3Args)expr).m_arg2)
              return false;

      return true;
}
 
Example 7
Source Project: openjdk-8   Source File: UnionPattern.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
      if(!isSameClass(expr))
              return false;

      UnionPattern up = (UnionPattern)expr;

      if(null != m_patterns)
      {
              int n = m_patterns.length;
              if((null == up.m_patterns) || (up.m_patterns.length != n))
                      return false;

              for(int i = 0; i < n; i++)
              {
                      if(!m_patterns[i].deepEquals(up.m_patterns[i]))
                              return false;
              }
      }
      else if(up.m_patterns != null)
              return false;

      return true;

}
 
Example 8
Source Project: Bytecoder   Source File: UnionPattern.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
      if(!isSameClass(expr))
              return false;

      UnionPattern up = (UnionPattern)expr;

      if(null != m_patterns)
      {
              int n = m_patterns.length;
              if((null == up.m_patterns) || (up.m_patterns.length != n))
                      return false;

              for(int i = 0; i < n; i++)
              {
                      if(!m_patterns[i].deepEquals(up.m_patterns[i]))
                              return false;
              }
      }
      else if(up.m_patterns != null)
              return false;

      return true;

}
 
Example 9
Source Project: jdk8u60   Source File: UnionPathIterator.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see ExpressionOwner#setExpression(Expression)
 */
public void setExpression(Expression exp)
{

    if(!(exp instanceof LocPathIterator))
    {
            // Yuck.  Need FilterExprIter.  Or make it so m_exprs can be just
            // plain expressions?
            WalkingIterator wi = new WalkingIterator(getPrefixResolver());
            FilterExprWalker few = new FilterExprWalker(wi);
            wi.setFirstWalker(few);
            few.setInnerExpression(exp);
            wi.exprSetParent(UnionPathIterator.this);
            few.exprSetParent(wi);
            exp.exprSetParent(few);
            exp = wi;
    }
    else
            exp.exprSetParent(UnionPathIterator.this);
    m_exprs[m_index] = (LocPathIterator)exp;
}
 
Example 10
Source Project: JDKSourceCode1.8   Source File: PredicatedNodeTest.java    License: MIT License 6 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
  if (!super.deepEquals(expr))
        return false;

  PredicatedNodeTest pnt = (PredicatedNodeTest) expr;
  if (null != m_predicates)
  {

    int n = m_predicates.length;
    if ((null == pnt.m_predicates) || (pnt.m_predicates.length != n))
          return false;
    for (int i = 0; i < n; i++)
    {
      if (!m_predicates[i].deepEquals(pnt.m_predicates[i]))
            return false;
    }
  }
  else if (null != pnt.m_predicates)
          return false;

  return true;
}
 
Example 11
Source Project: JDKSourceCode1.8   Source File: AxesWalker.java    License: MIT License 5 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
  if (!super.deepEquals(expr))
            return false;

  AxesWalker walker = (AxesWalker)expr;
  if(this.m_axis != walker.m_axis)
    return false;

  return true;
}
 
Example 12
Source Project: openjdk-jdk9   Source File: Compiler.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Compile a location path union. The UnionPathIterator itself may create
 * {@link com.sun.org.apache.xpath.internal.axes.LocPathIterator} children.
 *
 * @param opPos The current position in the m_opMap array.
 *
 * @return reference to {@link com.sun.org.apache.xpath.internal.axes.LocPathIterator} instance.
 *
 * @throws TransformerException if a error occurs creating the Expression.
 */
protected Expression union(int opPos) throws TransformerException
{
  locPathDepth++;
  try
  {
    return UnionPathIterator.createUnionIterator(this, opPos);
  }
  finally
  {
    locPathDepth--;
  }
}
 
Example 13
Source Project: JDKSourceCode1.8   Source File: UnionPathIterator.java    License: MIT License 5 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
  if (!super.deepEquals(expr))
        return false;

  UnionPathIterator upi = (UnionPathIterator) expr;

  if (null != m_exprs)
  {
    int n = m_exprs.length;

    if((null == upi.m_exprs) || (upi.m_exprs.length != n))
            return false;

    for (int i = 0; i < n; i++)
    {
      if(!m_exprs[i].deepEquals(upi.m_exprs[i]))
            return false;
    }
  }
  else if (null != upi.m_exprs)
  {
      return false;
  }

  return true;
}
 
Example 14
/**
 * Set an argument expression for a function.  This method is called by the
 * XPath compiler.
 *
 * @param arg non-null expression that represents the argument.
 * @param argNum The argument number index.
 *
 * @throws WrongNumberArgsException If a derived class determines that the
 * number of arguments is incorrect.
 */
public void setArg(Expression arg, int argNum)
        throws WrongNumberArgsException
{

  if (argNum < 3)
    super.setArg(arg, argNum);
  else
  {
    if (null == m_args)
    {
      m_args = new Expression[1];
      m_args[0] = arg;
    }
    else
    {

      // Slow but space conservative.
      Expression[] args = new Expression[m_args.length + 1];

      System.arraycopy(m_args, 0, args, 0, m_args.length);

      args[m_args.length] = arg;
      m_args = args;
    }
    arg.exprSetParent(this);
  }
}
 
Example 15
Source Project: openjdk-8   Source File: FilterExprIterator.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
  if (!super.deepEquals(expr))
    return false;

  FilterExprIterator fet = (FilterExprIterator) expr;
  if (!m_expr.deepEquals(fet.m_expr))
    return false;

  return true;
}
 
Example 16
Source Project: openjdk-8   Source File: UnionPathIterator.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
  if (!super.deepEquals(expr))
        return false;

  UnionPathIterator upi = (UnionPathIterator) expr;

  if (null != m_exprs)
  {
    int n = m_exprs.length;

    if((null == upi.m_exprs) || (upi.m_exprs.length != n))
            return false;

    for (int i = 0; i < n; i++)
    {
      if(!m_exprs[i].deepEquals(upi.m_exprs[i]))
            return false;
    }
  }
  else if (null != upi.m_exprs)
  {
      return false;
  }

  return true;
}
 
Example 17
/**
 * Call the visitors for the function arguments.
 */
public void callArgVisitors(XPathVisitor visitor)
{
    for (int i = 0; i < m_argVec.size(); i++)
    {
       Expression exp = (Expression)m_argVec.elementAt(i);
       exp.callVisitors(new ArgExtOwner(exp), visitor);
    }

}
 
Example 18
Source Project: openjdk-8-source   Source File: Compiler.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Compiles predicates in the step.
 *
 * @param opPos The position of the first predicate the m_opMap array.
 * @param predicates An empty pre-determined array of
 *            {@link com.sun.org.apache.xpath.internal.Expression}s, that will be filled in.
 *
 * @throws TransformerException
 */
private void compilePredicates(int opPos, Expression[] predicates)
        throws TransformerException
{

  for (int i = 0; OpCodes.OP_PREDICATE == getOp(opPos); i++)
  {
    predicates[i] = predicate(opPos);
    opPos = getNextOpPos(opPos);
  }
}
 
Example 19
Source Project: openjdk-8   Source File: Compiler.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Bottle-neck compilation of a unary operation.
 *
 * @param unary The parent unary operation.
 * @param opPos The position in the op map of the parent operation.
 *
 * @return The unary argument.
 *
 * @throws TransformerException if syntax or other error occurs.
 */
private Expression compileUnary(UnaryOperation unary, int opPos)
        throws TransformerException
{

  int rightPos = getFirstChildPos(opPos);

  unary.setRight(compile(rightPos));

  return unary;
}
 
Example 20
Source Project: openjdk-jdk9   Source File: AxesWalker.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
  if (!super.deepEquals(expr))
            return false;

  AxesWalker walker = (AxesWalker)expr;
  if(this.m_axis != walker.m_axis)
    return false;

  return true;
}
 
Example 21
Source Project: jdk8u60   Source File: UnionPathIterator.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
  if (!super.deepEquals(expr))
        return false;

  UnionPathIterator upi = (UnionPathIterator) expr;

  if (null != m_exprs)
  {
    int n = m_exprs.length;

    if((null == upi.m_exprs) || (upi.m_exprs.length != n))
            return false;

    for (int i = 0; i < n; i++)
    {
      if(!m_exprs[i].deepEquals(upi.m_exprs[i]))
            return false;
    }
  }
  else if (null != upi.m_exprs)
  {
      return false;
  }

  return true;
}
 
Example 22
Source Project: jdk1.8-source-analysis   Source File: Compiler.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Compile a location path.  The LocPathIterator itself may create
 * {@link com.sun.org.apache.xpath.internal.axes.AxesWalker} children.
 *
 * @param opPos The current position in the m_opMap array.
 *
 * @return reference to {@link com.sun.org.apache.xpath.internal.axes.LocPathIterator} instance.
 *
 * @throws TransformerException if a error occurs creating the Expression.
 */
public Expression locationPath(int opPos) throws TransformerException
{
  locPathDepth++;
  try
  {
    DTMIterator iter = WalkerFactory.newDTMIterator(this, opPos, (locPathDepth == 0));
    return (Expression)iter; // cast OK, I guess.
  }
  finally
  {
    locPathDepth--;
  }
}
 
Example 23
/**
 * Bottle-neck compilation of a unary operation.
 *
 * @param unary The parent unary operation.
 * @param opPos The position in the op map of the parent operation.
 *
 * @return The unary argument.
 *
 * @throws TransformerException if syntax or other error occurs.
 */
private Expression compileUnary(UnaryOperation unary, int opPos)
        throws TransformerException
{

  int rightPos = getFirstChildPos(opPos);

  unary.setRight(compile(rightPos));

  return unary;
}
 
Example 24
Source Project: Bytecoder   Source File: FuncExtFunction.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Return the nth argument passed to the extension function.
 *
 * @param n The argument number index.
 * @return The Expression object at the given index.
 */
public Expression getArg(int n) {
  if (n >= 0 && n < m_argVec.size())
    return m_argVec.get(n);
  else
    return null;
}
 
Example 25
Source Project: hottub   Source File: Function.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
      if(!isSameClass(expr))
              return false;

      return true;
}
 
Example 26
Source Project: JDKSourceCode1.8   Source File: Operation.java    License: MIT License 5 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
      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;
}
 
Example 27
Source Project: jdk1.8-source-analysis   Source File: FuncExtFunction.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Call the visitors for the function arguments.
 */
public void callArgVisitors(XPathVisitor visitor)
{
    for (int i = 0; i < m_argVec.size(); i++)
    {
       Expression exp = (Expression)m_argVec.elementAt(i);
       exp.callVisitors(new ArgExtOwner(exp), visitor);
    }

}
 
Example 28
Source Project: openjdk-8   Source File: Operation.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
      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;
}
 
Example 29
/**
 * @see Expression#deepEquals(Expression)
 */
public boolean deepEquals(Expression expr)
{
      if(!super.deepEquals(expr))
              return false;

      if(m_axis != ((OneStepIteratorForward)expr).m_axis)
              return false;

      return true;
}
 
Example 30
Source Project: openjdk-jdk9   Source File: FunctionPattern.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a FunctionPattern from a
 * {@link com.sun.org.apache.xpath.internal.functions.Function expression}.
 *
 * NEEDSDOC @param expr
 */
public FunctionPattern(Expression expr, int axis, int predaxis)
{

  super(0, null, null, axis, predaxis);

  m_functionExpr = expr;
}