/** * Returns true if children cells (of the next finer granularity) can fully contain * this cell. For instance, if this cell is @ gran=20, and the next finest gran=5, * then conceivably 4 children could contain a gran20. * * A cell cannot be contained by its children when it lies on the edges of the structure * (a parent may not have a full set of children) */ public boolean canBeContainedByChildren() { FrozenGranularityLayer childLayer = layer.getChild(); if (childLayer == null) { return false; } return childLayer.canFullyContain(range); }
private List<FrozenCell> makeChildrenCells() { FrozenGranularityLayer childLayer = layer.getChild(); if (childLayer == null) { return Collections.emptyList(); } List<TimeRange> ranges = childLayer.fillRange(range); List<FrozenCell> res = new ArrayList<FrozenCell>(ranges.size()); for (TimeRange childRange: ranges) { res.add(childLayer.getCell(childRange)); } return res; }
/** * Returns the range that the children of this cell will occupy, or null if * there are no children. */ public TimeRange getChildrenRange() { FrozenGranularityLayer child = layer.getChild(); if (child == null) { return null; } return child.getTotalRange().intersect(range); }
List<FrozenCell> splitRange(FrozenCell cell) { if (!cell.canBeContainedByChildren()) { return Collections.emptyList(); } Granularity childGran = cell.getLayer().getChild().getGranularity(); if (childGran.isSmallerThan(minGran)) { return Collections.emptyList(); } return cell.getChildren(); } }