Real-Time Java AOCS Framework v1.0 API Specification

RtjAocsFramework.ObjectList
Class ObjectList

java.lang.Object
  |
  +--RtjAocsFramework.BasicObjects.RootObject
        |
        +--RtjAocsFramework.BasicObjects.AocsObject
              |
              +--RtjAocsFramework.ObjectList.ObjectList
All Implemented Interfaces:
Configurable, Resettable, Telemeterable
Direct Known Subclasses:
AocsDataList, AocsObjectList, ChangeListenerList, ChangeObjectList, ConfigurationListenerList, ConsistencyCheckableList, ControllerList, FailureListenerList, ManoeuvreList, ManoeuvreListenerList, ModeListenerList, MonitoringCheckList, PropertyMonitorList, ReconfigurableList, ReconfigurationListenerList, RecoveryListenerList, SystemListenerList, TelecommandList, TelecommandListenerList, TelemeterableList, UnitCommandList, UnitFunctionalList, UnitHousekeepingList, UnitList

public class ObjectList
extends AocsObject

Encapsulation of a list of untyped objects. This class manages a set of objects of generic type Object. Objects can be added and removed from the set dynamically. Operations are provided to iterate through the items in the repository.

This class should not be directly used in the framework because it is not type-safe. It is only provided as a basis upon which type-safe repositories can be built by derivation.

This class implements a very straightforward linear search algorithm to identify empty slots when new objects are inserted or to located a specific object in the list.

Change Record:

Copyright: see the Copyright Notice.

Version:
1.1
Author:
Alessandro Pasetti (University of Konstanz)

Field Summary
 
Fields inherited from interface RtjAocsFramework.TelemetryManagement.Telemeterable
DEBUG_TM, LONG_TM, NORMAL_TM, NTMFORMATS, SHORT_TM
 
Constructor Summary
protected ObjectList()
          Construct (without initializing) the list.
 
Method Summary
protected  int addObject(Object newObject)
          Add one object to the repository.
 Object firstObject()
          Start an iteration and return the first object in the list.
protected  Object getByPosition(int i)
          Return the object (possibly a null reference) stored in list at position i
 int getListSize()
           
 int getNumberOfItems()
           
 int getPosition()
          While an iteration is under way, the method returns the position of the last element retrieved by the iterator operations.
 int getTelemetryImageLength()
          Return the length (in bits) of the telemetry image of the object.
 boolean isConfigured()
          The list is configured if its size has been set.
 boolean isLast()
          Return true if the iteration is finished.
 boolean isListFull()
          Returns true if list is full
protected  boolean isObjectInList(Object object)
          Returns true if the argument object is in the list
protected  void localReset()
           
protected  void localResetConfiguration()
           
protected  int locateObjectInList(Object object)
          Locate the argument object in the list.
protected  Object nextObject()
          Advance the iteration and return the next object in the list.
protected  int removeObject(Object object)
          Remove one object from the list.
protected  void removeObjectByPosition(int i)
          Remove the object (possibly a null reference) at position i from the list.
 void reset()
          Reset any on-going iteration.
 void resetConfiguration()
          Clear all list entries.
 void setListSize(int listSize)
          Initialization method to set the list size.
 void writeToTelemetry(TelemetryStream tmStream)
          Only a trivial implementation is provided in the framework prototype.
 
Methods inherited from class RtjAocsFramework.BasicObjects.AocsObject
addConfigurationListener, addFailureListener, finalize, getAocsClock, getConfigurationListenerList, getCycle, getDestructionRecoveryAction, getFailureListenerList, getSystemManager, getTelemetryFormat, getTime, removeConfigurationListener, removeFailureListener, reportConfigurationEvent, reportFailure, resetStaticConfiguration, setAocsClock, setDestructionRecoveryAction, setMaxNumberOfConfigurationListeners, setMaxNumberOfFailureListeners, setSystemManager, setTelemetryFormat
 
