Class EntityZone<E extends Entity>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
net.demilich.metastone.game.entities.EntityZone<E>
- Type Parameters:
E
- The subclass ofEntity
that is stored. For example,Spellsource.ZonesMessage.Zones.BATTLEFIELD
can only storeMinion
entities.
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<EntityZone<? extends Entity>>
,Iterable<E>
,Collection<E>
,List<E>
- Direct Known Subclasses:
CardZone
public class EntityZone<E extends Entity>
extends AbstractList<E>
implements List<E>, Iterable<E>, Cloneable, Serializable, Comparable<EntityZone<? extends Entity>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected final com.hiddenswitch.spellsource.rpc.Spellsource.ZonesMessage.Zones
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorsConstructorDescriptionEntityZone
(int player, com.hiddenswitch.spellsource.rpc.Spellsource.ZonesMessage.Zones zone, Map<Integer, Entity> lookup) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clone()
int
compareTo
(@NotNull EntityZone<? extends Entity> o) static EntityZone<Entity>
empty
(com.hiddenswitch.spellsource.rpc.Spellsource.ZonesMessage.Zones zone, int player) protected void
get
(int index) static @NotNull Comparator<Card>
int
com.hiddenswitch.spellsource.rpc.Spellsource.ZonesMessage.Zones
getZone()
int
void
move
(int index, EntityZone destination, int destinationIndex) void
move
(Entity source, EntityZone destination) remove
(int index) boolean
void
setPlayer
(int playerIndex) protected E
setUnchecked
(int index, E element) int
size()
void
sort
(Comparator<? super E> c) static <E extends Entity>
voidswap
(E sourceEntity, E targetEntity, EntityZoneTable context) Swaps two entities with each other.protected void
uncheckedAdd
(int index, E element) 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 java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
add, addAll, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeAll, replaceAll, retainAll, spliterator, subList, toArray, toArray
-
Field Details
-
zone
protected final com.hiddenswitch.spellsource.rpc.Spellsource.ZonesMessage.Zones zone -
lookup
-
player
protected int player -
internal
-
-
Constructor Details
-
Method Details
-
getManaCostComparator
-
clone
-
get
-
set
-
sort
-
setUnchecked
-
add
-
uncheckedAdd
-
remove
-
indexOf
-
remove
-
move
-
move
-
exchange
-
size
public int size() -
setPlayer
public void setPlayer(int playerIndex) -
getZone
public com.hiddenswitch.spellsource.rpc.Spellsource.ZonesMessage.Zones getZone() -
getPlayer
public int getPlayer() -
swap
Swaps two entities with each other. They must be of the same type.- Type Parameters:
E
- The type of the entity to swap (must be the same).- Parameters:
sourceEntity
- One of the two entities to swap in location.targetEntity
- One of the two entities to swap in location.context
- AnEntityZoneTable
, typically aGameContext
, to look up entities inside of.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<E extends Entity>
-
setLookup
-