BUG-8043: correct LengthConstraint definition
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / type / LengthConstraint.java
index b7d64aa8e2b903ffe328f3d1e52a61e3a86465bd..e3f59ab43797ad5775e245f2aa0cc813d9691f2a 100644 (file)
@@ -7,44 +7,18 @@
  */
 package org.opendaylight.yangtools.yang.model.api.type;
 
+import com.google.common.collect.RangeSet;
 import org.opendaylight.yangtools.yang.model.api.ConstraintMetaDefinition;
 
 /**
- * The Lenght Constraint value consists of an explicit value, or a lower bound
- * returned by {@link #getMin()} and an upper bound returned by
- * {@link #getMax()}. <br>
- * <br>
- * Length-restricting values MUST NOT be negative. A length value is a
- * non-negative integer, or one of the special values <code>min</code> or
- * <code>max</code>. The defined <code>min</code> and <code>max</code> mean the
- * minimum and maximum length accepted for the type being restricted,
- * respectively. <br>
- * An implementation is not required to support a length value larger than
- * {@link Long#MAX_VALUE} <br>
- * <br>
- * The interface extends definitions from {@link ConstraintMetaDefinition} <br>
- * <br>
- * This interface was modeled according to definition in <a
- * href="https://tools.ietf.org/html/rfc6020#section-9.4.4">[RFC-6020] The
- * length Statement</a>.
- *
- * @see ConstraintMetaDefinition
+ * A single value length restriction, as expressed by a length statement, as specified by
+ * <a href="https://tools.ietf.org/html/rfc6020#section-9.4.4">[RFC-6020] The length Statement</a>.
  */
 public interface LengthConstraint extends ConstraintMetaDefinition {
-
-    /**
-     * Returns the length-restricting lower bound value. <br>
-     * The value MUST NOT be negative.
-     *
-     * @return the length-restricting lower bound value.
-     */
-    Number getMin();
-
     /**
-     * Returns the length-restricting upper bound value. <br>
-     * The value MUST NOT be negative.
+     * Return allowed length ranges. Returned RangeSet must not be empty.
      *
-     * @return length-restricting upper bound value.
+     * @return Set of allowed lengths.
      */
-    Number getMax();
+    RangeSet<Integer> getAllowedRanges();
 }