本文整理汇总了Java中org.olap4j.Position类的典型用法代码示例。如果您正苦于以下问题:Java Position类的具体用法?Java Position怎么用?Java Position使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Position类属于org.olap4j包,在下文中一共展示了Position类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Olap4jResultAxis
import org.olap4j.Position; //导入依赖的package包/类
public Olap4jResultAxis(CellSetAxis axis,
List<Hierarchy> axisHierarchies,
Olap4jFactory factory)
{
List<Position> positions = axis.getPositions();
this.tuples = new ArrayList<Olap4jTuple>(positions.size());
for (Iterator<Position> it = positions.iterator(); it.hasNext(); )
{
tuples.add(new Olap4jTuple(it.next(), factory));
}
this.hierarchies = new ArrayList<Olap4jHierarchy>(axisHierarchies.size());
for (Iterator<Hierarchy> it = axisHierarchies.iterator(); it.hasNext(); )
{
hierarchies.add(new Olap4jHierarchy(it.next()));
}
}
示例2: toString
import org.olap4j.Position; //导入依赖的package包/类
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
boolean first = true;
for (Object o : comparableObjects) {
if (!first) sb.append(", ");
if (o instanceof String) {
sb.append((String) o);
} else if (o instanceof Position) {
boolean firstMember = true;
for (Member member : ((Position) o).getMembers()) {
if (!first || !firstMember) sb.append(", ");
sb.append(member.getName());
firstMember = false;
}
}
first = false;
}
return sb.toString();
}
示例3: determineRowAxisColumns
import org.olap4j.Position; //导入依赖的package包/类
/**
*
* @param axis
* @return
*/
private List<Level> determineRowAxisColumns(CellSetAxis axis) {
Set<Level> levelsEncountered = new HashSet<Level>();
for (Position p : axis.getPositions()) {
for (Member m : p.getMembers()) {
levelsEncountered.add(m.getLevel());
}
}
List<Level> columnAssignments = new ArrayList<Level>();
for (Hierarchy h : axis.getAxisMetaData().getHierarchies()) {
for (Level l : h.getLevels()) {
if (levelsEncountered.contains(l)) {
columnAssignments.add(l);
}
}
}
return columnAssignments;
}
示例4: axisInfo
import org.olap4j.Position; //导入依赖的package包/类
private List<Hierarchy> axisInfo(SaxWriter writer, CellSetAxis axis, String axisName) {
writer.startElement("AxisInfo", "name", axisName);
List<Hierarchy> hierarchies;
Iterator<org.olap4j.Position> it = axis.getPositions().iterator();
if (it.hasNext()) {
final org.olap4j.Position position = it.next();
hierarchies = new ArrayList<Hierarchy>();
for (Member member : position.getMembers()) {
hierarchies.add(member.getHierarchy());
}
} else {
hierarchies = axis.getAxisMetaData().getHierarchies();
}
List<Property> props = getProps(axis.getAxisMetaData());
writeHierarchyInfo(writer, hierarchies, props);
writer.endElement(); // AxisInfo
return hierarchies;
}
示例5: computeAxisInfo
import org.olap4j.Position; //导入依赖的package包/类
/**
* Computes a description of an axis.
*
* @param axis
* Axis
* @return Description of axis
*/
private AxisInfo computeAxisInfo(final CellSetAxis axis) {
if (axis == null) {
return new AxisInfo(0);
}
final AxisInfo axisInfo = new AxisInfo(axis.getAxisMetaData().getHierarchies().size());
int p = -1;
for (final Position position : axis.getPositions()) {
++p;
int k = -1;
for (final Member member : position.getMembers()) {
++k;
final AxisOrdinalInfo axisOrdinalInfo = axisInfo.ordinalInfos.get(k);
final int topDepth = member.isAll() ? member.getDepth() : member.getHierarchy().hasAll() ? 1 : 0;
if (axisOrdinalInfo.minDepth > topDepth || p == 0) {
axisOrdinalInfo.minDepth = topDepth;
}
axisOrdinalInfo.maxDepth = Math.max(axisOrdinalInfo.maxDepth, member.getDepth());
}
}
return axisInfo;
}
示例6: computeAxisInfo
import org.olap4j.Position; //导入依赖的package包/类
/**
* Computes a description of an axis.
*
* @param axis
* Axis
* @return Description of axis
*/
private AxisInfo computeAxisInfo( final CellSetAxis axis ) {
if ( axis == null ) {
return new AxisInfo( 0 );
}
final AxisInfo axisInfo = new AxisInfo( axis.getAxisMetaData().getHierarchies().size() );
int p = -1;
for ( final Position position : axis.getPositions() ) {
++p;
int k = -1;
for ( final Member member : position.getMembers() ) {
++k;
final AxisOrdinalInfo axisOrdinalInfo = axisInfo.ordinalInfos.get( k );
final int topDepth = member.isAll() ? member.getDepth() : member.getHierarchy().hasAll() ? 1 : 0;
if ( axisOrdinalInfo.minDepth > topDepth || p == 0 ) {
axisOrdinalInfo.minDepth = topDepth;
}
axisOrdinalInfo.maxDepth = Math.max( axisOrdinalInfo.maxDepth, member.getDepth() );
}
}
return axisInfo;
}
示例7: getCell
import org.olap4j.Position; //导入依赖的package包/类
@Override
public Cell getCell(Position... positions) {
List<Integer> coordinates = new ArrayList<Integer>(axes.size());
for(int i=0; i < axes.size(); i++){
CellSetAxis axis = axes.get(i);
int coord = axis.getPositions().indexOf(positions[i]);
if(coord<0)
return null;
coordinates.set(i, coord);
}
return getCell(coordinates);
}
示例8: parseAxes
import org.olap4j.Position; //导入依赖的package包/类
protected void parseAxes(CellSet result)
{
// Cycle over AxisInfo-Elements
Iterator<CellSetAxis> itAxis = result.getAxes().iterator();
log.debug("# axes: " + result.getAxes().size());
while (itAxis.hasNext())
{
CellSetAxis itAxisElement = itAxis.next();
Axis axis = itAxisElement.getAxisMetaData().getAxisOrdinal();
if (axis.axisOrdinal() == Axis.FILTER.axisOrdinal())
{
if (log.isDebugEnabled())
{
log.debug("skipping filter axis: " + axis.name() + ", ordinal: " + axis.axisOrdinal());
}
continue;
}
JRXmlaResultAxis xmlaAxis = new JRXmlaResultAxis(axis.name());
xmlaResult.addAxis(xmlaAxis);
if (log.isDebugEnabled())
{
log.debug("adding axis: " + axis.name() + ", ordinal: " + axis.axisOrdinal());
}
handleHierInfo(xmlaAxis, itAxisElement.getAxisMetaData());
ListIterator<Position> positionsIt = itAxisElement.iterator();
while (positionsIt.hasNext())
{
Position p = positionsIt.next();
if (log.isDebugEnabled())
{
log.debug("adding pos : " + p.getOrdinal() + ", with member size: " + p.getMembers().size());
}
handlePosition(xmlaAxis, itAxisElement, p);
}
}
}
示例9: Olap4jTuple
import org.olap4j.Position; //导入依赖的package包/类
public Olap4jTuple(Position position, Olap4jFactory factory)
{
members = new Olap4jMember[position.getMembers().size()];
int idx = 0;
for (Iterator<Member> it = position.getMembers().iterator(); it.hasNext(); ++idx)
{
Member member = it.next();
members[idx] = factory.createMember(member);
}
}
示例10: next
import org.olap4j.Position; //导入依赖的package包/类
@Override
public List<?> next() throws TranslatorException {
if (!rowPositionIterator.hasNext()) {
return null;
}
Position rowPosition = rowPositionIterator.next();
Object[] result = new Object[colWidth];
int i = 0;
// add in rows axis
List<Member> members = rowPosition.getMembers();
for (Member member:members) {
String columnName = member.getName();
result[i++] = columnName;
}
// add col axis
for (Position colPos : columnsAxis) {
Cell cell = cellSet.getCell(colPos, rowPosition);
result[i++] = cell.getValue();
}
if (returnsArray) {
ArrayList<Object[]> results = new ArrayList<Object[]>(1);
results.add(result);
return results;
}
return Arrays.asList(result);
}
示例11: getColumnsName
import org.olap4j.Position; //导入依赖的package包/类
protected IList<Object> getColumnsName(final CellSet cellSet) {
final IList<Object> columnsName = GamaListFactory.create();
final List<CellSetAxis> cellSetAxes = cellSet.getAxes();
// get headings.
final CellSetAxis columnsAxis = cellSetAxes.get(Axis.COLUMNS.axisOrdinal());
for (final Position position : columnsAxis.getPositions()) {
final Member measure = position.getMembers().get(0);
columnsName.add(measure.getName());
}
return columnsName;
}
示例12: getCell
import org.olap4j.Position; //导入依赖的package包/类
public Cell getCell(Position... positions) {
int[] coords = new int[positions.length];
for (int i = 0; i < coords.length; i++) {
coords[i] = positions[i].getOrdinal();
}
return getCellInternal(coords);
}
示例13: writeMember
import org.olap4j.Position; //导入依赖的package包/类
private void writeMember(SaxWriter writer, Member member, Position prevPosition, Position nextPosition, int k, List<Property> props) throws OlapException {
writer.startElement("Member", "Hierarchy", "[" + member.getHierarchy().getName() + "]");
int levelNo = 0;
for (Property prop : props) {
if (!prop.getName().equals("PARENT_UNIQUE_NAME") && !prop.getName().equals("HIERARCHY_UNIQUE_NAME")) {
Object value;
Property longProp = longProps.get(prop.getName());
levelNo = (Integer) member.getPropertyValue(StandardMemberProperty.LEVEL_NUMBER);
if (longProp == null) {
longProp = prop;
}
if (longProp == StandardMemberProperty.DISPLAY_INFO) {
// LNum is relevant to Excel drill - down behavior. The value is
if (levelNo == 0)
value = 0;//value = 1000;
else if (levelNo == 1)
value = 197608;
else if (levelNo == 2)
value = 132072;
else
value = 131072 + levelNo;
} else if (longProp == StandardMemberProperty.DEPTH) {
value = member.getDepth();
} else {
value = member.getPropertyValue(longProp);
}
if (value != null && !(levelNo == 0 && prop.getName().equals("HIERARCHY_UNIQUE_NAME"))) {
writer.textElement(encoder.encode(prop.getName()), value);
}
}
}
writer.endElement(); // Member
}
示例14: recurse
import org.olap4j.Position; //导入依赖的package包/类
private void recurse(SaxWriter writer, List<Integer> pos, int axisOrdinal, int[] cellOrdinal) {
if (axisOrdinal < 0) {
emitCell(writer, pos, cellOrdinal[0]++);
} else {
CellSetAxis axis = cellSet.getAxes().get(axisOrdinal);
List<Position> positions = axis.getPositions();
for (int i = 0, n = positions.size(); i < n; i++) {
pos.set(axisOrdinal, i);
recurse(writer, pos, axisOrdinal - 1, cellOrdinal);
}
}
}
示例15: iterate
import org.olap4j.Position; //导入依赖的package包/类
private void iterate(SaxWriter writer, int axis, final int xxx) throws OlapException {
final List<Position> positions = cellSet.getAxes().get(axis).getPositions();
int axisLength = axis == 0 ? 1 : positions.size();
for (int i = 0; i < axisLength; i++) {
final Position position = positions.get(i);
int ho = xxx;
final List<Member> members = position.getMembers();
for (int j = 0; j < members.size() && ho < this.members.length; j++, ho++) {
this.members[ho] = position.getMembers().get(j);
}
++cellOrdinal;
Util.discard(cellOrdinal);
if (axis >= 2) {
iterate(writer, axis - 1, ho);
} else {
writer.startElement("row");// abrimos la fila
pos[axis] = i; // coordenadas: fila i
pos[0] = 0; // coordenadas (0,i): columna 0
for (ColumnHandler columnHandler : columnHandlers) {
if (columnHandler instanceof MemberColumnHandler) {
columnHandler.write(writer, null, this.members);
} else if (columnHandler instanceof CellColumnHandler) {
columnHandler.write(writer, cellSet.getCell(posList), null);
pos[0]++;// next col.
}
}
writer.endElement();// cerramos la fila
}
}
}