EOS 2  1.1.0
Einfache Objektbasierte Sprache
PowI.java
gehe zur Dokumentation dieser Datei
1 package de.lathanda.eos.vm.commands;
2 
3 import de.lathanda.eos.vm.Command;
4 import de.lathanda.eos.vm.Machine;
5 
12 public class PowI extends Command {
13 
14  @Override
15  public boolean execute(Machine m) throws Exception {
16  Object b = m.pop();
17  Object a = m.pop();
18  int power = 1;
19  int ai = ((Number) a).intValue();
20  for (int i = ((Number) b).intValue(); i-- > 0;) {
21  power *= ai;
22  }
23  m.push(power);
24  return true;
25  }
26 
27  @Override
28  public String toString() {
29  return "Multiply{" + '}';
30  }
31 }
boolean execute(Machine m)
Definition: PowI.java:15
Impressum