Class SMFHeader

  • All Implemented Interfaces:
    SMFHeaderType

    public final class SMFHeader
    extends java.lang.Object
    implements SMFHeaderType
    Information about an SMF file.
    • Method Detail

      • vertexCount

        public long vertexCount()
        Specified by:
        vertexCount in interface SMFHeaderType
        Returns:
        The number of vertices in the file
      • dataByteOrder

        public java.nio.ByteOrder dataByteOrder()
        Specified by:
        dataByteOrder in interface SMFHeaderType
        Returns:
        The endianness of the mesh data
      • withTriangles

        public final SMFHeader withTriangles​(SMFTriangles value)
        Copy the current immutable object by setting a value for the triangles attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for triangles
        Returns:
        A modified copy of the this object
      • withVertexCount

        public final SMFHeader withVertexCount​(long value)
        Copy the current immutable object by setting a value for the vertexCount attribute. A value equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for vertexCount
        Returns:
        A modified copy of the this object
      • withSchemaIdentifier

        public final SMFHeader withSchemaIdentifier​(SMFSchemaIdentifier value)
        Copy the current immutable object by setting a present value for the optional schemaIdentifier attribute.
        Parameters:
        value - The value for schemaIdentifier
        Returns:
        A modified copy of this object
      • withSchemaIdentifier

        public final SMFHeader withSchemaIdentifier​(java.util.Optional<? extends SMFSchemaIdentifier> optional)
        Copy the current immutable object by setting an optional value for the schemaIdentifier attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for schemaIdentifier
        Returns:
        A modified copy of this object
      • withCoordinateSystem

        public final SMFHeader withCoordinateSystem​(SMFCoordinateSystem value)
        Copy the current immutable object by setting a value for the coordinateSystem attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for coordinateSystem
        Returns:
        A modified copy of the this object
      • withDataByteOrder

        public final SMFHeader withDataByteOrder​(java.nio.ByteOrder value)
        Copy the current immutable object by setting a value for the dataByteOrder attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for dataByteOrder
        Returns:
        A modified copy of the this object
      • withAttributesInOrder

        public final SMFHeader withAttributesInOrder​(SMFAttribute... elements)
        Copy the current immutable object with elements that replace the content of attributesInOrder.
        Parameters:
        elements - The elements to set
        Returns:
        A modified copy of this object
      • withAttributesInOrder

        public final SMFHeader withAttributesInOrder​(java.lang.Iterable<? extends SMFAttribute> elements)
        Copy the current immutable object with elements that replace the content of attributesInOrder. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        elements - An iterable of attributesInOrder 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 SMFHeader 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: triangles, vertexCount, schemaIdentifier, coordinateSystem, dataByteOrder, attributesInOrder, attributesByName.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hashCode value
      • toString

        public java.lang.String toString()
        Prints the immutable value SMFHeader with attribute values.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of the value
      • of

        public static SMFHeader of​(SMFTriangles triangles,
                                   long vertexCount,
                                   java.util.Optional<SMFSchemaIdentifier> schemaIdentifier,
                                   SMFCoordinateSystem coordinateSystem,
                                   java.nio.ByteOrder dataByteOrder,
                                   java.util.List<SMFAttribute> attributesInOrder)
        Construct a new immutable SMFHeader instance.
        Parameters:
        triangles - The value for the triangles attribute
        vertexCount - The value for the vertexCount attribute
        schemaIdentifier - The value for the schemaIdentifier attribute
        coordinateSystem - The value for the coordinateSystem attribute
        dataByteOrder - The value for the dataByteOrder attribute
        attributesInOrder - The value for the attributesInOrder attribute
        Returns:
        An immutable SMFHeader instance
      • of

        public static SMFHeader of​(SMFTriangles triangles,
                                   long vertexCount,
                                   java.util.Optional<? extends SMFSchemaIdentifier> schemaIdentifier,
                                   SMFCoordinateSystem coordinateSystem,
                                   java.nio.ByteOrder dataByteOrder,
                                   java.lang.Iterable<? extends SMFAttribute> attributesInOrder)
        Construct a new immutable SMFHeader instance.
        Parameters:
        triangles - The value for the triangles attribute
        vertexCount - The value for the vertexCount attribute
        schemaIdentifier - The value for the schemaIdentifier attribute
        coordinateSystem - The value for the coordinateSystem attribute
        dataByteOrder - The value for the dataByteOrder attribute
        attributesInOrder - The value for the attributesInOrder attribute
        Returns:
        An immutable SMFHeader instance
      • copyOf

        public static SMFHeader copyOf​(SMFHeaderType instance)
        Creates an immutable copy of a SMFHeaderType 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 SMFHeader instance
      • builder

        public static SMFHeader.Builder builder()
        Creates a builder for SMFHeader.
         SMFHeader.builder()
            .setTriangles(com.io7m.smfj.core.SMFTriangles) // optional triangles
            .setVertexCount(long) // optional vertexCount
            .setSchemaIdentifier(SMFSchemaIdentifier) // optional schemaIdentifier
            .setCoordinateSystem(com.io7m.smfj.core.SMFCoordinateSystem) // optional coordinateSystem
            .setDataByteOrder(java.nio.ByteOrder) // optional dataByteOrder
            .addAttributesInOrder|addAllAttributesInOrder(SMFAttribute) // attributesInOrder elements
            .build();
         
        Returns:
        A new SMFHeader builder