Public Member Functions | Public Attributes | List of all members
FormatNumber Class Reference

Inherits ScriptObject.

Public Member Functions

 FormatNumber ()
 
Integer getDecimalSymbol ()
 
 setDecimalSymbol (Integer decimalSymbol)
 
Boolean getZeroPad ()
 
 setZeroPad (Boolean zeroPad)
 
Boolean getForceSign ()
 
 setForceSign (Boolean forceSign)
 
Boolean getForceDecimal ()
 
 setForceDecimal (Boolean forceDecimal)
 
Integer getWidth ()
 
 setWidth (Integer width)
 
Integer getNumberOfDecimals ()
 
 setNumberOfDecimals (Integer numberOfDecimals)
 
Boolean getTrimZeroDecimals ()
 
 setTrimZeroDecimals (Boolean trimZeroDecimals)
 
Boolean getTrimLeadZero ()
 
 setTrimLeadZero (Boolean trimLeadZero)
 
Number remap (Number value)
 
Number unmap (Number value)
 
Number getCyclicLimit ()
 
Integer getCyclicSign ()
 
 setCyclicMapping (Number limit, Integer sign)
 
Number getScale ()
 
 setScale (Number scale)
 
Number getOffset ()
 
 setOffset (Number offset)
 
String getPrefix ()
 
 setPrefix (String prefix)
 
String getSuffix ()
 
 setSuffix (String suffix)
 
Number getBase ()
 
 setBase (Number base)
 
Number getMinimum ()
 
 setMinimum (Number value)
 
Number getMaximum ()
 
 setMaximum (Number value)
 
Integer getMinDigitsLeft ()
 
 setMinDigitsLeft (Integer value)
 
Integer getMinDigitsRight ()
 
 setMinDigitsRight (Integer value)
 
Integer getType ()
 
 setType (Integer type)
 
String format (Number value)
 
Boolean isSignificant (Number value)
 
Boolean areDifferent (Number a, Number b)
 
Number getMinimumValue ()
 
Number getResultingValue (Number value)
 
Number getError (Number value)
 

Public Attributes

Integer decimals
 The number of decimals.
 
Boolean trimZeroDecimals
 The trailing zero decimals should be skipped. Deprecated since r45877.
 
Boolean trimLeadZero
 The leading zero should be excluded. Eg. ".123" instead of "0.123". Deprecated since r45877.
 
Boolean zeroPad
 The returned string should be padded with zeros to fit the width. Deprecated since r45877.
 
Integer width
 The minimum width of the formattedd number. Deprecated since r45877.
 
Integer minDigitsLeft
 The minumum digits to the left of decimal point to output. Since r45877.
 
Integer minDigitsRight
 The minumum digits to the right of decimal point to output. Since r45877.
 
Integer type
 The format type: FORMAT_REAL, FORMAT_INTEGER, FORMAT_LZS, FORMAT_TZS. Since r45877.
 
Integer decimalSymbol
 The decimal symbol.
 
Boolean forceSign
 Forces the '+' sign on positive numbers.
 
Boolean forceDecimal
 Forces the decimal separator in the formatted number. Deprecated since r45877.
 
Number cyclicLimit
 The cyclic limit. Deprecated since r45877.
 
Integer cyclicSign
 The cyclic sign. Only valid if cyclicLimit > 0. Deprecated since r45877.
 
Number scale
 The scaling factor for the output number.
 
Number offset
 The offset for the output number.
 
Number base
 The minimum increment to output. Since r45877.
 
Number minimum
 The unsigned minimum value. Since r45877.
 
Number maximum
 The unsigned maximum value. Since r45877.
 
String prefix
 The prefix.
 
String suffix
 The suffix.
 

Detailed Description

This class converts numbers into strings in accordance with several modifiers.

When value remapping is enabled the cyclic mapping is done first, then the scaling, and finally the offset.

Constructor & Destructor Documentation

◆ FormatNumber()

Constructs a number formatting object.

Member Function Documentation

◆ areDifferent()

Boolean areDifferent ( Number  a,
Number  b 
)

Returns true if the specified values are different when formatted.

◆ format()

String format ( Number  value)

Returns the string for the specified value.

◆ getBase()

Number getBase ( )

Returns the base number.

Since
r45877.

◆ getCyclicLimit()

Number getCyclicLimit ( )

Returns the cyclic limit. Deprecated since r45877.

◆ getCyclicSign()

Integer getCyclicSign ( )

Returns the cyclic sign. Deprecated since r45877.

◆ getDecimalSymbol()

Integer getDecimalSymbol ( )

Returns the decimal separator.

◆ getError()

Number getError ( Number  value)

Returns the error for the specified value.

◆ getForceDecimal()

Boolean getForceDecimal ( )

Returns the force decimal flag. Deprecated since r45877.

◆ getForceSign()

Boolean getForceSign ( )

Returns the force sign flag.

◆ getMaximum()

Number getMaximum ( )

Returns the maximum allowed value.

Since
r45877.

◆ getMinDigitsLeft()

Integer getMinDigitsLeft ( )

Returns the minimum number of digits to the left of the decimal point.

Since
r45877.

◆ getMinDigitsRight()

Integer getMinDigitsRight ( )

Returns the minimum number of digits to the right of the decimal point.

Since
r45877.

◆ getMinimum()

Number getMinimum ( )

Returns the minimum allowed value.

Since
r45877.

◆ getMinimumValue()

Number getMinimumValue ( )

Returns the minimum epsilon value.

Returns
1 for no decimals, 0.1 for 1 decimal and so forth.

◆ getNumberOfDecimals()

Integer getNumberOfDecimals ( )

Returns the number of decimals.

◆ getOffset()

Number getOffset ( )

Returns the offset.

◆ getPrefix()

String getPrefix ( )

Returns the prefix.

◆ getResultingValue()

Number getResultingValue ( Number  value)

Returns the resulting value for the specified value.

◆ getScale()

Number getScale ( )

Returns the scale.

◆ getSuffix()

String getSuffix ( )

Returns the suffix.

◆ getTrimLeadZero()

Boolean getTrimLeadZero ( )

Returns true if the leading zero should be skipped. Deprecated since r45877.

◆ getTrimZeroDecimals()

Boolean getTrimZeroDecimals ( )

Returns true if the suffix zero decimals should be skipped. Deprecated since r45877.

◆ getType()

Integer getType ( )

Returns the type of formatted value.

Since
r45877.

◆ getWidth()

Integer getWidth ( )

Returns the width. Deprecated since r45877.

◆ getZeroPad()

Boolean getZeroPad ( )

Returns the zero padding mode. Deprecated since r45877.

◆ isSignificant()

Boolean isSignificant ( Number  value)

Returns true if the specified value would be non-zero when formatted. When comparing 2 values use areDifferent() instead.

◆ remap()

Number remap ( Number  value)

Returns the value after cyclic mapping, scaling, and offset.

◆ setBase()

setBase ( Number  base)

Sets the base number.

Since
r45877.

◆ setCyclicMapping()

setCyclicMapping ( Number  limit,
Integer  sign 
)

Sets the cyclic mapping.

Parameters
limitSpecifies the cyclic limit. Must be positive or 0. Cyclic mapping will be disabled when set to 0.
signSpecifies the sign. Must in -1, 0, or 1.

For sign -1 the values will be mapped to the range [-cyclicLimit; 0] For sign 0 the values will be mapped to the range [-cyclicLimit; cyclicLimit] For sign 1 the values will be mapped to the range [0; cyclicLimit]

The cyclic mapping is done before scaling and offset. Deprecated since r45877.

◆ setDecimalSymbol()

setDecimalSymbol ( Integer  decimalSymbol)

Sets the decimal separator.

◆ setForceDecimal()

setForceDecimal ( Boolean  forceDecimal)

Sets the force decimal flag. Deprecated since r45877.

◆ setForceSign()

setForceSign ( Boolean  forceSign)

Sets the force sign flag.

◆ setMaximum()

setMaximum ( Number  value)

Sets the maximum allowed value.

Since
r45877.

◆ setMinDigitsLeft()

setMinDigitsLeft ( Integer  value)

Sets the minimum number of digits to the left of the decimal point.

Since
r45877.

◆ setMinDigitsRight()

setMinDigitsRight ( Integer  value)

Sets the minimum number of digits to the right of the decimal point.

Since
r45877.

◆ setMinimum()

setMinimum ( Number  value)

Sets the minimum allowed value.

Since
r45877.

◆ setNumberOfDecimals()

setNumberOfDecimals ( Integer  numberOfDecimals)

Sets the number of decimals.

◆ setOffset()

setOffset ( Number  offset)

Sets the offset.

◆ setPrefix()

setPrefix ( String  prefix)

Sets the prefix.

◆ setScale()

setScale ( Number  scale)

Sets the scale.

◆ setSuffix()

setSuffix ( String  suffix)

Sets the suffix.

◆ setTrimLeadZero()

setTrimLeadZero ( Boolean  trimLeadZero)

Sets the skip leading zero flag. Deprecated since r45877.

◆ setTrimZeroDecimals()

setTrimZeroDecimals ( Boolean  trimZeroDecimals)

Sets the skip zero decimals flag. Deprecated since r45877.

◆ setType()

setType ( Integer  type)

Sets the type of formatted value. Can be FORMAT_INTEGER, FORMAT_REAL, FORMAT_LZS, FORMAT_TZS.

Since
r45877.

◆ setWidth()

setWidth ( Integer  width)

Sets the width. Deprecated since r45877.

◆ setZeroPad()

setZeroPad ( Boolean  zeroPad)

Sets zero padding mode. Deprecated since r45877.

◆ unmap()

Number unmap ( Number  value)

Returns the value after removing the any scaling and offset factors.



Generated by Autodesk, Inc. 19 April 2024
Copyright (c) 2012-2024 by Autodesk, Inc.