Package com.io7m.smfj.core
Class SMFHeader
- java.lang.Object
-
- com.io7m.smfj.core.SMFHeader
-
- All Implemented Interfaces:
SMFHeaderType
public final class SMFHeader extends java.lang.Object implements SMFHeaderType
Information about an SMF file.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSMFHeader.BuilderBuilds instances of typeSMFHeader.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.SortedMap<SMFAttributeName,SMFAttribute>attributesByName()java.util.List<SMFAttribute>attributesInOrder()static SMFHeader.Builderbuilder()Creates a builder forSMFHeader.SMFCoordinateSystemcoordinateSystem()static SMFHeadercopyOf(SMFHeaderType instance)Creates an immutable copy of aSMFHeaderTypevalue.java.nio.ByteOrderdataByteOrder()booleanequals(java.lang.Object another)This instance is equal to all instances ofSMFHeaderthat have equal attribute values.inthashCode()Computes a hash code from attributes:triangles,vertexCount,schemaIdentifier,coordinateSystem,dataByteOrder,attributesInOrder,attributesByName.static SMFHeaderof(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 immutableSMFHeaderinstance.static SMFHeaderof(SMFTriangles triangles, long vertexCount, java.util.Optional<SMFSchemaIdentifier> schemaIdentifier, SMFCoordinateSystem coordinateSystem, java.nio.ByteOrder dataByteOrder, java.util.List<SMFAttribute> attributesInOrder)Construct a new immutableSMFHeaderinstance.java.util.Optional<SMFSchemaIdentifier>schemaIdentifier()java.lang.StringtoString()Prints the immutable valueSMFHeaderwith attribute values.SMFTrianglestriangles()longvertexCount()SMFHeaderwithAttributesInOrder(SMFAttribute... elements)Copy the current immutable object with elements that replace the content ofattributesInOrder.SMFHeaderwithAttributesInOrder(java.lang.Iterable<? extends SMFAttribute> elements)Copy the current immutable object with elements that replace the content ofattributesInOrder.SMFHeaderwithCoordinateSystem(SMFCoordinateSystem value)Copy the current immutable object by setting a value for thecoordinateSystemattribute.SMFHeaderwithDataByteOrder(java.nio.ByteOrder value)Copy the current immutable object by setting a value for thedataByteOrderattribute.SMFHeaderwithSchemaIdentifier(SMFSchemaIdentifier value)Copy the current immutable object by setting a present value for the optionalschemaIdentifierattribute.SMFHeaderwithSchemaIdentifier(java.util.Optional<? extends SMFSchemaIdentifier> optional)Copy the current immutable object by setting an optional value for theschemaIdentifierattribute.SMFHeaderwithTriangles(SMFTriangles value)Copy the current immutable object by setting a value for thetrianglesattribute.SMFHeaderwithVertexCount(long value)Copy the current immutable object by setting a value for thevertexCountattribute.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.io7m.smfj.core.SMFHeaderType
checkPreconditions
-
-
-
-
Method Detail
-
triangles
public SMFTriangles triangles()
- Specified by:
trianglesin interfaceSMFHeaderType- Returns:
- The triangle information for the file
-
vertexCount
public long vertexCount()
- Specified by:
vertexCountin interfaceSMFHeaderType- Returns:
- The number of vertices in the file
-
schemaIdentifier
public java.util.Optional<SMFSchemaIdentifier> schemaIdentifier()
- Specified by:
schemaIdentifierin interfaceSMFHeaderType- Returns:
- The schema ID in the file
-
coordinateSystem
public SMFCoordinateSystem coordinateSystem()
- Specified by:
coordinateSystemin interfaceSMFHeaderType- Returns:
- The coordinate system of the mesh data
-
dataByteOrder
public java.nio.ByteOrder dataByteOrder()
- Specified by:
dataByteOrderin interfaceSMFHeaderType- Returns:
- The endianness of the mesh data
-
attributesInOrder
public java.util.List<SMFAttribute> attributesInOrder()
- Specified by:
attributesInOrderin interfaceSMFHeaderType- Returns:
- The attributes in the order that they appeared in the file
-
attributesByName
public java.util.SortedMap<SMFAttributeName,SMFAttribute> attributesByName()
- Specified by:
attributesByNamein interfaceSMFHeaderType- Returns:
- The attributes by name
-
withTriangles
public final SMFHeader withTriangles(SMFTriangles value)
Copy the current immutable object by setting a value for thetrianglesattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for triangles- Returns:
- A modified copy of the
thisobject
-
withVertexCount
public final SMFHeader withVertexCount(long value)
Copy the current immutable object by setting a value for thevertexCountattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for vertexCount- Returns:
- A modified copy of the
thisobject
-
withSchemaIdentifier
public final SMFHeader withSchemaIdentifier(SMFSchemaIdentifier value)
Copy the current immutable object by setting a present value for the optionalschemaIdentifierattribute.- Parameters:
value- The value for schemaIdentifier- Returns:
- A modified copy of
thisobject
-
withSchemaIdentifier
public final SMFHeader withSchemaIdentifier(java.util.Optional<? extends SMFSchemaIdentifier> optional)
Copy the current immutable object by setting an optional value for theschemaIdentifierattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for schemaIdentifier- Returns:
- A modified copy of
thisobject
-
withCoordinateSystem
public final SMFHeader withCoordinateSystem(SMFCoordinateSystem value)
Copy the current immutable object by setting a value for thecoordinateSystemattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for coordinateSystem- Returns:
- A modified copy of the
thisobject
-
withDataByteOrder
public final SMFHeader withDataByteOrder(java.nio.ByteOrder value)
Copy the current immutable object by setting a value for thedataByteOrderattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for dataByteOrder- Returns:
- A modified copy of the
thisobject
-
withAttributesInOrder
public final SMFHeader withAttributesInOrder(SMFAttribute... elements)
Copy the current immutable object with elements that replace the content ofattributesInOrder.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withAttributesInOrder
public final SMFHeader withAttributesInOrder(java.lang.Iterable<? extends SMFAttribute> elements)
Copy the current immutable object with elements that replace the content ofattributesInOrder. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of attributesInOrder elements to set- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofSMFHeaderthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:triangles,vertexCount,schemaIdentifier,coordinateSystem,dataByteOrder,attributesInOrder,attributesByName.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueSMFHeaderwith attribute values.- Overrides:
toStringin classjava.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 immutableSMFHeaderinstance.- Parameters:
triangles- The value for thetrianglesattributevertexCount- The value for thevertexCountattributeschemaIdentifier- The value for theschemaIdentifierattributecoordinateSystem- The value for thecoordinateSystemattributedataByteOrder- The value for thedataByteOrderattributeattributesInOrder- The value for theattributesInOrderattribute- 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 immutableSMFHeaderinstance.- Parameters:
triangles- The value for thetrianglesattributevertexCount- The value for thevertexCountattributeschemaIdentifier- The value for theschemaIdentifierattributecoordinateSystem- The value for thecoordinateSystemattributedataByteOrder- The value for thedataByteOrderattributeattributesInOrder- The value for theattributesInOrderattribute- Returns:
- An immutable SMFHeader instance
-
copyOf
public static SMFHeader copyOf(SMFHeaderType instance)
Creates an immutable copy of aSMFHeaderTypevalue. 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 forSMFHeader.SMFHeader.builder() .setTriangles(com.io7m.smfj.core.SMFTriangles) // optionaltriangles.setVertexCount(long) // optionalvertexCount.setSchemaIdentifier(SMFSchemaIdentifier) // optionalschemaIdentifier.setCoordinateSystem(com.io7m.smfj.core.SMFCoordinateSystem) // optionalcoordinateSystem.setDataByteOrder(java.nio.ByteOrder) // optionaldataByteOrder.addAttributesInOrder|addAllAttributesInOrder(SMFAttribute) //attributesInOrderelements .build();- Returns:
- A new SMFHeader builder
-
-