summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/ioutils/format/GeneralNumberDirective.java
diff options
context:
space:
mode:
authorbjculkin <bjculkin@mix.wvu.edu>2018-03-01 14:16:15 -0500
committerbjculkin <bjculkin@mix.wvu.edu>2018-03-01 14:16:15 -0500
commit0b373102f64fd7bfd25837a24ffb4ccb44b9d7e9 (patch)
treefe947781da6ca891a3e25a3461f3394a7953d080 /base/src/main/java/bjc/utils/ioutils/format/GeneralNumberDirective.java
parent2d8f0aba5565b292f17695afd276143a4f71c72b (diff)
Finish most of CL formatting.
There are a couple of unimplemented directives, but the only ones I'd consider anywhere near crucial would be the floating-point ones, which I'm not sure what I should do with them.
Diffstat (limited to 'base/src/main/java/bjc/utils/ioutils/format/GeneralNumberDirective.java')
-rw-r--r--base/src/main/java/bjc/utils/ioutils/format/GeneralNumberDirective.java45
1 files changed, 0 insertions, 45 deletions
diff --git a/base/src/main/java/bjc/utils/ioutils/format/GeneralNumberDirective.java b/base/src/main/java/bjc/utils/ioutils/format/GeneralNumberDirective.java
deleted file mode 100644
index 6a90f94..0000000
--- a/base/src/main/java/bjc/utils/ioutils/format/GeneralNumberDirective.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package bjc.utils.ioutils.format;
-
-import bjc.utils.math.NumberUtils;
-
-abstract class GeneralNumberDirective implements Directive {
- protected static void handleNumberDirective(StringBuffer buff, CLModifiers mods, CLParameters params,
- int argidx, long val, int radix) {
- /*
- * Initialize the two padding related parameters, and then fill
- * them in from the directive parameters if they are present.
- */
- int mincol = 0;
- char padchar = ' ';
- if(params.length() > (argidx + 2)) {
- mincol = params.getIntDefault(argidx + 1, "minimum column count", 'R', 0);
- }
- if(params.length() > (argidx + 3)) {
- padchar = params.getCharDefault(argidx + 2, "padding character", 'R', ' ');
- }
-
- String res;
-
- if(mods.colonMod) {
- /*
- * We're doing commas, so check if the two comma-related
- * parameters were supplied.
- */
- int commaInterval = 0;
- char commaChar = ',';
- if(params.length() > (argidx + 3)) {
- commaChar = params.getCharDefault((argidx + 3), "comma character", 'R', ' ');
- }
- if(params.length() > (argidx + 4)) {
- commaInterval = params.getIntDefault((argidx + 4), "comma interval", 'R', 0);
- }
-
- res = NumberUtils.toCommaString(val, mincol, padchar, commaInterval, commaChar, mods.atMod,
- radix);
- } else {
- res = NumberUtils.toNormalString(val, mincol, padchar, mods.atMod, radix);
- }
-
- buff.append(res);
- }
-}