[ONOS-4670] Removal of Data Model dependencies on Linker
Change-Id: I3f9c5af30198ea31d743e06cea1764dcb306ec32
diff --git a/src/main/java/org/onosproject/yangutils/utils/RestrictionResolver.java b/src/main/java/org/onosproject/yangutils/utils/RestrictionResolver.java
deleted file mode 100644
index 41a8fef..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/RestrictionResolver.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.utils;
-
-import java.util.regex.Pattern;
-import org.onosproject.yangutils.datamodel.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangRangeInterval;
-import org.onosproject.yangutils.datamodel.YangRangeRestriction;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.utils.builtindatatype.DataTypeException;
-import org.onosproject.yangutils.utils.builtindatatype.YangBuiltInDataTypeInfo;
-
-import static org.onosproject.yangutils.datamodel.YangDataTypes.DECIMAL64;
-import static org.onosproject.yangutils.datamodel.YangDataTypes.INT16;
-import static org.onosproject.yangutils.datamodel.YangDataTypes.INT32;
-import static org.onosproject.yangutils.datamodel.YangDataTypes.INT64;
-import static org.onosproject.yangutils.datamodel.YangDataTypes.INT8;
-import static org.onosproject.yangutils.datamodel.YangDataTypes.UINT16;
-import static org.onosproject.yangutils.datamodel.YangDataTypes.UINT32;
-import static org.onosproject.yangutils.datamodel.YangDataTypes.UINT64;
-import static org.onosproject.yangutils.datamodel.YangDataTypes.UINT8;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
-import static org.onosproject.yangutils.utils.YangConstructType.LENGTH_DATA;
-import static org.onosproject.yangutils.utils.YangConstructType.RANGE_DATA;
-import static org.onosproject.yangutils.utils.builtindatatype.BuiltInTypeObjectFactory.getDataObjectFromString;
-
-/**
- * Represents restriction resolver which provide common utility used by parser
- * and during linking for restriction resolution.
- */
-public final class RestrictionResolver {
-
- private static final String PIPE = "|";
- private static final String INTERVAL = "..";
- private static final int MAX_RANGE_BOUNDARY = 2;
- private static final int MIN_RANGE_BOUNDARY = 1;
- private static final String MIN_KEYWORD = "min";
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Creates a restriction resolver.
- */
- private RestrictionResolver() {
- }
-
- /**
- * Processes the range restriction for parser and linker.
- *
- * @param refRangeRestriction range restriction of referred typedef
- * @param lineNumber error line number
- * @param charPositionInLine error character position in line
- * @param hasReferredRestriction whether has referred restriction
- * @param curRangeString caller type's range string
- * @param effectiveType effective type, when called from linker
- * @return YANG range restriction
- */
- public static YangRangeRestriction processRangeRestriction(YangRangeRestriction refRangeRestriction,
- int lineNumber, int charPositionInLine,
- boolean hasReferredRestriction,
- String curRangeString, YangDataTypes effectiveType) {
- YangBuiltInDataTypeInfo<?> startValue;
- YangBuiltInDataTypeInfo<?> endValue;
- YangRangeRestriction rangeRestriction = new YangRangeRestriction();
-
- String rangeArgument = removeQuotesAndHandleConcat(curRangeString);
- String[] rangeArguments = rangeArgument.trim().split(Pattern.quote(PIPE));
-
- for (String rangePart : rangeArguments) {
- String startInterval;
- String endInterval;
- YangRangeInterval rangeInterval = new YangRangeInterval();
- String[] rangeBoundary = rangePart.trim().split(Pattern.quote(INTERVAL));
-
- if (rangeBoundary.length > MAX_RANGE_BOUNDARY) {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(RANGE_DATA) + " " + rangeArgument +
- " is not valid.");
- parserException.setLine(lineNumber);
- parserException.setCharPosition(charPositionInLine);
- throw parserException;
- }
-
- if (rangeBoundary.length == MIN_RANGE_BOUNDARY) {
- startInterval = rangeBoundary[0].trim();
- endInterval = rangeBoundary[0].trim();
- } else {
- startInterval = rangeBoundary[0].trim();
- endInterval = rangeBoundary[1].trim();
- }
-
- try {
- if (hasReferredRestriction && startInterval.equals(MIN_KEYWORD)
- && refRangeRestriction.getMinRestrictedvalue() != null) {
- startValue = refRangeRestriction.getMinRestrictedvalue();
- } else if (hasReferredRestriction && startInterval.equals(MAX_KEYWORD)
- && refRangeRestriction.getMaxRestrictedvalue() != null) {
- startValue = refRangeRestriction.getMaxRestrictedvalue();
- } else {
- startValue = getDataObjectFromString(startInterval, effectiveType);
- }
- if (hasReferredRestriction && endInterval.equals(MIN_KEYWORD)
- && refRangeRestriction.getMinRestrictedvalue() != null) {
- endValue = refRangeRestriction.getMinRestrictedvalue();
- } else if (hasReferredRestriction && endInterval.equals(MAX_KEYWORD)
- && refRangeRestriction.getMaxRestrictedvalue() != null) {
- endValue = refRangeRestriction.getMaxRestrictedvalue();
- } else {
- endValue = getDataObjectFromString(endInterval, effectiveType);
- }
- } catch (DataTypeException | DataModelException e) {
- ParserException parserException = new ParserException(e.getMessage());
- parserException.setLine(lineNumber);
- parserException.setCharPosition(charPositionInLine);
- throw parserException;
- }
-
- rangeInterval.setStartValue(startValue);
- rangeInterval.setEndValue(endValue);
-
- try {
- rangeRestriction.addRangeRestrictionInterval(rangeInterval);
- } catch (DataModelException e) {
- ParserException parserException = new ParserException(constructExtendedListenerErrorMessage(
- UNHANDLED_PARSED_DATA, RANGE_DATA, rangeArgument, ENTRY, e.getMessage()));
- parserException.setLine(lineNumber);
- parserException.setCharPosition(charPositionInLine);
- throw parserException;
- }
- }
- return rangeRestriction;
- }
-
- /**
- * Processes the length restriction for parser and linker.
- *
- * @param refLengthRestriction length restriction of referred typedef
- * @param lineNumber error line number
- * @param charPositionInLine error character position in line
- * @param hasReferredRestriction whether has referred restriction
- * @param curLengthString caller type's length string
- * @return YANG range restriction
- */
- public static YangRangeRestriction processLengthRestriction(YangRangeRestriction refLengthRestriction,
- int lineNumber, int charPositionInLine,
- boolean hasReferredRestriction,
- String curLengthString) {
-
- YangBuiltInDataTypeInfo<?> startValue;
- YangBuiltInDataTypeInfo<?> endValue;
- YangRangeRestriction lengthRestriction = new YangRangeRestriction<>();
-
- String rangeArgument = removeQuotesAndHandleConcat(curLengthString);
- String[] rangeArguments = rangeArgument.trim().split(Pattern.quote(PIPE));
-
- for (String rangePart : rangeArguments) {
- String startInterval;
- String endInterval;
- YangRangeInterval rangeInterval = new YangRangeInterval<>();
- String[] rangeBoundary = rangePart.trim().split(Pattern.quote(INTERVAL));
-
- if (rangeBoundary.length > MAX_RANGE_BOUNDARY) {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(LENGTH_DATA) + " " + rangeArgument +
- " is not valid.");
- parserException.setLine(lineNumber);
- parserException.setCharPosition(charPositionInLine);
- throw parserException;
- }
-
- if (rangeBoundary.length == MIN_RANGE_BOUNDARY) {
- startInterval = rangeBoundary[0].trim();
- endInterval = rangeBoundary[0].trim();
- } else {
- startInterval = rangeBoundary[0].trim();
- endInterval = rangeBoundary[1].trim();
- }
-
- try {
- if (hasReferredRestriction && startInterval.equals(MIN_KEYWORD)
- && refLengthRestriction.getMinRestrictedvalue() != null) {
- startValue = refLengthRestriction.getMinRestrictedvalue();
- } else if (hasReferredRestriction && startInterval.equals(MAX_KEYWORD)
- && refLengthRestriction.getMaxRestrictedvalue() != null) {
- startValue = refLengthRestriction.getMaxRestrictedvalue();
- } else {
- startValue = getDataObjectFromString(startInterval, YangDataTypes.UINT64);
- }
- if (hasReferredRestriction && endInterval.equals(MIN_KEYWORD)
- && refLengthRestriction.getMinRestrictedvalue() != null) {
- endValue = refLengthRestriction.getMinRestrictedvalue();
- } else if (hasReferredRestriction && endInterval.equals(MAX_KEYWORD)
- && refLengthRestriction.getMaxRestrictedvalue() != null) {
- endValue = refLengthRestriction.getMaxRestrictedvalue();
- } else {
- endValue = getDataObjectFromString(endInterval, YangDataTypes.UINT64);
- }
- } catch (DataTypeException | DataModelException e) {
- ParserException parserException = new ParserException(e.getMessage());
- parserException.setLine(lineNumber);
- parserException.setCharPosition(charPositionInLine);
- throw parserException;
- }
-
- rangeInterval.setStartValue(startValue);
- rangeInterval.setEndValue(endValue);
-
- try {
- lengthRestriction.addRangeRestrictionInterval(rangeInterval);
- } catch (DataModelException e) {
- ParserException parserException = new ParserException(constructExtendedListenerErrorMessage(
- UNHANDLED_PARSED_DATA, LENGTH_DATA, rangeArgument, ENTRY, e.getMessage()));
- parserException.setLine(lineNumber);
- parserException.setCharPosition(charPositionInLine);
- throw parserException;
- }
- }
- return lengthRestriction;
- }
-
- /**
- * Returns whether the data type is of range restricted type.
- *
- * @param dataType data type to be checked
- * @return true, if data type can have range restrictions, false otherwise
- */
- public static boolean isOfRangeRestrictedType(YangDataTypes dataType) {
- return (dataType == INT8
- || dataType == INT16
- || dataType == INT32
- || dataType == INT64
- || dataType == UINT8
- || dataType == UINT16
- || dataType == UINT32
- || dataType == UINT64
- || dataType == DECIMAL64);
- }
-}
diff --git a/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java b/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
index adc7015..72e3fa2 100644
--- a/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
+++ b/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
@@ -1098,7 +1098,7 @@
/**
* Static attribute for YANG types package.
*/
- public static final String YANG_TYPES_PKG = "org.onosproject.yangutils.utils.builtindatatype";
+ public static final String YANG_TYPES_PKG = "org.onosproject.yangutils.datamodel.utils.builtindatatype";
/**
* Static attribute for MathContext class.
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/BuiltInTypeObjectFactory.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/BuiltInTypeObjectFactory.java
deleted file mode 100644
index 7002129..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/BuiltInTypeObjectFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * Copyright 2016 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.yangutils.utils.builtindatatype;
-
-import org.onosproject.yangutils.datamodel.YangDataTypes;
-
-/**
- * Factory to create an object of required type.
- */
-public final class BuiltInTypeObjectFactory {
-
- /**
- * Utility factory class, hence the object creation is forbidden.
- */
- private BuiltInTypeObjectFactory() {
- }
-
- /**
- * Given the value represented in string return the corresponding types
- * object with the value initialized.
- *
- * @param valueInStr value represented in string
- * @param builtInType built in data type
- * @return the target data type object with the value initialized
- * @param <T> the data type of the target object
- */
- public static <T extends YangBuiltInDataTypeInfo<?>> T getDataObjectFromString(String valueInStr,
- YangDataTypes builtInType) {
-
- switch (builtInType) {
- case INT8: {
- return (T) new YangInt8(valueInStr);
- }
- case INT16: {
- return (T) new YangInt16(valueInStr);
- }
- case INT32: {
- return (T) new YangInt32(valueInStr);
- }
- case INT64: {
- return (T) new YangInt64(valueInStr);
- }
- case UINT8: {
- return (T) new YangUint8(valueInStr);
- }
- case UINT16: {
- return (T) new YangUint16(valueInStr);
- }
- case UINT32: {
- return (T) new YangUint32(valueInStr);
- }
- case UINT64: {
- return (T) new YangUint64(valueInStr);
- }
- default: {
- throw new DataTypeException("YANG file error : Unsupported data type");
- }
- }
-
- }
-
-}
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/DataTypeException.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/DataTypeException.java
deleted file mode 100644
index 4cad2cd..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/DataTypeException.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2016 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.utils.builtindatatype;
-
-/**
- * Base class for exceptions in data type.
- */
-public class DataTypeException extends RuntimeException {
-
- private static final long serialVersionUID = 20160211L;
-
- /**
- * Create a new data type exception.
- */
- public DataTypeException() {
- super();
- }
-
- /**
- * Creates a new data type exception with given message.
- *
- * @param message the detail of exception in string
- */
- public DataTypeException(String message) {
- super(message);
- }
-
- /**
- * Creates a new data type exception from given message and cause.
- *
- * @param message the detail of exception in string
- * @param cause underlying cause of the error
- */
- public DataTypeException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Creates a new data type exception from cause.
- *
- * @param cause underlying cause of the error
- */
- public DataTypeException(final Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangBinary.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangBinary.java
deleted file mode 100644
index 51747f3..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangBinary.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.utils.builtindatatype;
-
-import java.util.Objects;
-
-import com.google.common.base.MoreObjects;
-
-/**
- * Represents binary data type.
- */
-public final class YangBinary {
-
- private byte[] byteArray;
-
- /**
- * Creates an instance of YANG binary.
- */
- private YangBinary() {
- }
-
- /**
- * Creates an instance of YANG binary.
- *
- * @param bytes byte array
- */
- public YangBinary(byte[] bytes) {
- this.byteArray = bytes;
- }
-
- /**
- * Returns object of YANG binary.
- *
- * @param bytes byte array
- * @return object of YANG binary
- */
- public static YangBinary of(byte[] bytes) {
- return new YangBinary(bytes);
- }
-
- /**
- * Returns byte array.
- *
- * @return byte array
- */
- public byte[] byteArray() {
- return byteArray;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(byteArray);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof YangBinary) {
- YangBinary other = (YangBinary) obj;
- return Objects.equals(byteArray, other.byteArray);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .omitNullValues()
- .add("byteArray", byteArray)
- .toString();
- }
-
- /**
- * Returns the object of YANG binary fromString input String.
- *
- * @param valInString input String
- * @return Object of YANG binary
- */
- public static YangBinary fromString(String valInString) {
- try {
- byte[] tmpVal = valInString.getBytes();
- return of(tmpVal);
- } catch (Exception e) {
- }
- return null;
- }
-
-}
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangBits.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangBits.java
deleted file mode 100644
index 60b0c32..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangBits.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.utils.builtindatatype;
-
-import java.util.Objects;
-
-import com.google.common.base.MoreObjects;
-
-/**
- * Represents bits data type.
- */
-public class YangBits {
-
- private byte[] byteArray;
-
- /**
- * Creates an instance of YANG bits.
- */
- private YangBits() {
- }
-
- /**
- * Creates an instance of YANG bits.
- *
- * @param bytes byte array
- */
- public YangBits(byte[] bytes) {
- this.byteArray = bytes;
- }
-
- /**
- * Returns object of YANG bits.
- *
- * @param bytes byte array
- * @return object of YANG bits
- */
- public static YangBits of(byte[] bytes) {
- return new YangBits(bytes);
- }
-
- /**
- * Returns byte array.
- *
- * @return byte array
- */
- public byte[] byteArray() {
- return byteArray;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(byteArray);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof YangBits) {
- YangBits other = (YangBits) obj;
- return Objects.equals(byteArray, other.byteArray);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .omitNullValues()
- .add("byteArray", byteArray)
- .toString();
- }
-
- /**
- * Returns the object of YANG bits fromString input String.
- *
- * @param valInString input String
- * @return Object of YANG bits
- */
- public static YangBits fromString(String valInString) {
- try {
- byte[] tmpVal = valInString.getBytes();
- return of(tmpVal);
- } catch (Exception e) {
- }
- return null;
- }
-
-}
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangBuiltInDataTypeInfo.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangBuiltInDataTypeInfo.java
deleted file mode 100644
index 437fe0f..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangBuiltInDataTypeInfo.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2016 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.yangutils.utils.builtindatatype;
-
-import org.onosproject.yangutils.datamodel.YangDataTypes;
-
-/**
- * Represents the list of utility functions to be supported by YANG built in
- * data type implementations.
- *
- * @param <T> The target data type
- */
-public interface YangBuiltInDataTypeInfo<T> extends Comparable<T> {
-
- /**
- * Returns the YANG built in type.
- *
- * @return the YANG built in type
- */
- YangDataTypes getYangType();
-}
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangDecimal64.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangDecimal64.java
deleted file mode 100644
index 8b3a0eb..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangDecimal64.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.utils.builtindatatype;
-
-import java.util.Objects;
-
-import com.google.common.base.MoreObjects;
-
-/**
- * Represents YANG decimal 64.
- */
-public class YangDecimal64 {
-
- private int fractionDigit;
-
- /**
- * Creates an instance of YANG decimal64.
- */
- public YangDecimal64() {
- }
-
- /**
- * Creates an instance of of YANG decimal64.
- *
- * @param fractionDigit fraction digit
- */
- public YangDecimal64(int fractionDigit) {
- this.setFractionDigit(fractionDigit);
- }
-
- /**
- * Returns fraction digit.
- *
- * @return the fractionDigit
- */
- public int getFractionDigit() {
- return fractionDigit;
- }
-
- /**
- * Sets fraction digit.
- *
- * @param fractionDigit fraction digits.
- */
- public void setFractionDigit(int fractionDigit) {
- this.fractionDigit = fractionDigit;
- }
-
- /**
- * Returns object of YANG decimal64.
- *
- * @param value fraction digit
- * @return YANG decimal64
- */
- public static YangDecimal64 of(int value) {
- return new YangDecimal64(value);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(fractionDigit);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof YangDecimal64) {
- YangDecimal64 other = (YangDecimal64) obj;
- return Objects.equals(fractionDigit, other.fractionDigit);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .omitNullValues()
- .add("fractionDigit", fractionDigit)
- .toString();
- }
-
- /**
- * Returns the object of YANG decimal64 fromString input String.
- *
- * @param valInString input String
- * @return Object of YANG decimal64
- */
- public static YangDecimal64 fromString(String valInString) {
- try {
- int tmpVal = Integer.parseInt(valInString);
- return of(tmpVal);
- } catch (Exception e) {
- }
- return null;
- }
-}
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangInt16.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangInt16.java
deleted file mode 100644
index f9055e8..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangInt16.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.utils.builtindatatype;
-
-import org.onosproject.yangutils.datamodel.YangDataTypes;
-
-
-/**
- * Handles the YANG's int16 data type processing.
- *
- * int16 represents integer values between -32768 and 32767, inclusively.
- */
-public class YangInt16 implements YangBuiltInDataTypeInfo<YangInt16> {
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's int16.
- */
- public static final short MIN_VALUE = -32768;
-
- /**
- * Valid maximum value of YANG's int16.
- */
- public static final short MAX_VALUE = 32767;
-
- /**
- * The value of YANG's int16.
- */
- private final short value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- public YangInt16(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = Short.parseShort(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "int16.");
- }
- }
- }
-
- /**
- * Returns YANG's int16 value.
- *
- * @return value of YANG's int16
- */
- public short getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangInt16 anotherYangInt16) {
- return Short.compare(value, anotherYangInt16.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.INT16;
- }
-
-}
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangInt32.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangInt32.java
deleted file mode 100644
index 2f48f33..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangInt32.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.utils.builtindatatype;
-
-import org.onosproject.yangutils.datamodel.YangDataTypes;
-
-/**
- * Handles the YANG's int32 data type processing.
- *
- * int32 represents integer values between -2147483648 and 2147483647, inclusively.
- */
-public class YangInt32 implements YangBuiltInDataTypeInfo<YangInt32> {
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's int32.
- */
- public static final int MIN_VALUE = -2147483648;
-
- /**
- * Valid maximum value of YANG's int32.
- */
- public static final int MAX_VALUE = 2147483647;
-
- /**
- * The value of YANG's int32.
- */
- private final int value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- public YangInt32(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = Integer.parseInt(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "int32.");
- }
- }
- }
-
-
- /**
- * Returns YANG's int32 value.
- *
- * @return value of YANG's int32
- */
- public int getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangInt32 anotherYangInt32) {
- return Integer.compare(value, anotherYangInt32.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.INT32;
- }
-
-}
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangInt64.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangInt64.java
deleted file mode 100644
index 6b0b685..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangInt64.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.utils.builtindatatype;
-
-import org.onosproject.yangutils.datamodel.YangDataTypes;
-
-/**
- * Handles the YANG's int8 data type processing.
- *
- * int8 represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.
- */
-public class YangInt64 implements YangBuiltInDataTypeInfo<YangInt64> {
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's int64.
- */
- public static final Long MIN_VALUE = 0x8000000000000000L;
-
- /**
- * Valid maximum value of YANG's int64.
- */
- public static final long MAX_VALUE = 0x7fffffffffffffffL;
-
- /**
- * The value of YANG's int64.
- */
- private final long value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- public YangInt64(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = Long.parseLong(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "int64.");
- }
- }
- }
-
-
- /**
- * Returns YANG's int64 value.
- *
- * @return value of YANG's int64
- */
- public long getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangInt64 anotherYangInt64) {
- return Long.compare(value, anotherYangInt64.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.INT64;
- }
-
-}
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangInt8.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangInt8.java
deleted file mode 100644
index b2823e5..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangInt8.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.utils.builtindatatype;
-
-import org.onosproject.yangutils.datamodel.YangDataTypes;
-
-/**
- * Handles the YANG's int8 data type processing.
- *
- * int8 represents integer values between -128 and 127, inclusively.
- */
-public class YangInt8 implements YangBuiltInDataTypeInfo<YangInt8> {
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's int8.
- */
- public static final byte MIN_VALUE = -128;
-
- /**
- * Valid maximum value of YANG's int8.
- */
- public static final byte MAX_VALUE = 127;
-
- /**
- * The value of YANG's int8.
- */
- private final byte value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- public YangInt8(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = Byte.parseByte(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "int8.");
- }
- }
- }
-
- /**
- * Returns YANG's int8 value.
- *
- * @return value of YANG's int8
- */
- public byte getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangInt8 anotherYangInt8) {
- return Byte.compare(value, anotherYangInt8.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.INT8;
- }
-
-}
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangUint16.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangUint16.java
deleted file mode 100644
index 53c3a50..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangUint16.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.utils.builtindatatype;
-
-import org.onosproject.yangutils.datamodel.YangDataTypes;
-
-/**
- * Handles the YANG's Uint16 data type processing.
- *
- * Uint16 represents integer values between 0 and 65535, inclusively.
- */
-public class YangUint16 implements YangBuiltInDataTypeInfo<YangUint16> {
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's Uint16.
- */
- public static final int MIN_VALUE = 0;
-
- /**
- * Valid maximum value of YANG's Uint16.
- */
- public static final int MAX_VALUE = 65535;
-
- /**
- * Value of the object.
- */
- private int value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- YangUint16(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = Integer.parseInt(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "uint16.");
- }
- }
-
- if (value < MIN_VALUE) {
- throw new DataTypeException("YANG file error : " + valueInString + " is lesser than minimum value "
- + MIN_VALUE + ".");
- } else if (value > MAX_VALUE) {
- throw new DataTypeException("YANG file error : " + valueInString + " is greater than maximum value "
- + MAX_VALUE + ".");
- }
- }
-
- /**
- * Returns YANG's uint16 value.
- *
- * @return value of YANG's uint16
- */
- public int getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangUint16 another) {
- return Integer.compare(value, another.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.UINT16;
- }
-
-}
-
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangUint32.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangUint32.java
deleted file mode 100644
index 79d1c6d..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangUint32.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.utils.builtindatatype;
-
-import org.onosproject.yangutils.datamodel.YangDataTypes;
-
-/**
- * Handles the YANG's Uint32 data type processing.
- *
- * Uint32 represents integer values between 0 and 4294967295, inclusively.
- */
-public class YangUint32 implements YangBuiltInDataTypeInfo<YangUint32> {
-
- private static final String MIN_KEYWORD = "min";
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's Uint32.
- */
- public static final long MIN_VALUE = 0;
-
- /**
- * Valid maximum value of YANG's Uint32.
- */
- public static final long MAX_VALUE = 4294967295L;
-
- /**
- * Value of the object.
- */
- private long value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- YangUint32(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = Long.parseLong(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "uint32.");
- }
- }
-
- if (value < MIN_VALUE) {
- throw new DataTypeException("YANG file error : " + valueInString + " is lesser than minimum value "
- + MIN_VALUE + ".");
- } else if (value > MAX_VALUE) {
- throw new DataTypeException("YANG file error : " + valueInString + " is greater than maximum value "
- + MAX_VALUE + ".");
- }
- }
-
- /**
- * Returns YANG's uint32 value.
- *
- * @return value of YANG's uint32
- */
- public long getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangUint32 another) {
- return Long.compare(value, another.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.UINT32;
- }
-
-}
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangUint64.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangUint64.java
deleted file mode 100644
index cc16a7a..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangUint64.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.utils.builtindatatype;
-
-import java.math.BigInteger;
-import java.util.regex.Pattern;
-import org.onosproject.yangutils.datamodel.YangDataTypes;
-
-/**
- * Handles the YANG's Uint16 data type processing.
- *
- * Uint64 represents integer values between 0 and 18446744073709551615, inclusively.
- */
-public class YangUint64 implements YangBuiltInDataTypeInfo<YangUint64> {
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * YANG's Integer value pattern.
- */
- private static final Pattern NON_NEGATIVE_INTEGER_PATTERN = Pattern.compile("[0-9]+");
-
- /**
- * Valid minimum value of YANG's Uint64.
- */
- public static final BigInteger MIN_VALUE = BigInteger.valueOf(0);
-
- /**
- * Valid maximum value of YANG's Uint64.
- */
- public static final BigInteger MAX_VALUE = new BigInteger("18446744073709551615");
-
- /**
- * Value of the object.
- */
- private BigInteger value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- YangUint64(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else if (NON_NEGATIVE_INTEGER_PATTERN.matcher(valueInString).matches()) {
- value = new BigInteger(valueInString);
- } else {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "uint64.");
- }
-
- if (value.compareTo(MIN_VALUE) < 0) {
- throw new DataTypeException("YANG file error : " + valueInString + " is lesser than minimum value "
- + MIN_VALUE + ".");
- } else if (value.compareTo(MAX_VALUE) > 0) {
- throw new DataTypeException("YANG file error : " + valueInString + " is greater than maximum value "
- + MAX_VALUE + ".");
- }
- }
-
- /**
- * Returns YANG's uint64 value.
- *
- * @return value of YANG's uint64
- */
- public BigInteger getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangUint64 another) {
- return value.compareTo(another.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.UINT64;
- }
-
-}
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangUint8.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangUint8.java
deleted file mode 100644
index b9abf4c..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/YangUint8.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.utils.builtindatatype;
-
-import org.onosproject.yangutils.datamodel.YangDataTypes;
-
-/**
- * Handles the YANG's Uint8 data type processing.
- *
- * Uint8 represents integer values between 0 and 255, inclusively.
- */
-public class YangUint8 implements YangBuiltInDataTypeInfo<YangUint8> {
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's Uint8.
- */
- public static final short MIN_VALUE = 0;
-
- /**
- * Valid maximum value of YANG's Uint8.
- */
- public static final short MAX_VALUE = 255;
-
- /**
- * Value of the object.
- */
- private short value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- YangUint8(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = Short.parseShort(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "uint8.");
- }
- }
-
- if (value < MIN_VALUE) {
- throw new DataTypeException("YANG file error : " + valueInString + " is lesser than minimum value "
- + MIN_VALUE + ".");
- } else if (value > MAX_VALUE) {
- throw new DataTypeException("YANG file error : " + valueInString + " is greater than maximum value "
- + MAX_VALUE + ".");
- }
- }
-
- /**
- * Returns YANG's uint8 value.
- *
- * @return value of YANG's uint8
- */
- public short getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangUint8 another) {
- return Short.compare(value, another.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.UINT8;
- }
-
-}
diff --git a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/package-info.java b/src/main/java/org/onosproject/yangutils/utils/builtindatatype/package-info.java
deleted file mode 100644
index 9d3aa33..0000000
--- a/src/main/java/org/onosproject/yangutils/utils/builtindatatype/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*-
- * Copyright 2016 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Utilities for YANG built in data types.
- */
-package org.onosproject.yangutils.utils.builtindatatype;