/** * Builds a new {@link SMFCoordinateSystem SMFCoordinateSystem}. * @return An immutable instance of SMFCoordinateSystem * @throws java.lang.IllegalStateException if any required attributes are missing */ public SMFCoordinateSystem build() { return new SMFCoordinateSystem(this); } }
/** * This instance is equal to all instances of {@code SMFCoordinateSystem} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(Object another) { if (this == another) return true; return another instanceof SMFCoordinateSystem && equalTo((SMFCoordinateSystem) another); }
/** * Creates an immutable copy of a {@link SMFCoordinateSystemType} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable SMFCoordinateSystem instance */ public static SMFCoordinateSystem copyOf(SMFCoordinateSystemType instance) { if (instance instanceof SMFCoordinateSystem) { return (SMFCoordinateSystem) instance; } return SMFCoordinateSystem.builder() .from(instance) .build(); }
private boolean equalTo(SMFHeader another) { return triangles.equals(another.triangles) && vertexCount == another.vertexCount && Objects.equals(schemaIdentifier, another.schemaIdentifier) && coordinateSystem.equals(another.coordinateSystem) && this.attributesInOrder().equals(another.attributesInOrder()) && attributesByName.equals(another.attributesByName); }
/** * Computes a hash code from attributes: {@code triangles}, {@code vertexCount}, {@code schemaIdentifier}, {@code coordinateSystem}, {@code attributesInOrder}, {@code attributesByName}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + triangles.hashCode(); h += (h << 5) + Long.hashCode(vertexCount); h += (h << 5) + Objects.hashCode(schemaIdentifier); h += (h << 5) + coordinateSystem.hashCode(); h += (h << 5) + (attributesInOrder().hashCode()); h += (h << 5) + attributesByName.hashCode(); return h; }
private static SMFSchemaValidationError errorWrongCoordinateSystem( final SMFCoordinateSystem expected, final SMFCoordinateSystem received) { final StringBuilder sb = new StringBuilder(128); sb.append("The mesh has an unexpected coordinate system."); sb.append(System.lineSeparator()); sb.append(" Expected: "); sb.append(expected.toHumanString()); sb.append(System.lineSeparator()); sb.append(" Received: "); sb.append(received.toHumanString()); sb.append(System.lineSeparator()); return SMFSchemaValidationError.of(sb.toString(), Optional.empty()); }
return valid(SMFCoordinateSystem.of( CAxisSystem.of(axis_right, axis_up, axis_forward), order));
private static String serializeAxes( final SMFCoordinateSystem system) { final CAxisSystem axes = system.axes(); return String.format( "coordinates %s %s %s %s", serializeAxis(axes.right()), serializeAxis(axes.up()), serializeAxis(axes.forward()), serializeWindingOrder(system.windingOrder())); }
/** * Creates an immutable copy of a {@link SMFCoordinateSystemType} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable SMFCoordinateSystem instance */ public static SMFCoordinateSystem copyOf(SMFCoordinateSystemType instance) { if (instance instanceof SMFCoordinateSystem) { return (SMFCoordinateSystem) instance; } return SMFCoordinateSystem.builder() .from(instance) .build(); }
private boolean equalTo(SMFHeader another) { return triangles.equals(another.triangles) && vertexCount == another.vertexCount && schemaIdentifier.equals(another.schemaIdentifier) && coordinateSystem.equals(another.coordinateSystem) && this.attributesInOrder().equals(another.attributesInOrder()) && attributesByName.equals(another.attributesByName) && metaCount == another.metaCount; }
/** * Computes a hash code from attributes: {@code triangles}, {@code vertexCount}, {@code schemaIdentifier}, {@code coordinateSystem}, {@code attributesInOrder}, {@code attributesByName}, {@code metaCount}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + triangles.hashCode(); h += (h << 5) + Long.hashCode(vertexCount); h += (h << 5) + schemaIdentifier.hashCode(); h += (h << 5) + coordinateSystem.hashCode(); h += (h << 5) + (attributesInOrder().hashCode()); h += (h << 5) + attributesByName.hashCode(); h += (h << 5) + Long.hashCode(metaCount); return h; }
final SMFCoordinateSystem coords = coords_opt.get(); writer.append("coordinates "); writer.append(coords.toHumanString()); writer.newLine();
this.coords = SMFCoordinateSystem.of( CAxisSystem.of(axis_right, axis_up, axis_forward), order);
/** * Construct a new immutable {@code SMFCoordinateSystem} instance. * @param axes The value for the {@code axes} attribute * @param windingOrder The value for the {@code windingOrder} attribute * @return An immutable SMFCoordinateSystem instance */ public static SMFCoordinateSystem of(CAxisSystem axes, SMFFaceWindingOrder windingOrder) { return new SMFCoordinateSystem(axes, windingOrder); }
/** * @return The coordinate system of the mesh data */ @Value.Default @Value.Parameter default SMFCoordinateSystem coordinateSystem() { return SMFCoordinateSystem.builder().build(); }
/** * This instance is equal to all instances of {@code SMFCoordinateSystem} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(Object another) { if (this == another) return true; return another instanceof SMFCoordinateSystem && equalTo((SMFCoordinateSystem) another); }
/** * Construct a new immutable {@code SMFCoordinateSystem} instance. * @param axes The value for the {@code axes} attribute * @param windingOrder The value for the {@code windingOrder} attribute * @return An immutable SMFCoordinateSystem instance */ public static SMFCoordinateSystem of(CAxisSystem axes, SMFFaceWindingOrder windingOrder) { return new SMFCoordinateSystem(axes, windingOrder); }
/** * Copy the current immutable object by setting a value for the {@link SMFCoordinateSystemType#windingOrder() windingOrder} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for windingOrder * @return A modified copy of the {@code this} object */ public final SMFCoordinateSystem withWindingOrder(SMFFaceWindingOrder value) { if (this.windingOrder == value) return this; SMFFaceWindingOrder newValue = Objects.requireNonNull(value, "windingOrder"); return new SMFCoordinateSystem(this, this.axes, newValue); }
/** * Copy the current immutable object by setting a value for the {@link SMFCoordinateSystemType#axes() axes} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for axes * @return A modified copy of the {@code this} object */ public final SMFCoordinateSystem withAxes(CAxisSystem value) { if (this.axes == value) return this; CAxisSystem newValue = Objects.requireNonNull(value, "axes"); return new SMFCoordinateSystem(this, newValue, this.windingOrder); }
/** * Copy the current immutable object by setting a value for the {@link SMFCoordinateSystemType#axes() axes} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for axes * @return A modified copy of the {@code this} object */ public final SMFCoordinateSystem withAxes(CAxisSystem value) { if (this.axes == value) return this; CAxisSystem newValue = Objects.requireNonNull(value, "axes"); return new SMFCoordinateSystem(this, newValue, this.windingOrder); }