All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gov.sandia.cognition.learning.algorithm.AbstractBatchLearnerContainer Maven / Gradle / Ivy

There is a newer version: 4.0.1
Show newest version
/*
 * File:                BatchLearnerWrapper.java
 * Authors:             Justin Basilico
 * Company:             Sandia National Laboratories
 * Project:             Cognitive Foundry
 * 
 * Copyright April 08, 2009, Sandia Corporation.
 * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive 
 * license for use of this work by or on behalf of the U.S. Government. Export 
 * of this program may require a license from the United States Government. 
 * See CopyrightHistory.txt for complete details.
 * 
 */

package gov.sandia.cognition.learning.algorithm;

import gov.sandia.cognition.util.AbstractCloneableSerializable;
import gov.sandia.cognition.util.ObjectUtil;

/**
 * An abstract class for objects that contain a batch learning algorithm.
 * 
 * @param 
 *      Type of the learning algorithm contained in the object.
 * @author  Justin Basilico
 * @since   3.0
 */
public class AbstractBatchLearnerContainer>
    extends AbstractCloneableSerializable
    implements BatchLearnerContainer
{

    /** The wrapped learner. */
    protected LearnerType learner;

    /**
     * Creates a new {@code AbstractBatchLearnerWrapper} with a null learner.
     */
    public AbstractBatchLearnerContainer()
    {
        this(null);
    }

    /**
     * Creates a new {@code AbstractBatchLearnerWrapper} with the given learner.
     *
     * @param   learner
     *      The wrapped learner.
     */
    public AbstractBatchLearnerContainer(
        final LearnerType learner)
    {
        super();

        this.setLearner(learner);
    }

    @Override
    public AbstractBatchLearnerContainer clone()
    {
        @SuppressWarnings("unchecked")
        final AbstractBatchLearnerContainer clone =
            (AbstractBatchLearnerContainer) super.clone();
        clone.setLearner(ObjectUtil.cloneSafe(this.getLearner()));
        return clone;
    }

    /**
     * Gets the wrapped learner.
     *
     * @return
     *      The wrapped learner.
     */
    public LearnerType getLearner()
    {
        return this.learner;
    }

    /**
     * Sets the wrapped learner.
     *
     * @param   learner
     *      The wrapped learner.
     */
    public void setLearner(
        final LearnerType learner)
    {
        this.learner = learner;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy