/** * Start monitoring the consequences. */ public void startMonitorConsequences() { if(microplansteps && getRuleSystem().isInited()) { monitor_consequences++; if(monitor_consequences==1) agenda_state = getRuleSystem().getAgenda().getState(); } }
public void run() { oavpanel = new OAVPanel(bdii.getRuleSystem().getState()); SwingUtilities.invokeLater(new Runnable() { public void run() { component.add(BorderLayout.CENTER, oavpanel); component.invalidate(); component.doLayout(); component.repaint(); } }); } });
/** * Called to initialize the panel. * Called on the swing thread. * @param jcc The jcc. * @param bpp The breakpoint panel. * @param id The component identifier. * @param access The external access of the component. */ public void init(IControlCenter jcc, IBreakpointPanel bpp, IComponentIdentifier name, IExternalAccess access) { if(access instanceof ElementFlyweight) { BDIInterpreter bdii = ((ElementFlyweight)access).getInterpreter(); this.retepanel = new RetePanel(bdii.getRuleSystem(), null, bpp); this.component = retepanel; } else { JLabel emptylabel = new JLabel("Rule engine debugger only supported for local components.", JLabel.CENTER); emptylabel.setVerticalAlignment(JLabel.CENTER); emptylabel.setHorizontalTextPosition(JLabel.CENTER); emptylabel.setFont(emptylabel.getFont().deriveFont(emptylabel.getFont().getSize()*1.3f)); this.component = new JPanel(new BorderLayout()); component.add(emptylabel, BorderLayout.CENTER); } }
/** * 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; }
if(microplansteps && getRuleSystem().isInited()) if(agenda_state!=getRuleSystem().getAgenda().getState())