@Test public void testGetSpanningCuboid() { CubeDesc cube = getTestKylinCubeWithoutSeller(); CuboidScheduler scheduler = new CuboidScheduler(cube); Collection<Long> spnanningCuboids = scheduler.getSpanningCuboid(248); assertEquals("[]", spnanningCuboids.toString()); }
public Collection<Long> getSpanningCuboid(long cuboid) { if (cuboid > max || cuboid < 0) { throw new IllegalArgumentException("Cuboid " + cuboid + " is out of scope 0-" + max); } Collection<Long> result = cache.get(cuboid); if (result != null) { return result; } Collection<Long> allPrevOffspring = new HashSet<Long>(); for (Long sibling : findSmallerSibling(cuboid)) { Collection<Long> prevOffsprings = generateChildren(sibling); allPrevOffspring.addAll(prevOffsprings); } result = new ArrayList<Long>(); for (Long offspring : generateChildren(cuboid)) { if (!allPrevOffspring.contains(offspring)) { result.add(offspring); } } cache.put(cuboid, result); return result; }
CuboidScheduler { public Collection<Long> getSpanningCuboid(long cuboid) { if (cuboid > max || cuboid < 0) { throw new IllegalArgumentException("Cuboid " + cuboid + " is out of scope 0-" + max); } Collection<Long> result = cache.get(cuboid); if (result != null) { return result; } Collection<Long> allPrevOffspring = new HashSet<Long>(); for (Long sibling : findSmallerSibling(cuboid)) { Collection<Long> prevOffsprings = generateChildren(sibling); allPrevOffspring.addAll(prevOffsprings); } result = new ArrayList<Long>(); for (Long offspring : generateChildren(cuboid)) { if (!allPrevOffspring.contains(offspring)) { result.add(offspring); } } cache.put(cuboid, result); return result; } }
CuboidScheduler { public Collection<Long> getSpanningCuboid(long cuboid) { if (cuboid > max || cuboid < 0) { throw new IllegalArgumentException("Cuboid " + cuboid + " is out of scope 0-" + max); } Collection<Long> result = cache.get(cuboid); if (result != null) { return result; } Collection<Long> allPrevOffspring = new HashSet<Long>(); for (Long sibling : findSmallerSibling(cuboid)) { Collection<Long> prevOffsprings = generateChildren(sibling); allPrevOffspring.addAll(prevOffsprings); } result = new ArrayList<Long>(); for (Long offspring : generateChildren(cuboid)) { if (!allPrevOffspring.contains(offspring)) { result.add(offspring); } } cache.put(cuboid, result); return result; } CuboidScheduler(CubeDesc cube); }
CuboidScheduler { public Collection<Long> getSpanningCuboid(long cuboid) { if (cuboid > max || cuboid < 0) { throw new IllegalArgumentException("Cuboid " + cuboid + " is out of scope 0-" + max); } Collection<Long> result = cache.get(cuboid); if (result != null) { return result; } Collection<Long> allPrevOffspring = new HashSet<Long>(); for (Long sibling : findSmallerSibling(cuboid)) { Collection<Long> prevOffsprings = generateChildren(sibling); allPrevOffspring.addAll(prevOffsprings); } result = new ArrayList<Long>(); for (Long offspring : generateChildren(cuboid)) { if (!allPrevOffspring.contains(offspring)) { result.add(offspring); } } cache.put(cuboid, result); return result; } CuboidScheduler(CubeDesc cube); Collection<Long> getSpanningCuboid(long cuboid); Collection<Long> findSmallerSibling(long cuboid); int getCardinality(long cuboid); }
CuboidScheduler { public Collection<Long> getSpanningCuboid(long cuboid) { if (cuboid > max || cuboid < 0) { throw new IllegalArgumentException("Cuboid " + cuboid + " is out of scope 0-" + max); } Collection<Long> result = cache.get(cuboid); if (result != null) { return result; } Collection<Long> allPrevOffspring = new HashSet<Long>(); for (Long sibling : findSmallerSibling(cuboid)) { Collection<Long> prevOffsprings = generateChildren(sibling); allPrevOffspring.addAll(prevOffsprings); } result = new ArrayList<Long>(); for (Long offspring : generateChildren(cuboid)) { if (!allPrevOffspring.contains(offspring)) { result.add(offspring); } } cache.put(cuboid, result); return result; } CuboidScheduler(CubeDesc cube); Collection<Long> getSpanningCuboid(long cuboid); Collection<Long> findSmallerSibling(long cuboid); int getCardinality(long cuboid);  }