Module syntaxnbt

Record Class SNBTParser.Range

java.lang.Object
java.lang.Record
at.syntaxerror.syntaxnbt.internal.SNBTParser.Range
Enclosing class:
SNBTParser

protected static record SNBTParser.Range(BigInteger min, BigInteger max, Function<BigInteger,Tag<?>> converter) extends Record
Range for an integer type
  • Constructor Details

    • Range

      protected Range(BigInteger min, BigInteger max, Function<BigInteger,Tag<?>> converter)
      Creates an instance of a Range record class.
      Parameters:
      min - the value for the min record component
      max - the value for the max record component
      converter - the value for the converter record component
  • Method Details

    • inRange

      protected boolean inRange(BigInteger number)
      Checks if a number lies within this range
      Parameters:
      number - a number
      Returns:
      whether a number lies within this range
    • convert

      protected Tag<?> convert(BigInteger number)
      Converts a number into an NBT Tag
      Parameters:
      number - a number
      Returns:
      the new NBT tag
    • 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 Objects::equals(Object,Object).
      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.
    • min

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

      public BigInteger max()
      Returns the value of the max record component.
      Returns:
      the value of the max record component
    • converter

      public Function<BigInteger,Tag<?>> converter()
      Returns the value of the converter record component.
      Returns:
      the value of the converter record component