|
||||||||||
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.Real
public class Real
Constructor Summary | |
---|---|
Real()
Create the instance with a random value. |
|
Real(double value)
Create the instance with the given value. |
|
Real(double lower,
double upper)
Create the Real instance with the initial value which is random between lower and upper . |
|
Real(Real copy)
Copy construtor. |
Method Summary | |
---|---|
int |
compareTo(Numeric other)
|
boolean |
equals(Object other)
Compare the specified object with this type for equality. |
boolean |
getBit()
Get the value of this Numeric. |
Real |
getClone()
Create a cloned copy of the current object and return it. |
int |
getInt()
Get the value of this Numeric. |
double |
getReal()
Get the value of this Numeric. |
String |
getRepresentation()
Get the type representation of this Real object as a string. |
int |
hashCode()
Returns the hash code value for this list. |
void |
randomize(Random random)
Re-randomize the Real object based on the upper and lower bounds. |
void |
readExternal(ObjectInput ois)
Read the Real from the provided ObjectInput. |
void |
reset()
Set the value of the Real to a default value of 0.0. |
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 bit value with the provided value. |
void |
setBit(String value)
Set the bit value with the provided value. |
void |
setInt(int value)
Set the integer value with the provided value. |
void |
setInt(String value)
Set the integer value with the provided value. |
void |
setReal(double value)
Set the real value with the provided value. |
void |
setReal(String value)
Set the real value with the provided value. |
String |
toString()
Return a String representation of the Real object. |
void |
writeExternal(ObjectOutput oos)
Serialize the Real to the provided ObjectOutput. |
Methods inherited from class net.sourceforge.cilib.type.types.Numeric |
---|
getBounds, setBounds, setBounds |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Real()
public Real(double value)
value
- The value of the Real.public Real(double lower, double upper)
Real
instance with the initial value which is random between lower
and upper
.
lower
- The lower boundary for the random number.upper
- The upper boundary for the random number.public Real(Real copy)
copy
- The instance to copy.Method Detail |
---|
public Real 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 value to 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 set.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 value to set.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)
Real
object based on the upper and lower bounds.
random
- The Random
to use for the randomization.public void reset()
public String toString()
String
representation of the Real
object.
toString
in class Object
String
representing the object instance.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 IO error occurs.
ClassNotFoundException
- If a class cast problem occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |