Package org.apache.xpath.axes

Examples of org.apache.xpath.axes.AxesWalker


      Vector vars = root.getVariablesAndParamsComposed();
      var.setIndex(vars.size()-1);
    }
   
    // Walk to the first walker after the one's we are replacing.
    AxesWalker walker = wi.getFirstWalker();
    for(int i = 0; i < numSteps; i++)
    {
      assertion(null != walker, "Walker should not be null!");
      walker = walker.getNextWalker();
    }
   
    if(null != walker)
    {
   
      FilterExprWalker few = new FilterExprWalker(wi);
      few.setInnerExpression(var);
      few.exprSetParent(wi);
      few.setNextWalker(walker);
      walker.setPrevWalker(few);
      wi.setFirstWalker(few);
      return wi;
    }
    else
    {
View Full Code Here


  protected WalkingIterator createIteratorFromSteps(final WalkingIterator wi, int numSteps)
  {
    WalkingIterator newIter = new WalkingIterator(wi.getPrefixResolver());
    try
    {
      AxesWalker walker = (AxesWalker)wi.getFirstWalker().clone();
      newIter.setFirstWalker(walker);
      walker.setLocPathIterator(newIter);
      for(int i = 1; i < numSteps; i++)
      {
        AxesWalker next = (AxesWalker)walker.getNextWalker().clone();
        walker.setNextWalker(next);
        next.setLocPathIterator(newIter);
        walker = next;
      }
      walker.setNextWalker(null);
    }
    catch(CloneNotSupportedException cnse)
View Full Code Here

   *
   */
  protected boolean stepsEqual(WalkingIterator iter1, WalkingIterator iter2,
                                         int numSteps)
  {
    AxesWalker aw1 = iter1.getFirstWalker();
    AxesWalker aw2 = iter2.getFirstWalker();
   
    for(int i = 0; (i < numSteps); i++)
    {
      if((null == aw1) || (null == aw2))
         return false;
        
      if(!aw1.deepEquals(aw2))
        return false;
     
      aw1 = aw1.getNextWalker();
      aw2 = aw2.getNextWalker();
    }
   
    assertion((null != aw1) || (null != aw2), "Total match is incorrect!");
   
    return true;
View Full Code Here

  protected int countSteps(LocPathIterator lpi)
  {
    if(lpi instanceof WalkingIterator)
    {
      WalkingIterator wi = (WalkingIterator)lpi;
      AxesWalker aw = wi.getFirstWalker();
      int count = 0;
      while(null != aw)
      {
        count++;
        aw = aw.getNextWalker();
      }
      return count;
    }
    else
      return 1;
View Full Code Here

      return true;
    }
    else if(path instanceof WalkingIterator)
    {
      WalkingIterator wi = (WalkingIterator)path;
      AxesWalker aw = wi.getFirstWalker();
      if((aw instanceof FilterExprWalker) && (null == aw.getNextWalker()))
      {
        FilterExprWalker few = (FilterExprWalker)aw;
        Expression exp = few.getInnerExpression();
        if(exp instanceof Variable)
          return true;
View Full Code Here

      Vector vars = root.getVariablesAndParamsComposed();
      var.setIndex(vars.size()-1);
    }
   
    // Walk to the first walker after the one's we are replacing.
    AxesWalker walker = wi.getFirstWalker();
    for(int i = 0; i < numSteps; i++)
    {
      assertion(null != walker, "Walker should not be null!");
      walker = walker.getNextWalker();
    }
   
    if(null != walker)
    {
   
      FilterExprWalker few = new FilterExprWalker(wi);
      few.setInnerExpression(var);
      few.exprSetParent(wi);
      few.setNextWalker(walker);
      walker.setPrevWalker(few);
      wi.setFirstWalker(few);
      return wi;
    }
    else
    {
View Full Code Here

  protected WalkingIterator createIteratorFromSteps(final WalkingIterator wi, int numSteps)
  {
    WalkingIterator newIter = new WalkingIterator(wi.getPrefixResolver());
    try
    {
      AxesWalker walker = (AxesWalker)wi.getFirstWalker().clone();
      newIter.setFirstWalker(walker);
      walker.setLocPathIterator(newIter);
      for(int i = 1; i < numSteps; i++)
      {
        AxesWalker next = (AxesWalker)walker.getNextWalker().clone();
        walker.setNextWalker(next);
        next.setLocPathIterator(newIter);
        walker = next;
      }
      walker.setNextWalker(null);
    }
    catch(CloneNotSupportedException cnse)
View Full Code Here

   *
   */
  protected boolean stepsEqual(WalkingIterator iter1, WalkingIterator iter2,
                                         int numSteps)
  {
    AxesWalker aw1 = iter1.getFirstWalker();
    AxesWalker aw2 = iter2.getFirstWalker();
   
    for(int i = 0; (i < numSteps); i++)
    {
      if((null == aw1) || (null == aw2))
         return false;
        
      if(!aw1.deepEquals(aw2))
        return false;
     
      aw1 = aw1.getNextWalker();
      aw2 = aw2.getNextWalker();
    }
   
    assertion((null != aw1) || (null != aw2), "Total match is incorrect!");
   
    return true;
View Full Code Here

  protected int countSteps(LocPathIterator lpi)
  {
    if(lpi instanceof WalkingIterator)
    {
      WalkingIterator wi = (WalkingIterator)lpi;
      AxesWalker aw = wi.getFirstWalker();
      int count = 0;
      while(null != aw)
      {
        count++;
        aw = aw.getNextWalker();
      }
      return count;
    }
    else
      return 1;
View Full Code Here

      return true;
    }
    else if(path instanceof WalkingIterator)
    {
      WalkingIterator wi = (WalkingIterator)path;
      AxesWalker aw = wi.getFirstWalker();
      if((aw instanceof FilterExprWalker) && (null == aw.getNextWalker()))
      {
        FilterExprWalker few = (FilterExprWalker)aw;
        Expression exp = few.getInnerExpression();
        if(exp instanceof Variable)
          return true;
View Full Code Here

TOP

Related Classes of org.apache.xpath.axes.AxesWalker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.