Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Mobile Tools for Java
Release 1.0

org.eclipse.mtj.core.project.runtime
Class MTJRuntimeList


java.lang.Object
  extended by 

java.util.AbstractCollection<E>
      extended by 

java.util.AbstractList<E>
          extended by 

java.util.ArrayList<
MTJRuntime>
              extended by 
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.

Field Summary
static  String ELEM_CONFIGURATIONS
          The metadata element for storing the list of runtimes.
 
Fields inherited from class java.util. AbstractList
modCount
 
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.
 
Method Summary
 boolean add ( MTJRuntime runtime)
          Appends the specified MTJRuntime to the end of this list.
 boolean addAll ( Collection<? extends MTJRuntime> runtimes)
          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.
 void addMTJRuntimeListChangeListener ( IMTJRuntimeListChangeListener listener)
          Adds the listener to the collection of listeners who will be notified when the runtime list state changes.
  MTJRuntime getActiveMTJRuntime ()
          Get the MTJRuntime that is currently active.
 boolean remove ( Object o)
          Removes a single instance of the specified MTJRuntime from this list, if it is present.
 boolean removeAll ( Collection<?> runtimes)
          Removes from this collection all of its MTJRuntimes that are contained in the specified collection.
 void removeMTJRuntimeListChangeListener ( IMTJRuntimeListChangeListener listener)
          Removes the listener from the collection of listeners who will be notified when the runtime state changes.
 void switchActiveMTJRuntime ( MTJRuntime runtime)
          Switch the current active MTJRuntime.
 
Methods inherited from class java.util. ArrayList
add, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util. AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util. AbstractCollection
containsAll, retainAll, toString
 
Methods inherited from class java.lang. Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util. List
containsAll, equals, hashCode, iterator, listIterator, listIterator, retainAll, subList
 

Field Detail

ELEM_CONFIGURATIONS

public static final 
String ELEM_CONFIGURATIONS
The metadata element for storing the list of runtimes.

See Also:
Constant Field Values
Constructor Detail

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

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.

Mobile Tools for Java
Release 1.0


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire