diff options
Diffstat (limited to 'src/net/sourceforge/plantuml/api')
10 files changed, 0 insertions, 708 deletions
diff --git a/src/net/sourceforge/plantuml/api/CountRate.java b/src/net/sourceforge/plantuml/api/CountRate.java deleted file mode 100644 index 6f8264d..0000000 --- a/src/net/sourceforge/plantuml/api/CountRate.java +++ /dev/null @@ -1,82 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2017, 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.api; - -public final class CountRate { - - private final MagicArray lastMinute = new MagicArray(60); - private final MagicArray lastHour = new MagicArray(60); - private final MagicArray lastDay = new MagicArray(140); - - public void increment() { - final long now = System.currentTimeMillis(); - lastMinute.incKey(now / 1000L); - lastHour.incKey(now / (60 * 1000L)); - lastDay.incKey(now / (10 * 60 * 1000L)); - } - - public void increment(int value) { - final long now = System.currentTimeMillis(); - lastMinute.incKey(now / 1000L, value); - lastHour.incKey(now / (60 * 1000L), value); - lastDay.incKey(now / (10 * 60 * 1000L), value); - } - - public long perMinute() { - return lastMinute.getSum(); - } - - public long perHour() { - return lastHour.getSum(); - } - - public long perDay() { - return lastDay.getSum(); - } - - public long perMinuteMax() { - return lastMinute.getMaxSum(); - } - - public long perHourMax() { - return lastHour.getMaxSum(); - } - - public long perDayMax() { - return lastDay.getMaxSum(); - } - -} diff --git a/src/net/sourceforge/plantuml/api/MagicArray.java b/src/net/sourceforge/plantuml/api/MagicArray.java deleted file mode 100644 index 55c3292..0000000 --- a/src/net/sourceforge/plantuml/api/MagicArray.java +++ /dev/null @@ -1,98 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2017, 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.api; - -public final class MagicArray { - - private final int data[]; - private final int size; - private long lastUpdatedKey = -1; - private int lastUpdatedValue; - private long sum; - private long maxSum; - - public MagicArray(int size) { - this.data = new int[size]; - this.size = size; - } - - synchronized public void incKey(long key) { - incKey(key, 1); - } - - synchronized public void incKey(long key, int delta) { - if (key < lastUpdatedKey) { - return; - } - if (key != lastUpdatedKey) { - if (lastUpdatedKey != -1) { - setValue(lastUpdatedKey, lastUpdatedValue); - for (long i = lastUpdatedKey + 1; i < key; i++) { - setValue(i, 0); - } - } - lastUpdatedValue = 0; - lastUpdatedKey = key; - } - lastUpdatedValue += delta; - } - - private void setValue(long key, int value) { - final int i = (int) (key % size); - sum += value - data[i]; - if (sum > maxSum) { - maxSum = sum; - } - data[i] = value; - } - - synchronized public long getSum() { - return sum; - } - - synchronized public long getMaxSum() { - return maxSum; - } - - private long getSumSlow() { - long tmp = 0; - for (int d : data) { - tmp += d; - } - return tmp; - } - -} diff --git a/src/net/sourceforge/plantuml/api/NiceNumber.java b/src/net/sourceforge/plantuml/api/NiceNumber.java deleted file mode 100644 index dddccb8..0000000 --- a/src/net/sourceforge/plantuml/api/NiceNumber.java +++ /dev/null @@ -1,71 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2017, 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.api; - -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.util.Locale; - -public class NiceNumber { - - public static int getNicer(final int value) { - if (value <= 18) { - return value; - } - if (value < 93) { - return ((value + 2) / 5) * 5; - } - if (value < 100) { - return ((value + 5) / 10) * 10; - } - int m = 1; - double head = value; - while (head >= 100) { - head = head / 10.0; - m *= 10; - } - return getNicer((int) Math.round(head)) * m; - } - - public static String format(final long v) { - final DecimalFormat df = new DecimalFormat(); - df.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US)); - df.setGroupingSize(3); - df.setMaximumFractionDigits(0); - final String t = df.format(v).replace(',', ' '); - return t; - } -} diff --git a/src/net/sourceforge/plantuml/api/NumberAnalyzed2.java b/src/net/sourceforge/plantuml/api/NumberAnalyzed2.java deleted file mode 100644 index c275066..0000000 --- a/src/net/sourceforge/plantuml/api/NumberAnalyzed2.java +++ /dev/null @@ -1,184 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU General Public - * License aint with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - */ -package net.sourceforge.plantuml.api; - -import java.util.StringTokenizer; -import java.util.concurrent.atomic.AtomicLong; -import java.util.prefs.Preferences; - -import net.sourceforge.plantuml.Log; - -public class NumberAnalyzed2 implements INumberAnalyzed { - - private static final int SLIDING_WINDOW = 512; - - private final AtomicLong nb = new AtomicLong(); - private final AtomicLong sum = new AtomicLong(); - private final AtomicLong min = new AtomicLong(); - private final AtomicLong max = new AtomicLong(); - private final AtomicLong sumOfSquare = new AtomicLong(); - // See https://fossies.org/linux/haproxy/include/proto/freq_ctr.h - private final AtomicLong sliddingSum = new AtomicLong(); - private final String name; - - public NumberAnalyzed2(String name) { - this.name = name; - } - - public void reset() { - this.nb.set(0); - this.sum.set(0); - this.min.set(0); - this.max.set(0); - this.sumOfSquare.set(0); - this.sliddingSum.set(0); - } - - public NumberAnalyzed2() { - this(""); - } - - public final void save(Preferences prefs) { - if (name.length() == 0) { - throw new UnsupportedOperationException(); - } - prefs.put(name + ".saved", getSavedString()); - } - - protected String getSavedString() { - final String value = longToString(nb) + ";" + longToString(sum) + ";" + longToString(min) + ";" - + longToString(max) + ";" + longToString(sumOfSquare) + ";" + longToString(sliddingSum); - return value; - } - - protected final String longToString(AtomicLong val) { - return Long.toString(val.get(), 36); - } - - public static NumberAnalyzed2 load(String name, Preferences prefs) { - final String value = prefs.get(name + ".saved", ""); - if (value.length() == 0) { - System.err.println("Cannot load " + name); - return null; - } - try { - final StringTokenizer st = new StringTokenizer(value, ";"); - return new NumberAnalyzed2(name, Long.parseLong(st.nextToken(), 36), Long.parseLong(st.nextToken(), 36), - Long.parseLong(st.nextToken(), 36), Long.parseLong(st.nextToken(), 36), Long.parseLong( - st.nextToken(), 36), Long.parseLong(st.nextToken(), 36)); - } catch (Exception e) { - e.printStackTrace(); - Log.info("Error reading " + value); - return null; - } - } - - @Override - public String toString() { - return "sum=" + sum + " nb=" + nb + " min=" + min + " max=" + max + " mean=" + getMean(); - } - - protected NumberAnalyzed2(String name, long nb, long sum, long min, long max, long sumOfSquare, long sliddingSum) { - this(name); - this.nb.set(nb); - this.sum.set(sum); - this.min.set(min); - this.max.set(max); - this.sumOfSquare.set(sumOfSquare); - this.sliddingSum.set(sliddingSum); - } - - public INumberAnalyzed getCopyImmutable() { - final NumberAnalyzed2 copy = new NumberAnalyzed2(name, nb.get(), sum.get(), min.get(), max.get(), - sumOfSquare.get(), sliddingSum.get()); - return copy; - } - - public void addValue(long v) { - nb.incrementAndGet(); - if (nb.get() == 1) { - min.set(v); - max.set(v); - } else if (v > max.get()) { - max.set(v); - } else if (v < min.get()) { - min.set(v); - } - sum.addAndGet(v); - sumOfSquare.addAndGet(v * v); - sliddingSum.set(sliddingSum.get() * (SLIDING_WINDOW - 1) / SLIDING_WINDOW + v); - } - - public void add(NumberAnalyzed2 other) { - this.sum.addAndGet(other.sum.get()); - this.nb.addAndGet(other.nb.get()); - this.min.set(Math.min(this.min.get(), other.min.get())); - this.max.set(Math.max(this.max.get(), other.max.get())); - } - - public final long getNb() { - return nb.get(); - } - - public final long getSum() { - return sum.get(); - } - - public final long getMin() { - return min.get(); - } - - public final long getMax() { - return max.get(); - } - - public final long getMean() { - if (nb.get() == 0) { - return 0; - } - // Bad - return sum.get() / nb.get(); - } - - public final long getSliddingMean() { - if (nb.get() == 0) { - return 0; - } - if (nb.get() < SLIDING_WINDOW) { - return sum.get() / nb.get(); - } - // Bad - return sliddingSum.get() / nb.get(); - } - - final public String getName() { - return name; - } - -} diff --git a/src/net/sourceforge/plantuml/api/PlantumlUtils.java b/src/net/sourceforge/plantuml/api/PlantumlUtils.java deleted file mode 100644 index 5a02064..0000000 --- a/src/net/sourceforge/plantuml/api/PlantumlUtils.java +++ /dev/null @@ -1,60 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2017, 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.api; - -import java.util.List; - -import net.sourceforge.plantuml.BlockUml; -import net.sourceforge.plantuml.SourceStringReader; -import net.sourceforge.plantuml.core.Diagram; - -public class PlantumlUtils { - - public static boolean hasCMapData(String uml) { - List<BlockUml> blocks = new SourceStringReader(uml).getBlocks(); - if (blocks.size() == 0) { - uml = "@startuml\n" + uml + "\n@enduml"; - blocks = new SourceStringReader(uml).getBlocks(); - if (blocks.size() == 0) { - return false; - } - } - final BlockUml block = blocks.get(0); - final Diagram diagram = block.getDiagram(); - return diagram.hasUrl(); - } - -} diff --git a/src/net/sourceforge/plantuml/api/mda/option2/MDADiagram.java b/src/net/sourceforge/plantuml/api/mda/option2/MDADiagram.java deleted file mode 100644 index 15fde47..0000000 --- a/src/net/sourceforge/plantuml/api/mda/option2/MDADiagram.java +++ /dev/null @@ -1,42 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2017, 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.api.mda.option2; - -import java.util.Collection; - -public interface MDADiagram { - public Collection<MDAPackage> getPackages(); -} diff --git a/src/net/sourceforge/plantuml/api/mda/option2/MDAEntity.java b/src/net/sourceforge/plantuml/api/mda/option2/MDAEntity.java deleted file mode 100644 index c60f5e4..0000000 --- a/src/net/sourceforge/plantuml/api/mda/option2/MDAEntity.java +++ /dev/null @@ -1,41 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2017, 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.api.mda.option2; - -public interface MDAEntity { - public String getName(); - -} diff --git a/src/net/sourceforge/plantuml/api/mda/option2/MDAPackage.java b/src/net/sourceforge/plantuml/api/mda/option2/MDAPackage.java deleted file mode 100644 index 0f7c3fb..0000000 --- a/src/net/sourceforge/plantuml/api/mda/option2/MDAPackage.java +++ /dev/null @@ -1,46 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2017, 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.api.mda.option2; - -import java.util.Collection; - -public interface MDAPackage { - - public String getName(); - - public Collection<MDAEntity> getEntities(); - -} diff --git a/src/net/sourceforge/plantuml/api/mda/option2/MDAUtils.java b/src/net/sourceforge/plantuml/api/mda/option2/MDAUtils.java deleted file mode 100644 index e09f968..0000000 --- a/src/net/sourceforge/plantuml/api/mda/option2/MDAUtils.java +++ /dev/null @@ -1,45 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2017, 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.api.mda.option2; - -import net.sourceforge.plantuml.mda.MDADiagramImpl; - -public class MDAUtils { - - public static MDADiagram getMDADiagram(String plantumlDiagramSource) { - return MDADiagramImpl.create(plantumlDiagramSource); - } -} diff --git a/src/net/sourceforge/plantuml/api/mda/option3/MDAVisitor.java b/src/net/sourceforge/plantuml/api/mda/option3/MDAVisitor.java deleted file mode 100644 index 5bbbec4..0000000 --- a/src/net/sourceforge/plantuml/api/mda/option3/MDAVisitor.java +++ /dev/null @@ -1,39 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2017, 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.api.mda.option3; - -public interface MDAVisitor { -} |