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.buildlangModel.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! Does not support filtering.- 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 file tracer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<java.lang.Object>adjustSequenceForJoin(Collection<java.lang.Object> collection)Allows a tracer to change the sequence of processing a map collection.Collection<?>adjustSequenceForMap(Collection<?> collection)Allows a tracer to change the sequence of processing a map collection.voidfailedAt(IBuildlangElement element)Is called when the execution of a build language element failed.ITraceFiltergetTraceFilter()Returns the active trace filter.protected ExpressionWritergetWriter(java.io.Writer out)Returns the writer for emitting expressions.voidreset()Resets this tracer for reuse.voidsetTraceFilter(ITraceFilter filter)Sets a trace filter on this tracer.voidvisitAlternative(boolean takeIf)An alternative was visited.voidvisitedInstantiator(java.lang.String name, java.lang.Object result)Is called when an instantiator was visited / executed.voidvisitedLoop(IEnumeratingLoop loop, RuntimeEnvironment<?,?> environment)Is called when visiting a map ends.voidvisitedRule(Rule rule, RuntimeEnvironment<?,?> environment, java.lang.Object result)Is called when visiting a rule ends.voidvisitedScript(Script script)Is called when visiting a script ends.voidvisitedWhileBody()Is called when visiting a while body ends.voidvisitingInstantiator(java.lang.String name)Is called when an instantiator is being visited / executed.voidvisitIteratorAssignment(IEnumeratingLoop loop, VariableDeclaration var, java.lang.Object value)Is called when a loop iterator variable is assigned.voidvisitLoop(IEnumeratingLoop loop, RuntimeEnvironment<?,?> environment)Is called when visiting a map starts.voidvisitRule(Rule rule, RuntimeEnvironment<?,?> environment)Is called when visiting a rule starts.voidvisitScript(Script script, RuntimeEnvironment<?,?> environment)Is called when a script (header) is being visited.voidvisitScriptBody(Script script, RuntimeEnvironment<?,?> environment)Is called when a script (body) is being visited.voidvisitSystemCall(java.lang.String[] args)Is called before executing a system call.voidvisitWhileBody()Is called when visiting a while body starts.-
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 file 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
-
setTraceFilter
public void setTraceFilter(ITraceFilter filter)
Description copied from interface:ITracerSets a trace filter on this tracer.- Specified by:
setTraceFilterin interfaceITracer- Parameters:
filter- the new trace filter, ignored if null
-
getTraceFilter
public ITraceFilter getTraceFilter()
Description copied from interface:ITracerReturns the active trace filter.- Specified by:
getTraceFilterin interfaceITracer- Returns:
- the filter, may be null if the tracer does not support filters
-
visitRule
public void visitRule(Rule rule, RuntimeEnvironment<?,?> environment)
Description copied from interface:ITracerIs called when visiting a rule starts.
-
visitedRule
public void visitedRule(Rule rule, RuntimeEnvironment<?,?> environment, java.lang.Object result)
Description copied from interface:ITracerIs called when visiting a rule ends.- Specified by:
visitedRulein interfaceITracer- Parameters:
rule- the rule being visitedenvironment- the runtime environmentresult- the result produced by the rule
-
visitLoop
public void visitLoop(IEnumeratingLoop loop, RuntimeEnvironment<?,?> environment)
Description copied from interface:ITracerIs called when visiting a map starts.
-
visitIteratorAssignment
public void visitIteratorAssignment(IEnumeratingLoop loop, VariableDeclaration var, java.lang.Object value)
Description copied from interface:ITracerIs called when a loop iterator variable is assigned.- Specified by:
visitIteratorAssignmentin interfaceITracer- Parameters:
loop- the loopvar- the iterator variablevalue- the actual value
-
visitedLoop
public void visitedLoop(IEnumeratingLoop loop, RuntimeEnvironment<?,?> environment)
Description copied from interface:ITracerIs called when visiting a map ends.- Specified by:
visitedLoopin interfaceITracer- Parameters:
loop- the loop being visitedenvironment- the runtime environment
-
adjustSequenceForMap
public Collection<?> adjustSequenceForMap(Collection<?> collection)
Description copied from interface:ITracerAllows a tracer to change the sequence of processing a map collection. This is intended for testing and debugging only as it normalizes and, thus, interfers with the actual execution sequence.- Specified by:
adjustSequenceForMapin interfaceITracer- Parameters:
collection- the collection to be considered- Returns:
- the new sequence (just the elements may be reordered)
-
adjustSequenceForJoin
public Collection<java.lang.Object> adjustSequenceForJoin(Collection<java.lang.Object> collection)
Description copied from interface:ITracerAllows a tracer to change the sequence of processing a map collection. This is intended for testing and debugging only as it normalizes and, thus, interfers with the actual execution sequence.- Specified by:
adjustSequenceForJoinin interfaceITracer- Parameters:
collection- the collection to be considered- Returns:
- the new sequence (just the elements may be reordered)
-
visitSystemCall
public void visitSystemCall(java.lang.String[] args)
Description copied from interface:ITracerIs called before executing a system call.- Specified by:
visitSystemCallin interfaceITracer- Parameters:
args- the arguments for the system call
-
visitingInstantiator
public void visitingInstantiator(java.lang.String name)
Description copied from interface:ITracerIs called when an instantiator is being visited / executed.- Specified by:
visitingInstantiatorin interfaceITracer- Parameters:
name- the name of the instantiator
-
visitedInstantiator
public void visitedInstantiator(java.lang.String name, java.lang.Object result)Description copied from interface:ITracerIs called when an instantiator was visited / executed.- Specified by:
visitedInstantiatorin interfaceITracer- Parameters:
name- the name of the instantiatorresult- the result of the execution
-
failedAt
public void failedAt(IBuildlangElement element)
Description copied from interface:ITracerIs called when the execution of a build 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
-
visitScript
public void visitScript(Script script, RuntimeEnvironment<?,?> environment)
Description copied from interface:ITracerIs called when a script (header) is being visited.- Specified by:
visitScriptin interfaceITracer- Parameters:
script- the scriptenvironment- the runtime environment
-
visitScriptBody
public void visitScriptBody(Script script, RuntimeEnvironment<?,?> environment)
Description copied from interface:ITracerIs called when a script (body) is being visited.- Specified by:
visitScriptBodyin interfaceITracer- Parameters:
script- the scriptenvironment- the runtime environment
-
visitedScript
public void visitedScript(Script script)
Description copied from interface:ITracerIs called when visiting a script ends.- Specified by:
visitedScriptin interfaceITracer- Parameters:
script- the script
-
reset
public void reset()
Description copied from interface:ITracerResets this tracer for reuse.
-
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
-
visitWhileBody
public void visitWhileBody()
Description copied from interface:ITracerIs called when visiting a while body starts.- Specified by:
visitWhileBodyin interfaceITracer
-
visitedWhileBody
public void visitedWhileBody()
Description copied from interface:ITracerIs called when visiting a while body ends.- Specified by:
visitedWhileBodyin interfaceITracer
-
-