Package mgui.numbers
Class MguiBoolean
java.lang.Object
mgui.numbers.MguiBoolean
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Comparable<MguiNumber>
,XMLObject
,MguiNumber
public class MguiBoolean extends java.lang.Object implements MguiNumber
Implementation of
MguiNumber
for values of type boolean
. As a number,
this treats a value as 0 == false
and any other value is considered true
.- 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
-
Field Summary
Fields Modifier and Type Field Description protected boolean
value
-
Constructor Summary
Constructors Constructor Description MguiBoolean()
MguiBoolean(boolean thisValue)
MguiBoolean(java.lang.String thisValue)
-
Method Summary
Modifier and Type Method Description MguiNumber
add(double n)
Update the value of this number by addingn
.MguiNumber
add(MguiNumber number)
Update the value of this number by addingn
.java.lang.Object
clone()
int
compareTo(double d)
int
compareTo(double value, int precision)
int
compareTo(MguiNumber n)
MguiNumber
divide(double n)
Update the value of this number by dividing byn
.MguiNumber
divide(MguiNumber number)
Update the value of this number by dividing byn
.boolean
equals(java.lang.Object obj)
int
getByteSize()
java.lang.String
getDTD()
Returns the Data Type Declaration (DTD) for this object's XML representationjava.lang.String
getLocalName()
Returns the local name associated with this XML object.java.lang.String
getShortXML(int tab)
Returns a short XML representation of this object.boolean
getTrue()
double
getValue()
Returns the value of this numberjava.lang.String
getXML()
Returns this object's XML representation as a single string.java.lang.String
getXML(int tab)
Returns this object's XML representation as a single string.static XMLObject
getXMLInstance(org.xml.sax.Attributes attributes)
java.lang.String
getXMLSchema()
Returns the XML schema for this object's XML representationvoid
handleXMLElementEnd(java.lang.String localName)
Handles the end of an XML element.void
handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)
Handles the start of an XML element.void
handleXMLString(java.lang.String s)
Handles a string within an XML element.MguiNumber
multiply(double n)
Update the value of this number by multiplying byn
.MguiNumber
multiply(MguiNumber number)
Update the value of this number by multiplying byn
.void
setTrue(boolean b)
void
setValue(boolean thisValue)
void
setValue(double thisValue)
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 number)
Update the value of this number by subtractingn
.java.lang.String
toString()
static java.lang.String
toString(boolean b)
java.lang.String
toString(java.lang.String pattern)
Returns the value of this number as aString
, formatted withpattern
.void
writeXML(int tab, java.io.Writer writer)
Writes the XML representation of this object to file.void
writeXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar)
Writes the XML representation of this object to file, asXMLType.Normal
.void
writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar)
Writes the XML representation of this object to file.Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
value
protected boolean value
-
-
Constructor Details
-
MguiBoolean
public MguiBoolean() -
MguiBoolean
public MguiBoolean(java.lang.String thisValue) -
MguiBoolean
public MguiBoolean(boolean thisValue)
-
-
Method Details
-
setValue
- Specified by:
setValue
in interfaceMguiNumber
-
setValue
public void setValue(double thisValue)- Specified by:
setValue
in interfaceMguiNumber
-
compareTo
public int compareTo(double value, int precision)- Specified by:
compareTo
in interfaceMguiNumber
-
setValue
public void setValue(boolean thisValue) -
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getTrue
public boolean getTrue() -
setTrue
public void setTrue(boolean b) -
getValue
public double getValue()Description copied from interface:MguiNumber
Returns the value of this number- Specified by:
getValue
in interfaceMguiNumber
- Returns:
-
toString
public java.lang.String toString(java.lang.String pattern)Description copied from interface:MguiNumber
Returns the value of this number as aString
, formatted withpattern
.- Specified by:
toString
in interfaceMguiNumber
- Returns:
-
setValue
public boolean setValue(java.lang.String val)- Specified by:
setValue
in interfaceMguiNumber
-
clone
public java.lang.Object clone()- Specified by:
clone
in interfaceMguiNumber
- Overrides:
clone
in classjava.lang.Object
-
compareTo
- Specified by:
compareTo
in interfacejava.lang.Comparable<MguiNumber>
- Throws:
java.lang.ClassCastException
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equals
in classjava.lang.Object
-
add
Description copied from interface:MguiNumber
Update the value of this number by addingn
.- Specified by:
add
in interfaceMguiNumber
- Returns:
- this number
-
divide
Description copied from interface:MguiNumber
Update the value of this number by dividing byn
.- Specified by:
divide
in interfaceMguiNumber
- Returns:
- this number
-
subtract
Description copied from interface:MguiNumber
Update the value of this number by subtractingn
.- Specified by:
subtract
in interfaceMguiNumber
- Returns:
- this number
-
multiply
Description copied from interface:MguiNumber
Update the value of this number by multiplying byn
.- Specified by:
multiply
in interfaceMguiNumber
- Returns:
- this number
-
add
Description copied from interface:MguiNumber
Update the value of this number by addingn
.- Specified by:
add
in interfaceMguiNumber
- Returns:
- this number
-
divide
Description copied from interface:MguiNumber
Update the value of this number by dividing byn
.- Specified by:
divide
in interfaceMguiNumber
- Returns:
- this number
-
multiply
Description copied from interface:MguiNumber
Update the value of this number by multiplying byn
.- Specified by:
multiply
in interfaceMguiNumber
- Returns:
- this number
-
subtract
Description copied from interface:MguiNumber
Update the value of this number by subtractingn
.- Specified by:
subtract
in interfaceMguiNumber
- Returns:
- this number
-
getByteSize
public int getByteSize()- Specified by:
getByteSize
in interfaceMguiNumber
-
compareTo
public int compareTo(double d)- Specified by:
compareTo
in interfaceMguiNumber
-
toString
public static java.lang.String toString(boolean b) -
getDTD
public java.lang.String getDTD()Description copied from interface:XMLObject
Returns the Data Type Declaration (DTD) for this object's XML representationSee http://en.wikipedia.org/wiki/Document_Type_Definition for a description.
-
getLocalName
public java.lang.String getLocalName()Description copied from interface:XMLObject
Returns the local name associated with this XML object.- Specified by:
getLocalName
in interfaceXMLObject
- Returns:
-
getXML
public java.lang.String getXML()Description copied from interface:XMLObject
Returns this object's XML representation as a single string. NOTE: this is not feasible for larger objects and containers, thus may not be implemented for these objects. Use theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)
functions to write larger objects to file. -
getXML
public java.lang.String getXML(int tab)Description copied from interface:XMLObject
Returns this object's XML representation as a single string. NOTE: this is not feasible for larger objects and containers, thus may not be implemented for these objects. Use theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)
functions to write larger objects to file. -
getXMLSchema
public java.lang.String getXMLSchema()Description copied from interface:XMLObject
Returns the XML schema for this object's XML representation- Specified by:
getXMLSchema
in interfaceXMLObject
- Returns:
-
handleXMLElementEnd
public void handleXMLElementEnd(java.lang.String localName)Description copied from interface:XMLObject
Handles the end of an XML element.- Specified by:
handleXMLElementEnd
in interfaceXMLObject
- Parameters:
localName
- Local name of the element
-
handleXMLElementStart
public void handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)Description copied from interface:XMLObject
Handles the start of an XML element.- Specified by:
handleXMLElementStart
in interfaceXMLObject
- Parameters:
localName
- Local name of the elementattributes
- Set of element attributestype
- TheXMLType
of this element
-
handleXMLString
public void handleXMLString(java.lang.String s)Description copied from interface:XMLObject
Handles a string within an XML element.- Specified by:
handleXMLString
in interfaceXMLObject
- Parameters:
s
- String to handle
-
getXMLInstance
-
writeXML
public void writeXML(int tab, java.io.Writer writer) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format ofXMLFormat.Ascii
will be used. -
writeXML
public void writeXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file, asXMLType.Normal
. The default format ofXMLFormat.Ascii
will be used. The basic contract for this method is that it should not write a newline character at its start or end. -
writeXML
public void writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format ofXMLFormat.Ascii
will be used. -
getShortXML
public java.lang.String getShortXML(int tab)Description copied from interface:XMLObject
Returns a short XML representation of this object.- Specified by:
getShortXML
in interfaceXMLObject
- Returns:
-