Commits

David Lin committed ffbb096

Unified Accept Function

Comments (0)

Files changed (6)

src/Edge/AbstractEdge.java

 public abstract class AbstractEdge implements Edge{
   
   //
-  protected abstract boolean acceptPackage(Package visitor);
+  //protected abstract boolean acceptPackage(Package visitor);
   
   // fields
   private Location from;
   {
     if(!from.accept(visitor) || !to.accept(visitor))
       return false;
-    
-    if(getLoadWeight() < visitor.getWeight())
+    else if(getLoadWeight() < visitor.getWeight())
       return false;
     
-    return this.acceptPackage(visitor);
+    return visitor.visit(this);
   }
   
   //

src/Edge/AbstractEdgeDecorator.java

       return false;
     else if(getLoadWeight() < visitor.getWeight())
       return false;
+    
     return acceptPackage(visitor);
   }
   

src/Edge/Aero.java

     setLoadWeight(5000);
   }
   
-  @Override
-  public boolean acceptPackage(Package visitor)
-  {
-    return visitor.visit(this);
-  }
+  //@Override
+  //public boolean acceptPackage(Package visitor)
+  //{
+  //  return visitor.visit(this);
+  //}
   
   @Override
   public String toString()

src/Edge/Rail.java

     setLoadWeight(20000);
   }
   
-  @Override
-  protected boolean acceptPackage(Package visitor)
-  {
-    return visitor.visit(this);
-  }
+  //@Override
+  //protected boolean acceptPackage(Package visitor)
+  //{
+  //  return visitor.visit(this);
+  //}
   
   @Override
   public String toString()

src/Edge/Road.java

     setLoadWeight(800);
   }
   
-  @Override
-  protected boolean acceptPackage(Package visitor)
-  {
-    return visitor.visit(this);
-  }
+  //@Override
+  //protected boolean acceptPackage(Package visitor)
+  //{
+  //  return visitor.visit(this);
+  //}
   
   @Override
   public String toString()

src/Edge/Ship.java

     setLoadWeight(500000);
   }
   
-  @Override
-  protected boolean acceptPackage(Package visitor)
-  {
-    return visitor.visit(this);
-  }
+  //@Override
+  //protected boolean acceptPackage(Package visitor)
+  //{
+  //  return visitor.visit(this);
+  //}
   
   @Override
   public String toString()