public interface MDWList<E> extends EList<E>, MDWCollection<E>
MDWObject
element of this list. MDWList
enables to:
String
using concat(String scriptName)
MDWList
using collect(String scriptName)
MDWObject
elements of this list based on script results:
select(String scriptName, Object value)
detect(String scriptName, Object value)
reject(String scriptName, Object value)
MDWObject
elements of this list based on metatype using getInstances(String typeName)
MDWObject
elements of this list using sort(String scriptName)
This interface is not intended to be implemented by clients.
DefaultMDWList
Modifier and Type | Method and Description |
---|---|
<T> MDWList<T> |
collect(EStructuralFeature feature)
Evaluates the specified feature on each
MDWObject of this list,
and concatenates the results into a new list. |
<T> MDWList<T> |
collect(String scriptName)
Evaluates the specified script on each
MDWObject of this list,
and concatenates the results into a new list. |
<T> MDWList<T> |
collect(String scriptName,
List<?> arguments)
Evaluates the specified script on each
MDWObject of this list,
and concatenates the results into a new list. |
String |
concat(EStructuralFeature feature)
Evaluates the specified feature on each
MDWObject of this list,
and concatenates the results into a String . |
String |
concat(EStructuralFeature feature,
String separator)
Evaluates the specified feature on each
MDWObject of this list,
and concatenates the results into a String . |
String |
concat(String scriptName)
Evaluates the specified script on each
MDWObject of this list,
and concatenates the results into a String . |
String |
concat(String scriptName,
List<?> arguments)
Evaluates the specified script on each
MDWObject of this list,
and concatenates the results into a String . |
String |
concat(String scriptName,
List<?> arguments,
String separator)
Evaluates the specified script on each
MDWObject of this list,
and concatenates the results into a String . |
String |
concat(String scriptName,
String separator)
Evaluates the specified script on each
MDWObject of this list,
and concatenates the results into a String . |
MDWList<E> |
copy()
Copies all of the elements of the receiver list to a newly created one.
|
<T extends MDWObject> |
detect(EStructuralFeature feature,
Object value)
Returns the first
MDWObject of this list whose feature matches the specified value. |
<T extends MDWObject> |
detect(String scriptName,
List<?> arguments,
Object value)
Returns the first
MDWObject of this list whose script evaluation result matches the specified value. |
<T extends MDWObject> |
detect(String scriptName,
Object value)
Returns the first
MDWObject of this list whose script evaluation result matches the specified value. |
E |
first()
Returns the first element of the list, or
null if empty. |
<T extends E> |
getInstances(EClass type)
Selects
MDWObject instances of this list of the specified type. |
<T extends E> |
getInstances(EClass type,
boolean includeSubTypes)
Selects
MDWObject instances of this list of the specified type, or one of its sub types. |
<T extends E> |
getInstances(String typeName)
Selects
MDWObject instances of this list of the specified type. |
<T extends E> |
getInstances(String typeName,
boolean includeSubTypes)
Selects
MDWObject instances of this list of the specified type, or one of its sub types. |
<T extends E> |
getProfiledInstances(EClass type,
String profileName)
Selects
MDWObject instances of this list of the specified type, which match the specified profile name. |
<T extends E> |
getProfiledInstances(EClass type,
String profileName,
boolean includeSubTypes)
Selects
MDWObject instances of this list of the specified type, or one of its sub types,
which match the specified profile name. |
<T extends E> |
getProfiledInstances(String typeName,
String profileName)
Selects
MDWObject instances of this list of the specified type, which match the specified profile name. |
<T extends E> |
getProfiledInstances(String typeName,
String profileName,
boolean includeSubTypes)
Selects
MDWObject instances of this list of the specified type, or one of its sub types,
which match the specified profile name. |
E |
last()
Returns the last element of the list, or
null if empty. |
MDWList<E> |
reject(EStructuralFeature feature,
Object value)
Rejects
MDWObject instances of this list whose feature does not match the specified value. |
MDWList<E> |
reject(String scriptName,
List<?> arguments,
Object value)
Rejects
MDWObject instances of this list whose script evaluation result does not match the specified value. |
MDWList<E> |
reject(String scriptName,
Object value)
Rejects
MDWObject instances of this list whose script evaluation result does not match the specified value. |
MDWList<E> |
reverse()
Creates a new list containing the receiver's elements in a reverse order.
|
MDWList<E> |
select(EStructuralFeature feature,
Object value)
Selects
MDWObject instances of this list whose feature matches the specified value. |
MDWList<E> |
select(String scriptName,
List<?> arguments,
Object value)
Selects
MDWObject instances of this list whose script evaluation result matches the specified value. |
MDWList<E> |
select(String scriptName,
Object value)
Selects
MDWObject instances of this list whose script evaluation result matches the specified value. |
MDWList<E> |
sort(EStructuralFeature feature)
Returns a sorted list into ascending order induced by the specified feature.
|
MDWList<E> |
sort(String scriptName)
Returns a sorted list into ascending order induced by the specified script.
|
MDWList<E> |
sort(String scriptName,
List<?> arguments)
Returns a sorted list into ascending order induced by the specified script.
|
MDWSet<E> |
toSet()
Converts this list to a new modifiable
MDWSet . |
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
parallelStream, removeIf, stream
E first()
null
if empty.null
if the list is empty.E last()
null
if empty.null
if the list is empty.MDWList<E> copy()
This method is useful when you want to traverse a list and modify its contents: you can create a copy of the original list, loop on its
elements, and change the contents of the original list without throwing ConcurrentModificationException
s.
MDWList<E> reverse()
String concat(String scriptName)
MDWObject
of this list,
and concatenates the results into a String
.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
concat
in interface MDWCollection<E>
scriptName
- the name of the script to evaluate on each MDWObject
.
This script must not expect any parameter.ClassCastException
- if the list contains anything else than MDWObject
instances.String concat(String scriptName, String separator)
MDWObject
of this list,
and concatenates the results into a String
.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
The separator is inserted between each concatenated (non empty) script result.
concat
in interface MDWCollection<E>
scriptName
- the name of the script to evaluate on each MDWObject
.
This script must not expect any parameter.separator
- a separator to insert between each concatenated script resultClassCastException
- if the list contains anything else than MDWObject
instances.String concat(String scriptName, List<?> arguments)
MDWObject
of this list,
and concatenates the results into a String
.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
The number and type of arguments must match the parameters of the script.
concat
in interface MDWCollection<E>
scriptName
- the name of the script to evaluate on each MDWObject
.arguments
- the script arguments.ClassCastException
- if the list contains anything else than MDWObject
instances.String concat(String scriptName, List<?> arguments, String separator)
MDWObject
of this list,
and concatenates the results into a String
.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
The number and type of arguments must match the parameters of the script.
The separator is inserted between each concatenated (non empty) script result.
concat
in interface MDWCollection<E>
scriptName
- the name of the script to evaluate on each MDWObject
.arguments
- the script arguments.separator
- a separator to insert between each concatenated script result.ClassCastException
- if the list contains anything else than MDWObject
instances.String concat(EStructuralFeature feature)
MDWObject
of this list,
and concatenates the results into a String
.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
concat
in interface MDWCollection<E>
feature
- the feature to evaluate on each MDWObject
.ClassCastException
- if the list contains anything else than MDWObject
instances.String concat(EStructuralFeature feature, String separator)
MDWObject
of this list,
and concatenates the results into a String
.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
The separator is inserted between each concatenated (non empty) feature result.
concat
in interface MDWCollection<E>
feature
- the feature to evaluate on each MDWObject
.separator
- a separator to insert between each concatenated script resultClassCastException
- if the list contains anything else than MDWObject
instances.MDWList<E> select(String scriptName, Object value)
MDWObject
instances of this list whose script evaluation result matches the specified value.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
scriptName
- the name of the script to evaluate on each MDWObject
.
This script must not expect any parameter.value
- the comparison criterium (can be null
).MDWObject
instances whose script result matches the specified value.ClassCastException
- if the list contains anything else than MDWObject
instances.detect(String, Object)
,
reject(String, Object)
MDWList<E> select(String scriptName, List<?> arguments, Object value)
MDWObject
instances of this list whose script evaluation result matches the specified value.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
The number and type of arguments must match the parameters of the script.
scriptName
- the name of the script to evaluate on each MDWObject
.arguments
- the script arguments.value
- the comparison criterium (can be null
).MDWObject
instances whose script result matches the specified value.ClassCastException
- if the list contains anything else than MDWObject
instances.detect(String, List, Object)
,
reject(String, List, Object)
MDWList<E> select(EStructuralFeature feature, Object value)
MDWObject
instances of this list whose feature matches the specified value.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
feature
- the feature to evaluate on each MDWObject
.value
- the comparison criterium (can be null
).MDWObject
instances whose feature matches the specified value.ClassCastException
- if the list contains anything else than MDWObject
instances.detect(EStructuralFeature, Object)
,
reject(EStructuralFeature, Object)
MDWList<E> reject(String scriptName, Object value)
MDWObject
instances of this list whose script evaluation result does not match the specified value.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
scriptName
- the name of the script to evaluate on each MDWObject
.
This script must not expect any parameter.value
- the comparison criterium (can be null
).MDWObject
instances whose script result does not match the specified value.ClassCastException
- if the list contains anything else than MDWObject
instances.select(String, Object)
MDWList<E> reject(String scriptName, List<?> arguments, Object value)
MDWObject
instances of this list whose script evaluation result does not match the specified value.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
The number and type of arguments must match the parameters of the script.
scriptName
- the name of the script to evaluate on each MDWObject
.arguments
- the script arguments.value
- the comparison criterium (can be null
).MDWObject
instances whose script result does not match the specified value.ClassCastException
- if the list contains anything else than MDWObject
instances.select(String, List, Object)
MDWList<E> reject(EStructuralFeature feature, Object value)
MDWObject
instances of this list whose feature does not match the specified value.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
feature
- the feature to evaluate on each MDWObject
.value
- the comparison criterium (can be null
).MDWObject
instances whose feature does not match the specified value.ClassCastException
- if the list contains anything else than MDWObject
instances.select(EStructuralFeature, Object)
<T extends MDWObject> T detect(String scriptName, Object value)
MDWObject
of this list whose script evaluation result matches the specified value.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
detect
in interface MDWCollection<E>
T
- the type of elements in the returned collection.scriptName
- the name of the script to evaluate on each MDWObject
.
This script must not expect any parameter.value
- the comparison criterium (can be null
).MDWObject
instances whose script result matches the specified value, null
if no instance matches
the value.ClassCastException
- if the list contains anything else than MDWObject
instances.select(String, Object)
<T extends MDWObject> T detect(String scriptName, List<?> arguments, Object value)
MDWObject
of this list whose script evaluation result matches the specified value.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
The number and type of arguments must match the parameters of the script.
detect
in interface MDWCollection<E>
T
- the type of elements in the returned collection.scriptName
- the name of the script to evaluate on each MDWObject
.arguments
- the script arguments.value
- the comparison criterium (can be null
).MDWObject
instances whose script result matches the specified value, null
if no instance matches
the value.ClassCastException
- if the list contains anything else than MDWObject
instances.select(String, List, Object)
<T extends MDWObject> T detect(EStructuralFeature feature, Object value)
MDWObject
of this list whose feature matches the specified value.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
detect
in interface MDWCollection<E>
T
- the type of elements in the returned collection.feature
- the feature to evaluate on each MDWObject
.value
- the comparison criterium (can be null
).MDWObject
instances whose feature matches the specified value, null
if no instance matches the
value.ClassCastException
- if the list contains anything else than MDWObject
instances.<T> MDWList<T> collect(String scriptName)
MDWObject
of this list,
and concatenates the results into a new list.
The returned list is always flattened: if a script result is a collection (Collection
, Map
, Iterator
or
array
), we iterate on this collection and add each element into the returned list.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
collect
in interface MDWCollection<E>
T
- the type of elements in the returned collection.scriptName
- the name of the script to evaluate on each MDWObject
.
This script must not expect any parameter.ClassCastException
- if the list contains anything else than MDWObject
instances.<T> MDWList<T> collect(String scriptName, List<?> arguments)
MDWObject
of this list,
and concatenates the results into a new list.
The returned list is always flattened: if a script result is a collection (Collection
, Map
, Iterator
or
array
), we iterate on this collection and add each element into the returned list.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
The number and type of arguments must match the parameters of the script.
collect
in interface MDWCollection<E>
T
- the type of elements in the returned collection.scriptName
- the name of the script to evaluate on each MDWObject
.arguments
- the script arguments.ClassCastException
- if the list contains anything else than MDWObject
instances.<T> MDWList<T> collect(EStructuralFeature feature)
MDWObject
of this list,
and concatenates the results into a new list.
The returned list is always flattened: if a feature is a collection, we iterate on this collection and add each element into the returned list.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
collect
in interface MDWCollection<E>
T
- the type of elements in the returned collection.feature
- the feature to evaluate on each MDWObject
.ClassCastException
- if the list contains anything else than MDWObject
instances.MDWList<E> sort(String scriptName)
The script is evaluated on each MDWObject
of this list, the script results are then used to compare elements. This sort is
guaranteed to be stable: equal elements will not be reordered as a result of the sort.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
sort
in interface MDWCollection<E>
scriptName
- the name of the script to evaluate on each MDWObject
.
This script must not expect any parameter.ClassCastException
- if the list contains anything else than MDWObject
instances,
or if the script results that are not mutually comparable (for example, strings and integers).MDWList<E> sort(String scriptName, List<?> arguments)
The script is evaluated on each MDWObject
of this list, the script results are then used to compare elements. This sort is
guaranteed to be stable: equal elements will not be reordered as a result of the sort.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
The number and type of arguments must match the parameters of the script.
sort
in interface MDWCollection<E>
scriptName
- the name of the script to evaluate on each MDWObject
.arguments
- the script arguments.ClassCastException
- if the list contains anything else than MDWObject
instances,
or if the script results that are not mutually comparable (for example, strings and integers).MDWList<E> sort(EStructuralFeature feature)
The feature is evaluated on each MDWObject
of this list, the feature results are then used to compare elements. This sort is
guaranteed to be stable: equal elements will not be reordered as a result of the sort.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
sort
in interface MDWCollection<E>
feature
- the feature to evaluate on each MDWObject
.ClassCastException
- if the list contains anything else than MDWObject
instances.MDWSet<E> toSet()
MDWSet
.MDWSet
containing each element of this list.<T extends E> MDWList<T> getInstances(String typeName)
MDWObject
instances of this list of the specified type.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
The specified type name can be a fully qualified class ("com.sodius.mdw.metamodel.uml21.Class"
for example), or a simple name (
"Class"
), if this name is unique in the metamodel.
T
- the type of elements in the returned list.typeName
- the type name of model elements to retrieve.MDWObject
that matches the specified type.ClassCastException
- if the list contains anything else than MDWObject
instances.getInstances(String, boolean)
<T extends E> MDWList<T> getInstances(String typeName, boolean includeSubTypes)
MDWObject
instances of this list of the specified type, or one of its sub types.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
The specified type name can be a fully qualified class ("com.sodius.mdw.metamodel.uml21.Class"
for example), or a simple name (
"Class"
), if this name is unique in the metamodel.
T
- the type of elements in the returned list.typeName
- the type name of model elements to retrieve.includeSubTypes
- determines whether to retrieve elements based on sub types.MDWObject
that matches the specified type, or one of its sub types.ClassCastException
- if the list contains anything else than MDWObject
instances.getInstances(String)
<T extends E> MDWList<T> getInstances(EClass type)
MDWObject
instances of this list of the specified type.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
T
- the type of elements in the returned list.type
- the type of model elements to retrieve.MDWObject
that matches the specified type.ClassCastException
- if the list contains anything else than MDWObject
instances.getInstances(EClass, boolean)
<T extends E> MDWList<T> getInstances(EClass type, boolean includeSubTypes)
MDWObject
instances of this list of the specified type, or one of its sub types.
This list is expected to contain only MDWObject
instances. A ClassCastException
is thrown if any other kind of
element is found (null
values are silently ignored).
T
- the type of elements in the returned list.type
- the type of model elements to retrieve.includeSubTypes
- determines whether to retrieve elements based on sub types.MDWObject
that matches the specified type, or one of its sub types.ClassCastException
- if the list contains anything else than MDWObject
instances.getInstances(EClass)
<T extends E> MDWList<T> getProfiledInstances(String typeName, String profileName)
MDWObject
instances of this list of the specified type, which match the specified profile name.
This method does not consider sub types of the specified type.
The specified type name can be a fully qualified class ("com.sodius.mdw.metamodel.uml21.Class"
for example), or a simple name (
"Class"
), if this name is unique in the metamodel.
T
- the type of elements in the returned list.typeName
- the type name of model elements to retrieve.profileName
- the name of the profile type the instances must match.MDWObject
that matches the specified type.InvalidCallException
- if this API is not called during an MDWorkbench evaluation.getProfiledInstances(String, String, boolean)
<T extends E> MDWList<T> getProfiledInstances(String typeName, String profileName, boolean includeSubTypes)
MDWObject
instances of this list of the specified type, or one of its sub types,
which match the specified profile name.
The specified type name can be a fully qualified class ("com.sodius.mdw.metamodel.uml21.Classifier"
for example), or a simple name
("Classifier"
), if this name is unique in the metamodel.
T
- the type of elements in the returned list.typeName
- the type name of model elements to retrieve.profileName
- the name of the profile type the instances must match.includeSubTypes
- determines whether to retrieve elements based on sub types.MDWObject
that matches the specified type, or one of its sub types.InvalidCallException
- if this API is not called during an MDWorkbench evaluation.getProfiledInstances(String, String)
<T extends E> MDWList<T> getProfiledInstances(EClass type, String profileName)
MDWObject
instances of this list of the specified type, which match the specified profile name.
This method does not consider sub types of the specified type.T
- the type of elements in the returned list.type
- the type of model elements to retrieve.profileName
- the name of the profile type the instances must match.MDWObject
that matches the specified type.InvalidCallException
- if this API is not called during an MDWorkbench evaluation.getProfiledInstances(EClass, String, boolean)
<T extends E> MDWList<T> getProfiledInstances(EClass type, String profileName, boolean includeSubTypes)
MDWObject
instances of this list of the specified type, or one of its sub types,
which match the specified profile name.T
- the type of elements in the returned list.type
- the type of model elements to retrieve.profileName
- the name of the profile type the instances must match.includeSubTypes
- determines whether to retrieve elements based on sub types.MDWObject
that matches the specified type, or one of its sub types.InvalidCallException
- if this API is not called during an MDWorkbench evaluation.getProfiledInstances(EClass, String)