Classes Files

com::wombat::mama::MamaSourceGroup

Inherits from com.wombat.mama.MamaSourceGroupListener

Public Functions

  Name
  MamaSourceGroup(String name)
void enableLogging(Level level)
void disableLogging()
String getName()
MamaSource findSource(final String sourceName)
void addSource(MamaSource source, long weight)
void addSourceWithName(MamaSource source, String sourceName, long weight)
void setSourceWeight(String sourceName, long weight)
boolean reevaluate()
MamaSource getTopWeightSource()
void registerStateChangeListener(MamaSourceStateChangeListener event)
void unregisterStateChangeListener(MamaSourceStateChangeListener event)
Iterator sourceIterator()

Public Functions Documentation

function MamaSourceGroup

inline MamaSourceGroup(
    String name
)

Create a mamaSourceGroup object.

function enableLogging

inline void enableLogging(
    Level level
)

function disableLogging

inline void disableLogging()

function getName

inline String getName()

Return: The group name

Return the name string identifier for the specified source group.

function findSource

inline MamaSource findSource(
    final String sourceName
)

Parameters:

  • sourceName The name identifier for the source being located.

Return: MamaSource

Find a source with the given name in the group.

function addSource

inline void addSource(
    MamaSource source,
    long weight
)

Parameters:

  • source The mamaSource being added to the mamaSourceGroup.
  • weight The weighing to apply to the source being added.

Add a mamaSource to the specified group with the specified weighting. The source id will be used by the group to uniquely identify the source.

function addSourceWithName

inline void addSourceWithName(
    MamaSource source,
    String sourceName,
    long weight
)

Parameters:

  • source The mamaSource being added to the mamaSourceGroup.
  • sourceName The unique identifier for this source in this group.
  • weight The weighing to apply to the source being added.

Add a mamaSource to the specified group with the specified weighting and string name identifier.

function setSourceWeight

inline void setSourceWeight(
    String sourceName,
    long weight
)

Parameters:

  • sourceName The name of the source whose weight is being updated.
  • weight The new weight value for the specified source.

Set the weight for an existing mamaSource in the specified group.

function reevaluate

inline boolean reevaluate()

Return: boolean Whether any states were changed as a result of the call. false indicates none were changed. true indicates that the state of one or more sources has changed.

Re-evaluate the group by checking all of the relative weights and changing the state of each MamaSource in the group as appropriate. Returns true if any states were changed; otherwise false.

function getTopWeightSource

inline MamaSource getTopWeightSource()

Return the top weighted source for this source group

function registerStateChangeListener

inline void registerStateChangeListener(
    MamaSourceStateChangeListener event
)

Parameters:

  • event to register

Reimplements: com::wombat::mama::MamaSourceGroupListener::registerStateChangeListener

Applications interested in event notifications can register for events.

function unregisterStateChangeListener

inline void unregisterStateChangeListener(
    MamaSourceStateChangeListener event
)

Parameters:

  • event to unregister

Reimplements: com::wombat::mama::MamaSourceGroupListener::unregisterStateChangeListener

Applications interested in event notifications can unregister for events.

function sourceIterator

inline Iterator sourceIterator()

Updated on 2023-03-31 at 15:29:43 +0100