diff options
author | Andrey Loskutov | 2017-01-09 13:12:58 +0000 |
---|---|---|
committer | Andrey Loskutov | 2017-01-13 20:56:39 +0000 |
commit | ebb2566c95427e5c7cffd5e27f1e910b0a187b17 (patch) | |
tree | f9b87db9c4ccf476dfb8c8d4b5fcfcfd3f871bbb /org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java | |
parent | 1c1d17b82a223fb8fcc69b4883a71b8744899ccb (diff) | |
download | eclipse.platform.debug-ebb2566c95427e5c7cffd5e27f1e910b0a187b17.tar.gz eclipse.platform.debug-ebb2566c95427e5c7cffd5e27f1e910b0a187b17.tar.xz eclipse.platform.debug-ebb2566c95427e5c7cffd5e27f1e910b0a187b17.zip |
Bug 510100 - [cleanup] Get rid of trailing white space in platform.debugY20170119-1000I20170119-2000I20170119-1010I20170119-0345I20170118-2000I20170118-1215I20170117-2000I20170116-2000I20170115-2000I20170114-2000I20170113-2000
Also enabled "cleanup whitespace on save" actions for debug.ui and
debug.tests bundles.
Change-Id: I755b879ab1d49144a1bec3f4318dbb8b29521bb3
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java index 25dde336f..f15fb6cf4 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.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 *******************************************************************************/ @@ -33,14 +33,14 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering { { String ret; long result = 0; - + if (columnSize == 1) { result = byteArray[0]; result &= 0xff; } else if (columnSize == 2) - { + { result = RenderingsUtil.convertByteArrayToInt(byteArray, endianess); } else if (columnSize == 4) @@ -50,7 +50,7 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering { else if (columnSize == 8) { BigInteger value = RenderingsUtil.convertByteArrayToUnsignedLong(byteArray, endianess); - return value.toString(); + return value.toString(); } else if (columnSize == 16) { @@ -60,14 +60,14 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering { else { BigInteger bigRet = RenderingsUtil.convertByteArrayToUnsignedBigInt(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 { @@ -80,25 +80,25 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering { } // unsigned integer else if (colSize == 2) - { + { int i = Integer.parseInt(newValue); bytes = RenderingsUtil.convertIntToByteArray(i, endianess); bytes = extractBytes(bytes, endianess, colSize); } else if (colSize == 4) - { + { long i = Long.parseLong(newValue); bytes = RenderingsUtil.convertLongToByteArray(i, endianess); bytes = extractBytes(bytes, endianess, colSize); } else if (colSize == 8) - { + { BigInteger i = new BigInteger(newValue); bytes = RenderingsUtil.convertBigIntegerToByteArray(i, endianess); bytes = extractBytes(bytes, endianess, colSize); } else if (colSize == 16) - { + { BigInteger i = new BigInteger(newValue); bytes = RenderingsUtil.convertUnsignedBigIntegerToByteArray(i, endianess); bytes = extractBytes(bytes, endianess, colSize); @@ -110,9 +110,9 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering { BigInteger i = new BigInteger(newValue); bytes = RenderingsUtil.convertUnsignedBigIntToByteArray(i, endianess, colSize); bytes = extractBytes(bytes, endianess, colSize); - return bytes; + return bytes; } - + return bytes; } catch (NumberFormatException e) { throw e; @@ -124,7 +124,7 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering { */ @Override public String getString(String dataType, BigInteger address, MemoryByte[] data) { - + String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR); boolean invalid = false; for (int i=0; i<data.length; i++) @@ -135,7 +135,7 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering { break; } } - + if (invalid) { StringBuffer strBuf = new StringBuffer(); @@ -145,19 +145,19 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering { } return strBuf.toString(); } - + int columnSize = getBytesPerColumn(); 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(); @@ -167,7 +167,7 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering { } return strBuf.toString(); } - + return convertToString(byteArray, columnSize, endianess); } @@ -176,12 +176,12 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering { */ @Override public byte[] getBytes(String dataType, BigInteger address, MemoryByte[] currentValues, String data) { - + int columnSize = getBytesPerColumn(); 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) { @@ -190,19 +190,19 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering { retBytes[i] = currentValues[i].getValue(); return retBytes; } - + return convertToBytes(columnSize, data, endianess); } - + private byte[] extractBytes(byte[] bytes, int endianess, int colSize) { - + if (colSize > bytes.length) throw new NumberFormatException(); - + // take the least significant 'colSize' bytes out of the bytes array // if it's big endian, it's the last 'colSize' bytes if (endianess == RenderingsUtil.BIG_ENDIAN) - { + { // check most significan bytes... if data has to be represented // using more than 'colSize' number of bytes, this // number is invalid, throw number format exception @@ -211,11 +211,11 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering { if (bytes[i] != 0) throw new NumberFormatException(); } - + byte[] copy = new byte[colSize]; for (int j=0, k=bytes.length-colSize; j<copy.length && k<bytes.length; j++, k++) - { - copy[j] = bytes[k]; + { + copy[j] = bytes[k]; } bytes = copy; } @@ -230,14 +230,14 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering { if (bytes[i] != 0) throw new NumberFormatException(); } - + byte[] copy = new byte[colSize]; for (int j=0; j<copy.length; j++) - { - copy[j] = bytes[j]; + { + copy[j] = bytes[j]; } - bytes = copy; + bytes = copy; } return bytes; - } + } } |