|
ABLE 2.3.0 07/13/2005 14:21:00 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectjava.util.AbstractCollection
com.ibm.able.rules.AbleOclCollection
This class defines an OCL Collection base class, upon which OCL Bag, Sequence, Set, and OrderedSet are built.
This class is a java.util.Collection and can be used as such (methods such as add, addAll, contains, work). The class also supports OCL methods such as includes, excludes, exists, forAll. A few additional methods, such as hasExactly, hasAtMost, and so on, are thrown in for good measure.
Note that methods defined for collection subtypes are mostly implemented in here as throwing UnsupportedOperationExceptions. Each collection subtype, AbleOclSet for example, must override these methods (methods such as intersection, union and so on) as necessary.
| Field Summary | |
|---|---|
protected java.util.Collection |
myCollection
The current value of the collection. |
| Constructor Summary | |
|---|---|
AbleOclCollection()
Create a new, empty collection. |
|
AbleOclCollection(AbleOclCollection theAbleOclCollection)
Create a new collection based on the specified OCL collection. |
|
AbleOclCollection(java.util.Collection theCollection)
Create a new collection based on the specified Java collection. |
|
| Method Summary | |
|---|---|
boolean |
add(java.lang.Object theObject)
Ensures that this collection contains the specified element. |
boolean |
addAll(java.util.Collection theCollection)
Adds all of the elements in the specified collection to this collection. |
java.lang.Object |
any(AbleSelector theSelector)
Returns the first element of this collection that causes the specified selector expression to evaluate to true, if any. |
AbleOclCollection |
append(java.lang.Object theObject)
Returns a new collection that is this collection with the specified object added at the end. |
AbleOclBag |
asBag()
Returns this collection as a new Bag. |
AbleOclOrderedSet |
asOrderedSet()
Returns this collection as a new OrderedSet. |
AbleOclSequence |
asSequence()
Returns this collection as a new Sequence. |
AbleOclSet |
asSet()
Returns this collection as a new Set. |
java.lang.Object |
at(int thePosition)
Returns the element at the specified location. |
void |
clear()
Removes all elements from this collection. |
AbleOclCollection |
collect(AbleSelector theSelector)
Collects and returns the values returned when the specified expression is evaluated against each element of this collection. |
boolean |
contains(java.lang.Object theObject)
Determines whether this collection contains the specified element. |
boolean |
containsAll(java.util.Collection theCollection)
Determines whether this collection contains all of the elements in the specified collection. |
int |
count(java.lang.Object theObject)
Counts the number of times that the specified object occurs in this collection. |
AbleOclSet |
difference(AbleOclSet theSet)
Returns a new Set that is the difference of this Set and the specified Set. |
boolean |
excludes(java.lang.Object theObject)
Determines whether the specified object does not occur in this collection. |
boolean |
excludesAll(AbleOclCollection theCollection)
Determines whether all the elements of the specified collection do not occur in this collection. |
AbleOclCollection |
excluding(java.lang.Object theObject)
Returns a new collection comprised of this collection with the specified object removed. |
boolean |
exists(AbleSelector theSelector)
Determines whether at least one element of this collection causes the specified constraint expression to evaluate to true. |
java.lang.Object |
first()
Returns the first element of the collection. |
AbleOclCollection |
flatten()
Flattens the elements of this collection. |
protected static AbleOclCollection |
flatten(AbleOclCollection theOclCollection)
|
boolean |
forAll(AbleSelector theSelector)
Determines whether all of the elements of this collection cause the specified selector expression to evaluate to true. |
java.util.Collection |
getCollection()
Gets the value of the underlying collection. |
boolean |
hasAtLeast(int theNumber,
AbleSelector theSelector)
Determines whether at least the specified number of elements of this collection cause the specified constraint expression to evaluate to true. |
boolean |
hasAtMost(int theNumber,
AbleSelector theSelector)
Determines whether no more than the specified number of elements of this collection cause the specified constraint expression to evaluate to true. |
boolean |
hasBetween(int theNumberLo,
int theNumberHi,
AbleSelector theSelector)
Determines whether the number of elements of this collection that cause the specified constraint expression to evaluate to true falls within the specified range (inclusive). |
boolean |
hasExactly(int theNumber,
AbleSelector theSelector)
Determines whether the number of elements of this collection that cause the specified constraint expression to evaluate to true is exactly the specified number. |
boolean |
includes(java.lang.Object theObject)
Determines whether the specified object does occur in this collection. |
boolean |
includesAll(AbleOclCollection theCollection)
Determines whether all the elements of the specified collection occur in this collection. |
AbleOclCollection |
including(java.lang.Object theObject)
Returns a new collection comprised of this collection and the specified object. |
int |
indexOf(java.lang.Object theObject)
Returns the position of the specified element. |
AbleOclCollection |
insertAt(int thePosition,
java.lang.Object theObject)
Returns a new collection that is this collection with the specified object inserted at the specified location. |
AbleOclCollection |
intersection(AbleOclBag theBag)
Returns a new collection that is the intersection of this collection and the specified Bag. |
protected static void |
intersection(AbleOclCollection theOclCollection1,
AbleOclCollection theOclCollection2,
AbleOclCollection theResultOclCollection)
|
AbleOclSet |
intersection(AbleOclSet theSet)
Returns a new collection that is the intersection of this collection and the specified Set. |
boolean |
isEmpty()
Determines whether this collection is empty. |
boolean |
isUnique(AbleSelector theSelector)
Determines whether the specified expression evaluates to a unique value for each element of this collection. |
java.util.Iterator |
iterator()
Returns an iterator over the elements in this collection. |
java.lang.Object |
last()
Returns the last element of the collection. |
boolean |
notEmpty()
Determines whether this collection is not empty. |
boolean |
one(AbleSelector theSelector)
Determines whether one and only one of the elements of this collection cause the specified selector expression to evaluate to true. |
AbleOclCollection |
prepend(java.lang.Object theObject)
Returns a new collection that is this collection with the specified object added at the beginning. |
AbleOclSet |
product(AbleOclCollection theCollection)
Determines the cartesian product of this collection and the specified collection. |
AbleOclCollection |
reject(AbleSelector theSelector)
Creates a new collection whose elements are those of this collection that cause the specified selector expression to evaluate to false. |
boolean |
remove(java.lang.Object theObject)
Removes a single instance of the specified element from this collection. |
boolean |
removeAll(java.util.Collection theCollection)
Removes all of this collection's elements that are also contained in the specified collection. |
boolean |
retainAll(java.util.Collection theCollection)
Retains only the elements in this collection that are contained in the specified collection. |
AbleOclCollection |
select(AbleSelector theSelector)
Creates a new collection whose elements are those of this collection that cause the specified selector expression to evaluate to true. |
void |
setCollection(java.util.Collection theCollection)
Sets the value of the underlying collection to be the specified collection. |
int |
size()
Returns the number of elements in this colection. |
AbleOclOrderedSet |
subOrderedSet(int theFirstPosition,
int theLastPosition)
Returns a new OrderedSet that is a portion of this OrderedSet. |
AbleOclSequence |
subSequence(int theFirstPosition,
int theLastPosition)
Returns a new Sequence that is a portion of this Sequence. |
java.lang.Object |
sum()
Sums the elements of this collection. |
AbleOclSet |
symmetricDifference(AbleOclSet theSet)
Returns a new Set that is the symmetric difference of this Set and the specified Set. |
java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this collection. |
java.lang.Object[] |
toArray(java.lang.Object[] theObjectArray)
Returns an array containing all of the elements in this collection. |
AbleOclBag |
union(AbleOclBag theBag)
Returns a new collection that is the union of this collection and the specified Bag. |
AbleOclSequence |
union(AbleOclSequence theSequence)
Returns a new Sequence that is the union of this Sequence and the specified Sequence. |
AbleOclCollection |
union(AbleOclSet theSet)
Returns a new collection that is the union of this collection and the specified Set. |
| Methods inherited from class java.util.AbstractCollection |
|---|
toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
equals, hashCode |
| Field Detail |
protected java.util.Collection myCollection
Valid data types are:
| Constructor Detail |
public AbleOclCollection()
setCollection(Collection) method must be
called to set the value of this collection.
public AbleOclCollection(java.util.Collection theCollection)
theCollection - A Java collection upon which the new collection is
based.
public AbleOclCollection(AbleOclCollection theAbleOclCollection)
theAbleOclCollection - An OCL collection upon which the new collection is
based.
| Method Detail |
public boolean add(java.lang.Object theObject)
add in interface java.util.CollectiontheObject - An element whose presence in this collection is to be
ensured.
public boolean addAll(java.util.Collection theCollection)
addAll in interface java.util.CollectiontheCollection - A collection whose elements are to be inserted into
this collection.
public void clear()
clear in interface java.util.Collectionpublic boolean contains(java.lang.Object theObject)
contains in interface java.util.CollectiontheObject - An element whose presence in this collection is to be
tested.
public boolean containsAll(java.util.Collection theCollection)
containsAll in interface java.util.CollectiontheCollection - A collection whose elements are to be checked for
containment in this collection.
public boolean isEmpty()
isEmpty in interface java.util.Collectionpublic java.util.Iterator iterator()
iterator in interface java.util.Collectionpublic boolean remove(java.lang.Object theObject)
remove in interface java.util.CollectiontheObject - An element to be removed from this collection, if
present.
public boolean removeAll(java.util.Collection theCollection)
removeAll in interface java.util.CollectiontheCollection - A collection whose elements are to be removed from
this collection.
public boolean retainAll(java.util.Collection theCollection)
retainAll in interface java.util.CollectiontheCollection - A collection whose elements are to be retained in this
collection.
public int size()
size in interface java.util.Collectionpublic java.lang.Object[] toArray()
toArray in interface java.util.Collectionpublic java.lang.Object[] toArray(java.lang.Object[] theObjectArray)
toArray in interface java.util.CollectiontheObjectArray - The array into which the elements of this collection
are to be stored, if it is big enough; otherwise, a
new array of the same runtime type is allocated for
this purpose.
public int count(java.lang.Object theObject)
theObject - The object to look for in this collection.
public boolean excludes(java.lang.Object theObject)
theObject - The object to look for in this collection.
public boolean excludesAll(AbleOclCollection theCollection)
theCollection - A collection whose elements are to be examined for
containment in this collection.
public boolean includes(java.lang.Object theObject)
theObject - The object to look for in this collection.
public boolean includesAll(AbleOclCollection theCollection)
theCollection - A collection whose elements are to be examined for
containment in this collection.
public boolean notEmpty()
public AbleOclSet product(AbleOclCollection theCollection)
java.lang.UnsupportedOperationException - in all cases.public java.lang.Object sum()
public boolean exists(AbleSelector theSelector)
throws AbleDataException
theSelector - An encapsulated {selector variable | boolean
expression} that is to be evaluated against the
elements of this collection.
AbleDataException
public boolean forAll(AbleSelector theSelector)
throws AbleDataException
theSelector - An encapsulated {selector variable | boolean
expression} that is to be evaluated against the
elements of this collection.
AbleDataException
public boolean isUnique(AbleSelector theSelector)
throws AbleDataException
theSelector - An encapsulated {selector variable | expression} that
is to be evaluated against the elements of this
collection.
AbleDataException
public java.lang.Object any(AbleSelector theSelector)
throws AbleDataException
theSelector - An encapsulated {selector variable | boolean
expression} that is to be evaluated against the
elements of this collection.
AbleDataException
public boolean one(AbleSelector theSelector)
throws AbleDataException
theSelector - An encapsulated {selector variable | boolean
expression} that is to be evaluated against the
elements of this collection.
AbleDataException
public AbleOclCollection collect(AbleSelector theSelector)
throws AbleDataException
theSelector - An encapsulated {selector variable | expression} that
is to be evaluated against the elements of this
collection.
AbleDataException
public AbleOclCollection select(AbleSelector theSelector)
throws AbleDataException
theSelector - An encapsulated {selector variable | boolean
expression} that is to be evaluated against the
elements of this collection.
AbleDataException
public AbleOclCollection reject(AbleSelector theSelector)
throws AbleDataException
theSelector - An encapsulated {selector variable | boolean
expression} that is to be evaluated against the
elements of this collection.
AbleDataException
public boolean hasExactly(int theNumber,
AbleSelector theSelector)
throws AbleDataException
theNumber - The exact number of elements that can cause the
expression to evaluate to true.
theSelector - An encapsulated {selector variable | boolean
expression} that is to be evaluated against the
elements of this collection.
AbleDataException
public boolean hasAtLeast(int theNumber,
AbleSelector theSelector)
throws AbleDataException
theNumber - The minimum number of elements that can cause the
expression to evaluate to true.
theSelector - An encapsulated {selector variable | boolean
expression} that is to be evaluated against the
elements of this collection.
AbleDataException
public boolean hasAtMost(int theNumber,
AbleSelector theSelector)
throws AbleDataException
theNumber - The maximum number of elements that can cause the
expression to evaluate to true.
theSelector - An encapsulated {selector variable | boolean
expression} that is to be evaluated against the
elements of this collection.
AbleDataException
public boolean hasBetween(int theNumberLo,
int theNumberHi,
AbleSelector theSelector)
throws AbleDataException
theNumberLo - The minimum number of elements that can cause the
expression to evaluate to true.
theNumberHi - The maximum number of elements that can cause the
expression to evaluate to true.
theSelector - An encapsulated {selector variable | boolean
expression} that is to be evaluated against the
elements of this collection.
AbleDataExceptionpublic AbleOclBag asBag()
public AbleOclOrderedSet asOrderedSet()
public AbleOclSequence asSequence()
public AbleOclSet asSet()
public AbleOclCollection flatten()
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public AbleOclCollection including(java.lang.Object theObject)
theObject - An element to add to the new collection.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public AbleOclCollection excluding(java.lang.Object theObject)
theObject - An element to remove from the new collection.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public AbleOclCollection intersection(AbleOclBag theBag)
theBag - A collection to examine with this collection.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public AbleOclSet intersection(AbleOclSet theSet)
theSet - A collection to examine with this collection.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public AbleOclBag union(AbleOclBag theBag)
theBag - A collection to examine with this collection.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public AbleOclCollection union(AbleOclSet theSet)
theSet - A collection to examine with this collection.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public AbleOclCollection append(java.lang.Object theObject)
theObject - An element to add to the end of the new collection.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public AbleOclCollection prepend(java.lang.Object theObject)
theObject - An element to add to the beginning of the new
collection.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.
public AbleOclCollection insertAt(int thePosition,
java.lang.Object theObject)
thePosition - The location at which to insert the specified
element.
theObject - An element to insert in the new collection.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public java.lang.Object at(int thePosition)
thePosition - The location of the element to return.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public java.lang.Object first()
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public int indexOf(java.lang.Object theObject)
theObject - The element for which to search.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public java.lang.Object last()
java.lang.UnsupportedOperationException - if this collection does
not support this operation.
public AbleOclOrderedSet subOrderedSet(int theFirstPosition,
int theLastPosition)
theFirstPosition - The position of the first element to include.
theLastPosition - The position of the last element to include.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.
public AbleOclSequence subSequence(int theFirstPosition,
int theLastPosition)
theFirstPosition - The position of the first element to include.
theLastPosition - The position of the last element to include.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public AbleOclSequence union(AbleOclSequence theSequence)
theSequence - A Sequence to examine with this Sequence.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public AbleOclSet difference(AbleOclSet theSet)
theSet - A Set to examine with this Set.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public AbleOclSet symmetricDifference(AbleOclSet theSet)
theSet - A Set to examine with this Set.
java.lang.UnsupportedOperationException - if this collection does
not support this operation.public void setCollection(java.util.Collection theCollection)
theCollection - The collection that is to be the value of this
collection.
public java.util.Collection getCollection()
protected static AbleOclCollection flatten(AbleOclCollection theOclCollection)
protected static void intersection(AbleOclCollection theOclCollection1,
AbleOclCollection theOclCollection2,
AbleOclCollection theResultOclCollection)
|
ABLE 2.3.0 07/13/2005 14:21:00 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||