/**
 * Copyright (c) 2012-2013, Daniele Codecasa <codecasa.job@gmail.com>,
 * Models and Algorithms for Data & Text Mining (MAD) laboratory of
 * Milano-Bicocca University, and all the CTBNCToolkit contributors
 * that will follow.
 * All rights reserved.
 *
 * @author Daniele Codecasa and all the CTBNCToolkit contributors that will follow.
 * @copyright 2012-2013 Daniele Codecasa, MAD laboratory, and all the CTBNCToolkit contributors that will follow
 */
package CTBNCToolkit;

import java.util.*;

/**
 * 
 * @author Daniele Codecasa <codecasa.job@gmail.com>
 *
 * Interface that define the classification algorithm.
 *
 * @param <TimeType> type of the time interval (Integer = discrete time, Double = continuous time)
 * @param <NodeType> node type
 */
public interface IClassifyAlgorithm<TimeType extends Number & Comparable<TimeType>, NodeType extends INode> {

	/**
	 * Set the default values for the algorithm
	 * parameters.
	 */
	public void setDefaultParameters();
	
	/**
	 * Inform if the probability calculation is
	 * enabled.
	 * 
	 * @return true if the probability calculation is enabled, false otherwise.
	 */
	public boolean probabilityFlag();
	
	/**
	 * Set the algorithm parameters.
	 * 
	 * @param params maps of the parameters represented as "parameter name" and "value"
	 * @throws IllegalArgumentException if there is some error with the parameters
	 */
	public void setParameters(Map<String,Object> params) throws IllegalArgumentException;

	/**
	 * Return a parameter value.
	 * 
	 * @param name name of the parameter
	 * @return the parameter value
	 * @throws IllegalArgumentException in case of some error
	 */
	public Object getParameter(String name) throws IllegalArgumentException;
	
	/**
	 * Return the help description for the algorithm parameters.
	 * 
	 * @return parameters help
	 */
	public String helpParameters();
	
	/**
	 * Classify the trajectory in input using the given model.
	 * The output trajectory will have the same interval as
	 * the input trajectory.
	 * 
	 * @param model the model
	 * @param trajectory the trajectory to classify
	 * @return the classification result
	 * @throws RuntimeException exception in case of errors
	 */
	public IClassificationResult<TimeType> classify(ICTClassifier<TimeType,NodeType>  model, ITrajectory<TimeType> trajectory) throws RuntimeException;
	
	/**
	 * Classify the trajectory in input using the given model.
	 * The output trajectory will be the sum of all the intervals
	 * in the input trajectory and the interval generated by
	 * the sampling.
	 * 
	 * @param model the model
	 * @param trajectory the trajectory to classify
	 * @param samplingInterval sampling interval to define a more granularity output trajectory
	 * @return the classification result
	 * @throws RuntimeException exception in case of errors
	 */
	public IClassificationResult<TimeType> classify(ICTClassifier<TimeType,NodeType>  model, ITrajectory<TimeType> trajectory, TimeType samplingInterval) throws RuntimeException;
	
	/**
	 * Classify the trajectory in input using the given model.
	 * The output trajectory will be the sum of all the intervals
	 * in the input trajectory and in the timeStream.
	 * 
	 * @param model the model
	 * @param trajectory the trajectory to classify
	 * @param timeStream sequence of time interval in which calculate the probability distribution of the class
	 * @return the classification result
	 * @throws RuntimeException exception in case of errors
	 */
	public IClassificationResult<TimeType> classify(ICTClassifier<TimeType,NodeType>  model, ITrajectory<TimeType> trajectory, Vector<TimeType> timeStream) throws RuntimeException;
}
