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;
	}
}

@@ -67,16 +67,69 @@
 lection;
+%0Aimport java.util.Iterator;%0Aimport java.util.TreeSet;
 %0A%0Aimport
@@ -719,24 +719,102 @@
 mbers = 
-members;
+new TreeSet%3C%3E();%0A%09%09for(Specification member : members)%7B%0A%09%09%09this.addMember(member);%0A%09%09%7D
 %0A%09%7D%0A%09%0A%09%0A
@@ -997,24 +997,24 @@
 getType() %7B%0A
-
 %09%09return ESp
@@ -1039,10 +1039,815 @@
 oup;%0A%09%7D%0A
+%09%0A%09/**%0A%09 * Add a specification to this group %0A%09 * @param member the specification to add%0A%09 */%0A%09public void addMember(Specification member)%7B%0A%09%09addMember(member, true);%0A%09%7D%0A%09%0A%09/**%0A%09 * Add a specification to this group %0A%09 * @param member the specification to add%0A%09 * @param reverse if true, add this specification to the group too. %0A%09 */%0A%09public void addMember(Specification member, boolean reverse)%7B%0A%09%09if(this.members == null)%7B%0A%09%09%09this.members = new TreeSet%3C%3E();%0A%09%09%7D%0A%09%09this.members.add(member);%0A%09%09if(reverse)%7B%0A%09%09%09member.addGroup(this, false);%0A%09%09%7D%0A%09%7D%0A%0A%09/*%0A%09 * (non-Javadoc)%0A%09 * @see be.shoktan.BeeBreedingManager.model.Specification#iterator()%0A%09 */%0A%09@Override%0A%09public Iterator%3CSpecification%3E iterator() %7B%0A%09%09if(this.members == null)%7B%0A%09%09%09this.members = new TreeSet%3C%3E();%0A%09%09%7D%0A%09%09return this.members.iterator();%0A%09%7D%0A
 %7D%0A

Update Group.java