public class Membership extends Predicate
expressions, maxOperands
factory, type
Constructor and Description |
---|
Membership()
Creates a default Membership predicate.
|
Membership(java.lang.String name)
Creates a named Membership predicate.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Boolean |
evaluate()
Executes this Membership predicate on its operands.
|
protected java.lang.Boolean |
excludes(java.lang.Object collection,
java.lang.Object value)
Reports whether the collection excludes the value from its elements.
|
protected java.lang.Boolean |
excludesAll(java.lang.Object first,
java.lang.Object second)
Reports whether the first collection excludes all of the second one.
|
protected java.lang.Boolean |
excludesKey(java.lang.Object collection,
java.lang.Object key)
Reports whether the map excludes the key from its search keys.
|
protected java.lang.Boolean |
includes(java.lang.Object collection,
java.lang.Object value)
Reports whether the collection includes the value in its elements.
|
protected java.lang.Boolean |
includesAll(java.lang.Object first,
java.lang.Object second)
Reports whether the first collection includes all of the second one.
|
protected java.lang.Boolean |
includesKey(java.lang.Object collection,
java.lang.Object key)
Reports whether the collection includes the key in its search keys.
|
boolean |
isConsistent()
Reports whether this Membership predicate is consistent.
|
protected java.lang.Boolean |
isEmpty(java.lang.Object collection)
Reports whether the collection is empty.
|
protected void |
nameCheck()
Checks the name of this Membership predicate and sets the expected
number of operands.
|
Predicate |
negate()
Returns the complement of this Membership predicate.
|
protected java.lang.Boolean |
notEmpty(java.lang.Object collection)
Reports whether the collection is not empty.
|
protected void |
rebindFalse()
Rebinds the unbound operands of this Membership predicate, so that it
yields false.
|
protected void |
rebindTrue()
Rebinds the unbound operands of this Membership predicate, so that it
yields true.
|
boolean |
subsumes(Predicate other)
Tests whether this Membership predicate subsumes the other Predicate.
|
protected boolean |
subsumesMembership(Membership other)
Reports whether this Membership predicate subsumes the other.
|
protected void |
typeCheck()
Checks that the operand types are consistent and that the result type
is Boolean.
|
isFalseConstant, normalise, rebind, rebind, refine, setType, subsumesAllDisjunctsOf, subsumesOneConjunctOf, subsumesProposition
addExpression, assign, equals, getExpressions, getType, hashCode, isAssignable, isBound, operand, resolve, setName, toString, unbind
getName, isBottom, isOrdered
safeEquals, safeHashCode, semanticError
public Membership()
public Membership(java.lang.String name)
name
- the name of the membership predicate.protected void nameCheck()
protected void typeCheck()
public boolean isConsistent()
isConsistent
in class Predicate
public boolean subsumes(Predicate other)
protected boolean subsumesMembership(Membership other)
other
- the other Membership predicate.public Predicate negate()
public java.lang.Boolean evaluate()
protected java.lang.Boolean isEmpty(java.lang.Object collection)
collection
- any kind of collection.protected java.lang.Boolean notEmpty(java.lang.Object collection)
collection
- any kind of collection.protected java.lang.Boolean includes(java.lang.Object collection, java.lang.Object value)
collection
- any kind of collection.value
- any value of the collection's value-type.protected java.lang.Boolean excludes(java.lang.Object collection, java.lang.Object value)
collection
- any kind of collection.value
- any value of the collection's value-type.protected java.lang.Boolean includesAll(java.lang.Object first, java.lang.Object second)
first
- the first collection of any kind.second
- the second collection of the same kind.protected java.lang.Boolean excludesAll(java.lang.Object first, java.lang.Object second)
first
- the first collection of any kind.second
- the second collection of the same kind.protected java.lang.Boolean includesKey(java.lang.Object collection, java.lang.Object key)
collection
- must be a Map or a List.key
- a key of the Map's key-type, or an Integer index.protected java.lang.Boolean excludesKey(java.lang.Object collection, java.lang.Object key)
collection
- must be a Map or a List.key
- a key of the Map's key-type, or an Integer index.protected void rebindTrue()
rebindTrue
in class Predicate
protected void rebindFalse()
rebindFalse
in class Predicate