/** {@inheritDoc} */ @Override public void setUpUnitaryBench(AgentNumberBenchRun run) throws Exception { super.setUpUnitaryBench(run); Kernels.killAll(); LoggerUtil.setLoggingEnable(false); Kernel kernel = Kernels.create(); this.emitter = new Emitter(); kernel.launchLightAgent(this.emitter, run.getNumberOfAgents()); while (!this.emitter.getState().isAlive()) { Thread.yield(); } }
/** * @param k is the kernel to inspect. * @param planeEntity is the entity which is the plane. * @param cubeCount is the number of cubes in the problem. */ public CubeWorldPanel(Kernel k, EcoIdentity planeEntity, int cubeCount) { this.planeEntity = planeEntity; this.cubeCount = cubeCount; setLayout(new BorderLayout()); add(this.displayer, BorderLayout.CENTER); JPanel tools = new JPanel(); tools.setLayout(new BoxLayout(tools, BoxLayout.X_AXIS)); add(tools, BorderLayout.SOUTH); this.startButton = new JButton(getIcon("first.png")); // $NON-NLS-1$ this.startButton.setActionCommand(ACTION_FIRST_STATE); this.startButton.setToolTipText( Locale.getString(CubeWorldPanel.class, "FIRST_STATE")); // $NON-NLS-1$ tools.add(this.startButton); this.startButton.addActionListener(this); this.previousButton = new JButton(getIcon("previous.png")); // $NON-NLS-1$ this.previousButton.setActionCommand(ACTION_PREVIOUS_STATE); this.previousButton.setToolTipText( Locale.getString(CubeWorldPanel.class, "PREVIOUS_STATE")); // $NON-NLS-1$ tools.add(this.previousButton); this.previousButton.addActionListener(this); this.nextButton = new JButton(getIcon("next.png")); // $NON-NLS-1$ this.nextButton.setActionCommand(ACTION_NEXT_STATE); this.nextButton.setToolTipText( Locale.getString(CubeWorldPanel.class, "NEXT_STATE")); // $NON-NLS-1$ tools.add(this.nextButton); this.nextButton.addActionListener(this); this.endButton = new JButton(getIcon("last.png")); // $NON-NLS-1$ this.endButton.setActionCommand(ACTION_LAST_STATE); this.endButton.setToolTipText( Locale.getString(CubeWorldPanel.class, "LAST_STATE")); // $NON-NLS-1$ tools.add(this.endButton); this.endButton.addActionListener(this); this.stateLabel = new JLabel(); this.stateLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); tools.add(this.stateLabel); updateUIComponents(); k.getChannelManager().addChannelInteractableListener(this); }
@Override protected void launchEmitter(Kernel kernel, Agent agent, int nbListeners) { kernel.submitHeavyAgent(agent, nbListeners); }