ITEM
- SET
- public interface SetOf<ITEM,SET extends SetOf<ITEM,SET>> extends Verify, Iterable<ITEM>
union(SetOf)
; intersection(SetOf)
; set difference - minus(SetOf)
;
isSubsetOf(SetOf)
; isEmpty()
; membership contains(Object)
.
Also supports operation which relate to java sets such as Iterable.iterator()
, asCollection()
.
The two operations to produce sets of subsets produce java sets, these are powerSet()
and subsetsOfSize(int)
.
sameSetAs(SetOf)
implements mathematical set equality,
and
Object.equals(Object)
may be mathematical set equality or not. This is indicated by equalsIsSameSetAs()
Modifier and Type | Method and Description |
---|---|
JavaSet<? extends ITEM> |
asCollection() |
boolean |
contains(ITEM a) |
boolean |
equalsIsSameSetAs()
This indicates whether in the implementing class
the notion of equality is set equality or not.
|
int |
hashCode()
Returns the hash code value for this set.
|
SET |
intersection(SET b) |
boolean |
isEmpty() |
boolean |
isSubsetOf(SET b) |
boolean |
isSupersetOf(SET b) |
SET |
minus(ITEM b) |
SET |
minus(SET b) |
JavaSet<? extends SET> |
powerSet() |
SET |
respectingEquals()
Return a set
s such that:
s.sameSetSetAs(this) && s.equalsIsSameSetAs() . |
boolean |
sameSetAs(SET other)
This is mathematically set equality, except
for empty sets - which respect type as well.
|
int |
size() |
JavaSet<? extends SET> |
subsetsOfSize(int i) |
ITEM[] |
toArray()
An array of the members of this set.
|
SET |
union(ITEM b)
Set union with the singleton set containing
b |
SET |
union(SET b)
Set union.
|
void |
verify()
Check invariants of the object, in particular
check that
Object.hashCode() satisfies its contract. |
ITEM[] toArray()
boolean sameSetAs(SET other)
other
- boolean equalsIsSameSetAs()
OM
which defines equality as
Oriented Matroid equality which is not the same as set equality.Object.equals(Object)
and sameSetAs(SetOf)
return identical results.int hashCode()
equalsIsSameSetAs()
is true, then the
hash code of a set is defined to be the sum of the hash codes of the elements in the set,
see Set.hashCode()
.
If equalsIsSameSetAs()
is false, then the
hash code of a set is not restricted except to the general contract,
see Object.hashCode()
.hashCode
in class Object
Object.equals(Object)
,
Set.equals(Object)
SET respectingEquals()
s
such that:
s.sameSetSetAs(this) && s.equalsIsSameSetAs()
.
If equalsIsSameSetAs()
is true, then this method
should usually return this
.
If equalsIsSameSetAs()
is false, then a different
SET containing the same members is returned.SET union(ITEM b)
b
b
- The new member to be addedboolean contains(ITEM a)
int size()
boolean isSubsetOf(SET b)
boolean isSupersetOf(SET b)
boolean isEmpty()
void verify() throws AxiomViolation
Object.hashCode()
satisfies its contract.verify
in interface Verify
AxiomViolation
- if the set violates its contract.