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

public abstract class NumberSymbol extends Object implements IDateSymbol

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 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

      public final int parseDatePartAsInteger(String dateString, int pos, int maxWidth)
      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

      public 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. 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.