public class Result extends Object implements Comparable<Result>
There is a generic getter getValue()
that returns the value as a
String. Additionally, there are getters that (try to) convert the String
value to an int / long / double.
The class provides a toString()
implementation that converts to
{timestamp}{separator}{value}[{separator}{proxy}]The default separator is "\t". It can be modified via
Result.SEPARATOR = "someString"
. The proxy name is only
printed if it is not null.
For far more flexible ways of converting Results to Strings, please see the
ResultFormatter
interface. A user can provide his/her own
implementation for this interface or make use of implementations that are
shipped with the clientlib, e.g. ResultFormatterSimple
,
ResultFormatterDate
, and ResultFormatterDeltaTime
.
Utility methods for printing and saving Results are provided in the
Results
class which makes use of ResultFormatter
implementations.
Modifier and Type | Field and Description |
---|---|
static String |
SEPARATOR |
Constructor and Description |
---|
Result(long timestamp,
String value)
Constructs a new Result from a timestamp and a value.
|
Result(long timestamp,
String value,
Proxy proxy)
Constructs a new Result from a timestamp, a value and a proxy.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Result o) |
double |
getDouble()
Gets the result value converted to a double.
|
int |
getInt()
Gets the result value converted to an int.
|
long |
getLong()
Gets the result value converted to a long.
|
Proxy |
getProxy()
Gets the proxy where the result was generated.
|
long |
getTimestamp()
Gets the timestamp of the result as set by the tool that produced it.
|
String |
getValue()
Gets the String representation of the result value.
|
void |
setProxy(Proxy proxy)
Sets the proxy where the result was generated.
|
String |
toString() |
public Result(long timestamp, String value)
timestamp
- The timestampvalue
- The value in String representationpublic Result(long timestamp, String value, Proxy proxy)
timestamp
- The timestampvalue
- The value in String representationproxy
- the proxy where the result was generatedpublic long getTimestamp()
public String getValue()
getInt()
, getLong()
, or getDouble()
, respectively.public int getInt()
public long getLong()
public double getDouble()
public String toString()
toString
in class Object
public Proxy getProxy()
public void setProxy(Proxy proxy)
proxy
- the proxy to setCopyright (c) Salzburg Research Forschungsgesellschaft mbH. All rights reserved.