package org.eclipse.jdt.internal.core.dom.rewrite;
import java.util.Arrays;
import java.util.List;
import org.eclipse.jdt.core.dom.LineComment;
import org.eclipse.jdt.core.formatter.IndentManipulation;
import org.eclipse.jdt.internal.compiler.util.Util;
@SuppressWarnings("rawtypes")
public class {
private int[] ;
private final List ;
public (List commentList) {
this.commentList= commentList;
this.offsets= null;
}
private int[] () {
if (this.offsets == null) {
if (this.commentList != null) {
int nComments= this.commentList.size();
int count= 0;
for (int i= 0; i < nComments; i++) {
Object curr= this.commentList.get(i);
if (curr instanceof LineComment) {
count++;
}
}
this.offsets= new int[count];
for (int i= 0, k= 0; i < nComments; i++) {
Object curr= this.commentList.get(i);
if (curr instanceof LineComment) {
LineComment comment= (LineComment) curr;
this.offsets[k++]= comment.getStartPosition() + comment.getLength();
}
}
} else {
this.offsets= Util.EMPTY_INT_ARRAY;
}
}
return this.offsets;
}
public boolean (int offset) {
return offset >= 0 && Arrays.binarySearch(getOffsets(), offset) >= 0;
}
public boolean (int offset, char[] content) {
if (offset < 0 || (offset < content.length && !IndentManipulation.isLineDelimiterChar(content[offset]))) {
return false;
}
return Arrays.binarySearch(getOffsets(), offset) >= 0;
}
public boolean (int offset) {
int[] offsetArray= getOffsets();
int index= Arrays.binarySearch(offsetArray, offset);
if (index >= 0) {
if (index > 0) {
System.arraycopy(offsetArray, 0, offsetArray, 1, index);
}
offsetArray[0]= -1;
return true;
}
return false;
}
}