--- projects/cms/source/util/uk/org/iscream/cms/util/XMLPacket.java 2000/11/29 19:11:53 1.3 +++ projects/cms/source/util/uk/org/iscream/cms/util/XMLPacket.java 2000/12/05 13:19:19 1.8 @@ -1,15 +1,15 @@ //---PACKAGE DECLARATION--- -package uk.ac.ukc.iscream.xml; +package uk.ac.ukc.iscream.util; //---IMPORTS--- -import java.util.HashMap; +import java.util.*; /** * Object in which to store incoming XML data * to be passed around the CORBA system. * - * @author $Author: tdb $ - * @version $Id: XMLPacket.java,v 1.3 2000/11/29 19:11:53 tdb Exp $ + * @author $Author: pjm2 $ + * @version $Id: XMLPacket.java,v 1.8 2000/12/05 13:19:19 pjm2 Exp $ */ public class XMLPacket { @@ -18,7 +18,7 @@ public class XMLPacket { /** * The current CVS revision of this class */ - public final String REVISION = "$Revision: 1.3 $"; + public final String REVISION = "$Revision: 1.8 $"; //---STATIC METHODS--- @@ -28,10 +28,7 @@ public class XMLPacket { // Add a key and value pair to the HashMap. public synchronized void addParam (String key, String value) { - params.put(key, value); - // debug by println ;-) - // System.out.println("Adding to hash: " + key + " = " + value); - // end debug code + _params.put(key, value); } // Return the value associated with a particular key. @@ -39,13 +36,23 @@ public class XMLPacket { // this should not necessarily indicate that the key // does not exist. public synchronized String getParam (String key) { - return (String)params.get(key); + return (String) _params.get(key); } + // Return a Set of the keys in the HashMap. + public synchronized Set getSet () { + return _params.keySet(); + } + + // Find if a particular key exists in the HashMap. + public synchronized boolean containsKey(String key){ + return _params.containsKey(key); + } + // Print out the entire HashMap. // (Mainly for assisting debugging.) public synchronized String printAll () { - return params.toString(); + return _params.toString(); } /** @@ -54,7 +61,7 @@ public class XMLPacket { * * @return the name of this class and its CVS revision */ - public String toString() { + public String toString () { return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")"; } @@ -64,8 +71,8 @@ public class XMLPacket { //---ATTRIBUTES--- - private HashMap params = new HashMap(); + private HashMap _params = new HashMap(); //---STATIC ATTRIBUTES--- -} \ No newline at end of file +}