<commit_before>package gov.nih.nci.calab.dto.characterization;

import gov.nih.nci.calab.domain.nano.characterization.physical.Morphology;
import gov.nih.nci.calab.domain.nano.characterization.Characterization;
import gov.nih.nci.calab.domain.nano.characterization.DerivedBioAssayData;

import java.util.List;


/**
 * This class represents the Morphology characterization information to be shown in
 * the view page.
 * 
 * @author pansu
 * 
 */
public class MorphologyBean extends CharacterizationBean {
	private String type;
	
	public MorphologyBean() {
		super();
		initSetup();
	}
	
	public MorphologyBean(Characterization aChar) {
		super(aChar);
		/*
		this.setCharacterizationSource(aChar.getSource());
		this.setViewTitle(aChar.getIdentificationName());
		this.setDescription(aChar.getDescription());
		if (aChar.getInstrument() != null) {
			this.getInstrument().setType(aChar.getInstrument().getInstrumentType().getName());
			this.getInstrument().setDescription(aChar.getInstrument().getDescription());
			this.getInstrument().setManufacturer(aChar.getInstrument().getManufacturer().getName());
		}
		this.setNumberOfDerivedBioAssayData(Integer.valueOf(aChar.getDerivedBioAssayDataCollection().size()).toString());
		for (DerivedBioAssayData table : aChar.getDerivedBioAssayDataCollection()) {
			DerivedBioAssayDataBean ctBean = new DerivedBioAssayDataBean(table);
			this.getDerivedBioAssayData().add(ctBean);
		}
		if (aChar.getCharacterizationProtocol() != null) {
			this.getCharacterizationProtocol().setId(aChar.getCharacterizationProtocol().getId());
			this.getCharacterizationProtocol().setName(aChar.getCharacterizationProtocol().getName());
			this.getCharacterizationProtocol().setVersion(aChar.getCharacterizationProtocol().getVersion());
		}
		*/
	}
	
	public void setDerivedBioAssayData(
			List<DerivedBioAssayDataBean> derivedBioAssayData) {
		super.setDerivedBioAssayData(derivedBioAssayData);
		initSetup();
	}
	
	public void initSetup() {
		for (DerivedBioAssayDataBean table:getDerivedBioAssayData()) {
			DatumBean average=new DatumBean();
			average.setType("Average");
			average.setValueUnit("nm");
			DatumBean zaverage=new DatumBean();
			zaverage.setType("Z-Average");
			zaverage.setValueUnit("nm");
			DatumBean pdi=new DatumBean();
			pdi.setType("PDI");
			table.getDatumList().add(average);
			table.getDatumList().add(zaverage);
			table.getDatumList().add(pdi);
		}
	}
	
	public Morphology getDomainObj() {
		Morphology morphology = new Morphology();
		super.updateDomainObj(morphology);
		return morphology;
	}

	public String getType() {
		return type;
	}
<commit_msg>added code to handle morphology's type.<commit_after>package gov.nih.nci.calab.dto.characterization;

import gov.nih.nci.calab.domain.nano.characterization.physical.Morphology;
import gov.nih.nci.calab.domain.nano.characterization.Characterization;
import gov.nih.nci.calab.domain.nano.characterization.DerivedBioAssayData;

import java.util.List;


/**
 * This class represents the Morphology characterization information to be shown in
 * the view page.
 * 
 * @author pansu
 * 
 */
public class MorphologyBean extends CharacterizationBean {
	private String type;
	
	public MorphologyBean() {
		super();
		initSetup();
	}
	
	public MorphologyBean(Morphology aChar) {
		super(aChar);
		/*
		this.setCharacterizationSource(aChar.getSource());
		this.setViewTitle(aChar.getIdentificationName());
		this.setDescription(aChar.getDescription());
		if (aChar.getInstrument() != null) {
			this.getInstrument().setType(aChar.getInstrument().getInstrumentType().getName());
			this.getInstrument().setDescription(aChar.getInstrument().getDescription());
			this.getInstrument().setManufacturer(aChar.getInstrument().getManufacturer().getName());
		}
		this.setNumberOfDerivedBioAssayData(Integer.valueOf(aChar.getDerivedBioAssayDataCollection().size()).toString());
		for (DerivedBioAssayData table : aChar.getDerivedBioAssayDataCollection()) {
			DerivedBioAssayDataBean ctBean = new DerivedBioAssayDataBean(table);
			this.getDerivedBioAssayData().add(ctBean);
		}
		if (aChar.getCharacterizationProtocol() != null) {
			this.getCharacterizationProtocol().setId(aChar.getCharacterizationProtocol().getId());
			this.getCharacterizationProtocol().setName(aChar.getCharacterizationProtocol().getName());
			this.getCharacterizationProtocol().setVersion(aChar.getCharacterizationProtocol().getVersion());
		}
		*/
		this.type = aChar.getType();
	}
	
	public void setDerivedBioAssayData(
			List<DerivedBioAssayDataBean> derivedBioAssayData) {
		super.setDerivedBioAssayData(derivedBioAssayData);
		initSetup();
	}
	
	public void initSetup() {
		for (DerivedBioAssayDataBean table:getDerivedBioAssayData()) {
			DatumBean average=new DatumBean();
			average.setType("Average");
			average.setValueUnit("nm");
			DatumBean zaverage=new DatumBean();
			zaverage.setType("Z-Average");
			zaverage.setValueUnit("nm");
			DatumBean pdi=new DatumBean();
			pdi.setType("PDI");
			table.getDatumList().add(average);
			table.getDatumList().add(zaverage);
			table.getDatumList().add(pdi);
		}
	}
	
	public Morphology getDomainObj() {
		Morphology morphology = new Morphology();
		super.updateDomainObj(morphology);
		
		morphology.setType(this.type);
		
		return morphology;
	}

	public String getType() {
		return type;
	}

{'fraction_non_alphanumeric': 0.1286143447239955, 'fraction_numerical': 0.0, 'mean_word_length': 5.803320561941252, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2141872', 'n_tokens_mistral': 1902, 'n_tokens_neox': 1654, 'n_words': 232}