Package com.io7m.jnoisetype.api
Class NTSource
java.lang.Object
com.io7m.jnoisetype.api.NTSource
- All Implemented Interfaces:
NTSourceType
A location in a binary file.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic NTSource.Builderbuilder()Creates a builder forNTSource.static NTSourcecopyOf(NTSourceType instance) Creates an immutable copy of aNTSourceTypevalue.booleanThis instance is equal to all instances ofNTSourcethat have equal attribute values.inthashCode()Computes a hash code from attributes:source,offset.static NTSourceConstruct a new immutableNTSourceinstance.longoffset()source()toString()Prints the immutable valueNTSourcewith attribute values.final NTSourcewithOffset(long value) Copy the current immutable object by setting a value for theoffsetattribute.final NTSourcewithSource(URI value) Copy the current immutable object by setting a value for thesourceattribute.
-
Method Details
-
source
- Specified by:
sourcein interfaceNTSourceType- Returns:
- The source URI
-
offset
public long offset()- Specified by:
offsetin interfaceNTSourceType- Returns:
- The source offset in octets
-
withSource
Copy the current immutable object by setting a value for thesourceattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for source- Returns:
- A modified copy of the
thisobject
-
withOffset
Copy the current immutable object by setting a value for theoffsetattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for offset- Returns:
- A modified copy of the
thisobject
-
equals
This instance is equal to all instances ofNTSourcethat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:source,offset. -
toString
Prints the immutable valueNTSourcewith attribute values. -
of
Construct a new immutableNTSourceinstance.- Parameters:
source- The value for thesourceattributeoffset- The value for theoffsetattribute- Returns:
- An immutable NTSource instance
-
copyOf
Creates an immutable copy of aNTSourceTypevalue. 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
Creates a builder forNTSource.NTSource.builder() .setSource(java.net.URI) // requiredsource.setOffset(long) // requiredoffset.build();- Returns:
- A new NTSource builder
-