 package crml.compiler.translation;

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

public class Signature {
	
	enum Type {
		FUNCTION,
		OPERATOR,
		BLOCK,
		SET_OP //arrays in set operators need to be expanded 
	}
	
	List <String> variable_names;
	List <String> variable_types;
	List <Boolean> variable_is_set; // which variables are sets
	
	String function_name;
	String return_name;
	String return_type;
	Boolean wrapBoolean; // needs to be wrapped into a boolean return
	Type 	mtype = Type.BLOCK; // maps to a block by default
	Boolean is_return_set;
	String temp_var_name; // sets a name to avoid variable names like '==0'

	String associated_category = null;

	public Signature() {
		variable_names = new Vector<String>();
		variable_types = new Vector<String>();
	}

	public Signature(String name, List<String> params, String return_t, Type t) {
		this.function_name = name;
		this.mtype = t;
		this.variable_types = params;
		this.return_type = return_t;
		this.variable_is_set = new ArrayList<Boolean>();
		for (int i=0; i < params.size(); i++){
			this.variable_is_set.add(false);
		}
		this.is_return_set=false;
		this.temp_var_name = name; // unless otherwise specified
	}
	
	public Signature(String name, List<String> params, String return_t, String out_var_name, Type t) {
		this(name, params, return_t, t);
		this.temp_var_name = out_var_name; 
	}
	
	public Signature(String name, List<String> params, List<String> param_names, String return_t, Type t) {
		this(name, params, return_t, t);
		this.variable_names= param_names;
	}
	
	public Signature(String name, List<String> params, List<String> param_names, String return_t, String out_var_name, Type t) {
		this(name, params, param_names, return_t, t); 
		this.temp_var_name = out_var_name; 
	}
	
	public Signature(String name, List<String> params, List<String> param_names, String return_t, Type t, List<Boolean> isSet, Boolean returnSet) {
		this(name, params, param_names, return_t, t); 
		this.variable_is_set = isSet;
		this.is_return_set=returnSet;
	}
	
	public Signature(String name, List<String> params, List<String> param_names, String return_t, Type t, String out_var_name, List<Boolean> isSet, Boolean returnSet) {
		this(name, params, param_names, return_t, t); 
		this.is_return_set=returnSet;
		this.temp_var_name = out_var_name;
	}

	public void setCategory(String name){
		associated_category=name;
	}

	public String getCategory(){
		return associated_category;
	}

}
