A static factory class for creating and accessing the tactical symbols provided in this module via a programmer friendly method.
Make sure to call initialise()
early in your application startup
to get the most expensive part of starting up out of the way. This triggers
the reading of the index file and will create an ArrayList of TacticalSymbol
with instances for every symbol. If not explicitely called, it will be
called on the first attempt to access the symbols. This may cause a slight
stutter in your application, as on my machine the initialisation takes over
100ms
- Since:
- 1.2
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<TacticalSymbolResource>
Simply returns the internal storage wrapped in an unmodifiable list.static Collection<TacticalSymbolResource>
getTacticalSymbols
(TacticalSymbolTag... tags) A search mechanism using "AND" logic to retrieve allTacticalSymbolResource
s with all of the desiredTacticalSymbolTag
sstatic boolean
Reads the index file and populates an internal storage ofTacticalSymbolResource
instances.static boolean
Simple check to see if the internal storage has been initialised.static void
reset()
Resets the cache back to a default state.
-
Field Details
-
LOGGER_NAME
We use java.util logging. This is the name of the logger we are using.- Since:
- 1.1
- See Also:
-
-
Method Details
-
initialise
public static boolean initialise()Reads the index file and populates an internal storage of
TacticalSymbolResource
instances. Note, that thes instances do not have the images in memory, only URLs to the assets so that you can easily load them using your system of choice.- Returns:
- if the initialisation was successfull or not.
- Since:
- 1.2
-
reset
public static void reset()Resets the cache back to a default state. After calling clear, a subsequent call to
isInitialised()
will return false.- Since:
- 1.2
-
isInitialised
public static boolean isInitialised()Simple check to see if the internal storage has been initialised.- Returns:
- if the symbols instances have been prepared.
- Since:
- 1.2
-
getTacticalSymbols
A search mechanism using "AND" logic to retrieve all
TacticalSymbolResource
s with all of the desiredTacticalSymbolTag
s- Parameters:
tags
- TheTacticalSymbolTag
s to be used to search for the symbols- Returns:
- A collection of symbols matching all tags
- Since:
- 1.2
-
getTacticalSymbols
Simply returns the internal storage wrapped in an unmodifiable list.- Returns:
- All of the loaded
TacticalSymbolResource
s - Since:
- 1.2
-