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

net.sourceforge.plantuml.version.PSystemVersionFactory 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.version;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.command.PSystemSingleLineFactory;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.utils.Log;

public class PSystemVersionFactory extends PSystemSingleLineFactory {

	@Override
	protected AbstractPSystem executeLine(UmlSource source, String line) {
		try {
			if (line.matches("(?i)^(authors?|about)\\s*$"))
				return PSystemVersion.createShowAuthors2(source);

			if (line.matches("(?i)^version\\s*$"))
				return PSystemVersion.createShowVersion2(source);

			// ::comment when __CORE__
			if (line.matches("(?i)^stdlib\\s*$"))
				return PSystemVersion.createStdLib(source);

			if (line.matches("(?i)^testdot\\s*$"))
				return PSystemVersion.createTestDot(source);

			if (line.matches("(?i)^keydistributor\\s*$"))
				return PSystemVersion.createKeyDistributor(source);

			if (line.matches("(?i)^keygen\\s*$")) {
				line = line.trim();
				return new PSystemKeygen(source, "");
			}
			if (line.matches("(?i)^keyimport(\\s+[0-9a-z]+)?\\s*$")) {
				line = line.trim();
				final String key = line.substring("keyimport".length()).trim();
				return new PSystemKeygen(source, key);
			}
			if (line.matches("(?i)^keycheck\\s+([0-9a-z]+)\\s+([0-9a-z]+)\\s*$")) {
				final Pattern p = Pattern.compile("(?i)^keycheck\\s+([0-9a-z]+)\\s+([0-9a-z]+)\\s*$");
				final Matcher m = p.matcher(line);
				if (m.find()) {
					return new PSystemKeycheck(source, m.group(1), m.group(2));
				}
			}
		} catch (Exception e) {
			Log.error("Error " + e);

		}
		return null;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy