java.util
Interface Map
- All Known Subinterfaces:
- SortedMap
- All Known Implementing Classes:
- AbstractMap, HashMap, Hashtable, TreeMap
- public interface Map
JML's specification of java.util.Map.
- Version:
- $Revision: 1.16 $
- Author:
- Katie Becker, Gary T. Leavens
Class Specifications |
axiom ( \forall java.util.Map m; ; ( \forall java.lang.Object k, v, vv; ; (m.contains(k,v)&&m.contains(k,vv)) ==> v == vv));
instance public invariant ( \forall java.lang.Object o; this.theMap.has(o); o instanceof java.util.Map.Entry);
instance public invariant ( \forall java.lang.Object o1, o2; this.theMap.has(o1)&&this.theMap.has(o2); o2 != o1 ==> !org.jmlspecs.models.JMLNullSafe.equals(o2,o1)); |
Specifications inherited from class Object |
represents objectState <- org.jmlspecs.lang.JMLDataGroup.IT;
public represents _getClass <- \typeof(this); |
Ghost Field Summary |
[instance] boolean |
containsNull
True iff we are allowed to contain null: // FIXME values or keys or both? |
theMap
public JMLEqualsSet theMap
- Specifications: instance non_null
datagroup contains: java.util.SortedMap.firstKey java.util.SortedMap.lastKey
containsNull
public boolean containsNull
- True iff we are allowed to contain null: // FIXME values or keys or both?
- Specifications: instance
nullequals
public static boolean nullequals(non_null Object o,
non_null Object oo)
- Specifications: pure
-
public normal_behavior
ensures \result == (o == oo||(o != null&&oo != null&&o.equals(oo)));
contains
public boolean contains(non_null Map.Entry e)
- Specifications: pure
-
public normal_behavior
requires e != null;
ensures \result <==> this.contains(e.getKey(),e.getValue());
contains
public boolean contains(non_null Object key,
non_null Object value)
- Specifications: pure
size
public int size()
- Specifications: pure
-
public normal_behavior
ensures \result == this.theMap.int_size();
- implies_that
-
ensures \result >= 0;
isEmpty
public boolean isEmpty()
- Specifications: pure
-
public normal_behavior
ensures \result <==> this.theMap.isEmpty();
containsKey
public boolean containsKey(non_null Object key)
- Specifications: pure
-
public normal_behavior
requires key != null;
ensures \result <==> ( \exists java.util.Map.Entry e; this.theMap.has(e)&&e != null; org.jmlspecs.models.JMLNullSafe.equals(e.abstractKey,key));
containsValue
public boolean containsValue(non_null Object value)
- Specifications: pure
-
public behavior
ensures \result <==> ( \exists java.util.Map.Entry e; this.theMap.has(e)&&e != null; org.jmlspecs.models.JMLNullSafe.equals(e.abstractValue,value));
signals_only java.lang.ClassCastException, java.lang.NullPointerException;
signals (java.lang.ClassCastException) (* if the value is not appropriate for this object *);
signals (java.lang.NullPointerException) value == null&&(* this type doesn't permit null values *);
get
public Object get(non_null Object key)
- Specifications: pure non_null
-
public normal_behavior
requires !this.containsKey(key);
ensures \result == null;
- also
-
public normal_behavior
requires this.containsKey(key);
ensures ( \exists java.util.Map.Entry e; this.theMap.has(e); e != null&&org.jmlspecs.models.JMLNullSafe.equals(e.abstractKey,key)&&\result .equals(e.abstractValue));
put
public Object put(non_null Object key,
non_null Object value)
- Specifications: non_null
-
public behavior
assignable theMap;
ensures ( \exists java.util.Map.Entry e; this.theMap.has(e); e != null&&org.jmlspecs.models.JMLNullSafe.equals(e.abstractKey,key)&&org.jmlspecs.models.JMLNullSafe.equals(e.abstractValue,value)&&\result .equals(\old(e.abstractValue)));
signals_only java.lang.NullPointerException, java.lang.UnsupportedOperationException, java.lang.ClassCastException, java.lang.IllegalArgumentException;
signals (java.lang.NullPointerException) \not_modified(value)&&(key == null)||(value == null)&&!this.containsNull;
signals (java.lang.UnsupportedOperationException) \not_modified(theMap)&&(* if the map's put operation is not supported *);
signals (java.lang.ClassCastException) \not_modified(theMap)&&(* \typeof(key) or \typeof(value) is incompatible with the valueType or keyType of this map *);
signals (java.lang.IllegalArgumentException) \not_modified(theMap)&&(* if some aspect of key or value is not allowed in the map *);
remove
public Object remove(non_null Object key)
- Specifications: non_null
-
public behavior
assignable theMap;
ensures \result != null ==> ( \exists java.util.Map.Entry e; e != null&&\old(this.theMap.has(e)); org.jmlspecs.models.JMLNullSafe.equals(e.abstractKey,key)&&\result .equals(e.abstractValue));
ensures !( \exists java.util.Map.Entry e; e != null&&\old(this.theMap.has(e)); org.jmlspecs.models.JMLNullSafe.equals(e.abstractKey,key));
signals_only java.lang.NullPointerException, java.lang.UnsupportedOperationException, java.lang.ClassCastException;
signals (java.lang.UnsupportedOperationException) (* if this operation is not supported *);
signals (java.lang.ClassCastException) (* if the argument is not appropriate *);
signals (java.lang.NullPointerException) key == null&&(* if this map doesn't support null keys *);
putAll
public void putAll(non_null Map t)
- Specifications:
-
public behavior
assignable theMap;
ensures ( \forall java.util.Map.Entry e; t.theMap.has(e); this.theMap.has(e));
signals_only java.lang.NullPointerException, java.lang.UnsupportedOperationException, java.lang.ClassCastException, java.lang.IllegalArgumentException;
signals (java.lang.NullPointerException) \not_modified(theMap)&&(t == null)&&!this.containsNull;
signals (java.lang.UnsupportedOperationException) \not_modified(theMap)&&(* if the map's put operation is not supported *);
signals (java.lang.ClassCastException) \not_modified(theMap)&&(* \typeof(t) or is incompatible with this map *);
signals (java.lang.IllegalArgumentException) \not_modified(theMap)&&(* if some aspect of a key or value is not allowed in the map *);
clear
public void clear()
- Specifications:
-
public normal_behavior
assignable theMap;
ensures this.theMap.isEmpty();
keySet
public Set keySet()
- Specifications: pure non_null
-
public normal_behavior
ensures \result != null;
ensures ( \forall java.lang.Object o; ; this.containsKey(o) <==> \result .contains(o));
values
public Collection values()
- Specifications: pure non_null
-
public normal_behavior
ensures \result != null;
ensures ( \forall java.lang.Object o; ; this.containsValue(o) <==> \result .contains(o));
entrySet
public Set entrySet()
- Specifications: pure non_null
-
public normal_behavior
ensures \result != null;
equals
public boolean equals(nullable Object o)
- Specifications: pure
- also
-
public normal_behavior
requires o instanceof java.util.Map;
ensures \result <==> this.theMap.equals(o);
- also
-
public normal_behavior
requires !(o instanceof java.util.Map);
ensures \result == false;
- Specifications inherited from overridden method equals(Object obj) in class Object:
pure -
public normal_behavior
requires obj != null;
ensures (* \result is true when obj is "equal to" this object *);
- also
-
public normal_behavior
requires this == obj;
ensures \result ;
- also
-
public code normal_behavior
requires obj != null;
ensures \result <==> this == obj;
- also
-
diverges false;
ensures obj == null ==> !\result ;
hashCode
public int hashCode()
- Specifications: pure
- Specifications inherited from overridden method in class Object:
-
public behavior
assignable objectState;
ensures (* \result is a hash code for this object *);
- also
-
public code normal_behavior
assignable \nothing;
JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.