1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-11 12:42:26 +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 * @author Christian Treber, ct@ctreber.com
*/ */
public class ACearth { public class ACearth {
// :: remove folder when __CORE__ // ::remove folder when __CORE__
public static final String VERSION = "1.1"; public static final String VERSION = "1.1";
public static final String BUILD = "22.11.2002 004"; 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 public class MOBoolean extends MonitoredObject
{ {
// :: remove folder when __CORE__ // ::remove folder when __CORE__
private boolean fBoolean; private boolean fBoolean;
public MOBoolean() public MOBoolean()

View File

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

View File

@ -25,7 +25,7 @@ import java.util.Hashtable;
*/ */
public final class BarcodeFormat { public final class BarcodeFormat {
// ::remove folder when __HAXE__ // ::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. // 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 { 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> hides2 = new ArrayList<>();
private final List<HideOrShow2> removed = new ArrayList<>(); private final List<HideOrShow2> removed = new ArrayList<>();
protected final EntityFactory entityFactory = new EntityFactory(hides2, removed, this); protected final EntityFactory entityFactory = new EntityFactory(hides2, removed, this);
@ -104,6 +101,12 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
private boolean visibilityModifierPresent; 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) { public CucaDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source, type, orig); super(source, type, orig);
this.stacks.add(entityFactory.root().getData()); this.stacks.add(entityFactory.root().getData());
@ -143,19 +146,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(id); 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 @Override
public boolean hasUrl() { public boolean hasUrl() {
for (Quark<Entity> quark : entityFactory.quarks()) { for (Quark<Entity> quark : entityFactory.quarks()) {
@ -233,7 +223,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
public String removePortId(String id) { public String removePortId(String id) {
// To be kept // To be kept
if ("::".equals(namespaceSeparator)) if ("::".equals(getNamespaceSeparator()))
return id; return id;
final int x = id.lastIndexOf("::"); final int x = id.lastIndexOf("::");
if (x == -1) if (x == -1)
@ -243,7 +233,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
public String getPortId(String id) { public String getPortId(String id) {
// To be kept // To be kept
if ("::".equals(namespaceSeparator)) if ("::".equals(getNamespaceSeparator()))
return null; return null;
final int x = id.lastIndexOf("::"); final int x = id.lastIndexOf("::");
if (x == -1) if (x == -1)

View File

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

View File

@ -75,6 +75,16 @@ public abstract class AbstractPSystem implements Diagram {
private int splitPagesHorizontal = 1; private int splitPagesHorizontal = 1;
private int splitPagesVertical = 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) { public AbstractPSystem(UmlSource source) {
this.source = Objects.requireNonNull(source); this.source = Objects.requireNonNull(source);
} }

View File

@ -58,7 +58,7 @@ import net.sourceforge.plantuml.skin.SplitParam;
import net.sourceforge.plantuml.utils.Log; import net.sourceforge.plantuml.utils.Log;
public class PSystemUtils { public class PSystemUtils {
// :: remove file when __CORE__ // ::remove file when __CORE__
// ::remove file when __HAXE__ // ::remove file when __HAXE__
public static List<FileImageData> exportDiagrams(Diagram system, SuggestedFile suggested, 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; import java.util.logging.LogRecord;
public class ProgressBar { public class ProgressBar {
// :: remove file when __CORE__ // ::remove file when __CORE__
// ::remove file when __HAXE__ // ::remove file when __HAXE__
private static final java.util.logging.Logger logger; private static final java.util.logging.Logger logger;

View File

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

View File

@ -73,8 +73,7 @@ public final class EntityFactory implements IEntityFactory {
this.hides2 = hides2; this.hides2 = hides2;
this.removed = removed; this.removed = removed;
this.diagram = diagram; this.diagram = diagram;
this.namespace = new Plasma<Entity>("."); this.namespace = new Plasma<Entity>();
// this.printspace = new Plasma<Entity>(".");
this.root = namespace.root(); this.root = namespace.root();
this.rootGroup = new Entity(this.root, this, null, GroupType.ROOT, 0); 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; import net.sourceforge.plantuml.core.UmlSource;
public class PSystemXearth extends AbstractPSystem { public class PSystemXearth extends AbstractPSystem {
// :: remove folder when __CORE__ // ::remove folder when __CORE__
final private int width; final private int width;
final private int height; final private int height;

View File

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

View File

@ -88,7 +88,7 @@ public enum BoxStyle {
ug.apply(UTranslate.dx(width - PADDING)).draw(vline); ug.apply(UTranslate.dx(width - PADDING)).draw(vline);
} }
}, },
SDL_SAVE("save", '\\', 0) { SDL_SAVE("load", '\\', 0) {
@Override @Override
protected Shadowable getShape(double width, double height, double roundCorner) { protected Shadowable getShape(double width, double height, double roundCorner) {
final UPolygon result = new UPolygon(); final UPolygon result = new UPolygon();
@ -99,7 +99,7 @@ public enum BoxStyle {
return result; return result;
} }
}, },
SDL_ANTISAVE("load", '/', 0) { SDL_ANTISAVE("save", '/', 0) {
@Override @Override
protected Shadowable getShape(double width, double height, double roundCorner) { protected Shadowable getShape(double width, double height, double roundCorner) {
final UPolygon result = new UPolygon(); 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 UDrawable shape = boxStyle.getUDrawable(widthTotal, heightTotal, shadowing, roundCorner);
final XDimension2D dimTotal = calculateDimension(ug.getStringBounder()); final XDimension2D dimTotal = calculateDimension(ug.getStringBounder());
ug.draw(new UEmpty(dimTotal)); ug.draw(UEmpty.create(dimTotal));
final UStroke thickness = style.getStroke(); 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 XDimension2D dim = gtiles.get(i).calculateDimension(stringBounder);
final UTranslate pos = getPosition(i); final UTranslate pos = getPosition(i);
final XDimension2D corner = dim.applyTranslate(pos); final XDimension2D corner = dim.applyTranslate(pos);
result = MathUtils.max(result, corner); result = MathUtils.maxDim(result, corner);
} }
return result; return result;
} }

View File

@ -107,7 +107,7 @@ public class GtileHexagonInsideLabelled extends GtileWithMargin {
final UTranslate east = getCoord(GPoint.EAST_HOOK); final UTranslate east = getCoord(GPoint.EAST_HOOK);
final XDimension2D eastCorner = eastLabel.calculateDimension(stringBounder).applyTranslate(east); 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) { public XDimension2D calculateDimension(StringBounder stringBounder) {
final XDimension2D corner1 = dim1.applyTranslate(getPos1()); final XDimension2D corner1 = dim1.applyTranslate(getPos1());
final XDimension2D corner2 = dim2.applyTranslate(getPos2()); final XDimension2D corner2 = dim2.applyTranslate(getPos2());
return MathUtils.max(corner1, corner2); return MathUtils.maxDim(corner1, corner2);
} }
public Set<Swimlane> getSwimlanes() { public Set<Swimlane> getSwimlanes() {

View File

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

View File

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

View File

@ -35,7 +35,7 @@
*/ */
package net.sourceforge.plantuml.classdiagram.command; 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.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.regex.IRegex; 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.regex.RegexResult;
import net.sourceforge.plantuml.utils.LineLocation; 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()); super(getRegexConcat());
} }
@ -64,13 +66,13 @@ public class CommandNamespaceSeparator extends SingleLineCommand2<CucaDiagram> {
} }
@Override @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); final String s = arg.get("SEPARATOR", 0);
if ("none".equalsIgnoreCase(s)) { if ("none".equalsIgnoreCase(s))
diagram.setNamespaceSeparator(null); diagram.setNamespaceSeparator(null);
} else { else
diagram.setNamespaceSeparator(s); diagram.setNamespaceSeparator(s);
}
return CommandExecutionResult.ok(); 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.CommandHideShowByGender;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShowByVisibility; 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.sequencediagram.command.CommandSkin;
import net.sourceforge.plantuml.statediagram.command.CommandHideEmptyDescription; import net.sourceforge.plantuml.statediagram.command.CommandHideEmptyDescription;
import net.sourceforge.plantuml.style.CommandStyleImport; import net.sourceforge.plantuml.style.CommandStyleImport;
@ -106,6 +107,7 @@ public final class CommonCommands {
cmds.add(CommandHeader.ME); cmds.add(CommandHeader.ME);
cmds.add(CommandMultilinesHeader.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; import net.sourceforge.plantuml.skin.UmlDiagramType;
public class CompositeDiagram extends AbstractEntityDiagram { public class CompositeDiagram extends AbstractEntityDiagram {
// :: remove folder when __HAXE__ // ::remove folder when __HAXE__
public CompositeDiagram(UmlSource source, Map<String, String> skinParam) { public CompositeDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.COMPOSITE, skinParam); super(source, UmlDiagramType.COMPOSITE, skinParam);

View File

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

View File

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

View File

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

View File

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

View File

@ -49,7 +49,7 @@ public class Arrow {
public void drawArrow(UGraphic ug) { public void drawArrow(UGraphic ug) {
ug = ug.apply(UStroke.simple()); 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 dist = p1.distance(p2);
final double alpha = Math.atan2(p1p2.getDX(), p1p2.getDY()); 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; import net.sourceforge.plantuml.klimt.color.HColor;
public interface UBackground extends UChange { public interface UBackground extends UChange {
// ::remove file when __HAXE__
public HColor getBackColor(); public HColor getBackColor();

View File

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

View File

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

View File

@ -50,6 +50,7 @@ public abstract class ColorMapper {
return simple.getAwtColor(); return simple.getAwtColor();
} }
}; };
// ::comment when __HAXE__
public final static ColorMapper DARK_MODE = new ColorMapper() { public final static ColorMapper DARK_MODE = new ColorMapper() {
@Override @Override
public Color fromColorSimple(HColorSimple simple) { 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; import java.awt.Color;
public enum ColorOrder { public enum ColorOrder {
// ::remove file when __HAXE__
RGB, RBG, GRB, GBR, BRG, BGR; RGB, RBG, GRB, GBR, BRG, BGR;
public Color getColor(Color color) { public Color getColor(Color color) {

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult; import net.sourceforge.plantuml.regex.RegexResult;
public class ColorParser { public class ColorParser {
// ::remove file when __HAXE__
private static final String COLOR_REGEXP = "#\\w+[-\\\\|/]?\\w+"; 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 java.awt.Color;
import net.sourceforge.plantuml.utils.MathUtils;
public class ColorUtils { public class ColorUtils {
public static int getGrayScale(Color color) { 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 // YIQ equation from http://24ways.org/2010/calculating-color-contrast
return getGrayScaleInternal(red, green, blue) / 1000; final int result = getGrayScaleInternal(red, green, blue) / 1000;
} return result;
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);
} }
private static int getGrayScaleInternal(int red, int green, int blue) { private static int getGrayScaleInternal(int red, int green, int blue) {
@ -60,11 +56,11 @@ public class ColorUtils {
return red * 299 + green * 587 + blue * 114; 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 red = (rgb & 0x00FF0000) >> 16;
final int green = (rgb & 0x0000FF00) >> 8; final int green = (rgb & 0x0000FF00) >> 8;
final int blue = (rgb & 0x000000FF); final int blue = (rgb & 0x000000FF);
return getGrayScale(red, green, blue); return getGrayScaleInternalFromRGB(red, green, blue);
} }
public static Color getGrayScaleColor(Color color) { public static Color getGrayScaleColor(Color color) {
@ -77,6 +73,15 @@ public class ColorUtils {
return new Color(grayScale, grayScale, grayScale); 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 :-) * This code is still experimental. If you can improve it, please go ahead :-)
* *
@ -170,5 +175,6 @@ public class ColorUtils {
return result; return result;
} }
// ::done
} }

View File

@ -50,6 +50,7 @@ import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.style.ISkinParam; import net.sourceforge.plantuml.style.ISkinParam;
public class Colors { public class Colors {
// ::remove file when __HAXE__
private final Map<ColorType, HColor> map = new EnumMap<ColorType, HColor>(ColorType.class); private final Map<ColorType, HColor> map = new EnumMap<ColorType, HColor>(ColorType.class);
private LinkStyle lineStyle = null; 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.UBackground;
import net.sourceforge.plantuml.klimt.UChange; 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 { public abstract class HColor implements UChange {
// ::remove folder when __HAXE__
public UBackground bg() { public UBackground bg() {
return new UBackground() { return new Back(this);
public HColor getBackColor() {
return HColor.this;
}
};
} }
public Color toColor(ColorMapper mapper) { public Color toColor(ColorMapper mapper) {
@ -94,9 +103,11 @@ public abstract class HColor implements UChange {
return true; return true;
} }
// ::comment when __HAXE__
public String asString() { public String asString() {
return "?" + getClass().getSimpleName(); return "?" + getClass().getSimpleName();
} }
// ::done
public HColor darkSchemeTheme() { public HColor darkSchemeTheme() {
return this; return this;

View File

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

View File

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

View File

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

View File

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

View File

@ -44,15 +44,10 @@ public class HColorSimple extends HColor {
private final Color color; private final Color color;
private final HColor dark; private final HColor dark;
@Override
public int hashCode() {
return color.hashCode();
}
@Override @Override
public String toString() { public String toString() {
final boolean withDark = this != dark; final boolean withDark = dark != null;
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
if (withDark) if (withDark)
@ -65,6 +60,7 @@ public class HColorSimple extends HColor {
return sb.toString(); return sb.toString();
} }
// ::comment when __HAXE__
@Override @Override
public String asString() { public String asString() {
if (isTransparent()) if (isTransparent())
@ -76,29 +72,43 @@ public class HColorSimple extends HColor {
return "#" + Integer.toHexString(color.getRGB()); 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 @Override
public HColor lighten(int ratio) { public HColor lighten(int ratio) {
final float[] hsl = new HSLColor(color).getHSL(); final float[] hsl = new HSLColor(color).getHSL();
hsl[2] += hsl[2] * (ratio / 100.0); hsl[2] += hsl[2] * (ratio / 100.0);
return new HColorSimple(new HSLColor(hsl).getRGB()); return HColorSimple.create(new HSLColor(hsl).getRGB());
} }
@Override @Override
public HColor darken(int ratio) { public HColor darken(int ratio) {
final float[] hsl = new HSLColor(color).getHSL(); final float[] hsl = new HSLColor(color).getHSL();
hsl[2] -= hsl[2] * (ratio / 100.0); hsl[2] -= hsl[2] * (ratio / 100.0);
return new HColorSimple(new HSLColor(hsl).getRGB()); return HColorSimple.create(new HSLColor(hsl).getRGB());
} }
@Override @Override
public HColor reverseHsluv() { public HColor reverseHsluv() {
return new HColorSimple(ColorUtils.reverseHsluv(color)); return HColorSimple.create(ColorUtils.reverseHsluv(color));
} }
@Override @Override
public HColor reverse() { public HColor reverse() {
return new HColorSimple(ColorOrder.RGB.getReverse(color)); return HColorSimple.create(ColorOrder.RGB.getReverse(color));
} }
// ::done
@Override @Override
public boolean isDark() { public boolean isDark() {
@ -110,17 +120,8 @@ public class HColorSimple extends HColor {
return color.getAlpha() == 0; return color.getAlpha() == 0;
} }
@Override public static HColorSimple create(Color c) {
public boolean equals(Object other) { return new HColorSimple(c, null);
if (other instanceof HColorSimple == false)
return false;
return this.color.equals(((HColorSimple) other).color);
}
HColorSimple(Color c) {
this.color = c;
this.dark = this;
} }
private HColorSimple(Color c, HColor dark) { private HColorSimple(Color c, HColor dark) {
@ -133,9 +134,10 @@ public class HColorSimple extends HColor {
} }
public HColor asMonochrome() { 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) { public HColor asMonochrome(HColorSimple colorForMonochrome, double minGray, double maxGray) {
final Color tmp = ColorUtils.getGrayScaleColor(color); final Color tmp = ColorUtils.getGrayScaleColor(color);
final int gray = tmp.getGreen(); final int gray = tmp.getGreen();
@ -144,22 +146,14 @@ public class HColorSimple extends HColor {
final double coef = (gray - minGray) / 256.0; final double coef = (gray - minGray) / 256.0;
final Color result = ColorUtils.grayToColor(coef, colorForMonochrome.color); final Color result = ColorUtils.grayToColor(coef, colorForMonochrome.color);
return new HColorSimple(result); return HColorSimple.create(result);
} }
@Override @Override
public HColor opposite() { public Color toColor(ColorMapper mapper) {
final Color mono = ColorUtils.getGrayScaleColor(color); if (this.isTransparent())
final int grayScale = 255 - mono.getGreen() > 127 ? 255 : 0; return getAwtColor();
return new HColorSimple(new Color(grayScale, grayScale, grayScale)); return mapper.fromColorSimple(this);
}
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 static HColorSimple unlinear(HColorSimple color1, HColorSimple color2, int completionInt) { 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); 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) { private static float[] linear(float factor, float[] hsl1, float[] hsl2) {
@ -192,6 +186,23 @@ public class HColorSimple extends HColor {
return x + (y - x) * factor; 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 @Override
public HColor withDark(HColor dark) { public HColor withDark(HColor dark) {
return new HColorSimple(color, dark); return new HColorSimple(color, dark);
@ -199,14 +210,9 @@ public class HColorSimple extends HColor {
@Override @Override
public HColor darkSchemeTheme() { public HColor darkSchemeTheme() {
if (dark == null)
return this;
return dark; 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) { public static HColor noGradient(HColor color) {
if (color instanceof HColorGradient) if (color instanceof HColorGradient)
return ((HColorGradient) color).getColor1(); return ((HColorGradient) color).getColor1();
@ -133,16 +145,6 @@ public class HColors {
return color.bg(); 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) { public static HColor unlinear(HColor color1, HColor color2, int completion) {
if (completion == 0) if (completion == 0)
return color1; return color1;
@ -163,9 +165,10 @@ public class HColors {
public static HColorGradient gradient(HColor color1, HColor color2, char policy) { public static HColorGradient gradient(HColor color1, HColor color2, char policy) {
return new HColorGradient(color1, color2, policy); return new HColorGradient(color1, color2, policy);
} }
// ::done
public static HColor simple(Color c) { 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. * a color by adjusting the luminance value.
*/ */
public class HSLColor { public class HSLColor {
// ::remove file when __HAXE__
private Color rgb; private Color rgb;
private float[] hsl; private float[] hsl;
private float alpha; private float alpha;

View File

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

View File

@ -36,5 +36,6 @@
package net.sourceforge.plantuml.klimt.color; package net.sourceforge.plantuml.klimt.color;
public class NoSuchColorRuntimeException extends RuntimeException { 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; import net.sourceforge.plantuml.url.Url;
public abstract class AbstractCommonUGraphic implements UGraphic { public abstract class AbstractCommonUGraphic implements UGraphic {
// ::remove file when __HAXE__
private UStroke stroke = UStroke.simple(); private UStroke stroke = UStroke.simple();
private UPattern pattern = UPattern.FULL; 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; import net.sourceforge.plantuml.klimt.shape.UText;
public abstract class AbstractUGraphic<O> extends AbstractCommonUGraphic { public abstract class AbstractUGraphic<O> extends AbstractCommonUGraphic {
// ::remove folder when __HAXE__ // ::remove file when __HAXE__
private final O graphic; private final O graphic;
private final MinMaxMutable minmax; private final MinMaxMutable minmax;

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.shape.UHorizontalLine; import net.sourceforge.plantuml.klimt.shape.UHorizontalLine;
public abstract class AbstractUGraphicHorizontalLine extends UGraphicDelegator { public abstract class AbstractUGraphicHorizontalLine extends UGraphicDelegator {
// ::remove file when __HAXE__
private UTranslate translate = UTranslate.none(); 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; import net.sourceforge.plantuml.klimt.shape.UText;
public final class LimitFinder extends UGraphicNo { public final class LimitFinder extends UGraphicNo {
// ::remove file when __HAXE__
@Override @Override
public UGraphic apply(UChange change) { 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; import net.sourceforge.plantuml.klimt.shape.UText;
public class TextLimitFinder extends UGraphicNo { public class TextLimitFinder extends UGraphicNo {
// ::remove file when __HAXE__
private final MinMaxMutable minmax; private final MinMaxMutable minmax;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -36,7 +36,7 @@
package net.sourceforge.plantuml.klimt.geom; package net.sourceforge.plantuml.klimt.geom;
public class BezierUtils { public class BezierUtils {
// :: remove file when __HAXE__ // ::remove file when __HAXE__
static public double getEndingAngle(final XCubicCurve2D left) { static public double getEndingAngle(final XCubicCurve2D left) {
if (left.getCtrlP2().equals(left.getP2())) { 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; import net.sourceforge.plantuml.klimt.font.StringBounder;
public interface MagneticBorder { public interface MagneticBorder {
// :: remove file when __HAXE__ // ::remove file when __HAXE__
public UTranslate getForceAt(StringBounder stringBounder, XPoint2D position); 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; import net.sourceforge.plantuml.klimt.font.StringBounder;
public class MagneticBorderNone implements MagneticBorder { public class MagneticBorderNone implements MagneticBorder {
// :: remove file when __HAXE__ // ::remove file when __HAXE__
@Override @Override
public UTranslate getForceAt(StringBounder stringBounder, XPoint2D position) { 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; import net.sourceforge.plantuml.klimt.shape.URectangle;
public class MinMax { public class MinMax {
// :: remove file when __HAXE__
private final double maxX; private final double maxX;
private final double maxY; private final double maxY;
@ -153,6 +152,7 @@ public class MinMax {
return new XDimension2D(maxX - minX, maxY - minY); return new XDimension2D(maxX - minX, maxY - minY);
} }
// ::comment when __HAXE__
public void drawGray(UGraphic ug) { public void drawGray(UGraphic ug) {
draw(ug, HColors.GRAY); draw(ug, HColors.GRAY);
} }
@ -162,6 +162,7 @@ public class MinMax {
ug = ug.apply(new UTranslate(minX, minY)); ug = ug.apply(new UTranslate(minX, minY));
ug.draw(new URectangle(getWidth(), getHeight())); ug.draw(new URectangle(getWidth(), getHeight()));
} }
// ::done
public MinMax translate(UTranslate translate) { public MinMax translate(UTranslate translate) {
final double dx = translate.getDx(); final double dx = translate.getDx();

View File

@ -40,7 +40,7 @@ import java.util.Map;
import net.sourceforge.plantuml.klimt.shape.TextBlock; import net.sourceforge.plantuml.klimt.shape.TextBlock;
public interface PlacementStrategy { public interface PlacementStrategy {
// :: remove file when __HAXE__ // ::remove file when __HAXE__
public void add(TextBlock block); 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; import net.sourceforge.plantuml.klimt.shape.TextBlock;
public class PlacementStrategyVisibility extends AbstractPlacementStrategy { public class PlacementStrategyVisibility extends AbstractPlacementStrategy {
// :: remove file when __HAXE__ // ::remove file when __HAXE__
private final int col2; private final int col2;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -53,7 +53,7 @@ import net.sourceforge.plantuml.klimt.geom.XRectangle2D;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
public class TextBlockUtils { public class TextBlockUtils {
// ::remove file when __HAXE__ // ::remove file when __HAXE__
public static final TextBlock EMPTY_TEXT_BLOCK = TextBlockUtils.empty(0, 0); 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) { 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) { 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) { 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; private final double height;
public UEmpty(double width, double height) { public UEmpty(double width, double height) {
if (width == 0) { if (width == 0)
throw new IllegalArgumentException(); throw new IllegalArgumentException();
}
this.width = width; this.width = width;
this.height = height; this.height = height;
} }
public UEmpty(XDimension2D dim) { public static UEmpty create(XDimension2D dim) {
this(dim.getWidth(), dim.getHeight()); return new UEmpty(dim.getWidth(), dim.getHeight());
} }
public double getWidth() { public double getWidth() {

View File

@ -48,8 +48,8 @@ public class ULine extends AbstractShadowable implements UShapeSized {
private final double dx; private final double dx;
private final double dy; private final double dy;
public ULine(XPoint2D p1, XPoint2D p2) { public static ULine create(XPoint2D p1, XPoint2D p2) {
this(p2.getX() - p1.getX(), p2.getY() - p1.getY()); return new ULine(p2.getX() - p1.getX(), p2.getY() - p1.getY());
} }
public ULine(double dx, double dy) { 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) { public AbstractClassOrObjectDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source, type, orig); super(source, type, orig);
setNamespaceSeparator(".");
} }
final public boolean insertBetween(Entity entity1, Entity entity2, Entity node) { final public boolean insertBetween(Entity entity1, Entity entity2, Entity node) {

View File

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

View File

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

View File

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

View File

@ -101,7 +101,7 @@ public class ExtremityArrow extends Extremity {
public void drawLineIfTransparent(UGraphic ug) { public void drawLineIfTransparent(UGraphic ug) {
final XPoint2D pt1 = polygon.getPoint(0); final XPoint2D pt1 = polygon.getPoint(0);
final XPoint2D pt2 = polygon.getPoint(2); 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); 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; import net.sourceforge.plantuml.version.Version;
class AboutWindow extends JFrame { class AboutWindow extends JFrame {
// :: remove folder when __CORE__ // ::remove folder when __CORE__
public AboutWindow() { public AboutWindow() {
super(); super();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -65,7 +65,7 @@ abstract class WBSTextBlock extends AbstractTextBlock {
} }
final protected void drawLine(UGraphic ug, XPoint2D p1, XPoint2D p2) { 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); getStyleUsed().applyStrokeAndLineColor(ug.apply(UTranslate.point(p1)), skinParam.getIHtmlColorSet()).draw(line);
} }

View File

@ -36,14 +36,28 @@
package smetana.core.debug; package smetana.core.debug;
import java.util.LinkedHashMap;
import java.util.Map;
public final class SmetanaDebug { 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 LOG(String s) {
} }
static public void ENTERING(String signature, String methodName) { 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) { static public void LEAVING(String signature, String methodName) {