Package VASSAL.build.module.index
Class IndexManager
java.lang.Object
VASSAL.build.module.index.IndexManager
The IndexManager maintains a set of indexes on GamePieces that will primarily be used by
the GKC Fast-match mechanism to quickly find sets of pieces that meet certain critera.
It maintains the following indexes:
o A per-map quadtree of piece locations
o A per-map cross-reference of values of the Currentzone and LocationName properties
The indexes for each Map are stored in a VassalMapPieceIndex object
NOTE: Pieces not on Maps are NOT included in any index.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clearAll()
Clear all indexesReturn a list of pieces at a specific point on a specific mapReturn a list of pieces within a given range of a specified pointReturn a list of pieces on a Map with a specified value for the specified propertyReturn a list of pieces within a given range of another piecevoid
pieceMoved
(GamePiece piece, Map map) A piece has just moved or been placed on the board, update any location based indexes and create any property based indexes if we have not seen this piece beforevoid
pieceRemoved
(GamePiece piece, Map map) A piece has been removed from a Mapvoid
rebuild()
Clear and rebuild all indexes using pieces currently existing on boards.
-
Constructor Details
-
IndexManager
public IndexManager()
-
-
Method Details
-
rebuild
public void rebuild()Clear and rebuild all indexes using pieces currently existing on boards. Will usually only be called at the start of a game session after initial load of gamestate is complete. -
clearAll
public void clearAll()Clear all indexes -
pieceMoved
-
pieceRemoved
-
getPieces
Return a list of pieces within a given range of another piece- Parameters:
piece
- Piece to use as originrange
- range in units appropriate to the grid at the pieces locationforceAsPixels
- Force the range check to be in pixels, overriding any grid at the target point- Returns:
- List of pieces (not including the souurce piece)
-
getPieces
-
getPieces
Return a list of pieces within a given range of a specified point- Parameters:
map
- Mappoint
- Position to search fromrange
- Range in units appropriate to the grid at the search point.forceAsPixels
- Force the range check to be in pixels, overriding any grid at the target point- Returns:
- List of pieces
-
getPieces
-
getPieces
-
getPieces
Return a list of pieces on a Map with a specified value for the specified property- Parameters:
map
- MappropertyName
- Propertyname to lookuppropertyValue
- Property value to look for- Returns:
- List of pieces with that property value
-