Class NumberSymbol
java.lang.Object
com.aquima.interactions.foundation.text.symbol.NumberSymbol
- All Implemented Interfaces:
IDateSymbol
,Serializable
- Direct Known Subclasses:
CentiSecondSymbol
,DateSymbol
,DeciSecondSymbol
,HourSymbol
,MilliSecondSymbol
,MinuteSymbol
,MonthSymbol
,SecondSymbol
,YearSymbol
Base class for number symbols used by the DateFormat class.
This base class contains a few utility methods that may be used by descendant classes. It also declares a method to be implemented by all descendant classes to identify which Calendar field it represents.
- Since:
- 5.1
- Author:
- C. de Meijer
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract int
Returns the Calendar field this NumberSymbol represents.static final void
lz
(int i, int padLength, StringBuffer sb) This method uses an internally declared static StringBuffer to convert the specified integer to a string with leading zeroes if necessary.final int
parseDatePartAsInteger
(String dateString, int pos, int maxWidth) Utility method for descendant classes to parse part of a dateString as an integer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.aquima.interactions.foundation.text.IDateSymbol
format, getPattern, getWidth, parse
-
Constructor Details
-
NumberSymbol
public NumberSymbol()
-
-
Method Details
-
getCalendarField
public abstract int getCalendarField()Returns the Calendar field this NumberSymbol represents.- Returns:
- int Denoting the Calendar field this NumberSymbol represents.
-
parseDatePartAsInteger
Utility method for descendant classes to parse part of a dateString as an integer. The maxWith parameter may be less than the number returned by the getWidth method, if for example the next symbol is a seperator and the dateString does not use leading zeroes to pad the individual numbers.- Parameters:
dateString
- String containing the number to be parsed.pos
- integer denoting the position at which to start parsing the dateString.maxWidth
- integer denoting the maximum number of characters to parse.- Returns:
- Integer value of part of the dateString indicated by the pos and maxWidth parameter.
- Throws:
NumberFormatException
- if the specified part of the dateString could not be parsed as an integer.
-
lz
This method uses an internally declared static StringBuffer to convert the specified integer to a string with leading zeroes if necessary. The resulting string will be padded with leading zeroes up to a total length of the padLength parameter. The resulting string will be longer than the specified padLength if the integer results in a string longer than the padLength.
- Parameters:
i
- Integer to be converted to String.padLength
- Integer the length to patch the resulting string to, if its length is shorter.sb
- StringBuffer into which the string representation of the integer value specified by the 'i' parameter should be stored.
-