Class NTSource

java.lang.Object
com.io7m.jnoisetype.api.NTSource
All Implemented Interfaces:
NTSourceType

public final class NTSource extends Object implements NTSourceType
A location in a binary file.
  • Method Details

    • source

      public URI source()
      Specified by:
      source in interface NTSourceType
      Returns:
      The source URI
    • offset

      public long offset()
      Specified by:
      offset in interface NTSourceType
      Returns:
      The source offset in octets
    • withSource

      public final NTSource withSource(URI value)
      Copy the current immutable object by setting a value for the source attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for source
      Returns:
      A modified copy of the this object
    • withOffset

      public final NTSource withOffset(long value)
      Copy the current immutable object by setting a value for the offset attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for offset
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of NTSource that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: source, offset.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value NTSource with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

      public static NTSource of(URI source, long offset)
      Construct a new immutable NTSource instance.
      Parameters:
      source - The value for the source attribute
      offset - The value for the offset attribute
      Returns:
      An immutable NTSource instance
    • copyOf

      public static NTSource copyOf(NTSourceType instance)
      Creates an immutable copy of a NTSourceType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable NTSource instance
    • builder

      public static NTSource.Builder builder()
      Creates a builder for NTSource.
       NTSource.builder()
          .setSource(java.net.URI) // required source
          .setOffset(long) // required offset
          .build();
       
      Returns:
      A new NTSource builder