diff --git a/pom.xml b/pom.xml
index d0513093e..6f9734fc8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
net.sourceforge.plantuml
plantuml
- 1.2019.1-SNAPSHOT
+ 1.2019.2-SNAPSHOT
jar
PlantUML
diff --git a/src/net/sourceforge/plantuml/AnnotatedWorker.java b/src/net/sourceforge/plantuml/AnnotatedWorker.java
index 93ea0201b..d0ae850d8 100644
--- a/src/net/sourceforge/plantuml/AnnotatedWorker.java
+++ b/src/net/sourceforge/plantuml/AnnotatedWorker.java
@@ -71,9 +71,9 @@ public class AnnotatedWorker {
}
public TextBlockBackcolored addAdd(TextBlock result) {
- result = addTitle(result);
result = addFrame(result);
result = addLegend(result);
+ result = addTitle(result);
result = addCaption(result);
result = addHeaderAndFooter(result);
return (TextBlockBackcolored) result;
diff --git a/src/net/sourceforge/plantuml/Option.java b/src/net/sourceforge/plantuml/Option.java
index 71b7fde9b..67b5206cc 100644
--- a/src/net/sourceforge/plantuml/Option.java
+++ b/src/net/sourceforge/plantuml/Option.java
@@ -108,6 +108,7 @@ public class Option {
if (arg.length == 0) {
OptionFlags.getInstance().setGui(true);
}
+ initInclude(GraphvizUtils.getenvDefaultConfigFilename());
for (int i = 0; i < arg.length; i++) {
String s = arg[i];
if (s.equalsIgnoreCase("-headless")) {
@@ -409,13 +410,21 @@ public class Option {
}
private void initInclude(String filename) throws IOException {
+ if (filename == null) {
+ return;
+ }
if (filename.contains("*")) {
final FileGroup group = new FileGroup(filename, Collections. emptyList(), null);
for (File f : group.getFiles()) {
- addInConfig(new FileReader(f));
+ if (f.exists() && f.canRead()) {
+ addInConfig(new FileReader(f));
+ }
}
} else {
- addInConfig(new FileReader(filename));
+ final File f = new File(filename);
+ if (f.exists() && f.canRead()) {
+ addInConfig(new FileReader(f));
+ }
}
}
diff --git a/src/net/sourceforge/plantuml/OptionPrint.java b/src/net/sourceforge/plantuml/OptionPrint.java
index 3a7494ea0..95ba824cf 100644
--- a/src/net/sourceforge/plantuml/OptionPrint.java
+++ b/src/net/sourceforge/plantuml/OptionPrint.java
@@ -142,7 +142,7 @@ public class OptionPrint {
System.out.println(" -splash\t\tTo display a splash screen with some progress bar");
System.out.println(" -progress\t\tTo display a textual progress bar in console");
System.out.println(" -pipeimageindex N\tTo generate the Nth image with pipe option");
- System.out.println(" -stdlib\t\tTo print standart library info");
+ System.out.println(" -stdlib\t\tTo print standard library info");
System.out.println(" -extractstdlib\tTo extract PlantUML Standard Library into stdlib folder");
System.out.println(" -filename \"example.puml\"\tTo override %filename% variable");
System.out.println(" -preproc\t\tTo output preprocessor text of diagrams");
diff --git a/src/net/sourceforge/plantuml/UmlDiagram.java b/src/net/sourceforge/plantuml/UmlDiagram.java
index fc5ee10dd..ea46ddfec 100644
--- a/src/net/sourceforge/plantuml/UmlDiagram.java
+++ b/src/net/sourceforge/plantuml/UmlDiagram.java
@@ -432,7 +432,7 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram, Ann
return legend;
}
- public final void setLegend(DisplayPositionned legend) {
+ public void setLegend(DisplayPositionned legend) {
this.legend = legend;
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java
index e5c168296..d5891d158 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java
@@ -50,16 +50,17 @@ public class WormMutation {
public static WormMutation create(Worm worm, double delta) {
final String signature = worm.getDirectionsCode();
- if (signature.length() > 2) {
+ final String definition = getDefinition(signature);
+ if (definition == null) {
return createFromLongSignature(signature, delta);
}
- return createFromSimpleSignature(signature, delta);
+ return new WormMutation(definition, delta);
}
private static WormMutation createFromLongSignature(final String signature, final double delta) {
final WormMutation result = new WormMutation();
for (int i = 0; i < signature.length() - 1; i++) {
- WormMutation tmp = createFromSimpleSignature(signature.substring(i, i + 2), delta);
+ WormMutation tmp = new WormMutation(getDefinition(signature.substring(i, i + 2)), delta);
if (i == 0) {
result.translations.add(tmp.translations.get(0));
} else {
@@ -96,64 +97,61 @@ public class WormMutation {
return translations.size();
}
- private static WormMutation createFromSimpleSignature(final String signature, final double delta) {
- final WormMutation result = new WormMutation();
- // System.err.println("signature=" + signature);
+ private static String getDefinition(final String signature) {
if (signature.equals("D") || signature.equals("U")) {
- final UTranslate translate = new UTranslate(delta, 0);
- result.translations.add(translate);
- result.translations.add(translate);
- return result;
+ return "33";
+ } else if (signature.equals("L") || signature.equals("R")) {
+ return "55";
+ } else if (signature.equals("RD")) {
+ return "123";
+ } else if (signature.equals("RU")) {
+ return "543";
+ } else if (signature.equals("LD")) {
+ return "187";
+ } else if (signature.equals("DL")) {
+ return "345";
+ } else if (signature.equals("DR")) {
+ return "765";
+ } else if (signature.equals("UL")) {
+ return "321";
+ } else if (signature.equals("UR")) {
+ return "781";
+ // } else if (signature.equals("DLD")) {
+ // return "3443";
}
- if (signature.equals("L") || signature.equals("R")) {
- final UTranslate translate = new UTranslate(0, delta);
- result.translations.add(translate);
- result.translations.add(translate);
- return result;
+ return null;
+ }
+
+ private WormMutation(String definition, double delta) {
+ if (definition == null) {
+ throw new IllegalArgumentException();
}
- if (signature.equals("RD")) {
- result.translations.add(new UTranslate(0, -delta));
- result.translations.add(new UTranslate(delta, -delta));
- result.translations.add(new UTranslate(delta, 0));
- return result;
+ for (int i = 0; i < definition.length(); i++) {
+ this.translations.add(translation(Integer.parseInt(definition.substring(i, i + 1)), delta));
}
- if (signature.equals("RU")) {
- result.translations.add(new UTranslate(0, delta));
- result.translations.add(new UTranslate(delta, delta));
- result.translations.add(new UTranslate(delta, 0));
- return result;
+
+ }
+
+ private static UTranslate translation(int type, double delta) {
+ switch (type) {
+ case 1:
+ return new UTranslate(0, -delta);
+ case 2:
+ return new UTranslate(delta, -delta);
+ case 3:
+ return new UTranslate(delta, 0);
+ case 4:
+ return new UTranslate(delta, delta);
+ case 5:
+ return new UTranslate(0, delta);
+ case 6:
+ return new UTranslate(-delta, delta);
+ case 7:
+ return new UTranslate(-delta, 0);
+ case 8:
+ return new UTranslate(-delta, -delta);
}
- if (signature.equals("LD")) {
- result.translations.add(new UTranslate(0, -delta));
- result.translations.add(new UTranslate(-delta, -delta));
- result.translations.add(new UTranslate(-delta, 0));
- return result;
- }
- if (signature.equals("DL")) {
- result.translations.add(new UTranslate(delta, 0));
- result.translations.add(new UTranslate(delta, delta));
- result.translations.add(new UTranslate(0, delta));
- return result;
- }
- if (signature.equals("DR")) {
- result.translations.add(new UTranslate(-delta, 0));
- result.translations.add(new UTranslate(-delta, delta));
- result.translations.add(new UTranslate(0, delta));
- return result;
- }
- if (signature.equals("UL")) {
- result.translations.add(new UTranslate(delta, 0));
- result.translations.add(new UTranslate(delta, -delta));
- result.translations.add(new UTranslate(0, -delta));
- return result;
- }
- if (signature.equals("UR")) {
- result.translations.add(new UTranslate(-delta, 0));
- result.translations.add(new UTranslate(-delta, -delta));
- result.translations.add(new UTranslate(0, -delta));
- return result;
- }
- throw new UnsupportedOperationException(signature);
+ throw new IllegalArgumentException();
}
static private class MinMax {
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java
index f653e273e..0a97d06eb 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java
@@ -42,12 +42,12 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
+import net.sourceforge.plantuml.AlignmentParam;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
-import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
@@ -133,9 +133,9 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
- final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
- skinParam, CreoleMode.FULL).createSheet(note.getDisplay());
- final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, skinParam.wrapWidth() , skinParam.getPadding()),
+ final HorizontalAlignment align = skinParam.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null, false);
+ final Sheet sheet = new CreoleParser(fc, align, skinParam, CreoleMode.FULL).createSheet(note.getDisplay());
+ final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, skinParam.wrapWidth(), skinParam.getPadding()),
this, new UStroke(1));
opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(null), withLink);
diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java
index aaf1f0042..669b57e30 100644
--- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java
@@ -49,6 +49,7 @@ import net.sourceforge.plantuml.command.note.SingleMultiFactoryCommand;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
@@ -131,7 +132,8 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
if (lines.size() > 0) {
final boolean tryMerge = line0.get("VMERGE", 0) != null;
- final Note note = new Note(p1, p2, lines.toDisplay());
+ final Display display = diagram.manageVariable(lines.toDisplay());
+ final Note note = new Note(p1, p2, display);
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
note.setColors(colors);
// note.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
diff --git a/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java b/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java
index 6846185c7..186d96c1b 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java
@@ -261,4 +261,12 @@ public class GroupRoot implements IGroup {
public Set stereotags() {
throw new UnsupportedOperationException();
}
+
+ public void setLegend(DisplayPositionned legend) {
+ throw new UnsupportedOperationException();
+ }
+
+ public DisplayPositionned getLegend() {
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/IGroup.java b/src/net/sourceforge/plantuml/cucadiagram/IGroup.java
index 54cd87e4d..48ad9aa69 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/IGroup.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/IGroup.java
@@ -70,4 +70,8 @@ public interface IGroup extends IEntity {
public char getConcurrentSeparator();
public void setConcurrentSeparator(char separator);
+
+ public void setLegend(DisplayPositionned legend);
+
+ public DisplayPositionned getLegend();
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java
index 47f5ef358..9b495a057 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java
@@ -89,7 +89,7 @@ public class GraphvizUtils {
}
private static boolean useVizJs(ISkinParam skinParam) {
- if (skinParam!=null && skinParam.isUseVizJs() && VizJsEngine.isOk()) {
+ if (skinParam != null && skinParam.isUseVizJs() && VizJsEngine.isOk()) {
return true;
}
if (VIZJS.equalsIgnoreCase(getenvGraphvizDot()) && VizJsEngine.isOk()) {
@@ -143,6 +143,14 @@ public class GraphvizUtils {
return 4096;
}
+ public static String getenvDefaultConfigFilename() {
+ final String env = System.getProperty("PLANTUML_DEFAULT_CONFIG_FILENAME");
+ if (StringUtils.isNotEmpty(env)) {
+ return env;
+ }
+ return System.getenv("PLANTUML_DEFAULT_CONFIG_FILENAME");
+ }
+
public static String getenvLogData() {
final String env = System.getProperty("PLANTUML_LOGDATA");
if (StringUtils.isNotEmpty(env)) {
diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessState.java b/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessState.java
index 6f9347e17..f1ad5bd8c 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessState.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessState.java
@@ -95,6 +95,11 @@ public class ProcessState {
final ProcessState other = (ProcessState) o;
return name.equals(other.name);
}
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
public Throwable getCause() {
return cause;
diff --git a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java
index 18d94a8fc..bbd6b3e0d 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java
@@ -52,6 +52,7 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.cucadiagram.Bodier;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
import net.sourceforge.plantuml.cucadiagram.EntityPosition;
import net.sourceforge.plantuml.cucadiagram.EntityUtils;
import net.sourceforge.plantuml.cucadiagram.GroupRoot;
@@ -90,6 +91,7 @@ final class EntityImpl implements ILeaf, IGroup {
private final Bodier bodier;
private final String uid = StringUtils.getUid("cl", UniqueSequence.getValue());
private Display display = Display.empty();
+ private DisplayPositionned legend = null;
private LeafType leafType;
private Stereotype stereotype;
@@ -644,4 +646,15 @@ final class EntityImpl implements ILeaf, IGroup {
public VisibilityModifier getVisibilityModifier() {
return visibility;
}
+
+ public void setLegend(DisplayPositionned legend) {
+ checkGroup();
+ this.legend = legend;
+ }
+
+ public DisplayPositionned getLegend() {
+ checkGroup();
+ return legend;
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/dedication/Dedications.java b/src/net/sourceforge/plantuml/dedication/Dedications.java
index 727d5014c..3a7c3fd29 100644
--- a/src/net/sourceforge/plantuml/dedication/Dedications.java
+++ b/src/net/sourceforge/plantuml/dedication/Dedications.java
@@ -50,6 +50,7 @@ public class Dedications {
static {
addNormal("Write your own dedication!", "dedication");
addNormal("linux_china", "linux_china");
+ addNormal("ARKBAN", "arkban");
addCrypted("0", "pOhci6rKgPXw32AeYXhOpSY0suoauHq5VUSwFqHLHsLYgSO6WaJ7BW5vtHBAoU6ePbcW7d8Flx99MWjPSKQTDm00");
addCrypted("1", "LTxN3hdnhSJ515qcA7IQ841axt4GXfUd3n2wgNirYCdLnyX2360Gv1OEOnJ1-gwFzRW5B3HAqLBkR6Ge0WW_Z000");
}
diff --git a/src/net/sourceforge/plantuml/dedication/arkban.png b/src/net/sourceforge/plantuml/dedication/arkban.png
new file mode 100644
index 000000000..7ddc8131d
Binary files /dev/null and b/src/net/sourceforge/plantuml/dedication/arkban.png differ
diff --git a/src/net/sourceforge/plantuml/donors/PSystemDonors.java b/src/net/sourceforge/plantuml/donors/PSystemDonors.java
index 52ecf1895..dc1595937 100644
--- a/src/net/sourceforge/plantuml/donors/PSystemDonors.java
+++ b/src/net/sourceforge/plantuml/donors/PSystemDonors.java
@@ -67,21 +67,26 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.version.PSystemVersion;
public class PSystemDonors extends AbstractPSystem {
- public static final String DONORS = "6v8802mEp3EZtv0iGcz-fvJYI4HCdvyvFoLZ70fX42Pji_Rj7u5_xF8MOOgGwCb2hYywcqt8cZ7fvZdB"
- + "UKOHB9z6h9SwR7EpNwh8AC6pcc_-6SNudZjfQ4BQdR1i1_B_wLu53WLaSJR5GnWEsFmBC_QWEUnUABLh"
- + "wMBt2ze2ZMdqOyjAyTtoFPIoRgV0R9HytwmWOV4FnnLLiXJZBf5YgXDROEAE6SdMwKxm3RVRVzHDQj7Q"
- + "ceQ4Zm1Y6obiROzzBIuBEJw5WH74e0umG8G3AOVw8ATuUy41HAyQCUApcCPwgtUUA4321XLQy8-SLESM"
- + "iZpBa0bYS3CGCFaEd03iJKabcEtS1kHfWHP53PRgrdKd8ZFU34y9MJHSHGuOHD0Ag4AGDq47-2vjorkC"
- + "nvWLCVpHFHWVtX3aJHQUI2yM-dhhmK3usLqrazNjJcrg8SGbxtMSjJR0iuQC7EsXzxXaCnxhrrmAmsyj"
- + "G7uBz5BlY1X_Szqi945mBgatd7ME7D-c28Gsbef5xcBAQy8PNNQsfgZlBLYOb_phrg4immXTgRW5y0ij"
- + "ZvDrlb3SDDH_BxaQEdu5rdWqt5k1ijFcOlvxsItDZD83jDc5pT1L4U6USMXLA2P31AuG-ZxW8KdEfDh7"
- + "v57zMBx4F_Od8Rn5uO2LDZFQdrLN98eSLa4Mb3lQn08mtIJQ0M9q9s44r0NTXYhdy0nttRi9UTfcO-hQ"
- + "eOPZDy8OrBVf9FaWOZUNZ9A67bas2ukr7t2Mu1mkajVFFHor2c0zqhlhPcc-mK2yXJdT8js6vML9koMY"
- + "g2D4bjCMh-hYh-wsykUXCtyuvx5ew8tpJvvVXun7yoLzQQb7bBbhqFtj25dUpaXHPjWEr-503MHy2hXU"
- + "DNccaYCGlUaCXqPi967M1w-T1OTm1nVHMATiBqrBaAtdwcEW6Vo8tCcGIZrm9n7hk0jmXl4eij-Ozyge"
- + "k_eyf4Gje60C4vobGjX7I54DsxOWGyRuwHcCJhxoeIqMy6dioSmw53vXebt31ZQc48iMzOEu2S3rtjUe"
- + "bpGcIi3NlFocUioiWvu_iwKLuW1EAGa1g63uy1rdfqgRhMcij-Zzs3HzBHj__MUkCi4f5VkyMu1K1p7v"
- + "BuSWCX7VbTqZy5daOudHHaRWM2lRMBcqz3Z0i22JbXbgcfyPyUbQADVN1ZHhVIZFVvHLdh6dvmK0";
+
+ private static final int COLS = 6;
+ private static final int FREE_LINES = 6;
+
+ public static final String DONORS = "6zm80AmEEBmtNeGqQ-xME_ioXj6A6CylpxzGd5Z4qzs0-0MuTthSRwI_YAvqxvjcH5klBSmPH700wedp"
+ + "RuQMT_qrVlFrLJB6LIrTOG84tZ4kxHj_ULk8gMBxBHFQ-zkF2tL8QuNW2jnKJiZyTAy2XmAoE9jY_ZbW"
+ + "O-FQkxLxdrgxbYvsFw0jq9X6FxQibADsTU1heSR1aN5yGqfcnPWFaQAfZIr0moTkn6gZEi4dKhF_g4Lg"
+ + "qffTGxfB0B6C5B7cRT7SlfFjKnWuuQXaXm94E91mI2zo752VIC1HIgD6P1IZiQxYBKz44A632hlmZvmK"
+ + "dpraUPIX0uxARY2WyHi40NWcnPJOREDcGCuUrYAdmKATcHizalt5u9GZ3nek8JjK8gW5L078cw0BUbrz"
+ + "vX9d6PkYX2TlORpAOe2SPLq0ZYSp-jfBOQ3ytpym4-Hoezfw27FATOnV7HtmKqD6zdxJQfopc8ZvRIx8"
+ + "y8K5E5y0lTGQAiRVD-UDXNW8ZIbr8IVEmUDz586mobAmo4rCSStnaovziPgORrrOB1_XrvcXBCC8NAdO"
+ + "0_Y8bjC7TRw0hXhgduTSTHsVmjOuBTXRX4ydpRdY_rst93DA5z1Q4pv4LqAKBBrWbIqcHGIk0Fesu259"
+ + "RgJgo-HHlYmV4k_xao3Ud70WKfi5x4_A6OrB3bE85rOwLCKCOBfBr0kEserqmwiJqBj0vHGPuQxVquGz"
+ + "RDAOEZUuud4_n1ZaYtIyVD5ZCvUCImsTCcrsxDH-n560s_0bUTLz68vL04jHxvR5qdWQ0-uQvZI3T1sH"
+ + "zprjIOzB7QLbEMvnLPTuDhU3YuTEBZYJHMFCQ7CSCZiadvEfgLkCvwb1uxT1PEts2gBE0dU3TJYGOHcV"
+ + "0zOLamEL7C5H6ivmoCGa2QtMUSLk0t0FechhcEsfQmcndhhw5AWsViJPo81AsWd744UxA-oCXQF8Vjcy"
+ + "LqRTrBSX6CS2yiKWmKagb6s4e39iJY53UX_qZCP9FizBkonas_XcuGM6mYT8TDziWrMc48yKwOsw1i3r"
+ + "Owl4YnyJ8u2VyVORw5d6EkZvDtfQMHp0ff8GC1MMSlYNOALYtQn9hBVeTLjhRylEdt-l8zCunVisLWgW"
+ + "no2B_WiXY9EeSmMte1yNV2P7RI4ZiA-3RLkvDlGumA2WHIsJNBLDC-BJMLQketPuvF6XdFykao2mdqz8"
+ + "Ud4AAaUV4gpMtkfAPQ1zyet5IGuM_nHL6hAuYZfgOiGH";
@Override
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed)
@@ -94,7 +99,7 @@ public class PSystemDonors extends AbstractPSystem {
}
private UDrawable getGraphicStrings() throws IOException {
- final List cols = getCols(getDonors(), 7, 5);
+ final List cols = getCols(getDonors(), COLS, FREE_LINES);
return new UDrawable() {
public void drawU(UGraphic ug) {
final TextBlockBackcolored header = GraphicStrings.createBlackOnWhite(Arrays
diff --git a/src/net/sourceforge/plantuml/eps/EpsGraphics.java b/src/net/sourceforge/plantuml/eps/EpsGraphics.java
index 1fe1294cd..54d9576b9 100644
--- a/src/net/sourceforge/plantuml/eps/EpsGraphics.java
+++ b/src/net/sourceforge/plantuml/eps/EpsGraphics.java
@@ -311,11 +311,13 @@ public class EpsGraphics {
}
public void epsPolygon(HtmlColorGradient gr, ColorMapper mapper, double... points) {
+ assert points.length % 2 == 0;
setFillColor(mapper.getMappedColor(gr.getColor1()));
epsPolygon(points);
}
public void epsPolygon(double... points) {
+ assert points.length % 2 == 0;
checkCloseDone();
double lastX = 0;
double lastY = 0;
@@ -761,6 +763,7 @@ public class EpsGraphics {
}
public void epsPolygonShadow(double deltaShadow, double... points) {
+ assert points.length % 2 == 0;
setStrokeColor(null);
for (double i = 0; i <= deltaShadow; i += 0.5) {
setFillColor(shadowManager.getColor(i, deltaShadow));
diff --git a/src/net/sourceforge/plantuml/nwdiag/DiagElement.java b/src/net/sourceforge/plantuml/nwdiag/DiagElement.java
index a5a50323b..7764aee35 100644
--- a/src/net/sourceforge/plantuml/nwdiag/DiagElement.java
+++ b/src/net/sourceforge/plantuml/nwdiag/DiagElement.java
@@ -109,8 +109,8 @@ public class DiagElement {
}
public final void setShape(String shapeName) {
- USymbol shapeFromString = USymbol.getFromString(shapeName);
- if (shapeFromString!=null){
+ final USymbol shapeFromString = USymbol.getFromString(shapeName);
+ if (shapeFromString != null) {
this.shape = shapeFromString;
}
}
diff --git a/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java b/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java
index b1ac13c41..31879651b 100644
--- a/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java
+++ b/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java
@@ -42,7 +42,10 @@ import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
+import net.sourceforge.plantuml.cucadiagram.GroupRoot;
import net.sourceforge.plantuml.cucadiagram.IEntity;
+import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
@@ -310,4 +313,17 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
}
}
+ @Override
+ public void setLegend(DisplayPositionned legend) {
+
+ final IGroup currentGroup = this.getCurrentGroup();
+
+ if (currentGroup instanceof GroupRoot) {
+ super.setLegend(legend);
+ return;
+ }
+
+ currentGroup.setLegend(legend);
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/project/BasicInstantArithmetic.java b/src/net/sourceforge/plantuml/project/BasicInstantArithmetic.java
deleted file mode 100644
index 5a824a8db..000000000
--- a/src/net/sourceforge/plantuml/project/BasicInstantArithmetic.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-class BasicInstantArithmetic implements InstantArithmetic {
-
- private final DayClose dayClose;
-
- BasicInstantArithmetic(DayClose dayClose) {
- if (dayClose == null) {
- throw new IllegalArgumentException();
- }
- this.dayClose = dayClose;
- }
-
- public Instant add(Instant i1, Duration duration) {
- Instant result = i1;
- final long min = duration.getMinutes();
- if (min < 0) {
- throw new IllegalArgumentException();
- }
- for (long i = 0; i < min; i += 24 * 60 * 60) {
- result = result.next(dayClose);
- }
- return result;
- }
-
- public Instant sub(Instant i1, Duration duration) {
- Instant result = i1;
- final long min = duration.getMinutes();
- if (min < 0) {
- throw new IllegalArgumentException();
- }
- for (long i = 0; i < min; i += 24 * 60 * 60) {
- result = result.prev(dayClose);
- }
- return result;
- }
-
- public Duration diff(Instant i1, Instant i2) {
- if (i2.compareTo(i1) < 0) {
- throw new IllegalArgumentException();
- }
- long minutes = 0;
- while (i2.compareTo(i1) > 0) {
- minutes += 24 * 60 * 60;
- i1 = i1.next(null);
- }
- return new Duration(minutes);
- }
-}
diff --git a/src/net/sourceforge/plantuml/project/Day.java b/src/net/sourceforge/plantuml/project/Day.java
deleted file mode 100644
index 163c27d15..000000000
--- a/src/net/sourceforge/plantuml/project/Day.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-public class Day implements Comparable {
-
- private final int numDay;
- private final Month month;
- private final int year;
- private final WeekDay weekDay;
-
- private Day(int year, Month month, int numDay, WeekDay weekDay) {
- this.year = year;
- this.month = month;
- this.numDay = numDay;
- this.weekDay = weekDay;
- }
-
- public static boolean isValidDesc(String desc) {
- if (desc.matches("^\\d{4}/\\d{2}/\\d{2}$")) {
- return true;
- }
- if (desc.matches("^\\d{2}-[A-Za-z]{3}-\\d{4}$")) {
- return true;
- }
- return false;
- }
-
- public Day(String desc) {
- if (desc.matches("^\\d{4}/\\d{2}/\\d{2}$")) {
- this.year = Integer.parseInt(desc.substring(0, 4));
- this.month = Month.fromNum(Integer.parseInt(desc.substring(5, 7)));
- this.numDay = Integer.parseInt(desc.substring(8, 10));
- } else if (desc.matches("^\\d{2}-[A-Za-z]{3}-\\d{4}$")) {
- this.year = Integer.parseInt(desc.substring(7, 11));
- this.month = Month.valueOf(desc.substring(3, 6));
- this.numDay = Integer.parseInt(desc.substring(0, 2));
- } else {
- throw new IllegalArgumentException(desc);
- }
- final int wd = new GregorianCalendar(year, month.getNum() - 1, numDay).get(Calendar.DAY_OF_WEEK);
- this.weekDay = WeekDay.values()[wd - 1];
- }
-
- public Day next(DayClose dayClose) {
- if (dayClose == null) {
- return nextInternal();
- }
- if (dayClose.isClose(this)) {
- throw new IllegalArgumentException();
- }
- Day result = nextInternal();
- while (dayClose.isClose(result)) {
- result = result.nextInternal();
- }
- return result;
- }
-
- public Day prev(DayClose dayClose) {
- if (dayClose == null) {
- return prevInternal();
- }
- if (dayClose.isClose(this)) {
- throw new IllegalArgumentException();
- }
- Day result = prevInternal();
- while (dayClose.isClose(result)) {
- result = result.prevInternal();
- }
- return result;
- }
-
- private Day nextInternal() {
- if (numDay < month.getNbDays(year)) {
- return new Day(year, month, numDay + 1, weekDay.next());
- }
- final Month next = month.next();
- if (next == null) {
- return new Day(year + 1, Month.JAN, 1, weekDay.next());
- }
- return new Day(year, next, 1, weekDay.next());
- }
-
- private Day prevInternal() {
- if (numDay > 1) {
- return new Day(year, month, numDay - 1, weekDay.prev());
- }
- final Month prev = month.prev();
- if (prev == null) {
- return new Day(year - 1, Month.DEC, 31, weekDay.prev());
- }
- return new Day(year, prev, prev.getNbDays(year), weekDay.prev());
- }
-
- @Override
- public String toString() {
- return "" + weekDay + " " + year + "-" + month + "-" + String.format("%02d", numDay);
- }
-
- public final int getNumDay() {
- return numDay;
- }
-
- public final Month getMonth() {
- return month;
- }
-
- public final int getYear() {
- return year;
- }
-
- public int compareTo(Day other) {
- if (year > other.year) {
- return 1;
- }
- if (year < other.year) {
- return -1;
- }
- final int cmpMonth = month.compareTo(other.month);
- if (cmpMonth != 0) {
- return cmpMonth;
- }
- return numDay - other.numDay;
- }
-
- @Override
- public boolean equals(Object obj) {
- final Day this2 = (Day) obj;
- return this.numDay == this2.numDay && this.month == this2.month && this.year == this2.year;
- }
-
- @Override
- public int hashCode() {
- return numDay * 420 + year + month.hashCode();
- }
-
- public final WeekDay getWeekDay() {
- return weekDay;
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/DayClose.java b/src/net/sourceforge/plantuml/project/DayClose.java
deleted file mode 100644
index ff6c28dc6..000000000
--- a/src/net/sourceforge/plantuml/project/DayClose.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-interface DayClose {
-
- boolean isClose(Day day);
-
-}
diff --git a/src/net/sourceforge/plantuml/project/DayCloseNone.java b/src/net/sourceforge/plantuml/project/DayCloseNone.java
deleted file mode 100644
index f7df0f2dc..000000000
--- a/src/net/sourceforge/plantuml/project/DayCloseNone.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-class DayCloseNone implements DayClose {
-
- public boolean isClose(Day day) {
- return false;
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/DayCloseOr.java b/src/net/sourceforge/plantuml/project/DayCloseOr.java
deleted file mode 100644
index 2b5e453e6..000000000
--- a/src/net/sourceforge/plantuml/project/DayCloseOr.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-import java.util.ArrayList;
-import java.util.List;
-
-class DayCloseOr implements DayClose {
-
- private final List all = new ArrayList();
-
- public boolean isClose(Day day) {
- for (DayClose dc : all) {
- if (dc.isClose(day)) {
- return true;
- }
- }
- return false;
- }
-
- public void add(DayClose dayClose) {
- all.add(dayClose);
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/DayCloseWeekDay.java b/src/net/sourceforge/plantuml/project/DayCloseWeekDay.java
deleted file mode 100644
index 65d1edf25..000000000
--- a/src/net/sourceforge/plantuml/project/DayCloseWeekDay.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-class DayCloseWeekDay implements DayClose {
-
- private final WeekDay weekDay;
-
- public DayCloseWeekDay(WeekDay weekDay) {
- this.weekDay = weekDay;
- }
-
- public boolean isClose(Day day) {
- if (day.getWeekDay() == weekDay) {
- return true;
- }
- return false;
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/Expression.java b/src/net/sourceforge/plantuml/project/Expression.java
deleted file mode 100644
index b6b30a9e4..000000000
--- a/src/net/sourceforge/plantuml/project/Expression.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-public interface Expression {
-
- Numeric getValue();
-
- String getDescription();
-
- NumericType getNumericType();
-
-}
diff --git a/src/net/sourceforge/plantuml/project/FormalAddition.java b/src/net/sourceforge/plantuml/project/FormalAddition.java
deleted file mode 100644
index dc2c91b99..000000000
--- a/src/net/sourceforge/plantuml/project/FormalAddition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-class FormalAddition implements Formal {
-
- private final Expression exp1;
- private final Expression exp2;
-
- public FormalAddition(Expression exp1, Expression exp2) {
- this.exp1 = exp1;
- this.exp2 = exp2;
- }
-
- public String getDescription() {
- return "add " + exp1 + " " + exp2;
- }
-
- public NumericType getNumericType() {
- return exp1.getNumericType();
- }
-
- public Numeric getValue() {
- return exp1.getValue().add(exp2.getValue());
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/FormalAdditionInstantDuration.java b/src/net/sourceforge/plantuml/project/FormalAdditionInstantDuration.java
deleted file mode 100644
index 7036b32cb..000000000
--- a/src/net/sourceforge/plantuml/project/FormalAdditionInstantDuration.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-class FormalAdditionInstantDuration implements Formal {
-
- private final Expression exp1;
- private final Expression exp2;
- private final InstantArithmetic math;
-
- public FormalAdditionInstantDuration(Expression exp1, Expression exp2, InstantArithmetic math) {
- this.exp1 = exp1;
- this.exp2 = exp2;
- this.math = math;
- }
-
- public String getDescription() {
- return "addID " + exp1 + " " + exp2;
- }
-
- public NumericType getNumericType() {
- return exp1.getNumericType();
- }
-
- public Numeric getValue() {
- if (exp2.getNumericType() == NumericType.NUMBER) {
- final Duration d = new Duration((NumericNumber) exp2.getValue());
- return math.add((Instant) exp1.getValue(), d);
- }
-
- return math.add((Instant) exp1.getValue(), (Duration) exp2.getValue());
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/FreeVariable.java b/src/net/sourceforge/plantuml/project/FreeVariable.java
deleted file mode 100644
index a5c1f434b..000000000
--- a/src/net/sourceforge/plantuml/project/FreeVariable.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-class FreeVariable implements Expression {
-
- private Expression value;
- private final String name;
- private final NumericType type;
-
- public FreeVariable(String name, NumericType type) {
- this.name = name;
- this.type = type;
- }
-
- public String getDescription() {
- return "$" + name + "=" + (value == null ? "null" : value.getDescription());
- }
-
- public NumericType getNumericType() {
- return type;
- }
-
- public Numeric getValue() {
- if (value == null) {
- return null;
- }
- return value.getValue();
- }
-
- public void setValue(Expression expression) {
- if (expression.getNumericType() != type) {
- throw new IllegalArgumentException("Bad type");
- }
- this.value = expression;
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/IncompleteItem.java b/src/net/sourceforge/plantuml/project/IncompleteItem.java
deleted file mode 100644
index da71ea51b..000000000
--- a/src/net/sourceforge/plantuml/project/IncompleteItem.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-import java.util.EnumMap;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Map;
-
-class IncompleteItem implements Item {
-
- private Map data = new EnumMap(ItemCaract.class);
-
- private final InstantArithmetic math;
-
- private final Item parent;
-
- private final String code;
-
- public IncompleteItem(String code, Item parent, InstantArithmetic math) {
- this.math = math;
- this.code = code;
- this.parent = parent;
- }
-
- public void setData(ItemCaract caract, Numeric value) {
- if (caract.getNumericType() != value.getNumericType()) {
- throw new IllegalArgumentException();
- }
- if (data.containsKey(caract)) {
- throw new IllegalStateException();
- }
- data.put(caract, value);
- boolean change = false;
- do {
- change = false;
- change = eventuallyUseBeginComplete() || change;
- change = eventuallyUseBeginDuration() || change;
- change = eventuallyUseCompleteDuration() || change;
- change = eventuallyUseDurationWork() || change;
- change = eventuallyUseDurationLoad() || change;
- change = eventuallyUseLoadWork() || change;
- } while (change);
- }
-
- private boolean eventuallyUseDurationWork() {
- if (data.containsKey(ItemCaract.DURATION) && data.containsKey(ItemCaract.WORK)
- && data.containsKey(ItemCaract.LOAD) == false) {
- final Duration d = (Duration) data.get(ItemCaract.DURATION);
- final NumericNumber w = (NumericNumber) data.get(ItemCaract.WORK);
- data.put(ItemCaract.LOAD, new Load(d.getMinutes() * w.getIntValue()));
- return true;
- }
- return false;
- }
-
- private boolean eventuallyUseLoadWork() {
- if (data.containsKey(ItemCaract.LOAD) && data.containsKey(ItemCaract.WORK)
- && data.containsKey(ItemCaract.DURATION) == false) {
- final Load l = (Load) data.get(ItemCaract.LOAD);
- final NumericNumber w = (NumericNumber) data.get(ItemCaract.WORK);
- data.put(ItemCaract.DURATION, new Duration(l.getMinuteMen() / w.getIntValue()));
- return true;
- }
- return false;
- }
-
- private boolean eventuallyUseDurationLoad() {
- if (data.containsKey(ItemCaract.DURATION) && data.containsKey(ItemCaract.LOAD)
- && data.containsKey(ItemCaract.WORK) == false) {
- final Duration d = (Duration) data.get(ItemCaract.DURATION);
- final Load l = (Load) data.get(ItemCaract.LOAD);
- data.put(ItemCaract.WORK, new NumericNumber((int) (l.getMinuteMen() / d.getMinutes())));
- return true;
- }
- return false;
- }
-
- private boolean eventuallyUseBeginDuration() {
- if (data.containsKey(ItemCaract.BEGIN) && data.containsKey(ItemCaract.DURATION)
- && data.containsKey(ItemCaract.COMPLETED) == false) {
- final Instant i1 = (Instant) data.get(ItemCaract.BEGIN);
- final Duration d = (Duration) data.get(ItemCaract.DURATION);
- data.put(ItemCaract.COMPLETED, math.add(i1, d));
- return true;
- }
- return false;
- }
-
- private boolean eventuallyUseCompleteDuration() {
- if (data.containsKey(ItemCaract.COMPLETED) && data.containsKey(ItemCaract.DURATION)
- && data.containsKey(ItemCaract.BEGIN) == false) {
- final Instant i2 = (Instant) data.get(ItemCaract.COMPLETED);
- final Duration d = (Duration) data.get(ItemCaract.DURATION);
- data.put(ItemCaract.BEGIN, math.sub(i2, d));
- return true;
- }
- return false;
- }
-
- private boolean eventuallyUseBeginComplete() {
- if (data.containsKey(ItemCaract.BEGIN) && data.containsKey(ItemCaract.COMPLETED)
- && data.containsKey(ItemCaract.DURATION) == false) {
- final Instant i1 = (Instant) data.get(ItemCaract.BEGIN);
- final Instant i2 = (Instant) data.get(ItemCaract.COMPLETED);
- if (i2.compareTo(i1) <= 0) {
- throw new IllegalArgumentException();
- }
- data.put(ItemCaract.DURATION, math.diff(i1, i2));
- return true;
- }
- return false;
- }
-
- public boolean isValid() {
- return data.size() == EnumSet.allOf(ItemCaract.class).size();
- }
-
- public Instant getBegin() {
- return (Instant) data.get(ItemCaract.BEGIN);
- }
-
- public Instant getCompleted() {
- return (Instant) data.get(ItemCaract.COMPLETED);
- }
-
- public Duration getDuration() {
- return (Duration) data.get(ItemCaract.DURATION);
- }
-
- public Load getLoad() {
- return (Load) data.get(ItemCaract.LOAD);
- }
-
- public NumericNumber getWork() {
- return (NumericNumber) data.get(ItemCaract.WORK);
- }
-
- public boolean isLeaf() {
- return true;
- }
-
- public Item getParent() {
- return parent;
- }
-
- public List- getChildren() {
- return null;
- }
-
- public String getCode() {
- return code;
- }
-
- @Override
- public String toString() {
- return code + " " + data.toString();
- }
-}
diff --git a/src/net/sourceforge/plantuml/project/Instant.java b/src/net/sourceforge/plantuml/project/Instant.java
deleted file mode 100644
index e53be562e..000000000
--- a/src/net/sourceforge/plantuml/project/Instant.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-public class Instant implements Numeric {
-
- private final Day value;
-
- public Instant(Day d) {
- this.value = d;
- }
-
- public Numeric add(Numeric other) {
- throw new UnsupportedOperationException();
- }
-
- public NumericType getNumericType() {
- return NumericType.INSTANT;
- }
-
- public Day getDay() {
- return value;
- }
-
- public Instant next(DayClose dayClose) {
- return new Instant(value.next(dayClose));
- }
-
- public Instant prev(DayClose dayClose) {
- return new Instant(value.prev(dayClose));
- }
-
- @Override
- public String toString() {
- return "Instant:" + value;
- }
-
- public int compareTo(Numeric other) {
- final Instant this2 = (Instant) other;
- return value.compareTo(this2.value);
- }
-
- @Override
- public int hashCode() {
- return value.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- final Instant other = (Instant) obj;
- return value.equals(other.value);
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/InstantArithmetic.java b/src/net/sourceforge/plantuml/project/InstantArithmetic.java
deleted file mode 100644
index 911ba90be..000000000
--- a/src/net/sourceforge/plantuml/project/InstantArithmetic.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-interface InstantArithmetic {
-
- public Instant add(Instant i1, Duration duration);
-
- public Instant sub(Instant i1, Duration duration);
-
- public Duration diff(Instant i1, Instant i2);
-}
diff --git a/src/net/sourceforge/plantuml/project/Item.java b/src/net/sourceforge/plantuml/project/Item.java
deleted file mode 100644
index 44fed3016..000000000
--- a/src/net/sourceforge/plantuml/project/Item.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-import java.util.List;
-
-public interface Item {
-
- Instant getBegin();
-
- Instant getCompleted();
-
- Duration getDuration();
-
- Load getLoad();
-
- NumericNumber getWork();
-
- boolean isLeaf();
-
- Item getParent();
-
- List
- getChildren();
-
- public String getCode();
-
- public boolean isValid();
-
-}
diff --git a/src/net/sourceforge/plantuml/project/ItemCaract.java b/src/net/sourceforge/plantuml/project/ItemCaract.java
deleted file mode 100644
index 75b193812..000000000
--- a/src/net/sourceforge/plantuml/project/ItemCaract.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-enum ItemCaract {
- BEGIN(NumericType.INSTANT), //
- COMPLETED(NumericType.INSTANT), //
- DURATION(NumericType.DURATION), //
- LOAD(NumericType.LOAD), //
- WORK(NumericType.NUMBER);
-
- private final NumericType type;
-
- private ItemCaract(NumericType type) {
- this.type = type;
- }
-
- public NumericType getNumericType() {
- return type;
- }
-
- public Numeric getData(Item item) {
- if (this == BEGIN) {
- return item.getBegin();
- }
- if (this == COMPLETED) {
- return item.getCompleted();
- }
- if (this == DURATION) {
- return item.getDuration();
- }
- if (this == LOAD) {
- return item.getLoad();
- }
- if (this == WORK) {
- return item.getWork();
- }
- throw new UnsupportedOperationException();
- }
-}
diff --git a/src/net/sourceforge/plantuml/project/ItemComparator.java b/src/net/sourceforge/plantuml/project/ItemComparator.java
deleted file mode 100644
index 1d8904048..000000000
--- a/src/net/sourceforge/plantuml/project/ItemComparator.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-import java.util.Comparator;
-
-public class ItemComparator implements Comparator
- {
-
- public int compare(Item it1, Item it2) {
- final int cmp1 = it1.getBegin().compareTo(it2.getBegin());
- if (cmp1 != 0) {
- return cmp1;
- }
- if (it1 instanceof Jalon && it2 instanceof Jalon == false) {
- return -1;
- }
- if (it2 instanceof Jalon && it1 instanceof Jalon == false) {
- return 1;
- }
- final int cmp2 = it2.getCompleted().compareTo(it1.getCompleted());
- if (cmp2 != 0) {
- return cmp2;
- }
- return it1.getCode().compareTo(it2.getCode());
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/Jalon.java b/src/net/sourceforge/plantuml/project/Jalon.java
deleted file mode 100644
index e9f61faab..000000000
--- a/src/net/sourceforge/plantuml/project/Jalon.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-import java.util.List;
-
-public class Jalon implements Item {
-
- private Instant begin;
- private final String code;
- private final Item parent;
-
- public Jalon(String code, Item parent) {
- this.code = code;
- this.parent = parent;
- }
-
- public Instant getBegin() {
- return begin;
- }
-
- public Instant getCompleted() {
- return begin;
- }
-
- public Duration getDuration() {
- return new Duration(0);
- }
-
- public Load getLoad() {
- return new Load(0);
- }
-
- public NumericNumber getWork() {
- return new NumericNumber(1);
- }
-
- public boolean isLeaf() {
- return true;
- }
-
- public Item getParent() {
- return parent;
- }
-
- public List
- getChildren() {
- return null;
- }
-
- public String getCode() {
- return code;
- }
-
- public boolean isValid() {
- return begin != null;
- }
-
- public void setInstant(Numeric value) {
- this.begin = (Instant) value;
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/Load.java b/src/net/sourceforge/plantuml/project/Load.java
deleted file mode 100644
index 1bc877e93..000000000
--- a/src/net/sourceforge/plantuml/project/Load.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-class Load implements Numeric {
-
- private final long minuteMen;
-
- public Load(long minuteMen) {
- this.minuteMen = minuteMen;
- }
-
- public Load(NumericNumber value) {
- this(value.getIntValue() * 24L * 60 * 60);
- }
-
- public Numeric add(Numeric other) {
- return new Load(((Load) other).minuteMen + minuteMen);
- }
-
- public NumericType getNumericType() {
- return NumericType.LOAD;
- }
-
- public int compareTo(Numeric other) {
- final Load this2 = (Load) other;
- if (this2.minuteMen > minuteMen) {
- return -1;
- }
- if (this2.minuteMen < minuteMen) {
- return 1;
- }
- return 0;
- }
-
- public final long getMinuteMen() {
- return minuteMen;
- }
-
- @Override
- public String toString() {
- return "LOAD:" + minuteMen / (24 * 60 * 60);
- }
-
-
-
-}
diff --git a/src/net/sourceforge/plantuml/project/Month.java b/src/net/sourceforge/plantuml/project/Month.java
deleted file mode 100644
index f4017908f..000000000
--- a/src/net/sourceforge/plantuml/project/Month.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-
-public enum Month {
-
- JAN(31), FEB(28), MAR(31), APR(30), MAY(31), JUN(30), JUL(31), AUG(31), SEP(30), OCT(31), NOV(30), DEC(31);
-
- final private int nbDays;
-
- private Month(int nbDays) {
- this.nbDays = nbDays;
- }
-
- public final int getNbDays(int year) {
- if (this == FEB && year % 4 == 0) {
- return 29;
- }
- return nbDays;
- }
-
- public final int getNum() {
- return ordinal() + 1;
- }
-
- public final int getNumNormal() {
- return ordinal();
- }
-
- public Month next() {
- if (this == DEC) {
- return null;
- }
- final List all = new ArrayList(EnumSet.allOf(Month.class));
- return all.get(getNum());
- }
-
- public Month prev() {
- if (this == JAN) {
- return null;
- }
- final List all = new ArrayList(EnumSet.allOf(Month.class));
- return all.get(getNum() - 2);
- }
-
- public static Month fromNum(int num) {
- if (num < 1 || num > 12) {
- throw new IllegalArgumentException();
- }
- final List all = new ArrayList(EnumSet.allOf(Month.class));
- return all.get(num - 1);
- }
-}
diff --git a/src/net/sourceforge/plantuml/project/Numeric.java b/src/net/sourceforge/plantuml/project/Numeric.java
deleted file mode 100644
index 05a42bd20..000000000
--- a/src/net/sourceforge/plantuml/project/Numeric.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-public interface Numeric extends Comparable {
- Numeric add(Numeric other);
-
- NumericType getNumericType();
-
-}
diff --git a/src/net/sourceforge/plantuml/project/NumericNumber.java b/src/net/sourceforge/plantuml/project/NumericNumber.java
deleted file mode 100644
index 79ddb23a9..000000000
--- a/src/net/sourceforge/plantuml/project/NumericNumber.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-class NumericNumber implements Numeric {
-
- private final int value;
-
- public NumericNumber(int v) {
- this.value = v;
- }
-
- public Numeric add(Numeric other) {
- if (other.getNumericType() != getNumericType()) {
- throw new IllegalArgumentException();
- }
- return new NumericNumber(value + ((NumericNumber) other).value);
- }
-
- public NumericType getNumericType() {
- return NumericType.NUMBER;
- }
-
- public int getIntValue() {
- return value;
- }
-
- @Override
- public String toString() {
- return "Number:" + value;
- }
-
- public int compareTo(Numeric other) {
- final NumericNumber this2 = (NumericNumber) other;
- if (this2.value > value) {
- return -1;
- }
- if (this2.value < value) {
- return 1;
- }
- return 0;
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/NumericType.java b/src/net/sourceforge/plantuml/project/NumericType.java
deleted file mode 100644
index 0ebbbe451..000000000
--- a/src/net/sourceforge/plantuml/project/NumericType.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-enum NumericType {
-
- NUMBER, INSTANT, LOAD, DURATION;
-
- public NumericType add(NumericType other) {
- if (this == NUMBER) {
- return addNumber(other);
- }
- if (this == INSTANT) {
- return null;
- }
- if (this == LOAD) {
- return addLoad(other);
- }
- if (this == DURATION) {
- return addDuration(other);
- }
- throw new UnsupportedOperationException();
-
- }
-
- private NumericType addDuration(NumericType other) {
- if (other == DURATION) {
- return DURATION;
- }
- return null;
- }
-
- private NumericType addLoad(NumericType other) {
- if (other == LOAD) {
- return LOAD;
- }
- return null;
- }
-
- private NumericType addNumber(NumericType other) {
- if (other == NUMBER) {
- return NUMBER;
- }
- return null;
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/PSystemProject.java b/src/net/sourceforge/plantuml/project/PSystemProject.java
deleted file mode 100644
index aa48c8012..000000000
--- a/src/net/sourceforge/plantuml/project/PSystemProject.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-import java.awt.Color;
-import java.awt.Graphics2D;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import net.sourceforge.plantuml.AbstractPSystem;
-import net.sourceforge.plantuml.Dimension2DDouble;
-import net.sourceforge.plantuml.EmptyImageBuilder;
-import net.sourceforge.plantuml.FileFormat;
-import net.sourceforge.plantuml.FileFormatOption;
-import net.sourceforge.plantuml.StringUtils;
-import net.sourceforge.plantuml.api.ImageDataSimple;
-import net.sourceforge.plantuml.core.DiagramDescription;
-import net.sourceforge.plantuml.core.ImageData;
-import net.sourceforge.plantuml.eps.EpsStrategy;
-import net.sourceforge.plantuml.png.PngIO;
-import net.sourceforge.plantuml.project.graphic.GanttDiagramUnused;
-import net.sourceforge.plantuml.ugraphic.ColorMapper;
-import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
-import net.sourceforge.plantuml.ugraphic.eps.UGraphicEps;
-import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d;
-import net.sourceforge.plantuml.ugraphic.svg.UGraphicSvg;
-
-public class PSystemProject extends AbstractPSystem {
-
- private final Project project = new Project();
- private final Color background = Color.WHITE;
- private final ColorMapper colorMapper = new ColorMapperIdentity();
-
- public int getNbImages() {
- return 1;
- }
-
- public DiagramDescription getDescription() {
- return new DiagramDescription("(Project)");
- }
-
- @Override
- final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormatOption, long seed)
- throws IOException {
- final GanttDiagramUnused diagram = new GanttDiagramUnused(project);
- final FileFormat fileFormat = fileFormatOption.getFileFormat();
- if (fileFormat == FileFormat.PNG) {
- final BufferedImage im = createImage(diagram);
- PngIO.write(im, os, fileFormatOption.isWithMetadata() ? getMetadata() : null, 96);
- } else if (fileFormat == FileFormat.SVG) {
- final UGraphicSvg svg = new UGraphicSvg(true, new Dimension2DDouble(0, 0), colorMapper,
- StringUtils.getAsHtml(background), false, 1.0, fileFormatOption.getSvgLinkTarget(),
- fileFormatOption.getHoverColor(), seed());
- diagram.draw(svg, 0, 0);
- svg.createXml(os, fileFormatOption.isWithMetadata() ? getMetadata() : null);
- } else if (fileFormat == FileFormat.EPS) {
- final UGraphicEps eps = new UGraphicEps(colorMapper, EpsStrategy.getDefault2());
- diagram.draw(eps, 0, 0);
- os.write(eps.getEPSCode().getBytes());
- } else if (fileFormat == FileFormat.EPS_TEXT) {
- final UGraphicEps eps = new UGraphicEps(colorMapper, EpsStrategy.WITH_MACRO_AND_TEXT);
- diagram.draw(eps, 0, 0);
- os.write(eps.getEPSCode().getBytes());
- } else {
- throw new UnsupportedOperationException();
- }
- return ImageDataSimple.ok();
- }
-
- private BufferedImage createImage(GanttDiagramUnused diagram) {
- EmptyImageBuilder builder = new EmptyImageBuilder(10, 10, background);
- Graphics2D g2d = builder.getGraphics2D();
- UGraphicG2d ug = new UGraphicG2d(colorMapper, g2d, 1.0);
-
- final double height = diagram.getHeight(ug.getStringBounder());
- final double width = diagram.getWidth(ug.getStringBounder());
-
- g2d.dispose();
-
- builder = new EmptyImageBuilder(width, height, background);
- final BufferedImage im = builder.getBufferedImage();
- g2d = builder.getGraphics2D();
-
- ug = new UGraphicG2d(colorMapper, g2d, 1.0);
- ug.setBufferedImage(im);
- diagram.draw(ug, 0, 0);
- g2d.dispose();
- return im;
- }
-
- public final Project getProject() {
- return project;
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/ParentItem.java b/src/net/sourceforge/plantuml/project/ParentItem.java
deleted file mode 100644
index 15392b26f..000000000
--- a/src/net/sourceforge/plantuml/project/ParentItem.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-public class ParentItem implements Item {
-
- private final String code;
- private final Item parent;
-
- private final List
- children = new ArrayList
- ();
-
- public ParentItem(String code, Item parent) {
- this.code = code;
- this.parent = parent;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder(code + " {");
- for (final Iterator
- it = children.iterator(); it.hasNext();) {
- final Item child = it.next();
- sb.append(child.getCode());
- if (it.hasNext()) {
- sb.append(", ");
- }
- }
- sb.append("}");
- return sb.toString();
- }
-
- public Instant getBegin() {
- Instant result = null;
- for (Item it : children) {
- if (result == null || result.compareTo(it.getBegin()) > 0) {
- result = it.getBegin();
- }
- }
- return result;
- }
-
- public Instant getCompleted() {
- Instant result = null;
- for (Item it : children) {
- if (result == null || result.compareTo(it.getCompleted()) < 0) {
- result = it.getCompleted();
- }
- }
- return result;
- }
-
- public Duration getDuration() {
- throw new UnsupportedOperationException();
- }
-
- public Load getLoad() {
- throw new UnsupportedOperationException();
- }
-
- public NumericNumber getWork() {
- throw new UnsupportedOperationException();
- }
-
- public boolean isLeaf() {
- return false;
- }
-
- public Item getParent() {
- return parent;
- }
-
- public List
- getChildren() {
- return Collections.unmodifiableList(children);
- }
-
- public String getCode() {
- return code;
- }
-
- public void addChild(Item child) {
- this.children.add(child);
- }
-
- public boolean isValid() {
- if (children.size() == 0) {
- return false;
- }
- for (Item it : children) {
- if (it.isValid() == false) {
- return false;
- }
- }
- return true;
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/Project.java b/src/net/sourceforge/plantuml/project/Project.java
deleted file mode 100644
index 449a3c89e..000000000
--- a/src/net/sourceforge/plantuml/project/Project.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import net.sourceforge.plantuml.StringUtils;
-
-public class Project {
-
- private final Map variables = new TreeMap();
-
- private final Map items = new TreeMap();
-
- private final Map ressources = new TreeMap();
-
- private final DayCloseOr dayClose = new DayCloseOr();
-
- public Project() {
- }
-
- public final Instant getStart() {
- Instant result = null;
- for (Item it : getValidItems()) {
- if (result == null || result.compareTo(it.getBegin()) > 0) {
- result = it.getBegin();
- }
- }
- return result;
- }
-
- public final Instant getEnd() {
- Instant result = null;
- for (Item it : getValidItems()) {
- if (result == null || result.compareTo(it.getCompleted()) < 0) {
- result = it.getCompleted();
- }
- }
- return result;
- }
-
- public FreeVariable createVariable(String name, NumericType type) {
- if (variables.containsKey(name)) {
- throw new IllegalArgumentException("Already exist: " + name);
- }
- final FreeVariable variable = new FreeVariable(name, type);
- variables.put(name, variable);
- return variable;
- }
-
- public Expression getExpression(String desc) {
- desc = StringUtils.trin(desc);
- final int plus = desc.indexOf('+');
-
- if (plus != -1) {
- final Expression exp1 = getExpression(desc.substring(0, plus));
- final Expression exp2 = getExpression(desc.substring(plus + 1));
- if (exp1.getNumericType() == NumericType.INSTANT
- && (exp2.getNumericType() == NumericType.DURATION || exp2.getNumericType() == NumericType.NUMBER)) {
- return new FormalAdditionInstantDuration(exp1, exp2, new BasicInstantArithmetic(dayClose));
- }
- if (exp2.getNumericType() == NumericType.INSTANT
- && (exp1.getNumericType() == NumericType.DURATION || exp1.getNumericType() == NumericType.NUMBER)) {
- return new FormalAdditionInstantDuration(exp2, exp1, new BasicInstantArithmetic(dayClose));
- }
- return new FormalAddition(exp1, exp2);
- }
-
- if (desc.matches("^\\d+$")) {
- return new Constant(new NumericNumber(Integer.parseInt(desc)));
- }
- if (desc.matches("^\\$\\w+$")) {
- final String varName = desc.substring(1);
- final FreeVariable v = variables.get(varName);
- if (v != null) {
- return v;
- }
- throw new IllegalArgumentException("No such variable: " + desc);
- }
- if (Day.isValidDesc(desc)) {
- final Day d = new Day(desc);
- return new Constant(new Instant(d));
- }
- if (desc.matches("^[\\w/]+\\$(begin|completed|work|load|duration)$")) {
- final int idx = desc.indexOf('$');
- final String varName = desc.substring(0, idx);
- final Item item = items.get(varName);
- if (item == null) {
- throw new IllegalArgumentException("No such variable: " + desc);
- }
- return new Constant(ItemCaract.valueOf(StringUtils.goUpperCase(desc.substring(idx + 1))).getData(item));
- }
- if (desc.startsWith("^")) {
- final Item item = items.get(desc.substring(1));
- if (item == null) {
- throw new IllegalArgumentException("No such variable: " + desc);
- }
- return new Constant(item.getBegin());
- }
- throw new IllegalArgumentException("cannot parse");
- }
-
- public boolean affectation(String destination, Expression expression) {
- if (destination.startsWith("^")) {
- return affectationJalon(destination, expression);
- }
- if (destination.startsWith("~")) {
- return affectationRessource(destination, expression);
- }
- final int idx = destination.indexOf('$');
- if (idx == -1) {
- return affectationVariable(destination, expression);
- }
- final String itemName = destination.substring(0, idx);
- final Item item = getItem(itemName);
- if (item instanceof IncompleteItem == false) {
- return false;
- }
- final IncompleteItem incompleteItem = (IncompleteItem) item;
- final String suf = destination.substring(idx + 1);
- if (suf.equalsIgnoreCase("begin")) {
- incompleteItem.setData(ItemCaract.BEGIN, expression.getValue());
- } else if (suf.equalsIgnoreCase("completed")) {
- incompleteItem.setData(ItemCaract.COMPLETED, expression.getValue());
- } else if (suf.equalsIgnoreCase("work")) {
- incompleteItem.setData(ItemCaract.WORK, expression.getValue());
- } else if (suf.equalsIgnoreCase("duration")) {
- if (expression.getNumericType() == NumericType.NUMBER) {
- expression = new Constant(new Duration((NumericNumber) expression.getValue()));
- }
- incompleteItem.setData(ItemCaract.DURATION, expression.getValue());
- } else if (suf.equalsIgnoreCase("LOAD")) {
- if (expression.getNumericType() == NumericType.NUMBER) {
- expression = new Constant(new Load((NumericNumber) expression.getValue()));
- }
- incompleteItem.setData(ItemCaract.LOAD, expression.getValue());
- } else {
- return false;
- }
- return true;
- }
-
- private boolean affectationRessource(String res, Expression expression) {
- res = res.substring(1);
- final int idx = res.indexOf('$');
- final String suf = res.substring(idx + 1);
- if (suf.equals("capacity")) {
- final Ressource ressource = getRessource(res.substring(0, idx));
- ressource.setCapacity(((NumericNumber) expression.getValue()).getIntValue());
- return true;
- }
- return false;
- }
-
- private Ressource getRessource(String code) {
- Ressource result = ressources.get(code);
- if (result == null) {
- result = new Ressource(code);
- ressources.put(code, result);
- }
- return result;
- }
-
- private boolean affectationJalon(String jalon, Expression expression) {
- final Jalon it = getItemJalon(jalon.substring(1));
- it.setInstant(expression.getValue());
- return true;
- }
-
- private Jalon getItemJalon(String jalon) {
- Jalon result = (Jalon) items.get(jalon);
- if (result == null) {
- result = new Jalon(jalon, null);
- items.put(jalon, result);
-
- }
- return result;
- }
-
- private Item getItem(String code) {
- Item result = items.get(code);
- if (result == null) {
- final int idx = code.indexOf('/');
- if (idx == -1) {
- result = new IncompleteItem(code, null, new BasicInstantArithmetic(dayClose));
- } else {
- final ParentItem parent = getItemParent(code.substring(0, idx));
- result = new IncompleteItem(code, parent, new BasicInstantArithmetic(dayClose));
- parent.addChild(result);
- }
- items.put(code, result);
- }
- return result;
- }
-
- private ParentItem getItemParent(String code) {
- Item result = items.get(code);
- if (result == null) {
- final int idx = code.indexOf('/');
- if (idx == -1) {
- result = new ParentItem(code, null);
- items.put(code, result);
- } else {
- throw new UnsupportedOperationException();
- }
- }
- return (ParentItem) result;
- }
-
- private boolean affectationVariable(String destination, Expression expression) {
- if (variables.containsKey(destination) == false) {
- return false;
- }
- variables.get(destination).setValue(expression);
- return true;
- }
-
- public List
- getValidItems() {
- final List
- result = new ArrayList
- ();
- for (Item item : items.values()) {
- if (item.isValid()) {
- result.add(item);
- }
- }
- Collections.sort(result, new ItemComparator());
- return Collections.unmodifiableList(result);
- }
-
- public final DayClose getDayClose() {
- return dayClose;
- }
-
- public void closeWeekDay(WeekDay weekDay) {
- dayClose.add(new DayCloseWeekDay(weekDay));
- }
-
- // public Item getItem(String code) {
- // BasicItem result = items.get(code);
- // if (result == null) {
- // result = new BasicItem(code);
- // items.put(code, result);
- // }
- // return result;
- // }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/WeekDay.java b/src/net/sourceforge/plantuml/project/WeekDay.java
deleted file mode 100644
index 3dee5c794..000000000
--- a/src/net/sourceforge/plantuml/project/WeekDay.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-
-public enum WeekDay {
-
- SUN, MON, TUE, WED, THU, FRI, SAT;
-
- public WeekDay next() {
- if (this.ordinal() == 6) {
- return SUN;
- }
- final List all = new ArrayList(EnumSet.allOf(WeekDay.class));
- return all.get(this.ordinal() + 1);
- }
-
- public WeekDay prev() {
- if (this.ordinal() == 0) {
- return SAT;
- }
- final List all = new ArrayList(EnumSet.allOf(WeekDay.class));
- return all.get(this.ordinal() - 1);
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/project/graphic/GanttDiagramUnused.java b/src/net/sourceforge/plantuml/project/graphic/GanttDiagramUnused.java
deleted file mode 100644
index 9fcaaec9d..000000000
--- a/src/net/sourceforge/plantuml/project/graphic/GanttDiagramUnused.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project.graphic;
-
-import java.util.Map;
-import java.util.SortedMap;
-
-import net.sourceforge.plantuml.Log;
-import net.sourceforge.plantuml.graphic.HtmlColor;
-import net.sourceforge.plantuml.graphic.HtmlColorSetSimple;
-import net.sourceforge.plantuml.graphic.HtmlColorUtils;
-import net.sourceforge.plantuml.graphic.StringBounder;
-import net.sourceforge.plantuml.project.Instant;
-import net.sourceforge.plantuml.project.Item;
-import net.sourceforge.plantuml.project.Jalon;
-import net.sourceforge.plantuml.project.Project;
-import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
-import net.sourceforge.plantuml.ugraphic.UChangeColor;
-import net.sourceforge.plantuml.ugraphic.UGraphic;
-import net.sourceforge.plantuml.ugraphic.ULine;
-import net.sourceforge.plantuml.ugraphic.UPolygon;
-import net.sourceforge.plantuml.ugraphic.URectangle;
-import net.sourceforge.plantuml.ugraphic.UShape;
-import net.sourceforge.plantuml.ugraphic.UTranslate;
-
-public class GanttDiagramUnused {
-
- private final Project project;
- private final TimeScale timeScale;
- private final ItemHeader itemHeader;
-
- public GanttDiagramUnused(Project project) {
- this.project = project;
- this.timeScale = new TimeScale(project);
- this.itemHeader = new ItemHeader(project);
- }
-
- public void draw(UGraphic ug, double x, double y) {
- final StringBounder stringBounder = ug.getStringBounder();
- final double x0start = itemHeader.getWidth(stringBounder);
-
- final double timeScaleHeight = timeScale.getHeight(stringBounder);
-
- final SortedMap pos = timeScale.getAbscisse(stringBounder);
- for (Item it : project.getValidItems()) {
- final Instant start = it.getBegin();
- final Instant completed = it.getCompleted();
- if (pos.get(start) == null || pos.get(completed) == null) {
- Log.println("PB " + it);
- continue;
- }
- final double x1 = pos.get(start) + 3;
- final double x2 = pos.get(completed) - 3;
-
- final double yitem = timeScaleHeight + itemHeader.getPosition(stringBounder, it) + 3;
-
- final UShape rect;
- if (it instanceof Jalon) {
- rect = new UPolygon();
- ((UPolygon) rect).addPoint(0, 3);
- ((UPolygon) rect).addPoint(3, 0);
- ((UPolygon) rect).addPoint(6, 3);
- ((UPolygon) rect).addPoint(3, 6);
- } else {
- rect = new URectangle(x2 - x1, 3);
- }
- ug = ug.apply(new UChangeColor(HtmlColorUtils.GREEN));
- ug = ug.apply(new UChangeBackColor(HtmlColorUtils.GRAY));
- ug.apply(new UTranslate(x0start + x1, yitem)).draw(rect);
-
- }
-
- drawGrid(ug, x + x0start, y + timeScaleHeight, pos);
-
- ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
- ug = ug.apply(new UChangeBackColor(null));
- timeScale.draw(ug, x + x0start, y);
- itemHeader.draw(ug, x, y + timeScaleHeight);
-
- }
-
- private final HtmlColor lightGray = new HtmlColorSetSimple().getColorIfValid("#C8C8C8");
-
- private void drawGrid(UGraphic ug, double x, double y, SortedMap pos) {
- final ULine line = new ULine(0, itemHeader.getHeight(ug.getStringBounder()));
- Instant last = null;
- for (Map.Entry ent : pos.entrySet()) {
- final double xcur = ent.getValue();
- if (last == null || last.next(null).equals(ent.getKey())) {
- ug = ug.apply(new UChangeColor(lightGray));
- } else {
- ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
- }
- ug.apply(new UTranslate(x + xcur, y)).draw(line);
- last = ent.getKey();
- }
- }
-
- public double getWidth(StringBounder stringBounder) {
- return itemHeader.getWidth(stringBounder) + timeScale.getWidth(stringBounder) + 3;
- }
-
- public double getHeight(StringBounder stringBounder) {
- return itemHeader.getHeight(stringBounder) + timeScale.getHeight(stringBounder) + 3;
- }
-
-}
\ No newline at end of file
diff --git a/src/net/sourceforge/plantuml/project/graphic/ItemHeader.java b/src/net/sourceforge/plantuml/project/graphic/ItemHeader.java
deleted file mode 100644
index 37469493b..000000000
--- a/src/net/sourceforge/plantuml/project/graphic/ItemHeader.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project.graphic;
-
-import java.awt.Font;
-import java.awt.geom.Dimension2D;
-
-import net.sourceforge.plantuml.SpriteContainerEmpty;
-import net.sourceforge.plantuml.cucadiagram.Display;
-import net.sourceforge.plantuml.graphic.FontConfiguration;
-import net.sourceforge.plantuml.graphic.HorizontalAlignment;
-import net.sourceforge.plantuml.graphic.HtmlColorUtils;
-import net.sourceforge.plantuml.graphic.StringBounder;
-import net.sourceforge.plantuml.graphic.TextBlock;
-import net.sourceforge.plantuml.project.Item;
-import net.sourceforge.plantuml.project.Project;
-import net.sourceforge.plantuml.ugraphic.UChangeColor;
-import net.sourceforge.plantuml.ugraphic.UFont;
-import net.sourceforge.plantuml.ugraphic.UGraphic;
-import net.sourceforge.plantuml.ugraphic.ULine;
-import net.sourceforge.plantuml.ugraphic.URectangle;
-import net.sourceforge.plantuml.ugraphic.UTranslate;
-
-class ItemHeader {
-
- private final UFont font = UFont.serif(9);
- private final Project project;
- private final FontConfiguration fontConfig = FontConfiguration.blackBlueTrue(font);
-
- public ItemHeader(Project project) {
- this.project = project;
- }
-
- public void draw(UGraphic ug, double x, double y) {
-
- final StringBounder stringBounder = ug.getStringBounder();
-
- ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
- ug.apply(new UTranslate(x, y)).draw(new URectangle(getWidth(stringBounder), getHeight(stringBounder)));
-
- for (Item it : project.getValidItems()) {
- final TextBlock b = Display.create("" + it.getCode()).create(fontConfig, HorizontalAlignment.LEFT,
- new SpriteContainerEmpty());
- final Dimension2D dim = b.calculateDimension(stringBounder);
- b.drawU(ug.apply(new UTranslate(x, y)));
- y += dim.getHeight();
- ug.apply(new UTranslate(x, y)).draw(new ULine(getWidth(stringBounder), 0));
- }
- }
-
- public double getWidth(StringBounder stringBounder) {
- double width = 0;
- for (Item it : project.getValidItems()) {
- final Dimension2D dim = stringBounder.calculateDimension(font, it.getCode());
- width = Math.max(width, dim.getWidth());
- }
- return width;
- }
-
- public double getHeight(StringBounder stringBounder) {
- double height = 0;
- for (Item it : project.getValidItems()) {
- final Dimension2D dim = stringBounder.calculateDimension(font, it.getCode());
- height += dim.getHeight();
-
- }
- return height;
- }
-
- public double getPosition(StringBounder stringBounder, Item item) {
- double pos = 0;
- for (Item it : project.getValidItems()) {
- if (it == item) {
- return pos;
- }
- final Dimension2D dim = stringBounder.calculateDimension(font, it.getCode());
- pos += dim.getHeight();
-
- }
- throw new IllegalArgumentException();
- }
-
-}
\ No newline at end of file
diff --git a/src/net/sourceforge/plantuml/project/graphic/TimeScale.java b/src/net/sourceforge/plantuml/project/graphic/TimeScale.java
deleted file mode 100644
index b157429dd..000000000
--- a/src/net/sourceforge/plantuml/project/graphic/TimeScale.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project.graphic;
-
-import java.awt.Font;
-import java.awt.geom.Dimension2D;
-import java.util.Collections;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import net.sourceforge.plantuml.SpriteContainerEmpty;
-import net.sourceforge.plantuml.cucadiagram.Display;
-import net.sourceforge.plantuml.graphic.FontConfiguration;
-import net.sourceforge.plantuml.graphic.HorizontalAlignment;
-import net.sourceforge.plantuml.graphic.HtmlColorUtils;
-import net.sourceforge.plantuml.graphic.StringBounder;
-import net.sourceforge.plantuml.graphic.TextBlock;
-import net.sourceforge.plantuml.project.Day;
-import net.sourceforge.plantuml.project.Instant;
-import net.sourceforge.plantuml.project.Month;
-import net.sourceforge.plantuml.project.Project;
-import net.sourceforge.plantuml.ugraphic.UChangeColor;
-import net.sourceforge.plantuml.ugraphic.UFont;
-import net.sourceforge.plantuml.ugraphic.UGraphic;
-import net.sourceforge.plantuml.ugraphic.ULine;
-import net.sourceforge.plantuml.ugraphic.URectangle;
-import net.sourceforge.plantuml.ugraphic.UTranslate;
-
-class TimeScale {
-
- private final UFont font = UFont.serif(9);
- private final Project project;
- private final FontConfiguration fontConfig = FontConfiguration.blackBlueTrue(font);
-
- public TimeScale(Project project) {
- this.project = project;
- }
-
- public void draw(UGraphic ug, final double x, double y) {
- final StringBounder stringBounder = ug.getStringBounder();
- final double monthHeight = getMonthHeight(stringBounder);
- final double caseWidth = getCaseWidth(stringBounder);
- final double caseHeight = getCaseHeight(stringBounder);
- final int nb = getNbCase();
-
- ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
- ug.apply(new UTranslate(x, y)).draw(new URectangle(nb * caseWidth, monthHeight));
- final Instant end = project.getEnd();
-
- Month printed = null;
-
- double curx = x;
- for (Instant cur = project.getStart(); cur.compareTo(end) <= 0; cur = cur.next(project.getDayClose())) {
- final Day d = cur.getDay();
- if (printed == null || d.getMonth() != printed) {
- ug.apply(new UTranslate(curx, y)).draw(new ULine(0, monthHeight));
- printed = d.getMonth();
- final TextBlock b = Display.create(printed.name()).create(fontConfig, HorizontalAlignment.LEFT,
- new SpriteContainerEmpty());
- final Dimension2D dim = b.calculateDimension(stringBounder);
- b.drawU(ug.apply(new UTranslate(curx, (y + (monthHeight - dim.getHeight()) / 2))));
- }
- curx += caseWidth;
- }
-
- curx = x;
- y += monthHeight;
- ug.apply(new UTranslate(x, y)).draw(new URectangle(nb * caseWidth, caseHeight));
-
- for (Instant cur = project.getStart(); cur.compareTo(end) <= 0; cur = cur.next(project.getDayClose())) {
- final Day d = cur.getDay();
- final TextBlock b = Display.create("" + d.getNumDay()).create(fontConfig, HorizontalAlignment.LEFT,
- new SpriteContainerEmpty());
- final Dimension2D dim = b.calculateDimension(stringBounder);
- b.drawU(ug.apply(new UTranslate((curx + (caseWidth - dim.getWidth()) / 2), (y + (caseHeight - dim
- .getHeight()) / 2))));
- curx += caseWidth;
- ug.apply(new UTranslate(curx, y)).draw(new ULine(0, caseHeight));
- }
- }
-
- public SortedMap getAbscisse(StringBounder stringBounder) {
- final SortedMap pos = new TreeMap();
- final double caseWidth = getCaseWidth(stringBounder);
- final Instant end = project.getEnd();
- double x = 0;
- for (Instant cur = project.getStart(); cur.compareTo(end) <= 0; cur = cur.next(project.getDayClose())) {
- pos.put(cur, x);
- x += caseWidth;
- }
- return Collections.unmodifiableSortedMap(pos);
- }
-
- private int getNbCase() {
- int result = 0;
- final Instant end = project.getEnd();
- for (Instant cur = project.getStart(); cur.compareTo(end) <= 0; cur = cur.next(project.getDayClose())) {
- result++;
- }
- return result;
- }
-
- private double getCaseWidth(StringBounder stringBounder) {
- final Dimension2D dim00 = stringBounder.calculateDimension(font, "00");
- return dim00.getWidth() + 3;
- }
-
- private double getCaseHeight(StringBounder stringBounder) {
- final Dimension2D dim00 = stringBounder.calculateDimension(font, "00");
- return dim00.getHeight() + 3;
- }
-
- private double getMonthHeight(StringBounder stringBounder) {
- final Dimension2D dimZZ = stringBounder.calculateDimension(font, "ZZ");
- return dimZZ.getHeight() + 3;
- }
-
- public double getWidth(StringBounder stringBounder) {
- return getCaseWidth(stringBounder) * getNbCase();
- }
-
- public double getHeight(StringBounder stringBounder) {
- return getCaseHeight(stringBounder) + getMonthHeight(stringBounder);
- }
-
-}
\ No newline at end of file
diff --git a/src/net/sourceforge/plantuml/project3/ComplementDate.java b/src/net/sourceforge/plantuml/project3/ComplementDate.java
index c53ab3deb..c92236c11 100644
--- a/src/net/sourceforge/plantuml/project3/ComplementDate.java
+++ b/src/net/sourceforge/plantuml/project3/ComplementDate.java
@@ -44,7 +44,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
public class ComplementDate implements ComplementPattern {
public IRegex toRegex(String suffix) {
- return new RegexOr(toRegexA(suffix), toRegexB(suffix), toRegexC(suffix));
+ return new RegexOr(toRegexA(suffix), toRegexB(suffix), toRegexC(suffix), toRegexD(suffix));
}
private IRegex toRegexA(String suffix) {
@@ -74,6 +74,12 @@ public class ComplementDate implements ComplementPattern {
new RegexLeaf("CYEAR" + suffix, "([\\d]{4})"));
}
+ private IRegex toRegexD(String suffix) {
+ return new RegexConcat( //
+ new RegexLeaf("DCOUNT" + suffix, "([\\d]+)"), //
+ new RegexLeaf("[%s]+days?[%s]+after[%s]+start"));
+ }
+
public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) {
if (arg.get("ADAY" + suffix, 0) != null) {
return Failable. ok(resultA(arg, suffix));
@@ -84,9 +90,17 @@ public class ComplementDate implements ComplementPattern {
if (arg.get("CDAY" + suffix, 0) != null) {
return Failable. ok(resultC(arg, suffix));
}
+ if (arg.get("DCOUNT" + suffix, 0) != null) {
+ return Failable. ok(resultD(system, arg, suffix));
+ }
throw new IllegalStateException();
}
+ private Complement resultD(GanttDiagram system, RegexResult arg, String suffix) {
+ final int day = Integer.parseInt(arg.get("DCOUNT" + suffix, 0));
+ return system.getStartingDate(day);
+ }
+
private Complement resultA(RegexResult arg, String suffix) {
final int day = Integer.parseInt(arg.get("ADAY" + suffix, 0));
final String month = arg.get("AMONTH" + suffix, 0);
diff --git a/src/net/sourceforge/plantuml/project3/ComplementSeveralDays.java b/src/net/sourceforge/plantuml/project3/ComplementSeveralDays.java
index fb83e92e2..cb8c44c46 100644
--- a/src/net/sourceforge/plantuml/project3/ComplementSeveralDays.java
+++ b/src/net/sourceforge/plantuml/project3/ComplementSeveralDays.java
@@ -44,20 +44,20 @@ public class ComplementSeveralDays implements ComplementPattern {
public IRegex toRegex(String suffix) {
return new RegexConcat( //
- new RegexLeaf("COMPLEMENT" + suffix, "(\\d+)[%s]+(days?|weeks?)"), //
- new RegexLeaf("LOAD" + suffix, "([%s]+at[%s]+(\\d+)%)?"));
+ new RegexLeaf("COMPLEMENT" + suffix, "(\\d+)[%s]+(days?|weeks?)")); //
+ // new RegexLeaf("LOAD" + suffix, "([%s]+at[%s]+(\\d+)%)?"));
}
public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) {
final String number = arg.get("COMPLEMENT" + suffix, 0);
final boolean inWeeks = arg.get("COMPLEMENT" + suffix, 1).startsWith("w");
final int factor = inWeeks ? system.daysInWeek() : 1;
- final String load = arg.get("LOAD" + suffix, 1);
+ // final String load = arg.get("LOAD" + suffix, 1);
final int days = Integer.parseInt(number) * factor;
- if (load == null) {
- return Failable. ok(LoadInDays.inDay(days));
- }
- return Failable. ok(LoadInDays.inDayWithLoad(days, Integer.parseInt(load)));
+ // if (load == null) {
+ return Failable. ok(LoadInDays.inDay(days));
+ // }
+ // return Failable. ok(LoadInDays.inDayWithLoad(days, Integer.parseInt(load)));
}
}
diff --git a/src/net/sourceforge/plantuml/project3/DayAsDate.java b/src/net/sourceforge/plantuml/project3/DayAsDate.java
index a67ebc16a..0a1d0ffc9 100644
--- a/src/net/sourceforge/plantuml/project3/DayAsDate.java
+++ b/src/net/sourceforge/plantuml/project3/DayAsDate.java
@@ -35,6 +35,8 @@
*/
package net.sourceforge.plantuml.project3;
+import java.util.Date;
+
public class DayAsDate implements Complement, Comparable, Subject {
private final int year;
@@ -49,6 +51,14 @@ public class DayAsDate implements Complement, Comparable, Subject {
return new DayAsDate(year, Month.values()[month - 1], dayOfMonth);
}
+ public static DayAsDate today() {
+ final Date now = new Date();
+ final int year = now.getYear() + 1900;
+ final int month = now.getMonth() + 1;
+ final int dayOfMonth = now.getDate();
+ return create(year, month, dayOfMonth);
+ }
+
private DayAsDate(int year, Month month, int dayOfMonth) {
this.year = year;
this.dayOfMonth = dayOfMonth;
@@ -126,4 +136,5 @@ public class DayAsDate implements Complement, Comparable, Subject {
public int compareTo(DayAsDate other) {
return this.internalNumber() - other.internalNumber();
}
+
}
diff --git a/src/net/sourceforge/plantuml/project3/GanttDiagram.java b/src/net/sourceforge/plantuml/project3/GanttDiagram.java
index 9a488ace3..e0f4b0efc 100644
--- a/src/net/sourceforge/plantuml/project3/GanttDiagram.java
+++ b/src/net/sourceforge/plantuml/project3/GanttDiagram.java
@@ -39,19 +39,20 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.Scale;
import net.sourceforge.plantuml.SpriteContainerEmpty;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.cucadiagram.Display;
@@ -124,7 +125,7 @@ public class GanttDiagram extends AbstractPSystem implements Subject {
throws IOException {
final double margin = 10;
- sortTasks();
+ // OsortTasks();
final Scale scale = getScale();
final double dpiFactor = scale == null ? 1 : scale.getScale(100, 100);
@@ -136,19 +137,19 @@ public class GanttDiagram extends AbstractPSystem implements Subject {
return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed, os);
}
- private void sortTasks() {
- final TaskCodeSimpleOrder order = getCanonicalOrder(1);
- final List list = new ArrayList(tasks.values());
- Collections.sort(list, new Comparator() {
- public int compare(Task task1, Task task2) {
- return order.compare(task1.getCode(), task2.getCode());
- }
- });
- tasks.clear();
- for (Task task : list) {
- tasks.put(task.getCode(), task);
- }
- }
+ // private void sortTasks() {
+ // final TaskCodeSimpleOrder order = getCanonicalOrder(1);
+ // final List list = new ArrayList(tasks.values());
+ // Collections.sort(list, new Comparator() {
+ // public int compare(Task task1, Task task2) {
+ // return order.compare(task1.getCode(), task2.getCode());
+ // }
+ // });
+ // tasks.clear();
+ // for (Task task : list) {
+ // tasks.put(task.getCode(), task);
+ // }
+ // }
private UDrawable getUDrawable() {
return new UDrawable() {
@@ -510,24 +511,6 @@ public class GanttDiagram extends AbstractPSystem implements Subject {
tasks.put(separator.getCode(), separator);
}
- private TaskCodeSimpleOrder getCanonicalOrder(int hierarchyHeader) {
- final List codes = new ArrayList();
- for (TaskCode code : tasks.keySet()) {
- if (code.getHierarchySize() >= hierarchyHeader) {
- codes.add(code.truncateHierarchy(hierarchyHeader));
- }
- }
- return new TaskCodeSimpleOrder(codes, hierarchyHeader);
- }
-
- private int getMaxHierarchySize() {
- int max = Integer.MIN_VALUE;
- for (TaskCode code : tasks.keySet()) {
- max = Math.max(max, code.getHierarchySize());
- }
- return max;
- }
-
public void addContraint(GanttConstraint constraint) {
constraints.add(constraint);
}
@@ -547,6 +530,13 @@ public class GanttDiagram extends AbstractPSystem implements Subject {
return this.calendar.getStartingDate();
}
+ public DayAsDate getStartingDate(int nday) {
+ if (this.calendar == null) {
+ return null;
+ }
+ return ((GCalendarSimple) this.calendar).toDayAsDate(new InstantDay(nday));
+ }
+
public int daysInWeek() {
return 7 - closedDayOfWeek.size();
}
@@ -561,9 +551,18 @@ public class GanttDiagram extends AbstractPSystem implements Subject {
private final Map resources = new LinkedHashMap();
- public void affectResource(Task result, String resourceName) {
- Resource resource = getResource(resourceName);
- result.addResource(resource);
+ public void affectResource(Task result, String description) {
+ final Pattern p = Pattern.compile("([^:]+)(:(\\d+))?");
+ final Matcher m = p.matcher(description);
+ if (m.find() == false) {
+ throw new IllegalArgumentException();
+ }
+ final Resource resource = getResource(m.group(1));
+ int percentage = 100;
+ if (m.group(3) != null) {
+ percentage = Integer.parseInt(m.group(3));
+ }
+ result.addResource(resource, percentage);
}
public Resource getResource(String resourceName) {
@@ -637,4 +636,18 @@ public class GanttDiagram extends AbstractPSystem implements Subject {
nameDays.put(day, name);
}
+ public void setTodayColors(ComplementColors colors) {
+ if (today == null) {
+ this.today = DayAsDate.today();
+ }
+ colorDay(today, colors.getCenter());
+ }
+
+ private DayAsDate today;
+
+ public CommandExecutionResult setToday(DayAsDate date) {
+ this.today = date;
+ return CommandExecutionResult.ok();
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/project3/GanttDiagramFactory.java b/src/net/sourceforge/plantuml/project3/GanttDiagramFactory.java
index d337e6ff1..b3d9a1c83 100644
--- a/src/net/sourceforge/plantuml/project3/GanttDiagramFactory.java
+++ b/src/net/sourceforge/plantuml/project3/GanttDiagramFactory.java
@@ -51,7 +51,7 @@ public class GanttDiagramFactory extends UmlDiagramFactory {
private List subjects() {
return Arrays. asList(new SubjectTask(), new SubjectProject(), new SubjectDayOfWeek(),
- new SubjectDayAsDate(), new SubjectDaysAsDates(), new SubjectResource());
+ new SubjectDayAsDate(), new SubjectDaysAsDates(), new SubjectResource(), new SubjectToday());
}
public GanttDiagramFactory(DiagramType type) {
diff --git a/src/net/sourceforge/plantuml/project3/Load.java b/src/net/sourceforge/plantuml/project3/Load.java
index 6a7109fa4..d74b619a3 100644
--- a/src/net/sourceforge/plantuml/project3/Load.java
+++ b/src/net/sourceforge/plantuml/project3/Load.java
@@ -35,7 +35,7 @@
*/
package net.sourceforge.plantuml.project3;
-public interface Load extends Value, Complement, LoadPlanable {
+public interface Load extends Value, Complement {
int getFullLoad();
diff --git a/src/net/sourceforge/plantuml/project3/LoadInDays.java b/src/net/sourceforge/plantuml/project3/LoadInDays.java
index f52001bb4..2695cf1c1 100644
--- a/src/net/sourceforge/plantuml/project3/LoadInDays.java
+++ b/src/net/sourceforge/plantuml/project3/LoadInDays.java
@@ -49,10 +49,10 @@ public class LoadInDays implements Load {
return new LoadInDays(days, 100);
}
- public static Complement inDayWithLoad(int days, int loadPerDay) {
- final int tmp = (int) Math.ceil(days * 100.0 / loadPerDay);
- return new LoadInDays(tmp, loadPerDay);
- }
+// public static Complement inDayWithLoad(int days, int loadPerDay) {
+// final int tmp = (int) Math.ceil(days * 100.0 / loadPerDay);
+// return new LoadInDays(tmp, loadPerDay);
+// }
public int getFullLoad() {
return days * loadPerDay;
diff --git a/src/net/sourceforge/plantuml/project3/PlanUtils.java b/src/net/sourceforge/plantuml/project3/PlanUtils.java
index 084c56ca3..8afc8e87c 100644
--- a/src/net/sourceforge/plantuml/project3/PlanUtils.java
+++ b/src/net/sourceforge/plantuml/project3/PlanUtils.java
@@ -49,4 +49,12 @@ public class PlanUtils {
};
}
+ public static LoadPlanable multiply(final LoadPlanable p1, final LoadPlanable p2) {
+ return new LoadPlanable() {
+ public int getLoadAt(Instant instant) {
+ return p1.getLoadAt(instant) * p2.getLoadAt(instant) / 100;
+ }
+ };
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/project3/Resource.java b/src/net/sourceforge/plantuml/project3/Resource.java
index aa2e41a09..ea95a93aa 100644
--- a/src/net/sourceforge/plantuml/project3/Resource.java
+++ b/src/net/sourceforge/plantuml/project3/Resource.java
@@ -38,16 +38,16 @@ package net.sourceforge.plantuml.project3;
import java.util.Set;
import java.util.TreeSet;
-public class Resource implements Subject, LoadPlanable {
+public class Resource implements Subject /* , LoadPlanable */{
private final String name;
private ResourceDraw draw;
- private final LoadPlanable loadPlanable;
+ // private final LoadPlanable loadPlanable;
private Set closed = new TreeSet();
public Resource(String name, LoadPlanable loadPlanable) {
this.name = name;
- this.loadPlanable = loadPlanable;
+ // this.loadPlanable = loadPlanable;
}
@Override
@@ -78,13 +78,17 @@ public class Resource implements Subject, LoadPlanable {
this.draw = draw;
}
- public int getLoadAt(Instant instant) {
- if (this.closed.contains(instant)) {
- return 0;
- }
- return loadPlanable.getLoadAt(instant);
+ public boolean isClosedAt(Instant instant) {
+ return this.closed.contains(instant);
}
+// public int getLoadAt(Instant instant) {
+// if (this.closed.contains(instant)) {
+// return 0;
+// }
+// return loadPlanable.getLoadAt(instant);
+// }
+
public void addCloseDay(Instant instant) {
this.closed.add(instant);
}
diff --git a/src/net/sourceforge/plantuml/project3/Resources.java b/src/net/sourceforge/plantuml/project3/Resources.java
index 727460b81..d1159e667 100644
--- a/src/net/sourceforge/plantuml/project3/Resources.java
+++ b/src/net/sourceforge/plantuml/project3/Resources.java
@@ -38,16 +38,16 @@ package net.sourceforge.plantuml.project3;
import java.util.LinkedHashSet;
import java.util.Set;
-public class Resources implements LoadPlanable {
+public class Resources /*implements LoadPlanable*/ {
private final Set all = new LinkedHashSet();
- public int getLoadAt(Instant instant) {
- int result = 0;
- for (Resource res : all) {
- result += res.getLoadAt(instant);
- }
- return result;
- }
+// public int getLoadAt(Instant instant) {
+// int result = 0;
+// for (Resource res : all) {
+// result += res.getLoadAt(instant);
+// }
+// return result;
+// }
}
diff --git a/src/net/sourceforge/plantuml/project/Constant.java b/src/net/sourceforge/plantuml/project3/SubjectToday.java
similarity index 64%
rename from src/net/sourceforge/plantuml/project/Constant.java
rename to src/net/sourceforge/plantuml/project3/SubjectToday.java
index c0301a6f9..595414566 100644
--- a/src/net/sourceforge/plantuml/project/Constant.java
+++ b/src/net/sourceforge/plantuml/project3/SubjectToday.java
@@ -33,26 +33,29 @@
*
*
*/
-package net.sourceforge.plantuml.project;
+package net.sourceforge.plantuml.project3;
-class Constant implements Expression {
+import java.util.Arrays;
+import java.util.Collection;
- private final Numeric value;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
- public Constant(Numeric value) {
- this.value = value;
+public class SubjectToday implements SubjectPattern {
+
+ public Collection getVerbs() {
+ return Arrays. asList(new VerbIsColoredForToday(), new VerbIsForToday());
}
- public String getDescription() {
- return "Constant:" + value;
+ public IRegex toRegex() {
+ return new RegexConcat( //
+ new RegexLeaf("today") //
+ );
}
- public NumericType getNumericType() {
- return value.getNumericType();
+ public Subject getSubject(GanttDiagram project, RegexResult arg) {
+ return new Today();
}
-
- public Numeric getValue() {
- return value;
- }
-
}
diff --git a/src/net/sourceforge/plantuml/project3/Task.java b/src/net/sourceforge/plantuml/project3/Task.java
index ee53a667c..2731c221e 100644
--- a/src/net/sourceforge/plantuml/project3/Task.java
+++ b/src/net/sourceforge/plantuml/project3/Task.java
@@ -57,6 +57,6 @@ public interface Task extends Subject, Moment {
public void setColors(ComplementColors colors);
- public void addResource(Resource resource);
+ public void addResource(Resource resource, int percentage);
}
diff --git a/src/net/sourceforge/plantuml/project3/TaskCode.java b/src/net/sourceforge/plantuml/project3/TaskCode.java
index ed4ce0321..e6466abc0 100644
--- a/src/net/sourceforge/plantuml/project3/TaskCode.java
+++ b/src/net/sourceforge/plantuml/project3/TaskCode.java
@@ -35,58 +35,32 @@
*/
package net.sourceforge.plantuml.project3;
-import java.util.Arrays;
-import java.util.List;
-
-import net.sourceforge.plantuml.cucadiagram.Display;
-
public class TaskCode {
- private final List hierarchy;
+ private final String code;
public TaskCode(String code) {
- this.hierarchy = Arrays.asList(code.split("/"));
- }
-
- public boolean startsWith(TaskCode other) {
- if (other.hierarchy.size() > this.hierarchy.size()) {
- return false;
- }
- assert other.hierarchy.size() <= this.hierarchy.size();
- final List sub = this.hierarchy.subList(0, other.hierarchy.size());
- return sub.equals(other.hierarchy);
- }
-
- private TaskCode(List hierarchy) {
- this.hierarchy = hierarchy;
- }
-
- public TaskCode truncateHierarchy(int size) {
- return new TaskCode(this.hierarchy.subList(0, size));
+ this.code = code;
}
@Override
public int hashCode() {
- return hierarchy.hashCode();
+ return code.hashCode();
}
@Override
public boolean equals(Object arg) {
final TaskCode other = (TaskCode) arg;
- return this.hierarchy.equals(other.hierarchy);
+ return this.code.equals(other.code);
}
@Override
public String toString() {
- return hierarchy.toString();
+ return code.toString();
}
public String getSimpleDisplay() {
- return hierarchy.get(hierarchy.size() - 1);
- }
-
- public int getHierarchySize() {
- return hierarchy.size();
+ return code;
}
}
diff --git a/src/net/sourceforge/plantuml/project3/TaskCodeSimpleOrder.java b/src/net/sourceforge/plantuml/project3/TaskCodeSimpleOrder.java
deleted file mode 100644
index 1e1ad45cd..000000000
--- a/src/net/sourceforge/plantuml/project3/TaskCodeSimpleOrder.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- *
- */
-package net.sourceforge.plantuml.project3;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.List;
-
-public class TaskCodeSimpleOrder implements Comparator {
-
- private final List order;
- private final int hierarchySize;
-
- public TaskCodeSimpleOrder(Collection order, int hierarchySize) {
- this.order = new ArrayList(order);
- this.hierarchySize = hierarchySize;
- for (TaskCode code : order) {
- if (code.getHierarchySize() != hierarchySize) {
- throw new IllegalArgumentException();
- }
- }
- }
-
- public int compare(TaskCode code1, TaskCode code2) {
- if (code1.getHierarchySize() < hierarchySize) {
- throw new IllegalArgumentException();
- }
- if (code2.getHierarchySize() < hierarchySize) {
- throw new IllegalArgumentException();
- }
- code1 = code1.truncateHierarchy(hierarchySize);
- code2 = code2.truncateHierarchy(hierarchySize);
- final int idx1 = order.indexOf(code1);
- final int idx2 = order.indexOf(code2);
- return idx1 - idx2;
- }
-}
diff --git a/src/net/sourceforge/plantuml/project3/TaskDrawRegular.java b/src/net/sourceforge/plantuml/project3/TaskDrawRegular.java
index f7ceedbc8..954eccc06 100644
--- a/src/net/sourceforge/plantuml/project3/TaskDrawRegular.java
+++ b/src/net/sourceforge/plantuml/project3/TaskDrawRegular.java
@@ -40,6 +40,8 @@ import net.sourceforge.plantuml.SpriteContainerEmpty;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorSetSimple;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
@@ -53,6 +55,8 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
public class TaskDrawRegular implements TaskDraw {
+ // private static final HtmlColor defaultColor = HtmlColorUtils.COL_84BE84;
+ private static final HtmlColor defaultColor = new HtmlColorSetSimple().getColorIfValid("GreenYellow");
private final TaskImpl task;
private final TimeScale timeScale;
private final double y;
@@ -87,22 +91,23 @@ public class TaskDrawRegular implements TaskDraw {
ug2.draw(shapeFull);
} else {
final double fullHeight = ((URectangle) shapeFull).getHeight();
- ug2.apply(new UChangeBackColor(HtmlColorUtils.WHITE)).apply(new UChangeColor(HtmlColorUtils.WHITE))
- .draw(shapeFull);
- drawInside(ug1, fullHeight);
- ug2.apply(new UChangeBackColor(null)).draw(shapeFull);
+ // ug2.apply(new UChangeBackColor(HtmlColorUtils.WHITE)).apply(new UChangeColor(HtmlColorUtils.WHITE))
+ // .draw(shapeFull);
+ // drawInside(ug1, fullHeight);
+ // ug2.apply(new UChangeBackColor(null)).draw(shapeFull);
+ ug2.draw(shapeFull);
}
}
- private void drawInside(UGraphic ug, double fullHeight) {
- for (Instant i = task.getStart(); i.compareTo(task.getEnd()) <= 0; i = i.increment()) {
- final int load = task.getLoadAt(i);
- final URectangle shapeLoad = getShapeInside(load, i);
- final double diffHeight = fullHeight - shapeLoad.getHeight();
- final double start = timeScale.getStartingPosition(i);
- ug.apply(new UChangeColor(null)).apply(new UTranslate(start, diffHeight + margin)).draw(shapeLoad);
- }
- }
+ // private void drawInside(UGraphic ug, double fullHeight) {
+ // for (Instant i = task.getStart(); i.compareTo(task.getEnd()) <= 0; i = i.increment()) {
+ // // final int load = task.getLoadAt(i);
+ // final URectangle shapeLoad = getShapeInside(i);
+ // final double diffHeight = fullHeight - shapeLoad.getHeight();
+ // final double start = timeScale.getStartingPosition(i);
+ // ug.apply(new UChangeColor(null)).apply(new UTranslate(start, diffHeight + margin)).draw(shapeLoad);
+ // }
+ // }
private UGraphic applyColors(UGraphic ug) {
if (colors != null && colors.isOk()) {
@@ -111,16 +116,26 @@ public class TaskDrawRegular implements TaskDraw {
if (isDiamond()) {
return ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(HtmlColorUtils.BLACK));
}
- return ug.apply(new UChangeColor(HtmlColorUtils.BLUE)).apply(new UChangeBackColor(HtmlColorUtils.COL_84BE84));
+ return ug.apply(new UChangeColor(HtmlColorUtils.BLUE)).apply(new UChangeBackColor(defaultColor));
}
- private URectangle getShapeInside(int load, Instant instant) {
+ private URectangle getShapeInside(Instant instant) {
final double start = timeScale.getStartingPosition(instant);
final double end = timeScale.getEndingPosition(instant);
- final double height = (getHeight() - 2 * margin) * load / 100.0;
+ final double height = getHeight() - 2 * margin;
return new URectangle(end - start, height);
}
+ // private URectangle getShapeInside(int load, Instant instant) {
+ // final double start = timeScale.getStartingPosition(instant);
+ // final double end = timeScale.getEndingPosition(instant);
+ // if (load > 100) {
+ // load = 100;
+ // }
+ // final double height = (getHeight() - 2 * margin) * load / 100.0;
+ // return new URectangle(end - start, height);
+ // }
+
private UShape getShape(int load) {
if (isDiamond()) {
return getDiamond();
diff --git a/src/net/sourceforge/plantuml/project3/TaskImpl.java b/src/net/sourceforge/plantuml/project3/TaskImpl.java
index 81d3e8b89..7b91a1a0c 100644
--- a/src/net/sourceforge/plantuml/project3/TaskImpl.java
+++ b/src/net/sourceforge/plantuml/project3/TaskImpl.java
@@ -36,14 +36,14 @@
package net.sourceforge.plantuml.project3;
import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
+import java.util.LinkedHashMap;
+import java.util.Map;
public class TaskImpl implements Task, LoadPlanable {
private final TaskCode code;
private final Solver3 solver;
- private final Set resources = new LinkedHashSet();
+ private final Map resources2 = new LinkedHashMap();
private final LoadPlanable defaultPlan;
public TaskImpl(TaskCode code, LoadPlanable defaultPlan) {
@@ -55,39 +55,46 @@ public class TaskImpl implements Task, LoadPlanable {
}
public int getLoadAt(Instant instant) {
- LoadPlanable plan1 = defaultPlan;
- if (resources.size() > 0) {
- plan1 = PlanUtils.minOf(plan1, getRessourcePlan());
+ LoadPlanable result = defaultPlan;
+ if (resources2.size() > 0) {
+ result = PlanUtils.multiply(defaultPlan, getRessourcePlan());
}
- return PlanUtils.minOf(getLoad(), plan1).getLoadAt(instant);
+ return result.getLoadAt(instant);
+ // return PlanUtils.minOf(getLoad(), plan1).getLoadAt(instant);
}
- public int loadForResource(Resource res, Instant i) {
- if (resources.contains(res) && i.compareTo(getStart()) >= 0 && i.compareTo(getEnd()) <= 0) {
- if (res.getLoadAt(i) == 0) {
+ public int loadForResource(Resource res, Instant instant) {
+ if (resources2.keySet().contains(res) && instant.compareTo(getStart()) >= 0 && instant.compareTo(getEnd()) <= 0) {
+ if (res.isClosedAt(instant)) {
return 0;
}
- int size = 0;
- for (Resource r : resources) {
- if (r.getLoadAt(i) > 0) {
- size++;
- }
- }
- return getLoadAt(i) / size;
+ // int size = 0;
+ return resources2.get(res);
+ // for (Resource r : resources) {
+ // if (r.getLoadAt(i) > 0) {
+ // size++;
+ // }
+ // }
+ // return getLoadAt(instant) / size;
}
return 0;
}
private LoadPlanable getRessourcePlan() {
- if (resources.size() == 0) {
+ if (resources2.size() == 0) {
throw new IllegalStateException();
}
return new LoadPlanable() {
public int getLoadAt(Instant instant) {
int result = 0;
- for (Resource res : resources) {
- result += res.getLoadAt(instant);
+ for (Map.Entry ent : resources2.entrySet()) {
+ final Resource res = ent.getKey();
+ if (res.isClosedAt(instant)) {
+ continue;
+ }
+ final int percentage = ent.getValue();
+ result += percentage;
}
return result;
}
@@ -95,12 +102,17 @@ public class TaskImpl implements Task, LoadPlanable {
}
public String getPrettyDisplay() {
- if (resources.size() > 0) {
+ if (resources2.size() > 0) {
final StringBuilder result = new StringBuilder(code.getSimpleDisplay());
result.append(" ");
- for (Iterator it = resources.iterator(); it.hasNext();) {
+ for (Iterator> it = resources2.entrySet().iterator(); it.hasNext();) {
+ final Map.Entry ent = it.next();
result.append("{");
- result.append(it.next().getName());
+ result.append(ent.getKey().getName());
+ final int percentage = ent.getValue();
+ if (percentage != 100) {
+ result.append(":" + percentage + "%");
+ }
result.append("}");
if (it.hasNext()) {
result.append(" ");
@@ -168,8 +180,8 @@ public class TaskImpl implements Task, LoadPlanable {
this.colors = colors;
}
- public void addResource(Resource resource) {
- this.resources.add(resource);
+ public void addResource(Resource resource, int percentage) {
+ this.resources2.put(resource, percentage);
}
}
diff --git a/src/net/sourceforge/plantuml/project3/TaskSeparator.java b/src/net/sourceforge/plantuml/project3/TaskSeparator.java
index 868ed5a3d..e8a9b5f94 100644
--- a/src/net/sourceforge/plantuml/project3/TaskSeparator.java
+++ b/src/net/sourceforge/plantuml/project3/TaskSeparator.java
@@ -84,7 +84,7 @@ public class TaskSeparator implements Task {
return comment;
}
- public void addResource(Resource resource) {
+ public void addResource(Resource resource, int percentage) {
throw new UnsupportedOperationException();
}
diff --git a/src/net/sourceforge/plantuml/project/Formal.java b/src/net/sourceforge/plantuml/project3/Today.java
similarity index 93%
rename from src/net/sourceforge/plantuml/project/Formal.java
rename to src/net/sourceforge/plantuml/project3/Today.java
index b75b670cd..9a15b24b8 100644
--- a/src/net/sourceforge/plantuml/project/Formal.java
+++ b/src/net/sourceforge/plantuml/project3/Today.java
@@ -33,8 +33,8 @@
*
*
*/
-package net.sourceforge.plantuml.project;
+package net.sourceforge.plantuml.project3;
-interface Formal extends Expression {
+public class Today implements Subject {
}
diff --git a/src/net/sourceforge/plantuml/project/command/CommandCloseWeekDay.java b/src/net/sourceforge/plantuml/project3/VerbIsColoredForToday.java
similarity index 59%
rename from src/net/sourceforge/plantuml/project/command/CommandCloseWeekDay.java
rename to src/net/sourceforge/plantuml/project3/VerbIsColoredForToday.java
index 12615e9fc..fa9d5b39d 100644
--- a/src/net/sourceforge/plantuml/project/command/CommandCloseWeekDay.java
+++ b/src/net/sourceforge/plantuml/project3/VerbIsColoredForToday.java
@@ -33,26 +33,35 @@
*
*
*/
-package net.sourceforge.plantuml.project.command;
+package net.sourceforge.plantuml.project3;
-import java.util.List;
+import java.util.Arrays;
+import java.util.Collection;
-import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.command.CommandExecutionResult;
-import net.sourceforge.plantuml.command.SingleLineCommand;
-import net.sourceforge.plantuml.project.PSystemProject;
-import net.sourceforge.plantuml.project.WeekDay;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandCloseWeekDay extends SingleLineCommand {
+public class VerbIsColoredForToday implements VerbPattern {
- public CommandCloseWeekDay() {
- super("(?i)^\\s*close\\s+(\\w{3,}day)\\s*$");
+ public Collection getComplements() {
+ return Arrays. asList(new ComplementInColors());
}
- @Override
- protected CommandExecutionResult executeArg(PSystemProject diagram, List arg) {
- final WeekDay weekDay = WeekDay.valueOf(StringUtils.goUpperCase(arg.get(0).substring(0, 3)));
- diagram.getProject().closeWeekDay(weekDay);
- return CommandExecutionResult.ok();
+ public IRegex toRegex() {
+ return new RegexLeaf("is[%s]+colou?red");
+ }
+
+ public Verb getVerb(final GanttDiagram project, RegexResult arg) {
+ return new Verb() {
+ public CommandExecutionResult execute(Subject subject, Complement complement) {
+ final Today task = (Today) subject;
+ final ComplementColors colors = (ComplementColors) complement;
+ project.setTodayColors(colors);
+ return CommandExecutionResult.ok();
+ }
+
+ };
}
}
diff --git a/src/net/sourceforge/plantuml/project/command/CommandAffectation.java b/src/net/sourceforge/plantuml/project3/VerbIsForToday.java
similarity index 61%
rename from src/net/sourceforge/plantuml/project/command/CommandAffectation.java
rename to src/net/sourceforge/plantuml/project3/VerbIsForToday.java
index b77821158..61aa0d559 100644
--- a/src/net/sourceforge/plantuml/project/command/CommandAffectation.java
+++ b/src/net/sourceforge/plantuml/project3/VerbIsForToday.java
@@ -33,29 +33,33 @@
*
*
*/
-package net.sourceforge.plantuml.project.command;
+package net.sourceforge.plantuml.project3;
-import java.util.List;
+import java.util.Arrays;
+import java.util.Collection;
-import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.command.CommandExecutionResult;
-import net.sourceforge.plantuml.command.SingleLineCommand;
-import net.sourceforge.plantuml.project.Expression;
-import net.sourceforge.plantuml.project.PSystemProject;
+import net.sourceforge.plantuml.command.regex.IRegex;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
-public class CommandAffectation extends SingleLineCommand {
+public class VerbIsForToday implements VerbPattern {
- public CommandAffectation() {
- super("(?i)^\\s*([~\\^]?[\\w$/]+)\\s*:=\\s*(.+)$");
+ public Collection getComplements() {
+ return Arrays. asList(new ComplementInColors(), new ComplementDate());
}
- @Override
- protected CommandExecutionResult executeArg(PSystemProject diagram, List arg) {
- final Expression exp = diagram.getProject().getExpression(StringUtils.trin(arg.get(1)));
- final boolean ok = diagram.getProject().affectation(StringUtils.trin(arg.get(0)), exp);
- if (ok) {
- return CommandExecutionResult.ok();
- }
- return CommandExecutionResult.error("Cannot execute");
+ public IRegex toRegex() {
+ return new RegexLeaf("is");
+ }
+
+ public Verb getVerb(final GanttDiagram project, RegexResult arg) {
+ return new Verb() {
+ public CommandExecutionResult execute(Subject subject, Complement complement) {
+ final Today task = (Today) subject;
+ final DayAsDate date = (DayAsDate) complement;
+ return project.setToday(date);
+ }
+ };
}
}
diff --git a/src/net/sourceforge/plantuml/salt/PSystemSalt.java b/src/net/sourceforge/plantuml/salt/PSystemSalt.java
index 56e6a690f..5e1950318 100644
--- a/src/net/sourceforge/plantuml/salt/PSystemSalt.java
+++ b/src/net/sourceforge/plantuml/salt/PSystemSalt.java
@@ -154,7 +154,7 @@ public class PSystemSalt extends AbstractPSystem implements WithSprite {
} else if (s.startsWith("skinparam ")) {
// System.err.println("skipping " + s);
} else if (s.startsWith("scale ")) {
- final Double scale = Double.parseDouble(s.substring("scale ".length()));
+ final double scale = Double.parseDouble(s.substring("scale ".length()));
this.setScale(new ScaleSimple(scale));
// System.err.println("skipping " + s);
} else if (s.startsWith("sprite $")) {
diff --git a/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java b/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java
index 2503da4a4..6134f255c 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java
@@ -201,4 +201,18 @@ public abstract class AbstractMessage implements EventWithDeactivate {
public double getPosYendLevel() {
return posYendLevel;
}
+
+ private String anchor;
+
+ public void setAnchor(String anchor) {
+ this.anchor = anchor;
+ if (anchor != null && anchor.startsWith("{")) {
+ throw new IllegalArgumentException(anchor);
+ }
+ }
+
+ public String getAnchor() {
+ return anchor;
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/project/Ressource.java b/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java
similarity index 68%
rename from src/net/sourceforge/plantuml/project/Ressource.java
rename to src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java
index ddf848cd2..363dcba65 100644
--- a/src/net/sourceforge/plantuml/project/Ressource.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java
@@ -33,28 +33,35 @@
*
*
*/
-package net.sourceforge.plantuml.project;
+package net.sourceforge.plantuml.sequencediagram;
-public class Ressource {
+public class LinkAnchor {
- private final String code;
+ private final String anchor1;
+ private final String anchor2;
+ private final String message;
- private int capacity = 1;
-
- public Ressource(String code) {
- this.code = code;
+ public LinkAnchor(String anchor1, String anchor2, String message) {
+ this.anchor1 = anchor1;
+ this.anchor2 = anchor2;
+ this.message = message;
}
- public DayClose getDayClose() {
- return new DayCloseNone();
+ @Override
+ public String toString() {
+ return anchor1 + "<->" + anchor2 + " " + message;
}
- public final int getCapacity() {
- return capacity;
+ public final String getAnchor1() {
+ return anchor1;
}
- public final void setCapacity(int capacity) {
- this.capacity = capacity;
+ public final String getAnchor2() {
+ return anchor2;
+ }
+
+ public final String getMessage() {
+ return message;
}
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java
index 163c93f4a..6045ecef8 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java
@@ -55,6 +55,7 @@ import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.Scale;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.cucadiagram.Display;
@@ -525,4 +526,15 @@ public class SequenceDiagram extends UmlDiagram {
public Display manageVariable(Display labels) {
return labels.replace("%autonumber%", autoNumber.getCurrentMessageNumber(false));
}
+
+ private final List linkAnchors = new ArrayList();
+
+ public CommandExecutionResult linkAnchor(String anchor1, String anchor2, String message) {
+ this.linkAnchors.add(new LinkAnchor(anchor1, anchor2, message));
+ return CommandExecutionResult.ok();
+ }
+
+ public List getLinkAnchors() {
+ return Collections.unmodifiableList(linkAnchors);
+ }
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java
index e3f556d93..71675356c 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java
@@ -64,6 +64,7 @@ import net.sourceforge.plantuml.sequencediagram.command.CommandFootboxOld;
import net.sourceforge.plantuml.sequencediagram.command.CommandGrouping;
import net.sourceforge.plantuml.sequencediagram.command.CommandHSpace;
import net.sourceforge.plantuml.sequencediagram.command.CommandIgnoreNewpage;
+import net.sourceforge.plantuml.sequencediagram.command.CommandLinkAnchor;
import net.sourceforge.plantuml.sequencediagram.command.CommandNewpage;
import net.sourceforge.plantuml.sequencediagram.command.CommandParticipantA;
import net.sourceforge.plantuml.sequencediagram.command.CommandParticipantA2;
@@ -138,6 +139,7 @@ public class SequenceDiagramFactory extends UmlDiagramFactory {
cmds.add(new CommandDelay());
cmds.add(new CommandFootboxOld());
cmds.add(new CommandUrl());
+ cmds.add(new CommandLinkAnchor());
return cmds;
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java
index bedcde117..b3c912438 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java
@@ -76,6 +76,7 @@ public class CommandArrow extends SingleLineCommand2 {
return new RegexConcat(
new RegexLeaf("^"), //
new RegexLeaf("PARALLEL", "(&%s*)?"), //
+ new RegexLeaf("ANCHOR", "(\\{([\\p{L}0-9_]+)\\}[%s]+)?"), //
new RegexOr("PART1", //
new RegexLeaf("PART1CODE", "([\\p{L}0-9_.@]+)"), //
new RegexLeaf("PART1LONG", "[%g]([^%g]+)[%g]"), //
@@ -234,6 +235,8 @@ public class CommandArrow extends SingleLineCommand2 {
if (parallel) {
msg.goParallel();
}
+ final String anchor = arg.get("ANCHOR", 1);
+ msg.setAnchor(anchor);
final String error = diagram.addMessage(msg);
if (error != null) {
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java
index 6de6ea597..801de04ce 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java
@@ -35,27 +35,43 @@
*/
package net.sourceforge.plantuml.sequencediagram.command;
-import java.util.List;
-
import net.sourceforge.plantuml.command.CommandExecutionResult;
-import net.sourceforge.plantuml.command.SingleLineCommand;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
+import net.sourceforge.plantuml.command.regex.RegexOr;
+import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
-public class CommandBoxStart extends SingleLineCommand {
+public class CommandBoxStart extends SingleLineCommand2 {
public CommandBoxStart() {
- super("(?i)^box(?:[%s]+[%g]([^%g]+)[%g])?(?:[%s]+(#\\w+))?$");
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("box"), //
+ new RegexOptional(new RegexOr( //
+ new RegexLeaf("NAME1", "[%s]+[%g]([^%g]+)[%g]"), //
+ new RegexLeaf("NAME2", "[%s]+([^#]+)"))), //
+ new RegexLeaf("[%s]*"), //
+ new RegexLeaf("COLOR", "(#\\w+)?"), //
+ new RegexLeaf("$"));
}
@Override
- protected CommandExecutionResult executeArg(SequenceDiagram diagram, List arg) {
+ protected CommandExecutionResult executeArg(SequenceDiagram diagram, RegexResult arg2) {
if (diagram.isBoxPending()) {
return CommandExecutionResult.error("Box cannot be nested");
}
- final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get(1));
- final String title = arg.get(0) == null ? "" : arg.get(0);
+ final String argTitle = arg2.getLazzy("NAME", 0);
+ final String argColor = arg2.get("COLOR", 0);
+ final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(argColor);
+ final String title = argTitle == null ? "" : argTitle;
diagram.boxStart(Display.getWithNewlines(title), color);
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/project/Duration.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandLinkAnchor.java
similarity index 50%
rename from src/net/sourceforge/plantuml/project/Duration.java
rename to src/net/sourceforge/plantuml/sequencediagram/command/CommandLinkAnchor.java
index 05e32f088..df520172f 100644
--- a/src/net/sourceforge/plantuml/project/Duration.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandLinkAnchor.java
@@ -33,50 +33,38 @@
*
*
*/
-package net.sourceforge.plantuml.project;
+package net.sourceforge.plantuml.sequencediagram.command;
-class Duration implements Numeric {
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
- private final long minutes;
+public class CommandLinkAnchor extends SingleLineCommand2 {
- public Duration(long minutes) {
- this.minutes = minutes;
+ public CommandLinkAnchor() {
+ super(getRegexConcat());
}
- public Duration(NumericNumber value) {
- this(value.getIntValue() * 24L * 60 * 60);
- }
-
- public Numeric add(Numeric other) {
- return new Duration(((Duration) other).minutes + minutes);
- }
-
- public static Duration of(long days) {
- return new Duration(days * 24 * 60 * 60);
- }
-
- public NumericType getNumericType() {
- return NumericType.DURATION;
- }
-
- public long getMinutes() {
- return minutes;
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("ANCHOR1", "\\{([\\p{L}0-9_]+)\\}"), //
+ new RegexLeaf("[%s]*"), //
+ new RegexLeaf("LINK", "\\<-\\>"), //
+ new RegexLeaf("[%s]*"), //
+ new RegexLeaf("ANCHOR2", "\\{([\\p{L}0-9_]+)\\}"), //
+ new RegexLeaf("[%s]*"), //
+ new RegexLeaf("MESSAGE", "(?::[%s]*(.*))?$"));
}
@Override
- public String toString() {
- return "DURATION:" + minutes / (24 * 60 * 60);
- }
-
- public int compareTo(Numeric other) {
- final Duration this2 = (Duration) other;
- if (this2.minutes > minutes) {
- return -1;
- }
- if (this2.minutes < minutes) {
- return 1;
- }
- return 0;
+ protected CommandExecutionResult executeArg(SequenceDiagram diagram, RegexResult arg) {
+ final String anchor1 = arg.get("ANCHOR1", 0);
+ final String anchor2 = arg.get("ANCHOR2", 0);
+ final String message = arg.get("MESSAGE", 0);
+ return diagram.linkAnchor(anchor1, anchor2, message);
}
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java
index 6ce2875fd..4f65a79dd 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java
@@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.real.Real;
@@ -51,6 +52,8 @@ import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@@ -164,10 +167,20 @@ public class CommunicationTile implements TileWithUpdateStairs, TileWithCallback
}
}
comp.drawU(ug, area, (Context2D) ug);
+
+ if (message.getAnchor() != null) {
+ drawAnchor(ug);
+ }
// ug.draw(new ULine(x2 - x1, 0));
}
+ private void drawAnchor(UGraphic ug) {
+ ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
+ ug.draw(new UEllipse(10, 10));
+
+ }
+
public double getPreferredHeight(StringBounder stringBounder) {
final Component comp = getComponent(stringBounder);
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/MainTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/MainTile.java
index 55310c190..c6975cde4 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/MainTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/MainTile.java
@@ -42,6 +42,7 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.real.Real;
import net.sourceforge.plantuml.real.RealUtils;
import net.sourceforge.plantuml.sequencediagram.Event;
+import net.sourceforge.plantuml.sequencediagram.LinkAnchor;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
import net.sourceforge.plantuml.ugraphic.LimitFinder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@@ -55,10 +56,12 @@ public class MainTile implements Tile, Bordered {
private final List tiles = new ArrayList();
private final LivingSpaces livingSpaces;
+ private final List linkAnchors;
public MainTile(SequenceDiagram diagram, Englobers englobers, TileArguments tileArguments) {
this.livingSpaces = tileArguments.getLivingSpaces();
+ this.linkAnchors = diagram.getLinkAnchors();
final List min2 = new ArrayList();
final List max2 = new ArrayList();
@@ -112,10 +115,26 @@ public class MainTile implements Tile, Bordered {
for (YPositionedTile tile : positionedTiles) {
tile.drawU(ug);
}
+ for (LinkAnchor linkAnchor : linkAnchors) {
+ System.err.println("linkAnchor=" + linkAnchor);
+ final YPositionedTile tile1 = getFromAnchor(positionedTiles, linkAnchor.getAnchor1());
+ final YPositionedTile tile2 = getFromAnchor(positionedTiles, linkAnchor.getAnchor2());
+ System.err.println("tile1=" + tile1);
+ System.err.println("tile2=" + tile2);
+ }
// System.err.println("MainTile::drawUInternal finalY=" + y);
return y;
}
+ private YPositionedTile getFromAnchor(List positionedTiles, String anchor) {
+ for (YPositionedTile tile : positionedTiles) {
+ if (tile.matchAnchor(anchor)) {
+ return tile;
+ }
+ }
+ return null;
+ }
+
public double getPreferredHeight(StringBounder stringBounder) {
final LimitFinder limitFinder = new LimitFinder(stringBounder, true);
final UGraphicInterceptorTile interceptor = new UGraphicInterceptorTile(limitFinder, false);
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java
index cab78221d..aa84d1b11 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java
@@ -36,6 +36,8 @@
package net.sourceforge.plantuml.sequencediagram.teoz;
import net.sourceforge.plantuml.graphic.UDrawable;
+import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
+import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@@ -57,4 +59,15 @@ public class YPositionedTile implements UDrawable {
ug.apply(new UTranslate(0, y)).draw(tile);
}
+ public boolean matchAnchor(String anchor) {
+ final Event event = tile.getEvent();
+ if (event instanceof AbstractMessage) {
+ final AbstractMessage msg = (AbstractMessage) event;
+ if (anchor.equals(msg.getAnchor())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java
index b283200b3..4c619591c 100644
--- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java
@@ -53,11 +53,10 @@ final public class ComponentRoseNoteHexagonal extends AbstractTextualComponent {
private final int cornersize = 10;
private final SymbolContext symbolContext;
-
public ComponentRoseNoteHexagonal(SymbolContext symbolContext, FontConfiguration font, Display strings,
ISkinSimple spriteContainer, HorizontalAlignment alignment) {
- super(LineBreakStrategy.NONE, strings, font, alignment, 12, 12, 4, spriteContainer, false, null, null);
+ super(spriteContainer.wrapWidth(), strings, font, alignment, 12, 12, 4, spriteContainer, false, null, null);
this.symbolContext = symbolContext;
}
diff --git a/src/net/sourceforge/plantuml/stats/HumanDuration.java b/src/net/sourceforge/plantuml/stats/HumanDuration.java
index 85ddc6da0..2e4927dfd 100644
--- a/src/net/sourceforge/plantuml/stats/HumanDuration.java
+++ b/src/net/sourceforge/plantuml/stats/HumanDuration.java
@@ -45,7 +45,9 @@ class HumanDuration {
@Override
public String toString() {
- long time = duration / 1000;
+ long time = duration;
+// final long ms = time % 1000L;
+ time = time / 1000;
final long sec = time % 60;
time = time / 60;
final long min = time % 60;
diff --git a/src/net/sourceforge/plantuml/stats/StatsUtilsIncrement.java b/src/net/sourceforge/plantuml/stats/StatsUtilsIncrement.java
index 5619c49ad..801c83ff8 100644
--- a/src/net/sourceforge/plantuml/stats/StatsUtilsIncrement.java
+++ b/src/net/sourceforge/plantuml/stats/StatsUtilsIncrement.java
@@ -45,13 +45,10 @@ import net.sourceforge.plantuml.PSystemError;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.directdot.PSystemDot;
-import net.sourceforge.plantuml.ditaa.PSystemDitaa;
import net.sourceforge.plantuml.eggs.PSystemWelcome;
-import net.sourceforge.plantuml.jcckit.PSystemJcckit;
import net.sourceforge.plantuml.math.PSystemMath;
import net.sourceforge.plantuml.salt.PSystemSalt;
import net.sourceforge.plantuml.stats.api.Stats;
-import net.sourceforge.plantuml.sudoku.PSystemSudoku;
public class StatsUtilsIncrement {
@@ -122,7 +119,7 @@ public class StatsUtilsIncrement {
if (type == PSystemSalt.class) {
return "Salt";
}
- if (type == PSystemSudoku.class) {
+ if (type.getSimpleName().equals("PSystemSudoku")) {
return "Sudoku";
}
if (type == PSystemDot.class) {
@@ -131,10 +128,10 @@ public class StatsUtilsIncrement {
if (type == PSystemWelcome.class) {
return "Welcome";
}
- if (type == PSystemDitaa.class) {
+ if (type.getSimpleName().equals("PSystemDitaa")) {
return "Ditaa";
}
- if (type == PSystemJcckit.class) {
+ if (type.getSimpleName().equals("PSystemJcckit")) {
return "Jcckit";
}
if (type == PSystemMath.class) {
diff --git a/src/net/sourceforge/plantuml/suggest/SuggestEngineResult.java b/src/net/sourceforge/plantuml/suggest/SuggestEngineResult.java
index 30ac3b990..3eec4a8d2 100644
--- a/src/net/sourceforge/plantuml/suggest/SuggestEngineResult.java
+++ b/src/net/sourceforge/plantuml/suggest/SuggestEngineResult.java
@@ -37,7 +37,6 @@ package net.sourceforge.plantuml.suggest;
import net.sourceforge.plantuml.StringUtils;
-
public class SuggestEngineResult {
private final SuggestEngineStatus status;
diff --git a/src/net/sourceforge/plantuml/svek/ClusterDecoration.java b/src/net/sourceforge/plantuml/svek/ClusterDecoration.java
index d85314c27..f58e10eb5 100644
--- a/src/net/sourceforge/plantuml/svek/ClusterDecoration.java
+++ b/src/net/sourceforge/plantuml/svek/ClusterDecoration.java
@@ -67,9 +67,6 @@ public class ClusterDecoration {
this.maxX = maxX;
this.maxY = maxY;
this.defaultStroke = stroke;
- // if (stateBack instanceof HtmlColorTransparent) {
- // throw new UnsupportedOperationException();
- // }
}
private static USymbol guess(USymbol symbol, PackageStyle style) {
@@ -96,138 +93,6 @@ public class ClusterDecoration {
.withCorner(roundCorner, 0);
symbol.asBig(title, titleAlignment, stereo, maxX - minX, maxY - minY, symbolContext).drawU(
ug.apply(new UTranslate(minX, minY)));
- // return;
- // }
- // if (style == PackageStyle.NODE) {
- // drawWithTitleNode(ug, biColor, shadowing);
- // } else if (style == PackageStyle.CARD) {
- // drawWithTitleCard(ug, biColor, shadowing);
- // } else if (style == PackageStyle.DATABASE) {
- // drawWithTitleDatabase(ug, biColor, shadowing);
- // } else if (style == PackageStyle.CLOUD) {
- // drawWithTitleCloud(ug, biColor, shadowing);
- // } else if (style == PackageStyle.FRAME) {
- // drawWithTitleFrame(ug, biColor, shadowing);
- // } else if (style == PackageStyle.RECT) {
- // drawWithTitleRect(ug, biColor, shadowing);
- // } else {
- // throw new UnsupportedOperationException();
- // // drawWithTitleFolder(ug, biColor, shadowing);
- // }
}
- // // Cloud
- // private void drawWithTitleCloud(UGraphic ug, SymbolContext biColor, boolean shadowing) {
- // final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
- // final double width = maxX - minX;
- // final double height = maxY - minY;
- // ug = biColor.applyColors(ug);
- // ug = ug.apply(defaultStroke);
- // PackageStyle.CLOUD.drawU(ug.apply(new UTranslate(minX, minY)), new Dimension2DDouble(width, height), dimTitle,
- // shadowing);
- // ug = ug.apply(new UStroke());
- // title.drawU(ug.apply(new UTranslate(minX + (width - dimTitle.getWidth()) / 2, minY + 10)));
- //
- // }
- //
- // // Database
- // private void drawWithTitleDatabase(UGraphic ug, SymbolContext biColor, boolean shadowing) {
- // final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
- // final double width = maxX - minX;
- // final double height = maxY - minY;
- // ug = ug.apply(defaultStroke);
- // ug = biColor.applyColors(ug);
- // PackageStyle.DATABASE.drawU(ug.apply(new UTranslate(minX, minY - 10)),
- // new Dimension2DDouble(width, height + 10), dimTitle, shadowing);
- // ug = ug.apply(new UStroke());
- // title.drawU(ug.apply(new UTranslate(minX + marginTitleX1, minY + 10)));
- //
- // }
- //
- // // Corner
- // private void drawWithTitleFrame(UGraphic ug, SymbolContext biColor, boolean shadowing) {
- // final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
- // final double width = maxX - minX;
- // final double height = maxY - minY;
- // ug = biColor.applyColors(ug);
- // ug = ug.apply(defaultStroke);
- // PackageStyle.FRAME.drawU(ug.apply(new UTranslate(minX, minY)), new Dimension2DDouble(width, height), dimTitle,
- // shadowing);
- // ug = ug.apply(new UStroke());
- // title.drawU(ug.apply(new UTranslate(minX + marginTitleX1, minY)));
- //
- // }
- //
- // // Card
- // private void drawWithTitleCard(UGraphic ug, SymbolContext biColor, boolean shadowing) {
- // final double width = maxX - minX;
- // final double height = maxY - minY;
- // final SymbolContext ctx = biColor.withStroke(defaultStroke).withShadow(shadowing);
- // USymbol.CARD.asBig(title, TextBlockUtils.empty(0, 0), width + 10, height, ctx).drawU(
- // ug.apply(new UTranslate(minX, minY)));
- // }
- //
- // // Node
- // private void drawWithTitleNode(UGraphic ug, SymbolContext biColor, boolean shadowing) {
- // final double width = maxX - minX;
- // final double height = maxY - minY;
- // final SymbolContext ctx = biColor.withStroke(defaultStroke).withShadow(shadowing);
- // USymbol.NODE.asBig(title, TextBlockUtils.empty(0, 0), width + 10, height, ctx).drawU(
- // ug.apply(new UTranslate(minX, minY)));
- // }
- //
- // // Folder
- // private UPolygon getSpecificFrontierForFolder(StringBounder stringBounder) {
- // final double width = maxX - minX;
- // final double height = maxY - minY;
- // final Dimension2D dimTitle = title.calculateDimension(stringBounder);
- // final double wtitle = dimTitle.getWidth() + marginTitleX1 + marginTitleX2;
- // final double htitle = dimTitle.getHeight() + marginTitleY1 + marginTitleY2;
- // final UPolygon shape = new UPolygon();
- // shape.addPoint(0, 0);
- // shape.addPoint(wtitle, 0);
- // shape.addPoint(wtitle + marginTitleX3, htitle);
- // shape.addPoint(width, htitle);
- // shape.addPoint(width, height);
- // shape.addPoint(0, height);
- // shape.addPoint(0, 0);
- // return shape;
- // }
- //
- // private void drawWithTitleFolder(UGraphic ug, SymbolContext biColor, boolean shadowing) {
- // final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
- // final double wtitle = dimTitle.getWidth() + marginTitleX1 + marginTitleX2;
- // final double htitle = dimTitle.getHeight() + marginTitleY1 + marginTitleY2;
- // final UPolygon shape = getSpecificFrontierForFolder(ug.getStringBounder());
- // if (shadowing) {
- // shape.setDeltaShadow(3.0);
- // }
- //
- // ug = biColor.applyColors(ug);
- // ug = ug.apply(defaultStroke);
- // ug.apply(new UTranslate(minX, minY)).draw(shape);
- // ug.apply(new UTranslate(minX, minY + htitle)).draw(new ULine(wtitle + marginTitleX3, 0));
- // ug = ug.apply(new UStroke());
- // title.drawU(ug.apply(new UTranslate(minX + marginTitleX1, minY + marginTitleY1)));
- // }
- //
- // // Rect
- // private void drawWithTitleRect(UGraphic ug, SymbolContext biColor, boolean shadowing) {
- // final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
- // final double width = maxX - minX;
- // final double height = maxY - minY;
- // final URectangle shape = new URectangle(width, height);
- // if (shadowing) {
- // shape.setDeltaShadow(3.0);
- // }
- //
- // ug = biColor.applyColors(ug);
- // ug = ug.apply(defaultStroke);
- //
- // ug.apply(new UTranslate(minX, minY)).draw(shape);
- // ug = ug.apply(new UStroke());
- // final double deltax = width - dimTitle.getWidth();
- // title.drawU(ug.apply(new UTranslate(minX + deltax / 2, minY + 5)));
- // }
-
}
diff --git a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java
index 5662549ca..6f8e69b2f 100644
--- a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java
+++ b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java
@@ -57,9 +57,11 @@ import net.sourceforge.plantuml.SkinParamSameClassWidth;
import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType;
+import net.sourceforge.plantuml.activitydiagram3.ftile.EntityImageLegend;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
import net.sourceforge.plantuml.cucadiagram.EntityPosition;
import net.sourceforge.plantuml.cucadiagram.GroupType;
@@ -417,8 +419,8 @@ public final class GeneralImageBuilder {
if (leaf.getLeafType() == LeafType.EMPTY_PACKAGE) {
if (leaf.getUSymbol() != null) {
// final HtmlColor black = HtmlColorUtils.BLACK;
- final HtmlColor black = SkinParamUtils.getColor(skinParam, leaf.getStereotype(),
- leaf.getUSymbol().getColorParamBorder());
+ final HtmlColor black = SkinParamUtils.getColor(skinParam, leaf.getStereotype(), leaf.getUSymbol()
+ .getColorParamBorder());
return new EntityImageDescription(leaf, new SkinParamForecolored(skinParam, black), portionShower,
links);
}
@@ -548,8 +550,23 @@ public final class GeneralImageBuilder {
return label.create(fontConfiguration, HorizontalAlignment.CENTER, skinParam);
}
+ private TextBlock addLegend(TextBlock original, DisplayPositionned legend) {
+ if (legend == null || legend.isNull()) {
+ return original;
+ }
+ final TextBlock text = EntityImageLegend.create(legend.getDisplay(), dotData.getSkinParam());
+
+ return DecorateEntityImage.add(original, text, legend.getHorizontalAlignment(), legend.getVerticalAlignment());
+ }
+
private TextBlock getStereoBlock(IGroup g) {
+ final DisplayPositionned legend = g.getLegend();
+ return addLegend(getStereoBlockWithoutLegend(g), legend);
+ }
+
+ private TextBlock getStereoBlockWithoutLegend(IGroup g) {
final Stereotype stereotype = g.getStereotype();
+ final DisplayPositionned legend = g.getLegend();
if (stereotype == null) {
return TextBlockUtils.empty(0, 0);
}
diff --git a/src/net/sourceforge/plantuml/svek/Line.java b/src/net/sourceforge/plantuml/svek/Line.java
index 8d47a15b7..bfe2a7799 100644
--- a/src/net/sourceforge/plantuml/svek/Line.java
+++ b/src/net/sourceforge/plantuml/svek/Line.java
@@ -701,7 +701,7 @@ public class Line implements Moveable, Hideable {
}
todraw.setComment(link.getEntity1().getCode().getFullName() + "-" + link.getEntity2().getCode().getFullName());
- drawRainbow(ug.apply(new UTranslate(x, y)), color, todraw, link.getSupplementaryColors());
+ drawRainbow(ug.apply(new UTranslate(x, y)), color, todraw, link.getSupplementaryColors(), stroke);
ug = ug.apply(new UStroke()).apply(new UChangeColor(color));
@@ -733,12 +733,12 @@ public class Line implements Moveable, Hideable {
}
}
- private void drawRainbow(UGraphic ug, HtmlColor color, DotPath todraw, List supplementaryColors) {
+ private void drawRainbow(UGraphic ug, HtmlColor color, DotPath todraw, List supplementaryColors, UStroke stroke) {
ug.draw(todraw);
final LinkType linkType = link.getType();
if (this.extremity2 != null) {
- UGraphic ug2 = ug.apply(new UStroke()).apply(new UChangeColor(color));
+ UGraphic ug2 = ug.apply(new UChangeColor(color)).apply(stroke.onlyThickness());
if (linkType.getDecor1().isFill()) {
ug2 = ug2.apply(new UChangeBackColor(color));
} else {
@@ -748,7 +748,7 @@ public class Line implements Moveable, Hideable {
this.extremity2.drawU(ug2);
}
if (this.extremity1 != null) {
- UGraphic ug2 = ug.apply(new UStroke()).apply(new UChangeColor(color));
+ UGraphic ug2 = ug.apply(new UChangeColor(color)).apply(stroke.onlyThickness());
if (linkType.getDecor2().isFill()) {
ug2 = ug2.apply(new UChangeBackColor(color));
} else {
diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleLine.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleLine.java
index 51e380975..7b8b8782a 100644
--- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleLine.java
+++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleLine.java
@@ -41,14 +41,13 @@ import java.awt.geom.Point2D;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
+import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
class ExtremityCircleLine extends Extremity {
private final Point2D contact;
private final double angle;
- private final double radius = 4;
- private final double lineHeight = 4;
@Override
public Point2D somePoint() {
@@ -61,11 +60,14 @@ class ExtremityCircleLine extends Extremity {
}
public void drawU(UGraphic ug) {
+ final double thickness = ug.getParam().getStroke().getThickness();
+ final double radius = 4 + thickness - 1;
+ final double lineHeight = 4 + thickness - 1;
final int xWing = 4;
final AffineTransform rotate = AffineTransform.getRotateInstance(this.angle);
Point2D middle = new Point2D.Double(0, 0);
- Point2D base = new Point2D.Double(-xWing-radius-3, 0);
- Point2D circleBase = new Point2D.Double(-xWing-radius-3, 0);
+ Point2D base = new Point2D.Double(-xWing - radius - 3, 0);
+ Point2D circleBase = new Point2D.Double(-xWing - radius - 3, 0);
Point2D lineTop = new Point2D.Double(-xWing, -lineHeight);
Point2D lineBottom = new Point2D.Double(-xWing, lineHeight);
@@ -76,8 +78,11 @@ class ExtremityCircleLine extends Extremity {
rotate.transform(circleBase, circleBase);
drawLine(ug, contact.getX(), contact.getY(), base, middle);
- ug.apply(new UTranslate(contact.getX()+circleBase.getX()-radius, contact.getY()+circleBase.getY()-radius)).draw(new UEllipse(2*radius, 2*radius));
- drawLine(ug, contact.getX(), contact.getY(), lineTop, lineBottom);
+ final UStroke stroke = new UStroke(thickness);
+ ug.apply(
+ new UTranslate(contact.getX() + circleBase.getX() - radius, contact.getY() + circleBase.getY() - radius))
+ .apply(stroke).draw(new UEllipse(2 * radius, 2 * radius));
+ drawLine(ug.apply(stroke), contact.getX(), contact.getY(), lineTop, lineBottom);
}
static private void drawLine(UGraphic ug, double x, double y, Point2D p1, Point2D p2) {
@@ -85,5 +90,5 @@ class ExtremityCircleLine extends Extremity {
final double dy = p2.getY() - p1.getY();
ug.apply(new UTranslate(x + p1.getX(), y + p1.getY())).draw(new ULine(dx, dy));
}
-
+
}
diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageBranch.java b/src/net/sourceforge/plantuml/svek/image/EntityImageBranch.java
index 900e7506e..895ac0171 100644
--- a/src/net/sourceforge/plantuml/svek/image/EntityImageBranch.java
+++ b/src/net/sourceforge/plantuml/svek/image/EntityImageBranch.java
@@ -42,6 +42,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
+import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ShapeType;
@@ -74,9 +75,11 @@ public class EntityImageBranch extends AbstractEntityImage {
diams.addPoint(0, SIZE);
diams.addPoint(SIZE, 0);
- ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityBorder)))
- .apply(new UChangeBackColor(SkinParamUtils.getColor(getSkinParam(), getStereo(),
- ColorParam.activityBackground))).apply(new UStroke(1.5)).draw(diams);
+ final HtmlColor border = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityDiamondBorder,
+ ColorParam.activityBorder);
+ final HtmlColor back = SkinParamUtils.getColor(getSkinParam(), getStereo(),
+ ColorParam.activityDiamondBackground, ColorParam.activityBackground);
+ ug.apply(new UChangeColor(border)).apply(new UChangeBackColor(back)).apply(new UStroke(1.5)).draw(diams);
}
public ShapeType getShapeType() {
diff --git a/src/net/sourceforge/plantuml/svg/SvgGraphics.java b/src/net/sourceforge/plantuml/svg/SvgGraphics.java
index b4a5f6450..38a0af761 100644
--- a/src/net/sourceforge/plantuml/svg/SvgGraphics.java
+++ b/src/net/sourceforge/plantuml/svg/SvgGraphics.java
@@ -408,6 +408,7 @@ public class SvgGraphics {
}
public void svgPolygon(double deltaShadow, double... points) {
+ assert points.length % 2 == 0;
manageShadow(deltaShadow);
if (hidden == false) {
final Element elt = (Element) document.createElement("polygon");
@@ -789,6 +790,7 @@ public class SvgGraphics {
}
private void addFilter(Element filter, String name, String... data) {
+ assert data.length % 2 == 0;
final Element elt = (Element) document.createElement(name);
for (int i = 0; i < data.length; i += 2) {
elt.setAttribute(data[i], data[i + 1]);
diff --git a/src/net/sourceforge/plantuml/tikz/TikzGraphics.java b/src/net/sourceforge/plantuml/tikz/TikzGraphics.java
index d86045a6e..874b8bdff 100644
--- a/src/net/sourceforge/plantuml/tikz/TikzGraphics.java
+++ b/src/net/sourceforge/plantuml/tikz/TikzGraphics.java
@@ -382,6 +382,7 @@ public class TikzGraphics {
public void polygon(double[] points) {
+ assert points.length % 2 == 0;
final StringBuilder sb = new StringBuilder();
appendShadeOrDraw(sb);
sb.append("line width=" + thickness + "pt]");
@@ -395,6 +396,7 @@ public class TikzGraphics {
}
private void round(double r, double[] points) {
+ assert points.length % 2 == 0;
final StringBuilder sb = new StringBuilder();
appendShadeOrDraw(sb);
sb.append("line width=" + thickness + "pt]");
diff --git a/src/net/sourceforge/plantuml/ugraphic/ShadowManager.java b/src/net/sourceforge/plantuml/ugraphic/ShadowManager.java
index db9657fd2..41475f305 100644
--- a/src/net/sourceforge/plantuml/ugraphic/ShadowManager.java
+++ b/src/net/sourceforge/plantuml/ugraphic/ShadowManager.java
@@ -50,6 +50,7 @@ public class ShadowManager {
}
public double[] getShadowDeltaPoints(double deltaShadow, double diff, double[] points) {
+ assert points.length % 2 == 0;
double cx = 0;
double cy = 0;
for (int i = 0; i < points.length; i += 2) {
diff --git a/src/net/sourceforge/plantuml/ugraphic/UImage.java b/src/net/sourceforge/plantuml/ugraphic/UImage.java
index bdf87a52e..a3cc2648b 100644
--- a/src/net/sourceforge/plantuml/ugraphic/UImage.java
+++ b/src/net/sourceforge/plantuml/ugraphic/UImage.java
@@ -97,37 +97,57 @@ public class UImage implements UShape {
if (newColor == null) {
return this;
}
- int darker = -1;
+ int darkerRgb = -1;
for (int i = 0; i < image.getWidth(); i++) {
for (int j = 0; j < image.getHeight(); j++) {
final int color = image.getRGB(i, j);
- if (isTransparent(color)) {
+ // System.err.println("i="+i+" j="+j+" "+Integer.toHexString(color)+" "+isTransparent(color));
+ final int rgb = getRgb(color);
+ final int a = getA(color);
+ if (a != mask_a__) {
continue;
}
- final int grey = ColorChangerMonochrome.getGrayScale(color);
- if (darker == -1 || grey < ColorChangerMonochrome.getGrayScale(darker)) {
- darker = color;
+ // if (isTransparent(color)) {
+ // continue;
+ // }
+ final int grey = ColorChangerMonochrome.getGrayScale(rgb);
+ if (darkerRgb == -1 || grey < ColorChangerMonochrome.getGrayScale(darkerRgb)) {
+ darkerRgb = rgb;
}
}
}
final BufferedImage copy = deepCopy(image);
for (int i = 0; i < image.getWidth(); i++) {
for (int j = 0; j < image.getHeight(); j++) {
- if (copy.getRGB(i, j) == darker) {
- copy.setRGB(i, j, newColor.getRGB());
+ final int color = copy.getRGB(i, j);
+ final int rgb = getRgb(color);
+ final int a = getA(color);
+ if (a!=0 && rgb == darkerRgb) {
+ copy.setRGB(i, j, newColor.getRGB() + a);
}
}
}
return new UImage(copy, formula);
}
- private boolean isTransparent(int color) {
- if (color == 0) {
- return true;
- }
- return false;
+ private static final int mask_a__ = 0xFF000000;
+ private static final int mask_rgb = 0x00FFFFFF;
+
+ private int getRgb(int color) {
+ return color & mask_rgb;
}
+ private int getA(int color) {
+ return color & mask_a__;
+ }
+
+ // private boolean isTransparent(int argb) {
+ // if ((argb & mask) == mask) {
+ // return false;
+ // }
+ // return true;
+ // }
+
// From https://stackoverflow.com/questions/3514158/how-do-you-clone-a-bufferedimage
private static BufferedImage deepCopy(BufferedImage bi) {
final ColorModel cm = bi.getColorModel();
diff --git a/src/net/sourceforge/plantuml/ugraphic/UMotif.java b/src/net/sourceforge/plantuml/ugraphic/UMotif.java
index b561f06ac..4c12a870c 100644
--- a/src/net/sourceforge/plantuml/ugraphic/UMotif.java
+++ b/src/net/sourceforge/plantuml/ugraphic/UMotif.java
@@ -48,6 +48,7 @@ public class UMotif {
private final List points = new ArrayList();
public UMotif(int... data) {
+ assert data.length % 2 == 0;
for (int i = 0; i < data.length; i += 2) {
points.add(new Point2D.Double(data[i], data[i + 1]));
}
diff --git a/src/net/sourceforge/plantuml/ugraphic/UStroke.java b/src/net/sourceforge/plantuml/ugraphic/UStroke.java
index b8bac0f06..043aa27d8 100644
--- a/src/net/sourceforge/plantuml/ugraphic/UStroke.java
+++ b/src/net/sourceforge/plantuml/ugraphic/UStroke.java
@@ -60,6 +60,10 @@ public class UStroke implements UChange {
this(1.0);
}
+ public UStroke onlyThickness() {
+ return new UStroke(thickness);
+ }
+
private UStroke applyThickness(UStroke thickness) {
if (thickness == null) {
return this;
diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverPolygonSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverPolygonSvg.java
index d55e79a8e..41d19b14b 100644
--- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverPolygonSvg.java
+++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverPolygonSvg.java
@@ -58,6 +58,7 @@ public class DriverPolygonSvg implements UDriver {
final UPolygon shape = (UPolygon) ushape;
final double points[] = shape.getPointArray(x, y);
+ assert points.length % 2 == 0;
final UClip clip = clipContainer.getClip();
if (clip != null) {
for (int j = 0; j < points.length; j += 2) {
diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java
index 530f2e6c1..2ee5d3aa4 100644
--- a/src/net/sourceforge/plantuml/version/Version.java
+++ b/src/net/sourceforge/plantuml/version/Version.java
@@ -43,7 +43,7 @@ public class Version {
private static final int MAJOR_SEPARATOR = 1000000;
public static int version() {
- return 1201900;
+ return 1201901;
}
public static int versionPatched() {
@@ -88,7 +88,7 @@ public class Version {
}
public static long compileTime() {
- return 1547394402485L;
+ return 1549726324013L;
}
public static String compileTimeString() {