com.sas.storage.olap.embedded
Class Axis

com.sas.storage.olap.embedded.Axis
All Implemented Interfaces:
AxisInterface

public class Axis
implements AxisInterface

This implementation is designed for the simple definition of axes in a multidimensional ResultSet. The axes are stored in memory within the model. The axis is the root of metadata information for the multidimensional result set. Each result set contains n axes that define the metadata in more detail. The two main components of an axis are the dimensions and the tuples. The dimensions contained on the axis are said to be projected onto the axis. A tuple is the element that combines members from each dimension that is projected onto the axis. In this case where a connection to the metadata does not exist the information about the dimension and the member is not available or minimal.

See Also:
AxisInterface, TupleInterface, ResultSetMetadata

Field Summary
 
Fields inherited from interface com.sas.storage.olap.AxisInterface
CACHE_COUNT, CHAPTERS_AXIS, COLUMNS_AXIS, PAGES_AXIS, ROWS_AXIS, SECTIONS_AXIS, SLICERS_AXIS, START_CACHE_INDEX
 
Constructor Summary
Axis(int axisIndex)
          Create an axis based on the index.
Axis(int axisIndex, java.lang.String[] axisHeaders, TupleInterface[] tuples)
          Create a new Axis
 
Method Summary
 void addTuple(int index, TupleInterface tuple)
          Add a tuple at the specified index.
 void addTuple(TupleInterface tuple)
          Append a tuple.
 TupleInterface[] asTupleArray(java.util.List list)
           
 java.lang.String[] getAxisHeaders()
          Return the axis headers for this axis
 int getAxisNumber()
          Returns the axis number
 java.lang.String[] getDimensionNames()
          Return the an array of names of all the dimensions projected on the axis.
 java.lang.String[] getHierarchyNames()
          Return the Hierarchy names set on this axis
 int getMaximumTupleDepth()
          Return the number of labels associated with each tuple.
 ResultSetMetadataInterface getResultSetMetadata()
          Return ResultSetMetaData for this axis
 TupleInterface getTuple(int index)
          Returns the tuple at given index associated with the axis
 int getTupleCount()
          Returns the number of tuples associated with the axis
 TupleInterface[] getTuples(int index, int count)
          Returns the tuples associated with the axis
 java.lang.String[] getUniqueLevelNames()
          Get the uniqueLevel names
 TupleInterface removeTuple(int index)
          Remove a tuple at the specified index.
 void setAxisHeaders(java.lang.String[] labels)
          Replace the axis header labels for this axis
 void setDimensionNames(java.lang.String[] dimensionNames)
          Replace all the dimension names with the dimension names passed in
 void setHierarchyNames(java.lang.String[] hierarchyNames)
          Set the hierarchy names for this axis
 void setResultSetMetadata(ResultSetMetadataInterface rsm)
          Set the resultset metadata for this axis.
 void setTuple(int index, TupleInterface tuple)
          Replace the tuple at the given index
 void setTuples(int startIndex, int endIndex, TupleInterface[] tuples)
          Replace the tuples associated with the axis
 void setUniqueLevelNames(java.lang.String[] levelNames)
          Set the unique level names on the axis
 

Constructor Detail

Axis

public Axis(int axisIndex)
     throws OLAPException
Create an axis based on the index. The axis index are zero based beginning with AxisInterface.COLUMNS_AXIS axis, followed by AxisInterface.ROWS_AXIS, then PAGESAXISAxisInterface.PAGES_AXIS, etc. and the last axis is AxisInterface.SLICERS_AXIS

Parameters:
axisIndex - axis index of the axis
Throws:
OLAPException - if the axis cannot be created

Axis

public Axis(int axisIndex,
            java.lang.String[] axisHeaders,
            TupleInterface[] tuples)
     throws OLAPException
Create a new Axis

Parameters:
axisIndex - axis number for this axis
axisHeaders - headers for the axis that identifies the row/column members on this axis
tuples - that identify the row/column. A null tuple will not be added.
Throws:
OLAPException - if the axis cannot be created
Method Detail

setDimensionNames

public void setDimensionNames(java.lang.String[] dimensionNames)
                       throws OLAPException
Replace all the dimension names with the dimension names passed in

Parameters:
dimensionNames - dimension names on the axis
Throws:
OLAPException

setResultSetMetadata

public void setResultSetMetadata(ResultSetMetadataInterface rsm)
                          throws OLAPException
Set the resultset metadata for this axis. This Axis will be added to the resultsetmetadata

Parameters:
rsm - resltsetmetadatafor this axis
Throws:
OLAPException - if the resultsetmetadata cannot be set

getDimensionNames

public java.lang.String[] getDimensionNames()
                                     throws OLAPException
Return the an array of names of all the dimensions projected on the axis. If the dimensions are not set, but the tuples are for the axis, this will return an array of tupleDepth with null dimension names.

Specified by:
getDimensionNames in interface AxisInterface
Returns:
An array of dimension names projected on the axis
Throws:
OLAPException

getTuples

public TupleInterface[] getTuples(int index,
                                  int count)
                           throws OLAPException
Returns the tuples associated with the axis

Specified by:
getTuples in interface AxisInterface
Parameters:
index - start index. index should be less than the number of tuples.
count - number of tuples
Returns:
An array of tuples associated with the axis, size of count
Throws:
OLAPException

