private void addCoupling(ICouplingSet couplings, IBasicDEVSModel model1,
IPort port1, MultiCouplingTargetList model2, String name,
ISelector<IBasicDEVSModel> selector) {
if (port1 == null) {
throw new InvalidCouplingException(
"Cannot use null as starting port of a coupling (" + name
+ ") starting model " + model1.getName() + "");
}
MultiCoupling coupling =
new MultiCoupling(model1, port1, model2, name, selector);
// only allow addition if models and ports are existent!
if ((!subModels.contains(model1) && (this != model1))
|| !model1.hasPort(port1)) {
throw new InvalidCouplingException(
"Add coupling: Not existing model or port! " + model1.getName() + ":"
+ port1.getName());
}
couplings.addCoupling(coupling);
changed();