01: /*
02: * $Id: GreaterThanNode.java,v 1.7 2002/09/16 08:05:04 jkl Exp $
03: *
04: * Copyright (c) 2002 Njet Communications Ltd. All Rights Reserved.
05: *
06: * Use is subject to license terms, as defined in
07: * Anvil Sofware License, Version 1.1. See LICENSE
08: * file, or http://njet.org/license-1.1.txt
09: */
10: package anvil.script.expression;
11:
12: import anvil.core.Any;
13: import anvil.core.Any.Op;
14: import anvil.codec.Code;
15: import anvil.script.compiler.ByteCompiler;
16: import anvil.script.Context;
17: import java.io.IOException;
18:
19: /**
20: * class GreaterThanNode
21: *
22: * @author: Jani Lehtimäki
23: */
24: public class GreaterThanNode extends BinaryParent {
25:
26: public GreaterThanNode(Node left, Node right) {
27: super (left, right);
28: }
29:
30: public int typeOf() {
31: return Node.EXPR_GREATER;
32: }
33:
34: public Any eval() {
35: return Op.gtA(_left.eval(), _right.eval());
36: }
37:
38: public void compile(ByteCompiler context, int operation) {
39: super .compile(context, GET);
40: Code code = context.getCode();
41: if (operation == GET_BOOLEAN) {
42: code.invokestatic(code.getPool().addMethodRef(
43: context.TYPE_ANY_OP, "gt",
44: "(Lanvil/core/Any;Lanvil/core/Any;)Z"));
45: } else {
46: code
47: .invokestatic(code
48: .getPool()
49: .addMethodRef(context.TYPE_ANY_OP, "gtA",
50: "(Lanvil/core/Any;Lanvil/core/Any;)Lanvil/core/Any;"));
51: }
52: }
53:
54: }
|