Class REFAIPlayer.REFNavyGoalDecider

  • All Implemented Interfaces:
    GoalDecider
    Enclosing class:
    REFAIPlayer

    private static class REFAIPlayer.REFNavyGoalDecider
    extends java.lang.Object
    implements GoalDecider
    Goal decider class for the REF Navy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Player rebel
      The rebel player to attack.
      private java.util.Set<Unit> rebelNavy
      A container to fill with target units.
    • Constructor Summary

      Constructors 
      Constructor Description
      REFNavyGoalDecider​(Player rebel, java.util.Set<Unit> rebelNavy)
      Build a new goal decider for the REF to find rebel naval units.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean check​(Unit unit, PathNode pathNode)
      Checks whether the given PathNode is a goal/sub-goal.
      PathNode getGoal()
      Gets the PathNode containing the goal.
      boolean hasSubGoals()
      Determines whether this GoalDecider has any sub goals.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • rebel

        private Player rebel
        The rebel player to attack.
      • rebelNavy

        private java.util.Set<Unit> rebelNavy
        A container to fill with target units.
    • Constructor Detail

      • REFNavyGoalDecider

        public REFNavyGoalDecider​(Player rebel,
                                  java.util.Set<Unit> rebelNavy)
        Build a new goal decider for the REF to find rebel naval units.
        Parameters:
        rebel - The Player to attack.
        rebelNavy - A container to fill with the naval units found.
    • Method Detail

      • getGoal

        public PathNode getGoal()
        Gets the PathNode containing the goal.
        Specified by:
        getGoal in interface GoalDecider
        Returns:
        The PathNode where the Tile returned by pathNode.getTile() is the goal.
      • hasSubGoals

        public boolean hasSubGoals()
        Determines whether this GoalDecider has any sub goals.
        Specified by:
        hasSubGoals in interface GoalDecider
        Returns:
        true if there are any sub goals and false otherwise.
      • check

        public boolean check​(Unit unit,
                             PathNode pathNode)
        Checks whether the given PathNode is a goal/sub-goal.
        Specified by:
        check in interface GoalDecider
        Parameters:
        unit - The Unit which we are trying to find a path for.
        pathNode - The PathNode where the Tile returned by pathNode.getTile() is the tile to be checked.
        Returns:
        true if the PathNode was either a goal or a sub goal and false otherwise. The goal should be returned by GoalDecider.getGoal() right after a call to this method, if this method returns true and GoalDecider.hasSubGoals() returns false.