本文整理汇总了Java中gnu.math.DFloNum类的典型用法代码示例。如果您正苦于以下问题:Java DFloNum类的具体用法?Java DFloNum怎么用?Java DFloNum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DFloNum类属于gnu.math包,在下文中一共展示了DFloNum类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testUnaryDoubleFunction
import gnu.math.DFloNum; //导入依赖的package包/类
private void testUnaryDoubleFunction(String funName, double[] args, double[] vals)
throws Throwable {
for (int i = 0; i < args.length; i++) {
String expression = "(" + funName + " " + args[i] + ")";
Object result = scheme.eval(expression);
if (result instanceof DFloNum) {
Assert.assertEquals(expression,
vals[i],
((DFloNum) result).doubleValue(),
DELTA);
} else {
Assert.assertEquals(expression,
vals[i],
(Double) result,
DELTA);
}
}
}
示例2: procAttrsForInsert
import gnu.math.DFloNum; //导入依赖的package包/类
protected void procAttrsForInsert(ActorObject target, int roundnum, List<String> attrNames,
List<Object> vals) {
RoundHistory r = target.getHistory().getRoundHistory(roundnum);
for (Pair pair : target.getAttributeAndFieldNamePairs()) {
Symbol key = (Symbol) pair.getCdr();
attrNames.add(key.toString());
Serializable val = r.get(key);
if (IntNum.class.isAssignableFrom(val.getClass())) {
vals.add(((IntNum) val).intValue());
} else if (DFloNum.class.isAssignableFrom(val.getClass())) {
vals.add(((DFloNum) val).doubleValue());
} else if (Number.class.isAssignableFrom(val.getClass())) {
vals.add(val);
} else {
vals.add(val.toString());
}
}
}
示例3: testBinaryDoubleFunction
import gnu.math.DFloNum; //导入依赖的package包/类
private void testBinaryDoubleFunction(String funName,
double[] args1,
double[] args2,
double[] vals)
throws Throwable {
for (int i = 0; i < args1.length; i++) {
String expression = "(" + funName + " " + args1[i] + " " + args2[i] + ")";
Assert.assertEquals(vals[i],
((DFloNum) scheme.eval(expression)).doubleValue(),
DELTA);
}
}
示例4: syncFieldsToPropertiesByReflection
import gnu.math.DFloNum; //导入依赖的package包/类
protected void syncFieldsToPropertiesByReflection(Class<?> clazz, Properties props) {
for (Field f : clazz.getDeclaredFields()) {
HistoricalField a = f.getAnnotation(HistoricalField.class);
if (a == null) {
continue;
}
Object val = props.get(Symbol.parse(f.getName()));
if (val == null || val.equals("#!null")) {
val = null;
} else if (f.getType().isAssignableFrom(val.getClass())) {
// OK
} else if (val instanceof IntNum) {
val = ((IntNum) val).intValue();
} else if (val instanceof DFloNum) {
val = ((DFloNum) val).doubleValue();
}
try {
f.setAccessible(true);
f.set(this, val);
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}
if (GameObject.class.isAssignableFrom(clazz.getSuperclass())) {
syncFieldsToPropertiesByReflection(clazz.getSuperclass(), props);
}
}