summaryrefslogtreecommitdiffstats
path: root/wizards/com/sun/star/wizards/common/NumericalHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/com/sun/star/wizards/common/NumericalHelper.java')
-rw-r--r--wizards/com/sun/star/wizards/common/NumericalHelper.java91
1 files changed, 0 insertions, 91 deletions
diff --git a/wizards/com/sun/star/wizards/common/NumericalHelper.java b/wizards/com/sun/star/wizards/common/NumericalHelper.java
index afcab2a472a1..16cded8b34bc 100644
--- a/wizards/com/sun/star/wizards/common/NumericalHelper.java
+++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java
@@ -1352,97 +1352,6 @@ public class NumericalHelper
return aShortVal;
}
- /**
- * Helper class for roman numbering
- */
- private static class RomanNumbering
- {
-
- /** the used roman lettesrs **/
- private static final String[] ROMAN_EQUIV = new String[]
- {
- "I", "V", "X", "L", "C", "D", "M"
- };
- /** max number that can be converted **/
- private static final int MAX_NUMBER = 3999;
- /** min number that can be converted **/
- private static final int MIN_NUMBER = 1;
- /** ASCII code for the number 0 **/
- private static final int ASCII_CODE_0 = 48;
- /** special number for the conversion algorithm **/
- private static final int FOUR = 4;
- /** special number for the conversion algorithm **/
- private static final int FIVE = 5;
- /** special number for the conversion algorithm **/
- private static final int NINE = 9;
-
- /**
- * Get the roman equivalent to an arabic number, e.g. 17 -> XVII.
- * The allowed range for numbers goes from 1 to 3999. These can be
- * converted using ASCII letters (3999 -> MMMCMXCIX).
- * @param n the arabic number
- * @return the roman equivalent as string
- * @throws com.sun.star.script.BasicErrorException if the number cannot be converted.
- */
- public static String getRomanEquivalent(int n)
- throws Exception
- {
- StringBuffer romanNumber = new StringBuffer();
- try
- {
- if (n > MAX_NUMBER || n < MIN_NUMBER)
- {
- DebugHelper.exception(1 /*BasicErrorCode.SbERR_OUT_OF_RANGE*/, PropertyNames.EMPTY_STRING);
- }
- String number = NumericalHelper.toString(new Integer(n));
- /* converison idea: every digit is written with a maximum of two
- * different roman symbols, using three in total, e.g. CC, CD,
- * DCC, CM for the hundreds (meaning 200, 400, 700 and 900).
- * So every digit is converted separately with regard to the
- * special cases 4 and 9.
- */
- int symbolIndex = 0;
- for (int i = number.length() - 1; i >= 0; i--)
- {
- StringBuffer romanDigit = new StringBuffer();
- int b = number.charAt(i) - ASCII_CODE_0;
- if (b == FOUR)
- { // special case IV
- romanDigit.append(ROMAN_EQUIV[symbolIndex]);
- romanDigit.append(ROMAN_EQUIV[symbolIndex + 1]);
- }
- else if (b == NINE)
- { // special case IX
- romanDigit.append(ROMAN_EQUIV[symbolIndex]);
- romanDigit.append(ROMAN_EQUIV[symbolIndex + 2]);
- }
- else
- {
- if (b >= FIVE)
- { // special case V
- romanDigit.append(ROMAN_EQUIV[symbolIndex + 1]);
- b = b - FIVE;
- }
- for (int j = 0; j < b; j++)
- { // append I's
- romanDigit.append(ROMAN_EQUIV[symbolIndex]);
- }
- }
- // next group of three symbols
- symbolIndex += 2;
- // append in reverse: we are starting at the right
- romanNumber.append(romanDigit.reverse());
- }
- }
- catch (com.sun.star.lang.IllegalArgumentException e)
- {
-//TODO does not do anything anyway DebugHelper.exception(e);
- }
- // reverse again to get the number
- return romanNumber.reverse().toString();
- }
- }
-
public static boolean representsIntegerNumber(double _dblvalue)
{
double dblsecvalue = ((int) _dblvalue);