E
- the type of the elements contained in this collectionpublic final class UniqueAny<E> extends UniqueCollection<E,UniqueAny<E>>
GeneralCollection
.
Represents: unordered, unique, 0..* collection of primitives or objects
Usage:
Use the Action.collectIn(Class, Object...)
method to instantiate
this class and fill the new collection with elements. After that, the methods
of this class can be used to manage it.
Java restrictions:
See the documentation of Model
for an overview on modeling in
JtxtUML.
Action.collectIn(Class, Object...)
GeneralCollection.NonUnique<E>, GeneralCollection.Ordered<E>, GeneralCollection.Unique<E>, GeneralCollection.Unordered<E>
INFINITE_BOUND
Modifier and Type | Method and Description |
---|---|
C |
add(E element)
Returns a collection of the same type as this which contains all the
elements of this and also the specified element.
|
protected C |
clone()
This method must not be used in the model.
|
boolean |
contains(java.lang.Object element)
Tests whether the specified element is contained in this collection.
|
boolean |
equals(java.lang.Object obj) |
@External int |
getLowerBound()
Returns the lower bound of this collection, that is, the minimum number
of elements it may contain.
|
int |
getLowerBound() |
@External int |
getUpperBound()
Returns the upper bound of this collection, that is, the maximum number
of elements it may contain.
|
int |
getUpperBound() |
@External int |
hashCode()
This method must not be used in the model.
|
boolean |
isEmpty()
Tests whether this collection is empty.
|
java.util.Iterator<E> |
iterator()
This method must not be used directly in the model, only
through the use of enhanced for-loops.
|
E |
one()
Returns an element of this collection; if this collection is empty, it
results in a model error.
|
C |
remove(java.lang.Object element)
Returns a collection of the same type as this which contains all the
elements of this except the specified element.
|
int |
size()
Returns the size of this collection, that is, the number of elements
contained.
|
as, isOrdered, isUnique, toString, unbound
finalize, forEach, spliterator
@External public @External int getLowerBound()
@External public @External int getUpperBound()
GeneralCollection.INFINITE_BOUND
, which means that this
collection has no upper bound.@ExternalBody public final boolean isEmpty()
GeneralCollection
isEmpty
in class GeneralCollection<E>
true
if this is empty; false
otherwise@ExternalBody public final int size()
GeneralCollection
Non-unique collections: every element is counted as many times as they are contained.
size
in class GeneralCollection<E>
@ExternalBody public final E one()
GeneralCollection
Ordered collections: the first element is returned.
Unordered collections: an arbitrary element is returned.
one
in class GeneralCollection<E>
@ExternalBody public final boolean contains(java.lang.Object element)
GeneralCollection
Non-unique collections: tests whether the element is contained at least once
Two objects that are equal are considered to be the same element.
contains
in class GeneralCollection<E>
true
of the specified element is contained in this
collection (at least once); false
otherwise@ExternalBody public final C add(E element)
GeneralCollection
Unique collections: if the element is already contained, the action cannot be performed and therefore this collection will be returned.
Non-unique collections: if the element is already contained, it will be contained one time more.
Ordered collections: the element is added as the last one.
Two objects that are equal are considered to be the same element.
add
in class GeneralCollection<E>
@ExternalBody public final C remove(java.lang.Object element)
GeneralCollection
If the element is not contained, the action cannot be performed and therefore this collection will be returned.
Non-unique collections: if the element is contained more than once, it will be contained in the result one time less.
Non-unique, ordered collections: if the element is contained more than once, its first appearance will be removed.
Two objects that are equal are considered to be the same element.
remove
in class GeneralCollection<E>
@ExternalBody public final int getLowerBound()
@ExternalBody public final int getUpperBound()
@ExternalBody public final java.util.Iterator<E> iterator()
GeneralCollection
iterator
in interface java.lang.Iterable<E>
iterator
in class GeneralCollection<E>
@External protected final C clone()
GeneralCollection
clone
in class GeneralCollection<E>
@External public final @External int hashCode()
GeneralCollection
hashCode
in class GeneralCollection<E>
@ExternalBody public final boolean equals(java.lang.Object obj)
equals
in class GeneralCollection<E>