Package net.sf.gridarta.model.anim
Class DefaultAnimationObject
- java.lang.Object
-
- net.sf.gridarta.model.data.AbstractNamedObject
-
- net.sf.gridarta.model.anim.DefaultAnimationObject
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<NamedObject>,AnimationObject,NamedObject
public class DefaultAnimationObject extends AbstractNamedObject implements AnimationObject
Abstract base implementation ofAnimationObject.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultAnimationObject(@NotNull java.lang.String animName, @NotNull java.lang.String animList, @NotNull java.lang.String path)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull java.lang.StringgetAnimList()Returns the animation list of this animation.@NotNull java.lang.StringgetAnimName()Get the animName, which is the name of the animation as usable by the "animations" attribute.@NotNull java.lang.StringgetDisplayIconName()Returns the face name of the display icon for this AbstractNamedObject.intgetFacings()Get the facings, which is the number of different sub-animations, for instance for different directions.@NotNull java.lang.StringgetFirstFrame(int facing)Get the first frame.intgetFrameCount()Get the number of frames per facing.@NotNull java.lang.StringgetName()Get the name of this AbstractNamedObject.java.lang.StringtoString()The String representation of an AnimationObject is suitable for writing into the animations file.-
Methods inherited from class net.sf.gridarta.model.data.AbstractNamedObject
compareTo, equals, getPath, hashCode, setPath
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.gridarta.model.data.NamedObject
getPath, setPath
-
-
-
-
Constructor Detail
-
DefaultAnimationObject
public DefaultAnimationObject(@NotNull @NotNull java.lang.String animName, @NotNull @NotNull java.lang.String animList, @NotNull @NotNull java.lang.String path)Creates a new instance. Therefore animList is parsed. Do not invoke this constructor directly, useAnimationObjects.addAnimationObject(String, String, String)instead. If you invoke this constructor directly, the created AnimationObject will not be registered.- Parameters:
animName- name of the animationanimList- list of animation as found between "anim" and "mina", separated with "\n", including "facings" but including neither "anim" nor "mina"path- the path for this animation object
-
-
Method Detail
-
getName
@NotNull public @NotNull java.lang.String getName()
Description copied from interface:NamedObjectGet the name of this AbstractNamedObject. The name should be of user presentable but 100% machine processable nature, means it must be usable for reverse lookup of this AbstractNamedObject in Maps. For faces, the name should be the face name. For animations, the name should be the animation name. For arch objects, the name should be the arch name (definitely not the title).- Specified by:
getNamein interfaceNamedObject- Returns:
- the same String as
getAnimName()
-
getFacings
public int getFacings()
Description copied from interface:AnimationObjectGet the facings, which is the number of different sub-animations, for instance for different directions.- Specified by:
getFacingsin interfaceAnimationObject- Returns:
- facings
-
getAnimName
@NotNull public @NotNull java.lang.String getAnimName()
Description copied from interface:AnimationObjectGet the animName, which is the name of the animation as usable by the "animations" attribute.- Specified by:
getAnimNamein interfaceAnimationObject- Returns:
- the name of this animation
- See Also:
getName()
-
getAnimList
@NotNull public @NotNull java.lang.String getAnimList()
Description copied from interface:AnimationObjectReturns the animation list of this animation. The individual entries are all suffixed with '\n'.- Specified by:
getAnimListin interfaceAnimationObject- Returns:
- the animation list of this animation
-
toString
public java.lang.String toString()
The String representation of an AnimationObject is suitable for writing into the animations file.- Specified by:
toStringin interfaceNamedObject- Overrides:
toStringin classAbstractNamedObject
-
getDisplayIconName
@NotNull public @NotNull java.lang.String getDisplayIconName()
Description copied from interface:NamedObjectReturns the face name of the display icon for this AbstractNamedObject.- Specified by:
getDisplayIconNamein interfaceNamedObject- Returns:
- the face name
-
getFirstFrame
@NotNull public @NotNull java.lang.String getFirstFrame(int facing)
Description copied from interface:AnimationObjectGet the first frame.- Specified by:
getFirstFramein interfaceAnimationObject- Parameters:
facing- facing to get frame for, usually a direction- Returns:
- frame
-
getFrameCount
public int getFrameCount()
Get the number of frames per facing.- Returns:
- number of frames per facing
-
-