Package org.apache.xpath

Examples of org.apache.xpath.ExpressionOwner


    if (null != m_predicates)
      {
      int n = m_predicates.length;
      for (int i = 0; i < n; i++)
        {
        ExpressionOwner predOwner = new PredOwner(i);
        if (visitor.visitPredicate(predOwner, m_predicates[i]))
          {
          m_predicates[i].callVisitors(predOwner, visitor);
        }
 
View Full Code Here


    int n = paths.size();
    int numPathsEliminated = 0;
    int numUniquePathsEliminated = 0;
    for (int i = 0; i < n; i++)
    {
      ExpressionOwner owner = (ExpressionOwner) paths.elementAt(i);
      if (null != owner)
      {
        int found = findAndEliminateRedundant(i + 1, i, owner, psuedoVarRecipient, paths);
        if (found > 0)
                  numUniquePathsEliminated++;
View Full Code Here

    ElemVariable var = createPseudoVarDecl(root, newIter, isGlobal);
    if(DIAGNOSE_MULTISTEPLIST)
      System.err.println("Created var: "+var.getName()+(isGlobal ? "(Global)" : ""));
    while(null != matchedPaths)
    {
      ExpressionOwner owner = matchedPaths.m_exprOwner;
      WalkingIterator iter = (WalkingIterator)owner.getExpression();
     
      if(DIAGNOSE_MULTISTEPLIST)
        diagnoseLineNumber(iter);
     
      LocPathIterator newIter2 =
          changePartToRef(var.getName(), iter, lengthToTest, isGlobal);
      owner.setExpression(newIter2);
     
      matchedPaths = matchedPaths.m_next;
    }
  }
 
View Full Code Here

    if (null != m_predicates)
    {
      int n = m_predicates.length;
      for (int i = 0; i < n; i++)
      {
        ExpressionOwner predOwner = new PredOwner(i);
        if (visitor.visitPredicate(predOwner, m_predicates[i]))
        {
          m_predicates[i].callVisitors(predOwner, visitor);
        }
      }
View Full Code Here

  {
    MultistepExprHolder first = null;
    int n = paths.size();
    for(int i = 0; i < n; i++)
    {
      ExpressionOwner eo = (ExpressionOwner)paths.elementAt(i);
      if(null == eo)
        continue;
       
      // Assuming location path iterators should be OK.
      LocPathIterator lpi = (LocPathIterator)eo.getExpression();
      int numPaths = countSteps(lpi);
      if(numPaths > 1)
      {
        if(null == first)
          first = new MultistepExprHolder(eo, numPaths, null);
View Full Code Here

  boolean isGlobal = (paths == m_absPaths);
  LocPathIterator lpi = (LocPathIterator)expr1;
  int stepCount = countSteps(lpi);
  for(int j = start; j < n; j++)
  {
    ExpressionOwner owner2 = (ExpressionOwner)paths.elementAt(j);
    if(null != owner2)
    {
      Expression expr2 = owner2.getExpression();
      boolean isEqual = expr2.deepEquals(lpi);
      if(isEqual)
      {     
        LocPathIterator lpi2  = (LocPathIterator)expr2;       
        if(null == head)
        {
          head = new MultistepExprHolder(firstOccuranceOwner, stepCount, null);
          tail = head;
          numPathsFound++;
        }
        tail.m_next = new MultistepExprHolder(owner2, stepCount, null);
        tail = tail.m_next;
 
        // Null out the occurance, so we don't have to test it again.
        paths.setElementAt(null, j);
       
        // foundFirst = true;
        numPathsFound++;
      }
    }
  }
 
  // Change all globals in xsl:templates, etc, to global vars no matter what.
  if((0 == numPathsFound) && isGlobal)
  {
      head = new MultistepExprHolder(firstOccuranceOwner, stepCount, null);
      numPathsFound++;
  }
 
  if(null != head)
  {
    ElemTemplateElement root = isGlobal ? psuedoVarRecipient : findCommonAncestor(head);
    LocPathIterator sharedIter = (LocPathIterator)head.m_exprOwner.getExpression();
    ElemVariable var = createPseudoVarDecl(root, sharedIter, isGlobal);
    if(DIAGNOSE_MULTISTEPLIST)
      System.err.println("Created var: "+var.getName()+(isGlobal ? "(Global)" : ""));
    QName uniquePseudoVarName = var.getName();
    while(null != head)
    {
      ExpressionOwner owner = head.m_exprOwner; 
      if(DIAGNOSE_MULTISTEPLIST)
        diagnoseLineNumber(owner.getExpression());
      changeToVarRef(uniquePseudoVarName, owner, paths, root);
      head = head.m_next;
    }
    // Replace the first occurance with the variable's XPath, so 
    // that further reduction may take place if needed.
View Full Code Here

    assertIsLocPathIterator(expr1, firstOccuranceOwner);
  boolean isGlobal = (paths == m_absPaths);
  LocPathIterator lpi = (LocPathIterator)expr1;
  for(int j = start; j < n; j++)
  {
    ExpressionOwner owner2 = (ExpressionOwner)paths.elementAt(j);
    if(null != owner2)
    {
      Expression expr2 = owner2.getExpression();
      boolean isEqual = expr2.deepEquals(lpi);
      if(isEqual)
      {     
        LocPathIterator lpi2  = (LocPathIterator)expr2;       
        if(!foundFirst)
View Full Code Here

    assertion(owner.getExpression() == path, "owner.getExpression() != path!!!");
  int n = paths.size();
  // There should never be any duplicates in the list!
  for(int i = 0; i < n; i++)
  {
    ExpressionOwner ew = (ExpressionOwner)paths.elementAt(i);
    assertion(ew != owner, "duplicate owner on the list!!!");
    assertion(ew.getExpression() != path, "duplicate expression on the list!!!");
  }
  }
View Full Code Here

    if (null != m_predicates)
    {
      int n = m_predicates.length;
      for (int i = 0; i < n; i++)
      {
        ExpressionOwner predOwner = new PredOwner(i);
        if (visitor.visitPredicate(predOwner, m_predicates[i]))
        {
          m_predicates[i].callVisitors(predOwner, visitor);
        }
      }
View Full Code Here

    if (null != m_predicates)
      {
      int n = m_predicates.length;
      for (int i = 0; i < n; i++)
        {
        ExpressionOwner predOwner = new PredOwner(i);
        if (visitor.visitPredicate(predOwner, m_predicates[i]))
          {
          m_predicates[i].callVisitors(predOwner, visitor);
        }
 
View Full Code Here

TOP

Related Classes of org.apache.xpath.ExpressionOwner

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.