Class RepresentativeElectionAlgorithm<T>

java.lang.Object
tools.refinery.interpreter.rete.itc.alg.representative.RepresentativeElectionAlgorithm<T>
All Implemented Interfaces:
IGraphObserver<T>
Direct Known Subclasses:
StronglyConnectedComponentAlgorithm, WeaklyConnectedComponentAlgorithm

public abstract class RepresentativeElectionAlgorithm<T> extends Object implements IGraphObserver<T>
  • Field Details

    • graph

      protected final Graph<T> graph
    • representatives

      protected final Map<T,T> representatives
    • components

      protected final Map<T,Set<T>> components
  • Constructor Details

    • RepresentativeElectionAlgorithm

      protected RepresentativeElectionAlgorithm(Graph<T> graph)
  • Method Details

    • initializeComponents

      protected abstract void initializeComponents()
    • initializeSet

      protected void initializeSet(Set<T> set)
    • merge

      protected void merge(Set<T> toMerge)
    • merge

      protected void merge(T leftRepresentative, T rightRepresentative)
    • assignNewRepresentative

      protected void assignNewRepresentative(T oldRepresentative, Set<T> set)
    • setObserver

      public void setObserver(RepresentativeObserver<? super T> observer)
    • getComponents

      public Map<T,Set<T>> getComponents()
    • getRepresentative

      public T getRepresentative(T node)
    • getComponent

      public Set<T> getComponent(T representative)
    • dispose

      public void dispose()
    • nodeInserted

      public void nodeInserted(T n)
      Description copied from interface: IGraphObserver
      Used to notify when a node is inserted into the graph.
      Specified by:
      nodeInserted in interface IGraphObserver<T>
      Parameters:
      n - the node
    • nodeDeleted

      public void nodeDeleted(T n)
      Description copied from interface: IGraphObserver
      Used to notify when a node is deleted from the graph.
      Specified by:
      nodeDeleted in interface IGraphObserver<T>
      Parameters:
      n - the node
    • notifyToObservers

      protected void notifyToObservers(T node, T oldRepresentative, T newRepresentative)
    • notifyToObservers

      protected void notifyToObservers(T node, T representative, Direction direction)