private static long getBaseTypeBitPosition(final String bitName, final BitsTypeDefinition baseType, final StmtContext<?, ?, ?> ctx) { for (Bit baseTypeBit : baseType.getBits()) { if (bitName.equals(baseTypeBit.getName())) { return baseTypeBit.getPosition(); } } throw new SourceException(ctx.getStatementSourceReference(), "Bit '%s' is not a subset of its base bits type %s.", bitName, baseType.getQName()); }
private void validateRestrictedBit(final @NonNull Bit item) { boolean isASubsetOfBaseBits = false; for (Bit baseTypeBit : getBaseType().getBits()) { if (item.getName().equals(baseTypeBit.getName())) { if (item.getPosition() != baseTypeBit.getPosition()) { throw new InvalidBitDefinitionException(item, "Position of bit '%s' must be the same as the " + "position of corresponding bit in the base bits type %s.", item.getName(), getBaseType().getQName()); } isASubsetOfBaseBits = true; break; } } if (!isASubsetOfBaseBits) { throw new InvalidBitDefinitionException(item, "Bit '%s' is not a subset of its base bits type %s.", item.getName(), getBaseType().getQName()); } }
private void validateRestrictedBit(final @NonNull Bit item) { boolean isASubsetOfBaseBits = false; for (Bit baseTypeBit : getBaseType().getBits()) { if (item.getName().equals(baseTypeBit.getName())) { if (item.getPosition() != baseTypeBit.getPosition()) { throw new InvalidBitDefinitionException(item, "Position of bit '%s' must be the same as the " + "position of corresponding bit in the base bits type %s.", item.getName(), getBaseType().getQName()); } isASubsetOfBaseBits = true; break; } } if (!isASubsetOfBaseBits) { throw new InvalidBitDefinitionException(item, "Bit '%s' is not a subset of its base bits type %s.", item.getName(), getBaseType().getQName()); } }