Package mondrian.rolap
Interface Modulos
- All Known Implementing Classes:
Modulos.Base
,Modulos.Many
,Modulos.One
,Modulos.Three
,Modulos.Two
,Modulos.Zero
public interface Modulos
Modulos implementations encapsulate algorithms to map between integral
ordinals and position arrays. There are particular implementations for
the most likely cases where the number of axes is 1, 2 and 3
as well as a general implementation.
Suppose the result is 4 x 3 x 2, then modulo = {1, 4, 12, 24}.
Then the ordinal of cell (3, 2, 1)
= (modulo[0] * 3) + (modulo[1] * 2) + (modulo[2] * 1) = (1 * 3) + (4 * 2) + (12 * 1) = 23
Reverse calculation:
p[0] = (23 % modulo[1]) / modulo[0] = (23 % 4) / 1 = 3 p[1] = (23 % modulo[2]) / modulo[1] = (23 % 12) / 4 = 2 p[2] = (23 % modulo[3]) / modulo[2] = (23 % 24) / 12 = 1
- Author:
- jhyde
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
static class
static class
static class
static class
static class
static class
-
Method Summary
Modifier and TypeMethodDescriptionint
getCellOrdinal
(int[] pos) Converts a set of cell coordinates to a cell ordinal.int[]
getCellPos
(int cellOrdinal) Converts a cell ordinal to a set of cell coordinates.
-
Method Details
-
getCellPos
int[] getCellPos(int cellOrdinal) Converts a cell ordinal to a set of cell coordinates. Converse ofgetCellOrdinal(int[])
. For example, if this result is 10 x 10 x 10, then cell ordinal 537 has coordinates (5, 3, 7).- Parameters:
cellOrdinal
- Cell ordinal- Returns:
- cell coordinates
-
getCellOrdinal
int getCellOrdinal(int[] pos) Converts a set of cell coordinates to a cell ordinal. Converse ofgetCellPos(int)
.- Parameters:
pos
- Cell coordinates- Returns:
- cell ordinal
-