// create 2d array and build initialization list. For example:
// outgoingVectors = new ValueVector[][] {
// new ValueVector[] {vv1, vv2},
// new ValueVector[] {vv3, vv4}
// });
JArray outgoingVectorInit = JExpr.newArray(cg.getModel().ref(ValueVector.class).array());
int fieldId = 0;
int batchId = 0;
for (OutgoingRecordBatch batch : outgoing) {
JArray outgoingVectorInitBatch = JExpr.newArray(cg.getModel().ref(ValueVector.class));
for (VectorWrapper<?> vv : batch) {
// declare outgoing value vector and assign it to the array
JVar outVV = cg.declareVectorValueSetupAndMember("outgoing[" + batchId + "]",
new TypedFieldId(vv.getField().getType(),
fieldId,
false));
// add vv to initialization list (e.g. { vv1, vv2, vv3 } )
outgoingVectorInitBatch.add(outVV);
++fieldId;
}
// add VV array to initialization list (e.g. new ValueVector[] { ... })
outgoingVectorInit.add(outgoingVectorInitBatch);