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

Quick Search    Search Deep

org.jdaemon.era
Class AbstractCube  view AbstractCube download AbstractCube.java

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byorg.jdaemon.era.AbstractCube
All Implemented Interfaces:
java.util.Collection, Cube, java.lang.Iterable
Direct Known Subclasses:
FilteredCube

public abstract class AbstractCube
extends java.util.AbstractCollection
implements Cube

Provides a base implementation of many methods in Cube.


Nested Class Summary
private  class AbstractCube.Equal
          Default implementation for StandardFilter with type EQUAL
private  class AbstractCube.Greater
          Default implementation for StandardFilter with type GREATER
private  class AbstractCube.GreaterOrEqual
          Default implementation for StandardFilter with type GREATER_OR_EQUAL
private  class AbstractCube.Less
          Default implementation for StandardFilter with type LESS
private  class AbstractCube.LessOrEqual
          Default implementation for StandardFilter with type LESS_OR_EQUAL
private  class AbstractCube.StandardFilter
          Base class for standard Filter implementations
 
Field Summary
private static java.util.Comparator DEFAULT_COMPARATOR
          Default comparator which assumes objects to be compared implement the Comparable interface
 
Fields inherited from interface org.jdaemon.era.Cube
EQUAL, GREATER, GREATER_OR_EQUAL, LAST_OPERAND, LESS, LESS_OR_EQUAL
 
Constructor Summary
AbstractCube()
           
 
Method Summary
 void addAll(Cube cube)
          Add all the data items in the given Cube OPTIONAL OPERATION Adds many objects to this cube
 Cube constrain(Filter filter)
          Create 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.
 Cube constrain(java.lang.String attribute, int constraint_type, java.lang.Object value)
          Create 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.
abstract  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)
          Return a set of all the values of a given attribute across all contained objects
 java.util.Comparator getComparator(java.lang.String attribute)
          Get a comparator object which orders an attribute of this cube The default implementation returns a default comparator which assumes the attribute is of a type that implements Comparable.
abstract  CubeDescriptor getDescriptor()
          Get metadata describing this cube
 java.lang.Object getMax(java.lang.String dimension)
          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.
 java.lang.Object getMin(java.lang.String dimension)
          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.
 double getSum(java.lang.String attribute)
          Get the sum over all contained objects of some attribute This method is should be equivalent to summing: ((Number)getAttribute(attribute, object)).doubleValue() for all values returned by the Cube's iterator.
 java.util.Iterator groupBy(java.lang.String attribute)
          Group data by a given attribute Returns an iterator of a collection of Cubes.
abstract  java.util.Iterator iterator()
          Get an interator over all data items contained by this cube
 int size()
          Get the number of data items 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 class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Field Detail

DEFAULT_COMPARATOR

private static final java.util.Comparator DEFAULT_COMPARATOR
Default comparator which assumes objects to be compared implement the Comparable interface

Constructor Detail

AbstractCube

public AbstractCube()
Method Detail

addAll

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

Specified by:
addAll in interface Cube

constrain

public Cube constrain(Filter filter)
Create 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 getFilter() method returns standardised filter objects the implementation of which can be significantly optimised by the cube implementation. The filters returned by getFilter() should therefore be used in preference to custom generated filters wherever possible.

Specified by:
constrain in interface Cube

getComparator

public java.util.Comparator getComparator(java.lang.String attribute)
Get a comparator object which orders an attribute of this cube The default implementation returns a default comparator which assumes the attribute is of a type that implements Comparable.


getAttributeSet

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

Specified by:
getAttributeSet in interface Cube

constrain

public Cube constrain(java.lang.String attribute,
                      int constraint_type,
                      java.lang.Object value)
Create 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

Specified by:
constrain in interface Cube

getMax

public java.lang.Object getMax(java.lang.String dimension)
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.

Specified by:
getMax in interface Cube

getMin

public java.lang.Object getMin(java.lang.String dimension)
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.

Specified by:
getMin in interface Cube

getSum

public double getSum(java.lang.String attribute)
Get the sum over all contained objects of some attribute 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.

Specified by:
getSum in interface Cube

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.

Specified by:
groupBy in interface Cube

size

public int size()
Get the number of data items contained by this cube

Specified by:
size in interface java.util.Collection

iterator

public abstract java.util.Iterator iterator()
Get an interator over all data items contained by this cube

Specified by:
iterator in interface Cube

getDescriptor

public abstract CubeDescriptor getDescriptor()
Get metadata describing this cube

Specified by:
getDescriptor in interface Cube

getAttribute

public abstract 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

Specified by:
getAttribute in interface Cube

union

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

Specified by:
union in interface Cube