@Override public IList<ISpecies> getMicroSpecies() { final IList<ISpecies> retVal = GamaListFactory.create(Types.SPECIES); retVal.addAll(microSpecies.values()); final ISpecies parentSpecies = this.getParentSpecies(); if (parentSpecies != null) { retVal.addAll(parentSpecies.getMicroSpecies()); } return retVal; }
/** * Returns a micro-species with the specified name or null otherwise. * * @param microSpeciesName * @return a species or null */ @Override public ISpecies getMicroSpecies(final String microSpeciesName) { final ISpecies retVal = microSpecies.get(microSpeciesName); if (retVal != null) { return retVal; } final ISpecies parentSpecies = this.getParentSpecies(); if (parentSpecies != null) { return parentSpecies.getMicroSpecies(microSpeciesName); } return null; }
@Override public ISpecies getParentSpecies() { if (parentSpecies == null) { final TypeDescription parentSpecDesc = getDescription().getParent(); // Takes care of invalid species (see Issue 711) if (parentSpecDesc == null || parentSpecDesc == getDescription()) { return null; } ISpecies currentMacroSpec = this.getMacroSpecies(); while (currentMacroSpec != null && parentSpecies == null) { parentSpecies = currentMacroSpec.getMicroSpecies(parentSpecDesc.getName()); currentMacroSpec = currentMacroSpec.getMacroSpecies(); } } return parentSpecies; }