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.io.Serial;
13 import java.math.BigDecimal;
14 import org.eclipse.jdt.annotation.Nullable;
16 final class BigDecimalNumberExpr extends YangNumberExpr {
18 private static final long serialVersionUID = 1L;
20 private final BigDecimal number;
22 private BigDecimalNumberExpr(final BigDecimal number) {
23 this.number = requireNonNull(number);
26 static BigDecimalNumberExpr of(final BigDecimal number) {
27 return new BigDecimalNumberExpr(number);
31 public BigDecimal getNumber() {
36 public BigDecimalXPathMathSupport getSupport() {
37 return BigDecimalXPathMathSupport.INSTANCE;
41 public int hashCode() {
42 return number.hashCode();
46 public boolean equals(final @Nullable Object obj) {
47 return this == obj || obj instanceof BigDecimalNumberExpr other && number.equals(other.number);
51 public String toString() {
52 return number.toString();