net.intelie.pipes.UnsafeRow 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 java.util.Arrays;
public final class UnsafeRow implements UnsafeObject {
private final Object[] buffer;
public UnsafeRow(int size) {
this(new Object[size]);
}
private UnsafeRow(Object[] buffer) {
this.buffer = buffer;
}
public Object get(int id) {
return this.buffer[id];
}
public void set(int id, Object obj) {
this.buffer[id] = obj;
}
@Override
public UnsafeRow copy() {
return new UnsafeRow(Arrays.copyOf(buffer, buffer.length));
}
public ArrayRow toRow() {
return new ArrayRow(Arrays.copyOf(buffer, buffer.length));
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof UnsafeRow)) return false;
UnsafeRow row = (UnsafeRow) o;
return Arrays.equals(buffer, row.buffer);
}
@Override
public int hashCode() {
return Arrays.hashCode(buffer);
}
@Override
public String toString() {
return "" + Arrays.asList(buffer);
}
}