Methods Summary |
---|
public synchronized void | addTemperatureChangeListener(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 void | readObject(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 void | removeTemperatureChangeListener(TemperatureChangeListener l)
// if we have a collection of listeners, attempt to remove
// the specified listener
if (listeners != null)
{
listeners.removeElement(l);
}
|
private void | writeObject(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
|