|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkodkod.ast.Expression
kodkod.ast.LeafExpression
kodkod.ast.Relation
public class Relation
A relation is a leaf expression. Two relations are the same if and only if they refer to the same object. That is, r1.equals(r2) <=> r1 == r2. Each variable has a name, which is basically a comment for the purpose of printing, viewing, etc. The name has no meaning otherwise.
Four methods for creating commonly used predicates over binary relations
are provided: function(Expression, Expression)
, functional(Expression, Expression)
,
acyclic()
, and totalOrder(Relation, Relation, Relation)
. Using
these methods to generate desired predicates will result in faster constraint solving
than creating the same predicates via other API calls.
no children |
name: String |
arity: int |
Field Summary |
---|
Fields inherited from class kodkod.ast.Expression |
---|
IDEN, INTS, NONE, UNIV |
Method Summary | ||
---|---|---|
|
accept(ReturnVisitor<E,F,D,I> visitor)
Accepts the given visitor and returns the result. |
|
void |
accept(VoidVisitor visitor)
Accepts the given visitor. |
|
Formula |
acyclic()
Returns a formula stating that this relation is acyclic. |
|
static Relation |
binary(java.lang.String name)
Returns a new binary relation with the given name. |
|
Formula |
function(Expression domain,
Expression range)
Returns a formula stating that this relation is a total function with the specified domain and range. |
|
Formula |
functional(Expression domain,
Expression range)
Returns a formula stating that this relation is a partial function with the specified domain and range. |
|
static Relation |
nary(java.lang.String name,
int arity)
Returns a new relation with the given name and arity. |
|
static Relation |
ternary(java.lang.String name)
Returns a ternary relation with the specified name. |
|
Formula |
totalOrder(Relation ordered,
Relation first,
Relation last)
Returns a formula stating that this relation imposes a total ordering over the atoms in the set ordered , and that thet first and
last elements in the ordering are given by the relations first
and last . |
|
static Relation |
unary(java.lang.String name)
Returns a new unary relation with the given name. |
Methods inherited from class kodkod.ast.LeafExpression |
---|
arity, name, toString |
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 |
---|
public static Relation nary(java.lang.String name, int arity)
java.lang.IllegalArgumentException
- - arity < 1public static Relation unary(java.lang.String name)
public static Relation binary(java.lang.String name)
public static Relation ternary(java.lang.String name)
public <E,F,D,I> E accept(ReturnVisitor<E,F,D,I> visitor)
accept
in interface Node
accept
in class Expression
Node.accept(kodkod.ast.visitor.ReturnVisitor)
public void accept(VoidVisitor visitor)
Node.accept(kodkod.ast.visitor.VoidVisitor)
public Formula acyclic()
java.lang.IllegalArgumentException
- - this.arity != 2public Formula function(Expression domain, Expression range)
java.lang.NullPointerException
- - domain = null || range = null
java.lang.IllegalArgumentException
- - domain.arity != 1 || range.arity != 1
java.lang.IllegalArgumentException
- - this.arity != 2public Formula functional(Expression domain, Expression range)
java.lang.NullPointerException
- - domain = null || range = null
java.lang.IllegalArgumentException
- - domain.arity != 1 || range.arity != 1
java.lang.IllegalArgumentException
- - this.arity != 2public Formula totalOrder(Relation ordered, Relation first, Relation last)
ordered
, and that thet first and
last elements in the ordering are given by the relations first
and last
.
java.lang.NullPointerException
- - any of the arguments are null
java.lang.IllegalArgumentException
- - any of the argument relations' arities are greater than one
java.lang.IllegalArgumentException
- - this.arity != 2
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |