java.lang.Object
it.polimi.ingsw.communication.sugar_framework.Room

public class Room extends Object
Represents a room in the Sugar communication protocol
  • Field Details

    • roomId

      private final UUID roomId
    • peers

      private final Set<Peer> peers
  • Constructor Details

    • Room

      public Room()
    • Room

      public Room(UUID roomId)
  • Method Details

    • addPeer

      public void addPeer(Peer peer)
      Makes the peer join into this room
      Parameters:
      peer - any peer connected to the server
    • addPeers

      public void addPeers(Collection<Peer> peers)
      Adds all peers to the room
      Parameters:
      peers - a collection of Peer(s)
    • getRoomId

      public UUID getRoomId()
    • getPeers

      public Set<Peer> getPeers()
    • remove

      public void remove(Peer peer)
      If the peer is in this room, makes the peer leave the room, otherwise it has no effect
      Parameters:
      peer - any peer
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object