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

import de.uni_stuttgart.vis.vowl.owl2vowl.constants.Node_Types;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.BaseEntity;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.edges.properties.BaseProperty;

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


public abstract class BaseNode extends BaseEntity {
	private List<BaseNode> disjoints = new ArrayList<BaseNode>();
	private List<BaseProperty> outGoingEdges = new ArrayList<BaseProperty>();
	private List<BaseProperty> inGoingEdges = new ArrayList<BaseProperty>();

	public BaseNode() {
	}

	public List<BaseNode> getDisjoints() {
		return disjoints;
	}

	public void setDisjoints(List<BaseNode> disjoints) {
		this.disjoints = disjoints;
	}

	public List<BaseProperty> getOutGoingEdges() {
		return outGoingEdges;
	}

	public List<BaseProperty> getInGoingEdges() {
		return inGoingEdges;
	}

	/**
	 * Returns the owl:Thing which is already connected to the node.
	 *
	 * @return Owl:Thing which has connection to this node. Else null.
	 */
	public BaseNode getConnectedThing() {
		for (BaseProperty out : getOutGoingEdges()) {
			String type = out.getRange().getType();

			if (type.equals(Node_Types.TYPE_THING)) {
				return out.getRange();
			}
		}

		for (BaseProperty in : getInGoingEdges()) {
			String type = in.getDomain().getType();

			if (type.equals(Node_Types.TYPE_THING)) {
				return in.getDomain();
			}
		}

		return null;
	}
}

@@ -1449,11 +1449,546 @@
 null;%0A%09%7D
+%0A%0A%09public boolean containsConnectedThing(BaseNode node) %7B%0A%09%09for (BaseProperty out : getOutGoingEdges()) %7B%0A%09%09%09BaseNode range = out.getRange();%0A%09%09%09String type = range.getType();%0A%0A%09%09%09if (type.equals(Node_Types.TYPE_THING) && range.getId().equals(node.getId())) %7B%0A%09%09%09%09return true;%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09for (BaseProperty in : getInGoingEdges()) %7B%0A%09%09%09BaseNode domain = in.getDomain();%0A%09%09%09String type = domain.getType();%0A%0A%09%09%09if (type.equals(Node_Types.TYPE_THING) && domain.getId().equals(node.getId())) %7B%0A%09%09%09%09return true;%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09return false;%0A%09%7D
 %0A%7D%0A

Add method to check if a node has the same connected thing as another node.,