From 7bf2a0e574703a0f01a4ed570e5a7496d7b85c3a Mon Sep 17 00:00:00 2001 From: dchandler Date: Sun, 13 Oct 2002 01:07:38 +0000 Subject: [PATCH] Changed a linked list to an array. Performance is drastically better. Try holding down the 'f' key right after startup in the old version, and you'll see it bog down quickly. This will never bog down. --- source/org/thdl/tib/input/DuffPane.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/org/thdl/tib/input/DuffPane.java b/source/org/thdl/tib/input/DuffPane.java index c55b6cc..c93b5ae 100644 --- a/source/org/thdl/tib/input/DuffPane.java +++ b/source/org/thdl/tib/input/DuffPane.java @@ -53,7 +53,7 @@ public class DuffPane extends JTextPane implements KeyListener, FocusListener { * screen, the {@link #newGlyphList glyphList}) is computed on the basis * of charList. */ - private java.util.LinkedList charList; + private java.util.ArrayList charList; /* * This field holds a copy of the last {@link #newGlyphList}. * Then, when a key is pressed, {@link #charList} is updated, a new @@ -313,7 +313,7 @@ public RTFEditorKit rtfEd = null; isStackingOn_default = true; } } - charList = new LinkedList(); + charList = new ArrayList(); oldGlyphList = new ArrayList(); newGlyphList = new ArrayList(); initKeyboard(); @@ -1074,7 +1074,7 @@ public void paste(int offset) { initKeyboard(); else if (size > 1 && isStackingRightToLeft) { - String s = (String)charList.removeLast(); + String s = (String)charList.remove(charList.size() - 1); newGlyphList = TibetanDocument.getGlyphs(charList, isStackingRightToLeft, isDefinitelyTibetan, isDefinitelySanskrit); oldGlyphList = redrawGlyphs(oldGlyphList, newGlyphList); initKeyboard(); @@ -1223,7 +1223,7 @@ public void paste(int offset) { if (isTopHypothesis) { if (TibetanMachineWeb.isAChungConsonant() && isStackingOn && charList.size()>1 && s2.equals(TibetanMachineWeb.ACHUNG)) { - charList.removeLast(); + charList.remove(charList.size() - 1); newGlyphList = TibetanDocument.getGlyphs(charList, isStackingRightToLeft, isDefinitelyTibetan, isDefinitelySanskrit); oldGlyphList = redrawGlyphs(oldGlyphList, newGlyphList); putVowel(TibetanMachineWeb.A_VOWEL);