{
mxPoint point = null;
if (terminal != null)
{
mxPerimeterFunction perimeter = getPerimeterFunction(terminal);
if (perimeter != null && next != null)
{
mxRectangle bounds = getPerimeterBounds(terminal, border);
if (bounds.getWidth() > 0 || bounds.getHeight() > 0)
{
point = perimeter.apply(bounds, terminal, next, orthogonal);
}
}
if (point == null)
{