From 0b373102f64fd7bfd25837a24ffb4ccb44b9d7e9 Mon Sep 17 00:00:00 2001 From: bjculkin Date: Thu, 1 Mar 2018 14:16:15 -0500 Subject: 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. --- .../bjc/utils/ioutils/format/RadixDirective.java | 44 ---------------------- 1 file changed, 44 deletions(-) delete mode 100644 base/src/main/java/bjc/utils/ioutils/format/RadixDirective.java (limited to 'base/src/main/java/bjc/utils/ioutils/format/RadixDirective.java') diff --git a/base/src/main/java/bjc/utils/ioutils/format/RadixDirective.java b/base/src/main/java/bjc/utils/ioutils/format/RadixDirective.java deleted file mode 100644 index 668a0bd..0000000 --- a/base/src/main/java/bjc/utils/ioutils/format/RadixDirective.java +++ /dev/null @@ -1,44 +0,0 @@ -package bjc.utils.ioutils.format; - -import bjc.utils.esodata.Tape; -import bjc.utils.math.NumberUtils; - -import java.util.IllegalFormatConversionException; -import java.util.regex.Matcher; - -class RadixDirective extends GeneralNumberDirective { - - @Override - public void format(StringBuffer buff, Object arg, CLModifiers mods, CLParameters params, Tape tParams, - Matcher dirMatcher, CLFormatter fmt) { - CLFormatter.checkItem(arg, 'R'); - - if(!(arg instanceof Number)) { - throw new IllegalFormatConversionException('R', arg.getClass()); - } - - /* - * @TODO see if this is the way we want to do this. - */ - long val = ((Number) arg).longValue(); - - if(params.length() == 0) { - if(mods.atMod) { - buff.append(NumberUtils.toRoman(val, mods.colonMod)); - } else if(mods.colonMod) { - buff.append(NumberUtils.toOrdinal(val)); - } else { - buff.append(NumberUtils.toCardinal(val)); - } - } else { - if(params.length() < 1) throw new IllegalArgumentException( - "R directive requires at least one parameter, the radix"); - - int radix = params.getInt(0, "radix", 'R'); - - handleNumberDirective(buff, mods, params, 0, val, radix); - } - - tParams.right(); - } -} -- cgit v1.2.3