1 13 package com.tonbeller.jpivot.olap.model.impl; 14 15 import java.util.ArrayList ; 16 import java.util.List ; 17 18 import com.tonbeller.jpivot.olap.model.Axis; 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.model.Visitor; 23 24 28 public class AxisImpl implements Axis { 29 30 List positions = new ArrayList (); 31 32 38 public Hierarchy[] getHierarchies() { 39 if (positions.size() > 0) { 40 Position pos = (Position)positions.get(0); 41 Member[] members = pos.getMembers(); 42 Hierarchy[] hiers = new Hierarchy[members.length]; 43 for (int i = 0; i < members.length; i++) 44 hiers[i] = members[i].getLevel().getHierarchy(); 45 return hiers; 46 } 47 return new Hierarchy[0]; 48 } 49 50 54 public List getPositions() { 55 return positions; 56 } 57 58 62 public void setPositions(List positions) { 63 this.positions = positions; 64 } 65 66 public void addPosition(Position pos) { 67 positions.add(pos); 68 } 69 70 public void accept(Visitor visitor) { 71 visitor.visitAxis(this); 72 } 73 74 public Object getRootDecoree() { 75 return this; 76 } 77 78 } 79 | Popular Tags |