@Override
public Switch add() {
String id = checkAndGetUniqueId();
if (node1 == null) {
throw new ValidationException(this, "first connection node is not set");
}
if (node2 == null) {
throw new ValidationException(this, "second connection node is not set");
}
if (kind == null) {
throw new ValidationException(this, "kind is not set");
}
SwitchImpl aSwitch = new SwitchImpl(NodeBreakerVoltageLevel.this, id, getName(), kind, open, retained, fictitious);
getNetwork().getObjectStore().checkAndAdd(aSwitch);
int e = graph.addEdge(node1, node2, aSwitch);
switches.put(id, e);
invalidateCache();
getNetwork().getListeners().notifyCreation(aSwitch);
return aSwitch;
}