DESY ACOP Beans Home
com.cosylab.gui.adapters
Interface Converter
- All Superinterfaces:
- java.lang.Cloneable, DataConsumer, DataSource, java.io.Serializable
- All Known Implementing Classes:
- AbstractConverter, ConverterChain, ExponentialConverter, IdentityConverter, LinearConverter, LogarithmicConverter, MultiplierConverter, PotentialConverter, SimpleArrayConverterSupport, SimpleConverterSupport
public interface Converter
- extends DataSource, DataConsumer, java.lang.Cloneable, java.io.Serializable
Converter interface distinguishes objects that wish to act as
data converters for data flow betwean some arbitrary
DataSource and DataConsumer. To accomplish this
they must represent itself as data consumer to peer data source, thus
implementing DataConsumer interface, and on the other side
accept peer data consumer as data source, thus implementing at the same
time DataSource interface. With such approach it is possible
to chain multiple Converters in a single data flow line from
source to consumer.
Besides implementing DataSource and DataConsumer
interfaces converter must comply to the following contract:
-
When implementing method
DataCosnumer::addConsumer(DataConsumer) the consumer parameter
must be examined for the following:
-
If the consumer is
NonblockingNumberConsumer, then it comes
from peer data source and wants to receive notifications from this
converter as data source of feedback requests. See Displayer
documentation for details. At the moment only
NonblockingNumberConsumer is supported, later will be also
other Nonblocking<TYPPE>Consumer,
Synchronous<TYPPE>Consumer and
Asynchronous<TYPPE>Consumer interfaces from
con.cosylab.gui.displayers package.
-
Any other consumer is treated as it would normaly be in data source:
-
consumer is added to the list of consumers which will be notified about data
flow events.
-
if consumer implements
DataSource interface we must add
NonblockingNumberConsumer implementation, which will dispatch
value change notifications to set of consumers of same type, the ones that
was mentioned above in first bullet.
To clear the things there is simple exemplatory implementation
MultiplierConverter. This example is fully functional and
performs convertions in which any incoming number is multiplied by some
user defined factor. To see how this example converter is used run
con.cosylab.showcase.CalculationPanel showcase demo.
The SimpleConverterSupport class could be used as
implementation base for most of transformations.
- Since:
- Feb 14, 2004.
- Version:
- $Id: Converter.java,v 1.10 2008-04-22 12:31:02 jbobnar Exp $
- Author:
- Igor Kriznar
- See Also:
Displayer,
DataSource,
DataConsumer,
SimpleConverterSupport,
MultiplierConverter
|
Method Summary |
java.lang.Object |
clone()
|
clone
java.lang.Object clone()
throws java.lang.CloneNotSupportedException
- Throws:
java.lang.CloneNotSupportedException
Copyright © 2010. All Rights Reserved.