Package com.soebes.ip

Record Class IPv4Address

java.lang.Object
java.lang.Record
com.soebes.ip.IPv4Address

public record IPv4Address(int t1, int t2, int t3, int t4) extends Record
  • Constructor Summary

    Constructors
    Constructor
    Description
    IPv4Address(int t1, int t2, int t3, int t4)
    Creates an instance of a IPv4Address record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Indicates whether some other object is "equal to" this one.
    int
     
    final int
    Returns a hash code value for this object.
    int
     
    int
    t1()
    Returns the value of the t1 record component.
    int
    t2()
    Returns the value of the t2 record component.
    int
    t3()
    Returns the value of the t3 record component.
    int
    t4()
    Returns the value of the t4 record component.
    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

    • IPv4Address

      public IPv4Address(int t1, int t2, int t3, int t4)
      Creates an instance of a IPv4Address record class.
      Parameters:
      t1 - the value for the t1 record component
      t2 - the value for the t2 record component
      t3 - the value for the t3 record component
      t4 - the value for the t4 record component
  • Method Details

    • 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
    • equals

      public boolean equals(Object obj)
      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:
      obj - the object with which to compare
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • first16

      public int first16()
    • second16

      public int second16()
    • 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
    • t1

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

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

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

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