|
JML | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jmlspecs.models.JMLEqualsToValueRelation org.jmlspecs.models.JMLEqualsToValueMap
Maps (i.e., binary relations that are functional) from non-null
elements of Object
to non-null elements of JMLType
. The first type, Object, is called
the domain type of the map; the second type,
JMLType, is called the range type of the map. A
map can be seen as a set of pairs, of form (dv, rv),
consisting of an element of the domain type, dv, and an
element of the range type, rv. Alternatively, it can be
seen as a partial function that maps each element of the domain to
an element of the range type.
This type is a subtype of JMLEqualsToValueRelation
, and as such as can be treated as a
binary relation or a set valued function also. See the
documentation for JMLEqualsToValueRelation
and for the
methods inherited from this supertype for more information.
This type considers elements val and dv
of the domain type, to be distinct just when
_val_not_equal_to_dv_. It considers elements of
r and rv of the range type to be distinct
just when _r_not_equal_to_rv_. Cloning takes place for
the domain or range elements if the corresponding domain or range
type is JMLType
.
JMLCollection
,
JMLType
,
JMLEqualsToValueRelation
,
JMLEqualsToValueRelationEnumerator
,
JMLEqualsToValueRelationImageEnumerator
,
JMLValueSet
,
JMLObjectSet
,
JMLObjectToObjectMap
,
JMLValueToObjectMap
,
JMLObjectToValueMap
,
JMLValueToValueMap
,
JMLEqualsToValueRelation.toFunction()
Class Specifications |
public invariant this.isaFunction(); public invariant_redundantly ( \forall java.lang.Object dv; this.isDefinedAt(dv); this.elementImage(dv).int_size() == 1); |
Specifications inherited from class JMLEqualsToValueRelation |
public invariant ( \forall java.lang.Object obj; this.theRelation.has((org.jmlspecs.models.JMLType)obj); obj != null&&obj instanceof org.jmlspecs.models.JMLEqualsValuePair&&((org.jmlspecs.models.JMLEqualsValuePair)obj).key != null&&((org.jmlspecs.models.JMLEqualsValuePair)obj).value != null); public invariant_redundantly (* Every element of 'theRelation'is a JMLEqualsValuePair whose key and value are not null *); public invariant this.elementType == \type(org.jmlspecs.models.JMLEqualsValuePair); public invariant !this.containsNull; protected invariant this.imagePairSet_.int_size() == this.domain_.int_size()&&( \forall java.lang.Object dv; dv != null&&this.domain_.has(dv); this.imagePairSet_.has(new org.jmlspecs.models.JMLEqualsValuePair(dv, this.elementImage(dv)))); protected invariant_redundantly this.imagePairSet_ == this.imagePairSet(); protected invariant this.size_ == this.theRelation.int_size(); protected invariant this.size_ >= 0; public invariant this.owner == null; protected represents theRelation <- this.toSet(); |
Specifications inherited from class Object |
represents objectState <- org.jmlspecs.lang.JMLDataGroup.IT; public represents _getClass <- \typeof(this); |
Specifications inherited from interface JMLCollection |
instance public constraint this.elementType == \old(this.elementType); instance public constraint this.containsNull == \old(this.containsNull); |
Model Field Summary |
Model fields inherited from class org.jmlspecs.models.JMLEqualsToValueRelation |
theRelation |
Model fields inherited from class java.lang.Object |
_getClass, objectState, theString |
Model fields inherited from interface org.jmlspecs.models.JMLCollection |
elementState |
Ghost Field Summary |
Ghost fields inherited from class java.lang.Object |
objectTimesFinalized, owner |
Ghost fields inherited from interface org.jmlspecs.models.JMLCollection |
containsNull, elementType |
Field Summary | |
static JMLEqualsToValueMap |
EMPTY
The empty JMLEqualsToValueMap. |
Fields inherited from class org.jmlspecs.models.JMLEqualsToValueRelation |
domain_, imagePairSet_, size_, TOO_BIG_TO_UNION |
Constructor Summary | |
|
JMLEqualsToValueMap()
Initialize this map to be the empty mapping. |
|
JMLEqualsToValueMap(non_null Object dv,
non_null JMLType rv)
Initialize this map to be a mapping that maps the given domain element to the given range element. |
|
JMLEqualsToValueMap(non_null JMLEqualsValuePair pair)
Initialize this map to be a mapping that maps the key in the given pair to the value in that pair. |
protected |
JMLEqualsToValueMap(JMLValueSet ipset,
JMLEqualsSet dom,
int sz)
Initialize this map based on the representation values given. |
Model Method Summary |
Model methods inherited from class java.lang.Object |
hashValue |
Model methods inherited from interface org.jmlspecs.models.JMLCollection |
size |
Method Summary | |
JMLType |
apply(Object dv)
Return the range element corresponding to dv, if there is one. |
JMLEqualsToValueMap |
clashReplaceUnion(JMLEqualsToValueMap othMap,
JMLType errval)
Return a new map that is like the union of the given map and this map, except that if both define a mapping for a given domain element, then each of these clashes is replaced by a mapping from the domain element in question to the given range element. |
Object |
clone()
Return a clone of this object. |
JMLObjectToValueMap |
compose(non_null JMLObjectToEqualsMap othMap)
Return a new map that is the composition of this and the given map. |
JMLValueToValueMap |
compose(non_null JMLValueToEqualsMap othMap)
Return a new map that is the composition of this and the given map. |
JMLEqualsToValueMap |
disjointUnion(non_null JMLEqualsToValueMap othMap)
Return a map that is the disjoint union of this and othMap. |
JMLEqualsToValueMap |
extend(non_null Object dv,
non_null JMLType rv)
Return a new map that is like this but maps the given domain element to the given range element. |
JMLEqualsToValueMap |
extendUnion(non_null JMLEqualsToValueMap othMap)
Return a new map that is like the union of the given map and this map, except that if both define a mapping for a given domain element, then only the mapping in the given map is retained. |
boolean |
isaFunction()
Tells whether this relation is a function. |
JMLEqualsToValueMap |
rangeRestrictedTo(non_null JMLValueSet rng)
Return a new map that is like this map but only contains associations that map to range elements in the given set. |
JMLEqualsToValueMap |
removeDomainElement(Object dv)
Return a new map that is like this but has no association for the given domain element. |
JMLEqualsToValueMap |
restrictedTo(non_null JMLEqualsSet dom)
Return a new map that only maps elements in the given domain to the corresponding range elements in this map. |
static JMLEqualsToValueMap |
singletonMap(non_null Object dv,
non_null JMLType rv)
Return the singleton map containing the given association. |
static JMLEqualsToValueMap |
singletonMap(non_null JMLEqualsValuePair pair)
Return the singleton map containing the association described by the given pair. |
Methods inherited from class org.jmlspecs.models.JMLEqualsToValueRelation |
add, associations, compose, compose, difference, domain, domainElements, elementImage, elements, equals, has, has, has, hashCode, image, imagePairs, imagePairSet, insert, int_size, intersection, inverse, inverseElementImage, inverseImage, isDefinedAt, isEmpty, iterator, range, rangeElements, remove, remove, removeFromDomain, restrictDomainTo, restrictRangeTo, singleton, singleton, toBag, toFunction, toSequence, toSet, toString, union |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final JMLEqualsToValueMap EMPTY
JMLEqualsToValueMap()
Constructor Detail |
public JMLEqualsToValueMap()
EMPTY
public JMLEqualsToValueMap(non_null Object dv, non_null JMLType rv)
singletonMap(Object, JMLType)
,
JMLEqualsToValueMap(JMLEqualsValuePair)
public JMLEqualsToValueMap(non_null JMLEqualsValuePair pair)
singletonMap(JMLEqualsValuePair)
,
JMLEqualsToValueMap(Object, JMLType)
protected JMLEqualsToValueMap(JMLValueSet ipset, JMLEqualsSet dom, int sz)
Method Detail |
public static JMLEqualsToValueMap singletonMap(non_null Object dv, non_null JMLType rv)
JMLEqualsToValueMap(Object, JMLType)
,
singletonMap(JMLEqualsValuePair)
public static JMLEqualsToValueMap singletonMap(non_null JMLEqualsValuePair pair)
JMLEqualsToValueMap(JMLEqualsValuePair)
,
singletonMap(Object, JMLType)
public boolean isaFunction()
isaFunction
in class JMLEqualsToValueRelation
public JMLType apply(Object dv) throws JMLNoSuchElementException
dv
- the domain element for which an association is
sought (the key to the table).
JMLNoSuchElementException
- when dv is not associated
to any range element by this.JMLEqualsToValueRelation.isDefinedAt(java.lang.Object)
,
JMLEqualsToValueRelation.elementImage(java.lang.Object)
,
JMLEqualsToValueRelation.image(org.jmlspecs.models.JMLEqualsSet)
public Object clone()
JMLEqualsToValueRelation
clone
in interface JMLType
clone
in class JMLEqualsToValueRelation
public JMLEqualsToValueMap extend(non_null Object dv, non_null JMLType rv)
JMLEqualsToValueRelation#insert(Object, JMLType)
public JMLEqualsToValueMap removeDomainElement(Object dv)
JMLEqualsToValueRelation.removeFromDomain(java.lang.Object)
public JMLValueToValueMap compose(non_null JMLValueToEqualsMap othMap)
compose(JMLObjectToEqualsMap)
public JMLObjectToValueMap compose(non_null JMLObjectToEqualsMap othMap)
compose(JMLValueToEqualsMap)
public JMLEqualsToValueMap restrictedTo(non_null JMLEqualsSet dom)
rangeRestrictedTo(org.jmlspecs.models.JMLValueSet)
,
JMLEqualsToValueRelation.restrictDomainTo(org.jmlspecs.models.JMLEqualsSet)
public JMLEqualsToValueMap rangeRestrictedTo(non_null JMLValueSet rng)
restrictedTo(org.jmlspecs.models.JMLEqualsSet)
,
JMLEqualsToValueRelation.restrictRangeTo(org.jmlspecs.models.JMLValueSet)
public JMLEqualsToValueMap extendUnion(non_null JMLEqualsToValueMap othMap) throws IllegalStateException
IllegalStateException
clashReplaceUnion(org.jmlspecs.models.JMLEqualsToValueMap, org.jmlspecs.models.JMLType)
,
disjointUnion(org.jmlspecs.models.JMLEqualsToValueMap)
,
JMLEqualsToValueRelation.union(org.jmlspecs.models.JMLEqualsToValueRelation)
public JMLEqualsToValueMap clashReplaceUnion(JMLEqualsToValueMap othMap, JMLType errval) throws IllegalStateException
othMap
- the other map.errval
- the range element to use when clashes occur.
IllegalStateException
extendUnion(org.jmlspecs.models.JMLEqualsToValueMap)
,
disjointUnion(org.jmlspecs.models.JMLEqualsToValueMap)
,
JMLEqualsToValueRelation.union(org.jmlspecs.models.JMLEqualsToValueRelation)
public JMLEqualsToValueMap disjointUnion(non_null JMLEqualsToValueMap othMap) throws JMLMapException, IllegalStateException
othMap
- the other mapping
JMLMapException
- the ranges of this and othMap have elements
in common (i.e., when they interesect).
IllegalStateException
extendUnion(org.jmlspecs.models.JMLEqualsToValueMap)
,
clashReplaceUnion(org.jmlspecs.models.JMLEqualsToValueMap, org.jmlspecs.models.JMLType)
,
JMLEqualsToValueRelation.union(org.jmlspecs.models.JMLEqualsToValueRelation)
|
JML | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |