JET

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

java.lang.Object
  extended by edu.utep.cs.et.rat.gen.InterfaceValueGenerator
All Implemented Interfaces:
ValueGenerator

 class InterfaceValueGenerator
extends Object
implements ValueGenerator

A class to generate interface values. The approach is to choose randomly a concrete implementation class or subclass from a user-specified list, and to create its instance.

Version:
$Revision: 1.11 $
Author:
Yoonsik Cheon

Field Summary
private  ValueFactory factory
          Factory to create various types of values.
private  ValueGenerator generator
          Generator to generate various types of values.
 
Constructor Summary
InterfaceValueGenerator(ValueFactory factory, ValueGenerator generator)
          Creates an interface generator that uses the given value factory and generator.
 
Method Summary
 Denotable generate(Class type, Context ctx, int maxHeight)
          Generates a value of the given interface or abstract class type in the given testing context.
private  String getImplClass(Class type, Context ctx)
          Returns an implementation class of the given type, if any; otherwise, return null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

private ValueFactory factory
Factory to create various types of values.


generator

private ValueGenerator generator
Generator to generate various types of values.

Constructor Detail

InterfaceValueGenerator

public InterfaceValueGenerator(ValueFactory factory,
                               ValueGenerator generator)
Creates an interface generator that uses the given value factory and generator.

Method Detail

generate

public Denotable generate(Class type,
                          Context ctx,
                          int maxHeight)
Generates a value of the given interface or abstract class type in the given testing context. A concrete implementation class or subclass is chosen randomly from a user-specified list, and its instance created. If no such a concrete class is found, a null value is returned.

Specified by:
generate in interface ValueGenerator
Parameters:
maxHeight - Maximum height of the generated object (viewed as a tree)

getImplClass

private String getImplClass(Class type,
                            Context ctx)
Returns an implementation class of the given type, if any; otherwise, return null.


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.