cz.cuni.jagrlib.piece
Class IntervalArray.CFTree

java.lang.Object
  extended by cz.cuni.jagrlib.piece.IntervalArray.CFTree
Enclosing class:
IntervalArray

protected class IntervalArray.CFTree
extends java.lang.Object

Cummulative frequency interval tree. Implemented as an in-place array:

     total a+..+s
      |                                             q+r+s
      |                i+j+k+l+m+n+o+p                |
      |        e+f+g+h        |        m+n+o+p        |
      |    c+d    |    g+h    |    k+l    |    o+p    |     s
 19:  |  b  |  d  |  f  |  h  |  j  |  l  |  n  |  p  |  r  |
 p[]  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18
 

Since:
0.24

Constructor Summary
IntervalArray.CFTree(int symbols, long sumLimit, boolean nonZero)
           
 
Method Summary
 void decimate()
          Halves all symbol frequencies.
 long getCf(int i)
          Interval start.
 long getF(int i)
          Interval length.
 int getI(long cf)
          Interval number.
 void inc(long[] a)
          Increments frequencies.
 void init(int symbols, long sumLimit, boolean nonZero)
          [Re-]initializes the array.
 void newLimit(long n)
          Changes frequency sum limit.
 void newNonZero(boolean n)
          Changes minimum frequency.
 void newSize(int n)
          Resizes the array.
 void set(long[] a)
          Sets frequencies.
 void update(int i, long d)
          Change interval length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntervalArray.CFTree

public IntervalArray.CFTree(int symbols,
                            long sumLimit,
                            boolean nonZero)
Method Detail

decimate

public void decimate()
Halves all symbol frequencies.


set

public void set(long[] a)
Sets frequencies. Checks frequency bounds.


inc

public void inc(long[] a)
Increments frequencies. Checks bounds.


init

public void init(int symbols,
                 long sumLimit,
                 boolean nonZero)
[Re-]initializes the array.


newSize

public void newSize(int n)
Resizes the array.


newLimit

public void newLimit(long n)
Changes frequency sum limit.


newNonZero

public void newNonZero(boolean n)
Changes minimum frequency.


getF

public long getF(int i)
Interval length.


getCf

public long getCf(int i)
Interval start.


getI

public int getI(long cf)
Interval number.


update

public void update(int i,
                   long d)
Change interval length.