public void displayAllPeers() { Iterator<Peer> iterator = this.allPeers.iterator(); while (iterator.hasNext()) { Peer peer = (Peer) iterator.next(); peer.displayPeer(); } }
public void displayAllZones() { Iterator<Peer> iterator = this.allPeers.iterator(); while (iterator.hasNext()) { Peer peer = (Peer) iterator.next(); System.out.println(peer.getZone().toString()); } }
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; } }
public Peer assignPeerToZone(Peer peer, Zone zone) { peer.setZone(zone); return peer; }