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

gov.sandia.cognition.framework.learning.EvaluatorBasedCognitiveModuleSettings Maven / Gradle / Ivy

There is a newer version: 4.0.1
Show newest version
/*
 * File:                EvaluatorBasedCognitiveModuleSettings.java
 * Authors:             Justin Basilico and Kevin R. Dixon
 * Company:             Sandia National Laboratories
 * Project:             Cognitive Framework Lite
 *
 * Copyright June 21, 2007, 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.framework.learning;

import gov.sandia.cognition.framework.learning.converter.CogxelConverter;
import gov.sandia.cognition.framework.CognitiveModuleSettings;
import gov.sandia.cognition.evaluator.Evaluator;
import java.io.Serializable;

/**
 * The EvaluatorBasedCognitiveModuleSettings class implements the settings for
 * the EvaluatorBasedCognitiveModule. It contains the evaluator to be wrapped
 * along with the converters to convert the input Cogxels to the InputType and
 * the OutputType back to Cogxels.
 *
 * @param  Input type of the embedded Evaluator
 * @param  Output type of the embedded Evaluator
 * @author Justin Basilico
 * @author Kevin R. Dixon
 * @since  2.0
 */
public class EvaluatorBasedCognitiveModuleSettings
    extends Object
    implements CognitiveModuleSettings, Serializable
{
    /** The evaluator to be used by the module. */
    private Evaluator evaluator;
    
    /** The CogxelConverter used to convert from a CogxelState to InputType. */
    private CogxelConverter inputConverter;
    
    /** The CogxelConverter used to convert OutputType to a CogxelState. */
    private CogxelConverter outputConverter;
    
    /**
     * Creates a new instance of EvaluatorBasedCognitiveModuleSettings.
     */
    public EvaluatorBasedCognitiveModuleSettings()
    {
        this(null, null, null);
    }
    
    /**
     * Creates a new instance of EvaluatorBasedCognitiveModuleSettings.
     *
     * @param  evaluator The evaluator to be used by the module.
     * @param  inputConverter The CogxelConverter used to convert from a 
     *         CogxelState to InputType.
     * @param  outputConverter The CogxelConverter used to convert OutputType to 
     *         a CogxelState.
     */
    public EvaluatorBasedCognitiveModuleSettings(
        Evaluator evaluator,
        CogxelConverter inputConverter,
        CogxelConverter outputConverter)
    {
        super();
        
        this.setEvaluator(evaluator);
        this.setInputConverter(inputConverter);
        this.setOutputConverter(outputConverter);
    }
    
    /**
     * Creates a new instance of EvaluatorBasedCognitiveModuleSettings that is
     * a copy of the given EvaluatorBasedCognitiveModuleSettings. This involves
     * cloning the input and output converters and passing a reference to the
     * evaluator to be used.
     *
     * @param  other The other EvaluatorBasedCognitiveModuleSettings to copy.
     */
    public EvaluatorBasedCognitiveModuleSettings(
        EvaluatorBasedCognitiveModuleSettings other)
    {
        this(other.getEvaluator(),
            other.getInputConverter().clone(),
            other.getOutputConverter().clone());
    }
    
    /**
     * Creates a clone of this EvaluatorBasedCognitiveModuleSettings. For
     * this clone the input converter and output converter are cloned, but
     * the evaluator is passed by reference.
     *
     * @return A clone of this object.
     */
    @Override
    public EvaluatorBasedCognitiveModuleSettings clone()
    {
        return new EvaluatorBasedCognitiveModuleSettings(
            this);
    }
    
    /**
     * Gets the evaluator to be used by the module.
     *
     * @return The evaluator to be used by the module.
     */
    public Evaluator getEvaluator()
    {
        return this.evaluator;
    }

    /**
     * Sets the evaluator to be used by the module.
     *
     * @param  evaluator The evaluator to be used by the module.
     */
    public void setEvaluator(
        Evaluator evaluator)
    {
        this.evaluator = evaluator;
    }
    
    /**
     * Gets the CogxelConverter used to convert from a CogxelState to InputType.
     *
     * @return The CogxelConverter used to convert from a CogxelState to 
     *         InputType.
     */
    public CogxelConverter getInputConverter()
    {
        return inputConverter;
    }

    /** 
     * Sets the CogxelConverter used to convert from a CogxelState to InputType.
     *
     * @param  inputConverter The CogxelConverter used to convert from a 
     *         CogxelState to InputType.
     */
    public void setInputConverter(
        CogxelConverter inputConverter)
    {
        this.inputConverter = inputConverter;
    }

    /** 
     * Gets the CogxelConverter used to convert OutputType to a CogxelState.
     *
     * @return The CogxelConverter used to convert OutputType to a CogxelState.
     */
    public CogxelConverter getOutputConverter()
    {
        return outputConverter;
    }

    /**
     * Sets the CogxelConverter used to convert OutputType to a CogxelState.
     *
     * @param  outputConverter The CogxelConverter used to convert OutputType to
     *         a CogxelState.
     */
    public void setOutputConverter(
        CogxelConverter outputConverter)
    {
        this.outputConverter = outputConverter;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy