/** @return */ public boolean isFilled() { for (Cell<T> c : this) { if (c.isFilled()) { return true; } } return false; }
public boolean tryInterleaveWith(Row<T> other) { // System.out.println("Try to interleave " + this); // System.out.print(" with " + other); if (!isInterleaveableWith(other)) { // System.out.println(": failed"); return false; } Iterator<Cell<T>> oIt = other.iterator(); for (Cell<T> c : this) { Cell<T> oC = oIt.next(); if (c.isFilled()) { if (oC.prevCell == null) { oC.parent.firstCell = c; } else { oC.prevCell.nextCell = c; } if (oC.nextCell == null) { oC.parent.lastCell = c; } else { oC.nextCell.prevCell = c; } c.prevCell = oC.prevCell; c.nextCell = oC.nextCell; c.parent = oC.parent; oC.nextCell = null; oC.prevCell = null; oC.parent = null; } else if (c.isUnpackable()) { oC.setPackable(false); } } this._remove(); // System.out.println(": done"); return true; }