Class Component

java.lang.Object
rea.components.Component
All Implemented Interfaces:
Element
Direct Known Subclasses:
Place, Positionable

public abstract class Component extends Object implements Element
Abstract class common to all classes implementing the game map structure. Defines methods required by those classes and provides general methods.
Author:
José Paulo Leal jpleal@fc.up.pt
Implementation Note:
Corresponds to the Component in the Composite design pattern.
  • Field Details

    • visual

      Visual visual
      The visual representation of the component.
    • description

      String description
      The description of the component.
  • Constructor Details

    • Component

      public Component(Visual image, String description)
      Create a component.
      Parameters:
      image - visual representation of the component
      description - description of the component
  • Method Details

    • getVisual

      public Visual getVisual()
      Get the visual representation of the component.
      Returns:
      the visual representation of the component
    • getDescription

      public String getDescription()
      Get the description of the component.
      Returns:
      the description of the component
    • toString

      public String toString()
      Show component as a string using its description.
      Overrides:
      toString in class Object
      Returns:
      the description of the component