Package net.sf.gridarta.model.gameobject
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>>
- java.lang.Object
-
- net.sf.gridarta.model.gameobject.MultiArchData<G,A,R,T>
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<T>
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.SerializableClass related toGameObjectto store multi-part information. This data is only used for multi-part objects. When the editor is running, usually a big number ofGameObjects exist - most of them single-part objects. The encapsulation of this "multi-part-only" data can save a little bit of memory.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MultiArchData(T head, int multiShapeID)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPart(T tail)Adds a part to this multi-part object.TgetHead()Returns the head part of this multi-part object.intgetMaxX()Returns the maximum x-coordinate of any part.intgetMaxY()Returns the maximum y-coordinate of any part.intgetMinX()Returns the minimum x-coordinate of any part.intgetMinY()Returns the minimum y-coordinate of any part.intgetMultiRefCount()Returns the number of parts this multi-part object contains.intgetMultiShapeID()Returns the shape ID of this object.TgetNext(T ob)Returns the part following a given part.intgetSizeX()Returns the horizontal extent in squares.intgetSizeY()Returns the vertical extent in squares.java.util.Iterator<T>iterator()voidsetMultiShapeID(int multiShapeID)Sets the shape ID of this object.
-
-
-
Constructor Detail
-
MultiArchData
public MultiArchData(@NotNull T head, int multiShapeID)Creates a new instance.- Parameters:
head- the head part of the multi-part objectmultiShapeID- the shape ID of this object
-
-
Method Detail
-
getMultiRefCount
public int getMultiRefCount()
Returns the number of parts this multi-part object contains.- Returns:
- the number of parts this multi-part object contains
-
getSizeX
public int getSizeX()
Returns the horizontal extent in squares. For single-part objects 1 is returned.- Returns:
- the horizontal extent
-
getSizeY
public int getSizeY()
Returns the vertical extent in squares. For single-part objects 1 is returned.- Returns:
- the vertical extent
-
getMaxX
public int getMaxX()
Returns the maximum x-coordinate of any part. The value is relative to the head part. For single-part objects 0 is returned.- Returns:
- the maximum x-coordinate
-
getMaxY
public int getMaxY()
Returns the maximum y-coordinate of any part. The value is relative to the head part. For single-part objects 0 is returned.- Returns:
- the maximum y-coordinate
-
getMinX
public int getMinX()
Returns the minimum x-coordinate of any part. The value is relative to the head part. For single-part objects 0 is returned.- Returns:
- the minimum x-coordinate
-
getMinY
public int getMinY()
Returns the minimum y-coordinate of any part. The value is relative to the head part. For single-part objects 0 is returned.- Returns:
- the minimum y-coordinate
-
getMultiShapeID
public int getMultiShapeID()
Returns the shape ID of this object.- Returns:
- the shape ID of this object
-
setMultiShapeID
public void setMultiShapeID(int multiShapeID)
Sets the shape ID of this object.- Parameters:
multiShapeID- the new shape ID of this object
-
getHead
@NotNull public T getHead()
Returns the head part of this multi-part object.- Returns:
- the head part
-
getNext
@Nullable public T getNext(@NotNull T ob)
Returns the part following a given part.- Parameters:
ob- the current part- Returns:
- the part following the current part or
nullif this part was the last.
-
addPart
public void addPart(@NotNull T tail)Adds a part to this multi-part object.- Parameters:
tail- the tail part to add
-
-