1 package org.simantics.scl.compiler.internal.interpreted;
4 public class IIf implements IExpression {
5 private final IExpression condition;
6 private final IExpression thenBranch;
7 private final IExpression elseBranch;
9 public IIf(IExpression condition, IExpression thenBranch,
10 IExpression elseBranch) {
11 this.condition = condition;
12 this.thenBranch = thenBranch;
13 this.elseBranch = elseBranch;
17 public Object execute(Object[] variableBindings) {
18 if((Boolean)condition.execute(variableBindings))
19 return thenBranch.execute(variableBindings);
21 return elseBranch.execute(variableBindings);
25 public String toString() {
26 StringBuilder b = new StringBuilder();