use of aima.core.agent.impl.DynamicPercept in project aima-java by aimacode.
the class PerceptSequenceTest method testEquals.
@Test
public void testEquals() {
List<Percept> ps1 = new ArrayList<Percept>();
List<Percept> ps2 = new ArrayList<Percept>();
Assert.assertEquals(ps1, ps2);
ps1.add(new DynamicPercept("key1", "value1"));
Assert.assertNotSame(ps1, ps2);
ps2.add(new DynamicPercept("key1", "value1"));
Assert.assertEquals(ps1, ps2);
}
use of aima.core.agent.impl.DynamicPercept in project aima-java by aimacode.
the class TableDrivenAgentProgramTest method setUp.
@Before
public void setUp() {
Map<List<Percept>, Action> perceptSequenceActions = new HashMap<List<Percept>, Action>();
perceptSequenceActions.put(createPerceptSequence(new DynamicPercept("key1", "value1")), ACTION_1);
perceptSequenceActions.put(createPerceptSequence(new DynamicPercept("key1", "value1"), new DynamicPercept("key1", "value2")), ACTION_2);
perceptSequenceActions.put(createPerceptSequence(new DynamicPercept("key1", "value1"), new DynamicPercept("key1", "value2"), new DynamicPercept("key1", "value3")), ACTION_3);
agent = new MockAgent(new TableDrivenAgentProgram(perceptSequenceActions));
}
use of aima.core.agent.impl.DynamicPercept in project aima-java by aimacode.
the class SimpleMapAgent method updateState.
//
// PROTECTED METHODS
//
@Override
protected void updateState(Percept p) {
DynamicPercept dp = (DynamicPercept) p;
state.setAttribute(DynAttributeNames.AGENT_LOCATION, dp.getAttribute(DynAttributeNames.PERCEPT_IN));
}
use of aima.core.agent.impl.DynamicPercept in project aima-java by aimacode.
the class DynamicPerceptTest method testEquals.
@Test
public void testEquals() {
DynamicPercept p1 = new DynamicPercept();
DynamicPercept p2 = new DynamicPercept();
Assert.assertEquals(p1, p2);
p1 = new DynamicPercept("key1", "value1");
Assert.assertNotSame(p1, p2);
p2 = new DynamicPercept("key1", "value1");
Assert.assertEquals(p1, p2);
}
use of aima.core.agent.impl.DynamicPercept in project aima-java by aimacode.
the class PerceptSequenceTest method testToString.
@Test
public void testToString() {
List<Percept> ps = new ArrayList<Percept>();
ps.add(new DynamicPercept("key1", "value1"));
Assert.assertEquals("[Percept[key1==value1]]", ps.toString());
ps.add(new DynamicPercept("key1", "value1", "key2", "value2"));
Assert.assertEquals("[Percept[key1==value1], Percept[key1==value1, key2==value2]]", ps.toString());
}
Aggregations