Package gda.util.converters
Class AutoRenameableConverter<S extends javax.measure.Quantity<S>,T extends javax.measure.Quantity<T>>
java.lang.Object
gda.factory.FindableBase
gda.util.converters.AutoRenameableConverter<S,T>
- All Implemented Interfaces:
Findable,IConverter<javax.measure.Quantity<S>,,javax.measure.Quantity<T>> IQuantitiesConverter<S,,T> IQuantityConverter<S,,T> IReloadableQuantitiesConverter<S,T>
public class AutoRenameableConverter<S extends javax.measure.Quantity<S>,T extends javax.measure.Quantity<T>>
extends FindableBase
implements IReloadableQuantitiesConverter<S,T>
AutoRenameableConverter Class
-
Constructor Summary
ConstructorsConstructorDescriptionAutoRenameableConverter(String name, ConverterNameProvider provider) AutoRenameableConverter(String name, ConverterNameProvider provider, boolean autoConversion) -
Method Summary
Modifier and TypeMethodDescriptionjavax.measure.Quantity<T>[]calculateMoveables(javax.measure.Quantity<S>[] sources, Object[] moveables) Calculates an array of values in units of the source given an array of quantities in units of the sourcevoidvoidReturns the units in which the targets quantities passed into ToSource can be expressedReturns the units in which the sources quantities passed into calculateMoveables can be expressedbooleanbooleanbooleanvoidReload its state from any resource on which it may depend e.g.voidsetAutoConversion(boolean autoConversion) voidsetConverterName(String converterName) voidSet or change the name of the object (as defined in XML).booleanReturns true is the conversion reverses the sense.javax.measure.Quantity<S> Calculates a value for Source given the value of the targetjavax.measure.Quantity<S>[]Calculates an array of values in units of the source given an array of quantities in units of the moveablestoString()javax.measure.Quantity<T> Calculates a value for Target given the value of the sourceMethods inherited from class gda.factory.FindableBase
equals, getName, hashCode
-
Constructor Details
-
AutoRenameableConverter
-
AutoRenameableConverter
-
-
Method Details
-
reloadConverter
public void reloadConverter()Description copied from interface:IReloadableQuantitiesConverterReload its state from any resource on which it may depend e.g. re-read a lookup table.- Specified by:
reloadConverterin interfaceIReloadableQuantitiesConverter<S extends javax.measure.Quantity<S>,T extends javax.measure.Quantity<T>>
-
setName
Description copied from interface:FindableSet or change the name of the object (as defined in XML).- Specified by:
setNamein interfaceFindable- Overrides:
setNamein classFindableBase- Parameters:
name- the object name
-
getConverterName
-
setConverterName
-
calculateMoveables
public javax.measure.Quantity<T>[] calculateMoveables(javax.measure.Quantity<S>[] sources, Object[] moveables) throws Exception Description copied from interface:IQuantitiesConverterCalculates an array of values in units of the source given an array of quantities in units of the source- Specified by:
calculateMoveablesin interfaceIQuantitiesConverter<S extends javax.measure.Quantity<S>,T extends javax.measure.Quantity<T>> - Parameters:
sources- Array of values in units of the sources to be converted.moveables- Array ofMoveable- Returns:
- Array of calculated values in units of the moveables
- Throws:
Exception
-
toSource
public javax.measure.Quantity<S>[] toSource(javax.measure.Quantity<T>[] targets, Object[] moveables) throws Exception Description copied from interface:IQuantitiesConverterCalculates an array of values in units of the source given an array of quantities in units of the moveables- Specified by:
toSourcein interfaceIQuantitiesConverter<S extends javax.measure.Quantity<S>,T extends javax.measure.Quantity<T>> - Parameters:
targets- Array of values in units of the moveables to be converted.moveables- Array ofMoveable- Returns:
- Array of calculated values in units of the source
- Throws:
Exception
-
getAcceptableUnits
Description copied from interface:IQuantitiesConverterReturns the units in which the sources quantities passed into calculateMoveables can be expressed- Specified by:
getAcceptableUnitsin interfaceIQuantitiesConverter<S extends javax.measure.Quantity<S>,T extends javax.measure.Quantity<T>> - Returns:
- Each element of the array is an array of units that is acceptable for the corresponding source in calls to calculateMoveables
-
getAcceptableMoveableUnits
Description copied from interface:IQuantitiesConverterReturns the units in which the targets quantities passed into ToSource can be expressed- Specified by:
getAcceptableMoveableUnitsin interfaceIQuantitiesConverter<S extends javax.measure.Quantity<S>,T extends javax.measure.Quantity<T>> - Returns:
- Each element of the array is an array of units that is acceptable for the corresponding target in calls to ToSource
-
toString
-
getAcceptableSourceUnits
- Specified by:
getAcceptableSourceUnitsin interfaceIQuantityConverter<S extends javax.measure.Quantity<S>,T extends javax.measure.Quantity<T>> - Returns:
- AcceptableSourceUnits
-
getAcceptableTargetUnits
- Specified by:
getAcceptableTargetUnitsin interfaceIQuantityConverter<S extends javax.measure.Quantity<S>,T extends javax.measure.Quantity<T>> - Returns:
- AcceptableTargetUnits
-
toSource
Description copied from interface:IConverterCalculates a value for Source given the value of the target -
toTarget
Description copied from interface:IConverterCalculates a value for Target given the value of the source -
sourceMinIsTargetMax
public boolean sourceMinIsTargetMax()Description copied from interface:IConverterReturns true is the conversion reverses the sense. So that to get the max of the source you convert the min of the target and vice versa- Specified by:
sourceMinIsTargetMaxin interfaceIConverter<S extends javax.measure.Quantity<S>,T extends javax.measure.Quantity<T>> - Returns:
- true is the conversion reverses the sense.
-
enableAutoConversion
public void enableAutoConversion() -
disableAutoConversion
public void disableAutoConversion() -
isAutoConversion
public boolean isAutoConversion() -
setAutoConversion
public void setAutoConversion(boolean autoConversion) -
handlesStoT
public boolean handlesStoT()- Specified by:
handlesStoTin interfaceIQuantityConverter<S extends javax.measure.Quantity<S>,T extends javax.measure.Quantity<T>> - Returns:
- true if the converter converts from S to T
-
handlesTtoS
public boolean handlesTtoS()- Specified by:
handlesTtoSin interfaceIQuantityConverter<S extends javax.measure.Quantity<S>,T extends javax.measure.Quantity<T>> - Returns:
- true if the converter converts from T to S
-