Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.INVOKEINTERFACE


              ORDER_ITERATOR,
              ORDER_ITERATOR_SIG);
      il.append(methodGen.loadDOM());
      il.append(SWAP);
      il.append(methodGen.loadContextNode());
      il.append(new INVOKEINTERFACE(order, 3));

  }
    }
View Full Code Here


  il.append(new ILOAD(parentNode.getIndex()));

  // Now get the node value and feck it on the parameter stack
  il.append(methodGen.loadDOM());
  il.append(methodGen.loadCurrentNode());
  il.append(new INVOKEINTERFACE(getNodeValue, 2));

  // Finally do the call to add an entry in the index for this key.
  il.append(new INVOKEVIRTUAL(buildKeyIndex));

  nextNode.setTarget(il.append(methodGen.loadIterator()));
View Full Code Here

  il.append(methodGen.loadIterator());

  // Get an iterator for all nodes in the DOM
  il.append(methodGen.loadDOM())
  il.append(new PUSH(cpg,Axis.DESCENDANT));
  il.append(new INVOKEINTERFACE(git, 2));

  // Reset the iterator to start with the root node
  il.append(methodGen.loadCurrentNode());
  il.append(methodGen.setStartNode());
  il.append(methodGen.storeIterator());
View Full Code Here

      final int idx = cpg.addInterfaceMethodref(DOM_INTF,
                  "getType", "(I)I");
      il.append(new SIPUSH((short)((Step)_left).getNodeType()));
      il.append(methodGen.loadDOM());
      il.append(methodGen.loadContextNode());
      il.append(new INVOKEINTERFACE(idx, 2));
      _falseList.add(il.append(new IF_ICMPNE(null)));
  }
  else {

      _left.translate(classGen, methodGen);
View Full Code Here

  // call "comment"
  final int comment =
      cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
              "comment",
              "(" + STRING_SIG + ")V");
  il.append(new INVOKEINTERFACE(comment, 2));
  // Restore old handler base from stack
  il.append(methodGen.storeHandler());
    }
View Full Code Here

                 "getTypedAxisIterator",
                 "(II)"+NODE_ITERATOR_SIG);
    il.append(methodGen.loadDOM());
    il.append(new PUSH(cpg, Axis.ATTRIBUTE));
    il.append(new PUSH(cpg, _nodeType));
    il.append(new INVOKEINTERFACE(iter, 3));
    return;
      }

      // Special case for '.'
      if (isAbbreviatedDot()) {
    if (_type == Type.Node) {
        // Put context node on stack if using Type.Node
        il.append(methodGen.loadContextNode());
    }
    else {
        // Wrap the context node in a singleton iterator if not.
        int init = cpg.addMethodref(SINGLETON_ITERATOR,
            "<init>", "("+NODE_SIG+")V");
        il.append(new NEW(cpg.addClass(SINGLETON_ITERATOR)));
        il.append(DUP);
        il.append(methodGen.loadContextNode());
        il.append(new INVOKESPECIAL(init));
    }
    return;
      }

      // Special case for /foo/*/bar
      SyntaxTreeNode parent = getParent();
      if ((parent instanceof ParentLocationPath) &&
    (parent.getParent() instanceof ParentLocationPath)) {
    if ((_nodeType == NodeTest.ELEMENT) && (!_hadPredicates)) {
        _nodeType = NodeTest.ANODE;
    }
      }

      // "ELEMENT" or "*" or "@*" or ".." or "@attr" with a parent.
      switch (_nodeType) {
      case NodeTest.ATTRIBUTE:
    _axis = Axis.ATTRIBUTE;
      case NodeTest.ANODE:
    // DOM.getAxisIterator(int axis);
    int git = cpg.addInterfaceMethodref(DOM_INTF,
                "getAxisIterator",
                "(I)"+NODE_ITERATOR_SIG);
    il.append(methodGen.loadDOM());
    il.append(new PUSH(cpg, _axis));
    il.append(new INVOKEINTERFACE(git, 2));
    break;
      default:
    final XSLTC xsltc = getParser().getXSLTC();
    final Vector ni = xsltc.getNamesIndex();
    String name = null;
    int star = 0;
   
    if (_nodeType >= DOM.NTYPES) {
        name = (String)ni.elementAt(_nodeType-DOM.NTYPES);
        star = name.lastIndexOf('*');
    }
   
    if (star > 1) {
        final String namespace;
        if (_axis == Axis.ATTRIBUTE)
      namespace = name.substring(0,star-2);
        else
      namespace = name.substring(0,star-1);

        final int nsType = xsltc.registerNamespace(namespace);
        final int ns = cpg.addInterfaceMethodref(DOM_INTF,
                "getNamespaceAxisIterator",
                "(II)"+NODE_ITERATOR_SIG);
        il.append(methodGen.loadDOM());
        il.append(new PUSH(cpg, _axis));
        il.append(new PUSH(cpg, nsType));
        il.append(new INVOKEINTERFACE(ns, 3));
        break;
    }
      case NodeTest.ELEMENT:
    // DOM.getTypedAxisIterator(int axis, int type);
    final int ty = cpg.addInterfaceMethodref(DOM_INTF,
            "getTypedAxisIterator",
            "(II)"+NODE_ITERATOR_SIG);
    // Get the typed iterator we're after
    il.append(methodGen.loadDOM());
    il.append(new PUSH(cpg, _axis));
    il.append(new PUSH(cpg, _nodeType));
    il.append(new INVOKEINTERFACE(ty, 3));

    break;
      }
  }
    }
