private static SMFSchemaValidationError errorExtraAttribute( final SMFAttributeName name) { final StringBuilder sb = new StringBuilder(128); sb.append( "The mesh contains an extra attribute but the schema does not permit them."); sb.append(System.lineSeparator()); sb.append(" Attribute: "); sb.append(name.value()); sb.append(System.lineSeparator()); return SMFSchemaValidationError.of(sb.toString(), Optional.empty()); }
private static SMFSchemaValidationError errorMissingAttribute( final SMFAttributeName name) { final StringBuilder sb = new StringBuilder(128); sb.append("A required attribute is missing."); sb.append(System.lineSeparator()); sb.append(" Attribute: "); sb.append(name.value()); sb.append(System.lineSeparator()); return SMFSchemaValidationError.of(sb.toString(), Optional.empty()); }
private static SMFSchemaValidationError errorWrongComponentSize( final SMFAttributeName name, final int expected, final int received) { final StringBuilder sb = new StringBuilder(128); sb.append("Attribute component size is not the expected size."); sb.append(System.lineSeparator()); sb.append(" Attribute: "); sb.append(name.value()); sb.append(System.lineSeparator()); sb.append(" Expected: "); sb.append(expected); sb.append(System.lineSeparator()); sb.append(" Received: "); sb.append(received); sb.append(System.lineSeparator()); return SMFSchemaValidationError.of(sb.toString(), Optional.empty()); }
private static SMFSchemaValidationError errorWrongComponentCount( final SMFAttributeName name, final int expected, final int received) { final StringBuilder sb = new StringBuilder(128); sb.append("Attribute component count is not the expected count."); sb.append(System.lineSeparator()); sb.append(" Attribute: "); sb.append(name.value()); sb.append(System.lineSeparator()); sb.append(" Expected: "); sb.append(expected); sb.append(System.lineSeparator()); sb.append(" Received: "); sb.append(received); sb.append(System.lineSeparator()); return SMFSchemaValidationError.of(sb.toString(), Optional.empty()); }
private static SMFSchemaValidationError errorWrongComponentType( final SMFAttributeName name, final SMFComponentType expected, final SMFComponentType received) { final StringBuilder sb = new StringBuilder(128); sb.append("Attribute is not of the expected type."); sb.append(System.lineSeparator()); sb.append(" Attribute: "); sb.append(name.value()); sb.append(System.lineSeparator()); sb.append(" Expected: "); sb.append(expected.getName()); sb.append(System.lineSeparator()); sb.append(" Received: "); sb.append(received.getName()); sb.append(System.lineSeparator()); return SMFSchemaValidationError.of(sb.toString(), Optional.empty()); }
@Override public void onDataAttributeStart( final SMFAttribute attribute) { final String name = attribute.name().value(); if (this.attributes_by_name.containsKey(name)) { final Attribute attr = this.attributes_by_name.get(name); this.packer = new SMFByteBufferPacker( this.array_update.getData(), attr.type, (int) attr.offset, this.vertex_size); } else { this.packer = null; } }
sb.append(System.lineSeparator()); sb.append(" Expected: An attribute '"); sb.append(this.config.name().value()); sb.append("'"); if (this.config.componentCount().isPresent()) {
writer.append(requirement); writer.append(" \""); writer.append(name.value()); writer.append("\" ");
sb.append(System.lineSeparator()); sb.append(" Attribute: "); sb.append(a.name().value()); sb.append(System.lineSeparator()); sb.append(" Attribute type: ");
sb.append(System.lineSeparator()); sb.append(" Attribute: "); sb.append(this.attribute_current.name().value()); sb.append(System.lineSeparator()); sb.append(" Remaining: "); String.format( "attribute \"%s\"", this.attribute_current.name().value())); this.writer.newLine(); return; sb.append(" Expected: "); if (!this.attribute_queue.isEmpty()) { sb.append(this.attribute_queue.head().name().value()); } else { sb.append("(no attribute expected)"); sb.append(name.value()); sb.append(System.lineSeparator()); this.state.transition(SerializerState.STATE_FAILED);
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); } }
/** * @return The attributes by name */ @Value.Derived default SortedMap<SMFAttributeName, SMFAttribute> attributesByName() { SortedMap<SMFAttributeName, SMFAttribute> m = TreeMap.empty(); final List<SMFAttribute> ordered = this.attributesInOrder(); for (int index = 0; index < ordered.size(); ++index) { final SMFAttribute attr = ordered.get(index); if (m.containsKey(attr.name())) { final StringBuilder sb = new StringBuilder(128); sb.append("Duplicate attribute name."); sb.append(System.lineSeparator()); sb.append(" Attribute: "); sb.append(attr.name().value()); sb.append(System.lineSeparator()); throw new IllegalArgumentException(sb.toString()); } m = m.put(attr.name(), attr); } return m; }
/** * @return The attributes by name */ @Value.Derived default SortedMap<SMFAttributeName, SMFAttribute> attributesByName() { SortedMap<SMFAttributeName, SMFAttribute> m = TreeMap.empty(); final List<SMFAttribute> ordered = this.attributesInOrder(); for (int index = 0; index < ordered.size(); ++index) { final SMFAttribute attr = ordered.get(index); if (m.containsKey(attr.name())) { final StringBuilder sb = new StringBuilder(128); sb.append("Duplicate attribute name."); sb.append(System.lineSeparator()); sb.append(" Attribute: "); sb.append(attr.name().value()); sb.append(System.lineSeparator()); throw new IllegalArgumentException(sb.toString()); } m = m.put(attr.name(), attr); } return m; }
private void failMissedAttributes() { final Set<SMFAttributeName> names = this.header.attributesByName().keySet().diff( this.attributes_attempted.keySet()); if (!names.isEmpty()) { names.forEach( name -> this.fail( "No data specified for attribute: " + name.value(), Optional.empty())); } }
"An attempt has already been made to supply data for attribute " + name.value(), Optional.empty()); return; this.log().debug("finished attribute {}", name.value()); this.attributes_ok = this.attributes_ok.put(name, Boolean.TRUE); } finally { super.fail("No such attribute: " + name.value(), Optional.empty());
String.format( "attribute \"%s\" %s %s %s", attribute.name().value(), attribute.componentType().getName(), Long.toUnsignedString((long) attribute.componentCount()),
String.format( "An attribute '%s' with %d components of type %s with size %d", attr.name().value(), Integer.valueOf(attr.componentCount()), attr.componentType().getName(),
Integer.valueOf(required_attribute.index()); this.attributes_by_index.put(b_index, attr); this.attributes_by_name.put(name.value(), attr);