com.sun.slamd.scripting.ldap
Class AttributeValueList

java.lang.Object
  extended by com.sun.slamd.scripting.ldap.AttributeValueList

public class AttributeValueList
extends java.lang.Object

This class defines a list of explicit values that an attribute may have. The values may be weighted so that some are more likely to occur than others. Values with a larger weight are more likely to occur than values with a smaller weight.

Author:
Neil A. Wilson

Constructor Summary
AttributeValueList()
          Creates a new value list with no values.
 
Method Summary
 void addValue(java.lang.String value)
          Adds the specified value to the value list.
 void addValue(java.lang.String value, int weight)
          Adds the specified value to the value list with the indicated weight.
 void completeInitialization()
          Indicates that all of the values have been added to the value list and that the value list should be optimized for better performance when retrieving values from it.
 java.lang.String nextValue()
          Retrieves a value from the value list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeValueList

public AttributeValueList()
Creates a new value list with no values.

Method Detail

addValue

public void addValue(java.lang.String value)
Adds the specified value to the value list. It will be given a weight of 1.

Parameters:
value - The value to add to the value list.

addValue

public void addValue(java.lang.String value,
                     int weight)
Adds the specified value to the value list with the indicated weight.

Parameters:
value - The value to add to the value list.
weight - The weight to use for the value.

completeInitialization

public void completeInitialization()
Indicates that all of the values have been added to the value list and that the value list should be optimized for better performance when retrieving values from it.


nextValue

public java.lang.String nextValue()
Retrieves a value from the value list. The value to retrieve will be chosen at random, but will be somewhat based on the weights associated with each value.

Returns:
A value from the value list.