@Test public void testSortedList(){ setupTestNodes(); List<FullNode> fullNodeList = latencyNodeProvider.getSortedNodes(); Assert.assertSame(nodeC, fullNodeList.get(0)); Assert.assertSame(nodeB, fullNodeList.get(1)); Assert.assertSame(nodeA, fullNodeList.get(2)); }
@Override public List<FullNode> getSortedNodes() { FullNode[] nodeArray = mFullNodeHeap.toArray(new FullNode[mFullNodeHeap.size()]); ArrayList<FullNode> nodeList = new ArrayList<>(); for(FullNode fullNode : nodeList){ if(fullNode != null){ nodeList.add(fullNode); } } Collections.sort(nodeList); return Arrays.asList(nodeArray); }
LatencyNodeProvider implements NodeProvider { @Override public List<FullNode> getSortedNodes() { FullNode[] nodeArray = mFullNodeHeap.toArray(new FullNode[mFullNodeHeap.size()]); ArrayList<FullNode> nodeList = new ArrayList<>(); for(FullNode fullNode : nodeList){ if(fullNode != null){ nodeList.add(fullNode); } } Collections.sort(nodeList); return Arrays.asList(nodeArray); } }
LatencyNodeProvider implements NodeProvider { @Override public List<FullNode> getSortedNodes() { FullNode[] nodeArray = mFullNodeHeap.toArray(new FullNode[mFullNodeHeap.size()]); ArrayList<FullNode> nodeList = new ArrayList<>(); for(FullNode fullNode : nodeList){ if(fullNode != null){ nodeList.add(fullNode); } } Collections.sort(nodeList); return Arrays.asList(nodeArray); } LatencyNodeProvider(); }
LatencyNodeProvider implements NodeProvider { @Override public List<FullNode> getSortedNodes() { FullNode[] nodeArray = mFullNodeHeap.toArray(new FullNode[mFullNodeHeap.size()]); ArrayList<FullNode> nodeList = new ArrayList<>(); for(FullNode fullNode : nodeList){ if(fullNode != null){ nodeList.add(fullNode); } } Collections.sort(nodeList); return Arrays.asList(nodeArray); } LatencyNodeProvider(); @Override FullNode getBestNode(); @Override void addNode(FullNode fullNode); @Override boolean updateNode(FullNode fullNode); boolean updateNode(FullNode fullNode, int latency); @Override List<FullNode> getSortedNodes(); }
LatencyNodeProvider implements NodeProvider { @Override public List<FullNode> getSortedNodes() { FullNode[] nodeArray = mFullNodeHeap.toArray(new FullNode[mFullNodeHeap.size()]); ArrayList<FullNode> nodeList = new ArrayList<>(); for(FullNode fullNode : nodeList){ if(fullNode != null){ nodeList.add(fullNode); } } Collections.sort(nodeList); return Arrays.asList(nodeArray); } LatencyNodeProvider(); @Override FullNode getBestNode(); @Override void addNode(FullNode fullNode); @Override boolean updateNode(FullNode fullNode); boolean updateNode(FullNode fullNode, int latency); @Override List<FullNode> getSortedNodes();  }