diff --git a/pom.xml b/pom.xml
index dc00df9..bafbcbf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.riscure
trsfile
- 2.2.3
+ 2.2.4
jar
${project.groupId}:${project.artifactId}
diff --git a/src/main/java/com/riscure/trs/Trace.java b/src/main/java/com/riscure/trs/Trace.java
index fc3415f..9187e7c 100644
--- a/src/main/java/com/riscure/trs/Trace.java
+++ b/src/main/java/com/riscure/trs/Trace.java
@@ -11,6 +11,9 @@
* including potential associated data and a title
*/
public class Trace {
+ private static final String TO_STRING_FORMAT = "Trace{Title='%s', numberOfSamples=%d, shifted=%d, " +
+ "aggregatesValid=%b, hasIllegalValues=%b, isReal=%b, max=%f, min=%f%n%s}";
+
/**
* Factory method. This will copy the sample array for stability.
* @param sample the sample array
@@ -194,6 +197,12 @@ public void setTraceSet(TraceSet traceSet) {
this.traceSet = traceSet;
}
+ @Override
+ public String toString() {
+ return String.format(TO_STRING_FORMAT, title, sample.array().length, shifted,
+ aggregatesValid, hasIllegalValues, isReal, max, min, parameters);
+ }
+
/** A map of all custom named trace parameters */
private TraceParameterMap parameters = new TraceParameterMap();
/** list of samples */
diff --git a/src/main/java/com/riscure/trs/parameter/trace/TraceParameterMap.java b/src/main/java/com/riscure/trs/parameter/trace/TraceParameterMap.java
index 12e0cae..cd02fa2 100644
--- a/src/main/java/com/riscure/trs/parameter/trace/TraceParameterMap.java
+++ b/src/main/java/com/riscure/trs/parameter/trace/TraceParameterMap.java
@@ -16,7 +16,7 @@
import java.util.Optional;
public class TraceParameterMap extends LinkedHashMap {
- private static final String KEY_NOT_FOUND = "Parameter %s was not found in the trace set.";
+ private static final String KEY_NOT_FOUND = "TraceParameter %s was not found in the trace.";
private static final String EMPTY_DATA_BUT_NONEMPTY_DEFINITIONS = "The provided byte array is null or empty, but the provided definitions are not";
private static final String DATA_LENGTH_DEFINITIONS_MISMATCH = "The provided byte array (%d bytes) does not match the total definitions length (%d bytes)";
diff --git a/src/main/java/com/riscure/trs/parameter/trace/definition/TraceParameterDefinition.java b/src/main/java/com/riscure/trs/parameter/trace/definition/TraceParameterDefinition.java
index 5d6c31d..b99ec2e 100644
--- a/src/main/java/com/riscure/trs/parameter/trace/definition/TraceParameterDefinition.java
+++ b/src/main/java/com/riscure/trs/parameter/trace/definition/TraceParameterDefinition.java
@@ -6,6 +6,7 @@
import com.riscure.trs.parameter.TraceParameter;
import java.io.IOException;
+import java.util.stream.Collectors;
public class TraceParameterDefinition {
private final ParameterType type;
@@ -68,4 +69,9 @@ public int hashCode() {
result = 31 * result + (int) length;
return result;
}
+
+ @Override
+ public String toString() {
+ return String.format("TraceParameterDefinition{Type=%s, Offset=%d, Length=%d}", getType(), getOffset(), getLength());
+ }
}
diff --git a/src/main/java/com/riscure/trs/parameter/traceset/TraceSetParameterMap.java b/src/main/java/com/riscure/trs/parameter/traceset/TraceSetParameterMap.java
index 126304f..9cabbff 100644
--- a/src/main/java/com/riscure/trs/parameter/traceset/TraceSetParameterMap.java
+++ b/src/main/java/com/riscure/trs/parameter/traceset/TraceSetParameterMap.java
@@ -20,7 +20,7 @@
* This explicitly implements LinkedHashMap to ensure that the data is retrieved in the same order as it was added
*/
public class TraceSetParameterMap extends LinkedHashMap {
- private static final String KEY_NOT_FOUND = "Parameter %s was not found in the trace set.";
+ private static final String KEY_NOT_FOUND = "TraceSetParameter %s was not found in the trace set.";
public TraceSetParameterMap() {
super();
diff --git a/src/main/java/com/riscure/trs/types/TypedKey.java b/src/main/java/com/riscure/trs/types/TypedKey.java
index 49f1edc..bd9d140 100644
--- a/src/main/java/com/riscure/trs/types/TypedKey.java
+++ b/src/main/java/com/riscure/trs/types/TypedKey.java
@@ -61,4 +61,12 @@ public int hashCode() {
result = 31 * result + (key != null ? key.hashCode() : 0);
return result;
}
+
+ @Override
+ public String toString() {
+ return "TypedKey{" +
+ "key='" + key +
+ "', cls=" + cls +
+ '}';
+ }
}