com.esri.arcgis.system
Class FractionFormat

java.lang.Object
  extended by com.esri.arcgis.system.FractionFormat
All Implemented Interfaces:
com.esri.arcgis.interop.RemoteObjRef, IClone, IFractionFormat, INumberFormat, INumberFormatOperations, IPersist, IPersistStream, Externalizable, Serializable

public class FractionFormat
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, INumberFormat, INumberFormatOperations, IFractionFormat, IClone, IPersist, IPersistStream, Externalizable

An object for formatting numbers in a fraction format.

Description

FractionFormat is an IFractionFormat interface coclass who's members determine how the ValueToString method in the associated INumberFormat interface formats numbers.

The FractionFormat object converts from decimal values to fractions (using ValueToString) and vice versa (using StringToValue).

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.

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, Serialized Form

Constructor Summary
FractionFormat()
          Constructs a FractionFormat using ArcGIS Engine.
FractionFormat(Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
FractionFormat theFractionFormat = (FractionFormat) obj;
 
Method Summary
 void assign(IClone src)
          Assigns the properties of src to the receiver.
 boolean equals(Object o)
          Compare this object with another
 IClone esri_clone()
          Clones the receiver and assigns the result to *clone.
 void getClassID(GUID[] pClassID)
          getClassID
static String getClsid()
          getClsid.
 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 getSizeMax(_ULARGE_INTEGER[] pcbSize)
          getSizeMax
 int hashCode()
          the hashcode for this object
 double increment(double value)
          Increments a value according to the numbers format.
 void isDirty()
          isDirty
 boolean isEqual(IClone other)
          Returns TRUE when the receiver and other have the same properties.
 boolean isIdentical(IClone other)
          Returns TRUE when the receiver and other are the same object.
 void load(IStream pstm)
          load
 void readExternal(ObjectInput in)
           
 void save(IStream pstm, int fClearDirty)
          save
 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.
 double stringToValue(String str)
          Converts a formatted string to a numeric value.
 String valueToString(double value)
          Converts a numeric value to a formatted string.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef
getJintegraDispatch, release
 

Constructor Detail

FractionFormat

public FractionFormat()
               throws IOException,
                      UnknownHostException
Constructs a FractionFormat using ArcGIS Engine.

Throws:
IOException - if there are interop problems
UnknownHostException - if there are interop problems

FractionFormat

public FractionFormat(Object obj)
               throws IOException
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
FractionFormat theFractionFormat = (FractionFormat) obj;

Construct a FractionFormat using a reference to such an object returned from ArcGIS Engine or Server. This is semantically equivalent to casting obj to FractionFormat.

Parameters:
obj - an object returned from ArcGIS Engine or Server
Throws:
IOException - if there are interop problems
Method Detail

getClsid

public static String getClsid()
getClsid.


equals

public boolean equals(Object o)
Compare this object with another

Overrides:
equals in class Object

hashCode

public int hashCode()
the hashcode for this object

Overrides:
hashCode in class Object

valueToString

public String valueToString(double value)
                     throws IOException,
                            AutomationException
Converts a numeric value to a formatted string.

Description

The ValueToString method expresses a numeric value as a formatted string. The string is formatted based on the property settings of the number formatting interface that is used. See the particular number formatting interface you're interested in under See Also above for more information.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
valueToString in interface INumberFormat
Parameters:
value - The value (in)
Returns:
The str
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

stringToValue

public double stringToValue(String str)
                     throws IOException,
                            AutomationException
Converts a formatted string to a numeric value.

Description

The StringToValue method obtains a numerical value from a formatted string. The string doesn't necessarily need to have been formatted with the ValueToString method, but the string needs to look like it would be if it was formatted with the associated interface's implementation of the ValueToString method. See the particular number formatting interface you're interested in under See Also above for more information.

Remarks

When using the StringToValue method to obtain a ValueToString argument value, the properties in the associated interface must be set the same as they were when the ValueToString method was used. This applies in cases where ValueToString may perform a numerical conversion (in the IAngleFormat, IFractionFormat, IPercentageFormat, and IRateFormat interfaces).

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
stringToValue in interface INumberFormat
Parameters:
str - The str (in)
Returns:
The value
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

increment

public double increment(double value)
                 throws IOException,
                        AutomationException
Increments a value according to the numbers format.

Remarks

The Increment method reacts differently depending on the number format object used and how that object is configured. A NumericFormat configured for a specific number of decimal places will increment to the last decimal place. For example, if two decimal places are specified, 22.533 would increment to 22.54; if the object is configured for two significant digits, 22.533 would increment to 24. For an AngleFormat, the input value is converted to the display format first then the same rules apply as for a NumericFormat.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
increment in interface INumberFormatOperations
Parameters:
value - The value (in)
Returns:
The result
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setFractionOption

public 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

Specified by:
setFractionOption in interface IFractionFormat
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

public 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

Specified by:
getFractionOption in interface IFractionFormat
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

public 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

Specified by:
setFractionFactor in interface IFractionFormat
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

public 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

Specified by:
getFractionFactor in interface IFractionFormat
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

esri_clone

public IClone esri_clone()
                  throws IOException,
                         AutomationException
Clones the receiver and assigns the result to *clone.

Product Availability

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

Specified by:
esri_clone in interface IClone
Returns:
A reference to a com.esri.arcgis.system.IClone
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

assign

public void assign(IClone src)
            throws IOException,
                   AutomationException
Assigns the properties of src to the receiver.

Description

Use Assign method to assign the properties of source object to receiver object. Both objects need to have the same CLSIDs. Both source and receiver objects need to be instantiated.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
assign in interface IClone
Parameters:
src - A reference to a com.esri.arcgis.system.IClone (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isEqual

public boolean isEqual(IClone other)
                throws IOException,
                       AutomationException
Returns TRUE when the receiver and other have the same properties.

Description

IsEqual returns True if the receiver and the source have the same properties. Note, this does not imply that the receiver and the source reference the same object.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
isEqual in interface IClone
Parameters:
other - A reference to a com.esri.arcgis.system.IClone (in)
Returns:
The equal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isIdentical

public boolean isIdentical(IClone other)
                    throws IOException,
                           AutomationException
Returns TRUE when the receiver and other are the same object.

Description

IsIdentical returns true if the receiver and the source reference the same object.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
isIdentical in interface IClone
Parameters:
other - A reference to a com.esri.arcgis.system.IClone (in)
Returns:
The identical
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getClassID

public void getClassID(GUID[] pClassID)
                throws IOException,
                       AutomationException
getClassID

Description

IPersist is a Microsoft interface. Please refer to MSDN for information about this interface.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
getClassID in interface IPersist
Parameters:
pClassID - A Structure: com.esri.arcgis.support.ms.stdole.GUID (out: use single element array)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isDirty

public void isDirty()
             throws IOException,
                    AutomationException
isDirty

Description

IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
isDirty in interface IPersistStream
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

load

public void load(IStream pstm)
          throws IOException,
                 AutomationException
load

Description

IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
load in interface IPersistStream
Parameters:
pstm - A reference to a com.esri.arcgis.system.IStream (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

save

public void save(IStream pstm,
                 int fClearDirty)
          throws IOException,
                 AutomationException
save

Description

IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
save in interface IPersistStream
Parameters:
pstm - A reference to a com.esri.arcgis.system.IStream (in)
fClearDirty - The fClearDirty (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getSizeMax

public void getSizeMax(_ULARGE_INTEGER[] pcbSize)
                throws IOException,
                       AutomationException
getSizeMax

Description

IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
getSizeMax in interface IPersistStream
Parameters:
pcbSize - A Structure: com.esri.arcgis.system._ULARGE_INTEGER (out: use single element array)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException