|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--dm.datacube.DataCube
Implements a DataCube using an array and a DCComp object
Inner Class Summary | |
class |
DataCube.DataElement
Internal class for data storage (not static because we want to access parent class fields) |
class |
DataCube.DataSet
Internal class for iterator element storage (not static because we want to access parent class fields) |
Field Summary | |
java.util.ArrayList |
_alDimensions
|
java.util.ArrayList |
_alPrintDimOrder
|
boolean |
_bSealed
|
DCComp |
_comp
|
DataCube.DataElement[] |
_data
Local data members |
java.text.DecimalFormat |
_df
|
java.util.List |
_lParams
|
int |
_nAgFun
|
int |
_nDataSize
|
int |
_nIterEnd
|
int |
_nIterPos
Iterator position |
int |
_nIterStart
|
int |
_nTableWidth
The following parameters are for printing only |
java.io.PrintStream |
_ps
|
java.lang.String |
_sValLabel
|
static int |
INITIAL_SIZE
Constants |
Constructor Summary | |
DataCube(java.util.ArrayList dimensions,
java.lang.String val_label)
Constructor - default |
Method Summary | |
void |
addElement(java.lang.Integer[] key,
java.lang.Integer val)
Add a new entry to the data cube (don't sort) |
boolean |
addRestriction(java.lang.String dim_name,
java.lang.Integer value)
Adds a restriction to the DataCube and resort the DataCube |
java.lang.String |
computeAgVal(java.util.List data,
int ag_fun,
java.util.List params)
Given a data list (of Integers), an aggregation function, a list of fun params, and width, returns a String resulting from the application of the specified function to the list |
boolean |
drillDownDim(java.lang.String dim_name)
Adds a dimension to the DataCube and resort the DataCube |
boolean |
dropRestriction(java.lang.String dim_name)
Drops a restriction from the DataCube and resort the DataCube |
int |
findRestrictionRange(boolean max)
Find min or max key for data with current restrictions |
java.util.Set |
getActiveDims()
Get a set of the current active datacube dimensions |
java.util.Set |
getAllDims()
Get a set of all dimensions (active, inactive, restricted) |
Dimension |
getDim(int index)
Get the Dimension object for a key index |
int |
getDimIndex(java.lang.String dim_name)
Finds dimension index |
java.util.Set |
getDimKeys(java.lang.String dim_name)
Get the possible set of keys for a dimension |
java.util.List |
getIndexList()
Get a list of indices for the non-dropped Dimensions (in the order they are compared) |
java.util.Map |
getRestrictions()
Get a set of the current active datacube restrictions |
java.util.List |
getValues(java.lang.Integer[] key)
Retrieves all values for the given key according to current comparator (Comp) |
boolean |
hasNext()
Returns whether there are more elements to iterate over |
static java.lang.String |
indent(int level)
A simple method for producing an indent based on level |
DataCube.DataSet |
next()
Returns the next DataSet object for entries sharing the same key, starting at _nIterPos. |
static java.lang.String |
pad(java.lang.String s,
int len)
A simple method for padding Strings to a given length |
void |
printCube(java.io.PrintStream ps,
int table_width,
int ag_fun,
java.util.List params)
Print this data cube to the given output stream |
void |
printDimension(int index,
java.lang.Integer[] key)
Recurse on the dimensions and print them |
static java.lang.String |
repeat(java.lang.String s,
int n)
Produces repeated String |
void |
resetIterator()
Resets the iterator |
void |
resortData()
Resort the data according to the current Comparator (_comp) |
boolean |
rollUpDim(java.lang.String dim_name)
Drops a dimension from the DataCube and resort the DataCube |
void |
sealDataCube()
Once this is executed, the data is sorted but no more elements can be added due to the computational complexity of doing so |
int |
size()
Get the size of this datacube |
static java.lang.String |
trunc(java.lang.String s,
int len)
A simple method for truncating (or padding) string to a length |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int INITIAL_SIZE
public DataCube.DataElement[] _data
public java.util.ArrayList _alDimensions
public java.lang.String _sValLabel
public DCComp _comp
public boolean _bSealed
public int _nDataSize
public int _nIterPos
public int _nIterStart
public int _nIterEnd
public int _nTableWidth
public java.util.ArrayList _alPrintDimOrder
public java.io.PrintStream _ps
public int _nAgFun
public java.util.List _lParams
public java.text.DecimalFormat _df
Constructor Detail |
public DataCube(java.util.ArrayList dimensions, java.lang.String val_label)
dimensions
- Must be a list with the dimensions in the order
that they appear.Method Detail |
public void addElement(java.lang.Integer[] key, java.lang.Integer val)
key
- Array of dim keys (same order as _alDimensions)val
- Value for this keypublic void sealDataCube()
public void resortData()
public boolean drillDownDim(java.lang.String dim_name)
dim_name
- The name of the dimension to addpublic boolean rollUpDim(java.lang.String dim_name)
dim_name
- The name of the dimension to addpublic boolean addRestriction(java.lang.String dim_name, java.lang.Integer value)
dim_name
- The name of the dimension to addpublic boolean dropRestriction(java.lang.String dim_name)
dim_name
- The name of the dimension to addpublic int getDimIndex(java.lang.String dim_name)
dim_name
- The name of the dimensionpublic java.util.Set getAllDims()
public java.util.Map getRestrictions()
public java.util.Set getActiveDims()
public java.util.Set getDimKeys(java.lang.String dim_name)
dim_name
- Name of the dimensionpublic java.util.List getIndexList()
public Dimension getDim(int index)
index
- The key index for this DataCubepublic int size()
public java.util.List getValues(java.lang.Integer[] key)
key
- Array of key values in same order as _alDimensionspublic int findRestrictionRange(boolean max)
max
- if true will return max key, otherwise min keypublic void resetIterator()
public boolean hasNext()
public DataCube.DataSet next()
public void printCube(java.io.PrintStream ps, int table_width, int ag_fun, java.util.List params)
ps
- Stream to print totable_width
- Max width of a table elementag_fun
- int ID of aggregation function to use (see DMQL.Display)params
- List of parameters for the aggregation functionpublic void printDimension(int index, java.lang.Integer[] key)
dims
- List of Dimensions (in order)index
- Dimension to printpublic java.lang.String computeAgVal(java.util.List data, int ag_fun, java.util.List params)
data
- List of dataag_fun
- int ID of the aggregation function (see DMQL.Display)params
- List of params for the aggregation functionpublic static java.lang.String trunc(java.lang.String s, int len)
s
- String to processlen
- Length to pad/truncate topublic static java.lang.String indent(int level)
level
- Level to indent forpublic static java.lang.String repeat(java.lang.String s, int n)
s
- String to repeatn
- number of times to repeatpublic static java.lang.String pad(java.lang.String s, int len)
s
- String to padlen
- Length to pad to
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |