Record Class Document

java.lang.Object
java.lang.Record
it.unisa.diem.wordageddon_g16.models.Document
Record Components:
filename - nome del file associato al documento
title - titolo descrittivo del documento
wordCount - numero di parole contenute nel documento
All Implemented Interfaces:
Serializable

public record Document(String filename, String title, Integer wordCount) extends Record implements Serializable
Rappresenta un documento testuale nell'applicazione Wordageddon.

Ogni documento è identificato dal suo percorso (filename), ha un titolo e un conteggio di parole. Due documenti sono considerati uguali se condividono lo stesso percorso.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final String
    The field for the filename record component.
    private final String
    The field for the title record component.
    private final Integer
    The field for the wordCount record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Document(String filename, String title, Integer wordCount)
    Creates an instance of a Document record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Verifica se questo documento è uguale a un altro oggetto in base al percorso (filename).
    Restituisce il nome del file associato al documento.
    int
    Restituisce l'hash code del documento calcolato sul campo filename.
    Restituisce il titolo del documento.
    final String
    Returns a string representation of this record class.
    Restituisce il numero di parole contenute nel documento.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • filename

      private final String filename
      The field for the filename record component.
    • title

      private final String title
      The field for the title record component.
    • wordCount

      private final Integer wordCount
      The field for the wordCount record component.
  • Constructor Details

    • Document

      public Document(String filename, String title, Integer wordCount)
      Creates an instance of a Document record class.
      Parameters:
      filename - the value for the filename record component
      title - the value for the title record component
      wordCount - the value for the wordCount record component
  • Method Details

    • equals

      public boolean equals(Object o)
      Verifica se questo documento è uguale a un altro oggetto in base al percorso (filename).
      Specified by:
      equals in class Record
      Parameters:
      o - oggetto da confrontare
      Returns:
      true se i percorsi coincidono, false altrimenti
    • hashCode

      public int hashCode()
      Restituisce l'hash code del documento calcolato sul campo filename.
      Specified by:
      hashCode in class Record
      Returns:
      valore hash del percorso
    • title

      public String title()
      Restituisce il titolo del documento.
      Returns:
      titolo come String
    • filename

      public String filename()
      Restituisce il nome del file associato al documento.
      Returns:
      percorso del file come String
    • wordCount

      public Integer wordCount()
      Restituisce il numero di parole contenute nel documento.
      Returns:
      conteggio parole come Integer
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object