org.efaps.number2words.converters
Class Spanish

java.lang.Object
  extended by org.efaps.number2words.converters.AbstractDecimalConverter
      extended by org.efaps.number2words.converters.Spanish
All Implemented Interfaces:
IConverter

public class Spanish
extends AbstractDecimalConverter

The class implements the conversion of numbers to Spanish words.

Version:
$Id: Spanish.java 2698 2009-06-27 12:15:16Z tim.moxter $
Author:
The eFaps Team

Constructor Summary
Spanish()
           
 
Method Summary
protected  java.lang.String convertLessThanOneHundred(int _number)
          The method converts the numbers from 1 to 99 into words.
protected  java.lang.String convertLessThanOneThousand(int _number)
          Method to convert the numbers from 1 to 999.
protected  java.lang.String convertPower(int _number, int _power)
          The method converts the given _number depending on the _power to words.
protected  java.lang.String getMinus()
          Returns the related Spanish word for "minus" needed for negative numbers.
protected  java.lang.String[] getNumNames()
          Returns the string array to define the conversion of numbers for 1 till 19.
protected  java.lang.String[] getPowerNames()
          Returns the string array for log numbers 100, 1000, 1000000 and 1000000000.
protected  java.lang.String[] getTensNames()
          Returns the string array for the numbers 10, 20, 30, 40, 50, 60, 70, 80 and 90.
protected  java.lang.String getZero()
          Returns the related Spanish word for the number zero ('0').
 
Methods inherited from class org.efaps.number2words.converters.AbstractDecimalConverter
convert, isDecimal, usesShortScale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Spanish

public Spanish()
Method Detail

convertLessThanOneThousand

protected java.lang.String convertLessThanOneThousand(int _number)
Method to convert the numbers from 1 to 999. The original method must be overwritten because of some specialties of the Spanish languages for numbers below 30 and for all hundred numbers (100, 200, ...).

Overrides:
convertLessThanOneThousand in class AbstractDecimalConverter
Parameters:
_number - number to be converted
Returns:
return words for number
See Also:
AbstractDecimalConverter.convertLessThanOneHundred(int)

convertLessThanOneHundred

protected java.lang.String convertLessThanOneHundred(int _number)
The method converts the numbers from 1 to 99 into words. The method is used from AbstractDecimalConverter.convertLessThanOneThousand(int).

Specified by:
convertLessThanOneHundred in class AbstractDecimalConverter
Parameters:
_number - number less than one hundred to convert
Returns:
converted _number in words

convertPower

protected java.lang.String convertPower(int _number,
                                        int _power)
The method converts the given _number depending on the _power to words. The real number to convert is "_number * (10 ^ _power)". The original method is overwritten because if _number is equal one, the values from SINGLE_POWER_NAMES must be used.

Overrides:
convertPower in class AbstractDecimalConverter
Parameters:
_number - number to convert
_power - power of the number
Returns:
converted string
See Also:
SINGLE_POWER_NAMES

getNumNames

protected java.lang.String[] getNumNames()
Returns the string array to define the conversion of numbers for 1 till 19.

Specified by:
getNumNames in class AbstractDecimalConverter
Returns:
string array of numbers
See Also:
AbstractDecimalConverter.getNumNames(), NUM_NAMES

getTensNames

protected java.lang.String[] getTensNames()
Returns the string array for the numbers 10, 20, 30, 40, 50, 60, 70, 80 and 90.

Specified by:
getTensNames in class AbstractDecimalConverter
Returns:
string array of tens names
See Also:
AbstractDecimalConverter.getTensNames(), TENS_NAMES

getPowerNames

protected java.lang.String[] getPowerNames()
Returns the string array for log numbers 100, 1000, 1000000 and 1000000000.

Specified by:
getPowerNames in class AbstractDecimalConverter
Returns:
string array of log numbers
See Also:
AbstractDecimalConverter.getPowerNames(), POWER_NAMES

getZero

protected java.lang.String getZero()
Returns the related Spanish word for the number zero ('0').

Specified by:
getZero in class AbstractDecimalConverter
Returns:
"cero"

getMinus

protected java.lang.String getMinus()
Returns the related Spanish word for "minus" needed for negative numbers.

Specified by:
getMinus in class AbstractDecimalConverter
Returns:
always the text string "menos"


Copyright © 2009 eFaps. All Rights Reserved.