Class RecordingCounter<T>
Object
org.anchoranalysis.plugin.io.shared.RecordingCounter<T>
- Type Parameters:
T- shared-state ofCopyFilesNaming
public class RecordingCounter<T> extends Object
A counter that also records outputs in a message-log and CSV file.
The following outputs are produced:
| Output Name | Default? | Description |
|---|---|---|
| "copyLog" | no | a text log file showing each copy operation (and any skipped files). |
| "pathMapping" | no | a CSV file showing the source and destination paths for each copy operation (skipped files are not included).. |
- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description RecordingCounter(org.anchoranalysis.math.arithmetic.Counter counter, org.anchoranalysis.io.output.outputter.Outputter outputter, T namingSharedState) -
Method Summary
Modifier and Type Method Description voidcloseLogger()Closes the logger.TgetNamingSharedState()intincrementCounter()Increments the counter.voidrecordCopiedOutput(Path source, Optional<Path> destination, int index)Records an copy operation in the log / CSV path mapping.
-
Constructor Details
-
RecordingCounter
public RecordingCounter(org.anchoranalysis.math.arithmetic.Counter counter, org.anchoranalysis.io.output.outputter.Outputter outputter, T namingSharedState) throws org.anchoranalysis.core.exception.OperationFailedException- Throws:
org.anchoranalysis.core.exception.OperationFailedException
-
-
Method Details
-
incrementCounter
public int incrementCounter()Increments the counter.This is thread-safe.
- Returns:
- the index of the counter before being incremented.
-
recordCopiedOutput
public void recordCopiedOutput(Path source, Optional<Path> destination, int index) throws org.anchoranalysis.core.exception.OperationFailedExceptionRecords an copy operation in the log / CSV path mapping.This also performs a check that multiple files are writing to the same output destination.
- Parameters:
source- source-path for copying operationdestination- destination-path for copying operationindex- the index of file (an integer number uniquely assigned to each operation)- Throws:
org.anchoranalysis.core.exception.OperationFailedException- if this method has been previously called with an identicaldestination(only if it's not-empty).
-
closeLogger
public void closeLogger()Closes the logger. -
getNamingSharedState
-