Class AbstractAlgorithm

java.lang.Object
org.svvrl.goal.core.AbstractAlgorithm
All Implemented Interfaces:
java.util.EventListener, Algorithm, AlgorithmListener
Direct Known Subclasses:
AbstractControllableAlgorithm, AbstractGALayout, AbstractGameSolver, AbstractOnTheFlyContainment, AltStyleConversion, Aperiodic, ChainedConversion, Containment, DBW2ComplementDCW, DCW2ComplementDBW, DCW2NBW, Degeneralizer, DelayedSimulationOptimizer, DMW2ComplementDMW, DMW2DBW, DMW2DPW, DMW2DRW, DMW2DSW, DNFABW2NBW, DPW2ComplementDPW, DRW2ComplementDSW, DSW2ComplementDRW, ElementaryCycleFinder, ElementaryCycleGenerator, Equivalence, FairSimulationOptimizer, ForceScanAlgorithm.FSAImpl, ForceTransferAlgorithm.FTAImpl, FRLayout.FRImpl, FSA2AltAutomaton, FSA2DBWByBK09, FSA2DBWByLandweber, FSA2Game, FSA2NMW, GameConversion, GEMLayout.GEMImpl, ImprovedPushForceScanAlgorithm.IPFSAImpl, ISOMLayout.ISOMImpl, LTLPastFutureSeparator, MSContainment, NBW2ComplementUCW, NBW2DCW, NBW2DCW.NBW2DCWImpl, NBW2DPW, NBW2DRW, NBW2NCW, NBW2NCW.NBW2NCWImpl, NBW2NGBW, NBW2NPW, NBW2NRW, NBW2NSW, NBW2NTBW, NBW2SDBW, NCW2ComplementUBW, NCW2DCW, NFW2DFW, NGBW2NBW, NGBW2NBWSet, NMW2NBW, NPW2NBW, NPW2NRW, NPW2NSW, NRW2NBW, NSW2NBW, NSW2NBW2, NSW2NGBW, NTBW2NTGBW, NTGBW2NBW, NTGBW2NBW, NTGBW2NGBW, OmegaUtil.CycleFinder, OREExtractor, PitermanContainment, Product, PruningFairSets, QPTLPastFutureSeparator, RabinIndex, REExtractor, Replacement, ReverseNFW, SafraContainment, SALayout.SAImpl, SemanticDeterminism, SemanticDeterminismByLandweber, SimpleDeadEndSolver, SimpleMcNaughtonZielonkaSolver, SimulationOptimizer, SliceAntichain, SliceAntichain.SliceContainmentImpl, SliceContainment, TemporalHierarchyClassification, TWVWAA2NTGBW, VWAA2NTGBW

