Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

exptree.utilities
Class generator  view generator download generator.java

java.lang.Object
  extended byexptree.utilities.generator

public class generator
extends java.lang.Object

Creates a randomly generated mathematic expression and places it in an expressionTree. The generation process is influenced by several parameters contain in a globalSettings object. The most significant are the properties "complexity," "depreciation," and "variable.probability." The complexity value determines how likely the node being produced is to be a terminal node, where the lower complexity's value, the more likely it is to be terminal. Depreciation is a value that is subtracted from complexity at each level of the tree, to ensure the generation process will end within a reasonable number of tree levels. The variable.probability determines how likely a terminal node is to be a value or a variable, where higher values mean variables are more likely to occur than values. All three of these settings should fall in the range of 0.0 to 1.0. Depreciation, however, should never actually be 0.0.

Version:
1.1 08/19/2000

Field Summary
(package private)  exptree.operators.operatorInterface[] list
          A list of the available operators.
(package private)  settings.globalSettings settings
          The user defined settings that influence the generation of expressions.
(package private)  variablePackage variables
          The variables the generated expression may use.
 
Constructor Summary
generator(settings.globalSettings s, variablePackage v)
          Class constructor which sets the object's settings and variablePackage.
 
Method Summary
 exptree.expressionTree generate(double level, java.util.Random randomNumber)
          Returns a generated expressionTree based ont he given Random object, starting at the levelth level of the tree.
 exptree.expressionTree generate(java.util.Random randomNumber)
          Returns a generated expressionTree based on the given Random object.
(package private)  exptree.operators.operatorInterface pickRandomOp(java.util.Random whichOp)
          Returns a randomly chosen operatorInterface object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

variables

variablePackage variables
The variables the generated expression may use.


settings

settings.globalSettings settings
The user defined settings that influence the generation of expressions.


list

exptree.operators.operatorInterface[] list
A list of the available operators.

Constructor Detail

generator

public generator(settings.globalSettings s,
                 variablePackage v)
Class constructor which sets the object's settings and variablePackage.

Method Detail

generate

public exptree.expressionTree generate(java.util.Random randomNumber)
Returns a generated expressionTree based on the given Random object.


generate

public exptree.expressionTree generate(double level,
                                       java.util.Random randomNumber)
Returns a generated expressionTree based ont he given Random object, starting at the levelth level of the tree.


pickRandomOp

exptree.operators.operatorInterface pickRandomOp(java.util.Random whichOp)
Returns a randomly chosen operatorInterface object.