/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
* @version 1.0
*/
public class IterableSynonymyList implements Iterable<TaxonBase> {
-
+
private Taxon taxon;
/**
*
* @return a {@link java.util.Iterator} object.
*/
- public Iterator<TaxonBase> iterator() {
+ @Override
+ public Iterator<TaxonBase> iterator() {
return new TaxonIterator(taxon);
}
-
+
class TaxonIterator implements Iterator<TaxonBase> {
List<TaxonBase> synonymyList;
int index = 0;
-
+
public TaxonIterator(Taxon taxon) {
synonymyList = new ArrayList<TaxonBase>();
HomotypicalGroup homotypicGroup = taxon.getHomotypicGroup();
-
+
if (homotypicGroup != null) {
List<Synonym> homotypicSynonyms = taxon.getSynonymsInGroup(homotypicGroup);
for (Synonym synonym : homotypicSynonyms) {
}
}
}
-
+
List<HomotypicalGroup> heterotypicGroups = taxon.getHeterotypicSynonymyGroups();
for (HomotypicalGroup heterotypicGroup : heterotypicGroups) {
-
+
// Make sure this is not the taxon's homotypic group
if (!heterotypicGroup.equals(homotypicGroup)) {
-
+
List<Synonym> heterotypicSynonyms = taxon.getSynonymsInGroup(heterotypicGroup);
for (Synonym synonym : heterotypicSynonyms) {
}
}
}
-
- Set<Taxon> misappliedNames = taxon.getMisappliedNames();
+
+ Set<Taxon> misappliedNames = taxon.getMisappliedNames(true);
for (Taxon misappliedName : misappliedNames) {
synonymyList.add(misappliedName);
}
-
+
}
- public boolean hasNext() {
+ @Override
+ public boolean hasNext() {
if (synonymyList.size() == index) {
return false;
}
return true;
}
- public TaxonBase next() {
+ @Override
+ public TaxonBase next() {
TaxonBase next = synonymyList.get(index);
index++;
return next;
}
- public void remove() {}
+ @Override
+ public void remove() {}
}
}