 |
Gridarta Editor
|
Go to the documentation of this file.
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;
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 getMaxY()
Returns the maximum y-coordinate of any part.
int minY
The minimum coordinate of any part; it is never positive.
Base package of all Gridarta classes.
int minX
The minimum coordinate of any part; it is never positive.
Class related to GameObject to store multi-part information.
int getMultiRefCount()
Returns the number of parts this multi-part object contains.
MultiArchData(@NotNull final T head, final int multiShapeID)
Creates a new instance.
void setMultiShapeID(final int multiShapeID)
Sets the shape ID of this object.
Reflects a game object (object on a map).
int getMaxX()
Returns the maximum x-coordinate of any part.
Interface for MapArchObjects.
T getNext(@NotNull final T ob)
Returns the part following a given part.
T getHead()
Returns the head part of this multi-part object.
static final long serialVersionUID
The serial version UID.
int getSizeX()
Returns the horizontal extent in squares.
int getMultiShapeID()
Returns the shape ID of this object.
int getMinY()
Returns the minimum y-coordinate of any part.
void addPart(@NotNull final T tail)
Adds a part to this multi-part object.
int getSizeY()
Returns the vertical extent in squares.
final List< T > parts
All parts belonging to this multi-part object; the first element is the head part.
int maxX
The maximum coordinate of any part; it is never negative.
int multiShapeID
The shape ID of this object.
int maxY
The maximum coordinate of any part; it is never negative.
int getMinX()
Returns the minimum x-coordinate of any part.