Exemple #1
0
 public override void CompareAndReplace(RoutePath routePath)
 {
     if (BestRoutePath == null)
     {
         BestRoutePath = routePath;
     }
     else
     {
         if (BestRoutePath.NumHop == routePath.NumHop)
         {
             if (BestRoutePath.Cost > routePath.Cost)
             {
                 BestRoutePath = routePath;
             }
         }
         else if (BestRoutePath.NumHop > routePath.NumHop)
         {
             BestRoutePath = routePath;
         }
     }
 }
Exemple #2
0
 public override bool BreakCondition(RoutePath routePath)
 {
     return(BestRoutePath != null
            &&
            routePath.NumHop > BestRoutePath.NumHop);
 }
 /// <summary>
 /// Điều kiện dừng tối ưu khi chạy đệ quy
 /// </summary>
 /// <param name="routePath"></param>
 /// <returns></returns>
 public abstract bool BreakCondition(RoutePath routePath);
 public abstract void CompareAndReplace(RoutePath routePath);
 public override bool BreakCondition(RoutePath routePath)
 {
     return(BestRoutePath != null &&
            routePath.Cost > BestRoutePath.Cost);
 }
 public override bool BreakCondition(List <Router> routePath)
 {
     return(BestRoutePath != null &&
            RoutePath.CaculateCost(routePath) > BestRoutePath.Cost);
 }