Class 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
      int compareTo​(@NotNull NamedObject o)
      Overridden to sort bug.101 and bug.111 before all other faces.
      boolean equals​(@Nullable java.lang.Object obj)  
      @Nullable java.lang.String getAlternativeFaceName()
      Returns the alternative face name for image.a.nnn faces.
      @NotNull java.lang.String getDisplayIconName()
      Returns the face name of the display icon for this AbstractNamedObject.
      @NotNull java.lang.String getFaceName()
      Get the faceName, which is the name of the face as usable by the "face" attribute.
      @NotNull java.lang.String getName()
      Get the name of this AbstractNamedObject.
      int getOffset()
      Returns the offset of this face in the actual file.
      @NotNull java.lang.String getOriginalFilename()
      Get the original filename of this face.
      int getSize()
      Returns the size of this face in the actual file.
      int hashCode()  
      boolean isDouble()
      Return whether this face is a double face.
      boolean isUp()
      Return whether this face is an up face.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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 by actualFilename, e.g. 148676
        size - size in the file denoted by actualFilename, e.g. 567,
    • Method Detail

      • getName

        @NotNull
        public @NotNull java.lang.String getName()
        Description copied from interface: NamedObject
        Get 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:
        getName in interface NamedObject
        Returns:
        the same String as getFaceName()
      • getFaceName

        @NotNull
        public @NotNull java.lang.String getFaceName()
        Description copied from interface: FaceObject
        Get the faceName, which is the name of the face as usable by the "face" attribute.
        Specified by:
        getFaceName in interface FaceObject
        Returns:
        faceName
        See Also:
        getName()
      • getOriginalFilename

        @NotNull
        public @NotNull java.lang.String getOriginalFilename()
        Description copied from interface: FaceObject
        Get the original filename of this face.
        Specified by:
        getOriginalFilename in interface FaceObject
        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: FaceObject
        Return whether this face is an up face.
        Specified by:
        isUp in interface FaceObject
        Returns:
        upFace
      • isDouble

        public boolean isDouble()
        Description copied from interface: FaceObject
        Return whether this face is a double face.
        Specified by:
        isDouble in interface FaceObject
        Returns:
        doubleFace
      • getAlternativeFaceName

        @Nullable
        public @Nullable java.lang.String getAlternativeFaceName()
        Description copied from interface: FaceObject
        Returns the alternative face name for image.a.nnn faces.
        Specified by:
        getAlternativeFaceName in interface FaceObject
        Returns:
        the alternative face name (image.b.nnn) or null
      • getDisplayIconName

        @NotNull
        public @NotNull java.lang.String getDisplayIconName()
        Description copied from interface: NamedObject
        Returns the face name of the display icon for this AbstractNamedObject.
        Specified by:
        getDisplayIconName in interface NamedObject
        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:
        compareTo in interface java.lang.Comparable<NamedObject>
        Overrides:
        compareTo in class AbstractNamedObject
      • equals

        public boolean equals​(@Nullable
                              @Nullable java.lang.Object obj)
        Overrides:
        equals in class AbstractNamedObject