Search in sources :

Example 1 with SignalVolt

use of com.cas.circuit.SignalVolt in project TeachingInSimulation by ScOrPiOzzy.

the class R method findElecComp.

private void findElecComp(List<ElecCompDef> elecCompList, List<Terminal> terminals, boolean considerEVN) {
    if (voltage instanceof SignalVolt) {
        return;
    }
    Terminal terminal = null;
    ElecCompDef comp = null;
    ElecCompDef toRemove = null;
    Iterator<Terminal> it = terminals.iterator();
    while (it.hasNext()) {
        terminal = it.next();
        comp = terminal.getElecComp();
        if (!considerEVN || terminal.getResidualVolt().containsKey(voltage.getEnv())) {
            if (comp == null) {
                if (terminal.getParent() != null && terminal.getParent() instanceof Jack) {
                    if (terminal == startTerminal || terminal == endTerminal) {
                        // 针脚的parent是插孔Jack,插孔的parent是ElecCompDef
                        toRemove = (ElecCompDef) terminal.getParent().getParent();
                    }
                }
            }
            if (comp != null && !elecCompList.contains(comp)) {
                elecCompList.add(comp);
            }
        }
    }
    if (toRemove != null) {
        elecCompList.remove(toRemove);
    }
// System.out.println(voltage.getEnv() + "-" +elecCompList);
}
Also used : SignalVolt(com.cas.circuit.SignalVolt) ElecCompDef(com.cas.circuit.vo.ElecCompDef) Jack(com.cas.circuit.vo.Jack) Terminal(com.cas.circuit.vo.Terminal)

Aggregations

SignalVolt (com.cas.circuit.SignalVolt)1 ElecCompDef (com.cas.circuit.vo.ElecCompDef)1 Jack (com.cas.circuit.vo.Jack)1 Terminal (com.cas.circuit.vo.Terminal)1