public final class Bo2ObjectTube extends java.lang.Object implements Bo2ObjectProvider
WPObject.ATTRIBUTE_FREQUENCY
attributes).Constructor and Description |
---|
Bo2ObjectTube(java.lang.String name,
java.util.List<WPObject> objects) |
Modifier and Type | Method and Description |
---|---|
Bo2ObjectTube |
clone()
Create a deep copy of the object provider.
|
java.util.List<WPObject> |
getAllObjects()
Obtain a list of all different
WPObject s which this
object provider can return. |
java.lang.String |
getName()
Get the name of this object provider (if it represents one object this
may be the name of the object).
|
WPObject |
getObject()
Obtain one
WPObject , which may be the same one every time, or a
different one from a random collection or sequence every time. |
static Bo2ObjectTube |
load(java.io.File dir)
Create a new
Bo2ObjectTube containing all supported custom
objects from a specific directory. |
static Bo2ObjectTube |
load(java.lang.String name,
java.util.Collection<java.io.File> files)
Create a new
Bo2ObjectTube with a specific name from a list
of specific custom object files. |
static Bo2ObjectTube |
load(java.lang.String name,
java.io.File dir)
Create a new
Bo2ObjectTube with a specific name, containing
all supported custom objects from a specific directory. |
void |
setSeed(long seed)
Sets the seed of the PRNG, for object providers which use one.
|
public Bo2ObjectTube(java.lang.String name, java.util.List<WPObject> objects)
public java.lang.String getName()
Bo2ObjectProvider
getName
in interface Bo2ObjectProvider
public void setSeed(long seed)
Bo2ObjectProvider
setSeed
in interface Bo2ObjectProvider
seed
- The seed to set on the PRNG, if any.public WPObject getObject()
Bo2ObjectProvider
WPObject
, which may be the same one every time, or a
different one from a random collection or sequence every time.getObject
in interface Bo2ObjectProvider
WPObject
.public java.util.List<WPObject> getAllObjects()
Bo2ObjectProvider
WPObject
s which this
object provider can return. This is an optional operation which may
throw an UnsupportedOperationException
if this object provider
does not support it.getAllObjects
in interface Bo2ObjectProvider
public Bo2ObjectTube clone()
Bo2ObjectProvider
clone
in interface Bo2ObjectProvider
clone
in class java.lang.Object
public static Bo2ObjectTube load(java.io.File dir) throws java.io.IOException
Bo2ObjectTube
containing all supported custom
objects from a specific directory. The name of the
Bo2ObjectTube
will be set to the name of the directory.dir
- The directory containing the objects to load.Bo2ObjectTube
containing the supported objects
from the specified directory.java.io.IOException
- If there was an I/O error reading one of the files.public static Bo2ObjectTube load(java.lang.String name, java.io.File dir) throws java.io.IOException
Bo2ObjectTube
with a specific name, containing
all supported custom objects from a specific directory.name
- The name of the new Bo2ObjectTube
.dir
- The directory containing the objects to load.Bo2ObjectTube
containing the supported objects
from the specified directory.java.io.IOException
- If there was an I/O error reading one of the files.public static Bo2ObjectTube load(java.lang.String name, java.util.Collection<java.io.File> files) throws java.io.IOException
Bo2ObjectTube
with a specific name from a list
of specific custom object files.name
- The name of the new Bo2ObjectTube
.files
- The list of files containing the objects to load.Bo2ObjectTube
containing the custom objects
from the specified file(s).java.io.IOException
- If there was an I/O error reading one of the files.