@Encoding.Naming(standard = Encoding.StandardNaming.ADD) @Encoding.Init void add( final T element) { this.list = this.list.append(element); }
"Unrecognized schema statement: " + name, Optional.empty()); return errors.append(error);
@Override public void onError( final SMFErrorType e) { this.errors = this.errors.append(e); }
error_x = checkComponentCount(error_x, name, attr_schema, attribute); } else if (schema.allowExtraAttributes() == SMF_EXTRA_ATTRIBUTES_DISALLOWED) { error_x = errors.append(errorExtraAttribute(name));
@Override public void onWarning( final SMFWarningType w) { this.warnings = this.warnings.append(w); }
public Builder addAttributesInOrder(SMFAttribute element) { this.attributesInOrder_list = this.attributesInOrder_list.append(element); return this; }
public Builder addAttributesInOrder(SMFAttribute element) { this.attributesInOrder_list = this.attributesInOrder_list.append(element); return this; }
@Override public void onWarning( final SMFWarningType w) { LOG.warn("parse warning: {}", w.fullMessage()); this.warnings = this.warnings.append(w); }
@Override public void onError( final SMFErrorType e) { LOG.error("parse error: {}", e.fullMessage()); this.errors = this.errors.append(e); }
@Override public void onError( final SMFParseError e) { final LexicalPosition<Path> lex = e.lexical(); LOG.error( "parse error: {}:{}:{}: {}", lex.file(), Integer.valueOf(lex.line()), Integer.valueOf(lex.column()), e.message()); this.errors = this.errors.append(e); }
private static List<SMFErrorType> checkCoordinateSystem( final SMFHeader header, final SMFSchema schema, final List<SMFErrorType> errors) { List<SMFErrorType> error_accum = errors; final Optional<SMFCoordinateSystem> coords_opt = schema.requiredCoordinateSystem(); if (coords_opt.isPresent()) { final SMFCoordinateSystem req_coords = coords_opt.get(); if (!Objects.equals(req_coords, header.coordinateSystem())) { error_accum = error_accum.append(errorWrongCoordinateSystem( req_coords, header.coordinateSystem())); } } return error_accum; }
private static List<SMFErrorType> checkComponentSize( final List<SMFErrorType> errors, final SMFAttributeName name, final SMFSchemaAttribute attr_schema, final SMFAttribute attr) { final OptionalInt req_size_opt = attr_schema.requiredComponentSize(); if (req_size_opt.isPresent()) { final int req_size = req_size_opt.getAsInt(); if (attr.componentSizeBits() != req_size) { return errors.append(errorWrongComponentSize( name, req_size, attr.componentSizeBits())); } } return errors; }
private static List<SMFErrorType> checkComponentCount( final List<SMFErrorType> errors, final SMFAttributeName name, final SMFSchemaAttribute attr_schema, final SMFAttribute attr) { final OptionalInt req_count_opt = attr_schema.requiredComponentCount(); if (req_count_opt.isPresent()) { final int req_count = req_count_opt.getAsInt(); if (attr.componentCount() != req_count) { return errors.append(errorWrongComponentCount( name, req_count, attr.componentCount())); } } return errors; }
javaslang.collection.List currentAttributes = currentAttributePath.append(currentAttribute);
private static List<SMFErrorType> checkComponentType( final List<SMFErrorType> errors, final SMFAttributeName name, final SMFSchemaAttribute attr_schema, final SMFAttribute attr) { final Optional<SMFComponentType> req_type_opt = attr_schema.requiredComponentType(); if (req_type_opt.isPresent()) { final SMFComponentType req_type = req_type_opt.get(); if (attr.componentType() != req_type) { return errors.append(errorWrongComponentType( name, req_type, attr.componentType())); } } return errors; }
private static List<SMFErrorType> checkVerticesAndTriangles( final SMFHeader header, final SMFSchema schema, final List<SMFErrorType> errors) { List<SMFErrorType> error_accum = errors; if (schema.requireTriangles() == SMF_TRIANGLES_REQUIRED) { if (header.triangles().triangleCount() == 0L) { error_accum = error_accum.append(errorTrianglesRequiredButEmpty()); } } if (schema.requireVertices() == SMF_VERTICES_REQUIRED) { if (header.vertexCount() == 0L) { error_accum = error_accum.append(errorVerticesRequiredButEmpty()); } } return error_accum; }
this.attributes_list = this.attributes_list.append(attr); } catch (final IllegalArgumentException e) { super.failExpectedGot(
@Override public Validation<List<SMFErrorType>, SMFHeader> validate( final SMFHeader header, final SMFSchema schema) { NullCheck.notNull(header, "Header"); NullCheck.notNull(schema, "Schema"); List<SMFErrorType> errors = List.empty(); final Optional<SMFSchemaIdentifier> file_id_opt = header.schemaIdentifier(); if (file_id_opt.isPresent()) { final SMFSchemaIdentifier file_id = file_id_opt.get(); final SMFSchemaIdentifier schema_id = schema.schemaIdentifier(); if (!Objects.equals(schema_id, file_id)) { errors = errors.append(errorWrongSchemaID(schema_id, file_id)); } } errors = checkVerticesAndTriangles(header, schema, errors); errors = checkAttributes(header, schema, errors); errors = checkCoordinateSystem(header, schema, errors); if (errors.isEmpty()) { return valid(header); } return invalid(errors); }