Package org.svvrl.goal.core
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 Summary
Constructors Constructor Description AbstractAlgorithm()
Constructs this algorithm with an empty name.AbstractAlgorithm(java.lang.String n)
Constructs this algorithm with a specified name and empty options.AbstractAlgorithm(java.lang.String n, Properties o)
Constructs this algorithm with a specified name and predefined options.AbstractAlgorithm(Properties o)
Constructs this algorithm with an empty name and predefined options. -
Method Summary
Modifier and Type Method Description void
addAlgorithmListener(AlgorithmListener listener)
Adds an algorithm listener.void
addProgress(int i)
Increases the current progress by a specified number.void
addSubAlgorithm(Algorithm alg)
Adds a specified algorithm as a subroutine of this algorithm.void
appendStageMessage(java.lang.String msg)
Outputs a message to this listener when a big stage is done by the algorithm.void
appendStepMessage(java.lang.String msg)
Outputs a message to this listener when a small step is done by the algorithm.AlgorithmListener[]
getAlgorithmListeners()
Returns all algorithm listeners.int
getCurrentProgress()
Returns the current progress.int
getMaximalProgress()
Returns the maximal progress.int
getMinimalProgress()
Returns the minimal progress.java.lang.String
getName()
Returns the name of this algorithm.Properties
getOptions()
Returns the options of this algorithm.Algorithm[]
getSubAlgorithms()
Returns the subroutines of this algorithm.boolean
isDeterministicProgress()
Returnstrue
if the progress of this algorithm is deterministic.void
removeAlgorithmListener(AlgorithmListener listener)
Removes an algorithm listener.void
removeSubAlgorithm(Algorithm alg)
Removes a specified algorithm from the subroutines of this algorithm.void
setCurrentProgress(int n)
Informs this listener the current progress value of the algorithm.void
setDeterministicProgress(boolean b)
Informs this listener whether the progress of the algorithm can be measured deterministically or not.void
setMaximalProgress(int n)
Informs this listener the maximal progress value of the algorithm.void
setMinimalProgress(int n)
Informs this listener the minimal progress value of the algorithm.
-
Constructor Details
-
AbstractAlgorithm
public AbstractAlgorithm()Constructs this algorithm with an empty name. -
AbstractAlgorithm
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
Constructs this algorithm with a specified name and predefined options.- Parameters:
n
- the name of this algorithmo
- predefined options
-
-
Method Details
-
getName
public java.lang.String getName()Returns the name of this algorithm.- Returns:
- the name of this algorithm
-
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 interfaceAlgorithm
- Returns:
- the options of this algorithm
-
addAlgorithmListener
Description copied from interface:Algorithm
Adds an algorithm listener.- Specified by:
addAlgorithmListener
in interfaceAlgorithm
- Parameters:
listener
- an algorithm listener to be inserted
-
addSubAlgorithm
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
Removes a specified algorithm from the subroutines of this algorithm.- Parameters:
alg
- an algorithm to be removed from the subroutines of this algorithm
-
getSubAlgorithms
Returns the subroutines of this algorithm.- Returns:
- the subroutines of this algorithm
-
removeAlgorithmListener
Description copied from interface:Algorithm
Removes an algorithm listener.- Specified by:
removeAlgorithmListener
in interfaceAlgorithm
- Parameters:
listener
- an algorithm listener to be removed
-
getAlgorithmListeners
Description copied from interface:Algorithm
Returns all algorithm listeners.- Specified by:
getAlgorithmListeners
in interfaceAlgorithm
- 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 interfaceAlgorithmListener
- 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 interfaceAlgorithmListener
- 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 interfaceAlgorithmListener
- 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 interfaceAlgorithmListener
- 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 interfaceAlgorithmListener
- 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 interfaceAlgorithmListener
- 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 interfaceAlgorithmListener
- 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 interfaceAlgorithmListener
- 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 interfaceAlgorithmListener
- Parameters:
b
-true
if the progress of the algorithm can be measured deterministically
-
isDeterministicProgress
public boolean isDeterministicProgress()Returnstrue
if the progress of this algorithm is deterministic.- Returns:
true
if the progress of this algorithm is deterministic
-