2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.controller.model.util;
\r
10 import java.math.BigDecimal;
\r
11 import java.util.ArrayList;
\r
12 import java.util.Collections;
\r
13 import java.util.List;
\r
15 import org.opendaylight.controller.model.api.type.DecimalTypeDefinition;
\r
16 import org.opendaylight.controller.model.api.type.RangeConstraint;
\r
17 import org.opendaylight.controller.yang.common.QName;
\r
18 import org.opendaylight.controller.yang.model.api.SchemaPath;
\r
19 import org.opendaylight.controller.yang.model.api.Status;
\r
20 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
\r
22 public class Decimal64 implements DecimalTypeDefinition {
\r
24 private final QName name = BaseTypes.constructQName("decimal64");
\r
25 private final SchemaPath path;
\r
26 private String units = "";
\r
27 private BigDecimal defaultValue = null;
\r
29 private final String description = "The decimal64 type represents a subset of the real numbers, which can "
\r
30 + "be represented by decimal numerals. The value space of decimal64 is the set of numbers that can "
\r
31 + "be obtained by multiplying a 64-bit signed integer by a negative power of ten, i.e., expressible as "
\r
32 + "'i x 10^-n' where i is an integer64 and n is an integer between 1 and 18, inclusively.";
\r
34 private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.3";
\r
36 private final List<RangeConstraint> rangeStatements;
\r
37 private final Integer fractionDigits;
\r
39 public Decimal64(final Integer fractionDigits) {
\r
41 this.fractionDigits = fractionDigits;
\r
42 rangeStatements = new ArrayList<RangeConstraint>();
\r
43 this.path = BaseTypes.schemaPath(name);
\r
46 public Decimal64(final List<RangeConstraint> rangeStatements,
\r
47 Integer fractionDigits) {
\r
49 this.rangeStatements = rangeStatements;
\r
50 this.fractionDigits = fractionDigits;
\r
51 this.path = BaseTypes.schemaPath(name);
\r
54 public Decimal64(final String units, final BigDecimal defaultValue,
\r
55 final List<RangeConstraint> rangeStatements,
\r
56 final Integer fractionDigits) {
\r
59 this.defaultValue = defaultValue;
\r
60 this.rangeStatements = rangeStatements;
\r
61 this.fractionDigits = fractionDigits;
\r
62 this.path = BaseTypes.schemaPath(name);
\r
66 public DecimalTypeDefinition getBaseType() {
\r
71 public String getUnits() {
\r
76 public Object getDefaultValue() {
\r
77 return defaultValue;
\r
81 public QName getQName() {
\r
86 public SchemaPath getPath() {
\r
91 public String getDescription() {
\r
96 public String getReference() {
\r
101 public Status getStatus() {
\r
102 return Status.CURRENT;
\r
106 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
\r
107 return Collections.emptyList();
\r
111 public List<RangeConstraint> getRangeStatements() {
\r
112 return rangeStatements;
\r
116 public Integer getFractionDigits() {
\r
117 return fractionDigits;
\r
121 public String toString() {
\r
122 return Decimal64.class.getSimpleName() + "[qname=" + name
\r
123 + ", fractionDigits=" + fractionDigits + "]";
\r