예제 #1
0
  public void displayAllPeers() {
    Iterator<Peer> iterator = this.allPeers.iterator();

    while (iterator.hasNext()) {
      Peer peer = (Peer) iterator.next();
      peer.displayPeer();
    }
  }
예제 #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());
    }
  }
예제 #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;
    }
  }
예제 #4
0
 public Peer assignPeerToZone(Peer peer, Zone zone) {
   peer.setZone(zone);
   return peer;
 }