KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openbravo > xmlEngine > FunctionMaxValue


1 /*
2  ************************************************************************************
3  * Copyright (C) 2001-2006 Openbravo S.L.
4  * Licensed under the Apache Software License version 2.0
5  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6  * Unless required by applicable law or agreed to in writing, software distributed
7  * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
8  * CONDITIONS OF ANY KIND, either express or implied. See the License for the
9  * specific language governing permissions and limitations under the License.
10  ************************************************************************************
11 */

12 package org.openbravo.xmlEngine;
13
14 import org.apache.log4j.Logger ;
15
16 class FunctionMaxValue extends FunctionEvaluationValue {
17
18   static Logger log4jFunctionMaxValue = Logger.getLogger(FunctionMaxValue.class);
19
20   public FunctionMaxValue(FunctionTemplate functionTemplate, XmlDocument xmlDocument) {
21     super(functionTemplate, xmlDocument);
22   }
23
24   public String JavaDoc print() {
25     if (arg1Value.print().equals(XmlEngine.strTextDividedByZero) || arg2Value.print().equals(XmlEngine.strTextDividedByZero)) {
26       return XmlEngine.strTextDividedByZero;
27     } else {
28       return functionTemplate.printFormatOutput(Math.max(Double.valueOf(arg1Value.printSimple()).doubleValue(), Double.valueOf(arg2Value.printSimple()).doubleValue()));
29     }
30   }
31
32   public String JavaDoc printSimple() {
33     if (arg1Value.print().equals(XmlEngine.strTextDividedByZero) || arg2Value.print().equals(XmlEngine.strTextDividedByZero)) {
34       return XmlEngine.strTextDividedByZero;
35     } else {
36       return functionTemplate.printFormatSimple(Math.max(Double.valueOf(arg1Value.printSimple()).doubleValue(), Double.valueOf(arg2Value.printSimple()).doubleValue()));
37     }
38   }
39
40 }
41
Popular Tags