~ubuntu-branches/ubuntu/raring/libjboss-remoting-java/raring

« back to all changes in this revision

Viewing changes to examples/org/jboss/remoting/samples/transporter/complex/Information.java

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2011-09-09 14:01:03 UTC
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: package-import@ubuntu.com-20110909140103-o8ucrolqt5g25k57
Tags: upstream-2.5.3.SP1
ImportĀ upstreamĀ versionĀ 2.5.3.SP1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package org.jboss.remoting.samples.transporter.complex;
2
 
 
3
 
import java.util.ArrayList;
4
 
import java.util.HashMap;
5
 
import java.util.List;
6
 
import java.util.Map;
7
 
import org.jboss.remoting.samples.transporter.complex.Doctor;
8
 
 
9
 
/**
10
 
 * @author <a href="mailto:telrod@e2technologies.net">Tom Elrod</a>
11
 
 */
12
 
public class Information
13
 
{
14
 
   private static Information info = new Information();
15
 
   private static Map providers = new HashMap();
16
 
   private static List patients = new ArrayList();
17
 
 
18
 
   static
19
 
   {
20
 
      Doctor p1 = new Doctor("Andy Jones", "financial");
21
 
      providers.put("financial", p1);
22
 
      Doctor p2 = new Doctor("Joe Smith", "medical");
23
 
      providers.put("medical", p2);
24
 
 
25
 
      Patient pat1 = new Patient("Larry", "Ellison");
26
 
      pat1.setDoctor(p1);
27
 
      p1.addPatient(pat1);
28
 
      patients.add(pat1);
29
 
      Patient pat2 = new Patient("Steve", "Jobs");
30
 
      pat2.setDoctor(p1);
31
 
      p1.addPatient(pat2);
32
 
   }
33
 
 
34
 
   public static Information getInstance()
35
 
   {
36
 
      return info;
37
 
   }
38
 
 
39
 
   public Doctor getProviderBySpecialty(String ailmentType)
40
 
   {
41
 
      return (Doctor) providers.get(ailmentType);
42
 
   }
43
 
 
44
 
   public void retireDoctor(Doctor doctor)
45
 
   {
46
 
      String specialty = doctor.getSpecialty();
47
 
      providers.remove(specialty);
48
 
   }
49
 
}