use of com.tencent.angel.psagent.matrix.transport.router.value.IntValuesPart in project angel by Tencent.
the class ServerRowUtils method getByKeys.
public static ValuePart getByKeys(ServerRow row, KeyPart keyPart) {
ValuePart result;
if (keyPart instanceof IIntKeyPartOp) {
// Index is int
IIntKeyPartOp intKeyPart = (IIntKeyPartOp) keyPart;
if (row instanceof ServerIntFloatRow) {
float[] values = ((ServerIntFloatRow) row).get(intKeyPart.getKeys());
result = new FloatValuesPart(values);
} else if (row instanceof ServerIntDoubleRow) {
double[] values = ((ServerIntDoubleRow) row).get(intKeyPart.getKeys());
result = new DoubleValuesPart(values);
} else if (row instanceof ServerIntIntRow) {
int[] values = ((ServerIntIntRow) row).get(intKeyPart.getKeys());
result = new IntValuesPart(values);
} else if (row instanceof ServerIntLongRow) {
long[] values = ((ServerIntLongRow) row).get(intKeyPart.getKeys());
result = new LongValuesPart(values);
} else {
throw new UnsupportedOperationException("Unsupport row type " + row.getClass().getName());
}
} else if (keyPart instanceof ILongKeyPartOp) {
// Index is long
ILongKeyPartOp longKeyPart = (ILongKeyPartOp) keyPart;
if (row instanceof ServerLongFloatRow) {
float[] values = ((ServerLongFloatRow) row).get(longKeyPart.getKeys());
result = new FloatValuesPart(values);
} else if (row instanceof ServerLongDoubleRow) {
double[] values = ((ServerLongDoubleRow) row).get(longKeyPart.getKeys());
result = new DoubleValuesPart(values);
} else if (row instanceof ServerLongIntRow) {
int[] values = ((ServerLongIntRow) row).get(longKeyPart.getKeys());
result = new IntValuesPart(values);
} else if (row instanceof ServerLongLongRow) {
long[] values = ((ServerLongLongRow) row).get(longKeyPart.getKeys());
result = new LongValuesPart(values);
} else {
throw new UnsupportedOperationException("Unsupport row type " + row.getClass().getName());
}
} else {
throw new UnsupportedOperationException("Unsupport index type " + keyPart.getClass().getName());
}
return result;
}
Aggregations