Class NTSource

  • All Implemented Interfaces:
    NTSourceType

    public final class NTSource
    extends java.lang.Object
    implements NTSourceType
    A location in a binary file.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  NTSource.Builder
      Builds instances of type NTSource.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static NTSource.Builder builder()
      Creates a builder for NTSource.
      static NTSource copyOf​(NTSourceType instance)
      Creates an immutable copy of a NTSourceType value.
      boolean equals​(java.lang.Object another)
      This instance is equal to all instances of NTSource that have equal attribute values.
      int hashCode()
      Computes a hash code from attributes: source, offset.
      static NTSource of​(java.net.URI source, long offset)
      Construct a new immutable NTSource instance.
      long offset()  
      java.net.URI source()  
      java.lang.String toString()
      Prints the immutable value NTSource with attribute values.
      NTSource withOffset​(long value)
      Copy the current immutable object by setting a value for the offset attribute.
      NTSource withSource​(java.net.URI value)
      Copy the current immutable object by setting a value for the source attribute.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • source

        public java.net.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​(java.net.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​(java.lang.Object another)
        This instance is equal to all instances of NTSource that have equal attribute values.
        Overrides:
        equals in class java.lang.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 java.lang.Object
        Returns:
        hashCode value
      • toString

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

        public static NTSource of​(java.net.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