/** * Get the complete ConnectInfo * * @param ConnectInfo the user * @return the complete ConnectInfo */ private ConnectInfo getCompleteConnectInfo(ConnectInfo ci) { Iterator i = this.connections.iterator(); while (i.hasNext()) { ConnectInfo tmp = (ConnectInfo) i.next(); if (ci.getName().equals(tmp.getName())) return tmp; } return ci; }
/** * Check if a user is already known * * @param ConnectInfo the user * @return true or false */ private boolean isAlreadyKnown(ConnectInfo ci) { boolean result = false; Iterator i = this.connections.iterator(); while (i.hasNext() && !result) { ConnectInfo tmp = (ConnectInfo) i.next(); result = ci.getName().equals(tmp.getName()); } return result; }
/** * Get a user connection infos * * @param userName the user * @return the ConnectInfo */ public ConnectInfo getConnectInfo(String userName) { for (int i = 0; i < this.connections.size(); i++) { ConnectInfo ci = (ConnectInfo) this.connections.get(i); if (ci.getName().equals(userName)) return ci; } return null; }
/** * Remove a ConnectionInfo * * @param user the user name */ private void removeConnectInfo(String user) { for (int i = 0; i < this.connections.size(); i++) { ConnectInfo ci = (ConnectInfo) this.connections.get(i); if (ci.getName().equals(user)) { this.connections.remove(ci); break; } } sendUserList(); }
/** * Remove a ConnectionInfo * * @param ci the connect info */ private void removeConnectInfo(ConnectInfo ci) { removeConnectInfo(ci.getName()); }