Record Class TechRequirement

java.lang.Object
java.lang.Record
net.chen.legacyLand.item.attribute.TechRequirement

public record TechRequirement(String lineId, int requiredTier) extends Record
物品科技需求:科技线 ID + 最低等级(tier)
  • Constructor Summary

    Constructors
    Constructor
    Description
    TechRequirement(String lineId, int requiredTier)
    Creates an instance of a TechRequirement record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    efficiencyRatio(int nationMaxTier)
    计算效能比例(0.0 ~ 1.0),不足时按比例降低
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    isMet(int nationMaxTier)
    检查国家已完成的节点中,指定科技线的最高 tier 是否满足需求
    Returns the value of the lineId record component.
    int
    Returns the value of the requiredTier record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

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

    • TechRequirement

      public TechRequirement(String lineId, int requiredTier)
      Creates an instance of a TechRequirement record class.
      Parameters:
      lineId - the value for the lineId record component
      requiredTier - the value for the requiredTier record component
  • Method Details

    • isMet

      public boolean isMet(int nationMaxTier)
      检查国家已完成的节点中,指定科技线的最高 tier 是否满足需求
      Parameters:
      nationMaxTier - 国家在该科技线上已达到的最高 tier
    • efficiencyRatio

      public double efficiencyRatio(int nationMaxTier)
      计算效能比例(0.0 ~ 1.0),不足时按比例降低
    • 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.
    • lineId

      public String lineId()
      Returns the value of the lineId record component.
      Returns:
      the value of the lineId record component
    • requiredTier

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