<commit_before>package be.shoktan.BeeBreedingManager.model;

import java.util.Collection;

import javax.persistence.Entity;
import javax.persistence.ManyToMany;

/**
 * Class to regroup bees or other group of bees to simplify mutation description
 * @author Wisthy
 *
 */
@Entity
public class Group extends Specification {
	
	@ManyToMany(mappedBy = "groups")
	private Collection<Specification> members;
	
	
	
	// ********** getters & setters ********** //

	/**
	 * @return the members
	 */
	public Collection<Specification> getMembers() {
		return members;
	}

	/**
	 * @param members the members to set
	 */
	public void setMembers(Collection<Specification> members) {
		this.members = members;
	}
	
	
	
	// ********** others ********** //

	/*
	 * (non-Javadoc)
	 * @see be.shoktan.BeeBreedingManager.model.Specification#getType()
	 */
	@Override
	protected ESpecificationType getType() {
		return ESpecificationType.group;
	}
}
<commit_msg>Update Group.java<commit_after>package be.shoktan.BeeBreedingManager.model;

import java.util.Collection;
import java.util.Iterator;
import java.util.TreeSet;

import javax.persistence.Entity;
import javax.persistence.ManyToMany;

/**
 * Class to regroup bees or other group of bees to simplify mutation description
 * @author Wisthy
 *
 */
@Entity
public class Group extends Specification {
	
	@ManyToMany(mappedBy = "groups")
	private Collection<Specification> members;
	
	
	
	// ********** getters & setters ********** //

	/**
	 * @return the members
	 */
	public Collection<Specification> getMembers() {
		return members;
	}

	/**
	 * @param members the members to set
	 */
	public void setMembers(Collection<Specification> members) {
		this.members = new TreeSet<>();
		for(Specification member : members){
			this.addMember(member);
		}
	}
	
	
	
	// ********** others ********** //

	/*
	 * (non-Javadoc)
	 * @see be.shoktan.BeeBreedingManager.model.Specification#getType()
	 */
	@Override
	protected ESpecificationType getType() {
		return ESpecificationType.group;
	}
	
	/**
	 * Add a specification to this group 
	 * @param member the specification to add
	 */
	public void addMember(Specification member){
		addMember(member, true);
	}
	
	/**
	 * Add a specification to this group 
	 * @param member the specification to add
	 * @param reverse if true, add this specification to the group too. 
	 */
	public void addMember(Specification member, boolean reverse){
		if(this.members == null){
			this.members = new TreeSet<>();
		}
		this.members.add(member);
		if(reverse){
			member.addGroup(this, false);
		}
	}

	/*
	 * (non-Javadoc)
	 * @see be.shoktan.BeeBreedingManager.model.Specification#iterator()
	 */
	@Override
	public Iterator<Specification> iterator() {
		if(this.members == null){
			this.members = new TreeSet<>();
		}
		return this.members.iterator();
	}
}

{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.0, 'mean_word_length': 3.8276450511945392, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '6438282', 'n_tokens_mistral': 958, 'n_tokens_neox': 861, 'n_words': 212}