public void valueChanged(ListSelectionEvent e) { if(!e.getValueIsAdjusting()) { int i = -1; if(next!=null) { for(i=0;i<amodel.getSize(); i++) { if(next.equals(amodel.getElementAt(i))) break; } } // Hack!!! Should use agent.invokeLater if(activations.getSelectedIndex()!=-1 && activations.getSelectedIndex()!=i && activations.getSelectedIndex()<agenda.getActivations().size()) agenda.setNextActivation((Activation)amodel.getElementAt(activations.getSelectedIndex())); } } });
public void agendaChanged() { synchronized(AgendaPanel.this) { List his = agenda.getHistory(); activations_clone = agenda.getActivations().toArray(); history_clone = his!=null? his.toArray(): new Object[0]; next = agenda.getNextActivation(); } if(!invoked) { invoked = true; SwingUtilities.invokeLater(new Runnable() { public void run() { invoked = false; synchronized(AgendaPanel.this) { AgendaPanel.this.activations_clone = activations_clone; AgendaPanel.this.history_clone = history_clone; AgendaPanel.this.next = next; } updateList(); } }); } } };
/** * Test if the component's execution is currently at one of the * given breakpoints. If yes, the component will be suspended by * the platform. * @param breakpoints An array of breakpoints. * @return True, when some breakpoint is triggered. */ public boolean isAtBreakpoint(String[] breakpoints) { // assert isAgentThread(); assert !getAgentAdapter().isExternalThread(); boolean isatbreakpoint = false; Object cs = state.getAttributeValue(ragent, OAVBDIRuntimeModel.agent_has_state); if(cs!=null && !OAVBDIRuntimeModel.AGENTLIFECYCLESTATE_TERMINATED.equals(cs)) { Set bps = new HashSet(Arrays.asList(breakpoints)); // Todo: cache set across invocations for speed? Iterator it = getRuleSystem().getAgenda().getActivations().iterator(); while(!isatbreakpoint && it.hasNext()) { IRule rule = ((Activation)it.next()).getRule(); isatbreakpoint = bps.contains(rule.getName()); } } // else still in init return isatbreakpoint; }
activations_clone = agenda.getActivations().toArray(); history_clone = agenda.getHistory().toArray(); next = agenda.getNextActivation();
Iterator it = rulesystem.getAgenda().getActivations().iterator(); while(it.hasNext())
Iterator it = rulesystem.getAgenda().getActivations().iterator(); while(it.hasNext())