java.lang.Object
io.jenetics.prog.regression.SampleBuffer<T>
- All Implemented Interfaces:
Sampling<T>
This class holds the actual sample values which are used for the symbolic
regression example. This class is thread-safe and can be used in a
producer-consumer setup. You can add single sample values
(
add(Sample)
) or a list (addAll(Collection)
) of new values.
These values will be made available for evaluation after an explicit call of
the publish()
method.- Since:
- 6.0
- Version:
- 6.0
- Implementation Note:
- This class is thread-safe.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jenetics.prog.regression.Sampling
Sampling.Result<T>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adding a new sample point to the buffer.void
addAll
(Collection<? extends Sample<? extends T>> samples) The given sample points to the buffer.Evaluates the givenprogram
tree with its sample points.Evaluates the givenfunction
tree with its sample points.int
publish()
Making the current sample points available for theeval(Tree)
function.
-
Constructor Details
-
SampleBuffer
-
-
Method Details
-
add
Adding a new sample point to the buffer. You need to explicitly callpublish()
to make it available for theeval(Tree)
method.- Parameters:
sample
- the sample point to add- Throws:
NullPointerException
- if the givensample
point isnull
-
addAll
The given sample points to the buffer. You need to explicitly callpublish()
to make it available for theeval(Tree)
method.- Parameters:
samples
- the samples to add to the buffer- Throws:
NullPointerException
- if the givensamples
isnull
-
publish
Making the current sample points available for theeval(Tree)
function.- Returns:
- the number of published sample points
-
eval
Description copied from interface:Sampling
Evaluates the givenprogram
tree with its sample points. The returned result object may benull
if no sample point has been added to the sampling when calling theeval
method. -
eval
Description copied from interface:Sampling
Evaluates the givenfunction
tree with its sample points. The returned result object may benull
if no sample point has been added to the sampling when calling theeval
method.
-