getTuple

public TupleInterface getTuple(int index)
                        throws OLAPException
Returns the tuple at given index associated with the axis

Specified by:
getTuple in interface AxisInterface
Parameters:
index - start index. index should be less than the number of tuples.
Returns:
A tuple associated with the axis
Throws:
OLAPException

addTuple

public void addTuple(TupleInterface tuple)
              throws OLAPException
Append a tuple.

Parameters:
tuple - to add
Throws:
OLAPException - if the tuple cannot be added

addTuple

public void addTuple(int index,
                     TupleInterface tuple)
              throws OLAPException
Add a tuple at the specified index. Index is set as a tuple coordinate for the tuple. The minimum and maximum coordinate is adjusted for all the tuples on this axis.

Parameters:
index - insert the tuple at the specified zero based index.
tuple - add a non null tuple
Throws:
OLAPException - if the tuple cannot be added

setTuple

public void setTuple(int index,
                     TupleInterface tuple)
              throws OLAPException
Replace the tuple at the given index

Parameters:
index - replace the tuple at this index. Index should be greater than or equal to zero and less than the current tuple count.
tuple - associated with the axis that is to be replaced
Throws:
OLAPException

setTuples

public void setTuples(int startIndex,
                      int endIndex,
                      TupleInterface[] tuples)
               throws OLAPException
Replace the tuples associated with the axis

Parameters:
startIndex - set the tuples beginning at this index. startIndex should be in the range of zero and current tuple count
endIndex - set the tuples upto endIndex, exclusive. endIndex should be greater than startIndex and less than or equal to current tuple count
tuples - An array of tuples associated with the axis
Throws:
OLAPException

removeTuple

public TupleInterface removeTuple(int index)
                           throws OLAPException
Remove a tuple at the specified index. If the tuple is not removed from the end then all other tuples move up in the list to fill the gap and the minimum/maximum coordinate is adjusted accordingly

Parameters:
index - remove the tuple at this index. Index should be between 0 and the length of tuple.
Returns:
removed tuple
Throws:
OLAPException - if the tuple cannot be removed

getTupleCount

public int getTupleCount()
Returns the number of tuples associated with the axis

Specified by:
getTupleCount in interface AxisInterface
Returns:
The number of tuples associated with the axis

getMaximumTupleDepth

public int getMaximumTupleDepth()
                         throws OLAPException
Return the number of labels associated with each tuple. This method returns the maximum depth among all tuples.

Specified by:
getMaximumTupleDepth in interface AxisInterface
Returns:
The number of labels associated with each tuple. This value will be greater than or equal to the number of dimensions projected onto the axis. In some cases multiple labels may be displayed for a given dimension in order to provide context for the user. For example, the quarters of the Time dimension may be projected onto the axis, and the years may be displayed to help provide more information. The tuple depth is a hint for representing this additional information.
Throws:
OLAPException - if a database error occurs

getAxisHeaders

public java.lang.String[] getAxisHeaders()
                                  throws OLAPException
Return the axis headers for this axis

Specified by:
getAxisHeaders in interface AxisInterface
Returns:
array of axis header labels. These are the labels of levels from the metadata in connected implementation, in this case it would be whatever is set or null.
Throws:
OLAPException - if a database error occurs

setAxisHeaders

public void setAxisHeaders(java.lang.String[] labels)
                    throws OLAPException
Replace the axis header labels for this axis

Parameters:
labels - Axis header labels for the axis
Throws:
OLAPException

getHierarchyNames

public java.lang.String[] getHierarchyNames()
                                     throws OLAPException
Return the Hierarchy names set on this axis

Specified by:
getHierarchyNames in interface AxisInterface
Returns:
an array of hierarchy names set on this axis
Throws:
OLAPException
See Also:
AxisInterface.getHierarchyNames()

setHierarchyNames

public void setHierarchyNames(java.lang.String[] hierarchyNames)
                       throws OLAPException
Set the hierarchy names for this axis

Parameters:
hierarchyNames - and array of hierarchy names for the axis
Throws:
OLAPException

getUniqueLevelNames

public java.lang.String[] getUniqueLevelNames()
                                       throws OLAPException
Get the uniqueLevel names

Specified by:
getUniqueLevelNames in interface AxisInterface
Returns:
unique level names on the axis
Throws:
OLAPException
See Also:
AxisInterface.getUniqueLevelNames()

setUniqueLevelNames

public void setUniqueLevelNames(java.lang.String[] levelNames)
                         throws OLAPException
Set the unique level names on the axis

Parameters:
levelNames - an array of level names
Throws:
OLAPException

getResultSetMetadata

public ResultSetMetadataInterface getResultSetMetadata()
                                                throws OLAPException
Return ResultSetMetaData for this axis

Specified by:
getResultSetMetadata in interface AxisInterface
Returns:
resultset metadata for this axis
Throws:
OLAPException

getAxisNumber

public int getAxisNumber()
                  throws OLAPException
Returns the axis number

Specified by:
getAxisNumber in interface AxisInterface
Returns:
The number of the axis (0 for COLUMN, 1 for ROW, 2 for PAGE... -1 for SLICER)
Throws:
OLAPException

asTupleArray

public TupleInterface[] asTupleArray(java.util.List list)



Copyright © 2009 SAS Institute Inc. All Rights Reserved.