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

net.sourceforge.plantuml.utils.Position 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.utils;

import java.util.Objects;

import net.sourceforge.plantuml.klimt.geom.Rankdir;

public enum Position {
	RIGHT, LEFT, BOTTOM, TOP;

	public static Position fromString(String s) {
		return Position.valueOf(s.toUpperCase());
	}

	public Position withRankdir(Rankdir rankdir) {
		// Default
		if (Objects.requireNonNull(rankdir) == Rankdir.TOP_TO_BOTTOM)
			return this;

		if (this == RIGHT)
			return BOTTOM;

		if (this == LEFT)
			return TOP;

		if (this == BOTTOM)
			return RIGHT;

		if (this == TOP)
			return LEFT;

		throw new IllegalStateException();
	}

	public Direction reverseDirection() {
		if (this == LEFT)
			return Direction.RIGHT;

		if (this == RIGHT)
			return Direction.LEFT;

		throw new UnsupportedOperationException();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy