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 static java.util.Objects.requireNonNull;
12 import java.math.BigDecimal;
13 import org.eclipse.jdt.annotation.Nullable;
15 final class BigDecimalNumberExpr extends YangNumberExpr {
16 private static final long serialVersionUID = 1L;
18 private final BigDecimal number;
20 private BigDecimalNumberExpr(final BigDecimal number) {
21 this.number = requireNonNull(number);
24 static BigDecimalNumberExpr of(final BigDecimal number) {
25 return new BigDecimalNumberExpr(number);
29 public BigDecimal getNumber() {
34 public BigDecimalXPathMathSupport getSupport() {
35 return BigDecimalXPathMathSupport.INSTANCE;
39 public int hashCode() {
40 return number.hashCode();
44 public boolean equals(final @Nullable Object obj) {
45 return this == obj || obj instanceof BigDecimalNumberExpr
46 && number.equals(((BigDecimalNumberExpr) obj).number);
50 public String toString() {
51 return number.toString();