Customizing random value generation
Customizing random value generation
- Subject: Customizing random value generation
- From: Florijan Stamenkovic <email@hidden>
- Date: Thu, 04 Sep 2008 11:42:30 -0400
Hi all,
I am working on the EO data generator discussed a while ago, in
between of other things. So, since "hints" that affect value
generation are wired into the generation process, I need to know what
they are to use them. Below is a list of hint types I have, if anyone
can come up with something else that is relevant, please let me know.
Explanations are provided in comments.
Note that a hint consists of a type and a value. The value is of the
class that the hint type is parameterized with. A hint type is
instantiated with an integer that is used as it's hash type, and to
compare hint equality. The desired consequence of this is that hints
with the same ID will override each other. For example if you first
set an OVRD hint for a certain property, and then set a SEQ hint for
the same property, the OVRD property will be removed from the hint
cache.
F
If you are interested in the context in which this is used, Hint.java
is attached:
Attachment:
Hint.java
Description: Binary data
/**
* Entity level hint, determines how many EOs should be generated for
* any particular entity.
*/
public static final Type<Integer> COUNT = new Type<Integer>(0);
/**
* Determines how frequently a value will be set for a property
* that allows null.
*/
public static final Type<Float> SPARSITY = new Type<Float>(1);
/**
* Overrides randomized value generation and instead uses the provided
* <tt>List</tt> to randomly choose a value from.
*/
public static final Type<List<?>> OVRD = new Type<List<?>>(2);
/**
* Similar to {@link #OVRD}, but the values are not randomly chosen
* from the <tt>List</tt>, but in sequence.
*/
public static final Type<List<?>> SEQ = new Type<List<?>>(2);
/**
* Instead of using the default value generator for the class of the
* attribute, a custom provided <tt>AttGen</tt> is used.
*/
public static final Type<AttGen> CUSTOM = new Type<AttGen>(2);
/**
* An attribute generator for the given <tt>Class</tt> is used, and
* then the value is converted to the type the attribute expects it in.
*/
public static final Type<Class<?>> CONVERT = new Type<Class<?>>(2);
/**
* The low boundary for randomly generated values. Different
attribute type
* generators will expect different value types for hints of this type:
* <ul>
* <li><tt>String</tt> attributes expect an <tt>Integer</tt>
denoting the
* minimum <tt>String</tt> length.</li>
* <li>Numeric attributes expect a <tt>Number</tt> of the same type the
* attribute is in, denoting the minimum allowed value for the
attribute.</li>
* <li><tt>NSData</tt> attributes expect an <tt>Integer</tt>
denoting the
* minimum number of bytes used.</li>
* <li><tt>NSData</tt> attributes that are images expect a
<tt>Dimension</tt>
* denoting the minimum image size in pixels.</li>
* </ul>
*/
public static final Type<Object> MIN = new Type<Object>(3);
/**
* The high boundary for randomly generated values. Different
attribute type
* generators will expect different value types for hints of this type:
* <ul>
* <li><tt>String</tt> attributes expect an <tt>Integer</tt>
denoting the
* maximum <tt>String</tt> length.</li>
* <li>Numeric attributes expect a <tt>Number</tt> of the same type the
* attribute is in, denoting the maximum allowed value for the
attribute.</li>
* <li><tt>NSData</tt> attributes expect an <tt>Integer</tt>
denoting the
* maximum number of bytes used.</li>
* <li><tt>NSData</tt> attributes that are images expect a
<tt>Dimension</tt>
* denoting the maximum image size in pixels.</li>
* </ul>
*/
public static final Type<Object> MAX = new Type<Object>(4);
/**
* Utilized only by <tt>NSData</tt> attributes, defines the
attribute to be
* the data of an image, the value of the hint of this type should a
* <tt>String</tt> that defines the image format name, as expected by
* {@link ImageIO#getImageWritersByFormatName(String)}.
*/
public static final Type<String> IMAGE = new Type<String>(5);
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden