Class SMFMemoryMesh

  • All Implemented Interfaces:
    SMFMemoryMeshType

    public final class SMFMemoryMesh
    extends java.lang.Object
    implements SMFMemoryMeshType
    An immutable in-memory copy of a mesh.
    • Method Detail

      • triangles

        public java.util.List<com.io7m.jtensors.core.unparameterized.vectors.Vector3L> triangles()
        Specified by:
        triangles in interface SMFMemoryMeshType
        Returns:
        The triangles
      • withHeader

        public final SMFMemoryMesh withHeader​(SMFHeader value)
        Copy the current immutable object by setting a value for the header attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        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 the arrays 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 returning this.
        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 of metadata.
        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 of metadata. A shallow reference equality check is used to prevent copying of the same value by returning this.
        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 of triangles.
        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 of triangles. A shallow reference equality check is used to prevent copying of the same value by returning this.
        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 of SMFMemoryMesh 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: header, arrays, metadata, triangles.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hashCode value
      • toString

        public java.lang.String toString()
        Prints the immutable value SMFMemoryMesh with attribute values.
        Overrides:
        toString in class java.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 immutable SMFMemoryMesh instance.
        Parameters:
        header - The value for the header attribute
        arrays - The value for the arrays attribute
        metadata - The value for the metadata attribute
        triangles - The value for the triangles 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 immutable SMFMemoryMesh instance.
        Parameters:
        header - The value for the header attribute
        arrays - The value for the arrays attribute
        metadata - The value for the metadata attribute
        triangles - The value for the triangles attribute
        Returns:
        An immutable SMFMemoryMesh instance
      • copyOf

        public static SMFMemoryMesh copyOf​(SMFMemoryMeshType instance)
        Creates an immutable copy of a SMFMemoryMeshType 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 for SMFMemoryMesh.
         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