package de.dhbwstuttgart.strucTypes;

import java.util.List;

import de.dhbwstuttgart.syntaxtree.Field;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
import de.dhbwstuttgart.syntaxtree.Method;

public class AS_Abstract {
	
	
	
	public static AS_Field find_AS_Field(Field f, List<AS_Abstract> ass) {
		AS_Field res = null; 
		
		for (AS_Abstract as : ass) {
			if (as.getClass().equals(AS_Field.class)) {
				AS_Field asf = (AS_Field) as; 
				if (f == asf.get_Field() ) {
					return asf; 
				}
			}
		}		
		return res; 
	}
	
	
	

	
	public static AS_Argument find_AS_Argument(FormalParameter f , List<AS_Abstract> ass  ) {
		AS_Argument res = null; 
		
		for (AS_Abstract as : ass) {
			if ( as.getClass().equals(AS_Argument.class)  ) {
				AS_Argument asa = (AS_Argument) as; 
				if (f == asa.fp) {
					res = asa; 
				}				
			}			
		}		
		return res; 	
	}
	
	

	
	public static AS_Argument find_AS_Argument(FormalParameter f, Method m , List<AS_Abstract> ass  ) {
		AS_Argument res = null; 
		
		for (AS_Abstract as : ass) {
			if ( as.getClass().equals(AS_Argument.class)  ) {
				AS_Argument asa = (AS_Argument) as; 
				if (f == asa.fp) {
					if (asa.tv_alpha.method == m) {
						res = asa; 
					}					
				}				
			}			
		}		
		return res; 	
	}
	
	
	public static AS_Argument find_AS_Argument_by_Name(String name, List<AS_Abstract> ass  ) {
		
		// if 
		AS_Argument result = null; 
		
		// else Find Assumption 
		for (AS_Abstract as : ass) {
			if (as.getClass().equals(AS_Argument.class)) {
				AS_Argument as_arg = (AS_Argument) as; 
				if (as_arg.fp.getName().equals(name)) {
					result = as_arg; 													
				}							
			}
		}		
		return result;  
	}
	
	
	public static AS_Argument find_AS_Argument_by_Name(String name, Method m, List<AS_Abstract> ass) {
		return null; 
	}
	
	
	
	
	
}
