public List<ApiObject> requestList(int method, ApiObject[] parameters) {
   try {
     switch (method) {
       case LIST_OPTION_GROUPS:
         return ApiObject.envelopeStringList(getOptionGroups());
       case LIST_OPTION_NAMES:
         return ApiObject.envelopeStringList(
             getOptionNames(((ApiObject.String) parameters[0]).Value));
       case LIST_BOOK_TAGS:
         return ApiObject.envelopeStringList(getBookTags());
       case LIST_ACTIONS:
         return ApiObject.envelopeStringList(listActions());
       case LIST_ACTION_NAMES:
         {
           final ArrayList<String> actions = new ArrayList<String>(parameters.length);
           for (ApiObject o : parameters) {
             actions.add(((ApiObject.String) o).Value);
           }
           return ApiObject.envelopeStringList(listActionNames(actions));
         }
       case LIST_ZONEMAPS:
         return ApiObject.envelopeStringList(listZoneMaps());
       case GET_PARAGRAPH_WORDS:
         return ApiObject.envelopeStringList(
             getParagraphWords(((ApiObject.Integer) parameters[0]).Value));
       case GET_PARAGRAPH_WORD_INDICES:
         return ApiObject.envelopeIntegerList(
             getParagraphWordIndices(((ApiObject.Integer) parameters[0]).Value));
       default:
         return Collections.<ApiObject>singletonList(unsupportedMethodError(method));
     }
   } catch (Throwable e) {
     return Collections.<ApiObject>singletonList(exceptionInMethodError(method, e));
   }
 }
 public ArrayList<Integer> getParagraphWordIndices(int paragraphIndex) {
   final ArrayList<Integer> indices = new ArrayList<Integer>();
   final ZLTextWordCursor cursor =
       new ZLTextWordCursor(getReader().getTextView().getStartCursor());
   cursor.moveToParagraph(paragraphIndex);
   cursor.moveToParagraphStart();
   while (!cursor.isEndOfParagraph()) {
     ZLTextElement element = cursor.getElement();
     if (element instanceof ZLTextWord) {
       indices.add(cursor.getElementIndex());
     }
     cursor.nextWord();
   }
   return indices;
 }
 public List<String> getParagraphWords(int paragraphIndex) {
   final ArrayList<String> words = new ArrayList<String>();
   final ZLTextWordCursor cursor =
       new ZLTextWordCursor(getReader().getTextView().getStartCursor());
   cursor.moveToParagraph(paragraphIndex);
   cursor.moveToParagraphStart();
   while (!cursor.isEndOfParagraph()) {
     ZLTextElement element = cursor.getElement();
     if (element instanceof ZLTextWord) {
       words.add(element.toString());
     }
     cursor.nextWord();
   }
   return words;
 }