mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-05 21:17:52 +00:00
Fix style issue and add splitstr function
This commit is contained in:
parent
8ae721e3d2
commit
db76ab28b5
@ -61,16 +61,15 @@ public abstract class USymbol {
|
||||
public final static USymbol NODE = record("NODE", SkinParameter.NODE, new USymbolNode());
|
||||
public final static USymbol ARTIFACT = record("ARTIFACT", SkinParameter.ARTIFACT, new USymbolArtifact());
|
||||
public final static USymbol PACKAGE = record("PACKAGE", SkinParameter.PACKAGE,
|
||||
new USymbolFolder(SkinParameter.PACKAGE, true));
|
||||
new USymbolFolder(SName.package_, SkinParameter.PACKAGE, true));
|
||||
public final static USymbol FOLDER = record("FOLDER", SkinParameter.FOLDER,
|
||||
new USymbolFolder(SkinParameter.FOLDER, false));
|
||||
new USymbolFolder(SName.folder, SkinParameter.FOLDER, false));
|
||||
public final static USymbol FILE = record("FILE", SkinParameter.FILE, new USymbolFile());
|
||||
public final static USymbol RECTANGLE = record("RECTANGLE", SkinParameter.RECTANGLE,
|
||||
new USymbolRectangle(SkinParameter.RECTANGLE));
|
||||
public final static USymbol HEXAGON = record("HEXAGON", SkinParameter.HEXAGON, new USymbolHexagon());
|
||||
public final static USymbol PERSON = record("PERSON", SkinParameter.PERSON, new USymbolPerson());
|
||||
public final static USymbol LABEL = record("LABEL", SkinParameter.LABEL,
|
||||
new USymbolLabel(SkinParameter.LABEL));
|
||||
public final static USymbol LABEL = record("LABEL", SkinParameter.LABEL, new USymbolLabel(SkinParameter.LABEL));
|
||||
public final static USymbol ARCHIMATE = record("ARCHIMATE", SkinParameter.ARCHIMATE,
|
||||
new USymbolRectangle(SkinParameter.ARCHIMATE));
|
||||
public final static USymbol COLLECTIONS = record("COLLECTIONS", SkinParameter.COLLECTIONS,
|
||||
@ -97,6 +96,7 @@ public abstract class USymbol {
|
||||
public final static USymbol TOGETHER = record("TOGETHER", SkinParameter.QUEUE, new USymbolTogether());
|
||||
|
||||
abstract public SkinParameter getSkinParameter();
|
||||
|
||||
abstract public SName getSName();
|
||||
|
||||
// public USymbol withStereoAlignment(HorizontalAlignment alignment) {
|
||||
|
@ -59,11 +59,13 @@ public class USymbolFolder extends USymbol {
|
||||
private final static int marginTitleY2 = 3;
|
||||
|
||||
private final SkinParameter skinParameter;
|
||||
private final SName sname;
|
||||
private final boolean showTitle;
|
||||
|
||||
public USymbolFolder(SkinParameter skinParameter, boolean showTitle) {
|
||||
public USymbolFolder(SName sname, SkinParameter skinParameter, boolean showTitle) {
|
||||
this.skinParameter = skinParameter;
|
||||
this.showTitle = showTitle;
|
||||
this.sname = sname;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -78,7 +80,7 @@ public class USymbolFolder extends USymbol {
|
||||
|
||||
@Override
|
||||
public SName getSName() {
|
||||
return SName.folder;
|
||||
return sname;
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,6 +117,7 @@ import net.sourceforge.plantuml.tim.stdlib.ReverseColor;
|
||||
import net.sourceforge.plantuml.tim.stdlib.ReverseHsluvColor;
|
||||
import net.sourceforge.plantuml.tim.stdlib.SetVariableValue;
|
||||
import net.sourceforge.plantuml.tim.stdlib.Size;
|
||||
import net.sourceforge.plantuml.tim.stdlib.SplitStr;
|
||||
import net.sourceforge.plantuml.tim.stdlib.StringFunction;
|
||||
import net.sourceforge.plantuml.tim.stdlib.Strlen;
|
||||
import net.sourceforge.plantuml.tim.stdlib.Strpos;
|
||||
@ -185,6 +186,7 @@ public class TContext {
|
||||
functionsSet.addFunction(new Size());
|
||||
functionsSet.addFunction(new GetJsonKey());
|
||||
functionsSet.addFunction(new GetJsonType());
|
||||
functionsSet.addFunction(new SplitStr());
|
||||
// %standard_exists_function
|
||||
// %str_replace
|
||||
// !exit
|
||||
|
75
src/net/sourceforge/plantuml/tim/stdlib/SplitStr.java
Normal file
75
src/net/sourceforge/plantuml/tim/stdlib/SplitStr.java
Normal file
@ -0,0 +1,75 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2021, 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.tim.stdlib;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.json.JsonArray;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
|
||||
public class SplitStr extends SimpleReturnFunction {
|
||||
|
||||
public TFunctionSignature getSignature() {
|
||||
return new TFunctionSignature("%splitstr", 3);
|
||||
}
|
||||
|
||||
public boolean canCover(int nbArg, Set<String> namedArgument) {
|
||||
return nbArg == 2;
|
||||
}
|
||||
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final JsonArray result = new JsonArray();
|
||||
|
||||
final String str = values.get(0).toString();
|
||||
final String separator = values.get(1).toString();
|
||||
|
||||
final StringTokenizer tokenizer = new StringTokenizer(str, separator);
|
||||
while (tokenizer.hasMoreElements())
|
||||
result.add(tokenizer.nextToken());
|
||||
|
||||
return TValue.fromJson(result);
|
||||
}
|
||||
|
||||
}
|
@ -80,7 +80,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static int beta() {
|
||||
final int beta = 0;
|
||||
final int beta = 1;
|
||||
return beta;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user