use of com.cas.circuit.vo.Cable in project TeachingInSimulation by ScOrPiOzzy.
the class LinkerData method addLinker.
// /**
// * 所负责工作站
// */
// private byte stationInCharge;
public LinkerMsg addLinker(ILinker linker, ILinkTarget target, String wireMark) {
// 封装LinkerInfo
LinkerMsg linkInfo = new LinkerMsg();
if (linker instanceof Wire) {
linkInfo.setLinkType(LinkerMsg.WIRE);
} else if (linker instanceof Pipe) {
linkInfo.setLinkType(LinkerMsg.PIPE);
} else if (linker instanceof Cable) {
if (target instanceof Jack) {
linkInfo.setLinkType(LinkerMsg.CABLE_JACK);
linkInfo.setElecComp(((Cable) linker).isElecComp());
} else {
linkInfo.setLinkType(LinkerMsg.CABLE_TERM);
// A、B、C
linkInfo.setWireMark(wireMark);
}
linkInfo.setCableKey(((Cable) linker).getPO().getId());
}
linkInfo.setKey(linker.hashCode());
linkInfo.setColor(linker.getColor());
linkInfo.setElecCompKey(target.getElecCompKey());
linkInfo.setTargetKey(target.getTargetKey());
// 线号
linkInfo.setNumMark(linker.getWireNum());
linkerMapForSave.put(linker.hashCode() + "_" + target.hashCode(), linkInfo);
return linkInfo;
}
use of com.cas.circuit.vo.Cable in project TeachingInSimulation by ScOrPiOzzy.
the class LinkerData method modifyWireNum.
public List<LinkerMsg> modifyWireNum(ILinker linker, String wireNum) {
int hashCode = linker.hashCode();
// 因为连线时的判断所以此处线缆必然是特殊线缆
if (linker instanceof Cable) {
Cable cable = (Cable) linker;
List<Wire> bindWires = cable.getBindWires();
// 最近Bind的导线
linker = bindWires.get(bindWires.size() - 1);
}
List<LinkerMsg> msgs = new ArrayList<LinkerMsg>();
ILinkTarget target1 = linker.getLinkTarget1();
modifyTargetWireNum(msgs, hashCode, target1, wireNum);
ILinkTarget target2 = linker.getLinkTarget2();
modifyTargetWireNum(msgs, hashCode, target2, wireNum);
return msgs;
}
Aggregations