Oxygen XML Editor, Version 14.2

ro.sync.sample.plugin.converter
Class FactorConversionEntry

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

public class FactorConversionEntry
extends ConversionEntry

Implements a factor based conversion.

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
FactorConversionEntry(java.lang.String masterLabel, java.lang.String slaveLabel, java.lang.String masterValue, java.lang.String slaveValue, int decimalsToShow, double factor)
          Constructor for the FactorConversionEntry object.
 
Method Summary
 double convert(double what, boolean direct, int decimalsNumber)
          Converts the argument from the master measure to the slave measure if direct attribute is true, otherwise reverse.
 
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

FactorConversionEntry

public FactorConversionEntry(java.lang.String masterLabel,
                             java.lang.String slaveLabel,
                             java.lang.String masterValue,
                             java.lang.String slaveValue,
                             int decimalsToShow,
                             double factor)
                      throws ConversionException
Constructor for the FactorConversionEntry object.

Parameters:
masterLabel - The master measure label.
slaveLabel - The slave measure label.
masterValue - The master measure value.
slaveValue - The second section value.
decimalsToShow - The decimals number to be included in the result.
factor - The conversion factor.
Throws:
ConversionException - Trown when this conversion entry is invalid, that means one of the argument is null, or conversion factor 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 if direct attribute is true, otherwise reverse.

Specified by:
convert in class ConversionEntry
Parameters:
what - The conversion argument.
direct - If true, then make the conversion from s1 to s2, 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.