List<Token> tokens = new ArrayList<Token>(select(jcas, Token.class));
long timeNaive = 0;
long timeOptimized = 0;
for (int j = 0; j < ITERATIONS; j++) {
Token t1 = tokens.get(rnd.nextInt(tokens.size()));
Token t2 = tokens.get(rnd.nextInt(tokens.size()));
int left = Math.min(t1.getEnd(), t2.getEnd());
int right = Math.max(t1.getBegin(), t2.getBegin());
long ti;
List<Sentence> reference;
if ((t1.getBegin() < t2.getBegin() && t2.getBegin() < t1.getEnd())
|| (t1.getBegin() < t2.getEnd() && t2.getEnd() < t1.getEnd())
|| (t2.getBegin() < t1.getBegin() && t1.getBegin() < t2.getEnd())
|| (t2.getBegin() < t1.getEnd() && t1.getEnd() < t2.getEnd())) {
// If the boundary annotations overlap, the result must be empty
ti = System.currentTimeMillis();
reference = new ArrayList<Sentence>();
timeNaive += System.currentTimeMillis() - ti;
} else {