Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rabestro/biorhythm-calculator-labs
Laboratory for creating a training project. The goal is to create a tutorial project on working with dates in Java. The idea is to create a biorhythm calculator that allows you to select dates and print reports for different periods of time.
https://github.com/rabestro/biorhythm-calculator-labs
date datepicker formatter java-8
Last synced: 10 days ago
JSON representation
Laboratory for creating a training project. The goal is to create a tutorial project on working with dates in Java. The idea is to create a biorhythm calculator that allows you to select dates and print reports for different periods of time.
- Host: GitHub
- URL: https://github.com/rabestro/biorhythm-calculator-labs
- Owner: rabestro
- License: mit
- Created: 2021-06-25T22:24:35.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-08-28T07:04:57.000Z (over 3 years ago)
- Last Synced: 2024-11-07T11:52:34.162Z (2 months ago)
- Topics: date, datepicker, formatter, java-8
- Language: Java
- Homepage:
- Size: 723 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Biorhythms Calculator
## About
This is a laboratory for creating a [training project](https://github.com/rabestro/biorhythm-calculator-labs/wiki). The goal is to create a tutorial project on working with dates in Java. The idea is to create a biorhythm calculator that allows you to select dates and print reports for different periods of time. We use the laboratory to come up with what the project will look like, what components it will consist of.
## Stages
The project is divided into [eight stages](/src/main/java/lv/id/jc/stage8). At each stage, we need to implement certain functionality. After completing the last stage, we should get a fully working program.
## Context
The context of this project is only two fields - date of birth and date of report. The context is created when the program starts and then injected in each component or command.
## Components
To make it easier to invent a project, the concept of a system component was introduced. The entire training project is broken down into many small sub-tasks. Each of these tasks is a separate class in this repository. To make it easier to manipulate different components, a common interface was created.
Each individual component can be [run, tested](/src/test/java/lv/id/jc/runner), and improved separately. A [special class](/src/test/java/lv/id/jc/runner/AbstractRunner.java) generates a random context for the component and you can see how the module behaves when working with different data. You can then assemble the components into a [working implementation](/src/main/java/lv/id/jc/stage8) of each of the steps in the tutorial project.
## Command Processor (Broker)
One of the main parts of the system is the [command processor](/src/main/java/lv/id/jc/biorhythm/service/Broker.java). The command processor accepts a list of components, and each component acts as a command. When the user enters a query, [each component is asked if it understands the command](https://github.com/rabestro/biorhythm-calculator-labs/blob/b4b150b12ad2bac32d87c0a3925afee2bfb9831f/src/main/java/lv/id/jc/biorhythm/service/CommandProcessor.java#L42). To do this, the component must [implement the predicate](https://github.com/rabestro/biorhythm-calculator-labs/blob/b4b150b12ad2bac32d87c0a3925afee2bfb9831f/src/main/java/lv/id/jc/biorhythm/command/MoveDate.java#L29), but the [default implementation](https://github.com/rabestro/biorhythm-calculator-labs/blob/b4b150b12ad2bac32d87c0a3925afee2bfb9831f/src/main/java/lv/id/jc/biorhythm/ui/Component.java#L46) is already in the abstract class. If the component understands the user's request, then it fulfills it. If none of the components understand the command, then the command processor prints error messages.