z635c27fcde666

Table of Contents

Setup

  1. Before running the program, you must have Python installed (3.10.7 at the time).
  2. Download the most recent version of the repository.
git clone https://github.com/mucsci-students/2022fa-420-LigmaPy.git
  1. Once the repo is downloaded, install the required libraries with the below commands.
python3 -m pip install -r requirements.txt

How to Run

  1. Download the latest version from the repo.
  2. Python 3.10 or higher is installed.
  3. In a terminal, navigate to the /2022fa-420-Ligmapy/ directory.
  4. To run the UML editor type:
python uml.py [--cli]

Note: Add the --cli flag to run the CLI editor

CLI Commands

addClass - Creates a class

addClass <name>

deleteClass - Removes a class

deleteClass <name>

renameClass - Updates name of a class

renameClass <currentName> <newName>

addField - Creates a field in a class

addField <class> <name> <type>

deleteField - Removes a field from a class

deleteField <class> <name>

renameField - Updates the name of a classes field

renameField <class> <old_name> <new_name>

addMethod - Creates a method in a class

addMethod <class> <name> <return_type> [-p <name>:<type>...]

deleteMethod - Removes a method from a class

deleteMethod <class> <name>

renameMethod - Updates the name of a method in a class

renameMethod <class> <old_name> <new_name>

addParam - Creates a list of parameters for a method in a class

addParam <class> <method> <name>:<type>...

deleteParam - Removes the parameter(s) from a method in a class

deleteParam <class> <method> [-a] [<name>...]

addRelationship - Creates a relationship between two classes

addRelationship <source> <destination>

deleteRelationship - Removes a relationship between two classes

deleteRelationship <source> <destination>

changeRelType - Updates the type of a relationship

changeRelType <source> <destination> <new_type>

save - Saves the current state of the program

save <filename>

load - Loads a previously saved state

load <filename>

listClasses - Lists all classes and their contents

listClasses

listClass - Lists the contents of a specified class

listClass <name>

listRelationships - Lists all existing relationships between classes

listRelationships

export - Exports the UML to a .jpg image

export <filename>

help - Lists all available commands and their descriptions

help [command]

exit - Exits the program

exit

Design Patterns

MVC

The model contains the information for classes and relationships. This information is stored in two lists, classIndex and relationIndex, respectively. The view contains everything used to display the model information onto the canvas. The controller listens for button presses in the gui or a valid command in the cli.

Memento - UMLState

I created a class to capture and store states of the classIndex and relationIndex. This allows us to repopulate those lists with a different version (past or future), allowing us to be able to undo and redo actions.

Observer - UMLClass

The UMLClass contains a list of "subscribers" which are relationships that the class is a part of (as a source or destination). There are also class methods register and unregister which handle adding and removing relationships from that list. On every name change, or deletion of a class, each subscriber in the list is notified. This allows for relationships to be deleted when their source or destination has been deleted, and a class name change to be reflected in each relationship that it is a part of.

Singleton - View

Since there should only ever be one GUI window, the view class now checks if an instance has already been created or not, before making one. If there has been an instance created already, then the pre-existing instance will be returned instead of a newly made one.

Prototype - Prototype

Every time a class is added to the GUI, a label is created with "Class: Fields: Methods:". Prototype creates this label which is then copied every time a new class is created. This allows us to start with the same label every time and then adjust it as needed to add the specific qualities of the new class.

Strategy – exportImage

Each different relationship line (Aggregation, Composition, Inheritance, Realization) represents a different strategy. The algorithms for drawing the different types of lines are put into separate classes. The context export object can then change its strategy based on the line type then draw the corresponding line to canvas.


Team

Aaron Heinbaugh Christian Shepperson Julia Geesaman Samantha Noggle Trevor Bender
Aaron Heinbaugh Christian Shepperson Julia Geesaman Samantha Noggle Trevor Bender




Dedicated to JSMACH <3