/** * Clears this {@link ListOf} if not empty and then adds all elements in * the given {@link List} to this {@link ListOf}. * * @param listOf the list that contain all the elements to add to this {@link ListOf} */ public void setListOf(List<T> listOf) { if (!this.listOf.isEmpty()) { this.clear(); } if ((listOf != null) && (listOf.size() > 0)) { this.addAll(listOf); } }
/** * Merges listOfSpeciesFeature and listOfSubListOfSpeciesFeatures into one combined ListOf<ListOfSpeciesFeatureContent>. * * <p>At the moment the file order is not kept and {@link SpeciesFeature}s are put first, * followed by any {@link SubListOfSpeciesFeature}s. * * @return a combined ListOf containing all {@link SpeciesFeature}s and {@link SubListOfSpeciesFeature}s. */ private ListOf<ListOfSpeciesFeatureContent> getCombinedListOfSpeciesFeatures() { ListOf<ListOfSpeciesFeatureContent> combinedListOfSpeciesFeatures = new ListOf<ListOfSpeciesFeatureContent>(); combinedListOfSpeciesFeatures.setPackageVersion(-1); combinedListOfSpeciesFeatures.setSBaseListType(Type.other); combinedListOfSpeciesFeatures.setPackageName(null); combinedListOfSpeciesFeatures.setPackageName(MultiConstants.shortLabel); combinedListOfSpeciesFeatures.setOtherListName(MultiConstants.listOfSpeciesFeatures); // We cannot register the list as otherwise the ids would be registered and would create exceptions // if (isSetExtendedSBase()) { // extendedSBase.registerChild(combinedListOfSpeciesFeatures); // } if (isSetListOfSpeciesFeatures()) { combinedListOfSpeciesFeatures.addAll(getListOfSpeciesFeatures()); } if (isSetListOfSubListOfSpeciesFeatures()) { combinedListOfSpeciesFeatures.addAll(getListOfSubListOfSpeciesFeatures()); } return combinedListOfSpeciesFeatures; }