Collection class final
A collection of cards that may span multiple CardSets.
This class is intended to be used to represent all of the cards that belong to a person or entity, e.g. a collection of all cards owned by a person, or all cards that are legal in a tournament.
Equality
Two Collections are equal if they contain the same cards, and the number of copies of each card is the same. This is a deep equalit check, so it should be used with caution.
- Available extensions
- Annotations
-
- @immutable
Constructors
-
Collection.fromCards(Iterable<
Card> cards) -
Creates a new Collection with the given
cards
.factory -
Collection.fromCardSets(Iterable<
CardSetInventory> cardSets, {int count(Card) = _defaultCount}) -
Creates a new Collection containing the cards from each card set.
factory
Properties
Methods
-
contains(
Card card) → bool -
Returns whether this collection contains at least one copy of
card
. -
count(
Card card) → int -
Returns the number of copies of
card
in this collection. -
decodeDeck(
Iterable< CardReference> references) → Deck -
Available on Collection, provided by the DeckDecoder extension
Decodes card references into a deck. -
find(
CardSet cardSet, int orderInSet) → Card -
Looks up a card in this collection by its
cardSet
andorderInSet
. -
findCopies(
CardSet cardSet, int orderInSet) → ({Card card, int count}) -
Looks up a card in this collection by its
cardSet
andorderInSet
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDebugString(
) → String - Returns a string representation of this object, suitable for debugging.
-
toMap(
) → Map< CardSet, Map< Card, int> > - Returns a map of card sets to the number of cards in that set.
-
toSet(
) → Set< Card> - Returns a set of all of the cards in this collection.
-
toString(
) → String -
A string representation of this object.
inherited
-
tryFind(
CardSet cardSet, int orderInSet) → Card? -
Looks up a card in this collection by its
cardSet
andorderInSet
. -
tryFindCopies(
CardSet cardSet, int orderInSet) → ({Card? card, int count}) -
Looks up a card in this collection by its
cardSet
andorderInSet
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator [](
Card card) → int -
Returns the number of copies of
card
in this collection.