1 10 package mondrian.rolap; 11 12 import java.util.*; 13 14 26 public class RolapCacheRegion { 27 private final BitKey bitKey; 28 private final Map<Integer , StarColumnPredicate> columnPredicates = 29 new HashMap<Integer , StarColumnPredicate>(); 30 private Map<List<RolapStar.Column>, StarPredicate> predicates = 31 new HashMap<List<RolapStar.Column>, StarPredicate>(); 32 33 public RolapCacheRegion(RolapStar star, List<RolapStar.Measure> starMeasureList) { 34 bitKey = BitKey.Factory.makeBitKey(star.getColumnCount()); 35 for (RolapStar.Measure measure : starMeasureList) { 36 bitKey.set(measure.getBitPosition()); 37 } 38 } 39 40 public BitKey getConstrainedColumnsBitKey() { 41 return bitKey; 42 } 43 44 50 public void addPredicate( 51 RolapStar.Column column, 52 StarColumnPredicate predicate) 53 { 54 int bitPosition = column.getBitPosition(); 55 assert !bitKey.get(bitPosition); 56 bitKey.set(bitPosition); 57 columnPredicates.put(bitPosition, predicate); 58 } 59 60 67 public StarColumnPredicate getPredicate(int columnOrdinal) { 68 return columnPredicates.get(columnOrdinal); 69 } 70 71 81 public void addPredicate(StarPredicate predicate) 82 { 83 final List<RolapStar.Column> columnList = 84 predicate.getConstrainedColumnList(); 85 predicates.put( 86 new ArrayList<RolapStar.Column>(columnList), 87 predicate); 88 for (RolapStar.Column column : columnList) { 89 bitKey.set(column.getBitPosition()); 90 } 91 } 92 93 98 public Collection<StarPredicate> getPredicates() { 99 return predicates.values(); 100 } 101 } 102 103 | Popular Tags |