Permalink
Browse files

formatted code, old on line mc predator removed

  • Loading branch information...
1 parent 389dcfb commit f4deda36e03271cb74b09f00e4f24671a7ca4d58 @GiorgosMethe committed Oct 4, 2012
@@ -6,12 +6,13 @@
public Coordinate State;
public StateActionPair Action;
-
+
public SAPair(Coordinate state, StateActionPair action) {
-
+
State = state;
Action = action;
}
+
public String toString() {
return "{s=" + this.State + ", a=" + this.Action + "}";
}
@@ -15,31 +15,31 @@ public StateActionPair(Coordinate action, double value, int id) {
this.id = id;
}
-
+
@Override
public boolean equals(Object o) {
if (!(o instanceof StateActionPair)) {
return false;
}
StateActionPair that = (StateActionPair) o;
-
- return (that == null)
- || ((this.Action == null ? that.Action == null : that.Action.equals(this.Action))
- || (this.Value == that.Value)
- || (this.id == that.id));
+
+ return (that == null)
+ || ((this.Action == null ? that.Action == null : that.Action
+ .equals(this.Action)) || (this.Value == that.Value) || (this.id == that.id));
}
-
+
@Override
public int hashCode() {
int hashCode = 0;
if (this.Action != null) {
- hashCode += 11 * this.Action.getX() + this.Action.getY();
+ hashCode += 11 * this.Action.getX() + this.Action.getY();
}
hashCode = id * ((int) this.Value) ^ hashCode;
return hashCode;
}
-
+
public String toString() {
- return "(a=" + this.Action + ", v=" + this.Value + ", #=" + this.id + ")";
+ return "(a=" + this.Action + ", v=" + this.Value + ", #=" + this.id
+ + ")";
}
}
View
@@ -1,7 +1,6 @@
package agentsPack;
import java.util.Map;
-import agentsPack.Vector;
import actionPack.RandomAction;
import environmentPack.Coordinate;
@@ -156,18 +155,18 @@ public Double reward(int currState, int nextState, Coordinate action) {
public abstract Vector<RandomAction> ProbabilityActionsRSW(
Vector<Agent> worldState);
-
@Override
public boolean equals(Object o) {
if (!(o instanceof Agent)) {
return false;
}
Agent that = (Agent) o;
-
- return (that == null ? this == null :
- (that.lives == this.lives)
- && (that.name == null ? this.name == null : that.name.equals(this.name))
- && (that.position == null ? this.position == null : that.position.equals(this.position))
- /*&& (that.pi == null ? this.pi == null : that.pi.equals(this.pi))*/);
+
+ return (that == null ? this == null : (that.lives == this.lives)
+ && (that.name == null ? this.name == null : that.name
+ .equals(this.name))
+ && (that.position == null ? this.position == null
+ : that.position.equals(this.position))
+ /* && (that.pi == null ? this.pi == null : that.pi.equals(this.pi)) */);
}
}
@@ -2,7 +2,6 @@
import java.util.HashMap;
import java.util.Map;
-import agentsPack.Vector;
import environmentPack.Coordinate;
@@ -7,14 +7,15 @@
public interface DefaultFactory<Input, Output> {
public Output getDefault(Input key);
}
-
- public class SimpleDefaultFactory<Input, Output> implements DefaultFactory<Input, Output> {
+
+ public class SimpleDefaultFactory<Input, Output> implements
+ DefaultFactory<Input, Output> {
public Output defaultValue;
-
+
SimpleDefaultFactory(Output defaultValue) {
this.defaultValue = defaultValue;
}
-
+
public Output getDefault(Input key) {
return this.defaultValue;
}
@@ -2,7 +2,6 @@
import java.util.Map;
import java.util.Map.Entry;
-import agentsPack.Vector;
import environmentPack.Coordinate;
@@ -1,7 +1,6 @@
package agentsPack;
import java.util.Map;
-import agentsPack.Vector;
import actionPack.RandomAction;
import environmentPack.Coordinate;
Oops, something went wrong.

0 comments on commit f4deda3

Please sign in to comment.