001 /* 002 // $Id: //open/mondrian/src/main/mondrian/rolap/GroupingSetsCollector.java#2 $ 003 // This software is subject to the terms of the Common Public License 004 // Agreement, available at the following URL: 005 // http://www.opensource.org/licenses/cpl.html. 006 // Copyright (C) 2004-2008 Julian Hyde and others 007 // All Rights Reserved. 008 // You must accept the terms of that agreement to use this software. 009 */ 010 package mondrian.rolap; 011 012 import mondrian.rolap.agg.GroupingSet; 013 014 import java.util.ArrayList; 015 import java.util.List; 016 017 /** 018 * <p>The <code>GroupingSetsCollector</code> collects the GroupinpSets and pass 019 * the consolidated list to form group by grouping sets sql</p> 020 * 021 * @author Thiyagu 022 * @version $Id: //open/mondrian/src/main/mondrian/rolap/GroupingSetsCollector.java#2 $ 023 * @since 06-Jun-2007 024 */ 025 public class GroupingSetsCollector { 026 027 private final boolean useGroupingSets; 028 029 private ArrayList<GroupingSet> groupingSets = new ArrayList<GroupingSet>(); 030 031 public GroupingSetsCollector(boolean useGroupingSets) { 032 this.useGroupingSets = useGroupingSets; 033 } 034 035 public boolean useGroupingSets() { 036 return useGroupingSets; 037 } 038 039 public void add(GroupingSet aggInfo) { 040 assert groupingSets.isEmpty() || 041 groupingSets.get(0).getColumns().length >= aggInfo.getColumns().length; 042 groupingSets.add(aggInfo); 043 } 044 045 public List<GroupingSet> getGroupingSets() { 046 return groupingSets; 047 } 048 } 049 050 // End GroupingSetsCollector.java