public class District { public static enum Type { Noble ( "noble" ), Religious ( "religious" ), Trade ( "trade" ), Military ( "military" ), Special ( "special" ); private String typename; Type( String s ) { typename = s; } public String toString() { return typename; } } public int id; public String name; public Type typ; public int cost; public int points; public String toString() { String s; s = "District " + id + ": " + name + " (" + typ.toString() + " / " + cost + " gold / " + points + " points)"; return s; } public District() { id = -1; name = ""; typ = Type.Special; } public District( String s ) { String typestr; MyStringTokenizer st = new MyStringTokenizer( s, "|" ); id = Integer.parseInt( st.nextToken() ); typestr = st.nextToken(); if (typestr.equals( "noble" )) { typ = Type.Noble; } else if (typestr.equals( "religious" )) { typ = Type.Religious; } else if (typestr.equals( "trade" )) { typ = Type.Trade; } else if (typestr.equals( "military" )) { typ = Type.Military; } else { typ = Type.Special; } name = st.nextToken(); cost = Integer.parseInt( st.nextToken() ); points = Integer.parseInt( st.nextToken() ); } }