<exclude name="LocalVariableCouldBeFinal" />
<exclude name="MethodArgumentCouldBeFinal" />
<exclude name="OnlyOneReturn" />
- <exclude name="ShortVariable" />
<exclude name="UnnecessaryLocalBeforeReturn" />
<exclude name="UnnecessaryReturn" />
</rule>
+ <rule ref="category/java/codestyle.xml/LongVariable" >
+ <properties>
+ <property name="minimum" value="25"/>
+ </properties>
+ </rule>
+ <rule ref="category/java/codestyle.xml/ShortVariable" >
+ <properties>
+ <property name="minimum" value="2"/>
+ </properties>
+ </rule>
<rule ref="category/java/design.xml" >
<exclude name="LawOfDemeter" />
<exclude name="LoosePackageCoupling" />
</rule>
+ <rule ref="category/java/design.xml/NcssCount" >
+ <properties>
+ <property name="methodReportLevel" value="50"/>
+ </properties>
+ </rule>
<rule ref="category/java/documentation.xml" />
<rule ref="category/java/documentation.xml/CommentRequired" >
int roof = errList.size() - 1;
while(floor <= roof){
- int midpoint = (floor + roof) / 2; // 切り捨て
+ int gapHalf = (roof - floor) / 2; // 切り捨て
+ int midpoint = floor + gapHalf;
DecodeErrorInfo einfo = errList.get(midpoint);
int cmp = einfo.getCharPosition() - startPos;
- if(cmp == 0) return midpoint;
-
if (cmp < 0) floor = midpoint + 1;
else if(cmp > 0) roof = midpoint - 1;
+ else return midpoint;
}
return floor;
/**
* 人狼BBS各種XHTML文字列のパースを行いハンドラに通知する。
*/
+@SuppressWarnings({
+ "PMD.FieldDeclarationsShouldBeAtStartOfClass",
+ "PMD.PrematureDeclaration"
+})
public class HtmlParser extends AbstractParser{
private static final String SP = "\u0020";
* 人狼BBSシステムが出力する各種イベント表記のパースを行うパーサ。
* パース進行に従い{@link SysEventHandler}の各種メソッドが呼び出される。
*/
+@SuppressWarnings({
+ "PMD.FieldDeclarationsShouldBeAtStartOfClass",
+ "PMD.PrematureDeclaration"
+})
public class SysEventParser extends AbstractParser{
private static final String AVATAR_REGEX =
* 人狼BBSシステムが出力する各発言箇所のパーサ。
* パース進行に従い{@link TalkHandler}の各種メソッドが呼び出される。
*/
+@SuppressWarnings("PMD.FieldDeclarationsShouldBeAtStartOfClass")
public class TalkParser extends AbstractParser{
private TalkHandler talkHandler;
errList.add(new DecodeErrorInfo(15, (byte)0x00));
result = DecodedContent.bsearchErrorIndex(errList, 10);
assertEquals(2, result);
+ result = DecodedContent.bsearchErrorIndex(errList, 9);
+ assertEquals(2, result);
+ result = DecodedContent.bsearchErrorIndex(errList, 11);
+ assertEquals(3, result);
return;
}