Menu

#25 add useful constant ValueConstraints to the native wrappers

open
nobody
None
5
2012-09-15
2006-01-19
No

Two examples. To tsm.value.ByteConstraint, add:

public static final ByteConstraint POSITIVE
= new ByteConstraint(1, Byte.MAX_VALUE);
public static final ByteConstraint NON_NEGATIVE
= new ByteConstraint(0, Byte.MAX_VALUE);
public static final ByteConstraint NEGATIVE
= new ByteConstraint(Byte.MIN_VALUE, -1);
public static final ByteConstraint NON_POSITIVE
= new ByteConstraint(Byte.MIN_VALUE, 0);

To tsm.value.FloatConstraint, add:

public static final FloatConstraint POSITIVE
= new FloatConstraint
(0, Float.MAX_VALUE, false, true);
public static final FloatConstraint NON_NEGATIVE
= new FloatConstraint
(0, Float.MAX_VALUE, true, true);
public static final FloatConstraint NEGATIVE
= new FloatConstraint
(-Float.MAX_VALUE, 0, true, false);
public static final FloatConstraint NON_POSITIVE
= new FloatConstraint
(-Float.MAX_VALUE, 0, true, true);

(you may need to cast the -1, 0, and 1 values to get
it to compile).

The rest of the classes (Short-, Integer-, Long-, and
DoubleConstraint) should have the same things.

Discussion


Log in to post a comment.