当前位置: 首页>>代码示例>>Java>>正文


Java Axis.DESCENDANTORSELF属性代码示例

本文整理汇总了Java中com.sun.org.apache.xml.internal.dtm.Axis.DESCENDANTORSELF属性的典型用法代码示例。如果您正苦于以下问题:Java Axis.DESCENDANTORSELF属性的具体用法?Java Axis.DESCENDANTORSELF怎么用?Java Axis.DESCENDANTORSELF使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.sun.org.apache.xml.internal.dtm.Axis的用法示例。


在下文中一共展示了Axis.DESCENDANTORSELF属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAxisIterator

public DTMAxisIterator getAxisIterator(final int axis)
{
    switch (axis)
    {
        case Axis.CHILD:
        case Axis.DESCENDANT:
            return new SimpleIterator(SimpleIterator.DIRECTION_DOWN);
        case Axis.PARENT:
        case Axis.ANCESTOR:
            return new SimpleIterator(SimpleIterator.DIRECTION_UP);
        case Axis.ANCESTORORSELF:
            return (new SimpleIterator(SimpleIterator.DIRECTION_UP)).includeSelf();
        case Axis.DESCENDANTORSELF:
            return (new SimpleIterator(SimpleIterator.DIRECTION_DOWN)).includeSelf();
        case Axis.SELF:
            return new SingletonIterator();
        default:
            return EMPTY_ITERATOR;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:SimpleResultTreeImpl.java

示例2: getTypedAxisIterator

public DTMAxisIterator getTypedAxisIterator(final int axis, final int type)
{
    switch (axis)
    {
        case Axis.CHILD:
        case Axis.DESCENDANT:
            return new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type);
        case Axis.PARENT:
        case Axis.ANCESTOR:
            return new SimpleIterator(SimpleIterator.DIRECTION_UP, type);
        case Axis.ANCESTORORSELF:
            return (new SimpleIterator(SimpleIterator.DIRECTION_UP, type)).includeSelf();
        case Axis.DESCENDANTORSELF:
            return (new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type)).includeSelf();
        case Axis.SELF:
            return new SingletonIterator(type);
        default:
            return EMPTY_ITERATOR;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:SimpleResultTreeImpl.java

示例3: getAxisIterator

/**
 * This is a shortcut to the iterators that implement the
 * supported XPath axes (only namespace::) is not supported.
 * Returns a bare-bones iterator that must be initialized
 * with a start node (using iterator.setStartNode()).
 */
public DTMAxisIterator getAxisIterator(final int axis)
{
    switch (axis)
    {
        case Axis.SELF:
            return new SingletonIterator();
        case Axis.CHILD:
            return new ChildrenIterator();
        case Axis.PARENT:
            return new ParentIterator();
        case Axis.ANCESTOR:
            return new AncestorIterator();
        case Axis.ANCESTORORSELF:
            return (new AncestorIterator()).includeSelf();
        case Axis.ATTRIBUTE:
            return new AttributeIterator();
        case Axis.DESCENDANT:
            return new DescendantIterator();
        case Axis.DESCENDANTORSELF:
            return (new DescendantIterator()).includeSelf();
        case Axis.FOLLOWING:
            return new FollowingIterator();
        case Axis.PRECEDING:
            return new PrecedingIterator();
        case Axis.FOLLOWINGSIBLING:
            return new FollowingSiblingIterator();
        case Axis.PRECEDINGSIBLING:
            return new PrecedingSiblingIterator();
        case Axis.NAMESPACE:
            return new NamespaceIterator();
        case Axis.ROOT:
            return new RootIterator();
        default:
            BasisLibrary.runTimeError(BasisLibrary.AXIS_SUPPORT_ERR,
                    Axis.getNames(axis));
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:SAXImpl.java

示例4: isDownwardAxisOfMany

/**
   * Tell if the given axis goes downword.  Bogus name, if you can think of
   * a better one, please do tell.  This really has to do with inverting
   * attribute axis.
   * @param axis One of Axis.XXX.
   * @return true if the axis is not a child axis and does not go up from
   * the axis root.
   */
  public static boolean isDownwardAxisOfMany(int axis)
  {
    return ((Axis.DESCENDANTORSELF == axis) ||
          (Axis.DESCENDANT == axis)
          || (Axis.FOLLOWING == axis)
//          || (Axis.FOLLOWINGSIBLING == axis)
          || (Axis.PRECEDING == axis)
//          || (Axis.PRECEDINGSIBLING == axis)
          );
  }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:WalkerFactory.java

示例5: getTypedAxisIterator

/**
 * Similar to getAxisIterator, but this one returns an iterator
 * containing nodes of a typed axis (ex.: child::foo)
 */
public DTMAxisIterator getTypedAxisIterator(int axis, int type)
{
    // Most common case handled first
    if (axis == Axis.CHILD) {
        return new TypedChildrenIterator(type);
    }

    if (type == NO_TYPE) {
        return(EMPTYITERATOR);
    }

    switch (axis)
    {
        case Axis.SELF:
            return new TypedSingletonIterator(type);
        case Axis.CHILD:
            return new TypedChildrenIterator(type);
        case Axis.PARENT:
            return new ParentIterator().setNodeType(type);
        case Axis.ANCESTOR:
            return new TypedAncestorIterator(type);
        case Axis.ANCESTORORSELF:
            return (new TypedAncestorIterator(type)).includeSelf();
        case Axis.ATTRIBUTE:
            return new TypedAttributeIterator(type);
        case Axis.DESCENDANT:
            return new TypedDescendantIterator(type);
        case Axis.DESCENDANTORSELF:
            return (new TypedDescendantIterator(type)).includeSelf();
        case Axis.FOLLOWING:
            return new TypedFollowingIterator(type);
        case Axis.PRECEDING:
            return new TypedPrecedingIterator(type);
        case Axis.FOLLOWINGSIBLING:
            return new TypedFollowingSiblingIterator(type);
        case Axis.PRECEDINGSIBLING:
            return new TypedPrecedingSiblingIterator(type);
        case Axis.NAMESPACE:
            return  new TypedNamespaceIterator(type);
        case Axis.ROOT:
            return new TypedRootIterator(type);
        default:
            BasisLibrary.runTimeError(BasisLibrary.TYPED_AXIS_SUPPORT_ERR,
                    Axis.getNames(axis));
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:51,代码来源:SAXImpl.java

示例6: checkAxisMismatch

/**
 * This method is used to determine if this parent location path is a
 * combination of two step's with axes that will create duplicate or
 * unordered nodes.
 */
public boolean checkAxisMismatch() {

    int left = _path.getAxis();
    int right = ((Step)_step).getAxis();

    if (((left == Axis.ANCESTOR) || (left == Axis.ANCESTORORSELF)) &&
        ((right == Axis.CHILD) ||
         (right == Axis.DESCENDANT) ||
         (right == Axis.DESCENDANTORSELF) ||
         (right == Axis.PARENT) ||
         (right == Axis.PRECEDING) ||
         (right == Axis.PRECEDINGSIBLING)))
        return true;

    if ((left == Axis.CHILD) &&
        (right == Axis.ANCESTOR) ||
        (right == Axis.ANCESTORORSELF) ||
        (right == Axis.PARENT) ||
        (right == Axis.PRECEDING))
        return true;

    if ((left == Axis.DESCENDANT) || (left == Axis.DESCENDANTORSELF))
        return true;

    if (((left == Axis.FOLLOWING) || (left == Axis.FOLLOWINGSIBLING)) &&
        ((right == Axis.FOLLOWING) ||
         (right == Axis.PARENT) ||
         (right == Axis.PRECEDING) ||
         (right == Axis.PRECEDINGSIBLING)))
        return true;

    if (((left == Axis.PRECEDING) || (left == Axis.PRECEDINGSIBLING)) &&
        ((right == Axis.DESCENDANT) ||
         (right == Axis.DESCENDANTORSELF) ||
         (right == Axis.FOLLOWING) ||
         (right == Axis.FOLLOWINGSIBLING) ||
         (right == Axis.PARENT) ||
         (right == Axis.PRECEDING) ||
         (right == Axis.PRECEDINGSIBLING)))
        return true;

    if ((right == Axis.FOLLOWING) && (left == Axis.CHILD)) {
        // Special case for '@*/following::*' expressions. The resulting
        // iterator is initialised with the parent's first child, and this
        // can cause duplicates in the output if the parent has more than
        // one attribute that matches the left step.
        if (_path instanceof Step) {
            int type = ((Step)_path).getNodeType();
            if (type == DTM.ATTRIBUTE_NODE) return true;
        }
    }

    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:59,代码来源:ParentLocationPath.java

示例7: translateStep

public void translateStep(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Backwards branches are prohibited if an uninitialized object is
    // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed.
    // We don't know whether this code might contain backwards branches
    // so we mustn't create the new object until after we've created
    // the suspect arguments to its constructor.  Instead we calculate
    // the values of the arguments to the constructor first, store them
    // in temporary variables, create the object and reload the
    // arguments from the temporaries to avoid the problem.

    LocalVariableGen pathTemp
            = methodGen.addLocalVariable("parent_location_path_tmp1",
                                     Util.getJCRefType(NODE_ITERATOR_SIG),
                                     null, null);
    pathTemp.setStart(il.append(new ASTORE(pathTemp.getIndex())));

    _step.translate(classGen, methodGen);
    LocalVariableGen stepTemp
            = methodGen.addLocalVariable("parent_location_path_tmp2",
                                     Util.getJCRefType(NODE_ITERATOR_SIG),
                                     null, null);
    stepTemp.setStart(il.append(new ASTORE(stepTemp.getIndex())));

    // Create new StepIterator
    final int initSI = cpg.addMethodref(STEP_ITERATOR_CLASS,
                                        "<init>",
                                        "("
                                        +NODE_ITERATOR_SIG
                                        +NODE_ITERATOR_SIG
                                        +")V");
    il.append(new NEW(cpg.addClass(STEP_ITERATOR_CLASS)));
    il.append(DUP);

    pathTemp.setEnd(il.append(new ALOAD(pathTemp.getIndex())));
    stepTemp.setEnd(il.append(new ALOAD(stepTemp.getIndex())));

    // Initialize StepIterator with iterators from the stack
    il.append(new INVOKESPECIAL(initSI));

    // This is a special case for the //* path with or without predicates
    Expression stp = _step;
    if (stp instanceof ParentLocationPath)
        stp = ((ParentLocationPath)stp).getStep();

    if ((_path instanceof Step) && (stp instanceof Step)) {
        final int path = ((Step)_path).getAxis();
        final int step = ((Step)stp).getAxis();
        if ((path == Axis.DESCENDANTORSELF && step == Axis.CHILD) ||
            (path == Axis.PRECEDING        && step == Axis.PARENT)) {
            final int incl = cpg.addMethodref(NODE_ITERATOR_BASE,
                                              "includeSelf",
                                              "()" + NODE_ITERATOR_SIG);
            il.append(new INVOKEVIRTUAL(incl));
        }
    }

    /*
     * If this pattern contains a sequence of descendant iterators we
     * run the risk of returning the same node several times. We put
     * a new iterator on top of the existing one to assure node order
     * and prevent returning a single node multiple times.
     */
    if (_orderNodes) {
        final int order = cpg.addInterfaceMethodref(DOM_INTF,
                                                    ORDER_ITERATOR,
                                                    ORDER_ITERATOR_SIG);
        il.append(methodGen.loadDOM());
        il.append(SWAP);
        il.append(methodGen.loadContextNode());
        il.append(new INVOKEINTERFACE(order, 3));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:75,代码来源:ParentLocationPath.java

示例8: canBeWalkedInNaturalDocOrderStatic

/**
 * Tell if the nodeset can be walked in doc order, via static analysis.
 *
 *
 * @return true if the nodeset can be walked in doc order, without sorting.
 */
boolean canBeWalkedInNaturalDocOrderStatic()
{

  if (null != m_firstWalker)
  {
    AxesWalker walker = m_firstWalker;
    int prevAxis = -1;
    boolean prevIsSimpleDownAxis = true;

    for(int i = 0; null != walker; i++)
    {
      int axis = walker.getAxis();

      if(walker.isDocOrdered())
      {
        boolean isSimpleDownAxis = ((axis == Axis.CHILD)
                                 || (axis == Axis.SELF)
                                 || (axis == Axis.ROOT));
        // Catching the filtered list here is only OK because
        // FilterExprWalker#isDocOrdered() did the right thing.
        if(isSimpleDownAxis || (axis == -1))
          walker = walker.getNextWalker();
        else
        {
          boolean isLastWalker = (null == walker.getNextWalker());
          if(isLastWalker)
          {
            if(walker.isDocOrdered() && (axis == Axis.DESCENDANT ||
               axis == Axis.DESCENDANTORSELF || axis == Axis.DESCENDANTSFROMROOT
               || axis == Axis.DESCENDANTSORSELFFROMROOT) || (axis == Axis.ATTRIBUTE))
              return true;
          }
          return false;
        }
      }
      else
        return false;
    }
    return true;
  }
  return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:48,代码来源:WalkingIteratorSorted.java

示例9: getAxisFromStep

/**
 * Special purpose function to see if we can optimize the pattern for
 * a DescendantIterator.
 *
 * @param compiler non-null reference to compiler object that has processed
 *                 the XPath operations into an opcode map.
 * @param stepOpCodePos The opcode position for the step.
 *
 * @return 32 bits as an integer that give information about the location
 * path as a whole.
 *
 * @throws javax.xml.transform.TransformerException
 */
public static int getAxisFromStep(
        Compiler compiler, int stepOpCodePos)
          throws javax.xml.transform.TransformerException
{

  int stepType = compiler.getOp(stepOpCodePos);

  switch (stepType)
  {
  case OpCodes.FROM_FOLLOWING :
    return Axis.FOLLOWING;
  case OpCodes.FROM_FOLLOWING_SIBLINGS :
    return Axis.FOLLOWINGSIBLING;
  case OpCodes.FROM_PRECEDING :
    return Axis.PRECEDING;
  case OpCodes.FROM_PRECEDING_SIBLINGS :
    return Axis.PRECEDINGSIBLING;
  case OpCodes.FROM_PARENT :
    return Axis.PARENT;
  case OpCodes.FROM_NAMESPACE :
    return Axis.NAMESPACE;
  case OpCodes.FROM_ANCESTORS :
    return Axis.ANCESTOR;
  case OpCodes.FROM_ANCESTORS_OR_SELF :
    return Axis.ANCESTORORSELF;
  case OpCodes.FROM_ATTRIBUTES :
    return Axis.ATTRIBUTE;
  case OpCodes.FROM_ROOT :
    return Axis.ROOT;
  case OpCodes.FROM_CHILDREN :
    return Axis.CHILD;
  case OpCodes.FROM_DESCENDANTS_OR_SELF :
    return Axis.DESCENDANTORSELF;
  case OpCodes.FROM_DESCENDANTS :
    return Axis.DESCENDANT;
  case OpCodes.FROM_SELF :
    return Axis.SELF;
  case OpCodes.OP_EXTFUNCTION :
  case OpCodes.OP_FUNCTION :
  case OpCodes.OP_GROUP :
  case OpCodes.OP_VARIABLE :
    return Axis.FILTEREDLIST;
  }

  throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: "
                             //+ stepType);
 }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:60,代码来源:WalkerFactory.java

示例10: getAnalysisBitFromAxes

/**
 * Get a corresponding BIT_XXX from an axis.
 * @param axis One of Axis.ANCESTOR, etc.
 * @return One of BIT_ANCESTOR, etc.
 */
static public int getAnalysisBitFromAxes(int axis)
{
  switch (axis) // Generate new traverser
    {
    case Axis.ANCESTOR :
      return BIT_ANCESTOR;
    case Axis.ANCESTORORSELF :
      return BIT_ANCESTOR_OR_SELF;
    case Axis.ATTRIBUTE :
      return BIT_ATTRIBUTE;
    case Axis.CHILD :
      return BIT_CHILD;
    case Axis.DESCENDANT :
      return BIT_DESCENDANT;
    case Axis.DESCENDANTORSELF :
      return BIT_DESCENDANT_OR_SELF;
    case Axis.FOLLOWING :
      return BIT_FOLLOWING;
    case Axis.FOLLOWINGSIBLING :
      return BIT_FOLLOWING_SIBLING;
    case Axis.NAMESPACE :
    case Axis.NAMESPACEDECLS :
      return BIT_NAMESPACE;
    case Axis.PARENT :
      return BIT_PARENT;
    case Axis.PRECEDING :
      return BIT_PRECEDING;
    case Axis.PRECEDINGSIBLING :
      return BIT_PRECEDING_SIBLING;
    case Axis.SELF :
      return BIT_SELF;
    case Axis.ALLFROMNODE :
      return BIT_DESCENDANT_OR_SELF;
      // case Axis.PRECEDINGANDANCESTOR :
    case Axis.DESCENDANTSFROMROOT :
    case Axis.ALL :
    case Axis.DESCENDANTSORSELFFROMROOT :
      return BIT_ANY_DESCENDANT_FROM_ROOT;
    case Axis.ROOT :
      return BIT_ROOT;
    case Axis.FILTEREDLIST :
      return BIT_FILTER;
    default :
      return BIT_FILTER;
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:51,代码来源:WalkerFactory.java


注:本文中的com.sun.org.apache.xml.internal.dtm.Axis.DESCENDANTORSELF属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。