src/net/sourceforge/plantuml/utils/Position.java
// 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();
	}
}
