alun.markov
Class BasicVariable

java.lang.Object
  extended by alun.markov.BasicVariable
All Implemented Interfaces:
Iterable, Variable
Direct Known Subclasses:
Edge, GeneticVariable

public class BasicVariable
extends java.lang.Object
implements Variable

A BasicVariable can take only positive integer values, and setStates can only restrict the possible states among those that were possible on construction.


Constructor Summary
BasicVariable(int n)
           
 
Method Summary
 java.lang.String getName()
           
 int getNStates()
          Returns the current number of possible states.
 int getState()
          Returns the value of the current state of the Variable.
 int[] getStates()
           
 void init()
           
static void main(java.lang.String[] args)
          Test main.
 boolean next()
           
 void setName(java.lang.String s)
           
 boolean setState(int i)
          Sets the current state to the given integer.
 void setStates(Function f)
          Restricts the set of values that the variable can take to those among the current set for which the given function has positive value.
 void setStates(int[] x)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicVariable

public BasicVariable(int n)
Method Detail

setName

public void setName(java.lang.String s)

getName

public java.lang.String getName()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

init

public void init()
Specified by:
init in interface Iterable

next

public boolean next()
Specified by:
next in interface Iterable

getState

public int getState()
Description copied from interface: Variable
Returns the value of the current state of the Variable.

Specified by:
getState in interface Variable

getNStates

public int getNStates()
Description copied from interface: Variable
Returns the current number of possible states.

Specified by:
getNStates in interface Variable

setState

public boolean setState(int i)
Description copied from interface: Variable
Sets the current state to the given integer. Returns true if the given state is valid.

Specified by:
setState in interface Variable

setStates

public void setStates(int[] x)
Specified by:
setStates in interface Variable

getStates

public int[] getStates()
Specified by:
getStates in interface Variable

setStates

public void setStates(Function f)
Description copied from interface: Variable
Restricts the set of values that the variable can take to those among the current set for which the given function has positive value.

Specified by:
setStates in interface Variable

main

public static void main(java.lang.String[] args)
Test main.