at.ac.tuwien.infosys.sm4all.copal.api
Class ContextEventType

java.lang.Object
  extended by at.ac.tuwien.infosys.sm4all.copal.api.ActionList<DefaultAction,DefaultAction>
      extended by at.ac.tuwien.infosys.sm4all.copal.api.ContextEventType
Direct Known Subclasses:
XMLContextEventType

public class ContextEventType
extends ActionList<DefaultAction,DefaultAction>

Class which defines type for each ContextEvent, i.e. each ContextEvent must have a corresponding ContextEventType associated with it. The name of the ContextEventType is also the name of each ContextEvent associated with this type and is a globally unique name on which ContextPublishers and ContextListeners have to agree on and use it to publish and listen on events respectively. This class is not thread safe.

Author:
sanjin

Constructor Summary
ContextEventType(String name)
          Creates an instance of ContextEventType.
 
Method Summary
 boolean equals(Object obj)
          Compares this ContextEventType to the specified Object.
 DefaultAction[] getActions()
          Returns the array of current ContextEventActions.
 String getName()
           
 int hashCode()
          Returns hash code for this ContextEventType.
 void replaceAction(int index, DefaultAction action)
          Replaces the action at specified index with specified DefaultAction in this list.
 
Methods inherited from class at.ac.tuwien.infosys.sm4all.copal.api.ActionList
appendAction, appendActions, getAction, hasAction, insertAction, numberOfActions, removeAction, removeActions, setAction, setActions
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextEventType

public ContextEventType(String name)
Creates an instance of ContextEventType. The name must be globally unique name of the event and cannot be null .

Parameters:
name - the globally unique name of the ContextEventType.
Throws:
NullPointerException - if specified name null.
IllegalArgumentException - if specified name is an empty or blank string.
Method Detail

getName

public String getName()
Returns:
the globally unique name of the ContextEventType.

replaceAction

public void replaceAction(int index,
                          DefaultAction action)
Replaces the action at specified index with specified DefaultAction in this list.

Parameters:
index - the position at which the DefaultAction is replaced.
action - the DefaultAction to replace with at specified index.
Throws:
NullPointerException - if specified DefaultAction is null.
IllegalArgumentException - if specified index has negative value or is greater or equal than ActionList.numberOfActions().

getActions

public DefaultAction[] getActions()
Description copied from class: ActionList
Returns the array of current ContextEventActions.

Overrides:
getActions in class ActionList<DefaultAction,DefaultAction>
Returns:
the array of current ContextEventActions.

hashCode

public int hashCode()
Returns hash code for this ContextEventType. The hash code for a ContextEventType object is hash code of its name.

Overrides:
hashCode in class Object
Returns:
a hash code value for this ContextEventType.

equals

public boolean equals(Object obj)
Compares this ContextEventType to the specified Object. The result is true if and only if the argument is not null and is a ContextEventType object that has same name as this ContextEventType.

Overrides:
equals in class Object
Parameters:
obj - the Object to compare this ContextEventType against.
Returns:
true if ContextEventTypes are equal; false otherwise.


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