1 /*******************************************************************************
\r
2 * Copyright (c) 2010 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.databoard.type;
14 import java.util.Set;
\r
16 import org.simantics.databoard.util.IdentityPair;
\r
17 import org.simantics.databoard.util.Limit;
\r
18 import org.simantics.databoard.util.Range;
\r
20 public class DoubleType extends NumberType {
22 public DoubleType() {}
23 public DoubleType(String unit) {
26 public DoubleType(String unit, Range range) {
30 public DoubleType(String unit, String range) {
35 public double minValue() {
36 Range range = getRange();
\r
37 if (range==null) return -Double.MAX_VALUE;
38 Limit l = range.getLower();
39 double value = l.getValue().doubleValue();
42 if (l.isExclusive()) value+= Double.MIN_VALUE;
47 public double maxValue() {
48 Range range = getRange();
\r
49 if (range==null) return Double.MAX_VALUE;
50 Limit l = range.getUpper();
51 double value = l.getValue().doubleValue();
54 if (l.isExclusive()) value-= Double.MIN_VALUE;
60 protected boolean deepEquals(Object obj, Set<IdentityPair<Datatype, Datatype>> compareHistory) {
61 if (this==obj) return true;
\r
62 if ( !hasEqualMetadata(obj) ) return false;
\r
63 return obj instanceof DoubleType;
67 public int hashCode() {
\r
68 return 0xabcff33 + metadataHashCode();
\r
72 public void accept(Visitor1 v, Object obj) {
77 public <T> T accept(Visitor<T> v) {