Record Class VarbitRead

java.lang.Object
java.lang.Record
com.botwithus.bot.api.model.VarbitRead
Record Components:
id - the varbit id
state - the state of the varbit's base variable
value - the decoded bits, or -1 when there is no value
defaultVerified - as VarpRead.defaultVerified(), for the base variable

public record VarbitRead(int id, VarpState state, int value, boolean defaultVerified) extends Record
One varbit read. A varbit is a bit range of a base variable, so its state is the base's state: SET decodes the stored base, DEFAULT_NOT_SET_CLIENTSIDE decodes the base's type default (which is what the game reads, and for a varp whose default is -1 that means every bit of the range is set), and the other two states carry -1.

NO_SUCH_VARP covers both an unknown varbit id and a varbit whose base varp does not exist.

  • Constructor Summary

    Constructors
    Constructor
    Description
    VarbitRead(int id, VarpState state, int value, boolean defaultVerified)
    Creates an instance of a VarbitRead record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of the defaultVerified record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    True when value() is what the game reads.
    int
    id()
    Returns the value of the id record component.
    Returns the value of the state record component.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the value record component.

    Methods inherited from class Object

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

    • VarbitRead

      public VarbitRead(int id, VarpState state, int value, boolean defaultVerified)
      Creates an instance of a VarbitRead record class.
      Parameters:
      id - the value for the id record component
      state - the value for the state record component
      value - the value for the value record component
      defaultVerified - the value for the defaultVerified record component
  • Method Details

    • hasValue

      public boolean hasValue()
      True when value() is what the game reads.
    • 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.
    • id

      public int id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • state

      public VarpState state()
      Returns the value of the state record component.
      Returns:
      the value of the state record component
    • value

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

      public boolean defaultVerified()
      Returns the value of the defaultVerified record component.
      Returns:
      the value of the defaultVerified record component