public class CSVLogger<K> extends Object implements SignalProbe<Object>, AutoCloseable
Modifier and Type | Field and Description |
---|---|
protected Function<Boolean,String> |
booleanFormat |
protected DoubleFunction<String> |
doubleFormat |
protected Supplier<String> |
eventFormat |
protected Function<Float,String> |
floatFormat |
protected Function<Object,String> |
format |
protected IntFunction<String> |
intFormat |
protected Map<K,Integer> |
key2index |
protected Map<K,String> |
key2name |
protected List<K> |
keys |
protected String[] |
line |
protected LongFunction<String> |
longFormat |
protected PrintWriter |
out |
protected String |
separator |
Constructor and Description |
---|
CSVLogger(PrintWriter out) |
Modifier and Type | Method and Description |
---|---|
void |
addColumn(K key,
Optional<String> name) |
void |
close() |
Process |
getBeginLine() |
Process |
getEndLine() |
String |
getSeparator() |
void |
monitor(Object key)
Notify this observer of an event associated with a given key.
|
void |
monitor(Object key,
boolean value)
Notify this observer of a
boolean signal value associated with a
given key. |
void |
monitor(Object key,
double value)
Notify this observer of a
double signal value associated with a
given key. |
void |
monitor(Object key,
float value)
Notify this observer of a
float signal value associated with a
given key. |
void |
monitor(Object key,
int value)
Notify this observer of a
int signal value associated with a
given key. |
void |
monitor(Object key,
long value)
Notify this observer of a
long signal value associated with a
given key. |
void |
monitor(Object key,
Object value)
Notify this observer of a signal value object associated with a
given key.
|
protected void |
newln() |
void |
printHeader() |
protected void |
println() |
protected void |
record(Object key,
String text) |
void |
setFloatFormat(Function<Float,String> floatFormat) |
void |
setFloatFormat(String floatFormat) |
void |
setSeparator(String separator) |
Process |
watch(Process body) |
protected final PrintWriter out
protected String[] line
protected String separator
protected IntFunction<String> intFormat
protected LongFunction<String> longFormat
protected DoubleFunction<String> doubleFormat
public CSVLogger(PrintWriter out)
public String getSeparator()
public void setSeparator(String separator)
public void setFloatFormat(String floatFormat)
public void printHeader()
public Process getBeginLine()
public Process getEndLine()
protected void newln()
protected void println()
public void monitor(Object key, boolean value)
SignalProbe
boolean
signal value associated with a
given key.monitor
in interface SignalProbe<Object>
key
- the keyvalue
- the current valuepublic void monitor(Object key, int value)
SignalProbe
int
signal value associated with a
given key.monitor
in interface SignalProbe<Object>
key
- the keyvalue
- the current valuepublic void monitor(Object key, long value)
SignalProbe
long
signal value associated with a
given key.monitor
in interface SignalProbe<Object>
key
- the keyvalue
- the current valuepublic void monitor(Object key, float value)
SignalProbe
float
signal value associated with a
given key.monitor
in interface SignalProbe<Object>
key
- the keyvalue
- the current valuepublic void monitor(Object key, double value)
SignalProbe
double
signal value associated with a
given key.monitor
in interface SignalProbe<Object>
key
- the keyvalue
- the current valuepublic void monitor(Object key, Object value)
SignalProbe
monitor
in interface SignalProbe<Object>
key
- the keyvalue
- the current valuepublic void monitor(Object key)
SignalProbe
monitor
in interface SignalProbe<Object>
key
- the keypublic void close()
close
in interface AutoCloseable