itmo-prog-lab-3/README.md

66 lines
5.3 KiB
Markdown
Raw Permalink Normal View History

2023-11-27 15:59:44 +03:00
# itmo-prog-lab-3
## Class Description
2023-11-27 15:59:44 +03:00
### StoryTeller
- The main class of the application. It sets up the story's context, including the city, house, and characters, and initiates the storytelling process.
### Package: characters
- **Character.java**: An abstract class that serves as a base for all character types. It implements `Listenable` and `Conversable` interfaces.
- **Child.java**: Represents a child character. Capable of listening to and asking questions about stories.
- **Traveler.java**: Represents a traveler character. Focuses on telling stories about their adventures.
- **Znayka.java**: A specialized traveler character with additional behaviors.
### Package: enums
- **CharacterType.java**: An enumeration that defines different character types, such as `TRAVELER` and `CHILD`.
### Package: interfaces
- **Listenable.java**: Interface for characters that can listen to stories.
- **Conversable.java**: Interface for characters that can converse about specific subjects in the story.
### Package: model
- **City.java**: Represents a city in the story with a method to simulate the return to daily life with changes.
- **House.java**: Represents a house where characters reside and storytelling occurs.
- **StoryElement.java**: An abstract base class for elements within the story, like City and House.
### Package: story
- **Narrative.java**: Manages a collection of story events.
- **StoryContext.java**: Provides context for the story, linking the city, house, and the overarching story theme.
- **StoryEvent.java**: Represents individual events within the story.
## Interactions and Configurations
- **StoryTeller**: Initializes the storytelling environment by creating a city, a house (Znayka's house), and characters (Znayka, Malish, and Malishka). It then triggers the storytelling process in Znayka's house.
- **Character Classes**: Each character type (`Child`, `Traveler`, `Znayka`) interacts differently within the story. For instance, children listen and ask questions, while travelers focus on narrating their adventures.
- **Interfaces**: `Listenable` and `Conversable` are implemented differently in each character class, providing unique behaviors during storytelling.
- **Model Classes**: `City` and `House` serve as the physical setting for the story. The `House` class, in particular, is the focal point where characters gather and share stories.
- **Story Classes**: `StoryContext` links the narrative's physical setting with the thematic elements, while `Narrative` and `StoryEvent` manage the flow and individual events of the story.
## Given Query
```
На этом знаменитое путешествие Знайки и его товарищей окончилось.
Жизнь в Цветочном городе потекла по-старому... хотя нет, нельзя сказать, чтобы совсем по-старому.
С тех пор как наши отважные путешественники вернулись домой, в городе только и говорили о них.
Все жители, и малыши и малышки, приходили по вечерам к домику Знайки и слушали рассказы путешественников об их жизни в Зеленом городе.
```
## Output
```
2023-12-23 00:32:01 +03:00
На этом знаменитое путешествие Знайка закончилось.
Жизнь в Цветочный город потекла по-старому... хотя нет, нельзя сказать, чтобы совсем по-старому.
2023-12-23 00:32:01 +03:00
С тех пор как наши отважные путешественники Знайка вернулись домой, в городе только и говорили о них.
Жители собираются в Дом Знайки чтобы рассказать истории
Все жители слушают историю о путешествии в путешествие в Зеленый город в Цветочный город
Малыш слушает: Малыш слушает историю о путешествие в Зеленый город и спрашивает вопросы о путешествие в Зеленый город
Малышка слушает: Малышка слушает историю о путешествие в Зеленый город и спрашивает вопросы о путешествие в Зеленый город
Знайка рассказывает: Знайка умно рассказывает историю о путешествие в Зеленый город
и думает: Немного я знаю о городах, но история о путешествие в Зеленый город мне очень понравилась
Истории захватывали дух, и каждый вечер собирались всё больше жителей, чтобы слушать новые приключения.
```
## UML Diagram
![UML Diagram](https://new.akarpov.ru/media/files/sanspie/qLhQT/bebra.svg "https://new.akarpov.ru/files/rWZkihSbBcdbqCMhtfGB")
## Вывод
В ходе выполнения данной лабораторной работы я научился работать с интерфейсами, абстрактными классами.