Class ProfilableRunConfiguration
- java.lang.Object
-
- org.eclipse.epsilon.common.launch.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProfilableRunConfiguration.Builder<C extends ProfilableRunConfiguration,B extends ProfilableRunConfiguration.Builder<C,B>>
-
Field Summary
Fields Modifier and Type Field Description protected boolean
hasRun
protected int
id
java.nio.file.Path
outputFile
protected java.lang.String
printMarker
protected java.util.Collection<ProfileDiagnostic>
profiledStages
boolean
profileExecution
protected java.lang.Object
result
java.nio.file.Path
script
boolean
showResults
protected int
targetRepeats
-
Constructor Summary
Constructors Modifier Constructor Description protected
ProfilableRunConfiguration(ProfilableRunConfiguration other)
protected
ProfilableRunConfiguration(ProfilableRunConfiguration.Builder<?,?> builder)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
afterRepeatLoop()
protected void
beforeRepeatLoop()
static <C extends ProfilableRunConfiguration,B extends ProfilableRunConfiguration.Builder<C,B>>
BBuilder(java.lang.Class<C> configClass)
java.lang.Object
call()
boolean
equals(java.lang.Object obj)
protected abstract java.lang.Object
execute()
protected static <C extends ProfilableRunConfiguration,B extends ProfilableRunConfiguration.Builder<C,B>>
java.lang.reflect.Constructor<B>findBuilder(java.lang.Class<C> configClass)
protected int
getCurrentRepeat()
java.time.Duration
getExecutionTime()
int
getId()
protected java.util.List<java.lang.Object>
getProfilingOutput()
java.lang.Object
getResult()
protected java.util.List<java.lang.Object>
getResultOutput()
java.lang.Object
getThrows()
protected void
handleException(java.lang.Exception ex)
int
hashCode()
protected boolean
isFirstRepeat()
protected boolean
isLastRepeat()
protected void
postExecute()
protected void
preExecute()
protected void
reset()
void
run()
java.lang.String
toString()
void
writeOut(java.lang.Object... lines)
protected void
writeOut(java.util.Collection<?> lines)
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.epsilon.common.function.CheckedSupplier
get
-
-
-
-
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
-
-
Constructor Detail
-
ProfilableRunConfiguration
protected ProfilableRunConfiguration(ProfilableRunConfiguration.Builder<?,?> builder)
-
ProfilableRunConfiguration
protected ProfilableRunConfiguration(ProfilableRunConfiguration other)
-
-
Method Detail
-
Builder
public static <C extends ProfilableRunConfiguration,B extends ProfilableRunConfiguration.Builder<C,B>> B Builder(java.lang.Class<C> configClass)
-
findBuilder
protected static <C extends ProfilableRunConfiguration,B extends ProfilableRunConfiguration.Builder<C,B>> java.lang.reflect.Constructor<B> findBuilder(java.lang.Class<C> configClass)
-
getThrows
public final java.lang.Object getThrows() throws java.lang.Exception
- Specified by:
getThrows
in interfaceCheckedSupplier<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 interfacejava.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 interfacejava.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 classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-