better colorization of interpreter logs
[fleet.git] / src / edu / berkeley / fleet / interpreter / Packet.java
index 60a69e7..d26b894 100644 (file)
@@ -3,23 +3,40 @@ import edu.berkeley.fleet.api.*;
 
 class Packet {
 
-    InterpreterPath path;
-    BitVector value;
-    boolean isToken;
+    private final InterpreterPath path;
+    private final BitVector value;
+    private final boolean isToken;
 
     public Packet(InterpreterPath path, BitVector value, boolean isToken) {
         this.value = value;
         this.path = path;
         this.isToken = isToken;
+        this.value.setImmutable();
     }
 
     public void send() {
-        if (isToken) {
-            Log.token(path.getSource(), path.getDestination());
-        } else {
-            Log.data(value+"", path.getSource(), path.getDestination());
-        }
+        Log.packet(this);
         ((InterpreterDestination)path.getDestination()).addDataFromFabric(this);
     }
 
+    public Destination getDestination() {
+        return path.getDestination();
+    }
+
+    public Dock getSource() {
+        return path.getSource();
+    }
+
+    public BitVector getSignal() {
+        return path.getSignal();
+    }
+
+    public BitVector getValue() {
+        return value;
+    }
+
+    public boolean isToken() {
+        return isToken;
+    }
+
 }