package bjc.utils.components; import bjc.funcdata.IMap; /** * A repository of components stored in memory. * * @author bjculkin * * @param The type of component stored in the repository. */ public class MemoryComponentRepository implements IComponentRepository { private final IMap repo; private final String source; /** * Create a new memory component repository. * * @param repo * The set of components to use. */ public MemoryComponentRepository(IMap repo) { this(repo, "memory"); } /** * Create a new memory component repository. * * @param repo * The set of components to use. * @param source * Where the components came from. */ public MemoryComponentRepository(IMap repo, String source) { this.repo = repo; this.source = source; } @Override public IMap getAll() { return repo; } public ComponentType getByName(String name) { return repo.get(name); } public String getSource() { return source; } }