summaryrefslogtreecommitdiffstats
path: root/src/main/java/derms/replica/replica2/ResourceID.java
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2024-11-28 17:32:28 -0500
committerSam Anthony <sam@samanthony.xyz>2024-11-28 17:32:28 -0500
commitd267dd1dda606f0c56d8afaa7187485e60ebfd86 (patch)
treee1bca5933aa7e5e9793773057fd5616ff65a9eb8 /src/main/java/derms/replica/replica2/ResourceID.java
parent6654546671eea9f9becd32b3160a134802659cbc (diff)
downloadsoen423-d267dd1dda606f0c56d8afaa7187485e60ebfd86.zip
move replica2 to top level
Diffstat (limited to 'src/main/java/derms/replica/replica2/ResourceID.java')
-rw-r--r--src/main/java/derms/replica/replica2/ResourceID.java49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/main/java/derms/replica/replica2/ResourceID.java b/src/main/java/derms/replica/replica2/ResourceID.java
deleted file mode 100644
index d4cc4cf..0000000
--- a/src/main/java/derms/replica/replica2/ResourceID.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package derms.replica.replica2;
-
-import java.io.Serializable;
-
-class ResourceID implements Serializable {
- String city;
- short num;
-
- ResourceID (String city, short num) {
- this.city = city;
- this.num = num;
- }
-
- ResourceID() {
- this("XXX", (short) 1111);
- }
-
- static ResourceID parse(String s) throws IllegalArgumentException {
- if (s.length() != City.codeLen+ID.nDigits) {
- throw new IllegalArgumentException("invalid resource ID: "+s);
- }
- try {
- String cityCode = s.substring(0, City.codeLen);
- short num = Short.parseShort(s.substring(City.codeLen));
- return new ResourceID(cityCode, num);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("invalid resource ID: "+e.getMessage());
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null || obj.getClass() != this.getClass()) {
- return false;
- }
- ResourceID other = (ResourceID) obj;
- return (this.city.equals(other.city)) && (this.num == other.num);
- }
-
- @Override
- public int hashCode() {
- return city.hashCode() * num;
- }
-
- @Override
- public String toString() {
- return city+num;
- }
-}