FileDocCategorySizeDatePackage
SimpleTemperature.javaAPI DocExample2772Sun Jan 04 21:06:06 GMT 1998None

SimpleTemperature

public class SimpleTemperature extends Object

Fields Summary
protected transient Vector
listeners
Constructors Summary
Methods Summary
public synchronized voidaddTemperatureChangeListener(TemperatureChangeListener l)


      
    
   
      // if the vector doesn't exist yet, create it now
      if (listeners == null)
      {
         listeners = new Vector();
      }

      // add the listener
      if (!listeners.contains(l))
      {
         listeners.addElement(l);
      }
   
private voidreadObject(java.io.ObjectInputStream stream)

      try
      {
         stream.defaultReadObject();
         
         Object l;
         while(null != (l = stream.readObject())) 
         {
            addTemperatureChangeListener((TemperatureChangeListener)l);
         }
      }
      catch (ClassNotFoundException e)
      {
         throw new IOException();
      }
   
public synchronized voidremoveTemperatureChangeListener(TemperatureChangeListener l)

      // if we have a collection of listeners, attempt to remove
      // the specified listener
      if (listeners != null)
      {
         listeners.removeElement(l);
      }
   
private voidwriteObject(java.io.ObjectOutputStream stream)

       // perform default writing first
       stream.defaultWriteObject();

       // clone the vector in case one is added or removed
       Vector v = null;
       synchronized (this) 
       {
          if (listeners != null) 
          {
             v = (Vector)listeners.clone();
          }
       }

       // if we have a collection