Search in sources :

Example 1 with CircuitTransactionResult

use of com.cburch.logisim.circuit.CircuitTransactionResult in project logisim-evolution by reds-heig.

the class SetAttributeAction method doIt.

@Override
public void doIt(Project proj) {
    CircuitMutation xn = new CircuitMutation(circuit);
    int len = values.size();
    oldValues.clear();
    for (int i = 0; i < len; i++) {
        Component comp = comps.get(i);
        Attribute<Object> attr = attrs.get(i);
        Object value = values.get(i);
        if (circuit.contains(comp)) {
            oldValues.add(null);
            xn.set(comp, attr, value);
        } else {
            AttributeSet compAttrs = comp.getAttributeSet();
            oldValues.add(compAttrs.getValue(attr));
            compAttrs.setValue(attr, value);
        }
    }
    if (!xn.isEmpty()) {
        CircuitTransactionResult result = xn.execute();
        xnReverse = result.getReverseTransaction();
    }
}
Also used : CircuitTransactionResult(com.cburch.logisim.circuit.CircuitTransactionResult) AttributeSet(com.cburch.logisim.data.AttributeSet) CircuitMutation(com.cburch.logisim.circuit.CircuitMutation) Component(com.cburch.logisim.comp.Component)

Aggregations

CircuitMutation (com.cburch.logisim.circuit.CircuitMutation)1 CircuitTransactionResult (com.cburch.logisim.circuit.CircuitTransactionResult)1 Component (com.cburch.logisim.comp.Component)1 AttributeSet (com.cburch.logisim.data.AttributeSet)1