1 12 package org.openbravo.xmlEngine; 13 14 import org.apache.log4j.Logger ; 15 16 class FunctionDivideValue extends FunctionEvaluationValue { 17 18 static Logger log4jFunctionDivideValue = Logger.getLogger(FunctionDivideValue.class); 19 20 public FunctionDivideValue(FunctionTemplate functionTemplate, XmlDocument xmlDocument) { 21 super(functionTemplate, xmlDocument); 22 } 23 24 public String print() { 25 log4jFunctionDivideValue.debug("Arg2: " + arg2Value.printSimple()); 26 log4jFunctionDivideValue.debug("Arg1: " + arg1Value.printSimple()); 27 28 if (arg1Value.print().equals(XmlEngine.strTextDividedByZero) || arg2Value.print().equals(XmlEngine.strTextDividedByZero)) { 29 return XmlEngine.strTextDividedByZero; 30 } else { 31 double division = Double.valueOf(arg1Value.printSimple()).doubleValue() / Double.valueOf(arg2Value.printSimple()).doubleValue(); 32 if (Double.isInfinite(division) || Double.isNaN(division)) { 33 return XmlEngine.strTextDividedByZero; 34 } else { 35 return functionTemplate.printFormatOutput(division); 36 } 37 } 38 } 39 40 public String printSimple() { 41 log4jFunctionDivideValue.debug("Arg2: " + arg2Value.printSimple()); 42 log4jFunctionDivideValue.debug("Arg1: " + arg1Value.printSimple()); 43 44 if (arg1Value.print().equals(XmlEngine.strTextDividedByZero) || arg2Value.print().equals(XmlEngine.strTextDividedByZero)) { 45 return XmlEngine.strTextDividedByZero; 46 } else { 47 double division = Double.valueOf(arg1Value.printSimple()).doubleValue() / Double.valueOf(arg2Value.printSimple()).doubleValue(); 48 if (Double.isInfinite(division) || Double.isNaN(division)) { 49 return XmlEngine.strTextDividedByZero; 50 } else { 51 return functionTemplate.printFormatSimple(division); 52 } 53 } 54 } 55 } 56 | Popular Tags |