这是我们合作伙伴分配的运行长度编码程序。

问题描述:

我们正在尝试对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

什么问题? –

这不是实际的RLE压缩功能,而是一个辅助函数来计算正由主RLE处理当前字符的重复压缩功能。

什么,这似乎需要做的是这样的:

  • 以字符字符串时的line指数index,并将其存储在运行对象的相应属性。
  • 在索引index之后,对line中的字符进行迭代,直至遇到与您在开始时所用的字符不相同的字符。
  • 将找到的重复数量存储在Run对象的相应属性中。
  • 返回字符串中遇到不等字符的位置。