public class RandomVectorFactory
extends java.lang.Object
RandomVector
instances from "orders".
The "specifications" of each order are as generic as possible:
String (name of class), Object[] (parameters), long (seed),
RandomNumber (instance of supporting Un(0,1) generator).
The default supporting RandomNumber is determined by the implementation
of the RandomVector. In most cases it is Congruential
.
Modifier and Type | Field and Description |
---|---|
protected static java.util.Map<java.lang.String,java.lang.Class> |
cache
Holds a cache of the RandomVector Classes that have already been
found indexed by their name.
|
protected static java.util.Set<java.lang.String> |
searchPackages
A list of packages to search for RandomVector if the
class name given is not fully qualified.
|
protected static boolean |
verbose
If true, print out information while searching for RandomVector
Classes.
|
Modifier | Constructor and Description |
---|---|
protected |
RandomVectorFactory()
This factory Class should never by instantiated.
|
Modifier and Type | Method and Description |
---|---|
static void |
addSearchPackage(java.lang.String newPackage)
Adds the given fully qualified package name to the list of packages
that will be searched when attempting to find RandomVectors by name.
|
static java.lang.Class |
findFullyQualifiedNameFor(java.lang.String className)
Finds the RandomVector Class corresponding to the given name.
|
static java.util.Map<java.lang.String,java.lang.Class> |
getCache() |
static RandomVector |
getInstance(java.lang.Class<?> rvClass,
java.lang.Object... params)
Creates a new RandomVector using the default supporting RandomNumber and
the default seed.
|
static RandomVector |
getInstance(java.lang.Class<?> rvClass,
java.lang.Object[] params,
long seed)
Deprecated.
use getInstance(RandomNumber, Class<?>, Object...) instead
|
static RandomVector |
getInstance(java.lang.Class<?> rvClass,
java.lang.Object[] params,
long[] seed)
Deprecated.
Used getInstance(RandomNumber, Class<?>, Object...) instead
|
static RandomVector |
getInstance(RandomNumber rng,
java.lang.Class<?> rvClass,
java.lang.Object... params)
Creates a
RandomVector instance supported by the
RandomNumber instance passed in. |
static RandomVector |
getInstance(RandomNumber rng,
java.lang.String className,
java.lang.Object... parameters)
Creates a
RandomVector instance supported by the
RandomNumber instance passed in. |
static RandomVector |
getInstance(RandomVector rv)
Created a new instance of the given RandomVector.
|
static RandomVector |
getInstance(java.lang.String className,
java.lang.Object... parameters)
Creates a
RandomVector instance with default seed(s) and
the default supporting RandomNumber . |
static RandomVector |
getInstance(java.lang.String className,
java.lang.Object[] parameters,
long seed)
Deprecated.
Use getInstance(RandomNumber, String, Object...) instead
|
static java.util.Set<java.lang.String> |
getSearchPackages() |
static boolean |
isVerbose() |
static void |
setSearchPackages(java.util.Set<java.lang.String> packages) |
static void |
setVerbose(boolean b) |
protected static java.util.Map<java.lang.String,java.lang.Class> cache
protected static java.util.Set<java.lang.String> searchPackages
protected static boolean verbose
protected RandomVectorFactory()
public static void setVerbose(boolean b)
b
- true, if printing out information while searching for
RandomVector Classes.public static boolean isVerbose()
public static java.util.Map<java.lang.String,java.lang.Class> getCache()
public static RandomVector getInstance(java.lang.String className, java.lang.Object... parameters)
RandomVector
instance with default seed(s) and
the default supporting RandomNumber
.className
- The fully-qualified class name of the desired instanceparameters
- The desired parameters for the instanceRandomVector
based on the
(fully-qualified) class name and the parameters. The default
RandomNumber
instance is used with the default seed(s).java.lang.IllegalArgumentException
- If the className is null
or
a class with that name cannot be found.public static RandomVector getInstance(java.lang.String className, java.lang.Object[] parameters, long seed)
RandomVector
instance with
the default supporting RandomNumber
.className
- The fully-qualified class name of the desired instanceparameters
- The desired parameters for the instanceseed
- The seed for the supporting RandomNumber
RandomVector
based on the
(fully-qualified) class name and the parameters. The default
RandomNumber
instance is used.java.lang.IllegalArgumentException
- If the className is null
or
a class with that name cannot be found.public static RandomVector getInstance(RandomNumber rng, java.lang.String className, java.lang.Object... parameters)
RandomVector
instance supported by the
RandomNumber
instance passed in.className
- The fully-qualified class name of the desired instanceparameters
- The desired parameters for the instancerng
- An instance of RandomNumber
to support this
RandomVector.RandomVector
based on the
(fully-qualified) class name and the parameters.java.lang.IllegalArgumentException
- If the className is null
or
a class with that name cannot be found.public static RandomVector getInstance(RandomVector rv)
rv
- given RandomVectorpublic static RandomVector getInstance(java.lang.Class<?> rvClass, java.lang.Object[] params, long seed)
rvClass
- The Class of the desired RandomVector.params
- The parameters required to construct the RandomVector.seed
- The starting seed for the supporting RandomNumber.java.lang.IllegalArgumentException
- If rvClass is not a RandomVector or if
it is null
.public static RandomVector getInstance(java.lang.Class<?> rvClass, java.lang.Object[] params, long[] seed)
rvClass
- The Class of the desired RandomVector.params
- The parameters required to construct the RandomVector.seed
- The starting seeds for the supporting RandomNumber.java.lang.IllegalArgumentException
- If rvClass is not a RandomVector or if
it is null
.public static RandomVector getInstance(java.lang.Class<?> rvClass, java.lang.Object... params)
rvClass
- The Class of the desired RandomVector.params
- The parameters required to construct the RandomVector.java.lang.IllegalArgumentException
- If rvClass is not a RandomVector or if
it is null
.public static RandomVector getInstance(RandomNumber rng, java.lang.Class<?> rvClass, java.lang.Object... params)
RandomVector
instance supported by the
RandomNumber
instance passed in.rvClass
- The class object of the desired instanceparams
- The desired parameters for the instancerng
- An instance of RandomNumber
to support this
RandomVector.RandomVector
based on the
class and the parameters.java.lang.IllegalArgumentException
- If the className is null
or
a class with that name cannot be found.public static void addSearchPackage(java.lang.String newPackage)
newPackage
- given fully qualified package namepublic static void setSearchPackages(java.util.Set<java.lang.String> packages)
packages
- Set of packages that will be searched when attempting to find
a RandomVector by name.public static java.util.Set<java.lang.String> getSearchPackages()
public static java.lang.Class findFullyQualifiedNameFor(java.lang.String className)
className
- given nameaddSearchPackage(String)
,
setSearchPackages(Set)