@Test public void testGet() throws Exception { ProductionManager pm = agent.getProductions(); pm.loadProduction("i-support\n" + "(state <s> ^superstate nil ^io <io>)\n" + "-->\n" + "(<s> ^foo bar)"); pm.loadProduction("propose\n" + "(state <s> ^superstate nil)\n" + "-->\n" + "(<s> ^operator <o> +)"); pm.loadProduction("o-support\n" + "(state <s> ^operator <o> ^io <io>)\n" + "-->\n" + "(<s> ^foo bar)"); agent.runFor(2, RunType.DECISIONS); final Identifier s1 = agent.getSymbols().findIdentifier('S', 1); assertNotNull(s1); final Wme foo = Wmes.matcher(agent).attr("foo").value("bar").find(s1); assertNotNull(foo); WmeSupportInfo info = WmeSupportInfo.get(agent, foo); assertNotNull(info); assertSame(foo, info.getWme()); List<Support> supports = info.getSupports(); assertNotNull(supports); assertEquals(2, supports.size()); Support a = supports.get(0); assertEquals("o-support", a.getSource().getName().toString()); assertTrue(a.isOSupported()); Support b = supports.get(1); assertEquals("i-support", b.getSource().getName().toString()); assertFalse(b.isOSupported()); }
public static WmeSupportInfo get(Agent agent, Wme wme) { Arguments.checkNotNull(agent, "agent"); Arguments.checkNotNull(wme, "wme"); final List<Support> sources = new ArrayList<Support>(); final Iterator<Preference> prefIt = wme.getPreferences(); while(prefIt.hasNext()) { sources.add(createSupport(agent, prefIt.next())); } return new WmeSupportInfo(wme, sources); }
WmeSupportInfo { public static WmeSupportInfo get(Agent agent, Wme wme) { Arguments.checkNotNull(agent, "agent"); Arguments.checkNotNull(wme, "wme"); final List<Support> sources = new ArrayList<Support>(); final Iterator<Preference> prefIt = wme.getPreferences(); while(prefIt.hasNext()) { sources.add(createSupport(agent, prefIt.next())); } return new WmeSupportInfo(wme, sources); } }
WmeSupportInfo { public static WmeSupportInfo get(Agent agent, Wme wme) { Arguments.checkNotNull(agent, "agent"); Arguments.checkNotNull(wme, "wme"); final List<Support> sources = new ArrayList<Support>(); final Iterator<Preference> prefIt = wme.getPreferences(); while(prefIt.hasNext()) { sources.add(createSupport(agent, prefIt.next())); } return new WmeSupportInfo(wme, sources); } private  WmeSupportInfo(Wme wme, List<Support> supports); }
WmeSupportInfo { public static WmeSupportInfo get(Agent agent, Wme wme) { Arguments.checkNotNull(agent, "agent"); Arguments.checkNotNull(wme, "wme"); final List<Support> sources = new ArrayList<Support>(); final Iterator<Preference> prefIt = wme.getPreferences(); while(prefIt.hasNext()) { sources.add(createSupport(agent, prefIt.next())); } return new WmeSupportInfo(wme, sources); } private  WmeSupportInfo(Wme wme, List<Support> supports); static WmeSupportInfo get(Agent agent, Wme wme); Wme getWme(); List<Support> getSupports(); @Override String toString(); }
WmeSupportInfo { public static WmeSupportInfo get(Agent agent, Wme wme) { Arguments.checkNotNull(agent, "agent"); Arguments.checkNotNull(wme, "wme"); final List<Support> sources = new ArrayList<Support>(); final Iterator<Preference> prefIt = wme.getPreferences(); while(prefIt.hasNext()) { sources.add(createSupport(agent, prefIt.next())); } return new WmeSupportInfo(wme, sources); } private  WmeSupportInfo(Wme wme, List<Support> supports); static WmeSupportInfo get(Agent agent, Wme wme); Wme getWme(); List<Support> getSupports(); @Override String toString();  }