KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > jpivot > test > olap > TestPlaceMembersOnAxes


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.jpivot.test.olap;
14
15 import java.util.ArrayList JavaDoc;
16 import java.util.Iterator JavaDoc;
17 import java.util.List JavaDoc;
18
19 import com.tonbeller.jpivot.olap.model.Hierarchy;
20 import com.tonbeller.jpivot.olap.model.Member;
21 import com.tonbeller.jpivot.olap.model.Position;
22 import com.tonbeller.jpivot.olap.navi.PlaceMembersOnAxes;
23
24 /**
25  * Created on 13.12.2002
26  *
27  * @author av
28  */

29 public class TestPlaceMembersOnAxes extends TestPlaceHierarchiesOnAxes implements PlaceMembersOnAxes {
30
31   /**
32    * @see com.tonbeller.jpivot.olap.navi.PlaceMembersOnAxes#createMemberExpression(List)
33    */

34   public Object JavaDoc createMemberExpression(List JavaDoc members) {
35     return TestOlapModelUtils.createAxis(members);
36   }
37
38   /**
39    * @see com.tonbeller.jpivot.olap.navi.PlaceMembersOnAxes#findVisibleMembers(Hierarchy)
40    */

41   public List JavaDoc findVisibleMembers(Hierarchy hier) {
42     List JavaDoc list = new ArrayList JavaDoc();
43     
44     TestAxis[] axes = model().getAxes();
45     for (int i = 0; i < axes.length; i++) {
46       TestAxis axis = axes[i];
47       // optimize: check against axis.getHierarchies()
48
for (Iterator JavaDoc it = axis.getPositions().iterator(); it.hasNext();) {
49         Position p = (Position)it.next();
50         Member[] members = p.getMembers();
51         // optimize find the position of the member once
52
for (int j = 0; j < members.length; j++) {
53           if (members[j].getLevel().getHierarchy().equals(hier))
54             list.add(members[j]);
55         }
56       }
57     }
58     return list;
59   }
60
61 }
62
Popular Tags