use of com.cburch.logisim.data.AttributeSet in project logisim-evolution by reds-heig.
the class SelectionAttributes method computeAttributes.
private static LinkedHashMap<Attribute<Object>, Object> computeAttributes(Collection<Component> newSel) {
LinkedHashMap<Attribute<Object>, Object> attrMap;
attrMap = new LinkedHashMap<Attribute<Object>, Object>();
Iterator<Component> sit = newSel.iterator();
if (sit.hasNext()) {
AttributeSet first = sit.next().getAttributeSet();
for (Attribute<?> attr : first.getAttributes()) {
@SuppressWarnings("unchecked") Attribute<Object> attrObj = (Attribute<Object>) attr;
attrMap.put(attrObj, first.getValue(attr));
}
while (sit.hasNext()) {
AttributeSet next = sit.next().getAttributeSet();
Iterator<Attribute<Object>> ait = attrMap.keySet().iterator();
while (ait.hasNext()) {
Attribute<Object> attr = ait.next();
if (next.containsAttribute(attr)) {
Object v = attrMap.get(attr);
if (v != null && !v.equals(next.getValue(attr))) {
attrMap.put(attr, null);
}
} else {
ait.remove();
}
}
}
}
return attrMap;
}
use of com.cburch.logisim.data.AttributeSet in project logisim-evolution by reds-heig.
the class InstanceFactory method createAttributeSet.
@Override
public AttributeSet createAttributeSet() {
Attribute<?>[] as = attrs;
AttributeSet ret = as == null ? AttributeSets.EMPTY : AttributeSets.fixedSet(as, defaults);
return ret;
}
use of com.cburch.logisim.data.AttributeSet in project logisim-evolution by reds-heig.
the class AbstractComponentFactory method getDefaultAttributeValue.
public Object getDefaultAttributeValue(Attribute<?> attr, LogisimVersion ver) {
AttributeSet dfltSet = defaultSet;
if (dfltSet == null) {
dfltSet = (AttributeSet) createAttributeSet().clone();
defaultSet = dfltSet;
}
return dfltSet.getValue(attr);
}
use of com.cburch.logisim.data.AttributeSet in project logisim-evolution by reds-heig.
the class CircuitMutatorImpl method set.
public void set(Circuit circuit, Component comp, Attribute<?> attr, Object newValue) {
if (circuit.contains(comp)) {
modified.add(circuit);
@SuppressWarnings("unchecked") Attribute<Object> a = (Attribute<Object>) attr;
AttributeSet attrs = comp.getAttributeSet();
Object oldValue = attrs.getValue(a);
log.add(CircuitChange.set(circuit, comp, attr, oldValue, newValue));
attrs.setValue(a, newValue);
}
}
use of com.cburch.logisim.data.AttributeSet in project logisim-evolution by reds-heig.
the class CircuitAttributes method createBaseAttrs.
static AttributeSet createBaseAttrs(Circuit source, String name) {
AttributeSet ret = AttributeSets.fixedSet(STATIC_ATTRS, STATIC_DEFAULTS);
ret.setValue(CircuitAttributes.NAME_ATTR, name);
ret.addAttributeListener(new StaticListener(source));
return ret;
}
Aggregations