package users.events; import users.*; import java.util.*; /** * An event indicating changes in a user's capabilities. * * @see User * @see Capability * @see CapabilityDataListener * * @author Steffen Zschaler * @version 2.0 05/05/1999 * @since v2.0 */ public class CapabilityDataEvent extends EventObject { /** * The capabilities that participated in the change. * * @serial */ private Set m_stCapNames; /** * Create a new CapabilityDataEvent with a source and a set of affected capabilities * * @param source the source of the event, usually a User object. * @param stCapNames the set of capabilities that changed. */ public CapabilityDataEvent (Object source, Set stCapNames) { super (source); m_stCapNames = stCapNames; } /** * Test whether a given capability is affected by this event. * * @param sCapName the name of the capability to be tested * * @return true if the given capability is affected by this event. * * @override Never */ public boolean affectsCapability (String sCapName) { return m_stCapNames.contains (sCapName); } /** * Return a capability if it is affected by this event. * * @param sCapName the name of the capability to be returned. * * @return the capability with the given name, if it is affected by this event. * <code>null</code> otherwise. * * @override Never */ public Capability getCapability (String sCapName) { return ((affectsCapability (sCapName))? (((User) getSource()).getCapability (sCapName)): (null) ); } }