aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/anarres/cpp/Main.java
diff options
context:
space:
mode:
authorShevek <[email protected]>2014-09-10 16:10:52 -0700
committerShevek <[email protected]>2014-09-10 19:07:35 -0700
commitbcc3a2b96b0e8b8b03dad0babd7103903cc9df3f (patch)
tree09a2833189524f55e5a6c149cc0e4650a6e5a5f0 /src/main/java/org/anarres/cpp/Main.java
parentaefac8ce01aee2f538db413d5812613facee9c55 (diff)
NetBeans refactorings to standardize codebase.
Diffstat (limited to 'src/main/java/org/anarres/cpp/Main.java')
-rw-r--r--src/main/java/org/anarres/cpp/Main.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main/java/org/anarres/cpp/Main.java b/src/main/java/org/anarres/cpp/Main.java
index 4c50b70..3bc02eb 100644
--- a/src/main/java/org/anarres/cpp/Main.java
+++ b/src/main/java/org/anarres/cpp/Main.java
@@ -16,11 +16,11 @@
*/
package org.anarres.cpp;
+import gnu.getopt.Getopt;
+import gnu.getopt.LongOpt;
import java.io.File;
import java.io.PrintStream;
import java.util.EnumSet;
-import gnu.getopt.Getopt;
-import gnu.getopt.LongOpt;
/**
* (Currently a simple test class).
@@ -29,8 +29,8 @@ public class Main {
private static class Option extends LongOpt {
- private String eg;
- private String help;
+ private final String eg;
+ private final String help;
public Option(String word, int arg, int ch,
String eg, String help) {
@@ -204,8 +204,8 @@ public class Main {
private static String getShortOpts(Option[] opts)
throws Exception {
StringBuilder buf = new StringBuilder();
- for (int i = 0; i < opts.length; i++) {
- char c = (char) opts[i].getVal();
+ for (Option opt : opts) {
+ char c = (char) opt.getVal();
if (!Character.isLetterOrDigit(c))
continue;
for (int j = 0; j < buf.length(); j++)
@@ -214,7 +214,7 @@ public class Main {
"Duplicate short option " + c
);
buf.append(c);
- switch (opts[i].getHasArg()) {
+ switch (opt.getHasArg()) {
case LongOpt.NO_ARGUMENT:
break;
case LongOpt.OPTIONAL_ARGUMENT:
@@ -284,9 +284,9 @@ public class Main {
private static void usage(String command, Option[] options) {
StringBuilder text = new StringBuilder("Usage: ");
text.append(command).append('\n');
- for (int i = 0; i < options.length; i++) {
+ for (Option option : options) {
StringBuilder line = new StringBuilder();
- Option opt = options[i];
+ Option opt = option;
line.append(" --").append(opt.getName());
switch (opt.getHasArg()) {
case LongOpt.NO_ARGUMENT: