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 edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
11 import org.eclipse.jdt.annotation.Nullable;
13 final class DoubleNumberExpr extends YangNumberExpr<DoubleNumberExpr, Double> {
14 private static final long serialVersionUID = 1L;
16 private final double value;
18 private DoubleNumberExpr(final double value) {
22 static DoubleNumberExpr of(final double value) {
23 return new DoubleNumberExpr(value);
31 public Double getNumber() {
36 public DoubleXPathMathSupport getSupport() {
37 return DoubleXPathMathSupport.getInstance();
41 public int hashCode() {
42 return Double.hashCode(value);
46 @SuppressFBWarnings(value = "FE_FLOATING_POINT_EQUALITY", justification = "")
47 public boolean equals(final @Nullable Object obj) {
48 return this == obj || obj instanceof DoubleNumberExpr && bitEqual(((DoubleNumberExpr) obj).value);
51 private boolean bitEqual(final double other) {
52 return Double.doubleToLongBits(value) == Double.doubleToLongBits(other);
56 public String toString() {
57 return String.valueOf(value);