From cb479767593be781b3295ca67979d6be375153e3 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Mon, 2 Dec 2024 19:03:09 -0500 Subject: combine replica2.City and replica3.City --- src/main/java/derms/replica2/City.java | 38 ---------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 src/main/java/derms/replica2/City.java (limited to 'src/main/java/derms/replica2/City.java') diff --git a/src/main/java/derms/replica2/City.java b/src/main/java/derms/replica2/City.java deleted file mode 100644 index a5a2f4c..0000000 --- a/src/main/java/derms/replica2/City.java +++ /dev/null @@ -1,38 +0,0 @@ -package derms.replica2; - -import java.io.Serializable; - -public class City implements Serializable { - static final int codeLen = 3; - - private String code; - - City(String code) throws IllegalArgumentException { - if (code.length() != codeLen) - throw new IllegalArgumentException("Invalid city: "+code+"; must be "+codeLen+" letters"); - this.code = code; - } - - public City() { - this("XXX"); - } - - @Override - public String toString() { - return code; - } - - @Override - public boolean equals(Object obj) { - if (obj == null || this.getClass() != obj.getClass()) { - return false; - } - City other = (City) obj; - return this.code.equals(other.code); - } - - @Override - public int hashCode() { - return code.hashCode(); - } -} -- cgit v1.2.3