public interface MDWSet<E> extends Set<E>, MDWCollection<E>
MDWObject
element of this Set. MDWSet
enables to:
String
using concat(String scriptName)
MDWSet
using collect(String scriptName)
MDWObject
elements of this Set based on script results:
select(String scriptName, Object value)
detect(String scriptName, Object value)
reject(String scriptName, Object value)
MDWObject
elements of this Set based on metatype using getInstances(String typeName)
MDWObject
elements of this Set using sort(String scriptName)
This interface is not intended to be implemented by clients.
DefaultMDWSet
Modifier and Type | Method and Description |
---|---|
<T> MDWList<T> |
collect(EStructuralFeature feature)
Evaluates the specified feature on each
MDWObject of this Set,
and concatenates the results into a new list. |
<T> MDWList<T> |
collect(String scriptName)
Evaluates the specified script on each
MDWObject of this Set,
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 Set,
and concatenates the results into a new list. |
String |
concat(EStructuralFeature feature)
Evaluates the specified feature on each
MDWObject of this Set,
and concatenates the results into a String . |
String |
concat(EStructuralFeature feature,
String separator)
Evaluates the specified feature on each
MDWObject of this Set,
and concatenates the results into a String . |
String |
concat(String scriptName)
Evaluates the specified script on each
MDWObject of this Set,
and concatenates the results into a String . |
String |
concat(String scriptName,
List<?> arguments)
Evaluates the specified script on each
MDWObject of this Set,
and concatenates the results into a String . |
String |
concat(String scriptName,
List<?> arguments,
String separator)
Evaluates the specified script on each
MDWObject of this Set,
and concatenates the results into a String . |
String |
concat(String scriptName,
String separator)
Evaluates the specified script on each
MDWObject of this Set,
and concatenates the results into a String . |
MDWSet<E> |
copy()
Copies all of the elements of the receiver Set to a newly created one.
|
<T extends MDWObject> |
detect(EStructuralFeature feature,
Object value)
Returns the first
MDWObject of this Set whose feature matches the specified value. |
<T extends MDWObject> |
detect(String scriptName,
List<?> arguments,
Object value)
Returns the first
MDWObject of this Set whose script evaluation result matches the specified value. |
<T extends MDWObject> |
detect(String scriptName,
Object value)
Returns the first
MDWObject of this Set whose script evaluation result matches the specified value. |
<T extends E> |
getInstances(EClass type)
Selects
MDWObject instances of this Set of the specified type. |
<T extends E> |
getInstances(EClass type,
boolean includeSubTypes)
Selects
MDWObject instances of this Set of the specified type, or one of its sub types. |
<T extends E> |
getInstances(String typeName)
Selects
MDWObject instances of this Set of the specified type. |
<T extends E> |
getInstances(String typeName,
boolean includeSubTypes)
Selects
MDWObject instances of this Set of the specified type, or one of its sub types. |
<T extends E> |
getProfiledInstances(EClass type,
String profileName)
Selects
MDWObject instances of this Set 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 Set 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 Set 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 Set of the specified type, or one of its sub types,
which match the specified profile name. |
MDWSet<E> |
reject(EStructuralFeature feature,
Object value)
Rejects
MDWObject instances of this Set whose feature does not match the specified value. |
MDWSet<E> |
reject(String scriptName,
List<?> arguments,
Object value)
Rejects
MDWObject instances of this Set whose script evaluation result does not match the specified value. |
MDWSet<E> |
reject(String scriptName,
Object value)
Rejects
MDWObject instances of this Set whose script evaluation result does not match the specified value. |
MDWSet<E> |
select(EStructuralFeature feature,
Object value)
Selects
MDWObject instances of this Set whose feature matches the specified value. |
MDWSet<E> |
select(String scriptName,
List<?> arguments,
Object value)
Selects
MDWObject instances of this Set whose script evaluation result matches the specified value. |
MDWSet<E> |
select(String scriptName,
Object value)
Selects
MDWObject instances of this Set 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.
|
MDWList<E> |
toList()
Converts this Set to a new modifiable
MDWList . |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, spliterator, toArray, toArray
parallelStream, removeIf, stream
MDWSet<E> copy()
This method is useful when you want to traverse a Set and modify its contents: you can create a copy of the original Set, loop on its elements,
and change the contents of the original Set without throwing ConcurrentModificationException
s.
String concat(String scriptName)
MDWObject
of this Set,
and concatenates the results into a String
.
This Set 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 Set contains anything else than MDWObject
instances.String concat(String scriptName, String separator)
MDWObject
of this Set,
and concatenates the results into a String
.
This Set 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 Set contains anything else than MDWObject
instances.String concat(String scriptName, List<?> arguments)
MDWObject
of this Set,
and concatenates the results into a String
.
This Set 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 Set contains anything else than MDWObject
instances.String concat(String scriptName, List<?> arguments, String separator)
MDWObject
of this Set,
and concatenates the results into a String
.
This Set 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 Set contains anything else than MDWObject
instances.String concat(EStructuralFeature feature)
MDWObject
of this Set,
and concatenates the results into a String
.
This Set 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 Set contains anything else than MDWObject
instances.String concat(EStructuralFeature feature, String separator)
MDWObject
of this Set,
and concatenates the results into a String
.
This Set 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 Set contains anything else than MDWObject
instances.MDWSet<E> select(String scriptName, Object value)
MDWObject
instances of this Set whose script evaluation result matches the specified value.
This Set 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 Set contains anything else than MDWObject
instances.detect(String, Object)
,
reject(String, Object)
MDWSet<E> select(String scriptName, List<?> arguments, Object value)
MDWObject
instances of this Set whose script evaluation result matches the specified value.
This Set 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 Set contains anything else than MDWObject
instances.detect(String, List, Object)
,
reject(String, List, Object)
MDWSet<E> select(EStructuralFeature feature, Object value)
MDWObject
instances of this Set whose feature matches the specified value.
This Set 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 Set contains anything else than MDWObject
instances.detect(EStructuralFeature, Object)
,
reject(EStructuralFeature, Object)
MDWSet<E> reject(String scriptName, Object value)
MDWObject
instances of this Set whose script evaluation result does not match the specified value.
This Set 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 does not match the specified value.ClassCastException
- if the Set contains anything else than MDWObject
instances.select(String, Object)
MDWSet<E> reject(String scriptName, List<?> arguments, Object value)
MDWObject
instances of this Set whose script evaluation result does not match the specified value.
This Set 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 does not match the specified value.ClassCastException
- if the Set contains anything else than MDWObject
instances.select(String, List, Object)
MDWSet<E> reject(EStructuralFeature feature, Object value)
MDWObject
instances of this Set whose feature does not match the specified value.
This Set 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 Set contains anything else than MDWObject
instances.select(EStructuralFeature, Object)
<T extends MDWObject> T detect(String scriptName, Object value)
MDWObject
of this Set whose script evaluation result matches the specified value.
This Set 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 Set contains anything else than MDWObject
instances.select(String, Object)
<T extends MDWObject> T detect(String scriptName, List<?> arguments, Object value)
MDWObject
of this Set whose script evaluation result matches the specified value.
This Set 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 Set contains anything else than MDWObject
instances.select(String, List, Object)
<T extends MDWObject> T detect(EStructuralFeature feature, Object value)
MDWObject
of this Set whose feature matches the specified value.
This Set 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 Set contains anything else than MDWObject
instances.<T> MDWList<T> collect(String scriptName)
MDWObject
of this Set,
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 Set 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 Set contains anything else than MDWObject
instances.<T> MDWList<T> collect(String scriptName, List<?> arguments)
MDWObject
of this Set,
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 Set 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 Set contains anything else than MDWObject
instances.<T> MDWList<T> collect(EStructuralFeature feature)
MDWObject
of this Set,
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 Set 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 Set contains anything else than MDWObject
instances.MDWList<E> sort(String scriptName)
The script is evaluated on each MDWObject
of this Set, 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 Set 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 Set 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 Set, 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 Set 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 Set 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 Set, 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 Set 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 Set contains anything else than MDWObject
instances.MDWList<E> toList()
MDWList
.MDWList
containing each element of this Set.<T extends E> MDWSet<T> getInstances(String typeName)
MDWObject
instances of this Set of the specified type.
This Set 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 collection.typeName
- the type name of model elements to retrieve.MDWObject
that matches the specified type.ClassCastException
- if the Set contains anything else than MDWObject
instances.getInstances(String, boolean)
<T extends E> MDWSet<T> getInstances(String typeName, boolean includeSubTypes)
MDWObject
instances of this Set of the specified type, or one of its sub types.
This Set 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 collection.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 Set contains anything else than MDWObject
instances.getInstances(String)
<T extends E> MDWSet<T> getInstances(EClass type)
MDWObject
instances of this Set of the specified type.
This Set 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 collection.type
- the type of model elements to retrieve.MDWObject
that matches the specified type.ClassCastException
- if the Set contains anything else than MDWObject
instances.getInstances(EClass, boolean)
<T extends E> MDWSet<T> getInstances(EClass type, boolean includeSubTypes)
MDWObject
instances of this Set of the specified type, or one of its sub types.
This Set 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 collection.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 Set contains anything else than MDWObject
instances.getInstances(EClass)
<T extends E> MDWSet<T> getProfiledInstances(String typeName, String profileName)
MDWObject
instances of this Set 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 collection.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> MDWSet<T> getProfiledInstances(String typeName, String profileName, boolean includeSubTypes)
MDWObject
instances of this Set 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 collection.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> MDWSet<T> getProfiledInstances(EClass type, String profileName)
MDWObject
instances of this Set 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 collection.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> MDWSet<T> getProfiledInstances(EClass type, String profileName, boolean includeSubTypes)
MDWObject
instances of this Set of the specified type, or one of its sub types,
which match the specified profile name.T
- the type of elements in the returned collection.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)