de.uni_paderborn.robots.robot.group10
Class ItemIdListMatcher

java.lang.Object
  |
  +--de.uni_paderborn.robots.robot.group10.ItemIdListMatcher
All Implemented Interfaces:
MapItemMatcher

public class ItemIdListMatcher
extends java.lang.Object
implements MapItemMatcher

Implementation of MapItemMatcher that searches for the shortest paths to map items whose id matches with one from a list of ids.


Field Summary
protected  int[] ids
          The ids to search for
protected  int idsFound
          The number of ids already found.
 
Constructor Summary
ItemIdListMatcher(int[] ids)
          Creates a new ItemTypeMatcher that searches for map items with an id that matches one out of the specified id list.
 
Method Summary
 boolean finished(MapItem mapItem)
          Determines if the search is finished after mapItem is found.
 boolean matches(MapItem mapItem)
          Tests if this map item's id matches the reqested type.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

ids

protected int[] ids
The ids to search for

idsFound

protected int idsFound
The number of ids already found.
Constructor Detail

ItemIdListMatcher

public ItemIdListMatcher(int[] ids)
Creates a new ItemTypeMatcher that searches for map items with an id that matches one out of the specified id list.
Parameters:
array - of ids to search for.
Method Detail

matches

public boolean matches(MapItem mapItem)
Tests if this map item's id matches the reqested type.
Specified by:
matches in interface MapItemMatcher
Parameters:
mapItem - the map item to check
Returns:
true if the id of the specified map item is equal to one of the ids to be searched for

finished

public boolean finished(MapItem mapItem)
Determines if the search is finished after mapItem is found. Tests if all ids have aready been found.
Specified by:
finished in interface MapItemMatcher
Parameters:
mapItem - map item whose search is completed
Returns:
true if all ids have been found