Class PythonExporter
java.lang.Object
ca.mcscert.jpipe.visitor.AbstractModelExporter
ca.mcscert.jpipe.visitor.PythonExporter
- All Implemented Interfaces:
JustificationVisitor<Void>
Serialises a single
JustificationModel to a Python module: each
element becomes a decorated function named after the element's label
(snake_case via LabelEscaper). Two decorators are emitted per
function:
@jpipe_link("<modelName:elementId>")— links the function back to the originating jPipe element.@jpipe(produce=[], consume=[])— placeholder decorators to be filled in by the developer.
Each function carries a docstring with the original element label so the full text is always recoverable regardless of escaping.
This visitor operates on one model at a time. Use SelectModel in the
compilation pipeline to extract the desired model from a
before
invoking this exporter.invalid reference
Unit
-
Field Summary
Fields inherited from class AbstractModelExporter
builder, currentModelName -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexport(JustificationModel<?> model) Serialisemodelto Python source text without a file header.export(JustificationModel<?> model, String sourcePath) Serialisemodelto Python source text, optionally prefixed with a generated-file header comment.protected voidexportModel(JustificationModel<?> model) Performs the actual serialisation ofmodel.visit(AbstractSupport abstractSupport) visit(Conclusion conclusion) visit(SubConclusion subConclusion) Methods inherited from class AbstractModelExporter
qualify, visit, visit, visit
-
Constructor Details
-
PythonExporter
public PythonExporter()
-
-
Method Details
-
export
Serialisemodelto Python source text without a file header.- Parameters:
model- the justification or template to serialise.- Returns:
- Python source text.
-
export
Serialisemodelto Python source text, optionally prefixed with a generated-file header comment.- Parameters:
model- the justification or template to serialise.sourcePath- path of the originating.jdfile, included in the header comment; may benullto omit the header.- Returns:
- Python source text.
-
visit
-
visit
-
visit
-
visit
-
visit
-
exportModel
Description copied from class:AbstractModelExporterPerforms the actual serialisation ofmodel. Implementations must setAbstractModelExporter.currentModelName= model.getName()before calling any element visit methods.- Specified by:
exportModelin classAbstractModelExporter
-