@Test public void testIC3NetworkLatency() { NetworkLatency nl = new NetworkLatency.IC3NetworkLatency(); Node a0 = new Node(new Random(0), new NodeBuilder()); Node a00 = new Node(new Random(0), new NodeBuilder()); Assert.assertEquals(NetworkLatency.IC3NetworkLatency.S10 / 2, nl.getLatency(a0, a00, 0)); NodeBuilder nb = new NodeBuilder() { @Override public int getX(int rdi) { return Node.MAX_X / 2; } @Override public int getY(int rdi) { return Node.MAX_Y / 2; } }; Node a1 = new Node(new Random(0), nb); Assert.assertEquals(NetworkLatency.IC3NetworkLatency.SW / 2, nl.getLatency(a0, a1, 0)); Assert.assertEquals(NetworkLatency.IC3NetworkLatency.SW / 2, nl.getLatency(a1, a0, 0)); }
protected int getLatency(Node from, Node to, int delta) { if (from == to) { return 1; } int base = from.extraLatency + to.extraLatency; base += getExtendedLatency(from, to, delta); return Math.max(1, base); }
NetworkLatency { protected int getLatency(Node from, Node to, int delta) { if (from == to) { return 1; } int base = from.extraLatency + to.extraLatency; base += getExtendedLatency(from, to, delta); return Math.max(1, base); } }
NetworkLatency { protected int getLatency(Node from, Node to, int delta) { if (from == to) { return 1; } int base = from.extraLatency + to.extraLatency; base += getExtendedLatency(from, to, delta); return Math.max(1, base); }  }
NetworkLatency { protected int getLatency(Node from, Node to, int delta) { if (from == to) { return 1; } int base = from.extraLatency + to.extraLatency; base += getExtendedLatency(from, to, delta); return Math.max(1, base); }  @Override String toString(); static MeasuredNetworkLatency estimateLatency(Network net, final int rounds); static MeasuredNetworkLatency estimateP2PLatency(P2PNetwork<?> net, final int rounds); static MeasuredNetworkLatency estimateLatency(
      Network net, PeerGetter pg, final int rounds); }
NetworkLatency { protected int getLatency(Node from, Node to, int delta) { if (from == to) { return 1; } int base = from.extraLatency + to.extraLatency; base += getExtendedLatency(from, to, delta); return Math.max(1, base); }  @Override String toString(); static MeasuredNetworkLatency estimateLatency(Network net, final int rounds); static MeasuredNetworkLatency estimateP2PLatency(P2PNetwork<?> net, final int rounds); static MeasuredNetworkLatency estimateLatency(
      Network net, PeerGetter pg, final int rounds);  }