ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/util/uk/org/iscream/cms/util/XMLPacket.java
(Generate patch)

Comparing projects/cms/source/util/uk/org/iscream/cms/util/XMLPacket.java (file contents):
Revision 1.1 by pjm2, Wed Nov 22 08:40:53 2000 UTC vs.
Revision 1.6 by pjm2, Fri Dec 1 14:42:04 2000 UTC

# Line 1 | Line 1
1 + //---PACKAGE DECLARATION---
2 + package uk.ac.ukc.iscream.util;
3 +
4 + //---IMPORTS---
5   import java.util.HashMap;
6  
7 < // Paul Mutton, pjm2@ukc.ac.uk
8 <
9 < // Object in which to store incoming XML data
10 < // to be passed around the CORBA system.
7 > /**
8 > * Object in which to store incoming XML data
9 > * to be passed around the CORBA system.
10 > *
11 > * @author  $Author$
12 > * @version $Id$
13 > */
14   public class XMLPacket {
15  
16 + //---FINAL ATTRIBUTES---
17 +
18 +    /**
19 +     * The current CVS revision of this class
20 +     */
21 +    public final String REVISION = "$Revision$";
22 +    
23 + //---STATIC METHODS---
24 +
25 + //---CONSTRUCTORS---
26 +
27 + //---PUBLIC METHODS---
28 +
29      // Add a key and value pair to the HashMap.
30      public synchronized void addParam (String key, String value) {
31 <        params.put(key, value);        
12 <        // debug by println ;-)
13 <        // System.out.println("Adding to hash: " + key + " = " + value);
14 <        // end debug code
31 >        _params.put(key, value);
32      }
33      
34      // Return the value associated with a particular key.
# Line 19 | Line 36 | public class XMLPacket {
36      // this should not necessarily indicate that the key
37      // does not exist.
38      public synchronized String getParam (String key) {
39 <        return (String)params.get(key);
39 >        return (String) _params.get(key);
40      }
41      
42      // Print out the entire HashMap.
43      // (Mainly for assisting debugging.)
44 <    public synchronized void printAll () {
45 <        System.out.println(params);
44 >    public synchronized String printAll () {
45 >        return _params.toString();
46      }
47  
48 <    private HashMap params = new HashMap();  
49 <    
48 >    /**
49 >     * Overrides the {@link java.lang.Object#toString() Object.toString()}
50 >     * method to provide clean logging (every class should have this).
51 >     *
52 >     * @return the name of this class and its CVS revision
53 >     */
54 >    public String toString() {
55 >        return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")";
56 >    }
57 >
58 > //---PRIVATE METHODS---
59 >
60 > //---ACCESSOR/MUTATOR METHODS---
61 >
62 > //---ATTRIBUTES---
63 >
64 >    private HashMap _params = new HashMap();
65 >
66 > //---STATIC ATTRIBUTES---
67 >
68   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines