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 classSMFMemoryMesh.BuilderBuilds 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.Builderbuilder()Creates a builder forSMFMemoryMesh.static SMFMemoryMeshcopyOf(SMFMemoryMeshType instance)Creates an immutable copy of aSMFMemoryMeshTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofSMFMemoryMeshthat have equal attribute values.inthashCode()Computes a hash code from attributes:header,arrays,metadata,triangles.SMFHeaderheader()java.util.List<SMFMetadata>metadata()static SMFMemoryMeshof(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 immutableSMFMemoryMeshinstance.static SMFMemoryMeshof(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 immutableSMFMemoryMeshinstance.java.lang.StringtoString()Prints the immutable valueSMFMemoryMeshwith attribute values.java.util.List<com.io7m.jtensors.core.unparameterized.vectors.Vector3L>triangles()SMFMemoryMeshwithArrays(java.util.Map<? extends SMFAttributeName,? extends SMFAttributeArrayType> entries)Copy the current immutable object by replacing thearraysmap with the specified map.SMFMemoryMeshwithHeader(SMFHeader value)Copy the current immutable object by setting a value for theheaderattribute.SMFMemoryMeshwithMetadata(SMFMetadata... elements)Copy the current immutable object with elements that replace the content ofmetadata.SMFMemoryMeshwithMetadata(java.lang.Iterable<? extends SMFMetadata> elements)Copy the current immutable object with elements that replace the content ofmetadata.SMFMemoryMeshwithTriangles(com.io7m.jtensors.core.unparameterized.vectors.Vector3L... elements)Copy the current immutable object with elements that replace the content oftriangles.SMFMemoryMeshwithTriangles(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:
headerin interfaceSMFMemoryMeshType- Returns:
- The mesh header
-
arrays
public java.util.Map<SMFAttributeName,SMFAttributeArrayType> arrays()
- Specified by:
arraysin interfaceSMFMemoryMeshType- Returns:
- The mesh attribute arrays
-
metadata
public java.util.List<SMFMetadata> metadata()
- Specified by:
metadatain interfaceSMFMemoryMeshType- Returns:
- The parsed metadata
-
triangles
public java.util.List<com.io7m.jtensors.core.unparameterized.vectors.Vector3L> triangles()
- Specified by:
trianglesin interfaceSMFMemoryMeshType- Returns:
- The triangles
-
withHeader
public final SMFMemoryMesh withHeader(SMFHeader value)
Copy the current immutable object by setting a value for theheaderattribute. 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
thisobject
-
withArrays
public final SMFMemoryMesh withArrays(java.util.Map<? extends SMFAttributeName,? extends SMFAttributeArrayType> entries)
Copy the current immutable object by replacing thearraysmap 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
thisobject
-
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
thisobject
-
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
thisobject
-
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
thisobject
-
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
thisobject
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofSMFMemoryMeshthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:header,arrays,metadata,triangles.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueSMFMemoryMeshwith attribute values.- Overrides:
toStringin 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 immutableSMFMemoryMeshinstance.- Parameters:
header- The value for theheaderattributearrays- The value for thearraysattributemetadata- The value for themetadataattributetriangles- The value for thetrianglesattribute- 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 immutableSMFMemoryMeshinstance.- Parameters:
header- The value for theheaderattributearrays- The value for thearraysattributemetadata- The value for themetadataattributetriangles- The value for thetrianglesattribute- Returns:
- An immutable SMFMemoryMesh instance
-
copyOf
public static SMFMemoryMesh copyOf(SMFMemoryMeshType instance)
Creates an immutable copy of aSMFMemoryMeshTypevalue. 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) // requiredheader.putArrays|putAllArrays(com.io7m.smfj.core.SMFAttributeName => com.io7m.smfj.processing.api.SMFAttributeArrayType) //arraysmappings .addMetadata|addAllMetadata(SMFMetadata) //metadataelements .addTriangles|addAllTriangles(com.io7m.jtensors.core.unparameterized.vectors.Vector3L) //triangleselements .build();- Returns:
- A new SMFMemoryMesh builder
-
-