package br.ufes.inf.ontoumlplugin.model;

import com.vp.plugin.model.IAssociationEnd;

public class AssociationMultiplicity {
	
	private int mMinMultiplicity;
	private int mMaxMultiplicity;
	private String mMultiplicity;
	
	public AssociationMultiplicity(String multiplicity){
		this.mMultiplicity = multiplicity;
		
		switch(mMultiplicity){
			case IAssociationEnd.MULTIPLICITY_ONE:
				this.mMinMultiplicity = 1;
				this.mMaxMultiplicity = 1;
				break;
			case IAssociationEnd.MULTIPLICITY_ONE_TO_MANY:
				this.mMinMultiplicity = 1;
				this.mMaxMultiplicity = -1;
				break;
			case IAssociationEnd.MULTIPLICITY_ZERO_TO_MANY:
				this.mMinMultiplicity = 0;
				this.mMaxMultiplicity = -1;
				break;
			case IAssociationEnd.MULTIPLICITY_ZERO_TO_ONE:
				this.mMinMultiplicity = 0;
				this.mMaxMultiplicity = 1;
				break;
		}
		
	}
	
	public AssociationMultiplicity(int min, int max){
		this.mMinMultiplicity = min;
		this.mMaxMultiplicity = max;
		this.mMultiplicity = IAssociationEnd.MULTIPLICITY_MANY;
	}
	
	public int getMinMultiplicity(){
		return mMinMultiplicity;
	}
	
	public int getMaxMultiplicity(){
		return mMaxMultiplicity;
	}

}
@@ -822,16 +822,438 @@
 %09break;%0A
+%09%09%09default:%0A%09%09%09%09String%5B%5D multStr = multiplicity.split(%22%5B.%5D+%22);%0A%09%09%09%09this.mMinMultiplicity = multStr%5B0%5D.equals(%22*%22) ? %0A%09%09%09%09%09%09%09%09%09%09%09-1 : %0A%09%09%09%09%09%09%09%09%09%09%09Integer.valueOf(multStr%5B0%5D);%0A%09%09%09%09this.mMaxMultiplicity = multStr.length == 2 ?%0A%09%09%09%09%09%09%09%09%09%09(multStr%5B1%5D.equals(%22*%22) ? %0A%09%09%09%09%09%09%09%09%09%09%09-1 : %0A%09%09%09%09%09%09%09%09%09%09%09Integer.valueOf(multStr%5B1%5D)) :%0A%09%09%09%09%09%09%09%09%09%09(multStr%5B0%5D.equals(%22*%22) ? %0A%09%09%09%09%09%09%09%09%09%09%09-1 : %0A%09%09%09%09%09%09%09%09%09%09%09Integer.valueOf(multStr%5B0%5D));%09%09%0A%09%09%09%09%0A
 %09%09%7D%0A%09%09%0A%09

Corrige multiplicidade de associações na conversão para RefOntoUML não registrando multiplicidades diferentes de 1