Skip to content

Commit 0b7c52c

Browse files
committed
Lots of minor refactoring
1 parent e327769 commit 0b7c52c

File tree

98 files changed

+287
-260
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+287
-260
lines changed

nb-configuration.xml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project-shared-configuration>
3-
<!--
4-
This file contains additional configuration written by modules in the NetBeans IDE.
5-
The configuration is intended to be shared among all the users of project and
6-
therefore it is assumed to be part of version control checkout.
7-
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
3+
<!--
4+
This file contains additional configuration written by modules in the NetBeans IDE.
5+
The configuration is intended to be shared among all the users of project and
6+
therefore it is assumed to be part of version control checkout.
7+
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
88
-->
9-
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
10-
<!--
11-
Properties that influence various parts of the IDE, especially code formatting and the like.
12-
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
13-
That way multiple projects can share the same settings (useful for formatting rules for example).
14-
Any value defined here will override the pom.xml file value but is only applicable to the current project.
9+
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
10+
<!--
11+
Properties that influence various parts of the IDE, especially code formatting and the like.
12+
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
13+
That way multiple projects can share the same settings (useful for formatting rules for example).
14+
Any value defined here will override the pom.xml file value but is only applicable to the current project.
1515
-->
16-
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width>4</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width>
17-
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeIfParen>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeIfParen>
18-
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeCatchParen>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeCatchParen>
19-
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeTryParen>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeTryParen>
20-
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeSwitchParen>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeSwitchParen>
21-
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-line-wrap>none</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-line-wrap>
22-
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab>4</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab>
23-
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size>4</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size>
24-
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-limit-width>120</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-limit-width>
25-
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeSynchronizedParen>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeSynchronizedParen>
26-
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeForParen>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeForParen>
27-
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs>
28-
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeWhileParen>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeWhileParen>
29-
<org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>none</org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>
30-
<org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>4</org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>
31-
<org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>4</org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>
32-
<org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>4</org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>
33-
<org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>120</org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>
34-
<org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>false</org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>
35-
<org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
36-
</properties>
16+
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width>4</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width>
17+
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeIfParen>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeIfParen>
18+
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeCatchParen>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeCatchParen>
19+
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeTryParen>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeTryParen>
20+
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeSwitchParen>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeSwitchParen>
21+
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-line-wrap>none</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-line-wrap>
22+
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab>4</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab>
23+
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size>4</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size>
24+
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-limit-width>120</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-limit-width>
25+
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeSynchronizedParen>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeSynchronizedParen>
26+
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeForParen>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeForParen>
27+
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs>
28+
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeWhileParen>false</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceBeforeWhileParen>
29+
<org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>none</org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>
30+
<org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>4</org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>
31+
<org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>4</org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>
32+
<org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>4</org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>
33+
<org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>120</org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>
34+
<org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>false</org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>
35+
<org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
36+
</properties>
3737
</project-shared-configuration>

