20 package net.sf.gridarta.model.mapmodel;
22 import org.jetbrains.annotations.NotNull;
23 import org.jetbrains.annotations.Nullable;
57 throw new IllegalArgumentException(
"map file is empty");
59 if (
name.contains(
"/")) {
60 throw new IllegalArgumentException(
"map file contains '/': " +
name);
62 if (
name.equals(
".")) {
64 }
else if (
name.equals(
"..")) {
65 if (parent.path.isEmpty()) {
67 }
else if (parent.path.endsWith(
"/..") || parent.path.equals(
"..")) {
68 path = parent.path +
"/..";
70 final int index = parent.path.lastIndexOf(
'/');
71 path = index == -1 ?
"" : parent.path.substring(0, index);
74 path = parent.path.isEmpty() ?
name : parent.path +
"/" +
name;
87 final int index =
path.indexOf(
'/', 1);
88 return index == -1 ? null :
path.substring(0, index);
99 return path.compareTo(o.path);
103 public boolean equals(@Nullable
final Object obj) {
104 if (obj ==
null || getClass() != obj.getClass()) {
113 return path.hashCode();