From 7fc984a9e5fe4e7202037f3c0430b8775a5a6328 Mon Sep 17 00:00:00 2001 From: "George Z. Zachos" Date: Mon, 30 Sep 2019 03:02:02 +0300 Subject: [PATCH] Did some minor refactoring. --- mars/tools/StackVisualizer.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/mars/tools/StackVisualizer.java b/mars/tools/StackVisualizer.java index e4b830e..b9290dc 100644 --- a/mars/tools/StackVisualizer.java +++ b/mars/tools/StackVisualizer.java @@ -161,8 +161,7 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole else if (row > spDataRowIndex) { color = GRAY; } - else { - if (row % 2 == 0) + else if (row % 2 == 0) { color = LIGHT_GRAY; } c.setBackground(new Color(color)); @@ -514,7 +513,7 @@ private void processRegisterAccessNotice(RegisterAccessNotice notice) { } private void processStackMemoryUpdate(MemoryAccessNotice notice) { - String regName, frameName; + String regName = "", frameName = ""; if (notice.getAccessType() == AccessNotice.READ) return; @@ -522,15 +521,11 @@ private void processStackMemoryUpdate(MemoryAccessNotice notice) { if (regNameToBeStoredInStack != null) { regName = regNameToBeStoredInStack; regNameToBeStoredInStack = null; - } else { - regName = ""; } if (frameNameToBeCreated != null) { frameName = frameNameToBeCreated; frameNameToBeCreated = null; - } else { - frameName = ""; } if (debug) { @@ -823,8 +818,9 @@ protected void reset() { } private void updateSpDataRowColIndex() { - spDataRowIndex = getTableRowIndex(getSpValue()); - spDataColumnIndex = getTableColumnIndex(getSpValue()); + int spValue = getSpValue(); + spDataRowIndex = getTableRowIndex(spValue); + spDataColumnIndex = getTableColumnIndex(spValue); } private void resetStoredRegAndFrameNameColumns(int startRow, int endRow) {