java.lang.Cloneable
, java.lang.Iterable<java.lang.Object>
public class Ris extends LSet
x
is the control term of the RIS, i.e. a dummy variable,
D
is the domain of the RIS, i.e. a finite (possibly unspecified) s that is also the domain of x
.
F(x)
, the filter, is a constraint in which could appear x
or free variables (or dummy variables)
defined outside of the RIS, this constraint must be satisfied by all x
in order for them to be used in the formula P(x)
, the pattern,
to form the member terms of the intensional set.USEJOLLYTOKEN
Constructor | Description |
---|---|
Ris(LObject controlTerm,
LSet domain,
Constraint filter) |
Constructs the restricted intensional set
{controlTerm : domain | filter @ controlTerm} . |
Ris(LObject controlTerm,
LSet domain,
Constraint filter,
LObject pattern,
LObject... dummyVariables) |
Constructs the restricted intensional set
{controlTerm : domain | filter @ pattern} and treats each variable in
dummyVariables as a dummy variable (i.e. creates a new instance for every application of filter and pattern). |
Ris(Ris ris) |
Constructs a restricted intensional set that has the same
controlTerm , domain , filter , pattern and
dummy variables as the argument ris . |
Modifier and Type | Method | Description |
---|---|---|
java.lang.Object |
accept(jsetl.Visitor visitor) |
Needed for the Visitor pattern to work.
|
Ris |
clone() |
Constructs and returns a clone of this
Ris , the same as new Ris(this) . |
boolean |
equals(java.lang.Object object) |
Checks whether this object is equal to the parameter
object . |
LSet |
expand() |
Returns a logical set containing the expansion of this
Ris , if it is expandable. |
Constraint |
forallElems(LVar lVar,
Constraint constraint) |
This method returns a constraint that is true if and only if
for every element in
this , that element satisfies the constraint
constraint with lVar replaced with such element in it. |
LObject |
getControlTerm() |
Return the control term of this
Ris . |
LSet |
getDomain() |
Return the domain of this
Ris . |
Constraint |
getFilter() |
Return the filter of this
Ris . |
LObject |
getPattern() |
Return the pattern of this
Ris . |
int |
getSize() |
Calling this method is the same as calling
this.expand().getSize() . |
Ris |
getTail() |
Returns tha tail of this restricted intensional set, which is
this . |
java.util.HashSet<?> |
getValue() |
Same as calling
getValue() on the value returned by the expand() method. |
int |
hashCode() |
Returns the hashcode for this
Ris . |
boolean |
isBound() |
Checks whether the
Ris domain is bound or not. |
boolean |
isClosed() |
Checks whether the
Ris domain is closed or not. |
boolean |
isExpandable() |
Checks whether this
Ris is expandable or not. |
boolean |
isGround() |
Checks whether the
Ris is ground or not: it is if and only if its domain is ground. |
java.util.Iterator<java.lang.Object> |
iterator() |
Calling this method is the same as calling
this.expand().iterator() . |
Ris |
normalizeSet() |
This operation is not supported by
Ris , so it will always throw UnsupportedOperationException . |
boolean |
occurs(java.lang.Object object) |
Tests whether this
Ris contains the parameter object as its (or inside its) control term, domain, filter or pattern. |
void |
output() |
Outputs a description of this
Ris to the standard output. |
void |
printElems(char delimiter) |
Calling this method is the same as calling
this.expand().getSize(delimiter) . |
Ris |
setName(java.lang.String name) |
Sets the name of this
Ris to name and returns this . |
LSet |
setValue(java.util.Set<?> value) |
Calling this method always throws
UnsupportedOperationException . |
java.lang.Object[] |
toArray() |
Calling this method is the same as calling
this.expand().toArray() . |
java.lang.String |
toString() |
Constructs and returns a string representation of this restricted intensional set,
the string is of the form
"{ controlTerm : domain | filter @ pattern }" . |
isEmpty, testContains
contains, diff, diff, diff, diff, disj, disj, empty, eq, eq, 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, nsubset, nsubset, nunion, nunion, nunion, nunion, size, size, subset, subset, union, union, union, union
public Ris(@NotNull LObject controlTerm, @NotNull LSet domain, @NotNull Constraint filter, @NotNull LObject pattern, @NotNull LObject... dummyVariables)
{controlTerm : domain | filter @ pattern}
and treats each variable in
dummyVariables
as a dummy variable (i.e. creates a new instance for every application of filter and pattern).
Note that also the variables created to represent the flattened form of expressions are treated as dummy variables, even if
they do not occur in dummyVariables
.controlTerm
- control term of this Ris
.domain
- domain of this of this Ris
.filter
- filter of this Ris
.pattern
- pattern of this Ris
.dummyVariables
- each variable in this array will be treated as a dummy variable if it occurs in filter
or pattern
.
It can not contain null
values.java.lang.NullPointerException
- if dummyVariables
contains null
values.public Ris(@NotNull LObject controlTerm, @NotNull LSet domain, @NotNull Constraint filter)
{controlTerm : domain | filter @ controlTerm}
.
Note that also the variables created to represent the flattened form of expressions are treated as dummy dummyVariables.controlTerm
- control term (and pattern) of this Ris
.domain
- domain of this of this Ris
.filter
- filter of this Ris
.@NotNull public LObject getControlTerm()
Ris
.@NotNull public Constraint getFilter()
Ris
.@NotNull public LObject getPattern()
Ris
.@NotNull public Ris setName(@NotNull java.lang.String name)
Ris
to name
and returns this
.public java.util.HashSet<?> getValue()
getValue()
on the value returned by the expand()
method.getValue
in class LSet
Ris
.java.lang.IllegalStateException
- if this Ris
is not expandable.expand()
,
isExpandable()
public void output()
Ris
to the standard output.
The description is of the form "name = toString".@NotNull public Ris clone()
Ris
, the same as new Ris(this)
.public boolean isExpandable()
Ris
is expandable or not.
A Ris
is expandable if and only if its domain is empty or (it has at least a ground element
and the filter has no free (not dummy and not part of control term) variables).true
if this Ris
is expandable, false
otherwise.expand()
@NotNull public LSet expand()
Ris
, if it is expandable.
The expansion of a Ris
is a LSet
containing each possible P(d)
for each ground d in domain
that satisfies F(d)
. The constructed LSet
has an empty tail (LSet.empty()
)
if the domain of the Ris
is ground,
otherwise it is a Ris
with the same control term, filter and pattern as the original Ris
and
a LSet
containing each non-ground element of domain
as its domain.Ris
.java.lang.IllegalStateException
- if the this Ris
is not expandableisExpandable()
@NotNull public Ris getTail()
this
.public boolean isBound()
Ris
domain is bound or not.isBound
in class LObject
true
if the domain of this Ris
is initialized, false
otherwise.LObject.isInitialized()
public boolean isGround()
Ris
is ground or not: it is if and only if its domain is ground.isGround
in class LCollection
true
if this Ris
is ground, false
otherwise.public boolean isClosed()
Ris
domain is closed or not.isClosed
in class LCollection
true
if this Ris
domain is closed, false
otherwise.@NotNull public java.lang.String toString()
"{ controlTerm : domain | filter @ pattern }"
.public boolean occurs(@NotNull java.lang.Object object)
Ris
contains the parameter object
as its (or inside its) control term, domain, filter or pattern.public boolean equals(@Nullable java.lang.Object object)
object
.
Note that equal Ris
s will have the same hash code.public int hashCode()
Ris
. Note that equal Ris
s will have the same hash code.hashCode
in class java.lang.Object
@NotNull public java.util.Iterator<java.lang.Object> iterator()
this.expand().iterator()
.iterator
in interface java.lang.Iterable<java.lang.Object>
iterator
in class LCollection
Ris
.java.lang.IllegalStateException
- if this Ris
is not expandable.expand()
,
isExpandable()
public int getSize()
this.expand().getSize()
.getSize
in class LSet
Ris
.java.lang.IllegalStateException
- if this Ris
is not expandable.expand()
,
isExpandable()
@NotNull public java.lang.Object[] toArray()
this.expand().toArray()
.toArray
in class LCollection
ris
.java.lang.IllegalStateException
- if this Ris
is not expandable.expand()
,
isExpandable()
public void printElems(char delimiter)
this.expand().getSize(delimiter)
.
It outputs to standard output the list of elements in the expansion of this Ris
separated by delimiter
.printElems
in class LSet
delimiter
- character to use between elements.java.lang.IllegalStateException
- if this Ris
is not expandable.expand()
,
isExpandable()
@Nullable public java.lang.Object accept(@NotNull jsetl.Visitor visitor)
@NotNull public Constraint forallElems(@NotNull LVar lVar, @NotNull Constraint constraint)
this
, that element satisfies the constraint
constraint
with lVar
replaced with such element in it.forallElems
in class LCollection
lVar
- the dummy logical variable used in the constraint constraint
.constraint
- a constraint conjunction which should be satisfied for each (known) element
of this collection, after substituting y
with them.@UnsupportedOperation public Ris normalizeSet()
Ris
, so it will always throw UnsupportedOperationException
.normalizeSet
in class LSet
java.lang.UnsupportedOperationException
- always.@UnsupportedOperation public LSet setValue(java.util.Set<?> value)
UnsupportedOperationException
.