mirror of
https://github.com/Noratrieb/UMLetClassParser.git
synced 2026-01-15 09:05:05 +01:00
better regex and drag and drop
This commit is contained in:
parent
501fa2f293
commit
c24064c2c1
8 changed files with 110 additions and 11 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class UMLMethod {
|
||||
|
||||
|
|
@ -29,7 +28,7 @@ public class UMLMethod {
|
|||
* name;
|
||||
* args in the UML format
|
||||
*/
|
||||
String formatted = line.replaceAll("([+\\-~#]) ?(.+)\\((.*: .*,?)?\\):? ?(.+)?", "$1;$4;$2;$3");
|
||||
String formatted = line.replaceAll(Regex.METHOD_FIND_REGEX, "$1;$4;$2;$3");
|
||||
String[] parts = formatted.split(";");
|
||||
this.encapsulation = switch (parts[0]) {
|
||||
case "+" -> "public ";
|
||||
|
|
@ -53,10 +52,12 @@ public class UMLMethod {
|
|||
String[] argsSplit = args.split(",");
|
||||
|
||||
for (String s : argsSplit) {
|
||||
String argFormatted = s.replaceAll(" ?(.*): (.*)", "$1;$2");
|
||||
String[] formattedSplit = argFormatted.split(";");
|
||||
argsNames.add(formattedSplit[0]);
|
||||
argsTypes.add(formattedSplit[1]);
|
||||
if(s.matches(Regex.ARG_SPLIT_REGEX)) {
|
||||
String argFormatted = s.replaceAll(Regex.ARG_SPLIT_REGEX, "$1;$2");
|
||||
String[] formattedSplit = argFormatted.split(";");
|
||||
argsNames.add(formattedSplit[0]);
|
||||
argsTypes.add(formattedSplit[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue