[FOray-commit] SF.net SVN: foray: [10372] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2008-02-28 16:56:35
|
Revision: 10372
http://foray.svn.sourceforge.net/foray/?rev=10372&view=rev
Author: victormote
Date: 2008-02-28 08:56:32 -0800 (Thu, 28 Feb 2008)
Log Message:
-----------
1. Clean up more checkstyle issues.
2. Start breaking out checkstyle suppressions that are semi-permanent.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/PatternGenerator.java
trunk/foray/scripts/checkstyle-suppressions.xml
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/PatternGenerator.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/PatternGenerator.java 2008-02-28 16:39:06 UTC (rev 10371)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/PatternGenerator.java 2008-02-28 16:56:32 UTC (rev 10372)
@@ -488,7 +488,7 @@
for (int j = 0; j <= PatternGenerator.LAST_ASCII_CODE; j++) {
xext[j] = ' ';
}
- xext[PatternGenerator.EDGE_OF_WORD]= '.';
+ xext[PatternGenerator.EDGE_OF_WORD] = '.';
/* Initialize the xdig array. */
for (char j = 0; j < xdig.length; j++) {
@@ -498,9 +498,9 @@
}
/* Initialize the xhyf array. */
- xhyf[PatternGenerator.ERR_HYF]= '.';
- xhyf[PatternGenerator.IS_HYF]= '-';
- xhyf[PatternGenerator.FOUND_HYF]= '*';
+ xhyf[PatternGenerator.ERR_HYF] = '.';
+ xhyf[PatternGenerator.IS_HYF] = '-';
+ xhyf[PatternGenerator.FOUND_HYF] = '*';
}
/**
@@ -663,7 +663,7 @@
if (s > TRIE_SIZE - NUM_ASCII_CODES) {
overflow("pattern trie nodes", TRIE_SIZE);
}
- while (triebmax<s) {
+ while (triebmax < s) {
triebmax ++;
trietaken[triebmax] = false;
triec[triebmax + LAST_ASCII_CODE] = MIN_PACKED;
@@ -683,7 +683,7 @@
*/
void unpack(int s) {
this.qmax = 1;
- for(char c = this.cmin; c <= cmax; c++) {
+ for (char c = this.cmin; c <= cmax; c++) {
/* Search for transitions belonging to this state. */
int t = s + c;
if (so(triec[t]) == c) {
@@ -710,7 +710,7 @@
opcount = opcount + 1;
if (opcount == MAX_OPS) {
System.err.printf("%s%ld%s%s\n", "PATGEN capacity exceeded, sorry [",
- (long)MAX_OPS, " outputs" , "]." );
+ (long) MAX_OPS, " outputs" , "]." );
System.exit(1);
}
ops[h].val = v;
@@ -768,7 +768,7 @@
qmax = 1;
while (i < patlen) {
i = i + 1;
- trieqc[1]= pat[i];
+ trieqc[1] = pat[i];
t = firstfit();
triel[s] = t;
s = t + pat[i];
@@ -816,10 +816,10 @@
if (b > trieckmax - 256) {
if (trieckmax == TRIEC_SIZE) {
System.err.printf("%s%ld%s%s\n", "PATGEN capacity exceeded, sorry [" ,
- (long)TRIEC_SIZE, " count trie nodes" , "]." );
+ (long) TRIEC_SIZE, " count trie nodes" , "]." );
System.exit(1);
}
- System.out.printf("%ld%s", (long)trieckmax / 1024 , "K ");
+ System.out.printf("%ld%s", (long) trieckmax / 1024 , "K ");
if (trieckmax > TRIEC_SIZE - 4096) {
trieckmax = TRIEC_SIZE;
} else {
@@ -828,8 +828,8 @@
}
while (triecbmax < b) {
triecbmax = triecbmax + 1;
- triectaken[triecbmax]= false;
- triecc[triecbmax + 255]= 0;
+ triectaken[triecbmax] = false;
+ triecc[triecbmax + 255] = 0;
triecl[triecbmax + 255] = triecbmax + 256;
triecr[triecbmax + 256] = triecbmax + 255;
}
@@ -854,15 +854,15 @@
if (q <= for_end) {
do {
a = b + trieqc[q];
- triecl[triecr[a]]= triecl[a];
- triecr[triecl[a]]= triecr[a];
- triecc[a]= trieqc[q];
- triecl[a]= trieql[q];
- triecr[a]= trieqr[q];
+ triecl[triecr[a]] = triecl[a];
+ triecr[triecl[a]] = triecr[a];
+ triecc[a] = trieqc[q];
+ triecl[a] = trieql[q];
+ triecr[a] = trieqr[q];
if (a > triecmax) {
triecmax = a;
}
- } while ( q++ < for_end);
+ } while (q++ < for_end);
}
triectaken[b] = true;
return b;
@@ -911,16 +911,16 @@
if (triecc[a] == 0 ) {
triecl[triecr[a]] = triecl[a];
triecr[triecl[a]] = triecr[a];
- triecc[a]= word[spos];
- triecl[a]= 0;
- triecr[a]= 0;
+ triecc[a] = word[spos];
+ triecl[a] = 0;
+ triecr[a] = 0;
if (a > triecmax)
triecmax = a;
} else {
unpackc(a - word[spos]);
- trieqc[qmax]= word[spos];
- trieql[qmax]= 0;
- trieqr[qmax]= 0;
+ trieqc[qmax] = word[spos];
+ trieql[qmax] = 0;
+ trieqr[qmax] = 0;
a = firstcfit();
triecl[b] = a;
a = a + word [spos];
@@ -1101,7 +1101,7 @@
} else {
n1 = 0;
output.printf("%s%ld%s\n", "Specify 1<=left_hyphen_min,right_hyphen_min<=",
- (long)MAX_DOT - 1, " !");
+ (long) MAX_DOT - 1, " !");
}
} while (! (n1 > 0));
}
@@ -1176,7 +1176,7 @@
} while (! ( bufptr == MAX_BUF_LEN));
output.printf("%c\n", ' ');
System.err.printf("%s%ld%s%s\n",
- "PATGEN capacity exceeded, sorry [" , (long)256,
+ "PATGEN capacity exceeded, sorry [" , (long) 256,
" letters" , "].");
System.exit(1);
}
@@ -1271,8 +1271,8 @@
}
}
translate.close();
- output.printf("%s%ld%s%ld%s%ld%s\n", "left_hyphen_min = ", (long)lefthyphenmin,
- ", right_hyphen_min = ", (long)righthyphenmin , ", " , (long)imax - 1 , " letters");
+ output.printf("%s%ld%s%ld%s%ld%s\n", "left_hyphen_min = ", (long) lefthyphenmin,
+ ", right_hyphen_min = ", (long) righthyphenmin, ", ", (long) imax - 1, " letters");
cmax = imax;
}
@@ -1304,13 +1304,13 @@
if ( triecmax == TRIEC_SIZE ) {
System.err.printf("%s%ld%s%s\n",
"PATGEN capacity exceeded, sorry [",
- (long)TRIEC_SIZE, " count trie nodes" , "].");
+ (long) TRIEC_SIZE, " count trie nodes" , "].");
System.exit(1);
}
triecmax = triecmax + 1;
triecl[l] = triecmax;
l = triecmax;
- triecc[l]= pat[j];
+ triecc[l] = pat[j];
} while (j++ < for_end2);
}
triecl[l] = 0;
@@ -1356,7 +1356,7 @@
badcount = 0;
moretocome = false;
traversecounttrie(1, 1);
- output.printf("%ld%s%ld%s", (long)goodpatcount, " good and ", (long)badpatcount,
+ output.printf("%ld%s%ld%s", (long) goodpatcount, " good and ", (long) badpatcount,
" bad patterns added");
levelpatterncount = levelpatterncount + goodpatcount;
if (moretocome) {
@@ -1364,7 +1364,7 @@
} else {
output.printf("%c\n", ' ');
}
- output.printf("%s%ld%s%ld%s", "finding ", (long)goodcount, " good and ", (long)badcount,
+ output.printf("%s%ld%s%ld%s", "finding ", (long) goodcount, " good and ", (long) badcount,
" bad hyphens");
if (goodpatcount > 0) {
output.print(", efficiency = "
@@ -1373,8 +1373,8 @@
} else {
output.printf("%c\n", ' ');
}
- output.printf("%s%ld%s%s%ld%s%ld%s\n", "pattern trie has ", (long)triecount, " nodes, ",
- "trie_max = ", (long)triemax, ", ", (long)opcount, " outputs");
+ output.printf("%s%ld%s%s%ld%s%ld%s\n", "pattern trie has ", (long) triecount, " nodes, ",
+ "trie_max = ", (long) triemax, ", ", (long) opcount, " outputs");
}
int deletepatterns(int s) {
@@ -1446,8 +1446,8 @@
}
} while (h++ < for_end);
}
- output.printf("%ld%s%ld%s\n", (long)oldtriecount - triecount, " nodes and " ,
- (long)oldopcount - opcount, " outputs deleted");
+ output.printf("%ld%s%ld%s\n", (long) oldtriecount - triecount, " nodes and " ,
+ (long) oldopcount - opcount, " outputs deleted");
qmaxthresh = 7;
}
@@ -1497,15 +1497,16 @@
l = triecl [l ];
}
patout.write(xext[pat[d]]);
- if ( hval [d ]> 0 )
+ if (hval[d] > 0)
patout.write(xdig[hval[d]]);
}
while (d++ < for_end3);
}
patout.write('\n');
}
- if ( triel [t ]> 0 )
+ if (triel[t] > 0 ) {
outputpatterns(triel[t], patlen + 1);
+ }
}
} while (c++ < for_end);
}
@@ -1534,7 +1535,7 @@
readln(dictionary);
while (bufptr < MAX_BUF_LEN) {
bufptr = bufptr + 1;
- buf [bufptr ]= ' ';
+ buf[bufptr] = ' ';
}
}
word[1] = 1;
@@ -1569,7 +1570,7 @@
} while (! (bufptr == MAX_BUF_LEN));
output.printf("%c\n", ' ');
System.err.printf("%s%s%ld%s\n", "PATGEN capacity exceeded, sorry [",
- "word length=", (long)MAX_LEN, "].");
+ "word length=", (long) MAX_LEN, "].");
System.exit(1);
}
word[wlen] = xint[c];
@@ -1587,7 +1588,7 @@
} while (! (bufptr == MAX_BUF_LEN));
output.printf("%c\n", ' ');
System.err.printf("%s%s%ld%s\n", "PATGEN capacity exceeded, sorry [",
- "word length=", (long)MAX_LEN, "]." );
+ "word length=", (long) MAX_LEN, "]." );
System.exit(1);
}
t = 1;
@@ -1786,7 +1787,7 @@
/* TODO: Next line is not quite right. The original C code depended on "fname". Does this
* open a different dictionary file? */
dictionary.reset();
- xclass['.']= 5;
+ xclass['.'] = 5;
xclass[xhyf[1]] = 2;
xint[xhyf[1]] = 0;
xclass[xhyf[2]] = 2;
@@ -1816,8 +1817,8 @@
}
if (procesp) {
initcounttrie();
- output.printf("%s%ld%s%ld\n", "processing dictionary with pat_len = ", (long)patlen,
- ", pat_dot = ", (long)patdot);
+ output.printf("%s%ld%s%ld\n", "processing dictionary with pat_len = ", (long) patlen,
+ ", pat_dot = ", (long) patdot);
}
if (hyphp) {
filnam = "pattmp. ".toCharArray();
@@ -1844,19 +1845,22 @@
}
dictionary.close();
output.printf("%c\n", ' ');
- output.printf("%ld%s%ld%s%ld%s\n", (long)goodcount, " good, ", (long)badcount, " bad, ",
- (long)misscount, " missed");
+ output.printf("%ld%s%ld%s%ld%s\n", (long) goodcount, " good, ", (long) badcount, " bad, ",
+ (long) misscount, " missed");
if ((goodcount + misscount) > 0) {
- output.print((100 * goodcount / ((double) (goodcount + misscount))));
+ output.print((WKConstants.PERCENT_CONVERSION * goodcount
+ / ((double) (goodcount + misscount))));
output.print(" %, ");
- output.print((100 * badcount / ((double) (goodcount + misscount))));
+ output.print((WKConstants.PERCENT_CONVERSION * badcount
+ / ((double) (goodcount + misscount))));
output.print(" %, ");
- output.print((100 * misscount / ((double) (goodcount + misscount))));
+ output.print((WKConstants.PERCENT_CONVERSION * misscount
+ / ((double) (goodcount + misscount))));
output.printf("%s\n", " %");
}
if (procesp) {
- output.printf("%ld%s%ld%s%s%ld\n", (long)patcount, " patterns, ", (long)trieccount,
- " nodes in count trie, ", "triec_max = ", (long)triecmax);
+ output.printf("%ld%s%ld%s%s%ld\n", (long) patcount, " patterns, ", (long) trieccount,
+ " nodes in count trie, ", "triec_max = ", (long) triecmax);
}
if (hyphp) {
pattmp.close();
@@ -1932,7 +1936,7 @@
break;
case 4: {
patlen = patlen + 1;
- hval[patlen]= 0;
+ hval[patlen] = 0;
t = 1;
lab30: while (true) {
t = triel[t] + xord[c];
@@ -2002,9 +2006,9 @@
}
}
patterns.close();
- output.printf("%ld%s\n", (long)levelpatterncount , " patterns read in");
- output.printf("%s%ld%s%s%ld%s%ld%s\n", "pattern trie has ", (long)triecount, " nodes, ",
- "trie_max = ", (long)triemax, ", ", (long)opcount, " outputs");
+ output.printf("%ld%s\n", (long) levelpatterncount , " patterns read in");
+ output.printf("%s%ld%s%s%ld%s%ld%s\n", "pattern trie has ", (long) triecount, " nodes, ",
+ "trie_max = ", (long) triemax, ", ", (long) opcount, " outputs");
}
void mainbody() throws IOException {
@@ -2029,7 +2033,7 @@
} else {
this.n1 = 0;
output.printf("%s%ld%s\n", "Specify 1<=hyph_start,hyph_finish<=",
- (long)MAX_VAL - 1, " !");
+ (long) MAX_VAL - 1, " !");
}
} while (! (n1 > 0));
hyphlevel = maxpat;
@@ -2043,7 +2047,7 @@
if (hyphlevel > hyphstart) {
output.printf("%c\n", ' ');
} else if (hyphstart <= maxpat) {
- output.printf("%s%ld%s\n", "Largest hyphenation value ", (long)maxpat,
+ output.printf("%s%ld%s\n", "Largest hyphenation value ", (long) maxpat,
" in patterns should be less than hyph_start");
}
do {
@@ -2057,7 +2061,7 @@
} else {
n1 = 0;
output.printf("%s%ld%s\n", "Specify 1<=pat_start<=pat_finish<=",
- (long)MAX_DOT, " !" );
+ (long) MAX_DOT, " !" );
}
} while (! (n1 > 0));
do {
@@ -2079,7 +2083,7 @@
for_end2 = MAX_DOT;
if (k <= for_end2) {
do {
- morethislevel [k ]= true;
+ morethislevel[k] = true;
} while (k++ < for_end2);
}
int for_end3;
@@ -2113,8 +2117,8 @@
} while (j++ < for_end3);
}
deletebadpatterns();
- output.printf("%s%ld%s%ld\n", "total of ", (long)levelpatterncount,
- " patterns at hyph_level ", (long)hyphlevel);
+ output.printf("%s%ld%s%ld\n", "total of ", (long) levelpatterncount,
+ " patterns at hyph_level ", (long) hyphlevel);
} while (i++ < for_end);
}
findletters(triel[1], 1);
Modified: trunk/foray/scripts/checkstyle-suppressions.xml
===================================================================
--- trunk/foray/scripts/checkstyle-suppressions.xml 2008-02-28 16:39:06 UTC (rev 10371)
+++ trunk/foray/scripts/checkstyle-suppressions.xml 2008-02-28 16:56:32 UTC (rev 10372)
@@ -13,8 +13,9 @@
<suppress checks="MagicNumber"
files="src.javatest.*"/>
- <!-- Temporarily suppress all javadoc warnings for the Pattern Generator
+ <!-- Temporarily suppress some javadoc warnings for the Pattern Generator
class. -->
+ <suppress checks="MagicNumber*" files="src.java.org.foray.hyphen.PatternGenerator.*"/>
<suppress checks=".*" files="src.java.org.foray.hyphen.PatternGenerator.*"/>
</suppressions>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|