KickJava   Java API By Example, From Geeks To Geeks.

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


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>A3CMLProperty</code> describes a property.
25  */

26 public class A3CMLProperty implements Serializable {
27   /** Name of the property. */
28   public String JavaDoc name = null;
29   /** Value of the property. */
30   public String JavaDoc value = null;
31
32   public A3CMLProperty(String JavaDoc name, String JavaDoc value) {
33     this.name = name;
34     this.value = value;
35   }
36   
37   public A3CMLProperty duplicate() throws Exception JavaDoc {
38     A3CMLProperty clone = new A3CMLProperty(name, value);
39     return clone;
40   }
41
42   public String JavaDoc toString() {
43     StringBuffer JavaDoc strBuf = new StringBuffer JavaDoc();
44     strBuf.append("(");
45     strBuf.append(super.toString());
46     strBuf.append(",").append(name).append("=").append(value);
47     strBuf.append(")");
48     return strBuf.toString();
49   }
50
51   public boolean equals(Object JavaDoc obj) {
52     if (obj == null) return false;
53
54     if (obj instanceof A3CMLProperty) {
55       A3CMLProperty prop = (A3CMLProperty) obj;
56       if (((name == prop.name) ||
57            ((name != null) && name.equals(prop.name))) &&
58           ((value == prop.value) ||
59            ((value != null) && value.equals(prop.value))))
60         return true;
61     }
62     return false;
63   }
64 }
65
Popular Tags