incs[i] = new BigDecimal(0);
}
}
Tuple end = new VTuple(schema.getColumnNum());
Column column;
for (int i = 0; i < last.size(); i++) {
column = schema.getColumn(i);
switch (column.getDataType().getType()) {
case CHAR:
if (overflowFlag[i]) {
end.put(i, DatumFactory.createChar((char) (range.getStart().get(i).asChar() + incs[i].longValue())));
} else {
end.put(i, DatumFactory.createChar((char) (last.get(i).asChar() + incs[i].longValue())));
}
break;
case BIT:
if (overflowFlag[i]) {
end.put(i, DatumFactory.createBit(
(byte) (range.getStart().get(i).asByte() + incs[i].longValue())));
} else {
end.put(i, DatumFactory.createBit((byte) (last.get(i).asByte() + incs[i].longValue())));
}
break;
case INT2:
if (overflowFlag[i]) {
end.put(i, DatumFactory.createInt2(
(short) (range.getStart().get(i).asInt2() + incs[i].longValue())));
} else {
end.put(i, DatumFactory.createInt2((short) (last.get(i).asInt2() + incs[i].longValue())));
}
break;
case INT4:
if (overflowFlag[i]) {
end.put(i, DatumFactory.createInt4(
(int) (range.getStart().get(i).asInt4() + incs[i].longValue())));
} else {
end.put(i, DatumFactory.createInt4((int) (last.get(i).asInt4() + incs[i].longValue())));
}
break;
case INT8:
if (overflowFlag[i]) {
end.put(i, DatumFactory.createInt8(
range.getStart().get(i).asInt4() + incs[i].longValue()));
} else {
end.put(i, DatumFactory.createInt8(last.get(i).asInt8() + incs[i].longValue()));
}
break;
case FLOAT4:
if (overflowFlag[i]) {
end.put(i, DatumFactory.createFloat4(
range.getStart().get(i).asFloat4() + incs[i].longValue()));
} else {
end.put(i, DatumFactory.createFloat4(last.get(i).asFloat4() + incs[i].longValue()));
}
break;
case FLOAT8:
if (overflowFlag[i]) {
end.put(i, DatumFactory.createFloat8(
range.getStart().get(i).asFloat8() + incs[i].longValue()));
} else {
end.put(i, DatumFactory.createFloat8(last.get(i).asFloat8() + incs[i].longValue()));
}
break;
case TEXT:
if (overflowFlag[i]) {
end.put(i, DatumFactory.createText(((char) (range.getStart().get(i).asChars().charAt(0)
+ incs[i].longValue())) + ""));
} else {
end.put(i, DatumFactory.createText(
((char) (last.get(i).asChars().charAt(0) + incs[i].longValue())) + ""));
}
break;
default:
throw new UnsupportedOperationException(column.getDataType() + " is not supported yet");
}
}
return end;
}