|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jopt.csp.util.FloatUtil
Float type utility functions
Field Summary | |
static float |
DEFAULT_PRECISION
|
Constructor Summary | |
FloatUtil()
|
Method Summary | |
static int |
compare(float val1,
float val2,
float precision)
Compares two values using a given precision to determine if they are equal |
static float |
getMax(CspNumExpr expr)
Returns maximum value of a numeric expression as a float type |
static float |
getMax(VariableSolution sol)
Returns maximum value of a numeric expression as a double type |
static float |
getMin(CspNumExpr expr)
Returns minimum value of a numeric expression as a float type |
static float |
getMin(VariableSolution sol)
Returns minimum value of a numeric expression as a double type |
static int |
intCeil(float n)
Returns integer value for a number rounding using ceiling method if necessary |
static int |
intFloor(float n)
Returns integer value for a number rounding using floor method if necessary |
static boolean |
isEqual(float val1,
float val2,
float precision)
Returns true if two values are within precision of one another |
static boolean |
isIntEquivalent(float val)
Returns true if value is equivalent to an integer value |
static boolean |
isLongEquivalent(float val)
Returns true if value is equivalent to a long value |
static long |
longCeil(float n)
Returns long value for a number rounding using ceiling method if necessary |
static long |
longFloor(float n)
Returns long value for a number rounding using floor method if necessary |
static float |
next(float v)
Returns the next float value in sequence for a given float |
static float |
previous(float v)
Returns the previous float value in sequence for a given float |
static float |
returnMinMaxIfClose(float minCurrent,
float maxCurrent,
float newVal,
float precision)
Returns a min or max value if it close enough to a value for comparison based on a precision value |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final float DEFAULT_PRECISION
Constructor Detail |
public FloatUtil()
Method Detail |
public static float next(float v)
public static float previous(float v)
public static float returnMinMaxIfClose(float minCurrent, float maxCurrent, float newVal, float precision)
minCurrent
- Minimum possible current value that will be returned if new value is close enough given scalemaxCurrent
- Maximum possible current value that will be returned if new value is close enough given scalenewVal
- Value that is to be checked to ensure it is close enough to another valueprecision
- Precision values must fall within to be equalpublic static int compare(float val1, float val2, float precision)
val1
- First value to compareval2
- Second value to compareprecision
- Precision values must fall within to be equalpublic static boolean isEqual(float val1, float val2, float precision)
val1
- First value to compareval2
- Second value to compareprecision
- Precision values must fall within to return true.public static int intCeil(float n)
public static int intFloor(float n)
public static boolean isIntEquivalent(float val)
public static long longCeil(float n)
public static long longFloor(float n)
public static boolean isLongEquivalent(float val)
public static float getMin(CspNumExpr expr)
public static float getMax(CspNumExpr expr)
public static float getMin(VariableSolution sol)
public static float getMax(VariableSolution sol)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |