public class OperationHistoryLogger extends java.lang.Object implements OperationHistoryLogInterface
OperationHistoryLogInterface that will collect and print
the operation history log to the PrintWriter given when constructed.| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<TypedOperation,java.util.EnumMap<OperationOutcome,java.lang.Integer>> |
operationMap
A sparse representation for the operation-outcome table.
|
private java.io.PrintWriter |
writer
The
PrintWriter for outputting the operation history as a table. |
| Constructor and Description |
|---|
OperationHistoryLogger(java.io.PrintWriter writer)
Creates an
OperationHistoryLogger that will write to the given PrintWriter. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(TypedOperation operation,
OperationOutcome outcome)
Increments the count for
operation and outcome. |
void |
outputTable()
Prints a table showing the counts for each operation-outcome pair in the operation history log.
|
private java.util.Map<OperationOutcome,java.lang.String> |
printHeader(int firstColumnLength)
Writes the header for the operation history table, and constructs a map of format strings for
the columns of the table matching the length of the outcome names.
|
private void |
printRow(int firstColumnLength,
java.util.Map<OperationOutcome,java.lang.String> formatMap,
TypedOperation operation,
java.util.EnumMap<OperationOutcome,java.lang.Integer> countMap)
Writes a row for a particular operation consisting of the operation signature and the counts of
sequences for each outcome.
|
private final java.io.PrintWriter writer
PrintWriter for outputting the operation history as a table.private final java.util.Map<TypedOperation,java.util.EnumMap<OperationOutcome,java.lang.Integer>> operationMap
operationMap.get(A).get(B) is the number of times that (A, B) were arguments to add(randoop.operation.TypedOperation, randoop.generation.OperationOutcome).public OperationHistoryLogger(java.io.PrintWriter writer)
OperationHistoryLogger that will write to the given PrintWriter.writer - the PrintWriter for writing the table from the created operation historypublic void add(TypedOperation operation, OperationOutcome outcome)
OperationHistoryLogInterfaceoperation and outcome.add in interface OperationHistoryLogInterfaceoperation - the TypedOperationoutcome - the generation outcome for the operationpublic void outputTable()
OperationHistoryLogInterfaceoutputTable in interface OperationHistoryLogInterfaceprivate java.util.Map<OperationOutcome,java.lang.String> printHeader(int firstColumnLength)
firstColumnLength - the width to use for the first columnOperationOutcome value to numeric column format for subsequent rowsprivate void printRow(int firstColumnLength,
java.util.Map<OperationOutcome,java.lang.String> formatMap,
TypedOperation operation,
java.util.EnumMap<OperationOutcome,java.lang.Integer> countMap)
firstColumnLength - the width to use for the first columnformatMap - the map of format strings for the counts for each outcomeoperation - the operation for the rowcountMap - the map of counts for the operation and each outcome