Search in sources :

Example 36 with Circuit

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

the class FileStatistics method doUniqueCounts.

private static void doUniqueCounts(Map<ComponentFactory, Count> counts, Map<Circuit, Map<ComponentFactory, Count>> circuitCounts) {
    for (Count count : counts.values()) {
        ComponentFactory factory = count.getFactory();
        int unique = 0;
        for (Circuit circ : circuitCounts.keySet()) {
            Count subcount = circuitCounts.get(circ).get(factory);
            if (subcount != null) {
                unique += subcount.simpleCount;
            }
        }
        count.uniqueCount = unique;
    }
}
Also used : ComponentFactory(com.cburch.logisim.comp.ComponentFactory) Circuit(com.cburch.logisim.circuit.Circuit)

Example 37 with Circuit

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

the class LoadedLibrary method replaceAll.

private static void replaceAll(Map<ComponentFactory, ComponentFactory> compMap, Map<Tool, Tool> toolMap) {
    for (Project proj : Projects.getOpenProjects()) {
        Tool oldTool = proj.getTool();
        Circuit oldCircuit = proj.getCurrentCircuit();
        if (toolMap.containsKey(oldTool)) {
            proj.setTool(toolMap.get(oldTool));
        }
        SubcircuitFactory oldFactory = oldCircuit.getSubcircuitFactory();
        if (compMap.containsKey(oldFactory)) {
            SubcircuitFactory newFactory;
            newFactory = (SubcircuitFactory) compMap.get(oldFactory);
            proj.setCurrentCircuit(newFactory.getSubcircuit());
        }
        replaceAll(proj.getLogisimFile(), compMap, toolMap);
    }
    for (LogisimFile file : LibraryManager.instance.getLogisimLibraries()) {
        replaceAll(file, compMap, toolMap);
    }
}
Also used : Project(com.cburch.logisim.proj.Project) SubcircuitFactory(com.cburch.logisim.circuit.SubcircuitFactory) Circuit(com.cburch.logisim.circuit.Circuit) Tool(com.cburch.logisim.tools.Tool) AddTool(com.cburch.logisim.tools.AddTool)

Example 38 with Circuit

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

the class FileStatistics method getTotal.

private static Count getTotal(List<Count> counts, Set<Circuit> exclude) {
    Count ret = new Count(null);
    for (Count count : counts) {
        ComponentFactory factory = count.getFactory();
        Circuit factoryCirc = null;
        if (factory instanceof SubcircuitFactory) {
            factoryCirc = ((SubcircuitFactory) factory).getSubcircuit();
        }
        if (exclude == null || !exclude.contains(factoryCirc)) {
            ret.simpleCount += count.simpleCount;
            ret.uniqueCount += count.uniqueCount;
            ret.recursiveCount += count.recursiveCount;
        }
    }
    return ret;
}
Also used : ComponentFactory(com.cburch.logisim.comp.ComponentFactory) SubcircuitFactory(com.cburch.logisim.circuit.SubcircuitFactory) Circuit(com.cburch.logisim.circuit.Circuit)

Example 39 with Circuit

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

the class Project method removeCircuitListener.

public void removeCircuitListener(CircuitListener value) {
    circuitListeners.remove(value);
    Circuit current = getCurrentCircuit();
    if (current != null)
        current.removeCircuitListener(value);
}
Also used : Circuit(com.cburch.logisim.circuit.Circuit)

Example 40 with Circuit

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

the class Project method doTestVector.

public int doTestVector(String vectorname, String name) {
    Circuit circuit = (name == null ? file.getMainCircuit() : file.getCircuit(name));
    if (circuit == null) {
        System.err.println("Circuit '" + name + "' not found.");
        return -1;
    }
    setCurrentCircuit(circuit);
    return TestThread.doTestVector(this, circuit, vectorname);
}
Also used : Circuit(com.cburch.logisim.circuit.Circuit)

Aggregations

Circuit (com.cburch.logisim.circuit.Circuit)62 Component (com.cburch.logisim.comp.Component)19 SubcircuitFactory (com.cburch.logisim.circuit.SubcircuitFactory)12 Project (com.cburch.logisim.proj.Project)11 ArrayList (java.util.ArrayList)9 Wire (com.cburch.logisim.circuit.Wire)8 ComponentFactory (com.cburch.logisim.comp.ComponentFactory)8 Location (com.cburch.logisim.data.Location)8 Bounds (com.cburch.logisim.data.Bounds)6 LogisimFile (com.cburch.logisim.file.LogisimFile)6 AddTool (com.cburch.logisim.tools.AddTool)6 Tool (com.cburch.logisim.tools.Tool)6 CircuitState (com.cburch.logisim.circuit.CircuitState)5 AttributeSet (com.cburch.logisim.data.AttributeSet)5 Selection (com.cburch.logisim.gui.main.Selection)5 Action (com.cburch.logisim.proj.Action)4 CircuitMutation (com.cburch.logisim.circuit.CircuitMutation)3 ComponentDrawContext (com.cburch.logisim.comp.ComponentDrawContext)3 Graphics (java.awt.Graphics)3 CanvasObject (com.cburch.draw.model.CanvasObject)2