| java.lang.Object org.andromda.translation.ocl.validation.OCLCollections
OCLCollections | final public class OCLCollections (Code) | | Used to translated OCL collection expressions to their corresponding Java collection expressions.
|
Method Summary | |
public static Object | any(Collection collection, Predicate predicate) Returns a random element from the collection for which the argument expression evaluates true. | public static boolean | append(List list, Object item) Appends the item to the list. | public static boolean | append(Bag collection, Object item) Appends the item to the bag. | public static Bag | asBag(Collection collection) Returns the argument as a bag. | public static Set | asOrderedSet(Collection collection) Returns the argument as an ordered set. | public static List | asSequence(Collection collection) Returns the argument as a list. | public static Set | asSet(Collection collection) Returns the argument as a set. | public static Object | at(List list, int index) Returns the element at the specified index in the argument list. | public static Collection | collect(Collection collection, Transformer transformer) Returns the collection of Objects that results from executing the transformer on each individual element in the
source collection. | public static Collection | collectNested(Collection collection) | public static int | count(Collection collection, Object item) Counts the number of occurrences of the argument item in the source collection. | public static boolean | excludes(Collection collection, Object item) Return true if the object is not an element of the collection, false otherwise. | public static boolean | excludesAll(Collection collection, Collection items) Returns true if all elements of the parameter collection are not present in the current collection, false
otherwise. | public static boolean | excluding(Collection collection, Object item) Removes all occurrences of the item in the source collection. | public static boolean | exists(Collection collection, Predicate predicate) Returns true if a predicate is true for at least one element of a collection. | public static boolean | exists(Object collection, Predicate predicate) Returns true if a predicate is true for at least one element of a collection. | public static Object | first(Object object) Returns the first element in the collection.
Parameters: object - the collection or single instance which will be converted to a collection. | public static Collection | flatten(Collection collection) Recursively flattens this collection, this method returns a Collection containing no nested Collection
instances. | public static boolean | forAll(Collection collection, Predicate predicate)
Executes every predicate for the given collectoin, if one evaluates to false this
operation returns false , otherwise true is returned. | public static boolean | forAll(Object collection, Predicate predicate)
Executes every predicate for the given collection, if one evaluates to false this
operation returns false , otherwise true is returned. | public static boolean | includes(Collection collection, Object item) Returns true if the object is an element of the collection, false otherwise. | public static boolean | includesAll(Collection collection, Collection items) Returns true if all elements of the parameter collection are present in the current collection, false otherwise. | public static boolean | including(Collection collection, Object item) | public static int | indexOf(List collection, Object item) Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not
contain this element. | public static void | insertAt(List collection, int index, Object item) Insert the item at the specified index into the collection. | public static Collection | intersection(Collection first, Collection second) Returns the collection of elements common in both argument collections. | public static boolean | isEmpty(Collection collection) Returns true if the collection contains no elements, false otherwise. | public static boolean | isEmpty(Object object) Returns true if the argument is null , false otherwise. | public static boolean | isEmpty(String string) Returns true if the argument is either null or only contains whitespace characters, false
otherwise. | public static boolean | isUnique(Collection collection, Transformer transformer) Returns true if the result of executing the transformer has a unique value for each
element in the source collection. | public static boolean | isUnique(Object collection, Transformer transformer) Returns true if the result of executing the transformer has a unique value for each
element in the source collection. | public static Collection | iterate(Collection collection) | public static Object | last(Object object) Returns the last element in the collection.
Parameters: object - the collection or single instance which will be converted to a collection. | public static boolean | notEmpty(Collection collection) Returns true if the collection contains one or more elements, false otherwise. | public static boolean | notEmpty(Object object) Returns true if the argument is not null , false otherwise. | public static boolean | notEmpty(String string) Returns true if the argument is neither null nor only contains whitespace characters, false
otherwise. | public static boolean | one(Collection collection, Predicate predicate) Returns true when the argument expression evaluates true for one and only one element in the
collection. | public static boolean | one(Object collection, Predicate predicate)
Returns true if collection is actually a Collection instance and if the
predicate expression evaluates true for one and only one element in the collection. | public static Object | prepend(List list, Object item) Insert the item into the first position of the list. | public static Collection | reject(Collection collection, Predicate predicate) Returns a subcollection of the source collection containing all elements for which the expression evaluates
false . | public static Collection | select(Collection collection, Predicate predicate) Returns a subcollection of the source collection containing all elements for which the expression evaluates
true . | public static Collection | select(Object collection, Predicate predicate) Returns a subcollection of the source collection containing all elements for which the expression evaluates
true . | public static int | size(Object object) Checks the instance of the object and makes sure its a Collection, if the object is a collection the
size is checked and returned, if its NOT a collection, 0 is returned.
Parameters: object - the object to check. | public static int | size(Collection collection) Returns the number of elements in the collection. | public static Collection | sortedBy(Collection collection) | public static Set | subOrderedSet(Set collection) | public static List | subSequence(List collection) | public static double | sum(Object collection) Returns the sum of all the element in the collection. | public static double | sum(Collection collection) Returns the sum of all the element in the collection. | public static Collection | symmetricDifference(Collection first, Collection second) Returns those element that are contained in only one of both collections. | public static Collection | union(Collection first, Collection second) Returns the union of both collections into a single collection. |
any | public static Object any(Collection collection, Predicate predicate)(Code) | | Returns a random element from the collection for which the argument expression evaluates true.
|
append | public static boolean append(List list, Object item)(Code) | | Appends the item to the list.
true if the operation was a success |
append | public static boolean append(Bag collection, Object item)(Code) | | Appends the item to the bag.
true if the operation was a success |
asBag | public static Bag asBag(Collection collection)(Code) | | Returns the argument as a bag.
|
asOrderedSet | public static Set asOrderedSet(Collection collection)(Code) | | Returns the argument as an ordered set.
|
asSequence | public static List asSequence(Collection collection)(Code) | | Returns the argument as a list.
|
at | public static Object at(List list, int index)(Code) | | Returns the element at the specified index in the argument list.
|
collect | public static Collection collect(Collection collection, Transformer transformer)(Code) | | Returns the collection of Objects that results from executing the transformer on each individual element in the
source collection.
|
count | public static int count(Collection collection, Object item)(Code) | | Counts the number of occurrences of the argument item in the source collection.
|
excludes | public static boolean excludes(Collection collection, Object item)(Code) | | Return true if the object is not an element of the collection, false otherwise.
|
excludesAll | public static boolean excludesAll(Collection collection, Collection items)(Code) | | Returns true if all elements of the parameter collection are not present in the current collection, false
otherwise.
|
excluding | public static boolean excluding(Collection collection, Object item)(Code) | | Removes all occurrences of the item in the source collection.
true if one or more elements were removed |
exists | public static boolean exists(Collection collection, Predicate predicate)(Code) | | Returns true if a predicate is true for at least one element of a collection. A null collection or predicate
returns false.
|
exists | public static boolean exists(Object collection, Predicate predicate)(Code) | | Returns true if a predicate is true for at least one element of a collection. A null collection or predicate
returns false.
|
first | public static Object first(Object object)(Code) | | Returns the first element in the collection.
Parameters: object - the collection or single instance which will be converted to a collection. the first object of the collection or the object itself if the object is not a collection instance (ornull if the object is null or an empty collection). |
flatten | public static Collection flatten(Collection collection)(Code) | | Recursively flattens this collection, this method returns a Collection containing no nested Collection
instances.
|
forAll | public static boolean forAll(Collection collection, Predicate predicate)(Code) | |
Executes every predicate for the given collectoin, if one evaluates to false this
operation returns false , otherwise true is returned. If the input collection or
closure is null false is returned.
true if every evaluated predicate returns true, false otherwise. |
forAll | public static boolean forAll(Object collection, Predicate predicate)(Code) | |
Executes every predicate for the given collection, if one evaluates to false this
operation returns false , otherwise true is returned. If the input collection or
closure is null false is returned.
true if every evaluated predicate returns true, false otherwise. |
includes | public static boolean includes(Collection collection, Object item)(Code) | | Returns true if the object is an element of the collection, false otherwise.
|
includesAll | public static boolean includesAll(Collection collection, Collection items)(Code) | | Returns true if all elements of the parameter collection are present in the current collection, false otherwise.
|
including | public static boolean including(Collection collection, Object item)(Code) | | Adds the item to the list
true if the element was added |
indexOf | public static int indexOf(List collection, Object item)(Code) | | Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not
contain this element. More formally, returns the lowest index i such that (o == null ? get(i) = =null :
o.equals(get(i))), or -1 if there is no such index.
|
insertAt | public static void insertAt(List collection, int index, Object item)(Code) | | Insert the item at the specified index into the collection.
|
isEmpty | public static boolean isEmpty(Collection collection)(Code) | | Returns true if the collection contains no elements, false otherwise.
|
isEmpty | public static boolean isEmpty(Object object)(Code) | | Returns true if the argument is null , false otherwise.
|
isEmpty | public static boolean isEmpty(String string)(Code) | | Returns true if the argument is either null or only contains whitespace characters, false
otherwise.
|
isUnique | public static boolean isUnique(Collection collection, Transformer transformer)(Code) | | Returns true if the result of executing the transformer has a unique value for each
element in the source collection.
|
isUnique | public static boolean isUnique(Object collection, Transformer transformer)(Code) | | Returns true if the result of executing the transformer has a unique value for each
element in the source collection.
|
last | public static Object last(Object object)(Code) | | Returns the last element in the collection.
Parameters: object - the collection or single instance which will be converted to a collection. the last object of the collection or the object itself if the object is not a collection instance (ornull if the object is null or an empty collection). |
notEmpty | public static boolean notEmpty(Collection collection)(Code) | | Returns true if the collection contains one or more elements, false otherwise.
|
notEmpty | public static boolean notEmpty(Object object)(Code) | | Returns true if the argument is not null , false otherwise.
|
notEmpty | public static boolean notEmpty(String string)(Code) | | Returns true if the argument is neither null nor only contains whitespace characters, false
otherwise.
|
one | public static boolean one(Collection collection, Predicate predicate)(Code) | | Returns true when the argument expression evaluates true for one and only one element in the
collection. Returns false otherwise.
|
one | public static boolean one(Object collection, Predicate predicate)(Code) | |
Returns true if collection is actually a Collection instance and if the
predicate expression evaluates true for one and only one element in the collection. Returns
false otherwise.
|
prepend | public static Object prepend(List list, Object item)(Code) | | Insert the item into the first position of the list.
the element previously at the first position |
reject | public static Collection reject(Collection collection, Predicate predicate)(Code) | | Returns a subcollection of the source collection containing all elements for which the expression evaluates
false .
|
select | public static Collection select(Collection collection, Predicate predicate)(Code) | | Returns a subcollection of the source collection containing all elements for which the expression evaluates
true .
|
select | public static Collection select(Object collection, Predicate predicate)(Code) | | Returns a subcollection of the source collection containing all elements for which the expression evaluates
true .
|
size | public static int size(Object object)(Code) | | Checks the instance of the object and makes sure its a Collection, if the object is a collection the
size is checked and returned, if its NOT a collection, 0 is returned.
Parameters: object - the object to check. the size of the collection |
size | public static int size(Collection collection)(Code) | | Returns the number of elements in the collection.
|
subOrderedSet | public static Set subOrderedSet(Set collection)(Code) | | |
sum | public static double sum(Object collection)(Code) | | Returns the sum of all the element in the collection. Every element must extend java.lang.Number or this method
will throw an exception.
Parameters: collection - a collection containing only classes extending java.lang.Number the sum of all the elements in the collection |
sum | public static double sum(Collection collection)(Code) | | Returns the sum of all the element in the collection. Every element must extend java.lang.Number or this method
will throw an exception.
Parameters: collection - a collection containing only classes extending java.lang.Number the sum of all the elements in the collection |
symmetricDifference | public static Collection symmetricDifference(Collection first, Collection second)(Code) | | Returns those element that are contained in only one of both collections.
|
|
|