# Record Class ModernMaterialStore.ModernInventoryStats

java.lang.Object
java.lang.Record
com.university.bookstore.api.ModernMaterialStore.ModernInventoryStats

Record Components:
  `totalCount` - total number of materials
  `averagePrice` - average price of all materials
  `medianPrice` - median price of all materials
  `uniqueTypes` - number of unique material types
  `mediaCount` - number of media materials
  `printCount` - number of printed materials

Enclosing interface:
  `ModernMaterialStore`

public static record ModernMaterialStore.ModernInventoryStats(int totalCount, double averagePrice, double medianPrice, int uniqueTypes, int mediaCount, int printCount) extends Record
Modern InventoryStats using Java record for immutability. Records provide built-in equals(), hashCode(), and toString() methods.

Since:
  2024-09-15
Version:
  4.0
Author:
  Navid Mohaghegh

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ModernInventoryStats(int totalCount, double averagePrice, double medianPrice, int uniqueTypes, int mediaCount, int printCount)`
  Compact constructor for validation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `double`
  `averagePrice()`
  Returns the value of the `averagePrice` record component.
  `static ModernMaterialStore.ModernInventoryStats`
  `empty()`
  Creates an empty stats instance.
  `final boolean`
  `equals(Object o)`
  Indicates whether some other object is "equal to" this one.
  `double`
  `getMediaPercentage()`
  Gets the percentage of media materials.
  `double`
  `getPrintPercentage()`
  Gets the percentage of print materials.
  `String`
  `getSummary()`
  Creates a summary string for reporting.
  `final int`
  `hashCode()`
  Returns a hash code value for this object.
  `boolean`
  `isEmpty()`
  Checks if the inventory is empty.
  `int`
  `mediaCount()`
  Returns the value of the `mediaCount` record component.
  `double`
  `medianPrice()`
  Returns the value of the `medianPrice` record component.
  `int`
  `printCount()`
  Returns the value of the `printCount` record component.
  `final String`
  `toString()`
  Returns a string representation of this record class.
  `int`
  `totalCount()`
  Returns the value of the `totalCount` record component.
  `int`
  `uniqueTypes()`
  Returns the value of the `uniqueTypes` record component.

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### ModernInventoryStats

    public ModernInventoryStats(int totalCount, double averagePrice, double medianPrice, int uniqueTypes, int mediaCount, int printCount)
    Compact constructor for validation.

- ## Method Details

  - ### empty

    public static ModernMaterialStore.ModernInventoryStats empty()
    Creates an empty stats instance.
    Returns:
      stats with all zero values

  - ### isEmpty

    public boolean isEmpty()
    Checks if the inventory is empty.
    Returns:
      true if total count is zero

  - ### getMediaPercentage

    public double getMediaPercentage()
    Gets the percentage of media materials.
    Returns:
      media percentage (0-100)

  - ### getPrintPercentage

    public double getPrintPercentage()
    Gets the percentage of print materials.
    Returns:
      print percentage (0-100)

  - ### getSummary

    public String getSummary()
    Creates a summary string for reporting.
    Returns:
      formatted summary

  - ### 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

  - ### hashCode

    public final int hashCode()
    Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
    Specified by:
      `hashCode` in class `Record`
    Returns:
      a hash code value for this object

  - ### equals

    public final boolean equals(Object o)
    Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with the `compare` method from their corresponding wrapper classes.
    Specified by:
      `equals` in class `Record`
    Parameters:
      `o` - the object with which to compare
    Returns:
      `true` if this object is the same as the `o` argument; `false` otherwise.

  - ### totalCount

    public int totalCount()
    Returns the value of the `totalCount` record component.
    Returns:
      the value of the `totalCount` record component

  - ### averagePrice

    public double averagePrice()
    Returns the value of the `averagePrice` record component.
    Returns:
      the value of the `averagePrice` record component

  - ### medianPrice

    public double medianPrice()
    Returns the value of the `medianPrice` record component.
    Returns:
      the value of the `medianPrice` record component

  - ### uniqueTypes

    public int uniqueTypes()
    Returns the value of the `uniqueTypes` record component.
    Returns:
      the value of the `uniqueTypes` record component

  - ### mediaCount

    public int mediaCount()
    Returns the value of the `mediaCount` record component.
    Returns:
      the value of the `mediaCount` record component

  - ### printCount

    public int printCount()
    Returns the value of the `printCount` record component.
    Returns:
      the value of the `printCount` record component