do not instantiate millions of HighlightData

This commit is contained in:
2015-07-09 10:31:50 +02:00
parent c8db079e8e
commit 0437e95b4f
16 changed files with 54 additions and 35 deletions
@@ -109,7 +109,7 @@ public abstract class GraphTextWriter {
}
public final GraphTextWriter hilightSpecial(String text, HighlightSpecialType type, int specialValue) {
return hilightSpecial(text, type, Integer.toString(specialValue), new HighlightData());
return hilightSpecial(text, type, Integer.toString(specialValue), null);
}
public final GraphTextWriter hilightSpecial(String text, HighlightSpecialType type, int specialValue, HighlightData data) {
@@ -117,7 +117,7 @@ public abstract class GraphTextWriter {
}
public final GraphTextWriter hilightSpecial(String text, HighlightSpecialType type, String specialValue) {
return hilightSpecial(text, type, specialValue, new HighlightData());
return hilightSpecial(text, type, specialValue, null);
}
protected GraphTextWriter hilightSpecial(String text, HighlightSpecialType type, String specialValue, HighlightData data) {
@@ -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.flash.helpers.hilight;
import java.io.Serializable;
@@ -44,6 +45,9 @@ public class HighlightData implements Cloneable, Serializable {
}
public void merge(HighlightData data) {
if (data == null) {
return;
}
if (data.declaration) {
declaration = data.declaration;
}