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 1start- first level to match; values below 1 are raised to 1end- 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
ConstructorsConstructorDescriptionDynamic(int modulo, int start, int end) Normalizes the bounds so a malformed skilltree cannot produce a rule that never matches. -
Method Summary
Modifier and TypeMethodDescriptionbooleancheck(int level) Tests whether this rule matches the given level.intend()Returns the value of theendrecord component.final booleanIndicates whether some other object is "equal to" this one.intReturns the priority used to order this rule relative to other rules that match the same level.final inthashCode()Returns a hash code value for this object.intmodulo()Returns the value of themodulorecord component.intstart()Returns the value of thestartrecord component.final StringtoString()Returns a string representation of this record class.
-
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:LevelRuleTests whether this rule matches the given level. -
getPriority
public int getPriority()Description copied from interface:LevelRuleReturns the priority used to order this rule relative to other rules that match the same level. Lower values execute first.- Specified by:
getPriorityin interfaceLevelRule- Returns:
- the ordering priority
-
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. -
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. -
equals
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 '=='. -
modulo
public int modulo()Returns the value of themodulorecord component.- Returns:
- the value of the
modulorecord component
-
start
public int start()Returns the value of thestartrecord component.- Returns:
- the value of the
startrecord component
-
end
public int end()Returns the value of theendrecord component.- Returns:
- the value of the
endrecord component
-