Class CardZone
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<EntityZone<? extends Entity>>
,Iterable<Card>
,Collection<Card>
,List<Card>
,CardList
This class is a
CardList
that represents the Spellsource.ZonesMessage.Zones.HAND
and Spellsource.ZonesMessage.Zones.DECK
. It is implemented as
an EntityZone
because it represents an in-game zone; i.e., an entity can only be in one zone at once.-
Field Summary
Fields inherited from class net.demilich.metastone.game.entities.EntityZone
internal, lookup, player, zone
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds all the cards from the given list.Adds the card fluently.clone()
Creates a new zone and adds a clone of all the cards to it.boolean
Checks if the list has the specific reference to a card.int
getCount()
Gets the size of this list.Gets the first card in this instance.boolean
Removes the specified card instance by reference.void
Deprecated.Removes the first card in this instance and sets its location toEntityLocation.UNASSIGNED
, so that it can be added to another zone.boolean
Replaces a card in this zone, setting the old card'sEntity.entityLocation
toEntityLocation.UNASSIGNED
so that it can be added to another zone.shuffle
(XORShiftRandom random) Shuffles the instance with the given random number generator.stream()
Gets theStream
API representation of this card list.toList()
Gets aList
that references the contents of this instance.Methods inherited from class net.demilich.metastone.game.entities.EntityZone
add, compareTo, empty, exchange, get, getManaCostComparator, getPlayer, getZone, indexOf, move, move, remove, remove, set, setLookup, setPlayer, setUnchecked, size, sort, swap, uncheckedAdd
Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.demilich.metastone.game.cards.CardList
addCard, containsCard, containsCard, filtered, get, getCopy, hasCardOfType, isEmpty, iterator, peek
Methods inherited from interface java.util.Collection
parallelStream, removeIf, toArray
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
Constructor Details
-
Method Details
-
addCard
Description copied from interface:CardList
Adds the card fluently. -
addAll
Description copied from interface:CardList
Adds all the cards from the given list. -
clone
Creates a new zone and adds a clone of all the cards to it. Skips checks on the zone to prevent entities from being in two places at once. -
contains
Description copied from interface:CardList
Checks if the list has the specific reference to a card. Does not use the card'sEntity.id
or itsCard.getCardId()
, which may be more helpful. -
getCount
public int getCount()Description copied from interface:CardList
Gets the size of this list. -
peekFirst
Description copied from interface:CardList
Gets the first card in this instance. -
remove
Description copied from interface:CardList
Removes the specified card instance by reference. -
removeAll
Deprecated.Description copied from interface:CardList
Removes all the cards from this instance. -
removeFirst
Removes the first card in this instance and sets its location toEntityLocation.UNASSIGNED
, so that it can be added to another zone.- Specified by:
removeFirst
in interfaceCardList
- Returns:
- The card that was removed.
-
replace
Replaces a card in this zone, setting the old card'sEntity.entityLocation
toEntityLocation.UNASSIGNED
so that it can be added to another zone. -
shuffle
Description copied from interface:CardList
Shuffles the instance with the given random number generator.- Specified by:
shuffle
in interfaceCardList
- Parameters:
random
- AXORShiftRandom
instance.
-
toList
Description copied from interface:CardList
Gets aList
that references the contents of this instance. -
stream
Description copied from interface:CardList
Gets theStream
API representation of this card list.- Specified by:
stream
in interfaceCardList
- Specified by:
stream
in interfaceCollection<Card>
- Returns:
- The backing list's
Collection.stream()
.
-