20 package net.sf.gridarta.model.face;
22 import java.util.regex.Matcher;
23 import java.util.regex.Pattern;
26 import org.jetbrains.annotations.NotNull;
27 import org.jetbrains.annotations.Nullable;
98 private final boolean isUp;
117 public DefaultFaceObject(@NotNull
final String faceName, @NotNull
final String originalFilename,
final int offset,
final int size) {
118 super(originalFilename);
123 isUp = faceName.contains(
".u.");
124 isDouble = faceName.contains(
".d.");
125 final Matcher matcher = ALTERNATIVE_FACE_NAME_PATTERN.matcher(faceName);
126 alternativeFaceName = matcher.find() ? matcher.replaceFirst(
".b.").intern() : null;
197 final boolean iAmBug = faceName.equals(
"bug.111") || faceName.equals(
"bug.101");
198 final boolean otherIsBug = o.getName().equals(
"bug.111") || o.getName().equals(
"bug.101");
199 if (iAmBug && otherIsBug) {
208 return super.compareTo(o);
213 return faceName.hashCode() ^ super.hashCode();
217 public boolean equals(@Nullable
final Object obj) {
221 if (obj == null || obj.getClass() != getClass()) {
225 return faceName.
equals(defaultFaceObject.
faceName) && super.equals(obj);
final boolean isDouble
Whether this face is a "double" face.
String getDisplayIconName()
Returns the face name of the display icon for this AbstractNamedObject.
The data package contains classes for handling data that is organized in a tree.
static final long serialVersionUID
The serial version UID.
Common interface for FaceObject.
final int size
The size in the file the face was loaded from.
final int offset
The offset in the file the face was loaded from.
static final Pattern ALTERNATIVE_FACE_NAME_PATTERN
A Pattern matching face names having alternative face names.
int compareTo(@NotNull final NamedObject o)
Overridden to sort bug.101 and bug.111 before all other faces.
boolean equals(@Nullable final Object obj)
Base package of all Gridarta classes.
final boolean isUp
Whether this face is an "up" face.
String getAlternativeFaceName()
Returns the alternative face name for image.a.nnn faces.
int getOffset()
Get the offset of this face in the actualFilename.
final String alternativeFaceName
The alternative face name for image.a.nnn faces.
final String faceName
The face name.
int getSize()
Get the size of this face in the actualFilename.
boolean isUp()
Return whether this face is an up face.
boolean isDouble()
Return whether this face is a double face.
String getOriginalFilename()
Get the original filename of this face.
A FaceObject stores information and meta information about a face and provides methods for accessing ...
final String originalFilename
The filename the face originally came from (origin location).
DefaultFaceObject(@NotNull final String faceName, @NotNull final String originalFilename, final int offset, final int size)
Create a FaceObject.