MatrixElement element = null;
if (numItems > 1) {
CompoundMatrixElement compoundElement = new CompoundMatrixElement();
Set<ContinuousMatrixElement> elements = new HashSet<ContinuousMatrixElement>();
// pre calculate the compound values and cache it in compoundElement.
StringBuilder compoundValues = new StringBuilder();
compoundValues.append('(');
for (int j = 0; j < numItems; j++) {
Double2DArray anItem = continuousData.getItem(j);
double elementValue = anItem.getValue(colIndex, pRowIndex);
ContinuousMatrixElement anElement = new ContinuousMatrixElement();
anElement.setValue(elementValue);
anElement.setColumn(matrixColumn);
// This can be null, means the default definition 'AVG' is used.
ItemDefinition definition = getItemDefMap().get(anItem);
if (definition != null) {
anElement.setDefinition(definition);
}
anElement.appendValue(compoundValues);
if (j < numItems - 1) {
compoundValues.append(' ');
}
}
compoundValues.append(')');
compoundElement.setCompoundValue(compoundValues.toString());
compoundElement.setElements(elements);
element = compoundElement;
} else {
// single item definition, use single element:
double elementValue = continuousData.getState(colIndex, pRowIndex, 0);