Record Class PaintPlan

java.lang.Object
java.lang.Record
dev.despical.pixelpainter.image.PaintPlan
Record Components:
width - output columns
height - output rows
blocks - row-major block-data strings or null for transparent pixels
materials - selected material names and their pixel counts

public record PaintPlan(int width, int height, String[] blocks, Map<String,Integer> materials) extends Record
Stores prepared block data and material totals without a live world reference.

The block array is a row-major image, with row zero at the top. A null entry preserves the existing block. Construction and array access copy the array; the material-count map is copied and exposed as an unmodifiable view.

Plans are created by image workers and consumed by the server-thread painting service. Counts describe selected pixels rather than changes to terrain that may already match the selected material.

  • Constructor Summary

    Constructors
    Constructor
    Description
    PaintPlan(int width, int height, String[] blocks, Map<String,Integer> materials)
    Copies the output pixels and material counts before publication.
  • Method Summary

    Modifier and Type
    Method
    Description
    block(int index)
    Reads one selected block without copying the complete pixel array.
    Returns a defensive copy of the row-major pixel array.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the height record component.
    Returns the value of the materials record component.
    int
    Counts pixels that select a palette material.
    int
    Returns the complete output area, including transparent pixels.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the width record component.

    Methods inherited from class Object

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

    • PaintPlan

      public PaintPlan(int width, int height, String[] blocks, Map<String,Integer> materials)
      Copies the output pixels and material counts before publication.
  • Method Details

    • blocks

      public String[] blocks()
      Returns a defensive copy of the row-major pixel array.
      Returns:
      copied block-data strings, including null transparent entries
    • block

      public String block(int index)
      Reads one selected block without copying the complete pixel array.
      Parameters:
      index - row-major pixel index
      Returns:
      canonical block data, or null to preserve terrain
    • size

      public int size()
      Returns the complete output area, including transparent pixels.
      Returns:
      number of pixel slots
    • painted

      public int painted()
      Counts pixels that select a palette material.
      Returns:
      selected pixels, regardless of existing terrain
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components 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.
    • width

      public int width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • height

      public int height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • materials

      public Map<String,Integer> materials()
      Returns the value of the materials record component.
      Returns:
      the value of the materials record component