View Full Code Here

    }
    predicate.translate(classGen, methodGen);
    idx = cpg.addInterfaceMethodref(DOM_INTF,
            GET_NODE_VALUE_ITERATOR,
            GET_NODE_VALUE_ITERATOR_SIG);
    il.append(new INVOKEINTERFACE(idx, 5));
      }
      // Handle '//*[n]' expression
      else if (predicate.isNthDescendant()) {
    il.append(methodGen.loadDOM());
    il.append(new ICONST(NodeTest.ELEMENT));
    predicate.translate(classGen, methodGen);
    il.append(new ICONST(0));
    idx = cpg.addInterfaceMethodref(DOM_INTF,
            "getNthDescendant",
            "(IIZ)"+NODE_ITERATOR_SIG);
    il.append(new INVOKEINTERFACE(idx, 4));
      }
      // Handle 'elem[n]' expression
      else if (predicate.isNthPositionFilter()) {
    idx = cpg.addMethodref(NTH_ITERATOR_CLASS,
               "<init>",
View Full Code Here

      final int esc = cpg.addInterfaceMethodref(OUTPUT_HANDLER,
                  "setEscaping", "(Z)Z");
      if (!_escaping) {
    il.append(methodGen.loadHandler());
    il.append(new PUSH(cpg, false));
    il.append(new INVOKEINTERFACE(esc, 2));
      }

      final int characters = cpg.addInterfaceMethodref(OUTPUT_HANDLER,
                   "characters",
                   "(" + STRING_SIG + ")V");
      il.append(methodGen.loadHandler());
      il.append(new PUSH(cpg, _text));
      il.append(new INVOKEINTERFACE(characters, 2));

      // Restore character escaping setting to whatever it was.
      // Note: setEscaping(bool) returns the original (old) value
      if (!_escaping) {
    il.append(methodGen.loadHandler());
    il.append(SWAP);
    il.append(new INVOKEINTERFACE(esc, 2));
    il.append(POP);
      }
  }
  translateContents(classGen, methodGen);
    }
View Full Code Here

      // Lookup index using the string value from the current node
      il.append(new ALOAD(searchIndex.getIndex()));
      il.append(DUP);
      il.append(methodGen.loadDOM());
      il.append(methodGen.loadCurrentNode());
      il.append(new INVOKEINTERFACE(getNodeValue, 2));
      if (_name == null) {
    il.append(new INVOKEVIRTUAL(lookupId));
      }
      else {
    il.append(new INVOKEVIRTUAL(lookupKey));
View Full Code Here

  if (_nodeType == DOM.ELEMENT) {
      final int check = cpg.addInterfaceMethodref(DOM_INTF,
              "isElement", "(I)Z");
      il.append(methodGen.loadDOM());
      il.append(SWAP);
      il.append(new INVOKEINTERFACE(check, 2));
 
      // Need to allow for long jumps here
      final BranchHandle icmp = il.append(new IFNE(null));
      _falseList.add(il.append(new GOTO_W(null)));
      icmp.setTarget(il.append(NOP));
  }
  else if (_nodeType == DOM.ATTRIBUTE) {
      final int check = cpg.addInterfaceMethodref(DOM_INTF,
              "isAttribute", "(I)Z");
      il.append(methodGen.loadDOM());
      il.append(SWAP);
      il.append(new INVOKEINTERFACE(check, 2));
 
      // Need to allow for long jumps here
      final BranchHandle icmp = il.append(new IFNE(null));
      _falseList.add(il.append(new GOTO_W(null)));
      icmp.setTarget(il.append(NOP));
  }
  else {
      // context node is on the stack
      final int getType = cpg.addInterfaceMethodref(DOM_INTF,
                "getType", "(I)I");
      il.append(methodGen.loadDOM());
      il.append(SWAP);
      il.append(new INVOKEINTERFACE(getType, 2));
      il.append(new PUSH(cpg, _nodeType));
 
      // Need to allow for long jumps here
      final BranchHandle icmp = il.append(new IF_ICMPEQ(null));
      _falseList.add(il.append(new GOTO_W(null)));
View Full Code Here

TOP

Related Classes of org.apache.bcel.generic.INVOKEINTERFACE

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.