我们正在尝试执行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 :(得分:0)
这不是实际的RLE压缩函数,而是辅助函数,用于计算主RLE压缩函数正在处理的当前字符的重复。
这似乎需要做的是:
index
的索引line
处的字符,并将其存储在Run对象的相应属性中。line
后面的索引index
中的字符进行迭代,直到遇到与您在开始时所采用的字符不相等的字符。