package edu.berkeley.fleet.api;
import java.util.*;
-public abstract class BenkoBox extends Destination {
+public abstract class BenkoBox {
public BenkoBox() { }
public abstract boolean isOutbox();
/** get all destinations associated with this BenkoBox; default implementation: just itself */
- public Iterable<Destination> getDestinations() {
- HashSet<Destination> self = new HashSet<Destination>();
- self.add(this);
- return self;
- }
+ public abstract Iterable<Destination> getDestinations();
/** default implementation: the empty string */
public String getDestinationName() { return ""; }
package edu.berkeley.fleet.api;
-public abstract class Destination {
-
- public Destination() { }
+public interface Destination {
/** return the Ship to which this BenkoBox belongs */
- public abstract Ship getShip();
+ public Ship getShip();
/**
* this returns the third component of the name; that is in
* "ship.port.foo", it returns "foo", and in "ship.port" it
* returns ""
*/
- public abstract String getDestinationName();
+ public String getDestinationName();
}
private static int max_addr;
- private class InterpreterBenkoBoxDestination extends Destination implements InterpreterDestination {
+ private class InterpreterBenkoBoxDestination implements InterpreterDestination {
public String name;
public long addr = max_addr++;
public InterpreterBenkoBoxDestination(String name) { this.name = name; }
import edu.berkeley.fleet.api.*;
import java.util.*;
-interface InterpreterDestination {
+interface InterpreterDestination extends Destination {
public long getDestAddr();
public void addDataFromFabric(Packet packet);
public String getDestinationName();
ports = newports;
}
- public class VirtualPort extends Destination {
+ public class VirtualPort implements Destination {
public String name;
public VirtualPort(String name) { this.name = name; }
public String getDestinationName() { return name; }