<commit_before>package gov.nih.nci.ispy.service.annotation;

import gov.nih.nci.ispy.service.clinical.TimepointType;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class RegistrantInfo {

	private String registrationId;
	
	private List<SampleInfo> associatedSamples = new ArrayList<SampleInfo>();
	
	
	/**
	 * 
	 * @param registrationId the participant registration id
	 */
	public RegistrantInfo(String registrationId) {
	  this.registrationId = registrationId;	
	}
	
	/**
	 * Insert an id at a given position in the list of associated ids.
	 * @param index
	 * @param id
	 */
	public void addSample(SampleInfo sample) {
       associatedSamples.add(sample);
	}
	
	public List<SampleInfo> getSamplesForDataTypeAndTimepoint(ISPYDataType dataType, TimepointType timepoint) {
	  List<SampleInfo> retList = new ArrayList<SampleInfo>();
	  
	  for (SampleInfo sample : associatedSamples) {
		 if ((sample.getDataTypes().contains(dataType))&&(sample.getTimepoint()==timepoint)) {
		   retList.add(sample);
		 }
	  }
	  
	  return retList;
	}
	
	public Set<SampleInfo> getSamplesForDataTypeAndTimepoints(ISPYDataType dataType, Set<TimepointType> timepoints) {
	  	Set<SampleInfo> retSet = new HashSet<SampleInfo>();
	  	
	  	for (SampleInfo sample : associatedSamples) {
	  	  if ((sample.getDataTypes().contains(dataType))&&(timepoints.contains(sample.getTimepoint()))) {
	  		 retSet.add(sample);
	  	  }
	  	}
	  	
	  	return retSet;
	}
	
	public String toString() {
	  StringBuffer sb = new StringBuffer();
	  
	  sb.append("RegistrationId : ").append(registrationId).append("\n");
	  for (SampleInfo sample: associatedSamples) {
		  sb.append("   ").append(sample);
	  }
	  sb.append("\n");
	  return sb.toString();
	}

	public List<SampleInfo> getAssociatedSamples() {
		return associatedSamples;
	}
	
	/**
	 * Return the sample info object associated with the specified labtrack id.
	 * @param labtrackId
	 * @return
	 */
	public SampleInfo getSample(String labtrackId) {
	  for (SampleInfo si : associatedSamples) {
	     if (si.getLabtrackId().equals(labtrackId)) {
	       return si;
	     }
	  }
	  return null;
	}

	public String getRegistrationId() {
		return registrationId;
	}

}<commit_msg>see line 80 diff<commit_after>package gov.nih.nci.ispy.service.annotation;

import gov.nih.nci.ispy.service.clinical.TimepointType;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class RegistrantInfo {

	private String registrationId;
	
	private List<SampleInfo> associatedSamples = new ArrayList<SampleInfo>();
	
	
	/**
	 * 
	 * @param registrationId the participant registration id
	 */
	public RegistrantInfo(String registrationId) {
	  this.registrationId = registrationId;	
	}
	
	/**
	 * Insert an id at a given position in the list of associated ids.
	 * @param index
	 * @param id
	 */
	public void addSample(SampleInfo sample) {
       associatedSamples.add(sample);
	}
	
	public List<SampleInfo> getSamplesForDataTypeAndTimepoint(ISPYDataType dataType, TimepointType timepoint) {
	  List<SampleInfo> retList = new ArrayList<SampleInfo>();
	  
	  for (SampleInfo sample : associatedSamples) {
		 if ((sample.getDataTypes().contains(dataType))&&(sample.getTimepoint()==timepoint)) {
		   retList.add(sample);
		 }
	  }
	  
	  return retList;
	}
	
	public Set<SampleInfo> getSamplesForDataTypeAndTimepoints(ISPYDataType dataType, Set<TimepointType> timepoints) {
	  	Set<SampleInfo> retSet = new HashSet<SampleInfo>();
	  	
	  	for (SampleInfo sample : associatedSamples) {
	  	  if ((sample.getDataTypes().contains(dataType))&&(timepoints.contains(sample.getTimepoint()))) {
	  		 retSet.add(sample);
	  	  }
	  	}
	  	
	  	return retSet;
	}
	
	public String toString() {
	  StringBuffer sb = new StringBuffer();
	  
	  sb.append("RegistrationId : ").append(registrationId).append("\n");
	  for (SampleInfo sample: associatedSamples) {
		  sb.append("   ").append(sample);
	  }
	  sb.append("\n");
	  return sb.toString();
	}

	public List<SampleInfo> getAssociatedSamples() {
		return associatedSamples;
	}
	
	/**
	 * Return the sample info object associated with the specified labtrack id.
	 * @param labtrackId
	 * @return
	 */
	public SampleInfo getSample(String labtrackId) {
	  for (SampleInfo si : associatedSamples) {
	     if (si.getISPYId().equals(labtrackId) ||  si.getLabtrackId().equals(labtrackId)) {
	       return si;
	     }
	  }
	  return null;
	}

	public String getRegistrationId() {
		return registrationId;
	}

}
{'fraction_non_alphanumeric': 0.11615165461319307, 'fraction_numerical': 0.00043830813061582295, 'mean_word_length': 3.8398727465535525, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '4890646', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1379, 'n_words': 304}