Examples of IntRange


Examples of com.baulsupp.kolja.log.util.IntRange

  public BasicLineIterator(LineIndex index) {
    this.index = index;

    int to = Math.min(BUFFER, index.length());
    currentRange = new IntRange(0, to);
   
    if (to > 0) {
      currentIterator = index.get(currentRange).listIterator();
    } else {
      List<Line> emptyList = Collections.emptyList();
View Full Code Here

Examples of com.baulsupp.kolja.log.util.IntRange

      int newFrom = currentRange.getTo();
      int newTo = Math.min(length, newFrom + BUFFER);

      if (newFrom < newTo) {
        currentRange = new IntRange(newFrom, newTo);

        currentIterator = index.get(currentRange).listIterator();

        hasNext = currentIterator.hasNext();
      } else {
View Full Code Here

Examples of com.baulsupp.kolja.log.util.IntRange

  // TODO optimise!!!!
  // TODO should we move half way, even though its expensive to do. Or edge?
  public void moveTo(int position) {
    // log.debug("moveTo " + position);
    currentIterator = EMPTY_LIST.listIterator();
    currentRange = new IntRange(position, position);
    // log.debug("resetting " + currentRange + "");
  }
View Full Code Here

Examples of com.baulsupp.kolja.log.util.IntRange

    while (!hasPrevious && currentRange.getFrom() > 0) {
      int newFrom = Math.max(0, currentRange.getFrom() - BUFFER);
      int newTo = currentRange.getFrom();

      currentRange = new IntRange(newFrom, newTo);

      log.debug("new range " + currentRange);

      List<Line> list = index.get(currentRange);
      currentIterator = list.listIterator(list.size());
View Full Code Here

Examples of com.baulsupp.kolja.log.util.IntRange

  }

  public List<Line> get(IntRange region) {
    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];

      if (lineStart >= to)
        break;

      // TODO should we extend the search area?
      lineEnd = (i == values.length - 1) ? newRange.getTo() : values[i + 1];

      // TODO check if this is safe, strip newlines
      lineEnd--;

      Line line = buildLine(lineStart, lineEnd);
View Full Code Here

Examples of com.baulsupp.kolja.log.util.IntRange

      }
    }
  }

  public void ensureAllKnown() {
    ensureKnown(new IntRange(0, li.length()));
  }
View Full Code Here

Examples of com.baulsupp.kolja.log.util.IntRange

      processLines(unknownRegion, list);
    }
  }
 
  public IntRange[] listUnknown() {
    return indexed.listUnknownRanges(new IntRange(0, li.length()));
  }
View Full Code Here

Examples of com.baulsupp.kolja.log.util.IntRange

      if (showEvents) {
        EventDetector eventList = format.getEventDetector();
        setEventList(eventList);
      }

      IntRange intRange2 = intRange == null ? null : new IntRange(intRange);
      lineIterator = new BasicLineIterator(li, intRange2);
    } else {
      lineIterator = lineIndexFactory.buildForwardsLineIterator(file, format, intRange);
    }
View Full Code Here

Examples of com.baulsupp.kolja.log.util.IntRange

  public Collection<RequestLine> getKnown() {
    return requests.values();
  }

  public List<Line> getAll() {
    return get(new IntRange(0, length()));
  }
View Full Code Here

Examples of com.baulsupp.kolja.log.util.IntRange

  private void ensureLineKnown(IntRange region, RequestLine line) {
    if (line.isComplete()) {
      return;
    }

    region = new IntRange(region);

    while (!line.isComplete()) {
      if (!line.isStartFound()) {
        region.setFrom(Math.max(0, region.getFrom() - region.getLength()));
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.