com.esri.arcgis.system
Interface IFractionFormat

All Superinterfaces:
Serializable
All Known Implementing Classes:
FractionFormat

public interface IFractionFormat
extends Serializable

Provides access to members that format fractions.

Description

The members in the IFractionFormat interface define how the ValueToString method in the associated INumberFormat interface formats numbers.

Use the IFractionFormat interface to either convert from a decimal fraction to a formatted fraction (using the ValueToString method) or to evaluate a formatted fraction as a decimal (using the StringToValue method). Basically, this means that ValueToString could convert an input of 0.75 to a string such as 3/4, and 2.5 could become 2 1/2, while StringToValue would do the reverse.

The properties FractionOption and FractionFactor give you more control over how the ValueToString conversion takes place because they allow you to use the FractionFactor to specify what denominator should be used for the output. The way in which this FractionFactor is used depends on which of the two settings (esriFractionOptionEnum) is used for the FractionOption property.

When To Use

Use the IFractionFormat interface to determine fractions for given decimal values or to evaluate formatted fractions.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

See Also:
ILatLonFormat2, CustomNumberFormat, IRateFormat, IAngleFormat, NumericFormat, LatLonFormat, CurrencyFormat, INumericFormat, IFractionFormat, RateFormat, IScientificNumberFormat, ICustomNumberFormat, ILatLonFormat, IPercentageFormat, INumberFormat, ScientificFormat, FractionFormat, PercentageFormat, AngleFormat

Method Summary
 int getFractionFactor()
          The maximum number of digits for the numerator or denominator, or the denominator of the formatted fraction.
 int getFractionOption()
          The fraction option determines how the numerator and denominator of the fraction are treated.
 void setFractionFactor(int factor)
          The maximum number of digits for the numerator or denominator, or the denominator of the formatted fraction.
 void setFractionOption(int option)
          The fraction option determines how the numerator and denominator of the fraction are treated.
 

Method Detail

setFractionOption

void setFractionOption(int option)
                       throws IOException,
                              AutomationException
The fraction option determines how the numerator and denominator of the fraction are treated.

Description

The FractionOption property sets or returns an option that determines how the FractionFactor property is used when the ValueToString method in the associated INumberFormat interface formats numbers.

The settings for FractionOption are:

Setting Description

esriSpecifyFractionDigits

(Default) The FractionFactor property specifies the maximum number of digits the numerator or denominator is calculated to.

If the value passed to ValueToString evaluates to a fraction whose numerator or denominator has more digits than specified in the FractionFactor property, the formatted string will be the closest fraction to the number of digits specified. In the example, StringToValue first evaluates the fraction 893/1234 to return a decimal value of 0.723662884927066. When ValueToString formats this number, it returns a formatted result of 474/655 because this is the closest 3 digit fraction to the decimal value. To calulate all 4 digits in the denominator, FractionFactor would need to be set to a value of 4. The caveat here is it takes a lot of processing time to figure out the fraction for higher FractionFactor's.

esriSpecifyFractionDenominator

The FractionFactor property value specifies the denominator. Since the ValueToString method doesn't have to calculate the denominator, the result is returned very quickly.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
option - A com.esri.arcgis.system.esriFractionOptionEnum constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
ILatLonFormat2, CustomNumberFormat, IRateFormat, IAngleFormat, NumericFormat, LatLonFormat, CurrencyFormat, INumericFormat, IFractionFormat, RateFormat, IScientificNumberFormat, ICustomNumberFormat, ILatLonFormat, IPercentageFormat, INumberFormat, ScientificFormat, FractionFormat, PercentageFormat, AngleFormat

getFractionOption

int getFractionOption()
                      throws IOException,
                             AutomationException
The fraction option determines how the numerator and denominator of the fraction are treated.

Description

The FractionOption property sets or returns an option that determines how the FractionFactor property is used when the ValueToString method in the associated INumberFormat interface formats numbers.

The settings for FractionOption are:

Setting Description

esriSpecifyFractionDigits

(Default) The FractionFactor property specifies the maximum number of digits the numerator or denominator is calculated to.

If the value passed to ValueToString evaluates to a fraction whose numerator or denominator has more digits than specified in the FractionFactor property, the formatted string will be the closest fraction to the number of digits specified. In the example, StringToValue first evaluates the fraction 893/1234 to return a decimal value of 0.723662884927066. ValueToString can format this decimal number back to 893/1234; however, the maximum number of decimal places to be used in the output fraction is three (by default). Therefore, by default this returns a formatted result of 474/655 because this is the closest three-digit fraction to the decimal value. To calculate all four digits in the denominator and return to the original fraction, FractionFactor needs to be set to a value of 4. The caveat here is that the higher the FractionFactor setting, the more processing time it will take to figure out the fraction.

esriSpecifyFractionDenominator

The FractionFactor property value explicitly specifies the denominator. Since the ValueToString method doesn't have to calculate the denominator, the result is returned very quickly.

Remarks

For example, when using esriSpecifyFractionDenominator, if the FractionFactor is set to 8, then the resulting fraction would be given in eighths. The result will be rounded to fit the denominator specified, as both 0.75 and 0.85 become 3/4 in the example below.

When using StringToValue, neither the FractionOption nor the FractionFactor properties are used; instead, a straightforward evaluation of the fraction is carried out. For example, 5/8 returns a value of 0.625, and 6 3/4 returns 6.75.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
A com.esri.arcgis.system.esriFractionOptionEnum constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
ILatLonFormat2, CustomNumberFormat, IRateFormat, IAngleFormat, NumericFormat, LatLonFormat, CurrencyFormat, INumericFormat, IFractionFormat, RateFormat, IScientificNumberFormat, ICustomNumberFormat, ILatLonFormat, IPercentageFormat, INumberFormat, ScientificFormat, FractionFormat, PercentageFormat, AngleFormat

setFractionFactor

void setFractionFactor(int factor)
                       throws IOException,
                              AutomationException
The maximum number of digits for the numerator or denominator, or the denominator of the formatted fraction.

Description

The FractionFactor property sets or returns a value (default: 1) that specifies the maximum number of digits for the numerator or denominator, or is used as the denominator of the formatted fraction.

The way the FractionFactor property is used depends on how the FractionOption property is set.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
factor - The factor (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
ILatLonFormat2, CustomNumberFormat, IRateFormat, IAngleFormat, NumericFormat, LatLonFormat, CurrencyFormat, INumericFormat, IFractionFormat, RateFormat, IScientificNumberFormat, ICustomNumberFormat, ILatLonFormat, IPercentageFormat, INumberFormat, ScientificFormat, FractionFormat, PercentageFormat, AngleFormat

getFractionFactor

int getFractionFactor()
                      throws IOException,
                             AutomationException
The maximum number of digits for the numerator or denominator, or the denominator of the formatted fraction.

Description

The FractionFactor property sets or returns a value (default: 1) that specifies the maximum number of digits for the numerator or denominator, or is used as the denominator of the formatted fraction.

The way the FractionFactor property is used depends on how the FractionOption property is set.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The factor
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
ILatLonFormat2, CustomNumberFormat, IRateFormat, IAngleFormat, NumericFormat, LatLonFormat, CurrencyFormat, INumericFormat, IFractionFormat, RateFormat, IScientificNumberFormat, ICustomNumberFormat, ILatLonFormat, IPercentageFormat, INumberFormat, ScientificFormat, FractionFormat, PercentageFormat, AngleFormat