* @author a.kohlbecker
* @since Dec 14, 2018
*/
-public abstract class AbstractEllypsisFormatter<T extends CdmBase> implements EllypsisFormatter<T> {
+public abstract class EllypsisFormatterBase<T extends CdmBase> implements EllypsisFormatter<T> {
protected static final String DELIM = " ";
protected String MORE = " \u2026";
return label.contains(MORE);
}
-
protected String titleCacheOnlyEllypsis(String titleCache, int maxCharsVisible, int minNumOfWords) {
// tokens = titleCache.split("\\s");
String head = titleCache.substring(0, Math.round(titleCache.length() / 2));
return head + StringUtils.reverse(tail);
}
-
public void applyAndSplit(LinkedList<EllipsisData> edList, String textpart, String textpartEllypsis) {
// apply on last element in list
EllipsisData last = edList.getLast();
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.format.ICdmFormatter.FormatKey;
import eu.etaxonomy.cdm.format.description.CategoricalDataFormatter;
+import eu.etaxonomy.cdm.format.description.DescriptionElementFormatter;
import eu.etaxonomy.cdm.format.description.QuantitativeDataFormatter;
import eu.etaxonomy.cdm.format.occurrences.DistanceStringFormatter;
import eu.etaxonomy.cdm.model.agent.AgentBase;
* @author m.venin
* @since 2010
*/
-public abstract class AbstractCategoricalDescriptionBuilder
- extends DescriptionBuilder<CategoricalData>{
+public abstract class CategoricalDescriptionBuilderBase
+ extends DescriptionBuilderBase<CategoricalData>{
@Override
public TextData build(CategoricalData data, List<Language> languages) {
import eu.etaxonomy.cdm.model.description.TextData;
import eu.etaxonomy.cdm.model.term.DefinedTerm;
-public class DefaultCategoricalDescriptionBuilder extends AbstractCategoricalDescriptionBuilder{
+public class DefaultCategoricalDescriptionBuilder extends CategoricalDescriptionBuilderBase{
@Override
protected TextData doBuild(List<StateData> states, List<Language> languages){
/**
* @author m.venin
*/
-public class DefaultQuantitativeDescriptionBuilder extends AbstractQuantitativeDescriptionBuilder {
+public class DefaultQuantitativeDescriptionBuilder extends QuantitativeDescriptionBuilderBase {
private String space = " ";
+/**
+* Copyright (C) 2007 EDIT
+* 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.
+*/
package eu.etaxonomy.cdm.format.description;
import java.util.List;
*
* @author m.venin
*/
-public abstract class DescriptionBuilder<T extends DescriptionElementBase> {
+public abstract class DescriptionBuilderBase<T extends DescriptionElementBase> {
protected String separator = ",";// the basic separator, used for example to separate states when building a description
// of a CategoricalData
/**
* Returns the TextData element with the description of the according DescriptionElement
- *
- * @param descriptionElement
- * @param languages
- * @return
*/
public abstract TextData build(T descriptionElement, List<Language> languages);
/**
- * Returns either the text, label or abbreviation of a Representation
- * @param representation
- * @return
+ * Returns either the text, label or abbreviation of a Representation.
*/
protected String getRightText(Representation representation){
String result;
return representation.getLabel();
}
-
/**
* Returns a TextData with the name of the feature.
- *
- * @param feature
- * @param languages
- * @return
*/
public TextData buildTextDataFeature(Feature feature, List<Language> languages){
return TextData.NewInstance(getRightText(feature.getPreferredRepresentation(languages)),languages.get(0),null);
}
-
-}
+}
\ No newline at end of file
* 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.
*/
-package eu.etaxonomy.cdm.format;
+package eu.etaxonomy.cdm.format.description;
import org.apache.commons.lang3.StringUtils;
* @since 2010
*/
public class MicroFormatCategoricalDescriptionBuilder
- extends AbstractCategoricalDescriptionBuilder{
+ extends CategoricalDescriptionBuilderBase{
private final String spanEnd = "</span>";
* @author m.venin
* @since 2010
*/
-public class MicroFormatQuantitativeDescriptionBuilder extends AbstractQuantitativeDescriptionBuilder {
+public class MicroFormatQuantitativeDescriptionBuilder extends QuantitativeDescriptionBuilderBase {
private String spanEnd = "</span>";
* @author m.venin
* @since 2010
*/
-public abstract class AbstractQuantitativeDescriptionBuilder extends DescriptionBuilder<QuantitativeData>{
+public abstract class QuantitativeDescriptionBuilderBase
+ extends DescriptionBuilderBase<QuantitativeData>{
@Override
public TextData build(QuantitativeData data, List<Language> languages) {
import org.apache.commons.lang3.StringUtils;
-import eu.etaxonomy.cdm.format.AbstractEllypsisFormatter;
+import eu.etaxonomy.cdm.format.EllypsisFormatterBase;
import eu.etaxonomy.cdm.model.agent.Team;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.reference.ReferenceType;
* @author a.kohlbecker
* @since Dec 12, 2018
*/
-public class ReferenceEllypsisFormatter extends AbstractEllypsisFormatter<Reference> {
+public class ReferenceEllypsisFormatter extends EllypsisFormatterBase<Reference> {
/**
* This init strategy should be used when the ReferenceEllypsisFormatter is being used
import eu.etaxonomy.cdm.format.description.DefaultCategoricalDescriptionBuilder;
import eu.etaxonomy.cdm.format.description.DefaultQuantitativeDescriptionBuilder;
-import eu.etaxonomy.cdm.format.description.DescriptionBuilder;
+import eu.etaxonomy.cdm.format.description.DescriptionBuilderBase;
import eu.etaxonomy.cdm.model.common.Annotation;
import eu.etaxonomy.cdm.model.common.AnnotationType;
import eu.etaxonomy.cdm.model.common.Language;
private String secondSeparator = ".";
private List<Integer> levels = new ArrayList<>();
- private DescriptionBuilder<QuantitativeData> quantitativeDescriptionBuilder = new DefaultQuantitativeDescriptionBuilder();
- private DescriptionBuilder<CategoricalData> categoricalDescriptionBuilder = new DefaultCategoricalDescriptionBuilder();
+ private DescriptionBuilderBase<QuantitativeData> quantitativeDescriptionBuilder = new DefaultQuantitativeDescriptionBuilder();
+ private DescriptionBuilderBase<CategoricalData> categoricalDescriptionBuilder = new DefaultCategoricalDescriptionBuilder();
private TextData previousTextData;
/**
* @param quantitativeDescriptionBuilder
*/
- public void setQuantitativeDescriptionBuilder(DescriptionBuilder<QuantitativeData> quantitativeDescriptionBuilder){
+ public void setQuantitativeDescriptionBuilder(DescriptionBuilderBase<QuantitativeData> quantitativeDescriptionBuilder){
this.quantitativeDescriptionBuilder = quantitativeDescriptionBuilder;
}
/**
* @param categoricalDescriptionBuilder
*/
- public void setCategoricalDescriptionBuilder(DescriptionBuilder<CategoricalData> categoricalDescriptionBuilder){
+ public void setCategoricalDescriptionBuilder(DescriptionBuilderBase<CategoricalData> categoricalDescriptionBuilder){
this.categoricalDescriptionBuilder = categoricalDescriptionBuilder;
}
/** recursive function that goes through a tree containing the order in which the description has to be generated,
- * if an element of this tree matches one of the TaxonDescription, a DescriptionBuilder is called which returns a TextData with the corresponding description.
+ * if an element of this tree matches one of the TaxonDescription, a DescriptionBuilderBase is called which returns a TextData with the corresponding description.
*
* @param children the children of the feature node considered
* @param parent the feature node considered