Package com.io7m.smfj.core
Class SMFTriangles
- java.lang.Object
-
- com.io7m.smfj.core.SMFTriangles
-
- All Implemented Interfaces:
SMFTrianglesType
public final class SMFTriangles extends java.lang.Object implements SMFTrianglesType
Information about triangles in a mesh.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SMFTriangles.Builder
Builds instances of typeSMFTriangles
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SMFTriangles.Builder
builder()
Creates a builder forSMFTriangles
.static SMFTriangles
copyOf(SMFTrianglesType instance)
Creates an immutable copy of aSMFTrianglesType
value.boolean
equals(java.lang.Object another)
This instance is equal to all instances ofSMFTriangles
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:triangleCount
,triangleIndexSizeBits
,triangleIndexSizeOctets
,triangleSizeOctets
.static SMFTriangles
of(long triangleCount, int triangleIndexSizeBits)
Construct a new immutableSMFTriangles
instance.java.lang.String
toString()
Prints the immutable valueSMFTriangles
with attribute values.long
triangleCount()
int
triangleIndexSizeBits()
int
triangleIndexSizeOctets()
int
triangleSizeOctets()
SMFTriangles
withTriangleCount(long value)
Copy the current immutable object by setting a value for thetriangleCount
attribute.SMFTriangles
withTriangleIndexSizeBits(int value)
Copy the current immutable object by setting a value for thetriangleIndexSizeBits
attribute.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.io7m.smfj.core.SMFTrianglesType
checkPreconditions
-
-
-
-
Method Detail
-
triangleCount
public long triangleCount()
- Specified by:
triangleCount
in interfaceSMFTrianglesType
- Returns:
- The number of triangles in the file
-
triangleIndexSizeBits
public int triangleIndexSizeBits()
- Specified by:
triangleIndexSizeBits
in interfaceSMFTrianglesType
- Returns:
- The size in bits of each triangle index
-
triangleIndexSizeOctets
public int triangleIndexSizeOctets()
- Specified by:
triangleIndexSizeOctets
in interfaceSMFTrianglesType
- Returns:
- The size in octets of each triangle index
-
triangleSizeOctets
public int triangleSizeOctets()
- Specified by:
triangleSizeOctets
in interfaceSMFTrianglesType
- Returns:
- The size in octets of each triangle
-
withTriangleCount
public final SMFTriangles withTriangleCount(long value)
Copy the current immutable object by setting a value for thetriangleCount
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for triangleCount- Returns:
- A modified copy of the
this
object
-
withTriangleIndexSizeBits
public final SMFTriangles withTriangleIndexSizeBits(int value)
Copy the current immutable object by setting a value for thetriangleIndexSizeBits
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for triangleIndexSizeBits- Returns:
- A modified copy of the
this
object
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofSMFTriangles
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:triangleCount
,triangleIndexSizeBits
,triangleIndexSizeOctets
,triangleSizeOctets
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueSMFTriangles
with attribute values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of the value
-
of
public static SMFTriangles of(long triangleCount, int triangleIndexSizeBits)
Construct a new immutableSMFTriangles
instance.- Parameters:
triangleCount
- The value for thetriangleCount
attributetriangleIndexSizeBits
- The value for thetriangleIndexSizeBits
attribute- Returns:
- An immutable SMFTriangles instance
-
copyOf
public static SMFTriangles copyOf(SMFTrianglesType instance)
Creates an immutable copy of aSMFTrianglesType
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 SMFTriangles instance
-
builder
public static SMFTriangles.Builder builder()
Creates a builder forSMFTriangles
.SMFTriangles.builder() .setTriangleCount(long) // optional
triangleCount
.setTriangleIndexSizeBits(int) // optionaltriangleIndexSizeBits
.build();- Returns:
- A new SMFTriangles builder
-
-