// place holder:
ContinuousMatrixElementJDBC element = new ContinuousMatrixElementJDBC();
// the compound element to be added later:
CompoundElementJDBC compoundElement = new CompoundElementJDBC();
//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 = getItemDefinitions()[j];
double elementValue = anItem.getValue(pColIndex, rowIndex);
compoundElement.getValues().add(elementValue);
String itemName = getItemDefinitionNames()[j];
// This can be null, means the default definition 'AVG' is used.
Long itemDefId = pMatrixJDBC.getItemDefNameToIDMap().get(itemName);
if (itemDefId == null) {
itemDefId = -1L;
}
compoundElement.getItemDefinitionIDs().add(itemDefId);
compoundValues.append(elementValue);
if (j < numItems - 1) {
compoundValues.append(' ');
}
}
compoundValues.append(')');
compoundElement.setCompoundValue(compoundValues.toString());
compoundElement.setColIndex(pColIndex);
compoundElement.setRowIndex(rowIndex);
pMatrixJDBC.getCompoundElements().add(compoundElement);
element.setElementOrder(pColIndex);
element.setMatrixRowID(rowIds[rowIndex]);
element.setMatrixColID(pColId);