Class RomanNumbers

java.lang.Object
eu.bandm.tools.ops.RomanNumbers

public class RomanNumbers extends Object
  • Field Details

    • romanLetterValues

      protected static final Map<Character,Integer> romanLetterValues
    • thousands

      protected static final String[] thousands
    • hundreds

      protected static final String[] hundreds
    • tens

      protected static final String[] tens
    • units

      protected static final String[] units
  • Constructor Details

    • RomanNumbers

      public RomanNumbers()
  • Method Details

    • roman2integer

      @Opt public static final @Opt Integer roman2integer(BiConsumer<String,Object[]> errorReceiver, String s, boolean lowercasesupported, boolean uppercasesupported, boolean subtractiveformat_directNeighbour, boolean subtractiveformat_fartherNeighbour)
      Public and Central Service Access Point to convert a string. Supports string in all uppercase or all lowercase. Does not support MIXED subtractive and additive (like "CCCCIV").
      The subtractive digit must be a power of ten, so VL, VC, VD, VM, LD and LM are not supported. (Use XLV, XCV, XDV, XMV, CDL and CML instead.)
      Parameters:
      errorReceiver - for error text and argument array
      s - the string to convert
      lowercasesupported - whether the input may be in lower case only
      uppercasesupported - whether the input may be in upper case only
      subtractiveformat_directNeighbour - Whether the immediately smaller digit left of a digit means subtraction
      subtractiveformat_fartherNeighbour - Whether ANY smaller digit left of a digit means subtraction
      Returns:
      null in case of error (after sending error message)
    • int2roman

      @Opt public static @Opt String int2roman(int num, boolean uppercase)
      Public and Central Service Access Point. Delivers subtractive way of writing (IV, not IIII). MAXIMUM is currently MMMCMXCIX = 3999
      Parameters:
      num - the number to convert.
      uppercase - whether to return in uppercase, not lowercase.
      Returns:
      the converted string, or null if limit 3999 is exceeded.
    • main

      public static void main(String[] args)