final DoubleVector[] newCenterArray = new DoubleVector[centers.length];
final int[] summationCount = new int[centers.length];
// if our cache is not enabled, iterate over the disk items
if (cache == null) {
// we have an assignment step
final NullWritable value = NullWritable.get();
final VectorWritable key = new VectorWritable();
while (peer.readNext(key, value)) {
assignCentersInternal(newCenterArray, summationCount, key.getVector()
.deepCopy());
}
} else {
// if our cache is enabled but empty, we have to read it from disk first
if (cache.isEmpty()) {
final NullWritable value = NullWritable.get();
final VectorWritable key = new VectorWritable();
while (peer.readNext(key, value)) {
DoubleVector deepCopy = key.getVector().deepCopy();
cache.add(deepCopy);
// but do the assignment directly