use of buildcraft.lib.expression.node.condition.NodeConditionalDouble in project BuildCraft by BuildCraft.
the class InternalCompiler method pushConditional.
private static void pushConditional(NodeStack stack) throws InvalidExpressionException {
IExpressionNode right = stack.pop();
IExpressionNode left = stack.pop();
IExpressionNode conditional = stack.pop();
right = convertBinary(right, left);
left = convertBinary(left, right);
if (conditional instanceof INodeBoolean) {
INodeBoolean condition = (INodeBoolean) conditional;
if (right instanceof INodeBoolean) {
stack.push(new NodeConditionalBoolean(condition, (INodeBoolean) left, (INodeBoolean) right));
} else if (right instanceof INodeDouble) {
stack.push(new NodeConditionalDouble(condition, (INodeDouble) left, (INodeDouble) right));
} else if (right instanceof INodeObject) {
stack.push(new NodeConditionalObject(condition, (INodeObject) left, (INodeObject) right));
} else if (right instanceof INodeLong) {
stack.push(new NodeConditionalLong(condition, (INodeLong) left, (INodeLong) right));
} else {
throw new InvalidExpressionException("Unknown node " + left);
}
} else {
throw new InvalidExpressionException("Required a boolean node, but got '" + conditional + "' of " + conditional.getClass());
}
}
Aggregations