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

net.sf.nakeduml.userinteractionmetamodel.Participation Maven / Gradle / Ivy

package net.sf.nakeduml.userinteractionmetamodel;

import net.sf.nakeduml.util.CompositionNode;

abstract public class Participation extends UserInteractionElement implements CompositionNode {
	private Double displayIndex = 0D;

	/** Default constructor for 
	 */
	public Participation() {
	}

	/** Call this method when you want to attach this object to the containment tree. Useful with transitive persistence
	 */
	public void addToOwningObject() {
	}
	
	public void copyState(Participation from, Participation to) {
		to.setName(from.getName());
		to.setAdditionalHumanName(from.getAdditionalHumanName());
		to.setRepresentedElement(getRepresentedElement());
		to.setDisplayIndex(from.getDisplayIndex());
	}
	
	public void createComponents() {
		super.createComponents();
	}
	
	public Double getDisplayIndex() {
		return displayIndex;
	}
	
	public CompositionNode getOwningObject() {
		return null;
	}
	
	public ParticipationGroup getParticipationGroup() {
		return null;
	}
	
	public void init(CompositionNode owner) {
		super.init(owner);
		createComponents();
	}
	
	abstract public Participation makeCopy();
	
	public void markDeleted() {
		super.markDeleted();
		if ( getParticipationGroup()!=null ) {
			getParticipationGroup().getParticipation().remove((Participation)this);
		}
	}
	
	public void removeFromOwningObject() {
		this.markDeleted();
	}
	
	public void setDisplayIndex(Double displayIndex) {
		this.displayIndex=displayIndex;
	}
	
	public void shallowCopyState(Participation from, Participation to) {
		to.setName(from.getName());
		to.setAdditionalHumanName(from.getAdditionalHumanName());
		to.setRepresentedElement(getRepresentedElement());
		to.setDisplayIndex(from.getDisplayIndex());
	}
	
	public String toString() {
		StringBuilder sb = new StringBuilder();
		if ( getOwner()==null ) {
			sb.append("owner=null;");
		} else {
			sb.append("owner="+getOwner().getClass().getSimpleName()+"[");
			sb.append(getOwner().getName());
			sb.append("];");
		}
		sb.append("name=");
		sb.append(getName());
		sb.append(";");
		sb.append("additionalHumanName=");
		sb.append(getAdditionalHumanName());
		sb.append(";");
		sb.append("humanName=");
		sb.append(getHumanName());
		sb.append(";");
		sb.append("qualifiedName=");
		sb.append(getQualifiedName());
		sb.append(";");
		if ( getRepresentedElement()==null ) {
			sb.append("representedElement=null;");
		} else {
			sb.append("representedElement="+getRepresentedElement().getClass().getSimpleName()+"[");
			sb.append(getRepresentedElement().getName());
			sb.append("];");
		}
		sb.append("displayIndex=");
		sb.append(getDisplayIndex());
		sb.append(";");
		if ( getParticipationGroup()==null ) {
			sb.append("participationGroup=null;");
		} else {
			sb.append("participationGroup="+getParticipationGroup().getClass().getSimpleName()+"[");
			sb.append(getParticipationGroup().getName());
			sb.append("];");
		}
		return sb.toString();
	}
	
	public String toXmlString() {
		StringBuilder sb = new StringBuilder();
		if ( getName()==null ) {
			sb.append("");
		} else {
			sb.append("");
			sb.append(getName());
			sb.append("");
			sb.append("\n");
		}
		if ( getAdditionalHumanName()==null ) {
			sb.append("");
		} else {
			sb.append("");
			sb.append(getAdditionalHumanName());
			sb.append("");
			sb.append("\n");
		}
		if ( getRepresentedElement()==null ) {
			sb.append("");
		} else {
			sb.append("");
			sb.append(getRepresentedElement().getClass().getSimpleName());
			sb.append("[");
			sb.append(getRepresentedElement().getName());
			sb.append("]");
			sb.append("");
			sb.append("\n");
		}
		if ( getDisplayIndex()==null ) {
			sb.append("");
		} else {
			sb.append("");
			sb.append(getDisplayIndex());
			sb.append("");
			sb.append("\n");
		}
		return sb.toString();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy