Java Code Examples for org.apache.lucene.util.ArrayUtil#swap()

The following examples show how to use org.apache.lucene.util.ArrayUtil#swap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestTopDocsMerge.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public void testInconsistentTopDocsFail() {
  TopDocs[] topDocs = new TopDocs[] {
      new TopDocs(new TotalHits(1, TotalHits.Relation.EQUAL_TO), new ScoreDoc[] { new ScoreDoc(1, 1.0f, 5) }),
      new TopDocs(new TotalHits(1, TotalHits.Relation.EQUAL_TO), new ScoreDoc[] { new ScoreDoc(1, 1.0f, -1) })
  };
  if (random().nextBoolean()) {
    ArrayUtil.swap(topDocs, 0, 1);
  }
  expectThrows(IllegalArgumentException.class, () -> {
      TopDocs.merge(0, 2, topDocs);
  });
}
 
Example 2
Source File: TestMutablePointsReaderUtils.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public void swap(int i, int j) {
  ArrayUtil.swap(points, i, j);
}