Record Class LevelRule.Dynamic

java.lang.Object
java.lang.Record
de.Keyle.MyPet.api.skill.skilltree.levelrule.LevelRule.Dynamic
Record Components:
modulo - match every this-many levels; values below 1 are raised to 1
start - first level to match; values below 1 are raised to 1
end - last level to match, or 0 for unbounded
All Implemented Interfaces:
LevelRule
Enclosing interface:
LevelRule

public static record LevelRule.Dynamic(int modulo, int start, int end) extends Record implements LevelRule
Matches levels by an "every modulo levels" pattern, optionally restricted to the inclusive range [start, end] (end == 0 means unbounded).
  • Nested Class Summary

    Nested classes/interfaces inherited from interface de.Keyle.MyPet.api.skill.skilltree.levelrule.LevelRule

    LevelRule.Dynamic, LevelRule.Static
  • Constructor Summary

    Constructors
    Constructor
    Description
    Dynamic(int modulo, int start, int end)
    Normalizes the bounds so a malformed skilltree cannot produce a rule that never matches.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    check(int level)
    Tests whether this rule matches the given level.
    int
    end()
    Returns the value of the end record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the priority used to order this rule relative to other rules that match the same level.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the modulo record component.
    int
    Returns the value of the start record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • Dynamic

      public Dynamic(int modulo, int start, int end)
      Normalizes the bounds so a malformed skilltree cannot produce a rule that never matches.
  • Method Details

    • check

      public boolean check(int level)
      Description copied from interface: LevelRule
      Tests whether this rule matches the given level.
      Specified by:
      check in interface LevelRule
      Parameters:
      level - the pet's current level (1-based)
      Returns:
      true if the associated upgrade/notification should activate
    • getPriority

      public int getPriority()
      Description copied from interface: LevelRule
      Returns the priority used to order this rule relative to other rules that match the same level. Lower values execute first.
      Specified by:
      getPriority in interface LevelRule
      Returns:
      the ordering priority
    • 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 '=='.
      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.
    • modulo

      public int modulo()
      Returns the value of the modulo record component.
      Returns:
      the value of the modulo record component
    • start

      public int start()
      Returns the value of the start record component.
      Returns:
      the value of the start record component
    • end

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