All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.yaoqiang.bpmn.model.elements.XMLComplexChoice Maven / Gradle / Ivy

package org.yaoqiang.bpmn.model.elements;

import java.util.ArrayList;
import java.util.List;

/**
 * XMLComplexChoice
 * 
 * @author Shi Yaoqiang([email protected])
 */
public abstract class XMLComplexChoice extends XMLElement {

	private static final long serialVersionUID = 1481531265569472328L;

	protected List choices;

	protected XMLElement choosen;

	public XMLComplexChoice(XMLComplexElement parent) {
		super(parent);
		fillChoices();
	}

	public List getChoices() {
		return choices;
	}

	public XMLElement getChoosen() {
		return choosen;
	}

	public void setChoosen(XMLElement ch) {
		this.choosen = ch;
	}

	public boolean isEmpty() {
		return choosen == null || choosen.isEmpty();
	}

	protected abstract void fillChoices();

	public Object clone() {
		XMLComplexChoice d = (XMLComplexChoice) super.clone();
		d.choices = new ArrayList();
		d.choosen = null;
		for (XMLElement c : choices) {
			XMLElement cloned = (XMLElement) c.clone();
			d.choices.add(cloned);
			cloned.setParent(d);
			if (d.choosen == null && this.choosen != null && this.choosen.equals(c)) {
				d.choosen = cloned;
			}
		}
		return d;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy