currentCoupling.getModel2());
}
} // if coupling
else if (coupling instanceof ClassCoupling) {
// get the next coupling
ClassCoupling currentCoupling = (ClassCoupling) coupling;
// this is an out coupling of the current childModel
// backup a reference to the port
IPort a = currentCoupling.getPort1();
// get the number of elements stored at this out port
int numberOfElements = a.getValuesCount();
// if there are any elements
if (numberOfElements > 0) {
// retrieve list containing the selected targets of this classcoupling
List<IBasicDEVSModel> targets =
currentCoupling.getSelector().executeSelection(
model.getSubmodelsByClass(currentCoupling.getModel2()));
// create iterator for retrieved elements
for (int j = 0; j < targets.size(); j++) {
// retrieve current targetmodel
BasicDEVSModel targetModel = (BasicDEVSModel) targets.get(j);
// retrieve inputport for the given model
IPort b = targetModel.getInPort(currentCoupling.getPort2());
copyPortValues(a, b, numberOfElements);
// the the target model is an atomic model remember that it got
// an external message
addToInfluenceeSet(model, influencees, involvedCM, targetModel);
}
}
} // if classcoupling
else if (coupling instanceof MultiCoupling) {
// get the next coupling
MultiCoupling currentCoupling = (MultiCoupling) coupling;
// this is an out coupling of the current childModel
// backup a reference to the port
IPort a = currentCoupling.getPort1();
// get the number of elements stored at this out port
int numberOfElements = a.getValuesCount();
// if there are any elements
if (numberOfElements > 0) {
// retrieve vector containing the selected targets of this
// classcoupling
List<IBasicDEVSModel> targets =
currentCoupling.getSelector().executeSelection(
currentCoupling.getTargetsAsArrayList());
// create iterator for retrieved elements
// Iterator targetIterator = targets.iterator();
// System.out.println(currentCoupling.getTargetsAsArrayList().size());
for (int j = 0; j < targets.size(); j++) {
// retrieve current targetmodel
IBasicDEVSModel targetModel = targets.get(j);
// retrieve inputport for the given model
String portname =
(currentCoupling.getTargets().getTarget(targetModel))
.getPortName();
IPort b = targetModel.getInPort(portname);
copyPortValues(a, b, numberOfElements);