summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/cli/ICommandMode.java
diff options
context:
space:
mode:
authorbjculkin <bjculkin@mix.wvu.edu>2017-03-17 08:52:13 -0400
committerbjculkin <bjculkin@mix.wvu.edu>2017-03-17 08:52:13 -0400
commit7f59d0b9de4536705b3122cb5a85d9c9f85846a3 (patch)
tree8aeed52ab4a18385f63dae2f51c792b88da669bb /BJC-Utils2/src/main/java/bjc/utils/cli/ICommandMode.java
parent9d89261fedf23c11b684eb66cefdd86a9378ad20 (diff)
Add toString/equals/hashCode/compareTo part 1
Adds utility methods to classes that need them. This covers the cli & component packages.
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/cli/ICommandMode.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/cli/ICommandMode.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/cli/ICommandMode.java b/BJC-Utils2/src/main/java/bjc/utils/cli/ICommandMode.java
index 2bf9ccf..431a8cf 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/cli/ICommandMode.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/cli/ICommandMode.java
@@ -7,7 +7,7 @@ package bjc.utils.cli;
* @author ben
*
*/
-public interface ICommandMode {
+public interface ICommandMode extends Comparable<ICommandMode> {
/**
* Check to see if this mode can handle the specified command
*
@@ -16,7 +16,7 @@ public interface ICommandMode {
* @return Whether or not this mode can handle the command. It is
* assumed not by default
*/
- public default boolean canHandle(String command) {
+ default boolean canHandle(String command) {
return false;
};
@@ -28,7 +28,7 @@ public interface ICommandMode {
* @throws UnsupportedOperationException
* if this mode doesn't support a custom prompt
*/
- public default String getCustomPrompt() {
+ default String getCustomPrompt() {
throw new UnsupportedOperationException("This mode doesn't support a custom prompt");
}
@@ -47,7 +47,7 @@ public interface ICommandMode {
*
* @return Whether or not this mode uses a custom prompt
*/
- public default boolean isCustomPromptEnabled() {
+ default boolean isCustomPromptEnabled() {
return false;
}
@@ -61,7 +61,12 @@ public interface ICommandMode {
* @return The command mode to use for the next command. Defaults to
* returning this, and doing nothing else
*/
- public default ICommandMode process(String command, String[] args) {
+ default ICommandMode process(String command, String[] args) {
return this;
}
+
+ @Override
+ default int compareTo(ICommandMode o) {
+ return getName().compareTo(o.getName());
+ }
}