1 10 package mondrian.olap.type; 11 12 import mondrian.olap.*; 13 14 21 public class TupleType implements Type { 22 public final Type[] elementTypes; 23 24 27 public TupleType(Type[] elementTypes) { 28 assert elementTypes != null; 29 this.elementTypes = elementTypes.clone(); 30 } 31 32 public boolean usesDimension(Dimension dimension, boolean maybe) { 33 for (Type elementType : elementTypes) { 34 if (elementType.usesDimension(dimension, maybe)) { 35 return true; 36 } 37 } 38 return false; 39 } 40 41 public Dimension getDimension() { 42 throw new UnsupportedOperationException (); 43 } 44 45 public Hierarchy getHierarchy() { 46 throw new UnsupportedOperationException (); 47 } 48 49 public Level getLevel() { 50 throw new UnsupportedOperationException (); 51 } 52 53 public Type getValueType() { 54 for (Type elementType : elementTypes) { 55 if (elementType instanceof MemberType) { 56 MemberType memberType = (MemberType) elementType; 57 if (memberType.getDimension().isMeasures()) { 58 return memberType.getValueType(); 59 } 60 } 61 } 62 return new ScalarType(); 63 } 64 } 65 66 | Popular Tags |