cleanup
authorAndreas Müller <a.mueller@bgbm.org>
Tue, 23 Feb 2021 15:04:53 +0000 (16:04 +0100)
committerAndreas Müller <a.mueller@bgbm.org>
Tue, 23 Feb 2021 17:20:31 +0000 (18:20 +0100)
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/DoubleResult.java
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/cdmLight/CdmLightClassificationExport.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/PresenceAbsenceTerm.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/TagEnum.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/TaggedCacheHelper.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/TaggedText.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/utility/DescriptionUtility.java

index 8d63e1bd3878e6aeb7ffd465431cc9ac50f66b02..0c18ba3f56bd2f06a394fbb3011d4c811604a38d 100644 (file)
@@ -1,64 +1,48 @@
 /**\r
 * Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
 * http://www.e-taxonomy.eu\r
-* \r
+*\r
 * The contents of this file are subject to the Mozilla Public License Version 1.1\r
 * See LICENSE.TXT at the top of this package for the full license terms.\r
 */\r
-\r
 package eu.etaxonomy.cdm.common;\r
 \r
 import org.apache.log4j.Logger;\r
 \r
 /**\r
  * An instance of this class represents an method result that contains 2 variables. The variables may be typified.\r
+ *\r
  * @author a.mueller\r
  * @since 30.10.2008\r
- * @version 1.0\r
  */\r
 public class DoubleResult<S extends Object, T extends Object> {\r
        private static final Logger logger = Logger.getLogger(DoubleResult.class);\r
-       \r
+\r
        private S firstResult = null;\r
        private T secondResult = null;\r
-       \r
+\r
        public DoubleResult() {\r
                if (logger.isDebugEnabled()){logger.debug("Constructor");}\r
        }\r
 \r
-       \r
+\r
        public DoubleResult(S firstResult, T secondResult) {\r
                this.firstResult = firstResult;\r
                this.secondResult = secondResult;\r
        }\r
 \r
-       /**\r
-        * @return the firstResult\r
-        */\r
        public S getFirstResult() {\r
                return firstResult;\r
        }\r
-\r
-       /**\r
-        * @param firstResult the firstResult to set\r
-        */\r
        public void setFirstResult(S firstResult) {\r
                this.firstResult = firstResult;\r
        }\r
 \r
-       /**\r
-        * @return the secondResult\r
-        */\r
        public T getSecondResult() {\r
                return secondResult;\r
        }\r
-\r
-       /**\r
-        * @param secondResult the secondResult to set\r
-        */\r
        public void setSecondResult(T secondResult) {\r
                this.secondResult = secondResult;\r
        }\r
-       \r
-}\r
+}
\ No newline at end of file
index 06b1501c13798f50c6e54b39b962806d2470f1a5..c523b13a5ed9259749ba4cb0f81fdc4b66f1b6d7 100755 (executable)
@@ -810,23 +810,21 @@ public class CdmLightClassificationExport
             }
         }
          if(state.getConfig().isCreateCondensedDistributionString()){
-             List<Language> langs = new ArrayList<Language>();
+             List<Language> langs = new ArrayList<>();
              langs.add(Language.ENGLISH());
 
              CondensedDistribution conDis =
              geoService.getCondensedDistribution(distributions, true,
-             null,null,state.getConfig().getCondensedDistributionRecipe(), langs
-             );
+             null,null,state.getConfig().getCondensedDistributionRecipe(), langs);
              CdmLightExportTable tableCondensed =
-             CdmLightExportTable.CONDENSED_DISTRIBUTION_FACT;
+                     CdmLightExportTable.CONDENSED_DISTRIBUTION_FACT;
              String[] csvLine = new String[table.getSize()];
              csvLine[tableCondensed.getIndex(CdmLightExportTable.TAXON_FK)] =
-             getId(state, taxon);
+                     getId(state, taxon);
              csvLine[tableCondensed.getIndex(CdmLightExportTable.FACT_TEXT)] =
-             conDis.toString();
+                     conDis.toString();
              state.getProcessor().put(tableCondensed, taxon, csvLine);
          }
-
     }
 
     private void handleCommonNameFacts(CdmLightExportState state, Taxon taxon,
index 3860e093535c89cf20748cb6915034f13e1c9a33..e648583136b47a2779c7b1ff6571e110f0ec4cb4 100644 (file)
@@ -88,7 +88,7 @@ public class PresenceAbsenceTerm extends OrderedTermBase<PresenceAbsenceTerm> {
        public static final UUID uuidIntroduced = UUID.fromString("643cf9d1-a5f1-4622-9837-82ef961e880b");
        private static final UUID uuidIntroducedDoubtfullyIntroduced = UUID.fromString("0c54761e-4887-4788-9dfa-7190c88746e3");
        public static final UUID uuidIntroducedUncertainDegreeNaturalisation = UUID.fromString("da159544-b0dd-4599-a9c9-640826af8c17");
-       public static final UUID uuidIntroducesAdventitious = UUID.fromString("42946bd6-9c22-45ad-a910-7427e8f60bfd");
+       public static final UUID uuidIntroducedAdventitious = UUID.fromString("42946bd6-9c22-45ad-a910-7427e8f60bfd");
        public static final UUID uuidNaturalised = UUID.fromString("e191e89a-a751-4b0c-b883-7f1de70915c9");
        private static final UUID uuidIntroducedCultiated = UUID.fromString("fac8c347-8262-44a1-b0a4-db4de451c021");
        private static final UUID uuidEndemic = UUID.fromString("c3ee7048-15b7-4be1-b687-9ce9c1a669d6");
@@ -369,7 +369,7 @@ public class PresenceAbsenceTerm extends OrderedTermBase<PresenceAbsenceTerm> {
      * @see #INTRODUCED_ADVENTITIOUS()
      */
     public static final PresenceAbsenceTerm CASUAL(){
-        return getTermByUuid(uuidIntroducesAdventitious);
+        return getTermByUuid(uuidIntroducedAdventitious);
     }
     /**
      * Casual alien, presence questionable
@@ -404,7 +404,7 @@ public class PresenceAbsenceTerm extends OrderedTermBase<PresenceAbsenceTerm> {
         */
        @Deprecated
        public static final PresenceAbsenceTerm INTRODUCED_ADVENTITIOUS(){
-               return getTermByUuid(uuidIntroducesAdventitious);
+               return getTermByUuid(uuidIntroducedAdventitious);
        }
 
        public static final PresenceAbsenceTerm INTRODUCED_CULTIVATED(){
index a2ae24520910bdeaa8f50154b6f7566e4e4deb14..69b1457c218c98c621ba2466fd05fe686567ae3b 100644 (file)
@@ -139,6 +139,9 @@ public enum TagEnum {
        public boolean isNomStatus(){
                return this == nomStatus;
        }
+       /**
+        * @return <code>true</code> if type is separator or postSeparator
+        */
        public boolean isSeparator(){
                return this == separator || this == postSeparator;
        }
index f9ed7cab2b3cc5b3e6fd6415f027ea366d94e352..211f6c01d817f448b5dde9f1daa2885ec34ed40a 100644 (file)
@@ -27,7 +27,7 @@ public class TaggedCacheHelper {
      * @return the concatenated string
      * @see #createString(List, HTMLTagRules)
      */
-    public static String createString(List<TaggedText> tags) {
+    public static String createString(List<? extends TaggedText> tags) {
         StringBuilder result = new StringBuilder();
 
         boolean isSeparator;
@@ -77,7 +77,7 @@ public class TaggedCacheHelper {
         //create String
         StringBuffer result = new StringBuffer();
 
-        Stack<String> htmlStack = new Stack<String>();
+        Stack<String> htmlStack = new Stack<>();
         for (int i = 0;  i < tags.size(); i++  ){
             TaggedText tag = tags.get(i);
             TagEnum thisType = tag.getType();
@@ -85,9 +85,6 @@ public class TaggedCacheHelper {
             TagEnum nextType = (i + 1 >= tags.size() ? null : tags.get(i + 1).getType());
 
             boolean isSeparator = tag.getType().isSeparator();
-//            boolean lastEqual = tag.getType().equals(lastType);
-//            boolean nextEqual = tag.getType().equals(nextType);
-//            boolean bothEqual = lastEqual && nextEqual;
 
             //compute list of rules (tags)
             SortedSet<String> separatorRules;
@@ -143,4 +140,4 @@ public class TaggedCacheHelper {
         }
         return result;
     }
-}
+}
\ No newline at end of file
index a807375965f10cd293e2d0248f6147edeb7d1a64..360476e643c5d2af817cb9539670f0eb07e214de 100644 (file)
@@ -16,7 +16,6 @@ import eu.etaxonomy.cdm.common.CdmUtils;
 import eu.etaxonomy.cdm.ref.TypedEntityReference;
 
 /**
- *
  * @author a.kohlbecker
  * @author m.doering
  * @since 11.12.2007
index 5b11205f13d6bc9699ba009d9f251955c0718801..17fa00409f115eaa3878c2fb07500502a436a04a 100644 (file)
@@ -90,7 +90,7 @@ public class DescriptionUtility {
             Set<MarkerType> hiddenAreaMarkerTypes, boolean preferAggregated, boolean statusOrderPreference,
             boolean subAreaPreference) {
 
-        SetMap<NamedArea, Distribution> filteredDistributions = new SetMap<>(100); // start with a big map from the beginning!
+        SetMap<NamedArea, Distribution> filteredDistributions = new SetMap<>(distributions.size());
 
         // sort Distributions by the area
         for(Distribution distribution : distributions){
@@ -152,12 +152,13 @@ public class DescriptionUtility {
 
     private static void handleHiddenAndFallbackAreas(Set<MarkerType> hiddenAreaMarkerTypes,
             SetMap<NamedArea, Distribution> filteredDistributions) {
+
         Set<NamedArea> areasHiddenByMarker = new HashSet<>();
         for(NamedArea area : filteredDistributions.keySet()) {
             if(checkAreaMarkedHidden(hiddenAreaMarkerTypes, area)) {
                 boolean showAsFallbackArea = false;
                 // if at least one sub area is not hidden by a marker
-                // this area is a fall-back area for this sub area
+                // the given area is a fall-back area for this sub area
                 for(NamedArea subArea : area.getIncludes()) {
                     if (!areasHiddenByMarker.contains(subArea) && checkAreaMarkedHidden(hiddenAreaMarkerTypes, subArea)) {
                         if(filteredDistributions.containsKey(subArea)) {