tn5250j/src/org/tn5250j ScanMulticaster.java,1.2,1.3
"Kenneth J. Pouncey" <[email protected]> Sat, 26 Jun 2004 13:14:46 +0000
| Newsgroups | gmane.comp.java.tn5250j.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16440
Added Files:
ScanMulticaster.java
Log Message:
this time not read only?
--- NEW FILE: ScanMulticaster.java ---
package org.tn5250j;
import org.tn5250j.interfaces.ScanListener;
public class ScanMulticaster implements ScanListener
{
public static ScanListener add(ScanListener a, ScanListener b)
{
if (a == null) return b;
if (b == null) return a;
return new ScanMulticaster(a, b);
}
public static ScanListener remove(ScanListener l, ScanListener oldl)
{
return removeInternal(l, oldl);
}
protected static ScanListener removeInternal(ScanListener l, ScanListener oldl)
{
if (l == null || l == oldl)
{
return null;
}
else if (l instanceof ScanMulticaster)
{
return ((ScanMulticaster)l).remove(oldl);
}
else
{
return l; // it's not here
}
}
public ScanMulticaster(ScanListener a, ScanListener b)
{
this.a = a;
this.b = b;
}
public void scanned(String command, String remainder)
{
a.scanned(command, remainder);
b.scanned(command, remainder);
}
protected ScanListener remove(ScanListener old)
{
if (old == a) return b;
if (old == b) return a;
ScanListener a2 = removeInternal(a, old);
ScanListener b2 = removeInternal(b, old);
if (a2 == a && b2 == b)
{
return this; // it's not here
}
return removeInternal(a2, b2);
}
private ScanListener a; // = null;
private ScanListener b; // = null;
}
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com