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()); }
private boolean equalTo(SMFAttribute another) { return name.equals(another.name) && componentType.equals(another.componentType) && componentCount == another.componentCount && componentSizeBits == another.componentSizeBits && componentSizeOctets == another.componentSizeOctets && sizeOctets == another.sizeOctets; }
/** * Computes a hash code from attributes: {@code name}, {@code componentType}, {@code componentCount}, {@code componentSizeBits}, {@code componentSizeOctets}, {@code sizeOctets}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + name.hashCode(); h += (h << 5) + componentType.hashCode(); h += (h << 5) + componentCount; h += (h << 5) + componentSizeBits; h += (h << 5) + componentSizeOctets; h += (h << 5) + sizeOctets; return h; }
private Validation<List<SMFParseError>, Optional<SMFComponentType>> parseComponentType( final String text) { if (Objects.equals(text, "-")) { return valid(Optional.empty()); } try { return valid(Optional.of(SMFComponentType.of(text))); } catch (final IllegalArgumentException e) { return invalid(List.of(SMFParseError.of( this.reader.position(), "Could not parse component type: " + e.getMessage(), Optional.of(e)))); } }
sb.append(a.componentCount()); sb.append(" components of type "); sb.append(a.componentType().name()); sb.append(System.lineSeparator()); sb.append(" Received: "); sb.append(count); sb.append(" components of type "); sb.append(type.name()); sb.append(System.lineSeparator()); this.state.transition(SerializerState.STATE_FAILED);
type = Optional.empty(); } else { type = Optional.of(SMFComponentType.of(type_text));
sb.append(this.config.componentType().get().getName()); } else { sb.append(" of any type");
SMFAttributeName.of(line.get(1)); final SMFComponentType type = SMFComponentType.of(line.get(2)); final int count = Integer.parseUnsignedInt(line.get(3));
private boolean equalTo(SMFAttribute another) { return name.equals(another.name) && componentType.equals(another.componentType) && componentCount == another.componentCount && componentSizeBits == another.componentSizeBits && componentSizeOctets == another.componentSizeOctets && sizeOctets == another.sizeOctets; }
/** * Computes a hash code from attributes: {@code name}, {@code componentType}, {@code componentCount}, {@code componentSizeBits}, {@code componentSizeOctets}, {@code sizeOctets}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + name.hashCode(); h += (h << 5) + componentType.hashCode(); h += (h << 5) + componentCount; h += (h << 5) + componentSizeBits; h += (h << 5) + componentSizeOctets; h += (h << 5) + sizeOctets; return h; }
writer.append(opt_type.get().getName()); } else { writer.append("-");
"attribute \"%s\" %s %s %s", attribute.name().value(), attribute.componentType().getName(), Long.toUnsignedString((long) attribute.componentCount()), Long.toUnsignedString((long) attribute.componentSizeBits())));
attr.name().value(), Integer.valueOf(attr.componentCount()), attr.componentType().getName(), Integer.valueOf(attr.componentSizeBits()))));