
de.undercouch.citeproc.DefaultAbbreviationProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of citeproc-java Show documentation
Show all versions of citeproc-java Show documentation
A Citation Style Language (CSL) Processor for Java.
package de.undercouch.citeproc;
import de.undercouch.citeproc.csl.CSLItemData;
import java.util.HashMap;
import java.util.Map;
/**
* Default implementation of {@link AbbreviationProvider}
* @author Michel Kraemer
*/
public class DefaultAbbreviationProvider implements AbbreviationProvider {
private final Map> abbrevs = new HashMap<>();
public void addAbbreviation(String variable, String original, String abbreviation) {
Map vm = abbrevs.computeIfAbsent(variable, v -> new HashMap<>());
vm.put(original, abbreviation);
}
@Override
public String getAbbreviation(String variable, String original, CSLItemData item) {
Map vm = abbrevs.get(variable);
if (vm != null) {
return vm.get(original);
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy