001/* 002// This software is subject to the terms of the Eclipse Public License v1.0 003// Agreement, available at the following URL: 004// http://www.eclipse.org/legal/epl-v10.html. 005// You must accept the terms of that agreement to use this software. 006// 007// Copyright (C) 2004-2005 Julian Hyde 008// Copyright (C) 2005-2011 Pentaho and others 009// All Rights Reserved. 010*/ 011package mondrian.rolap.agg; 012 013import mondrian.rolap.*; 014 015import java.util.List; 016 017/** 018 * <p>A collection 019 * of {@link mondrian.rolap.agg.Segment}s that can be represented 020 * as a GROUP BY GROUPING SET in a SQL query.</p> 021 * 022 * @author Thiyagu 023 * @since 05-Jun-2007 024 */ 025public class GroupingSet { 026 private final List<Segment> segments; 027 final Segment segment0; 028 private final BitKey levelBitKey; 029 private final BitKey measureBitKey; 030 private final StarColumnPredicate[] predicates; 031 private final SegmentAxis[] axes; 032 private final RolapStar.Column[] columns; 033 034 /** 035 * Creates a GroupingSet. 036 * 037 * @param segments Constituent segments 038 * @param levelBitKey Levels 039 * @param measureBitKey Measures 040 * @param predicates Predicates 041 * @param columns Columns 042 */ 043 public GroupingSet( 044 List<Segment> segments, 045 BitKey levelBitKey, 046 BitKey measureBitKey, 047 StarColumnPredicate[] predicates, 048 RolapStar.Column[] columns) 049 { 050 this.segments = segments; 051 this.segment0 = segments.get(0); 052 this.levelBitKey = levelBitKey; 053 this.measureBitKey = measureBitKey; 054 this.predicates = predicates; 055 this.axes = new SegmentAxis[predicates.length]; 056 this.columns = columns; 057 } 058 059 060 public List<Segment> getSegments() { 061 return segments; 062 } 063 064 public BitKey getLevelBitKey() { 065 return levelBitKey; 066 } 067 068 public BitKey getMeasureBitKey() { 069 return measureBitKey; 070 } 071 072 public SegmentAxis[] getAxes() { 073 return axes; 074 } 075 076 public StarColumnPredicate[] getPredicates() { 077 return predicates; 078 } 079 080 public RolapStar.Column[] getColumns() { 081 return columns; 082 } 083 084 /** 085 * Sets all the segments which are in loading state as failed 086 */ 087 public void setSegmentsFailed() { 088 for (Segment segment : segments) { 089 // TODO: segment.setFailIfStillLoading(); 090 } 091 } 092} 093 094// End GroupingSet.java