1 package edu.berkeley.fleet.interpreter;
2 import edu.berkeley.fleet.api.*;
3 import edu.berkeley.sbp.util.ANSI;
7 private final InterpreterPath path;
8 private final BitVector value;
9 private final boolean isToken;
11 public Packet(InterpreterPath path, BitVector value, boolean isToken) {
14 this.isToken = isToken;
15 this.value.setImmutable();
20 ((InterpreterDestination)path.getDestination()).addDataFromFabric(this);
23 public Destination getDestination() {
24 return path.getDestination();
27 public Dock getSource() {
28 return path.getSource();
31 public BitVector getSignal() {
32 return path.getSignal();
35 public BitVector getValue() {
39 public boolean isToken() {
43 public String toString() {
45 BitVector data = p.getValue();
46 Dock source = p.getSource();
47 Destination dest = p.getDestination();
48 if (dest.getDock().getInstructionDestination()==dest) {
50 return (ANSI.yellow(ANSI.bold(" torpedo: ")) + (source + " -> " + ANSI.yellow(ANSI.bold(dest+""))));
52 Instruction d = source.getShip().getFleet().decodeInstruction(data, source);
53 return (ANSI.red("dispatch: " + d));
57 return (ANSI.blue(ANSI.bold(" token: ")) + (source + " -> " + ANSI.blue(ANSI.bold(dest+""))));
59 return (ANSI.cyan(" data: "+data) +
61 (" : " + source))+(" -> "+ANSI.cyan(""+dest)));