at.ac.tuwien.infosys.sm4all.copal.api.event
Class Actions<T extends ContextEventAction>

java.lang.Object
  extended by at.ac.tuwien.infosys.sm4all.copal.api.event.Actions<T>
Type Parameters:
T - the subclass of ContextEventAction that is used for storage and retrieval.

public class Actions<T extends ContextEventAction>
extends java.lang.Object

Class which defines a list of ContextEventActions and makes possible to manipulate and retrieve ContextEventAction.

Author:
sanjin

Constructor Summary
Actions()
           
 
Method Summary
<S extends T>
void
append(S... actions)
          Append specified ContextEventActions.
 void clear()
          Remove all ContextEventActions.
 boolean contains(java.lang.String name)
          Return if there is at least one ContextEventAction with specified name.
 T get(int index)
          Return ContextEventAction at specified index.
 ContextEventAction[] getAll()
          Return all currently added ContextEventActions.
 void insert(int index, T action)
          Insert specified ContextEventAction at specified index.
 void remove(int index)
          Remove the ContextEventAction at specified position.
 void set(int index, T action)
          Set specified ContextEventAction at specified index.
 void setAll(T... actions)
          Add specified ContextEventActions and remove all previous ContextEventActions.
 int size()
          Return the number of ContextEventAction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Actions

public Actions()
Method Detail

get

public T get(int index)
Return ContextEventAction at specified index.

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

set

public void set(int index,
                T action)
Set specified ContextEventAction at specified index.

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

getAll

public ContextEventAction[] getAll()
Return all currently added ContextEventActions.

Returns:
all currently added ContextEventActions.

setAll

public void setAll(T... actions)
Add specified ContextEventActions and remove all previous ContextEventActions.

Parameters:
actions - the ContextEventActions.
Throws:
java.lang.NullPointerException - if specified array ContextEventActions or any ContextEventAction in the array is null.

contains

public boolean contains(java.lang.String name)
Return if there is at least one ContextEventAction with specified name.

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

size

public int size()
Return the number of ContextEventAction.

Returns:
the number of ContextEventAction.

append

public <S extends T> void append(S... actions)
Append specified ContextEventActions.

Type Parameters:
S - the type of appended ContextEventActions.
Parameters:
actions - the ContextEventActions.
Throws:
java.lang.NullPointerException - if specified array of ContextEventActions or any ContextEventAction in the array is null.

insert

public void insert(int index,
                   T action)
Insert specified ContextEventAction at specified index.

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

remove

public void remove(int index)
Remove the ContextEventAction at specified position.

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

clear

public void clear()
Remove all ContextEventActions.



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