Package com.io7m.smfj.processing.api
Class SMFMemoryMesh
- java.lang.Object
-
- com.io7m.smfj.processing.api.SMFMemoryMesh
-
- All Implemented Interfaces:
SMFMemoryMeshType
public final class SMFMemoryMesh extends java.lang.Object implements SMFMemoryMeshType
An immutable in-memory copy of a mesh.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SMFMemoryMesh.Builder
Builds instances of typeSMFMemoryMesh
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<SMFAttributeName,SMFAttributeArrayType>
arrays()
static SMFMemoryMesh.Builder
builder()
Creates a builder forSMFMemoryMesh
.static SMFMemoryMesh
copyOf(SMFMemoryMeshType instance)
Creates an immutable copy of aSMFMemoryMeshType
value.boolean
equals(java.lang.Object another)
This instance is equal to all instances ofSMFMemoryMesh
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:header
,arrays
,metadata
,triangles
.SMFHeader
header()
java.util.List<SMFMetadata>
metadata()
static SMFMemoryMesh
of(SMFHeader header, java.util.Map<? extends SMFAttributeName,? extends SMFAttributeArrayType> arrays, java.lang.Iterable<? extends SMFMetadata> metadata, java.lang.Iterable<? extends com.io7m.jtensors.core.unparameterized.vectors.Vector3L> triangles)
Construct a new immutableSMFMemoryMesh
instance.static SMFMemoryMesh
of(SMFHeader header, java.util.Map<SMFAttributeName,SMFAttributeArrayType> arrays, java.util.List<SMFMetadata> metadata, java.util.List<com.io7m.jtensors.core.unparameterized.vectors.Vector3L> triangles)
Construct a new immutableSMFMemoryMesh
instance.java.lang.String
toString()
Prints the immutable valueSMFMemoryMesh
with attribute values.java.util.List<com.io7m.jtensors.core.unparameterized.vectors.Vector3L>
triangles()
SMFMemoryMesh
withArrays(java.util.Map<? extends SMFAttributeName,? extends SMFAttributeArrayType> entries)
Copy the current immutable object by replacing thearrays
map with the specified map.SMFMemoryMesh
withHeader(SMFHeader value)
Copy the current immutable object by setting a value for theheader
attribute.SMFMemoryMesh
withMetadata(SMFMetadata... elements)
Copy the current immutable object with elements that replace the content ofmetadata
.SMFMemoryMesh
withMetadata(java.lang.Iterable<? extends SMFMetadata> elements)
Copy the current immutable object with elements that replace the content ofmetadata
.SMFMemoryMesh
withTriangles(com.io7m.jtensors.core.unparameterized.vectors.Vector3L... elements)
Copy the current immutable object with elements that replace the content oftriangles
.SMFMemoryMesh
withTriangles(java.lang.Iterable<? extends com.io7m.jtensors.core.unparameterized.vectors.Vector3L> elements)
Copy the current immutable object with elements that replace the content oftriangles
.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.io7m.smfj.processing.api.SMFMemoryMeshType
checkPreconditions
-
-
-
-
Method Detail
-
header
public SMFHeader header()
- Specified by:
header
in interfaceSMFMemoryMeshType
- Returns:
- The mesh header
-
arrays
public java.util.Map<SMFAttributeName,SMFAttributeArrayType> arrays()
- Specified by:
arrays
in interfaceSMFMemoryMeshType
- Returns:
- The mesh attribute arrays
-
metadata
public java.util.List<SMFMetadata> metadata()
- Specified by:
metadata
in interfaceSMFMemoryMeshType
- Returns:
- The parsed metadata
-
triangles
public java.util.List<com.io7m.jtensors.core.unparameterized.vectors.Vector3L> triangles()
- Specified by:
triangles
in interfaceSMFMemoryMeshType
- Returns:
- The triangles
-
withHeader
public final SMFMemoryMesh withHeader(SMFHeader value)
Copy the current immutable object by setting a value for theheader
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for header- Returns:
- A modified copy of the
this
object
-
withArrays
public final SMFMemoryMesh withArrays(java.util.Map<? extends SMFAttributeName,? extends SMFAttributeArrayType> entries)
Copy the current immutable object by replacing thearrays
map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
entries
- The entries to be added to the arrays map- Returns:
- A modified copy of
this
object
-
withMetadata
public final SMFMemoryMesh withMetadata(SMFMetadata... elements)
Copy the current immutable object with elements that replace the content ofmetadata
.- Parameters:
elements
- The elements to set- Returns:
- A modified copy of
this
object
-
withMetadata
public final SMFMemoryMesh withMetadata(java.lang.Iterable<? extends SMFMetadata> elements)
Copy the current immutable object with elements that replace the content ofmetadata
. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
elements
- An iterable of metadata elements to set- Returns:
- A modified copy of
this
object
-
withTriangles
public final SMFMemoryMesh withTriangles(com.io7m.jtensors.core.unparameterized.vectors.Vector3L... elements)
Copy the current immutable object with elements that replace the content oftriangles
.- Parameters:
elements
- The elements to set- Returns:
- A modified copy of
this
object
-
withTriangles
public final SMFMemoryMesh withTriangles(java.lang.Iterable<? extends com.io7m.jtensors.core.unparameterized.vectors.Vector3L> elements)
Copy the current immutable object with elements that replace the content oftriangles
. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
elements
- An iterable of triangles elements to set- Returns:
- A modified copy of
this
object
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofSMFMemoryMesh
that have equal attribute values.- Overrides:
equals
in classjava.lang.Object
- Returns:
true
ifthis
is equal toanother
instance
-
hashCode
public int hashCode()
Computes a hash code from attributes:header
,arrays
,metadata
,triangles
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueSMFMemoryMesh
with attribute values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of the value
-
of
public static SMFMemoryMesh of(SMFHeader header, java.util.Map<SMFAttributeName,SMFAttributeArrayType> arrays, java.util.List<SMFMetadata> metadata, java.util.List<com.io7m.jtensors.core.unparameterized.vectors.Vector3L> triangles)
Construct a new immutableSMFMemoryMesh
instance.- Parameters:
header
- The value for theheader
attributearrays
- The value for thearrays
attributemetadata
- The value for themetadata
attributetriangles
- The value for thetriangles
attribute- Returns:
- An immutable SMFMemoryMesh instance
-
of
public static SMFMemoryMesh of(SMFHeader header, java.util.Map<? extends SMFAttributeName,? extends SMFAttributeArrayType> arrays, java.lang.Iterable<? extends SMFMetadata> metadata, java.lang.Iterable<? extends com.io7m.jtensors.core.unparameterized.vectors.Vector3L> triangles)
Construct a new immutableSMFMemoryMesh
instance.- Parameters:
header
- The value for theheader
attributearrays
- The value for thearrays
attributemetadata
- The value for themetadata
attributetriangles
- The value for thetriangles
attribute- Returns:
- An immutable SMFMemoryMesh instance
-
copyOf
public static SMFMemoryMesh copyOf(SMFMemoryMeshType instance)
Creates an immutable copy of aSMFMemoryMeshType
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 SMFMemoryMesh instance
-
builder
public static SMFMemoryMesh.Builder builder()
Creates a builder forSMFMemoryMesh
.SMFMemoryMesh.builder() .setHeader(com.io7m.smfj.core.SMFHeader) // required
header
.putArrays|putAllArrays(com.io7m.smfj.core.SMFAttributeName => com.io7m.smfj.processing.api.SMFAttributeArrayType) //arrays
mappings .addMetadata|addAllMetadata(SMFMetadata) //metadata
elements .addTriangles|addAllTriangles(com.io7m.jtensors.core.unparameterized.vectors.Vector3L) //triangles
elements .build();- Returns:
- A new SMFMemoryMesh builder
-
-