|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.esri.arcgis.system.FractionFormat
public class FractionFormat
An object for formatting numbers in a fraction format.
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.
ILatLonFormat2
,
CustomNumberFormat
,
IRateFormat
,
IAngleFormat
,
NumericFormat
,
LatLonFormat
,
CurrencyFormat
,
INumericFormat
,
IFractionFormat
,
RateFormat
,
IScientificNumberFormat
,
ICustomNumberFormat
,
ILatLonFormat
,
IPercentageFormat
,
INumberFormat
,
ScientificFormat
,
FractionFormat
,
PercentageFormat
,
AngleFormat
,
Serialized FormConstructor 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)
Indicates if the receiver and other have the same properties. |
boolean |
isIdentical(IClone other)
Indicates if 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 |
---|
public FractionFormat() throws IOException, UnknownHostException
IOException
- if there are interop problems
UnknownHostException
- if there are interop problemspublic FractionFormat(Object obj) throws IOException
FractionFormat theFractionFormat = (FractionFormat) obj;
obj
to FractionFormat
.
obj
- an object returned from ArcGIS Engine or Server
IOException
- if there are interop problemsMethod Detail |
---|
public static String getClsid()
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String valueToString(double value) throws IOException, AutomationException
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.
valueToString
in interface INumberFormat
value
- The value (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ILatLonFormat2
,
CustomNumberFormat
,
IRateFormat
,
IAngleFormat
,
NumericFormat
,
LatLonFormat
,
CurrencyFormat
,
INumericFormat
,
IFractionFormat
,
RateFormat
,
IScientificNumberFormat
,
ICustomNumberFormat
,
ILatLonFormat
,
IPercentageFormat
,
INumberFormat
,
ScientificFormat
,
FractionFormat
,
PercentageFormat
,
AngleFormat
public double stringToValue(String str) throws IOException, AutomationException
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.
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).
stringToValue
in interface INumberFormat
str
- The str (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ILatLonFormat2
,
CustomNumberFormat
,
IRateFormat
,
IAngleFormat
,
NumericFormat
,
LatLonFormat
,
CurrencyFormat
,
INumericFormat
,
IFractionFormat
,
RateFormat
,
IScientificNumberFormat
,
ICustomNumberFormat
,
ILatLonFormat
,
IPercentageFormat
,
INumberFormat
,
ScientificFormat
,
FractionFormat
,
PercentageFormat
,
AngleFormat
public double increment(double value) throws IOException, AutomationException
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.
increment
in interface INumberFormatOperations
value
- The value (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setFractionOption(int option) throws IOException, AutomationException
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. |
setFractionOption
in interface IFractionFormat
option
- A com.esri.arcgis.system.esriFractionOptionEnum constant (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ILatLonFormat2
,
CustomNumberFormat
,
IRateFormat
,
IAngleFormat
,
NumericFormat
,
LatLonFormat
,
CurrencyFormat
,
INumericFormat
,
IFractionFormat
,
RateFormat
,
IScientificNumberFormat
,
ICustomNumberFormat
,
ILatLonFormat
,
IPercentageFormat
,
INumberFormat
,
ScientificFormat
,
FractionFormat
,
PercentageFormat
,
AngleFormat
public int getFractionOption() throws IOException, AutomationException
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. |
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.
getFractionOption
in interface IFractionFormat
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ILatLonFormat2
,
CustomNumberFormat
,
IRateFormat
,
IAngleFormat
,
NumericFormat
,
LatLonFormat
,
CurrencyFormat
,
INumericFormat
,
IFractionFormat
,
RateFormat
,
IScientificNumberFormat
,
ICustomNumberFormat
,
ILatLonFormat
,
IPercentageFormat
,
INumberFormat
,
ScientificFormat
,
FractionFormat
,
PercentageFormat
,
AngleFormat
public void setFractionFactor(int factor) throws IOException, AutomationException
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.
setFractionFactor
in interface IFractionFormat
factor
- The factor (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ILatLonFormat2
,
CustomNumberFormat
,
IRateFormat
,
IAngleFormat
,
NumericFormat
,
LatLonFormat
,
CurrencyFormat
,
INumericFormat
,
IFractionFormat
,
RateFormat
,
IScientificNumberFormat
,
ICustomNumberFormat
,
ILatLonFormat
,
IPercentageFormat
,
INumberFormat
,
ScientificFormat
,
FractionFormat
,
PercentageFormat
,
AngleFormat
public int getFractionFactor() throws IOException, AutomationException
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.
getFractionFactor
in interface IFractionFormat
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ILatLonFormat2
,
CustomNumberFormat
,
IRateFormat
,
IAngleFormat
,
NumericFormat
,
LatLonFormat
,
CurrencyFormat
,
INumericFormat
,
IFractionFormat
,
RateFormat
,
IScientificNumberFormat
,
ICustomNumberFormat
,
ILatLonFormat
,
IPercentageFormat
,
INumberFormat
,
ScientificFormat
,
FractionFormat
,
PercentageFormat
,
AngleFormat
public IClone esri_clone() throws IOException, AutomationException
esri_clone
in interface IClone
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void assign(IClone src) throws IOException, AutomationException
assign
in interface IClone
src
- A reference to a com.esri.arcgis.system.IClone (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isEqual(IClone other) throws IOException, AutomationException
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.
isEqual
in interface IClone
other
- A reference to a com.esri.arcgis.system.IClone (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isIdentical(IClone other) throws IOException, AutomationException
IsIdentical returns true if the receiver and the source reference the same object.
isIdentical
in interface IClone
other
- A reference to a com.esri.arcgis.system.IClone (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void getClassID(GUID[] pClassID) throws IOException, AutomationException
IPersist is a Microsoft interface. Please refer to MSDN for information about this interface.
getClassID
in interface IPersist
pClassID
- A Structure: com.esri.arcgis.support.ms.stdole.GUID (out: use single element array)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void isDirty() throws IOException, AutomationException
IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.
isDirty
in interface IPersistStream
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void load(IStream pstm) throws IOException, AutomationException
IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.
load
in interface IPersistStream
pstm
- A reference to a com.esri.arcgis.system.IStream (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void save(IStream pstm, int fClearDirty) throws IOException, AutomationException
IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.
save
in interface IPersistStream
pstm
- A reference to a com.esri.arcgis.system.IStream (in)fClearDirty
- The fClearDirty (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void getSizeMax(_ULARGE_INTEGER[] pcbSize) throws IOException, AutomationException
IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.
getSizeMax
in interface IPersistStream
pcbSize
- A Structure: com.esri.arcgis.system._ULARGE_INTEGER (out: use single element array)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |