Formatting cleanup

This commit is contained in:
Ziver Koc 2021-03-23 21:49:52 +01:00
parent 65b47d0755
commit ec1758ce20
222 changed files with 2739 additions and 2726 deletions

View file

@ -167,7 +167,7 @@ public class ExternalSort {
for (int i=0; i<rows.length; i++) {
if (rows[i] != null) {
if (minIndex < 0) {
throw(new IOException("Error sorting!!!"));
throw new IOException("Error sorting!!!");
}
someFileStillHasRows = true;
break;

View file

@ -81,8 +81,7 @@ public class MergeSort{
if (index2 < stop-start && (index1 >= length || tmp[index1] > tmp[index2])) {
list[i] = tmp[index2];
++index2;
}
else {
} else {
list[i] = tmp[index1];
++index1;
}
@ -146,8 +145,7 @@ public class MergeSort{
if (index2 < stop-start && (index1 >= length || ((Comparable)tmp[index1]).compareTo(tmp[index2]) > 0)) {
list.set(i, (T) tmp[index2]);
++index2;
}
else {
} else {
list.set(i, (T) tmp[index1]);
++index1;
}

View file

@ -42,9 +42,9 @@ public abstract class LineAxis extends AbstractChart{
chartBound = new Rectangle();
int stepLength = 7;
// **********************************
// ------------------------------------------------
// Calculate Font sizes
// **********************************
// ------------------------------------------------
FontMetrics metric = g2.getFontMetrics();
int fontHeight = metric.getHeight();

View file

@ -197,6 +197,7 @@ public class SQLQuery {
private SQLFrom joinTable(String type, String[] tables) {
if (tables.length < 2)
return this;
StringBuilder str = new StringBuilder();
for (int i=0; i<tables.length; i++) {
str.append(tables[i]);
@ -204,6 +205,7 @@ public class SQLQuery {
str.append(' ').append(type).append(' ');
}
this.tables.add(str.toString());
return this;
}
@ -224,12 +226,15 @@ public class SQLQuery {
query.append(" FROM ");
if (tables.isEmpty())
throw new RuntimeException("The FROM query item must have at least 1 table!");
for (int i=0; i<tables.size(); i++) {
query.append(tables.get(i));
if (i != tables.size() - 1)
query.append(", ");
}
if( next != null ) next.build( query );
if (next != null)
next.build(query);
}
}
@ -300,7 +305,8 @@ public class SQLQuery {
protected void build(StringBuilder query) {
query.append(" WHERE ");
if (conds.isEmpty())
throw new RuntimeException("The WHERE query item must hav atleast 1 condition!");
throw new RuntimeException("The WHERE query item must have minimum 1 condition!");
for (int i=0; i<conds.size(); i++) {
query.append(conds.get(i));
if (i != conds.size() - 1)
@ -336,7 +342,8 @@ public class SQLQuery {
protected void build(String op, StringBuilder query) {
query.append(' ').append(op).append(' ');
if (cols == null || cols.length <= 0)
throw new RuntimeException("The "+op+" query item must hav atleast 1 column!");
throw new RuntimeException("The " + op + " query item must have minimum 1 column!");
for (int i=0; i<cols.length; i++) {
query.append(cols[i]);
if (i != cols.length - 1)

View file

@ -63,7 +63,8 @@ public abstract class ImageFilterProcessor {
* Sets the progress in percent
*/
protected void setProgress(double percent) {
if(progress != null) progress.progressUpdate(this, null, percent);
if (progress != null)
progress.progressUpdate(this, null, percent);
}
/**

View file

@ -293,7 +293,9 @@ public class RAWImageUtil {
* @return A copy of the data array
*/
public static int[][][] crop(int[][][] data, int xData, int yData, int[][][] crop, int xCrop, int yCrop, int width, int height) {
if(crop==null) crop = new int[width][height][4];
if (crop == null)
crop = new int[width][height][4];
for (int y=0; y<width; y++) {
for (int x=0; x<height; x++) {
crop[y+yData][x+xData][0] = data[y+yCrop][x+xCrop][0];

View file

@ -288,7 +288,7 @@ public class FileUtil {
public static String getFileExtension(String file) {
if (file == null || file.lastIndexOf(".") == -1)
return "";
return file.substring(file.lastIndexOf(".")+1, file.length());
return file.substring(file.lastIndexOf(".")+1);
}
/**

View file

@ -111,7 +111,7 @@ public class InetScanner {
private static String platformPingCmd(String ip) {
switch (OSAbstractionLayer.getInstance().getOSType()) {
case Windows:
return "ping -n 1 -w "+ TIMEOUT_SEC*1000 +" " + ip;
return "ping -n 1 -w " + (TIMEOUT_SEC*1000) + " " + ip;
case Linux:
case MacOS:
return "ping -c 1 -W " + TIMEOUT_SEC + " " + ip;

View file

@ -92,10 +92,10 @@ public abstract class ThreadedTCPNetworkServer extends Thread{
while (true) {
Socket connectionSocket = serverSocket.accept();
ThreadedTCPNetworkServerThread thread = getThreadInstance(connectionSocket);
if (thread != null) {
executor.execute(thread);
}
else{
} else {
logger.severe("Unable to instantiate ThreadedTCPNetworkServerThread, closing connection!");
connectionSocket.close();
}

View file

@ -106,7 +106,9 @@ public class BloomFilter<T extends Serializable> implements Set<T>, Serializable
*/
public boolean contains(Object o) {
try {
if(!(o instanceof Serializable))return false;
if (!(o instanceof Serializable))
return false;
int hash = 0;
for (int i=0; i<k; i++) {
hash = Hasher.MurmurHash((Serializable)o, hash);

View file

@ -148,6 +148,7 @@ public class Configurator<T> {
public Configurator<T> setValues(DataNode node) {
if (!node.isMap())
return this;
for (ConfigurationParam param : this.params) {
if (node.get(param.getName()) != null)
param.setValue(node.getString(param.getName()));

View file

@ -188,9 +188,11 @@ public class Wizard implements ActionListener{
listener.onCancel(page, values);
return;
}
pages.add(nextPage);
displayWizardPage(nextPage);
back.setEnabled(true);
if (nextPage.isFinalPage()) {
next.setEnabled(false);
finish.setEnabled(true);