jaga
Class ESLib

java.lang.Object
  |
  +--jaga.ESLib

public abstract class ESLib
extends java.lang.Object

Library with functions used throughout the JaGa packages.


Constructor Summary
ESLib()
           
 
Method Summary
static int binomialCoefficient(int n, int r)
           
static java.lang.String boolArr2String(boolean[] table)
           
static int fact(int n)
           
static BitSet[] getChunks(BitSet[] data, int start, int secLen)
          Same as getChunks( data, start, secLen, 0, data.length - 1 )
static BitSet[] getChunks(BitSet[] data, int startY, int secLenY, int firstX, int lastX)
          Extracts sections out SampleDatas in an array.
static int getLine(BitSet[] data, int lineNr)
          Same as getLine( data, lineNr, 0, data.length - 1 )
static int getLine(BitSet[] data, int lineNr, int start, int end)
          A kind of reverse of setLine will decode a binary integer from a line in an array of SampleDatas.
static SampleData[] getLines(SampleData[] src, int firstInc, int howMany)
           
static int indexOf(int pin, int[] hay)
           
static int indexOf(java.lang.Object pin, java.lang.Object[] hay)
           
static java.lang.String int2BinStr(int num, int width)
           
static int log2(int x)
           
static java.lang.String sampleDatasToString(SampleData[] as, SampleData[] bs)
          Will print these SampleDatas side by side.
static void setLine(BitSet[] data, int lineNr, int setTo)
          Sets a line in an array of SampleDatas to represent an integer using little endian.
static BitSet stretch(BitSet what, int factor)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ESLib

public ESLib()
Method Detail

setLine

public static void setLine(BitSet[] data,
                           int lineNr,
                           int setTo)
Sets a line in an array of SampleDatas to represent an integer using little endian. SampleDatas stacked vertically so a line is the set of all items of same index in each them.
Parameters:
data - where to encode this integer
lineNr - at what line to encode it
setTo - the integer to encode

getLine

public static int getLine(BitSet[] data,
                          int lineNr,
                          int start,
                          int end)
A kind of reverse of setLine will decode a binary integer from a line in an array of SampleDatas. Little endian is used.
Parameters:
data - where to decode the integer from.
lineNr - what line to decode it from.
start - what SampleData to start reading from.
end - up to what SampleData to read inclusive.

getLine

public static int getLine(BitSet[] data,
                          int lineNr)
Same as getLine( data, lineNr, 0, data.length - 1 )

getChunks

public static BitSet[] getChunks(BitSet[] data,
                                 int startY,
                                 int secLenY,
                                 int firstX,
                                 int lastX)
Extracts sections out SampleDatas in an array.
Parameters:
data - The SampleDatas we're getting stuff from.
startY - Index within SampleDatas at which to start extracting.
secLen - Length of section within SampleDatas we want to extract.
firstX - Index of first SampleData to include in output.
lastX - Index of last SampleData to include in output inclusive.
Returns:
Sections of the SampleDatas in data in an array.

getChunks

public static BitSet[] getChunks(BitSet[] data,
                                 int start,
                                 int secLen)
Same as getChunks( data, start, secLen, 0, data.length - 1 )

binomialCoefficient

public static int binomialCoefficient(int n,
                                      int r)

fact

public static int fact(int n)

sampleDatasToString

public static java.lang.String sampleDatasToString(SampleData[] as,
                                                   SampleData[] bs)
Will print these SampleDatas side by side. Array elements in X axis, SampleData bits in Y axis. Takes into account difference in SampleSeparation but ASSUMES bs HAS SAMPLESEPARATION = 1.

getLines

public static SampleData[] getLines(SampleData[] src,
                                    int firstInc,
                                    int howMany)

stretch

public static BitSet stretch(BitSet what,
                             int factor)

indexOf

public static int indexOf(java.lang.Object pin,
                          java.lang.Object[] hay)

indexOf

public static int indexOf(int pin,
                          int[] hay)

int2BinStr

public static java.lang.String int2BinStr(int num,
                                          int width)

log2

public static int log2(int x)

boolArr2String

public static java.lang.String boolArr2String(boolean[] table)