|
|
|
|
org.eclipse.mtj.core.project.runtime
Class MTJRuntimeList
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<
MTJRuntime>
org.eclipse.mtj.core.project.runtime.MTJRuntimeList
-
All Implemented Interfaces:
-
Serializable,
Cloneable,
Iterable<
MTJRuntime>,
Collection<
MTJRuntime>,
List<
MTJRuntime>,
RandomAccess
-
public class MTJRuntimeList
- extends
ArrayList<
MTJRuntime>
This class is used to maintains the list of runtimes for MTJ project. Each
MTJ project have one instance of this class. We retrieve the instance by
IMTJProject.getRuntimeList() .
Each MTJRuntimeList is stored in the metadata file available in the project
this list belongs to.
Bellow is a sample on the structure of a MTJRuntimeList stored in a metadata
file.
<configurations>
<configuration active="true" name="Config1">
...
</configuration>
<configuration active="false" name="Config2">
...
</configuration>
<configuration active="false" name="Config3">
...
</configuration>
</configurations>
-
Since:
- 1.0
-
See Also:
-
MTJRuntime ,
Serialized Form
-
Restriction:
- This class is not intended to be subclassed by clients.
-
Restriction:
- This class is not intended to be instantiated by clients.
Constructor Summary
|
MTJRuntimeList
()
Creates a new instance of MTJRuntimeList. |
MTJRuntimeList
(
Element runtimeListElement)
Creates a new MTJRuntimeList from the metadata available in the project
holding this list of runtimes. |
Methods inherited from class java.util.
ArrayList
|
add,
addAll,
clear,
clone,
contains,
ensureCapacity,
get,
indexOf,
isEmpty,
lastIndexOf,
remove,
removeRange,
set,
size,
toArray,
toArray,
trimToSize
|
ELEM_CONFIGURATIONS
public static final
String ELEM_CONFIGURATIONS
- The metadata element for storing the list of runtimes.
-
See Also:
-
Constant Field Values
MTJRuntimeList
public MTJRuntimeList()
- Creates a new instance of MTJRuntimeList. This is an empty runtime list
with no runtime configured yet.
MTJRuntimeList
public MTJRuntimeList(
Element runtimeListElement)
throws
PersistenceException
- Creates a new MTJRuntimeList from the metadata available in the project
holding this list of runtimes.
We try to read the runtimes from the DOM element retrieved from the
project metadata and put them into the runtime list.
-
Parameters:
-
runtimeListElement - The DOM element containing the runtime data
(the
ELEM_CONFIGURATIONS XML element).
-
Throws:
-
PersistenceException
- if fails to create a runtime persisted in
the metadata.
add
public boolean add(
MTJRuntime runtime)
- Appends the specified MTJRuntime to the end of this list.
This method notifies all listeners after adding the MTJRuntime, through
the invocation of
IMTJRuntimeListChangeListener.mtjRuntimeAdded(AddMTJRuntimeEvent)
.
-
-
Specified by:
-
add
in interface
Collection<
MTJRuntime>
-
Specified by:
-
add
in interface
List<
MTJRuntime>
-
Overrides:
-
add
in class
ArrayList<
MTJRuntime>
-
-
Parameters:
-
runtime - MTJRuntime to be appended to this list.
-
Returns:
-
true (as per the general contract of Collection.add).
-
See Also:
-
ArrayList.add(java.lang.Object)
addAll
public boolean addAll(
Collection<? extends
MTJRuntime> runtimes)
throws
NullPointerException
- Appends all of the MTJRuntimes in the specified Collection to the end of
this list, in the order that they are returned by the specified
Collection's Iterator.
This method notifies all listeners after adding each MTJRuntime, through
the invocation of
IMTJRuntimeListChangeListener.mtjRuntimeAdded(AddMTJRuntimeEvent)
.
-
-
Specified by:
-
addAll
in interface
Collection<
MTJRuntime>
-
Specified by:
-
addAll
in interface
List<
MTJRuntime>
-
Overrides:
-
addAll
in class
ArrayList<
MTJRuntime>
-
-
Parameters:
-
runtimes - the MTJRuntimes to be inserted into this list.
-
Returns:
-
true if this list changed as a result of the call.
-
Throws:
-
NullPointerException
- if the specified collection is
null . -
See Also:
-
ArrayList.addAll(java.util.Collection)
addMTJRuntimeListChangeListener
public void addMTJRuntimeListChangeListener(
IMTJRuntimeListChangeListener listener)
- Adds the listener to the collection of listeners who will be notified
when the runtime list state changes. The listener is notified by invoking
one of methods defined in the
IMTJRuntimeListChangeListener
interface.
-
-
Parameters:
-
listener - the listener that should be notified when the state of
the runtime list changes.
getActiveMTJRuntime
public
MTJRuntime getActiveMTJRuntime()
- Get the MTJRuntime that is currently active.
If no runtime is active this method will return null .
-
-
Returns:
- the MTJRuntime that is currently active or
null in
no active runtime could be found.
remove
public boolean remove(
Object o)
- Removes a single instance of the specified MTJRuntime from this list, if
it is present.
This method notifies all listeners after removing the MTJRuntime, through
the invocation of
IMTJRuntimeListChangeListener.mtjRuntimeRemoved(RemoveMTJRuntimeEvent)
.
-
-
Specified by:
-
remove
in interface
Collection<
MTJRuntime>
-
Specified by:
-
remove
in interface
List<
MTJRuntime>
-
Overrides:
-
remove
in class
ArrayList<
MTJRuntime>
-
-
Parameters:
-
o - MTJRuntime to be removed from this list, if present.
-
Returns:
-
true if the list contained the specified MTJRuntime.
-
See Also:
-
ArrayList.remove(java.lang.Object)
removeAll
public boolean removeAll(
Collection<?> runtimes)
- Removes from this collection all of its MTJRuntimes that are contained in
the specified collection.
This method notifies all listeners after removing each MTJRuntime,
through the invocation of
IMTJRuntimeListChangeListener.mtjRuntimeRemoved(RemoveMTJRuntimeEvent)
.
-
-
Specified by:
-
removeAll
in interface
Collection<
MTJRuntime>
-
Specified by:
-
removeAll
in interface
List<
MTJRuntime>
-
Overrides:
-
removeAll
in class
AbstractCollection<
MTJRuntime>
-
-
Parameters:
-
runtimes - MTJRuntimes to be removed from this collection.
-
Returns:
-
true if this collection changed as a result of the call.
-
Throws:
-
NullPointerException
- if the specified collection is
null . -
See Also:
-
AbstractCollection.removeAll(java.util.Collection)
removeMTJRuntimeListChangeListener
public void removeMTJRuntimeListChangeListener(
IMTJRuntimeListChangeListener listener)
- Removes the listener from the collection of listeners who will be
notified when the runtime state changes.
Note:Since instance of MTJRuntime have a long life cycle (as long
as the MTJ project), clients should remove listener manually when it no
longer used.
-
-
Parameters:
-
listener - the listener that should no longer be notified when the
state of the runtime list changes.
switchActiveMTJRuntime
public void switchActiveMTJRuntime(
MTJRuntime runtime)
- Switch the current active MTJRuntime.
-
-
Parameters:
-
runtime - MTJRuntime to be set as the active one.
|
|
|