|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jmlspecs.models.JMLValueSetSpecs
org.jmlspecs.models.JMLValueSet
Sets of values. This type uses ".equals" to compare elements, and clones elements that are passed into and returned from the set's methods.
For the purposes of informal specification in the methods below, we assume there is a model field
public model mathematical_set theSet;that you can think of as a mathematical set of values.
JMLCollection,
JMLType,
JMLEqualsSet,
JMLObjectSet,
JMLValueSetEnumerator,
JMLValueSetSpecs,
JMLObjectBag,
JMLEqualsBag,
JMLValueBag| Field Summary | |
static JMLValueSet |
EMPTY
The empty JMLValueSet. |
protected int |
size
The number of elements in this set. |
protected JMLListValueNode |
the_list
An equational specification of the properties of sets. |
| Constructor Summary | |
|
JMLValueSet()
Initialize this to be an empty set. |
protected |
JMLValueSet(JMLListValueNode ls)
Initialize this set with the given list. |
protected |
JMLValueSet(JMLListValueNode ls,
int sz)
Initialize this set with the given instance variables. |
|
JMLValueSet(JMLType e)
Initialize this to be a singleton set containing the given element. |
| Method Summary | |
JMLType |
choose()
Return an arbitrary element of this. |
Object |
clone()
Return a clone of this object. |
boolean |
containsAll(Collection c)
Tell whether, for each element in the given collection, there is a ".equals" element in this set. |
static JMLValueSet |
convertFrom(Collection c)
Return the set containing all the value in the given collection. |
static JMLValueSet |
convertFrom(JMLCollection c)
Return the set containing all the value in the given JMLCollection. |
static JMLValueSet |
convertFrom(JMLType[] a)
Return the set containing all the elements in the given array. |
JMLValueSet |
difference(JMLValueSet s2)
Returns a new set that contains all the elements that are in this but not in the given argument. |
JMLValueSetEnumerator |
elements()
Returns an Enumeration over this set. |
boolean |
equals(Object s2)
Test whether this object's value is equal to the given argument. |
protected JMLValueSet |
fast_insert(JMLType elem)
Returns a new set that contains all the elements of this and also the given argument, assuming the argument is not in the set. |
boolean |
has(JMLType elem)
Is the argument ".equals" to one of the values in theSet. |
int |
hashCode()
Return a hash code for this object. |
JMLValueSet |
insert(JMLType elem)
Returns a new set that contains all the elements of this and also the given argument. |
int |
int_size()
Tells the number of elements in the set. |
JMLValueSet |
intersection(JMLValueSet s2)
Returns a new set that contains all the elements that are in both this and the given argument. |
boolean |
isEmpty()
Is the set empty. |
boolean |
isProperSubset(JMLValueSet s2)
Tells whether this set is a subset of but not equal to the argument. |
boolean |
isProperSuperset(JMLValueSet s2)
Tells whether this set is a superset of but not equal to the argument. |
boolean |
isSubset(JMLValueSet s2)
Tells whether this set is a subset of or equal to the argument. |
boolean |
isSuperset(JMLValueSet s2)
Tells whether this set is a superset of or equal to the argument. |
JMLIterator |
iterator()
Returns an Iterator over this set. |
JMLValueSet |
powerSet()
Returns a new set that is the set of all subsets of this. |
JMLValueSet |
remove(JMLType elem)
Returns a new set that contains all the elements of this except for the given argument. |
static JMLValueSet |
singleton(JMLType e)
Return the singleton set containing the given element. |
JMLType[] |
toArray()
Return a new array containing all the elements of this. |
JMLValueBag |
toBag()
Return a new JMLValueBag containing all the elements of this. |
JMLValueSequence |
toSequence()
Return a new JMLValueSequence containing all the elements of this. |
String |
toString()
Return a string representation of this object. |
JMLValueSet |
union(JMLValueSet s2)
Returns a new set that contains all the elements that are in either this or the given argument. |
| Methods inherited from class org.jmlspecs.models.JMLValueSetSpecs |
has |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jmlspecs.models.JMLCollection |
has |
| Field Detail |
protected final JMLListValueNode the_list
protected final int size
public static final JMLValueSet EMPTY
JMLValueSet()| Constructor Detail |
public JMLValueSet()
EMPTYpublic JMLValueSet(JMLType e)
singleton(org.jmlspecs.models.JMLType)
protected JMLValueSet(JMLListValueNode ls,
int sz)
protected JMLValueSet(JMLListValueNode ls)
| Method Detail |
public static JMLValueSet singleton(JMLType e)
JMLValueSet(JMLType)public static JMLValueSet convertFrom(JMLType[] a)
public static JMLValueSet convertFrom(Collection c)
throws ClassCastException
ClassCastException - if some element in c is not an instance of
JMLType.containsAll(java.util.Collection)
public static JMLValueSet convertFrom(JMLCollection c)
throws ClassCastException
ClassCastException - if some element in c is not an instance of
JMLType.public boolean has(JMLType elem)
public boolean containsAll(Collection c)
c - the collection whose elements are sought.isSuperset(JMLValueSet),
convertFrom(java.util.Collection)public boolean equals(Object s2)
JMLType
equals in interface JMLTypeequals in class Objectpublic int hashCode()
hashCode in interface JMLTypehashCode in class Objectpublic boolean isEmpty()
int_size(),
has(JMLType)public int int_size()
int_size in interface JMLCollectionpublic boolean isSubset(JMLValueSet s2)
isProperSubset(JMLValueSet),
isSuperset(JMLValueSet)public boolean isProperSubset(JMLValueSet s2)
isSubset(JMLValueSet),
isProperSuperset(JMLValueSet)public boolean isSuperset(JMLValueSet s2)
isProperSuperset(JMLValueSet),
isSubset(JMLValueSet),
containsAll(java.util.Collection)public boolean isProperSuperset(JMLValueSet s2)
isSuperset(JMLValueSet),
isProperSubset(JMLValueSet)
public JMLType choose()
throws JMLNoSuchElementException
JMLNoSuchElementException - if this is empty.isEmpty(),
elements()public Object clone()
clone in interface JMLTypeclone in class JMLValueSetSpecs
public JMLValueSet insert(JMLType elem)
throws IllegalStateException
IllegalStateExceptionhas(JMLType),
remove(JMLType)protected JMLValueSet fast_insert(JMLType elem)
insert(JMLType)public JMLValueSet remove(JMLType elem)
has(JMLType),
insert(JMLType)public JMLValueSet intersection(JMLValueSet s2)
union(JMLValueSet),
difference(JMLValueSet)
public JMLValueSet union(JMLValueSet s2)
throws IllegalStateException
IllegalStateExceptionintersection(JMLValueSet),
difference(JMLValueSet)public JMLValueSet difference(JMLValueSet s2)
union(JMLValueSet),
difference(JMLValueSet)
public JMLValueSet powerSet()
throws IllegalStateException
IllegalStateExceptionpublic JMLValueBag toBag()
toSequence()public JMLValueSequence toSequence()
toBag(),
toArray()public JMLType[] toArray()
toSequence()public JMLValueSetEnumerator elements()
iterator()public JMLIterator iterator()
iterator in interface JMLCollectionelements()public String toString()
toString in class Object
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||