<commit_before>/**
 * 
 */
package gov.nih.nci.calab.dto.function;

import gov.nih.nci.calab.domain.nano.function.Agent;
import gov.nih.nci.calab.domain.nano.function.Attachment;
import gov.nih.nci.calab.domain.nano.function.Encapsulation;
import gov.nih.nci.calab.domain.nano.function.Linkage;
import gov.nih.nci.calab.domain.nano.function.UnclassifiedLinkage;
import gov.nih.nci.calab.service.util.CaNanoLabConstants;

/**
 * @author zengje
 * 
 */
public class LinkageBean {

	private String id;

	private String description;

	private String type;

	private AgentBean agent = new AgentBean();

	private String bondType;// for atttachments

	private String localization; // for encapsulations

	/**
	 * 
	 */
	public LinkageBean() {
		super();
		// TODO Auto-generated constructor stub
	}

	public LinkageBean(Linkage linkage) {
		this.description = linkage.getDescription();
		this.id = linkage.getId().toString();
		if (linkage instanceof Attachment) {
			bondType = ((Attachment) linkage).getBondType();
			this.type = CaNanoLabConstants.ATTACHMENT;
		} else if (linkage instanceof Encapsulation) {
			localization = ((Encapsulation) linkage).getLocalization();
			this.type = CaNanoLabConstants.ENCAPSULATION;
		} else if (linkage instanceof UnclassifiedLinkage) {
			this.type = CaNanoLabConstants.OTHER;
		}
		this.agent = new AgentBean(linkage.getAgent());
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public AgentBean getAgent() {
		return agent;
	}

	public void setAgent(AgentBean agent) {
		this.agent = agent;
	}

	public void updateDomainObj(Linkage doLinkage) {
		doLinkage.setDescription(description);
		if (type.equals(CaNanoLabConstants.ATTACHMENT)) {
			((Attachment) doLinkage).setBondType(bondType);
		} else if (type.equals(CaNanoLabConstants.ENCAPSULATION)) {
			((Encapsulation) doLinkage).setLocalization(localization);
		}
		//updateAgent(doLinkage);
	}

	public Linkage getDomainObj() {
		Linkage doLinkage = null;
		// create new instances of different types if not persisted already
		if (type.equals(CaNanoLabConstants.ATTACHMENT)) {
			doLinkage = new Attachment();
		} else if (type.equals(CaNanoLabConstants.ENCAPSULATION)) {
			doLinkage = new Encapsulation();
		} else {
			doLinkage = new UnclassifiedLinkage();
		}

		doLinkage.setDescription(description);
		if (type.equals(CaNanoLabConstants.ATTACHMENT)) {
			((Attachment) doLinkage).setBondType(bondType);
		} else if (type.equals(CaNanoLabConstants.ENCAPSULATION)) {
			((Encapsulation) doLinkage).setLocalization(localization);
		}
		//updateAgent(doLinkage);
		return doLinkage;
	}

	private void updateAgent(Linkage doLinkage) {
		Agent doAgent=null;<commit_msg>uncomment updateAgent<commit_after>/**
 * 
 */
package gov.nih.nci.calab.dto.function;

import gov.nih.nci.calab.domain.nano.function.Agent;
import gov.nih.nci.calab.domain.nano.function.Attachment;
import gov.nih.nci.calab.domain.nano.function.Encapsulation;
import gov.nih.nci.calab.domain.nano.function.Linkage;
import gov.nih.nci.calab.domain.nano.function.UnclassifiedLinkage;
import gov.nih.nci.calab.service.util.CaNanoLabConstants;

/**
 * @author zengje
 * 
 */
public class LinkageBean {

	private String id;

	private String description;

	private String type;

	private AgentBean agent = new AgentBean();

	private String bondType;// for atttachments

	private String localization; // for encapsulations

	/**
	 * 
	 */
	public LinkageBean() {
		super();
		// TODO Auto-generated constructor stub
	}

	public LinkageBean(Linkage linkage) {
		this.description = linkage.getDescription();
		this.id = linkage.getId().toString();
		if (linkage instanceof Attachment) {
			bondType = ((Attachment) linkage).getBondType();
			this.type = CaNanoLabConstants.ATTACHMENT;
		} else if (linkage instanceof Encapsulation) {
			localization = ((Encapsulation) linkage).getLocalization();
			this.type = CaNanoLabConstants.ENCAPSULATION;
		} else if (linkage instanceof UnclassifiedLinkage) {
			this.type = CaNanoLabConstants.OTHER;
		}
		this.agent = new AgentBean(linkage.getAgent());
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public AgentBean getAgent() {
		return agent;
	}

	public void setAgent(AgentBean agent) {
		this.agent = agent;
	}

	public void updateDomainObj(Linkage doLinkage) {
		doLinkage.setDescription(description);
		if (type.equals(CaNanoLabConstants.ATTACHMENT)) {
			((Attachment) doLinkage).setBondType(bondType);
		} else if (type.equals(CaNanoLabConstants.ENCAPSULATION)) {
			((Encapsulation) doLinkage).setLocalization(localization);
		}
		updateAgent(doLinkage);
	}

	public Linkage getDomainObj() {
		Linkage doLinkage = null;
		// create new instances of different types if not persisted already
		if (type.equals(CaNanoLabConstants.ATTACHMENT)) {
			doLinkage = new Attachment();
		} else if (type.equals(CaNanoLabConstants.ENCAPSULATION)) {
			doLinkage = new Encapsulation();
		} else {
			doLinkage = new UnclassifiedLinkage();
		}

		doLinkage.setDescription(description);
		if (type.equals(CaNanoLabConstants.ATTACHMENT)) {
			((Attachment) doLinkage).setBondType(bondType);
		} else if (type.equals(CaNanoLabConstants.ENCAPSULATION)) {
			((Encapsulation) doLinkage).setLocalization(localization);
		}
		updateAgent(doLinkage);
		return doLinkage;
	}

	private void updateAgent(Linkage doLinkage) {
		Agent doAgent=null;
{'fraction_non_alphanumeric': 0.1162007409902324, 'fraction_numerical': 0.0, 'mean_word_length': 4.468692449355433, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2554289', 'n_tokens_mistral': 2180, 'n_tokens_neox': 1956, 'n_words': 392}