import java.awt.Color; import javax.swing.*; import java.awt.*; import java.util.*; import java.beans.*; /** {@link PropertyChangeSupport} messages:
set
fired whenever the set this room belongs to changes. The old and new objects are the old and new sets, respectively.
north, south, east, west
Boolean-values PCS messages that indicate the north, south, east, or west door has been opened, respectively.
*/ public class Room { private static int nextID = 0; private int id; private Set myset; private Room north, east, south, west; private LockPub northLock, southLock, westLock, eastLock; private PropertyChangeSupport pcs; /** Set this {@link Room}'s {@link Set} to a new {@link HashSet}; initialize PCS and the four locks ({@link LockPub}) */ public Room() { this.id = nextID++; // complete below } /** Accessor for the id */ public int getID() { return id; } /** Accessor for this {@link Room}'s PCS */ public PropertyChangeSupport getPCS() { return pcs; } /** Accessor for this Room's west {@link LockInvokable} */ public LockPub getWestLock() { return westLock; } /** Accessor for this Room's east {@link LockInvokable} */ public LockPub getEastLock() { return eastLock; } /** Accessor for this Room's north {@link LockInvokable} */ public LockPub getNorthLock() { return northLock; } /** Accessor for this Room's south {@link LockInvokable} */ public LockPub getSouthLock() { return southLock; } /** Connect now to the supplied {@link Room}; fire the PCS north signal */ public void connectNorth(Room r) { } /** Connect now to the supplied {@link Room}; fire the PCS easth signal */ public void connectEast(Room r) { } /** Connect now to the supplied {@link Room}; fire the PCS south signal */ public void connectSouth(Room r) { } /** Connect now to the supplied {@link Room}; fire the PCS west signal */ public void connectWest(Room r) { } /** Mutator for this {@link Room}'s {@link Set} ; notify via PCS, sending the old and new Set */ public void setSet(Set newSet) { } /** Accessor for this {@link Room}'s {@link Set} */ public Set getSet() { return myset; } public String toString() { return "Room " + getID(); } }