Package org.apache.xalan.xsltc.util

Examples of org.apache.xalan.xsltc.util.IntegerArray


      return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0;
  }
    }

    public int containsKey(int node, Object value) {
  final IntegerArray nodes = (IntegerArray) _index.get(value);
  return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0;
    }
View Full Code Here


  public NodeListImpl(int[] nodes) {
      _nodes = nodes;
  }

  public NodeListImpl(NodeIterator iter) {
      final IntegerArray list = new IntegerArray();
      int node;
      while ((node = iter.next()) != NodeIterator.END) {
    list.add(node);
      }
      _nodes = list.toIntArray();
  }
View Full Code Here

    // Skip attribute nodes
    while (_type[attribute] == NAMESPACE) {
        attribute = _nextSibling[attribute];
    }
    if (attribute != NULL) {
        final IntegerArray attributes = new IntegerArray(4);
        do {
      attributes.add(attribute);
        }
        while ((attribute = _nextSibling[attribute]) != 0);
        return new NamedNodeMapImpl(attributes.toIntArray());
    }
    else {
        return getEmptyNamedNodeMap();
    }
      }
View Full Code Here

      }
  }

  public NodeList getChildNodes() {
      if (hasChildNodes()) {
    final IntegerArray children = new IntegerArray(8);
    int child = _offsetOrChild[_index];
    do {
        children.add(child);
    }
    while ((child = _nextSibling[child]) != 0);
    return new NodeListImpl(children.toIntArray());
      }
      else {
    return getEmptyNodeList();
      }
  }
View Full Code Here

            else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
            else if (Double.isInfinite(_value)) return "Infinity";
      else return formatNumbers((int)_value);
  }

  IntegerArray ancestors = new IntegerArray();

  // Gather all ancestors that do not match from pattern
  int next = _node;
  ancestors.add(next);    // include self
  while ((next = _document.getParent(next)) > END &&
         !matchesFrom(next)) {
      ancestors.add(next);
  }

  // Create an array of counters
  final int nAncestors = ancestors.cardinality();
  final int[] counters = new int[nAncestors];
  for (int i = 0; i < nAncestors; i++) {
      counters[i] = Integer.MIN_VALUE;
  }

  // Increment array of counters according to semantics
  for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) {
      final int counter = counters[j];
      final int ancestor = ancestors.at(i);

      if (matchesCount(ancestor)) {
    _precSiblings.setStartNode(ancestor);
    while ((next = _precSiblings.next()) != END) {
        if (matchesCount(next)) {
View Full Code Here

            _currentDocumentNode = rootNode;
            _index = new Hashtable();
            _rootToIndexMap.put(new Integer(rootNode), _index);
        }

        IntegerArray nodes = (IntegerArray) _index.get(value);

        if (nodes == null) {
             nodes = new IntegerArray();
            _index.put(value, nodes);
            nodes.add(node);

        // Because nodes are added in document order,
        // duplicates can be eliminated easily at this stage.
        } else if (node != nodes.at(nodes.cardinality() - 1)) {
            nodes.add(node);
        }
    }
View Full Code Here

  final StringTokenizer values = new StringTokenizer((String) value,
                                                           " \n\t");
  while (values.hasMoreElements()) {
            final String token = (String) values.nextElement();
      IntegerArray nodes = (IntegerArray) _index.get(token);

            if (nodes == null && _enhancedDOM != null
                && _enhancedDOM.hasDOMSource()) {
                nodes = getDOMNodeById(token);
            }

      if (nodes == null) continue;

      if (_nodes == null) {
     nodes = (IntegerArray)nodes.clone();
    _nodes = nodes;
      }
      else {
    _nodes.merge(nodes);
      }
View Full Code Here

     *
     * @param id The id
     * @return A IntegerArray representing the Node whose id is the given value.
     */
    public IntegerArray getDOMNodeById(String id) {
        IntegerArray nodes = null;

        if (_enhancedDOM != null) {
            int ident = _enhancedDOM.getElementById(id);

            if (ident != DTM.NULL) {
                Integer root = new Integer(_enhancedDOM.getDocument());
                Hashtable index = (Hashtable) _rootToIndexMap.get(root);

                if (index == null) {
                    index = new Hashtable();
                    _rootToIndexMap.put(root, index);
                } else {
                    nodes = (IntegerArray) index.get(id);
                }

                if (nodes == null) {
                    nodes = new IntegerArray();
                    index.put(id, nodes);
                }

                nodes.add(_enhancedDOM.getNodeHandle(ident));
            }
        }

        return nodes;
    }
View Full Code Here

     * <p><em>Use of an instance of this class as a {@link DTMAxisIterator} is
     * <b>deprecated.</b></em></p>
     * @deprecated
     */
    public void lookupKey(Object value) {
        IntegerArray nodes = (IntegerArray) _index.get(value);
        _nodes = (nodes != null) ? (IntegerArray) nodes.clone() : null;
        _position = 0;
    }
View Full Code Here

        // Split argument to id function into XML whitespace separated tokens
        final StringTokenizer values = new StringTokenizer(string, " \n\t");

        while (values.hasMoreElements()) {
            final String token = (String) values.nextElement();
            IntegerArray nodes = null;

            if (index != null) {
                nodes = (IntegerArray) index.get(token);
            }

            // If input was from W3C DOM, use DOM's getElementById to do
            // the look-up.
            if (nodes == null && _enhancedDOM != null
                && _enhancedDOM.hasDOMSource()) {
                nodes = getDOMNodeById(token)
            }

            // Did we find the context node in the set of nodes?
            if (nodes != null && nodes.indexOf(node) >= 0) {
                return 1;
            }
        }

        // Didn't find the context node in the set of nodes returned by id
View Full Code Here

TOP

Related Classes of org.apache.xalan.xsltc.util.IntegerArray

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.