de.uni_paderborn.robots.robot.group9
Class ItemIdMatcher

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

public class ItemIdMatcher
extends java.lang.Object
implements MapItemMatcher

Implementation of MapItemMatcher, that searches for the shortest path to a map item with a specified id


Field Summary
(package private)  int id
          The id to search for
 
Constructor Summary
ItemIdMatcher(int id)
          Creates a new ItemTypeMatcher that searches for map items with the specified id
 
Method Summary
 boolean equals(java.lang.Object otherMapItemMatcher)
          Does this ItemIdMatcher search for the same map items as the specified object?
 boolean finished(MapItem mapItem)
          Because type MapItemMatcher only searches for one map item, whenever the first item is found, the search should immediately stop.
 boolean matches(MapItem mapItem)
          Matches the item
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

id

int id
The id to search for
Constructor Detail

ItemIdMatcher

public ItemIdMatcher(int id)
Creates a new ItemTypeMatcher that searches for map items with the specified id
Parameters:
id - the id to search for.
Method Detail

matches

public boolean matches(MapItem mapItem)
Matches the item
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 the id to be searched for

finished

public boolean finished(MapItem mapItem)
Because type MapItemMatcher only searches for one map item, whenever the first item is found, the search should immediately stop.
Specified by:
finished in interface MapItemMatcher
Returns:
always true

equals

public boolean equals(java.lang.Object otherMapItemMatcher)
Does this ItemIdMatcher search for the same map items as the specified object?
Overrides:
equals in class java.lang.Object
Parameters:
otherMapItem - some object, preferably a MapItemMatcher, however it is no harm if something else is passed.
Returns:
true if the MapItemMatchers search for the same thing