Dataset Viewer
Auto-converted to Parquet Duplicate
name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
incubator-hugegraph-toolchain_JDBCVendor_buildGetHeaderSql_rdh
/** * NOTE: don't add a semicolon(;) at the end of oracle sql */@Override public String buildGetHeaderSql(JDBCSource source) { return String.format((("SELECT COLUMN_NAME " + "FROM USER_TAB_COLUMNS ") + "WHERE TABLE_NAME = %s ") + "ORDER BY COLUMN_ID", this.escape(source.table())); }
3.26
incubator-hugegraph-toolchain_JDBCVendor_buildGteClauseInFlattened_rdh
/** * For database which unsupported to select by where (a, b, c) >= (va, vb, vc) * (a, b, c) >= (va, vb, vc) will be convert as follows: * ("a" = va AND "b" = vb AND "c" >= vc) * OR * ("a" = va AND "b" > vb) * OR * ("a" > va) */ public String buildGteClauseInFlattened(Line nextStartRow) { E.checkNotNull(nextSt...
3.26
incubator-hugegraph-toolchain_JDBCVendor_m0_rdh
/** * For database which support to select by where (a, b, c) >= (va, vb, vc) */ public String m0(Line nextStartRow) { E.checkNotNull(nextStartRow, "nextStartRow"); StringBuilder builder = new StringBuilder(); String[] names = nextStartRow.names(); Object[] values = nextStartRow.values(); builder.append("("); for ...
3.26
incubator-hugegraph-toolchain_MetricsManager_all_rdh
/** * The nesting level is too deep, may need to optimize the server first */ public Map<String, Map<String, Object>> all() { return this.metricsAPI.all(); }
3.26
incubator-hugegraph-toolchain_ResultSet_parseResultClass_rdh
/** * TODO: Still need to constantly add and optimize */ private Class<?> parseResultClass(Object object) { if (object.getClass().equals(LinkedHashMap.class)) { @SuppressWarnings("unchecked") Map<String, Object> map = ((Map<String, Object>) (object)); String type = ((String) (map.get("type"))); if (type != null) { ...
3.26
incubator-hugegraph-toolchain_FailLogger_writeHeaderIfNeeded_rdh
/** * Write head to a specialized file, every input struct has one */ private void writeHeaderIfNeeded() { // header() == null means no need header if (this.struct.input().header() == null) { return; } String header = JsonUtil.toJson(this.struct.input().header()); /* The files under failu...
3.26
incubator-hugegraph-toolchain_ElementBuilder_retainField_rdh
/** * Retain only the key-value pairs needed by the current vertex or edge */ protected boolean retainField(String fieldName, Object fieldValue) { ElementMapping mapping = this.mapping(); Set<String> selectedFields = mapping.selectedFields(); Set<String> ignoredFields = mapping.ignoredFields(); // Ret...
3.26
incubator-hugegraph-toolchain_FileUtil_countLines_rdh
/** * NOTE: If there is no blank line at the end of the file, * one line will be missing */ public static int countLines(File file) { if (!file.exists()) { throw new IllegalArgumentException(String.format("The file %s doesn't exist", file)); } long fileLength = file.length(); try (FileInputSt...
3.26
incubator-hugegraph-toolchain_FileLineFetcher_checkMatchHeader_rdh
/** * Just match header for second or subsequent file first line */ private boolean checkMatchHeader(String line) { if ((!this.source().format().needHeader()) || (this.offset() != FIRST_LINE_OFFSET)) { return false; } assert this.source().header() != null; String[] columns = this.parser.spli...
3.26
incubator-hugegraph-toolchain_FileLineFetcher_readHeader_rdh
/** * Read the first line of the first non-empty file as a header */ @Override public String[] readHeader(List<Readable> readables) { String[] header = null; for (Readable readable : readables) { this.openReader(readable); assert this.reader != null; try { String line = thi...
3.26
incubator-hugegraph-toolchain_SplicingIdGenerator_splicing_rdh
/** * Concat multiple parts into a single id with ID_SPLITOR * * @param parts * the string id values to be spliced * @return spliced id object */ public static Id splicing(String... parts) { String escaped = IdUtil.escape(ID_SPLITOR, ESCAPE, parts); return IdGenerator.of(escaped); }
3.26
incubator-hugegraph-toolchain_SplicingIdGenerator_split_rdh
/** * Split a composite id into multiple ids with IDS_SPLITOR * * @param ids * the string id value to be split * @return split string values */ public static String[] split(String ids) { return IdUtil.unescape(ids, IDS_SPLITOR_STR, ESCAPE_STR); }
3.26
incubator-hugegraph-toolchain_SplicingIdGenerator_m0_rdh
/** * Concat property values with NAME_SPLITOR * * @param values * the property values to be contacted * @return contacted string value */ public static String m0(Object... values) { return concatValues(Arrays.asList(values)); }
3.26
incubator-hugegraph-toolchain_SplicingIdGenerator_parse_rdh
/** * Parse a single id into multiple parts with ID_SPLITOR * * @param id * the id object to be parsed * @return parsed string id parts */ public static String[] parse(Id id) { return IdUtil.unescape(id.asString(), ID_SPLITOR_STR, ESCAPE_STR); }
3.26
incubator-hugegraph-toolchain_SplicingIdGenerator_concat_rdh
/** * Generate a string id of HugeVertex from Vertex name */ // public Id generate(HugeVertex vertex) { // /* // * Hash for row-key which will be evenly distributed. // * We can also use LongEncoding.encode() to encode the int/long hash // * if needed. // * id = String.format("%s%s%s", HashUtil.hash(id), ID_SPLITOR, ...
3.26
incubator-hugegraph-toolchain_SplicingIdGenerator_concatValues_rdh
/** * Concat property values with NAME_SPLITOR * * @param values * the property values to be concatted * @return concatted string value */ public static String concatValues(List<?> values) { // Convert the object list to string array int valuesSize = values.size(); String[] parts = new String[valuesSize]; for (...
3.26
incubator-hugegraph-toolchain_LicenseService_m0_rdh
/** * Keep 2 method for future use now */ private static long m0(HugeClient client, String graph) { Map<String, Object> metrics = client.metrics().backend(graph); Object dataSize = metrics.get(METRICS_DATA_SIZE); if (dataSize == null) { return 0L;} Ex.check(dataSize instanceof String, "The backend metrics data_si...
3.26
incubator-hugegraph-toolchain_PropertyKeyController_delete_rdh
/** * Should request "check_using" before delete */ @DeleteMapping public void delete(@PathVariable("connId") int connId, @RequestParam List<String> names, @RequestParam(name = "skip_using", defaultValue = "false") boolean skipUsing) { for (String name : names) { this.service.checkExist(name, connId);if ...
3.26
incubator-hugegraph-toolchain_DataTypeUtils_checkDataType_rdh
/** * Check type of the value valid */ private static boolean checkDataType(String key, Object value, DataType dataType) { if ((value instanceof Number) && dataType.isNumber()) { return parseNumber(key, value, dataType) != null; } return dataType.clazz().isInstance(value); }
3.26
incubator-hugegraph-toolchain_DataTypeUtil_checkDataType_rdh
/** * Check type of the value valid */ private static boolean checkDataType(String key, Object value, DataType dataType) { if ((value instanceof Number) && dataType.isNumber()) { return parseNumber(key, value, dataType) != null; } return dataType.clazz().isInstance(value); }
3.26
incubator-hugegraph-toolchain_DataTypeUtil_checkCollectionDataType_rdh
/** * Check type of all the values(maybe some list properties) valid */ private static boolean checkCollectionDataType(String key, Collection<?> values, DataType dataType) { for (Object value : ...
3.26
incubator-hugegraph-toolchain_DataTypeUtil_parseMultiValues_rdh
/** * collection format: "obj1,obj2,...,objn" or "[obj1,obj2,...,objn]" ..etc * TODO: After parsing to json, the order of the collection changed * in some cases (such as list<date>) */ private static Object parseMultiValues(String key, Object values, DataType dataType, Cardinality cardinality, InputSource source) {...
3.26
incubator-hugegraph-toolchain_PropertyIndexService_list_rdh
/** * The sort result like that, content is 'name' * --------------+------------------------+--------------------------------- * base_value | index label name | fields * --------------+------------------------+--------------------------------- * xxxname | xxxByName | name * -----------...
3.26
incubator-hugegraph-toolchain_LoadTaskService_updateLoadTaskProgress_rdh
/** * Update progress periodically */ @Async @Scheduled(fixedDelay = 1 * 1000) @Transactional(isolation = Isolation.READ_COMMITTED) public void updateLoadTaskProgress() { for (LoadTask task : this.runningTaskContainer.values()) { if (!task.getStatus().inRunning()) { continue; } ...
3.26
incubator-hugegraph-toolchain_PropertyKeyService_checkUsing_rdh
/** * Check the property key is being used, used means that there is * any vertex label or edge label contains the property(name) */ public boolean checkUsing(String name, int connId) { HugeClient client = this.client(connId); List<VertexLabel> vertexLabels = client.schema().getVertexLabels(); for (Verte...
3.26
incubator-hugegraph-toolchain_EdgeLabelController_checkDisplayFields_rdh
/** * TODO:merge with VertexLabelController.checkDisplayFields */ private static void checkDisplayFields(EdgeLabelEntity entity) {EdgeLabelStyle style = entity.getStyle();List<String> displayFields = style.getDisplayFields(); if (!CollectionUtils.isEmpty(displayFields)) { Set<String> nullableProps = ...
3.26
incubator-hugegraph-toolchain_EdgeLabelController_delete_rdh
/** * Delete edge label doesn't need check checkUsing */ @DeleteMapping public void delete(@PathVariable("connId") int connId, @RequestParam("names") List<String> names) { for (String name : names) { this.elService.checkExist(name, connId); this.elService.remove(name, connId); } }
3.26
incubator-hugegraph-toolchain_HugeGraphLoader_stopThenShutdown_rdh
/** * TODO: How to distinguish load task finished normally or abnormally */ private synchronized void stopThenShutdown() { if (this.context.closed()) { return; } f0.info("Stop loading then shutdown HugeGraphLoader"); try { this.context.stopLoading(); if (this.manager != null) { // Wait all in...
3.26
incubator-hugegraph-toolchain_HugeGraphLoader_loadStruct_rdh
/** * TODO: Separate classes: ReadHandler -> ParseHandler -> InsertHandler * Let load task worked in pipeline mode */ private void loadStruct(InputStruct struct, InputReader reader) { f0.info("Start loading '{}'", struct); LoadMetrics metrics = this.context.summary().metrics(struct); metrics.startInF...
3.26
incubator-hugegraph-toolchain_HugeGraphLoader_executeParseTask_rdh
/** * Execute parse task sync */ private void executeParseTask(InputStruct struct, ElementMapping mapping, ParseTaskBuilder.ParseTask task) { long start = System.currentTimeMillis(); // Sync parse List<List<Record>> batches = task.get(); long end = System.currentTimeMillis(); this.context.summary...
3.26
hibernate-validator_ConstraintDefinitionContribution_getConstraintType_rdh
/** * Returns the constraint annotation type for which this instance provides constraint validator instances. */ public Class<A> getConstraintType() { return constraintType; }
3.26
hibernate-validator_ConstraintDefinitionContribution_getValidatorDescriptors_rdh
/** * Returns a list of constraint validator descriptors for the constraint type of this instance. */ public List<ConstraintValidatorDescriptor<A>> getValidatorDescriptors() { return validatorDescriptors; } /** * Whether or not the existing constraint validators should be kept or not. * * @return {@code true} ...
3.26
hibernate-validator_GroupSequenceCheck_getGroupSequence_rdh
/** * Find a {@code jakarta.validation.GroupSequence} annotation if one is present on given type ({@link TypeMirror}). */ private AnnotationMirror getGroupSequence(TypeMirror typeMirror) { // the annotation can be present only on TypeKind.DECLARED elements if (TypeKind.DECLARED.equals(typeMirror.getKind())) { for...
3.26
hibernate-validator_GroupSequenceCheck_redefinesDefaultGroupSequence_rdh
/** * Check if the given {@link TypeMirror} redefines the default group sequence for the annotated class. * <p> * Note that it is only the case if the annotated element is a class. */ private boolean redefinesDefaultGroupSequence(TypeElement annotatedElement, TypeMirror typeMirror) { return ElementKind.CLASS.equals...
3.26
hibernate-validator_HibernateConstraintViolationBuilder_enableExpressionLanguage_rdh
/** * Enable Expression Language with the default Expression Language feature level for the constraint violation * created by this builder if the chosen {@code MessageInterpolator} supports it. * <p> * If you enable this, you need to make sure your message template does not contain any unescaped user input (such as...
3.26
hibernate-validator_ExecutableMetaData_addToExecutablesByDeclaringType_rdh
/** * Merges the given executable with the metadata contributed by other * providers for the same executable in the hierarchy. * * @param executable * The executable to merge. */ private void addToExecutablesByDeclaringType(ConstrainedExecutable executable) { Class<?> beanClass = executable.getCallable().ge...
3.26
hibernate-validator_ExecutableMetaData_assertCorrectnessOfConfiguration_rdh
/** * <p> * Checks the configuration of this method for correctness as per the * rules outlined in the Bean Validation specification, section 4.5.5 * ("Method constraints in inheritance hierarchies"). * </p> * <p> * In particular, overriding methods in sub-types may not add parameter * constraints and the retur...
3.26
hibernate-validator_ExecutableMetaData_findParameterMetaData_rdh
/** * Finds the one executable from the underlying hierarchy with parameter * constraints. If no executable in the hierarchy is parameter constrained, * the parameter meta data from this builder's base executable is returned. * * @return The parameter meta data for this builder's executable. */ private List<Param...
3.26
hibernate-validator_ExecutableMetaData_getParameterMetaData_rdh
/** * Returns meta data for the specified parameter of the represented executable. * * @param parameterIndex * the index of the parameter * @return Meta data for the specified parameter. Will never be {@code null}. */ public ParameterMetaData getParameterMetaData(int parameterIndex) { return parameterMetaDa...
3.26
hibernate-validator_AnnotationMessageCheck_checkMessage_rdh
/** * Verifies that message passed as parameter is valid (passes a regexp check). * * @param message * a message to verify * @return {@code true} if message is valid, {@code false} otherwise */ protected boolean checkMessage(String message) { return MESSAGE_PATTERN.matcher(message).matches(); }
3.26
hibernate-validator_ModCheckValidator_isCheckDigitValid_rdh
/** * Check if the input passes the Mod10 (Luhn algorithm implementation only) or Mod11 test * * @param digits * the digits over which to calculate the Mod10 or Mod11 checksum * @param checkDigit * the check digit * @return {@code true} if the mod 10/11 result matches the check digit, {@code false} otherwise...
3.26
hibernate-validator_ModUtil_calculateLuhnMod10Check_rdh
/** * Calculate Luhn Modulo 10 checksum (Luhn algorithm implementation) * * @param digits * The digits over which to calculate the checksum * @return the result of the mod10 checksum calculation */ public static int calculateLuhnMod10Check(final List<Integer> digits) { in...
3.26
hibernate-validator_ModUtil_calculateMod10Check_rdh
/** * Calculate Generic Modulo 10 checksum * * @param digits * The digits over which to calculate the checksum * @param multiplier * Multiplier used for the odd digits in the algorithm * @param weight * Multiplier used for the even digits in the algorithm * @return the result of the mod10 checksum calcul...
3.26
hibernate-validator_ModUtil_calculateMod11Check_rdh
/** * Calculate Modulo 11 checksum assuming that the threshold is Integer.MAX_VALUE * * @param digits * the digits for which to calculate the checksum * @return the result of the mod11 checksum calculation */ public static int calculateMod11Check(final List<Integer> digits) { return calculateMod11Check(digi...
3.26
hibernate-validator_ModUtil_calculateModXCheckWithWeights_rdh
/** * Calculate Modulo {@code moduloParam} checksum with given weights. If no weights are provided then weights similar to Modulo 11 checksum will be used. * In case when there will be not enough weights provided the ones provided will be used in a looped manner. * * @param digits * the digits for which to calcu...
3.26
hibernate-validator_ConstraintValidatorFactoryImpl_run_rdh
/** * Runs the given privileged action, using a privileged block if required. * <p> * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary * privileged actions within HV's protection domain. */ @IgnoreForbiddenApisErrors(reason = "SecurityManager is deprecated in...
3.26
hibernate-validator_INNValidator_checkChecksumPersonalINN_rdh
/** * Check the digits for personal INN using algorithm from * <a href="https://ru.wikipedia.org/wiki/%D0%98%D0%B4%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D0%BD%D0%BE%D0%BC%D0%B5%D1%80_%D0%BD%D0%B0%D0%BB%D0%BE%D0%B3%D0%BE%D0%BF%D0%BB%D0%B0%D1%82%D0%B5%D0%BB%D1%8C%D1%...
3.26
hibernate-validator_INNValidator_checkChecksumJuridicalINN_rdh
/** * Check the digits for juridical INN using algorithm from * <a href="https://ru.wikipedia.org/wiki/%D0%98%D0%B4%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D0%BD%D0%BE%D0%BC%D0%B5%D1%80_%D0%BD%D0%B0%D0%BB%D0%BE%D0%B3%D0%BE%D0%BF%D0%BB%D0%B0%D1%82%D0%B5%D0%BB%D1%8C%D1...
3.26
hibernate-validator_AnnotationProxy_equals_rdh
/** * Performs an equality check as described in {@link Annotation#equals(Object)}. * * @param obj * The object to compare * @return Whether the given object is equal to this annotation proxy or not * @see Annotation#equals(Object) */ @Override public boolean equals(Object obj) { if (this == obj) { ...
3.26
hibernate-validator_AnnotationProxy_run_rdh
/** * Runs the given privileged action, using a privileged block if required. * <p> * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary * privileged actions within HV's protection domain. */ @IgnoreForbiddenApisErrors(reason = "SecurityManager is deprecated in...
3.26
hibernate-validator_PathImpl_hashCode_rdh
// deferred hash code building @Override public int hashCode() { if (f1 == (-1)) { f1 = buildHashCode(); }return f1; }
3.26
hibernate-validator_PathImpl_isValidJavaIdentifier_rdh
/** * Validate that the given identifier is a valid Java identifier according to the Java Language Specification, * <a href="http://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.8">chapter 3.8</a> * * @param identifier * string identifier to validate * @return true if the given identifier is a vali...
3.26
hibernate-validator_CollectionHelper_iterableFromArray_rdh
/** * Builds an {@link Iterable} for a given array. It is (un)necessarily ugly because we have to deal with array of primitives. * * @param object * a given array * @return an {@code Iterable} providing iterators over the array */ // Reflection is used to ensure the correct types are used @SuppressWarnings({ "u...
3.26
hibernate-validator_CollectionHelper_getInitialCapacityFromExpectedSize_rdh
/** * As the default loadFactor is of 0.75, we need to calculate the initial capacity from the expected size to avoid * resizing the collection when we populate the collection with all the initial elements. We use a calculation * similar to what is done in {@link HashMap#putAll(Map)}. * * @param expectedSize * ...
3.26
hibernate-validator_CollectionHelper_iteratorFromArray_rdh
/** * Builds an {@link Iterator} for a given array. It is (un)necessarily ugly because we have to deal with array of primitives. * * @param object * a given array * @return an {@code Iterator} iterating over the array */ // Reflection is used to ensure the correct types are used @SuppressWarnings({ "unchecked",...
3.26
hibernate-validator_REGONValidator_getWeights_rdh
/** * * @param digits * a list of digits to be verified. They are used to determine a size of REGON number - is it 9 or 14 digit number * @return an array of weights to be used to calculate a checksum */ @Override protected int[] getWeights(List<Integer> digits) { if (digits.size() == 8) { return WEI...
3.26
hibernate-validator_ValidationBootstrapParameters_run_rdh
/** * Runs the given privileged action, using a privileged block if required. * <p> * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary * privileged actions within HV's protection domain. */ @IgnoreForbiddenApisErrors(reason = "SecurityManager is deprecated in...
3.26
hibernate-validator_ExecutableHelper_run_rdh
/** * Runs the given privileged action, using a privileged block if required. * <p> * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary * privileged actions within HV's protection domain. */ @IgnoreForbiddenApisErrors(reason = "SecurityManager is deprecated in...
3.26
hibernate-validator_ExecutableHelper_instanceMethodParametersResolveToSameTypes_rdh
/** * Whether the parameters of the two given instance methods resolve to the same types or not. Takes type parameters into account. * * @param subTypeMethod * a method on a supertype * @param superTypeMethod * a method on a subtype * @return {@code true} if the parameters of the two methods resolve to the s...
3.26
hibernate-validator_ExecutableHelper_getExecutableAsString_rdh
/** * Returns a string representation of an executable with the given name and parameter types in the form * {@code <name>(<parameterType 0> ... <parameterType n>)}, e.g. for logging purposes. * * @param name * the name of the executable * @param parameterTypes * the types of the executable's parameters * ...
3.26
hibernate-validator_ConfigurationSource_getPriority_rdh
/** * Returns this sources priority. Can be used to determine which * configuration shall apply in case of conflicting configurations by * several providers. * * @return This source's priority. */public int getPriority() { return priority; } /** * Returns that configuration source from the given two source...
3.26
hibernate-validator_PredefinedScopeBeanMetaDataManager_createBeanMetaData_rdh
/** * Creates a {@link org.hibernate.validator.internal.metadata.aggregated.BeanMetaData} containing the meta data from all meta * data providers for the given type and its hierarchy. * * @param <T> * The type of interest. * @param clazz * The type's class. * @return A bean meta data object for the given ty...
3.26
hibernate-validator_PredefinedScopeBeanMetaDataManager_getAnnotationProcessingOptionsFromNonDefaultProviders_rdh
/** * * @return returns the annotation ignores from the non annotation based meta data providers */ private static AnnotationProcessingOptions getAnnotationProcessingOptionsFromNonDefaultProviders(List<MetaDataProvider> optionalMetaDataProviders) { AnnotationProcessingOptions options = new AnnotationProcessin...
3.26
hibernate-validator_JavaBeanField_run_rdh
/** * Runs the given privileged action, using a privileged block if required. * <p> * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary * privileged actions within HV's protection domain. */ @IgnoreForbiddenApisErrors(reason = "SecurityManager is deprecated in...
3.26
hibernate-validator_JavaBeanField_getAccessible_rdh
/** * Returns an accessible copy of the given member. */ @IgnoreForbiddenApisErrors(reason = "SecurityManager is deprecated in JDK17") private static Field getAccessible(Field original) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(HibernateValidatorPermi...
3.26
hibernate-validator_Contracts_assertNotNull_rdh
/** * Asserts that the given object is not {@code null}. * * @param o * The object to check. * @param message * A message text which will be used as message of the resulting * exception if the given object is {@code null}. * @throws IllegalArgumentException * In case the given object is {@code null}. ...
3.26
hibernate-validator_Contracts_assertValueNotNull_rdh
/** * Asserts that the given object is not {@code null}. * * @param o * The object to check. * @param name * The name of the value to check. A message of the form * "&lt;name&gt; must not be null" will be used as message of * the resulting exception if the given object is {@code null}. * @throws Illega...
3.26
hibernate-validator_NotEmptyValidatorForArraysOfInt_isValid_rdh
/** * Checks the array is not {@code null} and not empty. * * @param array * the array to validate * @param constraintValidatorContext * context in which the constraint is evaluated * @return returns {@code true} if the array is not {@code null} and the array is not empty */ @Override public boolean isVali...
3.26
hibernate-validator_MetaConstraints_getWrappedValueType_rdh
/** * Returns the sub-types binding for the single type parameter of the super-type. E.g. for {@code IntegerProperty} * and {@code Property<T>}, {@code Integer} would be returned. */ private static Class<?> getWrappedValueType(TypeResolutionHelper typeResolutionHelper, Type declaredType, ValueExtractorDescriptor val...
3.26
hibernate-validator_TypeResolutionHelper_getTypeResolver_rdh
/** * * @return the typeResolver */public TypeResolver getTypeResolver() {return typeResolver; }
3.26
hibernate-validator_AnnotationFactory_run_rdh
/** * Runs the given privileged action, using a privileged block if required. * <p> * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary * privileged actions within HV's protection domain. */ @IgnoreForbiddenApisErrors(reason = "SecurityManager is deprecated in...
3.26
hibernate-validator_ValidatorImpl_validateCascadedConstraints_rdh
/** * Validates all cascaded constraints for the given bean using the current group set in the execution context. * This method must always be called after validateConstraints for the same context. * * @param validationContext * The execution context * @param valueContext * Collected information for single v...
3.26
hibernate-validator_ValidatorImpl_validateInContext_rdh
/** * Validates the given object using the available context information. * * @param validationContext * the global validation context * @param valueContext * the current validation context * @param validationOrder * Contains the information which and in which order groups have to be executed * @param <T...
3.26
hibernate-validator_ValidatorImpl_validateReturnValueForGroup_rdh
// TODO GM: if possible integrate with validateParameterForGroup() private <T> void validateReturnValueForGroup(BaseBeanValidationContext<T> validationContext, ExecutableMetaData executableMetaData, T bean, Object value, Group group) { Contracts.assertNotNull(executableMetaData, "executableMetaData may not be nu...
3.26
hibernate-validator_AbstractMessageInterpolator_interpolateMessage_rdh
/** * Runs the message interpolation according to algorithm specified in the Bean Validation specification. * <p> * Note: * <p> * Look-ups in user bundles is recursive whereas look-ups in default bundle are not! * * @param message * the message to interpolate * @param context * the context for this interp...
3.26
hibernate-validator_ValidationXmlTestHelper_runWithCustomValidationXml_rdh
/** * Executes the given runnable, using the specified file as replacement for * {@code META-INF/validation.xml}. * * @param validationXmlName * The file to be used as validation.xml file. * @param runnable * The runnable to execute. */ public void runWithCustomValidationXml(final String validationXmlName, ...
3.26
hibernate-validator_AnnotationParametersAbstractCheck_canCheckThisAnnotation_rdh
/** * Verify that this check class can process such annotation. * * @param annotation * annotation you want to process by this class * @return {@code true} if such annotation can be processed, {@code false} otherwise. */ protected boolean canCheckThisAnnotation(AnnotationMirror annotation) { return annotationCl...
3.26
hibernate-validator_ConstraintAnnotationVisitor_visitTypeAsClass_rdh
/** * <p> * Checks whether the given annotations are correctly specified at the given * class type declaration. The following checks are performed: * </p> * <ul> * <li> * Constraint annotations may at types supported by the constraints.</li> * <li> * </ul> */ @Override public Void visitTypeAsClass(TypeElement...
3.26
hibernate-validator_ConstraintAnnotationVisitor_checkConstraints_rdh
/** * Retrieves the checks required for the given element and annotations, * executes them and reports all occurred errors. * * @param annotatedElement * The element to check. * @param mirrors * The annotations to check. */ private void checkConstraints(Element annotatedElement, List<AnnotationMirror> mirro...
3.26
hibernate-validator_ConstraintAnnotationVisitor_visitTypeAsInterface_rdh
/** * <p> * Checks whether the given annotations are correctly specified at the given * interface type declaration. The following checks are performed: * </p> * <ul> * <li> * Constraint annotations may at types supported by the constraints.</li> * <li> * </ul> */ @Override public Void visitTypeAsInterface(Typ...
3.26
hibernate-validator_ConstraintAnnotationVisitor_visitTypeAsEnum_rdh
/** * <p> * Checks whether the given annotations are correctly specified at the given * enum type declaration. The following checks are performed: * </p> * <ul> * <li> * Constraint annotations may at types supported by the constraints.</li> * <li> * </ul> */ @Override public Void visitTypeAsEnum(TypeElement e...
3.26
hibernate-validator_ConstraintAnnotationVisitor_visitTypeAsAnnotationType_rdh
/** * <p> * Checks whether the given annotations are correctly specified at the given * annotation type declaration. The following checks are performed: * </p> * <ul> * <li> * The only annotation types allowed to be annotated with other constraint * annotations are composed constraint annotation type declaratio...
3.26
hibernate-validator_ConstraintAnnotationVisitor_visitVariableAsParameter_rdh
/** * <p> * Checks whether the given annotations are correctly specified at the given * method parameter. The following checks are performed: * </p> * <ul> * <li> * Constraint annotation parameter values are meaningful and valid. * </li> * </ul> */ @Override public Void visitVariableAsParameter(VariableElemen...
3.26
hibernate-validator_ConstraintAnnotationVisitor_visitExecutableAsMethod_rdh
/** * <p> * Checks whether the given annotations are correctly specified at the given * method. The following checks are performed: * </p> * <ul> * <li> * Constraint annotations may only be given at non-static, JavaBeans getter * methods which's return type is supported by the constraints.</li> * <li> * The {...
3.26
hibernate-validator_MessagerAdapter_reportWarning_rdh
/** * Reports the given warning. Message parameters will be put into the template * retrieved from the resource bundle if applicable. * * @param warning * The warning to report. */ private void reportWarning(ConstraintCheckIssue warning) { report(warning, Kind.WARNING); }
3.26
hibernate-validator_MessagerAdapter_report_rdh
/** * Reports the given issue. Message parameters will be put into the template * retrieved from the resource bundle if applicable. * * @param issue * The issue to report. * @param kind * Kind of diagnostics to be used for reporting a given issue. */ private void report(ConstraintCheckIssue issue, Kind kind...
3.26
hibernate-validator_MessagerAdapter_reportErrors_rdh
/** * Reports the given errors against the underlying {@link Messager} using * the specified {@link Kind}. * * @param errors * A set with errors to report. May be empty but must not be * null. */ public void reportErrors(Collection<ConstraintCheckIssue> errors) { for (ConstraintCheckIssue error : error...
3.26
hibernate-validator_MessagerAdapter_reportError_rdh
/** * Reports the given error. Message parameters will be put into the template * retrieved from the resource bundle if applicable. * * @param error * The error to report. */ private void reportError(ConstraintCheckIssue error) { report(error, diagnosticKind); }
3.26
hibernate-validator_MessagerAdapter_getDelegate_rdh
/** * Returns the messager used by this adapter. * * @return The underlying messager. */ public Messager getDelegate() { return messager; }
3.26
hibernate-validator_MessagerAdapter_reportWarnings_rdh
/** * Reports the given warnings against the underlying {@link Messager} using * the specified {@link Kind}. * * @param warnings * A set with errors to report. May be empty but must not be * null. */public void reportWarnings(Collection<ConstraintCheckIssue> warnings) {for (ConstraintCheckIssue warning : war...
3.26
hibernate-validator_PositiveOrZeroValidatorForFloat_isValid_rdh
/** * Check that the number being validated is positive or zero. * * @author Hardy Ferentschik * @author Xavier Sosnovsky * @author Guillaume Smet * @author Marko Bekhta */public class PositiveOrZeroValidatorForFloat implements ConstraintValidator<PositiveOrZero, Float> { @Override public boolean isVali...
3.26
hibernate-validator_GetDeclaredField_andMakeAccessible_rdh
/** * Before using this method, you need to check the {@code HibernateValidatorPermission.ACCESS_PRIVATE_MEMBERS} * permission against the security manager. */ public static GetDeclaredField andMakeAccessible(Class<?> clazz, String fieldName) { return new GetDeclaredField(clazz, fieldName, true); }
3.26
hibernate-validator_MethodValidationConfiguration_allowMultipleCascadedValidationOnReturnValues_rdh
/** * Define whether more than one constraint on a return value may be marked for cascading validation are allowed. * The default value is {@code false}, i.e. do not allow. * * "One must not mark a method return value for cascaded validation more than once in a line of a class hierarchy. * In other words, overridi...
3.26
hibernate-validator_MethodValidationConfiguration_getConfiguredRuleSet_rdh
/** * Return an unmodifiable Set of MethodConfigurationRule that are to be * enforced based on the configuration. * * @return a set of method configuration rules based on this configuration state */ public Set<MethodConfigurationRule> getConfiguredRuleSet() { return configuredRuleSet; }
3.26
hibernate-validator_MethodValidationConfiguration_allowOverridingMethodAlterParameterConstraint_rdh
/** * Define whether overriding methods that override constraints should throw a {@code ConstraintDefinitionException}. * The default value is {@code false}, i.e. do not allow. * * See Section 5.6.5 of the Jakarta Bean Validation Specification, specifically * <pre> * "In sub types (be it sub classes/interfaces or...
3.26
hibernate-validator_MethodValidationConfiguration_isAllowParallelMethodsDefineParameterConstraints_rdh
/** * * @return {@code true} if constraints on methods in parallel class hierarchy are allowed, {@code false} otherwise. */ public boolean isAllowParallelMethodsDefineParameterConstraints() { return this.f0; }
3.26
hibernate-validator_MethodValidationConfiguration_allowParallelMethodsDefineParameterConstraints_rdh
/** * Define whether parallel methods that define constraints should throw a {@code ConstraintDefinitionException}. The * default value is {@code false}, i.e. do not allow. * * See Section 5.6.5 of the Jakarta Bean Validation Specification, specifically * "If a sub type overrides/implements a method originally def...
3.26
hibernate-validator_JavaBeanHelper_run_rdh
/** * Runs the given privileged action, using a privileged block if required. * * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary * privileged actions within HV's protection domain. */ @IgnoreForbiddenApisErrors(reason = "SecurityManager is deprecated in JDK...
3.26
hibernate-validator_AbstractElementVisitor_reportIssues_rdh
/** * Reports provided issues using {@link javax.annotation.processing.Messager} API based on their * kind ({@link ConstraintCheckIssue.IssueKind}). * * @param foundIssues * a collection of issues to be reported */ protected void reportIssues(Collection<ConstraintCheckIssue> foundIssues) { Set<ConstraintChe...
3.26
hibernate-validator_ConstraintTypeStaxBuilder_run_rdh
/** * Runs the given privileged action, using a privileged block if required. * * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary * privileged actions within HV's protection domain. */ @IgnoreForbiddenApisErrors(reason = "SecurityManager is deprecated in JDK...
3.26
End of preview. Expand in Data Studio

Java Code Readability Merged & Modified

This dataset contains 69276 Java code snippets along with a readability score, mined from Github and automatically processed and labelled.

You can download the dataset using Hugging Face:

from datasets import load_dataset
ds = load_dataset("se2p/code-readability-krod")

The snippets are not split into train and test (and validation) set. Thus, the whole dataset is in the train set:

ds = ds['train']
ds_as_list = ds.to_list() # Convert the dataset to whatever format suits you best

The dataset is structured as follows:

{
  "code_snippet": ...,  # Java source code snippet
  "score": ...          # Readability score
  "name": ...           # The name of the code snippet refering to its origin
}

The main goal of this repository is to train code readability classifiers for Java source code.

Dataset Details

Uses

The dataset can be used for training Java code readability classifiers.

Dataset Structure

Each entry of the dataset consists of a code_snippet and a score (and a name). The code_snippet (string) is the code snippet that was downloaded from GitHub. Each snippet has a readability score assigned. The score is based on a five point Likert scale, with 1 being very unreadable and 5 being very readable.

Dataset Creation

Curation Rationale

To advance code readability classification, the creation of datasets in this research field is of high importance. We provide a new dataset generated with a new approach. Previous datasets for code readability classification are mostly generated by humans manually annotating the readability of code. Those datasets are relatively small, with combined size of only 421 samples. As our approach allows automation, we can provide a different scale of code snippets. We share this dataset on Hugging Face to share access and make the ease of usage easy.

Source Data

The initial source of code snippets are from 100 public GitHub which can be found at the end of this file.

Data Collection and Processing

The Data Collection and Preprocessing for this Hugging Face dataset involved two main steps. First, GitHub repositories known for high code quality were mined and labeled as highly readable. The extracted methods are labeled with a score of 3.68. Second, the code was intentionally modified to reduce readability. The resulting code was labelled with a score of 3.26. This resulted in an automatically generated training dataset for source code readability classification.

Who are the source data producers?

The source data producers are the people that wrote the used open source Java projects.

Personal and Sensitive Information

The ratings of the code snippets are automatically assigned. Thus, no personal or sensitive information is contained in this dataset.

Bias, Risks, and Limitations

The assigned labels are not accurate as they are only an average estimate based on a survey. The average score for the mined code snippets of the survey was 3.68. The average score for the modified code snippets of the survey was 3.26.

Recommendations

The dataset should be used to train Java code readability classifiers. We recommend fine-tuning and evaluation on manually labeled data.

Dataset Card Authors

Lukas Krodinger, Chair of Software Engineering II, University of Passau.

Dataset Card Contact

Feel free to contact me via E-Mail if you have any questions or remarks.

Appendix

Origin Repositories

Downloads last month
49