Class ProfilableRunConfiguration

  • All Implemented Interfaces:
    java.lang.Runnable, java.util.concurrent.Callable<java.lang.Object>, java.util.function.Supplier<java.lang.Object>, CheckedSupplier<java.lang.Object,​java.lang.Exception>
    Direct Known Subclasses:
    EolRunConfiguration

    public abstract class ProfilableRunConfiguration
    extends java.lang.Object
    implements java.lang.Runnable, java.util.concurrent.Callable<java.lang.Object>, CheckedSupplier<java.lang.Object,​java.lang.Exception>
    Generic utility class for building standalone applications with support for:
    - Multi-stage, detailed AST profiling
    - Writing to output files
    - Identifying and comparing configurations
    - Displaying results
    - Building configurations using an elegant builder syntax
    ... and more

    The intention is that this class is used as a base for building more complex standalone run configurations which can be built and invoked easily (at least, from the client's perspective!).
    Since:
    1.6
    Author:
    Sina Madani
    • Field Detail

      • printMarker

        protected java.lang.String printMarker
      • id

        protected int id
      • showResults

        public final boolean showResults
      • profileExecution

        public final boolean profileExecution
      • script

        public final java.nio.file.Path script
      • outputFile

        public final java.nio.file.Path outputFile
      • profiledStages

        protected final java.util.Collection<ProfileDiagnostic> profiledStages
      • hasRun

        protected boolean hasRun
      • result

        protected java.lang.Object result
      • targetRepeats

        protected final int targetRepeats
    • Method Detail

      • getThrows

        public final java.lang.Object getThrows()
                                         throws java.lang.Exception
        Specified by:
        getThrows in interface CheckedSupplier<java.lang.Object,​java.lang.Exception>
        Throws:
        java.lang.Exception
      • call

        public final java.lang.Object call()
                                    throws java.lang.Exception
        Specified by:
        call in interface java.util.concurrent.Callable<java.lang.Object>
        Throws:
        java.lang.Exception
      • beforeRepeatLoop

        protected void beforeRepeatLoop()
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • afterRepeatLoop

        protected void afterRepeatLoop()
                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getCurrentRepeat

        protected final int getCurrentRepeat()
      • isFirstRepeat

        protected final boolean isFirstRepeat()
      • isLastRepeat

        protected final boolean isLastRepeat()
      • run

        public final void run()
        Specified by:
        run in interface java.lang.Runnable
      • handleException

        protected void handleException​(java.lang.Exception ex)
      • preExecute

        protected void preExecute()
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • execute

        protected abstract java.lang.Object execute()
                                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getProfilingOutput

        protected java.util.List<java.lang.Object> getProfilingOutput()
      • getResultOutput

        protected java.util.List<java.lang.Object> getResultOutput()
      • postExecute

        protected void postExecute()
                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • reset

        protected void reset()
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getExecutionTime

        public java.time.Duration getExecutionTime()
      • getResult

        public java.lang.Object getResult()
      • getId

        public int getId()
      • writeOut

        public final void writeOut​(java.lang.Object... lines)
      • writeOut

        protected void writeOut​(java.util.Collection<?> lines)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object