package edu.miamioh.cse283.htw;

public class RoomCollection {
	private Room[] rooms;

	public RoomCollection() {
		rooms = new Room[20];
		for (int i = 0; i < 20; i++) {
			rooms[i] = new Room(i + 1);
		}

		for (int i = 0; i < 19; i++) {
			rooms[i].addBidirectionalConnection(rooms[i + 1]);
		}

		rooms[0].addBidirectionalConnection(rooms[19]);
	}

	public Room get(int roomNumber) {
		return rooms[roomNumber - 1];
	}

	public int[] getAdjacentRooms(Room test) {
		Room[] adjacentRooms = test.getConnections();
		int[] adjacentNumbers = new int[adjacentRooms.length];

		for (int i = 0; i < adjacentRooms.length; i++) {
			adjacentNumbers[i] = adjacentRooms[i].getNumber();
		}

		return adjacentNumbers;
	}
}

@@ -369,73 +369,433 @@
 %0A%0D%0A%09
-public Room get(int roomNumber) %7B%0D%0A%09%09return rooms%5BroomNumber - 1%5D
+/**%0D%0A%09 * Returns the %7B@link edu.miamioh.cse283.htw.Room%7D with the given number%0D%0A%09 *%0D%0A%09 * @param roomNumber the number to search for in this RoomCollection%0D%0A%09 * @return the first %7B@link edu.miamioh.cse283.htw.Room%7D with a number matching roomNumber, or null if one doesn't exist%0D%0A%09 */%0D%0A%09public Room get(int roomNumber) %7B%0D%0A%09%09for (Room r : rooms) %7B%0D%0A%09%09%09if (r.getNumber() == roomNumber) %7B%0D%0A%09%09%09%09return r;%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%09return null
 ;%0D%0A%09

update implementation of RoomCollection.get