Package rea.gameplay.games
Class SimpleVisitor
java.lang.Object
rea.gameplay.games.SimpleVisitor
- All Implemented Interfaces:
Visitor
A simples visitor that counts elements of each kind in the game map, namely:
This visitor can be used to extend specialized visitors, to collect other information
needed to check if the games is completed, by going through all the elements in the map.
The extended visitor may reuse methods from this class that propagate
Element.accept(Visitor)
to descendents.
This class is part of the Visitor pattern - a concrete visitor.
- Author:
- José Paulo Leal
jpleal@fc.up.pt
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe set of players in the map.getItems()
The set of items in the map.The set of passages in the map.The set places in the map.void
Do a visit to a character in the composite structurevoid
Do a visit to an item in the composite structurevoid
Do a visit to a passage in the composite structurevoid
Do a visit to a place in the composite structure
-
Constructor Details
-
SimpleVisitor
public SimpleVisitor()Create an instance of this class. No particular initializations are performed.
-
-
Method Details
-
visit
Description copied from interface:Visitor
Do a visit to a character in the composite structure -
visit
Description copied from interface:Visitor
Do a visit to a place in the composite structure -
visit
Description copied from interface:Visitor
Do a visit to an item in the composite structure -
visit
Description copied from interface:Visitor
Do a visit to a passage in the composite structure -
getCharacters
The set of players in the map. This value will change as players are added and removed from the map.- Returns:
- the set of players in the map
-
getPlaces
The set places in the map. This value will change as places are added and removed from the map.- Returns:
- set of places in the map
-
getItems
The set of items in the map. This will change as items are collected and remove from the map.- Returns:
- set of items in the map
-
getPassages
The set of passages in the map. This value will change as certain items are used other items. For instance, if a key is used to open a door, the door will be changed in a passage to another place- Returns:
- set of passages in the map
-