1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.interpreter.operations;
11
12 import nl.tudelft.simulation.dsol.interpreter.LocalVariable;
13 import nl.tudelft.simulation.dsol.interpreter.OperandStack;
14 import nl.tudelft.simulation.dsol.interpreter.classfile.Constant;
15
16 /***
17 * The FCMPG operation as defined in <a
18 * href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/Instructions2.doc4.html">
19 * http://java.sun.com/docs/books/vmspec/2nd-edition/html/Instructions2.doc4.html
20 * </a>.
21 * <p>
22 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
23 * University of Technology </a>, the Netherlands. <br>
24 * See for project information <a
25 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
26 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
27 * License (GPL) </a>, no warranty <br>
28 *
29 * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
30 * Jacobs </a><a
31 * href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
32 * Verbraeck </a>
33 * @version 1.3 Apr 6, 2004
34 * @since 1.4
35 */
36 public class FCMPG extends VoidOperation
37 {
38 /*** OP refers to the operand code */
39 public static final int OP = 150;
40
41 /***
42 * constructs a new FCMPG
43 */
44 public FCMPG()
45 {
46 super();
47 }
48
49 /***
50 * @see nl.tudelft.simulation.dsol.interpreter.operations.VoidOperation
51 * #execute(nl.tudelft.simulation.dsol.interpreter.OperandStack,
52 * nl.tudelft.simulation.dsol.interpreter.classfile.Constant[],
53 * nl.tudelft.simulation.dsol.interpreter.LocalVariable[])
54 */
55 public void execute(final OperandStack stack,
56 final Constant[] constantPool, final LocalVariable[] localVariables)
57 {
58 Float value2 = (Float) stack.pop();
59 Float value1 = (Float) stack.pop();
60 if (value1.isNaN() || value2.isNaN())
61 {
62 stack.push(new Integer(1));
63 } else
64 {
65 stack.push(new Integer(value1.compareTo(value2)));
66 }
67 }
68
69 /***
70 * @see nl.tudelft.simulation.dsol.interpreter.Operation#getByteLength()
71 */
72 public int getByteLength()
73 {
74 return OPCODE_BYTE_LENGTH;
75 }
76
77 /***
78 * @see nl.tudelft.simulation.dsol.interpreter.Operation#getOpcode()
79 */
80 public int getOpcode()
81 {
82 return FCMPG.OP;
83 }
84 }