org.xwiki.eventstream
Class EventGroup

java.lang.Object
  extended by org.xwiki.eventstream.EventGroup

public class EventGroup
extends Object

A group of related events, all happening as a consequence of the same action.

Since:
3.0M2
Version:
$Id: 491c1afc04603ea6685aaa8a5caff8918936e00d $

Constructor Summary
EventGroup()
          Default constructor that creates an empty event group.
EventGroup(Event... events)
          Constructor that creates a group containing the passed events.
EventGroup(List<Event> events)
          Constructor that creates a group containing the passed events.
EventGroup(Set<Event> events)
          Constructor that creates a group containing the passed events.
 
Method Summary
 void addEvents(Event... events)
          Add more events to this group.
 void clearEvents()
          Remove all the events from this group.
 Set<Event> getEvents()
          List the events that are part of this group.
 Event getMainEvent()
          Get the most important event in this group.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventGroup

public EventGroup()
Default constructor that creates an empty event group.


EventGroup

public EventGroup(List<Event> events)
Constructor that creates a group containing the passed events.

Parameters:
events - the list of initial events to put in the group

EventGroup

public EventGroup(Set<Event> events)
Constructor that creates a group containing the passed events.

Parameters:
events - the list of initial events to put in the group

EventGroup

public EventGroup(Event... events)
Constructor that creates a group containing the passed events.

Parameters:
events - the list of initial events to put in the group
Method Detail

getEvents

public Set<Event> getEvents()
List the events that are part of this group.

Returns:
a read only snapshot of the events in this group; future changes in this group will not be reflected in the returned snapshot

addEvents

public void addEvents(Event... events)
Add more events to this group. Duplicate events are added only once, since this is a Set.

Parameters:
events - the new events to add

clearEvents

public void clearEvents()
Remove all the events from this group.


getMainEvent

public Event getMainEvent()
Get the most important event in this group. The "importance" is given by the importance property of events. If more events have the same maximal importance, the first one found in the group is returned. Usually this corresponds to the order the events were created, but this is not a guaranteed property.

Returns:
the most important event found in this group, null if the group is empty.

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2004-2013 XWiki. All Rights Reserved.