Skip to content

Commit 648880a

Browse files
committed
Minor cleanup.
1 parent 3eb29b1 commit 648880a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

aima-core/src/main/java/aima/core/agent/AgentProgram.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package aima.core.agent;
22

33
import java.util.Optional;
4+
import java.util.function.Function;
45

56
/**
67
* Artificial Intelligence A Modern Approach (3rd Edition): pg 35.<br>
@@ -13,14 +14,15 @@
1314
* @author Ravi Mohan
1415
* @author Ciaran O'Reilly
1516
*/
16-
public interface AgentProgram<P, A> {
17+
public interface AgentProgram<P, A> extends Function<P, Optional<A>> {
1718
/**
1819
* The Agent's program, which maps any given percept sequences to an action.
1920
*
2021
* @param percept
2122
* The current percept of a sequence perceived by the Agent.
2223
* @return the Action to be taken in response to the currently perceived
23-
* percept. No action replaces NoOp in earlier implementations.
24+
* percept. Empty replaces NoOp in earlier implementations.
2425
*/
26+
@Override
2527
Optional<A> apply(P percept);
2628
}

aima-core/src/main/java/aima/core/environment/vacuum/VacuumPercept.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public void setAttribute(String key, Object value) {
4545
@Override
4646
public String toString() {
4747
StringBuilder result = new StringBuilder();
48-
result.append("[ currLocation=").append(getCurrLocation()).append(" currState=").append(getCurrState());
48+
result.append("[currLocation=").append(getCurrLocation()).append(", currState=").append(getCurrState());
4949
if (!dynAttributes.isEmpty())
5050
for (Map.Entry<String, Object> e : dynAttributes.entrySet())
51-
result.append(" ").append(e.getKey()).append("=").append(e.getValue());
52-
result.append(" ]");
51+
result.append(", ").append(e.getKey()).append("=").append(e.getValue());
52+
result.append("]");
5353
return result.toString();
5454
}
5555

0 commit comments

Comments
 (0)