Skip to content

Commit f8841c7

Browse files
enable LeftCurly check
1 parent 8f7736d commit f8841c7

File tree

5 files changed

+28
-30
lines changed

5 files changed

+28
-30
lines changed

fishercoder_checkstyle.xml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@
6565
<property name="option" value="TEXT"/>
6666
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
6767
module>
68+
6869
69-
70-
71-
70+
71+
<module name="LeftCurly">
72+
<property name="maxLineLength" value="100"/>
73+
module>
74+
7275
<module name="RightCurly"/>
7376
<module name="RightCurly">
7477
<property name="option" value="alone"/>
@@ -157,14 +160,16 @@
157160
158161
159162
160-
163+
164+
165+
166+
167+
168+
169+
170+
171+
172+
168173
<module name="AbbreviationAsWordInName">
169174
<property name="ignoreFinal" value="false"/>
170175
<property name="allowedAbbreviationLength" value="10"/>

src/main/java/com/fishercoder/solutions/_149.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public int maxPoints(Point[] points) {
4141
}
4242
}
4343
} else
44-
for (int k = 0; (k < points.length); k++)
45-
/*
46-
* Here, I must put the judgment (k!=i) && (k!=j) in the
44+
for (int k = 0; (k < points.length); k++) {
45+
/*
46+
* Here, I must put the judgment (k!=i) && (k!=j) in the
4747
* if statement instead of in the for, otherwise, when k
4848
* equals i or j, it will stop traversing the rest of
4949
* the points that k represents!
@@ -53,7 +53,6 @@ public int maxPoints(Point[] points) {
5353
*
5454
* It took me an hour and couldn't find any clue!
5555
*/
56-
{
5756
if ((k != i) && (k != j)) {
5857
if (((points[k].x == points[i].x) && (points[k].y == points[i].y))) {
5958
maxPoints[i][j]++;

src/main/java/com/fishercoder/solutions/_452.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ public int findMinArrowShots(int[][] points) {
3737
Arrays.sort(points, (p1, p2) -> Integer.compare(p1[1],p2[1]));
3838
int currentEnd = points[0][1];
3939
int count = 1;
40-
for(int[] p: points)
41-
{
40+
for(int[] p: points) {
4241
// if the point starts after currentEnd, it means this balloons not been bursted. Then we shot the balloon in its end point. Otherwise, means this balloon has been bursted, then ignore it.
4342
if(p[0]>currentEnd) {
4443
count++;

src/main/java/com/fishercoder/solutions/_50.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ public class _50 {
88
public double myPow(double x, int n) {
99
if(n == 0)
1010
return 1;
11-
if( n == Integer.MIN_VALUE)
12-
{
11+
if( n == Integer.MIN_VALUE) {
1312
++n;
1413
n = -n;
1514
x = 1/x;

src/main/java/com/fishercoder/solutions/_59.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,26 @@ public int[][] generateMatrix(int num) {
2020
int[][] fourEdges = new int[num][num];
2121
int value = 1;
2222
int i = 0, j = 0;
23-
if(num%2 == 0)//when num is even
24-
{
25-
while(i < num/2 && j < num/2 && temp >= 0)
26-
{
23+
if(num%2 == 0) {//when num is even
24+
while(i < num/2 && j < num/2 && temp >= 0) {
2725
/* Assign the top row */
28-
while(j < temp)
29-
{
26+
while(j < temp) {
3027
fourEdges[i][j] = value;
3128
j++;
3229
value++;
3330

3431
}
3532

3633
/* Assign the right column */
37-
while(i < temp - 1){
34+
while(i < temp - 1) {
3835
i++;
3936
fourEdges[i][j - 1] = value;
4037
value++;
4138
}
4239
j = j - 2;
4340

4441
/* Assign the bottom row */
45-
while(j >= num - temp){
42+
while(j >= num - temp) {
4643
fourEdges[i][j] = value;
4744
j--;
4845
value++;
@@ -51,7 +48,7 @@ public int[][] generateMatrix(int num) {
5148
j++;
5249

5350
/* Assign the left column */
54-
while(i > num - temp){
51+
while(i > num - temp) {
5552
fourEdges[i][j] = value;
5653
i--;
5754
value++;
@@ -65,8 +62,7 @@ public int[][] generateMatrix(int num) {
6562
} else {//when num is odd
6663
while(i < num/2 && j < num/2 && temp >= 0) {
6764
/* Assign the top row */
68-
while(j < temp)
69-
{
65+
while(j < temp) {
7066
fourEdges[i][j] = value;
7167
j++;
7268
value++;

0 commit comments

Comments
 (0)