Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SignedIntegerRendering.java')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SignedIntegerRendering.java62
1 files changed, 31 insertions, 31 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SignedIntegerRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SignedIntegerRendering.java
index 522f27eab..2bcf483d4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SignedIntegerRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SignedIntegerRendering.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -17,7 +17,7 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.IDebugUIConstants;
/**
- *
+ *
* Represent a signed integer rendering.
*/
public class SignedIntegerRendering extends AbstractIntegerRendering {
@@ -25,7 +25,7 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
private int fColSize;
private BigInteger fMax;
private BigInteger fMin;
-
+
/**
* @param memBlock
* @param renderingId
@@ -38,13 +38,13 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
{
String ret;
long result = 0;
-
+
if (columnSize == 1)
{
result = byteArray[0];
}
else if (columnSize == 2)
- {
+ {
result = RenderingsUtil.convertByteArrayToShort(byteArray, endianess);
}
else if (columnSize == 4)
@@ -53,7 +53,7 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
}
else if (columnSize == 8)
{
- result = RenderingsUtil.convertByteArrayToLong(byteArray, endianess);
+ result = RenderingsUtil.convertByteArrayToLong(byteArray, endianess);
}
else if (columnSize == 16)
{
@@ -63,14 +63,14 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
else
{
BigInteger bigRet = RenderingsUtil.convertByteArrayToSignedBigInt(byteArray, endianess, columnSize);
- return bigRet.toString();
+ return bigRet.toString();
}
ret = new Long(result).toString();
-
+
return ret;
- }
-
+ }
+
private byte[] convertToBytes(int colSize, String newValue, int endianess)
{
try {
@@ -82,17 +82,17 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
bytes[0] = x;
}
else if (colSize == 2)
- {
+ {
short i = Short.parseShort(newValue);
bytes = RenderingsUtil.convertShortToByteArray(i, endianess);
}
else if (colSize == 4)
- {
+ {
int i = Integer.parseInt(newValue);
bytes = RenderingsUtil.convertIntToByteArray(i, endianess);
}
else if (colSize == 8)
- {
+ {
long i = Long.parseLong(newValue);
bytes = RenderingsUtil.convertLongToByteArray(i, endianess);
}
@@ -102,13 +102,13 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
// need to represent number in Big Integer
BigInteger i = new BigInteger(newValue);
bytes = RenderingsUtil.convertBigIntegerToByteArray(i, endianess);
-
+
return bytes;
- }
+ }
else
{
BigInteger i = new BigInteger(newValue);
-
+
// avoid calculating max and min over and over again
// for the same column size
if (fColSize != colSize)
@@ -119,14 +119,14 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
fMin = fMax.multiply(BigInteger.valueOf(-1));
fMax = fMax.subtract(BigInteger.valueOf(1));
}
-
+
if (i.compareTo(fMax) > 0 || i.compareTo(fMin) < 0)
throw new NumberFormatException();
-
+
bytes = RenderingsUtil.convertSignedBigIntToByteArray(i, endianess, colSize);
- return bytes;
+ return bytes;
}
-
+
return bytes;
} catch (NumberFormatException e) {
throw e;
@@ -138,7 +138,7 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
*/
@Override
public String getString(String dataType, BigInteger address, MemoryByte[] data) {
-
+
boolean invalid = false;
String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR);
for (int i=0; i<data.length; i++)
@@ -149,7 +149,7 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
break;
}
}
-
+
if (invalid)
{
StringBuffer strBuf = new StringBuffer();
@@ -159,22 +159,22 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
}
return strBuf.toString();
}
-
+
int columnSize = getBytesPerColumn();
-
+
// if the user has not set an endianess to the rendering
// take default endianess from bytes
int endianess = getDisplayEndianess();
if (endianess == RenderingsUtil.ENDIANESS_UNKNOWN)
endianess = getBytesEndianess(data);
-
+
byte[] byteArray = new byte[data.length];
for (int i=0; i<byteArray.length;i ++)
{
byteArray[i] = data[i].getValue();
}
-
- // if endianess is unknown, do not render, just return padded string
+
+ // if endianess is unknown, do not render, just return padded string
if (RenderingsUtil.ENDIANESS_UNKNOWN == endianess)
{
StringBuffer strBuf = new StringBuffer();
@@ -192,15 +192,15 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
*/
@Override
public byte[] getBytes(String dataType, BigInteger address, MemoryByte[] currentValues, String data) {
-
+
int columnSize = getBytesPerColumn();
-
+
// if the user has not set an endianess to the rendering
// take default
int endianess = getDisplayEndianess();
if (endianess == RenderingsUtil.ENDIANESS_UNKNOWN)
endianess = getBytesEndianess(currentValues);
-
+
// if endianess is unknown, do not try to render new data to bytes
if (endianess == RenderingsUtil.ENDIANESS_UNKNOWN)
{
@@ -209,7 +209,7 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
retBytes[i] = currentValues[i].getValue();
return retBytes;
}
-
+
return convertToBytes(columnSize, data, endianess);
}
}

Back to the top