package jalview.datamodel.features; import jalview.bin.Instance; import java.util.HashMap; import java.util.Map; public class FeatureSources { public static FeatureSources getInstance() { Instance i = Instance.getInstance(); return (i.featureSources == null ? i.featureSources = new FeatureSources() : i.featureSources); } private Map sources; private FeatureSources() { sources = new HashMap<>(); } /** * Answers the FeatureSource with the given unique identifier, or null if not * known * * @param sourceId * @return */ public FeatureSourceI getSource(String sourceId) { return sources.get(sourceId); } /** * Adds the given source under the given key. This will replace any existing * source with the same id, it is the caller's responsibility to ensure keys * are unique if necessary. * * @param sourceId * @param source */ public void addSource(String sourceId, FeatureSource source) { sources.put(sourceId, source); } }