org.flexgen.util
Class Option<T>

java.lang.Object
  extended by org.flexgen.util.Option<T>
Type Parameters:
T - The type of the option this class represents.

public class Option<T>
extends java.lang.Object

Class representing an option that can be randomly selected from among a number of options with different probabilities.


Constructor Summary
Option(T option, long startRange, long endRange)
          Construct an option.
 
Method Summary
 T getOption()
          Get the option represented by this class.
 boolean withinRange(long value)
          Determine whether or not this option is within range of a specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Option

public Option(T option,
              long startRange,
              long endRange)
Construct an option.

Parameters:
option - The option represented by the class. Cannot be null.
startRange - The lower bound of values that will result in this option being selected. Must be greater than or equal to 0.
endRange - The upper bound of values that will result in this option being selected. Must be greater than or equal to startRange.
Method Detail

getOption

public T getOption()
Get the option represented by this class.

Returns:
The option represented by this class.

withinRange

public boolean withinRange(long value)
Determine whether or not this option is within range of a specified value.

Parameters:
value - The value to check.
Returns:
True if the value is within range of this option, false otherwise.


FlexGen Home

Get FlexGen at SourceForge.net. Fast, secure and Free Open Source software downloads

Copyright © 2009 - Jeffrey J. Weston <jjweston@gmail.com>

All rights reserved. Use is subject to license terms.