Populate model/ hierarchy
[yangtools.git] / model / yang-model-ri / src / main / java / org / opendaylight / yangtools / yang / model / ri / type / RestrictedDecimalType.java
1 /*
2  * Copyright (c) 2015 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.model.ri.type;
9
10 import java.math.BigDecimal;
11 import java.util.Collection;
12 import org.eclipse.jdt.annotation.Nullable;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.type.DecimalTypeDefinition;
16 import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
17
18 final class RestrictedDecimalType extends AbstractRangeRestrictedType<DecimalTypeDefinition, BigDecimal>
19         implements DecimalTypeDefinition {
20     RestrictedDecimalType(final DecimalTypeDefinition baseType, final QName qname,
21             final Collection<? extends UnknownSchemaNode> unknownSchemaNodes,
22             final @Nullable RangeConstraint<BigDecimal> rangeConstraint) {
23         super(baseType, qname, unknownSchemaNodes, rangeConstraint);
24     }
25
26     @Override
27     public int getFractionDigits() {
28         return getBaseType().getFractionDigits();
29     }
30
31     @Override
32     public int hashCode() {
33         return DecimalTypeDefinition.hashCode(this);
34     }
35
36     @Override
37     public boolean equals(final Object obj) {
38         return DecimalTypeDefinition.equals(this, obj);
39     }
40
41     @Override
42     public String toString() {
43         return DecimalTypeDefinition.toString(this);
44     }
45 }