Package hydra.lisp.syntax
Class IfExpression
- java.lang.Object
-
- hydra.lisp.syntax.IfExpression
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<IfExpression>
public class IfExpression extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<IfExpression>
Conditional: (if test then else)- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIfExpression.BuilderA fluent builder forIfExpression.
-
Field Summary
Fields Modifier and Type Field Description ExpressionconditionThe test expressionstatic NameCONDITIONName of thehydra.lisp.syntax.IfExpression.conditionfield.static NameELSEName of thehydra.lisp.syntax.IfExpression.elsefield.Optional<Expression>else_Optional else branchExpressionthenThe then branchstatic NameTHENName of thehydra.lisp.syntax.IfExpression.thenfield.static NameTYPE_Name of thehydra.lisp.syntax.IfExpressiontype.
-
Constructor Summary
Constructors Constructor Description IfExpression(Expression condition, Expression then, Optional<Expression> else_)Constructs an immutableIfExpression.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IfExpression.Builderbuilder()Creates a new fluent builder forIfExpression.intcompareTo(IfExpression other)booleanequals(java.lang.Object other)inthashCode()java.lang.StringtoString()IfExpressionwithCondition(Expression condition)Returns a copy of thisIfExpressionwithconditionreplaced.IfExpressionwithElse(Optional<Expression> else_)Returns a copy of thisIfExpressionwithelsereplaced.IfExpressionwithThen(Expression then)Returns a copy of thisIfExpressionwiththenreplaced.
-
-
-
Field Detail
-
TYPE_
public static final Name TYPE_
Name of thehydra.lisp.syntax.IfExpressiontype.
-
CONDITION
public static final Name CONDITION
Name of thehydra.lisp.syntax.IfExpression.conditionfield.
-
THEN
public static final Name THEN
Name of thehydra.lisp.syntax.IfExpression.thenfield.
-
ELSE
public static final Name ELSE
Name of thehydra.lisp.syntax.IfExpression.elsefield.
-
condition
public final Expression condition
The test expression
-
then
public final Expression then
The then branch
-
else_
public final Optional<Expression> else_
Optional else branch
-
-
Constructor Detail
-
IfExpression
public IfExpression(Expression condition, Expression then, Optional<Expression> else_)
Constructs an immutableIfExpression.- Parameters:
condition- The test expressionthen- The then branchelse_- Optional else branch
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(IfExpression other)
- Specified by:
compareToin interfacejava.lang.Comparable<IfExpression>
-
withCondition
public IfExpression withCondition(Expression condition)
Returns a copy of thisIfExpressionwithconditionreplaced.
-
withThen
public IfExpression withThen(Expression then)
Returns a copy of thisIfExpressionwiththenreplaced.
-
withElse
public IfExpression withElse(Optional<Expression> else_)
Returns a copy of thisIfExpressionwithelsereplaced.
-
builder
public static IfExpression.Builder builder()
Creates a new fluent builder forIfExpression.
-
-