ucs
Class RuleCondition

java.lang.Object
  extended byucs.RuleCondition
All Implemented Interfaces:
java.lang.Cloneable

public class RuleCondition
extends java.lang.Object
implements java.lang.Cloneable

A rule object for use in UCS.

Author:
Gavin Brown

Field Summary
static int[] arity
          The arity of each element of the current condition.
 int length
          The length of this condition.
 double[] values
          The condition
 
Constructor Summary
RuleCondition(double[] cond)
          RuleCondition constructor.
RuleCondition(int length)
          RuleCondition constructor.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this object.
 boolean matches(double[] othergenome)
          Checks whether two conditions match or not.
 boolean matches(RuleCondition other)
          Checks whether two conditions match or not.
 double randomValue(int position)
          Returns a valid randomly chosen value for the specified index in this rule, including the ``don't care'' symbol.
 void set(double[] newgenome)
          Sets this condition to the supplied argument.
 void set(int position, double value)
          Sets a particular position in this condition to the supplied value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

arity

public static int[] arity
The arity of each element of the current condition.


length

public int length
The length of this condition.


values

public double[] values
The condition

Constructor Detail

RuleCondition

public RuleCondition(double[] cond)
RuleCondition constructor.

Parameters:
cond - A double array specifying the contents of this condition.

RuleCondition

public RuleCondition(int length)
RuleCondition constructor.

Parameters:
length - The required length of this condition.
Method Detail

clone

public java.lang.Object clone()
Returns a clone of this object.

Returns:
A clone of this RuleCondition object.

matches

public boolean matches(double[] othergenome)
Checks whether two conditions match or not.

Parameters:
othergenome - A double array specifying a condition to check against this condition.
Returns:
True if the two conditons match, otherwise false.

matches

public boolean matches(RuleCondition other)
Checks whether two conditions match or not.

Parameters:
other - A condition to check against this condition.
Returns:
True if the two conditons match, otherwise false.

randomValue

public double randomValue(int position)
Returns a valid randomly chosen value for the specified index in this rule, including the ``don't care'' symbol.

Parameters:
position - The index within this condition to query.

set

public void set(double[] newgenome)
Sets this condition to the supplied argument.

Parameters:
newgenome -

set

public void set(int position,
                double value)
Sets a particular position in this condition to the supplied value.

Parameters:
position - The index within this condition to set.
value - A double value specifying what value the position should be set to. This could be Condition.HASH to set it as a "don't care" symbol.