Package mgui.numbers
Interface MguiNumber
- All Superinterfaces:
java.lang.Cloneable
,java.lang.Comparable<MguiNumber>
,XMLObject
- All Known Implementing Classes:
MguiBoolean
,MguiDouble
,MguiFloat
,MguiInteger
,MguiLong
,MguiShort
public interface MguiNumber extends java.lang.Cloneable, java.lang.Comparable<MguiNumber>, XMLObject
Interface for numbers used in ModelGUI. In contrast to native Java number wrapper classes,
instances of
MguiNumber
are modifiable; thus must be used with caution due to
synchronicity issues, etc. This interface also specifies methods for basic arithmetic and comparisons.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Nested Class Summary
Nested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType
-
Method Summary
Modifier and Type Method Description MguiNumber
add(double n)
Update the value of this number by addingn
.MguiNumber
add(MguiNumber n)
Update the value of this number by addingn
.java.lang.Object
clone()
int
compareTo(double d)
int
compareTo(double d, int precision)
MguiNumber
divide(double n)
Update the value of this number by dividing byn
.MguiNumber
divide(MguiNumber n)
Update the value of this number by dividing byn
.int
getByteSize()
double
getValue()
Returns the value of this numberMguiNumber
multiply(double n)
Update the value of this number by multiplying byn
.MguiNumber
multiply(MguiNumber n)
Update the value of this number by multiplying byn
.void
setValue(double val)
boolean
setValue(java.lang.String val)
void
setValue(MguiNumber val)
MguiNumber
subtract(double n)
Update the value of this number by subtractingn
.MguiNumber
subtract(MguiNumber n)
Update the value of this number by subtractingn
.java.lang.String
toString(java.lang.String pattern)
Returns the value of this number as aString
, formatted withpattern
.Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface mgui.interfaces.xml.XMLObject
getDTD, getLocalName, getShortXML, getXML, getXML, getXMLSchema, handleXMLElementEnd, handleXMLElementStart, handleXMLString, writeXML, writeXML, writeXML
-
Method Details
-
toString
java.lang.String toString(java.lang.String pattern)Returns the value of this number as aString
, formatted withpattern
.- Parameters:
pattern
-- Returns:
-
clone
java.lang.Object clone() -
setValue
boolean setValue(java.lang.String val) -
setValue
-
setValue
void setValue(double val) -
compareTo
int compareTo(double d) -
compareTo
int compareTo(double d, int precision) -
getByteSize
int getByteSize() -
getValue
double getValue()Returns the value of this number- Returns:
-
add
Update the value of this number by addingn
.- Parameters:
n
-- Returns:
- this number
-
subtract
Update the value of this number by subtractingn
.- Parameters:
n
-- Returns:
- this number
-
multiply
Update the value of this number by multiplying byn
.- Parameters:
n
-- Returns:
- this number
-
divide
Update the value of this number by dividing byn
.- Parameters:
n
-- Returns:
- this number
-
add
Update the value of this number by addingn
.- Parameters:
n
-- Returns:
- this number
-
subtract
Update the value of this number by subtractingn
.- Parameters:
n
-- Returns:
- this number
-
multiply
Update the value of this number by multiplying byn
.- Parameters:
n
-- Returns:
- this number
-
divide
Update the value of this number by dividing byn
.- Parameters:
n
-- Returns:
- this number
-