Commits

David Lin committed 27cdf42

Expand Package

Comments (0)

Files changed (3)

src/Edge/AbstractEdgeDecorator.java

   }
   
   //
+  public final Edge getEdge()
+  {
+    return edge;
+  }
+  
+  //
   
   @Override
   public final Location getTo()
   @Override
   public final boolean accept(Package visitor)
   {
-    if(!edge.accept(visitor))
+    if(!getFrom().accept(visitor) || !getTo().accept(visitor))
+      return false;
+    else if(getLoadWeight() < visitor.getWeight())
       return false;
     return acceptPackage(visitor);
   }

src/Package/Meat.java

+package dp2011.group05.delivery;
+
+public class Meat extends AbstractPackage{
+  
+  // ctor
+  public Meat(int weight)
+  {
+    super(weight);
+  }
+  
+  // visit edge
+  
+  public boolean _visit(AbstractEdge edge)
+  {
+    return false;
+  }
+  
+  public boolean _visit(AbstractEdgeDecorator de)
+  {
+    return false;
+  }
+  
+  public boolean _visit(Freeze fe)
+  {
+    return true;
+  }
+  
+  public boolean _visit(AbstractLocation loc)
+  {
+    return true;
+  }
+  
+}

src/Package/NormalPackage.java

   
   // visit edge decorator
   
+  public boolean _visit(AbstractEdgeDecorator de)
+  {
+    return false;
+  }
+  
+  /*
   public boolean _visit(Alive alive)
   {
     return true;
   {
     return true;
   }
+  */
   
   // visit location
   
+  public boolean _visit(AbstractLocation loc)
+  {
+    return true;
+  }
+  
+  /*
   public boolean _visit(City city)
   {
     return true;
   }
+  */
   
 }