|
From: <sno...@us...> - 2013-09-08 03:28:54
|
Revision: 74
http://sourceforge.net/p/openrpg/svn/74
Author: snowdog_
Date: 2013-09-08 03:28:51 +0000 (Sun, 08 Sep 2013)
Log Message:
-----------
Minor changes to fix 'overridable method calls in constructors' issue (good code practice)
Modified Paths:
--------------
trunk/src/openrpg2/common/core/route/AddressToken.java
Modified: trunk/src/openrpg2/common/core/route/AddressToken.java
===================================================================
--- trunk/src/openrpg2/common/core/route/AddressToken.java 2006-06-16 00:03:20 UTC (rev 73)
+++ trunk/src/openrpg2/common/core/route/AddressToken.java 2013-09-08 03:28:51 UTC (rev 74)
@@ -60,7 +60,9 @@
* Creates a new MessageAddress object that is by default set to deliver to a Client with an undeliverable ID.
*/
public AddressToken() {
- clear();
+ exclude = false;
+ target = CLIENT;
+ id = 0;
}
/**
@@ -68,7 +70,9 @@
* @param id Client ID to deliver message to.
*/
public AddressToken(int id) {
- clear();
+ exclude = false;
+ target = CLIENT;
+ id = 0;
this.id = id;
}
@@ -78,7 +82,9 @@
* @param exclude If true the client will be excluded from message delivery.
*/
public AddressToken(int id, boolean exclude) {
- clear();
+ exclude = false;
+ target = CLIENT;
+ id = 0;
this.id = id;
this.exclude = exclude;
}
@@ -89,7 +95,9 @@
* @param id The id number of the client or group to identify the target.
*/
public AddressToken(char target, int id) {
- clear();
+ exclude = false;
+ target = CLIENT;
+ id = 0;
if (isValidTarget(target)){
this.target = target;
}
@@ -172,6 +180,7 @@
* Generates an encoded address string for this object
* @return encoded message address String.
*/
+ @Override
public String toString(){
StringBuffer temp = new StringBuffer();
if(exclude){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sno...@us...> - 2013-09-09 22:15:30
|
Revision: 79
http://sourceforge.net/p/openrpg/svn/79
Author: snowdog_
Date: 2013-09-09 22:15:26 +0000 (Mon, 09 Sep 2013)
Log Message:
-----------
Fixed a bug where AddressToken was created with improper settings.
Modified Paths:
--------------
trunk/src/openrpg2/common/core/route/AddressToken.java
Modified: trunk/src/openrpg2/common/core/route/AddressToken.java
===================================================================
--- trunk/src/openrpg2/common/core/route/AddressToken.java 2013-09-09 21:17:10 UTC (rev 78)
+++ trunk/src/openrpg2/common/core/route/AddressToken.java 2013-09-09 22:15:26 UTC (rev 79)
@@ -55,14 +55,14 @@
private char target;
/** id. The identifier for client or group # to use in conjunction with the target. */
private int id;
-
+
/**
* Creates a new MessageAddress object that is by default set to deliver to a Client with an undeliverable ID.
*/
public AddressToken() {
- exclude = false;
- target = CLIENT;
- id = 0;
+ this.exclude = false;
+ this.target = AddressToken.CLIENT;
+ this.id = 0;
}
/**
@@ -70,9 +70,9 @@
* @param id Client ID to deliver message to.
*/
public AddressToken(int id) {
- exclude = false;
- target = CLIENT;
- id = 0;
+ this.exclude = false;
+ this.target = AddressToken.CLIENT;
+ this.id = 0;
this.id = id;
}
@@ -83,8 +83,8 @@
*/
public AddressToken(int id, boolean exclude) {
exclude = false;
- target = CLIENT;
- id = 0;
+ this.target = AddressToken.CLIENT;
+ this.id = 0;
this.id = id;
this.exclude = exclude;
}
@@ -96,8 +96,8 @@
*/
public AddressToken(char target, int id) {
exclude = false;
- target = CLIENT;
- id = 0;
+ this.target = AddressToken.CLIENT;
+ this.id = 0;
if (isValidTarget(target)){
this.target = target;
}
@@ -208,15 +208,15 @@
* @return boolean. true if target is valid.
*/
private boolean isValidTarget(char target){
- if ( target == BROADCAST){return true;}
- if ( target == SERVER){return true;}
- if ( target == ALL ){return true;}
- if ( target == GM ){return true;}
- if ( target == PLAYERS ){return true;}
- if ( target == LURKERS ){return true;}
- if ( target == INVISIBLES ){return true;}
- if ( target == SELF ){return true;}
- if ( target == CLIENT ){return true;}
+ if ( target == AddressToken.BROADCAST){return true;}
+ if ( target == AddressToken.SERVER){return true;}
+ if ( target == AddressToken.ALL ){return true;}
+ if ( target == AddressToken.GM ){return true;}
+ if ( target == AddressToken.PLAYERS ){return true;}
+ if ( target == AddressToken.LURKERS ){return true;}
+ if ( target == AddressToken.INVISIBLES ){return true;}
+ if ( target == AddressToken.SELF ){return true;}
+ if ( target == AddressToken.CLIENT ){return true;}
return false;
}
@@ -227,10 +227,18 @@
*/
public String getHumanReadableAddress(){
String temp = "Address: ";
- if ( target == BROADCAST ){temp += "To BROADCAST (all clients)"; return temp;}
- if ( target == SERVER){ temp += "SERVER only"; return temp; }
+ if ( target == AddressToken.BROADCAST ){temp += "To BROADCAST (all clients)"; return temp;}
+ if ( target == AddressToken.SERVER){ temp += "SERVER only"; return temp; }
if (exclude){ temp += "Exclude "; } else {temp += "To ";}
- if ( target == ALL ){temp += "ALL in group #";} else if ( target == CLIENT ){temp += "CLIENT #";} else if ( target == GM ){temp += "GMs in group #";} else if ( target == PLAYERS ){temp += "PLAYERS in group #";} else if ( target == LURKERS ){temp += "LURKERS in group #";} else if ( target == INVISIBLES ){temp += "INVISIBLES in group #";} else if ( target == SELF ){temp += "SELF in group # ";} else{ temp += "[invalid address]"; return temp;}
+
+ if ( target == ALL ){temp += "ALL in group #";}
+ else if ( target == AddressToken.CLIENT ){temp += "CLIENT #";}
+ else if ( target == AddressToken.GM ){temp += "GMs in group #";}
+ else if ( target == AddressToken.PLAYERS ){temp += "PLAYERS in group #";}
+ else if ( target == AddressToken.LURKERS ){temp += "LURKERS in group #";}
+ else if ( target == AddressToken.INVISIBLES ){temp += "INVISIBLES in group #";}
+ else if ( target == SELF ){temp += "SELF in group # ";}
+ else{ temp += "[invalid address]"; return temp;}
temp += id;
return temp;
@@ -248,17 +256,17 @@
static public AddressToken convert(String addressToken) throws InvalidMessageTargetException {
AddressToken temp = new AddressToken();
int pos = 0;
- if (addressToken.charAt(pos) == BROADCAST){
- temp.setTarget(BROADCAST);
+ if (addressToken.charAt(pos) == AddressToken.BROADCAST){
+ temp.setTarget(AddressToken.BROADCAST);
temp.setId(0);
return temp;
}
- if (addressToken.charAt(pos) == SERVER){
- temp.setTarget(SERVER);
+ if (addressToken.charAt(pos) == AddressToken.SERVER){
+ temp.setTarget(AddressToken.SERVER);
temp.setId(0);
return temp;
}
- if (addressToken.charAt(pos) == NOT){
+ if (addressToken.charAt(pos) == AddressToken.NOT){
temp.setExcluded(true);
pos++;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|