JET

edu.utep.cs.et.rat.gen
Class ArrayValueGenerator

java.lang.Object
  extended by edu.utep.cs.et.rat.gen.ArrayValueGenerator

 class ArrayValueGenerator
extends Object

A class to generate an array value randomly.

Version:
$Revision: 1.10 $
Author:
Yoonsik Cheon

Field Summary
private  Context context
          Testing context.
private  ValueFactory factory
          Factory to create various types of values.
private  ValueGenerator generator
          Generator to generate various types of values randomly.
private static int MAX_LENGTH
          The maximum length of the array.
private static Random random
          A random number generator.
 
Constructor Summary
ArrayValueGenerator(ValueFactory factory, ValueGenerator generator)
          Creates a generic array generator.
 
Method Summary
private  Denotable buildArray(Class type, int maxHeight, int dim, boolean isTop)
          Creates an array of the given type and dimension.
 Denotable generate(Class type, Context ctx, int maxHeight)
          Generates an array value of the given type under the given testing context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LENGTH

private static final int MAX_LENGTH
The maximum length of the array.

See Also:
Constant Field Values

context

private Context context
Testing context.


random

private static final Random random
A random number generator.


factory

private final ValueFactory factory
Factory to create various types of values.


generator

private final ValueGenerator generator
Generator to generate various types of values randomly.

Constructor Detail

ArrayValueGenerator

public ArrayValueGenerator(ValueFactory factory,
                           ValueGenerator generator)
Creates a generic array generator.

Method Detail

generate

public Denotable generate(Class type,
                          Context ctx,
                          int maxHeight)
Generates an array value of the given type under the given testing context. The last argument constrains the height of the tree representing the return value.

Parameters:
maxHeight - Maximum height of the generated object (viewed as a tree)

buildArray

private Denotable buildArray(Class type,
                             int maxHeight,
                             int dim,
                             boolean isTop)
Creates an array of the given type and dimension.

Parameters:
maxHeight - Maximum height of the generated object (viewed as a tree)

JET

JET is Copyright (C) 2005-2007 by The University of Texas at El Paso and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.