ealet
Class EthiopicNumber

java.lang.Object
  extended by ealet.EthiopicNumber

public class EthiopicNumber
extends java.lang.Object

The Ethiopic numbering system is different from the Hindu-Arabic (modern) system. The system consists of 20 digits, but not 0, thus counting begins from 1. The Ethiopic numerals in modern form are (1, 2, 3, 4, 5, 6, ,7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10000).

Briefly, these are the set of rules for writing Ethiopic numbers. Assume they are strictly based on integer (whole) numbers.

  1. Numbers from 1-10 are written as such
  2. Numbers from 11-99 are written using their tens place digits followed by the ones place digit. For instance, 11 = (10)(1).
  3. Numbers from 100-9900 are written as a multiple of 100s plus the above rules
  4. Numbers from 10,000-above are written as a multiple of 10,000 plus the above rules

Version:
1.0 October 12, 2005
Author:
abass alamnehe

Constructor Summary
EthiopicNumber()
          Instance with hashtable with Ethiopic digits and their equivalents
 
Method Summary
 java.lang.String ethiopicUnicode(long modern)
          Returns Ethiopic number in Unicode form (2 bytes)
 java.lang.String ethiopicUTF(long modern)
          Returns Ethiopic number in UTF-8
 char getEthiopic(long num)
          Maps modern number to Ethiopic digit and returns the result
 int getModern(char c)
          Maps the Ethiopic digit in modern and returns the result
 void toEthiopic(long x)
          Converets a Hindu-Arabic numerals to Ethiopic numerals and stores the result into an array.
 long toModern(java.lang.String ethiopic)
          Converts Ethiopic number to modern or Hindu-Arabic number and returns the result.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EthiopicNumber

public EthiopicNumber()
Instance with hashtable with Ethiopic digits and their equivalents

Method Detail

getModern

public int getModern(char c)
Maps the Ethiopic digit in modern and returns the result

Parameters:
c - The Ethiopic digit to be mapped to modern
Returns:
The equivalent number in modern to Ethiopic digit
Since:
2.0

getEthiopic

public char getEthiopic(long num)
Maps modern number to Ethiopic digit and returns the result

Parameters:
num - The Ethiopic digit to be mapped to modern
Returns:
The equivalent Ethiopic digit to modern number
Since:
2.0

ethiopicUnicode

public java.lang.String ethiopicUnicode(long modern)
Returns Ethiopic number in Unicode form (2 bytes)

Parameters:
modern - A number in modern to be converted to Ethiopic
Returns:
Ethiopic number in Unicode (2bytes)
Since:
2.0

ethiopicUTF

public java.lang.String ethiopicUTF(long modern)
Returns Ethiopic number in UTF-8

Parameters:
modern - A number in modern to be converted to Ethiopic
Returns:
Ethiopic number in UTF-8
Since:
2.0

toEthiopic

public void toEthiopic(long x)
Converets a Hindu-Arabic numerals to Ethiopic numerals and stores the result into an array. The result is still in Hindu-Arabic numeral form; that is, converstion to real Ethiopic digits is necessary.

Parameters:
x - Hindu-Arabic numeral to be converted
Since:
2.0

toModern

public long toModern(java.lang.String ethiopic)
Converts Ethiopic number to modern or Hindu-Arabic number and returns the result. A given Ethiopic number is parsed from left to right while performing the arithmetic operations using stack. The following examples shows how such a given number is calculated to produce a modern equivalent.
    Unicode    :  0x1370 0x137C 0x1372 0x1371 0x137B 0xu137A 0x1371
    Decimal    :  2      10000   10     9      100    90      9
    Operations :  2  *   10000 +(10  +  9) *   100 +  90  +   9
    Result     :  21999 
 

Parameters:
ethiopic - Ethiopic number in String form
Returns:
The converted number result in modern
Since:
2.0