|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.cilib.type.types.Numeric net.sourceforge.cilib.type.types.Bit
public class Bit
Implemetantation of the Bit object. The Bit object is the Type system equivalent of a bit.
Constructor Summary | |
---|---|
Bit()
Create a Bit object with a random state value. |
|
Bit(Bit copy)
Copy constructor. |
|
Bit(boolean state)
Copy-constructor. |
Method Summary | |
---|---|
int |
compareTo(Numeric other)
|
boolean |
equals(Object other)
Compare the specified object with this type for equality. |
boolean |
getBit()
Return the state of the curent Bit object. |
Bit |
getClone()
Create a cloned copy of the current object and return it. |
int |
getInt()
Get the integer representation of the current Bit object. |
double |
getReal()
Get the state of the Bit returned as a double value. |
String |
getRepresentation()
Get the type representation of this Bit object as a string. |
int |
hashCode()
Returns the hash code value for this list. |
void |
randomize(Random random)
Randomly choose a new valid for the Bit object. |
void |
readExternal(ObjectInput ois)
Externalise the current object to the provided ObjectInput. |
void |
reset()
Set the Bit object to an initial value of false. |
void |
set(boolean value)
Set the value of the Numeric. |
void |
set(double value)
Set the value of the Numeric. |
void |
set(int value)
Set the value of the Numeric. |
void |
set(String value)
Set the value of the Numeric. |
void |
setBit(boolean value)
Set the state of of this Bit object. |
void |
setBit(String value)
Set the bit value with the provided value. |
void |
setBounds(Bounds bounds)
Set the bounds for the current Bit instance. |
void |
setBounds(double lower,
double upper)
Set the bounds for the current Bit instance. |
void |
setInt(int value)
Set the state of the current Bit object. |
void |
setInt(String value)
Set the integer value with the provided value. |
void |
setReal(double value)
Set the state of the Bit object using value as input. |
void |
setReal(String value)
Set the real value with the provided value. |
String |
toString()
Return the String representation of this object's value. |
void |
writeExternal(ObjectOutput oos)
Externalise the current object to the provided ObjectOutput. |
Methods inherited from class net.sourceforge.cilib.type.types.Numeric |
---|
getBounds |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Bit()
public Bit(boolean state)
state
- The state for the Bit object to be inpublic Bit(Bit copy)
copy
- The instance to copy.Method Detail |
---|
public Bit getClone()
getClone
in interface Type
getClone
in interface Cloneable
getClone
in class Numeric
Object.clone()
public boolean equals(Object other)
true
if and only if the specified object is also an instance
of the same type.
equals
in interface Type
equals
in class Numeric
other
- The object to compare.
true
if equality exists, false
otherwise.Object.equals(Object)
public int hashCode()
int hashCode = 7; Iterator<E> i = list.iterator(); while (i.hasNext()) { E obj = i.next(); hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode()); }This ensures that type1.equals(type2) implies that type1.hashCode()==type2.hashCode() for any two types, type1 and type2, as required by the general contract of
Object.hashCode()
.
hashCode
in interface Type
hashCode
in class Numeric
Object.equals(Object)
,
Type.equals(Object)
public void set(String value)
set
in class Numeric
value
- The String value to be parsed.public void set(boolean value)
set
in class Numeric
value
- The boolean value representing the value for this Type.public void set(double value)
set
in class Numeric
value
- The double value representing the value for this Type.public void set(int value)
set
in class Numeric
value
- The int value representing the value for this Type.public boolean getBit()
getBit
in class Numeric
public void setBit(boolean value)
setBit
in class Numeric
value
- The state to be set.public void setBit(String value)
setBit
in class Numeric
value
- The value to set.public int getInt()
getInt
in class Numeric
public void setInt(int value)
setInt
in class Numeric
value
- The value to be used to set the state.public void setInt(String value)
setInt
in class Numeric
value
- The value to set.public double getReal()
getReal
in class Numeric
public void setReal(double value)
setReal
in class Numeric
value
- The double value to be used to set the state.public void setReal(String value)
setReal
in class Numeric
value
- The value to set.public int compareTo(Numeric other)
compareTo
in interface Comparable<Numeric>
compareTo
in class Numeric
public void randomize(Random random)
Bit
object.
random
- The Random
to use for the randomization.public void reset()
public String toString()
toString
in class Object
public String getRepresentation()
getRepresentation
in class Numeric
public void writeExternal(ObjectOutput oos) throws IOException
oos
- The provided ObjectOutput
IOException
- if an error occurs.public void readExternal(ObjectInput ois) throws IOException, ClassNotFoundException
ois
- The provided ObjectInput
IOException
- if an error occurs.
ClassNotFoundException
- if the required class is not found.public void setBounds(Bounds bounds)
Bit
instance. This method is not a valid
operation and as a result throws a UnsupportedOperationException
.
setBounds
in interface BoundedType
setBounds
in class Numeric
bounds
- The bounds to set.
UnsupportedOperationException
- Bit instances cannot have arbitary bounds.public void setBounds(double lower, double upper)
Bit
instance. This method is not a valid
operation and as a result throws a UnsupportedOperationException
.
setBounds
in interface BoundedType
setBounds
in class Numeric
lower
- The lower bound value.upper
- The upperbound value.
UnsupportedOperationException
- Bit instances cannot have arbitary bounds.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |