private double getDiameterFromCell(final Optional<? extends CellWithCircularArea> biggest) { return biggest .transform(n -> n instanceof CircularDeformableCell ? ((CircularDeformableCell) n).getMaxDiameter() : n.getDiameter()) .or(0d); } }
final double maxRn; final double minRn; final double maxRN = thisNode.getMaxRadius(); final double minRN = thisNode.getRadius(); if (n instanceof CircularDeformableCell) { final CircularDeformableCell cell = (CircularDeformableCell) n; maxRn = cell.getMaxRadius(); minRn = cell.getRadius(); } else { maxRn = n.getRadius();
if (n instanceof CircularDeformableCell) { maxDist = (thisNode.getMaxRadius() + ((CircularDeformableCell) n).getMaxRadius()); } else { maxDist = (thisNode.getMaxRadius() + ((CellWithCircularArea) n).getRadius()); final double nodeMaxRadius = thisNode.getMaxRadius(); final double nodeMinRadius = thisNode.getRadius(); localNodeMaxRadius = localNode.getMaxRadius(); localNodeMinRadius = localNode.getRadius(); } else { localNodeMaxRadius = ((CellWithCircularArea) n).getRadius(); .collect(Collectors.toList()); if (pushForces.isEmpty()) { thisNode.addPolarization(new Continuous2DEuclidean(0, 0)); } else { for (final Position p : pushForces) { thisNode.addPolarization(new Continuous2DEuclidean(0, 0)); } else { thisNode.addPolarization(new Continuous2DEuclidean(resVersor[0] / module, resVersor[1] / module));
@Override public boolean isValid() { final CircularDeformableCell thisNode = (CircularDeformableCell) getNode(); return env.getNodesWithinRange(thisNode, env.getMaxDiameterAmongCircularDeformableCells()).stream() .parallel() .flatMap(n -> n instanceof CellWithCircularArea ? Stream.of((CellWithCircularArea) n) : Stream.empty()) .filter(n -> { final double maxDN = thisNode.getMaxRadius(); if (n instanceof CircularDeformableCell) { return env.getDistanceBetweenNodes(n, thisNode) < (maxDN + ((CircularDeformableCell) n).getMaxRadius()); } else { return env.getDistanceBetweenNodes(n, thisNode) < (maxDN + n.getRadius()); } }) .findAny() .isPresent(); }
@Override protected void nodeAdded(final Node<Double> node, final Position position, final Neighborhood<Double> neighborhood) { super.nodeAdded(node, position, neighborhood); if (node instanceof CellWithCircularArea) { final CellWithCircularArea cell = (CellWithCircularArea) node; if (cell.getDiameter() > getMaxDiameterAmongCellWithCircularShape()) { biggestCellWithCircularArea = Optional.of(cell); } } if (node instanceof CircularDeformableCell) { final CircularDeformableCell cell = (CircularDeformableCell) node; if (cell.getMaxDiameter() > getMaxDiameterAmongCircularDeformableCells()) { biggestCircularDeformableCell = Optional.of(cell); } } }