net.sourceforge.plantuml.version.PSystemVersionFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-mit Show documentation
Show all versions of plantuml-mit Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
// 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;
}
}