|
Jeospace API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.text.Format
org.jeospace.text.AngleFormat
Formats Angle objects into readable strings
and parses strings into Angle objects.
Affix,
Angle,
AngleNorm,
AngleSign,
AngleUnit,
Mult,
AngleFormatStyle,
AngleFormatSymbols,
Locale,
Serialized Form| Nested Class Summary | |
static class |
AngleFormat.Field
Defines constants that are used as attribute keys in the AttributedCharacterIterator returned
from AngleFormat.formatToCharacterIterator and as
field identifiers in FieldPosition. |
| Field Summary | |
protected DecimalAngleUnit |
dau
|
protected Affix |
directionAffix
Identifier of the position of the sign symbol as prefix or suffix. |
protected FieldAttributor |
fieldAttributor
The field attributor maps field positions within formatted strings and produces an attributed character iterator |
protected Angle |
fmtAngle
Scratch Angle object for format methods |
protected boolean |
isDecimal
|
protected boolean |
isSexagesimal
Identifier of the units that the Angle representation
should be formatted in. |
protected int |
maxDecimalPlaces
The maximum number of decimal places that will be calculated for the decimal portion of the Angle. |
protected Mult |
maxMult
The Mult object corresponding to the maximum number of
decimal places that will be calculated for the decimal portion
of the Angle. |
protected int |
minDecimalPlaces
The minimum number of decimal places that will be calculated for the decimal portion of the Angle. |
protected Mult |
minMult
The Mult object corresponding to the minimum number of
decimal places that will be calculated for the decimal portion
of the Angle. |
protected AngleNorm |
norm
Identifier of the normalization type to be performed upon the Angle before formatting. |
protected SexagesimalAngleUnit |
sau
|
protected AngleSignPair |
signPair
The direction affix preference identifier |
protected AngleFormatSymbols |
symbols
The symbols used in formatting. |
protected boolean |
truncateZeroDecimals
Flag indicating that any trailing decimal zeros should be truncated during format. |
protected boolean |
truncateZeroFields
Flag indicating that any leading zero value fields should be truncated during format. |
protected boolean |
usePositiveDirectionSymbol
Flag indicating that if the AngleSign is positive the positive symbol should be used. |
protected AngleSign |
zeroSign
The sign to use if the angle has a value of zero. |
| Constructor Summary | |
AngleFormat(Affix directionAffix,
AngleSignPair signPair,
AngleNorm norm,
AngleUnit units,
Mult mult)
Construct an AngleFormat object. |
|
AngleFormat(Affix directionAffix,
AngleSignPair signPair,
AngleNorm norm,
AngleUnit units,
Mult mult,
java.util.Locale locale)
Construct an AngleFormat object. |
|
| Method Summary | |
java.lang.Object |
clone()
Return a copy of this AngleFormat object. |
boolean |
equals(java.lang.Object obj)
Compare two AngleFormats for equality. |
java.lang.String |
format(Angle angle)
Format an Angle object into a human readable String. |
java.lang.StringBuffer |
format(Angle angle,
java.lang.StringBuffer result,
java.text.FieldPosition pos)
Format an Angle object into a human readable string. |
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer result,
java.text.FieldPosition pos)
Overrides Format. |
java.text.AttributedCharacterIterator |
formatToCharacterIterator(java.lang.Object obj)
Return the AttributedCharacterIterator describing the formatted value. |
AngleUnit |
getAngleUnits()
Return the AngleUnit used in formatting. |
Affix |
getDirectionAffix()
Return the directional affix setting. |
FieldAttributor |
getFieldAttributor()
Return the FieldAttributor |
static AngleFormat |
getInstance(AngleFormatStyle style)
Return an AngleFormat object configured to the requested style and the default locale |
static AngleFormat |
getInstance(AngleFormatStyle style,
java.util.Locale locale)
Return an AngleFormat object configured to the requested style and locale |
Mult |
getMaximumDecimalSize()
Return the Mult object that cooresponds to
the desired maximum number of decimal digits. |
Mult |
getMinimumDecimalSize()
Return the Mult object that cooresponds to
the desired minimum number of decimal digits. |
AngleNorm |
getNormalizationOption()
Get the normalization option used in formatting. |
AngleSignPair |
getSignPair()
Get the angle sign convention used in formatting. |
AngleFormatSymbols |
getSymbols()
Get the symbols object used in formatting. |
boolean |
getTruncateZeroDecimals()
Get the Truncate Zero Decimals option setting. |
boolean |
getTruncateZeroFields()
Get the Truncate Zero Fields option setting. |
AngleSign |
getZeroAngleSign()
Return the AngleSign value being used if the value of the
angle is zero. |
int |
hashCode()
Return the hash code for the AngleFormat object |
Angle |
parse(java.lang.String source)
Not implemented. |
java.lang.Object |
parseObject(java.lang.String source,
java.text.ParsePosition pos)
Not implemented. |
protected java.lang.String |
processAffix(AngleSign sign,
boolean isZero)
Return the directional affix that matches the style and angle value |
void |
setAngleUnits(AngleUnit units)
Set the angle units to be used in formatting. |
void |
setDirectionAffix(Affix directionAffix)
Set the directional affix setting. |
void |
setMaximumDecimalSize(Mult mult)
Set the maximum number of decimal fractional digits allowed. |
void |
setMinimumDecimalSize(Mult mult)
Set the minimum number of decimal fractional digits allowed. |
void |
setNormalizationOption(AngleNorm norm)
Set the normalization option to be used in formatting. |
void |
setSignPair(AngleSignPair signPair)
Set the angle sign convention to be used in formatting. |
void |
setSymbols(AngleFormatSymbols symbols)
Set the symbols object to be used in formatting. |
void |
setTruncateZeroDecimals(boolean inValue)
Set the option to eliminate trailing zero decimals. |
void |
setTruncateZeroFields(boolean inValue)
Set the option to eliminate leading fields that have zero value. |
void |
setUsePositiveDirectionSymbol(boolean usePositive)
Set the flag indicating that if the sign of the angle is positive the positive symbol should be used in formatting. |
void |
setZeroAngleSign(AngleSign zeroSign)
Set the AngleSign value to be used if the value of the
angle is zero. |
| Methods inherited from class java.text.Format |
format, parseObject |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected boolean truncateZeroFields
protected boolean truncateZeroDecimals
protected Affix directionAffix
protected AngleNorm norm
Angle before formatting.
protected boolean isSexagesimal
Angle representation
should be formatted in. For SexagesimalAngleUnits, this
parameter specifies SexagesimalAngleType as well as the
the least significant unit of the sexagesimal type that will be
calculated for the Angle.
protected SexagesimalAngleUnit sau
protected boolean isDecimal
protected DecimalAngleUnit dau
protected AngleFormatSymbols symbols
protected Mult maxMult
Mult object corresponding to the maximum number of
decimal places that will be calculated for the decimal portion
of the Angle.
protected int maxDecimalPlaces
Angle.
protected Mult minMult
Mult object corresponding to the minimum number of
decimal places that will be calculated for the decimal portion
of the Angle.
protected int minDecimalPlaces
Angle.
protected AngleSign zeroSign
protected AngleSignPair signPair
protected boolean usePositiveDirectionSymbol
protected FieldAttributor fieldAttributor
protected Angle fmtAngle
| Constructor Detail |
public AngleFormat(Affix directionAffix,
AngleSignPair signPair,
AngleNorm norm,
AngleUnit units,
Mult mult)
AngleFormat object.
directionAffix - the directional affix setting.signPair - the sign symbol convention identifiernorm - the normalization option.units - the least significant units to use in formatting.mult - the multiplier object that cooresponds to the desired
maximum number of decimal digits.
public AngleFormat(Affix directionAffix,
AngleSignPair signPair,
AngleNorm norm,
AngleUnit units,
Mult mult,
java.util.Locale locale)
AngleFormat object.
directionAffix - the directional affix setting.signPair - the sign symbol convention identifiernorm - the normalization option.units - the least significant units to use in formatting.mult - the multiplier object that cooresponds to the desired
maximum number of decimal digits.locale - the locale for determining the symbols and separators used| Method Detail |
public static AngleFormat getInstance(AngleFormatStyle style)
style - the AngleFormatStyle object
AngleFormat object
public static AngleFormat getInstance(AngleFormatStyle style,
java.util.Locale locale)
style - the AngleFormatStyle objectlocale - the locale
AngleFormat objectpublic void setSignPair(AngleSignPair signPair)
signPair - the AngleSignPair to use in formatting.public AngleSignPair getSignPair()
AngleSignPair used in formatting.public void setUsePositiveDirectionSymbol(boolean usePositive)
usePositive - the flagpublic void setSymbols(AngleFormatSymbols symbols)
symbols - the AngleFormatSymbols to use in formatting.public AngleFormatSymbols getSymbols()
AngleFormatSymbols used in formatting.public void setNormalizationOption(AngleNorm norm)
null is interpreted as AngleNorm.NONE.
norm - the AngleNorm option to use in formatting.public AngleNorm getNormalizationOption()
public void setAngleUnits(AngleUnit units)
units - the AngleUnit to use in formatting.public AngleUnit getAngleUnits()
AngleUnit used in formatting.
AngleUnit used in formatting.public void setDirectionAffix(Affix directionAffix)
directionAffix - the directional affix setting.public Affix getDirectionAffix()
public void setZeroAngleSign(AngleSign zeroSign)
AngleSign value to be used if the value of the
angle is zero. A parameter of AngleSign.POSITIVE or
AngleSign.NEGATIVE will cause the positive or
negative directional affix (respectively) to be included in the
formatted string on the condition that the value of the angle is
zero. A parameter of null will cause the directional affix to be
excluded from the formatted string.
zeroSign - the default for the sign of the angle if the value
of the angle is zero.public AngleSign getZeroAngleSign()
AngleSign value being used if the value of the
angle is zero. A null value indicates the directional affix is
excluded from formatting on the condition that the value of the angle is
zero.
public void setMaximumDecimalSize(Mult mult)
mult - the Mult object that cooresponds to
the desired maximum number of decimal digits. The Mult object
must be either Mult.NONE or represent a decimal value
or an IllegalArgumentException is thrown. If the maximum
decimal size setting represents fewer decimal digits than the minimum
setting, then the maximum decimal size is silently set to be equal to
the minimum.public Mult getMaximumDecimalSize()
Mult object that cooresponds to
the desired maximum number of decimal digits.
Mult object that cooresponds to
the desired maximum number of decimal digits.public void setMinimumDecimalSize(Mult mult)
mult - the Mult object that cooresponds to
the desired minimum number of decimal digits. The Mult object
must be either Mult.NONE or represent a decimal value
or an IllegalArgumentException is thrown. If the maximum
decimal size setting represents fewer decimal digits than the minimum
setting, then the maximum decimal size is silently set to be equal to
the minimum.public Mult getMinimumDecimalSize()
Mult object that cooresponds to
the desired minimum number of decimal digits.
Mult object that cooresponds to
the desired minimum number of decimal digits.public void setTruncateZeroFields(boolean inValue)
Example: An angle value of 1 arc second will format into:
1" when settrue0°00'01" when setfalse
inValue - boolean true to eliminate leading zero fields,
false to preserve leading zero fields. The default setting
is false.public boolean getTruncateZeroFields()
public void setTruncateZeroDecimals(boolean inValue)
inValue - boolean true to eliminate trailing zero decimals,
false to preserve trailing zero decimals. The default setting
is false.public boolean getTruncateZeroDecimals()
public FieldAttributor getFieldAttributor()
FieldAttributor
FieldAttributor.
public final java.lang.StringBuffer format(java.lang.Object obj,
java.lang.StringBuffer result,
java.text.FieldPosition pos)
Angle object into a human readable string.
obj - the object to format. Must be an Angle.result - the string buffer in which to place the formatted string.pos - an optional parameter for locating a specified field within the
returned string buffer.
java.lang.ClassCastException - if obj is not an Angle.
java.lang.NullPointerException - if obj is null.
public final java.lang.StringBuffer format(Angle angle,
java.lang.StringBuffer result,
java.text.FieldPosition pos)
Angle object into a human readable string.
angle - the Angle object to format.result - the string buffer in which to place the formatted string.pos - an optional parameter for locating a specified field within the
returned string buffer.
java.lang.NullPointerException - if angle is null.public java.text.AttributedCharacterIterator formatToCharacterIterator(java.lang.Object obj)
AttributedCharacterIterator describing the formatted value.
The returned iterator will contain positioning attributes as enumerated in
AngleFormat.FIELD.
obj - the object to format. Must be an Angle.
AttributedCharacterIterator describing the formatted value.
java.lang.ClassCastException - if obj is not an Angle.
java.lang.NullPointerException - if obj is null.public java.lang.String format(Angle angle)
Angle object into a human readable String.
angle - the Angle object to format.
Angle object.
java.lang.NullPointerException - if angle is null.
protected java.lang.String processAffix(AngleSign sign,
boolean isZero)
sign - the sign of the angle valueisZero - the flag to indicate that the angle value is 0
public java.lang.Object parseObject(java.lang.String source,
java.text.ParsePosition pos)
Angle object.
source - the string to parse.pos - a ParsePosition object with index and error index information.
Angle object.
public Angle parse(java.lang.String source)
throws java.text.ParseException
Angle object.
source - the string to parse.
Angle object.
java.text.ParseExceptionpublic java.lang.Object clone()
AngleFormat object. Overrides Cloneable.
AngleFormat object.public int hashCode()
AngleFormat object
public boolean equals(java.lang.Object obj)
AngleFormats for equality. The result is true
if and only if the argument object is not null, is an AngleFormat object
and represents an AngleFormat of the same type and style with the same
formatting symbols.
Two AngleFormat objects are equal only when the format
method will produce identical results with equal Angle objects as
arguments.
|
Jeospace API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||