Skip to content

Commit

Permalink
Merge branch 'release/2.2.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Siebje committed Jan 4, 2022
2 parents 80fae8a + 658b582 commit 30e1a01
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.riscure</groupId>
<artifactId>trsfile</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>
<packaging>jar</packaging>

<name>${project.groupId}:${project.artifactId}</name>
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/com/riscure/trs/Trace.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.Optional;

public class TraceParameterMap extends LinkedHashMap<String, TraceParameter> {
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)";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.riscure.trs.parameter.TraceParameter;

import java.io.IOException;
import java.util.stream.Collectors;

public class TraceParameterDefinition<T extends TraceParameter> {
private final ParameterType type;
Expand Down Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, TraceSetParameter> {
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();
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/riscure/trs/types/TypedKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
'}';
}
}

0 comments on commit 30e1a01

Please sign in to comment.