• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Position类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中mondrian.olap.Position的典型用法代码示例。如果您正苦于以下问题:Java Position类的具体用法?Java Position怎么用?Java Position使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Position类属于mondrian.olap包,在下文中一共展示了Position类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: JRMondrianAxis

import mondrian.olap.Position; //导入依赖的package包/类
public JRMondrianAxis(Axis axis, Hierarchy[] axisHierarchies, JRMondrianFactory factory)
{
	List<Position> positions = axis.getPositions();
	tuples = new JRMondrianTuple[positions.size()];
	
	int idx = 0;
	for (Iterator<Position> it = positions.iterator(); it.hasNext(); ++idx)
	{
		Position position = it.next();
		tuples[idx] = new JRMondrianTuple(position, factory);
	}
	
	hierarchies = new JRMondrianHierarchy[axisHierarchies.length];
	for (int i = 0; i < axisHierarchies.length; i++)
	{
		hierarchies[i] = new JRMondrianHierarchy(axisHierarchies[i]);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:19,代码来源:JRMondrianAxis.java


示例2: executeSingletonAxis

import mondrian.olap.Position; //导入依赖的package包/类
/**
 * Executes a set expression which is expected to return 0 or 1 members.
 * It is an error if the expression returns tuples (as opposed to members),
 * or if it returns two or more members.
 *
 * @param expression Expression string
 * @return Null if axis returns the empty set, member if axis returns one
 *   member. Throws otherwise.
 */
public Member executeSingletonAxis(String expression) {
    final String cubeName = getDefaultCubeName();
    Result result = executeQuery(
        "select {" + expression + "} on columns from " + cubeName);
    Axis axis = result.getAxes()[0];
    switch (axis.getPositions().size()) {
    case 0:
        // The mdx "{...}" operator eliminates null members (that is,
        // members for which member.isNull() is true). So if "expression"
        // yielded just the null member, the array will be empty.
        return null;
    case 1:
        // Java nulls should never happen during expression evaluation.
        Position position = axis.getPositions().get(0);
        Util.assertTrue(position.size() == 1);
        Member member = position.get(0);
        Util.assertTrue(member != null);
        return member;
    default:
        throw Util.newInternal(
            "expression " + expression
            + " yielded " + axis.getPositions().size() + " positions");
    }
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:34,代码来源:TestContext.java


示例3: toString

import mondrian.olap.Position; //导入依赖的package包/类
/**
 * Converts a set of positions into a string. Useful if you want to check
 * that an axis has the results you expected.
 */
public static String toString(List<Position> positions) {
    StringBuilder buf = new StringBuilder();
    int i = 0;
    for (Position position : positions) {
        if (i > 0) {
            buf.append(nl);
        }
        if (position.size() != 1) {
            buf.append("{");
        }
        for (int j = 0; j < position.size(); j++) {
            Member member = position.get(j);
            if (j > 0) {
                buf.append(", ");
            }
            buf.append(member.getUniqueName());
        }
        if (position.size() != 1) {
            buf.append("}");
        }
        i++;
    }
    return buf.toString();
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:29,代码来源:TestContext.java


示例4: testAllMemberCaption

import mondrian.olap.Position; //导入依赖的package包/类
public void testAllMemberCaption() {
    TestContext testContext = TestContext.instance()
    .createSubstitutingCube(
        "Sales",
        "<Dimension name=\"Gender3\" foreignKey=\"customer_id\">\n"
        + "  <Hierarchy hasAll=\"true\" allMemberName=\"All Gender\"\n"
        + " allMemberCaption=\"Frauen und Maenner\" primaryKey=\"customer_id\">\n"
        + "  <Table name=\"customer\"/>\n"
        + "    <Level name=\"Gender\" column=\"gender\" uniqueMembers=\"true\"/>\n"
        + "  </Hierarchy>\n"
        + "</Dimension>");
    String mdx = "select {[Gender3].[All Gender]} on columns from Sales";
    Result result = testContext.executeQuery(mdx);
    Axis axis0 = result.getAxes()[0];
    Position pos0 = axis0.getPositions().get(0);
    Member allGender = pos0.get(0);
    String caption = allGender.getCaption();
    Assert.assertEquals(caption, "Frauen und Maenner");
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:20,代码来源:BasicQueryTest.java


示例5: testAllLevelName

import mondrian.olap.Position; //导入依赖的package包/类
public void testAllLevelName() {
    TestContext testContext = TestContext.instance()
    .createSubstitutingCube(
        "Sales",
        "<Dimension name=\"Gender4\" foreignKey=\"customer_id\">\n"
        + "  <Hierarchy hasAll=\"true\" allMemberName=\"All Gender\"\n"
        + " allLevelName=\"GenderLevel\" primaryKey=\"customer_id\">\n"
        + "  <Table name=\"customer\"/>\n"
        + "    <Level name=\"Gender\" column=\"gender\" uniqueMembers=\"true\"/>\n"
        + "  </Hierarchy>\n"
        + "</Dimension>");
    String mdx = "select {[Gender4].[All Gender]} on columns from Sales";
    Result result = testContext.executeQuery(mdx);
    Axis axis0 = result.getAxes()[0];
    Position pos0 = axis0.getPositions().get(0);
    Member allGender = pos0.get(0);
    String caption = allGender.getLevel().getName();
    Assert.assertEquals(caption, "GenderLevel");
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:20,代码来源:BasicQueryTest.java


示例6: toString

import mondrian.olap.Position; //导入依赖的package包/类
public static String toString(List<Position> pl) {
    StringBuilder buf = new StringBuilder();
    for (Position p : pl) {
        buf.append('{');
        boolean firstTime = true;
        for (Member m : p) {
            if (! firstTime) {
                buf.append(", ");
            }
            buf.append(m.getUniqueName());
            firstTime = false;
        }
        buf.append('}');
        buf.append('\n');
    }
    return buf.toString();
}
 
开发者ID:Twixer,项目名称:mondrian-3.1.5,代码行数:18,代码来源:RolapAxis.java


示例7: iterator

import mondrian.olap.Position; //导入依赖的package包/类
public Iterator<Position> iterator() {
    return new Iterator<Position>() {
        private final Iterator it = list.iterator();
        private int cursor = 0;
        public boolean hasNext() {
            return it.hasNext();
        }

        public Position next() {
            it.next();
            return get(cursor++);
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
}
 
开发者ID:Twixer,项目名称:mondrian-3.1.5,代码行数:19,代码来源:RolapAxis.java


示例8: testMany

import mondrian.olap.Position; //导入依赖的package包/类
public void testMany() {
    Axis[] axes = new Axis[3];
    List<Position> positions = new PositionList(4);
    axes[0] = new RolapAxis.PositionList(positions);
    positions = new PositionList(3);
    axes[1] = new RolapAxis.PositionList(positions);
    positions = new PositionList(3);
    axes[2] = new RolapAxis.PositionList(positions);

    Modulos modulos = Modulos.Generator.createMany(axes);
    int ordinal = 23;

    int[] pos = modulos.getCellPos(ordinal);
    assertTrue("Pos length equals 3", pos.length == 3);
    assertTrue("Pos[0] length equals 3", pos[0] == 3);
    assertTrue("Pos[1] length equals 2", pos[1] == 2);
    assertTrue("Pos[2] length equals 1", pos[2] == 1);
}
 
开发者ID:Twixer,项目名称:mondrian-3.1.5,代码行数:19,代码来源:ModulosTest.java


示例9: executeSingletonAxis

import mondrian.olap.Position; //导入依赖的package包/类
/**
 * Executes a set expression which is expected to return 0 or 1 members.
 * It is an error if the expression returns tuples (as opposed to members),
 * or if it returns two or more members.
 *
 * @param expression Expression string
 * @return Null if axis returns the empty set, member if axis returns one
 *   member. Throws otherwise.
 */
public Member executeSingletonAxis(String expression) {
    final String cubeName = getDefaultCubeName();
    Result result = executeQuery(
            "select {" + expression + "} on columns from " + cubeName);
    Axis axis = result.getAxes()[0];
    switch (axis.getPositions().size()) {
    case 0:
        // The mdx "{...}" operator eliminates null members (that is,
        // members for which member.isNull() is true). So if "expression"
        // yielded just the null member, the array will be empty.
        return null;
    case 1:
        // Java nulls should never happen during expression evaluation.
        Position position = axis.getPositions().get(0);
        Util.assertTrue(position.size() == 1);
        Member member = position.get(0);
        Util.assertTrue(member != null);
        return member;
    default:
        throw Util.newInternal(
            "expression " + expression
            + " yielded " + axis.getPositions().size() + " positions");
    }
}
 
开发者ID:Twixer,项目名称:mondrian-3.1.5,代码行数:34,代码来源:TestContext.java


示例10: JRMondrianTuple

import mondrian.olap.Position; //导入依赖的package包/类
public JRMondrianTuple(Position position, JRMondrianFactory factory)
{
	members = new JRMondrianMember[position.size()];
	int idx = 0;
	for (Iterator<Member> it = position.iterator(); it.hasNext(); ++idx)
	{
		Member member = it.next();
		members[idx] = factory.createMember(member);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:11,代码来源:JRMondrianTuple.java


示例11: assertVisibility

import mondrian.olap.Position; //导入依赖的package包/类
private void assertVisibility(
    Result result,
    int ordinal,
    String expectedName,
    boolean expectedVisibility)
{
    List<Position> columnPositions = result.getAxes()[0].getPositions();
    Member measure = columnPositions.get(ordinal).get(0);
    assertEquals(expectedName, measure.getName());
    assertEquals(
        expectedVisibility,
        measure.getPropertyValue(Property.VISIBLE.name));
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:14,代码来源:VirtualCubeTest.java


示例12: testVirtualCubeMeasureCaption

import mondrian.olap.Position; //导入依赖的package包/类
/**
 * Test case for bug <a href="http://jira.pentaho.com/browse/MONDRIAN-352">
 * MONDRIAN-352, "Caption is not set on RolapVirtualCubeMesure"</a>.
 */
public void testVirtualCubeMeasureCaption() {
    TestContext testContext = TestContext.instance().create(
        null,
        "<Cube name=\"TestStore\">\n"
        + "  <Table name=\"store\"/>\n"
        + "  <Dimension name=\"HCB\" caption=\"Has coffee bar caption\">\n"
        + "    <Hierarchy hasAll=\"true\">\n"
        + "      <Level name=\"Has coffee bar\" column=\"coffee_bar\" uniqueMembers=\"true\"\n"
        + "          type=\"Boolean\"/>\n"
        + "    </Hierarchy>\n"
        + "  </Dimension>\n"
        + "  <Measure name=\"Store Sqft\" caption=\"Store Sqft Caption\" column=\"store_sqft\" aggregator=\"sum\" formatString=\"#,###\"/>\n"
        + "</Cube>\n",

        "<VirtualCube name=\"VirtualTestStore\">\n"
        + "  <VirtualCubeDimension cubeName=\"TestStore\" name=\"HCB\"/>\n"
        + "  <VirtualCubeMeasure   cubeName=\"TestStore\" name=\"[Measures].[Store Sqft]\"/>\n"
        + "</VirtualCube>",
        null,
        null,
        null);

    Result result = testContext.executeQuery(
        "select {[Measures].[Store Sqft]} ON COLUMNS,"
        + "{[HCB]} ON ROWS "
        + "from [VirtualTestStore]");

    Axis[] axes = result.getAxes();
    List<Position> positions = axes[0].getPositions();
    Member m0 = positions.get(0).get(0);
    String caption = m0.getCaption();
    assertEquals("Store Sqft Caption", caption);
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:38,代码来源:VirtualCubeTest.java


示例13: assertResultValid

import mondrian.olap.Position; //导入依赖的package包/类
/**
 * Checks that a {@link Result} is valid.
 *
 * @param result Query result
 */
private void assertResultValid(Result result) {
    for (Cell cell : cellIter(result)) {
        final Object value = cell.getValue();

        // Check that the dummy value used to represent null cells never
        // leaks into the outside world.
        Assert.assertNotSame(value, Util.nullValue);
        Assert.assertFalse(
            value instanceof Number
            && ((Number) value).doubleValue() == FunUtil.DoubleNull);

        // Similarly empty values.
        Assert.assertNotSame(value, Util.EmptyValue);
        Assert.assertFalse(
            value instanceof Number
            && ((Number) value).doubleValue() == FunUtil.DoubleEmpty);

        // Cells should be null if and only if they are null or empty.
        if (cell.getValue() == null) {
            Assert.assertTrue(cell.isNull());
        } else {
            Assert.assertFalse(cell.isNull());
        }
    }

    // There should be no null members.
    for (Axis axis : result.getAxes()) {
        for (Position position : axis.getPositions()) {
            for (Member member : position) {
                Assert.assertNotNull(member);
            }
        }
    }
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:40,代码来源:TestContext.java


示例14: assertCellSetValid

import mondrian.olap.Position; //导入依赖的package包/类
/**
 * Checks that a {@link CellSet} is valid.
 *
 * @param cellSet Cell set
 */
private void assertCellSetValid(CellSet cellSet) {
    for (org.olap4j.Cell cell : cellIter(cellSet)) {
        final Object value = cell.getValue();

        // Check that the dummy value used to represent null cells never
        // leaks into the outside world.
        Assert.assertNotSame(value, Util.nullValue);
        Assert.assertFalse(
            value instanceof Number
            && ((Number) value).doubleValue() == FunUtil.DoubleNull);

        // Similarly empty values.
        Assert.assertNotSame(value, Util.EmptyValue);
        Assert.assertFalse(
            value instanceof Number
            && ((Number) value).doubleValue() == FunUtil.DoubleEmpty);

        // Cells should be null if and only if they are null or empty.
        if (cell.getValue() == null) {
            Assert.assertTrue(cell.isNull());
        } else {
            Assert.assertFalse(cell.isNull());
        }
    }

    // There should be no null members.
    for (CellSetAxis axis : cellSet.getAxes()) {
        for (org.olap4j.Position position : axis.getPositions()) {
            for (org.olap4j.metadata.Member member : position.getMembers())
            {
                Assert.assertNotNull(member);
            }
        }
    }
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:41,代码来源:TestContext.java


示例15: outputFlattenedRecurse

import mondrian.olap.Position; //导入依赖的package包/类
private static void outputFlattenedRecurse(
    Result result,
    List<List<Object>> rows,
    List<Object> rowValues,
    int[] coords,
    int axisOrdinal)
{
    final Axis[] axes = result.getAxes();
    if (axisOrdinal == axes.length) {
        final Cell cell = result.getCell(coords);
        // Output the raw (unformatted) value of the cell.
        // NOTE: We could output other properties of the cell here, such as its
        // formatted value, too.
        rowValues.add(cell.getValue());

        // Add a copy of the completed row to the list of rows.
        rows.add(new ArrayList<Object>(rowValues));
    } else {
        final Axis axis = axes[axisOrdinal];
        int k = -1;
        int saveLength = rowValues.size();
        for (Position position : axis.getPositions()) {
            coords[axisOrdinal] = ++k;
            for (Member member : position) {
                rowValues.add(member.getUniqueName());
            }
            outputFlattenedRecurse(
                result, rows, rowValues, coords, axisOrdinal + 1);
            while (rowValues.size() > saveLength) {
                rowValues.remove(rowValues.size() - 1);
            }
        }
    }
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:35,代码来源:MondrianHelper.java


示例16: get

import mondrian.olap.Position; //导入依赖的package包/类
public Position get(int index) {
    try {
        return positionList.get(index);
    } catch (UnsupportedOperationException ex) {
        this.materialize();
        return positionList.get(index);
    }
}
 
开发者ID:Twixer,项目名称:mondrian-3.1.5,代码行数:9,代码来源:RolapAxis.java


示例17: testOne

import mondrian.olap.Position; //导入依赖的package包/类
public void testOne() {
    Axis[] axes = new Axis[1];
    List<Position> positions = new PositionList(53);
    axes[0] = new RolapAxis.PositionList(positions);

    Modulos modulosMany = Modulos.Generator.createMany(axes);
    Modulos modulos = Modulos.Generator.create(axes);
    int ordinal = 43;

    int[] posMany = modulosMany.getCellPos(ordinal);
    int[] pos = modulos.getCellPos(ordinal);
    assertTrue("Pos are not equal", Arrays.equals(posMany, pos));

    ordinal = 23;
    posMany = modulosMany.getCellPos(ordinal);
    pos = modulos.getCellPos(ordinal);
    assertTrue("Pos are not equal", Arrays.equals(posMany, pos));

    ordinal = 7;
    posMany = modulosMany.getCellPos(ordinal);
    pos = modulos.getCellPos(ordinal);
    assertTrue("Pos are not equal", Arrays.equals(posMany, pos));

    pos[0] = 23;

    int oMany = modulosMany.getCellOrdinal(pos);
    int o = modulos.getCellOrdinal(pos);
    assertTrue("Ordinals are not equal", oMany == o);

    pos[0] = 11;
    oMany = modulosMany.getCellOrdinal(pos);
    o = modulos.getCellOrdinal(pos);
    assertTrue("Ordinals are not equal", oMany == o);

    pos[0] = 7;
    oMany = modulosMany.getCellOrdinal(pos);
    o = modulos.getCellOrdinal(pos);
    assertTrue("Ordinals are not equal", oMany == o);
}
 
开发者ID:Twixer,项目名称:mondrian-3.1.5,代码行数:40,代码来源:ModulosTest.java


示例18: outputFlattenedRecurse

import mondrian.olap.Position; //导入依赖的package包/类
private static void outputFlattenedRecurse( Result result, List<List<Object>> rows, List<Object> rowValues,
  int[] coords, int axisOrdinal ) {
  final Axis[] axes = result.getAxes();
  if ( axisOrdinal == axes.length ) {
    final Cell cell = result.getCell( coords );
    // Output the raw (unformatted) value of the cell.
    // NOTE: We could output other properties of the cell here, such as its
    // formatted value, too.
    rowValues.add( cell.getValue() );

    // Add a copy of the completed row to the list of rows.
    rows.add( new ArrayList<>( rowValues ) );
  } else {
    final Axis axis = axes[axisOrdinal];
    int k = -1;
    int saveLength = rowValues.size();
    for ( Position position : axis.getPositions() ) {
      coords[axisOrdinal] = ++k;
      for ( Member member : position ) {
        rowValues.add( member.getUniqueName() );
      }
      outputFlattenedRecurse( result, rows, rowValues, coords, axisOrdinal + 1 );
      while ( rowValues.size() > saveLength ) {
        rowValues.remove( rowValues.size() - 1 );
      }
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:29,代码来源:MondrianHelper.java


示例19: createFlattenedOutput

import mondrian.olap.Position; //导入依赖的package包/类
/**
 * Retrieve the rows from the opened query.
 * Also create a description of the flattened output of the query.
 * This call populated rowMetaInterface and rows
 * The query needs to be opened beforehand.
 * @throws KettleDatabaseException in case something goes wrong
 * 
 * TODO: this is not quite working for our purposes.
 */
public void createFlattenedOutput() throws KettleDatabaseException {
	
	final Axis[] axes = result.getAxes();
    rows = new ArrayList<List<Object>>();
    headings = new ArrayList<String>();

    // Compute headings. Each heading is a hierarchy name. If there are say
    // 2 members on the columns, and 3 members on the rows axis, then there
    // will be 5 headings.
    //
    for (Axis axis : axes) {
        final List<Position> positions = axis.getPositions();
        if (positions.isEmpty()) {
            // Result set is empty. There is no data to print, and we cannot
            // even deduce column headings.
            return;
        }
        for (Member member : positions.get(0)) {
        	Hierarchy hierarchy = member.getHierarchy();
            headings.add(hierarchy.getUniqueName());
        }
    }

    int[] coords = new int[axes.length];
    outputFlattenedRecurse(result, rows, new ArrayList<Object>(), coords, 0);

    outputRowMeta = new RowMeta();

    // Just scan the first row to see what data types we received...
    //
    for (int i=0 ; i<rows.size() && i<1 ; i++) {
    	
    	List<Object> rowValues = rows.get(i);
    	
        for (int c=0 ;c<rowValues.size();c++) {
    		ValueMetaInterface valueMeta = new ValueMeta(headings.get(c));
        	Object             valueData = rowValues.get(c);

        	if (valueData instanceof String) {
        		valueMeta.setType(ValueMetaInterface.TYPE_STRING);
        	}
        	else if (valueData instanceof Date) {
        		valueMeta.setType(ValueMetaInterface.TYPE_DATE);
        	}
        	else if (valueData instanceof Boolean) {
        		valueMeta.setType(ValueMetaInterface.TYPE_BOOLEAN);
        	}
        	else if (valueData instanceof Long) {
        		valueMeta.setType(ValueMetaInterface.TYPE_INTEGER);
        	}
        	else if (valueData instanceof Double) {
        		valueMeta.setType(ValueMetaInterface.TYPE_NUMBER);
        	}
        	else if (valueData instanceof BigDecimal) {
        		valueMeta.setType(ValueMetaInterface.TYPE_BIGNUMBER);
        	}
        	else {
        		throw new KettleDatabaseException("Unhandled data type found '"+valueData.getClass().toString()+"'");
        	}
        	
        	outputRowMeta.addValueMeta(valueMeta);
        }
    }
    
    // Now that we painstakingly found the metadata that comes out of the Mondrian database, cache it please...
    //
    DBCacheEntry cacheEntry = new DBCacheEntry(databaseMeta.getName(), queryString);
    DBCache.getInstance().put(cacheEntry, outputRowMeta);
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:79,代码来源:MondrianHelper.java


示例20: getPositions

import mondrian.olap.Position; //导入依赖的package包/类
public List<Position> getPositions() {
    return this.axis.getPositions();
}
 
开发者ID:Twixer,项目名称:mondrian-3.1.5,代码行数:4,代码来源:RolapAxis.java



注:本文中的mondrian.olap.Position类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OWLModelManagerListener类代码示例发布时间:2022-05-22
下一篇:
Java OffsetAndTimestamp类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap