Class FlatInfo

Object
FlatInfo
All Implemented Interfaces:
CSVEncodable

public class FlatInfo extends Object implements CSVEncodable
Class representing information about a flat in the HDB project. This class implements the CSVEncodable interface to allow encoding of its data into a CSV format. The class contains information about the flat type, the number of remaining units, and the price of the flat.
  • Field Details

    • type

      private FlatType type
      Enum representing the type of flat.
    • remainingUnits

      private int remainingUnits
      The number of remaining units of the flat type.
    • price

      private int price
      The price of the flat type.
  • Constructor Details

    • FlatInfo

      FlatInfo(FlatType type, int remainingUnits, int price)
      Constructor to create a FlatInfo object with specified type, remaining units, and price.
      Parameters:
      type - the type of flat
      remainingUnits - the number of remaining units of the flat type
      price - the price of the flat type
  • Method Details

    • getType

      public FlatType getType()
      Returns the type of flat.
      Returns:
      the type of flat
    • getRemainingUnits

      public int getRemainingUnits()
      Returns the number of remaining units of the flat type.
      Returns:
      the number of remaining units
    • getPrice

      public int getPrice()
      Returns the price of the flat type.
      Returns:
      the price of the flat type
    • setType

      public void setType(FlatType type)
      Sets the type of flat.
      Parameters:
      type - the new type of flat
    • setRemainingUnits

      public void setRemainingUnits(int remainingUnits)
      Sets the number of remaining units of the flat type.
      Parameters:
      remainingUnits - the new number of remaining units
    • setPrice

      public void setPrice(int price)
      Sets the price of the flat type.
      Parameters:
      price - the new price of the flat type
    • encode

      public String encode()
      Encodes the FlatInfo object into a CSV format string. The format is: type,remainingUnits,price
      Specified by:
      encode in interface CSVEncodable
      Returns:
      the encoded CSV string representation of the FlatInfo object
    • sourceFileType

      public CSVFileTypes sourceFileType()
      Returns the type of the source file for this object. In this case, it returns null as FlatInfo does not have a specific source file type.
      Specified by:
      sourceFileType in interface CSVEncodable
      Returns:
      null