org.infoglue.cms.util
Class MathHelper

java.lang.Object
  extended byorg.infoglue.cms.util.MathHelper

public class MathHelper
extends java.lang.Object

Author:
ss Various mathematical functions accesible to templateEditors

Constructor Summary
MathHelper()
           
 
Method Summary
 java.lang.Float divide(java.lang.Float value, int divider)
           
 java.lang.String fileSize(long size)
           
 java.lang.String fileSize(long size, java.util.Locale locale)
           
 java.lang.Float floatStringToFloat(java.lang.String value)
           
 java.lang.Integer floatStringToInteger(java.lang.String value)
           
 java.lang.String getNumberAsString(java.lang.Object value, java.util.Locale locale, java.lang.String pattern)
          This method returns a string represented a formatted float value.
 java.lang.String getNumberAsString(java.lang.Object value, java.lang.String pattern)
          This method returns a string represented a formatted float value.
 int getRandom()
          Gets a random number.
 int getRandom(int upperLimit)
          Gets a random number with an upper limit.
 int hexToDecimal(java.lang.String hex)
           
 java.lang.Integer stringToInteger(java.lang.String value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MathHelper

public MathHelper()
Method Detail

hexToDecimal

public int hexToDecimal(java.lang.String hex)

fileSize

public java.lang.String fileSize(long size)

fileSize

public java.lang.String fileSize(long size,
                                 java.util.Locale locale)

stringToInteger

public java.lang.Integer stringToInteger(java.lang.String value)

floatStringToInteger

public java.lang.Integer floatStringToInteger(java.lang.String value)

floatStringToFloat

public java.lang.Float floatStringToFloat(java.lang.String value)

getNumberAsString

public java.lang.String getNumberAsString(java.lang.Object value,
                                          java.util.Locale locale,
                                          java.lang.String pattern)
This method returns a string represented a formatted float value. The formatting is controlled with the locale and the pattern sent in.


getNumberAsString

public java.lang.String getNumberAsString(java.lang.Object value,
                                          java.lang.String pattern)
This method returns a string represented a formatted float value. The formatting is controlled with the pattern sent in.


divide

public java.lang.Float divide(java.lang.Float value,
                              int divider)

getRandom

public int getRandom()
Gets a random number.


getRandom

public int getRandom(int upperLimit)
Gets a random number with an upper limit.