Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Qizx/open 4.1 API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.qizx.api.util.text
Class FormatNumberSieve

    java.lang.Object
      com.qizx.api.util.text.SieveBase
          com.qizx.api.util.text.FormatNumberSieve

All Implemented Interfaces:
  Indexing.NumberSieve, Indexing.Sieve

    public class FormatNumberSieve

extends SieveBase
implements Indexing.NumberSieve

Converts a number using a Java NumberFormat.

Field Summary
`static String` | `FORMAT` Name of the parameter used for specifying the format of recognized number values.
`static String` | `LOCALE` Name of the parameter used for specifying the locale of parsed dates.

Constructor Summary
`FormatNumberSieve()` Constructs a sieve that recognizes a number in US format.
`FormatNumberSieve(String decimalFormat)` Constructs a sieve that recognizes a particular Decimal format.

Method Summary
`double` | `convert(String value)` Attempts to convert the text fragment to a double value.
`String` | `getFormat()` Returns the currently used Date Format.
`void` | `setFormat(String numberFormat, Locale locale)` Sets the format used.
`void` | `setParameters(String[] parameters)` Defines optional parameters for the sieve.

Methods inherited from class com.qizx.api.util.text.SieveBase
`addParameter, getParameters, toString`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.qizx.api.Indexing.Sieve
`getParameters`

Field Detail

### FORMAT

    public static final String FORMAT

  Name of the parameter used for specifying the format of recognized number values. The value of the parameter must be accepted by `DecimalFormat`.

  See Also:
    Constant Field Values

### LOCALE

    public static final String LOCALE

  Name of the parameter used for specifying the locale of parsed dates. The value of this parameter can be of different forms (the dash separator can also be replaced by an underscore):
  - language (ISO 639, accepted by `Locale`)
  - language-country, for example en-US
  - language-country-variant, for example en-US-POSIX. The variant value is generally "WIN", "MAC" or "POSIX".

  See Also:
    Constant Field Values

Constructor Detail

### FormatNumberSieve

    public FormatNumberSieve()

  Constructs a sieve that recognizes a number in US format.

### FormatNumberSieve

    public FormatNumberSieve(String decimalFormat)

  Constructs a sieve that recognizes a particular Decimal format.

  Parameters:
    `decimalFormat` - a format accepted by `DecimalFormat`

Method Detail

### setParameters

    public void setParameters(String[] parameters)
                       throws DataModelException

  Description copied from interface: `Indexing.Sieve`
  Defines optional parameters for the sieve.

  Specified by:
    `setParameters` in interface `Indexing.Sieve`
  Parameters:
    `parameters` - an array of even size containing alternately a parameter name and a parameter value.
  Throws:
    `DataModelException` - if the option is unknown or the value is invalid.

### setFormat

    public void setFormat(String numberFormat,
                          Locale locale)

  Sets the format used. Convenience method equivalent to setting parameter "format".

  Parameters:
    `numberFormat` - a format accepted by `DecimalFormat`
    `locale` - if not null, the format is adapted to this locale

### getFormat

    public String getFormat()

  Returns the currently used Date Format.

  Returns:
    the currently used Date Format.

### convert

    public double convert(String value)

  Description copied from interface: `Indexing.NumberSieve`
  Attempts to convert the text fragment to a double value.

  Specified by:
    `convert` in interface `Indexing.NumberSieve`
  Parameters:
    `value` - an alleged numeric value in text form.
  Returns:
    the converted value, or NaN if the conversion is not possible. Should raise no exception

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| © 2010 Axyana Software
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD