test_class.declarator: NO_CODE = MonetaryFormat.BTC.noCode()
test_class.modifier: private static final
test_class.original_string: private static final MonetaryFormat NO_CODE = MonetaryFormat.BTC.noCode();
test_class.type: MonetaryFormat
test_class.var_name: NO_CODE
test_class.declarator: ONE_EURO = Fiat.parseFiat("EUR", "1")
test_class.modifier: private static final
test_class.original_string: private static final Fiat ONE_EURO = Fiat.parseFiat("EUR", "1");
test_class.type: Fiat
test_class.var_name: ONE_EURO
test_class.file: core/src/test/java/org/ulordj/utils/MonetaryFormatTest.java
test_class.identifier: MonetaryFormatTest
test_case.body: @Test
      public void uBtcRounding() throws Exception {
          assertEquals("0", format(ZERO, 6, 0));
          assertEquals("0.00", format(ZERO, 6, 2));
  
          assertEquals("1000000", format(COIN, 6, 0));
          assertEquals("1000000", format(COIN, 6, 0, 2));
          assertEquals("1000000.0", format(COIN, 6, 1));
          assertEquals("1000000.00", format(COIN, 6, 2));
  
          final Coin justNot = COIN.subtract(SATOSHI);
          assertEquals("1000000", format(justNot, 6, 0));
          assertEquals("999999.99", format(justNot, 6, 0, 2));
          assertEquals("1000000.0", format(justNot, 6, 1));
          assertEquals("999999.99", format(justNot, 6, 2));
  
          final Coin slightlyMore = COIN.add(SATOSHI);
          assertEquals("1000000", format(slightlyMore, 6, 0));
          assertEquals("1000000.01", format(slightlyMore, 6, 0, 2));
          assertEquals("1000000.0", format(slightlyMore, 6, 1));
          assertEquals("1000000.01", format(slightlyMore, 6, 2));
  
          final Coin pivot = COIN.add(SATOSHI.multiply(5));
          assertEquals("1000000.05", format(pivot, 6, 2));
          assertEquals("1000000.05", format(pivot, 6, 0, 2));
          assertEquals("1000000.1", format(pivot, 6, 1));
          assertEquals("1000000.1", format(pivot, 6, 0, 1));
  
          final Coin value = Coin.valueOf(1122334455667788l);
          assertEquals("11223344556678", format(value, 6, 0));
          assertEquals("11223344556677.88", format(value, 6, 2));
          assertEquals("11223344556677.9", format(value, 6, 1));
          assertEquals("11223344556677.88", format(value, 6, 2));
      }
test_case.class_method_signature: MonetaryFormatTest.uBtcRounding()
test_case.full_signature: @Test public void uBtcRounding()
test_case.identifier: uBtcRounding
test_case.invocations: assertEquals format assertEquals format assertEquals format assertEquals format assertEquals format assertEquals format subtract assertEquals format assertEquals format assertEquals format assertEquals format add assertEquals format assertEquals format assertEquals format assertEquals format add multiply assertEquals format assertEquals format assertEquals format assertEquals format valueOf assertEquals format assertEquals format assertEquals format assertEquals format
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void uBtcRounding()
focal_class.declarator: BTC = new MonetaryFormat().shift(0).minDecimals(2).repeatOptionalDecimals(2, 3)
focal_class.modifier: public static final
focal_class.original_string: public static final MonetaryFormat BTC = new MonetaryFormat().shift(0).minDecimals(2).repeatOptionalDecimals(2, 3);
focal_class.type: MonetaryFormat
focal_class.var_name: BTC
focal_class.declarator: MBTC = new MonetaryFormat().shift(3).minDecimals(2).optionalDecimals(2)
focal_class.modifier: public static final
focal_class.original_string: public static final MonetaryFormat MBTC = new MonetaryFormat().shift(3).minDecimals(2).optionalDecimals(2);
focal_class.type: MonetaryFormat
focal_class.var_name: MBTC
focal_class.declarator: UBTC = new MonetaryFormat().shift(6).minDecimals(0).optionalDecimals(2)
focal_class.modifier: public static final
focal_class.original_string: public static final MonetaryFormat UBTC = new MonetaryFormat().shift(6).minDecimals(0).optionalDecimals(2);
focal_class.type: MonetaryFormat
focal_class.var_name: UBTC
focal_class.declarator: FIAT = new MonetaryFormat().shift(0).minDecimals(2).repeatOptionalDecimals(2, 1)
focal_class.modifier: public static final
focal_class.original_string: public static final MonetaryFormat FIAT = new MonetaryFormat().shift(0).minDecimals(2).repeatOptionalDecimals(2, 1);
focal_class.type: MonetaryFormat
focal_class.var_name: FIAT
focal_class.declarator: CODE_BTC = "BTC"
focal_class.modifier: public static final
focal_class.original_string: public static final String CODE_BTC = "BTC";
focal_class.type: String
focal_class.var_name: CODE_BTC
focal_class.declarator: CODE_MBTC = "mBTC"
focal_class.modifier: public static final
focal_class.original_string: public static final String CODE_MBTC = "mBTC";
focal_class.type: String
focal_class.var_name: CODE_MBTC
focal_class.declarator: CODE_UBTC = "µBTC";
focal_class.modifier: public static final
focal_class.original_string: public static final String CODE_UBTC = "µBTC";
focal_class.type: String
focal_class.var_name: CODE_UBTC
focal_class.declarator: MAX_DECIMALS = 8
focal_class.modifier: public static final
focal_class.original_string: public static final int MAX_DECIMALS = 8;
focal_class.type: int
focal_class.var_name: MAX_DECIMALS
focal_class.declarator: negativeSign
focal_class.modifier: private final
focal_class.original_string: private final char negativeSign;
focal_class.type: char
focal_class.var_name: negativeSign
focal_class.declarator: positiveSign
focal_class.modifier: private final
focal_class.original_string: private final char positiveSign;
focal_class.type: char
focal_class.var_name: positiveSign
focal_class.declarator: zeroDigit
focal_class.modifier: private final
focal_class.original_string: private final char zeroDigit;
focal_class.type: char
focal_class.var_name: zeroDigit
focal_class.declarator: decimalMark
focal_class.modifier: private final
focal_class.original_string: private final char decimalMark;
focal_class.type: char
focal_class.var_name: decimalMark
focal_class.declarator: minDecimals
focal_class.modifier: private final
focal_class.original_string: private final int minDecimals;
focal_class.type: int
focal_class.var_name: minDecimals
focal_class.declarator: decimalGroups
focal_class.modifier: private final
focal_class.original_string: private final List<Integer> decimalGroups;
focal_class.type: List<Integer>
focal_class.var_name: decimalGroups
focal_class.declarator: shift
focal_class.modifier: private final
focal_class.original_string: private final int shift;
focal_class.type: int
focal_class.var_name: shift
focal_class.declarator: roundingMode
focal_class.modifier: private final
focal_class.original_string: private final RoundingMode roundingMode;
focal_class.type: RoundingMode
focal_class.var_name: roundingMode
focal_class.declarator: codes
focal_class.modifier: private final
focal_class.original_string: private final String[] codes;
focal_class.type: String[]
focal_class.var_name: codes
focal_class.declarator: codeSeparator
focal_class.modifier: private final
focal_class.original_string: private final char codeSeparator;
focal_class.type: char
focal_class.var_name: codeSeparator
focal_class.declarator: codePrefixed
focal_class.modifier: private final
focal_class.original_string: private final boolean codePrefixed;
focal_class.type: boolean
focal_class.var_name: codePrefixed
focal_class.declarator: DECIMALS_PADDING = "0000000000000000"
focal_class.modifier: private static final
focal_class.original_string: private static final String DECIMALS_PADDING = "0000000000000000";
focal_class.type: String
focal_class.var_name: DECIMALS_PADDING
focal_class.file: core/src/main/java/org/ulordj/utils/MonetaryFormat.java
focal_class.identifier: MonetaryFormat
focal_class.class_method_signature: MonetaryFormat.negativeSign(char negativeSign)
focal_class.full_signature: public MonetaryFormat negativeSign(char negativeSign)
focal_class.identifier: negativeSign
focal_class.modifiers: public
focal_class.parameters: (char negativeSign)
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat negativeSign(char negativeSign)
focal_class.class_method_signature: MonetaryFormat.positiveSign(char positiveSign)
focal_class.full_signature: public MonetaryFormat positiveSign(char positiveSign)
focal_class.identifier: positiveSign
focal_class.modifiers: public
focal_class.parameters: (char positiveSign)
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat positiveSign(char positiveSign)
focal_class.class_method_signature: MonetaryFormat.digits(char zeroDigit)
focal_class.full_signature: public MonetaryFormat digits(char zeroDigit)
focal_class.identifier: digits
focal_class.modifiers: public
focal_class.parameters: (char zeroDigit)
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat digits(char zeroDigit)
focal_class.class_method_signature: MonetaryFormat.decimalMark(char decimalMark)
focal_class.full_signature: public MonetaryFormat decimalMark(char decimalMark)
focal_class.identifier: decimalMark
focal_class.modifiers: public
focal_class.parameters: (char decimalMark)
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat decimalMark(char decimalMark)
focal_class.class_method_signature: MonetaryFormat.minDecimals(int minDecimals)
focal_class.full_signature: public MonetaryFormat minDecimals(int minDecimals)
focal_class.identifier: minDecimals
focal_class.modifiers: public
focal_class.parameters: (int minDecimals)
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat minDecimals(int minDecimals)
focal_class.class_method_signature: MonetaryFormat.optionalDecimals(int... groups)
focal_class.full_signature: public MonetaryFormat optionalDecimals(int... groups)
focal_class.identifier: optionalDecimals
focal_class.modifiers: public
focal_class.parameters: (int... groups)
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat optionalDecimals(int... groups)
focal_class.class_method_signature: MonetaryFormat.repeatOptionalDecimals(int decimals, int repetitions)
focal_class.full_signature: public MonetaryFormat repeatOptionalDecimals(int decimals, int repetitions)
focal_class.identifier: repeatOptionalDecimals
focal_class.modifiers: public
focal_class.parameters: (int decimals, int repetitions)
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat repeatOptionalDecimals(int decimals, int repetitions)
focal_class.class_method_signature: MonetaryFormat.shift(int shift)
focal_class.full_signature: public MonetaryFormat shift(int shift)
focal_class.identifier: shift
focal_class.modifiers: public
focal_class.parameters: (int shift)
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat shift(int shift)
focal_class.class_method_signature: MonetaryFormat.roundingMode(RoundingMode roundingMode)
focal_class.full_signature: public MonetaryFormat roundingMode(RoundingMode roundingMode)
focal_class.identifier: roundingMode
focal_class.modifiers: public
focal_class.parameters: (RoundingMode roundingMode)
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat roundingMode(RoundingMode roundingMode)
focal_class.class_method_signature: MonetaryFormat.noCode()
focal_class.full_signature: public MonetaryFormat noCode()
focal_class.identifier: noCode
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat noCode()
focal_class.class_method_signature: MonetaryFormat.code(int codeShift, String code)
focal_class.full_signature: public MonetaryFormat code(int codeShift, String code)
focal_class.identifier: code
focal_class.modifiers: public
focal_class.parameters: (int codeShift, String code)
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat code(int codeShift, String code)
focal_class.class_method_signature: MonetaryFormat.codeSeparator(char codeSeparator)
focal_class.full_signature: public MonetaryFormat codeSeparator(char codeSeparator)
focal_class.identifier: codeSeparator
focal_class.modifiers: public
focal_class.parameters: (char codeSeparator)
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat codeSeparator(char codeSeparator)
focal_class.class_method_signature: MonetaryFormat.prefixCode()
focal_class.full_signature: public MonetaryFormat prefixCode()
focal_class.identifier: prefixCode
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat prefixCode()
focal_class.class_method_signature: MonetaryFormat.postfixCode()
focal_class.full_signature: public MonetaryFormat postfixCode()
focal_class.identifier: postfixCode
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat postfixCode()
focal_class.class_method_signature: MonetaryFormat.withLocale(Locale locale)
focal_class.full_signature: public MonetaryFormat withLocale(Locale locale)
focal_class.identifier: withLocale
focal_class.modifiers: public
focal_class.parameters: (Locale locale)
focal_class.return: MonetaryFormat
focal_class.signature: MonetaryFormat withLocale(Locale locale)
focal_class.class_method_signature: MonetaryFormat.MonetaryFormat()
focal_class.full_signature: public  MonetaryFormat()
focal_class.identifier: MonetaryFormat
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  MonetaryFormat()
focal_class.class_method_signature: MonetaryFormat.MonetaryFormat(char negativeSign, char positiveSign, char zeroDigit, char decimalMark, int minDecimals,
              List<Integer> decimalGroups, int shift, RoundingMode roundingMode, String[] codes,
              char codeSeparator, boolean codePrefixed)
