CycleCountInput { public CycleCountInput(InputOutput io) { Arguments.checkNotNull(io, "io"); this.io = io; this.listener = new InputListener(); this.initListener = new InitSoarListener(); this.io.getEvents().addListener(InputEvent.class, listener); this.io.getEvents().addListener(BeforeInitSoarEvent.class, initListener); } CycleCountInput(InputOutput io); void dispose();  }
@Test public void testCycleCountInput() throws Exception { final List<Long> matches = new ArrayList<Long>(); agent.getRhsFunctions().registerHandler(new StandaloneRhsFunctionHandler("match") { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { matches.add(arguments.get(0).asInteger().getValue()); return null; }}); CycleCountInput input = new CycleCountInput(agent.getInputOutput()); agent.getProperties().set(SoarProperties.WAITSNC, true); agent.getProductions().loadProduction("testCycleCountInput " + "(state <s> ^superstate nil ^io.input-link.cycle-count <cc>)" + "-->" + "(match <cc>)"); final long n = 50; agent.runFor(n, RunType.DECISIONS); assertEquals(n, matches.size()); int expected = 1; for(Long i : matches) { assertEquals(expected++, i.intValue()); } input.dispose(); agent.runFor(1, RunType.DECISIONS); assertEquals(n, matches.size()); assertNull(Wmes.matcher(agent.getSymbols()).attr("cycle-count").find(agent.getInputOutput().getInputLink())); }