Class MamaSourceGroup

    • Constructor Detail

      • MamaSourceGroup

        public MamaSourceGroup​(java.lang.String name)
        Create a mamaSourceGroup object.
    • Method Detail

      • enableLogging

        public void enableLogging​(java.util.logging.Level level)
      • disableLogging

        public void disableLogging()
      • getName

        public java.lang.String getName()
        Return the name string identifier for the specified source group.
        Returns:
        The group name
      • findSource

        public MamaSource findSource​(java.lang.String sourceName)
        Find a source with the given name in the group.
        Parameters:
        sourceName - The name identifier for the source being located.
        Returns:
        MamaSource
      • addSource

        public void addSource​(MamaSource source,
                              long weight)
        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.
        Parameters:
        source - The mamaSource being added to the mamaSourceGroup.
        weight - The weighing to apply to the source being added.
      • addSourceWithName

        public void addSourceWithName​(MamaSource source,
                                      java.lang.String sourceName,
                                      long weight)
        Add a mamaSource to the specified group with the specified weighting and string name identifier.
        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.
      • setSourceWeight

        public void setSourceWeight​(java.lang.String sourceName,
                                    long weight)
        Set the weight for an existing mamaSource in the specified group.
        Parameters:
        sourceName - The name of the source whose weight is being updated.
        weight - The new weight value for the specified source.
      • reevaluate

        public boolean reevaluate()
        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.
        Returns:
        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.
      • getTopWeightSource

        public MamaSource getTopWeightSource()
        Return the top weighted source for this source group
      • sourceIterator

        public java.util.Iterator sourceIterator()