focal_class.full_signature: private  MonetaryFormat(char negativeSign, char positiveSign, char zeroDigit, char decimalMark, int minDecimals,
              List<Integer> decimalGroups, int shift, RoundingMode roundingMode, String[] codes,
              char codeSeparator, boolean codePrefixed)
focal_class.identifier: MonetaryFormat
focal_class.modifiers: private
focal_class.parameters: (char negativeSign, char positiveSign, char zeroDigit, char decimalMark, int minDecimals,
              List<Integer> decimalGroups, int shift, RoundingMode roundingMode, String[] codes,
              char codeSeparator, boolean codePrefixed)
focal_class.signature:  MonetaryFormat(char negativeSign, char positiveSign, char zeroDigit, char decimalMark, int minDecimals,
              List<Integer> decimalGroups, int shift, RoundingMode roundingMode, String[] codes,
              char codeSeparator, boolean codePrefixed)
focal_class.class_method_signature: MonetaryFormat.format(Monetary monetary)
focal_class.full_signature: public CharSequence format(Monetary monetary)
focal_class.identifier: format
focal_class.modifiers: public
focal_class.parameters: (Monetary monetary)
focal_class.return: CharSequence
focal_class.signature: CharSequence format(Monetary monetary)
focal_class.class_method_signature: MonetaryFormat.parse(String str)
focal_class.full_signature: public Coin parse(String str)
focal_class.identifier: parse
focal_class.modifiers: public
focal_class.parameters: (String str)
focal_class.return: Coin
focal_class.signature: Coin parse(String str)
focal_class.class_method_signature: MonetaryFormat.parseFiat(String currencyCode, String str)
focal_class.full_signature: public Fiat parseFiat(String currencyCode, String str)
focal_class.identifier: parseFiat
focal_class.modifiers: public
focal_class.parameters: (String currencyCode, String str)
focal_class.return: Fiat
focal_class.signature: Fiat parseFiat(String currencyCode, String str)
focal_class.class_method_signature: MonetaryFormat.parseValue(String str, int smallestUnitExponent)
focal_class.full_signature: private long parseValue(String str, int smallestUnitExponent)
focal_class.identifier: parseValue
focal_class.modifiers: private
focal_class.parameters: (String str, int smallestUnitExponent)
focal_class.return: long
focal_class.signature: long parseValue(String str, int smallestUnitExponent)
focal_class.class_method_signature: MonetaryFormat.code()
focal_class.full_signature: public String code()
focal_class.identifier: code
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String code()
focal_class.class_method_signature: MonetaryFormat.equals(final Object o)
focal_class.full_signature: @Override public boolean equals(final Object o)
focal_class.identifier: equals
focal_class.modifiers: @Override public
focal_class.parameters: (final Object o)
focal_class.return: boolean
focal_class.signature: boolean equals(final Object o)
focal_class.class_method_signature: MonetaryFormat.hashCode()
focal_class.full_signature: @Override public int hashCode()
focal_class.identifier: hashCode
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int hashCode()
focal_method.body: public CharSequence format(Monetary monetary) {
          // preparation
          int maxDecimals = minDecimals;
          if (decimalGroups != null)
              for (int group : decimalGroups)
                  maxDecimals += group;
          int smallestUnitExponent = monetary.smallestUnitExponent();
          checkState(maxDecimals <= smallestUnitExponent,
                  "The maximum possible number of decimals (%s) cannot exceed %s.", maxDecimals, smallestUnitExponent);
  
          // rounding
          long satoshis = Math.abs(monetary.getValue());
          long precisionDivisor = checkedPow(10, smallestUnitExponent - shift - maxDecimals);
          satoshis = checkedMultiply(divide(satoshis, precisionDivisor, roundingMode), precisionDivisor);
  
          // shifting
          long shiftDivisor = checkedPow(10, smallestUnitExponent - shift);
          long numbers = satoshis / shiftDivisor;
          long decimals = satoshis % shiftDivisor;
  
          // formatting
          String decimalsStr = String.format(Locale.US, "%0" + (smallestUnitExponent - shift) + "d", decimals);
          StringBuilder str = new StringBuilder(decimalsStr);
          while (str.length() > minDecimals && str.charAt(str.length() - 1) == '0')
              str.setLength(str.length() - 1); // trim trailing zero
          int i = minDecimals;
          if (decimalGroups != null) {
              for (int group : decimalGroups) {
                  if (str.length() > i && str.length() < i + group) {
                      while (str.length() < i + group)
                          str.append('0');
                      break;
                  }
                  i += group;
              }
          }
          if (str.length() > 0)
              str.insert(0, decimalMark);
          str.insert(0, numbers);
          if (monetary.getValue() < 0)
              str.insert(0, negativeSign);
          else if (positiveSign != 0)
              str.insert(0, positiveSign);
          if (codes != null) {
              if (codePrefixed) {
                  str.insert(0, codeSeparator);
                  str.insert(0, code());
              } else {
                  str.append(codeSeparator);
                  str.append(code());
              }
          }
  
          // Convert to non-arabic digits.
          if (zeroDigit != '0') {
              int offset = zeroDigit - '0';
              for (int d = 0; d < str.length(); d++) {
                  char c = str.charAt(d);
                  if (Character.isDigit(c))
                      str.setCharAt(d, (char) (c + offset));
              }
          }
          return str;
      }
focal_method.class_method_signature: MonetaryFormat.format(Monetary monetary)
focal_method.full_signature: public CharSequence format(Monetary monetary)
focal_method.identifier: format
focal_method.invocations: smallestUnitExponent checkState abs getValue checkedPow checkedMultiply divide checkedPow format length charAt length setLength length length length length append length insert insert getValue insert insert insert insert code append append code length charAt isDigit setCharAt
focal_method.modifiers: public
focal_method.parameters: (Monetary monetary)
focal_method.return: CharSequence
focal_method.signature: CharSequence format(Monetary monetary)