From 45fa122d4e270379e43f5bd037cdd53caea64c7a Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Thu, 19 Mar 2015 10:21:52 +0100 Subject: [PATCH] memory usage decreased --- .../src/com/jpexs/decompiler/flash/abc/ClassPath.java | 5 +---- .../src/com/jpexs/decompiler/flash/abc/ScriptPack.java | 2 +- .../decompiler/flash/treeitems/AS3ClassTreeItem.java | 8 +++++--- src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java | 5 ++++- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ClassPath.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ClassPath.java index 14ff0d372..46f541284 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ClassPath.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ClassPath.java @@ -58,9 +58,6 @@ public class ClassPath { if (!Objects.equals(this.packageStr, other.packageStr)) { return false; } - if (!Objects.equals(this.className, other.className)) { - return false; - } - return true; + return Objects.equals(this.className, other.className); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index 3077b806e..308c39a12 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java @@ -65,7 +65,7 @@ public class ScriptPack extends AS3ClassTreeItem { } public ScriptPack(ClassPath path, ABC abc, int scriptIndex, List traitIndices) { - super(path.className, path.toString()); + super(path.className, path); this.abc = abc; this.scriptIndex = scriptIndex; this.traitIndices = traitIndices; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/AS3ClassTreeItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/AS3ClassTreeItem.java index 957d88135..1fd25bfae 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/AS3ClassTreeItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/AS3ClassTreeItem.java @@ -16,6 +16,8 @@ */ package com.jpexs.decompiler.flash.treeitems; +import com.jpexs.decompiler.flash.abc.ClassPath; + /** * * @author JPEXS @@ -24,9 +26,9 @@ public abstract class AS3ClassTreeItem implements TreeItem { private final String name; - private final String path; + private final ClassPath path; - public AS3ClassTreeItem(String name, String path) { + public AS3ClassTreeItem(String name, ClassPath path) { this.name = name; this.path = path; } @@ -36,7 +38,7 @@ public abstract class AS3ClassTreeItem implements TreeItem { } public String getPath() { - return path; + return path.toString(); } @Override diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java index 58fe6b38e..5dfef537a 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java @@ -687,7 +687,10 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se ClassesListTreeModel clModel = (ClassesListTreeModel) scriptsNode; ScriptPack pack = null; for (MyEntry item : clModel.getList()) { - if (item.getKey().toString().equals(name)) { + ClassPath classPath = item.getKey(); + + // first check the className to avoid calling unnecessary toString + if (name.endsWith(classPath.className) && classPath.toString().equals(name)) { pack = item.getValue(); break; }