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>>
extends java.lang.Object
implements java.lang.Iterable<T>, java.io.Serializable
GameObject
to store multi-part information. This
data is only used for multi-part objects. When the editor is running, usually
a big number of GameObject
s exist - most of them single-part objects.
The encapsulation of this "multi-part-only" data can save a little bit of
memory.Constructor and Description |
---|
MultiArchData(T head,
int multiShapeID)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addPart(T tail)
Adds a part to this multi-part object.
|
T |
getHead()
Returns the head part of this multi-part object.
|
int |
getMaxX()
Returns the maximum x-coordinate of any part.
|
int |
getMaxY()
Returns the maximum y-coordinate of any part.
|
int |
getMinX()
Returns the minimum x-coordinate of any part.
|
int |
getMinY()
Returns the minimum y-coordinate of any part.
|
int |
getMultiRefCount()
Returns the number of parts this multi-part object contains.
|
int |
getMultiShapeID()
Returns the shape ID of this object.
|
T |
getNext(T ob)
Returns the part following a given part.
|
int |
getSizeX()
Returns the horizontal extent in squares.
|
int |
getSizeY()
Returns the vertical extent in squares.
|
java.util.Iterator<T> |
iterator() |
void |
setMultiShapeID(int multiShapeID)
Sets the shape ID of this object.
|
public MultiArchData(@NotNull T head, int multiShapeID)
head
- the head part of the multi-part objectmultiShapeID
- the shape ID of this objectpublic int getMultiRefCount()
public int getSizeX()
public int getSizeY()
public int getMaxX()
public int getMaxY()
public int getMinX()
public int getMinY()
public int getMultiShapeID()
public void setMultiShapeID(int multiShapeID)
multiShapeID
- the new shape ID of this object@NotNull public T getHead()
@Nullable public T getNext(@NotNull T ob)
ob
- the current partnull
if this part
was the last.public void addPart(@NotNull T tail)
tail
- the tail part to add