at.ac.tuwien.infosys.sm4all.copal.api.event
Class ActionList<S extends ContextEventAction,T extends S>

java.lang.Object
  extended by at.ac.tuwien.infosys.sm4all.copal.api.event.ActionList<S,T>
Type Parameters:
S - the subclass of ContextEventAction that is used for storage and retrieval.
T - the subclass of S that is allowed to be appended and inserted.
Direct Known Subclasses:
BaseEvent, ContextEventType

public class ActionList<S extends ContextEventAction,T extends S>
extends Object

Class which defines a list of ContextEventActions and makes possible to manipulate and retrieve ContextEventAction. This class is not thread safe.

Author:
sanjin

Constructor Summary
ActionList()
           
 
Method Summary
 void appendAction(T action)
          Appends specified ContextEventAction.
 void appendActions(T... actions)
          Appends specified ContextEventActions.
 S getAction(int index)
          Returns ContextEventAction at specified index.
 ContextEventAction[] getActions()
          Returns the array of current ContextEventActions.
 boolean hasAction(String name)
          If there is at least one ContextEventAction with specified name.
 void insertAction(int index, T action)
          Inserts specified ContextEventAction at specified index.
 int numberOfActions()
          Returns the number of ContextEventAction.
 void removeAction(int index)
          Removes an ContextEventAction at specified position.
protected  void removeActions()
          Removes all ContextEventActions.
protected  void setAction(int index, S action)
          Sets specified ContextEventAction at specified index.
protected  void setActions(S... actions)
          Adds specified ContextEventActions and removes all previous actions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionList

public ActionList()
Method Detail

appendAction

public void appendAction(T action)
Appends specified ContextEventAction.

Parameters:
action - the ContextEventAction.
Throws:
NullPointerException - if specified ContextEventAction is null.

appendActions

public void appendActions(T... actions)
Appends specified ContextEventActions.

Parameters:
actions - the ContextEventActions.
Throws:
NullPointerException - if any ContextEventAction is null.

insertAction

public void insertAction(int index,
                         T action)
Inserts specified ContextEventAction at specified index.

Parameters:
index - the index at which the ContextEventAction is inserted.
action - the ContextEventAction.
Throws:
NullPointerException - if specified ContextEventAction is null.
IllegalArgumentException - if specified index has negative value or is greater or equal than numberOfActions().

getAction

public S getAction(int index)
Returns ContextEventAction at specified index.

Parameters:
index - the index of the ContextEventAction to return.
Returns:
the ContextEventAction.
Throws:
IllegalArgumentException - if specified index has negative value or is greater or equal than numberOfActions().

removeAction

public void removeAction(int index)
Removes an ContextEventAction at specified position.

Parameters:
index - the position of the ContextEventAction to remove.
Throws:
IllegalArgumentException - if specified index has negative value or is greater or equal than numberOfActions().

numberOfActions

public int numberOfActions()
Returns the number of ContextEventAction.

Returns:
the number of ContextEventAction.

hasAction

public boolean hasAction(String name)
If there is at least one ContextEventAction with specified name.

Parameters:
name - the name of the ContextEventAction.
Returns:
true if there is at least one ContextEventAction with specified name; false otherwise.

getActions

public ContextEventAction[] getActions()
Returns the array of current ContextEventActions.

Returns:
the array of current ContextEventActions.

setActions

protected void setActions(S... actions)
Adds specified ContextEventActions and removes all previous actions.

Parameters:
actions - the array of ContextEventActions.
Throws:
NullPointerException - if any ContextEventAction is null.

setAction

protected void setAction(int index,
                         S action)
Sets specified ContextEventAction at specified index.

Parameters:
index - the index at which to set the ContextEventAction.
action - the ContextEventAction.
Throws:
NullPointerException - if specified ContextEventAction is null.
IllegalArgumentException - if specified index has negative value or is greater or equal than numberOfActions().

removeActions

protected void removeActions()
Removes all ContextEventActions.



Copyright © 2010 Distributed Systems Group, Vienna University of Technology. All Rights Reserved.