package de.dhbwstuttgart.strucTypes;

import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.statement.MethodCall;

/* Formal Idea: 
 * 
 * Mue( c , m , c` , (c`, c_all  )) 
 * means c provides a method m applicable to the arguments of type c, with return type c' and parameters of type c
 * 
 * Mue( class , method or methodname  , Arguments[] , ( B , Parameters []   ) 
 * 
 */

public class TC_Method extends TC_Abstract {
	
	// Not completely implemented in the moment 
	private ClassOrInterface cl; 
	private TV_Abstract typvar; 
	private Method method; 
	private MethodCall method_call; 
	
	// variante 1 -> Klasse ist bekannt 
	public TC_Method(ClassOrInterface cl, Method method ) {
		super(); 
		this.cl = cl; 
		this.method = method; 	
		typvar = null; 		
	}
	
	// variante 2 -> Klasse ist nicht bekannt
	public TC_Method(TV_Abstract typvar, MethodCall method_call) {
		super(); 
		this.cl = null; 
		this.method = null; 
		this.typvar = typvar; 
		this.method_call = method_call;  
	}
	
	
	
	
	public String toString() {		
		
		if (cl != null) {
		return "Mue( " + cl.getClassName().toString() + "," + method.getName() + "...)" ; 	
		}
		else {
			return String.format("Mue( %s , %s ..."  , typvar.toString() , method_call.get_Name()  ); 
		}
	}
	
	
	

}
