itmo-prog-lab-4/README.md

73 lines
5.5 KiB
Markdown
Raw Normal View History

# itmo-prog-lab-4
## Class Description
### StoryTeller
- The primary class of the application. It establishes the story's framework, incorporating the city, house, and characters, and initiates the storytelling process.
### Package: characters
- **Character.java**: This abstract class forms the foundation for all character types, implementing `Listenable` and `Conversable` interfaces.
- **Child.java**: Represents child characters who listen to and inquire about stories.
- **Traveler.java**: Depicts traveler characters who share tales of their adventures.
- **Znayka.java**: A specialized traveler character with extended capabilities.
### Package: enums
- **CharacterType.java**: Enumerates different character types, such as `TRAVELER` and `CHILD`.
### Package: interfaces
- **Listenable.java**: An interface for characters that can listen to stories.
- **Conversable.java**: An interface for characters that can engage in discussions about specific story subjects.
### Package: model
- **City.java**: Symbolizes a city in the story, featuring a method to simulate life resuming with changes.
- **House.java**: Represents a house where characters reside and where storytelling happens.
- **StoryElement.java**: An abstract base class for story components like City and House.
### Package: story
- **Narrative.java**: Manages a series of story events.
- **StoryContext.java**: Provides the narrative backdrop, linking the city, house, and the main story theme.
- **StoryEvent.java**: Constitutes individual events within the narrative.
### Package: exceptions
- **StoryException.java**: Handles exceptions specific to the storytelling process.
- **StoryRuntimeException.java**: Manages runtime exceptions within the story.
## Interactions and Configurations
- **StoryTeller**: Sets up the storytelling environment by creating a city, a house (Znayka's house), and characters (Znayka, Malish, and Malishka), then initiates the storytelling sequence in Znayka's house.
- **Character Classes**: Each character type (`Child`, `Traveler`, `Znayka`) interacts uniquely within the narrative. Children listen and pose questions, while travelers focus on recounting their adventures.
- **Interfaces**: `Listenable` and `Conversable` are implemented distinctly across character classes, enabling varied behaviors during the storytelling sessions.
- **Model Classes**: `City` and `House` form the physical backdrop of the story. The `House` class, in particular, is central to the gathering of characters and the exchange of stories.
- **Story Classes**: `StoryContext` connects the narrative's physical and thematic elements. `Narrative` and `StoryEvent` orchestrate the progression and individual occurrences of the story.
- **Exception Handling**: The `exceptions` package ensures robust error handling during the storytelling process, with `StoryException` and `StoryRuntimeException` tailored to specific storytelling scenarios.
## Output
```
Translating story on Bus 0 Device 0: ID 0x0:JMTek, LLC. USB PnP Audio Device
Translating story on Bus 1 Device 1: ID 0x10101:Creative Technology, Ltd SoundBlaster MP3+
Translating story on Bus 2 Device 2: ID 0x20202:Sennheiser Communications USB Headset
Translating story on Bus 3 Device 3: ID 0x30303:Bluetooth Audio Device
[DEBUG] Story Element Created: Цветочный город
[DEBUG] Story Element Created: Домик Знайки
[DEBUG] Story Element Created: TRAVELER Знайка
[DEBUG] Story Element Created: CHILD Малыш
[DEBUG] Story Element Created: CHILD Малышка
[DEBUG] Interaction with 'Домик Знайки': Starting evening stories session
Жители собираются в Домик Знайки чтобы рассказать истории
Все жители, и малыши и малышки, приходили по вечерам к Домик Знайки и слушали рассказы путешественников.
Жизнь в Цветочный город потекла по-старому... хотя нет, нельзя сказать, чтобы совсем по-старому.
Жители собираются в Домик Знайки чтобы рассказать истории
Знайка рассказывает историю о путешествие в Зеленый город
Малыш слушает историю о путешествия Знайки и спрашивает вопросы о путешествие в Зеленый город
Внезапный флешбенгер
[DEBUG] Interaction with 'Домик Знайки': Внезапный флешбенгер
Малышка слушает историю о путешествия Знайки и спрашивает вопросы о путешествие в Зеленый город
Знайка рассказывает историю о жизнь в Цветочном городе
Малыш слушает историю о путешествия Знайки и спрашивает вопросы о жизнь в Цветочном городе
Малышка слушает историю о путешествия Знайки и спрашивает вопросы о жизнь в Цветочном городе
Истории захватывали дух, и каждый вечер собирались всё больше жителей, чтобы слышать новые приключения.
Error in storytelling: No stories available to tell.
```
## UML Diagram
2023-12-12 11:51:00 +03:00
![UML Diagram](https://new.akarpov.ru/media/files/sanspie/DmZte/diagram.svg "https://new.akarpov.ru/files/YsvFMeuMCbOpfnOlOlyN")