Просмотр исходного кода

Fix line endings and trailing spaces

Change-Id: I36ccd739efef6b633cb8f927d820f7bfba49875f
Reviewed-on: http://gerrit.dmdirc.com/1922
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.7rc1
Chris Smith 13 лет назад
Родитель
Сommit
855c095404

+ 40
- 40
src/com/dmdirc/util/ConfigFile.java Просмотреть файл

@@ -49,13 +49,13 @@ public class ConfigFile extends TextFile {
49 49
     /** The key/value sets associated with each key domain. */
50 50
     private final Map<String, Map<String, String>> keydomains
51 51
             = new HashMap<String, Map<String, String>>();
52
-    
52
+
53 53
     /** Whether or not we should automatically create domains. */
54 54
     private boolean automake;
55 55
 
56 56
     /**
57 57
      * Creates a new read-only Config File from the specified input stream.
58
-     * 
58
+     *
59 59
      * @param is The input stream to read
60 60
      */
61 61
     public ConfigFile(final InputStream is) {
@@ -64,7 +64,7 @@ public class ConfigFile extends TextFile {
64 64
 
65 65
     /**
66 66
      * Creates a new Config File from the specified file.
67
-     * 
67
+     *
68 68
      * @param file The file to read/write
69 69
      */
70 70
     public ConfigFile(final File file) {
@@ -73,7 +73,7 @@ public class ConfigFile extends TextFile {
73 73
 
74 74
     /**
75 75
      * Creates a new Config File from the specified file.
76
-     * 
76
+     *
77 77
      * @param filename The name of the file to read/write
78 78
      */
79 79
     public ConfigFile(final String filename) {
@@ -84,7 +84,7 @@ public class ConfigFile extends TextFile {
84 84
      * Sets the "automake" value of this config file. If automake is set to
85 85
      * true, any calls to getKeyDomain will automatically create the domain
86 86
      * if it did not previously exist.
87
-     * 
87
+     *
88 88
      * @param automake The new value of the automake setting of this file
89 89
      */
90 90
     public void setAutomake(final boolean automake) {
@@ -93,7 +93,7 @@ public class ConfigFile extends TextFile {
93 93
 
94 94
     /**
95 95
      * Reads the data from the file.
96
-     * 
96
+     *
97 97
      * @throws IOException if an i/o exception occurred when reading
98 98
      * @throws InvalidConfigFileException if the config file isn't valid
99 99
      */
@@ -101,17 +101,17 @@ public class ConfigFile extends TextFile {
101 101
         String domain = null;
102 102
         boolean keydomain = false;
103 103
         int offset;
104
-        
104
+
105 105
         keydomains.clear();
106 106
         flatdomains.clear();
107 107
         domains.clear();
108
-        
108
+
109 109
         readLines();
110 110
 
111 111
         for (String line : getLines()) {
112 112
             String tline = line;
113
-            
114
-            while (!tline.isEmpty() && (tline.charAt(0) == '\t' || 
113
+
114
+            while (!tline.isEmpty() && (tline.charAt(0) == '\t' ||
115 115
                     tline.charAt(0) == ' ')) {
116 116
                 tline = tline.substring(1);
117 117
             }
@@ -127,7 +127,7 @@ public class ConfigFile extends TextFile {
127 127
 
128 128
                 keydomain = keydomains.containsKey(domain)
129 129
                         || flatdomains.containsValue("keysections", domain);
130
-                
130
+
131 131
                 if (keydomain && !keydomains.containsKey(domain)) {
132 132
                     keydomains.put(domain, new HashMap<String, String>());
133 133
                 } else if (!keydomain && !flatdomains.containsKey(domain)) {
@@ -150,7 +150,7 @@ public class ConfigFile extends TextFile {
150 150
 
151 151
     /**
152 152
      * Writes the contents of this ConfigFile to disk.
153
-     * 
153
+     *
154 154
      * @throws IOException if the write operation fails
155 155
      */
156 156
     public void write() throws IOException {
@@ -158,7 +158,7 @@ public class ConfigFile extends TextFile {
158 158
             throw new UnsupportedOperationException("Cannot write to a file "
159 159
                     + "that isn't writable");
160 160
         }
161
-        
161
+
162 162
         final List<String> lines = new ArrayList<String>();
163 163
 
164 164
         lines.add("# This is a DMDirc configuration file.");
@@ -191,10 +191,10 @@ public class ConfigFile extends TextFile {
191 191
 
192 192
         writeLines(lines);
193 193
     }
194
-    
194
+
195 195
     /**
196 196
      * Appends the meta-data (keysections) to the specified list of lines.
197
-     * 
197
+     *
198 198
      * @param lines The set of lines to be appended to
199 199
      */
200 200
     private void writeMeta(final List<String> lines) {
@@ -214,19 +214,19 @@ public class ConfigFile extends TextFile {
214 214
             }
215 215
         }
216 216
     }
217
-    
217
+
218 218
     /**
219 219
      * Retrieves all the key domains for this config file.
220
-     * 
220
+     *
221 221
      * @return This config file's key domains
222 222
      */
223 223
     public Map<String, Map<String, String>> getKeyDomains() {
224 224
         return keydomains;
225 225
     }
226
-    
226
+
227 227
     /**
228 228
      * Retrieves the key/values of the specified key domain.
229
-     * 
229
+     *
230 230
      * @param domain The domain to be retrieved
231 231
      * @return A map of keys to values in the specified domain
232 232
      */
@@ -235,23 +235,23 @@ public class ConfigFile extends TextFile {
235 235
             domains.add(domain);
236 236
             keydomains.put(domain, new HashMap<String, String>());
237 237
         }
238
-        
238
+
239 239
         return keydomains.get(domain);
240 240
     }
241
-    
241
+
242 242
     /**
243 243
      * Retrieves the content of the specified flat domain.
244
-     * 
244
+     *
245 245
      * @param domain The domain to be retrieved
246 246
      * @return A list of lines in the specified domain
247 247
      */
248 248
     public List<String> getFlatDomain(final String domain) {
249 249
         return flatdomains.get(domain);
250 250
     }
251
-    
251
+
252 252
     /**
253 253
      * Determines if this config file has the specified domain.
254
-     * 
254
+     *
255 255
      * @param domain The domain to check for
256 256
      * @return True if the domain is known, false otherwise
257 257
      */
@@ -263,7 +263,7 @@ public class ConfigFile extends TextFile {
263 263
     /**
264 264
      * Determines if this config file has the specified domain, and the domain
265 265
      * is a key domain.
266
-     * 
266
+     *
267 267
      * @param domain The domain to check for
268 268
      * @return True if the domain is known and keyed, false otherwise
269 269
      */
@@ -274,17 +274,17 @@ public class ConfigFile extends TextFile {
274 274
     /**
275 275
      * Determines if this config file has the specified domain, and the domain
276 276
      * is a flat domain.
277
-     * 
277
+     *
278 278
      * @param domain The domain to check for
279 279
      * @return True if the domain is known and flat, false otherwise
280 280
      */
281 281
     public boolean isFlatDomain(final String domain) {
282 282
         return flatdomains.containsKey(domain);
283 283
     }
284
-    
284
+
285 285
     /**
286 286
      * Adds a new flat domain to this config file.
287
-     * 
287
+     *
288 288
      * @param name The name of the domain to be added
289 289
      * @param data The content of the domain
290 290
      */
@@ -295,18 +295,18 @@ public class ConfigFile extends TextFile {
295 295
 
296 296
     /**
297 297
      * Adds a new key domain to this config file.
298
-     * 
298
+     *
299 299
      * @param name The name of the domain to be added
300 300
      * @param data The content of the domain
301
-     */    
301
+     */
302 302
     public void addDomain(final String name, final Map<String, String> data) {
303 303
         domains.add(name);
304 304
         keydomains.put(name, data);
305 305
     }
306
-    
306
+
307 307
     /**
308 308
      * Unescapes any escaped characters in the specified input string.
309
-     * 
309
+     *
310 310
      * @param input The string to unescape
311 311
      * @return The string with all escape chars (\) resolved
312 312
      */
@@ -325,7 +325,7 @@ public class ConfigFile extends TextFile {
325 325
                 } else {
326 326
                     temp.append(ch);
327 327
                 }
328
-                
328
+
329 329
                 escaped = false;
330 330
             } else if (ch == '\\') {
331 331
                 escaped = true;
@@ -333,14 +333,14 @@ public class ConfigFile extends TextFile {
333 333
                 temp.append(ch);
334 334
             }
335 335
         }
336
-        
336
+
337 337
         return temp.toString();
338 338
     }
339
-    
339
+
340 340
     /**
341 341
      * Escapes the specified input string by prefixing all occurances of
342 342
      * \, \n, \r, =, # and : with backslashes.
343
-     * 
343
+     *
344 344
      * @param input The string to be escaped
345 345
      * @return A backslash-armoured version of the string
346 346
      */
@@ -349,16 +349,16 @@ public class ConfigFile extends TextFile {
349 349
                 .replace("\r", "\\r").replace("=", "\\=")
350 350
                 .replace(":", "\\:").replace("#", "\\#");
351 351
     }
352
-    
352
+
353 353
     /**
354 354
      * Finds the first non-escaped instance of '=' in the specified string.
355
-     * 
355
+     *
356 356
      * @param input The string to be searched
357 357
      * @return The offset of the first non-escaped instance of '=', or -1.
358 358
      */
359 359
     protected static int findEquals(final String input) {
360 360
         boolean escaped = false;
361
-        
361
+
362 362
         for (int i = 0; i < input.length(); i++) {
363 363
             if (escaped) {
364 364
                 escaped = false;
@@ -368,7 +368,7 @@ public class ConfigFile extends TextFile {
368 368
                 return i;
369 369
             }
370 370
         }
371
-        
371
+
372 372
         return -1;
373 373
     }
374 374
 }

+ 5
- 5
src/com/dmdirc/util/DownloadListener.java Просмотреть файл

@@ -25,24 +25,24 @@ package com.dmdirc.util;
25 25
 /**
26 26
  * Defines the method that objects interested in receiving download progress
27 27
  * updates should implement.
28
- * 
28
+ *
29 29
  * @author chris
30 30
  */
31 31
 public interface DownloadListener {
32 32
 
33 33
     /**
34 34
      * Called when the progress of the download has changed.
35
-     * 
35
+     *
36 36
      * @param percent The percentage of the file that has been downloaded
37 37
      */
38 38
     void downloadProgress(float percent);
39
-    
39
+
40 40
     /**
41 41
      * Called to notify the listener if this download has an indeterminate
42 42
      * length.
43
-     * 
43
+     *
44 44
      * @param indeterminate true or false
45
-     * 
45
+     *
46 46
      * @since 0.6
47 47
      */
48 48
     void setIndeterminate(final boolean indeterminate);

+ 4
- 4
src/com/dmdirc/util/EquatableWeakReference.java Просмотреть файл

@@ -28,15 +28,15 @@ import java.lang.ref.WeakReference;
28 28
 /**
29 29
  * An extension of WeakReference that implements a sane equals and hashcode
30 30
  * method.
31
- * 
31
+ *
32 32
  * @param <T> The type of object that this reference contains
33 33
  * @author chris
34 34
  */
35 35
 public class EquatableWeakReference<T> extends WeakReference<T> {
36
-    
36
+
37 37
     /**
38 38
      * Creates a new instance of EquatableWeakReference.
39
-     * 
39
+     *
40 40
      * @param referent The object that this weak reference should reference.
41 41
      */
42 42
     public EquatableWeakReference(final T referent) {
@@ -58,5 +58,5 @@ public class EquatableWeakReference<T> extends WeakReference<T> {
58 58
     public int hashCode() {
59 59
         return get().hashCode();
60 60
     }
61
-    
61
+
62 62
 }

+ 3
- 3
src/com/dmdirc/util/InvalidConfigFileException.java Просмотреть файл

@@ -27,17 +27,17 @@ package com.dmdirc.util;
27 27
  * @author chris
28 28
  */
29 29
 public class InvalidConfigFileException extends Exception {
30
-    
30
+
31 31
     /**
32 32
      * A version number for this class. It should be changed whenever the class
33 33
      * structure is changed (or anything else that would prevent serialized
34 34
      * objects being unserialized with the new class).
35
-     */    
35
+     */
36 36
     private static final long serialVersionUID = 1;
37 37
 
38 38
     /**
39 39
      * Creates a new InvalidConfigFileException.
40
-     * 
40
+     *
41 41
      * @param string A description of the exception that occured.
42 42
      */
43 43
     public InvalidConfigFileException(final String string) {

+ 12
- 12
src/com/dmdirc/util/ListenerList.java Просмотреть файл

@@ -30,18 +30,18 @@ import java.util.concurrent.CopyOnWriteArrayList;
30 30
 /**
31 31
  * Represents a list of event listeners, similar to EventListenerList, but
32 32
  * not swing specific.
33
- * 
33
+ *
34 34
  * @author chris
35 35
  */
36 36
 public class ListenerList {
37
-    
37
+
38 38
     /** The map of class->listener or string->listener that we're using. */
39 39
     private final Map<Object, Collection<Object>> listeners
40 40
             = new HashMap<Object, Collection<Object>>();
41
-       
41
+
42 42
     /**
43 43
      * Adds a new listener of the specified type to this listener list.
44
-     * 
44
+     *
45 45
      * @param <T> The type of listener to be added
46 46
      * @param listenerType The type of listener to be added
47 47
      * @param listener The listener to be added
@@ -53,10 +53,10 @@ public class ListenerList {
53 53
 
54 54
         listeners.get(listenerType).add(listener);
55 55
     }
56
-    
56
+
57 57
     /**
58 58
      * Adds a new listener of the specified type to this listener list.
59
-     * 
59
+     *
60 60
      * @param listenerType The name of the type of listener that's being added
61 61
      * @param listener The listener to be added
62 62
      */
@@ -67,7 +67,7 @@ public class ListenerList {
67 67
 
68 68
         listeners.get(listenerType).add(listener);
69 69
     }
70
-    
70
+
71 71
     /**
72 72
      * Removes the specified listener from the list of listeners for the
73 73
      * specified type.
@@ -79,11 +79,11 @@ public class ListenerList {
79 79
     public <T> void remove(final Class<T> listenerType, final T listener) {
80 80
         get(listenerType).remove(listener);
81 81
     }
82
-    
82
+
83 83
     /**
84 84
      * Removes the specified listener from the list of listeners for the
85 85
      * specified type.
86
-     * 
86
+     *
87 87
      * @param listenerType The name of the type that the listener should be
88 88
      * removed from
89 89
      * @param listener The listener to be removed
@@ -91,7 +91,7 @@ public class ListenerList {
91 91
     public void remove(final String listenerType, final Object listener) {
92 92
         get(listenerType).remove(listener);
93 93
     }
94
-    
94
+
95 95
     /**
96 96
      * Retrieves the list of listeners for the specified type.
97 97
      *
@@ -107,10 +107,10 @@ public class ListenerList {
107 107
             return new CopyOnWriteArrayList<T>();
108 108
         }
109 109
     }
110
-    
110
+
111 111
     /**
112 112
      * Retrieves the list of listeners for the specified type.
113
-     * 
113
+     *
114 114
      * @param listenerType The type of listener to be retrieved
115 115
      * @return A list of listeners for the specified type
116 116
      */

+ 3
- 3
src/com/dmdirc/util/ReturnableThread.java Просмотреть файл

@@ -24,7 +24,7 @@ package com.dmdirc.util;
24 24
 
25 25
 /**
26 26
  * Normal thread with the potential to return a value.
27
- * 
27
+ *
28 28
  * @param T Type to be returned
29 29
  */
30 30
 public abstract class ReturnableThread<T> extends Thread {
@@ -38,7 +38,7 @@ public abstract class ReturnableThread<T> extends Thread {
38 38
 
39 39
     /**
40 40
      * Sets the returnable object.
41
-     * 
41
+     *
42 42
      * @param value new returnable object
43 43
      */
44 44
     public void setObject(final T value) {
@@ -47,7 +47,7 @@ public abstract class ReturnableThread<T> extends Thread {
47 47
 
48 48
     /**
49 49
      * Returns the object set by this thread.
50
-     * 
50
+     *
51 51
      * @return Returnable object
52 52
      */
53 53
     public T getObject() {

+ 34
- 34
src/com/dmdirc/util/RollingList.java Просмотреть файл

@@ -28,12 +28,12 @@ import java.util.List;
28 28
 /**
29 29
  * Implements a "rolling list". A rolling list has a maximum capacity, and
30 30
  * removes the oldest elements from the list to maintain this capacity.
31
- * 
32
- * @param <T> The type if items that this list contains 
31
+ *
32
+ * @param <T> The type if items that this list contains
33 33
  * @author chris
34 34
  */
35 35
 public class RollingList<T> {
36
-   
36
+
37 37
     /** The items in this rolling list. */
38 38
     private final List<T> items = new ArrayList<T>();
39 39
     /** The maximum capacity of this list. */
@@ -44,10 +44,10 @@ public class RollingList<T> {
44 44
     private int position = 0;
45 45
     /** The "empty" item to be added. */
46 46
     private T empty;
47
-    
47
+
48 48
     /**
49 49
      * Creates a new RollingList of the specified capacity.
50
-     * 
50
+     *
51 51
      * @param capacity The capacity of this list.
52 52
      */
53 53
     public RollingList(final int capacity) {
@@ -58,10 +58,10 @@ public class RollingList<T> {
58 58
     /**
59 59
      * Creates a new RollingList of the specified capacity, with the specified
60 60
      * "empty" element appended to the end.
61
-     * 
61
+     *
62 62
      * @param capacity The capacity of this list.
63 63
      * @param empty The "empty" element to be added
64
-     */    
64
+     */
65 65
     public RollingList(final int capacity, final T empty) {
66 66
         this.capacity = capacity;
67 67
         this.addEmpty = true;
@@ -70,7 +70,7 @@ public class RollingList<T> {
70 70
 
71 71
     /**
72 72
      * Removes the specified element from this list.
73
-     * 
73
+     *
74 74
      * @param o The object to be removed from the list.
75 75
      * @return True if the list contained the specified element,
76 76
      * false otherwise.
@@ -81,7 +81,7 @@ public class RollingList<T> {
81 81
 
82 82
     /**
83 83
      * Determines if this list is currently empty.
84
-     * 
84
+     *
85 85
      * @return True if the list is empty, false otherwise.
86 86
      */
87 87
     public boolean isEmpty() {
@@ -90,7 +90,7 @@ public class RollingList<T> {
90 90
 
91 91
     /**
92 92
      * Retrieves the item at the specified index in this list.
93
-     * 
93
+     *
94 94
      * @param index The index to look up
95 95
      * @return The item at the specified index
96 96
      */
@@ -100,7 +100,7 @@ public class RollingList<T> {
100 100
 
101 101
     /**
102 102
      * Determines if this list contains the specified object.
103
-     * 
103
+     *
104 104
      * @param o The object to be checked
105 105
      * @return True if this list contains the item, false otherwise.
106 106
      */
@@ -113,13 +113,13 @@ public class RollingList<T> {
113 113
      */
114 114
     public void clear() {
115 115
         items.clear();
116
-    }  
117
-    
116
+    }
117
+
118 118
     /**
119 119
      * Adds the specified item to this list. If the list has reached its
120 120
      * maximum capacity, this method will remove elements from the start of the
121 121
      * list until there is sufficient room for the new element.
122
-     * 
122
+     *
123 123
      * @param e The element to be added to the list.
124 124
      * @return True
125 125
      */
@@ -128,13 +128,13 @@ public class RollingList<T> {
128 128
             items.remove(0);
129 129
             position--;
130 130
         }
131
-        
131
+
132 132
         return items.add(e);
133 133
     }
134
-    
134
+
135 135
     /**
136 136
      * Retrieves the current position within the list.
137
-     * 
137
+     *
138 138
      * @return This list's positional pointer
139 139
      */
140 140
     public int getPosition() {
@@ -143,27 +143,27 @@ public class RollingList<T> {
143 143
 
144 144
     /**
145 145
      * Sets the positional pointer of this list.
146
-     * 
146
+     *
147 147
      * @param position The new position
148 148
      */
149 149
     public void setPosition(final int position) {
150 150
         this.position = position;
151
-    }    
152
-    
151
+    }
152
+
153 153
     /**
154 154
      * Determines if there is an element after the positional pointer of
155 155
      * the list.
156
-     * 
156
+     *
157 157
      * @return True if there is an element, false otherwise.
158 158
      */
159 159
     public boolean hasNext() {
160 160
         return (items.size() > position + 1) || ((items.size() > position)
161 161
                 && addEmpty);
162 162
     }
163
-    
163
+
164 164
     /**
165 165
      * Retrieves the element after the positional pointer of the list.
166
-     * 
166
+     *
167 167
      * @return The next element in the list
168 168
      */
169 169
     public T getNext() {
@@ -174,43 +174,43 @@ public class RollingList<T> {
174 174
             return empty;
175 175
         }
176 176
     }
177
-    
177
+
178 178
     /**
179 179
      * Determines if there is an element befpre the positional pointer of
180 180
      * the list.
181
-     * 
181
+     *
182 182
      * @return True if there is an element, false otherwise.
183
-     */    
183
+     */
184 184
     public boolean hasPrevious() {
185 185
         return 0 < position;
186 186
     }
187
-    
187
+
188 188
     /**
189 189
      * Retrieves the element before the positional pointer of the list.
190
-     * 
190
+     *
191 191
      * @return The previous element in the list
192
-     */    
192
+     */
193 193
     public T getPrevious() {
194 194
         return get(--position);
195
-    }    
196
-    
195
+    }
196
+
197 197
     /**
198 198
      * Sets the positional pointer of this list to the end.
199 199
      */
200 200
     public void seekToEnd() {
201 201
         position = items.size();
202 202
     }
203
-    
203
+
204 204
     /**
205 205
      * Sets the positional pointer of this list to the start.
206 206
      */
207 207
     public void seekToStart() {
208 208
         position = 0;
209 209
     }
210
-    
210
+
211 211
     /**
212 212
      * Retrieves a list of items that this rolling list contains.
213
-     * 
213
+     *
214 214
      * @return A list of items in this rolling list.
215 215
      */
216 216
     public List<T> getList() {

+ 1
- 1
src/com/dmdirc/util/StreamUtil.java Просмотреть файл

@@ -32,7 +32,7 @@ import java.io.IOException;
32 32
  * @author chris
33 33
  */
34 34
 public final class StreamUtil {
35
-    
35
+
36 36
     /** Shouldn't be called. */
37 37
     private StreamUtil() {
38 38
         super();

+ 23
- 23
src/com/dmdirc/util/TextFile.java Просмотреть файл

@@ -36,27 +36,27 @@ import java.util.List;
36 36
 
37 37
 /**
38 38
  * Allows reading and writing to a plain text file via a list of lines.
39
- * 
39
+ *
40 40
  * @author chris
41 41
  */
42 42
 public class TextFile {
43
-    
43
+
44 44
     /** The file we're dealing with. */
45 45
     private File file;
46
-    
46
+
47 47
     /** The input stream we're dealing with. */
48 48
     private InputStream is;
49
-    
49
+
50 50
     /** The lines we've read from the file. */
51 51
     private List<String> lines;
52 52
 
53 53
     /** The charset to use to read the file. */
54 54
     private final Charset charset;
55
-    
55
+
56 56
     /**
57 57
      * Creates a new instance of TextFile for the specified file, and uses the
58 58
      * default charset.
59
-     * 
59
+     *
60 60
      * @param filename The file to be read/written
61 61
      */
62 62
     public TextFile(final String filename) {
@@ -66,17 +66,17 @@ public class TextFile {
66 66
     /**
67 67
      * Creates a new instance of TextFile for the specified File, and uses the
68 68
      * default charset.
69
-     * 
69
+     *
70 70
      * @param file The file to read
71 71
      */
72 72
     public TextFile(final File file) {
73 73
         this(file, Charset.defaultCharset());
74 74
     }
75
-    
75
+
76 76
     /**
77 77
      * Creates a new instance of TextFile for an input stream, and uses the
78 78
      * default charset.
79
-     * 
79
+     *
80 80
      * @param is The input stream to read from
81 81
      */
82 82
     public TextFile(final InputStream is) {
@@ -108,11 +108,11 @@ public class TextFile {
108 108
         this.is = is;
109 109
         this.charset = charset;
110 110
     }
111
-    
111
+
112 112
     /**
113 113
      * Retrieves the contents of the file as a list of lines. If getLines() or
114 114
      * readLines() has previously been called, a cached version is returned.
115
-     * 
115
+     *
116 116
      * @return A list of lines in the file
117 117
      * @throws IOException if an I/O exception occurs
118 118
      */
@@ -120,13 +120,13 @@ public class TextFile {
120 120
         if (lines == null) {
121 121
             readLines();
122 122
         }
123
-        
123
+
124 124
         return lines;
125 125
     }
126
-    
126
+
127 127
     /**
128 128
      * Reads the contents of the file into this TextFile's line cache.
129
-     * 
129
+     *
130 130
      * @throws IOException If an I/O exception occurs
131 131
      */
132 132
     public void readLines() throws IOException {
@@ -151,19 +151,19 @@ public class TextFile {
151 151
             StreamUtil.close(inputStream);
152 152
         }
153 153
     }
154
-    
154
+
155 155
     /**
156 156
      * Determines if this file is writable or not.
157
-     * 
157
+     *
158 158
      * @return True if the file is writable, false otherwise
159 159
      */
160 160
     public boolean isWritable() {
161 161
         return file != null;
162 162
     }
163
-    
163
+
164 164
     /**
165 165
      * Writes the specified list of lines to the file.
166
-     * 
166
+     *
167 167
      * @param lines The lines to be written
168 168
      * @throws IOException if an I/O exception occurs
169 169
      */
@@ -172,12 +172,12 @@ public class TextFile {
172 172
             throw new UnsupportedOperationException("Cannot write to TextFile "
173 173
                     + "opened with an InputStream");
174 174
         }
175
-        
175
+
176 176
         BufferedWriter writer = null;
177 177
 
178 178
         try {
179 179
             writer = new BufferedWriter(new FileWriter(file));
180
-        
180
+
181 181
             for (String line : lines) {
182 182
                 writer.write(line);
183 183
                 writer.newLine();
@@ -189,13 +189,13 @@ public class TextFile {
189 189
 
190 190
     /**
191 191
      * Retrieves the File for this TextFile, if there is one.
192
-     * 
192
+     *
193 193
      * @return This TextFile's file, or null
194 194
      */
195 195
     public File getFile() {
196 196
         return file;
197 197
     }
198
-    
198
+
199 199
     /**
200 200
      * Deletes the file associated with this textfile, if there is one.
201 201
      */
@@ -204,7 +204,7 @@ public class TextFile {
204 204
             throw new UnsupportedOperationException("Cannot delete TextFile "
205 205
                     + "opened with an InputStream");
206 206
         }
207
-        
207
+
208 208
         file.delete();
209 209
     }
210 210
 

+ 3
- 3
src/com/dmdirc/util/WeakList.java Просмотреть файл

@@ -32,7 +32,7 @@ import java.util.ListIterator;
32 32
 /**
33 33
  * Implements a list of weak references. The weak references (and subsequent
34 34
  * garbage collection) are handled transparently.
35
- * 
35
+ *
36 36
  * @param <T> The type of object that this list will contain.
37 37
  * @author chris
38 38
  */
@@ -55,7 +55,7 @@ public class WeakList<T> implements List<T> {
55 55
 
56 56
     /**
57 57
      * Dereferences the specified list of WeakReferences to get a plain List.
58
-     * 
58
+     *
59 59
      * @param list The list to be dereferenced
60 60
      * @return A list containing the items referenced by the specified list
61 61
      */
@@ -74,7 +74,7 @@ public class WeakList<T> implements List<T> {
74 74
     /**
75 75
      * Creates a new collection of weak references to elements in the specified
76 76
      * collection.
77
-     * 
77
+     *
78 78
      * @param c The collection whose elements should be referenced
79 79
      * @return A copy of the specified collection, with each item wrapped in
80 80
      * a weak reference.

+ 4
- 4
src/com/dmdirc/util/WeakMapList.java Просмотреть файл

@@ -29,17 +29,17 @@ import java.util.List;
29 29
  * accessing the data. Implements a Map-like interface for easier transition.
30 30
  * This implementation uses WeakLists (i.e., lists of weak references) - all
31 31
  * references to values are wrapped in WeakReferences.
32
- * 
32
+ *
33 33
  * @param <S> the type of keys maintained by this map
34 34
  * @param <T> the type of mapped values
35 35
  * @author chris
36 36
  */
37 37
 public class WeakMapList<S,T> extends MapList<S,T> {
38
-    
38
+
39 39
     /**
40 40
      * Retrieves the list of values associated with the specified key, creating
41 41
      * the key if neccessary.
42
-     * 
42
+     *
43 43
      * @param key The key to retrieve
44 44
      * @return A list of the specified key's values
45 45
      */
@@ -48,7 +48,7 @@ public class WeakMapList<S,T> extends MapList<S,T> {
48 48
         if (!map.containsKey(key)) {
49 49
             map.put(key, new WeakList<T>());
50 50
         }
51
-        
51
+
52 52
         return map.get(key);
53 53
     }
54 54
 }

+ 1
- 1
src/com/dmdirc/util/validators/PermissiveValidator.java Просмотреть файл

@@ -28,7 +28,7 @@ package com.dmdirc.util.validators;
28 28
  * @author chris
29 29
  */
30 30
 public class PermissiveValidator<V> implements Validator<V> {
31
-    
31
+
32 32
     /**
33 33
      * Creates a new instance of PermissiveValidator.
34 34
      */

+ 3
- 3
src/com/dmdirc/util/validators/RegexStringValidator.java Просмотреть файл

@@ -1,16 +1,16 @@
1 1
 /*
2 2
  * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- * 
3
+ *
4 4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
5 5
  * of this software and associated documentation files (the "Software"), to deal
6 6
  * in the Software without restriction, including without limitation the rights
7 7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 8
  * copies of the Software, and to permit persons to whom the Software is
9 9
  * furnished to do so, subject to the following conditions:
10
- * 
10
+ *
11 11
  * The above copyright notice and this permission notice shall be included in
12 12
  * all copies or substantial portions of the Software.
13
- * 
13
+ *
14 14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

+ 3
- 3
src/com/dmdirc/util/validators/StringLengthValidator.java Просмотреть файл

@@ -23,14 +23,14 @@ package com.dmdirc.util.validators;
23 23
 
24 24
 /**
25 25
  * Validates that the length of a string is within certain bounds.
26
- * 
26
+ *
27 27
  * @author chris
28 28
  */
29 29
 public class StringLengthValidator implements Validator<String> {
30
-    
30
+
31 31
     /** The minimum string length. */
32 32
     protected final int min;
33
-    
33
+
34 34
     /** The maximum string length. */
35 35
     protected final int max;
36 36
 

Загрузка…
Отмена
Сохранить