|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.nrao.sss.measure.FluxDensity
public class FluxDensity
A measure of flux density.
Version Info:
$Revision: 1816 $ |
$Date: 2008-12-23 10:21:00 -0700 (Tue, 23 Dec 2008) $ |
$Author: dharland $ |
Constructor Summary | |
---|---|
FluxDensity()
Creates a new flux density of zero janskies. |
|
FluxDensity(BigDecimal janskies)
Creates a new flux density of janskies janskies. |
|
FluxDensity(BigDecimal value,
FluxDensityUnits units)
Creates a new flux density with the given magnitude and units. |
|
FluxDensity(String janskies)
Creates a new flux density of janskies janskies. |
|
FluxDensity(String value,
FluxDensityUnits units)
Creates a new flux density with the given magnitude and units. |
Method Summary | |
---|---|
FluxDensity |
add(FluxDensity other)
Adds other flux density to this one. |
FluxDensity |
clone()
Returns a flux density that is equal to this one. |
int |
compareTo(FluxDensity otherFlux)
Compares this flux density with the otherFlux for order. |
FluxDensity |
convertTo(FluxDensityUnits newUnits)
Converts this measure of flux density to the new units. |
boolean |
equals(Object o)
Returns true if o is equal to this flux density. |
FluxDensityUnits |
getUnits()
Returns the units of this flux density. |
BigDecimal |
getValue()
Returns the magnitude of this flux density. |
int |
hashCode()
Returns a hash code value for this flux density. |
boolean |
isInDefaultState()
Returns true if this flux density is in its default state, no matter how it got there. |
boolean |
isInfinite()
Returns true if this flux density is infinite. |
FluxDensity |
normalize()
Converts the value and units of this flux density so that the value is between one and one thousand. |
static FluxDensity |
parse(String fluxString)
Returns a new flux density based on fluxString . |
void |
reset()
Resets this flux density so that it is equal to a flux density created via the no-argument constructor. |
void |
set(BigDecimal value,
FluxDensityUnits units)
Sets the magnitude and units of this flux density. |
void |
set(String fluxString)
Sets the value and units of this flux density based on fluxString . |
void |
set(String value,
FluxDensityUnits units)
Sets the magnitude and units of this flux density. |
void |
setUnits(FluxDensityUnits newUnits)
Sets the units of this flux density to newUnits . |
void |
setValue(BigDecimal newValue)
Sets the magnitude of this flux density to newValue . |
void |
setValue(String newValue)
Sets the magnitude of this flux density to newValue . |
FluxDensity |
subtract(FluxDensity other)
Subtracts other flux density from this one. |
String |
toString()
Returns a text representation of this flux density. |
String |
toString(int minFracDigits,
int maxFracDigits)
Returns a text representation of this flux density. |
BigDecimal |
toUnits(FluxDensityUnits otherUnits)
Returns the magnitude of this flux density in otherUnits . |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FluxDensity()
public FluxDensity(BigDecimal janskies)
janskies
janskies.
See setValue(BigDecimal)
for information
about valid parameter values and exceptions that might
be thrown.
janskies
- the magnitude of this flux density in janskies.public FluxDensity(String janskies)
janskies
janskies.
See setValue(BigDecimal)
for information
about valid parameter values and exceptions that might
be thrown.
janskies
- the magnitude of this flux density in janskies.public FluxDensity(BigDecimal value, FluxDensityUnits units)
set(BigDecimal, FluxDensityUnits)
for information
about valid parameter values and exceptions that might
be thrown.
value
- the magnitude of this flux density.units
- the units in which value
is expressed.public FluxDensity(String value, FluxDensityUnits units)
set(BigDecimal, FluxDensityUnits)
for information
about valid parameter values and exceptions that might
be thrown.
value
- the magnitude of this flux density.units
- the units in which value
is expressed.Method Detail |
---|
public void reset()
public BigDecimal getValue()
public FluxDensityUnits getUnits()
public final void set(BigDecimal value, FluxDensityUnits units)
See setValue(BigDecimal)
for more information on legal
values for value.
value
- the new magnitude of this flux density.units
- the units in which value
is expressed.public final void set(String value, FluxDensityUnits units)
See setValue(String)
for more information on legal
values for value.
value
- the new magnitude of this flux density.units
- the units in which value
is expressed.public final void setValue(BigDecimal newValue)
newValue
.
Note that the units of this flux density are unaffected by this method.
newValue
- the new magnitude for this flux density.
This value may not be negative or null but may be infinite.
NumberFormatException
- if newValue
is null or negative.public final void setValue(String newValue)
newValue
.
Note that the units of this flux density are unaffected by this method.
newValue
- the new magnitude for this flux density.
This value may not be negative or null but may be infinite.
The allowable representations of infinity are
"infinity", "+infinity", and "-infinity";
these values are not case sensitive.
NumberFormatException
- if newValue
is null or negative.public final void setUnits(FluxDensityUnits newUnits)
newUnits
.
Note that the value of this distance is unaffected by
this method. Contrast this with convertTo(FluxDensityUnits)
.
newUnits
- the new units for this flux density.
If newUnits
is null an
IllegalArgumentException
will be thrown.public void set(String fluxString)
fluxString
.
See parse(String)
for the expected format of fluxString
.
If the parsing fails, this flux density will be kept in its current state.
fluxString
- a string that will be converted into a flux density.
IllegalArgumentException
- if fluxString
is not in the expected form.public boolean isInDefaultState()
A flux density is in its default state if both its value and
its units are the same as those of a flux density newly created via
the no-argument constructor
.
A flux density whose most recent update came via the
reset
method is also in its default state.
public boolean isInfinite()
public FluxDensity convertTo(FluxDensityUnits newUnits)
After this method is complete this flux density will have units of
units
and its value will have been converted
accordingly.
newUnits
- the new units for this flux density.
If newUnits
is null an
IllegalArgumentException
will be thrown.
double janskies =
myFluxDensity.convertTo(FluxDensityUnits.JANSKY).getValue();
public BigDecimal toUnits(FluxDensityUnits otherUnits)
otherUnits
.
Note that this method does not alter the state of this flux density.
Contrast this with convertTo(FluxDensityUnits)
.
otherUnits
- the units in which to express this flux density's
magnitude.
otherUnits
.public FluxDensity normalize()
public FluxDensity add(FluxDensity other)
other
flux density to this one.
other
- the flux density to be added to this flux density.
public FluxDensity subtract(FluxDensity other)
other
flux density from this one.
other
- the flux density to be subtracted from this flux density.
public static FluxDensity parse(String fluxString)
fluxString
.
Valid Formats
Let R be the text representation of a real number.
Let w represent zero or more whitespace characters.
Let S be a valid units
symbol.
Format One: wRw. The given number will be defined to be
in units of janskies
.
Format Two: wRwSw.
Special Cases
A fluxString
of null or "" (the empty
string) will not result in an IllegalArgumentException
,
but will instead return a flux density of zero janskies.
fluxString
- text that will be converted into a flux density.
IllegalArgumentException
- if fluxString
is not in
the expected form.public String toString()
toString
in class Object
public String toString(int minFracDigits, int maxFracDigits)
minFracDigits
- the minimum number of places after the decimal point.maxFracDigits
- the maximum number of places after the decimal point.
public FluxDensity clone()
clone
in class Object
public boolean equals(Object o)
o
is equal to this flux density.
equals
in class Object
public int hashCode()
hashCode
in class Object
public int compareTo(FluxDensity otherFlux)
otherFlux
for order.
compareTo
in interface Comparable<FluxDensity>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |