Class BasePipelineChange<T>
java.lang.Object
nz.org.riskscape.wizard.bld.change.BasePipelineChange<T>
- All Implemented Interfaces:
PipelineChange
- Direct Known Subclasses:
AppendStepChange
,StartChainChange
Base class for any PipelineChange
that follows a standard string -> ast -> validate -> update
pattern
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract String
TODO maybe break this up in to something else?final nz.org.riskscape.problem.ResultOrProblems<IncrementalBuildState>
make
(IncrementalBuildState state) Attempt to create a new IncrementalBuildState for this changetoString()
static String
Template for a pipeline change tostringprotected abstract nz.org.riskscape.pipeline.ast.PipelineDeclaration
updateAst
(IncrementalBuildState state, nz.org.riskscape.pipeline.ast.PipelineDeclaration astSegment, T validated) Build a new AST that is the result of this changeprotected abstract T
validateParsedSegment
(nz.org.riskscape.pipeline.ast.PipelineDeclaration declaration) Validate that the parsed pipeline segment is ok to use in this kind of change.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface nz.org.riskscape.wizard.bld.PipelineChange
getQuestion, getQuestionSet, parse
-
Constructor Details
-
BasePipelineChange
-
-
Method Details
-
toString
Template for a pipeline change tostring
-
make
public final nz.org.riskscape.problem.ResultOrProblems<IncrementalBuildState> make(IncrementalBuildState state) Description copied from interface:PipelineChange
Attempt to create a new IncrementalBuildState for this change
- Specified by:
make
in interfacePipelineChange
- Returns:
- a new IncrementalBuildState with this change applied
-
validateParsedSegment
protected abstract T validateParsedSegment(nz.org.riskscape.pipeline.ast.PipelineDeclaration declaration) throws BadPipelineChangeException Validate that the parsed pipeline segment is ok to use in this kind of change.
- Returns:
- the interesting bit of the pipeline, e.g. a single step, a step chain, whatever
- Throws:
BadPipelineChangeException
- if it's invalid - it has been coded badly (not a user error)
-
updateAst
protected abstract nz.org.riskscape.pipeline.ast.PipelineDeclaration updateAst(IncrementalBuildState state, nz.org.riskscape.pipeline.ast.PipelineDeclaration astSegment, T validated) Build a new AST that is the result of this change
- Parameters:
state
- the previous build state that we are building uponastSegment
- the segment that was parsed and validated. This is not the previous state's ast.validated
- the chunk of the parsed segment that the validate routine method returned - this is often the node of interest that ultimately gets added to the previous state's ast- Returns:
- a pipeline ast to be used in the next
IncrementalBuildState
-
getSource
TODO maybe break this up in to something else?
- Returns:
- the source code that was assembled to be parsed in to a
PipelineDeclaration
-
toString
-
getAnswer
- Specified by:
getAnswer
in interfacePipelineChange
- Returns:
- the Answer that was ultimately responsible for this
PipelineChange
being introduced. Note that this might not be the only thing that predicated this change, but it is the last thing that caused it (the straw that broke the camel's back, so to speak)
-