edu.udo.cs.ie.cowbots.internalActions.scout
Class checkHelpersNearCWP

Package class diagram package checkHelpersNearCWP
java.lang.Object
  extended by DefaultInternalAction
      extended by edu.udo.cs.ie.cowbots.internalActions.scout.checkHelpersNearCWP

public class checkHelpersNearCWP
extends DefaultInternalAction

Class for calculating the distance of relevant Helpers to a Closewaypoint. Called by Leaders exclusively to determine whether all his Groupmembers have passed a fence or not.


Field Summary
(package private)  ICowbot cowbot
           
 
Constructor Summary
checkHelpersNearCWP()
           
 
Method Summary
private  int calculateDistance(int myX, int myY, int destX, int destY)
           
private  int checkHelpers(int x, int y, java.lang.String name)
          Utility function for calculating whether all relevant Helpers are near the Closewaypoint
 java.lang.Object execute(TransitionSystem ts, Unifier un, Term[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cowbot

ICowbot cowbot
Constructor Detail

checkHelpersNearCWP

public checkHelpersNearCWP()
Method Detail

execute

public java.lang.Object execute(TransitionSystem ts,
                                Unifier un,
                                Term[] args)
                         throws java.lang.Exception
Throws:
java.lang.Exception

checkHelpers

private int checkHelpers(int x,
                         int y,
                         java.lang.String name)
Utility function for calculating whether all relevant Helpers are near the Closewaypoint

Parameters:
x - X-coordinate of the Waypoint
y - Y-coordinate of the Waypoint
name - the name of the helper responsible of keeping the door open, the leader has to make sure he doesnt include that helper in his calculation
Returns:
result-int, value = 1, if all relevant helpers are nearby, value = 0 else

calculateDistance

private int calculateDistance(int myX,
                              int myY,
                              int destX,
                              int destY)