/* * (non-Javadoc) * * @see * org.LexGrid.LexBIG.Utility.Iterators.EntityListIterator#numberRemaining() */ public int numberRemaining() throws LBResourceUnavailableException { int number = 0; for (ResolvedConceptReferencesIterator itr : _iterators) { number += itr.numberRemaining(); } return number; }
/* * (non-Javadoc) * * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ public int compare( ResolvedConceptReferencesIterator itr1, ResolvedConceptReferencesIterator itr2) { try { return itr2.numberRemaining() - itr1.numberRemaining(); } catch (LBResourceUnavailableException e) { throw new RuntimeException(e); } }
/** Removes the empty iterators. */ private void removeEmptyIterators() { List<ResolvedConceptReferencesIterator> newList = new ArrayList<ResolvedConceptReferencesIterator>(); for (ResolvedConceptReferencesIterator itr : _iterators) { try { if (itr.hasNext()) { newList.add(itr); } } catch (LBResourceUnavailableException e) { throw new RuntimeException(e); } } _iterators = newList; }
/** * Gets the next from list. * * @return the next from list */ private ResolvedConceptReference getNextFromList() { try { while (hasNext()) { int iterator = _currentIterator % _iterators.size(); ResolvedConceptReferencesIterator itr = _iterators.get(iterator); if (itr.hasNext()) { _currentIterator++; return itr.next(); } else { _currentIterator++; } } return null; } catch (Exception e) { throw new RuntimeException(e); } }
/* * (non-Javadoc) * * @see org.LexGrid.LexBIG.Utility.Iterators.EntityListIterator#release() */ public void release() throws LBResourceUnavailableException { for (ResolvedConceptReferencesIterator itr : _iterators) { itr.release(); } }