From 1b558482bcd2061d286775f8e85c76338def72c3 Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Fri, 27 Apr 2012 13:10:42 -0400 Subject: [PATCH] tmf: Add a proper toString() to history tree intervals or else printing intervals for debug is not very informative... Signed-off-by: Alexandre Montplaisir --- .../backend/historytree/HTInterval.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/backend/historytree/HTInterval.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/backend/historytree/HTInterval.java index ae0245ddef..c13a682385 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/backend/historytree/HTInterval.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/backend/historytree/HTInterval.java @@ -200,8 +200,7 @@ final class HTInterval implements ITmfStateInterval, Comparable { buffer.position(endPosOfStringEntry - sizeOfStringEntry); /* - * write the Strings entry (1st byte = size, then the bytes, then - * the 0) + * write the Strings entry (1st byte = size, then the bytes, then the 0) */ buffer.put((byte) sizeOfStringEntry); buffer.put(byteArrayToWrite); @@ -257,7 +256,7 @@ final class HTInterval implements ITmfStateInterval, Comparable { private int computeStringsEntrySize() { if (sv.toByteArray() == null) { return 0; - } + } return sv.toByteArray().length + 2; /* (+1 for the first byte indicating the size, +1 for the 0'ed byte) */ } @@ -276,7 +275,7 @@ final class HTInterval implements ITmfStateInterval, Comparable { return 0; } } - + @Override public boolean equals(Object other) { if (other instanceof HTInterval) { @@ -291,4 +290,12 @@ final class HTInterval implements ITmfStateInterval, Comparable { public int hashCode() { return super.hashCode(); } + + @Override + public String toString() { + /* Only for debug, should not be externalized */ + return '[' + start + ", " + end + ']' + //$NON-NLS-1$ + ", attribute = " + attribute + //$NON-NLS-1$ + ", value = " + sv.toString(); //$NON-NLS-1$ + } } -- 2.34.1