Skip to content

Commit

Permalink
host creates its own packet receiver
Browse files Browse the repository at this point in the history
  • Loading branch information
keznikl authored and andranikm committed Feb 7, 2014
1 parent 8ee3359 commit f4fb72d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 12 additions & 3 deletions jdeeco-simulation/src/cz/cuni/mff/d3s/deeco/simulation/Host.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ public class Host extends PacketSender {
private final Simulation simulation;
private final String id;

protected Host(Simulation simulation, String id, int packetSize,
PacketReceiver packetReceiver) {
protected Host(Simulation simulation, String id, int packetSize) {
super(packetSize);
this.simulation = simulation;
this.id = id;
this.packetReceiver = packetReceiver;
this.packetReceiver = new PacketReceiver(packetSize);
simulation.register(this, id);
}

Expand Down Expand Up @@ -65,4 +64,14 @@ public void at(double absoluteTime) {
protected void sendPacket(byte[] packet, String recipient) {
simulation.sendPacket(id, packet, recipient);
}

public double getPositionX() {
// TODO Auto-generated method stub
return 0;
}

public double getPositionY() {
// TODO Auto-generated method stub
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public void initialize() {
*
* @return new host instance
*/
public Host getHost(String id, int packetSize, PacketReceiver packetReceiver) {
return new Host(this, id, packetSize, packetReceiver);
public Host getHost(String id, int packetSize) {
return new Host(this, id, packetSize);
}

// Wrapper methods we may need them.
Expand Down

0 comments on commit f4fb72d

Please sign in to comment.