@Override
 public void searchModules(ModuleQuery query, ModuleSearchResult result) {
   // abort if not JVM
   if (query.getType() != ModuleQuery.Type.JVM) return;
   String name = query.getName();
   if (name == null) name = "";
   name = name.toLowerCase();
   boolean stopSearching = false;
   int found = 0;
   for (String module : JDK_MODULES) {
     // does it match?
     if (module.contains(name)) {
       // check if we were already done but were checking for a next results
       if (stopSearching) {
         // we already found enough results but were checking if there
         // were more results to be found for paging, so record that
         // and stop
         result.setHasMoreResults(true);
         return;
       }
       if (query.getStart() == null || found++ >= query.getStart()) {
         // are we interested in this result or did we need to skip it?
         result.addResult(module, doc(module), null, EmptySet, FixedVersionSet);
         // stop if we're done searching
         if (query.getStart() != null
             && query.getCount() != null
             && found >= query.getStart() + query.getCount()) {
           // we're done, but we want to see if there's at least one more result
           // to be found so we can tell clients there's a next page
           stopSearching = true;
         }
       }
     }
   }
 }
 @Override
 public void completeModules(ModuleQuery query, ModuleSearchResult result) {
   // abort if not JVM
   if (query.getType() != ModuleQuery.Type.JVM) return;
   String name = query.getName();
   if (name == null) name = "";
   for (String module : JDK_MODULES) {
     if (module.startsWith(name))
       result.addResult(module, doc(module), null, EmptySet, FixedVersionSet);
   }
 }