ZenMagick 0.9.6


org.zenmagick.model.ZMCurrency

Class ZMCurrency

ZMObject
|
+--ZMCurrency

public class ZMCurrency
extends ZMObject

A single currency.

Author:
DerManoMann
Version:
$Id: ZMCurrency.php 2200 2009-05-05 01:01:27Z dermanomann $

Fields inherited from org.zenmagick.ZMObject
properties_
Constructor Summary

ZMCurrency()

Create new instance.

Method Summary
float

convertFrom(float amount)

Convert from this currency into default currency.

float

convertTo(float amount)

Convert from default currency into this currency.

string

format(float amount, boolean convert)

Format the given amount according to this currency's rate and formatting rules.

string

getCode()

Get the currency code.

int

getDecimalPlaces()

Get the currency decimal places.

string

getDecimalPoint()

Get the currency decimal point.

int

getId()

Get the currency id.

string

getName()

Get the currency name.

double

getRate()

Get the currency rate.

string

getSymbolLeft()

Get the currency symbox (left).

string

getSymbolRight()

Get the currency symbox (right).

string

getThousandsPoint()

Get the currency thousands point.

float

parse(string value)

Parse a formatted currency amount.

void

setCode(string code)

Set the currency code.

void

setDecimalPlaces(int decimals)

Set the currency decimal places.

void

setDecimalPoint(string point)

Set the currency decimal point.

void

setId(int id)

Set the currency id.

void

setName(string name)

Set the currency name.

void

setRate(double rate)

Set the currency rate.

void

setSymbolLeft(string symbol)

Set the currency symbox (left).

void

setSymbolRight(string symbol)

Set the currency symbox (right).

void

setThousandsPoint(string point)

Set the currency thousands point.

Methods inherited from org.zenmagick.ZMObject
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Constructor Detail

ZMCurrency

public ZMCurrency()

Create new instance. /


Method Detail

convertFrom

public float convertFrom(float amount)

Convert from this currency into default currency.

Parameters:
amount - The amount in this currency.
Returns:
The converted amount.

convertTo

public float convertTo(float amount)

Convert from default currency into this currency.

Parameters:
amount - The amount in the default currency.
Returns:
The converted amount.

format

public string format(float amount, boolean convert)

Format the given amount according to this currency's rate and formatting rules.

Parameters:
amount - The amount.
convert - If true, consider $amount to be in default currency and * convert before formatting.
Returns:
The formatted amount.

getCode

public string getCode()

Get the currency code.

Returns:
The currency code.

getDecimalPlaces

public int getDecimalPlaces()

Get the currency decimal places.

Returns:
The currency decimal places.

getDecimalPoint

public string getDecimalPoint()

Get the currency decimal point.

Returns:
The currency decimal point.

getId

public int getId()

Get the currency id.

Returns:
The currency id.

getName

public string getName()

Get the currency name.

Returns:
The currency name.

getRate

public double getRate()

Get the currency rate.

This is the rate in relation to the default currency.

Returns:
The currency rate.

getSymbolLeft

public string getSymbolLeft()

Get the currency symbox (left).

Returns:
The currency symbol (left).

getSymbolRight

public string getSymbolRight()

Get the currency symbox (right).

Returns:
The currency symbol (right).

getThousandsPoint

public string getThousandsPoint()

Get the currency thousands point.

Returns:
The currency thousands point.

parse

public float parse(string value)

Parse a formatted currency amount.

Parameters:
value - The formatted currency value.
Returns:
The amount.

setCode

public void setCode(string code)

Set the currency code.

Parameters:
code - The currency code.

setDecimalPlaces

public void setDecimalPlaces(int decimals)

Set the currency decimal places.

Parameters:
decimals - The currency decimal places.

setDecimalPoint

public void setDecimalPoint(string point)

Set the currency decimal point.

Parameters:
point - The currency decimal point.

setId

public void setId(int id)

Set the currency id.

Parameters:
id - The currency id.

setName

public void setName(string name)

Set the currency name.

Parameters:
name - The currency name.

setRate

public void setRate(double rate)

Set the currency rate.

This is the rate in relation to the default currency.

Parameters:
rate - The currency rate.

setSymbolLeft

public void setSymbolLeft(string symbol)

Set the currency symbox (left).

Parameters:
symbol - The currency symbol (left).

setSymbolRight

public void setSymbolRight(string symbol)

Set the currency symbox (right).

Parameters:
symbol - The currency symbol (right).

setThousandsPoint

public void setThousandsPoint(string point)

Set the currency thousands point.

Parameters:
point - The currency thousands point.

ZenMagick 0.9.6