use of org.whole.lang.reflect.DataKinds in project whole by wholeplatform.
the class MathInterpreterVisitor method visit.
@Override
public void visit(Or entity) {
boolean value = false;
for (int i = 0, size = entity.size(); i < size; i++) {
IEntity result = evaluate(entity.get(i));
DataKinds dataKinds = DataTypeUtils.getUnboxedDataKind(result);
if (dataKinds.isNotAData())
throw new WholeIllegalArgumentException(WholeMessages.no_data).withSourceEntity(entity).withBindings(getBindings());
else if (!dataKinds.isBoolean())
throw new WholeIllegalArgumentException(WholeMessages.illegal_data_conversion).withSourceEntity(entity).withBindings(getBindings());
else if (value |= result.wBooleanValue())
break;
}
setResult(createBooleanLiteral(value));
}
use of org.whole.lang.reflect.DataKinds in project whole by wholeplatform.
the class MathInterpreterVisitor method visit.
@Override
public void visit(And entity) {
boolean value = true;
for (int i = 0, size = entity.size(); i < size; i++) {
IEntity result = evaluate(entity.get(i));
DataKinds dataKinds = DataTypeUtils.getUnboxedDataKind(result);
if (dataKinds.isNotAData())
throw new WholeIllegalArgumentException(WholeMessages.no_data).withSourceEntity(entity).withBindings(getBindings());
else if (!dataKinds.isBoolean())
throw new WholeIllegalArgumentException(WholeMessages.illegal_data_conversion).withSourceEntity(entity).withBindings(getBindings());
else if (!(value &= result.wBooleanValue()))
break;
}
setResult(createBooleanLiteral(value));
}
Aggregations