View Javadoc

1   package com.tapina.robe.runtime.instruction;
2   
3   import com.tapina.robe.runtime.CPU;
4   
5   /***
6    * Created by IntelliJ IDEA.
7    * User: gareth
8    * Date: Sep 2, 2003
9    * Time: 4:46:03 PM
10   */
11  public final class Negative extends Operand {
12      private final Operand operand;
13  
14      public Negative(Operand operand) {
15          this.operand = operand;
16      }
17  
18      public final int getValue(CPU cpu) {
19          return -operand.getValue(cpu);
20      }
21  
22      public String getJavaExpression() {
23          return "-" + operand.getJavaExpression();
24      }
25  }