com.sun.sgs.impl.service.nodemap.affinity
Class AffinitySet

java.lang.Object
  extended by com.sun.sgs.impl.service.nodemap.affinity.AffinitySet
All Implemented Interfaces:
AffinityGroup, Serializable

public class AffinitySet
extends Object
implements AffinityGroup, Serializable

The affinity group information for a single node, in a format which can be sent between nodes and the server. These affinity groups are data containers only.

See Also:
Serialized Form

Constructor Summary
AffinitySet(long id, long generation, HashSet<Identity> identitySet)
          Constructs a new affinity group with the given ID, generation number, and a set of initial identities to include.
AffinitySet(long id, long generation, Identity identity)
          Constructs a new affinity group with the given ID, generation number, and an initial identity to include.
 
Method Summary
(package private)  void addIdentity(Identity id)
          Add the given identity to this affinity group.
 long getGeneration()
          Returns a generation number for this affinity group.
 long getId()
          Returns the affinity group identifier.
 Set<Identity> getIdentities()
          Returns the set of Identities which are members of this group.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AffinitySet

public AffinitySet(long id,
                   long generation,
                   Identity identity)
Constructs a new affinity group with the given ID, generation number, and an initial identity to include.

Parameters:
id - the affinity group identity
generation - the generation number of this group
identity - the first identity in this affinity set

AffinitySet

public AffinitySet(long id,
                   long generation,
                   HashSet<Identity> identitySet)
Constructs a new affinity group with the given ID, generation number, and a set of initial identities to include.

Parameters:
id - the affinity group identity
generation - the generation number of this group
identitySet - the initial set of identities to include
Method Detail

getId

public long getId()
Returns the affinity group identifier.

Specified by:
getId in interface AffinityGroup
Returns:
the affinity group identifier

getIdentities

public Set<Identity> getIdentities()
Returns the set of Identities which are members of this group. The set will contain at least one member.

Specified by:
getIdentities in interface AffinityGroup
Returns:
the set of Identities which are members of this group

getGeneration

public long getGeneration()
Returns a generation number for this affinity group. Affinity groups in the same generation were created at approximately the same time, so they can be used as the set of communities found at that time. Affinity groups with the same identifier but different generations cannot be compared; they are independent.

Specified by:
getGeneration in interface AffinityGroup
Returns:
the generation number for this affinity group

toString

public String toString()

Overrides:
toString in class Object

addIdentity

void addIdentity(Identity id)
Add the given identity to this affinity group.

Parameters:
id - the identity to add

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved