Exemplo n.º 1
0
  public void displayAllPeers() {
    Iterator<Peer> iterator = this.allPeers.iterator();

    while (iterator.hasNext()) {
      Peer peer = (Peer) iterator.next();
      peer.displayPeer();
    }
  }
Exemplo n.º 2
0
  public void displayAllZones() {
    Iterator<Peer> iterator = this.allPeers.iterator();

    while (iterator.hasNext()) {
      Peer peer = (Peer) iterator.next();
      System.out.println(peer.getZone().toString());
    }
  }
Exemplo n.º 3
0
  public Peer inWhichPeerIsThePoint(Point point) {
    boolean exist = false;
    Peer findedPeer = null;
    Iterator<Peer> iterator = this.allPeers.iterator();

    while (iterator.hasNext()) {
      Peer peer = (Peer) iterator.next();
      if (peer.isPointInThisPeer(point)) {
        exist = true;
        findedPeer = new Peer(peer.getIdPeer(), peer.getPeerTitle(), peer.getZone());
        break;
      }
    }

    if (!exist) {
      System.out.println("There is no Peer which contain this point !");
      return null;
    } else {
      return findedPeer;
    }
  }
Exemplo n.º 4
0
 public Peer assignPeerToZone(Peer peer, Zone zone) {
   peer.setZone(zone);
   return peer;
 }