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

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

public class getNearestHelper
extends DefaultInternalAction

Class for choosing the nearest Helper to a certain Point


Field Summary
(package private)  ICowbot cowbot
           
 
Constructor Summary
getNearestHelper()
           
 
Method Summary
private  int calcDistance(ELPLiteral e, int x, int y)
          Utility function for calculating the distance between Agent and checkpoint
 java.lang.Object execute(TransitionSystem ts, Unifier un, Term[] args)
           
private  java.lang.String getHelper(int x, int y, java.lang.String fenceopenername)
          Utility function for calculating the distance between 2 points and comparing it to a threshold delta
 
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

getNearestHelper

public getNearestHelper()
Method Detail

execute

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

getHelper

private java.lang.String getHelper(int x,
                                   int y,
                                   java.lang.String fenceopenername)
Utility function for calculating the distance between 2 points and comparing it to a threshold delta

Parameters:
x - X-coordinate of the Point
y - Y-coordinate of the Point
Returns:
the name of the nearest helper

calcDistance

private int calcDistance(ELPLiteral e,
                         int x,
                         int y)
Utility function for calculating the distance between Agent and checkpoint

Parameters:
e - the ELPLiteral encoding the agents position.
x - X-coordinate of the CP
y - Y-coordinate of the CP
Returns:
the distance