Source:
<code>private static void refreshCorners(final AbstractDiagramElementContainerEditPart self, DDiagramElement diagElement, RoundedRectangle gradientRoundedShape) { Dimension cornerDimension = getCornerDimension(self); Dimension specificDimension = cornerDimension; Collection<Integer> specificCornerPosition <START> = Sets.newHashSet(); <END> if (self.isRegion()) { DNodeContainer regionContainer = (DNodeContainer) diagElement.eContainer(); Dimension regionContainerCornerDimension = getCornerDimension(regionContainer); if (!regionContainerCornerDimension.getShrinked(cornerDimension).isEmpty()) { int parentStackDirection = self.getParentStackDirection(); boolean firstRegionPart = isFirstRegionPart(self); boolean lastRegionPart = isLastRegionPart(self); if (parentStackDirection == PositionConstants.NORTH_SOUTH && lastRegionPart) { specificDimension = cornerDimension; cornerDimension = Dimension.max(cornerDimension, regionContainerCornerDimension); if (specificDimension != cornerDimension) { specificCornerPosition.add(PositionConstants.NORTH_WEST); specificCornerPosition.add(PositionConstants.NORTH_EAST); } updatePrecedingSiblingCorner(self, PositionConstants.SOUTH_WEST, PositionConstants.SOUTH_EAST); } else if (parentStackDirection == PositionConstants.EAST_WEST && (firstRegionPart || lastRegionPart)) { specificDimension = cornerDimension; cornerDimension = Dimension.max(cornerDimension, regionContainerCornerDimension); specificCornerPosition.add(PositionConstants.NORTH_WEST); specificCornerPosition.add(PositionConstants.NORTH_EAST); if (firstRegionPart && !lastRegionPart) { specificCornerPosition.add(PositionConstants.SOUTH_EAST); } else if (!firstRegionPart && lastRegionPart) { specificCornerPosition.add(PositionConstants.SOUTH_WEST); } if (lastRegionPart && !firstRegionPart) { updatePrecedingSiblingCorner(self, PositionConstants.SOUTH_EAST); } } } } gradientRoundedShape.setCornerDimensions(cornerDimension); if (gradientRoundedShape instanceof RegionRoundedGradientRectangle) { ((RegionRoundedGradientRectangle) gradientRoundedShape).setAdditionalCornerDimensions(specificDimension, specificCornerPosition); } }</code><technical_language>HashSet is a heavyweight. considered java.util.BitSet instead? offers more convient (and risky) API direct bitwise operations memory overhead a HashSet</technical_language>

Target:
private static void refreshCorners(final AbstractDiagramElementContainerEditPart self, DDiagramElement diagElement, RoundedRectangle gradientRoundedShape) { Dimension cornerDimension = getCornerDimension(self); Dimension specificDimension = cornerDimension; BitSet specificCornerPosition = new BitSet(PositionConstants.NSEW); if (self.isRegion()) { DNodeContainer regionContainer = (DNodeContainer) diagElement.eContainer(); Dimension regionContainerCornerDimension = getCornerDimension(regionContainer); if (!regionContainerCornerDimension.getShrinked(cornerDimension).isEmpty()) { int parentStackDirection = self.getParentStackDirection(); boolean firstRegionPart = isFirstRegionPart(self); boolean lastRegionPart = isLastRegionPart(self); if (parentStackDirection == PositionConstants.NORTH_SOUTH && lastRegionPart) { specificDimension = cornerDimension; cornerDimension = Dimension.max(cornerDimension, regionContainerCornerDimension); if (specificDimension != cornerDimension) { specificCornerPosition.set(PositionConstants.NORTH_WEST); specificCornerPosition.set(PositionConstants.NORTH_EAST); } updatePrecedingSiblingCorner(self, PositionConstants.SOUTH_WEST, PositionConstants.SOUTH_EAST); } else if (parentStackDirection == PositionConstants.EAST_WEST && (firstRegionPart || lastRegionPart)) { specificDimension = cornerDimension; cornerDimension = Dimension.max(cornerDimension, regionContainerCornerDimension); specificCornerPosition.set(PositionConstants.NORTH_WEST); specificCornerPosition.set(PositionConstants.NORTH_EAST); if (firstRegionPart && !lastRegionPart) { specificCornerPosition.set(PositionConstants.SOUTH_EAST); } else if (!firstRegionPart && lastRegionPart) { specificCornerPosition.set(PositionConstants.SOUTH_WEST); } if (lastRegionPart && !firstRegionPart) { updatePrecedingSiblingCorner(self, PositionConstants.SOUTH_EAST); } } } } gradientRoundedShape.setCornerDimensions(cornerDimension); if (gradientRoundedShape instanceof RegionRoundedGradientRectangle) { ((RegionRoundedGradientRectangle) gradientRoundedShape).setAdditionalCornerDimensions(specificDimension, specificCornerPosition); } }