net.sourceforge.plantuml.oregon.PSystemOregon 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.oregon;
import static net.sourceforge.plantuml.klimt.shape.GraphicStrings.createGreenOnBlackMonospaced;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import net.atmp.ImageBuilder;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.PlainDiagram;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.klimt.shape.UDrawable;
public class PSystemOregon extends PlainDiagram {
private Screen screen;
private List inputs;
@Deprecated
public PSystemOregon(UmlSource source, Keyboard keyboard) {
super(source);
final BasicGame game = new OregonBasicGame();
try {
game.run(keyboard);
this.screen = game.getScreen();
// this.screen = new Screen();
// screen.print("Game ended??");
} catch (NoInputException e) {
this.screen = game.getScreen();
}
}
@Override
public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException {
return super.createImageBuilder(fileFormatOption).blackBackcolor();
}
public PSystemOregon(UmlSource source) {
super(source);
this.inputs = new ArrayList<>();
}
public void add(String line) {
if (StringUtils.isNotEmpty(line)) {
inputs.add(line);
}
}
private Screen getScreen() {
if (screen == null) {
final Keyboard keyboard = new KeyboardList(inputs);
final BasicGame game = new OregonBasicGame();
try {
game.run(keyboard);
this.screen = game.getScreen();
// this.screen = new Screen();
// screen.print("Game ended??");
} catch (NoInputException e) {
this.screen = game.getScreen();
}
}
return screen;
}
@Override
protected UDrawable getRootDrawable(FileFormatOption fileFormatOption) throws IOException {
return createGreenOnBlackMonospaced(getScreen().getLines());
}
public DiagramDescription getDescription() {
return new DiagramDescription("(The Oregon Trail)");
}
}