net.intelie.pipes.ArrayRow Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pipes-api Show documentation
Show all versions of pipes-api Show documentation
Intelie Pipes' API classes and interfaces
package net.intelie.pipes;
import static net.intelie.pipes.util.Preconditions.checkNotNull;
public class ArrayRow extends AbstractRow {
private static final long serialVersionUID = 1L;
private final Object[] values;
public ArrayRow(Object... values) {
checkNotNull(values, "values array cannot be null");
this.values = values;
}
public static ArrayRow concat(Row... rows) {
int size = 0;
for (Row row : rows)
size += row.size();
Object[] newValues = new Object[size];
int i = 0;
for (Row row : rows) {
int thisSize = row.size();
for (int j = 0; j < thisSize; j++)
newValues[i++] = row.get(j);
}
return new ArrayRow(newValues);
}
@Override
public int size() {
return values.length;
}
@Override
public Object get(int index) {
return values[index];
}
}