Skip to content

Commit 220978b

Browse files
committed
Added Project
0 parents  commit 220978b

90 files changed

Lines changed: 9082 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.github/workflows/maven-ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# .github/workflows/maven-ci.yml
2+
name: Java CI with Maven
3+
4+
on:
5+
push:
6+
branches: [ "main", "dev" ]
7+
pull_request:
8+
branches: [ "main", "dev" ]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout sources
16+
uses: actions/checkout@v4
17+
18+
- name: Set up JDK 17
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '17'
22+
distribution: 'temurin'
23+
cache: maven
24+
25+
- name: Build, test and generate coverage
26+
run: mvn -B test jacoco:report --file pom.xml
27+
28+
- name: Upload JaCoCo HTML report
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: jacoco-html
32+
path: target/site/jacoco/
33+
34+
- name: Upload JaCoCo exec data
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: jacoco-exec
38+
path: target/jacoco.exec

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# IntelliJ project files
2+
.idea/
3+
*.iml
4+
*.iws
5+
out/
6+
*.class
7+
8+
# Build tools
9+
target/
10+
build/
11+
.gradle/
12+
.mvn/
13+
14+
# OS artifacts
15+
.DS_Store
16+
Thumbs.db
17+
18+
# Logs and temp
19+
*.log
20+
*.tmp

README.md

Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
# UML Manager (CLI & GUI)
2+
This **UML Manager** is an application that allows users to create and manage class definitions, fields, methods, parameters, and relationships between classes.
3+
It provides a simple way to review and model class structures and their associations with each other. You can run it either in **GUI mode** or **CLI mode**.
4+
5+
## How to Run the Program
6+
7+
### 1. Make sure you have Java installed
8+
You need Java installed on your computer. If you are not sure, open a terminal and type:
9+
10+
`java -version`
11+
12+
If you see a version number, Java is installed. If not, you will need to install Java first.
13+
14+
---
15+
16+
### 2. Download and unzip the application
17+
- Click the "`Sprint4`" on the **Releases** section
18+
- Click on the "`Sprint4.Zip`" to start your download
19+
- Once you have downloaded, Extract(Unzip) the file
20+
21+
---
22+
23+
### 3. Open the Terminal or Command Prompt
24+
**OPTION 1**
25+
- **Windows:**
26+
1. After you've unzipped, click on that folder, inside there will be a file called "target". Right click it (Make sure the file is selected), and press "`Open in Terminal`"
27+
28+
That will open the file in the terminal directory where it lives in.
29+
30+
**OPTION 2**
31+
- **Windows:**
32+
1. Press `Win + R`, type `cmd`, and press Enter.
33+
- **Mac/Linux:**
34+
Open your terminal application.
35+
36+
Navigate to the folder where you unzipped the files:
37+
38+
`cd path/to/unzipped/folder`
39+
40+
Example:
41+
42+
`cd /Users/alexr/Downloads/UMLManager`
43+
44+
---
45+
46+
### 4. Run the Program
47+
48+
There are two ways to run the program currently.
49+
50+
- **GUI Mode (default):**
51+
52+
In your terminal, copy and paste this -> `java -jar 404App-1.0-SNAPSHOT-jar-with-dependencies.jar` on the command line.
53+
54+
This will start the GUI
55+
56+
- **CLI Mode:**
57+
58+
In your terminal, copy and past this -> `java -jar 404App-1.0-SNAPSHOT-jar-with-dependencies.jar --cli` on the command line.
59+
60+
This will start the CLI
61+
62+
### 5. What You Should See
63+
64+
- **CLI Mode:**
65+
66+
<img width="700" height="292" alt="image" src="https://github.com/user-attachments/assets/654a9686-c2b7-4d96-b021-303ee90ed0f3" />
67+
68+
69+
- **GUI Mode:**
70+
<img width="500" height="782" alt="image" src="https://github.com/user-attachments/assets/0c33a157-5585-406e-ab22-0458a4ee91a7" />
71+
72+
---
73+
74+
## How To Use
75+
76+
### - CLI
77+
78+
1. The CLI is very self explanitory, when you type 'help' in the command line you'll see all avalable commands
79+
80+
<img width="800" height="1013" alt="image" src="https://github.com/user-attachments/assets/cc8db91f-1275-4bac-b740-28875575673c" />
81+
82+
2. When you begin, you'll have to add a class first (These commands are case sensitive so be sure to look at how they are formatted).
83+
Youll be prompted to type the class name
84+
85+
<img width="1917" height="73" alt="image" src="https://github.com/user-attachments/assets/528e3cca-c004-48cd-bb22-1dd42e4e2131" />
86+
87+
3. Once that is complete you are free to add parameters, methods, fields, and relationships
88+
89+
<img width="1900" height="543" alt="image" src="https://github.com/user-attachments/assets/dbf36493-9ceb-438d-b953-1b6ab6b4ffb9" />
90+
91+
4. To add a relationship, you will need two classes minimum, I mean, thats the whole point ;).
92+
You will pe prompted to add a 'Source Class' and a 'Target Class' and the type of relationship.
93+
94+
<img width="1918" height="231" alt="image" src="https://github.com/user-attachments/assets/09e974a6-fad7-4296-baf4-c6eebeb783fb" />
95+
96+
*Note: you might find that you'll get a '?' on the 'Relationship added' line, that simply means your terminal does not use UTF-8 ecoding unfortunately*
97+
98+
5. To see the Classes you have listed simply type listClasses on the command line.
99+
100+
101+
<img width="1918" height="303" alt="image" src="https://github.com/user-attachments/assets/346ca0ef-9c22-40ee-b9a2-ba77e04cb4a1" />
102+
103+
6. To make typing more simple and efficient we also have autoimplementation, for example if you want to add a relationship you can begin
104+
to type 'addR-' and then press [TAB] to autocomplete the rest, you can do this for fields, methods, CLI command, and parameter names!
105+
106+
107+
<img width="1918" height="66" alt="image" src="https://github.com/user-attachments/assets/2443a3ab-fcf8-4cda-a6c2-92a9fdf532db" />
108+
109+
---
110+
111+
## Available Commands for CLI
112+
113+
### Project / Save Commands
114+
- `new`
115+
116+
Clears the current project and starts a new blank project.
117+
118+
- `load`
119+
Loads a previously saved project from a JSON file.
120+
121+
- `save`
122+
Saves the current project to the last used save path. If no save exists, prompts for a filename.
123+
124+
- `saveAs`
125+
Prompts for a filename and saves the current project under that name.
126+
127+
---
128+
129+
### Class Commands
130+
- `addClass`
131+
Creates a new class.
132+
133+
- `deleteClass`
134+
Deletes an existing class.
135+
136+
- `renameClass`
137+
Renames a class.
138+
139+
- `listClasses`
140+
Displays all current classes.
141+
142+
- `listClass`
143+
Displays the provided class.
144+
145+
---
146+
147+
### Field Commands
148+
- `addField`
149+
Adds a new field to a class.
150+
151+
- `deleteField`
152+
Removes a field from a class.
153+
154+
- `renameField`
155+
Renames a field inside a class.
156+
157+
---
158+
159+
### Method Commands
160+
- `addMethod`
161+
Adds a new method to a class with optional parameters.
162+
163+
- `deleteMethod`
164+
Removes a method and all associated data by name from the target class.
165+
166+
- `renameMethod`
167+
Renames a method in a class.
168+
169+
---
170+
171+
### Parameter Commands
172+
- `addParameter`
173+
Adds a parameter to a method.
174+
175+
- `deleteParameter`
176+
Removes a parameter from a method.
177+
178+
- `renameParameter`
179+
180+
Renames a parameter from a method.
181+
182+
---
183+
184+
### Relationship Commands
185+
- `addRelationship`
186+
Creates a relationship between two classes.
187+
`<Type>` can be: `REALIZATION`, `AGGREGATION`, `COMPOSITION`, `GENERALIZATION`.
188+
189+
- `deleteRelationship`
190+
Removes all relationships involving a given class.
191+
192+
- `listRelationships`
193+
Lists all relationships created.
194+
195+
---
196+
197+
### System Commands
198+
- `help`
199+
Displays a list of all available commands.
200+
201+
- `exit`
202+
Closes the application.
203+
204+
---
205+
206+
### - GUI
207+
208+
1. To create a default class you can go to the menu section, click on 'Class' and then you can add a new class along with many more options
209+
210+
<img width="600" height="817" alt="image" src="https://github.com/user-attachments/assets/c8e2fb3d-39ef-468b-97df-b3a6b29d00f3" />
211+
212+
2. You can click on the 'Expand Clas List' which will show all classes which have been created and if they have been added to the scene
213+
214+
<img width="600" height="812" alt="image" src="https://github.com/user-attachments/assets/8228db0e-c511-4097-adf6-7e8cc544043d" />
215+
216+
3. You can double click on the default class name to rename such class
217+
218+
<img width="600" height="813" alt="image" src="https://github.com/user-attachments/assets/d00b1eac-365f-4b3b-b3d1-f34a1f806ce4" />
219+
220+
4. You can right click on the class box to add, create, and rename such class
221+
222+
<img width="600" height="817" alt="image" src="https://github.com/user-attachments/assets/4f34ed21-8e67-4cf1-825a-ddeb66188161" />
223+
224+
5. To add a relationship go to the menu bar, and select 'Relations' -> 'add Relation'. You will be prompted to add a source class and target class
225+
<img width="600" height="815" alt="image" src="https://github.com/user-attachments/assets/f9868386-fe43-4209-b769-851bb44e3b9a" />
226+
<img width="600" height="816" alt="image" src="https://github.com/user-attachments/assets/8fd688e6-e0d5-48ed-83fc-b0dd826f214b" />
227+
228+
5a. You will be prompted to add a relationship type using a drop down, select which ever.
229+
230+
<img width="600" height="810" alt="image" src="https://github.com/user-attachments/assets/62bb9d10-3cd3-4041-8fe6-985cb0a1edcf" />
231+
232+
5b. The final result will look something like this.
233+
234+
<img width="600" height="812" alt="image" src="https://github.com/user-attachments/assets/6f87f24c-ac4e-4d04-869e-a0ce348c3729" />
235+
236+
6. You can choose to save, save as 'filename', load, create new, and exit the program in the file menu button. With saving your project, it will direct you to your file explorer where you can export a photo and/or save your project.
237+
238+
<img width="600" height="820" alt="image" src="https://github.com/user-attachments/assets/a7ad8c7e-7a27-43d0-9d34-836ea1d24932" />
239+
240+
7. An important feature that we have recently implemented is the ability to undo and/or redo. By clicking the "UndoRedo" button on the menu bar you can undo something that you previously did as well as redo that action!
241+
242+
<img width="600" height="812" alt="image" src="https://github.com/user-attachments/assets/af2cf92b-9985-4a5d-ba18-915c7270a33c" />
243+
244+
---
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
Group 404 Design Patterns
2+
3+
Required Patterns:
4+
5+
Model – View – Controller:
6+
7+
Intent: with applications, there is a need to use Model View Controller setups for the importance of structuring code to align with roles of responsibility, and ease of expansion for any part within the application.
8+
9+
The Model is the part that will hold all essential data and states associated with the application at runtime. For us, the model is best seen within the DataDefinitions package, as these are the classes that define the data and possible states of data that the application needs to store and access during use.
10+
11+
The View is the interface that the user visually sees while they use the application. All parts of the view take care of how the internal data is represented and displayed to the user. This is best seen in our “gui” package with classes like the ClassBoxDisplay.
12+
13+
The Controller is what orchestrates user input, updates the model, and refreshes the view. These are the buttons and commands the user has access to in order to request changes in the data, which then correspond to refreshing the view.
14+
15+
Justification : having these coordinated, but separated in roles, structure is critical to a strong application. Each part knows what it is responsible for, and has access to communicate to the others parts as needed, without directly doing the other parts task logic within itself.
16+
17+
18+
19+
Memento Pattern:
20+
21+
Intent : Save and Restore previous states of the internal data for our application, for the purpose of allowing the user to undo, or even redo, changes they realized they did not mean to make with ease.
22+
23+
Where it appears : DataManager, saved in an undo / redo stack like data structure. Where each snapshot is taken and stored into a queue where the undo makes a snapshot of current to push into redo, then pops the most recent change and loads it as the current save.
24+
25+
Justification : sometimes user can be performing work with our application and find themselves realizing they did the wrong update, or the wrong move, and instead of requiring the user to directly know how to undo that move, we can instead allow them ease of an action that can undo for them, restoring the data to state they are happy with.
26+
27+
4 Additional Patterns
28+
29+
1. Singleton Pattern
30+
31+
Intent - During the beginning of sprint 3 we began to refactor our project to incorporate a singleton of dataManager. The intent for this was ensuring that a class only had a single instance and provided a global point of access to it. Before we had to instantiate a new dataManager for each file and then add the new instantiated dataManager into itself. With the new implemented singleton all we have to do is grab the instance of DataManager by doing DataManager.getInstance(). SceneManager had been recently added as a singleton to avoid multiple conflicting scene/layouts.
32+
33+
Where does it appear - DataManager, Commander, SceneManager
34+
35+
Justification - We want one authoritative model for classes/relationships so that: CLI and GUI always see consistent data, undo/redo, save/load operate on a single shared state, we also want one command registry so new commands can be registered in one place and reused by the CLI. It is just more simple to use
36+
37+
2. Command Pattern (~26 classes)
38+
39+
Intent - The command pattern encapsulates a request as an object, it allows parameterization of clients with different requests, Each operation is a separate command class implementing CommandHandler. This was a no brainer for us as it made things much simpler in the long run since we've had a variation of this pattern since sprint 1
40+
41+
Where does it appear - CommandHandler, All Commands(AddClassCommand, DeleteClassCommand, etc), Commander, CommandProcessor
42+
43+
Justification - Command Handler like we said before defines the command interface, with each operation being a separate command class implementing CommandHandler (e.g. AddFieldCommand, AddClassCommand, etc). Commander holds a Map registry, with the CLI using CommandProcessor to parse user input and dispatch the appropriate commandHandler This very way decouples UI from logic, the CLI and GUI menus can trigger the same commands without duplicating logic. Using this pattern centralizes undo/redo because every mutating operation goes through a command, Group 404 Design Patterns we can put snapshotForUndo() in the command at the exact point where a change occurs. It becomes Extensible ass new features are added by simply creating a new command class and registering them without modifying or changing the central execution loop
44+
45+
3. Strategy Pattern (used 3 separate instances)
46+
47+
Intent - The strategy pattern defines a family of algos, encapsulates each and every one and then makes them interchangeable, this went perfectly with our text box implementation.
48+
49+
Where does it appear - one instance of this is in our TextBoxStrategy setup, where TextBoxStrategy is the base interface, and TextBoxFieldStrategy, ...MethodStrategy, ...LabelStrategy, ...ClassStrategy all implement this to be a unique functionality.
50+
51+
Another instance of this pattern is in our Prompt system. Where PromptCapable is our interface setup, and PromptGUI and PromptCLIJLine allow us to use a prompting system for the given setup the user is in.
52+
53+
Lastly we also have this for our Validator system, where we are able to take our base interface Validator and change the strategy based on the type of data we are trying to validate.
54+
55+
Justification - TextBox is a generic UI component that shows/edits text. It delegates what to do when a user presses Enter to a TextBoxStrategy, each strategy knows how to interpret the text and updates the model. The UI component doesn't need to know any of the domain rules; we reuse the same textBox for multiple kinds of data by simply swapping the strategy. This way, it is easier to add new strategies later without changing the TextBox class. This same way is used for the prompting strategies; it abstracts a way for the application to ask the user for input so we can swap between CLI prompts and GUI dialogs. IPrompt defines the behavior, PromptCLIJLine uses JLine for advanced CLI input, PromptGUI uses javaFX dialogs. Classes that need prompting implement PromptCapable.
56+
57+
4. Observer Pattern (~ 4 classes)
58+
59+
Intent: communication between data structure and visual displays (the view) that doesn’t require hard coupling. With observer pattern, we can register the view to listen to changes occurring in data, and respond by updating the view for the user, so that any data changes the user should and can see, are updated in a way that provides the user the most current and accurate representation of the data.
60+
61+
Where it appears: DataManagerObserver, RelationshipObserver, and MainViewController with Runnables wired amongst Data Types like ClassData and all its internals.
62+
63+
Justification: instead of hard coupling data with it’s visual representation, we can soft couple them by having the view register to listen to the Data. In this way, when any piece of data gets a call to update internals, we can notify the view that a change occurred, and the view can handle refreshing itself, without needing to directly link a data and it’s refreshment
64+
65+
5. Template Pattern
66+
67+
Intent: give abstract operations to subclasses in a way where those subclasses can perform these operations as needed, but follow the contract provided by the super class.
68+
69+
Where it appears: IDraggable interface and ClassBoxDisplay which then implements it.
70+
71+
Justification: this allows a contract for anything we’d want to be “Draggable” in our scene to follow, but each individual class that implements it could write these functions as it pertains to their specific use case.

docs/404DesignPatternsWriteUp.pdf

55.3 KB
Binary file not shown.

docs/CodeCoveragePt.1.png

50.8 KB
Loading

docs/CodeCoveragePt.2.png

22.2 KB
Loading

docs/Sprint4UMLPNG.png

55.7 KB
Loading

0 commit comments

Comments
 (0)