DESY ACOP Beans Home

com.cosylab.gui.adapters
Class MultiplierConverter

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.MultiplierConverter
All Implemented Interfaces:
Converter, DataConsumer, DataSource, DoubleConsumer, DoubleSeqConsumer, java.io.Serializable, java.lang.Cloneable

public class MultiplierConverter
extends SimpleConverterSupport
implements DoubleConsumer

MulitplierConverter acts as data source and data consumer in the same time. This converter multiplies all data flow with user defined multiplication factor. As implementation base SimpleConverterSupport is used.

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

Since:
Feb 14, 2004.
Version:
$Id: MultiplierConverter.java,v 1.18 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
MultiplierConverter()
          Creates new multiplyer with default factor 1.0.
MultiplierConverter(double factor)
          Creates new multiplyer with defined factor.
 
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.
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
 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

MultiplierConverter

public MultiplierConverter()
Creates new multiplyer with default factor 1.0.


MultiplierConverter

public MultiplierConverter(double factor)
Creates new multiplyer with defined factor.

Parameters:
factor - new multiplicationfactor
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
Throws:
java.lang.IllegalArgumentException - if set value is 0.0

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)

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.