Package bitchanger.calculations
Interface ChangeableNumber
-
- All Known Implementing Classes:
SimpleChangeableNumber
public interface ChangeableNumberInterface that defines methods to convert numbers from any numeral system into another numeral system- Since:
- Bitchanger 0.1.0
- Version:
- 1.0.0
- Author:
- Tim Muehle
-
-
Field Summary
Fields Modifier and Type Field Description static StringNaNstatic StringNEGATIVE_INFINITYstatic StringPOSITIVE_INFINITY
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default doubleasDouble()javafx.beans.property.IntegerPropertybaseProperty()javafx.beans.property.ReadOnlyStringPropertylogicStringProperty()voidreset()Resets the wrapped value.voidset(double decValue)voidsetBin(String binValue)Sets the value of thisChangeableNumberto the value of a binary stringvoidsetDec(String decValue)Sets the value of thisChangeableNumberto the value of a decimal stringvoidsetHex(String hexValue)Sets the value of thisChangeableNumberto the value of a hexadecimal stringvoidsetIEEE(String ieee, IEEEStandard standard)Sets the value of thisChangeableNumberto a value of one of both IEEE standards (16 Bit or 32 Bit)voidsetOct(String octValue)Sets the value of thisChangeableNumberto the value of an octal stringvoidsetValue(String value, int baseOfValue)Sets the value of thisChangeableNumberto a value of any numeral systemjavafx.beans.property.ReadOnlyStringPropertystringProperty()StringtoBaseString(int base)Returns the string representation of thisChangeableNumberto any base.StringtoBinString()Returns the string representation of thisChangeableNumberas a binary string.StringtoDecString()Returns the string representation of thisChangeableNumberas a decimal string.StringtoHexString()Returns the string representation of thisChangeableNumberas a hexadecimal string.StringtoIEEEString(IEEEStandard standard)Returns the String representation of thisChangeableNumberas IEEE standard String.StringtoOctString()Returns the string representation of thisChangeableNumberas an octal string.
-
-
-
Field Detail
-
NaN
static final String NaN
- See Also:
- Constant Field Values
-
POSITIVE_INFINITY
static final String POSITIVE_INFINITY
- See Also:
- Constant Field Values
-
NEGATIVE_INFINITY
static final String NEGATIVE_INFINITY
- See Also:
- Constant Field Values
-
-
Method Detail
-
asDouble
default double asDouble()
-
set
void set(double decValue) throws NullPointerException, NumberFormatException, IllegalArgumentException, NumberOverflowException
-
setHex
void setHex(String hexValue) throws NullPointerException, NumberFormatException, IllegalArgumentException
Sets the value of thisChangeableNumberto the value of a hexadecimal string- Parameters:
hexValue- New Value that is represented as a hexadecimal string by this class- Throws:
NullPointerException- if the parameterhexValueisnullNumberFormatException- if the parameterhexValueis not a number of the hexadecimal systemIllegalArgumentException- ifhexValueis an empty string
-
setDec
void setDec(String decValue) throws NullPointerException, NumberFormatException, IllegalArgumentException
Sets the value of thisChangeableNumberto the value of a decimal string- Parameters:
decValue- New value that is represented as a decimal string by this class- Throws:
NullPointerException- if the parameterdecValueisnullNumberFormatException- if the parameterdecValueis not a number of the decimal systemIllegalArgumentException- ifdecValueis an empty string
-
setOct
void setOct(String octValue) throws NullPointerException, NumberFormatException, IllegalArgumentException
Sets the value of thisChangeableNumberto the value of an octal string- Parameters:
octValue- New value that is represented as an octal string by this class- Throws:
NullPointerException- if the parameteroctValueisnullNumberFormatException- if the parameteroctValueis not a number of the octal systemIllegalArgumentException- ifoctValueis an empty string
-
setBin
void setBin(String binValue) throws NullPointerException, NumberFormatException, IllegalArgumentException
Sets the value of thisChangeableNumberto the value of a binary string- Parameters:
binValue- New value that is represented as a binary string by this class- Throws:
NullPointerException- if the parameterbinValueisnullNumberFormatException- if the parameterbinValueis not a number of the binary systemIllegalArgumentException- ifbinValueis an empty string
-
setValue
void setValue(String value, int baseOfValue) throws NullPointerException, NumberFormatException, IllegalArgumentException
Sets the value of thisChangeableNumberto a value of any numeral system- Parameters:
value- New value that is represented as string by this classbaseOfValue- Base of the numeral system ofvalue- Throws:
NullPointerException- if the parametervalueisnullNumberFormatException- if the parametervalueis not a number of the binary systemIllegalArgumentException- ifvalueis an empty string or ifbaseOfValueleaves the range of values [2, 36] - seeConvertingNumbers.isValueToBase(int base, String value)
-
setIEEE
void setIEEE(String ieee, IEEEStandard standard) throws NullPointerException, NumberFormatException, IllegalArgumentException, NumberOverflowException
Sets the value of thisChangeableNumberto a value of one of both IEEE standards (16 Bit or 32 Bit)- Parameters:
ieee- New Value that is represented as a String, by this classstandard- Standard of the used IEEE standard ofieee- Throws:
NullPointerException- if the parameterieeeisnullNumberFormatException- if the parameterieeeis not a number of the binary system or has more characters than 16 respectively 32IllegalArgumentException- ifieeeis an empty String orstandardis something else than 16 or 32NumberOverflowException- Since:
- Bitchanger 0.1.6
-
reset
void reset()
Resets the wrapped value. The previous value gets deleted! If a toString method is called after this method, an empty string will be returned.The wrapped value can be set again by using one of the set methods.
-
toHexString
String toHexString()
Returns the string representation of thisChangeableNumberas a hexadecimal string.The string is not labeled as hexadecimal, so the prefix is not leading!
- Returns:
- hexadecimal string representation of this
ChangeableNumber
-
toDecString
String toDecString()
Returns the string representation of thisChangeableNumberas a decimal string.- Returns:
- decimal string representation of this
ChangeableNumber
-
toOctString
String toOctString()
Returns the string representation of thisChangeableNumberas an octal string.The string is not labeled as octal, so the prefix is not leading!
- Returns:
- octal string representation of this
ChangeableNumber
-
toBinString
String toBinString()
Returns the string representation of thisChangeableNumberas a binary string.The string is not labeled as binary, so the prefix is not leading!
- Returns:
- binary string representation of this
ChangeableNumber
-
toBaseString
String toBaseString(int base) throws IllegalArgumentException
Returns the string representation of thisChangeableNumberto any base.The String is not labeled by a prefix!
- Parameters:
base- Base of the numeral system, in which thisChangeableNumberis represented- Returns:
- String representation of this
ChangeableNumberto the committed base - Throws:
IllegalArgumentException- ifbaseleaves the range of values [2, 36] - seeConvertingNumbers.isValueToBase(int, String)
-
toIEEEString
String toIEEEString(IEEEStandard standard) throws ArithmeticException
Returns the String representation of thisChangeableNumberas IEEE standard String.- Parameters:
standard- IEEE standard that is used for converting- Returns:
- IEEE as String representation of this
ChangeableNumber - Throws:
ArithmeticException- if this number cannot be presented by the given ieee standard- Since:
- Bitchanger 0.1.6
-
stringProperty
javafx.beans.property.ReadOnlyStringProperty stringProperty()
- Returns:
- Since:
- Bitchanger 0.1.7
-
logicStringProperty
javafx.beans.property.ReadOnlyStringProperty logicStringProperty()
- Returns:
- Since:
- Bitchanger 0.1.7
-
baseProperty
javafx.beans.property.IntegerProperty baseProperty()
- Returns:
- Since:
- Bitchanger 0.1.7
-
-