Package org.apache.xalan.xsltc.util

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


    public String getCounter() {
  if (_value != Integer.MIN_VALUE) {
      return formatNumbers(_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


    /**
     * Adds a node to the node list for a given value. Nodes will
     * always be added in document order.
     */
    public void add(Object value, int node) {
  IntegerArray nodes;
  if ((nodes = (IntegerArray) _index.get(value)) == null) {
      _index.put(value, nodes = new IntegerArray());
  }
  nodes.add(node);
    }
View Full Code Here

  _nodes = null;

  final StringTokenizer values = new StringTokenizer((String) value);
  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);
            }
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) {
          nodes = new IntegerArray();
        _index.put(id, nodes);
    nodes.add(ident);
            }
        }
        return nodes;  
    }
View Full Code Here

  if (string.indexOf(' ') > -1) {
      final StringTokenizer values = new StringTokenizer(string);

      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 && nodes.indexOf(node) >= 0) {
        return 1;
    }
      }
      return 0;
  }
  else {
      IntegerArray nodes = (IntegerArray) _index.get(value);
            if (nodes == null && _enhancedDOM != null && _enhancedDOM.hasDOMSource()) {
                nodes = getDOMNodeById(string);
            }
      return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0;
  }
    }
View Full Code Here

      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 String getCounter() {
  if (_value != Integer.MIN_VALUE) {
      return formatNumbers(_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

  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

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.