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

The following examples show how to use com.sun.org.apache.xpath.internal.Expression. 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 File: Function3Args.java    From hottub with 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 #2
Source File: PredicatedNodeTest.java    From JDKSourceCode1.8 with 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 #3
Source File: UnionPathIterator.java    From jdk8u60 with 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 #4
Source File: UnionPattern.java    From Bytecoder with 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 #5
Source File: UnionPathIterator.java    From hottub with 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 #6
Source File: UnionPattern.java    From openjdk-8 with 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 #7
Source File: Function3Args.java    From jdk8u60 with 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 #8
Source File: PredicatedNodeTest.java    From jdk8u60 with 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 #9
Source File: WalkingIterator.java    From jdk8u60 with 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 #10
Source File: UnionPathIterator.java    From openjdk-8 with 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 #11
Source File: Compiler.java    From openjdk-8 with 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 #12
Source File: AxesWalker.java    From JDKSourceCode1.8 with 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 #13
Source File: Compiler.java    From openjdk-8-source with 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 #14
Source File: FilterExprIterator.java    From openjdk-8 with 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 #15
Source File: FunctionMultiArgs.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 #16
Source File: UnionPathIterator.java    From JDKSourceCode1.8 with 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 #17
Source File: UnionPathIterator.java    From openjdk-8 with 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 #18
Source File: Compiler.java    From openjdk-jdk8u-backup with 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 #19
Source File: Compiler.java    From openjdk-jdk9 with 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 #20
Source File: FuncExtFunction.java    From openjdk-jdk8u with GNU General Public License v2.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 #21
Source File: AxesWalker.java    From openjdk-jdk9 with 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 #22
Source File: UnionPathIterator.java    From jdk8u60 with 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 #23
Source File: Compiler.java    From jdk1.8-source-analysis with 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 #24
Source File: FuncExtFunction.java    From Bytecoder with 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 File: Function.java    From hottub with 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 File: Operation.java    From JDKSourceCode1.8 with 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 File: FuncExtFunction.java    From jdk1.8-source-analysis with 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 File: Operation.java    From openjdk-8 with 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
Source File: OneStepIteratorForward.java    From hottub with 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;

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

      return true;
}
 
Example #30
Source File: FunctionPattern.java    From openjdk-jdk9 with 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;
}