fr/dyade/aaa/agent/conf/A3CMLNat.java

00001 /*
00002  * Copyright (C) 2001 - 2003 ScalAgent Distributed Technologies 
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or any later version.
00008  * 
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00017  * USA.
00018  */
00019 package fr.dyade.aaa.agent.conf;
00020 
00021 import java.io.*;
00022 
00027 public class A3CMLNat implements Serializable {
00031   private static final long serialVersionUID = 1L;
00033   public short sid = -1;
00035   public String host = null;
00037   public int port = -1;
00038 
00039   public A3CMLNat(short sid, 
00040                   String host,
00041                   int port) {
00042     this.sid = sid;
00043     this.host = host;
00044     this.port = port;
00045   }
00046   
00047   public A3CMLNat duplicate() throws Exception {
00048     A3CMLNat clone = new A3CMLNat(sid, host, port);
00049     return clone;
00050   }
00051 
00052   public String toString() {
00053     StringBuffer strBuf = new StringBuffer();
00054     strBuf.append("(");
00055     strBuf.append(super.toString());
00056     strBuf.append(",sid=").append(sid);
00057     strBuf.append(",host=").append(host);
00058     strBuf.append(",port=").append(port);
00059     strBuf.append(")");
00060     return strBuf.toString();
00061   }
00062 
00063   public boolean equals(Object obj) {
00064     if (obj == null) return false;
00065 
00066     if (obj instanceof A3CMLNat) {
00067       A3CMLNat nat = (A3CMLNat) obj;
00068       if ((sid == nat.sid) &&
00069           ((host == nat.host) ||
00070            ((host != null) && host.equals(nat.host))) &&
00071           (port == nat.port))
00072         return true;
00073     }
00074     return false;
00075   }
00076 }

Generated on Tue Sep 16 16:14:27 2008 for joram by  doxygen 1.5.0