Package net.sf.gridarta.model.face
Class DefaultFaceObject
- java.lang.Object
-
- net.sf.gridarta.model.data.AbstractNamedObject
-
- net.sf.gridarta.model.face.DefaultFaceObject
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<NamedObject>,NamedObject,FaceObject
public class DefaultFaceObject extends AbstractNamedObject implements FaceObject
A FaceObject stores information and meta information about a face and provides methods for accessing these. Mainly this is:- Face name
- Weakly referenced Image Icon for different appearances of the face
- File name of file where the face originally came from
- File name where the face actually was loaded from (may be the same or different from the previous one)
- File offset in the file name
- File size
- See Also:
- Serialized Form
- Todo:
- think how this class could be serialized because size, offset etc. are not serializable.
-
-
Constructor Summary
Constructors Constructor Description DefaultFaceObject(@NotNull java.lang.String faceName, @NotNull java.lang.String originalFilename, int offset, int size)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(@NotNull NamedObject o)Overridden to sort bug.101 and bug.111 before all other faces.booleanequals(@Nullable java.lang.Object obj)@Nullable java.lang.StringgetAlternativeFaceName()Returns the alternative face name for image.a.nnn faces.@NotNull java.lang.StringgetDisplayIconName()Returns the face name of the display icon for this AbstractNamedObject.@NotNull java.lang.StringgetFaceName()Get the faceName, which is the name of the face as usable by the "face" attribute.@NotNull java.lang.StringgetName()Get the name of this AbstractNamedObject.intgetOffset()Returns the offset of this face in the actual file.@NotNull java.lang.StringgetOriginalFilename()Get the original filename of this face.intgetSize()Returns the size of this face in the actual file.inthashCode()booleanisDouble()Return whether this face is a double face.booleanisUp()Return whether this face is an up face.-
Methods inherited from class net.sf.gridarta.model.data.AbstractNamedObject
getPath, setPath, toString
-
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, toString
-
-
-
-
Constructor Detail
-
DefaultFaceObject
public DefaultFaceObject(@NotNull @NotNull java.lang.String faceName, @NotNull @NotNull java.lang.String originalFilename, int offset, int size)Creates a new instance.- Parameters:
faceName- name of face, e.g. "bug.111"originalFilename- original filename without .png extension, e.g. "/system/bug.111"offset- offset in the file denoted byactualFilename, e.g. 148676size- size in the file denoted byactualFilename, e.g. 567,
-
-
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
getFaceName()
-
getFaceName
@NotNull public @NotNull java.lang.String getFaceName()
Description copied from interface:FaceObjectGet the faceName, which is the name of the face as usable by the "face" attribute.- Specified by:
getFaceNamein interfaceFaceObject- Returns:
- faceName
- See Also:
getName()
-
getOriginalFilename
@NotNull public @NotNull java.lang.String getOriginalFilename()
Description copied from interface:FaceObjectGet the original filename of this face.- Specified by:
getOriginalFilenamein interfaceFaceObject- Returns:
- filename where this face was originally found
-
getOffset
public int getOffset()
Returns the offset of this face in the actual file.- Returns:
- the offset of this face in the actual file
-
getSize
public int getSize()
Returns the size of this face in the actual file.- Returns:
- the size of this face in the actual file
-
isUp
public boolean isUp()
Description copied from interface:FaceObjectReturn whether this face is an up face.- Specified by:
isUpin interfaceFaceObject- Returns:
- upFace
-
isDouble
public boolean isDouble()
Description copied from interface:FaceObjectReturn whether this face is a double face.- Specified by:
isDoublein interfaceFaceObject- Returns:
- doubleFace
-
getAlternativeFaceName
@Nullable public @Nullable java.lang.String getAlternativeFaceName()
Description copied from interface:FaceObjectReturns the alternative face name for image.a.nnn faces.- Specified by:
getAlternativeFaceNamein interfaceFaceObject- Returns:
- the alternative face name (image.b.nnn) or
null
-
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
-
compareTo
public int compareTo(@NotNull @NotNull NamedObject o)Overridden to sort bug.101 and bug.111 before all other faces.- Specified by:
compareToin interfacejava.lang.Comparable<NamedObject>- Overrides:
compareToin classAbstractNamedObject
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractNamedObject
-
equals
public boolean equals(@Nullable @Nullable java.lang.Object obj)- Overrides:
equalsin classAbstractNamedObject
-
-