Search in sources :

Example 11 with EndData

use of com.cburch.logisim.comp.EndData in project logisim-evolution by reds-heig.

the class CircuitPoints method add.

// 
// update methods
// 
void add(Component comp) {
    if (comp instanceof Wire) {
        Wire w = (Wire) comp;
        addSub(w.getEnd0(), w, null);
        addSub(w.getEnd1(), w, null);
    } else {
        for (EndData endData : comp.getEnds()) {
            if (endData != null) {
                addSub(endData.getLocation(), comp, endData);
            }
        }
    }
}
Also used : EndData(com.cburch.logisim.comp.EndData)

Example 12 with EndData

use of com.cburch.logisim.comp.EndData in project logisim-evolution by reds-heig.

the class CircuitPoints method remove.

void remove(Component comp) {
    if (comp instanceof Wire) {
        Wire w = (Wire) comp;
        removeSub(w.getEnd0(), w);
        removeSub(w.getEnd1(), w);
    } else {
        for (EndData endData : comp.getEnds()) {
            if (endData != null) {
                removeSub(endData.getLocation(), comp);
            }
        }
    }
}
Also used : EndData(com.cburch.logisim.comp.EndData)

Example 13 with EndData

use of com.cburch.logisim.comp.EndData in project logisim-evolution by reds-heig.

the class CircuitPoints method computeIncompatibilityData.

private void computeIncompatibilityData(Location loc, LocationData locData) {
    WidthIncompatibilityData error = null;
    if (locData != null) {
        BitWidth width = BitWidth.UNKNOWN;
        for (EndData endData : locData.ends) {
            if (endData != null) {
                BitWidth endWidth = endData.getWidth();
                if (width == BitWidth.UNKNOWN) {
                    width = endWidth;
                } else if (width != endWidth && endWidth != BitWidth.UNKNOWN) {
                    if (error == null) {
                        error = new WidthIncompatibilityData();
                        error.add(loc, width);
                    }
                    error.add(loc, endWidth);
                }
            }
        }
        locData.width = width;
    }
    if (error == null) {
        incompatibilityData.remove(loc);
    } else {
        incompatibilityData.put(loc, error);
    }
}
Also used : BitWidth(com.cburch.logisim.data.BitWidth) EndData(com.cburch.logisim.comp.EndData)

Example 14 with EndData

use of com.cburch.logisim.comp.EndData in project logisim-evolution by reds-heig.

the class CircuitPoints method getExclusive.

Component getExclusive(Location loc) {
    LocationData locData = map.get(loc);
    if (locData == null)
        return null;
    int i = -1;
    for (EndData endData : locData.ends) {
        i++;
        if (endData != null && endData.isExclusive()) {
            return locData.components.get(i);
        }
    }
    return null;
}
Also used : EndData(com.cburch.logisim.comp.EndData)

Example 15 with EndData

use of com.cburch.logisim.comp.EndData in project logisim-evolution by reds-heig.

the class Propagator method checkComponentEnds.

// 
// private methods
// 
void checkComponentEnds(CircuitState state, Component comp) {
    for (EndData end : comp.getEnds()) {
        Location loc = end.getLocation();
        SetData oldHead = state.causes.get(loc);
        Value oldVal = computeValue(oldHead);
        SetData newHead = removeCause(state, oldHead, loc, comp);
        Value newVal = computeValue(newHead);
        Value wireVal = state.getValueByWire(loc);
        if (!newVal.equals(oldVal) || wireVal != null) {
            state.markPointAsDirty(loc);
        }
        if (wireVal != null)
            state.setValueByWire(loc, Value.NIL);
    }
}
Also used : EndData(com.cburch.logisim.comp.EndData) Value(com.cburch.logisim.data.Value) Location(com.cburch.logisim.data.Location)

Aggregations

EndData (com.cburch.logisim.comp.EndData)20 Component (com.cburch.logisim.comp.Component)8 Location (com.cburch.logisim.data.Location)7 ArrayList (java.util.ArrayList)7 Splitter (com.cburch.logisim.circuit.Splitter)6 InstanceComponent (com.cburch.logisim.instance.InstanceComponent)5 BitWidth (com.cburch.logisim.data.BitWidth)3 SubcircuitFactory (com.cburch.logisim.circuit.SubcircuitFactory)2 Wire (com.cburch.logisim.circuit.Wire)2 Pin (com.cburch.logisim.std.wiring.Pin)2 HashSet (java.util.HashSet)2 NetlistComponent (com.bfh.logisim.designrulecheck.NetlistComponent)1 Circuit (com.cburch.logisim.circuit.Circuit)1 CircuitAttributes (com.cburch.logisim.circuit.CircuitAttributes)1 SplitterFactory (com.cburch.logisim.circuit.SplitterFactory)1 ComponentEvent (com.cburch.logisim.comp.ComponentEvent)1 Attribute (com.cburch.logisim.data.Attribute)1 Bounds (com.cburch.logisim.data.Bounds)1 Direction (com.cburch.logisim.data.Direction)1 Value (com.cburch.logisim.data.Value)1