KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > dyade > aaa > agent > conf > A3CMLNetwork


1 /*
2  * Copyright (C) 2001 - 2003 ScalAgent Distributed Technologies
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17  * USA.
18  */

19 package fr.dyade.aaa.agent.conf;
20
21 import java.io.*;
22
23 /**
24  * The class <code>A3CMLNetwork</code> describes a network component.
25  */

26 public class A3CMLNetwork implements Serializable {
27   public String JavaDoc domain = null;
28   public int port = -1;
29
30   public A3CMLNetwork(String JavaDoc domain,
31                       int port) {
32     this.domain = domain;
33     this.port = port;
34   }
35
36   public A3CMLNetwork duplicate() throws Exception JavaDoc {
37     A3CMLNetwork clone = new A3CMLNetwork(domain, port);
38     return clone;
39   }
40
41   public String JavaDoc toString() {
42     StringBuffer JavaDoc strBuf = new StringBuffer JavaDoc();
43     strBuf.append("(").append(super.toString());
44     strBuf.append(",domain=").append(domain);
45     strBuf.append(",port=").append(port);
46     strBuf.append(")");
47     return strBuf.toString();
48   }
49
50   public boolean equals(Object JavaDoc obj) {
51     if (obj == null) return false;
52
53     if (obj instanceof A3CMLNetwork) {
54       A3CMLNetwork network = (A3CMLNetwork) obj;
55       if (((domain == network.domain) ||
56            ((domain != null) && domain.equals(network.domain))) &&
57           (port == network.port))
58         return true;
59     }
60     return false;
61   }
62 }
63
Popular Tags