Methods inherited from class RtjAocsFramework.BasicObjects.RootObject
getClassId, getInstanceId, setClassId
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectList

protected ObjectList()
Construct (without initializing) the list. The list can only be used after its size has been set (with method setSize).

Method Detail

localReset

protected void localReset()

localResetConfiguration

protected void localResetConfiguration()

locateObjectInList

protected int locateObjectInList(Object object)
Locate the argument object in the list.

Parameters:
object - object to be located
Returns:
int position of located object in list (-1 if object it not in list)

setListSize

public void setListSize(int listSize)
Initialization method to set the list size. This method should only called once after the repository has been created and before it is used. Attempts to call it more than once will result in a configuration error being reported.


addObject

protected int addObject(Object newObject)
Add one object to the repository. If the repository is already full, a configuration error is reported. There is no guarantee as to where in the list the object will be placed. The method returns an integer i in the range [0..listSize-1] that indicates where in the list the object was inserted.

Parameters:
newObject - object to be added
Returns:
int position where the object was added or -1 if the repository is full.

removeObject

protected int removeObject(Object object)
Remove one object from the list. If the list is empty, a configuration error is reported. The method returns the position in the list of the object that was removed as an integer i in the range [0..listSize-1.

Parameters:
object - object to be removed
Returns:
int position from which the object was removed or -1 if the object is not in the list.

isListFull

public boolean isListFull()
Returns true if list is full


isObjectInList

protected boolean isObjectInList(Object object)
Returns true if the argument object is in the list


firstObject

public Object firstObject()
Start an iteration and return the first object in the list. This method should be used in conjunction with methods next() and isLast(). Iterations through the list should be performed in a synchronized section.


nextObject

protected Object nextObject()
Advance the iteration and return the next object in the list. This method should be used in conjunction with methods first() and isLast(). Iterations through the list should be performed in a synchronized section.


isLast

public boolean isLast()
Return true if the iteration is finished. This method should be used in conjunction with methods next() and first(). Iterations through the list should be performed in a synchronized section.


getPosition

public int getPosition()
While an iteration is under way, the method returns the position of the last element retrieved by the iterator operations. The position is returned as an integer i in the range [0..listSize-1].


getByPosition

protected Object getByPosition(int i)
Return the object (possibly a null reference) stored in list at position i


removeObjectByPosition

protected void removeObjectByPosition(int i)
Remove the object (possibly a null reference) at position i from the list.


reset

public void reset()
Reset any on-going iteration.

Specified by:
reset in interface Resettable
Overrides:
reset in class AocsObject

resetConfiguration

public void resetConfiguration()
Clear all list entries.

Specified by:
resetConfiguration in interface Configurable
Overrides:
resetConfiguration in class AocsObject

isConfigured

public boolean isConfigured()
The list is configured if its size has been set.

Specified by:
isConfigured in interface Configurable
Overrides:
isConfigured in class AocsObject

writeToTelemetry

public void writeToTelemetry(TelemetryStream tmStream)
Only a trivial implementation is provided in the framework prototype.

Specified by:
writeToTelemetry in interface Telemeterable
Overrides:
writeToTelemetry in class AocsObject

getTelemetryImageLength

public int getTelemetryImageLength()
Description copied from interface: Telemeterable
Return the length (in bits) of the telemetry image of the object. This method is useful to verify that the quantity of data generated by a given object is compatible with the capacity of the telemetry channel.

Specified by:
getTelemetryImageLength in interface Telemeterable
Overrides:
getTelemetryImageLength in class AocsObject

getListSize

public int getListSize()

getNumberOfItems

public int getNumberOfItems()

Real-Time Java AOCS Framework v1.0 API Specification

Real-Time Java AOCS Framework project home page

Automatic Control Laboratory, ETH Zuerich
Physikstrasse 3
CH-8092 Zuerich, Switzerland