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) 2005-2005 Julian Hyde
008// Copyright (C) 2005-2009 Pentaho
009// All Rights Reserved.
010*/
011package mondrian.olap.type;
012
013/**
014 * The type of a numeric expression.
015 *
016 * @author jhyde
017 * @since Feb 17, 2005
018 */
019public class NumericType extends ScalarType {
020
021    /**
022     * Creates a numeric type.
023     */
024    public NumericType() {
025        this("NUMERIC");
026    }
027
028    protected NumericType(String digest) {
029        super(digest);
030    }
031
032    public boolean equals(Object obj) {
033        return obj instanceof NumericType
034            && toString().equals(obj.toString());
035    }
036
037    public boolean isInstance(Object value) {
038        return value instanceof Number
039            || value instanceof Character;
040    }
041}
042
043// End NumericType.java