jgroup.util.log
Class ConnectionPatternEvent

java.lang.Object
  extended by jgroup.util.log.Event
      extended by jgroup.util.log.ConnectionPatternEvent
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Event>, java.lang.Iterable<Domain>

public class ConnectionPatternEvent
extends Event
implements java.lang.Iterable<Domain>

A connection pattern event to be logged.

Author:
Hein Meling
See Also:
Serialized Form

Nested Class Summary
static class ConnectionPatternEvent.ConnectionPatternType
           
static class ConnectionPatternEvent.Type
          Supported connection event types.
 
Field Summary
 
Fields inherited from class jgroup.util.log.Event
description, eventHost, time, type
 
Constructor Summary
ConnectionPatternEvent()
           
ConnectionPatternEvent(java.lang.String description, java.lang.String pattern, java.util.List<jgroup.util.log.ConnectionPatternEvent.ConnectionEvent> events)
           
 
Method Summary
 void addEvent(ConnectionPatternEvent.Type type, Domain fromDomain, Domain toDomain)
           
 boolean containsPartition()
           
 java.util.List<jgroup.util.log.ConnectionPatternEvent.ConnectionEvent> getConnectionEvents()
           
 DomainSet getPartition(java.net.InetAddress inetAdr)
          Returns the domain set (the partition) of the given host.
 java.util.Set<DomainSet> getPartitions()
          Returns a set of domain sets representing the partitions of this connection pattern event.
 java.util.Iterator<Domain> iterator()
           
 int partitionCount()
           
 java.lang.String toString()
           
 
Methods inherited from class jgroup.util.log.Event
commonToString, compareTo, getDescription, getHost, getHostname, getTime, getType, isLastEvent, isType, setRelativeTo, setTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConnectionPatternEvent

public ConnectionPatternEvent()

ConnectionPatternEvent

public ConnectionPatternEvent(java.lang.String description,
                              java.lang.String pattern,
                              java.util.List<jgroup.util.log.ConnectionPatternEvent.ConnectionEvent> events)
Method Detail

addEvent

public void addEvent(ConnectionPatternEvent.Type type,
                     Domain fromDomain,
                     Domain toDomain)

getConnectionEvents

public java.util.List<jgroup.util.log.ConnectionPatternEvent.ConnectionEvent> getConnectionEvents()
Returns:
Returns the list of connection events.

containsPartition

public boolean containsPartition()
Returns:
True if at least one of the events is a partition event.

partitionCount

public int partitionCount()
Returns:
The number of partitions that will result from this connection pattern.

getPartition

public DomainSet getPartition(java.net.InetAddress inetAdr)
Returns the domain set (the partition) of the given host.

Parameters:
inetAdr - the host for which to obtain the domain set
Returns:
Returns the domain set (the partition) of the given host.
Throws:
java.util.NoSuchElementException - Raised if the given host is not in any of the partitions.

getPartitions

public java.util.Set<DomainSet> getPartitions()
Returns a set of domain sets representing the partitions of this connection pattern event. Implementation note: this method requires that merge events are stored first in the events list. Currently this is accomplished by implementing the Comparable interface and sorting this list before constructing the set of domain sets.

Returns:
Returns a set of domain sets representing the partitions of this connection pattern event.

toString

public java.lang.String toString()
Overrides:
toString in class Event

iterator

public java.util.Iterator<Domain> iterator()
Specified by:
iterator in interface java.lang.Iterable<Domain>


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.