net.sourceforge.cilib.type.types
Class Numeric

java.lang.Object
  extended by net.sourceforge.cilib.type.types.Numeric
All Implemented Interfaces:
Serializable, Comparable<Numeric>, BoundedType, Randomizable, Resetable, Type, Cloneable
Direct Known Subclasses:
Bit, Int, Long, Real

public abstract class Numeric
extends Object
implements Type, BoundedType, Resetable, Comparable<Numeric>, Randomizable

Definition of the Numeric type.

Author:
Gary Pampara
See Also:
Serialized Form

Constructor Summary
protected Numeric()
           
 
Method Summary
abstract  int compareTo(Numeric other)
          
 boolean equals(Object other)
          Compare the specified object with this type for equality.
abstract  boolean getBit()
          Get the value of this Numeric.
 Bounds getBounds()
           
abstract  Numeric getClone()
          Create a cloned copy of the current object and return it.
abstract  int getInt()
          Get the value of this Numeric.
abstract  double getReal()
          Get the value of this Numeric.
abstract  String getRepresentation()
           
 int hashCode()
          Returns the hash code value for this list.
abstract  void set(boolean value)
          Set the value of the Numeric.
abstract  void set(double value)
          Set the value of the Numeric.
abstract  void set(int value)
          Set the value of the Numeric.
abstract  void set(String value)
          Set the value of the Numeric.
abstract  void setBit(boolean value)
          Set the bit value with the provided value.
abstract  void setBit(String value)
          Set the bit value with the provided value.
 void setBounds(Bounds bounds)
           
 void setBounds(double lower, double upper)
           
abstract  void setInt(int value)
          Set the integer value with the provided value.
abstract  void setInt(String value)
          Set the integer value with the provided value.
abstract  void setReal(double value)
          Set the real value with the provided value.
abstract  void setReal(String value)
          Set the real value with the provided value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.cilib.type.types.Resetable
reset
 
Methods inherited from interface net.sourceforge.cilib.type.types.Randomizable
randomize
 

Constructor Detail

Numeric

protected Numeric()
Method Detail

getClone

public abstract Numeric getClone()
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface Type
Specified by:
getClone in interface Cloneable
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

equals

public boolean equals(Object other)
Compare the specified object with this type for equality. Returns true if and only if the specified object is also an instance of the same type.

Specified by:
equals in interface Type
Overrides:
equals in class Object
Parameters:
other - The object to compare.
Returns:
true if equality exists, false otherwise.
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Returns the hash code value for this list. The hash code of a list is defined to be the result of the following calculation:
  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().

Specified by:
hashCode in interface Type
Overrides:
hashCode in class Object
Returns:
the hash code value for this list
See Also:
Object.equals(Object), Type.equals(Object)

set

public abstract void set(String value)
Set the value of the Numeric.

Parameters:
value - The String value to be parsed.

set

public abstract void set(boolean value)
Set the value of the Numeric.

Parameters:
value - The boolean value representing the value for this Type.

set

public abstract void set(int value)
Set the value of the Numeric.

Parameters:
value - The int value representing the value for this Type.

set

public abstract void set(double value)
Set the value of the Numeric.

Parameters:
value - The double value representing the value for this Type.

getBit

public abstract boolean getBit()
Get the value of this Numeric.

Returns:
The value of this Numeric as a boolean.

setBit

public abstract void setBit(boolean value)
Set the bit value with the provided value.

Parameters:
value - The value to set.

setBit

public abstract void setBit(String value)
Set the bit value with the provided value.

Parameters:
value - The value to set.

getInt

public abstract int getInt()
Get the value of this Numeric.

Returns:
The value of this Numeric as a int.

setInt

public abstract void setInt(int value)
Set the integer value with the provided value.

Parameters:
value - The value to set.

setInt

public abstract void setInt(String value)
Set the integer value with the provided value.

Parameters:
value - The value to set.

getReal

public abstract double getReal()
Get the value of this Numeric.

Returns:
The value of this Numeric as a double.

setReal

public abstract void setReal(double value)
Set the real value with the provided value.

Parameters:
value - The value to set.

setReal

public abstract void setReal(String value)
Set the real value with the provided value.

Parameters:
value - The value to set.

compareTo

public abstract int compareTo(Numeric other)

Specified by:
compareTo in interface Comparable<Numeric>

getBounds

public Bounds getBounds()
Specified by:
getBounds in interface BoundedType

setBounds

public void setBounds(Bounds bounds)
Specified by:
setBounds in interface BoundedType

setBounds

public void setBounds(double lower,
                      double upper)
Specified by:
setBounds in interface BoundedType

getRepresentation

public abstract String getRepresentation()


Copyright © 2009 CIRG. All Rights Reserved.