Quellcode durchsuchen

Style fixes

Change-Id: I4a52807921e2c3082cd0650e222387f0dedbfd23
Reviewed-on: http://gerrit.dmdirc.com/1319
Reviewed-by: Chris Smith <chris@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.6.4
Greg Holmes vor 14 Jahren
Ursprung
Commit
6bc88d147e
2 geänderte Dateien mit 150 neuen und 132 gelöschten Zeilen
  1. 12
    12
      src/com/dmdirc/parser/common/CallbackManager.java
  2. 138
    120
      src/com/dmdirc/parser/common/MyInfo.java

+ 12
- 12
src/com/dmdirc/parser/common/CallbackManager.java Datei anzeigen

@@ -46,7 +46,7 @@ public abstract class CallbackManager<T extends Parser> {
46 46
         ChannelJoinListener.class, ChannelKickListener.class,
47 47
         ChannelMessageListener.class, ChannelModeChangeListener.class,
48 48
         ChannelNickChangeListener.class, ChannelNonUserModeChangeListener.class,
49
-	ChannelModeMessageListener.class, ChannelModeNoticeListener.class,
49
+        ChannelModeMessageListener.class, ChannelModeNoticeListener.class,
50 50
         ChannelNoticeListener.class, ChannelPartListener.class, ChannelQuitListener.class,
51 51
         ChannelSelfJoinListener.class, ChannelSingleModeChangeListener.class,
52 52
         ChannelTopicListener.class, ChannelUserModeChangeListener.class,
@@ -79,7 +79,7 @@ public abstract class CallbackManager<T extends Parser> {
79 79
      *
80 80
      * @param parser Parser that owns this callback manager.
81 81
      */
82
-    public CallbackManager(final T parser) {
82
+    protected CallbackManager(final T parser) {
83 83
         initialise(parser);
84 84
     }
85 85
 
@@ -190,14 +190,14 @@ public abstract class CallbackManager<T extends Parser> {
190 190
      * Add a callback.
191 191
      * This method will throw a CallbackNotFoundException if the callback does not exist.
192 192
      *
193
-     * @param <T> The type of callback
193
+     * @param <S> The type of callback
194 194
      * @param callback Type of callback object
195 195
      * @param o instance of ICallbackInterface to add.
196 196
      * @throws CallbackNotFoundException If callback is not found.
197 197
      * @throws NullPointerException If 'o' is null
198 198
      */
199
-    public <T extends CallbackInterface> void addCallback(
200
-            final Class<T> callback, final T o) throws CallbackNotFoundException {
199
+    public <S extends CallbackInterface> void addCallback(
200
+            final Class<S> callback, final S o) throws CallbackNotFoundException {
201 201
         if (o == null) {
202 202
             throw new NullPointerException("CallbackInterface is null");
203 203
         }
@@ -220,9 +220,9 @@ public abstract class CallbackManager<T extends Parser> {
220 220
      * @throws CallbackNotFoundException If callback is not found.
221 221
      * @throws NullPointerException If 'o' is null
222 222
      */
223
-    public <T extends CallbackInterface> void addCallback(
224
-            final Class<T> callback,
225
-            final T o, final String target) throws CallbackNotFoundException {
223
+    public <S extends CallbackInterface> void addCallback(
224
+            final Class<S> callback,
225
+            final S o, final String target) throws CallbackNotFoundException {
226 226
         if (o == null) {
227 227
             throw new NullPointerException("CallbackInterface is null");
228 228
         }
@@ -239,8 +239,8 @@ public abstract class CallbackManager<T extends Parser> {
239 239
      * @param o instance of ICallbackInterface to add.
240 240
      * @return true/false if the callback was added or not.
241 241
      */
242
-    public <T extends CallbackInterface> boolean addNonCriticalCallback(
243
-            final Class<T> callback, final T o) {
242
+    public <S extends CallbackInterface> boolean addNonCriticalCallback(
243
+            final Class<S> callback, final S o) {
244 244
         try {
245 245
             addCallback(callback, o);
246 246
             return true;
@@ -259,8 +259,8 @@ public abstract class CallbackManager<T extends Parser> {
259 259
      * @param target Parameter to specify that a callback should only fire for specific things
260 260
      * @return true/false if the callback was added or not.
261 261
      */
262
-    public <T extends CallbackInterface> boolean addNonCriticalCallback(
263
-            final Class<T> callback, final T o, final String target) {
262
+    public <S extends CallbackInterface> boolean addNonCriticalCallback(
263
+            final Class<S> callback, final S o, final String target) {
264 264
         try {
265 265
             addCallback(callback, o, target);
266 266
             return true;

+ 138
- 120
src/com/dmdirc/parser/common/MyInfo.java Datei anzeigen

@@ -30,130 +30,148 @@ package com.dmdirc.parser.common;
30 30
  * @see IRCParser
31 31
  */
32 32
 public class MyInfo {
33
-    
34
-	/** Character to prepend to nickname if in use (Default "_"). */
35
-	private char prependChar = '_';	
36
-	/** Nickname to attempt to use on IRC. */
37
-	private String nickname;
38
-	/**
39
-	 * Alternative nickname to attempt to use on IRC.
40
-	 * If the first nickname is in use, and a NickInUse message is recieved before 001, we
41
-	 * will attempt to use this nickname instead.<br>
42
-	 * If this also fails, we will start prepending the prependChar character (_) to the main nickname
43
-	 */
44
-	private String altNickname;
45
-	/** Realname string to use */
46
-	private String realname;
47
-	/** Username to use, this doesn't matter when an ident server is running*/
48
-	private String username;
49
-	
50
-	/**
51
-	 * Create a new MyInfo object.
52
-	 */
53
-	public MyInfo() {
54
-		String result;
55
-		try {
56
-			result = System.getProperty("user.name");
57
-		} catch (SecurityException e) {
58
-			result = null;
59
-		}
60
-		if (result == null || result.isEmpty()) {
61
-			nickname = "IRCParser";
62
-			username = "IRCParser";
63
-			realname = "DMDIrc IRCParser";
64
-			altNickname = "IRC-Parser";
65
-		} else {
66
-			nickname = result;
67
-			username = nickname;
68
-			realname = nickname+" - DMDIrc";
69
-			altNickname = nickname+"-";
70
-		}
33
+
34
+    /** Character to prepend to nickname if in use (Default "_"). */
35
+    private char prependChar = '_';
36
+    /** Nickname to attempt to use on IRC. */
37
+    private String nickname;
38
+    /**
39
+     * Alternative nickname to attempt to use on IRC. If the first nickname is
40
+     * in use, and a NickInUse message is recieved before 001, we will attempt
41
+     * to use this nickname instead.<br>
42
+     * If this also fails, we will start prepending the prependChar character
43
+     * (_) to the main nickname
44
+     */
45
+    private String altNickname;
46
+    /** Realname string to use */
47
+    private String realname;
48
+    /** Username to use, this doesn't matter when an ident server is running */
49
+    private String username;
50
+
51
+    /**
52
+     * Create a new MyInfo object.
53
+     */
54
+    public MyInfo() {
55
+	String result;
56
+	try {
57
+	    result = System.getProperty("user.name");
58
+	} catch (SecurityException e) {
59
+	    result = null;
71 60
 	}
72
-	
73
-	/**
74
-	 * Set the Nickname.
75
-	 *
76
-	 * @param newValue Value to set to.
77
-	 */
78
-	public void setNickname(final String newValue) {
79
-		if (newValue != null && !newValue.isEmpty()) {
80
-			nickname = newValue;
81
-		}
61
+	if (result == null || result.isEmpty()) {
62
+	    nickname = "IRCParser";
63
+	    username = "IRCParser";
64
+	    realname = "DMDIrc IRCParser";
65
+	    altNickname = "IRC-Parser";
66
+	} else {
67
+	    nickname = result;
68
+	    username = nickname;
69
+	    realname = nickname + " - DMDIrc";
70
+	    altNickname = nickname + "-";
82 71
 	}
83
-	
84
-	/**
85
-	 * Get the Nickname.
86
-	 *
87
-	 * @return Current Nickname
88
-	 */
89
-	public String getNickname() { return nickname; }
90
-	
91
-	/**
92
-	 * Set the Alternative Nickname.
93
-	 *
94
-	 * @param newValue Value to set to.
95
-	 */
96
-	public void setAltNickname(final String newValue) {
97
-		if (newValue != null && !newValue.isEmpty()) {
98
-			altNickname = newValue;
99
-		}
72
+    }
73
+
74
+    /**
75
+     * Set the Nickname.
76
+     * 
77
+     * @param newValue
78
+     *            Value to set to.
79
+     */
80
+    public void setNickname(final String newValue) {
81
+	if (newValue != null && !newValue.isEmpty()) {
82
+	    nickname = newValue;
100 83
 	}
101
-	
102
-	/**
103
-	 * Get the Alternative Nickname.
104
-	 *
105
-	 * @return Current Nickname
106
-	 */
107
-	public String getAltNickname() { return altNickname; }
108
-	
109
-	/**
110
-	 * Set the Realname.
111
-	 *
112
-	 * @param newValue Value to set to.
113
-	 */
114
-	public void setRealname(final String newValue) {
115
-		if (newValue != null && !newValue.isEmpty()) {
116
-			realname = newValue;
117
-		}
84
+    }
85
+
86
+    /**
87
+     * Get the Nickname.
88
+     * 
89
+     * @return Current Nickname
90
+     */
91
+    public String getNickname() {
92
+	return nickname;
93
+    }
94
+
95
+    /**
96
+     * Set the Alternative Nickname.
97
+     * 
98
+     * @param newValue
99
+     *            Value to set to.
100
+     */
101
+    public void setAltNickname(final String newValue) {
102
+	if (newValue != null && !newValue.isEmpty()) {
103
+	    altNickname = newValue;
118 104
 	}
119
-	
120
-	/**
121
-	 * Get the Realname.
122
-	 *
123
-	 * @return Current Realname
124
-	 */
125
-	public String getRealname() { return realname; }
126
-	
127
-	/**
128
-	 * Set the Username.
129
-	 *
130
-	 * @param newValue Value to set to.
131
-	 */
132
-	public void setUsername(final String newValue) {
133
-		if (newValue != null && !newValue.isEmpty()) {
134
-			username = newValue;
135
-		}
105
+    }
106
+
107
+    /**
108
+     * Get the Alternative Nickname.
109
+     * 
110
+     * @return Current Nickname
111
+     */
112
+    public String getAltNickname() {
113
+	return altNickname;
114
+    }
115
+
116
+    /**
117
+     * Set the Realname.
118
+     * 
119
+     * @param newValue
120
+     *            Value to set to.
121
+     */
122
+    public void setRealname(final String newValue) {
123
+	if (newValue != null && !newValue.isEmpty()) {
124
+	    realname = newValue;
136 125
 	}
137
-	
138
-	/**
139
-	 * Get the Username.
140
-	 *
141
-	 * @return Current Username
142
-	 */
143
-	public String getUsername() { return username; }
144
-	
145
-	/**
146
-	 * Set the Prepend Character.
147
-	 *
148
-	 * @param newValue Value to set to.
149
-	 */
150
-	public void setPrependChar(final char newValue) { prependChar = newValue; }
151
-	
152
-	/**
153
-	 * Get the Prepend Character.
154
-	 *
155
-	 * @return Current Prepend Character
156
-	 */
157
-	public char getPrependChar() { return prependChar; }	
126
+    }
127
+
128
+    /**
129
+     * Get the Realname.
130
+     * 
131
+     * @return Current Realname
132
+     */
133
+    public String getRealname() {
134
+	return realname;
135
+    }
136
+
137
+    /**
138
+     * Set the Username.
139
+     * 
140
+     * @param newValue
141
+     *            Value to set to.
142
+     */
143
+    public void setUsername(final String newValue) {
144
+	if (newValue != null && !newValue.isEmpty()) {
145
+	    username = newValue;
146
+        }
147
+    }
148
+
149
+    /**
150
+     * Get the Username.
151
+     * 
152
+     * @return Current Username
153
+     */
154
+    public String getUsername() {
155
+	return username;
156
+    }
157
+
158
+    /**
159
+     * Set the Prepend Character.
160
+     * 
161
+     * @param newValue
162
+     *            Value to set to.
163
+     */
164
+    public void setPrependChar(final char newValue) {
165
+	prependChar = newValue;
166
+    }
167
+
168
+    /**
169
+     * Get the Prepend Character.
170
+     * 
171
+     * @return Current Prepend Character
172
+     */
173
+    public char getPrependChar() {
174
+	return prependChar;
175
+    }
158 176
 
159 177
 }

Laden…
Abbrechen
Speichern