final SMFArrayAttributeMapping mapping = m.get(name).get();
final Option<SMFAttribute> attribute_opt = named.get(attribute.name()); if (attribute_opt.isDefined()) { if (!Objects.equals(attribute, attribute_opt.get())) {
final Option<SMFAttribute> attribute_opt = named.get(attribute.name()); if (attribute_opt.isDefined()) { if (!Objects.equals(attribute, attribute_opt.get())) {
private void parseHeaderCheckUniqueAttributeNames() { final Collection<SMFAttributeName> names = new HashSet<>(this.attributes_list.size()); for (final SMFAttribute attribute : this.attributes_list) { final SMFAttributeName name = attribute.name(); if (names.contains(name)) { Invariants.checkInvariant( name, this.attribute_lines.containsKey(name), a_name -> "Attribute lines must contain " + a_name); this.failWithLineNumber( this.attribute_lines.get(name).get().intValue(), "Duplicate attribute name: " + name.value(), Optional.empty()); } names.add(name); } }
.map(inputComponent -> newComponentMap.get(inputComponent.getUuid())) .filter(optionInputComponent -> !optionInputComponent.isEmpty()) .map(Option::get)
try { final SMFAttributeArrayType array = this.mesh.arrays().get(a.name()).get(); array.matchArray( av,
final SMFAttribute attr = by_name.get(this.config.name()).get();
try (final SMFSerializerDataAttributesValuesType sav = sv.serializeData(name)) { final SMFAttributeArrayType array = mesh.arrays().get(name).get(); array.matchArray( sav,
final SMFAttributeArrayType array = arrays.get(this.source).get(); final Map<SMFAttributeName, SMFAttributeArrayType> renamed_arrays = arrays.replace( orig_header.attributesByName(); final SMFAttribute orig_attrib = orig_by_name.get(this.source).get(); final SMFAttribute new_attrib = orig_attrib.withName(this.target);
@Test public void testMappings() { final SMFArrayAttributeMapping m0 = SMFArrayAttributeMapping.of( SMFAttributeName.of("a"), 0, Optional.of(JCGLScalarType.TYPE_FLOAT), 4); final SMFArrayAttributeMapping m1 = SMFArrayAttributeMapping.of( SMFAttributeName.of("b"), 1, Optional.of(JCGLScalarType.TYPE_FLOAT), 4); final SMFArrayObjectConfiguration m = SMFArrayObjectConfiguration.builder() .setMappings(HashMap.ofEntries(List.of( Tuple.of(SMFAttributeName.of("a"), m0), Tuple.of(SMFAttributeName.of("b"), m1)))) .setIndexBufferUsage(JCGLUsageHint.USAGE_DYNAMIC_COPY) .setArrayBufferUsage(JCGLUsageHint.USAGE_STREAM_READ) .build(); Assert.assertEquals(JCGLUsageHint.USAGE_DYNAMIC_COPY, m.indexBufferUsage()); Assert.assertEquals(JCGLUsageHint.USAGE_STREAM_READ, m.arrayBufferUsage()); Assert.assertEquals(m0, m.mappings().get(SMFAttributeName.of("a")).get()); Assert.assertEquals(m1, m.mappings().get(SMFAttributeName.of("b")).get()); Assert.assertEquals(2L, (long) m.mappings().size()); } }
orig_header.attributesByName(); final SMFAttribute orig_attrib = orig_by_name.get(this.source).get(); final List<SMFAttribute> new_ordered = orig_ordered.remove(orig_attrib);