Class StreamTracer
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.expressions.AbstractWriter
-
- net.ssehub.easy.instantiation.core.model.expressions.StreamTracer
-
- net.ssehub.easy.instantiation.core.model.common.StreamTracer
-
- net.ssehub.easy.instantiation.core.model.templateModel.StreamTracer
-
public class StreamTracer extends StreamTracer implements ITracer
Implements a simple stream-based execution tracer. Produces normalized sequences of collections in order to facilitate easy comparison. As this may affect followup computations, don't use this tracer for real execution!- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private booleanemitFailed-
Fields inherited from class net.ssehub.easy.instantiation.core.model.expressions.StreamTracer
NORMALIZER
-
-
Constructor Summary
Constructors Constructor Description StreamTracer(java.io.Writer out, boolean emitFailed, java.lang.String... baseFolder)Creates a new stream tracer.StreamTracer(java.io.Writer out, java.lang.String... baseFolder)Creates a new stream tracer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfailedAt(ITemplateLangElement element)Is called when the execution of a template language element failed.protected ExpressionWritergetWriter(java.io.Writer out)Returns the writer for emitting expressions.voidvisitAlternative(boolean takeIf)An alternative was visited.voidvisitDef(Def def, RuntimeEnvironment<?,?> environment)Starts visiting a sub-template.voidvisitedDef(Def def, RuntimeEnvironment<?,?> environment, java.lang.Object result)Ends visiting a sub-template.voidvisitedFlush()Is called after a content flush.voidvisitedLoop(VariableDeclaration var)Visiting a loop ended.voidvisitedSwitch(java.lang.Object select, int alternative, java.lang.Object value)A switch statement was visited.voidvisitedTemplate(Template template)Ends visiting a template.voidvisitedWhileBody()Is called at the end of a while body being visited.voidvisitFlush()Is called before a content flush.voidvisitLoop(VariableDeclaration var)Visiting a loop started.voidvisitTemplate(Template template)Starts visiting a template.voidvisitWhileBody()Is called at the beginning of a while body being visited.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.common.StreamTracer
enable, isEnabled, printValueDefined, trace, traceError, traceExecutionException, traceWarning, valueDefined
-
Methods inherited from class net.ssehub.easy.instantiation.core.model.expressions.StreamTracer
failedAt, getLocale, getRuntimeEnvironment, makeRelative, makeRelative, makeRelative, setLocale, setRuntimeEnvironment, visitedCallExpression, visitingCallExpression
-
Methods inherited from class net.ssehub.easy.instantiation.core.model.expressions.AbstractWriter
decreaseIndentation, flush, getOut, increaseIndentation, print, print, print, print, printIndentation, printJavaEscaped, println, println, println, println, println, printWhitespace, setIndentation
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.common.ITracer
enable, trace, traceError, traceExecutionException, traceWarning, valueDefined
-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.expressions.ITracer
failedAt, getLocale, getRuntimeEnvironment, setLocale, setRuntimeEnvironment, visitedCallExpression, visitingCallExpression
-
-
-
-
Constructor Detail
-
StreamTracer
public StreamTracer(java.io.Writer out, java.lang.String... baseFolder)Creates a new stream tracer.- Parameters:
out- the output writerbaseFolder- optional base folders used to make matching (string) values relative
-
StreamTracer
public StreamTracer(java.io.Writer out, boolean emitFailed, java.lang.String... baseFolder)Creates a new stream tracer.- Parameters:
out- the output writeremitFailed- whether failure causes shall be emittedbaseFolder- optional base folders used to make matching (string) values relative
-
-
Method Detail
-
visitDef
public void visitDef(Def def, RuntimeEnvironment<?,?> environment)
Description copied from interface:ITracerStarts visiting a sub-template.
-
visitedDef
public void visitedDef(Def def, RuntimeEnvironment<?,?> environment, java.lang.Object result)
Description copied from interface:ITracerEnds visiting a sub-template.- Specified by:
visitedDefin interfaceITracer- Parameters:
def- the sub-templateenvironment- the runtime environmentresult- the execution result
-
visitedSwitch
public void visitedSwitch(java.lang.Object select, int alternative, java.lang.Object value)Description copied from interface:ITracerA switch statement was visited.- Specified by:
visitedSwitchin interfaceITracer- Parameters:
select- the select valuealternative- the successive alternative (0-based index including default)value- the actual value of the switch statement
-
visitLoop
public void visitLoop(VariableDeclaration var)
Description copied from interface:ITracerVisiting a loop started.
-
visitedLoop
public void visitedLoop(VariableDeclaration var)
Description copied from interface:ITracerVisiting a loop ended.- Specified by:
visitedLoopin interfaceITracer- Parameters:
var- the loop/iterator variable
-
visitAlternative
public void visitAlternative(boolean takeIf)
Description copied from interface:ITracerAn alternative was visited.- Specified by:
visitAlternativein interfaceITracer- Parameters:
takeIf- iftruethe if-branch is used,falseelse the else-branch
-
failedAt
public void failedAt(ITemplateLangElement element)
Description copied from interface:ITracerIs called when the execution of a template language element failed.
-
getWriter
protected ExpressionWriter getWriter(java.io.Writer out)
Description copied from class:StreamTracerReturns the writer for emitting expressions.- Specified by:
getWriterin classStreamTracer- Parameters:
out- the output target- Returns:
- the writer
-
visitTemplate
public void visitTemplate(Template template)
Description copied from interface:ITracerStarts visiting a template.- Specified by:
visitTemplatein interfaceITracer- Parameters:
template- the template being visited
-
visitedTemplate
public void visitedTemplate(Template template)
Description copied from interface:ITracerEnds visiting a template.- Specified by:
visitedTemplatein interfaceITracer- Parameters:
template- the template
-
visitWhileBody
public void visitWhileBody()
Description copied from interface:ITracerIs called at the beginning of a while body being visited.- Specified by:
visitWhileBodyin interfaceITracer
-
visitedWhileBody
public void visitedWhileBody()
Description copied from interface:ITracerIs called at the end of a while body being visited.- Specified by:
visitedWhileBodyin interfaceITracer
-
visitFlush
public void visitFlush()
Description copied from interface:ITracerIs called before a content flush.- Specified by:
visitFlushin interfaceITracer
-
visitedFlush
public void visitedFlush()
Description copied from interface:ITracerIs called after a content flush.- Specified by:
visitedFlushin interfaceITracer
-
-