src/main/java/com/laytonsmith/PureUtilities/ArgumentSuite.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
*/
2222
public class ArgumentSuite {
2323

24-
private Map<String, ArgumentParser> suite;
25-
private Map<String, String> aliases;
24+
private final Map<String, ArgumentParser> suite;
25+
private final Map<String, String> aliases;
2626
private String description;
2727

2828
public ArgumentSuite() {
@@ -211,9 +211,9 @@ public ArgumentParser getModeFromName(String mode) {
211211

212212
public static class ArgumentSuiteResults {
213213

214-
private ArgumentParser mode;
215-
private ArgumentParserResults results;
216-
private String modeName;
214+
private final ArgumentParser mode;
215+
private final ArgumentParserResults results;
216+
private final String modeName;
217217

218218
private ArgumentSuiteResults(String modeName, ArgumentParser mode, ArgumentParserResults results) {
219219
this.modeName = modeName;
@@ -292,9 +292,7 @@ public static void main(String[] args) {
292292
}
293293
System.exit(0);
294294
}
295-
} catch(ResultUseException ex) {
296-
showHelp(suite);
297-
} catch(ValidationException ex) {
295+
} catch(ResultUseException | ValidationException ex) {
298296
showHelp(suite);
299297
}
300298
}

src/main/java/com/laytonsmith/PureUtilities/ClassLoading/ClassDiscovery.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ private synchronized void discover(URL rootLocation) {
252252
}
253253
final File rootLocationFile;
254254
if(!classCache.containsKey(rootLocation)) {
255-
classCache.put(rootLocation, Collections.synchronizedSet(new HashSet<ClassMirror<?>>()));
255+
classCache.put(rootLocation, Collections.synchronizedSet(new HashSet<>()));
256256
} else {
257257
classCache.get(rootLocation).clear();
258258
}
@@ -398,7 +398,7 @@ public synchronized void addDiscoveryLocation(URL url) {
398398
}
399399
urlCache.add(url);
400400
dirtyURLs.add(url);
401-
classCache.put(url, new HashSet<ClassMirror<?>>());
401+
classCache.put(url, new HashSet<>());
402402
}
403403

404404
/**
@@ -722,7 +722,7 @@ public <T> Set<ClassMirror<? extends T>> getClassesWithAnnotationThatExtend(Clas
722722
if(superClass.getAnnotation(annotation) != null) {
723723
// The mechanism above won't automatically add this class, so we need to add it
724724
// ourselves here.
725-
mirrors.add(new ClassMirror<T>(superClass));
725+
mirrors.add(new ClassMirror<>(superClass));
726726
}
727727
return mirrors;
728728
}

src/main/java/com/laytonsmith/PureUtilities/ClassLoading/ClassDiscoveryCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class ClassDiscoveryCache {
3939
*/
4040
private static final int READ_SIZE = 2048;
4141

42-
private File cacheDir;
42+
private final File cacheDir;
4343
private ProgressIterator progress;
4444
private Logger logger;
4545

src/main/java/com/laytonsmith/PureUtilities/Common/TemplateBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public String build(String template) throws IllegalArgumentException {
9797
// }
9898
// }
9999
String[] tmplArgs = ArrayUtils.EMPTY_STRING_ARRAY;
100-
if(m.group(2) != null && !m.group(2).equals("")) {
100+
if(m.group(2) != null && !m.group(2).isEmpty()) {
101101
//We have arguments
102102
//remove the initial |, then split
103103
tmplArgs = m.group(2).substring(1).split("\\|");

src/main/java/com/laytonsmith/PureUtilities/MSP/CapabilityList.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
*/
1111
public class CapabilityList {
1212

13-
private Map<Capability, CapabilityValue> caps = new HashMap<Capability, CapabilityValue>();
14-
private Connection connection;
13+
private final Map<Capability, CapabilityValue> caps = new HashMap<Capability, CapabilityValue>();
14+
private final Connection connection;
1515

1616
/**
1717
* Creates a new CapabilityList object.

src/main/java/com/laytonsmith/PureUtilities/Marquee.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ public interface MarqueeCallback {
1919
void stringPortion(String portion, Marquee self);
2020
}
2121
private String text;
22-
private int maxChars;
23-
private int delay;
22+
private final int maxChars;
23+
private final int delay;
2424
private boolean run;
25-
private MarqueeCallback callback;
25+
private final MarqueeCallback callback;
2626

2727
public Marquee(String string, int maxChars, int delay, MarqueeCallback callback) {
2828
this.maxChars = maxChars;

src/main/java/com/laytonsmith/PureUtilities/PublicSuffix.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ private void dump() {
257257
}
258258

259259
private void dump(final Map<String, SubdomainNode> node, final int offset) {
260-
if(node == null || node.size() == 0) {
260+
if(node == null || node.isEmpty()) {
261261
return;
262262
}
263263
for(Map.Entry<String, SubdomainNode> e : node.entrySet()) {

src/main/java/com/laytonsmith/PureUtilities/RollingAverage.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
*/
1111
public class RollingAverage {
1212

13-
private Double[] data;
13+
private final Double[] data;
1414
private int insertionIndex;
15-
private int dataSize;
16-
private double initialValue;
15+
private final int dataSize;
16+
private final double initialValue;
1717

1818
/**
1919
* Creates a new rolling average object.

src/main/java/com/laytonsmith/PureUtilities/SSHWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ private static void checkAck(InputStream in) throws IOException {
407407
// -1
408408

409409
if(b == 1 || b == 2) {
410-
StringBuffer sb = new StringBuffer();
410+
StringBuilder sb = new StringBuilder();
411411
int c;
412412
do {
413413
c = in.read();
@@ -436,7 +436,7 @@ static int checkAckFrom(InputStream in) throws IOException {
436436
}
437437

438438
if(b == 1 || b == 2) {
439-
StringBuffer sb = new StringBuffer();
439+
StringBuilder sb = new StringBuilder();
440440
int c;
441441
do {
442442
c = in.read();

0 commit comments

Comments
 (0)