Oxygen XML Editor, Version 14.2

ro.sync.sample.plugin.converter
Class FormulaConversionEntry

java.lang.Object
  extended by ro.sync.sample.plugin.converter.ConversionEntry
      extended by ro.sync.sample.plugin.converter.FormulaConversionEntry

public class FormulaConversionEntry
extends ConversionEntry

Implements a formula based convertor. The formula is rez = (arg -v1)/v2. The reverse of the formula is: rez = arg * v2 + v1.

Version:
$Revision: 1.13 $

Field Summary
 
Fields inherited from class ro.sync.sample.plugin.converter.ConversionEntry
ALL_DECIMALS, decimalsNumber, masterLabel, masterValue, slaveLabel, slaveValue
 
Constructor Summary
FormulaConversionEntry(java.lang.String masterLabel, java.lang.String slaveLabel, java.lang.String masterValue, java.lang.String slaveValue, int decimals, double v1, double v2)
          Constructor for the FormulaConversionEntry object
 
Method Summary
 double convert(double what, boolean direct, int decimalsNumber)
          Converts the argument from the master measure to the slave measure.
 
Methods inherited from class ro.sync.sample.plugin.converter.ConversionEntry
formatDouble, getDecimalsNumber, getMasterLabel, getMasterValue, getSlaveLabel, getSlaveValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormulaConversionEntry

public FormulaConversionEntry(java.lang.String masterLabel,
                              java.lang.String slaveLabel,
                              java.lang.String masterValue,
                              java.lang.String slaveValue,
                              int decimals,
                              double v1,
                              double v2)
                       throws ConversionException
Constructor for the FormulaConversionEntry object

Parameters:
masterLabel - The master measure label.
slaveLabel - The slave measure label.
masterValue - The master measure value.
slaveValue - The second section value.
v1 - The v1 constant
v2 - The v2 constant
decimals - The decimals number to be included in the result.
Throws:
ConversionException - Trown when this conversion entry is invalid, that means one of the argument is null, or v2 value is 0.
Method Detail

convert

public double convert(double what,
                      boolean direct,
                      int decimalsNumber)
Converts the argument from the master measure to the slave measure.

Specified by:
convert in class ConversionEntry
Parameters:
what - The conversion argument
direct - If true, then make the conversion from master to slave, otherwise reverse.
decimalsNumber - The decimals number witch be included in the result.
Returns:
The conversion result.

Oxygen XML Editor, Version 14.2

© Copyright Syncro Soft SRL 2002 - 2013. All rights reserved.