public class ResultFormatterDate extends AbstractResultFormatter implements ResultFormatter
ResultFormatter
that formats the timestamp with
a SimpleDateFormat
pattern. The user can set a timebase so
that all generated timestamps are computed astimestamp = result.getTimestamp() - timebase
.
The separator can be configured via AbstractResultFormatter.setSeparator(String)
. Also, it
can be configured via AbstractResultFormatter.setShowProxy(boolean)
if the proxy is shown or
not.
Sample output (timebase set to execution start time, proxy is not shown):
00:00.191 0 00:01.191 1 00:02.197 2 00:03.198 3 00:04.199 4 00:05.200 5 00:06.201 6 00:07.202 7 00:08.203 8 00:09.204 9
Constructor and Description |
---|
ResultFormatterDate()
Default constructor.
|
ResultFormatterDate(String pattern)
Constructs a new ResultFormatterDate using the SimpleDateFormat pattern
pattern to format the timestamp. |
ResultFormatterDate(String pattern,
Date timebase)
Constructs a new ResultFormatterDate using the SimpleDateFormat pattern
pattern to format the timestamp. |
ResultFormatterDate(String pattern,
long timebase)
Constructs a new ResultFormatterDate using the SimpleDateFormat pattern
pattern to format the timestamp. |
ResultFormatterDate(String pattern,
String separator)
Constructs a new ResultFormatterDate using the SimpleDateFormat pattern
pattern to format the timestamp. |
ResultFormatterDate(String pattern,
String separator,
Date timebase)
Constructs a new ResultFormatterDate using the SimpleDateFormat pattern
pattern to format the timestamp. |
ResultFormatterDate(String pattern,
String separator,
long timebase)
Constructs a new ResultFormatterDate using the SimpleDateFormat pattern
pattern to format the timestamp. |
Modifier and Type | Method and Description |
---|---|
String |
format(Result result)
Transforms the result to a String representation.
|
String |
getPattern()
Gets the SimpleDateFormat pattern used to format the timestamp.
|
long |
getTimebase()
Gets the timebase.
|
void |
setPattern(String pattern)
Sets time SimpleDateFormat pattern used to format the timestamp.
|
void |
setTimebase(Date timebase)
Sets the timebase.
|
void |
setTimebase(long timebase)
Sets the timebase.
|
getSeparator, isShowProxy, setSeparator, setShowProxy
public ResultFormatterDate()
public ResultFormatterDate(String pattern)
pattern
to format the timestamp.pattern
- a SimpleDateFormat pattern, see
SimpleDateFormat
.public ResultFormatterDate(String pattern, Date timebase)
pattern
to format the timestamp. Additionally, the timebase
is set.pattern
- a SimpleDateFormat pattern, see
SimpleDateFormat
.timebase
- the timebase to setpublic ResultFormatterDate(String pattern, long timebase)
pattern
to format the timestamp. Additionally, the timebase
is set.pattern
- a SimpleDateFormat pattern, see
SimpleDateFormat
.timebase
- the timebase to setpublic ResultFormatterDate(String pattern, String separator)
pattern
to format the timestamp. Additionally, the separator
is set.pattern
- a SimpleDateFormat pattern, see
SimpleDateFormat
.separator
- the separator to setpublic ResultFormatterDate(String pattern, String separator, Date timebase)
pattern
to format the timestamp. Additionally, the timebase
and the separator are set.pattern
- a SimpleDateFormat pattern, see
SimpleDateFormat
.separator
- the separator to settimebase
- the timebase to setpublic ResultFormatterDate(String pattern, String separator, long timebase)
pattern
to format the timestamp. Additionally, the timebase
and the separator are set.pattern
- a SimpleDateFormat pattern, see
SimpleDateFormat
.separator
- the separator to settimebase
- the timebase to setpublic String format(Result result)
ResultFormatter
format
in interface ResultFormatter
result
- the result to be transformedpublic long getTimebase()
result.getTimestamp() - timebase
.public void setTimebase(long timebase)
result.getTimestamp() - timebase
.timebase
- the timebase to setpublic void setTimebase(Date timebase)
result.getTimestamp() - timebase
.timebase
- the timebase to setpublic String getPattern()
public void setPattern(String pattern)
pattern
- the pattern to setCopyright (c) Salzburg Research Forschungsgesellschaft mbH. All rights reserved.