for (int i = 0; i < inputPatterns.length; i++) {
InputPattern inputPattern = inputPatterns[i];
numNeeded = numTokensNeeded(inputPattern);
List data = (List) dataSoFar.get(new ChannelID(inputPattern
.getPortname(), 0));
if (data != null) {
numNeeded = numNeeded - data.size();
}
if (numNeeded > 0) {
inputProfile.put(new ChannelID(inputPattern.getPortname(),
0), Integer.valueOf(numNeeded));
}
}
return inputProfile;
}
InputPattern[] inputPatterns = actions[0].getInputPatterns();
if (inputPatterns.length == 0) {
// if the first action has no input patterns,
// then the "intersection" will be empty.
return inputProfile;
}
for (int i = 0; i < inputPatterns.length; i++) {
InputPattern inputPattern = inputPatterns[i];
numNeeded = numTokensNeeded(inputPattern);
for (int j = 1; j < actions.length; j++) {
InputPattern ip = getInputPattern(inputPattern.getPortname(),
actions[j]);
if (ip == null) {
numNeeded = 0;
break;
} else {
numNeeded = Math.min(numNeeded, numTokensNeeded(ip));
List data = (List) dataSoFar.get(new ChannelID(inputPattern
.getPortname(), 0));
if (data != null) {
numNeeded = numNeeded - data.size();
}
}
}
if (numNeeded > 0) {
inputProfile.put(new ChannelID(inputPattern.getPortname(), 0),
Integer.valueOf(numNeeded));
}
}
return inputProfile;