These new methods will be used to cache the values of Image keys, as well as to determine whether a card has an alternate image (and so key).
Methods on CardImageKeys have been distinguished in names to not confuse them with similar names (but completely different use and output) from InventoryItems interface.
CardImageKeys for PaperCard are also cached in private attribute to reduce OPS in Card Catalogs that are consistently the same.
As for Tokens, the output of these two new methods is the same as getImageKey.
These methods have been also moved to interface (and so class) as this would result in better encapsulation (esp. hasBackFace - using CardRules within the card - similar to `Card` class).
ImageUtil.getImageKey calls will be replaced with these methods, limiting their use only to downloaders (when set attribute can be added or not). PaperCard will always add the set info).
Pattern.quote has some corner cases on MAC not working (`ME/` ended up in three splits).
Resorted back to `//` as the key will never be a true file path anyway!
THe content of the setFolder is cached, filtering only images and key prefixes.
Working on prefixes only to get rid of all .full or .fullborder possible variations.
The huge improvement is due to a re-use of a getAllCards(Name, Predicate) method I started implementing into another branch for DeckImporter - re-using this method internally resolves a **lot** of duplicated iterations, and checks, which made the whole method to run even faster than the original legacy implementation!
An extra test method has been added to verify the corner case of querying for a card from editions with a very high (and weird) artIndex (like a land) - making sure that exact card is finally returned!
New method in Interface API to get all cards in a given setCode.
This has changed the implementation of getArtCount avoiding to iterate over all the possible card prints.
This optimisation removes redundant queries when looking for cards by specificed Art Preference.
getCardsFromSet has been worked-around, avoiding querying for potential candidates already in memory.
A preliminary benchmark/tests is implemented too.
There was a FIXME/TODO comment I just have found out relating to putCard implementation being inefficient.
I've re-used the new-methods implemented for lazyCardLoading to improve existing implementation.
Also, now all the PaperCard constructors won't miss collectorNumber and ArtistNames as gathered from CardInSet in CardEdition - YAY
Various optimisation to the PaperCard implementation:
- removed once and for all retrieveCollectorNumber method - we're now safe and sound that all PaperCard instances will have a collector Number matched.
- That is also made sure by removing all the many (legacy) class constructors. Only left two - with correct parameter passing!
- finally, collectorNumberSortingKey is created onces, and saved - as this won't change (for better performance)
DeckRecognizer is **the** core of the new Deck Import functionalities.
DeckRecognizer has been extended with more flexible, and alternative reg/exp for better card recognition, as well as Deck sections, card types, and deck name.
When retrieving cards from the db, the recogniser will also incorporate validation to check against illegal (from set) or banned cards considering current game/deck format.
The new set of regexp guarantee support for several M:TG deck format, including deckstats.net; tappedout; mtg-arena; mtgo
Each section requiring Validation, now can incorporate a method for sanity check. This will be useful when the deck importer will import cards that are placed in the wrong section in the list.
CardRequest now include a compose (parameter) alternative to just create a CardRequest by name, and/or a boolean flag.
Other changes include actual implementation of the new API methods (see prev. commit)
GetCardFromEditions (series of) methods now support to specify
a Predicate to filter the set of available candidates when gathering all the same card prints (by name).
For this reason, a new Predicate (isLegal) has been added to include limitations (filtering) based on set codes.
getAllCards method now include the possibility to provide a predicate
as a filter.
Forge loads all files found on the setlookup folder.
Example J21.txt (J21 set code) contains a list of set codes (sorted from Newest to Oldest beforehand) to lookup for images on other sets.
The new implementation now contains a completely refactored version of the algorithm, also including the invocation of the latest method for getAlternativeCardPrint in StaticData (with extra statistics paramenters gathered from current pool). This include optimisation for card frame, and cards from Expansion sets.
Moreover, the new implementation now automatically distribute card arts for **all** the cards in the pool - regardless they need to be "replaced" with alternative print or not.
THE ONLY case when this is not happening is when there is NO card to update in the current pool. This makes sense as this means editions has been specified, so the Deck won't receive any UNDESIRED alteration.
CardPool API has been extended by including utility methods to gather specific statistics about a cardPool. These statistics include:
- Distribution (card count frequency) of the Card Edition included in the Pool
- Distribution of the Card Edition Type included in the Pool
- Retrieving the most common Card Edition Type among those included in the Pool
- Determine whether or not the Pool "isModern" (i.e. the majority of cards is gathered from Modern Sets)
- get the PivotCardEdition: this is the cornerstone of card art optimisation for decks
The PivotCardEdition is the edition that will be considered the threshold boundary for cards in the pool. Any decision of card arts for other cards will be considered based on the PivotEdition, that is "alternativeCardPrint" released BEFORE or AFTER (depending on the current Card Art Preference) the PIVOT EDITION RELEASE DATE.
Also, this commit includes an optimisation in add method implementation, getting rid of lots of duplicated code!