java.lang.Cloneable
, java.lang.Iterable<java.lang.Object>
public class LRel extends LSet implements java.lang.Cloneable
LRel
implements logical relations, which are a type of logical sets
whose elements are logical pairs. This class provides methods for creating logical relations
and relational constraints on them.ssUSEJOLLYTOKEN
Constructor | Description |
---|---|
LRel() |
Constructs an unspecified logical relation with default name.
|
LRel(java.lang.String name) |
Constructs an unspecified logical relation with given name.
|
LRel(java.lang.String name,
java.util.Set<LPair> set) |
Constructs a bound and closed logical relation whose elements are those in
set and with a given name. |
LRel(java.lang.String name,
LRel lRel) |
Constructs a logical relation which is equal to the parameter
lRel and with given name. |
LRel(java.util.Set<LPair> set) |
Constructs a bound and closed logical relation whose elements are those in
set and with a default name. |
LRel(LRel lRel) |
Constructs a logical relation which is equal to the parameter
lRel and with default name. |
Modifier and Type | Method | Description |
---|---|---|
java.lang.Object |
accept(jsetl.Visitor visitor) |
Implementation of this method is needed for the Visitor design pattern.
|
LRel |
clone() |
Creates a clone of this
LRel . |
Constraint |
comp(LRel lRel1,
LRel lRel2) |
This method creates the "comp" constraint which requires that
this comp lRel1 = lRel2 . |
Constraint |
dom(LSet dom) |
This method creates the "dom" constraint.
|
Constraint |
dres(LSet lSet,
LRel lRel) |
This method creates a "dres" constraint of the form
dres(this, lSet, lRel) . |
static LRel |
empty() |
Creates an empty
LRel . |
java.util.HashSet<LPair> |
getValue() |
Gets the value of this
LRel (i.e., a HashSet<LPair> ) object containing all the
elements of this LRel (ignores the unspecified rest of the LRel ,
if present)). |
Constraint |
id() |
This method creates an "id" constraint, which requires
that
this is a identity relation over some logical set. |
Constraint |
id(LSet lSet) |
This method creates an "id" constraint.
|
LRel |
ins(LPair lPair) |
Creates and returns a new logical relation obtained from the union of
this with {lPair} . |
LRel |
ins(LPair... lPairs) |
Creates and returns a new logical relation obtained from this by adding all
elements of the parameter
lPairs . |
LRel |
insAll(java.util.ArrayList<LPair> newElements) |
Creates and returns a new logical s obtained from this by adding all
elements of the parameter
newElements . |
LRel |
insAll(LPair[] lPairs) |
Creates and returns a new logical relation obtained from this by adding all
elements of the parameter
lPairs . |
Constraint |
inv(LRel lRel) |
This method creates an "inv" constraint which requires that
lRel is the inverse relation of this . |
Constraint |
ncomp(LRel lRel1,
LRel lRel2) |
This method creates a "ncomp" constraint, which requires
that
this comp lRel1 != lRel2 . |
Constraint |
ndom(LSet lSet) |
This method creates a "ndom" constraint, which requires
that
lSet is not the domain this relation. |
Constraint |
ndres(LSet lSet,
LRel lRel) |
This method creates a "ndres" constraint of the form
ndres(this, lSet, lRel) . |
Constraint |
nid(LSet lSet) |
This method creates a "nid" constraint, which requires
that
this relation is not the identity over the set lSet . |
Constraint |
ninv(LRel lRel) |
This method creates an "ninv" constraint, which requires
that
lRel is not the inverse of this relation. |
Constraint |
nran(LSet lSet) |
This method creates a "nran" constraint, which requires
that
lSet is not the range this relation. |
Constraint |
nrres(LSet lSet,
LRel lRel) |
This method creates a "nrres" constraint of the form
nrres(this, lSet, lRel) . |
Constraint |
ran(LSet ran) |
This method creates the "ran" constraint.
|
Constraint |
rres(LSet lSet,
LRel lRel) |
This method creates a "rres" constraint of the form
rres(this, lSet, lRel) . |
LRel |
setName(java.lang.String name) |
Sets the name of this
LRel to name . |
LRel |
setValue(java.util.Set<?> set) |
Sets the value of this
LRel to the parameter java set. |
forallElems, isClosed, isEmpty, isGround, iterator, testContains, toArray
contains, diff, diff, diff, diff, disj, disj, eq, eq, equals, getSize, getTail, ins, insAll, insAll, inters, inters, inters, inters, less, less, less, less, mkSet, ncontains, ndiff, ndiff, ndiff, ndiff, ndisj, ndisj, neq, neq, ninters, ninters, ninters, ninters, normalizeSet, nsubset, nsubset, nunion, nunion, nunion, nunion, occurs, printElems, size, size, subset, subset, toString, union, union, union, union
public LRel()
public LRel(@NotNull java.lang.String name)
name
- name of the logical relation.public LRel(@NotNull java.util.Set<LPair> set)
set
and with a default name.set
- a java set whose elements will be the elements of the constructed logical relation.
It must not contain null
values.java.lang.NullPointerException
- if set
contains null
values.public LRel(@NotNull java.lang.String name, @NotNull java.util.Set<LPair> set)
set
and with a given name.set
- a java set whose elements will be the elements of the constructed logical relation.
It must not contain null
values.name
- the name of the logical relation.java.lang.NullPointerException
- if set
contains null
values.public LRel(@NotNull LRel lRel)
lRel
and with default name.
This constructor is equivalent to solving the constraint this.eq(lRel)
.lRel
- the logical relation to which the constructed logical relation is equal.public LRel(@NotNull java.lang.String name, @NotNull LRel lRel)
lRel
and with given name.
This constructor is equivalent to solving the constraint this.eq(lRel)
.name
- name of the logical relation.lRel
- the relation to which the constructed logical relation is equal@Nullable public java.lang.Object accept(@NotNull jsetl.Visitor visitor)
@NotNull public LRel setName(@NotNull java.lang.String name)
LRel
to name
.@NotNull public LRel ins(@NotNull LPair lPair)
this
with {lPair}
.
The invocation object is not modified.lPair
- the logical pair to use when creating the new set.lPair
to this logical relation.@NotNull public LRel ins(@NotNull LPair... lPairs)
lPairs
. Does not modify this logical relation.lPairs
- elements to add. None of them can be null
.java.lang.NullPointerException
- if at least one of the elements in lPairs
is null
.@NotNull public LRel insAll(@NotNull LPair[] lPairs)
lPairs
. Does not modify this logical relation.lPairs
- elements to add. None of them can be null
.java.lang.NullPointerException
- if at least one of the elements in lPairs
is null
.@NotNull public LRel insAll(@NotNull java.util.ArrayList<LPair> newElements)
newElements
. Does not modify this logical relation.newElements
- collection of elements to add. None of its elements can be null
.java.lang.NullPointerException
- if at least one of the elements in newElements
is null
.@Nullable public java.util.HashSet<LPair> getValue()
LRel
(i.e., a HashSet<LPair>
) object containing all the
elements of this LRel
(ignores the unspecified rest of the LRel
,
if present)). The result is null
if and only if this logical relation is not bound.
The returned set does not contain null
values;@NotNull public LRel setValue(@NotNull java.util.Set<?> set)
LRel
to the parameter java set.
This relation becomes bound and closed.
Calling this method is equivalent to solving the constraint this.eq(s)
.setValue
in class LSet
set
- the set containing all elements of this logical relation. It must not contain null
values.
It is required that each element of set
is a LPair
.LRel
modified.java.lang.NullPointerException
- if at least one of the elements of set
is null
.java.lang.IllegalArgumentException
- if at least one
element of set
is not null
an instance of LPair
.InitLObjectException
- if this logical relation is already bound.@NotNull public Constraint dom(@NotNull LSet dom)
dom
- : domain of the LRel
on which this method is invoked.
It is the domain of this
relation.@NotNull public Constraint ran(@NotNull LSet ran)
ran
- : range of the LRel
on which this method is invoked.
It is the range of this
relation.@NotNull public Constraint comp(@NotNull LRel lRel1, @NotNull LRel lRel2)
this comp lRel1 = lRel2
.lRel1
- second argument of the relational composition.lRel2
- result of the relational composition.@NotNull public Constraint id(@NotNull LSet lSet)
this
is the identity relation over the logical set lSet
.lSet
- a logical set.@NotNull public Constraint inv(@NotNull LRel lRel)
lRel
is the inverse relation of this
.lRel
- the inverse relation of this
.@NotNull public Constraint id()
this
is a identity relation over some logical set.@NotNull public Constraint dres(@NotNull LSet lSet, @NotNull LRel lRel)
dres(this, lSet, lRel)
.lSet
- domain restriction of the "dres" constraint.lRel
- result of the "dres".@NotNull public Constraint rres(@NotNull LSet lSet, @NotNull LRel lRel)
rres(this, lSet, lRel)
.lSet
- range restriction of the "rres" constraint.lRel
- result of the "rres".@NotNull public Constraint ndom(@NotNull LSet lSet)
lSet
is not the domain this
relation.lSet
- set which must not be the domain of this
relation.@NotNull public Constraint nran(@NotNull LSet lSet)
lSet
is not the range this
relation.lSet
- set which must not be the range of this
relation.@NotNull public Constraint ninv(@NotNull LRel lRel)
lRel
is not the inverse of this
relation.lRel
- relation which must not be the inverse of this
relation.@NotNull public Constraint nid(@NotNull LSet lSet)
this
relation is not the identity over the set lSet
.lSet
- a logical set.@NotNull public Constraint ncomp(@NotNull LRel lRel1, @NotNull LRel lRel2)
this comp lRel1 != lRel2
.lRel1
- second argument of the not composition constraint.lRel2
- third argument of the not composition constraint.@NotNull public Constraint ndres(@NotNull LSet lSet, @NotNull LRel lRel)
ndres(this, lSet, lRel)
.lSet
- domain restriction of the "ndres" constraint.lRel
- different than the result of the domain restriction.@NotNull public Constraint nrres(@NotNull LSet lSet, @NotNull LRel lRel)
nrres(this, lSet, lRel)
.lSet
- range restriction of the "nrres" constraint.lRel
- different than the result of the range restriction.