private static final CanonicalValueSupport<Uint16> SUPPORT = new Support();
private static final long serialVersionUID = 1L;
- private static final int MIN_VALUE = 0;
- private static final int MAX_VALUE = 65535;
+ private static final int MIN_VALUE_INT = 0;
+ private static final int MAX_VALUE_INT = 65535;
/**
* Cache of first 256 values.
*/
- private static final Uint16[] CACHE = new Uint16[Uint8.MAX_VALUE];
+ private static final Uint16[] CACHE = new Uint16[Uint8.MAX_VALUE_SHORT];
/**
* Commonly encountered values.
new Uint16((short)65535),
};
+ public static final Uint16 MIN_VALUE = valueOf(MIN_VALUE_INT);
+ public static final Uint16 MAX_VALUE = valueOf(MAX_VALUE_INT);
+
/**
* Tunable weak LRU cache for other values. By default it holds {@value #DEFAULT_LRU_SIZE} entries. This can be
* changed via {@value #LRU_SIZE_PROPERTY} system property.
*/
private static final int DEFAULT_LRU_SIZE = 1024;
private static final String LRU_SIZE_PROPERTY = "org.opendaylight.yangtools.yang.common.Uint16.LRU.size";
- private static final int MAX_LRU_SIZE = MAX_VALUE + 1;
+ private static final int MAX_LRU_SIZE = MAX_VALUE_INT + 1;
private static final int LRU_SIZE;
static {
}
public static Uint16 valueOf(final byte byteVal) {
- checkArgument(byteVal >= MIN_VALUE, "Negative values are not allowed");
+ checkArgument(byteVal >= MIN_VALUE_INT, "Negative values are not allowed");
return instanceFor(byteVal);
}
public static Uint16 valueOf(final short shortVal) {
- checkArgument(shortVal >= MIN_VALUE, "Negative values are not allowed");
+ checkArgument(shortVal >= MIN_VALUE_INT, "Negative values are not allowed");
return instanceFor(shortVal);
}
public static Uint16 valueOf(final int intVal) {
- checkArgument(intVal >= MIN_VALUE && intVal <= MAX_VALUE, "Value %s is outside of allowed range", intVal);
+ checkArgument(intVal >= MIN_VALUE_INT && intVal <= MAX_VALUE_INT, "Value %s is outside of allowed range",
+ intVal);
return instanceFor((short)(intVal & 0xffff));
}
public static Uint16 valueOf(final long longVal) {
- checkArgument(longVal >= MIN_VALUE && longVal <= MAX_VALUE, "Value %s is outside of allowed range", longVal);
+ checkArgument(longVal >= MIN_VALUE_INT && longVal <= MAX_VALUE_INT, "Value %s is outside of allowed range",
+ longVal);
return instanceFor((short)(longVal & 0xffff));
}
private static final CanonicalValueSupport<Uint32> SUPPORT = new Support();
private static final long serialVersionUID = 1L;
- private static final long MIN_VALUE = 0;
- private static final long MAX_VALUE = 0xffffffffL;
+ private static final long MIN_VALUE_LONG = 0;
+ private static final long MAX_VALUE_LONG = 0xffffffffL;
/**
* Cache of first 256 values.
*/
- private static final Uint32[] CACHE = new Uint32[Uint8.MAX_VALUE];
+ private static final Uint32[] CACHE = new Uint32[Uint8.MAX_VALUE_SHORT];
/**
* Commonly encountered values.
*/
new Uint32(65535),
new Uint32(65536),
new Uint32(Integer.MAX_VALUE),
+ new Uint32(-1)
};
+ public static final Uint32 MIN_VALUE = valueOf(MIN_VALUE_LONG);
+ public static final Uint32 MAX_VALUE = valueOf(MAX_VALUE_LONG);
+
/**
* Tunable weak LRU cache for other values. By default it holds {@value #DEFAULT_LRU_SIZE} entries. This can be
* changed via {@value #LRU_SIZE_PROPERTY} system property.
}
public static Uint32 valueOf(final byte byteVal) {
- checkArgument(byteVal >= MIN_VALUE, "Negative values are not allowed");
+ checkArgument(byteVal >= MIN_VALUE_LONG, "Negative values are not allowed");
return instanceFor(byteVal);
}
public static Uint32 valueOf(final short shortVal) {
- checkArgument(shortVal >= MIN_VALUE, "Negative values are not allowed");
+ checkArgument(shortVal >= MIN_VALUE_LONG, "Negative values are not allowed");
return instanceFor(shortVal);
}
public static Uint32 valueOf(final int intVal) {
- checkArgument(intVal >= MIN_VALUE, "Value %s is outside of allowed range", intVal);
+ checkArgument(intVal >= MIN_VALUE_LONG, "Value %s is outside of allowed range", intVal);
return instanceFor(intVal);
}
public static Uint32 valueOf(final long longVal) {
- checkArgument(longVal >= MIN_VALUE && longVal <= MAX_VALUE, "Value %s is outside of allowed range", longVal);
+ checkArgument(longVal >= MIN_VALUE_LONG && longVal <= MAX_VALUE_LONG, "Value %s is outside of allowed range",
+ longVal);
return instanceFor((int)longVal);
}
private static final CanonicalValueSupport<Uint64> SUPPORT = new Support();
private static final long serialVersionUID = 1L;
- private static final long MIN_VALUE = 0;
+ private static final long MIN_VALUE_LONG = 0;
/**
* Cache of first 256 values.
*/
- private static final Uint64[] CACHE = new Uint64[Uint8.MAX_VALUE];
+ private static final Uint64[] CACHE = new Uint64[Uint8.MAX_VALUE_SHORT];
/**
* Commonly encountered values.
*/
new Uint64(Integer.MAX_VALUE),
new Uint64(Integer.MAX_VALUE + 1L),
new Uint64(Long.MAX_VALUE),
+ new Uint64(-1L)
};
+ public static final Uint64 MIN_VALUE = valueOf(MIN_VALUE_LONG);
+ public static final Uint64 MAX_VALUE = fromLongBits(-1);
+
/**
* Tunable weak LRU cache for other values. By default it holds {@value #DEFAULT_LRU_SIZE} entries. This can be
* changed via {@value #LRU_SIZE_PROPERTY} system property.
}
public static Uint64 valueOf(final byte byteVal) {
- checkArgument(byteVal >= MIN_VALUE, "Negative values are not allowed");
+ checkArgument(byteVal >= MIN_VALUE_LONG, "Negative values are not allowed");
return instanceFor(byteVal);
}
public static Uint64 valueOf(final short shortVal) {
- checkArgument(shortVal >= MIN_VALUE, "Negative values are not allowed");
+ checkArgument(shortVal >= MIN_VALUE_LONG, "Negative values are not allowed");
return instanceFor(shortVal);
}
public static Uint64 valueOf(final int intVal) {
- checkArgument(intVal >= MIN_VALUE, "Value %s is outside of allowed range", intVal);
+ checkArgument(intVal >= MIN_VALUE_LONG, "Value %s is outside of allowed range", intVal);
return instanceFor(intVal);
}
public static Uint64 valueOf(final long longVal) {
- checkArgument(longVal >= MIN_VALUE, "Value %s is outside of allowed range", longVal);
+ checkArgument(longVal >= MIN_VALUE_LONG, "Value %s is outside of allowed range", longVal);
return instanceFor(longVal);
}
private static final CanonicalValueSupport<Uint8> SUPPORT = new Support();
- static final short MIN_VALUE = 0;
- static final short MAX_VALUE = 255;
+ static final short MIN_VALUE_SHORT = 0;
+ static final short MAX_VALUE_SHORT = 255;
private static final long serialVersionUID = 1L;
- private static final Uint8[] CACHE = new Uint8[MAX_VALUE + 1];
+ private static final Uint8[] CACHE = new Uint8[MAX_VALUE_SHORT + 1];
+
+ public static final Uint8 MIN_VALUE = valueOf(MIN_VALUE_SHORT);
+ public static final Uint8 MAX_VALUE = valueOf(MAX_VALUE_SHORT);
private final byte value;
}
public static Uint8 valueOf(final byte byteVal) {
- checkArgument(byteVal >= MIN_VALUE, "Negative values are not allowed");
+ checkArgument(byteVal >= MIN_VALUE_SHORT, "Negative values are not allowed");
return instanceFor(byteVal);
}
public static Uint8 valueOf(final short shortVal) {
- checkArgument(shortVal >= MIN_VALUE && shortVal <= MAX_VALUE, "Value %s is outside of allowed range", shortVal);
+ checkArgument(shortVal >= MIN_VALUE_SHORT && shortVal <= MAX_VALUE_SHORT,
+ "Value %s is outside of allowed range", shortVal);
return instanceFor((byte)(shortVal & 0xff));
}
public static Uint8 valueOf(final int intVal) {
- checkArgument(intVal >= MIN_VALUE && intVal <= MAX_VALUE, "Value %s is outside of allowed range", intVal);
+ checkArgument(intVal >= MIN_VALUE_SHORT && intVal <= MAX_VALUE_SHORT,
+ "Value %s is outside of allowed range", intVal);
return instanceFor((byte)(intVal & 0xff));
}
public static Uint8 valueOf(final long longVal) {
- checkArgument(longVal >= MIN_VALUE && longVal <= MAX_VALUE, "Value %s is outside of allowed range", longVal);
+ checkArgument(longVal >= MIN_VALUE_SHORT && longVal <= MAX_VALUE_SHORT,
+ "Value %s is outside of allowed range", longVal);
return instanceFor((byte)(longVal & 0xff));
}