DESY ACOP Beans Home

com.cosylab.gui.adapters
Class LinearConverter

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
                  extended by com.cosylab.gui.adapters.LinearConverter
All Implemented Interfaces:
Converter, DataConsumer, DataSource, DoubleConsumer, DoubleSeqConsumer, java.io.Serializable, java.lang.Cloneable

public class LinearConverter
extends SimpleConverterSupport
implements DoubleConsumer

MulitplierConverter acts as data source and data consumer in the same time. This converter performas on all data flow linear transformation with user defined multiplication factor and shift. Value transfirmation performs x multiplicationFactor + shift.

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

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

Field Summary
static java.lang.String SHORT_NAME
           
 
Fields inherited from class com.cosylab.gui.adapters.SimpleConverterSupport
arrayIndex
 
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
LinearConverter()
          Creates new multiplyer with default factor 1.0 and shift 0.0.
LinearConverter(double factor, double shift)
          Creates new multiplyer with defined factor and shift.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 double getMultiplicationFactor()
          Returns factor by which all data from input will be multiplied
 java.lang.String getName()
          Returns name of this data consumer.
 double getShift()
          Returns the shift of transformed value.
protected  double inverseTransform(double value)
          Here we implement invers transformation of our transformation function.
 void setCharacteristics(java.util.Map characteristics)
          This is called by peer data source.
 void setMultiplicationFactor(double d)
          Sets factor by which all data from input will be multiplied
 void setShift(double d)
          Sets the shift of transformed value
 java.lang.String toString()
           
protected  double transform(double value)
          Here we implement our transformation function.
 
Methods inherited from class com.cosylab.gui.adapters.SimpleConverterSupport
getArrayIndex, getNonblDisplatecher, setArrayIndex, updateValue, updateValue
 
Methods inherited from class com.cosylab.gui.adapters.AbstractConverter
addConsumer, cacheLastCharacteristics, clear, clone, consumerAdded, getLastCharacteristics, updateDataState
 
Methods inherited from class com.cosylab.gui.adapters.DataConsumerDispatcher
getDataConsumer, getDefaultDataConsumer, getSupportedCharacteristics, getSupportedConsumerTypes
 
Methods inherited from class com.cosylab.gui.displayers.DataSourceSupport
extractSupportedCharacteristics, getAcceptableConsumerTypes, getConsumers, removeAllConsumers, removeConsumer
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.cosylab.gui.displayers.DoubleConsumer
updateValue
 
Methods inherited from interface com.cosylab.gui.displayers.DataConsumer
getDataConsumer, getDefaultDataConsumer, getSupportedCharacteristics, getSupportedConsumerTypes, updateDataState
 
Methods inherited from interface com.cosylab.gui.adapters.Converter
clone
 
Methods inherited from interface com.cosylab.gui.displayers.DataSource
addConsumer, getAcceptableConsumerTypes, getConsumers, removeAllConsumers, removeConsumer
 

Field Detail

SHORT_NAME

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

LinearConverter

public LinearConverter()
Creates new multiplyer with default factor 1.0 and shift 0.0.


LinearConverter

public LinearConverter(double factor,
                       double shift)
Creates new multiplyer with defined factor and shift.

Parameters:
factor - new multiplicationfactor
shift - new shift
Method Detail

setCharacteristics

public void setCharacteristics(java.util.Map characteristics)
This is called by peer data source. Call is delegated to contained consumers. In the process it is modified with multiplication factor

Specified by:
setCharacteristics in interface DataConsumer
Overrides:
setCharacteristics in class AbstractConverter
Parameters:
characteristics - the Map with attri
See Also:
DataConsumer.setCharacteristics(java.util.Map)

getMultiplicationFactor

public double getMultiplicationFactor()
Returns factor by which all data from input will be multiplied

Returns:
multiplication factor

setMultiplicationFactor

public void setMultiplicationFactor(double d)
Sets factor by which all data from input will be multiplied

Parameters:
d - new multiplication factor

transform

protected double transform(double value)
Here we implement our transformation function.

Specified by:
transform in class SimpleConverterSupport
Parameters:
value - the value to be transfirmed
Returns:
the transformed value
See Also:
SimpleConverterSupport.transform(double)

inverseTransform

protected double inverseTransform(double value)
Here we implement invers transformation of our transformation function.

Specified by:
inverseTransform in class SimpleConverterSupport
Parameters:
value - the value to be transfirmed with inverse function
Returns:
the inversed value
See Also:
SimpleConverterSupport.inverseTransform(double)

getShift

public double getShift()
Returns the shift of transformed value.

Returns:
the shift of transformed value

setShift

public void setShift(double d)
Sets the shift of transformed value

Parameters:
d - new shift value

getName

public java.lang.String getName()
Description copied from interface: DataConsumer
Returns name of this data consumer.

Specified by:
getName in interface DataConsumer
Overrides:
getName in class DataConsumerDispatcher
Returns:
the name of this data consumer

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


Copyright © 2010. All Rights Reserved.