1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-05 21:17:52 +00:00
This commit is contained in:
Arnaud Roques 2023-03-08 21:49:44 +01:00
parent a171a90403
commit aa033bc2c1
95 changed files with 328 additions and 229 deletions

View File

@ -97,7 +97,7 @@ import ext.plantuml.com.ctreber.aclib.sort.QuickSort;
* @author Christian Treber, ct@ctreber.com
*/
public class ACearth {
// :: remove folder when __CORE__
// ::remove folder when __CORE__
public static final String VERSION = "1.1";
public static final String BUILD = "22.11.2002 004";

View File

@ -9,7 +9,7 @@ package ext.plantuml.com.ctreber.aclib.gui;
*/
public class MOBoolean extends MonitoredObject
{
// :: remove folder when __CORE__
// ::remove folder when __CORE__
private boolean fBoolean;
public MOBoolean()

View File

@ -12,7 +12,7 @@ import java.util.Comparator;
abstract public class CTSort
{
// ::remove folder when __HAXE__
// :: remove folder when __CORE__
// ::remove folder when __CORE__
public void sort(Object[] items)
{
sort(items, new DefaultComparator());

View File

@ -25,7 +25,7 @@ import java.util.Hashtable;
*/
public final class BarcodeFormat {
// ::remove folder when __HAXE__
// :: remove folder when __CORE__
// ::remove folder when __CORE__
// No, we can't use an enum here. J2ME doesn't support it.

View File

@ -93,9 +93,6 @@ import net.sourceforge.plantuml.xmlsc.StateDiagramScxmlMaker;
public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, PortionShower, ICucaDiagram {
private String namespaceSeparator = null;
private boolean namespaceSeparatorHasBeenSet = false;
private final List<HideOrShow2> hides2 = new ArrayList<>();
private final List<HideOrShow2> removed = new ArrayList<>();
protected final EntityFactory entityFactory = new EntityFactory(hides2, removed, this);
@ -104,6 +101,12 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
private boolean visibilityModifierPresent;
@Override
final public void setNamespaceSeparator(String namespaceSeparator) {
super.setNamespaceSeparator(namespaceSeparator);
entityFactory.setSeparator(namespaceSeparator);
}
public CucaDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source, type, orig);
this.stacks.add(entityFactory.root().getData());
@ -143,19 +146,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(id);
}
final public void setNamespaceSeparator(String namespaceSeparator) {
this.namespaceSeparatorHasBeenSet = true;
this.namespaceSeparator = namespaceSeparator;
entityFactory.setSeparator(namespaceSeparator);
}
final public String getNamespaceSeparator() {
if (namespaceSeparatorHasBeenSet == false)
return ".";
return namespaceSeparator;
}
@Override
public boolean hasUrl() {
for (Quark<Entity> quark : entityFactory.quarks()) {
@ -233,7 +223,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
public String removePortId(String id) {
// To be kept
if ("::".equals(namespaceSeparator))
if ("::".equals(getNamespaceSeparator()))
return id;
final int x = id.lastIndexOf("::");
if (x == -1)
@ -243,7 +233,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
public String getPortId(String id) {
// To be kept
if ("::".equals(namespaceSeparator))
if ("::".equals(getNamespaceSeparator()))
return null;
final int x = id.lastIndexOf("::");
if (x == -1)

View File

@ -91,7 +91,7 @@ public class PixelImage implements MutableImage {
for (int j = 0; j < bufferedImageScale1.getHeight(); j++) {
final int color = bufferedImageScale1.getRGB(i, j);
final int rgb = getRgb(color);
final int grayScale = ColorUtils.getGrayScale(rgb);
final int grayScale = ColorUtils.getGrayScaleFromRGB(rgb);
final int gray = grayScale + grayScale << 8 + grayScale << 16;
final int a = getA(color);
copy.setRGB(i, j, gray + a);
@ -150,8 +150,8 @@ public class PixelImage implements MutableImage {
// if (isTransparent(color)) {
// continue;
// }
final int gray = ColorUtils.getGrayScale(rgb);
if (darkerRgb == -1 || gray < ColorUtils.getGrayScale(darkerRgb))
final int gray = ColorUtils.getGrayScaleFromRGB(rgb);
if (darkerRgb == -1 || gray < ColorUtils.getGrayScaleFromRGB(darkerRgb))
darkerRgb = rgb;
}

View File

@ -75,6 +75,16 @@ public abstract class AbstractPSystem implements Diagram {
private int splitPagesHorizontal = 1;
private int splitPagesVertical = 1;
private String namespaceSeparator = null;
public void setNamespaceSeparator(String namespaceSeparator) {
this.namespaceSeparator = namespaceSeparator;
}
final public String getNamespaceSeparator() {
return namespaceSeparator;
}
public AbstractPSystem(UmlSource source) {
this.source = Objects.requireNonNull(source);
}

View File

@ -58,7 +58,7 @@ import net.sourceforge.plantuml.skin.SplitParam;
import net.sourceforge.plantuml.utils.Log;
public class PSystemUtils {
// :: remove file when __CORE__
// ::remove file when __CORE__
// ::remove file when __HAXE__
public static List<FileImageData> exportDiagrams(Diagram system, SuggestedFile suggested,

View File

@ -41,7 +41,7 @@ import java.util.logging.Level;
import java.util.logging.LogRecord;
public class ProgressBar {
// :: remove file when __CORE__
// ::remove file when __CORE__
// ::remove file when __HAXE__
private static final java.util.logging.Logger logger;

View File

@ -62,6 +62,15 @@ public class StringUtils {
// ::done
}
public static String goLowerCase(String s) {
// ::comment when __HAXE__
return s.toLowerCase(Locale.ENGLISH);
// ::done
// ::uncomment when __HAXE__
// return s.toLowerCase();
// ::done
}
public static String eventuallyRemoveStartingAndEndingDoubleQuote(String s, String format) {
if (s == null)
return null;
@ -239,10 +248,6 @@ public class StringUtils {
return goUpperCase("" + c).charAt(0);
}
public static String goLowerCase(String s) {
return s.toLowerCase(Locale.ENGLISH);
}
public static char goLowerCase(char c) {
return goLowerCase("" + c).charAt(0);
}
@ -548,13 +553,14 @@ public class StringUtils {
return h;
}
// ::done
public static String sharp000000(int color) {
final int v = 0xFFFFFF & color;
String s = "000000" + Integer.toHexString(v).toUpperCase();
s = s.substring(s.length() - 6);
return "#" + s;
}
// ::done
// ::comment when __CORE__ or __HAXE__
public static int getWcWidth(Display stringsToDisplay) {

View File

@ -73,8 +73,7 @@ public final class EntityFactory implements IEntityFactory {
this.hides2 = hides2;
this.removed = removed;
this.diagram = diagram;
this.namespace = new Plasma<Entity>(".");
// this.printspace = new Plasma<Entity>(".");
this.namespace = new Plasma<Entity>();
this.root = namespace.root();
this.rootGroup = new Entity(this.root, this, null, GroupType.ROOT, 0);
}

View File

@ -58,7 +58,7 @@ import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
public class PSystemXearth extends AbstractPSystem {
// :: remove folder when __CORE__
// ::remove folder when __CORE__
final private int width;
final private int height;

View File

@ -53,7 +53,9 @@ public class CommandEndif3 extends SingleLineCommand2<ActivityDiagram3> {
static IRegex getRegexConcat() {
return RegexConcat.build(CommandEndif3.class.getName(), //
RegexLeaf.start(), //
new RegexLeaf("endif"), //
new RegexLeaf("end"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("if"), //
new RegexLeaf(";?"), //
RegexLeaf.end());
}

View File

@ -88,7 +88,7 @@ public enum BoxStyle {
ug.apply(UTranslate.dx(width - PADDING)).draw(vline);
}
},
SDL_SAVE("save", '\\', 0) {
SDL_SAVE("load", '\\', 0) {
@Override
protected Shadowable getShape(double width, double height, double roundCorner) {
final UPolygon result = new UPolygon();
@ -99,7 +99,7 @@ public enum BoxStyle {
return result;
}
},
SDL_ANTISAVE("load", '/', 0) {
SDL_ANTISAVE("save", '/', 0) {
@Override
protected Shadowable getShape(double width, double height, double roundCorner) {
final UPolygon result = new UPolygon();

View File

@ -192,7 +192,7 @@ public class FtileBox2 extends AbstractFtile {
final UDrawable shape = boxStyle.getUDrawable(widthTotal, heightTotal, shadowing, roundCorner);
final XDimension2D dimTotal = calculateDimension(ug.getStringBounder());
ug.draw(new UEmpty(dimTotal));
ug.draw(UEmpty.create(dimTotal));
final UStroke thickness = style.getStroke();

View File

@ -104,7 +104,7 @@ public class GtileColumns extends AbstractGtile {
final XDimension2D dim = gtiles.get(i).calculateDimension(stringBounder);
final UTranslate pos = getPosition(i);
final XDimension2D corner = dim.applyTranslate(pos);
result = MathUtils.max(result, corner);
result = MathUtils.maxDim(result, corner);
}
return result;
}

View File

@ -107,7 +107,7 @@ public class GtileHexagonInsideLabelled extends GtileWithMargin {
final UTranslate east = getCoord(GPoint.EAST_HOOK);
final XDimension2D eastCorner = eastLabel.calculateDimension(stringBounder).applyTranslate(east);
return MathUtils.max(tmp, southCorner, eastCorner);
return MathUtils.maxDim(tmp, southCorner, eastCorner);
}
}

View File

@ -118,7 +118,7 @@ public class GtileTopDown extends AbstractGtile {
public XDimension2D calculateDimension(StringBounder stringBounder) {
final XDimension2D corner1 = dim1.applyTranslate(getPos1());
final XDimension2D corner2 = dim2.applyTranslate(getPos2());
return MathUtils.max(corner1, corner2);
return MathUtils.maxDim(corner1, corner2);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -121,7 +121,7 @@ public class GtileTopDown3 extends AbstractGtile {
final XDimension2D corner1 = dim1.applyTranslate(getPos1());
final XDimension2D corner2 = dim2.applyTranslate(getPos2());
final XDimension2D corner3 = dim3.applyTranslate(getPos3());
return MathUtils.max(corner1, corner2, corner3);
return MathUtils.maxDim(corner1, corner2, corner3);
}
@Override

View File

@ -155,8 +155,6 @@ public class ClassDiagramFactory extends PSystemCommandFactory {
cmds.add(new CommandDiamondAssociation());
cmds.add(new CommandNamespaceSeparator());
cmds.add(new CommandCreateElementMultilines(0));
cmds.add(new CommandCreateElementMultilines(1));
CommonCommands.addTitleCommands(cmds);

View File

@ -53,6 +53,7 @@ import net.sourceforge.plantuml.klimt.color.NoSuchColorException;
import net.sourceforge.plantuml.klimt.creole.Display;
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
import net.sourceforge.plantuml.plasma.Quark;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexOptional;
@ -101,16 +102,16 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
new RegexConcat(
//
new RegexLeaf("ARROW_HEAD1",
"((?<=[%s])+[ox]|[)#\\[<*+^}]|\\<_|\\<\\|[\\:\\|]|[<\\[]\\||\\}o|\\}\\||\\|o|\\|\\|)?"), //
optionalHead("ARROW_HEAD1", "(?<=[%s])+[ox]", "[)#\\[<*+^}]_?", "\\<_?\\|[\\:\\|]", "[<\\[]\\|",
"\\}o", "\\}\\|", "\\|o", "\\|\\|"),
new RegexLeaf("ARROW_BODY1", "([-=.]+)"), //
new RegexLeaf("ARROW_STYLE1", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
new RegexLeaf("ARROW_DIRECTION", "(left|right|up|down|le?|ri?|up?|do?)?"), //
new RegexOptional(new RegexLeaf("INSIDE", "(0|\\(0\\)|\\(0|0\\))(?=[-=.~])")), //
new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
new RegexLeaf("ARROW_BODY2", "([-=.]*)"), //
new RegexLeaf("ARROW_HEAD2",
"([ox][%s]+|:\\>\\>?|_\\>|[(#\\]>*+^\\{]|[\\|\\:]\\|\\>|\\|[>\\]]|o\\{|\\|\\{|o\\||\\|\\|)?")), //
optionalHead("ARROW_HEAD2", "[ox][%s]+", ":\\>\\>?", "_?\\>", "[(#\\]*+^\\{]", "[\\|:]\\|\\>",
"\\|[>\\]]", "o\\{", "\\|\\{", "o\\|", "\\|\\|")), //
RegexLeaf.spaceZeroOrMore(), //
@ -141,6 +142,18 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
)), RegexLeaf.end());
}
private static IRegex optionalHead(String name, String... options) {
final StringBuilder sb = new StringBuilder();
sb.append("(");
for (String s : options) {
if (sb.length() > 1)
sb.append("|");
sb.append(s);
}
sb.append(")?");
return new RegexLeaf(name, sb.toString());
}
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.LINE);
}
@ -156,7 +169,6 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
@Override
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
RegexResult arg) throws NoSuchColorException {
String ent1String = diagram.cleanId(arg.get("ENT1", 0));
String ent2String = diagram.cleanId(arg.get("ENT2", 0));
if (ent1String == null && ent2String == null)
@ -561,7 +573,7 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
}
private String getArrowHead(RegexResult arg, final String key) {
return notNull(arg.get(key, 0));
return notNull(arg.get(key, 0)).replaceAll("_", "");
}
private String getFullArrow(RegexResult arg) {

View File

@ -35,7 +35,7 @@
*/
package net.sourceforge.plantuml.classdiagram.command;
import net.atmp.CucaDiagram;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.regex.IRegex;
@ -45,9 +45,11 @@ import net.sourceforge.plantuml.regex.RegexOr;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.utils.LineLocation;
public class CommandNamespaceSeparator extends SingleLineCommand2<CucaDiagram> {
public class CommandNamespaceSeparator extends SingleLineCommand2<AbstractPSystem> {
public CommandNamespaceSeparator() {
public static final CommandNamespaceSeparator ME = new CommandNamespaceSeparator();
private CommandNamespaceSeparator() {
super(getRegexConcat());
}
@ -64,13 +66,13 @@ public class CommandNamespaceSeparator extends SingleLineCommand2<CucaDiagram> {
}
@Override
protected CommandExecutionResult executeArg(CucaDiagram diagram, LineLocation location, RegexResult arg) {
protected CommandExecutionResult executeArg(AbstractPSystem diagram, LineLocation location, RegexResult arg) {
final String s = arg.get("SEPARATOR", 0);
if ("none".equalsIgnoreCase(s)) {
if ("none".equalsIgnoreCase(s))
diagram.setNamespaceSeparator(null);
} else {
else
diagram.setNamespaceSeparator(s);
}
return CommandExecutionResult.ok();
}
}

View File

@ -39,6 +39,7 @@ import java.util.List;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShowByGender;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShowByVisibility;
import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator;
import net.sourceforge.plantuml.sequencediagram.command.CommandSkin;
import net.sourceforge.plantuml.statediagram.command.CommandHideEmptyDescription;
import net.sourceforge.plantuml.style.CommandStyleImport;
@ -106,6 +107,7 @@ public final class CommonCommands {
cmds.add(CommandHeader.ME);
cmds.add(CommandMultilinesHeader.ME);
cmds.add(CommandNamespaceSeparator.ME);
}
}

View File

@ -42,7 +42,7 @@ import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.skin.UmlDiagramType;
public class CompositeDiagram extends AbstractEntityDiagram {
// :: remove folder when __HAXE__
// ::remove folder when __HAXE__
public CompositeDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.COMPOSITE, skinParam);

View File

@ -76,7 +76,6 @@ public class DescriptionDiagramFactory extends PSystemCommandFactory {
@Override
protected void initCommandsList(List<Command> cmds) {
cmds.add(new CommandFootboxIgnored());
cmds.add(new CommandNamespaceSeparator());
cmds.add(new CommandRankDir());
cmds.add(new CommandNewpage(this));
CommonCommands.addCommonCommands1(cmds);

View File

@ -53,7 +53,7 @@ import net.sourceforge.plantuml.vizjs.GraphvizJs;
import net.sourceforge.plantuml.vizjs.VizJsEngine;
public class GraphvizUtils {
// :: remove file when __CORE__
// ::remove file when __CORE__
public static final String VIZJS = "vizjs";
private static int DOT_VERSION_LIMIT = 226;

View File

@ -60,7 +60,7 @@ import net.sourceforge.plantuml.log.Logme;
// ::done
public class Emoji {
// :: remove folder when __HAXE__
// ::remove folder when __HAXE__
private final static Map<String, Emoji> ALL = new HashMap<>();
static {

View File

@ -36,7 +36,7 @@
package net.sourceforge.plantuml.flashcode;
public class FlashCodeFactory {
// :: remove folder when __CORE__
// ::remove folder when __CORE__
public static FlashCodeUtils getFlashCodeUtils() {
final String name = "net.sourceforge.plantuml.flashcode.FlashCodeUtilsZxing";

View File

@ -49,7 +49,7 @@ public class Arrow {
public void drawArrow(UGraphic ug) {
ug = ug.apply(UStroke.simple());
final ULine p1p2 = new ULine(p1, p2);
final ULine p1p2 = ULine.create(p1, p2);
final double dist = p1.distance(p2);
final double alpha = Math.atan2(p1p2.getDX(), p1p2.getDY());

View File

@ -38,7 +38,6 @@ package net.sourceforge.plantuml.klimt;
import net.sourceforge.plantuml.klimt.color.HColor;
public interface UBackground extends UChange {
// ::remove file when __HAXE__
public HColor getBackColor();

View File

@ -38,8 +38,6 @@ package net.sourceforge.plantuml.klimt;
import net.sourceforge.plantuml.klimt.color.HColor;
public interface UParam {
// ::remove file when __HAXE__
public HColor getColor();
public HColor getBackcolor();

View File

@ -7,6 +7,7 @@ import java.util.Locale;
* {@link Color} with hue, saturation and brightness.
*/
public class ColorHSB extends Color {
// ::remove file when __HAXE__
private final float hue;
private final float saturation;
private final float brightness;

View File

@ -50,6 +50,7 @@ public abstract class ColorMapper {
return simple.getAwtColor();
}
};
// ::comment when __HAXE__
public final static ColorMapper DARK_MODE = new ColorMapper() {
@Override
public Color fromColorSimple(HColorSimple simple) {
@ -84,4 +85,6 @@ public abstract class ColorMapper {
};
}
// ::done
}

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.klimt.color;
import java.awt.Color;
public enum ColorOrder {
// ::remove file when __HAXE__
RGB, RBG, GRB, GBR, BRG, BGR;
public Color getColor(Color color) {

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
public class ColorParser {
// ::remove file when __HAXE__
private static final String COLOR_REGEXP = "#\\w+[-\\\\|/]?\\w+";

View File

@ -37,22 +37,18 @@ package net.sourceforge.plantuml.klimt.color;
import java.awt.Color;
import net.sourceforge.plantuml.utils.MathUtils;
public class ColorUtils {
public static int getGrayScale(Color color) {
return getGrayScale(color.getRed(), color.getGreen(), color.getBlue());
return getGrayScaleInternalFromRGB(color.getRed(), color.getGreen(), color.getBlue());
}
public static int getGrayScale(int red, int green, int blue) {
private static int getGrayScaleInternalFromRGB(int red, int green, int blue) {
// YIQ equation from http://24ways.org/2010/calculating-color-contrast
return getGrayScaleInternal(red, green, blue) / 1000;
}
public static int distance(Color c1, Color c2) {
final int diffRed = Math.abs(c1.getRed() - c2.getRed());
final int diffGreen = Math.abs(c1.getGreen() - c2.getGreen());
final int diffBlue = Math.abs(c1.getBlue() - c2.getBlue());
return getGrayScaleInternal(diffRed, diffGreen, diffBlue);
final int result = getGrayScaleInternal(red, green, blue) / 1000;
return result;
}
private static int getGrayScaleInternal(int red, int green, int blue) {
@ -60,11 +56,11 @@ public class ColorUtils {
return red * 299 + green * 587 + blue * 114;
}
public static int getGrayScale(int rgb) {
public static int getGrayScaleFromRGB(int rgb) {
final int red = (rgb & 0x00FF0000) >> 16;
final int green = (rgb & 0x0000FF00) >> 8;
final int blue = (rgb & 0x000000FF);
return getGrayScale(red, green, blue);
return getGrayScaleInternalFromRGB(red, green, blue);
}
public static Color getGrayScaleColor(Color color) {
@ -77,6 +73,15 @@ public class ColorUtils {
return new Color(grayScale, grayScale, grayScale);
}
public static int distance(Color c1, Color c2) {
final int diffRed = MathUtils.abs(c1.getRed() - c2.getRed());
final int diffGreen = MathUtils.abs(c1.getGreen() - c2.getGreen());
final int diffBlue = MathUtils.abs(c1.getBlue() - c2.getBlue());
return getGrayScaleInternal(diffRed, diffGreen, diffBlue);
}
// ::comment when __HAXE__
/*
* This code is still experimental. If you can improve it, please go ahead :-)
*
@ -170,5 +175,6 @@ public class ColorUtils {
return result;
}
// ::done
}

View File

@ -50,6 +50,7 @@ import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.style.ISkinParam;
public class Colors {
// ::remove file when __HAXE__
private final Map<ColorType, HColor> map = new EnumMap<ColorType, HColor>(ColorType.class);
private LinkStyle lineStyle = null;

View File

@ -40,15 +40,24 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.klimt.UBackground;
import net.sourceforge.plantuml.klimt.UChange;
class Back implements UBackground {
private final HColor hColor;
public Back(HColor hColor) {
this.hColor = hColor;
}
@Override
public HColor getBackColor() {
return hColor;
}
}
public abstract class HColor implements UChange {
// ::remove folder when __HAXE__
public UBackground bg() {
return new UBackground() {
public HColor getBackColor() {
return HColor.this;
}
};
return new Back(this);
}
public Color toColor(ColorMapper mapper) {
@ -94,9 +103,11 @@ public abstract class HColor implements UChange {
return true;
}
// ::comment when __HAXE__
public String asString() {
return "?" + getClass().getSimpleName();
}
// ::done
public HColor darkSchemeTheme() {
return this;

View File

@ -35,6 +35,7 @@
package net.sourceforge.plantuml.klimt.color;
class HColorAutomagic extends HColor {
// ::remove file when __HAXE__
@Override
public HColor getAppropriateColor(HColor back) {

View File

@ -38,6 +38,7 @@ import java.awt.Color;
import java.util.Objects;
public class HColorGradient extends HColor {
// ::remove file when __HAXE__
private final HColor color1;
private final HColor color2;

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.klimt.color;
import java.awt.Color;
public class HColorMiddle extends HColor {
// ::remove file when __HAXE__
private final HColor color1;
private final HColor color2;

View File

@ -228,37 +228,55 @@ public class HColorSet {
names.add(s);
}
class Gradient {
public HColor getColorOrWhite(String s) {
if (isColorValid(Objects.requireNonNull(s)) == false)
return HColors.WHITE;
try {
return getColor(s);
} catch (NoSuchColorException e) {
assert false;
return HColors.WHITE;
}
}
static class Gradient {
private final String s1;
private final char sep;
private final String s2;
private final HColorSet me;
Gradient(String s1, char sep, String s2) {
Gradient(HColorSet me, String s1, char sep, String s2) {
this.me = me;
this.s1 = s1;
this.sep = sep;
this.s2 = s2;
}
boolean isValid() {
return isColorValid(s1) && isColorValid(s2);
return me.isColorValid(s1) && me.isColorValid(s2);
}
// ::comment when __HAXE__
HColorGradient buildInternal() {
return HColors.gradient(build(s1), build(s2), sep);
return HColors.gradient(me.build(s1), me.build(s2), sep);
}
// ::done
}
class Automatic {
static class Automatic {
private final String[] colors;
private final HColorSet me;
public Automatic(String[] colors) {
public Automatic(HColorSet me, String[] colors) {
this.me = me;
this.colors = colors;
}
boolean isValid() {
for (String color : colors)
if (isColorValid(color) == false)
if (me.isColorValid(color) == false)
return false;
return true;
@ -266,22 +284,24 @@ public class HColorSet {
HColorScheme buildInternal() {
if (colors.length == 2)
return new HColorScheme(build(colors[0]), build(colors[1]), null);
return new HColorScheme(me.build(colors[0]), me.build(colors[1]), null);
return new HColorScheme(build(colors[0]), build(colors[1]), build(colors[2]));
return new HColorScheme(me.build(colors[0]), me.build(colors[1]), me.build(colors[2]));
}
}
private Gradient gradientFromString(String s) {
// ::comment when __HAXE__
final Matcher2 m = MyPattern.cmpile("[-\\\\|/]").matcher(s);
if (m.find()) {
final char sep = m.group(0).charAt(0);
final int idx = s.indexOf(sep);
final String s1 = s.substring(0, idx);
final String s2 = s.substring(idx + 1);
return new Gradient(s1, sep, s2);
return new Gradient(this, s1, sep, s2);
}
// ::done
return null;
}
@ -294,23 +314,11 @@ public class HColorSet {
final int idx = s.indexOf(':');
if (idx != -1)
return new Automatic(s.substring(1).split(":"));
return new Automatic(this, s.substring(1).split(":"));
return null;
}
public HColor getColorOrWhite(String s) {
if (isColorValid(Objects.requireNonNull(s)) == false)
return HColors.WHITE;
try {
return getColor(s);
} catch (NoSuchColorException e) {
assert false;
return HColors.WHITE;
}
}
public HColor getColorLEGACY(String s) throws NoSuchColorException {
return getColor(s);
}
@ -323,9 +331,11 @@ public class HColorSet {
if (automatic != null)
return automatic.buildInternal();
// ::comment when __HAXE__
final Gradient gradient = gradientFromString(s);
if (gradient != null)
return gradient.buildInternal();
// ::done
if (s.equalsIgnoreCase("#transparent") || s.equalsIgnoreCase("transparent"))
s = "#00000000";
@ -358,8 +368,10 @@ public class HColorSet {
final Color color;
if (s.equalsIgnoreCase("transparent") || s.equalsIgnoreCase("background")) {
return HColors.none();
// ::comment when __HAXE__
} else if (s.equalsIgnoreCase("automatic")) {
return new HColorAutomagic();
// ::done
} else if (s.matches("[0-9A-Fa-f]")) {
s = "" + s.charAt(0) + s.charAt(0) + s.charAt(0) + s.charAt(0) + s.charAt(0) + s.charAt(0);
color = new Color(Integer.parseInt(s, 16));
@ -396,5 +408,4 @@ public class HColorSet {
return s;
}
}

View File

@ -44,15 +44,10 @@ public class HColorSimple extends HColor {
private final Color color;
private final HColor dark;
@Override
public int hashCode() {
return color.hashCode();
}
@Override
public String toString() {
final boolean withDark = this != dark;
final boolean withDark = dark != null;
final StringBuilder sb = new StringBuilder();
if (withDark)
@ -65,6 +60,7 @@ public class HColorSimple extends HColor {
return sb.toString();
}
// ::comment when __HAXE__
@Override
public String asString() {
if (isTransparent())
@ -76,29 +72,43 @@ public class HColorSimple extends HColor {
return "#" + Integer.toHexString(color.getRGB());
}
@Override
public boolean equals(Object other) {
if (other instanceof HColorSimple == false)
return false;
return this.color.equals(((HColorSimple) other).color);
}
@Override
public int hashCode() {
return color.hashCode();
}
@Override
public HColor lighten(int ratio) {
final float[] hsl = new HSLColor(color).getHSL();
hsl[2] += hsl[2] * (ratio / 100.0);
return new HColorSimple(new HSLColor(hsl).getRGB());
return HColorSimple.create(new HSLColor(hsl).getRGB());
}
@Override
public HColor darken(int ratio) {
final float[] hsl = new HSLColor(color).getHSL();
hsl[2] -= hsl[2] * (ratio / 100.0);
return new HColorSimple(new HSLColor(hsl).getRGB());
return HColorSimple.create(new HSLColor(hsl).getRGB());
}
@Override
public HColor reverseHsluv() {
return new HColorSimple(ColorUtils.reverseHsluv(color));
return HColorSimple.create(ColorUtils.reverseHsluv(color));
}
@Override
public HColor reverse() {
return new HColorSimple(ColorOrder.RGB.getReverse(color));
return HColorSimple.create(ColorOrder.RGB.getReverse(color));
}
// ::done
@Override
public boolean isDark() {
@ -110,17 +120,8 @@ public class HColorSimple extends HColor {
return color.getAlpha() == 0;
}
@Override
public boolean equals(Object other) {
if (other instanceof HColorSimple == false)
return false;
return this.color.equals(((HColorSimple) other).color);
}
HColorSimple(Color c) {
this.color = c;
this.dark = this;
public static HColorSimple create(Color c) {
return new HColorSimple(c, null);
}
private HColorSimple(Color c, HColor dark) {
@ -133,9 +134,10 @@ public class HColorSimple extends HColor {
}
public HColor asMonochrome() {
return new HColorSimple(ColorUtils.getGrayScaleColor(color));
return HColorSimple.create(ColorUtils.getGrayScaleColor(color));
}
// ::comment when __HAXE__
public HColor asMonochrome(HColorSimple colorForMonochrome, double minGray, double maxGray) {
final Color tmp = ColorUtils.getGrayScaleColor(color);
final int gray = tmp.getGreen();
@ -144,22 +146,14 @@ public class HColorSimple extends HColor {
final double coef = (gray - minGray) / 256.0;
final Color result = ColorUtils.grayToColor(coef, colorForMonochrome.color);
return new HColorSimple(result);
return HColorSimple.create(result);
}
@Override
public HColor opposite() {
final Color mono = ColorUtils.getGrayScaleColor(color);
final int grayScale = 255 - mono.getGreen() > 127 ? 255 : 0;
return new HColorSimple(new Color(grayScale, grayScale, grayScale));
}
public int distanceTo(HColorSimple other) {
return ColorUtils.distance(this.color, other.color);
}
public boolean isGray() {
return color.getRed() == color.getGreen() && color.getGreen() == color.getBlue();
public Color toColor(ColorMapper mapper) {
if (this.isTransparent())
return getAwtColor();
return mapper.fromColorSimple(this);
}
public static HColorSimple unlinear(HColorSimple color1, HColorSimple color2, int completionInt) {
@ -178,7 +172,7 @@ public class HColorSimple extends HColor {
final HSLColor col = new HSLColor(hsl);
return new HColorSimple(col.getRGB());
return HColorSimple.create(col.getRGB());
}
private static float[] linear(float factor, float[] hsl1, float[] hsl2) {
@ -192,6 +186,23 @@ public class HColorSimple extends HColor {
return x + (y - x) * factor;
}
// ::done
@Override
public HColor opposite() {
final Color mono = ColorUtils.getGrayScaleColor(color);
final int grayScale = 255 - mono.getGreen() > 127 ? 255 : 0;
return HColorSimple.create(new Color(grayScale, grayScale, grayScale));
}
public int distanceTo(HColorSimple other) {
return ColorUtils.distance(this.color, other.color);
}
public boolean isGray() {
return color.getRed() == color.getGreen() && color.getGreen() == color.getBlue();
}
@Override
public HColor withDark(HColor dark) {
return new HColorSimple(color, dark);
@ -199,14 +210,9 @@ public class HColorSimple extends HColor {
@Override
public HColor darkSchemeTheme() {
if (dark == null)
return this;
return dark;
}
@Override
public Color toColor(ColorMapper mapper) {
if (this.isTransparent())
return getAwtColor();
return mapper.fromColorSimple(this);
}
}

View File

@ -118,6 +118,18 @@ public class HColors {
}
private static final HColorSimple TRANSPARENT = HColorSimple.create(new Color(0, 0, 0, 0));
public static HColor transparent() {
return TRANSPARENT;
}
public static HColor none() {
return TRANSPARENT;
}
// ::comment when __HAXE__
public static HColor noGradient(HColor color) {
if (color instanceof HColorGradient)
return ((HColorGradient) color).getColor1();
@ -133,16 +145,6 @@ public class HColors {
return color.bg();
}
private static final HColorSimple TRANSPARENT = new HColorSimple(new Color(0, 0, 0, 0));
public static HColor transparent() {
return TRANSPARENT;
}
public static HColor none() {
return TRANSPARENT;
}
public static HColor unlinear(HColor color1, HColor color2, int completion) {
if (completion == 0)
return color1;
@ -163,9 +165,10 @@ public class HColors {
public static HColorGradient gradient(HColor color1, HColor color2, char policy) {
return new HColorGradient(color1, color2, policy);
}
// ::done
public static HColor simple(Color c) {
return new HColorSimple(c);
return HColorSimple.create(c);
}
}

View File

@ -23,6 +23,7 @@ import java.awt.Color;
* a color by adjusting the luminance value.
*/
public class HSLColor {
// ::remove file when __HAXE__
private Color rgb;
private float[] hsl;
private float alpha;

View File

@ -16,6 +16,7 @@ import java.util.List;
*
*/
public class HUSLColorConverter {
// ::remove file when __HAXE__
private static double[][] m = new double[][] {
new double[] { 3.240969941904521, -1.537383177570093, -0.498610760293 },
new double[] { -0.96924363628087, 1.87596750150772, 0.041555057407175 },

View File

@ -36,5 +36,6 @@
package net.sourceforge.plantuml.klimt.color;
public class NoSuchColorRuntimeException extends RuntimeException {
// ::remove file when __HAXE__
}

View File

@ -55,6 +55,7 @@ import net.sourceforge.plantuml.klimt.shape.UHidden;
import net.sourceforge.plantuml.url.Url;
public abstract class AbstractCommonUGraphic implements UGraphic {
// ::remove file when __HAXE__
private UStroke stroke = UStroke.simple();
private UPattern pattern = UPattern.FULL;

View File

@ -67,7 +67,7 @@ import net.sourceforge.plantuml.klimt.shape.URectangle;
import net.sourceforge.plantuml.klimt.shape.UText;
public abstract class AbstractUGraphic<O> extends AbstractCommonUGraphic {
// ::remove folder when __HAXE__
// ::remove file when __HAXE__
private final O graphic;
private final MinMaxMutable minmax;

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.shape.UHorizontalLine;
public abstract class AbstractUGraphicHorizontalLine extends UGraphicDelegator {
// ::remove file when __HAXE__
private UTranslate translate = UTranslate.none();

View File

@ -70,6 +70,7 @@ import net.sourceforge.plantuml.klimt.shape.URectangle;
import net.sourceforge.plantuml.klimt.shape.UText;
public final class LimitFinder extends UGraphicNo {
// ::remove file when __HAXE__
@Override
public UGraphic apply(UChange change) {

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.shape.UText;
public class TextLimitFinder extends UGraphicNo {
// ::remove file when __HAXE__
private final MinMaxMutable minmax;

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.url.Url;
public abstract class UGraphicDelegator implements UGraphic {
// ::remove file when __HAXE__
final private UGraphic ug;

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.klimt.UChange;
import net.sourceforge.plantuml.klimt.UShape;
public class UGraphicFilter extends UGraphicDelegator {
// ::remove file when __HAXE__
public UGraphic apply(UChange translate) {
throw new UnsupportedOperationException();

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.klimt.UShape;
import net.sourceforge.plantuml.klimt.shape.UDrawable;
public class UGraphicInterceptorUDrawable extends UGraphicDelegator {
// ::remove file when __HAXE__
public UGraphicInterceptorUDrawable(UGraphic ug) {
super(ug);

View File

@ -50,6 +50,7 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.url.Url;
public abstract class UGraphicNo implements UGraphic {
// ::remove file when __HAXE__
private final StringBounder stringBounder;
private final UTranslate translate;

View File

@ -44,6 +44,7 @@ import net.sourceforge.plantuml.klimt.color.HColors;
import net.sourceforge.plantuml.klimt.geom.EnsureVisible;
public class UGraphicNull extends AbstractUGraphic<String> implements EnsureVisible {
// ::remove file when __HAXE__
@Override
protected AbstractCommonUGraphic copyUGraphic() {

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.shape.UHorizontalLine;
public class UGraphicStencil extends AbstractUGraphicHorizontalLine {
// ::remove file when __HAXE__
private final Stencil stencil;
private final UStroke defaultStroke;

View File

@ -44,7 +44,7 @@ import net.sourceforge.plantuml.regex.Matcher2;
import net.sourceforge.plantuml.regex.MyPattern;
public enum FontStyle {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
PLAIN, ITALIC, BOLD, UNDERLINE, STRIKE, WAVE, BACKCOLOR;
public UFont mutateFont(UFont font) {

View File

@ -36,7 +36,7 @@
package net.sourceforge.plantuml.klimt.geom;
public class BezierUtils {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
static public double getEndingAngle(final XCubicCurve2D left) {
if (left.getCtrlP2().equals(left.getP2())) {

View File

@ -39,7 +39,7 @@ import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.font.StringBounder;
public interface MagneticBorder {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
public UTranslate getForceAt(StringBounder stringBounder, XPoint2D position);

View File

@ -39,7 +39,7 @@ import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.font.StringBounder;
public class MagneticBorderNone implements MagneticBorder {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
@Override
public UTranslate getForceAt(StringBounder stringBounder, XPoint2D position) {

View File

@ -42,7 +42,6 @@ import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.shape.URectangle;
public class MinMax {
// :: remove file when __HAXE__
private final double maxX;
private final double maxY;
@ -153,6 +152,7 @@ public class MinMax {
return new XDimension2D(maxX - minX, maxY - minY);
}
// ::comment when __HAXE__
public void drawGray(UGraphic ug) {
draw(ug, HColors.GRAY);
}
@ -162,6 +162,7 @@ public class MinMax {
ug = ug.apply(new UTranslate(minX, minY));
ug.draw(new URectangle(getWidth(), getHeight()));
}
// ::done
public MinMax translate(UTranslate translate) {
final double dx = translate.getDx();

View File

@ -40,7 +40,7 @@ import java.util.Map;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
public interface PlacementStrategy {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
public void add(TextBlock block);

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
public class PlacementStrategyVisibility extends AbstractPlacementStrategy {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
private final int col2;

View File

@ -42,7 +42,7 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
public class PlacementStrategyX1X2 extends AbstractPlacementStrategy {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
public PlacementStrategyX1X2(StringBounder stringBounder) {
super(stringBounder);

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
public class PlacementStrategyX1Y2Y3 extends AbstractPlacementStrategy {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
public PlacementStrategyX1Y2Y3(StringBounder stringBounder) {
super(stringBounder);

View File

@ -42,7 +42,7 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
public class PlacementStrategyY1Y2 extends AbstractPlacementStrategy {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
public PlacementStrategyY1Y2(StringBounder stringBounder) {
super(stringBounder);

View File

@ -42,7 +42,7 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
public class PlacementStrategyY1Y2Center extends AbstractPlacementStrategy {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
public PlacementStrategyY1Y2Center(StringBounder stringBounder) {
super(stringBounder);

View File

@ -42,7 +42,7 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
public class PlacementStrategyY1Y2Left extends AbstractPlacementStrategy {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
public PlacementStrategyY1Y2Left(StringBounder stringBounder) {
super(stringBounder);

View File

@ -42,7 +42,7 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
public class PlacementStrategyY1Y2Right extends AbstractPlacementStrategy {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
public PlacementStrategyY1Y2Right(StringBounder stringBounder) {
super(stringBounder);

View File

@ -46,8 +46,8 @@ public final class PositionableImpl implements Positionable {
this.dim = dim;
}
public PositionableImpl(XPoint2D pt, XDimension2D dim) {
this(pt.getX(), pt.getY(), dim);
public static PositionableImpl create(XPoint2D pt, XDimension2D dim) {
return new PositionableImpl(pt.getX(), pt.getY(), dim);
}
public XPoint2D getPosition() {

View File

@ -36,7 +36,7 @@
package net.sourceforge.plantuml.klimt.geom;
public class PositionableUtils {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
static private XRectangle2D convert(Positionable positionable) {
final XPoint2D position = positionable.getPosition();

View File

@ -38,7 +38,7 @@ package net.sourceforge.plantuml.klimt.geom;
import net.sourceforge.plantuml.klimt.UTranslate;
public class RectangleArea {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
private final double minX;
private final double minY;

View File

@ -46,7 +46,7 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
public class ULayoutGroup {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
private final PlacementStrategy placementStrategy;

View File

@ -1,7 +1,7 @@
package net.sourceforge.plantuml.klimt.geom;
public class XCubicCurve2D {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
public double x1;
public double y1;

View File

@ -46,7 +46,7 @@ import net.sourceforge.plantuml.svek.Ports;
import net.sourceforge.plantuml.svek.WithPorts;
class TextBlockMarged extends AbstractTextBlock implements TextBlock, WithPorts {
// ::remove file when __HAXE__
// ::remove file when __HAXE__
private final TextBlock textBlock;
private final double top;
@ -80,7 +80,7 @@ class TextBlockMarged extends AbstractTextBlock implements TextBlock, WithPorts
// URectangle(calculateDimension(ug.getStringBounder())));
final XDimension2D dim = calculateDimension(ug.getStringBounder());
if (dim.getWidth() > 0) {
ug.draw(new UEmpty(dim));
ug.draw(UEmpty.create(dim));
final UTranslate translate = new UTranslate(left, top);
textBlock.drawU(ug.apply(translate));
}

View File

@ -53,7 +53,7 @@ import net.sourceforge.plantuml.klimt.geom.XRectangle2D;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
public class TextBlockUtils {
// ::remove file when __HAXE__
// ::remove file when __HAXE__
public static final TextBlock EMPTY_TEXT_BLOCK = TextBlockUtils.empty(0, 0);
@ -100,11 +100,11 @@ public class TextBlockUtils {
}
public static Positionable asPositionable(TextBlock textBlock, StringBounder stringBounder, XPoint2D pt) {
return new PositionableImpl(pt, textBlock.calculateDimension(stringBounder));
return PositionableImpl.create(pt, textBlock.calculateDimension(stringBounder));
}
public static Positionable asPositionable(XDimension2D dim, StringBounder stringBounder, XPoint2D pt) {
return new PositionableImpl(pt, dim);
return PositionableImpl.create(pt, dim);
}
public static TextBlock mergeLR(TextBlock b1, TextBlock b2, VerticalAlignment verticallAlignment) {

View File

@ -43,15 +43,15 @@ public class UEmpty implements UShape {
private final double height;
public UEmpty(double width, double height) {
if (width == 0) {
if (width == 0)
throw new IllegalArgumentException();
}
this.width = width;
this.height = height;
}
public UEmpty(XDimension2D dim) {
this(dim.getWidth(), dim.getHeight());
public static UEmpty create(XDimension2D dim) {
return new UEmpty(dim.getWidth(), dim.getHeight());
}
public double getWidth() {

View File

@ -48,8 +48,8 @@ public class ULine extends AbstractShadowable implements UShapeSized {
private final double dx;
private final double dy;
public ULine(XPoint2D p1, XPoint2D p2) {
this(p2.getX() - p1.getX(), p2.getY() - p1.getY());
public static ULine create(XPoint2D p1, XPoint2D p2) {
return new ULine(p2.getX() - p1.getX(), p2.getY() - p1.getY());
}
public ULine(double dx, double dy) {

View File

@ -59,6 +59,7 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
public AbstractClassOrObjectDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source, type, orig);
setNamespaceSeparator(".");
}
final public boolean insertBetween(Entity entity1, Entity entity2, Entity node) {

View File

@ -44,13 +44,12 @@ import java.util.Map;
public class Plasma<DATA> {
private String separator;
private String separator = "\u0000";
private final Quark<DATA> root;
private final List<Quark<DATA>> quarks = new ArrayList<>();
private final Map<String, PEntry<DATA>> stats = new HashMap<String, PEntry<DATA>>();
public Plasma(String separator) {
this.separator = separator;
public Plasma() {
this.root = new Quark<DATA>(this, null, "");
}
@ -80,7 +79,7 @@ public class Plasma<DATA> {
}
public final boolean hasSeparator() {
return this.separator != null && this.separator != "\u0000";
return this.separator.equals("\u0000") == false;
}
public Collection<Quark<DATA>> quarks() {

View File

@ -48,13 +48,13 @@ import net.sourceforge.plantuml.plasma.Quark;
import net.sourceforge.plantuml.skin.UmlDiagramType;
public class StateDiagram extends AbstractEntityDiagram {
// :: remove folder when __HAXE__
// ::remove folder when __HAXE__
private static final String CONCURRENT_PREFIX = "CONC";
public StateDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.STATE, skinParam);
// setNamespaceSeparator(null);
setNamespaceSeparator(".");
}
public boolean checkConcurrentStateOk(Quark<Entity> code) {

View File

@ -109,7 +109,6 @@ public class StateDiagramFactory extends PSystemCommandFactory {
CommonCommands.addCommonCommands1(cmds);
cmds.add(new CommandHideShow2());
cmds.add(new CommandNamespaceSeparator());
}
}

View File

@ -101,7 +101,7 @@ public class ExtremityArrow extends Extremity {
public void drawLineIfTransparent(UGraphic ug) {
final XPoint2D pt1 = polygon.getPoint(0);
final XPoint2D pt2 = polygon.getPoint(2);
final ULine line = new ULine(pt1, pt2);
final ULine line = ULine.create(pt1, pt2);
ug.apply(UTranslate.point(pt1)).draw(line);
}

View File

@ -61,7 +61,7 @@ import net.sourceforge.plantuml.version.PSystemVersion;
import net.sourceforge.plantuml.version.Version;
class AboutWindow extends JFrame {
// :: remove folder when __CORE__
// ::remove folder when __CORE__
public AboutWindow() {
super();

View File

@ -43,6 +43,7 @@ import java.util.Set;
import net.sourceforge.plantuml.text.BackSlash;
public class CMapData {
// ::remove file when __HAXE__
private final StringBuilder stringBuilder = new StringBuilder();

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml.url;
final public class Check {
// ::remove file when __CORE__
// ::remove file when __HAXE__
private static boolean isJunit = false;

View File

@ -43,30 +43,29 @@ import net.sourceforge.plantuml.klimt.geom.EnsureVisible;
import net.sourceforge.plantuml.text.BackSlash;
public class Url implements EnsureVisible {
// ::remove folder when __HAXE__
private final String url;
private final String tooltip;
private final String label;
private boolean member;
public Url(String url, String tooltip) {
this(url, tooltip, null);
}
public Url(String url, String tooltip, String label) {
url = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(url, "\"");
this.url = url;
if (tooltip == null) {
// ::comment when __HAXE__
if (tooltip == null)
this.tooltip = url;
} else {
else
this.tooltip = BackSlash.manageNewLine(tooltip);
}
if (label == null || label.length() == 0) {
// ::done
// ::uncomment when __HAXE__
// this.tooltip = url;
// ::done
if (label == null || label.length() == 0)
this.label = url;
} else {
else
this.label = label;
}
}
public static boolean isLatex(String pendingUrl) {
@ -89,13 +88,15 @@ public class Url implements EnsureVisible {
return label;
}
// ::comment when __HAXE__
@Override
public String toString() {
return super.toString() + " " + url + " " + visible.getCoords(1.0);
}
// ::done
public String getCoords(double scale) {
// ::comment when __CORE__
// ::comment when __CORE__ or __HAXE__
if (Check.isJunit() && visible.getCoords(1.0).contains("0,0,0,0"))
throw new IllegalStateException(toString());
// ::done
@ -125,11 +126,11 @@ public class Url implements EnsureVisible {
public int compare(Url url1, Url url2) {
final double surface1 = url1.visible.getSurface();
final double surface2 = url2.visible.getSurface();
if (surface1 > surface2) {
if (surface1 > surface2)
return 1;
} else if (surface1 < surface2) {
else if (surface1 < surface2)
return -1;
}
return 0;
}
};

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexOptional;
public class UrlBuilder {
// ::remove file when __HAXE__
public static final IRegex MANDATORY = new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")");
public static final IRegex OPTIONAL = new RegexOptional(MANDATORY);

View File

@ -36,7 +36,7 @@
package net.sourceforge.plantuml.utils;
public interface Inspector<O> {
// :: remove file when __HAXE__
// ::remove file when __HAXE__
O peek(int ahead);
void jump();

View File

@ -39,6 +39,10 @@ import net.sourceforge.plantuml.klimt.geom.XDimension2D;
public class MathUtils {
public static int abs(int a) {
return (a < 0) ? -a : a;
}
public static double max(double a, double b) {
return Math.max(a, b);
}
@ -77,21 +81,21 @@ public class MathUtils {
return v;
// throw new IllegalArgumentException("min="+min+" max="+max+" v="+v);
}
if (v < min) {
if (v < min)
return min;
}
if (v > max) {
if (v > max)
return max;
}
return v;
}
public static XDimension2D max(XDimension2D dim1, XDimension2D dim2) {
public static XDimension2D maxDim(XDimension2D dim1, XDimension2D dim2) {
return new XDimension2D(Math.max(dim1.getWidth(), dim2.getWidth()),
Math.max(dim1.getHeight(), dim2.getHeight()));
}
public static XDimension2D max(XDimension2D dim1, XDimension2D dim2, XDimension2D dim3) {
public static XDimension2D maxDim(XDimension2D dim1, XDimension2D dim2, XDimension2D dim3) {
return new XDimension2D(MathUtils.max(dim1.getWidth(), dim2.getWidth(), dim3.getWidth()),
MathUtils.max(dim1.getHeight(), dim2.getHeight(), dim3.getHeight()));
}

View File

@ -82,7 +82,7 @@ public class Version {
}
public static int beta() {
final int beta = 5;
final int beta = 7;
return beta;
}

View File

@ -65,7 +65,7 @@ abstract class WBSTextBlock extends AbstractTextBlock {
}
final protected void drawLine(UGraphic ug, XPoint2D p1, XPoint2D p2) {
final ULine line = new ULine(p1, p2);
final ULine line = ULine.create(p1, p2);
getStyleUsed().applyStrokeAndLineColor(ug.apply(UTranslate.point(p1)), skinParam.getIHtmlColorSet()).draw(line);
}

View File

@ -36,14 +36,28 @@
package smetana.core.debug;
import java.util.LinkedHashMap;
import java.util.Map;
public final class SmetanaDebug {
// ::remove folder when __HAXE__
// ::remove folder when __HAXE__
static private final Map<String, String> methods = new LinkedHashMap<String, String>();
static public void LOG(String s) {
}
static public void ENTERING(String signature, String methodName) {
// if (methods.containsKey(methodName) == false)
// methods.put(methodName, methodName);
}
static public void LIST_METHODS() {
int i = 0;
for (String s : methods.keySet()) {
System.err.println("i=" + i + " " + s);
i++;
}
}
static public void LEAVING(String signature, String methodName) {