public class AbstractAlgorithm
extends java.lang.Object
implements Algorithm
This class provides default implementations for the Algorithm interface. An object of this class can have a name. When outputting messages to AlgorithmListener objects, the name will be added to the messages as a prefix.
Author:
Ming-Hsien Tsai
  • Constructor Details

    • AbstractAlgorithm

      public AbstractAlgorithm()
      Constructs this algorithm with an empty name.
    • AbstractAlgorithm

      public AbstractAlgorithm​(Properties o)
      Constructs this algorithm with an empty name and predefined options.
      Parameters:
      o - predefined options
    • AbstractAlgorithm

      public AbstractAlgorithm​(java.lang.String n)
      Constructs this algorithm with a specified name and empty options.
      Parameters:
      n - the name of this algorithm
    • AbstractAlgorithm

      public AbstractAlgorithm​(java.lang.String n, Properties o)
      Constructs this algorithm with a specified name and predefined options.
      Parameters:
      n - the name of this algorithm
      o - predefined options
  • Method Details

    • getName

      public java.lang.String getName()
      Returns the name of this algorithm.
      Returns:
      the name of this algorithm
    • getOptions

      public Properties getOptions()
      Description copied from interface: Algorithm
      Returns the options of this algorithm. If there is no option, an empty options should be returned.
      Specified by:
      getOptions in interface Algorithm
      Returns:
      the options of this algorithm
    • addAlgorithmListener

      public void addAlgorithmListener​(AlgorithmListener listener)
      Description copied from interface: Algorithm
      Adds an algorithm listener.
      Specified by:
      addAlgorithmListener in interface Algorithm
      Parameters:
      listener - an algorithm listener to be inserted
    • addSubAlgorithm

      public void addSubAlgorithm​(Algorithm alg)
      Adds a specified algorithm as a subroutine of this algorithm. This method will add this algorithm as an algorithm listener of the subroutine such that the algorithm listeners of this algorithm also know what is going on in the subroutine.
      Parameters:
      alg - the algorithm as a subroutine of this algorithm
    • removeSubAlgorithm

      public void removeSubAlgorithm​(Algorithm alg)
      Removes a specified algorithm from the subroutines of this algorithm.
      Parameters:
      alg - an algorithm to be removed from the subroutines of this algorithm
    • getSubAlgorithms

      public Algorithm[] getSubAlgorithms()
      Returns the subroutines of this algorithm.
      Returns:
      the subroutines of this algorithm
    • removeAlgorithmListener

      public void removeAlgorithmListener​(AlgorithmListener listener)
      Description copied from interface: Algorithm
      Removes an algorithm listener.
      Specified by:
      removeAlgorithmListener in interface Algorithm
      Parameters:
      listener - an algorithm listener to be removed
    • getAlgorithmListeners

      public AlgorithmListener[] getAlgorithmListeners()
      Description copied from interface: Algorithm
      Returns all algorithm listeners.
      Specified by:
      getAlgorithmListeners in interface Algorithm
      Returns:
      all algorithm listeners
    • appendStepMessage

      public void appendStepMessage​(java.lang.String msg)
      Description copied from interface: AlgorithmListener
      Outputs a message to this listener when a small step is done by the algorithm.
      Specified by:
      appendStepMessage in interface AlgorithmListener
      Parameters:
      msg - the message produced by the algorithm for this listener
    • appendStageMessage

      public void appendStageMessage​(java.lang.String msg)
      Description copied from interface: AlgorithmListener
      Outputs a message to this listener when a big stage is done by the algorithm.
      Specified by:
      appendStageMessage in interface AlgorithmListener
      Parameters:
      msg - the message produced by the algorithm for this listener
    • setMinimalProgress

      public void setMinimalProgress​(int n)
      Description copied from interface: AlgorithmListener
      Informs this listener the minimal progress value of the algorithm. This method should be invoked only if the progress of the algorithm can be measured deterministically.
      Specified by:
      setMinimalProgress in interface AlgorithmListener
      Parameters:
      n - the minimal progress of the algorithm
    • getMinimalProgress

      public int getMinimalProgress()
      Description copied from interface: AlgorithmListener
      Returns the minimal progress.
      Specified by:
      getMinimalProgress in interface AlgorithmListener
      Returns:
      the minimal progress
    • setMaximalProgress

      public void setMaximalProgress​(int n)
      Description copied from interface: AlgorithmListener
      Informs this listener the maximal progress value of the algorithm. This method should be invoked only if the progress of the algorithm can be measured deterministically.
      Specified by:
      setMaximalProgress in interface AlgorithmListener
      Parameters:
      n - the maximal progress of the algorithm
    • getMaximalProgress

      public int getMaximalProgress()
      Description copied from interface: AlgorithmListener
      Returns the maximal progress.
      Specified by:
      getMaximalProgress in interface AlgorithmListener
      Returns:
      the maximal progress
    • setCurrentProgress

      public void setCurrentProgress​(int n)
      Description copied from interface: AlgorithmListener
      Informs this listener the current progress value of the algorithm. This method should be invoked only if the progress of the algorithm can be measured deterministically.
      Specified by:
      setCurrentProgress in interface AlgorithmListener
      Parameters:
      n - the current progress value of the algorithm
    • getCurrentProgress

      public int getCurrentProgress()
      Description copied from interface: AlgorithmListener
      Returns the current progress.
      Specified by:
      getCurrentProgress in interface AlgorithmListener
      Returns:
      the current progress
    • addProgress

      public void addProgress​(int i)
      Increases the current progress by a specified number.
      Parameters:
      i - the increment of the current progress
    • setDeterministicProgress

      public void setDeterministicProgress​(boolean b)
      Description copied from interface: AlgorithmListener
      Informs this listener whether the progress of the algorithm can be measured deterministically or not.
      Specified by:
      setDeterministicProgress in interface AlgorithmListener
      Parameters:
      b - true if the progress of the algorithm can be measured deterministically
    • isDeterministicProgress

      public boolean isDeterministicProgress()
      Returns true if the progress of this algorithm is deterministic.
      Returns:
      true if the progress of this algorithm is deterministic