Record Class Weight

java.lang.Object
java.lang.Record
com.ibm.wala.analysis.arraybounds.hypergraph.weight.Weight

public record Weight(Weight.Type type, int number) extends Record
A weight may be not set, a number or unlimited, note that the meaning of unlimited is given by the chosen order (see NormalOrder and ReverseOrder).
Author:
Stephan Gocht <stephan@gobro.de>
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Weight
     
    static final Weight
     
    static final Weight
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Weight(int number)
     
    Weight(Weight.Type type, int number)
    Creates an instance of a Weight record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Weight other)
    Returns this + other.
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use number() instead
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use type() instead
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the number record component.
    Returns a string representation of this record class.
    Returns the value of the type record component.

    Methods inherited from class Object

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

    • UNLIMITED

      public static final Weight UNLIMITED
    • NOT_SET

      public static final Weight NOT_SET
    • ZERO

      public static final Weight ZERO
  • Constructor Details

    • Weight

      public Weight(int number)
    • Weight

      public Weight(Weight.Type type, int number)
      Creates an instance of a Weight record class.
      Parameters:
      type - the value for the type record component
      number - the value for the number record component
  • Method Details

    • add

      public Weight add(Weight other)
      Returns this + other. If this is not Number this will be returned, if other is not number other will be returned
      Returns:
      this + other
    • getNumber

      @Deprecated(forRemoval=true, since="1.8.0") public int getNumber()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use number() instead
    • getType

      @Deprecated(forRemoval=true, since="1.8.0") public Weight.Type getType()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use type() instead
    • toString

      public 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.
    • type

      public Weight.Type type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • number

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