本文整理匯總了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);
}
}
}
示例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();
}
示例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);
}
}
}
示例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();
}
示例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);
}
}
示例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();
}
示例7: propagationCompleted
import com.cburch.logisim.circuit.Simulator; //導入依賴的package包/類
@Override
public void propagationCompleted(SimulatorEvent e) {
Simulator sim = e.getSource();
if (!sim.isTicking()) {
queueSize = 0;
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
示例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();
}