DESY ACOP Beans Home

com.cosylab.gui.adapters
Class SimpleConverterSupport

java.lang.Object
  extended by com.cosylab.gui.displayers.DataSourceSupport
      extended by com.cosylab.gui.adapters.DataConsumerDispatcher
          extended by com.cosylab.gui.adapters.AbstractConverter
              extended by com.cosylab.gui.adapters.SimpleConverterSupport
All Implemented Interfaces:
Converter, DataConsumer, DataSource, DoubleConsumer, DoubleSeqConsumer, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
ExponentialConverter, IdentityConverter, LinearConverter, LogarithmicConverter, MultiplierConverter, PotentialConverter

public abstract class SimpleConverterSupport
extends AbstractConverter
implements Converter, DoubleConsumer, DoubleSeqConsumer

SimpleConverterSupport is implementation of Converter interface intended for simple implementation, which use transfromation function on double data flow.

Note! This implementation works only with data sources and consumers, whcih support double as value type.

Since:
Feb 14, 2004.
Version:
$Id: SimpleConverterSupport.java,v 1.12 2008-04-22 12:31:02 jbobnar Exp $
Author:
Igor Kriznar
See Also:
Converter, Serialized Form

Field Summary
protected  int arrayIndex
           
static java.lang.String SHORT_NAME
           
 
Fields inherited from class com.cosylab.gui.adapters.AbstractConverter
nonblDispatcher
 
Fields inherited from class com.cosylab.gui.adapters.DataConsumerDispatcher
name
 
Fields inherited from class com.cosylab.gui.displayers.DataSourceSupport
types
 
Constructor Summary
SimpleConverterSupport()
          Creates new converter.
 
Method Summary
 int getArrayIndex()
          Returns the arrayIndex.
protected  NonblockingNumberDispatcher getNonblDisplatecher()
          Override this method to provide own dispatcher, which forwards revers data flow (from consumer to source).
protected abstract  double inverseTransform(double value)
          User must implement this method to make inverse transformation as in transfirm(double) function.
 void setArrayIndex(int arrayIndex)
          Sets new arrayIndex.
protected abstract  double transform(double value)
          User must implement this method and from prvided parameter calculate with own transfromatin function new value and return it.
 void updateValue(long timestamp, double value)
          This is called by peer data source.
 void updateValue(long timestamp, double[] value)
          Notifys this consumer about new dynamic value update.
 
Methods inherited from class com.cosylab.gui.adapters.AbstractConverter
addConsumer, cacheLastCharacteristics, clear, clone, consumerAdded, getLastCharacteristics, setCharacteristics, updateDataState
 
Methods inherited from class com.cosylab.gui.adapters.DataConsumerDispatcher
getDataConsumer, getDefaultDataConsumer, getName, getSupportedCharacteristics, getSupportedConsumerTypes
 
Methods inherited from class com.cosylab.gui.displayers.DataSourceSupport
extractSupportedCharacteristics, getAcceptableConsumerTypes, getConsumers, removeAllConsumers, removeConsumer
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.cosylab.gui.adapters.Converter
clone
 
Methods inherited from interface com.cosylab.gui.displayers.DataSource
addConsumer, getAcceptableConsumerTypes, getConsumers, removeAllConsumers, removeConsumer
 
Methods inherited from interface com.cosylab.gui.displayers.DataConsumer
getDataConsumer, getDefaultDataConsumer, getName, getSupportedCharacteristics, getSupportedConsumerTypes, setCharacteristics, updateDataState
 

Field Detail

SHORT_NAME

public static final java.lang.String SHORT_NAME
See Also:
Constant Field Values

arrayIndex

protected int arrayIndex
Constructor Detail

SimpleConverterSupport

public SimpleConverterSupport()
Creates new converter.

Method Detail

getArrayIndex

public int getArrayIndex()
Returns the arrayIndex. This index is used to extract value if this converter receives double array update.

Returns:
Returns the arrayIndex.

setArrayIndex

public void setArrayIndex(int arrayIndex)
Sets new arrayIndex. This index is used to extract value if this converter receives double array update.

Parameters:
arrayIndex - The arrayIndex to set.

updateValue

public void updateValue(long timestamp,
                        double value)
                 throws CommonException
This is called by peer data source. Call is delegated to contained consumers.

Specified by:
updateValue in interface DoubleConsumer
Parameters:
timestamp - the time of dynamic value event
value - new value
Throws:
CommonException
See Also:
DoubleConsumer.updateValue(long, double)

getNonblDisplatecher

protected NonblockingNumberDispatcher getNonblDisplatecher()
Description copied from class: AbstractConverter
Override this method to provide own dispatcher, which forwards revers data flow (from consumer to source).

Overrides:
getNonblDisplatecher in class AbstractConverter
Returns:
nonblocking reverse dispatcher

transform

protected abstract double transform(double value)
User must implement this method and from prvided parameter calculate with own transfromatin function new value and return it.

Parameters:
value - the value to be transfirmed
Returns:
the transformed value

inverseTransform

protected abstract double inverseTransform(double value)
User must implement this method to make inverse transformation as in transfirm(double) function. Following must be true some_value == inverseTransform(transfirm(some_value)).

Parameters:
value - the value to be transfirmed with inverse function
Returns:
the inversed value
See Also:
transform(double)

updateValue

public void updateValue(long timestamp,
                        double[] value)
                 throws CommonException
Description copied from interface: DoubleSeqConsumer
Notifys this consumer about new dynamic value update.

Specified by:
updateValue in interface DoubleSeqConsumer
Parameters:
timestamp - the time of dynamic value event
value - new value
Throws:
CommonException


Copyright © 2010. All Rights Reserved.