jmetal.core
Class Variable

java.lang.Object
  extended by jmetal.core.Variable
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ArrayInt, ArrayReal, Binary, Int, Permutation, Real

public abstract class Variable
extends java.lang.Object
implements java.io.Serializable

This abstract class is the base for defining new types of variables. Many methods of Variable (getValue, setValue, getLowerLimit,setLowerLimit,getUpperLimit, setUpperLimit) are not applicable to all the subclasses of Variable. For this reason, they are defined by default as giving a fatal error.

See Also:
Serialized Form

Constructor Summary
Variable()
           
 
Method Summary
abstract  Variable deepCopy()
          Creates an exact copy of a Variable object.
 double getLowerBound()
          Gets the lower bound value of a encodings.variable.
 double getUpperBound()
          Gets the upper bound value of a encodings.variable.
 double getValue()
          Gets the double value representating the encodings.variable.
 java.lang.Class getVariableType()
          Gets the type of the encodings.variable.
 void setLowerBound(double lowerBound)
          Sets the lower bound for a encodings.variable.
 void setUpperBound(double upperBound)
          Sets the upper bound for a encodings.variable.
 void setValue(double value)
          Sets a double value to a encodings.variable in subclasses of Variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Variable

public Variable()
Method Detail

deepCopy

public abstract Variable deepCopy()
Creates an exact copy of a Variable object.

Returns:
the copy of the object.

getValue

public double getValue()
                throws JMException
Gets the double value representating the encodings.variable. It is used in subclasses of Variable (i.e. Real and Int). As not all objects belonging to a subclass of Variable have a double value, a call to this method it is considered a fatal error by default, and the program is terminated. Those classes requiring this method must redefine it.

Throws:
JMException

setValue

public void setValue(double value)
              throws JMException
Sets a double value to a encodings.variable in subclasses of Variable. As not all objects belonging to a subclass of Variable have a double value, a call to this method it is considered a fatal error by default, and the program is terminated. Those classes requiring this method must redefine it.

Throws:
JMException

getLowerBound

public double getLowerBound()
                     throws JMException
Gets the lower bound value of a encodings.variable. As not all objects belonging to a subclass of Variable have a lower bound, a call to this method is considered a fatal error by default, and the program is terminated. Those classes requiring this method must redefine it.

Throws:
JMException

getUpperBound

public double getUpperBound()
                     throws JMException
Gets the upper bound value of a encodings.variable. As not all objects belonging to a subclass of Variable have an upper bound, a call to this method is considered a fatal error by default, and the program is terminated. Those classes requiring this method must redefine it.

Throws:
JMException

setLowerBound

public void setLowerBound(double lowerBound)
                   throws JMException
Sets the lower bound for a encodings.variable. As not all objects belonging to a subclass of Variable have a lower bound, a call to this method is considered a fatal error by default and the program is terminated. Those classes requiring this method must to redefine it.

Throws:
JMException

setUpperBound

public void setUpperBound(double upperBound)
                   throws JMException
Sets the upper bound for a encodings.variable. As not all objects belonging to a subclass of Variable have an upper bound, a call to this method is considered a fatal error by default, and the program is terminated. Those classes requiring this method must redefine it.

Throws:
JMException

getVariableType

public java.lang.Class getVariableType()
Gets the type of the encodings.variable. The types are defined in class Problem.

Returns:
The type of the encodings.variable