KickJava   Java API By Example, From Geeks To Geeks.

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


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 FunctionLtValue extends FunctionEvaluationValue {
17
18   static Logger log4jFunctionLtValue = Logger.getLogger(FunctionLtValue.class);
19
20   public FunctionLtValue(FunctionTemplate functionTemplate, XmlDocument xmlDocument) {
21     super(functionTemplate, xmlDocument);
22   }
23
24   public String JavaDoc print() {
25     log4jFunctionLtValue.debug("Arg1: " + arg1Value.printSimple() + " Arg2: " + arg2Value.printSimple());
26     if (arg1Value.print().equals(XmlEngine.strTextDividedByZero) || arg2Value.print().equals(XmlEngine.strTextDividedByZero)) {
27       return XmlEngine.strTextDividedByZero;
28     } else {
29       if (Double.valueOf(arg1Value.printSimple()).doubleValue() < Double.valueOf(arg2Value.printSimple()).doubleValue()) {
30         return "1";
31       } else {
32         return "0";
33       }
34     }
35   }
36
37   public String JavaDoc printSimple() {
38     return print();
39   }
40
41 }
42
Popular Tags