@Encoding.Naming(value = "setEntries*") @Encoding.Init void setEntries( final Iterable<Tuple2<K, V>> entries) { this.map = HashMap.ofEntries(entries); }
@Encoding.Naming(value = "setJavaMap*") @Encoding.Init void setJavaMap( final java.util.Map<K, V> in_map) { this.map = HashMap.ofAll(in_map); }
@Encoding.Naming(standard = Encoding.StandardNaming.PUT) @Encoding.Init void put( final K key, final V value) { this.map = this.map.put(key, value); }
/** * Check preconditions for the type. */ @Value.Check default void checkPreconditions() { HashMap<Integer, SMFByteBufferPackedAttribute> m = HashMap.empty(); final SortedMap<Integer, SMFByteBufferPackedAttribute> by_offset = this.packedAttributesByOffset(); for (final Integer offset : by_offset.keySet()) { Preconditions.checkPreconditionI( offset.intValue(), !m.containsKey(offset), i -> "All attribute offsets must be unique"); m = m.put(offset, by_offset.get(offset).get()); } } }
SMFTV1BodyParser( final SMFTAbstractParser in_parent, final SMFParserEventsType in_events, final SMFTLineReaderType in_reader, final SMFFormatVersion in_version, final SMFHeader in_header) { super( in_events, in_reader, NullCheck.notNull(in_parent, "Parent").state); this.header = NullCheck.notNull(in_header, "Header"); this.attributes_ok = HashMap.empty(); this.attributes_attempted = HashMap.empty(); }
@Test public void testMisfiled() { final SMFArrayAttributeMapping m0 = SMFArrayAttributeMapping.of( SMFAttributeName.of("a"), 0, Optional.of(JCGLScalarType.TYPE_FLOAT), 4); this.expected.expect(IllegalArgumentException.class); SMFArrayObjectConfiguration.builder() .setMappings(HashMap.of(SMFAttributeName.of("b"), m0)) .build(); }
SMFTV1HeaderParser( final SMFTAbstractParser in_parent, final SMFParserEventsType in_events, final SMFTLineReaderType in_reader, final SMFFormatVersion in_version) { super( in_events, in_reader, NullCheck.notNull(in_parent, "Parent").state); this.attribute_lines = HashMap.empty(); this.attributes_list = List.empty(); this.ok_triangles = false; this.ok_vertices = false; this.schema_id = SMFSchemaIdentifier.of(0, 0, 0, 0); }
.setArrayBufferUsage(JCGLUsageHint.USAGE_STATIC_DRAW) .setIndexBufferUsage(JCGLUsageHint.USAGE_STATIC_DRAW) .setMappings(HashMap.of(attr.name(), attr)) .build();
@Encoding.Naming(value = "setEntries*") @Encoding.Init void setEntries( final Iterable<Tuple2<K, V>> entries) { this.map = HashMap.ofEntries(entries); }
@Encoding.Naming(value = "setJavaMap*") @Encoding.Init void setJavaMap( final java.util.Map<K, V> in_map) { this.map = HashMap.ofAll(in_map); }
private SMFMemoryMeshProducer() { this.started = false; this.errors = List.empty(); this.warnings = List.empty(); this.arrays = HashMap.empty(); this.triangles = Vector.empty(); this.metadata = Vector.empty(); }
@Encoding.Naming(value = "putEntry*", depluralize = true) @Encoding.Init void putEntry( final Tuple2<K, V> entry) { this.map = this.map.put(entry); }
public Builder setEntriesArrays(Iterable<Tuple2<SMFAttributeName, SMFAttributeArrayType>> entries) { this.arrays_map = HashMap.ofEntries(entries); return this; }
public Builder setJavaMapMappings(java.util.Map<SMFAttributeName, SMFArrayAttributeMapping> in_map) { this.mappings_map = HashMap.ofAll(in_map); return this; }
public Builder setEntriesMappings(Iterable<Tuple2<SMFAttributeName, SMFArrayAttributeMapping>> entries) { this.mappings_map = HashMap.ofEntries(entries); return this; }
public Builder setJavaMapArrays(java.util.Map<SMFAttributeName, SMFAttributeArrayType> in_map) { this.arrays_map = HashMap.ofAll(in_map); return this; }
@Encoding.Naming(value = "setMap*") @Encoding.Init void setMap( final Map<K, V> in_map) { this.map = HashMap.ofEntries(in_map.map(x -> x)); }
@Encoding.Naming(value = "setJavaMultimap*") @Encoding.Init void setJavaMap( final java.util.Map<K, V> in_map) { this.map = HashMultimap.withSet().ofEntries(HashMap.ofAll(in_map)); }
@Test public void testDuplicate() { final SMFArrayAttributeMapping m0 = SMFArrayAttributeMapping.of( SMFAttributeName.of("a"), 0, Optional.of(JCGLScalarType.TYPE_FLOAT), 4); final SMFArrayAttributeMapping m1 = SMFArrayAttributeMapping.of( SMFAttributeName.of("b"), 0, Optional.of(JCGLScalarType.TYPE_FLOAT), 4); this.expected.expect(IllegalArgumentException.class); SMFArrayObjectConfiguration.builder() .setMappings(HashMap.ofEntries(List.of( Tuple.of(SMFAttributeName.of("a"), m0), Tuple.of(SMFAttributeName.of("b"), m1)))) .build(); }
@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()); } }