Package com.caucho.util

Examples of com.caucho.util.IntArray


  {
    _exprs = exprs;
    _order = order;

    if (order != null)
      _orderIndex = new IntArray();

    if (_stores.length < _exprs.length) {
      _stores = new BlockStore[exprs.length];
    }
View Full Code Here


    throws Exception
  {
    if (countPattern == null)
      countPattern = XPath.parseMatch(node.getNodeName()).getPattern();

    IntArray numbers = new IntArray();
    for (; node != null; node = node.getParentNode()) {
      if (countPattern.match(node, env)) {
        numbers.add(countPreviousSiblings(node, env, countPattern));
        break;
      }
      if (fromPattern != null && fromPattern.match(node, env))
        break;
    }
    if (fromPattern != null && ! findFromAncestor(node, env, fromPattern)) 
      numbers.clear();

    format.format(out, numbers);
  }
View Full Code Here

    throws Exception
  {
    if (countPattern == null)
      countPattern = XPath.parseMatch(node.getNodeName()).getPattern();

    IntArray numbers = new IntArray();
    for (; node != null; node = node.getParentNode()) {
      if (countPattern.match(node, env))
        numbers.add(countPreviousSiblings(node, env, countPattern));

      if (fromPattern != null && fromPattern.match(node, env))
        break;
    }
    if (fromPattern != null && ! findFromAncestor(node, env, fromPattern)) 
      numbers.clear();

    format.format(out, numbers);
  }
View Full Code Here

    throws Exception
  {
    if (countPattern == null)
      countPattern = XPath.parseMatch(node.getNodeName()).getPattern();

    IntArray numbers = new IntArray();
    int count = 0;
    for (; node != null; node = XmlUtil.getPrevious(node)) {
      if (countPattern.match(node, env))
        count++;

      if (fromPattern != null && fromPattern.match(node, env))
        break;
    }
    numbers.add(count);
    if (fromPattern != null && ! findFromAncestor(node, env, fromPattern))
      numbers.clear();

    format.format(out, numbers);
  }
View Full Code Here

  public void exprNumber(XslWriter out, Node node, Env env, Expr expr,
                         XslNumberFormat format)
    throws Exception
  {
    IntArray numbers = new IntArray();
    numbers.add((int) expr.evalNumber(node, env));

    format.format(out, numbers);
  }
View Full Code Here

      }

      if (hasHour) {
        if (_hourTimes == null)
          _hourTimes = new IntArray();
        _hourTimes.add(60 * hour + minute);
      }
      else {
        if (_minuteTimes == null)
          _minuteTimes = new IntArray();
        _minuteTimes.add(minute);
      }
    }
  }
View Full Code Here

      format = "1";

    int headIndex = format.length();

    ArrayList separators = new ArrayList();
    IntArray zeroSizes = new IntArray();
    IntArray formats = new IntArray();

    CharBuffer cb = new CharBuffer();
    int i = 0;
    while (i < format.length()) {
      char ch;

      // scan the separator
      cb.clear();
      for (; i < format.length(); i++) {
        ch = format.charAt(i);
        if (Character.isLetterOrDigit(ch))
          break;
        cb.append(ch);
      }

      // head and tail separators are just sticked on the ends
      if (head == null)
        head = cb.toString();
      else if (i >= format.length())
        tail = cb.toString();
      else
        separators.add(cb.toString());

      if (i >= format.length())
        break;

      // scan the format code
      int zeroSize = 1;
      int code = '0';
      for (; i < format.length(); i++) {
        ch = format.charAt(i);
        if (! Character.isLetterOrDigit(ch))
          break;

        if (! Character.isDigit(ch)) {
          if (code != '0' || zeroSize != 1)
            code = 0;
          else
            code = ch;
        }
        else if (Character.digit(ch, 10) == 0 && zeroSize >= 0)
          zeroSize++;
        else if (Character.digit(ch, 10) == 1)
          code = ch - 1;
        else
          code = 0;
      }
      if (code == 0)
        code = '0';

      zeroSizes.add(zeroSize);
      formats.add(code);
    }

    // default format is '1'
    if (formats.size() == 0) {
      tail = head;
      head = "";
      formats.add('0');
      zeroSizes.add(0);
    }

    // default separator is '.'
    if (separators.size() == 0)
      separators.add(".");
    if (separators.size() < formats.size())
      separators.add(separators.get(separators.size() - 1));

    this.separators = (String []) separators.toArray(new String[separators.size()]);
    this.zeroSize = zeroSizes.toArray();
    this.formats = formats.toArray();

    if (head == null)
      head = "";
    if (tail == null)
      tail = "";
View Full Code Here

    if (arg instanceof ESRegexp)
      regexp = (ESRegexp) arg;
    else
      regexp = new ESRegexp(arg.toStr(), ESString.NULL);

    IntArray results = new IntArray();
    String pattern = string.toString();

    ESBase replace = null;
    String stringPattern = null;
    if (length > 1)
View Full Code Here

  {
    _exprs = exprs;
    _order = order;

    if (order != null)
      _orderIndex = new IntArray();

    if (_stores.length < _exprs.length) {
      _stores = new BlockStore[exprs.length];
    }
View Full Code Here

      }

      if (hasHour) {
        if (_hourTimes == null)
          _hourTimes = new IntArray();
        _hourTimes.add(60 * hour + minute);
      }
      else {
        if (_minuteTimes == null)
          _minuteTimes = new IntArray();
        _minuteTimes.add(minute);
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.caucho.util.IntArray

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.