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

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

public interface MDWCollection<E>
extends Collection<E>

Provides facilities to invoke scripts on each MDWObject element of this collection. MDWCollection enables to:

This interface is not intended to be implemented by clients.

Since:
MDWorkbench 3.0.0

Method Summary
<T> MDWList<T>
collect(EStructuralFeature feature)
          Evaluates the specified feature on each MDWObject of this collection, and concatenates the results into a new list.
<T> MDWList<T>
collect(String scriptName)
          Evaluates the specified script on each MDWObject of this collection, 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 collection, and concatenates the results into a new list.
 String concat(EStructuralFeature feature)
          Evaluates the specified feature on each MDWObject of this collection, and concatenates the results into a String.
 String concat(EStructuralFeature feature, String separator)
          Evaluates the specified feature on each MDWObject of this collection, and concatenates the results into a String.
 String concat(String scriptName)
          Evaluates the specified script on each MDWObject of this collection, and concatenates the results into a String.
 String concat(String scriptName, List<?> arguments)
          Evaluates the specified script on each MDWObject of this collection, and concatenates the results into a String.
 String concat(String scriptName, List<?> arguments, String separator)
          Evaluates the specified script on each MDWObject of this collection, and concatenates the results into a String.
 String concat(String scriptName, String separator)
          Evaluates the specified script on each MDWObject of this collection, and concatenates the results into a String.
<T extends MDWObject>
T
detect(EStructuralFeature feature, Object value)
          Returns the first MDWObject of this collection whose feature matches the specified value.
<T extends MDWObject>
T
detect(String scriptName, List<?> arguments, Object value)
          Returns the first MDWObject of this collection whose script evaluation result matches the specified value.
<T extends MDWObject>
T
detect(String scriptName, Object value)
          Returns the first MDWObject of this collection 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.
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

concat

String concat(String scriptName)
Evaluates the specified script on each MDWObject of this collection, and concatenates the results into a String.

This collection 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.
Returns:
the concatenation the of script results.
Throws:
ClassCastException - if the collection contains anything else than MDWObject instances.

concat

String concat(String scriptName,
              String separator)
Evaluates the specified script on each MDWObject of this collection, and concatenates the results into a String.

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

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 collection contains anything else than MDWObject instances.

concat

String concat(String scriptName,
              List<?> arguments)
Evaluates the specified script on each MDWObject of this collection, and concatenates the results into a String.

This collection 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:
the concatenation the of script results.
Throws:
ClassCastException - if the collection contains anything else than MDWObject instances.

concat

String concat(String scriptName,
              List<?> arguments,
              String separator)
Evaluates the specified script on each MDWObject of this collection, and concatenates the results into a String.

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

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 collection contains anything else than MDWObject instances.

concat

String concat(EStructuralFeature feature)
Evaluates the specified feature on each MDWObject of this collection, and concatenates the results into a String.

This collection 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.
Returns:
the concatenation the of feature results.
Throws:
ClassCastException - if the collection contains anything else than MDWObject instances.

concat

String concat(EStructuralFeature feature,
              String separator)
Evaluates the specified feature on each MDWObject of this collection, and concatenates the results into a String.

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

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 collection contains anything else than MDWObject instances.

detect

<T extends MDWObject> T detect(String scriptName,
                               Object value)
Returns the first MDWObject of this collection whose script evaluation result matches the specified value.

This collection 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:
the first MDWObject instances whose script result matches the specified value, null if no instance matches the value.
Throws:
ClassCastException - if the collection contains anything else than MDWObject instances.

detect

<T extends MDWObject> T detect(String scriptName,
                               List<?> arguments,
                               Object value)
Returns the first MDWObject of this collection whose script evaluation result matches the specified value.

This collection 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:
the first MDWObject instances whose script result matches the specified value, null if no instance matches the value.
Throws:
ClassCastException - if the collection contains anything else than MDWObject instances.

detect

<T extends MDWObject> T detect(EStructuralFeature feature,
                               Object value)
Returns the first MDWObject of this collection whose feature matches the specified value.

This collection 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:
the first MDWObject instances whose feature matches the specified value, null if no instance matches the value.
Throws:
ClassCastException - if the collection contains anything else than MDWObject instances.

collect

<T> MDWList<T> collect(String scriptName)
Evaluates the specified script on each MDWObject of this collection, 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 collection 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.
Returns:
a modifiable list containing each script result.
Throws:
ClassCastException - if the collection contains anything else than MDWObject instances.

collect

<T> MDWList<T> collect(String scriptName,
                       List<?> arguments)
Evaluates the specified script on each MDWObject of this collection, 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 collection 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 each script result.
Throws:
ClassCastException - if the collection contains anything else than MDWObject instances.

collect

<T> MDWList<T> collect(EStructuralFeature feature)
Evaluates the specified feature on each MDWObject of this collection, 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 collection 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.
Returns:
a modifiable list containing each feature result.
Throws:
ClassCastException - if the collection contains anything else than MDWObject instances.

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 collection, 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 collection 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.
Returns:
a modifiable list containing each script result.
Throws:
ClassCastException - if the collection 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 collection, 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 collection 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 each script result.
Throws:
ClassCastException - if the collection 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 collection, 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 collection 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.
Returns:
a modifiable list containing each feature result.
Throws:
ClassCastException - if the collection contains anything else than MDWObject instances.