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
-
Method Summary
Modifier and TypeMethodDescriptionstatic NTSource.Builder
builder()
Creates a builder forNTSource
.static NTSource
copyOf
(NTSourceType instance) Creates an immutable copy of aNTSourceType
value.boolean
This instance is equal to all instances ofNTSource
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:source
,offset
.static NTSource
Construct a new immutableNTSource
instance.long
offset()
source()
toString()
Prints the immutable valueNTSource
with attribute values.final NTSource
withOffset
(long value) Copy the current immutable object by setting a value for theoffset
attribute.final NTSource
withSource
(URI value) Copy the current immutable object by setting a value for thesource
attribute.
-
Method Details
-
source
- Specified by:
source
in interfaceNTSourceType
- Returns:
- The source URI
-
offset
public long offset()- Specified by:
offset
in interfaceNTSourceType
- Returns:
- The source offset in octets
-
withSource
Copy the current immutable object by setting a value for thesource
attribute. 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
this
object
-
withOffset
Copy the current immutable object by setting a value for theoffset
attribute. 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
this
object
-
equals
This instance is equal to all instances ofNTSource
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:source
,offset
. -
toString
Prints the immutable valueNTSource
with attribute values. -
of
Construct a new immutableNTSource
instance.- Parameters:
source
- The value for thesource
attributeoffset
- The value for theoffset
attribute- Returns:
- An immutable NTSource instance
-
copyOf
Creates an immutable copy of aNTSourceType
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
Creates a builder forNTSource
.NTSource.builder() .setSource(java.net.URI) // required
source
.setOffset(long) // requiredoffset
.build();- Returns:
- A new NTSource builder
-