ajout d'un id a chaque utilisateur
This commit is contained in:
parent
824c1522d6
commit
a025a305fd
2 changed files with 9 additions and 0 deletions
Binary file not shown.
|
@ -6,10 +6,13 @@ public class Utilisateur extends Object {
|
||||||
private String pseudo ;
|
private String pseudo ;
|
||||||
private Integer port;
|
private Integer port;
|
||||||
private InetAddress ip ;
|
private InetAddress ip ;
|
||||||
|
private String id ;
|
||||||
|
|
||||||
public Utilisateur(String pseudo,Integer port, InetAddress ip ){
|
public Utilisateur(String pseudo,Integer port, InetAddress ip ){
|
||||||
this.setPseudo(pseudo) ;
|
this.setPseudo(pseudo) ;
|
||||||
this.setPort(port);
|
this.setPort(port);
|
||||||
this.ip = ip ;
|
this.ip = ip ;
|
||||||
|
this.id = ip.getHostName() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPseudo() {
|
public String getPseudo() {
|
||||||
|
@ -31,6 +34,9 @@ public class Utilisateur extends Object {
|
||||||
public InetAddress getIp() {
|
public InetAddress getIp() {
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
|
@ -38,6 +44,7 @@ public class Utilisateur extends Object {
|
||||||
s+="pseudo " + this.pseudo + " | ";
|
s+="pseudo " + this.pseudo + " | ";
|
||||||
s+="port " + (this.port).toString() + " | ";
|
s+="port " + (this.port).toString() + " | ";
|
||||||
s+="ip " + (this.ip).toString() + " | ";
|
s+="ip " + (this.ip).toString() + " | ";
|
||||||
|
s+="id " + (this.id).toString() + " | ";
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,10 +52,12 @@ public class Utilisateur extends Object {
|
||||||
String name = "";
|
String name = "";
|
||||||
Integer port = 0;
|
Integer port = 0;
|
||||||
String ip = "" ;
|
String ip = "" ;
|
||||||
|
String id = "";
|
||||||
String mots[] = s.split(" ");
|
String mots[] = s.split(" ");
|
||||||
name=mots[1];
|
name=mots[1];
|
||||||
port=Integer.parseInt(mots[4]);
|
port=Integer.parseInt(mots[4]);
|
||||||
ip=mots[7];
|
ip=mots[7];
|
||||||
|
id=mots[10];
|
||||||
Utilisateur user = null;
|
Utilisateur user = null;
|
||||||
try {
|
try {
|
||||||
user = new Utilisateur(name,port,InetAddress.getByName(ip.split("/")[0]));
|
user = new Utilisateur(name,port,InetAddress.getByName(ip.split("/")[0]));
|
||||||
|
|
Loading…
Reference in a new issue