2016-04-21 46 views
0

我們正在嘗試對Javadoc進行指導。到目前爲止,我們有這一點,但感到困惑與指數放慢參數這是我們合作伙伴分配的運行長度編碼程序。

* Read the next run (or single character) and return the index of the symbol following the run (or symbol read). 
    * Store the count and symbol for the run in the run parameter. 
    * @param line - the input line being processed 
    * @param index - the index of the first character in the next "run" (which might be just a single character) 
    * @param run - where to store the symbol and count for the Run 
    * @return the index of the symbol following the run just read 
    */ 
    static int getNext(String line, int index, Run run) { 
    line.charAt(index); //char first, something about a line 
    return ?.symbol;//Store values 
    run.count= ?.count; //the given number of that specific symbol or repetition 
    enter code here 
    run.symbol= ?.symbol; //whatever symbol you first see 
    // TO BE COMPLETED 

    return index+1;// just to make it advance so starter program doesn't loop infinitely 
    } 
} 
+0

什麼是'跑' – Natecat

+0

什麼問題? –

回答

0

這不是實際的RLE壓縮功能,而是一個輔助函數來計算正由主RLE處理當前字符的重複壓縮功能。

什麼,這似乎需要做的是這樣的:

  • 以字符字符串時的line指數index,並將其存儲在運行對象的相應屬性。
  • 在索引index之後,對line中的字符進行迭代,直至遇到與您在開始時所用的字符不相同的字符。
  • 將找到的重複數量存儲在Run對象的相應屬性中。
  • 返回字符串中遇到不等字符的位置。