@Test public void getPwPairsSortedByRankWorks() { PhysicalWebCollection physicalWebCollection = new PhysicalWebCollection(); addPair(physicalWebCollection, ID1, URL1, null); addPair(physicalWebCollection, ID2, URL2, null); addPair(physicalWebCollection, ID3, URL2, null); List<PwPair> pwPairs = physicalWebCollection.getPwPairsSortedByRank(testComparator); assertEquals(pwPairs.size(), 2); assertEquals(pwPairs.get(0).getUrlDevice().getId(), ID1); assertEquals(pwPairs.get(1).getUrlDevice().getId(), ID2); }
public List<PwPair> getPwPairsSortedByRank(Comparator<PwPair> comparator) { List<PwPair> allPwPairs = getPwPairs(); Collections.sort(allPwPairs, comparator); return removeDuplicateSiteUrls(allPwPairs); }
PhysicalWebCollection { public List<PwPair> getPwPairsSortedByRank(Comparator<PwPair> comparator) { List<PwPair> allPwPairs = getPwPairs(); Collections.sort(allPwPairs, comparator); return removeDuplicateSiteUrls(allPwPairs); } }
PhysicalWebCollection { public List<PwPair> getPwPairsSortedByRank(Comparator<PwPair> comparator) { List<PwPair> allPwPairs = getPwPairs(); Collections.sort(allPwPairs, comparator); return removeDuplicateSiteUrls(allPwPairs); } PhysicalWebCollection(); }
PhysicalWebCollection { public List<PwPair> getPwPairsSortedByRank(Comparator<PwPair> comparator) { List<PwPair> allPwPairs = getPwPairs(); Collections.sort(allPwPairs, comparator); return removeDuplicateSiteUrls(allPwPairs); } PhysicalWebCollection(); boolean addUrlDevice(UrlDevice urlDevice); void removeUrlDevice(UrlDevice urlDevice); void addMetadata(PwsResult pwsResult); void addIcon(String url, byte[] icon); void clear(); byte[] getIcon(String url); UrlDevice getUrlDeviceById(String id); PwsResult getMetadataByBroadcastUrl(String broadcastUrl); List<UrlDevice> getUrlDevices(); JSONObject jsonSerialize(); static PhysicalWebCollection jsonDeserialize(JSONObject jsonObject); List<PwPair> getPwPairsSortedByRank(Comparator<PwPair> comparator); List<PwPair> getGroupedPwPairsSortedByRank(Comparator<PwPair> comparator); List<PwPair> getPwPairs(); PwPair getTopRankedPwPairByGroupId(String groupId, Comparator<PwPair> comparator); void setPwsEndpoint(String pwsEndpoint, int pwsApiVersion); void setPwsEndpoint(String pwsEndpoint, int pwsApiVersion, String pwsApiKey); void fetchPwsResults(final PwsResultCallback pwsResultCallback,
                              final PwsResultIconCallback pwsResultIconCallback); void cancelAllRequests(); }
PhysicalWebCollection { public List<PwPair> getPwPairsSortedByRank(Comparator<PwPair> comparator) { List<PwPair> allPwPairs = getPwPairs(); Collections.sort(allPwPairs, comparator); return removeDuplicateSiteUrls(allPwPairs); } PhysicalWebCollection(); boolean addUrlDevice(UrlDevice urlDevice); void removeUrlDevice(UrlDevice urlDevice); void addMetadata(PwsResult pwsResult); void addIcon(String url, byte[] icon); void clear(); byte[] getIcon(String url); UrlDevice getUrlDeviceById(String id); PwsResult getMetadataByBroadcastUrl(String broadcastUrl); List<UrlDevice> getUrlDevices(); JSONObject jsonSerialize(); static PhysicalWebCollection jsonDeserialize(JSONObject jsonObject); List<PwPair> getPwPairsSortedByRank(Comparator<PwPair> comparator); List<PwPair> getGroupedPwPairsSortedByRank(Comparator<PwPair> comparator); List<PwPair> getPwPairs(); PwPair getTopRankedPwPairByGroupId(String groupId, Comparator<PwPair> comparator); void setPwsEndpoint(String pwsEndpoint, int pwsApiVersion); void setPwsEndpoint(String pwsEndpoint, int pwsApiVersion, String pwsApiKey); void fetchPwsResults(final PwsResultCallback pwsResultCallback,
                              final PwsResultIconCallback pwsResultIconCallback); void cancelAllRequests();  }