if (!input.hasToken(0)) {
return;
}
MatrixToken token = (MatrixToken) input.get(0);
int actualRowCount = token.getRowCount();
int actualColumnCount = token.getColumnCount();
boolean enforce = ((BooleanToken) enforceMatrixSize.getToken())
.booleanValue();
if (enforce) {
int rowsValue = ((IntToken) rows.getToken()).intValue();
int columnsValue = ((IntToken) columns.getToken()).intValue();
if ((actualRowCount != rowsValue)
|| (actualColumnCount != columnsValue)) {
throw new IllegalActionException(this, "The input matrix size "
+ actualRowCount + "x" + actualColumnCount
+ " does not match what the actor requires, "
+ rowsValue + "x" + columnsValue);
}
}
for (int i = 0; i < actualRowCount; i++) {
for (int j = 0; j < actualColumnCount; j++) {
output.send(0, token.getElementAsToken(i, j));
}
}
}