From f3814a84f8471684cd483347db4fb7b107c2e635 Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Thu, 3 Dec 2020 19:28:15 -0500 Subject: Rename interfaces to match Java style Rename several interfaces that were in the style IWhatever, which Java doesn't use --- .../bjc/utils/components/ComponentDescription.java | 6 +- .../bjc/utils/components/ComponentRepository.java | 49 +++++++++++++++++ .../bjc/utils/components/DescribedComponent.java | 64 ++++++++++++++++++++++ .../utils/components/FileComponentRepository.java | 4 +- .../bjc/utils/components/IComponentRepository.java | 49 ----------------- .../bjc/utils/components/IDescribedComponent.java | 64 ---------------------- .../components/MemoryComponentRepository.java | 4 +- 7 files changed, 120 insertions(+), 120 deletions(-) create mode 100644 base/src/main/java/bjc/utils/components/ComponentRepository.java create mode 100644 base/src/main/java/bjc/utils/components/DescribedComponent.java delete mode 100644 base/src/main/java/bjc/utils/components/IComponentRepository.java delete mode 100644 base/src/main/java/bjc/utils/components/IDescribedComponent.java (limited to 'base/src/main/java/bjc/utils/components') diff --git a/base/src/main/java/bjc/utils/components/ComponentDescription.java b/base/src/main/java/bjc/utils/components/ComponentDescription.java index 189ef90..2feed8d 100644 --- a/base/src/main/java/bjc/utils/components/ComponentDescription.java +++ b/base/src/main/java/bjc/utils/components/ComponentDescription.java @@ -5,7 +5,7 @@ package bjc.utils.components; * * @author ben */ -public class ComponentDescription implements IDescribedComponent { +public class ComponentDescription implements DescribedComponent { /* Check arguments are good. */ @SuppressWarnings("unused") private static void sanityCheckArgs(final String name, final String author, @@ -58,7 +58,7 @@ public class ComponentDescription implements IDescribedComponent { @Override public String getAuthor() { if (author == null) { - return IDescribedComponent.super.getAuthor(); + return DescribedComponent.super.getAuthor(); } return author; @@ -67,7 +67,7 @@ public class ComponentDescription implements IDescribedComponent { @Override public String getDescription() { if (description == null) { - return IDescribedComponent.super.getDescription(); + return DescribedComponent.super.getDescription(); } return description; diff --git a/base/src/main/java/bjc/utils/components/ComponentRepository.java b/base/src/main/java/bjc/utils/components/ComponentRepository.java new file mode 100644 index 0000000..120edc8 --- /dev/null +++ b/base/src/main/java/bjc/utils/components/ComponentRepository.java @@ -0,0 +1,49 @@ +package bjc.utils.components; + +import bjc.funcdata.ListEx; +import bjc.funcdata.MapEx; + +/** + * A collection of implementations of a particular type of + * {@link DescribedComponent}. + * + * @author ben + * + * @param + * The type of components contained in this repository. + */ +public interface ComponentRepository { + /** + * Get all of the components this repository knows about. + * + * @return A map from component name to component, containing all of the + * components in the repositories. + */ + public MapEx getAll(); + + /** + * Get a component with a specific name. + * + * @param name + * The name of the component to retrieve. + * + * @return The named component, or null if no component with that name exists. + */ + public ComponentType getByName(String name); + + /** + * Get a list of all the registered components. + * + * @return A list of all the registered components. + */ + public default ListEx getList() { + return getAll().valueList(); + } + + /** + * Get the source from which these components came. + * + * @return The source from which these components came. + */ + public String getSource(); +} diff --git a/base/src/main/java/bjc/utils/components/DescribedComponent.java b/base/src/main/java/bjc/utils/components/DescribedComponent.java new file mode 100644 index 0000000..dcbaf59 --- /dev/null +++ b/base/src/main/java/bjc/utils/components/DescribedComponent.java @@ -0,0 +1,64 @@ +package bjc.utils.components; + +/** + * Represents a optional component that has status information associated with + * it. + * + * @author ben + * + */ +public interface DescribedComponent extends Comparable { + /** + * Get the author of this component. + * + * Providing this is optional, with "Anonymous" as the default author. + * + * @return The author of the component. + */ + default String getAuthor() { + return "Anonymous"; + } + + /** + * Get the description of this component. + * + * Providing this is optional, with the default being a note that no description + * was provided. + * + * @return The description of the component + */ + default String getDescription() { + return "No description provided."; + } + + /** + * Get the name of this component. + * + * This is the only thing required of all components. + * + * @return The name of the component. + */ + String getName(); + + /** + * Get the version of this component. + * + * Providing this is optional, with "1" as the default version. + * + * @return The version of this component. + */ + default int getVersion() { + return 1; + } + + @Override + default int compareTo(final DescribedComponent o) { + int res = getName().compareTo(o.getName()); + + if (res == 0) { + res = getVersion() - o.getVersion(); + } + + return res; + } +} diff --git a/base/src/main/java/bjc/utils/components/FileComponentRepository.java b/base/src/main/java/bjc/utils/components/FileComponentRepository.java index fa98d03..e0e929f 100644 --- a/base/src/main/java/bjc/utils/components/FileComponentRepository.java +++ b/base/src/main/java/bjc/utils/components/FileComponentRepository.java @@ -24,8 +24,8 @@ import bjc.utils.funcutils.FileUtils; * @param * The type of component being read in. */ -public class FileComponentRepository - implements IComponentRepository { +public class FileComponentRepository + implements ComponentRepository { /* The logger to use for storing data about this class. */ private static final Logger CLASS_LOGGER = Logger.getLogger("FileComponentRepository"); diff --git a/base/src/main/java/bjc/utils/components/IComponentRepository.java b/base/src/main/java/bjc/utils/components/IComponentRepository.java deleted file mode 100644 index 7a40541..0000000 --- a/base/src/main/java/bjc/utils/components/IComponentRepository.java +++ /dev/null @@ -1,49 +0,0 @@ -package bjc.utils.components; - -import bjc.funcdata.ListEx; -import bjc.funcdata.MapEx; - -/** - * A collection of implementations of a particular type of - * {@link IDescribedComponent}. - * - * @author ben - * - * @param - * The type of components contained in this repository. - */ -public interface IComponentRepository { - /** - * Get all of the components this repository knows about. - * - * @return A map from component name to component, containing all of the - * components in the repositories. - */ - public MapEx getAll(); - - /** - * Get a component with a specific name. - * - * @param name - * The name of the component to retrieve. - * - * @return The named component, or null if no component with that name exists. - */ - public ComponentType getByName(String name); - - /** - * Get a list of all the registered components. - * - * @return A list of all the registered components. - */ - public default ListEx getList() { - return getAll().valueList(); - } - - /** - * Get the source from which these components came. - * - * @return The source from which these components came. - */ - public String getSource(); -} diff --git a/base/src/main/java/bjc/utils/components/IDescribedComponent.java b/base/src/main/java/bjc/utils/components/IDescribedComponent.java deleted file mode 100644 index ae3e06c..0000000 --- a/base/src/main/java/bjc/utils/components/IDescribedComponent.java +++ /dev/null @@ -1,64 +0,0 @@ -package bjc.utils.components; - -/** - * Represents a optional component that has status information associated with - * it. - * - * @author ben - * - */ -public interface IDescribedComponent extends Comparable { - /** - * Get the author of this component. - * - * Providing this is optional, with "Anonymous" as the default author. - * - * @return The author of the component. - */ - default String getAuthor() { - return "Anonymous"; - } - - /** - * Get the description of this component. - * - * Providing this is optional, with the default being a note that no description - * was provided. - * - * @return The description of the component - */ - default String getDescription() { - return "No description provided."; - } - - /** - * Get the name of this component. - * - * This is the only thing required of all components. - * - * @return The name of the component. - */ - String getName(); - - /** - * Get the version of this component. - * - * Providing this is optional, with "1" as the default version. - * - * @return The version of this component. - */ - default int getVersion() { - return 1; - } - - @Override - default int compareTo(final IDescribedComponent o) { - int res = getName().compareTo(o.getName()); - - if (res == 0) { - res = getVersion() - o.getVersion(); - } - - return res; - } -} diff --git a/base/src/main/java/bjc/utils/components/MemoryComponentRepository.java b/base/src/main/java/bjc/utils/components/MemoryComponentRepository.java index 2e11616..f83c293 100644 --- a/base/src/main/java/bjc/utils/components/MemoryComponentRepository.java +++ b/base/src/main/java/bjc/utils/components/MemoryComponentRepository.java @@ -10,8 +10,8 @@ import bjc.funcdata.MapEx; * @param * The type of component stored in the repository. */ -public class MemoryComponentRepository - implements IComponentRepository { +public class MemoryComponentRepository + implements ComponentRepository { private final MapEx repo; private final String source; -- cgit v1.2.3