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

net.sourceforge.plantuml.abel.EntityUtils Maven / Gradle / Ivy

There is a newer version: 1.2024.8
Show newest version
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.abel;

public abstract class EntityUtils {

	private static boolean isParent(Entity groupToBeTested, Entity parentGroup) {
		if (groupToBeTested.isGroup() == false)
			// Very strange!
			return false;

		if (groupToBeTested.isGroup() == false)
			throw new IllegalArgumentException();

		while (groupToBeTested.isRoot() == false) {
			if (groupToBeTested == parentGroup)
				return true;

			groupToBeTested = groupToBeTested.getParentContainer();
			if (groupToBeTested.isGroup() == false)
				return false;
			// throw new IllegalStateException();

		}
		return false;
	}

	public static boolean isPureInnerLink12(Entity group, Link link) {
		if (group.isGroup() == false)
			throw new IllegalArgumentException();

		final Entity e1 = link.getEntity1();
		final Entity e2 = link.getEntity2();
		final Entity group1 = e1.getParentContainer();
		final Entity group2 = e2.getParentContainer();

		if (isParent(group1, group) && isParent(group2, group))
			return true;

		return false;
	}

	public static boolean isPureInnerLink3(Entity group, Link link) {
		if (group.isGroup() == false)
			throw new IllegalArgumentException();

		final Entity e1 = link.getEntity1();
		final Entity e2 = link.getEntity2();
		final Entity group1 = e1.getParentContainer();
		final Entity group2 = e2.getParentContainer();
		if (isParent(group2, group) == isParent(group1, group))
			return true;

		return false;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy