public class Blackboard extends Object implements Serializable
AnalysisController
, the Blackboard pattern from POSA I. The Blackboard’s
vocabularies are: ResourceDemandingInternalAction
, SeffBranch
,
SeffLoop
, ResourceDemandMeasurementResult
,
BranchDecisionMeasurementResult
, LoopRepetitionCountMeasurementResult
and EvaluableExpression
. It further allows classes to store custom data.
The Blackboard is typically not accessed directly by its using classes, but through
blackboard views (recognisable by having the BlackboardView
suffix).
These are surrogates for the blackboard. They don’t modify its contents but only
restrict access to it.
AnalysisController
,
Serialized FormConstructor and Description |
---|
Blackboard(Set<ResourceDemandingInternalAction> rdias,
Set<SeffBranch> branches,
Set<SeffLoop> loops,
Set<ExternalCallParameter> externalCalls,
EvaluableExpressionFitnessFunction fitnessFunction,
ProjectInformation projectInformation)
Creates a new blackboard that can be used to analyse the given elements.
|
Modifier and Type | Method and Description |
---|---|
void |
addMeasurementResultFor(ExternalCallParameter parameter,
ParameterChangeMeasurementResult results)
Adds a measurement result for the provided
loop . |
void |
addMeasurementResultFor(ResourceDemandingInternalAction rdia,
ResourceDemandMeasurementResult results)
Adds a measurement result for the provided
rdia . |
void |
addMeasurementResultFor(SeffBranch branch,
BranchDecisionMeasurementResult results)
Adds a measurement result for the provided
branch . |
void |
addMeasurementResultFor(SeffLoop loop,
LoopRepetitionCountMeasurementResult results)
Adds a measurement result for the provided
loop . |
void |
addProposedExpressionFor(MeasurableSeffElement element,
EvaluableExpression expression)
Adds
expression as a proposal. |
void |
addToBeMeasuredExternalCallParameters(Collection<ExternalCallParameter> parameters)
Reports that
parameters shall be measured. |
void |
addToBeMeasuredExternalCallParameters(ExternalCallParameter... parameters)
Reports that
parameters shall be measured. |
void |
addToBeMeasuredRdias(Collection<ResourceDemandingInternalAction> toMeasureRdias)
Reports that
rdias shall be measured for its resource demands. |
void |
addToBeMeasuredRdias(ResourceDemandingInternalAction... toMeasureRdias)
Reports that
rdias shall be measured for its resource demands. |
void |
addToBeMeasuredSeffBranches(Collection<SeffBranch> toMeasureBranches)
Reports that
branches shall be measured for its branch decisions. |
void |
addToBeMeasuredSeffBranches(SeffBranch... toMeasureBranches)
Reports that
branches shall be measured for its branch decisions. |
void |
addToBeMeasuredSeffLoops(Collection<SeffLoop> toMeasureLoops)
Reports that
loops shall be measured for its repetitions. |
void |
addToBeMeasuredSeffLoops(SeffLoop... toMeasureLoops)
Reports that
loops shall be measured for its repetitions. |
void |
clearToBeMeasuredBranches()
Clears the list of
branchesToBeMeasured . |
void |
clearToBeMeasuredExternalCalls()
Clears the list of
externalCallParameterToBeMeasured . |
void |
clearToBeMeasuredLoops()
Clears the list of
loopsToBeMeasured . |
void |
clearToBeMeasuredRdias()
Clears the list of
rdiasToBeMeasured . |
Set<ExternalCallParameter> |
getAllExternalCallParameters()
Returns all external call parameters known to
Beagle.
|
Set<ResourceDemandingInternalAction> |
getAllRdias()
All resource demanding internal
actions known to Beagle.
|
Set<SeffBranch> |
getAllSeffBranches()
All SEFF branches known to Beagle.
|
Set<SeffLoop> |
getAllSeffLoops()
All SEFF loops known to Beagle.
|
Set<ExternalCallParameter> |
getExternalCallParametersToBeMeasured()
Returns all external call parameters which shall
be measured.
|
EvaluableExpression |
getFinalExpressionFor(MeasurableSeffElement element)
Returns the final expression set for
element . |
EvaluableExpressionFitnessFunction |
getFitnessFunction()
Returns an object which holds and is responsible allows access to the fitness
function grading evaluable expressions regarding
their fitness.
|
Set<ParameterChangeMeasurementResult> |
getMeasurementResultsFor(ExternalCallParameter externalCallParameter)
Gets all results yet measured for the external parameter
externalCallParameter . |
Set<ResourceDemandMeasurementResult> |
getMeasurementResultsFor(ResourceDemandingInternalAction rdia)
Gets all results yet measured for the resource demands of
rdia . |
Set<BranchDecisionMeasurementResult> |
getMeasurementResultsFor(SeffBranch branch)
Gets all results yet measured for branch decisions of
branch . |
Set<LoopRepetitionCountMeasurementResult> |
getMeasurementResultsFor(SeffLoop loop)
Gets all results yet measured for the loop repetitions of
loop . |
ProjectInformation |
getProjectInformation()
Information about the project belonging to this blackboard.
|
Set<EvaluableExpression> |
getProposedExpressionFor(MeasurableSeffElement element)
Returns a set of all evaluable expressions
proposed for
element . |
Set<ResourceDemandingInternalAction> |
getRdiasToBeMeasured()
RDIAs that shall be measured for their
resource demands.
|
Set<SeffBranch> |
getSeffBranchesToBeMeasured()
SEFF branches that shall be measured for their branch
decisions.
|
Set<SeffLoop> |
getSeffLoopsToBeMeasured()
SEFF loops that shall be measured for their repetitions.
|
<WRITTEN_TYPE extends Serializable> |
readFor(Class<? extends BlackboardStorer<WRITTEN_TYPE>> writer)
Reads data previously written for
writer through
writeFor(Class, Serializable) . |
void |
setFinalExpressionFor(MeasurableSeffElement element,
EvaluableExpression expression)
Sets
expression as the final description of element ’s measurement
results. |
<WRITTEN_TYPE extends Serializable> |
writeFor(Class<? extends BlackboardStorer<WRITTEN_TYPE>> writer,
WRITTEN_TYPE written)
Writes data for
writer to the blackboard. |
public Blackboard(Set<ResourceDemandingInternalAction> rdias, Set<SeffBranch> branches, Set<SeffLoop> loops, Set<ExternalCallParameter> externalCalls, EvaluableExpressionFitnessFunction fitnessFunction, ProjectInformation projectInformation)
rdias
- All resource demanding internal action to be known to analysers.branches
- All SEFF branches to be known to analysers.loops
- All SEFF loops to be known to analysers.externalCalls
- All external call parameter to be known to analysers.fitnessFunction
- The function to get better evaluable expression results.projectInformation
- Information about the project belonging to this
blackboard.public Set<ResourceDemandingInternalAction> getAllRdias()
null
.public Set<SeffBranch> getAllSeffBranches()
null
.public Set<SeffLoop> getAllSeffLoops()
null
.public Set<ExternalCallParameter> getAllExternalCallParameters()
null
.public Set<ResourceDemandingInternalAction> getRdiasToBeMeasured()
null
.public Set<SeffBranch> getSeffBranchesToBeMeasured()
null
.public Set<SeffLoop> getSeffLoopsToBeMeasured()
null
.public Set<ExternalCallParameter> getExternalCallParametersToBeMeasured()
null
.public void addToBeMeasuredRdias(ResourceDemandingInternalAction... toMeasureRdias)
rdias
shall be measured for its resource demands.toMeasureRdias
- Resource demanding internal actions that shall be measured.
Must not be null
and must be known to this blackboard.addToBeMeasuredRdias(Collection)
public void addToBeMeasuredRdias(Collection<ResourceDemandingInternalAction> toMeasureRdias)
rdias
shall be measured for its resource demands.toMeasureRdias
- Resource demanding internal actions that shall be measured.
Must not be null
and must be known to this blackboard.addToBeMeasuredRdias(ResourceDemandingInternalAction...)
public void addToBeMeasuredSeffBranches(SeffBranch... toMeasureBranches)
branches
shall be measured for its branch decisions.toMeasureBranches
- SEFF branches that shall be measured. Must not be
null
and must be known to this blackboard.addToBeMeasuredSeffBranches(Collection)
public void addToBeMeasuredSeffBranches(Collection<SeffBranch> toMeasureBranches)
branches
shall be measured for its branch decisions.toMeasureBranches
- SEFF branches that shall be measured. Must not be
null
and must be known to this blackboard.addToBeMeasuredSeffBranches(SeffBranch...)
public void addToBeMeasuredSeffLoops(SeffLoop... toMeasureLoops)
loops
shall be measured for its repetitions.toMeasureLoops
- SEFF Loops that shall be measured. Must not be null
and must be known to this blackboard.addToBeMeasuredSeffLoops(Collection)
public void addToBeMeasuredSeffLoops(Collection<SeffLoop> toMeasureLoops)
loops
shall be measured for its repetitions.toMeasureLoops
- SEFF Loops that shall be measured. Must not be null
and must be known to this blackboard.addToBeMeasuredSeffLoops(SeffLoop...)
public void addToBeMeasuredExternalCallParameters(ExternalCallParameter... parameters)
parameters
shall be measured.parameters
- external call parameters that shall be measured. Must not be
null
and must be known to this blackboard.addToBeMeasuredExternalCallParameters(Collection)
public void addToBeMeasuredExternalCallParameters(Collection<ExternalCallParameter> parameters)
parameters
shall be measured.parameters
- external call parameters that shall be measured. Must not be
null
and must be known to this blackboard.addToBeMeasuredExternalCallParameters(ExternalCallParameter...)
public void clearToBeMeasuredRdias()
rdiasToBeMeasured
.public void clearToBeMeasuredBranches()
branchesToBeMeasured
.public void clearToBeMeasuredLoops()
loopsToBeMeasured
.public void clearToBeMeasuredExternalCalls()
externalCallParameterToBeMeasured
.public Set<ResourceDemandMeasurementResult> getMeasurementResultsFor(ResourceDemandingInternalAction rdia)
rdia
.rdia
- An resource demanding internal action to get the measurement results
of. Must not be null
.rdia
. Changes to the returned
set will not modify the blackboard content. Is never null
.public Set<BranchDecisionMeasurementResult> getMeasurementResultsFor(SeffBranch branch)
branch
.branch
- A SEFF Branch to get the measurement results of. Must not be
null
.branch
. Changes to the
returned set will not modify the blackboard content. Is never null
.public Set<LoopRepetitionCountMeasurementResult> getMeasurementResultsFor(SeffLoop loop)
loop
.loop
- A SEFF Loop to get the measurement results of. Must not be null
.loop
. Changes to the returned
set will not modify the blackboard content. Is never null
.public Set<ParameterChangeMeasurementResult> getMeasurementResultsFor(ExternalCallParameter externalCallParameter)
externalCallParameter
.externalCallParameter
- An external parameter to get the measurement results
of. Must not be null
.externalCallParameter
. Changes
to the returned set will not modify the blackboard content. Is never
null
.public void addMeasurementResultFor(ResourceDemandingInternalAction rdia, ResourceDemandMeasurementResult results)
rdia
.rdia
- A resource demanding internal action that was measured. Must not be
null
.results
- The result of that measurement. Must not be null
.public void addMeasurementResultFor(SeffBranch branch, BranchDecisionMeasurementResult results)
branch
.branch
- A SEFF Branch which was measured. Must not be null
.results
- The result of that measurement. Must not be null
.public void addMeasurementResultFor(SeffLoop loop, LoopRepetitionCountMeasurementResult results)
loop
.loop
- A SEFF Loop which was measured. Must not be null
.results
- The result of that measurement. Must not be null
.public void addMeasurementResultFor(ExternalCallParameter parameter, ParameterChangeMeasurementResult results)
loop
.parameter
- An external call parameter which was measured. Must not be
null
.results
- The result of that measurement. Must not be null
.public Set<EvaluableExpression> getProposedExpressionFor(MeasurableSeffElement element)
element
.element
- A SEFF element. Must not be null
.element
.public void addProposedExpressionFor(MeasurableSeffElement element, EvaluableExpression expression)
expression
as a proposal.element
- A SEFF element. Must not be null
.expression
- An evaluable expression proposed to describe element
’s
measurement results. Must not be null
.public EvaluableExpression getFinalExpressionFor(MeasurableSeffElement element)
element
. The return value of this
method may change if
setFinalExpressionFor(MeasurableSeffElement, EvaluableExpression)
is
called with the same element
between calls to
addProposedExpressionFor
with this element as parameter.element
- A SEFF element. Must not be null
.element
.
null
if no expression has been marked yet.public void setFinalExpressionFor(MeasurableSeffElement element, EvaluableExpression expression)
expression
as the final description of element
’s measurement
results. Consecutive calls to this method with the same element
will
override previous settings.element
- A SEFF element Must not be null
.expression
- An evaluable expression describing element
’s measurement
results. May be null
to describe that no suitable expression was
found.public EvaluableExpressionFitnessFunction getFitnessFunction()
public <WRITTEN_TYPE extends Serializable> void writeFor(Class<? extends BlackboardStorer<WRITTEN_TYPE>> writer, WRITTEN_TYPE written)
writer
to the blackboard. This method serves as a type safe
mean for tools to store data that is not part of their results. Values stored here
will never contribute to Beagle’s results. Any class calling this method should
always pass its own Class instance as writer
. writer
has to implement BlackboardStorer
and thereby declare the type of values
they write. Calling this method will override any data potentially stored
previously for the given writer
.WRITTEN_TYPE
- written
’s type.writer
- The class the data should be written for. Must not be null
.written
- The data to write.readFor(Class)
public <WRITTEN_TYPE extends Serializable> WRITTEN_TYPE readFor(Class<? extends BlackboardStorer<WRITTEN_TYPE>> writer)
writer
through
writeFor(Class, Serializable)
.WRITTEN_TYPE
- The type of the data to be read.writer
- The class the desired data was written for. Must not be null
.writer
. null
if no data has been written for writer
yet.writeFor(Class, Serializable)
public ProjectInformation getProjectInformation()