diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-08 13:28:09 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-08 13:28:09 -0400 |
| commit | 275a627719fc2231b16caea41130ff09f0f2b6a1 (patch) | |
| tree | 757e8ca2061ba6ed9b2063f7155edbe954b72bdb /BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java | |
| parent | 79d3a4a47cbc1fcf17c77c6fc12ff826a3077bac (diff) | |
Switch functional data to use interfaces
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java b/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java index 4aea0d6..37c94f6 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java +++ b/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java @@ -2,14 +2,15 @@ package bjc.utils.components; import java.io.File; import java.nio.file.Path; -import java.util.HashMap; -import java.util.Map; import java.util.function.Function; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import bjc.utils.funcdata.FunctionalList; +import bjc.utils.funcdata.FunctionalMap; +import bjc.utils.funcdata.IFunctionalList; +import bjc.utils.funcdata.IFunctionalMap; /** * A component repository that loads its components from files in a @@ -29,7 +30,7 @@ public class FileComponentRepository<E extends IDescribedComponent> /** * The internal storage of components */ - private Map<String, E> components; + private IFunctionalMap<String, E> components; /** * The path that all the components came from @@ -57,7 +58,8 @@ public class FileComponentRepository<E extends IDescribedComponent> + "Components can only be read from a directory"); } - components = new HashMap<>(); + components = new FunctionalMap<>(); + sourceDirectory = directory.toPath().toAbsolutePath(); File[] listFiles = directory.listFiles(); @@ -100,8 +102,8 @@ public class FileComponentRepository<E extends IDescribedComponent> } @Override - public FunctionalList<E> getComponentList() { - FunctionalList<E> returnedList = new FunctionalList<>(); + public IFunctionalList<E> getComponentList() { + IFunctionalList<E> returnedList = new FunctionalList<>(); components .forEach((name, component) -> returnedList.add(component)); @@ -110,7 +112,7 @@ public class FileComponentRepository<E extends IDescribedComponent> } @Override - public Map<String, E> getComponents() { + public IFunctionalMap<String, E> getComponents() { return components; } |
