package de.uni_stuttgart.vis.vowl.owl2vowl.model;

import de.uni_stuttgart.vis.vowl.owl2vowl.constants.VowlAttribute;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.annotation.Annotations;
import org.semanticweb.owlapi.model.IRI;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public abstract class AbstractEntity implements HasEquivalents, VowlVisitable {

	private IRI iri;
	private String type;
	private Set<VowlAttribute> attributes = new HashSet<>();
	private Set<IRI> equivalents = new HashSet<>();
	private Annotations annotations = new Annotations();

	protected AbstractEntity(IRI iri, String type) {
		this.iri = iri;
		this.type = type;
	}

	public Set<VowlAttribute> getAttributes() {
		return Collections.unmodifiableSet(attributes);
	}

	public void addAttribute(VowlAttribute attribute) {
		attributes.add(attribute);
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public IRI getIri() {
		return iri;
	}

	@Override
	public Set<IRI> getEquivalentElements() {
		return Collections.unmodifiableSet(equivalents);
	}

	@Override
	public void addEquivalentElement(IRI iri) {
		equivalents.add(iri);
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		AbstractEntity that = (AbstractEntity) o;

		return !(iri != null ? !iri.equals(that.iri) : that.iri != null);

	}

	@Override
	public int hashCode() {
		return iri != null ? iri.hashCode() : 0;
	}

	@Override
	public String toString() {
		return iri.toString();
	}

	public Annotations getAnnotations() {
		return annotations;
	}
}

@@ -179,24 +179,97 @@
 nnotations;%0A
+import de.uni_stuttgart.vis.vowl.owl2vowl.model.data.VowlGenerationEnum;%0A
 import org.s
@@ -457,17 +457,16 @@
 table %7B%0A
-%0A
 %09private
@@ -659,16 +659,87 @@
 ons();%0A%0A
+%09private VowlGenerationEnum generated = VowlGenerationEnum.AUTOMATIC;%0A%0A
 %09protect
@@ -814,32 +814,192 @@
 ype = type;%0A%09%7D%0A%0A
+%09public VowlGenerationEnum getGenerated() %7B%0A%09%09return generated;%0A%09%7D%0A%0A%09public void setGenerated(VowlGenerationEnum generated) %7B%0A%09%09this.generated = generated;%0A%09%7D%0A%0A
 %09public Set%3CVowl

Add field to know if vowl element is directly from ontology or created for vowl