kodkod.ast
Class IfExpression

java.lang.Object
  extended by kodkod.ast.Expression
      extended by kodkod.ast.IfExpression
All Implemented Interfaces:
Node

public final class IfExpression
extends Expression

An expression whose value depends on the truth of a given condition.

Author:
Greg Dennis (gdennis@mit.edu), Emina Torlak
invariant:
children = condition + thenExpr + elseExpr
specfield:
condition: Formula
thenExpr: Expression
elseExpr: Expression

Field Summary
 
Fields inherited from class kodkod.ast.Expression
IDEN, INTS, NONE, UNIV
 
Method Summary
<E,F,D,I> E
accept(ReturnVisitor<E,F,D,I> visitor)
          Accepts the given visitor and returns the result.
 void accept(VoidVisitor visitor)
          Accepts the given visitor.
 int arity()
          Returns the arity of this.
 Formula condition()
          Returns the if-condition.
 Expression elseExpr()
          Returns the else-expression.
 Expression thenExpr()
          Returns the then-expression.
 java.lang.String toString()
          Returns the string representation of this expression.
 
Methods inherited from class kodkod.ast.Expression
apply, apply, apply, closure, compose, compose, count, difference, eq, in, intersection, join, lone, no, one, override, product, project, reflexiveClosure, some, sum, transpose, union
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

condition

public Formula condition()
Returns the if-condition.

Returns:
this.condition

thenExpr

public Expression thenExpr()
Returns the then-expression.

Returns:
this.thenExpr

elseExpr

public Expression elseExpr()
Returns the else-expression.

Returns:
this.elseExpr

arity

public int arity()
Returns the arity of this.

Specified by:
arity in class Expression
Returns:
this.arity

accept

public <E,F,D,I> E accept(ReturnVisitor<E,F,D,I> visitor)
Accepts the given visitor and returns the result.

Specified by:
accept in interface Node
Specified by:
accept in class Expression
Returns:
the result of being visited by the given visitor
See Also:
Node.accept(kodkod.ast.visitor.ReturnVisitor)

accept

public void accept(VoidVisitor visitor)
Accepts the given visitor.

See Also:
Node.accept(kodkod.ast.visitor.VoidVisitor)

toString

public java.lang.String toString()
Returns the string representation of this expression.

Overrides:
toString in class java.lang.Object
Returns:
string representation of this expression