itmo-prog-lab-4/README.md

11 KiB
Raw Blame History

itmo-prog-lab-3

Class Description

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

Жители Домик Знайки собираются чтобы рассказать истории
Все жители, и малыши и малышки, приходили по вечерам к Домик Знайки и слушали рассказы путешественников.
Жизнь в Цветочный город потекла по-старому... хотя нет, нельзя сказать, чтобы совсем по-старому.
Жители Домик Знайки собираются чтобы рассказать истории
Знайка рассказывает историю о путешествие Знайки в Зеленый город
Малыш слушает историю о путешествие Знайки и спрашивает вопросы о путешествие Знайки в Зеленый город
Малышка слушает историю о путешествие Знайки и спрашивает вопросы о путешествие Знайки в Зеленый город
Знайка рассказывает историю о жизнь в Цветочном городе
Малыш слушает историю о путешествие Знайки и спрашивает вопросы о жизнь в Цветочном городе
Малышка слушает историю о путешествие Знайки и спрашивает вопросы о жизнь в Цветочном городе
Истории захватывали дух, и каждый вечер собирались всё больше жителей, чтобы слышать новые приключения.

UML Diagram

UML Diagram

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

UML Diagram