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);
}
}
}
}
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);
}
}
}
}
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);
}
}
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;
}
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);
}
}
Aggregations