All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opendaylight.yangtools.yang.xpath.api.BigDecimalNumberExpr Maven / Gradle / Ivy

There is a newer version: 14.0.5
Show newest version
/*
 * Copyright (c) 2019 Pantheon Technologies, s.r.o.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.yangtools.yang.xpath.api;

import static java.util.Objects.requireNonNull;

import java.io.Serial;
import java.math.BigDecimal;
import org.eclipse.jdt.annotation.Nullable;

final class BigDecimalNumberExpr extends YangNumberExpr {
    @Serial
    private static final long serialVersionUID = 1L;

    private final BigDecimal number;

    private BigDecimalNumberExpr(final BigDecimal number) {
        this.number = requireNonNull(number);
    }

    static BigDecimalNumberExpr of(final BigDecimal number) {
        return new BigDecimalNumberExpr(number);
    }

    @Override
    public BigDecimal getNumber() {
        return number;
    }

    @Override
    public BigDecimalXPathMathSupport getSupport() {
        return BigDecimalXPathMathSupport.INSTANCE;
    }

    @Override
    public int hashCode() {
        return number.hashCode();
    }

    @Override
    public boolean equals(final @Nullable Object obj) {
        return this == obj || obj instanceof BigDecimalNumberExpr other && number.equals(other.number);
    }

    @Override
    public String toString() {
        return number.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy