2 * Copyright (c) 2019 Pantheon Technologies, s.r.o. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.xpath.api;
10 import org.eclipse.jdt.annotation.Nullable;
12 final class DoubleNumberExpr extends YangNumberExpr {
13 private static final long serialVersionUID = 1L;
15 private final double value;
17 private DoubleNumberExpr(final double value) {
21 static DoubleNumberExpr of(final double value) {
22 return new DoubleNumberExpr(value);
30 public Double getNumber() {
35 public DoubleXPathMathSupport getSupport() {
36 return DoubleXPathMathSupport.INSTANCE;
40 public int hashCode() {
41 return Double.hashCode(value);
45 public boolean equals(final @Nullable Object obj) {
46 return this == obj || obj instanceof DoubleNumberExpr && bitEqual(((DoubleNumberExpr) obj).value);
49 private boolean bitEqual(final double other) {
50 return Double.doubleToLongBits(value) == Double.doubleToLongBits(other);
54 public String toString() {
55 return String.valueOf(value);