Преглед на файлове

Get rid of bizarre map usage in parser

Change-Id: I0d43cc37f13085f59e417c1f7c4ffd48d5c54cd2
Reviewed-on: http://gerrit.dmdirc.com/530
Automatic-Compile: Gregory Holmes <greboid@dmdirc.com>
Reviewed-by: Gregory Holmes <greboid@dmdirc.com>
tags/0.6.3
Chris Smith преди 14 години
родител
ревизия
8b5675f530
променени са 1 файла, в които са добавени 5 реда и са изтрити 8 реда
  1. 5
    8
      src/com/dmdirc/parser/irc/IRCParser.java

+ 5
- 8
src/com/dmdirc/parser/irc/IRCParser.java Целия файл

@@ -39,8 +39,8 @@ import com.dmdirc.parser.interfaces.callbacks.Post005Listener;
39 39
 import com.dmdirc.parser.interfaces.callbacks.ServerErrorListener;
40 40
 import com.dmdirc.parser.interfaces.callbacks.SocketCloseListener;
41 41
 import com.dmdirc.parser.common.CallbackManager;
42
-
43 42
 import com.dmdirc.parser.common.QueuePriority;
43
+
44 44
 import java.io.BufferedReader;
45 45
 import java.io.IOException;
46 46
 import java.io.InputStreamReader;
@@ -205,11 +205,8 @@ public class IRCParser implements SecureParser, Runnable {
205 205
     /** Should the lastline (where given) be appended to the "data" part of any onErrorInfo call? */
206 206
     boolean addLastLine = false;
207 207
 
208
-    /**
209
-    * Channel Prefixes (ie # + etc).
210
-    * The "value" for these is always true.
211
-    */
212
-    final Map<Character, Boolean> chanPrefix = new Hashtable<Character, Boolean>();
208
+    /** Channel Prefixes (ie # + etc). */
209
+    private final List<Character> chanPrefix = new LinkedList<Character>();
213 210
     /** Hashtable storing all known clients based on nickname (in lowercase). */
214 211
     private final Map<String, IRCClientInfo> clientList = new Hashtable<String, IRCClientInfo>();
215 212
     /** Hashtable storing all known channels based on chanel name (inc prefix - in lowercase). */
@@ -1385,7 +1382,7 @@ public class IRCParser implements SecureParser, Runnable {
1385 1382
         for (int i = 0; i < modeStr.length(); ++i) {
1386 1383
             final Character cMode = modeStr.charAt(i);
1387 1384
             callDebugInfo(DEBUG_INFO, "Found Chan Prefix: %c", cMode);
1388
-            if (!chanPrefix.containsKey(cMode)) { chanPrefix.put(cMode, true); }
1385
+            if (!chanPrefix.contains(cMode)) { chanPrefix.add(cMode); }
1389 1386
         }
1390 1387
     }
1391 1388
 
@@ -1745,7 +1742,7 @@ public class IRCParser implements SecureParser, Runnable {
1745 1742
         // Otherwise return true if:
1746 1743
         // Channel equals "0"
1747 1744
         // first character of the channel name is a valid channel prefix.
1748
-        return chanPrefix.containsKey(name.charAt(0)) || name.equals("0");
1745
+        return chanPrefix.contains(name.charAt(0)) || name.equals("0");
1749 1746
     }
1750 1747
 
1751 1748
     /** {@inheritDoc} */

Loading…
Отказ
Запис