Search in sources :

Example 1 with NodeConstantBoolean

use of buildcraft.lib.expression.node.value.NodeConstantBoolean in project BuildCraft by BuildCraft.

the class NodeConditionalBoolean method inline.

@Override
public INodeBoolean inline() {
    INodeBoolean c = condition.inline();
    INodeBoolean t = ifTrue.inline();
    INodeBoolean f = ifFalse.inline();
    if (c instanceof NodeConstantBoolean) {
        return ((NodeConstantBoolean) c).value ? t : f;
    } else if (c != condition || t != ifTrue || f != ifFalse) {
        return new NodeConditionalBoolean(c, t, f);
    } else {
        return this;
    }
}
Also used : INodeBoolean(buildcraft.lib.expression.api.IExpressionNode.INodeBoolean) NodeConstantBoolean(buildcraft.lib.expression.node.value.NodeConstantBoolean)

Example 2 with NodeConstantBoolean

use of buildcraft.lib.expression.node.value.NodeConstantBoolean in project BuildCraft by BuildCraft.

the class NodeConditionalLong method inline.

@Override
public INodeLong inline() {
    INodeBoolean c = condition.inline();
    INodeLong t = ifTrue.inline();
    INodeLong f = ifFalse.inline();
    if (c instanceof NodeConstantBoolean && t instanceof NodeConstantLong && f instanceof NodeConstantLong) {
        return new NodeConstantLong(((NodeConstantBoolean) c).value ? ((NodeConstantLong) t).value : ((NodeConstantLong) f).value);
    } else if (c != condition || t != ifTrue || f != ifFalse) {
        return new NodeConditionalLong(c, t, f);
    } else {
        return this;
    }
}
Also used : INodeLong(buildcraft.lib.expression.api.IExpressionNode.INodeLong) NodeConstantBoolean(buildcraft.lib.expression.node.value.NodeConstantBoolean) NodeConstantLong(buildcraft.lib.expression.node.value.NodeConstantLong)

Example 3 with NodeConstantBoolean

use of buildcraft.lib.expression.node.value.NodeConstantBoolean in project BuildCraft by BuildCraft.

the class NodeConditionalDouble method inline.

@Override
public INodeDouble inline() {
    INodeBoolean c = condition.inline();
    INodeDouble t = ifTrue.inline();
    INodeDouble f = ifFalse.inline();
    if (c instanceof NodeConstantBoolean && t instanceof NodeConstantDouble && f instanceof NodeConstantDouble) {
        return new NodeConstantDouble(((NodeConstantBoolean) c).value ? ((NodeConstantDouble) t).value : ((NodeConstantDouble) f).value);
    } else if (c != condition || t != ifTrue || f != ifFalse) {
        return new NodeConditionalDouble(c, t, f);
    } else {
        return this;
    }
}
Also used : INodeDouble(buildcraft.lib.expression.api.IExpressionNode.INodeDouble) NodeConstantBoolean(buildcraft.lib.expression.node.value.NodeConstantBoolean) NodeConstantDouble(buildcraft.lib.expression.node.value.NodeConstantDouble)

Aggregations

NodeConstantBoolean (buildcraft.lib.expression.node.value.NodeConstantBoolean)3 INodeBoolean (buildcraft.lib.expression.api.IExpressionNode.INodeBoolean)1 INodeDouble (buildcraft.lib.expression.api.IExpressionNode.INodeDouble)1 INodeLong (buildcraft.lib.expression.api.IExpressionNode.INodeLong)1 NodeConstantDouble (buildcraft.lib.expression.node.value.NodeConstantDouble)1 NodeConstantLong (buildcraft.lib.expression.node.value.NodeConstantLong)1