diff --git a/.idea/discord.xml b/.idea/discord.xml
new file mode 100644
index 0000000..cd711a0
--- /dev/null
+++ b/.idea/discord.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/src/UMLClass.java b/src/UMLClass.java
new file mode 100644
index 0000000..06ce399
--- /dev/null
+++ b/src/UMLClass.java
@@ -0,0 +1,48 @@
+import java.util.ArrayList;
+
+public class UMLClass {
+
+ private String name;
+
+ private ArrayList fields = new ArrayList<>();
+ private ArrayList methods = new ArrayList<>();
+
+ public UMLClass(String classDiagram) {
+ String[] lines = classDiagram.split("\n");
+
+ String[] linesBeheaded = new String[lines.length-1];
+ this.name = lines[0];
+
+ System.arraycopy(lines, 1, linesBeheaded, 0, linesBeheaded.length);
+
+ for (String line : linesBeheaded) {
+ if(line != null) {
+ if (line.matches("([+\\-~#]) (.+)\\((.*: .*,?)?\\):? ?(.+)?")) { //MATCHES METHOD
+ methods.add(new UMLMethod(line, name));
+ } else if (line.matches("([+\\-~#]) ((?:[a-z]|[A-Z]|[0-1])+): (.*)")) { //MATCHES FIELD
+ fields.add(new UMLField(line));
+ }
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder s = new StringBuilder();
+ s.append("public class ").append(name).append(" {\n\n");
+
+ for (UMLField field : fields){
+ s.append(field.toString());
+ }
+
+ s.append("\n");
+
+ for (UMLMethod method : methods){
+ s.append(method.toString());
+ }
+
+ s.append("\n}");
+
+ return s.toString();
+ }
+}
diff --git a/src/UMLClassView.form b/src/UMLClassView.form
new file mode 100644
index 0000000..5d57eb3
--- /dev/null
+++ b/src/UMLClassView.form
@@ -0,0 +1,39 @@
+
+
diff --git a/src/UMLClassView.java b/src/UMLClassView.java
new file mode 100644
index 0000000..b8c2ddc
--- /dev/null
+++ b/src/UMLClassView.java
@@ -0,0 +1,39 @@
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+
+public class UMLClassView {
+ private JTextArea textArea1;
+ private JPanel panel1;
+ private JButton convertButton;
+ private JTextArea textArea2;
+
+
+ public UMLClassView() {
+
+ convertButton.addActionListener(e -> {
+ String text = textArea1.getText();
+
+ UMLClass umlClass = new UMLClass(text);
+
+ textArea2.setText(umlClass.toString());
+ });
+
+ textArea1.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ String text = textArea1.getText();
+
+ UMLClass umlClass = new UMLClass(text);
+
+ textArea2.setText(umlClass.toString());
+ }
+ });
+ }
+
+ public JPanel getPanel1() {
+ return panel1;
+ }
+}
diff --git a/src/UMLConverterMain.java b/src/UMLConverterMain.java
new file mode 100644
index 0000000..4a549e7
--- /dev/null
+++ b/src/UMLConverterMain.java
@@ -0,0 +1,18 @@
+import javax.swing.*;
+import java.awt.*;
+
+public class UMLConverterMain {
+
+ public static void main(String[] args) {
+
+
+ JFrame frame = new JFrame();
+ frame.setContentPane( new UMLClassView().getPanel1());
+ frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+ frame.setExtendedState(Frame.MAXIMIZED_BOTH);
+ frame.setVisible(true);
+
+ }
+
+
+}
diff --git a/src/UMLField.java b/src/UMLField.java
new file mode 100644
index 0000000..fdd5cd4
--- /dev/null
+++ b/src/UMLField.java
@@ -0,0 +1,44 @@
+public class UMLField {
+
+ private String dataType;
+ private String name;
+ private String encapsulation;
+
+ private boolean valid;
+
+ public UMLField(String dataType, String name, String encapsulation) {
+ this.dataType = dataType;
+ this.name = name;
+ this.encapsulation = encapsulation;
+ }
+
+ /**
+ * New Field from UML line
+ *
+ * @param line Format: "- name: String"
+ */
+ public UMLField(String line) {
+
+ String formatted = line.replaceAll("([+\\-~#]) ((?:[a-z]|[A-Z]|[0-1])+): (.*)", "$1;$3;$2");
+ System.out.println(formatted);
+ String[] formattedSplit = formatted.split(";");
+
+ this.encapsulation = switch (formattedSplit[0]) {
+ case "+" -> "public ";
+ case "-" -> "private ";
+ case "#" -> "protected ";
+ case "~" -> "";
+ default -> "[undefined] ";
+ };
+
+ this.name = formattedSplit[2];
+ this.dataType = formattedSplit[1];
+ }
+
+
+ @Override
+ public String toString() {
+ return " " + encapsulation + dataType + " " + name + ";\n";
+
+ }
+}
diff --git a/src/UMLMethod.java b/src/UMLMethod.java
new file mode 100644
index 0000000..bd42b6d
--- /dev/null
+++ b/src/UMLMethod.java
@@ -0,0 +1,80 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+
+public class UMLMethod {
+
+ private String returnType;
+ private String name;
+ private String encapsulation;
+
+ private ArrayList argsNames = new ArrayList<>();
+ private ArrayList argsTypes = new ArrayList<>();
+
+ public UMLMethod(String encapsulation, String returnType, String name, ArrayList argsNames, ArrayList argsTypes) {
+ this.returnType = returnType;
+ this.name = name;
+ this.argsNames = argsNames;
+ this.argsTypes = argsTypes;
+ this.encapsulation = encapsulation;
+ }
+
+ public UMLMethod(String line, String className) {
+
+ //First, format it nicely
+
+ /**
+ * Formatted line:
+ * EncapsulationIndicator;
+ * retunType("" for void);
+ * name;
+ * args in the UML format
+ */
+ String formatted = line.replaceAll("([+\\-~#]) (.+)\\((.*: .*,?)?\\):? ?(.+)?", "$1;$4;$2;$3");
+ String[] parts = formatted.split(";");
+ this.encapsulation = switch (parts[0]) {
+ case "+" -> "public ";
+ case "-" -> "private ";
+ case "#" -> "protected ";
+ case "~" -> "";
+ default -> "[undefined] ";
+ };
+
+ this.name = parts[2];
+
+
+ if(parts[1].equals("") && !className.equals(name)){
+ this.returnType = "void";
+ } else {
+ this.returnType = parts[1];
+ }
+
+ if(parts.length == 4) {
+ String args = parts[3];
+ 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]);
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder returnString = new StringBuilder();
+ returnString.append("\n ").append(encapsulation).append(returnType).append(" ").append(name).append(" (");
+
+ for (int i = 0; i < argsNames.size(); i++) {
+ returnString.append(argsTypes.get(i)).append(" ").append(argsNames.get(i));
+ if (i != argsNames.size() - 1) {
+ returnString.append(", ");
+ }
+ }
+
+ returnString.append(") {\n \n }\n");
+
+ return returnString.toString();
+ }
+}