001 /*
002 // $Id: CubeType.java 482 2012-01-05 23:27:27Z jhyde $
003 //
004 // Licensed to Julian Hyde under one or more contributor license
005 // agreements. See the NOTICE file distributed with this work for
006 // additional information regarding copyright ownership.
007 //
008 // Julian Hyde licenses this file to you under the Apache License,
009 // Version 2.0 (the "License"); you may not use this file except in
010 // compliance with the License. You may obtain a copy of the License at:
011 //
012 // http://www.apache.org/licenses/LICENSE-2.0
013 //
014 // Unless required by applicable law or agreed to in writing, software
015 // distributed under the License is distributed on an "AS IS" BASIS,
016 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 // See the License for the specific language governing permissions and
018 // limitations under the License.
019 */
020 package org.olap4j.type;
021
022 import org.olap4j.metadata.*;
023
024 /**
025 * The type of an expression which represents a Cube or Virtual Cube.
026 *
027 * @author jhyde
028 * @since Feb 17, 2005
029 * @version $Id: CubeType.java 482 2012-01-05 23:27:27Z jhyde $
030 */
031 public class CubeType implements Type {
032 private final Cube cube;
033
034 /**
035 * Creates a type representing a cube.
036 *
037 * @param cube Cube
038 */
039 public CubeType(Cube cube) {
040 this.cube = cube;
041 }
042
043 /**
044 * Returns the cube.
045 *
046 * @return the cube
047 */
048 public Cube getCube() {
049 return cube;
050 }
051
052 public boolean usesDimension(Dimension dimension, boolean maybe) {
053 return false;
054 }
055
056 public Dimension getDimension() {
057 return null;
058 }
059
060 public Hierarchy getHierarchy() {
061 return null;
062 }
063
064 public Level getLevel() {
065 return null;
066 }
067
068 public boolean equals(Object obj) {
069 if (obj instanceof CubeType) {
070 CubeType that = (CubeType) obj;
071 return TypeUtil.equal(this.cube, that.cube);
072 } else {
073 return false;
074 }
075 }
076
077 public int hashCode() {
078 return cube == null
079 ? 0
080 : cube.hashCode();
081 }
082 }
083
084 // End CubeType.java