https://github.com/stefanerrorerko/netlab4
Implementation of structural pattern Composite in C#
https://github.com/stefanerrorerko/netlab4
csharp patterns study-project
Last synced: 5 months ago
JSON representation
Implementation of structural pattern Composite in C#
- Host: GitHub
- URL: https://github.com/stefanerrorerko/netlab4
- Owner: StefanErrorerko
- Created: 2022-06-26T23:56:49.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-11T13:27:03.000Z (over 1 year ago)
- Last Synced: 2025-05-03T02:59:21.561Z (about 1 year ago)
- Topics: csharp, patterns, study-project
- Language: C#
- Homepage:
- Size: 57.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NETLab4
Lab 4 | Design Patterns (Structural) | Composite
Muzyka Stefan
IS-02
Variant 11
## Task
Implement a parse tree for an expression, based on the following syntax rules:
```
::= |
::= |
::= ()
::= ()
::= ( )
::= + | - | * | /
```
## Explanation
The Composite pattern is implemented through the classes Component, Composite, and Leaf. They represent a tree-like structure of an expression.
- Component is an abstract class that describes a part of the expression (either complex or simple).
- Composite is a complex expression.
- Leaf represents a simple expression (a constant or variable).
- Connect is the class that describes mathematical operators (*, /, +, -).
- Part is an abstract class that describes types of data: Number for constants and Variable for variables.
The expression is converted into an expression tree by the static class ExpressionParser.
## Class Diagram
