no more string concatenation in graph text writer

This commit is contained in:
2015-07-07 16:24:43 +02:00
parent 2b94ddf793
commit 31eb284b60
43 changed files with 160 additions and 111 deletions
@@ -148,6 +148,10 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
}
public GraphTextWriter toString(GraphTextWriter writer, LocalData localData) throws InterruptedException {
if (Thread.currentThread().isInterrupted()) {
throw new InterruptedException();
}
writer.startOffset(src, pos, srcData);
appendTo(writer, localData);
writer.endOffset();
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.graph;
import com.jpexs.decompiler.flash.AppResources;
@@ -34,7 +35,7 @@ public class MarkItem extends GraphTargetItem {
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
return writer.append("// " + AppResources.translate("decompilerMark") + ":" + mark);
return writer.append("// ").append(AppResources.translate("decompilerMark")).append(":").append(mark);
}
public String getMark() {
@@ -52,7 +52,7 @@ public class BreakItem extends GraphTargetItem {
}
}
if (labelRequired) {
writer.append(" loop" + loopId);
writer.append(" loop").append(loopId);
}
return writer;
}
@@ -52,7 +52,7 @@ public class ContinueItem extends GraphTargetItem {
}
}
if (labelRequired) {
writer.append(" loop" + loopId);
writer.append(" loop").append(loopId);
}
return writer;
}
@@ -64,7 +64,7 @@ public class DoWhileItem extends LoopItem implements Block {
((NulWriter) writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP);
}
if (labelUsed) {
writer.append("loop" + loop.id + ":").newLine();
writer.append("loop").append(loop.id).append(":").newLine();
}
writer.append("do");
writer.startBlock();
@@ -71,7 +71,7 @@ public class ForItem extends LoopItem implements Block {
((NulWriter) writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP);
}
if (labelUsed) {
writer.append("loop" + loop.id + ":").newLine();
writer.append("loop").append(loop.id).append(":").newLine();
}
writer.append("for");
if (writer.getFormatting().spaceBeforeParenthesesForParentheses) {
@@ -36,7 +36,7 @@ public class GotoItem extends GraphTargetItem {
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
writer.append("§§goto(" + labelName + ")");
writer.append("§§goto(").append(labelName).append(")");
return writer;
}
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -37,7 +37,7 @@ public class IntegerValueItem extends GraphTargetItem implements IntegerValueTyp
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
return writer.append("" + intValue);
return writer.append(intValue);
}
@Override
@@ -36,7 +36,7 @@ public class LabelItem extends GraphTargetItem {
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
writer.append(labelName + ":");
writer.append(labelName).append(":");
return writer;
}
@@ -74,7 +74,7 @@ public class SwitchItem extends LoopItem implements Block {
((NulWriter) writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_SWITCH);
}
if (labelUsed) {
writer.append("loop" + loop.id + ":").newLine();
writer.append("loop").append(loop.id).append(":").newLine();
}
writer.append("switch");
if (writer.getFormatting().spaceBeforeParenthesesSwitchParentheses) {
@@ -52,7 +52,7 @@ public class UniversalLoopItem extends LoopItem implements Block {
((NulWriter) writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP);
}
if (labelUsed) {
writer.append("loop" + loop.id + ":").newLine();
writer.append("loop").append(loop.id).append(":").newLine();
}
writer.append("while");
if (writer.getFormatting().spaceBeforeParenthesesWhileParentheses) {
@@ -59,7 +59,7 @@ public class WhileItem extends LoopItem implements Block {
((NulWriter) writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP);
}
if (labelUsed) {
writer.append("loop" + loop.id + ":").newLine();
writer.append("loop").append(loop.id).append(":").newLine();
}
writer.append("while");
if (writer.getFormatting().spaceBeforeParenthesesWhileParentheses) {