當前位置: 首頁>>代碼示例>>Java>>正文


Java Simulator類代碼示例

本文整理匯總了Java中com.cburch.logisim.circuit.Simulator的典型用法代碼示例。如果您正苦於以下問題:Java Simulator類的具體用法?Java Simulator怎麽用?Java Simulator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Simulator類屬於com.cburch.logisim.circuit包,在下文中一共展示了Simulator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: projectChanged

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
@Override
public void projectChanged(ProjectEvent event) {
	int action = event.getAction();
	if (action == ProjectEvent.ACTION_SET_STATE) {
		Simulator sim = project.getSimulator();
		CircuitState root = sim.getCircuitState();
		if (model.getRootState() != root) {
			model = new SimulationTreeModel(root);
			tree.setModel(model);
		}
		model.setCurrentView(project.getCircuitState());
		TreePath path = model.mapToPath(project.getCircuitState());
		if (path != null) {
			tree.scrollPathToVisible(path);
		}
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:18,代碼來源:SimulationExplorer.java

示例2: computeEnabled

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
@Override
void computeEnabled() {
	boolean present = currentState != null;
	Simulator sim = this.currentSim;
	boolean simRunning = sim != null && sim.isRunning();
	setEnabled(present);
	run.setEnabled(present);
	reset.setEnabled(present);
	step.setEnabled(present && !simRunning);
	upStateMenu.setEnabled(present);
	downStateMenu.setEnabled(present);
	tickOnce.setEnabled(present);
	ticksEnabled.setEnabled(present && simRunning);
	tickFreq.setEnabled(present);
	menubar.fireEnableChanged();
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:17,代碼來源:MenuSimulate.java

示例3: projectChanged

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
public void projectChanged(ProjectEvent event) {
	int action = event.getAction();
	if (action == ProjectEvent.ACTION_SET_STATE) {
		Simulator sim = project.getSimulator();
		CircuitState root = sim.getCircuitState();
		if (model.getRootState() != root) {
			model = new SimulationTreeModel(root);
			tree.setModel(model);
		}
		model.setCurrentView(project.getCircuitState());
		TreePath path = model.mapToPath(project.getCircuitState());
		if (path != null) {
			tree.scrollPathToVisible(path);
		}
	}
}
 
開發者ID:reds-heig,項目名稱:logisim-evolution,代碼行數:17,代碼來源:SimulationExplorer.java

示例4: computeEnabled

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
@Override
void computeEnabled() {
	boolean present = currentState != null;
	Simulator sim = this.currentSim;
	boolean simRunning = sim != null && sim.isRunning();
	setEnabled(present);
	run.setEnabled(present);
	reset.setEnabled(present);
	step.setEnabled(present && !simRunning);
	simulate_vhdl_enable.setEnabled(present);
	vhdl_sim_files.setEnabled(present);
	upStateMenu.setEnabled(present);
	downStateMenu.setEnabled(present);
	tickOnce.setEnabled(present);
	tickOnceMain.setEnabled(present);
	ticksEnabled.setEnabled(present && simRunning);
	tickFreq.setEnabled(present);
	menubar.fireEnableChanged();
}
 
開發者ID:reds-heig,項目名稱:logisim-evolution,代碼行數:20,代碼來源:MenuSimulate.java

示例5: actionPerformed

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
public void actionPerformed(ActionEvent e) {
	Object src = e.getSource();
	Project proj = menubar.getProject();
	Simulator sim = proj == null ? null : proj.getSimulator();
	if (src == run || src == LogisimMenuBar.SIMULATE_ENABLE) {
		if (sim != null) {
			sim.setIsRunning(!sim.isRunning());
			proj.repaintCanvas();
		}
	} else if (src == reset) {
		if (sim != null) sim.requestReset();
	} else if (src == step || src == LogisimMenuBar.SIMULATE_STEP) {
		if (sim != null) sim.step();
	} else if (src == tickOnce || src == LogisimMenuBar.TICK_STEP) {
		if (sim != null) sim.tick();
	} else if (src == ticksEnabled || src == LogisimMenuBar.TICK_ENABLE) {
		if (sim != null) sim.setIsTicking(!sim.isTicking());
	} else if (src == log) {
		LogFrame frame = menubar.getProject().getLogFrame(true);
		frame.setVisible(true);
	}
}
 
開發者ID:franciscaconcha,項目名稱:ProyectoLogisim,代碼行數:23,代碼來源:MenuSimulate.java

示例6: stateChanged

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
@Override
public void stateChanged(ChangeEvent e) {
	Simulator sim = project.getSimulator();
	boolean running = sim != null && sim.isRunning();
	boolean ticking = sim != null && sim.isTicking();
	simEnable.setIcon(running ? "simstop.png" : "simplay.png");
	simEnable.setToolTip(
			running ? Strings.getter("simulateDisableStepsTip") : Strings.getter("simulateEnableStepsTip"));
	tickEnable.setIcon(ticking ? "simtstop.png" : "simtplay.png");
	tickEnable.setToolTip(
			ticking ? Strings.getter("simulateDisableTicksTip") : Strings.getter("simulateEnableTicksTip"));
	fireToolbarAppearanceChanged();
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:14,代碼來源:SimulationToolbarModel.java

示例7: propagationCompleted

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
@Override
public void propagationCompleted(SimulatorEvent e) {
	Simulator sim = e.getSource();
	if (!sim.isTicking()) {
		queueSize = 0;
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:8,代碼來源:TickCounter.java

示例8: setSimulator

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
private void setSimulator(Simulator value, CircuitState state) {
	if ((value == null) == (curModel == null)) {
		if (value == null || value.getCircuitState() == curModel.getCircuitState())
			return;
	}

	LogisimMenuBar menubar = (LogisimMenuBar) getJMenuBar();
	menubar.setCircuitState(value, state);

	if (curSimulator != null)
		curSimulator.removeSimulatorListener(myListener);
	if (curModel != null)
		curModel.setSelected(this, false);

	Model oldModel = curModel;
	Model data = null;
	if (value != null) {
		data = modelMap.get(value.getCircuitState());
		if (data == null) {
			data = new Model(value.getCircuitState());
			modelMap.put(data.getCircuitState(), data);
		}
	}
	curSimulator = value;
	curModel = data;

	if (curSimulator != null)
		curSimulator.addSimulatorListener(myListener);
	if (curModel != null)
		curModel.setSelected(this, true);
	setTitle(computeTitle(curModel, project));
	if (panels != null) {
		for (int i = 0; i < panels.length; i++) {
			panels[i].modelChanged(oldModel, curModel);
		}
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:38,代碼來源:LogFrame.java

示例9: actionPerformed

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
@Override
public void actionPerformed(ActionEvent e) {
	Object src = e.getSource();
	Project proj = menubar.getProject();
	Simulator sim = proj == null ? null : proj.getSimulator();
	if (src == run || src == LogisimMenuBar.SIMULATE_ENABLE) {
		if (sim != null) {
			sim.setIsRunning(!sim.isRunning());
			proj.repaintCanvas();
		}
	} else if (src == reset) {
		if (sim != null)
			sim.requestReset();
	} else if (src == step || src == LogisimMenuBar.SIMULATE_STEP) {
		if (sim != null)
			sim.step();
	} else if (src == tickOnce || src == LogisimMenuBar.TICK_STEP) {
		if (sim != null)
			sim.tick();
	} else if (src == ticksEnabled || src == LogisimMenuBar.TICK_ENABLE) {
		if (sim != null)
			sim.setIsTicking(!sim.isTicking());
	} else if (src == log) {
		LogFrame frame = menubar.getProject().getLogFrame(true);
		frame.setVisible(true);
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:28,代碼來源:MenuSimulate.java

示例10: simulatorStateChanged

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
@Override
public void simulatorStateChanged(SimulatorEvent e) {
	Simulator sim = e.getSource();
	if (sim != currentSim)
		return;
	computeEnabled();
	run.setSelected(sim.isRunning());
	ticksEnabled.setSelected(sim.isTicking());
	double freq = sim.getTickFrequency();
	for (int i = 0; i < tickFreqs.length; i++) {
		TickFrequencyChoice item = tickFreqs[i];
		item.setSelected(freq == item.freq);
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:15,代碼來源:MenuSimulate.java

示例11: stateChanged

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
public void stateChanged(ChangeEvent e) {
	Simulator sim = project.getSimulator();
	boolean running = sim != null && sim.isRunning();
	boolean ticking = sim != null && sim.isTicking();
	simEnable.setIcon(running ? "simstop.png" : "simplay.png");
	simEnable.setToolTip(running ? Strings
			.getter("simulateDisableStepsTip") : Strings
			.getter("simulateEnableStepsTip"));
	tickEnable.setIcon(ticking ? "simtstop.png" : "simtplay.png");
	tickEnable.setToolTip(ticking ? Strings
			.getter("simulateDisableTicksTip") : Strings
			.getter("simulateEnableTicksTip"));
	fireToolbarAppearanceChanged();
}
 
開發者ID:reds-heig,項目名稱:logisim-evolution,代碼行數:15,代碼來源:SimulationToolbarModel.java

示例12: setSimulator

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
private void setSimulator(Simulator value, CircuitState state) {
	if ((value == null) == (curModel == null)) {
		if (value == null
				|| value.getCircuitState() == curModel.getCircuitState())
			return;
	}

	LogisimMenuBar menubar = (LogisimMenuBar) getJMenuBar();
	menubar.setCircuitState(value, state);

	if (curSimulator != null)
		curSimulator.removeSimulatorListener(myListener);
	if (curModel != null)
		curModel.setSelected(this, false);

	Model oldModel = curModel;
	Model data = null;
	if (value != null) {
		data = modelMap.get(value.getCircuitState());
		if (data == null) {
			data = new Model(value.getCircuitState());
			modelMap.put(data.getCircuitState(), data);
		}
	}
	curSimulator = value;
	curModel = data;

	if (curSimulator != null)
		curSimulator.addSimulatorListener(myListener);
	if (curModel != null)
		curModel.setSelected(this, true);
	setTitle(computeTitle(curModel, project));
	if (panels != null) {
		for (int i = 0; i < panels.length; i++) {
			panels[i].modelChanged(oldModel, curModel);
		}
	}
}
 
開發者ID:reds-heig,項目名稱:logisim-evolution,代碼行數:39,代碼來源:LogFrame.java

示例13: simulatorStateChanged

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
@Override
public void simulatorStateChanged(SimulatorEvent e) {
	Simulator sim = e.getSource();
	if (sim != currentSim) {
		return;
	}
	computeEnabled();
	run.setSelected(sim.isRunning());
	ticksEnabled.setSelected(sim.isTicking());
	double freq = sim.getTickFrequency();
	for (int i = 0; i < tickFreqs.length; i++) {
		TickFrequencyChoice item = tickFreqs[i];
		item.setSelected(freq == item.freq);
	}
}
 
開發者ID:reds-heig,項目名稱:logisim-evolution,代碼行數:16,代碼來源:MenuSimulate.java

示例14: setSimulator

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
private void setSimulator(Simulator value, Circuit circuit) {
	if ((value == null) == (curModel == null)) {
		if (value == null
				|| value.getCircuitState().getCircuit() == curModel
						.getCircuit())
			return;
	}

	// LogisimMenuBar menubar = (LogisimMenuBar) getJMenuBar();
	// menubar.setCircuitState(value, state);

	if (curSimulator != null)
		curSimulator.removeSimulatorListener(myListener);
	if (curModel != null)
		curModel.setSelected(false);
	if (curModel != null)
		curModel.removeModelListener(myListener);

	Model oldModel = curModel;
	Model data = null;
	if (value != null) {
		data = modelMap.get(value.getCircuitState().getCircuit());
		if (data == null) {
			data = new Model(project, value.getCircuitState().getCircuit());
			modelMap.put(data.getCircuit(), data);
		}
	}
	curSimulator = value;
	curModel = data;

	if (curSimulator != null)
		curSimulator.addSimulatorListener(myListener);
	if (curModel != null)
		curModel.setSelected(true);
	if (curModel != null)
		curModel.addModelListener(myListener);
	setTitle(computeTitle(curModel, project));
	if (panel != null)
		panel.modelChanged(oldModel, curModel);
}
 
開發者ID:reds-heig,項目名稱:logisim-evolution,代碼行數:41,代碼來源:TestFrame.java

示例15: stateChanged

import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
public void stateChanged(ChangeEvent e) {
	Simulator sim = project.getSimulator(); 
	boolean running = sim != null && sim.isRunning();
	boolean ticking = sim != null && sim.isTicking();
	simEnable.setIcon(running ? "simstop.png" : "simplay.png");
	simEnable.setToolTip(running ? Strings.getter("simulateDisableStepsTip")
			: Strings.getter("simulateEnableStepsTip"));
	tickEnable.setIcon(ticking ? "simtstop.png" : "simtplay.png");
	tickEnable.setToolTip(ticking ? Strings.getter("simulateDisableTicksTip")
			: Strings.getter("simulateEnableTicksTip"));
	fireToolbarAppearanceChanged();
}
 
開發者ID:franciscaconcha,項目名稱:ProyectoLogisim,代碼行數:13,代碼來源:SimulationToolbarModel.java


注:本文中的com.cburch.logisim.circuit.Simulator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。