|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpt.ua.base.Listable<T>
pt.ua.base.Indexable<T>
pt.ua.base.Set<T>
public abstract class Set<T>
Generic set module.
invariant: Indexable
This class follows DbC(tm) methodology. Where possible, contracts are implement with JML and native's Java assert.
Constructor Summary | |
---|---|
Set()
|
Method Summary | |
---|---|
abstract void |
add(T e)
Adds an element to the set. |
abstract void |
clear()
Empties the set. |
void |
copy(Set<T> other)
Copies a set to this set (deep copy). |
abstract Set<T> |
deepClone()
Clones current list. |
boolean |
exists(T e)
Queries element e existence. |
abstract void |
remove(T e)
Removes element from the set. |
Methods inherited from class pt.ua.base.Indexable |
---|
headList, itemAt, subList, tailList, toArray, toList, toString |
Methods inherited from class pt.ua.base.Listable |
---|
isEmpty, isFull, isLimited, maxSize, size |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Set()
Method Detail |
---|
public void copy(Set<T> other)
requires: other != null
requires: !isLimited() || maxSize() >= other.size()
other
- the set to copy frompublic abstract Set<T> deepClone()
Listable
ensures: \result.size() == size()
deepClone
in class Indexable<T>
public abstract void add(T e)
requires: !isFull() || exists(e)
ensures: !isEmpty() && exists(e)
ensures: \old(exists(e)) && size() == \old(size()) ||
!\old(exists(e)) && size() == \old(size()) + 1
e
- the element to insert in setpublic abstract void remove(T e)
requires: exists(e)
ensures: !isFull()
ensures: !exists(e)
ensures: size() == \old(size()) - 1
public boolean exists(T e)
e
existence.
true
if element exists, false
otherwisepublic abstract void clear()
ensures: isEmpty()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |