use of com.cburch.logisim.comp.ComponentFactory in project logisim-evolution by reds-heig.
the class AddTool method getBounds.
private Bounds getBounds() {
Bounds ret = bounds;
if (ret == null) {
ComponentFactory source = getFactory();
if (source == null) {
ret = Bounds.EMPTY_BOUNDS;
} else {
AttributeSet base = getBaseAttributes();
ret = source.getOffsetBounds(base).expand(5);
}
bounds = ret;
}
return ret;
}
use of com.cburch.logisim.comp.ComponentFactory in project logisim-evolution by reds-heig.
the class AddTool method getFactory.
public ComponentFactory getFactory() {
ComponentFactory ret = factory;
if (ret != null || sourceLoadAttempted) {
return ret;
} else {
ret = description.getFactory(descriptionBase);
if (ret != null) {
AttributeSet base = getBaseAttributes();
Boolean value = (Boolean) ret.getFeature(ComponentFactory.SHOULD_SNAP, base);
shouldSnap = value == null ? true : value.booleanValue();
}
factory = ret;
sourceLoadAttempted = true;
return ret;
}
}
use of com.cburch.logisim.comp.ComponentFactory in project logisim-evolution by reds-heig.
the class AddTool method getDescription.
@Override
public String getDescription() {
String ret;
FactoryDescription desc = description;
if (desc != null) {
ret = desc.getToolTip();
} else {
ComponentFactory source = getFactory();
if (source != null) {
ret = (String) source.getFeature(ComponentFactory.TOOL_TIP, getAttributeSet());
} else {
ret = null;
}
}
if (ret == null) {
ret = StringUtil.format(Strings.get("addToolText"), getDisplayName());
}
return ret;
}
use of com.cburch.logisim.comp.ComponentFactory in project logisim-evolution by reds-heig.
the class FactoryAttributes method getBase.
AttributeSet getBase() {
AttributeSet ret = baseAttrs;
if (ret == null) {
ComponentFactory fact = factory;
if (fact == null) {
fact = desc.getFactory(descBase);
factory = fact;
}
if (fact == null) {
ret = AttributeSets.EMPTY;
} else {
ret = fact.createAttributeSet();
ret.addAttributeListener(this);
}
baseAttrs = ret;
}
return ret;
}
use of com.cburch.logisim.comp.ComponentFactory in project logisim-evolution by reds-heig.
the class FileStatistics method doRecursiveCount.
private static Map<ComponentFactory, Count> doRecursiveCount(Circuit circuit, Set<Circuit> include, Map<Circuit, Map<ComponentFactory, Count>> countMap) {
if (countMap.containsKey(circuit)) {
return countMap.get(circuit);
}
Map<ComponentFactory, Count> counts = doSimpleCount(circuit);
countMap.put(circuit, counts);
for (Count count : counts.values()) {
count.uniqueCount = count.simpleCount;
count.recursiveCount = count.simpleCount;
}
for (Circuit sub : include) {
SubcircuitFactory subFactory = sub.getSubcircuitFactory();
if (counts.containsKey(subFactory)) {
int multiplier = counts.get(subFactory).simpleCount;
Map<ComponentFactory, Count> subCount;
subCount = doRecursiveCount(sub, include, countMap);
for (Count subcount : subCount.values()) {
ComponentFactory subfactory = subcount.factory;
Count supercount = counts.get(subfactory);
if (supercount == null) {
supercount = new Count(subfactory);
counts.put(subfactory, supercount);
}
supercount.recursiveCount += multiplier * subcount.recursiveCount;
}
}
}
return counts;
}
Aggregations