Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tonbeller.jpivot.table.span
Class SpanCalc

    java.lang.Object
      com.tonbeller.jpivot.table.span.SpanCalc

    public class SpanCalc

extends java.lang.Object

Calculates table spans for an axis. An axis is seen as a matrix of positions and hierarchies. For a row-axis, the positions are the rows, the hierarchies are the columns, for a column-axis its vice versa.

The cells of the matrix are `Span` instances.

Author:
  av

Constructor Summary
`SpanCalc(Axis axis)` creates an instance from an axis
`SpanCalc(Span[][] spans)` creates an instance

Method Summary
`void` | `addHierarchyHeader(SpanHeaderFactory shf, boolean removeDuplicates)`
`static SpanCalc` | `appendBelow(SpanCalc above, SpanCalc below)`
`SpanCalc` | `createPositionHeader(SpanHeaderFactory shf)` creates a SpanCalc for row axis headers.
`SpanConfig` | `getConfig()` Returns the config.
`int` | `getHierarchyCount()` Returns the hierarchyCount.
`int` | `getPositionCount()` Returns the positionCount.
`Span` | `getSpan(int positionIndex, int hierarchyIndex)` return span info for the element at positionIndex, hierarchyIndex.
`Span[][]` | `getSpans()` returns a matrix of spans[positionIndex][hierarchyIndex] for faster access.
`void` | `setConfig(SpanConfig config)` Sets the config.
`void` | `setSpans(Span[][] spans)` set the matrix of spans[positionIndex][hierarchyIndex] for faster access.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SpanCalc

    public SpanCalc(Span[][] spans)

  creates an instance

### SpanCalc

    public SpanCalc(Axis axis)

  creates an instance from an axis

Method Detail

### createPositionHeader

    public SpanCalc createPositionHeader(SpanHeaderFactory shf)

  creates a SpanCalc for row axis headers. Searches all positions for a "significant" span that is used to create the header via `shf`. Example: the row axis

       a a
       a b

  will get the header (upper case letters)

       A B
       ---
       a a
       a b

  because the second `a` is not significant. Here `A` is created by `shf.create(a)`, and `B = shf.create(b)`.

### addHierarchyHeader

    public void addHierarchyHeader(SpanHeaderFactory shf,
                                   boolean removeDuplicates)

### getSpan

    public Span getSpan(int positionIndex,
                        int hierarchyIndex)

  return span info for the element at positionIndex, hierarchyIndex.

  Parameters:
    `positionIndex` - - index for axis.getPositions()
    `hierarchyIndex` - - index for axis.getPositions().getMembers()
  Returns:
    the Span info if for (positionIndex, hierarchyIndex) needs a <td> to be generated, returns null otherwise. The return value is non-null, if (positionIndex, hierarchyIndex) are minimal for this cell.

### getHierarchyCount

    public int getHierarchyCount()

  Returns the hierarchyCount.

  Returns:
    int

### getPositionCount

    public int getPositionCount()

  Returns the positionCount.

  Returns:
    int

### getConfig

    public SpanConfig getConfig()

  Returns the config.

  Returns:
    SpanConfig

### setConfig

    public void setConfig(SpanConfig config)

  Sets the config.

  Parameters:
    `config` - The config to set

### getSpans

    public Span[][] getSpans()

  returns a matrix of spans[positionIndex][hierarchyIndex] for faster access.

### setSpans

    public void setSpans(Span[][] spans)

  set the matrix of spans[positionIndex][hierarchyIndex] for faster access.

### appendBelow

    public static SpanCalc appendBelow(SpanCalc above,
                                       SpanCalc below)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD