Usa extends Graph { public State findStateByStateName(String s) { if (this.isEmpty()){ System.out.println("Your list is empty"); return null; } for (int i =0; i < this.nodes.size();i++){ if (((State)this.nodes.get(i)).equalsName(s)){ return ((State) this.nodes.get(i)); } } return null; } Usa(); State findStateByState(State s); State findStateByStateName(String s); State findStateByCity(City c); ArrayList<State> getNeighbouringStates(State state, int distance); int getHops(State state, State state2); ArrayList<City> findLowestCrimeRate(ArrayList<State> states,int length); ArrayList<City> findLowestCrimeRate(int length); void addCity(String c); boolean containsState(State state); void printUSA(); static void main(String[] args); static final int FIND_STATE_BY_STATE_FLAG; static final int FIND_STATE_BY_CITY_FLAG; static final int FIND_LOWEST_CRIME_RATE_FLAG; static final int ADD_CITY_FLAG; static final int FIND_STATE_BY_STATE_NAME_FLAG; }
@Test public void testRDFSFindStateByCity(){ assertEquals(usa.findStateByStateName("New York"), NY); }