com.ibm.jdg2e.simplemodel.internal
Class RoadTrip

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.ArrayList
              extended bycom.ibm.jdg2e.simplemodel.internal.RoadTrip
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, IRoadTrip, java.util.List, java.util.RandomAccess, java.io.Serializable

public class RoadTrip
extends java.util.ArrayList
implements IRoadTrip

Represents a domain specific model. Although simple in its implementation, it does contain content at the start, can have Location s added and removed, and will report content changes at a high level.

Access to the model is intended to be done using the associated plug-in.

See Also:
SimpleModel.getRoadTrip(), Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.AbstractList
 
Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Fields inherited from interface com.ibm.jdg2e.simplemodel.core.IRoadTrip
LISTADD, LISTREMOVE
 
Constructor Summary
RoadTrip()
          Initializes the road trip data when the object is created.
 
Method Summary
 ILocation addLocation(java.lang.String name, java.lang.String activity, int political)
          Create a Location in the RoadTrip.
 void addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
          Add a property change listener.
(package private)  void firePropertyChange(java.lang.String changeId, java.lang.Object oldValue, java.lang.Object newValue)
          Fires a property change event object to all registered listeners.
 java.lang.Object[] getLocations()
          Returns the model content in the form of an array.
 void removeLocation(ILocation location)
          The referenced Location is removed.
 void removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
          Removes a property change listener.
 void resetList()
          Creates an initial set of Location object instances in the RoadTrip.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, 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, remove, removeAll, 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, remove, removeAll, retainAll, subList
 

Constructor Detail

RoadTrip

public RoadTrip()
Initializes the road trip data when the object is created.

See Also:
SimpleModel.getRoadTrip()
Method Detail

addLocation

public ILocation addLocation(java.lang.String name,
                             java.lang.String activity,
                             int political)
Create a Location in the RoadTrip. If nulls are passed default values are used.

Specified by:
addLocation in interface IRoadTrip
Parameters:
name - name for new object instance
activity - description for activity
political - identifier for political unit
Returns:
ILocation the model object that was added.
See Also:
IRoadTrip.addLocation(java.lang.String, java.lang.String, int)

addPropertyChangeListener

public void addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
Add a property change listener. This simple change listener is used to identify changes to RoadTrip content (adds/removes). It does not report attribute changes to ILocation.

Specified by:
addPropertyChangeListener in interface IRoadTrip
Parameters:
listener -

firePropertyChange

void firePropertyChange(java.lang.String changeId,
                        java.lang.Object oldValue,
                        java.lang.Object newValue)
Fires a property change event object to all registered listeners. These events are sent on the UI thread.

Parameters:
changeId - - Type of change: LISTADD or LISTREMOVE
oldValue - - null for LISTADD, Removed Location for LISTREMOVE
newValue - - null for LISTREMOVE, Added Location for LISTADD

getLocations

public java.lang.Object[] getLocations()
Returns the model content in the form of an array. Intended to support the needs of the content provider getElements() method.

Specified by:
getLocations in interface IRoadTrip
Returns:
Object[] - an array of ILocation

removeLocation

public void removeLocation(ILocation location)
The referenced Location is removed.

Specified by:
removeLocation in interface IRoadTrip
Parameters:
location -

removePropertyChangeListener

public void removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
Removes a property change listener.

Specified by:
removePropertyChangeListener in interface IRoadTrip
Parameters:
listener -

resetList

public void resetList()
Creates an initial set of Location object instances in the RoadTrip.

Specified by:
resetList in interface IRoadTrip