class SearchResponse extends AbstractResult {

  public SearchResponse subResult(final int fromIndex, final int toIndex)
  {
    if (fromIndex < 0 || toIndex > resultEntries.size() || fromIndex > toIndex) {
      throw new IndexOutOfBoundsException("Illegal index value");
    }

    final SearchResponse result = new SearchResponse();
    if (resultEntries.isEmpty() || fromIndex == toIndex) {
      return result;
    }

    int i = 0;
    for (Map.Entry<String, LdapEntry> e : resultEntries.entrySet()) {
      if (i >= fromIndex && i < toIndex) {
        result.addEntries(e.getValue());
      }
      i++;
    }
    return result;
  }

  public  SearchResponse();
  public  SearchResponse(final DERBuffer buffer);

}