001    /*
002    // $Id: //open/mondrian/src/main/mondrian/olap/type/CubeType.java#8 $
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) 2005-2008 Julian Hyde
007    // All Rights Reserved.
008    // You must accept the terms of that agreement to use this software.
009    */
010    package mondrian.olap.type;
011    
012    import mondrian.olap.Cube;
013    import mondrian.olap.Dimension;
014    import mondrian.olap.Hierarchy;
015    import mondrian.olap.Level;
016    
017    /**
018     * The type of an expression which represents a Cube or Virtual Cube.
019     *
020     * @author jhyde
021     * @since Feb 17, 2005
022     * @version $Id: //open/mondrian/src/main/mondrian/olap/type/CubeType.java#8 $
023     */
024    public class CubeType implements Type {
025        private final Cube cube;
026    
027        /**
028         * Creates a type representing a cube.
029         */
030        public CubeType(Cube cube) {
031            this.cube = cube;
032        }
033    
034        public Cube getCube() {
035            return cube;
036        }
037    
038        public boolean usesDimension(Dimension dimension, boolean definitely) {
039            return false;
040        }
041    
042        public Dimension getDimension() {
043            return null;
044        }
045    
046        public Hierarchy getHierarchy() {
047            return null;
048        }
049    
050        public Level getLevel() {
051            return null;
052        }
053    
054        public int hashCode() {
055            return cube.hashCode();
056        }
057    
058        public boolean equals(Object obj) {
059            if (obj instanceof CubeType) {
060                CubeType that = (CubeType) obj;
061                return this.cube.equals(that.cube);
062            } else {
063                return false;
064            }
065        }
066    
067        public Type computeCommonType(Type type, int[] conversionCount) {
068            return this.equals(type)
069                ? this
070                : null;
071        }
072    }
073    
074    // End CubeType.java