summaryrefslogtreecommitdiff
path: root/src/main/java/au/id/zancanaro/javacheck/state
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@zancanaro.id.au>2015-06-09 23:58:41 +1000
committerCarlo Zancanaro <carlo@zancanaro.id.au>2015-06-09 23:58:41 +1000
commit6546881559e4bbcfe2b220199a9f3cd4196d1960 (patch)
tree16244beed46eff76b65d1e5304cae4591b7db7ee /src/main/java/au/id/zancanaro/javacheck/state
parent40961d4950c40643d5d71721a7e024e3951323ce (diff)
A few changes, as suggested by static analysis
Diffstat (limited to 'src/main/java/au/id/zancanaro/javacheck/state')
-rw-r--r--src/main/java/au/id/zancanaro/javacheck/state/CommandValue.java4
-rw-r--r--src/main/java/au/id/zancanaro/javacheck/state/GeneratedCommand.java10
2 files changed, 5 insertions, 9 deletions
diff --git a/src/main/java/au/id/zancanaro/javacheck/state/CommandValue.java b/src/main/java/au/id/zancanaro/javacheck/state/CommandValue.java
index 1ca51a9..d2f3419 100644
--- a/src/main/java/au/id/zancanaro/javacheck/state/CommandValue.java
+++ b/src/main/java/au/id/zancanaro/javacheck/state/CommandValue.java
@@ -46,8 +46,8 @@ public class CommandValue<T> {
@SuppressWarnings("unchecked")
public T get() {
- if (values.containsKey(getId())) {
- return (T) values.get(getId());
+ if (values.containsKey(id)) {
+ return (T) values.get(id);
} else {
throw new NoSuchElementException("Concrete values cannot be supplied prior to being calculated");
}
diff --git a/src/main/java/au/id/zancanaro/javacheck/state/GeneratedCommand.java b/src/main/java/au/id/zancanaro/javacheck/state/GeneratedCommand.java
index 23f306b..92a90f9 100644
--- a/src/main/java/au/id/zancanaro/javacheck/state/GeneratedCommand.java
+++ b/src/main/java/au/id/zancanaro/javacheck/state/GeneratedCommand.java
@@ -30,19 +30,15 @@ public class GeneratedCommand<S, A, R> {
GeneratedCommand that = (GeneratedCommand) o;
- if (args != null ? !args.equals(that.args) : that.args != null)
- return false;
- if (command != null ? !command.equals(that.command) : that.command != null)
- return false;
+ return !(args != null ? !args.equals(that.args) : that.args != null)
+ && !(command != null ? !command.equals(that.command) : that.command != null);
- return true;
}
@Override
public int hashCode() {
int result = command != null ? command.hashCode() : 0;
- result = 31 * result + (args != null ? args.hashCode() : 0);
- return result;
+ return 31 * result + (args != null ? args.hashCode() : 0);
}
@Override