Bladeren bron

Style/license fixes

Change-Id: Ie91dc5f95b405c3664884b830bbc47dfeb282790
Reviewed-on: http://gerrit.dmdirc.com/1978
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.7rc1
Chris Smith 13 jaren geleden
bovenliggende
commit
997985fb97

+ 16
- 16
src/com/dmdirc/parser/common/AwayState.java Bestand weergeven

@@ -1,23 +1,23 @@
1 1
 /*
2
- *  Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
2
+ * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 3
  *
4
- *  Permission is hereby granted, free of charge, to any person obtaining a copy
5
- *  of this software and associated documentation files (the "Software"), to deal
6
- *  in the Software without restriction, including without limitation the rights
7
- *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- *  copies of the Software, and to permit persons to whom the Software is
9
- *  furnished to do so, subject to the following conditions:
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10 10
  *
11
- *  The above copyright notice and this permission notice shall be included in
12
- *  all copies or substantial portions of the Software.
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13 13
  *
14
- *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- *  SOFTWARE.
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21 21
  */
22 22
 
23 23
 package com.dmdirc.parser.common;

+ 16
- 18
src/com/dmdirc/parser/common/QueuePriority.java Bestand weergeven

@@ -1,31 +1,29 @@
1 1
 /*
2
- *  Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
2
+ * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 3
  *
4
- *  Permission is hereby granted, free of charge, to any person obtaining a copy
5
- *  of this software and associated documentation files (the "Software"), to deal
6
- *  in the Software without restriction, including without limitation the rights
7
- *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- *  copies of the Software, and to permit persons to whom the Software is
9
- *  furnished to do so, subject to the following conditions:
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10 10
  *
11
- *  The above copyright notice and this permission notice shall be included in
12
- *  all copies or substantial portions of the Software.
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13 13
  *
14
- *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- *  SOFTWARE.
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21 21
  */
22 22
 
23 23
 package com.dmdirc.parser.common;
24 24
 
25 25
 /**
26 26
  * Queue Priority.
27
- *
28
- * @author shane
29 27
  */
30 28
 public enum QueuePriority {
31 29
     /** High priority. */

+ 0
- 1
src/com/dmdirc/parser/interfaces/ChannelClientInfo.java Bestand weergeven

@@ -29,7 +29,6 @@ import java.util.Map;
29 29
  * interact with it.
30 30
  *
31 31
  * @since 0.6.3m2
32
- * @author chris
33 32
  */
34 33
 public interface ChannelClientInfo extends Comparable<ChannelClientInfo> {
35 34
 

+ 2
- 3
src/com/dmdirc/parser/interfaces/callbacks/ChannelNickChangeListener.java Bestand weergeven

@@ -47,7 +47,6 @@ public interface ChannelNickChangeListener extends CallbackInterface {
47 47
      * @param oldNick Nickname before change
48 48
      * @see com.dmdirc.parser.irc.ProcessNick#callChannelNickChanged
49 49
      */
50
-     void onChannelNickChanged(Parser parser, Date date, ChannelInfo channel,
51
-             ChannelClientInfo client, String oldNick);
52
-
50
+    void onChannelNickChanged(Parser parser, Date date, ChannelInfo channel,
51
+            ChannelClientInfo client, String oldNick);
53 52
 }

+ 1
- 2
src/com/dmdirc/parser/interfaces/callbacks/PrivateNoticeListener.java Bestand weergeven

@@ -47,5 +47,4 @@ public interface PrivateNoticeListener extends CallbackInterface {
47 47
      * @see com.dmdirc.parser.irc.ProcessMessage#callPrivateNotice
48 48
      */
49 49
     void onPrivateNotice(Parser parser, Date date, String message, String host);
50
-
51
-}
50
+}

+ 1
- 6
src/com/dmdirc/parser/interfaces/callbacks/UnknownActionListener.java Bestand weergeven

@@ -28,15 +28,11 @@ import java.util.Date;
28 28
 
29 29
 /**
30 30
  * Called when a person sends an action not aimed specifically at you or a channel (ie $*).
31
- * sHost is the hostname of the person sending the message. (Can be a server or a person)<br>
32
- * cClient is null if user is a server, or not on any common channel.
33 31
  */
34 32
 public interface UnknownActionListener extends CallbackInterface {
35 33
 
36 34
     /**
37 35
      * Called when a person sends an action not aimed specifically at you or a channel (ie $*).
38
-     * sHost is the hostname of the person sending the message. (Can be a server or a person)<br>
39
-     * cClient is null if user is a server, or not on any common channel.
40 36
      *
41 37
      * @param parser Reference to the parser object that made the callback.
42 38
      * @param date The date/time at which the event occured
@@ -47,5 +43,4 @@ public interface UnknownActionListener extends CallbackInterface {
47 43
      */
48 44
     void onUnknownAction(Parser parser, Date date, String message,
49 45
             String target, String host);
50
-
51
-}
46
+}

+ 5
- 4
src/com/dmdirc/parser/irc/IRCChannelInfo.java Bestand weergeven

@@ -539,7 +539,8 @@ public class IRCChannelInfo implements ChannelInfo {
539 539
         if (!listModes.containsKey(cMode)) {
540 540
             listModes.put(cMode, new ArrayList<ChannelListModeItem>());
541 541
         }
542
-        final ArrayList<ChannelListModeItem> lModes = listModes.get(cMode);
542
+
543
+        final List<ChannelListModeItem> lModes = listModes.get(cMode);
543 544
         for (int i = 0; i < lModes.size(); i++) {
544 545
             if (parser.getStringConverter().equalsIgnoreCase(lModes.get(i).getItem(), newItem.getItem())) {
545 546
                 if (bAdd) {
@@ -628,9 +629,9 @@ public class IRCChannelInfo implements ChannelInfo {
628 629
             return;
629 630
         }
630 631
 
631
-        modestr = ((add) ? "+" : "-") + mode;
632
+        modestr = (add ? "+" : "-") + mode;
632 633
         if (parser.chanModesBool.containsKey(mode)) {
633
-            final String teststr = ((add) ? "-" : "+") + mode;
634
+            final String teststr = (add ? "-" : "+") + mode;
634 635
             if (modeQueue.contains(teststr)) {
635 636
                 modeQueue.remove(teststr);
636 637
                 return;
@@ -650,7 +651,7 @@ public class IRCChannelInfo implements ChannelInfo {
650 651
                 } else if (add && ((modeint & IRCParser.MODE_SET) == IRCParser.MODE_SET)) {
651 652
                     // Does mode require a param to unset aswell?
652 653
                     // We might need to queue an unset first
653
-                    if (((modeint & IRCParser.MODE_UNSET) == IRCParser.MODE_UNSET)) {
654
+                    if ((modeint & IRCParser.MODE_UNSET) == IRCParser.MODE_UNSET) {
654 655
                         final String existingParam = getMode(mode);
655 656
                         if (!existingParam.isEmpty()) {
656 657
                             final String reverseModeStr = "-" + mode + " " + existingParam;

+ 5
- 6
src/com/dmdirc/parser/irc/IRCParser.java Bestand weergeven

@@ -53,6 +53,7 @@ import java.util.ArrayList;
53 53
 import java.util.Arrays;
54 54
 import java.util.Collection;
55 55
 import java.util.Collections;
56
+import java.util.Deque;
56 57
 import java.util.HashMap;
57 58
 import java.util.LinkedList;
58 59
 import java.util.List;
@@ -790,11 +791,10 @@ public class IRCParser implements SecureParser, EncodingParser, Runnable {
790 791
      * Connect to IRC.
791 792
      *
792 793
      * @throws IOException if the socket can not be connected
793
-     * @throws UnknownHostException if the hostname can not be resolved
794 794
      * @throws NoSuchAlgorithmException if SSL is not available
795 795
      * @throws KeyManagementException if the trustManager is invalid
796 796
      */
797
-    private void connect() throws UnknownHostException, IOException, NoSuchAlgorithmException, KeyManagementException {
797
+    private void connect() throws IOException, NoSuchAlgorithmException, KeyManagementException {
798 798
         if (server == null) {
799 799
             throw new UnknownHostException("Unspecified host.");
800 800
         }
@@ -1127,12 +1127,11 @@ public class IRCParser implements SecureParser, EncodingParser, Runnable {
1127 1127
         if (newLine[0].equalsIgnoreCase("away") && newLine.length > 1) {
1128 1128
             myself.setAwayReason(newLine[newLine.length - 1]);
1129 1129
         } else if (newLine[0].equalsIgnoreCase("mode") && newLine.length == 3) {
1130
-            // This makes sure we don't add the same item to the LMQ twice, even if its requested twice,
1131
-            // as the ircd will only reply once.
1132
-            final LinkedList<Character> foundModes = new LinkedList<Character>();
1133
-
1134 1130
             final IRCChannelInfo channel = getChannel(newLine[1]);
1135 1131
             if (channel != null) {
1132
+                // This makes sure we don't add the same item to the LMQ twice,
1133
+                // even if its requested twice, as the ircd will only reply once
1134
+                final Deque<Character> foundModes = new LinkedList<Character>();
1136 1135
                 final Queue<Character> listModeQueue = channel.getListModeQueue();
1137 1136
                 for (int i = 0; i < newLine[2].length(); ++i) {
1138 1137
                     final Character mode = newLine[2].charAt(i);

+ 16
- 16
src/com/dmdirc/parser/irc/Logging.java Bestand weergeven

@@ -80,20 +80,6 @@ public class Logging {
80 80
     /** "Log" object if available. */
81 81
     private Object log;
82 82
 
83
-    /**
84
-     * Get an instance of Logging.
85
-     *
86
-     * @return The instance of Logging
87
-     */
88
-    public static Logging getLogging() {
89
-        synchronized (Logging.class) {
90
-            if (me == null) {
91
-                me = new Logging();
92
-            }
93
-            return me;
94
-        }
95
-    }
96
-
97 83
     /** Create a new Logging. */
98 84
     @SuppressWarnings("unchecked")
99 85
     private Logging() {
@@ -104,7 +90,7 @@ public class Logging {
104 90
             Class.forName("org.apache.commons.logging.Log");
105 91
             factory = Class.forName("org.apache.commons.logging.LogFactory");
106 92
 
107
-            classExists = (factory != null);
93
+            classExists = factory != null;
108 94
             if (classExists) {
109 95
                 final Method getLog = factory.getMethod("getLog", new Class[]{Class.class});
110 96
                 log = getLog.invoke(null, this.getClass());
@@ -115,7 +101,21 @@ public class Logging {
115 101
         } catch (InvocationTargetException ite) {
116 102
         }
117 103
 
118
-        isAvailable = (classExists && log != null);
104
+        isAvailable = classExists && log != null;
105
+    }
106
+
107
+    /**
108
+     * Get an instance of Logging.
109
+     *
110
+     * @return The instance of Logging
111
+     */
112
+    public static Logging getLogging() {
113
+        synchronized (Logging.class) {
114
+            if (me == null) {
115
+                me = new Logging();
116
+            }
117
+            return me;
118
+        }
119 119
     }
120 120
 
121 121
     /**

+ 12
- 14
src/com/dmdirc/parser/irc/ProcessListModes.java Bestand weergeven

@@ -51,7 +51,6 @@ public class ProcessListModes extends IRCProcessor {
51 51
      * @param sParam Type of line to process
52 52
      * @param token IRCTokenised line to process
53 53
      */
54
-    @SuppressWarnings("unchecked")
55 54
     @Override
56 55
     public void process(final String sParam, final String[] token) {
57 56
         final IRCChannelInfo channel = getChannel(token[3]);
@@ -67,16 +66,16 @@ public class ProcessListModes extends IRCProcessor {
67 66
             return;
68 67
         }
69 68
 
70
-        if (sParam.equals("367") || sParam.equals("368")) {
69
+        if ("367".equals(sParam) || "368".equals(sParam)) {
71 70
             // Ban List/Item.
72 71
             // (Also used for +d and +q on dancer/hyperion... -_-)
73 72
             // (Also used for +q on ircd-seven... -_-)
74 73
             mode = 'b';
75
-            isItem = sParam.equals("367");
76
-        } else if (sParam.equals("348") || sParam.equals("349")) {
74
+            isItem = "367".equals(sParam);
75
+        } else if ("348".equals(sParam) || "349".equals(sParam)) {
77 76
             // Except / Exempt List etc
78 77
             mode = 'e';
79
-            isItem = sParam.equals("348");
78
+            isItem = "348".equals(sParam);
80 79
         } else if (sParam.equals("346") || sParam.equals("347")) {
81 80
             // Invite List
82 81
             mode = 'I';
@@ -115,7 +114,7 @@ public class ProcessListModes extends IRCProcessor {
115 114
 
116 115
         final Queue<Character> listModeQueue = channel.getListModeQueue();
117 116
         if (!isCleverMode && listModeQueue != null) {
118
-            if (sParam.equals("482")) {
117
+            if ("482".equals(sParam)) {
119 118
                 parser.callDebugInfo(IRCParser.DEBUG_LMQ, "Dropped LMQ mode " + listModeQueue.poll());
120 119
                 return;
121 120
             } else {
@@ -132,23 +131,22 @@ public class ProcessListModes extends IRCProcessor {
132 131
                     // Only raise an LMQ error if the lmqmode isn't one of bdq if the
133 132
                     // guess is one of bdq
134 133
                     if (ServerTypeGroup.FREENODE.isMember(serverType) && (mode == 'b' || mode == 'q' || mode == 'd')) {
135
-                        final LinkedList<Character> lmq = (LinkedList<Character>) listModeQueue;
136 134
                         if (mode == 'b') {
137
-                            error = !(oldMode == 'q' || oldMode == 'd');
138
-                            lmq.remove((Character) 'q');
135
+                            error = oldMode != 'q' && oldMode != 'd';
136
+                            listModeQueue.remove('q');
139 137
                             parser.callDebugInfo(IRCParser.DEBUG_LMQ, "Dropping q from list");
140 138
                         } else if (mode == 'q') {
141
-                            error = !(oldMode == 'b' || oldMode == 'd');
142
-                            lmq.remove((Character) 'b');
139
+                            error = oldMode != 'b' && oldMode != 'd';
140
+                            listModeQueue.remove('b');
143 141
                             parser.callDebugInfo(IRCParser.DEBUG_LMQ, "Dropping b from list");
144 142
                         } else if (mode == 'd') {
145
-                            error = !(oldMode == 'b' || oldMode == 'q');
143
+                            error = oldMode != 'b' && oldMode != 'q';
146 144
                         }
147 145
                     } else if (ServerTypeGroup.CHARYBDIS.isMember(serverType) && (mode == 'b' || mode == 'q')) {
148 146
                         // Finally freenode appear to have an ircd which isn't completely annoying.
149 147
                         // Only error if the LMQ thinks the mode should be
150 148
                         // something thats not the other one of these 2 modes.
151
-                        error = (mode == 'b') ? oldMode != 'q' : oldMode != 'b';
149
+                        error = oldMode != (mode == 'b' ? 'q' : 'b');
152 150
                     }
153 151
 
154 152
                     // If the lmq and the actual mode are not the same or the
@@ -166,7 +164,7 @@ public class ProcessListModes extends IRCProcessor {
166 164
         }
167 165
 
168 166
         if (isItem) {
169
-            if ((!isCleverMode) && listModeQueue == null && ServerTypeGroup.FREENODE.isMember(serverType) && token.length > 4 && mode == 'b') {
167
+            if (!isCleverMode && listModeQueue == null && ServerTypeGroup.FREENODE.isMember(serverType) && token.length > 4 && mode == 'b') {
170 168
                 // Assume mode is a 'd' mode
171 169
                 mode = 'd';
172 170
                 // Now work out if its not (or attempt to.)

+ 2
- 2
src/com/dmdirc/parser/irc/ProcessMessage.java Bestand weergeven

@@ -195,8 +195,8 @@ public class ProcessMessage extends IRCProcessor {
195 195
         // handled as if the prefix wasn't used. This can be changed in the future
196 196
         // if desired.
197 197
         final char modePrefix = token[2].charAt(0);
198
-        final boolean hasModePrefix = (parser.prefixMap.containsKey(modePrefix) && !parser.prefixModes.containsKey(modePrefix));
199
-        final String targetName = (hasModePrefix) ? token[2].substring(1) : token[2];
198
+        final boolean hasModePrefix = parser.prefixMap.containsKey(modePrefix) && !parser.prefixModes.containsKey(modePrefix);
199
+        final String targetName = hasModePrefix ? token[2].substring(1) : token[2];
200 200
 
201 201
         if (isValidChannelName(targetName)) {
202 202
             iChannel = getChannel(targetName);

+ 1
- 1
src/com/dmdirc/parser/irc/ProcessMode.java Bestand weergeven

@@ -216,7 +216,7 @@ public class ProcessMode extends IRCProcessor {
216 216
                         // List Mode
217 217
                         sModeParam = sModestr[nParam++];
218 218
                         sNonUserModeStrParams = sNonUserModeStrParams + " " + sModeParam;
219
-                        nTemp = (Calendar.getInstance().getTimeInMillis() / 1000);
219
+                        nTemp = Calendar.getInstance().getTimeInMillis() / 1000;
220 220
                         iChannel.setListModeParam(cMode, new ChannelListModeItem(sModeParam, token[0], nTemp), bPositive);
221 221
                         callDebugInfo(IRCParser.DEBUG_INFO, "List Mode: %c [%s] {Positive: %b}", cMode, sModeParam, bPositive);
222 222
                         if (cbSingle != null) {

+ 2
- 1
src/com/dmdirc/parser/irc/ProcessQuit.java Bestand weergeven

@@ -29,6 +29,7 @@ import com.dmdirc.parser.interfaces.callbacks.ChannelQuitListener;
29 29
 import com.dmdirc.parser.interfaces.callbacks.QuitListener;
30 30
 
31 31
 import java.util.ArrayList;
32
+import java.util.List;
32 33
 
33 34
 /**
34 35
  * Process a Quit message.
@@ -75,7 +76,7 @@ public class ProcessQuit extends IRCProcessor {
75 76
             sReason = token[token.length - 1];
76 77
         }
77 78
 
78
-        final ArrayList<IRCChannelInfo> channelList = new ArrayList<IRCChannelInfo>(parser.getChannels());
79
+        final List<IRCChannelInfo> channelList = new ArrayList<IRCChannelInfo>(parser.getChannels());
79 80
         for (IRCChannelInfo iChannel : channelList) {
80 81
             iChannelClient = iChannel.getChannelClient(iClient);
81 82
             if (iChannelClient != null) {

+ 2
- 2
src/com/dmdirc/parser/irc/ServerInfo.java Bestand weergeven

@@ -39,7 +39,7 @@ public class ServerInfo {
39 39
      */
40 40
     private static final long serialVersionUID = 1;
41 41
     /** Are we using a socks proxy (Default: false). */
42
-    private boolean useSocksProxy = false;
42
+    private boolean useSocksProxy;
43 43
     /** Proxy server to connect to (Default: "127.0.0.1"). */
44 44
     private String proxyHost = "127.0.0.1";
45 45
     /** Port server listens on for client connections (Default: 8080). */
@@ -49,7 +49,7 @@ public class ServerInfo {
49 49
     /** Proxy password if required. */
50 50
     private String proxyPass = "";
51 51
     /** URI used to create this ServerInfo if applicable. */
52
-    private URI uri = null;
52
+    private URI uri;
53 53
 
54 54
     /**
55 55
      * Constructor using specifed host, port and password, SSL/Proxy must be

+ 17
- 17
src/com/dmdirc/parser/irc/ServerType.java Bestand weergeven

@@ -1,23 +1,23 @@
1 1
 /*
2
- *  Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
2
+ * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 3
  *
4
- *  Permission is hereby granted, free of charge, to any person obtaining a copy
5
- *  of this software and associated documentation files (the "Software"), to deal
6
- *  in the Software without restriction, including without limitation the rights
7
- *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- *  copies of the Software, and to permit persons to whom the Software is
9
- *  furnished to do so, subject to the following conditions:
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10 10
  *
11
- *  The above copyright notice and this permission notice shall be included in
12
- *  all copies or substantial portions of the Software.
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13 13
  *
14
- *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- *  SOFTWARE.
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21 21
  */
22 22
 
23 23
 package com.dmdirc.parser.irc;
@@ -231,7 +231,7 @@ public enum ServerType {
231 231
      * @return
232 232
      */
233 233
     public boolean isOpOnly(final char mode) {
234
-        return (opOnly.indexOf(mode) != -1);
234
+        return opOnly.indexOf(mode) != -1;
235 235
     }
236 236
 
237 237
     /**

+ 16
- 16
src/com/dmdirc/parser/irc/ServerTypeGroup.java Bestand weergeven

@@ -1,23 +1,23 @@
1 1
 /*
2
- *  Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
2
+ * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 3
  *
4
- *  Permission is hereby granted, free of charge, to any person obtaining a copy
5
- *  of this software and associated documentation files (the "Software"), to deal
6
- *  in the Software without restriction, including without limitation the rights
7
- *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- *  copies of the Software, and to permit persons to whom the Software is
9
- *  furnished to do so, subject to the following conditions:
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10 10
  *
11
- *  The above copyright notice and this permission notice shall be included in
12
- *  all copies or substantial portions of the Software.
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13 13
  *
14
- *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- *  SOFTWARE.
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21 21
  */
22 22
 
23 23
 package com.dmdirc.parser.irc;

+ 16
- 16
src/com/dmdirc/parser/irc/outputqueue/OutputQueue.java Bestand weergeven

@@ -1,23 +1,23 @@
1 1
 /*
2
- *  Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
2
+ * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 3
  *
4
- *  Permission is hereby granted, free of charge, to any person obtaining a copy
5
- *  of this software and associated documentation files (the "Software"), to deal
6
- *  in the Software without restriction, including without limitation the rights
7
- *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- *  copies of the Software, and to permit persons to whom the Software is
9
- *  furnished to do so, subject to the following conditions:
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10 10
  *
11
- *  The above copyright notice and this permission notice shall be included in
12
- *  all copies or substantial portions of the Software.
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13 13
  *
14
- *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- *  SOFTWARE.
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21 21
  */
22 22
 
23 23
 package com.dmdirc.parser.irc.outputqueue;

+ 27
- 27
src/com/dmdirc/parser/irc/outputqueue/PriorityQueueHandler.java Bestand weergeven

@@ -1,23 +1,23 @@
1 1
 /*
2
- *  Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
2
+ * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 3
  *
4
- *  Permission is hereby granted, free of charge, to any person obtaining a copy
5
- *  of this software and associated documentation files (the "Software"), to deal
6
- *  in the Software without restriction, including without limitation the rights
7
- *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- *  copies of the Software, and to permit persons to whom the Software is
9
- *  furnished to do so, subject to the following conditions:
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10 10
  *
11
- *  The above copyright notice and this permission notice shall be included in
12
- *  all copies or substantial portions of the Software.
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13 13
  *
14
- *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- *  SOFTWARE.
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21 21
  */
22 22
 
23 23
 package com.dmdirc.parser.irc.outputqueue;
@@ -30,6 +30,17 @@ import java.util.concurrent.BlockingQueue;
30 30
  */
31 31
 public class PriorityQueueHandler extends QueueHandler {
32 32
 
33
+    /**
34
+     * Create a new PriorityQueueHandler.
35
+     *
36
+     * @param outputQueue Owner of this Queue Handler
37
+     * @param queue Queue to use
38
+     * @param out Output Stream to use
39
+     */
40
+    public PriorityQueueHandler(final OutputQueue outputQueue, final BlockingQueue<QueueItem> queue, final PrintWriter out) {
41
+        super(outputQueue, queue, out);
42
+    }
43
+
33 44
     /**
34 45
      * Get a QueueFactory that produces PriorityQueueHandlers.
35 46
      *
@@ -46,17 +57,6 @@ public class PriorityQueueHandler extends QueueHandler {
46 57
         };
47 58
     }
48 59
 
49
-    /**
50
-     * Create a new PriorityQueueHandler.
51
-     *
52
-     * @param outputQueue Owner of this Queue Handler
53
-     * @param queue Queue to use
54
-     * @param out Output Stream to use
55
-     */
56
-    public PriorityQueueHandler(final OutputQueue outputQueue, final BlockingQueue<QueueItem> queue, final PrintWriter out) {
57
-        super(outputQueue, queue, out);
58
-    }
59
-
60 60
     /** {@inheritDoc} */
61 61
     @Override
62 62
     public void run() {

+ 16
- 16
src/com/dmdirc/parser/irc/outputqueue/QueueFactory.java Bestand weergeven

@@ -1,23 +1,23 @@
1 1
 /*
2
- *  Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
2
+ * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 3
  *
4
- *  Permission is hereby granted, free of charge, to any person obtaining a copy
5
- *  of this software and associated documentation files (the "Software"), to deal
6
- *  in the Software without restriction, including without limitation the rights
7
- *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- *  copies of the Software, and to permit persons to whom the Software is
9
- *  furnished to do so, subject to the following conditions:
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10 10
  *
11
- *  The above copyright notice and this permission notice shall be included in
12
- *  all copies or substantial portions of the Software.
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13 13
  *
14
- *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- *  SOFTWARE.
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21 21
  */
22 22
 
23 23
 package com.dmdirc.parser.irc.outputqueue;

+ 18
- 18
src/com/dmdirc/parser/irc/outputqueue/QueueHandler.java Bestand weergeven

@@ -1,23 +1,23 @@
1 1
 /*
2
- *  Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
2
+ * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 3
  *
4
- *  Permission is hereby granted, free of charge, to any person obtaining a copy
5
- *  of this software and associated documentation files (the "Software"), to deal
6
- *  in the Software without restriction, including without limitation the rights
7
- *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- *  copies of the Software, and to permit persons to whom the Software is
9
- *  furnished to do so, subject to the following conditions:
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10 10
  *
11
- *  The above copyright notice and this permission notice shall be included in
12
- *  all copies or substantial portions of the Software.
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13 13
  *
14
- *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- *  SOFTWARE.
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21 21
  */
22 22
 
23 23
 package com.dmdirc.parser.irc.outputqueue;
@@ -35,10 +35,10 @@ public abstract class QueueHandler extends Thread implements Comparator<QueueIte
35 35
 
36 36
     /** Queue we are handling. */
37 37
     protected final BlockingQueue<QueueItem> queue;
38
-    /** Where to send the output. */
39
-    private final PrintWriter out;
40 38
     /** The output queue that owns us. */
41 39
     protected OutputQueue outputQueue;
40
+    /** Where to send the output. */
41
+    private final PrintWriter out;
42 42
 
43 43
     /**
44 44
      * Create a new Queue Thread.

+ 33
- 33
src/com/dmdirc/parser/irc/outputqueue/QueueItem.java Bestand weergeven

@@ -1,23 +1,23 @@
1 1
 /*
2
- *  Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
2
+ * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 3
  *
4
- *  Permission is hereby granted, free of charge, to any person obtaining a copy
5
- *  of this software and associated documentation files (the "Software"), to deal
6
- *  in the Software without restriction, including without limitation the rights
7
- *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- *  copies of the Software, and to permit persons to whom the Software is
9
- *  furnished to do so, subject to the following conditions:
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10 10
  *
11
- *  The above copyright notice and this permission notice shall be included in
12
- *  all copies or substantial portions of the Software.
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13 13
  *
14
- *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- *  SOFTWARE.
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21 21
  */
22 22
 
23 23
 package com.dmdirc.parser.irc.outputqueue;
@@ -30,7 +30,7 @@ import com.dmdirc.parser.common.QueuePriority;
30 30
 public class QueueItem implements Comparable<QueueItem> {
31 31
 
32 32
     /** Global Item Number. */
33
-    private static long number = 0L;
33
+    private static long number;
34 34
     /** Line to send. */
35 35
     private final String line;
36 36
     /** Time this line was added. */
@@ -42,6 +42,22 @@ public class QueueItem implements Comparable<QueueItem> {
42 42
     /** Our handler. */
43 43
     private final QueueHandler handler;
44 44
 
45
+    /**
46
+     * Create a new QueueItem.
47
+     *
48
+     * @param handler Handler for this QueueItem
49
+     * @param line Line to send
50
+     * @param priority Priority for the queue item
51
+     */
52
+    public QueueItem(final QueueHandler handler, final String line, final QueuePriority priority) {
53
+        this.handler = handler;
54
+        this.line = line;
55
+        this.priority = priority;
56
+
57
+        this.time = System.currentTimeMillis();
58
+        this.itemNumber = number++;
59
+    }
60
+
45 61
     /**
46 62
      * Get the value of line.
47 63
      *
@@ -78,22 +94,6 @@ public class QueueItem implements Comparable<QueueItem> {
78 94
         return priority;
79 95
     }
80 96
 
81
-    /**
82
-     * Create a new QueueItem.
83
-     *
84
-     * @param handler Handler for this QueueItem
85
-     * @param line Line to send
86
-     * @param priority Priority for the queue item
87
-     */
88
-    public QueueItem(final QueueHandler handler, final String line, final QueuePriority priority) {
89
-        this.handler = handler;
90
-        this.line = line;
91
-        this.priority = priority;
92
-
93
-        this.time = System.currentTimeMillis();
94
-        this.itemNumber = number++;
95
-    }
96
-
97 97
     /**
98 98
      * Compare objects.
99 99
      * This will use the compareQueueItem method of the current QueueHandler.

+ 40
- 37
src/com/dmdirc/parser/irc/outputqueue/SimpleRateLimitedQueueHandler.java Bestand weergeven

@@ -1,28 +1,29 @@
1 1
 /*
2
- *  Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
2
+ * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 3
  *
4
- *  Permission is hereby granted, free of charge, to any person obtaining a copy
5
- *  of this software and associated documentation files (the "Software"), to deal
6
- *  in the Software without restriction, including without limitation the rights
7
- *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- *  copies of the Software, and to permit persons to whom the Software is
9
- *  furnished to do so, subject to the following conditions:
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10 10
  *
11
- *  The above copyright notice and this permission notice shall be included in
12
- *  all copies or substantial portions of the Software.
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13 13
  *
14
- *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- *  SOFTWARE.
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21 21
  */
22 22
 
23 23
 package com.dmdirc.parser.irc.outputqueue;
24 24
 
25 25
 import com.dmdirc.parser.common.QueuePriority;
26
+
26 27
 import java.io.PrintWriter;
27 28
 import java.util.concurrent.BlockingQueue;
28 29
 
@@ -34,21 +35,6 @@ import java.util.concurrent.BlockingQueue;
34 35
  */
35 36
 public class SimpleRateLimitedQueueHandler extends QueueHandler {
36 37
 
37
-    /**
38
-     * Get a QueueFactory that produces PriorityQueueHandlers.
39
-     *
40
-     * @return a QueueFactory that produces PrirortyQueueHandlers.
41
-     */
42
-    public static QueueFactory getFactory() {
43
-        return new QueueFactory() {
44
-
45
-            /** {@inheritDoc} */
46
-            @Override
47
-            public QueueHandler getQueueHandler(final OutputQueue outputQueue, final BlockingQueue<QueueItem> queue, final PrintWriter out) {
48
-                return new SimpleRateLimitedQueueHandler(outputQueue, queue, out);
49
-            }
50
-        };
51
-    }
52 38
     /** Current count. */
53 39
     private int count;
54 40
     /** Time last item was added. */
@@ -75,6 +61,22 @@ public class SimpleRateLimitedQueueHandler extends QueueHandler {
75 61
         super(outputQueue, queue, out);
76 62
     }
77 63
 
64
+    /**
65
+     * Get a QueueFactory that produces PriorityQueueHandlers.
66
+     *
67
+     * @return a QueueFactory that produces PrirortyQueueHandlers.
68
+     */
69
+    public static QueueFactory getFactory() {
70
+        return new QueueFactory() {
71
+
72
+            /** {@inheritDoc} */
73
+            @Override
74
+            public QueueHandler getQueueHandler(final OutputQueue outputQueue, final BlockingQueue<QueueItem> queue, final PrintWriter out) {
75
+                return new SimpleRateLimitedQueueHandler(outputQueue, queue, out);
76
+            }
77
+        };
78
+    }
79
+
78 80
     /**
79 81
      * Get the number of items needed to activate rate limiting.
80 82
      *
@@ -188,7 +190,7 @@ public class SimpleRateLimitedQueueHandler extends QueueHandler {
188 190
     public QueueItem getQueueItem(final String line, final QueuePriority priority) {
189 191
         // Was the last line added less than limitTime ago?
190 192
         synchronized (this) {
191
-            final boolean overTime = (lastItemTime + limitTime > System.currentTimeMillis());
193
+            final boolean overTime = lastItemTime + limitTime > System.currentTimeMillis();
192 194
             if (overTime) {
193 195
                 // If we are not currently limiting, and this is the items-th item
194 196
                 // added in the last limitTime, start limiting.
@@ -196,18 +198,19 @@ public class SimpleRateLimitedQueueHandler extends QueueHandler {
196 198
                     isLimiting = true;
197 199
                     count = 0;
198 200
                 }
199
-            } else if (!isLimiting) {
200
-                // If it has been more than limitTime seconds since the last line
201
-                // and we are not currently limiting, reset the count.
202
-                count = 0;
203
-            } else {
201
+            } else if (isLimiting) {
204 202
                 // It has been longer than limitTime and we are still shown as
205 203
                 // limiting, check to see if the queue is empty or not, if it is
206 204
                 // disable limiting.
207 205
                 if (queue.size() == 0) {
208 206
                     isLimiting = false;
209 207
                 }
208
+            } else {
209
+                // If it has been more than limitTime seconds since the last line
210
+                // and we are not currently limiting, reset the count.
211
+                count = 0;
210 212
             }
213
+
211 214
             if (alwaysUpdateTime || overTime) {
212 215
                 lastItemTime = System.currentTimeMillis();
213 216
             }

Laden…
Annuleren
Opslaan