<commit_before>package be.kuleuven.cs.distrinet.chameleon.oo.method;

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

import be.kuleuven.cs.distrinet.chameleon.core.declaration.Declaration;
import be.kuleuven.cs.distrinet.chameleon.core.declaration.DeclarationContainer;
import be.kuleuven.cs.distrinet.chameleon.core.declaration.Signature;
import be.kuleuven.cs.distrinet.chameleon.core.element.Element;
import be.kuleuven.cs.distrinet.chameleon.core.lookup.DeclarationSelector;
import be.kuleuven.cs.distrinet.chameleon.core.lookup.LookupContext;
import be.kuleuven.cs.distrinet.chameleon.core.lookup.LookupException;
import be.kuleuven.cs.distrinet.chameleon.core.lookup.Target;
import be.kuleuven.cs.distrinet.chameleon.oo.member.DeclarationWithParametersHeader;
import be.kuleuven.cs.distrinet.chameleon.oo.member.DeclarationWithParametersSignature;
import be.kuleuven.cs.distrinet.chameleon.oo.member.Member;
import be.kuleuven.cs.distrinet.chameleon.oo.member.MemberImpl;
import be.kuleuven.cs.distrinet.chameleon.oo.type.DeclarationWithType;
import be.kuleuven.cs.distrinet.chameleon.oo.type.Type;
import be.kuleuven.cs.distrinet.chameleon.oo.type.generics.TypeParameter;
import be.kuleuven.cs.distrinet.chameleon.oo.variable.FormalParameter;
import be.kuleuven.cs.distrinet.chameleon.util.Util;
import be.kuleuven.cs.distrinet.chameleon.util.association.Single;

public abstract class DeclarationWithParameters extends MemberImpl implements DeclarationContainer, Target, DeclarationWithType {

	/**
	 * Initialize a new method with the given header.
	 * @param header
	 */
 /*@
   @ public behavior
   @
   @ post header() == header;
   @*/ 
	public DeclarationWithParameters(MethodHeader header) {
		setHeader(header);
	}
	
	protected DeclarationWithParameters() {
		
	}
	
	/**
	 * Set the header of this method.
	 * @param header
	 */
	public void setHeader(MethodHeader header) {
	  set(_header,header);
	}
	  
	  /**
	   * Return the signature of this member.
	   */
	  public MethodHeader header() {
	    return _header.getOtherEnd();
	  }
	  
	  private Single<MethodHeader> _header = new Single<MethodHeader>(this,true);
	
		public DeclarationWithParametersSignature signature() {
			return header().signature();
		}
		
		public void setSignature(Signature signature) {
			setHeader((MethodHeader) header().createFromSignature(signature));
		}
		
		public void setName(String name) {
			header().setName(name);
		}
		
		public List<TypeParameter> typeParameters() {
		  return header().typeParameters();
		}
		
		/**
		 * Return the index-th type parameter. Indices start at 1.
		 */
		public TypeParameter typeParameter(int index) {
			return header().typeParameter(index);
		}


		
		/**
		 * Return a string representation for the name of the method. This is just a convenience method.
		 * DO NOT USE IT TO IDENTIFY ELEMENTS! The signature is used for identification, not just the name.
		 * @return
		 */
		public String name() {
			DeclarationWithParametersHeader header = header();
			if(header != null) {
			  return header.name();
			} else {
				return null;<commit_msg>added nbTypeParameters to avoid typeParameters().size()<commit_after>package be.kuleuven.cs.distrinet.chameleon.oo.method;

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

import be.kuleuven.cs.distrinet.chameleon.core.declaration.Declaration;
import be.kuleuven.cs.distrinet.chameleon.core.declaration.DeclarationContainer;
import be.kuleuven.cs.distrinet.chameleon.core.declaration.Signature;
import be.kuleuven.cs.distrinet.chameleon.core.element.Element;
import be.kuleuven.cs.distrinet.chameleon.core.lookup.DeclarationSelector;
import be.kuleuven.cs.distrinet.chameleon.core.lookup.LookupContext;
import be.kuleuven.cs.distrinet.chameleon.core.lookup.LookupException;
import be.kuleuven.cs.distrinet.chameleon.core.lookup.Target;
import be.kuleuven.cs.distrinet.chameleon.oo.member.DeclarationWithParametersHeader;
import be.kuleuven.cs.distrinet.chameleon.oo.member.DeclarationWithParametersSignature;
import be.kuleuven.cs.distrinet.chameleon.oo.member.Member;
import be.kuleuven.cs.distrinet.chameleon.oo.member.MemberImpl;
import be.kuleuven.cs.distrinet.chameleon.oo.type.DeclarationWithType;
import be.kuleuven.cs.distrinet.chameleon.oo.type.Type;
import be.kuleuven.cs.distrinet.chameleon.oo.type.generics.TypeParameter;
import be.kuleuven.cs.distrinet.chameleon.oo.variable.FormalParameter;
import be.kuleuven.cs.distrinet.chameleon.util.Util;
import be.kuleuven.cs.distrinet.chameleon.util.association.Single;

public abstract class DeclarationWithParameters extends MemberImpl implements DeclarationContainer, Target, DeclarationWithType {

	/**
	 * Initialize a new method with the given header.
	 * @param header
	 */
 /*@
   @ public behavior
   @
   @ post header() == header;
   @*/ 
	public DeclarationWithParameters(MethodHeader header) {
		setHeader(header);
	}
	
	protected DeclarationWithParameters() {
		
	}
	
	/**
	 * Set the header of this method.
	 * @param header
	 */
	public void setHeader(MethodHeader header) {
	  set(_header,header);
	}
	  
	  /**
	   * Return the signature of this member.
	   */
	  public MethodHeader header() {
	    return _header.getOtherEnd();
	  }
	  
	  private Single<MethodHeader> _header = new Single<MethodHeader>(this,true);
	
		public DeclarationWithParametersSignature signature() {
			return header().signature();
		}
		
		public void setSignature(Signature signature) {
			setHeader((MethodHeader) header().createFromSignature(signature));
		}
		
		public void setName(String name) {
			header().setName(name);
		}
		
		public List<TypeParameter> typeParameters() {
		  return header().typeParameters();
		}
		
		public int nbTypeParameters() {
			return header().nbTypeParameters();
		}
		
		/**
		 * Return the index-th type parameter. Indices start at 1.
		 */
		public TypeParameter typeParameter(int index) {
			return header().typeParameter(index);
		}


		
		/**
		 * Return a string representation for the name of the method. This is just a convenience method.
		 * DO NOT USE IT TO IDENTIFY ELEMENTS! The signature is used for identification, not just the name.
		 * @return
		 */
		public String name() {
			DeclarationWithParametersHeader header = header();
			if(header != null) {
			  return header.name();
			} else {
				return null;
{'fraction_non_alphanumeric': 0.10866814299272382, 'fraction_numerical': 0.00031635558367605187, 'mean_word_length': 4.349407783417936, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7663402', 'n_tokens_mistral': 2201, 'n_tokens_neox': 2000, 'n_words': 378}