initial commit

This commit is contained in:
wea_ondara
2022-07-11 21:18:54 +02:00
commit 8bb2265abd
34 changed files with 2488 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
package jef.expressions;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class TernaryExpression implements Expression {
private final Expression cond;
private final Expression whenTrue;
private final Expression whenFalse;
@Override
public Type getType() {
return Type.TERNARY;
}
@Override
public String toString() {
return cond
+ " ? " + (!(whenTrue instanceof ConstantExpression) ? "(" + whenTrue + ")" : whenTrue)
+ " : " + (!(whenFalse instanceof ConstantExpression) ? "(" + whenFalse + ")" : whenFalse);
}
}