20 package net.sf.gridarta.model.gameobject;
22 import java.io.Serializable;
23 import java.util.ArrayList;
24 import java.util.Iterator;
25 import java.util.List;
29 import org.jetbrains.annotations.NotNull;
30 import org.jetbrains.annotations.Nullable;
41 public class MultiArchData<G
extends GameObject<G, A, R>, A extends
MapArchObject<A>, R extends
Archetype<G, A, R>, T extends
BaseObject<G, A, R, T>> implements Iterable<T>, Serializable {
84 private final List<T>
parts =
new ArrayList<>();
93 assert head.getArchetype().getMultiX() == 0 && head.getArchetype().getMultiY() == 0;
111 return maxX - minX + 1;
120 return maxY - minY + 1;
192 final int index = parts.indexOf(ob);
194 return index + 1 < parts.size() ? parts.get(index + 1) : null;
204 final int x = tail.getArchetype().getMultiX();
207 }
else if (x > maxX) {
211 final int y = tail.getArchetype().getMultiY();
214 }
else if (y > maxY) {
221 return parts.iterator();
int maxY
The maximum coordinate of any part; it is never negative.
int multiShapeID
The shape ID of this object.
final List< T > parts
All parts belonging to this multi-part object; the first element is the head part.
int getSizeX()
Determine the horizontal extent in squares.
int getMaxX()
Determine the maximum x-coordinate of any part.
int getSizeY()
Determine the vertical extent in squares.
static final long serialVersionUID
The serial version UID.
int getMinX()
Determine the minimum x-coordinate of any part.
int maxX
The maximum coordinate of any part; it is never negative.
int getMultiShapeID()
Return the shape ID of this object.
Base package of all Gridarta classes.
int minX
The minimum coordinate of any part; it is never positive.
Reflects a game object (object on a map).
MultiArchData(@NotNull final T head, final int multiShapeID)
Create a new instance.
T getNext(@NotNull final T ob)
Return the part following a given part.
T getHead()
Return the head part of this multi-part object.
void addPart(@NotNull final T tail)
Add a part to this multi-part object.
int getMaxY()
Determine the maximum y-coordinate of any part.
int minY
The minimum coordinate of any part; it is never positive.
int getMultiRefCount()
Returns the number of parts this multi-part object contains.
int getMinY()
Determine the minimum y-coordinate of any part.
Interface for MapArchObjects.
void setMultiShapeID(final int multiShapeID)
Set the shape ID of this object.
Class related to GameObject to store multi-part information.