Package org.apache.commons.collections.primitives

Examples of org.apache.commons.collections.primitives.IntList


    int effectiveFrom = from - lookBack;

    matcher.reset(text.subSequence(effectiveFrom, newTo));

    // TODO pool int lists
    IntList result = new FastIntList(100);

    boolean found = matcher.find(lookBack);

    while (found) {
      int pos = matcher.start() + effectiveFrom;

      if (pos >= to) {
        break;
      }

      result.add(pos);

      found = matcher.find();
    }

    return result;
View Full Code Here


  public BufferedLogEntryIndex(LogEntryIndex index) {
    this.index = index;
  }

  public IntList get(IntRange region) {
    IntList result = field.get(region);

    log.debug("buf " + region);

    if (result == null) {
      IntRange[] missing = field.listUnknownRanges(region);
      for (int i = 0; i < missing.length; i++) {
        // TODO problem here!
        log.debug("missing " + missing[i]);
        IntList l = index.get(missing[i]);

        field.add(new MemoryIntField(missing[i], l));
      }

      result = field.get(region);
View Full Code Here

    int to = region.getTo();

    IntRange newRange = new IntRange(region);
    newRange.setTo(Math.min(to + GloogyConstants.LINE_CUTOFF, text.length()));

    IntList list = index.get(newRange);

    if (list == null) {
      throw new NullPointerException("unable to index range " + newRange + " length of input " + text.length());
    }

    List<Line> l = new ArrayList<Line>(list.size());

    int[] values = list.toArray(new int[list.size()]);
    int lineStart = 0;
    int lineEnd = 0;

    for (int i = 0; i < values.length; i++) {
      lineStart = values[i];
View Full Code Here

  public int length() {
    return li.length();
  }

  protected void processLines(IntRange region, List<Line> regionLines) {
    IntList values = new ArrayIntList();

    for (Line line : regionLines) {
      processLine(values, line);
    }
View Full Code Here

  }

  public List<Line> get(IntRange region) {
    ensureKnown(region);

    IntList offsets = indexed.get(region);

    if (offsets == null) {
      throw new NullPointerException(region.toString() + " " + li.length() + " " + Arrays.asList(indexed.listUnknownRanges(region)));
    }
View Full Code Here

    // collections testing framework
    // ------------------------------------------------------------------------

    protected Object makeObject() {
        IntList list = new ArrayIntList();
        for(int i=0;i<10;i++) {
            list.add(i);
        }
        return new IntCollectionCollection(list);
    }
View Full Code Here

    protected IntList makeEmptyIntList() {
        return new ArrayIntList();
    }
   
    protected IntList makeFullIntList() {
        IntList list = makeEmptyIntList();
        int[] elts = getFullElements();
        for(int i=0;i<elts.length;i++) {
            list.add(elts[i]);
        }
        return list;
    }
View Full Code Here

    public void testWrapNull() {
        assertNull(ListIntList.wrap(null));
    }
   
    public void testWrapSerializable() {
        IntList list = ListIntList.wrap(new ArrayList());
        assertNotNull(list);
        assertTrue(list instanceof Serializable);
    }
View Full Code Here

        assertNotNull(list);
        assertTrue(list instanceof Serializable);
    }
   
    public void testWrapNonSerializable() {
        IntList list = ListIntList.wrap(new AbstractList() {
            public Object get(int i) { throw new IndexOutOfBoundsException(); }
            public int size() { return 0; }
        });
        assertNotNull(list);
        assertTrue(!(list instanceof Serializable));
View Full Code Here

    public void testWrapNull() {
        assertNull(UnmodifiableIntList.wrap(null));
    }

    public void testWrapUnmodifiableIntList() {
        IntList list = makeUnmodifiableIntList();
        assertSame(list,UnmodifiableIntList.wrap(list));
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.primitives.IntList

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.