ewe.util
Class RangeList

java.lang.Object
  extended byewe.data.DataObject
      extended byewe.util.Vector
          extended byewe.util.RangeList
All Implemented Interfaces:
Comparable, Copyable, DataUnit

public class RangeList
extends Vector

A RangeList manages a set of Range object - but you should never add Range objects to it directly. The RangeList always ensures that its collection of Ranges are fully optimized. That is if two ranges are contiguous, they are merged to form a single range. Similarly overlapping ranges are also merged. The ranges are also always sorted in increasing order.


Field Summary
protected static Range buff
           
 
Constructor Summary
RangeList()
           
 
Method Summary
 void addRange(int start, int end)
           
 int countItems()
           
 int countRanges()
           
 int findRangeWith(int value)
           
protected  void fixup()
           
 int getItemAtIndex(int idx)
           
 boolean inRange(int start)
           
 boolean inRange(int start, int end)
           
 Range rangeAt(int rangeIndex, Range dest)
           
 void removeAndShiftUp(int start, int end)
           
 void removeRange(int start, int end)
           
 void shift(int fromWhere, int places)
          Use this to shift up or down, but be careful shifting down.
 int[] toIntArray()
           
 
Methods inherited from class ewe.util.Vector
add, add, add, addAll, addAll, addAll, addCopiesFrom, addElement, clear, compare, contains, copyCopiesFrom, copyFrom, copyInto, copyInto, del, elementAt, elements, find, find, get, getCount, getFullCopy, insert, insertElementAt, isEmpty, iterator, iterator, pop, push, remove, removeAllElements, removeElementAt, set, setElementAt, setSize, size, sort, sort, toArray, toArray, toObjectArray, toString, zero
 
Methods inherited from class ewe.data.DataObject
_getSetField, appendAllFields, compareTo, copied, equals, getCopy, getDeclaredField, getDeclaredFieldValue, getDeclaredFieldValue, getFieldList, getFieldList, getMyFieldList, getNew
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode
 

Field Detail

buff

protected static Range buff
Constructor Detail

RangeList

public RangeList()
Method Detail

inRange

public boolean inRange(int start)

inRange

public boolean inRange(int start,
                       int end)

findRangeWith

public int findRangeWith(int value)

addRange

public void addRange(int start,
                     int end)

removeRange

public void removeRange(int start,
                        int end)

fixup

protected void fixup()

countItems

public int countItems()

toIntArray

public int[] toIntArray()

getItemAtIndex

public int getItemAtIndex(int idx)

shift

public void shift(int fromWhere,
                  int places)
Use this to shift up or down, but be careful shifting down.


countRanges

public int countRanges()

rangeAt

public Range rangeAt(int rangeIndex,
                     Range dest)

removeAndShiftUp

public void removeAndShiftUp(int start,
                             int end)