Record Class BlockProperty.Range

java.lang.Object
java.lang.Record
fr.fidorial.world.block.BlockProperty.Range
Record Components:
name - the property name
min - the lowest value, 0 or more
max - the highest value, above min
All Implemented Interfaces:
BlockProperty<Integer>
Enclosing interface:
BlockProperty<T>

public static record BlockProperty.Range(String name, int min, int max) extends Record implements BlockProperty<Integer>
A property taking every integer from min to max.
Since:
0.1.0
  • Constructor Details

    • Range

      public Range(String name, int min, int max)
      Creates an instance of a Range record class.
      Parameters:
      name - the value for the name record component
      min - the value for the min record component
      max - the value for the max record component
  • Method Details

    • values

      public List<Integer> values()
      Description copied from interface: BlockProperty
      Returns the accepted values, at least two, in state order.
      Specified by:
      values in interface BlockProperty<Integer>
      Returns:
      the accepted values, at least two, in state order
    • indexOf

      public int indexOf(Integer value)
      Description copied from interface: BlockProperty
      Returns the position of a value in BlockProperty.values(), -1 if it is not accepted.
      Specified by:
      indexOf in interface BlockProperty<Integer>
      Parameters:
      value - the value
      Returns:
      the position of a value in BlockProperty.values(), -1 if it is not accepted
    • nameOf

      public String nameOf(Integer value)
      Description copied from interface: BlockProperty
      Returns the name a value is written as.
      Specified by:
      nameOf in interface BlockProperty<Integer>
      Parameters:
      value - an accepted value
      Returns:
      the name a value is written as
    • parse

      public @Nullable Integer parse(String name)
      Description copied from interface: BlockProperty
      Returns the value written as a name, null if none is.
      Specified by:
      parse in interface BlockProperty<Integer>
      Parameters:
      name - the written value
      Returns:
      the value written as a name, null if none is
    • 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.
    • name

      public String name()
      Returns the value of the name record component.
      Specified by:
      name in interface BlockProperty<Integer>
      Returns:
      the value of the name record component
    • min

      public int min()
      Returns the value of the min record component.
      Returns:
      the value of the min record component
    • max

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