mondrian.rolap.agg
Class SegmentWithData

java.lang.Object
  extended by mondrian.rolap.agg.Segment
      extended by mondrian.rolap.agg.SegmentWithData

public class SegmentWithData
extends Segment

Extension to Segment with a data set.

Author:
jhyde

Nested Class Summary
 
Nested classes/interfaces inherited from class mondrian.rolap.agg.Segment
Segment.ExcludedRegion
 
Field Summary
(package private)  SegmentAxis[] axes
          An array of axes, one for each constraining column, containing the values returned for that constraining column.
 
Fields inherited from class mondrian.rolap.agg.Segment
columns, compoundPredicateList, constrainedColumnsBitKey, excludedRegions, id, measure, predicates, star
 
Constructor Summary
SegmentWithData(Segment segment, SegmentDataset data, SegmentAxis[] axes)
          Creates a SegmentWithData from an existing Segment.
 
Method Summary
(package private)  SegmentWithData createSubSegment(BitSet[] axisKeepBitSets, int bestColumn, StarColumnPredicate bestPredicate, List<Segment.ExcludedRegion> excludedRegions)
          Creates a Segment which has the same dimensionality as this Segment and a subset of the values.
protected  void describeAxes(StringBuilder buf, int i, boolean values)
           
 int getCellCount()
          Returns the number of cells in this Segment, deducting cells in excluded regions.
 Object getCellValue(Object[] keys)
          Retrieves the value at the location identified by keys.
 SegmentDataset getData()
          Returns the data set.
(package private)  boolean wouldContain(Object[] keys)
          Returns whether the given set of key values will be in this segment when it finishes loading.
 
Methods inherited from class mondrian.rolap.agg.Segment
createDataset, getColumns, getCompoundPredicateList, getConstrainedColumnsBitKey, getExcludedRegions, getHeader, getStar, isExcluded, matches, print, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

axes

final SegmentAxis[] axes
An array of axes, one for each constraining column, containing the values returned for that constraining column.

Constructor Detail

SegmentWithData

public SegmentWithData(Segment segment,
                       SegmentDataset data,
                       SegmentAxis[] axes)
Creates a SegmentWithData from an existing Segment.

Parameters:
segment - Segment (without data)
data - Data set
Method Detail

describeAxes

protected void describeAxes(StringBuilder buf,
                            int i,
                            boolean values)
Overrides:
describeAxes in class Segment

getCellValue

public Object getCellValue(Object[] keys)
Retrieves the value at the location identified by keys.

Returns

See Also:
make package-private?

wouldContain

boolean wouldContain(Object[] keys)
Returns whether the given set of key values will be in this segment when it finishes loading.


getCellCount

public int getCellCount()
Returns the number of cells in this Segment, deducting cells in excluded regions.

This method may return a value which is slightly too low, or occasionally even negative. This occurs when a Segment has more than one excluded region, and those regions overlap. Cells which are in both regions will be counted twice.

Returns:
Number of cells in this Segment

createSubSegment

SegmentWithData createSubSegment(BitSet[] axisKeepBitSets,
                                 int bestColumn,
                                 StarColumnPredicate bestPredicate,
                                 List<Segment.ExcludedRegion> excludedRegions)
Creates a Segment which has the same dimensionality as this Segment and a subset of the values.

If bestColumn is not -1, the bestColumnth column's predicate should be replaced by bestPredicate.

Parameters:
axisKeepBitSets - For each axis, a bitmap of the axis values to keep; each axis must have at least one bit set
bestColumn - The column that retains most of its values
bestPredicate -
excludedRegions - List of regions to exclude from segment
Returns:
Segment containing a subset of the values

getData

public final SegmentDataset getData()

Returns the data set.

WARNING: the returned SegmentDataset reference should not be modified; it is assumed to be invariant.

Returns:
The data reference

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads