com.sodius.mdw.core.model
Interface MDWList<E>

All Superinterfaces:
Collection<E>, Iterable<E>, MDWCollection<E>
All Known Subinterfaces:
MDWEList<E>, TransientLinkList<E>
All Known Implementing Classes:
DefaultMDWList

public interface MDWList<E>
extends MDWCollection<E>

Provides facilities to invoke scripts on each MDWObject element of this list. MDWList enables to:

This interface is not intended to be implemented by clients.

See Also:


Method Summary
<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>
T
detect(EStructuralFeature feature, Object value)
          Returns the first MDWObject of this list whose feature matches the specified value.
<T extends MDWObject>
T
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>
T
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>
MDWList<T>
getInstances(EClass type)
          Selects MDWObject instances of this list of the specified type.
<T extends E>
MDWList<T>
getInstances(EClass type, boolean includeSubTypes)
          Selects MDWObject instances of this list of the specified type, or one of its sub types.
<T extends E>
MDWList<T>
getInstances(String typeName)
          Selects MDWObject instances of this list of the specified type.
<T extends E>
MDWList<T>
getInstances(String typeName, boolean includeSubTypes)
          Selects MDWObject instances of this list of the specified type, or one of its sub types.
<T extends E>
MDWList<T>
getProfiledInstances(EClass type, String profileName)
          Selects MDWObject instances of this list of the specified type, which match the specified profile name.
<T extends E>
MDWList<T>
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>
MDWList<T>
getProfiledInstances(String typeName, String profileName)
          Selects MDWObject instances of this list of the specified type, which match the specified profile name.
<T extends E>
MDWList<T>
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.
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

first

E first()
Returns the first element of the list, or null if empty.

Returns:
the first element, null if the list is empty.

last

E last()
Returns the last element of the list, or null if empty.

Returns:
the last element, null if the list is empty.

copy

MDWList<E> copy()
Copies all of the elements of the receiver list to a newly created one.

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 ConcurrentModificationExceptions.

Returns:
a new list containining all receiver's elements.

reverse

MDWList<E> reverse()
Creates a new list containing the receiver's elements in a reverse order.

Returns:
a new list containining all receiver's elements in a reverse order.

concat

String concat(String scriptName)
Evaluates the specified script on each 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).

Specified by:
concat in interface MDWCollection<E>
Parameters:
scriptName - the name of the script to evaluate on each MDWObject. This script must not expect any parameter.
Returns:
the concatenation the of script results.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.

concat

String concat(String scriptName,
              String separator)
Evaluates the specified script on each 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.

Specified by:
concat in interface MDWCollection<E>
Parameters:
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 result
Returns:
the concatenation the of script results.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.

concat

String concat(String scriptName,
              List<?> arguments)
Evaluates the specified script on each 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.

Specified by:
concat in interface MDWCollection<E>
Parameters:
scriptName - the name of the script to evaluate on each MDWObject.
arguments - the script arguments.
Returns:
the concatenation the of script results.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.

concat

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.

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.

Specified by:
concat in interface MDWCollection<E>
Parameters:
scriptName - the name of the script to evaluate on each MDWObject.
arguments - the script arguments.
Returns:
the concatenation the of script results.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.

concat

String concat(EStructuralFeature feature)
Evaluates the specified feature on each 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).

Specified by:
concat in interface MDWCollection<E>
Parameters:
feature - the feature to evaluate on each MDWObject.
Returns:
the concatenation the of feature results.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
Since:
MDWorkbench 3.0.0

concat

String concat(EStructuralFeature feature,
              String separator)
Evaluates the specified feature on each 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.

Specified by:
concat in interface MDWCollection<E>
Parameters:
feature - the feature to evaluate on each MDWObject.
separator - a separator to insert between each concatenated script result
Returns:
the concatenation the of feature results.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
Since:
MDWorkbench 3.0.0

select

MDWList<E> select(String scriptName,
                  Object value)
Selects 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).

Parameters:
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).
Returns:
a modifiable list containing MDWObject instances whose script result matches the specified value.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
See Also:
detect(String, Object), reject(String, Object)

select

MDWList<E> select(String scriptName,
                  List<?> arguments,
                  Object value)
Selects 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.

Parameters:
scriptName - the name of the script to evaluate on each MDWObject.
arguments - the script arguments.
value - the comparison criterium (can be null).
Returns:
a modifiable list containing MDWObject instances whose script result matches the specified value.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
See Also:
detect(String, List, Object), reject(String, List, Object)

select

MDWList<E> select(EStructuralFeature feature,
                  Object value)
Selects 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).

Parameters:
feature - the feature to evaluate on each MDWObject.
value - the comparison criterium (can be null).
Returns:
a modifiable list containing MDWObject instances whose feature matches the specified value.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
Since:
MDWorkbench 3.0.0
See Also:
detect(EStructuralFeature, Object), reject(EStructuralFeature, Object)

reject

MDWList<E> reject(String scriptName,
                  Object value)
Rejects 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).

Parameters:
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).
Returns:
a modifiable list containing MDWObject instances whose script result does not match the specified value.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
See Also:
select(String, Object)

reject

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.

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.

Parameters:
scriptName - the name of the script to evaluate on each MDWObject.
arguments - the script arguments.
Returns:
a modifiable list containing MDWObject instances whose script result does not match the specified value.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
See Also:
select(String, List, Object)

reject

MDWList<E> reject(EStructuralFeature feature,
                  Object value)
Rejects 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).

Parameters:
feature - the feature to evaluate on each MDWObject.
value - the comparison criterium (can be null).
Returns:
a modifiable list containing MDWObject instances whose feature does not match the specified value.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
Since:
MDWorkbench 3.0.0
See Also:
select(EStructuralFeature, Object)

detect

<T extends MDWObject> T detect(String scriptName,
                               Object value)
Returns the first 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).

Specified by:
detect in interface MDWCollection<E>
Parameters:
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).
Returns:
the first MDWObject instances whose script result matches the specified value, null if no instance matches the value.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
See Also:
select(String, Object)

detect

<T extends MDWObject> T detect(String scriptName,
                               List<?> arguments,
                               Object value)
Returns the first 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.

Specified by:
detect in interface MDWCollection<E>
Parameters:
scriptName - the name of the script to evaluate on each MDWObject.
arguments - the script arguments.
Returns:
the first MDWObject instances whose script result matches the specified value, null if no instance matches the value.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
See Also:
select(String, List, Object)

detect

<T extends MDWObject> T detect(EStructuralFeature feature,
                               Object value)
Returns the first 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).

Specified by:
detect in interface MDWCollection<E>
Parameters:
feature - the feature to evaluate on each MDWObject.
value - the comparison criterium (can be null).
Returns:
the first MDWObject instances whose feature matches the specified value, null if no instance matches the value.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
Since:
MDWorkbench 3.0.0

collect

<T> MDWList<T> collect(String scriptName)
Evaluates the specified script on each 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).

Specified by:
collect in interface MDWCollection<E>
Parameters:
scriptName - the name of the script to evaluate on each MDWObject. This script must not expect any parameter.
Returns:
a modifiable list containing each script result.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.

collect

<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.

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.

Specified by:
collect in interface MDWCollection<E>
Parameters:
scriptName - the name of the script to evaluate on each MDWObject.
arguments - the script arguments.
Returns:
a modifiable list containing each script result.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.

collect

<T> MDWList<T> collect(EStructuralFeature feature)
Evaluates the specified feature on each 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).

Specified by:
collect in interface MDWCollection<E>
Parameters:
feature - the feature to evaluate on each MDWObject.
Returns:
a modifiable list containing each feature result.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
Since:
MDWorkbench 3.0.0

sort

MDWList<E> sort(String scriptName)
Returns a sorted list into ascending order induced by the specified script.

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).

Specified by:
sort in interface MDWCollection<E>
Parameters:
scriptName - the name of the script to evaluate on each MDWObject. This script must not expect any parameter.
Returns:
a modifiable list containing each script result.
Throws:
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).

sort

MDWList<E> sort(String scriptName,
                List<?> arguments)
Returns a sorted list into ascending order induced by the specified script.

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.

Specified by:
sort in interface MDWCollection<E>
Parameters:
scriptName - the name of the script to evaluate on each MDWObject.
arguments - the script arguments.
Returns:
a modifiable list containing each script result.
Throws:
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).

sort

MDWList<E> sort(EStructuralFeature feature)
Returns a sorted list into ascending order induced by the specified 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).

Specified by:
sort in interface MDWCollection<E>
Parameters:
feature - the feature to evaluate on each MDWObject.
Returns:
a modifiable list containing each feature result.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
Since:
MDWorkbench 3.0.0

toSet

MDWSet<E> toSet()
Converts this list to a new modifiable MDWSet.

Returns:
a modifiable MDWSet containing each element of this list.
Since:
MDWorkbench 3.0.0

getInstances

<T extends E> MDWList<T> getInstances(String typeName)
Selects 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.

Parameters:
typeName - the type name of model elements to retrieve.
Returns:
a modifiable list of MDWObject that matches the specified type.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
See Also:
getInstances(String, boolean)

getInstances

<T extends E> MDWList<T> getInstances(String typeName,
                                      boolean includeSubTypes)
Selects 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.

Parameters:
typeName - the type name of model elements to retrieve.
includeSubTypes - determines wheter to retrieve elements based on sub types.
Returns:
a modifiable list of MDWObject that matches the specified type, or one of its sub types.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
See Also:
getInstances(String)

getInstances

<T extends E> MDWList<T> getInstances(EClass type)
Selects 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).

Parameters:
type - the type of model elements to retrieve.
Returns:
a modifiable list of MDWObject that matches the specified type.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
Since:
MDWorkbench 3.0.0
See Also:
getInstances(EClass, boolean)

getInstances

<T extends E> MDWList<T> getInstances(EClass type,
                                      boolean includeSubTypes)
Selects 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).

Parameters:
type - the type of model elements to retrieve.
includeSubTypes - determines wheter to retrieve elements based on sub types.
Returns:
a modifiable list of MDWObject that matches the specified type, or one of its sub types.
Throws:
ClassCastException - if the list contains anything else than MDWObject instances.
Since:
MDWorkbench 3.0.0
See Also:
getInstances(EClass)

getProfiledInstances

<T extends E> MDWList<T> getProfiledInstances(String typeName,
                                              String profileName)
Selects 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.

Parameters:
typeName - the type name of model elements to retrieve.
profileName - the name of the profile type the instances must match.
Returns:
a modifiable list of MDWObject that matches the specified type.
Throws:
InvalidCallException - if this API is not called during an MDWorkbench evaluation.
Since:
MDWorkbench 3.0.0
See Also:
getProfiledInstances(String, String, boolean)

getProfiledInstances

<T extends E> MDWList<T> 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.

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.

Parameters:
typeName - the type name of model elements to retrieve.
profileName - the name of the profile type the instances must match.
includeSubTypes - determines wheter to retrieve elements based on sub types.
Returns:
a modifiable list of MDWObject that matches the specified type, or one of its sub types.
Throws:
InvalidCallException - if this API is not called during an MDWorkbench evaluation.
Since:
MDWorkbench 3.0.0
See Also:
getProfiledInstances(String, String)

getProfiledInstances

<T extends E> MDWList<T> getProfiledInstances(EClass type,
                                              String profileName)
Selects 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.

Parameters:
type - the type of model elements to retrieve.
profileName - the name of the profile type the instances must match.
Returns:
a modifiable list of MDWObject that matches the specified type.
Throws:
InvalidCallException - if this API is not called during an MDWorkbench evaluation.
Since:
MDWorkbench 3.0.0
See Also:
getProfiledInstances(EClass, String, boolean)

getProfiledInstances

<T extends E> MDWList<T> 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.

Parameters:
type - the type of model elements to retrieve.
profileName - the name of the profile type the instances must match.
includeSubTypes - determines wheter to retrieve elements based on sub types.
Returns:
a modifiable list of MDWObject that matches the specified type, or one of its sub types.
Throws:
InvalidCallException - if this API is not called during an MDWorkbench evaluation.
Since:
MDWorkbench 3.0.0
See Also:
getProfiledInstances(EClass, String)