private static int restrictEndBound(int start, int end, @Nonnull SourceLocation sourceLocation) { if (end < start) { return start; } if (end > sourceLocation.getSourceNode().getLength()) { return sourceLocation.getSourceNode().getLength(); } return end; }
private static int restrictStartBound(int start, @Nonnull SourceLocation sourceLocation) { if (start < 0) { return 0; } if (start > sourceLocation.getSourceNode().getLength()) { return sourceLocation.getSourceNode().getLength(); } return start; }