public class CollectionUtil extends Object
Modifier and Type | Method and Description |
---|---|
static <E> Collection<E> |
append(Collection<E> self,
E object)
Implementation of the OCL
OrderedSet::append(object : T) : OrderedSet(T)
Sequence::append(object : T) : Sequence(T)
operations.
|
static <E> Bag<E> |
asBag(Collection<E> self)
Implementation of the OCL
Set::asBag() : Bag(T)
Bag::asBag() : Bag(T)
Sequence::asBag() : Bag(T)
operations.
|
static <E> LinkedHashSet<E> |
asOrderedSet(Collection<E> self)
Implementation of the OCL
Set::asOrderedSet() : OrderedSet(T)
Bag::asOrderedSet() : OrderedSet(T)
Sequence::asOrderedSet() : OrderedSet(T)
operations.
|
static <E> List<E> |
asSequence(Collection<E> self)
Implementation of the OCL
Set::asSequence() : Sequence(T)
Bag::asSequence() : Sequence(T)
Sequence::asSequence() : Sequence(T)
operations.
|
static <E> Set<E> |
asSet(Collection<E> self)
Implementation of the OCL
Set::asSet() : Set(T)
Bag::asSet() : Set(T)
Sequence::asSet() : Set(T)
operations.
|
static <E> E |
at(Collection<E> self,
int index)
Implementation of the OCL
OrderedSet::at(index : Integer) : T
Sequence::at(index : Integer) : T
operations.
|
static int |
count(Collection<?> self,
Object object)
Implementation of the OCL
Collection::count(object : T) : Integer
operation.
|
static <E> Bag<E> |
createNewBag()
Creates a new OCL Bag.
|
static <E> Bag<E> |
createNewBag(Collection<? extends E> c)
Creates a new OCL Bag with initial contents supplied.
|
static <E> Collection<E> |
createNewCollection(Collection<? extends E> c)
Creates a new OCL collection of the same kind and contents as the
specified prototype.
|
static <E> Collection<E> |
createNewCollection(CollectionKind kind)
Creates a new OCL Collection of the specified kind.
|
static <E> Collection<E> |
createNewCollection(CollectionKind kind,
Collection<E> c)
Creates a new OCL Collection of the specified kind.
|
static <E> Collection<E> |
createNewCollectionOfSameKind(Collection<?> c)
Creates a new, empty OCL collection of the same kind as the specified
prototype.
|
static <E> LinkedHashSet<E> |
createNewOrderedSet()
Creates a new OCL OrderedSet.
|
static <E> LinkedHashSet<E> |
createNewOrderedSet(Collection<? extends E> c)
Creates a new OCL OrderedSet with initial contents supplied.
|
static <E> List<E> |
createNewSequence()
Creates a new OCL Sequence.
|
static <E> List<E> |
createNewSequence(Collection<? extends E> c)
Creates a new OCL Sequence with initial contents supplied.
|
static <E> Set<E> |
createNewSet()
Creates a new OCL Set.
|
static <E> Set<E> |
createNewSet(Collection<? extends E> c)
Creates a new OCL Set with initial contents supplied.
|
static boolean |
equals(Collection<?> self,
Collection<?> c)
Implementation of the OCL
Set::=(set : Set(T)) : Boolean
OrderedSet::=(set : OrderedSet(T)) : Boolean
Bag::=(bag : Bag(T)) : Boolean
Sequence::=(s : Sequence(T)) : Boolean
operations.
|
static boolean |
excludes(Collection<?> self,
Object object)
Implementation of the OCL
Collection::excludes(object : T) : Boolean
operation.
|
static boolean |
excludesAll(Collection<?> self,
Collection<?> c)
Implementation of the OCL
Collection::excludesAll(c : Collection(T)) : Boolean
operation.
|
static <E> Collection<E> |
excluding(Collection<E> self,
Object object)
Implementation of the OCL
Set::excluding(object : T) : Set(T)
Bag::excluding(object : T) : Bag(T)
Sequence::excluding(object : T) : Sequence(T)
operations.
|
static <E> E |
first(Collection<E> self)
Implementation of the OCL
OrderedSet::first() : T
Sequence::first() : T
operations.
|
static Collection<?> |
flatten(Collection<?> self)
Implementation of the OCL
Set::flatten() : Set(T2)
Bag::flatten() : Bag(T2)
Sequence::flatten() : Sequence(T2)
operations.
|
static <C> C |
getFlattenedElementType(CollectionType<C,?> type)
Obtains the type of the flattened form of the specified collection type.
|
static int |
hashCode(Collection<?> c)
Computes the hash of a collection, accounting for the similar hashing of
primitive numeric values that OCL considers equal but Java does not.
|
static boolean |
includes(Collection<?> self,
Object object)
Implementation of the OCL
Collection::includes(object : T) : Boolean
operation.
|
static boolean |
includesAll(Collection<?> self,
Collection<?> c)
Implementation of the OCL
Collection::includesAll(c : Collection(T)) : Boolean
operation.
|
static <E> Collection<E> |
including(Collection<E> self,
E object)
Implementation of the OCL
Set::including(object : T) : Set(T)
Bag::including(object : T) : Bag(T)
Sequence::including(object : T) : Sequence(T)
operations.
|
static <E> Integer |
indexOf(Collection<? extends E> self,
E object)
Implementation of the OCL
OrderedSet::indexOf(object : T) : Integer
Sequence::indexOf(object : T) : Integer
operations.
|
static <E> Collection<E> |
insertAt(Collection<E> self,
int index,
E object)
Implementation of the OCL
OrderedSet::insertAt(index : Integer, object : T) : OrderedSet(T)
Sequence::insertAt(index : Integer, object : T) : Sequence(T)
operations.
|
static <E> Collection<E> |
intersection(Collection<? extends E> self,
Collection<? extends E> c)
Implementation of the OCL
Set::intersection(set : Set(T)) : Set(T)
Set::intersection(bag : Bag(T)) : Set(T)
Bag::intersection(set : Set(T)) : Set(T)
Bag::intersection(bag : Bag(T)) : Set(T)
operations.
|
static boolean |
isEmpty(Collection<?> self)
Implementation of the OCL
Collection::isEmpty() : Boolean
operation.
|
static <E> E |
last(Collection<E> self)
Implementation of the OCL
OrderedSet::lset() : T
Sequence::lset() : T
operations.
|
static Object |
max(Collection<?> self)
Implementation of the OCL
Collection::max() : T
operation.
|
static Object |
min(Collection<?> self)
Implementation of the OCL
Collection::min() : T
operation.
|
static <E> Set<E> |
minus(Set<? extends E> self,
Set<? extends E> set)
Implementation of the OCL
Set::-(set : Set(T)) : Set(T)
operation.
|
static boolean |
notEmpty(Collection<?> self)
Implementation of the OCL
Collection::notEmpty() : Boolean
operation.
|
static <E> Collection<E> |
prepend(Collection<E> self,
E object)
Implementation of the OCL
OrderedSet::prepend(object : T) : OrderedSet(T)
Sequence::prepend(object : T) : Sequence(T)
operations.
|
static <PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> |
product(EvaluationEnvironment<C,O,P,CLS,E> evalEnv,
Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> env,
Collection<?> self,
Collection<?> c,
C tupleType)
Implementation of the OCL
Collection::product(c : Collection(T2)) : Set(Tuple(first : T, second : T2))
operations.
|
static <E> Collection<E> |
subOrderedSet(Collection<E> self,
int lower,
int upper)
Implementation of the OCL
OrderedSet::subOrderedSet(lower : Integer, upper : Integer) : OrderedSet(T)
operation.
|
static <E> Collection<E> |
subSequence(Collection<E> self,
int lower,
int upper)
Implementation of the OCL
Sequence::subSequence(lower : Integer, upper : Integer) : Sequence(T)
operation.
|
static Object |
sum(Collection<?> self)
Implementation of the OCL
Collection::sum() : T
operation.
|
static <E> Set<E> |
symmetricDifference(Set<? extends E> self,
Set<? extends E> set)
Implementation of the OCL
Set::symmetricDifference(set : Set(T)) : Set(T)
operation.
|
static String |
toString(Collection<?> c)
Computes the string representation of a collection value using syntax
like OCL's collection literals (e.g., OrderedSet{...}) instead
of Java's default (i.e., [...]).
|
static <E> Collection<E> |
union(Collection<? extends E> self,
Collection<? extends E> c)
Implementation of the OCL
Set::union(set : Set(T)) : Set(T)
Set::union(bag : Bag(T)) : Bag(T)
Bag::union(set : Set(T)) : Bag(T)
Bag::union(bag : Bag(T)) : Bag(T)
Sequence::union(s : Sequence(T)) : Sequence(T)
operations.
|
public static boolean includes(Collection<?> self, Object object)
self
- the source collectionobject
- an objectpublic static boolean excludes(Collection<?> self, Object object)
self
- the source collectionobject
- an objectpublic static int count(Collection<?> self, Object object)
self
- the source collectionobject
- an objectpublic static boolean includesAll(Collection<?> self, Collection<?> c)
self
- the source collectionc
- another collectionpublic static boolean excludesAll(Collection<?> self, Collection<?> c)
self
- the source collectionc
- another collectionpublic static boolean isEmpty(Collection<?> self)
self
- the source collectionpublic static Object max(Collection<?> self)
self
- the source collectionpublic static Object min(Collection<?> self)
self
- the source collectionpublic static boolean notEmpty(Collection<?> self)
self
- the source collectionpublic static Object sum(Collection<?> self)
self
- the source collectionpublic static boolean equals(Collection<?> self, Collection<?> c)
self
- the source collectionc
- another collection of the same kindpublic static int hashCode(Collection<?> c)
c
- a collectionpublic static <E> Collection<E> intersection(Collection<? extends E> self, Collection<? extends E> c)
self
- the source set or bagc
- another set or bagpublic static <E> Collection<E> union(Collection<? extends E> self, Collection<? extends E> c)
self
- the source collectionc
- another collectionpublic static Collection<?> flatten(Collection<?> self)
self
- the source collectionpublic static <C> C getFlattenedElementType(CollectionType<C,?> type)
type
- a collection typepublic static <E> Set<E> minus(Set<? extends E> self, Set<? extends E> set)
self
- the source setset
- another setpublic static <E> Collection<E> excluding(Collection<E> self, Object object)
self
- the source collectionobject
- an objectpublic static <E> Set<E> symmetricDifference(Set<? extends E> self, Set<? extends E> set)
self
- the source setset
- another setpublic static <E> Collection<E> including(Collection<E> self, E object)
self
- the source collectionobject
- an objectpublic static <E> Set<E> asSet(Collection<E> self)
self
- the source collectionpublic static <E> Bag<E> asBag(Collection<E> self)
self
- the source collectionpublic static <E> List<E> asSequence(Collection<E> self)
self
- the source collectionpublic static <E> LinkedHashSet<E> asOrderedSet(Collection<E> self)
self
- the source collectionpublic static <PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> Set<Tuple<O,P>> product(EvaluationEnvironment<C,O,P,CLS,E> evalEnv, Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> env, Collection<?> self, Collection<?> c, C tupleType)
evalEnv
- the current evaluation environment (for construction of
tuples)env
- the current OCL environment (for introspection of the tuple type)self
- the source collectionc
- another collectionpublic static <E> Collection<E> append(Collection<E> self, E object)
self
- the source collectionobject
- an objectpublic static <E> Collection<E> prepend(Collection<E> self, E object)
self
- the source collectionobject
- an objectpublic static <E> Collection<E> insertAt(Collection<E> self, int index, E object)
self
- the source collectionindex
- the 1-based (in OCL fashion) indexobject
- an objectIndexOutOfBoundsException
- if the index is out of boundspublic static <E> Collection<E> subOrderedSet(Collection<E> self, int lower, int upper)
self
- the source setlower
- the 1-based (in OCL fashion) inclusive lower boundupper
- the 1-based (in OCL fashion) inclusive upper boundIndexOutOfBoundsException
- if an index is out of boundsIllegalArgumentException
- if the lower bound is greater than the upperpublic static <E> Collection<E> subSequence(Collection<E> self, int lower, int upper)
self
- the source sequencelower
- the 1-based (in OCL fashion) inclusive lower boundupper
- the 1-based (in OCL fashion) inclusive upper boundIndexOutOfBoundsException
- if an index is out of boundsIllegalArgumentException
- if the lower bound is greater than the upperpublic static <E> E at(Collection<E> self, int index)
self
- the source collectionindex
- the 1-based (in OCL fashion) indexIndexOutOfBoundsException
- if the index is out of boundspublic static <E> E first(Collection<E> self)
self
- the source collectionpublic static <E> E last(Collection<E> self)
self
- the source collectionpublic static <E> Integer indexOf(Collection<? extends E> self, E object)
self
- the source collectionobject
- an objectpublic static <E> Set<E> createNewSet()
public static <E> Set<E> createNewSet(Collection<? extends E> c)
public static <E> Bag<E> createNewBag()
public static <E> Bag<E> createNewBag(Collection<? extends E> c)
public static <E> LinkedHashSet<E> createNewOrderedSet()
public static <E> LinkedHashSet<E> createNewOrderedSet(Collection<? extends E> c)
public static <E> List<E> createNewSequence()
public static <E> List<E> createNewSequence(Collection<? extends E> c)
public static <E> Collection<E> createNewCollectionOfSameKind(Collection<?> c)
c
- a collectionc
public static <E> Collection<E> createNewCollection(Collection<? extends E> c)
c
- a collectionc
public static <E> Collection<E> createNewCollection(CollectionKind kind)
kind
- the OCL collection kindpublic static <E> Collection<E> createNewCollection(CollectionKind kind, Collection<E> c)
kind
- the OCL collection kindc
- the contents of the new collectionkind
, containing
the same elements as c
public static String toString(Collection<?> c)
c
- a collection (not null
)Copyright © 2005, 2018 IBM Corporation and others. All Rights Reserved.