Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jdaemon.era
Interface Cube  view Cube download Cube.java

All Superinterfaces:
java.util.Collection, java.lang.Iterable
All Known Implementing Classes:
AbstractCube

public interface Cube
extends java.util.Collection

Interface to support generic slicing-and-dicing of data using an OLAP cube metaphor. A cube contains a collection of data items of some type (In principle any java object). Each object within the collection is assumed to have a set of named attriubutes; Subsets of this data collection can be generated either through an arbitrary filtering mechanism or through placing standardised constraints on object attribute values.


Field Summary
static int EQUAL
          operator that selects objects with attribute equal to a value
static int GREATER
          operator that selects objects with attribute greater than a value
static int GREATER_OR_EQUAL
          operator that selects objects with attribute greater than equal to a value
static int LAST_OPERAND
           
static int LESS
          operator that selects objects with attribute less than a value
static int LESS_OR_EQUAL
          operator that selects objects with attribute less than or equal to a value
 
Method Summary
 void addAll(Cube cube)
          Add all the data items in the given Cube to this cube.
 Cube constrain(Filter filter)
          Creates a new cube containing some subset of the contents of this cube.
 Cube constrain(java.lang.String attribute, int operator, java.lang.Object operand)
          Creates a new cube containing some subset of the contents of this cube.
 java.lang.Object getAttribute(java.lang.String attribute, java.lang.Object object)
          Get the value of an individual attribute of an object contained by this cube.
 java.util.SortedSet getAttributeSet(java.lang.String attribute)
          Get a set of all the values of a given attribute across all contained objects.
 CubeDescriptor getDescriptor()
          Get metadata describing this cube.
 java.lang.Object getMax(java.lang.String attribute)
          Get the maximum value over all contained objects of some attribute.
 java.lang.Object getMin(java.lang.String attribute)
          Get the minimum value over all contained objects of some attribute.
 double getSum(java.lang.String attribute)
          Gets the sum over all contained objects of some attributes.
 java.util.Iterator groupBy(java.lang.String attribute)
          Group data by a given attribute.
 java.util.Iterator iterator()
          Get an iterator over all objects contained by this cube.
 Cube union(Cube other)
          Create a cube containing the union of data in this cube and some other cube.
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray
 

Field Detail

EQUAL

public static final int EQUAL
operator that selects objects with attribute equal to a value

See Also:
Constant Field Values

LESS

public static final int LESS
operator that selects objects with attribute less than a value

See Also:
Constant Field Values

GREATER

public static final int GREATER
operator that selects objects with attribute greater than a value

See Also:
Constant Field Values

LESS_OR_EQUAL

public static final int LESS_OR_EQUAL
operator that selects objects with attribute less than or equal to a value

See Also:
Constant Field Values

GREATER_OR_EQUAL

public static final int GREATER_OR_EQUAL
operator that selects objects with attribute greater than equal to a value

See Also:
Constant Field Values

LAST_OPERAND

public static final int LAST_OPERAND
See Also:
Constant Field Values
Method Detail

constrain

public Cube constrain(Filter filter)
Creates a new cube containing some subset of the contents of this cube. The constrain(filter) method provides a way to generate subsets of the data contained in the cube. The subset generated is the set of objects for which filter.test(object) returns true. Users are therefore free to generate their own custom filter objects. However, the alternative constrain(attribute, operator, operand) method can be significantly optimised by the cube implementation. The alternative method should therefore be used whenever possible..


constrain

public Cube constrain(java.lang.String attribute,
                      int operator,
                      java.lang.Object operand)
Creates a new cube containing some subset of the contents of this cube. The constrain(attribute, operator, operand) method provides a way to generate standardised subsets of the data contained in the cube. The subset is formed by comparing the named attribute in all contained obects with the given operand. The comparison method is defined by operator, which should be one of the symbolic constants defined above: LESS, GREATER, EQUAL, LESS_OR_EQUAL, GREATER_OR_EQUAL


getSum

public double getSum(java.lang.String attribute)
Gets the sum over all contained objects of some attributes. This method is should be equivalent to summing: ((Number)getAttribute(attribute, object)).doubleValue() for all values returned by the Cube's iterator. However, certain cube implementations may cache or otherwise optimise the getSum() operation.


getMin

public java.lang.Object getMin(java.lang.String attribute)
Get the minimum value over all contained objects of some attribute. Cube implementations will generally have their own way to specify the comparison operation used to create this minimum.


getMax

public java.lang.Object getMax(java.lang.String attribute)
Get the maximum value over all contained objects of some attribute. Cube implementations will generally have their own way to specify the comparison operation used to create this minimum.


getAttribute

public java.lang.Object getAttribute(java.lang.String attribute,
                                     java.lang.Object object)
Get the value of an individual attribute of an object contained by this cube.


iterator

public java.util.Iterator iterator()
Get an iterator over all objects contained by this cube.

Specified by:
iterator in interface java.util.Collection

getAttributeSet

public java.util.SortedSet getAttributeSet(java.lang.String attribute)
Get a set of all the values of a given attribute across all contained objects.


groupBy

public java.util.Iterator groupBy(java.lang.String attribute)
Group data by a given attribute. Returns an iterator of a collection of Cubes. Each cube will contain only elements with the same value of the given attribute.


addAll

public void addAll(Cube cube)
Add all the data items in the given Cube to this cube. OPTIONAL OPERATION Adds many objects to this cube


getDescriptor

public CubeDescriptor getDescriptor()
Get metadata describing this cube.


union

public Cube union(Cube other)
Create a cube containing the union of data in this cube and some other cube.