-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Timeline customization import/export
- Loading branch information
Showing
10 changed files
with
331 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
timelines/src/main/java/gg/xp/xivsupport/timelines/TimelineCustomizationExport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package gg.xp.xivsupport.timelines; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class TimelineCustomizationExport { | ||
public Map<Long, TimelineCustomizations> timelineCustomizations; | ||
|
||
public static TimelineCustomizationExport empty() { | ||
TimelineCustomizationExport out = new TimelineCustomizationExport(); | ||
out.timelineCustomizations = new HashMap<>(); | ||
return out; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
timelines/src/main/java/gg/xp/xivsupport/timelines/ZoneTimelineDescription.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package gg.xp.xivsupport.timelines; | ||
|
||
import gg.xp.xivdata.data.*; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.Objects; | ||
|
||
public final class ZoneTimelineDescription { | ||
private final long zoneId; | ||
private final @Nullable String filename; | ||
private final @Nullable String dutyName; | ||
|
||
public ZoneTimelineDescription( | ||
long zoneId, | ||
@Nullable String filename | ||
) { | ||
this.zoneId = zoneId; | ||
this.dutyName = ZoneLibrary.capitalizedNameForZone((int) zoneId); | ||
this.filename = filename; | ||
} | ||
|
||
public String getDescription() { | ||
if (filename == null) { | ||
if (dutyName == null) { | ||
return "zone %s".formatted(zoneId); | ||
} | ||
else { | ||
return "duty '%s' (zone %s)".formatted(dutyName, zoneId); | ||
} | ||
} | ||
else { | ||
if (dutyName == null) { | ||
return "timeline '%s' (zone %s)".formatted(filename, zoneId); | ||
} | ||
else { | ||
return "duty '%s' (timeline '%s', zone '%s')".formatted(dutyName, filename, zoneId); | ||
} | ||
} | ||
} | ||
|
||
public long getZoneId() { | ||
return zoneId; | ||
} | ||
|
||
public @Nullable String getFilename() { | ||
return filename; | ||
} | ||
|
||
public @Nullable String getDutyName() { | ||
return dutyName; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj == this) return true; | ||
if (obj == null || obj.getClass() != this.getClass()) return false; | ||
var that = (ZoneTimelineDescription) obj; | ||
return this.zoneId == that.zoneId && | ||
Objects.equals(this.filename, that.filename) && | ||
Objects.equals(this.dutyName, that.dutyName); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(zoneId, filename, dutyName); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ZoneDescription[" + | ||
"zoneId=" + zoneId + ", " + | ||
"filename=" + filename + ", " + | ||
"duty=" + dutyName + ']'; | ||
} | ||
|
||
} |
Oops, something went wrong.