io.virtdata.core.ContextualBindingsArrayTemplate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of virtdata-lib-curves4 Show documentation
Show all versions of virtdata-lib-curves4 Show documentation
Statistical sampling library for use in virtualdataset libraries, based on apache commons math 4
package io.virtdata.core;
import io.virtdata.api.ValuesArrayBinder;
/**
* A template that maps a set of specifiers, a context object, and a method for applying
* mapped values to the context object. This can be used in the configuration phase, in global
* scope without triggering mapper bindings resolution from specifiers.
*
* @param The type of the contextual template object.
* @param The type which will be produced when mapped values are applied to a type C
*/
public class ContextualBindingsArrayTemplate {
private C context;
private BindingsTemplate bindingsTemplate;
private ValuesArrayBinder valuesArrayBinder;
public ContextualBindingsArrayTemplate(C context,
BindingsTemplate bindingsTemplate,
ValuesArrayBinder valuesArrayBinder) {
this.context = context;
this.bindingsTemplate = bindingsTemplate;
this.valuesArrayBinder = valuesArrayBinder;
}
public C getContext() {
return context;
}
public BindingsTemplate getBindingsTemplate() {
return bindingsTemplate;
}
public ValuesArrayBinder getValuesArrayBinder() {
return valuesArrayBinder;
}
public ContextualArrayBindings resolveBindings() {
Bindings bindings = bindingsTemplate.resolveBindings();
return new ContextualArrayBindings(bindings, context, valuesArrayBinder);
}
}