Class StreamTracer

  • All Implemented Interfaces:
    ITracer, ITracer, ITracer

    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 Detail

      • emitFailed

        private boolean emitFailed
    • Constructor Detail

      • StreamTracer

        public StreamTracer​(java.io.Writer out,
                            java.lang.String... baseFolder)
        Creates a new stream tracer.
        Parameters:
        out - the output writer
        baseFolder - 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 writer
        emitFailed - whether failure causes shall be emitted
        baseFolder - optional base folders used to make matching (string) values relative
    • Method Detail

      • setTraceFilter

        public void setTraceFilter​(ITraceFilter filter)
        Description copied from interface: ITracer
        Sets a trace filter on this tracer.
        Specified by:
        setTraceFilter in interface ITracer
        Parameters:
        filter - the new trace filter, ignored if null
      • getTraceFilter

        public ITraceFilter getTraceFilter()
        Description copied from interface: ITracer
        Returns the active trace filter.
        Specified by:
        getTraceFilter in interface ITracer
        Returns:
        the filter, may be null if the tracer does not support filters
      • visitDef

        public void visitDef​(Def def,
                             RuntimeEnvironment<?,​?> environment)
        Description copied from interface: ITracer
        Starts visiting a sub-template.
        Specified by:
        visitDef in interface ITracer
        Parameters:
        def - the sub-template
        environment - the runtime environment
      • visitedDef

        public void visitedDef​(Def def,
                               RuntimeEnvironment<?,​?> environment,
                               java.lang.Object result)
        Description copied from interface: ITracer
        Ends visiting a sub-template.
        Specified by:
        visitedDef in interface ITracer
        Parameters:
        def - the sub-template
        environment - the runtime environment
        result - the execution result
      • visitedSwitch

        public void visitedSwitch​(java.lang.Object select,
                                  int alternative,
                                  java.lang.Object value)
        Description copied from interface: ITracer
        A switch statement was visited.
        Specified by:
        visitedSwitch in interface ITracer
        Parameters:
        select - the select value
        alternative - 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: ITracer
        Visiting a loop started.
        Specified by:
        visitLoop in interface ITracer
        Parameters:
        var - the loop/iterator variable
      • visitedLoop

        public void visitedLoop​(VariableDeclaration var)
        Description copied from interface: ITracer
        Visiting a loop ended.
        Specified by:
        visitedLoop in interface ITracer
        Parameters:
        var - the loop/iterator variable
      • visitAlternative

        public void visitAlternative​(boolean takeIf)
        Description copied from interface: ITracer
        An alternative was visited.
        Specified by:
        visitAlternative in interface ITracer
        Parameters:
        takeIf - if true the if-branch is used, false else the else-branch
      • failedAt

        public void failedAt​(ITemplateLangElement element)
        Description copied from interface: ITracer
        Is called when the execution of a template language element failed.
        Specified by:
        failedAt in interface ITracer
        Parameters:
        element - the failed element
      • getWriter

        protected ExpressionWriter getWriter​(java.io.Writer out)
        Description copied from class: StreamTracer
        Returns the writer for emitting expressions.
        Specified by:
        getWriter in class StreamTracer
        Parameters:
        out - the output target
        Returns:
        the writer
      • visitTemplate

        public void visitTemplate​(Template template)
        Description copied from interface: ITracer
        Starts visiting a template.
        Specified by:
        visitTemplate in interface ITracer
        Parameters:
        template - the template being visited
      • visitedTemplate

        public void visitedTemplate​(Template template)
        Description copied from interface: ITracer
        Ends visiting a template.
        Specified by:
        visitedTemplate in interface ITracer
        Parameters:
        template - the template
      • visitWhileBody

        public void visitWhileBody()
        Description copied from interface: ITracer
        Is called at the beginning of a while body being visited.
        Specified by:
        visitWhileBody in interface ITracer
      • visitedWhileBody

        public void visitedWhileBody()
        Description copied from interface: ITracer
        Is called at the end of a while body being visited.
        Specified by:
        visitedWhileBody in interface ITracer
      • visitFlush

        public void visitFlush()
        Description copied from interface: ITracer
        Is called before a content flush.
        Specified by:
        visitFlush in interface ITracer
      • visitedFlush

        public void visitedFlush()
        Description copied from interface: ITracer
        Is called after a content flush.
        Specified by:
        visitedFlush in interface ITracer