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

gov.sandia.cognition.framework.learning.converter.CogxelInputOutputPairConverter Maven / Gradle / Ivy

/*
 * File:                InputOutputPairCogxelConverter.java
 * Authors:             Justin Basilico and Kevin R. Dixon
 * Company:             Sandia National Laboratories
 * Project:             Cognitive Foundry
 *
 * Copyright June 25, 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.converter;

import gov.sandia.cognition.framework.SemanticIdentifierMap;
import gov.sandia.cognition.learning.data.DefaultInputOutputPair;
import gov.sandia.cognition.learning.data.InputOutputPair;

/**
 * The InputOutputPairCogxelConverter class implements a converter to and from 
 * Cogxels to InputOutputPair objects. This is done by specifying two sub
 * converters: one for the input type and one for the output type.
 *
 * @param  Type of input to convert into the inputs of the 
 * InputOutputPairs
 * @param  Type of outputs to convert into the outputs of the
 * InputOutputPairs
 * @author Justin Basilico
 * @author Kevin R. Dixon
 * @since  2.0
 */
public class CogxelInputOutputPairConverter
    extends AbstractCogxelPairConverter>
    implements CogxelConverter>
{
    
    /**
     * Default constructor
     */
    public CogxelInputOutputPairConverter()
    {
        this( null, null );
    }
    
    /**
     * Creates a new instance of InputOutputCogxelConverter.
     *
     * @param  inputConverter The CogxelConverter for the input element of the 
     *         pair.
     * @param  outputConverter The CogxelConverter for the output element of the
     *         pair.
     */
    public CogxelInputOutputPairConverter(
        CogxelConverter inputConverter,
        CogxelConverter outputConverter )
    {
        this( inputConverter, outputConverter, null );
    }
    
    
    /**
     * Creates a new instance of InputOutputCogxelConverter.
     *
     * @param  inputConverter The CogxelConverter for the input element of the 
     *         pair.
     * @param  outputConverter The CogxelConverter for the output element of the
     *         pair.
     * @param  semanticIdentifierMap The SemanticIdentifierMap used by the
     *         converter.
     */
    public CogxelInputOutputPairConverter(
        CogxelConverter inputConverter,
        CogxelConverter outputConverter,
        SemanticIdentifierMap semanticIdentifierMap)
    {
        super( inputConverter, outputConverter, semanticIdentifierMap );
    }
    
    @Override
    public boolean equals(
        final Object other)
    {
        return other instanceof CogxelInputOutputPairConverter
            && super.equals(other);
    }

    @Override
    public int hashCode()
    {
        return super.hashCode();
    }
    
    @Override
    public InputOutputPair createPair(
        InputType first,
        OutputType second )
    {
        return new DefaultInputOutputPair( first, second );
    }
    
    /**
     * Gets the input converter
     * @return Input converter
     */
    public CogxelConverter getInputConverter()
    {
        return this.getFirstConverter();
    }
    
    /**
     * Gets the output converter
     * @return Output converter
     */
    public CogxelConverter getOutputConverter()
    {
        return this.getSecondConverter();
    }
            
    /**
     * Sets the input converter
     * @param inputConverter Input converter
     */
    public void setInputConverter(
        CogxelConverter inputConverter )
    {
        this.setFirstConverter( inputConverter );
    }
    
    /**
     * Sets the output converter
     * @param outputConverter Output converter
     */
    public void setOutputConverter(
        CogxelConverter outputConverter )
    {
        this.setSecondConverter( outputConverter );
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy