当前位置: 首页>>代码示例>>Java>>正文


Java CircuitMutation.addAll方法代码示例

本文整理汇总了Java中com.cburch.logisim.circuit.CircuitMutation.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java CircuitMutation.addAll方法的具体用法?Java CircuitMutation.addAll怎么用?Java CircuitMutation.addAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.cburch.logisim.circuit.CircuitMutation的用法示例。


在下文中一共展示了CircuitMutation.addAll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clear

import com.cburch.logisim.circuit.CircuitMutation; //导入方法依赖的package包/类
void clear(CircuitMutation xn, boolean dropLifted) {
	if (selected.isEmpty() && lifted.isEmpty())
		return;

	if (dropLifted && !lifted.isEmpty()) {
		xn.addAll(lifted);
	}

	selected.clear();
	lifted.clear();
	shouldSnap = false;
	bounds = Bounds.EMPTY_BOUNDS;

	fireSelectionChanged();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:16,代码来源:SelectionBase.java

示例2: dropAll

import com.cburch.logisim.circuit.CircuitMutation; //导入方法依赖的package包/类
void dropAll(CircuitMutation xn) {
	if (!lifted.isEmpty()) {
		xn.addAll(lifted);
		selected.addAll(lifted);
		lifted.clear();
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:8,代码来源:SelectionBase.java

示例3: clear

import com.cburch.logisim.circuit.CircuitMutation; //导入方法依赖的package包/类
void clear(CircuitMutation xn, boolean dropLifted) {
	if (selected.isEmpty() && lifted.isEmpty()) return;
	
	if (dropLifted && !lifted.isEmpty()) {
		xn.addAll(lifted);
	}
	
	selected.clear();
	lifted.clear();
	shouldSnap = false;
	bounds = Bounds.EMPTY_BOUNDS;
	
	fireSelectionChanged();
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:15,代码来源:SelectionBase.java

示例4: mouseReleased

import com.cburch.logisim.circuit.CircuitMutation; //导入方法依赖的package包/类
@Override
public void mouseReleased(Canvas canvas, Graphics g, MouseEvent e) {
	// add the wire
	if (!exists)
		return;

	Canvas.snapToGrid(e);
	int curX = e.getX();
	int curY = e.getY();
	if (computeMove(curX, curY)) {
		cur = Location.create(curX, curY);
	}
	if (hasDragged) {
		exists = false;
		super.mouseReleased(canvas, g, e);

		ArrayList<Wire> ws = new ArrayList<Wire>(2);
		if (cur.getY() == start.getY() || cur.getX() == start.getX()) {
			Wire w = Wire.create(cur, start);
			w = checkForRepairs(canvas, w, w.getEnd0());
			w = checkForRepairs(canvas, w, w.getEnd1());
			if (performShortening(canvas, start, cur)) {
				return;
			}
			if (w.getLength() > 0)
				ws.add(w);
		} else {
			Location m;
			if (direction == HORIZONTAL) {
				m = Location.create(cur.getX(), start.getY());
			} else {
				m = Location.create(start.getX(), cur.getY());
			}
			Wire w0 = Wire.create(start, m);
			Wire w1 = Wire.create(m, cur);
			w0 = checkForRepairs(canvas, w0, start);
			w1 = checkForRepairs(canvas, w1, cur);
			if (w0.getLength() > 0)
				ws.add(w0);
			if (w1.getLength() > 0)
				ws.add(w1);
		}
		if (ws.size() > 0) {
			CircuitMutation mutation = new CircuitMutation(canvas.getCircuit());
			mutation.addAll(ws);
			StringGetter desc;
			if (ws.size() == 1)
				desc = Strings.getter("addWireAction");
			else
				desc = Strings.getter("addWiresAction");
			Action act = mutation.toAction(desc);
			canvas.getProject().doAction(act);
			lastAction = act;
		}
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:57,代码来源:WiringTool.java

示例5: mouseReleased

import com.cburch.logisim.circuit.CircuitMutation; //导入方法依赖的package包/类
@Override
public void mouseReleased(Canvas canvas, Graphics g, MouseEvent e) {
	if (!exists)
		return;

	Canvas.snapToGrid(e);
	int curX = e.getX();
	int curY = e.getY();
	if (computeMove(curX, curY)) {
		cur = Location.create(curX, curY);
	}
	if (hasDragged) {
		exists = false;
		super.mouseReleased(canvas, g, e);

		ArrayList<Wire> ws = new ArrayList<Wire>(2);
		if (cur.getY() == start.getY() || cur.getX() == start.getX()) {
			Wire w = Wire.create(cur, start);
			w = checkForRepairs(canvas, w, w.getEnd0());
			w = checkForRepairs(canvas, w, w.getEnd1());
			if (performShortening(canvas, start, cur)) {
				return;
			}
			if (w.getLength() > 0)
				ws.add(w);
		} else {
			Location m;
			if (direction == HORIZONTAL) {
				m = Location.create(cur.getX(), start.getY());
			} else {
				m = Location.create(start.getX(), cur.getY());
			}
			Wire w0 = Wire.create(start, m);
			Wire w1 = Wire.create(m, cur);
			w0 = checkForRepairs(canvas, w0, start);
			w1 = checkForRepairs(canvas, w1, cur);
			if (w0.getLength() > 0)
				ws.add(w0);
			if (w1.getLength() > 0)
				ws.add(w1);
		}
		if (ws.size() > 0) {
			CircuitMutation mutation = new CircuitMutation(
					canvas.getCircuit());
			mutation.addAll(ws);
			StringGetter desc;
			if (ws.size() == 1)
				desc = Strings.getter("addWireAction");
			else
				desc = Strings.getter("addWiresAction");
			Action act = mutation.toAction(desc);
			canvas.getProject().doAction(act);
			lastAction = act;
		}
	}
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:57,代码来源:WiringTool.java

示例6: mouseReleased

import com.cburch.logisim.circuit.CircuitMutation; //导入方法依赖的package包/类
@Override
public void mouseReleased(Canvas canvas, Graphics g, MouseEvent e) {
	if (!exists) return;

	Canvas.snapToGrid(e);
	int curX = e.getX();
	int curY = e.getY();
	if (computeMove(curX, curY)) {
		cur = Location.create(curX, curY);
	}
	if (hasDragged) {
		exists = false;
		super.mouseReleased(canvas, g, e);

		ArrayList<Wire> ws = new ArrayList<Wire>(2);
		if (cur.getY() == start.getY() || cur.getX() == start.getX()) {
			Wire w = Wire.create(cur, start);
			w = checkForRepairs(canvas, w, w.getEnd0());
			w = checkForRepairs(canvas, w, w.getEnd1());
			if (performShortening(canvas, start, cur)) {
				return;
			}
			if (w.getLength() > 0) ws.add(w);
		} else {
			Location m;
			if (direction == HORIZONTAL) {
				m = Location.create(cur.getX(), start.getY());
			} else {
				m = Location.create(start.getX(), cur.getY());
			}
			Wire w0 = Wire.create(start, m);
			Wire w1 = Wire.create(m, cur);
			w0 = checkForRepairs(canvas, w0, start);
			w1 = checkForRepairs(canvas, w1, cur);
			if (w0.getLength() > 0) ws.add(w0);
			if (w1.getLength() > 0) ws.add(w1);
		}
		if (ws.size() > 0) {
			CircuitMutation mutation = new CircuitMutation(canvas.getCircuit());
			mutation.addAll(ws);
			StringGetter desc;
			if (ws.size() == 1) desc = Strings.getter("addWireAction");
			else desc = Strings.getter("addWiresAction");
			Action act = mutation.toAction(desc);
			canvas.getProject().doAction(act);
			lastAction = act;
		}
	}
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:50,代码来源:WiringTool.java

示例7: actionPerformed

import com.cburch.logisim.circuit.CircuitMutation; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {

	Set<Wire> wires = proj.getCurrentCircuit().getWires();
	CircuitState state = proj.getCircuitState();
	ArrayList<Wire> wiresMutator = new ArrayList<Wire>();
	Canvas canvas = proj.getFrame().getCanvas();
	for (Wire wire : wires) {
		Location s = wire.getE0();
		Location t = wire.getE1();
		if (state.getValue(s).getColor().equals(new Color(192, 0, 0))) {
			Wiring w = new Wiring();
			
			AddTool at = (AddTool) w.getTool("Pin");
			AttributeSet atrSet = at.getAttributeSet();
			// Revisar como alterar el numero de bits de datos
			atrSet.setValue(Pin.ATTR_TRISTATE, false);
			at.setAttributeSet(atrSet);
			at.setState(canvas, 2);

			MouseEvent mouseEvent = new MouseEvent(canvas, 0, 0, 0,
					s.getX() - 100, s.getY(), 50, 50, 1, false, 1);
			at.mouseReleased(canvas, canvas.getGraphics(), mouseEvent);
			canvas.completeAction();

			Location inicio = Location.create(s.getX() - 100, s.getY());
			Location fin = Location.create(s.getX() - 50, s.getY());

			Wire newWire = Wire.create(inicio, fin);
			
			wiresMutator.add(newWire);
			
		}

	}
	CircuitMutation mutation = new CircuitMutation(
			canvas.getCircuit());
	mutation.addAll(wiresMutator);
	StringGetter desc;
	if (wiresMutator.size() == 1)
		desc = Strings.getter("addWireAction");
	else
		desc = Strings.getter("addWiresAction");
	Action act = mutation.toAction(desc);
	canvas.getProject().doAction(act);
	canvas.completeAction();

}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:49,代码来源:PinErrorListener.java


注:本文中的com.cburch.logisim.circuit.CircuitMutation.addAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。