001    /*
002    // $Id: CubeType.java 229 2009-05-08 19:11:29Z jhyde $
003    // This software is subject to the terms of the Eclipse Public License v1.0
004    // Agreement, available at the following URL:
005    // http://www.eclipse.org/legal/epl-v10.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 org.olap4j.type;
011    
012    import org.olap4j.metadata.Dimension;
013    import org.olap4j.metadata.Hierarchy;
014    import org.olap4j.metadata.Level;
015    import org.olap4j.metadata.Cube;
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: CubeType.java 229 2009-05-08 19:11:29Z jhyde $
023     */
024    public class CubeType implements Type {
025        private final Cube cube;
026    
027        /**
028         * Creates a type representing a cube.
029         *
030         * @param cube Cube
031         */
032        public CubeType(Cube cube) {
033            this.cube = cube;
034        }
035    
036        /**
037         * Returns the cube.
038         *
039         * @return the cube
040         */
041        public Cube getCube() {
042            return cube;
043        }
044    
045        public boolean usesDimension(Dimension dimension, boolean maybe) {
046            return false;
047        }
048    
049        public Dimension getDimension() {
050            return null;
051        }
052    
053        public Hierarchy getHierarchy() {
054            return null;
055        }
056    
057        public Level getLevel() {
058            return null;
059        }
060    
061        public boolean equals(Object obj) {
062            if (obj instanceof CubeType) {
063                CubeType that = (CubeType) obj;
064                return TypeUtil.equal(this.cube, that.cube);
065            } else {
066                return false;
067            }
068        }
069    
070        public int hashCode() {
071            return cube == null
072                ? 0
073                : cube.hashCode();
074        }
075    }
076    
077    // End CubeType.java