repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.addGroupMember
public GitlabGroupMember addGroupMember(Integer groupId, Integer userId, GitlabAccessLevel accessLevel) throws IOException { Query query = new Query() .appendIf("id", groupId) .appendIf("user_id", userId) .appendIf("access_level", accessLevel); String tailUrl = GitlabGroup.URL + "/" + groupId + GitlabProjectMember.URL + query.toString(); return dispatch().to(tailUrl, GitlabGroupMember.class); }
java
public GitlabGroupMember addGroupMember(Integer groupId, Integer userId, GitlabAccessLevel accessLevel) throws IOException { Query query = new Query() .appendIf("id", groupId) .appendIf("user_id", userId) .appendIf("access_level", accessLevel); String tailUrl = GitlabGroup.URL + "/" + groupId + GitlabProjectMember.URL + query.toString(); return dispatch().to(tailUrl, GitlabGroupMember.class); }
[ "public", "GitlabGroupMember", "addGroupMember", "(", "Integer", "groupId", ",", "Integer", "userId", ",", "GitlabAccessLevel", "accessLevel", ")", "throws", "IOException", "{", "Query", "query", "=", "new", "Query", "(", ")", ".", "appendIf", "(", "\"id\"", ","...
Add a group member. @param groupId the group id @param userId the user id @param accessLevel the GitlabAccessLevel @return the GitlabGroupMember @throws IOException on gitlab api call error
[ "Add", "a", "group", "member", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L732-L739
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.getDateOfSecondsBack
public static Date getDateOfSecondsBack(final int secondsBack, final Date date) { return dateBack(Calendar.SECOND, secondsBack, date); }
java
public static Date getDateOfSecondsBack(final int secondsBack, final Date date) { return dateBack(Calendar.SECOND, secondsBack, date); }
[ "public", "static", "Date", "getDateOfSecondsBack", "(", "final", "int", "secondsBack", ",", "final", "Date", "date", ")", "{", "return", "dateBack", "(", "Calendar", ".", "SECOND", ",", "secondsBack", ",", "date", ")", ";", "}" ]
Get specify seconds back form given date. @param secondsBack how many second want to be back. @param date date to be handled. @return a new Date object.
[ "Get", "specify", "seconds", "back", "form", "given", "date", "." ]
train
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L149-L152
google/closure-compiler
src/com/google/javascript/jscomp/ModuleIdentifier.java
ModuleIdentifier.forClosure
public static ModuleIdentifier forClosure(String name) { String normalizedName = name; if (normalizedName.startsWith("goog:")) { normalizedName = normalizedName.substring("goog:".length()); } String namespace = normalizedName; String moduleName = normalizedName; int splitPoint = normalizedName.indexOf(':'); if (splitPoint != -1) { moduleName = normalizedName.substring(0, splitPoint); namespace = normalizedName.substring(Math.min(splitPoint + 1, normalizedName.length() - 1)); } return new AutoValue_ModuleIdentifier(normalizedName, namespace, moduleName); }
java
public static ModuleIdentifier forClosure(String name) { String normalizedName = name; if (normalizedName.startsWith("goog:")) { normalizedName = normalizedName.substring("goog:".length()); } String namespace = normalizedName; String moduleName = normalizedName; int splitPoint = normalizedName.indexOf(':'); if (splitPoint != -1) { moduleName = normalizedName.substring(0, splitPoint); namespace = normalizedName.substring(Math.min(splitPoint + 1, normalizedName.length() - 1)); } return new AutoValue_ModuleIdentifier(normalizedName, namespace, moduleName); }
[ "public", "static", "ModuleIdentifier", "forClosure", "(", "String", "name", ")", "{", "String", "normalizedName", "=", "name", ";", "if", "(", "normalizedName", ".", "startsWith", "(", "\"goog:\"", ")", ")", "{", "normalizedName", "=", "normalizedName", ".", ...
Returns an identifier for a Closure namespace. @param name The Closure namespace. It may be in one of the formats `name.space`, `goog:name.space` or `goog:moduleName:name.space`, where the latter specifies that the module and namespace names are different.
[ "Returns", "an", "identifier", "for", "a", "Closure", "namespace", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ModuleIdentifier.java#L59-L74
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/ssh/components/ComponentFactory.java
ComponentFactory.getInstance
public Object getInstance(String name) throws SshException { if (supported.containsKey(name)) { try { return createInstance(name, (Class<?>) supported.get(name)); } catch (Throwable t) { throw new SshException(t.getMessage(), SshException.INTERNAL_ERROR); } } throw new SshException(name + " is not supported", SshException.UNSUPPORTED_ALGORITHM); }
java
public Object getInstance(String name) throws SshException { if (supported.containsKey(name)) { try { return createInstance(name, (Class<?>) supported.get(name)); } catch (Throwable t) { throw new SshException(t.getMessage(), SshException.INTERNAL_ERROR); } } throw new SshException(name + " is not supported", SshException.UNSUPPORTED_ALGORITHM); }
[ "public", "Object", "getInstance", "(", "String", "name", ")", "throws", "SshException", "{", "if", "(", "supported", ".", "containsKey", "(", "name", ")", ")", "{", "try", "{", "return", "createInstance", "(", "name", ",", "(", "Class", "<", "?", ">", ...
Get a new instance of a supported component. @param name The name of the component; for example "3des-cbc" @return the newly instantiated object @throws ClassNotFoundException
[ "Get", "a", "new", "instance", "of", "a", "supported", "component", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/ComponentFactory.java#L171-L182
aws/aws-sdk-java
aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/StepFunctionBuilder.java
StepFunctionBuilder.gte
public static TimestampGreaterThanOrEqualCondition.Builder gte(String variable, Date expectedValue) { return TimestampGreaterThanOrEqualCondition.builder().variable(variable).expectedValue(expectedValue); }
java
public static TimestampGreaterThanOrEqualCondition.Builder gte(String variable, Date expectedValue) { return TimestampGreaterThanOrEqualCondition.builder().variable(variable).expectedValue(expectedValue); }
[ "public", "static", "TimestampGreaterThanOrEqualCondition", ".", "Builder", "gte", "(", "String", "variable", ",", "Date", "expectedValue", ")", "{", "return", "TimestampGreaterThanOrEqualCondition", ".", "builder", "(", ")", ".", "variable", "(", "variable", ")", "...
Binary condition for Timestamp greater than or equal to comparison. Dates are converted to ISO8601 UTC timestamps. @param variable The JSONPath expression that determines which piece of the input document is used for the comparison. @param expectedValue The expected value for this condition. @see <a href="https://states-language.net/spec.html#choice-state">https://states-language.net/spec.html#choice-state</a> @see com.amazonaws.services.stepfunctions.builder.states.Choice
[ "Binary", "condition", "for", "Timestamp", "greater", "than", "or", "equal", "to", "comparison", ".", "Dates", "are", "converted", "to", "ISO8601", "UTC", "timestamps", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/StepFunctionBuilder.java#L356-L358
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/security/core/BCrypt.java
BCrypt.checkpw
public static boolean checkpw(String plaintext, String hashed) { return (hashed.compareTo(hashpw(plaintext, hashed)) == 0); }
java
public static boolean checkpw(String plaintext, String hashed) { return (hashed.compareTo(hashpw(plaintext, hashed)) == 0); }
[ "public", "static", "boolean", "checkpw", "(", "String", "plaintext", ",", "String", "hashed", ")", "{", "return", "(", "hashed", ".", "compareTo", "(", "hashpw", "(", "plaintext", ",", "hashed", ")", ")", "==", "0", ")", ";", "}" ]
Check that a plaintext password matches a previously hashed one @param plaintext the plaintext password to verify @param hashed the previously-hashed password @return true if the passwords match, false otherwise
[ "Check", "that", "a", "plaintext", "password", "matches", "a", "previously", "hashed", "one" ]
train
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/security/core/BCrypt.java#L764-L766
Alluxio/alluxio
integration/checker/src/main/java/alluxio/checker/SparkIntegrationChecker.java
SparkIntegrationChecker.run
private Status run(JavaSparkContext sc, PrintWriter reportWriter, AlluxioConfiguration conf) { // Check whether Spark driver can recognize Alluxio classes and filesystem Status driverStatus = CheckerUtils.performIntegrationChecks(); String driverAddress = sc.getConf().get("spark.driver.host"); switch (driverStatus) { case FAIL_TO_FIND_CLASS: reportWriter.printf("Spark driver: %s failed to recognize Alluxio classes.%n%n", driverAddress); return driverStatus; case FAIL_TO_FIND_FS: reportWriter.printf("Spark driver: %s failed to recognize Alluxio filesystem.%n%n", driverAddress); return driverStatus; default: reportWriter.printf("Spark driver: %s can recognize Alluxio filesystem.%n%n", driverAddress); break; } if (!CheckerUtils.supportAlluxioHA(reportWriter, conf)) { return Status.FAIL_TO_SUPPORT_HA; } return runSparkJob(sc, reportWriter); }
java
private Status run(JavaSparkContext sc, PrintWriter reportWriter, AlluxioConfiguration conf) { // Check whether Spark driver can recognize Alluxio classes and filesystem Status driverStatus = CheckerUtils.performIntegrationChecks(); String driverAddress = sc.getConf().get("spark.driver.host"); switch (driverStatus) { case FAIL_TO_FIND_CLASS: reportWriter.printf("Spark driver: %s failed to recognize Alluxio classes.%n%n", driverAddress); return driverStatus; case FAIL_TO_FIND_FS: reportWriter.printf("Spark driver: %s failed to recognize Alluxio filesystem.%n%n", driverAddress); return driverStatus; default: reportWriter.printf("Spark driver: %s can recognize Alluxio filesystem.%n%n", driverAddress); break; } if (!CheckerUtils.supportAlluxioHA(reportWriter, conf)) { return Status.FAIL_TO_SUPPORT_HA; } return runSparkJob(sc, reportWriter); }
[ "private", "Status", "run", "(", "JavaSparkContext", "sc", ",", "PrintWriter", "reportWriter", ",", "AlluxioConfiguration", "conf", ")", "{", "// Check whether Spark driver can recognize Alluxio classes and filesystem", "Status", "driverStatus", "=", "CheckerUtils", ".", "per...
Implements Spark with Alluxio integration checker. @param sc current JavaSparkContext @param reportWriter save user-facing messages to a generated file @return performIntegrationChecks results
[ "Implements", "Spark", "with", "Alluxio", "integration", "checker", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/integration/checker/src/main/java/alluxio/checker/SparkIntegrationChecker.java#L77-L101
js-lib-com/commons
src/main/java/js/util/Files.java
Files.createBufferedReader
public static BufferedReader createBufferedReader(InputStream stream) { try { return new BufferedReader(new InputStreamReader(stream, "UTF-8")); } catch(UnsupportedEncodingException unused) { throw new BugError("Unsupported UTF-8 ecoding."); } }
java
public static BufferedReader createBufferedReader(InputStream stream) { try { return new BufferedReader(new InputStreamReader(stream, "UTF-8")); } catch(UnsupportedEncodingException unused) { throw new BugError("Unsupported UTF-8 ecoding."); } }
[ "public", "static", "BufferedReader", "createBufferedReader", "(", "InputStream", "stream", ")", "{", "try", "{", "return", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "stream", ",", "\"UTF-8\"", ")", ")", ";", "}", "catch", "(", "UnsupportedE...
Create buffered reader from bytes stream using UTF-8 charset. This library always uses UTF-8 encoding and this method does not rely on JVM default since there is no standard way to enforce it. JRE specification states that <code>file.encoding</code> is not the standard way to set default charset and to use host settings. @param stream input stream. @return newly created buffered reader.
[ "Create", "buffered", "reader", "from", "bytes", "stream", "using", "UTF", "-", "8", "charset", ".", "This", "library", "always", "uses", "UTF", "-", "8", "encoding", "and", "this", "method", "does", "not", "rely", "on", "JVM", "default", "since", "there",...
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Files.java#L84-L92
apiman/apiman
manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/util/ExceptionFactory.java
ExceptionFactory.apiVersionAlreadyExistsException
public static final ApiVersionAlreadyExistsException apiVersionAlreadyExistsException(String apiName, String version) { return new ApiVersionAlreadyExistsException(Messages.i18n.format("ApiVersionAlreadyExists", apiName, version)); //$NON-NLS-1$ }
java
public static final ApiVersionAlreadyExistsException apiVersionAlreadyExistsException(String apiName, String version) { return new ApiVersionAlreadyExistsException(Messages.i18n.format("ApiVersionAlreadyExists", apiName, version)); //$NON-NLS-1$ }
[ "public", "static", "final", "ApiVersionAlreadyExistsException", "apiVersionAlreadyExistsException", "(", "String", "apiName", ",", "String", "version", ")", "{", "return", "new", "ApiVersionAlreadyExistsException", "(", "Messages", ".", "i18n", ".", "format", "(", "\"A...
Creates an exception from an API name. @param apiName the API name @param version the version @return the exception
[ "Creates", "an", "exception", "from", "an", "API", "name", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/util/ExceptionFactory.java#L210-L212
landawn/AbacusUtil
src/com/landawn/abacus/util/Multimap.java
Multimap.merge
public <X extends Exception> V merge(K key, E e, Try.BiFunction<? super V, ? super E, ? extends V, X> remappingFunction) throws X { N.checkArgNotNull(remappingFunction); N.checkArgNotNull(e); final V oldValue = get(key); if (N.isNullOrEmpty(oldValue)) { put(key, e); return get(key); } final V newValue = remappingFunction.apply(oldValue, e); if (N.notNullOrEmpty(newValue)) { valueMap.put(key, newValue); } else { if (oldValue != null) { valueMap.remove(key); } } return newValue; }
java
public <X extends Exception> V merge(K key, E e, Try.BiFunction<? super V, ? super E, ? extends V, X> remappingFunction) throws X { N.checkArgNotNull(remappingFunction); N.checkArgNotNull(e); final V oldValue = get(key); if (N.isNullOrEmpty(oldValue)) { put(key, e); return get(key); } final V newValue = remappingFunction.apply(oldValue, e); if (N.notNullOrEmpty(newValue)) { valueMap.put(key, newValue); } else { if (oldValue != null) { valueMap.remove(key); } } return newValue; }
[ "public", "<", "X", "extends", "Exception", ">", "V", "merge", "(", "K", "key", ",", "E", "e", ",", "Try", ".", "BiFunction", "<", "?", "super", "V", ",", "?", "super", "E", ",", "?", "extends", "V", ",", "X", ">", "remappingFunction", ")", "thro...
The implementation is equivalent to performing the following steps for this Multimap: <pre> final V oldValue = get(key); if (N.isNullOrEmpty(oldValue)) { put(key, e); return get(key); } final V newValue = remappingFunction.apply(oldValue, e); if (N.notNullOrEmpty(newValue)) { valueMap.put(key, newValue); } else { if (oldValue != null) { valueMap.remove(key); } } return newValue; </pre> @param key @param e @param remappingFunction @return
[ "The", "implementation", "is", "equivalent", "to", "performing", "the", "following", "steps", "for", "this", "Multimap", ":" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Multimap.java#L1264-L1286
recommenders/rival
rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java
MultipleRecommendationRunner.runMahoutRecommenders
public static void runMahoutRecommenders(final Set<String> paths, final Properties properties) { for (AbstractRunner<Long, Long> rec : instantiateMahoutRecommenders(paths, properties)) { RecommendationRunner.run(rec); } }
java
public static void runMahoutRecommenders(final Set<String> paths, final Properties properties) { for (AbstractRunner<Long, Long> rec : instantiateMahoutRecommenders(paths, properties)) { RecommendationRunner.run(rec); } }
[ "public", "static", "void", "runMahoutRecommenders", "(", "final", "Set", "<", "String", ">", "paths", ",", "final", "Properties", "properties", ")", "{", "for", "(", "AbstractRunner", "<", "Long", ",", "Long", ">", "rec", ":", "instantiateMahoutRecommenders", ...
Runs Mahout-based recommenders. @param paths the input and output paths. @param properties the properties.
[ "Runs", "Mahout", "-", "based", "recommenders", "." ]
train
https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java#L229-L233
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java
TypeUtil.binaryNumericPromotion
public TypeMirror binaryNumericPromotion(TypeMirror type1, TypeMirror type2) { TypeKind t1 = type1.getKind(); TypeKind t2 = type2.getKind(); if (t1 == TypeKind.DECLARED) { t1 = javacTypes.unboxedType(type1).getKind(); } if (t2 == TypeKind.DECLARED) { t2 = javacTypes.unboxedType(type2).getKind(); } if (t1 == TypeKind.DOUBLE || t2 == TypeKind.DOUBLE) { return getDouble(); } else if (t1 == TypeKind.FLOAT || t2 == TypeKind.FLOAT) { return getFloat(); } else if (t1 == TypeKind.LONG || t2 == TypeKind.LONG) { return getLong(); } else { return getInt(); } }
java
public TypeMirror binaryNumericPromotion(TypeMirror type1, TypeMirror type2) { TypeKind t1 = type1.getKind(); TypeKind t2 = type2.getKind(); if (t1 == TypeKind.DECLARED) { t1 = javacTypes.unboxedType(type1).getKind(); } if (t2 == TypeKind.DECLARED) { t2 = javacTypes.unboxedType(type2).getKind(); } if (t1 == TypeKind.DOUBLE || t2 == TypeKind.DOUBLE) { return getDouble(); } else if (t1 == TypeKind.FLOAT || t2 == TypeKind.FLOAT) { return getFloat(); } else if (t1 == TypeKind.LONG || t2 == TypeKind.LONG) { return getLong(); } else { return getInt(); } }
[ "public", "TypeMirror", "binaryNumericPromotion", "(", "TypeMirror", "type1", ",", "TypeMirror", "type2", ")", "{", "TypeKind", "t1", "=", "type1", ".", "getKind", "(", ")", ";", "TypeKind", "t2", "=", "type2", ".", "getKind", "(", ")", ";", "if", "(", "...
If either type is a double TypeMirror, a double TypeMirror is returned. Otherwise, if either type is a float TypeMirror, a float TypeMirror is returned. Otherwise, if either type is a long TypeMirror, a long TypeMirror is returned. Otherwise, an int TypeMirror is returned. See jls-5.6.2. @param type1 a numeric type @param type2 a numeric type @return the result of binary numeric promotion applied to type1 and type2
[ "If", "either", "type", "is", "a", "double", "TypeMirror", "a", "double", "TypeMirror", "is", "returned", ".", "Otherwise", "if", "either", "type", "is", "a", "float", "TypeMirror", "a", "float", "TypeMirror", "is", "returned", ".", "Otherwise", "if", "eithe...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java#L319-L337
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFieldsForDumping.java
EmulatedFieldsForDumping.put
@Override public void put(String name, Object value) { emulatedFields.put(name, value); }
java
@Override public void put(String name, Object value) { emulatedFields.put(name, value); }
[ "@", "Override", "public", "void", "put", "(", "String", "name", ",", "Object", "value", ")", "{", "emulatedFields", ".", "put", "(", "name", ",", "value", ")", ";", "}" ]
Find and set the Object value of a given field named <code>name</code> in the receiver. @param name A String, the name of the field to set @param value New value for the field.
[ "Find", "and", "set", "the", "Object", "value", "of", "a", "given", "field", "named", "<code", ">", "name<", "/", "code", ">", "in", "the", "receiver", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFieldsForDumping.java#L152-L155
rnorth/visible-assertions
src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java
VisibleAssertions.assertEquals
public static void assertEquals(String message, Object expected, Object actual) { String expectedInQuotes = inQuotesIfNotNull(expected); String actualInQuotes = inQuotesIfNotNull(actual); if (areBothNull(expected, actual)) { pass(message); } else if (isObjectEquals(expected, actual)) { pass(message); } else if (isObjectStringEqualsButDifferentType(expected, actual)) { String actualClass = actual.getClass().getCanonicalName(); String expectedClass = expected.getClass().getCanonicalName(); fail(message, actualInQuotes + " [" + actualClass + "] does not equal expected " + expectedInQuotes + " [" + expectedClass + "]"); } else { fail(message, actualInQuotes + " does not equal expected " + expectedInQuotes); } }
java
public static void assertEquals(String message, Object expected, Object actual) { String expectedInQuotes = inQuotesIfNotNull(expected); String actualInQuotes = inQuotesIfNotNull(actual); if (areBothNull(expected, actual)) { pass(message); } else if (isObjectEquals(expected, actual)) { pass(message); } else if (isObjectStringEqualsButDifferentType(expected, actual)) { String actualClass = actual.getClass().getCanonicalName(); String expectedClass = expected.getClass().getCanonicalName(); fail(message, actualInQuotes + " [" + actualClass + "] does not equal expected " + expectedInQuotes + " [" + expectedClass + "]"); } else { fail(message, actualInQuotes + " does not equal expected " + expectedInQuotes); } }
[ "public", "static", "void", "assertEquals", "(", "String", "message", ",", "Object", "expected", ",", "Object", "actual", ")", "{", "String", "expectedInQuotes", "=", "inQuotesIfNotNull", "(", "expected", ")", ";", "String", "actualInQuotes", "=", "inQuotesIfNotNu...
Assert that an actual value is equal to an expected value. <p> Equality is tested with the standard Object equals() method, unless both values are null. <p> If the assertion passes, a green tick will be shown. If the assertion fails, a red cross will be shown. @param message message to display alongside the assertion outcome @param expected the expected value @param actual the actual value
[ "Assert", "that", "an", "actual", "value", "is", "equal", "to", "an", "expected", "value", ".", "<p", ">", "Equality", "is", "tested", "with", "the", "standard", "Object", "equals", "()", "method", "unless", "both", "values", "are", "null", ".", "<p", ">...
train
https://github.com/rnorth/visible-assertions/blob/6d7a7724db40ac0e9f87279553f814b790310b3b/src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java#L160-L176
Omertron/api-thetvdb
src/main/java/com/omertron/thetvdbapi/TheTVDBApi.java
TheTVDBApi.getSeries
public Series getSeries(String id, String language) throws TvDbException { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append(BASE_URL) .append(apiKey) .append(SERIES_URL) .append(id) .append("/"); if (StringUtils.isNotBlank(language)) { urlBuilder.append(language).append(XML_EXTENSION); } LOG.trace(URL, urlBuilder.toString()); List<Series> seriesList = TvdbParser.getSeriesList(urlBuilder.toString()); if (seriesList.isEmpty()) { return null; } else { return seriesList.get(0); } }
java
public Series getSeries(String id, String language) throws TvDbException { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append(BASE_URL) .append(apiKey) .append(SERIES_URL) .append(id) .append("/"); if (StringUtils.isNotBlank(language)) { urlBuilder.append(language).append(XML_EXTENSION); } LOG.trace(URL, urlBuilder.toString()); List<Series> seriesList = TvdbParser.getSeriesList(urlBuilder.toString()); if (seriesList.isEmpty()) { return null; } else { return seriesList.get(0); } }
[ "public", "Series", "getSeries", "(", "String", "id", ",", "String", "language", ")", "throws", "TvDbException", "{", "StringBuilder", "urlBuilder", "=", "new", "StringBuilder", "(", ")", ";", "urlBuilder", ".", "append", "(", "BASE_URL", ")", ".", "append", ...
Get the series information @param id @param language @return @throws com.omertron.thetvdbapi.TvDbException
[ "Get", "the", "series", "information" ]
train
https://github.com/Omertron/api-thetvdb/blob/2ff9f9580e76043f19d2fc3234d87e16a95fa485/src/main/java/com/omertron/thetvdbapi/TheTVDBApi.java#L96-L114
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java
HttpHeaderMap.setLongHeader
public void setLongHeader (@Nonnull @Nonempty final String sName, final long nValue) { _setHeader (sName, Long.toString (nValue)); }
java
public void setLongHeader (@Nonnull @Nonempty final String sName, final long nValue) { _setHeader (sName, Long.toString (nValue)); }
[ "public", "void", "setLongHeader", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sName", ",", "final", "long", "nValue", ")", "{", "_setHeader", "(", "sName", ",", "Long", ".", "toString", "(", "nValue", ")", ")", ";", "}" ]
Set the passed header as a number. @param sName Header name. May neither be <code>null</code> nor empty. @param nValue The value to be set. May not be <code>null</code>.
[ "Set", "the", "passed", "header", "as", "a", "number", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java#L369-L372
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/http/HttpMessage.java
HttpMessage.setField
public void setField(String name, List value) { if (_state!=__MSG_EDITABLE) return; _header.put(name,value); }
java
public void setField(String name, List value) { if (_state!=__MSG_EDITABLE) return; _header.put(name,value); }
[ "public", "void", "setField", "(", "String", "name", ",", "List", "value", ")", "{", "if", "(", "_state", "!=", "__MSG_EDITABLE", ")", "return", ";", "_header", ".", "put", "(", "name", ",", "value", ")", ";", "}" ]
Set a multi-value field value. If the message is editable, then a header field is set. Otherwise if the meesage is sending and a HTTP/1.1 version, then a trailer field is set. @param name Name of field @param value New values of field
[ "Set", "a", "multi", "-", "value", "field", "value", ".", "If", "the", "message", "is", "editable", "then", "a", "header", "field", "is", "set", ".", "Otherwise", "if", "the", "meesage", "is", "sending", "and", "a", "HTTP", "/", "1", ".", "1", "versi...
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/HttpMessage.java#L290-L295
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/script/ScriptBuilder.java
ScriptBuilder.bigNum
protected ScriptBuilder bigNum(int index, long num) { final byte[] data; if (num == 0) { data = new byte[0]; } else { Stack<Byte> result = new Stack<>(); final boolean neg = num < 0; long absvalue = Math.abs(num); while (absvalue != 0) { result.push((byte) (absvalue & 0xff)); absvalue >>= 8; } if ((result.peek() & 0x80) != 0) { // The most significant byte is >= 0x80, so push an extra byte that // contains just the sign of the value. result.push((byte) (neg ? 0x80 : 0)); } else if (neg) { // The most significant byte is < 0x80 and the value is negative, // set the sign bit so it is subtracted and interpreted as a // negative when converting back to an integral. result.push((byte) (result.pop() | 0x80)); } data = new byte[result.size()]; for (int byteIdx = 0; byteIdx < data.length; byteIdx++) { data[byteIdx] = result.get(byteIdx); } } // At most the encoded value could take up to 8 bytes, so we don't need // to use OP_PUSHDATA opcodes return addChunk(index, new ScriptChunk(data.length, data)); }
java
protected ScriptBuilder bigNum(int index, long num) { final byte[] data; if (num == 0) { data = new byte[0]; } else { Stack<Byte> result = new Stack<>(); final boolean neg = num < 0; long absvalue = Math.abs(num); while (absvalue != 0) { result.push((byte) (absvalue & 0xff)); absvalue >>= 8; } if ((result.peek() & 0x80) != 0) { // The most significant byte is >= 0x80, so push an extra byte that // contains just the sign of the value. result.push((byte) (neg ? 0x80 : 0)); } else if (neg) { // The most significant byte is < 0x80 and the value is negative, // set the sign bit so it is subtracted and interpreted as a // negative when converting back to an integral. result.push((byte) (result.pop() | 0x80)); } data = new byte[result.size()]; for (int byteIdx = 0; byteIdx < data.length; byteIdx++) { data[byteIdx] = result.get(byteIdx); } } // At most the encoded value could take up to 8 bytes, so we don't need // to use OP_PUSHDATA opcodes return addChunk(index, new ScriptChunk(data.length, data)); }
[ "protected", "ScriptBuilder", "bigNum", "(", "int", "index", ",", "long", "num", ")", "{", "final", "byte", "[", "]", "data", ";", "if", "(", "num", "==", "0", ")", "{", "data", "=", "new", "byte", "[", "0", "]", ";", "}", "else", "{", "Stack", ...
Adds the given number as a push data chunk to the given index in the program. This is intended to use for negative numbers or values greater than 16, and although it will accept numbers in the range 0-16 inclusive, the encoding would be considered non-standard. @see #number(long)
[ "Adds", "the", "given", "number", "as", "a", "push", "data", "chunk", "to", "the", "given", "index", "in", "the", "program", ".", "This", "is", "intended", "to", "use", "for", "negative", "numbers", "or", "values", "greater", "than", "16", "and", "althou...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java#L181-L216
landawn/AbacusUtil
src/com/landawn/abacus/util/IOUtil.java
IOUtil.copyURLToFile
public static void copyURLToFile(final URL source, final File destination) throws UncheckedIOException { InputStream is = null; try { is = source.openStream(); write(destination, is); } catch (IOException e) { throw new UncheckedIOException(e); } finally { close(is); } }
java
public static void copyURLToFile(final URL source, final File destination) throws UncheckedIOException { InputStream is = null; try { is = source.openStream(); write(destination, is); } catch (IOException e) { throw new UncheckedIOException(e); } finally { close(is); } }
[ "public", "static", "void", "copyURLToFile", "(", "final", "URL", "source", ",", "final", "File", "destination", ")", "throws", "UncheckedIOException", "{", "InputStream", "is", "=", "null", ";", "try", "{", "is", "=", "source", ".", "openStream", "(", ")", ...
Copies bytes from the URL <code>source</code> to a file <code>destination</code>. The directories up to <code>destination</code> will be created if they don't already exist. <code>destination</code> will be overwritten if it already exists. <p> Warning: this method does not set a connection or read timeout and thus might block forever. Use {@link #copyURLToFile(URL, File, int, int)} with reasonable timeouts to prevent this. @param source the <code>URL</code> to copy bytes from, must not be {@code null} @param destination the non-directory <code>File</code> to write bytes to (possibly overwriting), must not be {@code null} @throws UncheckedIOException if <code>source</code> URL cannot be opened @throws UncheckedIOException if <code>destination</code> is a directory @throws UncheckedIOException if <code>destination</code> cannot be written @throws UncheckedIOException if <code>destination</code> needs creating but can't be @throws UncheckedIOException if an IO error occurs during copying
[ "Copies", "bytes", "from", "the", "URL", "<code", ">", "source<", "/", "code", ">", "to", "a", "file", "<code", ">", "destination<", "/", "code", ">", ".", "The", "directories", "up", "to", "<code", ">", "destination<", "/", "code", ">", "will", "be", ...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/IOUtil.java#L2994-L3005
sdl/Testy
src/main/java/com/sdl/selenium/web/utils/GetData.java
GetData.getDate
public static String getDate(int days, int months, int years, String format) { return getDate(days, months, years, format, Locale.ENGLISH); }
java
public static String getDate(int days, int months, int years, String format) { return getDate(days, months, years, format, Locale.ENGLISH); }
[ "public", "static", "String", "getDate", "(", "int", "days", ",", "int", "months", ",", "int", "years", ",", "String", "format", ")", "{", "return", "getDate", "(", "days", ",", "months", ",", "years", ",", "format", ",", "Locale", ".", "ENGLISH", ")",...
Get Current day (+/- number of days/months/years) @param days days @param months months @param years years @param format format @return data
[ "Get", "Current", "day", "(", "+", "/", "-", "number", "of", "days", "/", "months", "/", "years", ")" ]
train
https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/web/utils/GetData.java#L51-L53
wanglinsong/thx-webservice
src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java
WebServiceCommunication.putJson
public String putJson(String endpoint, String params, JSONObject json) throws IOException { return this.putJson(endpoint, params, json, ""); }
java
public String putJson(String endpoint, String params, JSONObject json) throws IOException { return this.putJson(endpoint, params, json, ""); }
[ "public", "String", "putJson", "(", "String", "endpoint", ",", "String", "params", ",", "JSONObject", "json", ")", "throws", "IOException", "{", "return", "this", ".", "putJson", "(", "endpoint", ",", "params", ",", "json", ",", "\"\"", ")", ";", "}" ]
Issues HTTP PUT request, returns response body as string. @param endpoint endpoint of request url @param params request line parameters @param json request body @return response body @throws IOException in case of any IO related issue
[ "Issues", "HTTP", "PUT", "request", "returns", "response", "body", "as", "string", "." ]
train
https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java#L1058-L1060
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/raytrace/RaytraceWorld.java
RaytraceWorld.rayTraceBlock
public RayTraceResult rayTraceBlock(BlockPos pos, Point exit) { IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); //TODO: fix getBoundingBox for IBoundingBox ? if (hasOption(Options.CHECK_COLLISION) && state.getBoundingBox(world, pos) == null) return null; if (!block.canCollideCheck(state, hasOption(Options.HIT_LIQUIDS))) return null; return new RaytraceBlock(world, src, exit, pos).trace(); }
java
public RayTraceResult rayTraceBlock(BlockPos pos, Point exit) { IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); //TODO: fix getBoundingBox for IBoundingBox ? if (hasOption(Options.CHECK_COLLISION) && state.getBoundingBox(world, pos) == null) return null; if (!block.canCollideCheck(state, hasOption(Options.HIT_LIQUIDS))) return null; return new RaytraceBlock(world, src, exit, pos).trace(); }
[ "public", "RayTraceResult", "rayTraceBlock", "(", "BlockPos", "pos", ",", "Point", "exit", ")", "{", "IBlockState", "state", "=", "world", ".", "getBlockState", "(", "pos", ")", ";", "Block", "block", "=", "state", ".", "getBlock", "(", ")", ";", "//TODO: ...
Raytraces inside an actual block area. Calls {@link Block#collisionRayTrace(IBlockState, World, BlockPos, net.minecraft.util.math.Vec3d, net.minecraft.util.math.Vec3d)} @param pos the pos @param exit the exit @return the {@link RayTraceResult} return by block raytrace
[ "Raytraces", "inside", "an", "actual", "block", "area", ".", "Calls", "{", "@link", "Block#collisionRayTrace", "(", "IBlockState", "World", "BlockPos", "net", ".", "minecraft", ".", "util", ".", "math", ".", "Vec3d", "net", ".", "minecraft", ".", "util", "."...
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/raytrace/RaytraceWorld.java#L281-L291
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/Messages.java
Messages.formatMessage
private String formatMessage(String message, String language, Object... args) { if (args != null && args.length > 0) { // only format a message if we have arguments Locale locale = languages.getLocaleOrDefault(language); MessageFormat messageFormat = new MessageFormat(message, locale); return messageFormat.format(args); } return message; }
java
private String formatMessage(String message, String language, Object... args) { if (args != null && args.length > 0) { // only format a message if we have arguments Locale locale = languages.getLocaleOrDefault(language); MessageFormat messageFormat = new MessageFormat(message, locale); return messageFormat.format(args); } return message; }
[ "private", "String", "formatMessage", "(", "String", "message", ",", "String", "language", ",", "Object", "...", "args", ")", "{", "if", "(", "args", "!=", "null", "&&", "args", ".", "length", ">", "0", ")", "{", "// only format a message if we have arguments"...
Optionally formats a message for the requested language with {@link java.text.MessageFormat}. @param message @param language @param args @return the message
[ "Optionally", "formats", "a", "message", "for", "the", "requested", "language", "with", "{", "@link", "java", ".", "text", ".", "MessageFormat", "}", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Messages.java#L403-L412
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java
WorkQueueManager.createNewThread
protected void createNewThread(ChannelSelector sr, int threadType, int number) { StartPrivilegedThread privThread = new StartPrivilegedThread(sr, threadType, number, this.tGroup); AccessController.doPrivileged(privThread); }
java
protected void createNewThread(ChannelSelector sr, int threadType, int number) { StartPrivilegedThread privThread = new StartPrivilegedThread(sr, threadType, number, this.tGroup); AccessController.doPrivileged(privThread); }
[ "protected", "void", "createNewThread", "(", "ChannelSelector", "sr", ",", "int", "threadType", ",", "int", "number", ")", "{", "StartPrivilegedThread", "privThread", "=", "new", "StartPrivilegedThread", "(", "sr", ",", "threadType", ",", "number", ",", "this", ...
Create a new reader thread. Provided so we can support pulling these from a thread pool in the SyncWorkQueueManager. This will allow these threads to have WSTHreadLocal. @param sr @param threadType @param number
[ "Create", "a", "new", "reader", "thread", ".", "Provided", "so", "we", "can", "support", "pulling", "these", "from", "a", "thread", "pool", "in", "the", "SyncWorkQueueManager", ".", "This", "will", "allow", "these", "threads", "to", "have", "WSTHreadLocal", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java#L808-L811
overturetool/overture
core/pog/src/main/java/org/overture/pog/visitors/PatternToExpVisitor.java
PatternToExpVisitor.pattern2DummyDef
private ALocalDefinition pattern2DummyDef(PPattern pat) { ALocalDefinition r = AstFactory.newALocalDefinition(null, new LexNameToken("", "", pat.getLocation().clone()), NameScope.LOCAL, new AUnknownType()); return r; }
java
private ALocalDefinition pattern2DummyDef(PPattern pat) { ALocalDefinition r = AstFactory.newALocalDefinition(null, new LexNameToken("", "", pat.getLocation().clone()), NameScope.LOCAL, new AUnknownType()); return r; }
[ "private", "ALocalDefinition", "pattern2DummyDef", "(", "PPattern", "pat", ")", "{", "ALocalDefinition", "r", "=", "AstFactory", ".", "newALocalDefinition", "(", "null", ",", "new", "LexNameToken", "(", "\"\"", ",", "\"\"", ",", "pat", ".", "getLocation", "(", ...
/* VarExps in the CGP need a corresponding vardef or it crashes. So we add dummy definitions to avoid the crash. The definition is never needed for anything.
[ "/", "*", "VarExps", "in", "the", "CGP", "need", "a", "corresponding", "vardef", "or", "it", "crashes", ".", "So", "we", "add", "dummy", "definitions", "to", "avoid", "the", "crash", ".", "The", "definition", "is", "never", "needed", "for", "anything", "...
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/pog/src/main/java/org/overture/pog/visitors/PatternToExpVisitor.java#L315-L319
palatable/lambda
src/main/java/com/jnape/palatable/lambda/adt/Either.java
Either.trying
public static <T extends Throwable, R> Either<T, R> trying(CheckedSupplier<T, R> supplier) { return trying(supplier, id()); }
java
public static <T extends Throwable, R> Either<T, R> trying(CheckedSupplier<T, R> supplier) { return trying(supplier, id()); }
[ "public", "static", "<", "T", "extends", "Throwable", ",", "R", ">", "Either", "<", "T", ",", "R", ">", "trying", "(", "CheckedSupplier", "<", "T", ",", "R", ">", "supplier", ")", "{", "return", "trying", "(", "supplier", ",", "id", "(", ")", ")", ...
Attempt to execute the {@link CheckedSupplier}, returning its result in a right value. If the supplier throws an exception, wrap it in a left value and return it. @param supplier the supplier of the right value @param <T> the left parameter type (the most contravariant exception that supplier might throw) @param <R> the right parameter type @return the supplier result as a right value, or a left value of the thrown exception
[ "Attempt", "to", "execute", "the", "{", "@link", "CheckedSupplier", "}", "returning", "its", "result", "in", "a", "right", "value", ".", "If", "the", "supplier", "throws", "an", "exception", "wrap", "it", "in", "a", "left", "value", "and", "return", "it", ...
train
https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/adt/Either.java#L346-L348
ical4j/ical4j
src/main/java/net/fortuna/ical4j/model/DateTime.java
DateTime.setTimeZone
public final void setTimeZone(final TimeZone timezone) { this.timezone = timezone; if (timezone != null) { getFormat().setTimeZone(timezone); } else { resetTimeZone(); } time = new Time(time, getFormat().getTimeZone(), false); }
java
public final void setTimeZone(final TimeZone timezone) { this.timezone = timezone; if (timezone != null) { getFormat().setTimeZone(timezone); } else { resetTimeZone(); } time = new Time(time, getFormat().getTimeZone(), false); }
[ "public", "final", "void", "setTimeZone", "(", "final", "TimeZone", "timezone", ")", "{", "this", ".", "timezone", "=", "timezone", ";", "if", "(", "timezone", "!=", "null", ")", "{", "getFormat", "(", ")", ".", "setTimeZone", "(", "timezone", ")", ";", ...
Sets the timezone associated with this date-time instance. If the specified timezone is null, it will reset to the default timezone. If the date-time instance is utc, it will turn into either a floating (no timezone) date-time, or a date-time with a timezone. @param timezone a timezone to apply to the instance
[ "Sets", "the", "timezone", "associated", "with", "this", "date", "-", "time", "instance", ".", "If", "the", "specified", "timezone", "is", "null", "it", "will", "reset", "to", "the", "default", "timezone", ".", "If", "the", "date", "-", "time", "instance",...
train
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/model/DateTime.java#L465-L473
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java
BaseBigtableTableAdminClient.checkConsistency
public final CheckConsistencyResponse checkConsistency(String name, String consistencyToken) { CheckConsistencyRequest request = CheckConsistencyRequest.newBuilder() .setName(name) .setConsistencyToken(consistencyToken) .build(); return checkConsistency(request); }
java
public final CheckConsistencyResponse checkConsistency(String name, String consistencyToken) { CheckConsistencyRequest request = CheckConsistencyRequest.newBuilder() .setName(name) .setConsistencyToken(consistencyToken) .build(); return checkConsistency(request); }
[ "public", "final", "CheckConsistencyResponse", "checkConsistency", "(", "String", "name", ",", "String", "consistencyToken", ")", "{", "CheckConsistencyRequest", "request", "=", "CheckConsistencyRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", ")", ...
Checks replication consistency based on a consistency token, that is, if replication has caught up based on the conditions specified in the token and the check request. <p>Sample code: <pre><code> try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) { TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); String consistencyToken = ""; CheckConsistencyResponse response = baseBigtableTableAdminClient.checkConsistency(name.toString(), consistencyToken); } </code></pre> @param name The unique name of the Table for which to check replication consistency. Values are of the form `projects/&lt;project&gt;/instances/&lt;instance&gt;/tables/&lt;table&gt;`. @param consistencyToken The token created using GenerateConsistencyToken for the Table. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Checks", "replication", "consistency", "based", "on", "a", "consistency", "token", "that", "is", "if", "replication", "has", "caught", "up", "based", "on", "the", "conditions", "specified", "in", "the", "token", "and", "the", "check", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java#L1088-L1096
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java
SyncMembersInner.listMemberSchemasAsync
public Observable<Page<SyncFullSchemaPropertiesInner>> listMemberSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) { return listMemberSchemasWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) .map(new Func1<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>, Page<SyncFullSchemaPropertiesInner>>() { @Override public Page<SyncFullSchemaPropertiesInner> call(ServiceResponse<Page<SyncFullSchemaPropertiesInner>> response) { return response.body(); } }); }
java
public Observable<Page<SyncFullSchemaPropertiesInner>> listMemberSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) { return listMemberSchemasWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) .map(new Func1<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>, Page<SyncFullSchemaPropertiesInner>>() { @Override public Page<SyncFullSchemaPropertiesInner> call(ServiceResponse<Page<SyncFullSchemaPropertiesInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "SyncFullSchemaPropertiesInner", ">", ">", "listMemberSchemasAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "serverName", ",", "final", "String", "databaseName", ",", "final", "String", "syncGroup...
Gets a sync member database schema. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database on which the sync group is hosted. @param syncGroupName The name of the sync group on which the sync member is hosted. @param syncMemberName The name of the sync member. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SyncFullSchemaPropertiesInner&gt; object
[ "Gets", "a", "sync", "member", "database", "schema", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java#L1050-L1058
prestodb/presto
presto-parser/src/main/java/com/facebook/presto/sql/tree/Expression.java
Expression.accept
@Override protected <R, C> R accept(AstVisitor<R, C> visitor, C context) { return visitor.visitExpression(this, context); }
java
@Override protected <R, C> R accept(AstVisitor<R, C> visitor, C context) { return visitor.visitExpression(this, context); }
[ "@", "Override", "protected", "<", "R", ",", "C", ">", "R", "accept", "(", "AstVisitor", "<", "R", ",", "C", ">", "visitor", ",", "C", "context", ")", "{", "return", "visitor", ".", "visitExpression", "(", "this", ",", "context", ")", ";", "}" ]
Accessible for {@link AstVisitor}, use {@link AstVisitor#process(Node, Object)} instead.
[ "Accessible", "for", "{" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-parser/src/main/java/com/facebook/presto/sql/tree/Expression.java#L31-L35
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/i18n/dao/GeneratedDi18nDaoImpl.java
GeneratedDi18nDaoImpl.queryByLocalizedMessage
public Iterable<Di18n> queryByLocalizedMessage(java.lang.String localizedMessage) { return queryByField(null, Di18nMapper.Field.LOCALIZEDMESSAGE.getFieldName(), localizedMessage); }
java
public Iterable<Di18n> queryByLocalizedMessage(java.lang.String localizedMessage) { return queryByField(null, Di18nMapper.Field.LOCALIZEDMESSAGE.getFieldName(), localizedMessage); }
[ "public", "Iterable", "<", "Di18n", ">", "queryByLocalizedMessage", "(", "java", ".", "lang", ".", "String", "localizedMessage", ")", "{", "return", "queryByField", "(", "null", ",", "Di18nMapper", ".", "Field", ".", "LOCALIZEDMESSAGE", ".", "getFieldName", "(",...
query-by method for field localizedMessage @param localizedMessage the specified attribute @return an Iterable of Di18ns for the specified localizedMessage
[ "query", "-", "by", "method", "for", "field", "localizedMessage" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/i18n/dao/GeneratedDi18nDaoImpl.java#L88-L90
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoFieldUtils.java
PojoFieldUtils.readField
static Field readField(DataInputView in, ClassLoader userCodeClassLoader) throws IOException { Class<?> declaringClass = InstantiationUtil.resolveClassByName(in, userCodeClassLoader); String fieldName = in.readUTF(); return getField(fieldName, declaringClass); }
java
static Field readField(DataInputView in, ClassLoader userCodeClassLoader) throws IOException { Class<?> declaringClass = InstantiationUtil.resolveClassByName(in, userCodeClassLoader); String fieldName = in.readUTF(); return getField(fieldName, declaringClass); }
[ "static", "Field", "readField", "(", "DataInputView", "in", ",", "ClassLoader", "userCodeClassLoader", ")", "throws", "IOException", "{", "Class", "<", "?", ">", "declaringClass", "=", "InstantiationUtil", ".", "resolveClassByName", "(", "in", ",", "userCodeClassLoa...
Reads a field from the given {@link DataInputView}. <p>This read methods avoids Java serialization, by reading the classname of the field's declaring class and dynamically loading it. The field is also read by field name and obtained via reflection. @param in the input view to read from. @param userCodeClassLoader the user classloader. @return the read field.
[ "Reads", "a", "field", "from", "the", "given", "{", "@link", "DataInputView", "}", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoFieldUtils.java#L62-L66
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.serviceName_federation_activeDirectory_POST
public OvhTask serviceName_federation_activeDirectory_POST(String serviceName, String baseDnForGroups, String baseDnForUsers, String description, String domainAlias, String domainName, String ip, String password, String username) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/federation/activeDirectory"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "baseDnForGroups", baseDnForGroups); addBody(o, "baseDnForUsers", baseDnForUsers); addBody(o, "description", description); addBody(o, "domainAlias", domainAlias); addBody(o, "domainName", domainName); addBody(o, "ip", ip); addBody(o, "password", password); addBody(o, "username", username); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_federation_activeDirectory_POST(String serviceName, String baseDnForGroups, String baseDnForUsers, String description, String domainAlias, String domainName, String ip, String password, String username) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/federation/activeDirectory"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "baseDnForGroups", baseDnForGroups); addBody(o, "baseDnForUsers", baseDnForUsers); addBody(o, "description", description); addBody(o, "domainAlias", domainAlias); addBody(o, "domainName", domainName); addBody(o, "ip", ip); addBody(o, "password", password); addBody(o, "username", username); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_federation_activeDirectory_POST", "(", "String", "serviceName", ",", "String", "baseDnForGroups", ",", "String", "baseDnForUsers", ",", "String", "description", ",", "String", "domainAlias", ",", "String", "domainName", ",", "String", "...
Add a new option user access REST: POST /dedicatedCloud/{serviceName}/federation/activeDirectory @param domainAlias [required] Active Directory NetBIOS name, e.g. example @param username [required] Active Directory username, e.g. jdoe@example.com @param description [required] Description of your option access network @param domainName [required] Active Directory domain name, e.g. example.com @param baseDnForUsers [required] Active Directory base DN for users, e.g. dc=example,dc=com @param ip [required] IP address of the remote service, e.g. 123.100.200.0 @param password [required] Active Directory password @param baseDnForGroups [required] Active Directory base DN for groups, e.g. dc=example,dc=com @param serviceName [required] Domain of the service
[ "Add", "a", "new", "option", "user", "access" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L1075-L1089
JodaOrg/joda-time
src/main/java/org/joda/time/LocalDateTime.java
LocalDateTime.withDate
public LocalDateTime withDate(int year, int monthOfYear, int dayOfMonth) { Chronology chrono = getChronology(); long instant = getLocalMillis(); instant = chrono.year().set(instant, year); instant = chrono.monthOfYear().set(instant, monthOfYear); instant = chrono.dayOfMonth().set(instant, dayOfMonth); return withLocalMillis(instant); }
java
public LocalDateTime withDate(int year, int monthOfYear, int dayOfMonth) { Chronology chrono = getChronology(); long instant = getLocalMillis(); instant = chrono.year().set(instant, year); instant = chrono.monthOfYear().set(instant, monthOfYear); instant = chrono.dayOfMonth().set(instant, dayOfMonth); return withLocalMillis(instant); }
[ "public", "LocalDateTime", "withDate", "(", "int", "year", ",", "int", "monthOfYear", ",", "int", "dayOfMonth", ")", "{", "Chronology", "chrono", "=", "getChronology", "(", ")", ";", "long", "instant", "=", "getLocalMillis", "(", ")", ";", "instant", "=", ...
Returns a copy of this datetime with the specified date, retaining the time fields. <p> If the date is already the date passed in, then <code>this</code> is returned. <p> To set a single field use the properties, for example: <pre> DateTime set = dt.monthOfYear().setCopy(6); </pre> @param year the new year value @param monthOfYear the new monthOfYear value @param dayOfMonth the new dayOfMonth value @return a copy of this datetime with a different date @throws IllegalArgumentException if any value if invalid
[ "Returns", "a", "copy", "of", "this", "datetime", "with", "the", "specified", "date", "retaining", "the", "time", "fields", ".", "<p", ">", "If", "the", "date", "is", "already", "the", "date", "passed", "in", "then", "<code", ">", "this<", "/", "code", ...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/LocalDateTime.java#L910-L917
alkacon/opencms-core
src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java
CmsXmlContentPropertyHelper.getPropertyInfo
public static Map<String, CmsXmlContentProperty> getPropertyInfo( CmsObject cms, CmsResource page, CmsResource resource) throws CmsException { if (CmsResourceTypeXmlContent.isXmlContent(resource)) { I_CmsXmlContentHandler contentHandler = CmsXmlContentDefinition.getContentHandlerForResource(cms, resource); Map<String, CmsXmlContentProperty> propertiesConf = contentHandler.getSettings(cms, resource); CmsXmlContent content = CmsXmlContentFactory.unmarshal(cms, cms.readFile(resource)); CmsMacroResolver resolver = getMacroResolverForProperties(cms, contentHandler, content, null, page); return resolveMacrosInProperties(propertiesConf, resolver); } return Collections.<String, CmsXmlContentProperty> emptyMap(); }
java
public static Map<String, CmsXmlContentProperty> getPropertyInfo( CmsObject cms, CmsResource page, CmsResource resource) throws CmsException { if (CmsResourceTypeXmlContent.isXmlContent(resource)) { I_CmsXmlContentHandler contentHandler = CmsXmlContentDefinition.getContentHandlerForResource(cms, resource); Map<String, CmsXmlContentProperty> propertiesConf = contentHandler.getSettings(cms, resource); CmsXmlContent content = CmsXmlContentFactory.unmarshal(cms, cms.readFile(resource)); CmsMacroResolver resolver = getMacroResolverForProperties(cms, contentHandler, content, null, page); return resolveMacrosInProperties(propertiesConf, resolver); } return Collections.<String, CmsXmlContentProperty> emptyMap(); }
[ "public", "static", "Map", "<", "String", ",", "CmsXmlContentProperty", ">", "getPropertyInfo", "(", "CmsObject", "cms", ",", "CmsResource", "page", ",", "CmsResource", "resource", ")", "throws", "CmsException", "{", "if", "(", "CmsResourceTypeXmlContent", ".", "i...
Returns the property information for the given resource (type) AND the current user.<p> @param cms the current CMS context @param page the current container page @param resource the resource @return the property information @throws CmsException if something goes wrong
[ "Returns", "the", "property", "information", "for", "the", "given", "resource", "(", "type", ")", "AND", "the", "current", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java#L281-L295
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/SettingsInMemory.java
SettingsInMemory.getText
public String getText(Class<?> aClass, String key) { return getText(aClass.getName()+"."+key); }
java
public String getText(Class<?> aClass, String key) { return getText(aClass.getName()+"."+key); }
[ "public", "String", "getText", "(", "Class", "<", "?", ">", "aClass", ",", "String", "key", ")", "{", "return", "getText", "(", "aClass", ".", "getName", "(", ")", "+", "\".\"", "+", "key", ")", ";", "}" ]
Retrieves a Settings property as a String object. <p/>Loads the file if not already initialized. @param aClass the calling class @param key property key @return Value of the property as a string or null if no property found.
[ "Retrieves", "a", "Settings", "property", "as", "a", "String", "object", ".", "<p", "/", ">", "Loads", "the", "file", "if", "not", "already", "initialized", ".", "@param", "aClass", "the", "calling", "class", "@param", "key", "property", "key" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/SettingsInMemory.java#L112-L115
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearch.java
UserSearch.sendSearchForm
public ReportedData sendSearchForm(XMPPConnection con, Form searchForm, DomainBareJid searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { UserSearch search = new UserSearch(); search.setType(IQ.Type.set); search.setTo(searchService); search.addExtension(searchForm.getDataFormToSend()); IQ response = con.createStanzaCollectorAndSend(search).nextResultOrThrow(); return ReportedData.getReportedDataFrom(response); }
java
public ReportedData sendSearchForm(XMPPConnection con, Form searchForm, DomainBareJid searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { UserSearch search = new UserSearch(); search.setType(IQ.Type.set); search.setTo(searchService); search.addExtension(searchForm.getDataFormToSend()); IQ response = con.createStanzaCollectorAndSend(search).nextResultOrThrow(); return ReportedData.getReportedDataFrom(response); }
[ "public", "ReportedData", "sendSearchForm", "(", "XMPPConnection", "con", ",", "Form", "searchForm", ",", "DomainBareJid", "searchService", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "Us...
Sends the filled out answer form to be sent and queried by the search service. @param con the current XMPPConnection. @param searchForm the <code>Form</code> to send for querying. @param searchService the search service to use. (ex. search.jivesoftware.com) @return ReportedData the data found from the query. @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Sends", "the", "filled", "out", "answer", "form", "to", "be", "sent", "and", "queried", "by", "the", "search", "service", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearch.java#L94-L102
spring-projects/spring-social
spring-social-web/src/main/java/org/springframework/social/connect/web/ConnectSupport.java
ConnectSupport.buildOAuthUrl
public String buildOAuthUrl(ConnectionFactory<?> connectionFactory, NativeWebRequest request, MultiValueMap<String, String> additionalParameters) { if (connectionFactory instanceof OAuth1ConnectionFactory) { return buildOAuth1Url((OAuth1ConnectionFactory<?>) connectionFactory, request, additionalParameters); } else if (connectionFactory instanceof OAuth2ConnectionFactory) { return buildOAuth2Url((OAuth2ConnectionFactory<?>) connectionFactory, request, additionalParameters); } else { throw new IllegalArgumentException("ConnectionFactory not supported"); } }
java
public String buildOAuthUrl(ConnectionFactory<?> connectionFactory, NativeWebRequest request, MultiValueMap<String, String> additionalParameters) { if (connectionFactory instanceof OAuth1ConnectionFactory) { return buildOAuth1Url((OAuth1ConnectionFactory<?>) connectionFactory, request, additionalParameters); } else if (connectionFactory instanceof OAuth2ConnectionFactory) { return buildOAuth2Url((OAuth2ConnectionFactory<?>) connectionFactory, request, additionalParameters); } else { throw new IllegalArgumentException("ConnectionFactory not supported"); } }
[ "public", "String", "buildOAuthUrl", "(", "ConnectionFactory", "<", "?", ">", "connectionFactory", ",", "NativeWebRequest", "request", ",", "MultiValueMap", "<", "String", ",", "String", ">", "additionalParameters", ")", "{", "if", "(", "connectionFactory", "instanc...
Builds the provider URL to redirect the user to for connection authorization. @param connectionFactory the service provider's connection factory e.g. FacebookConnectionFactory @param request the current web request @param additionalParameters parameters to add to the authorization URL. @return the URL to redirect the user to for authorization @throws IllegalArgumentException if the connection factory is not OAuth1 based.
[ "Builds", "the", "provider", "URL", "to", "redirect", "the", "user", "to", "for", "connection", "authorization", "." ]
train
https://github.com/spring-projects/spring-social/blob/e41cfecb288022b83c79413b58f52511c3c9d4fc/spring-social-web/src/main/java/org/springframework/social/connect/web/ConnectSupport.java#L124-L132
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.whereLessThan
@Nonnull public Query whereLessThan(@Nonnull FieldPath fieldPath, @Nonnull Object value) { Preconditions.checkState( options.startCursor == null && options.endCursor == null, "Cannot call whereLessThan() after defining a boundary with startAt(), " + "startAfter(), endBefore() or endAt()."); QueryOptions newOptions = new QueryOptions(options); newOptions.fieldFilters.add(new ComparisonFilter(fieldPath, LESS_THAN, value)); return new Query(firestore, path, newOptions); }
java
@Nonnull public Query whereLessThan(@Nonnull FieldPath fieldPath, @Nonnull Object value) { Preconditions.checkState( options.startCursor == null && options.endCursor == null, "Cannot call whereLessThan() after defining a boundary with startAt(), " + "startAfter(), endBefore() or endAt()."); QueryOptions newOptions = new QueryOptions(options); newOptions.fieldFilters.add(new ComparisonFilter(fieldPath, LESS_THAN, value)); return new Query(firestore, path, newOptions); }
[ "@", "Nonnull", "public", "Query", "whereLessThan", "(", "@", "Nonnull", "FieldPath", "fieldPath", ",", "@", "Nonnull", "Object", "value", ")", "{", "Preconditions", ".", "checkState", "(", "options", ".", "startCursor", "==", "null", "&&", "options", ".", "...
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be less than the specified value. @param fieldPath The path of the field to compare. @param value The value for comparison. @return The created Query.
[ "Creates", "and", "returns", "a", "new", "Query", "with", "the", "additional", "filter", "that", "documents", "must", "contain", "the", "specified", "field", "and", "the", "value", "should", "be", "less", "than", "the", "specified", "value", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L470-L479
op4j/op4j
src/main/java/org/op4j/functions/FnNumber.java
FnNumber.toPercentStr
public static final Function<Number,String> toPercentStr(Locale locale) { return new ToString(NumberFormatType.PERCENT, locale); }
java
public static final Function<Number,String> toPercentStr(Locale locale) { return new ToString(NumberFormatType.PERCENT, locale); }
[ "public", "static", "final", "Function", "<", "Number", ",", "String", ">", "toPercentStr", "(", "Locale", "locale", ")", "{", "return", "new", "ToString", "(", "NumberFormatType", ".", "PERCENT", ",", "locale", ")", ";", "}" ]
<p> A {@link String} representing a percentage is created from the target number in the given {@link Locale} </p> @param locale the {@link Locale} to be used @return the string representation of the input number as a percentage
[ "<p", ">", "A", "{", "@link", "String", "}", "representing", "a", "percentage", "is", "created", "from", "the", "target", "number", "in", "the", "given", "{", "@link", "Locale", "}", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnNumber.java#L886-L888
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziAgent.java
EkstaziAgent.initSingleCoverageMode
private static boolean initSingleCoverageMode(final String runName, Instrumentation instrumentation) { // Check if run is affected and if not start coverage. if (Ekstazi.inst().checkIfAffected(runName)) { Ekstazi.inst().startCollectingDependencies(runName); // End coverage when VM ends execution. Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { Ekstazi.inst().finishCollectingDependencies(runName); } }); return true; } else { instrumentation.addTransformer(new RemoveMainCFT()); return false; } }
java
private static boolean initSingleCoverageMode(final String runName, Instrumentation instrumentation) { // Check if run is affected and if not start coverage. if (Ekstazi.inst().checkIfAffected(runName)) { Ekstazi.inst().startCollectingDependencies(runName); // End coverage when VM ends execution. Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { Ekstazi.inst().finishCollectingDependencies(runName); } }); return true; } else { instrumentation.addTransformer(new RemoveMainCFT()); return false; } }
[ "private", "static", "boolean", "initSingleCoverageMode", "(", "final", "String", "runName", ",", "Instrumentation", "instrumentation", ")", "{", "// Check if run is affected and if not start coverage.", "if", "(", "Ekstazi", ".", "inst", "(", ")", ".", "checkIfAffected",...
Initialize SingleMode run. We first check if run is affected and only in that case start coverage, otherwise we remove bodies of all main methods to avoid any execution.
[ "Initialize", "SingleMode", "run", ".", "We", "first", "check", "if", "run", "is", "affected", "and", "only", "in", "that", "case", "start", "coverage", "otherwise", "we", "remove", "bodies", "of", "all", "main", "methods", "to", "avoid", "any", "execution",...
train
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziAgent.java#L171-L187
lessthanoptimal/BoofCV
main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java
UtilImageIO.savePGM
public static void savePGM(GrayU8 gray , String fileName ) throws IOException { File out = new File(fileName); DataOutputStream os = new DataOutputStream(new FileOutputStream(out)); String header = String.format("P5\n%d %d\n255\n", gray.width, gray.height); os.write(header.getBytes()); os.write(gray.data,0,gray.width*gray.height); os.close(); }
java
public static void savePGM(GrayU8 gray , String fileName ) throws IOException { File out = new File(fileName); DataOutputStream os = new DataOutputStream(new FileOutputStream(out)); String header = String.format("P5\n%d %d\n255\n", gray.width, gray.height); os.write(header.getBytes()); os.write(gray.data,0,gray.width*gray.height); os.close(); }
[ "public", "static", "void", "savePGM", "(", "GrayU8", "gray", ",", "String", "fileName", ")", "throws", "IOException", "{", "File", "out", "=", "new", "File", "(", "fileName", ")", ";", "DataOutputStream", "os", "=", "new", "DataOutputStream", "(", "new", ...
Saves an image in PGM format. @param gray Gray scale image @param fileName Location where the image is to be written to. @throws IOException Thrown if there is a problem reading the image
[ "Saves", "an", "image", "in", "PGM", "format", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java#L500-L510
OpenLiberty/open-liberty
dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/IPAddressRange.java
IPAddressRange.belowRange
public boolean belowRange(InetAddress ip) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "belowRange, ip is " + ip); Tr.debug(tc, "belowRange, ipLower is " + ipLower); } return lessThan(ip, ipLower); }
java
public boolean belowRange(InetAddress ip) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "belowRange, ip is " + ip); Tr.debug(tc, "belowRange, ipLower is " + ipLower); } return lessThan(ip, ipLower); }
[ "public", "boolean", "belowRange", "(", "InetAddress", "ip", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"belowRange, ip is \"", "...
Is the given ip address numerically below the address range? Is it below ipLower? @param ip @return
[ "Is", "the", "given", "ip", "address", "numerically", "below", "the", "address", "range?", "Is", "it", "below", "ipLower?" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/IPAddressRange.java#L248-L254
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/TableKeysAndAttributes.java
TableKeysAndAttributes.withHashOnlyKeys
public TableKeysAndAttributes withHashOnlyKeys(String hashKeyName, Object ... hashKeyValues) { if (hashKeyName == null) throw new IllegalArgumentException(); PrimaryKey[] primaryKeys = new PrimaryKey[hashKeyValues.length]; for (int i=0; i < hashKeyValues.length; i++) primaryKeys[i] = new PrimaryKey(hashKeyName, hashKeyValues[i]); return withPrimaryKeys(primaryKeys); }
java
public TableKeysAndAttributes withHashOnlyKeys(String hashKeyName, Object ... hashKeyValues) { if (hashKeyName == null) throw new IllegalArgumentException(); PrimaryKey[] primaryKeys = new PrimaryKey[hashKeyValues.length]; for (int i=0; i < hashKeyValues.length; i++) primaryKeys[i] = new PrimaryKey(hashKeyName, hashKeyValues[i]); return withPrimaryKeys(primaryKeys); }
[ "public", "TableKeysAndAttributes", "withHashOnlyKeys", "(", "String", "hashKeyName", ",", "Object", "...", "hashKeyValues", ")", "{", "if", "(", "hashKeyName", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "PrimaryKey", "[", "]", ...
Used to specify multiple hash-only primary keys. @param hashKeyName hash-only key name @param hashKeyValues a list of hash key values
[ "Used", "to", "specify", "multiple", "hash", "-", "only", "primary", "keys", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/TableKeysAndAttributes.java#L84-L91
e-biz/spring-dbunit
spring-dbunit-core/src/main/java/com/excilys/ebi/spring/dbunit/dataset/xml/flyweight/FlyWeightFlatXmlProducer.java
FlyWeightFlatXmlProducer.mergeTableMetaData
private ITableMetaData mergeTableMetaData(List<Column> columnsToMerge, ITableMetaData originalMetaData) throws DataSetException { Column[] columns = new Column[originalMetaData.getColumns().length + columnsToMerge.size()]; System.arraycopy(originalMetaData.getColumns(), 0, columns, 0, originalMetaData.getColumns().length); for (int i = 0; i < columnsToMerge.size(); i++) { Column column = columnsToMerge.get(i); columns[columns.length - columnsToMerge.size() + i] = column; } return new DefaultTableMetaData(originalMetaData.getTableName(), columns); }
java
private ITableMetaData mergeTableMetaData(List<Column> columnsToMerge, ITableMetaData originalMetaData) throws DataSetException { Column[] columns = new Column[originalMetaData.getColumns().length + columnsToMerge.size()]; System.arraycopy(originalMetaData.getColumns(), 0, columns, 0, originalMetaData.getColumns().length); for (int i = 0; i < columnsToMerge.size(); i++) { Column column = columnsToMerge.get(i); columns[columns.length - columnsToMerge.size() + i] = column; } return new DefaultTableMetaData(originalMetaData.getTableName(), columns); }
[ "private", "ITableMetaData", "mergeTableMetaData", "(", "List", "<", "Column", ">", "columnsToMerge", ",", "ITableMetaData", "originalMetaData", ")", "throws", "DataSetException", "{", "Column", "[", "]", "columns", "=", "new", "Column", "[", "originalMetaData", "."...
merges the existing columns with the potentially new ones. @param columnsToMerge List of extra columns found, which need to be merge back into the metadata. @return ITableMetaData The merged metadata object containing the new columns @throws DataSetException
[ "merges", "the", "existing", "columns", "with", "the", "potentially", "new", "ones", "." ]
train
https://github.com/e-biz/spring-dbunit/blob/1ec51222ecdd5dbd6daa4bd6879c6eabe76dfb6b/spring-dbunit-core/src/main/java/com/excilys/ebi/spring/dbunit/dataset/xml/flyweight/FlyWeightFlatXmlProducer.java#L227-L237
elki-project/elki
addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/AbstractXTree.java
AbstractXTree.overflowTreatment
private N overflowTreatment(N node, IndexTreePath<SpatialEntry> path, int[] splitAxis) { if(node.isSuperNode()) { // only extend supernode; no re-insertions assert node.getCapacity() == node.getNumEntries(); assert node.getCapacity() > dirCapacity; node.growSuperNode(); return null; } // Handled by reinsertion? if(settings.getOverflowTreatment().handleOverflow(this, node, path)) { return null; } return split(node, splitAxis); }
java
private N overflowTreatment(N node, IndexTreePath<SpatialEntry> path, int[] splitAxis) { if(node.isSuperNode()) { // only extend supernode; no re-insertions assert node.getCapacity() == node.getNumEntries(); assert node.getCapacity() > dirCapacity; node.growSuperNode(); return null; } // Handled by reinsertion? if(settings.getOverflowTreatment().handleOverflow(this, node, path)) { return null; } return split(node, splitAxis); }
[ "private", "N", "overflowTreatment", "(", "N", "node", ",", "IndexTreePath", "<", "SpatialEntry", ">", "path", ",", "int", "[", "]", "splitAxis", ")", "{", "if", "(", "node", ".", "isSuperNode", "(", ")", ")", "{", "// only extend supernode; no re-insertions",...
Treatment of overflow in the specified node: if the node is not the root node and this is the first call of overflowTreatment in the given level during insertion the specified node will be reinserted, otherwise the node will be split. @param node the node where an overflow occurred @param path the path to the specified node @param splitAxis field for collecting the split axis used for this split or <code>-1</code> if the split was not successful @return In case of a re-insertion: <code>null</code>. In case of a split: Either the newly created split node with its split dimension logged in <code>splitAxis</code>, or <code>null</code>, if <code>node</code> has been converted into a supernode.
[ "Treatment", "of", "overflow", "in", "the", "specified", "node", ":", "if", "the", "node", "is", "not", "the", "root", "node", "and", "this", "is", "the", "first", "call", "of", "overflowTreatment", "in", "the", "given", "level", "during", "insertion", "th...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/AbstractXTree.java#L821-L834
passwordmaker/java-passwordmaker-lib
src/main/java/org/daveware/passwordmaker/AccountManager.java
AccountManager.generatePassword
public SecureUTF8String generatePassword(CharSequence masterPassword, String inputText, String username) { SecureUTF8String securedMasterPassword; if ( ! (masterPassword instanceof SecureUTF8String) ) { securedMasterPassword = new SecureUTF8String(masterPassword.toString()); } else { securedMasterPassword = (SecureUTF8String)masterPassword; } SecureUTF8String result = null; try { Account accountToUse = getAccountForInputText(inputText); // use the one that takes a username if the username isn't null if ( username != null ) result = pwm.makePassword(securedMasterPassword, accountToUse, inputText, username); else result = pwm.makePassword(securedMasterPassword, accountToUse, inputText); } catch (Exception e) { e.printStackTrace(); } if ( result != null ) { return result; } return new SecureUTF8String(); }
java
public SecureUTF8String generatePassword(CharSequence masterPassword, String inputText, String username) { SecureUTF8String securedMasterPassword; if ( ! (masterPassword instanceof SecureUTF8String) ) { securedMasterPassword = new SecureUTF8String(masterPassword.toString()); } else { securedMasterPassword = (SecureUTF8String)masterPassword; } SecureUTF8String result = null; try { Account accountToUse = getAccountForInputText(inputText); // use the one that takes a username if the username isn't null if ( username != null ) result = pwm.makePassword(securedMasterPassword, accountToUse, inputText, username); else result = pwm.makePassword(securedMasterPassword, accountToUse, inputText); } catch (Exception e) { e.printStackTrace(); } if ( result != null ) { return result; } return new SecureUTF8String(); }
[ "public", "SecureUTF8String", "generatePassword", "(", "CharSequence", "masterPassword", ",", "String", "inputText", ",", "String", "username", ")", "{", "SecureUTF8String", "securedMasterPassword", ";", "if", "(", "!", "(", "masterPassword", "instanceof", "SecureUTF8St...
Generate the password based on the masterPassword from the matching account from the inputtext @param masterPassword - the masterpassword to use @param inputText - the input text // url to use to find the account and generate the password @param username - (optional) the username to override the account's username unless its nil @return the generated password based on the matching account
[ "Generate", "the", "password", "based", "on", "the", "masterPassword", "from", "the", "matching", "account", "from", "the", "inputtext" ]
train
https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/AccountManager.java#L84-L106
acromusashi/acromusashi-stream
src/main/java/acromusashi/stream/resource/ResourceResolver.java
ResourceResolver.resolve
public static File resolve(Class<?> clazz, String path) { URL url = clazz.getResource(path); if (url == null) { return null; } File result; try { result = Paths.get(url.toURI()).toFile(); } catch (URISyntaxException ex) { return null; } return result; }
java
public static File resolve(Class<?> clazz, String path) { URL url = clazz.getResource(path); if (url == null) { return null; } File result; try { result = Paths.get(url.toURI()).toFile(); } catch (URISyntaxException ex) { return null; } return result; }
[ "public", "static", "File", "resolve", "(", "Class", "<", "?", ">", "clazz", ",", "String", "path", ")", "{", "URL", "url", "=", "clazz", ".", "getResource", "(", "path", ")", ";", "if", "(", "url", "==", "null", ")", "{", "return", "null", ";", ...
Return target file path from class and resource's path. @param clazz Target class @param path resource's path @return File object
[ "Return", "target", "file", "path", "from", "class", "and", "resource", "s", "path", "." ]
train
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/resource/ResourceResolver.java#L45-L64
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.dedicatedCloud_serviceName_filer_duration_GET
public OvhOrder dedicatedCloud_serviceName_filer_duration_GET(String serviceName, String duration, Long datacenterId, String name, Long quantity) throws IOException { String qPath = "/order/dedicatedCloud/{serviceName}/filer/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "datacenterId", datacenterId); query(sb, "name", name); query(sb, "quantity", quantity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder dedicatedCloud_serviceName_filer_duration_GET(String serviceName, String duration, Long datacenterId, String name, Long quantity) throws IOException { String qPath = "/order/dedicatedCloud/{serviceName}/filer/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "datacenterId", datacenterId); query(sb, "name", name); query(sb, "quantity", quantity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "dedicatedCloud_serviceName_filer_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "Long", "datacenterId", ",", "String", "name", ",", "Long", "quantity", ")", "throws", "IOException", "{", "String", "qPath", "=", "\...
Get prices and contracts information REST: GET /order/dedicatedCloud/{serviceName}/filer/{duration} @param name [required] Filer profile you want to order ("name" field in a profile returned by /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/orderableFilerProfiles) @param quantity [required] Quantity of filer you want to order (default 1) @param datacenterId [required] Datacenter where the filer will be mounted (if not precised, will be mounted in each Datacenter of this Private Cloud) @param serviceName [required] @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5561-L5569
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java
VirtualMachineScaleSetVMsInner.listAsync
public Observable<Page<VirtualMachineScaleSetVMInner>> listAsync(final String resourceGroupName, final String virtualMachineScaleSetName) { return listWithServiceResponseAsync(resourceGroupName, virtualMachineScaleSetName) .map(new Func1<ServiceResponse<Page<VirtualMachineScaleSetVMInner>>, Page<VirtualMachineScaleSetVMInner>>() { @Override public Page<VirtualMachineScaleSetVMInner> call(ServiceResponse<Page<VirtualMachineScaleSetVMInner>> response) { return response.body(); } }); }
java
public Observable<Page<VirtualMachineScaleSetVMInner>> listAsync(final String resourceGroupName, final String virtualMachineScaleSetName) { return listWithServiceResponseAsync(resourceGroupName, virtualMachineScaleSetName) .map(new Func1<ServiceResponse<Page<VirtualMachineScaleSetVMInner>>, Page<VirtualMachineScaleSetVMInner>>() { @Override public Page<VirtualMachineScaleSetVMInner> call(ServiceResponse<Page<VirtualMachineScaleSetVMInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "VirtualMachineScaleSetVMInner", ">", ">", "listAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "virtualMachineScaleSetName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName...
Gets a list of all virtual machines in a VM scale sets. @param resourceGroupName The name of the resource group. @param virtualMachineScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VirtualMachineScaleSetVMInner&gt; object
[ "Gets", "a", "list", "of", "all", "virtual", "machines", "in", "a", "VM", "scale", "sets", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java#L1265-L1273
EdwardRaff/JSAT
JSAT/src/jsat/io/CSV.java
CSV.readC
public static ClassificationDataSet readC(int classification_target, Path path, int lines_to_skip, Set<Integer> cat_cols) throws IOException { return readC(classification_target, path, DEFAULT_DELIMITER, lines_to_skip, DEFAULT_COMMENT, cat_cols); }
java
public static ClassificationDataSet readC(int classification_target, Path path, int lines_to_skip, Set<Integer> cat_cols) throws IOException { return readC(classification_target, path, DEFAULT_DELIMITER, lines_to_skip, DEFAULT_COMMENT, cat_cols); }
[ "public", "static", "ClassificationDataSet", "readC", "(", "int", "classification_target", ",", "Path", "path", ",", "int", "lines_to_skip", ",", "Set", "<", "Integer", ">", "cat_cols", ")", "throws", "IOException", "{", "return", "readC", "(", "classification_tar...
Reads in a CSV dataset as a classification dataset. Comments assumed to start with the "#" symbol. @param classification_target the column index (starting from zero) of the feature that will be the categorical target value @param path the CSV file to read @param lines_to_skip the number of lines to skip when reading in the CSV (used to skip header information) @param cat_cols a set of the indices to treat as categorical features. @return the classification dataset from the given CSV file @throws IOException
[ "Reads", "in", "a", "CSV", "dataset", "as", "a", "classification", "dataset", ".", "Comments", "assumed", "to", "start", "with", "the", "#", "symbol", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/CSV.java#L154-L157
mockito/mockito
src/main/java/org/mockito/internal/stubbing/defaultanswers/ReturnsDeepStubs.java
ReturnsDeepStubs.newDeepStubMock
private Object newDeepStubMock(GenericMetadataSupport returnTypeGenericMetadata, Object parentMock) { MockCreationSettings parentMockSettings = MockUtil.getMockSettings(parentMock); return mockitoCore().mock( returnTypeGenericMetadata.rawType(), withSettingsUsing(returnTypeGenericMetadata, parentMockSettings) ); }
java
private Object newDeepStubMock(GenericMetadataSupport returnTypeGenericMetadata, Object parentMock) { MockCreationSettings parentMockSettings = MockUtil.getMockSettings(parentMock); return mockitoCore().mock( returnTypeGenericMetadata.rawType(), withSettingsUsing(returnTypeGenericMetadata, parentMockSettings) ); }
[ "private", "Object", "newDeepStubMock", "(", "GenericMetadataSupport", "returnTypeGenericMetadata", ",", "Object", "parentMock", ")", "{", "MockCreationSettings", "parentMockSettings", "=", "MockUtil", ".", "getMockSettings", "(", "parentMock", ")", ";", "return", "mockit...
Creates a mock using the Generics Metadata. <li>Finally as we want to mock the actual type, but we want to pass along the contextual generics meta-data that was resolved for the current return type, for this to happen we associate to the mock an new instance of {@link ReturnsDeepStubs} answer in which we will store the returned type generic metadata. @param returnTypeGenericMetadata The metadata to use to create the new mock. @param parentMock The parent of the current deep stub mock. @return The mock
[ "Creates", "a", "mock", "using", "the", "Generics", "Metadata", "." ]
train
https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/internal/stubbing/defaultanswers/ReturnsDeepStubs.java#L105-L111
liyiorg/weixin-popular
src/main/java/weixin/popular/api/ShakeAroundAPI.java
ShakeAroundAPI.pageAdd
public static PageAddResult pageAdd(String accessToken, PageAdd pageAdd) { return pageAdd(accessToken, JsonUtil.toJSONString(pageAdd)); }
java
public static PageAddResult pageAdd(String accessToken, PageAdd pageAdd) { return pageAdd(accessToken, JsonUtil.toJSONString(pageAdd)); }
[ "public", "static", "PageAddResult", "pageAdd", "(", "String", "accessToken", ",", "PageAdd", "pageAdd", ")", "{", "return", "pageAdd", "(", "accessToken", ",", "JsonUtil", ".", "toJSONString", "(", "pageAdd", ")", ")", ";", "}" ]
页面管理-新增页面 @param accessToken accessToken @param pageAdd pageAdd @return result
[ "页面管理-新增页面" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ShakeAroundAPI.java#L726-L728
looly/hutool
hutool-core/src/main/java/cn/hutool/core/math/Arrangement.java
Arrangement.select
private void select(String[] resultList, int resultIndex, List<String[]> result) { int resultLen = resultList.length; if (resultIndex >= resultLen) { // 全部选择完时,输出排列结果 result.add(Arrays.copyOf(resultList, resultList.length)); return; } // 递归选择下一个 for (int i = 0; i < datas.length; i++) { // 判断待选项是否存在于排列结果中 boolean exists = false; for (int j = 0; j < resultIndex; j++) { if (datas[i].equals(resultList[j])) { exists = true; break; } } if (false == exists) { // 排列结果不存在该项,才可选择 resultList[resultIndex] = datas[i]; select(resultList, resultIndex + 1, result); } } }
java
private void select(String[] resultList, int resultIndex, List<String[]> result) { int resultLen = resultList.length; if (resultIndex >= resultLen) { // 全部选择完时,输出排列结果 result.add(Arrays.copyOf(resultList, resultList.length)); return; } // 递归选择下一个 for (int i = 0; i < datas.length; i++) { // 判断待选项是否存在于排列结果中 boolean exists = false; for (int j = 0; j < resultIndex; j++) { if (datas[i].equals(resultList[j])) { exists = true; break; } } if (false == exists) { // 排列结果不存在该项,才可选择 resultList[resultIndex] = datas[i]; select(resultList, resultIndex + 1, result); } } }
[ "private", "void", "select", "(", "String", "[", "]", "resultList", ",", "int", "resultIndex", ",", "List", "<", "String", "[", "]", ">", "result", ")", "{", "int", "resultLen", "=", "resultList", ".", "length", ";", "if", "(", "resultIndex", ">=", "re...
排列选择 @param dataList 待选列表 @param resultList 前面(resultIndex-1)个的排列结果 @param resultIndex 选择索引,从0开始 @param result 最终结果
[ "排列选择" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/math/Arrangement.java#L108-L130
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceListenerHelper.java
DfuServiceListenerHelper.registerLogListener
public static void registerLogListener(@NonNull final Context context, @NonNull final DfuLogListener listener) { if (mLogBroadcastReceiver == null) { mLogBroadcastReceiver = new LogBroadcastReceiver(); final IntentFilter filter = new IntentFilter(); filter.addAction(DfuBaseService.BROADCAST_LOG); LocalBroadcastManager.getInstance(context).registerReceiver(mLogBroadcastReceiver, filter); } mLogBroadcastReceiver.setLogListener(listener); }
java
public static void registerLogListener(@NonNull final Context context, @NonNull final DfuLogListener listener) { if (mLogBroadcastReceiver == null) { mLogBroadcastReceiver = new LogBroadcastReceiver(); final IntentFilter filter = new IntentFilter(); filter.addAction(DfuBaseService.BROADCAST_LOG); LocalBroadcastManager.getInstance(context).registerReceiver(mLogBroadcastReceiver, filter); } mLogBroadcastReceiver.setLogListener(listener); }
[ "public", "static", "void", "registerLogListener", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "NonNull", "final", "DfuLogListener", "listener", ")", "{", "if", "(", "mLogBroadcastReceiver", "==", "null", ")", "{", "mLogBroadcastReceiver", "=", ...
Registers the {@link DfuLogListener}. Registered listener will receive the log events from the DFU service. @param context the application context. @param listener the listener to register.
[ "Registers", "the", "{", "@link", "DfuLogListener", "}", ".", "Registered", "listener", "will", "receive", "the", "log", "events", "from", "the", "DFU", "service", "." ]
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceListenerHelper.java#L341-L350
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.importKeyAsync
public Observable<KeyBundle> importKeyAsync(String vaultBaseUrl, String keyName, JsonWebKey key, Boolean hsm, KeyAttributes keyAttributes, Map<String, String> tags) { return importKeyWithServiceResponseAsync(vaultBaseUrl, keyName, key, hsm, keyAttributes, tags).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() { @Override public KeyBundle call(ServiceResponse<KeyBundle> response) { return response.body(); } }); }
java
public Observable<KeyBundle> importKeyAsync(String vaultBaseUrl, String keyName, JsonWebKey key, Boolean hsm, KeyAttributes keyAttributes, Map<String, String> tags) { return importKeyWithServiceResponseAsync(vaultBaseUrl, keyName, key, hsm, keyAttributes, tags).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() { @Override public KeyBundle call(ServiceResponse<KeyBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "KeyBundle", ">", "importKeyAsync", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "JsonWebKey", "key", ",", "Boolean", "hsm", ",", "KeyAttributes", "keyAttributes", ",", "Map", "<", "String", ",", "String", ">", "ta...
Imports an externally created key, stores it, and returns key parameters and attributes to the client. The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the keys/import permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName Name for the imported key. @param key The Json web key @param hsm Whether to import as a hardware key (HSM) or software key. @param keyAttributes The key management attributes. @param tags Application specific metadata in the form of key-value pairs. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the KeyBundle object
[ "Imports", "an", "externally", "created", "key", "stores", "it", "and", "returns", "key", "parameters", "and", "attributes", "to", "the", "client", ".", "The", "import", "key", "operation", "may", "be", "used", "to", "import", "any", "key", "type", "into", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L1011-L1018
jamesagnew/hapi-fhir
hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/BaseDateTimeType.java
BaseDateTimeType.setValue
public void setValue(Date theValue, TemporalPrecisionEnum thePrecision) throws DataFormatException { if (getTimeZone() == null) { setTimeZone(TimeZone.getDefault()); } myPrecision = thePrecision; myFractionalSeconds = ""; if (theValue != null) { long millis = theValue.getTime() % 1000; if (millis < 0) { // This is for times before 1970 (see bug #444) millis = 1000 + millis; } String fractionalSeconds = Integer.toString((int) millis); myFractionalSeconds = StringUtils.leftPad(fractionalSeconds, 3, '0'); } super.setValue(theValue); }
java
public void setValue(Date theValue, TemporalPrecisionEnum thePrecision) throws DataFormatException { if (getTimeZone() == null) { setTimeZone(TimeZone.getDefault()); } myPrecision = thePrecision; myFractionalSeconds = ""; if (theValue != null) { long millis = theValue.getTime() % 1000; if (millis < 0) { // This is for times before 1970 (see bug #444) millis = 1000 + millis; } String fractionalSeconds = Integer.toString((int) millis); myFractionalSeconds = StringUtils.leftPad(fractionalSeconds, 3, '0'); } super.setValue(theValue); }
[ "public", "void", "setValue", "(", "Date", "theValue", ",", "TemporalPrecisionEnum", "thePrecision", ")", "throws", "DataFormatException", "{", "if", "(", "getTimeZone", "(", ")", "==", "null", ")", "{", "setTimeZone", "(", "TimeZone", ".", "getDefault", "(", ...
Sets the value for this type using the given Java Date object as the time, and using the specified precision, as well as the local timezone as determined by the local operating system. Both of these properties may be modified in subsequent calls if neccesary. @param theValue The date value @param thePrecision The precision @throws DataFormatException
[ "Sets", "the", "value", "for", "this", "type", "using", "the", "given", "Java", "Date", "object", "as", "the", "time", "and", "using", "the", "specified", "precision", "as", "well", "as", "the", "local", "timezone", "as", "determined", "by", "the", "local"...
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/BaseDateTimeType.java#L660-L676
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ContentRepository.java
ContentRepository.clearACL
public void clearACL(String path, String... principalNames) throws RepositoryException { final Session session = this.getAdminSession(); final AccessControlManager acm = session.getAccessControlManager(); final AccessControlList acl = this.getAccessControlList(session, path); final String[] principals; if (principalNames.length == 0) { // remove all existing entries principals = new String[] { ANY_WILDCARD }; } else { principals = principalNames; } for (String username : principals) { this.removeAccessControlEntries(acl, username); } // the policy must be re-set acm.setPolicy(path, acl); session.save(); }
java
public void clearACL(String path, String... principalNames) throws RepositoryException { final Session session = this.getAdminSession(); final AccessControlManager acm = session.getAccessControlManager(); final AccessControlList acl = this.getAccessControlList(session, path); final String[] principals; if (principalNames.length == 0) { // remove all existing entries principals = new String[] { ANY_WILDCARD }; } else { principals = principalNames; } for (String username : principals) { this.removeAccessControlEntries(acl, username); } // the policy must be re-set acm.setPolicy(path, acl); session.save(); }
[ "public", "void", "clearACL", "(", "String", "path", ",", "String", "...", "principalNames", ")", "throws", "RepositoryException", "{", "final", "Session", "session", "=", "this", ".", "getAdminSession", "(", ")", ";", "final", "AccessControlManager", "acm", "="...
Removes all ACLs on the node specified by the path. @param path the absolute path to the node @param principalNames the user(s) whose ACL entries should be removed. If none is provided, all ACLs will be removed. A word of warning, if you invoke this on the root node '/' all ACls including those for administrators and everyone-principal will be removed, rendering the entire repository useless.
[ "Removes", "all", "ACLs", "on", "the", "node", "specified", "by", "the", "path", "." ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ContentRepository.java#L437-L459
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/provisioning/ObjectsApi.java
ObjectsApi.searchAgentGroups
public Results<AgentGroup> searchAgentGroups(String groupType, Integer limit, Integer offset, String searchTerm, String searchKey, String matchMethod, String sortKey, Boolean sortAscending, String sortMethod) throws ProvisioningApiException { try { GetObjectsSuccessResponse resp = objectsApi.getObject( "agent-groups", null, null, groupType, limit, offset, searchTerm, searchKey, matchMethod, sortKey, sortAscending, sortMethod, null, null ); if (!resp.getStatus().getCode().equals(0)) { throw new ProvisioningApiException("Error getting objects. Code: " + resp.getStatus().getCode()); } Results<AgentGroup> out = new Results<AgentGroup>(); out.setResults(Converters.convertMapListToAgentGroupList(resp.getData().getAgentGroups())); out.setTotalCount(resp.getData().getTotalCount()); return out; } catch(ApiException e) { throw new ProvisioningApiException("Error getting objects", e); } }
java
public Results<AgentGroup> searchAgentGroups(String groupType, Integer limit, Integer offset, String searchTerm, String searchKey, String matchMethod, String sortKey, Boolean sortAscending, String sortMethod) throws ProvisioningApiException { try { GetObjectsSuccessResponse resp = objectsApi.getObject( "agent-groups", null, null, groupType, limit, offset, searchTerm, searchKey, matchMethod, sortKey, sortAscending, sortMethod, null, null ); if (!resp.getStatus().getCode().equals(0)) { throw new ProvisioningApiException("Error getting objects. Code: " + resp.getStatus().getCode()); } Results<AgentGroup> out = new Results<AgentGroup>(); out.setResults(Converters.convertMapListToAgentGroupList(resp.getData().getAgentGroups())); out.setTotalCount(resp.getData().getTotalCount()); return out; } catch(ApiException e) { throw new ProvisioningApiException("Error getting objects", e); } }
[ "public", "Results", "<", "AgentGroup", ">", "searchAgentGroups", "(", "String", "groupType", ",", "Integer", "limit", ",", "Integer", "offset", ",", "String", "searchTerm", ",", "String", "searchKey", ",", "String", "matchMethod", ",", "String", "sortKey", ",",...
Get agent groups. Get agent groups from Configuration Server with the specified filters. @param groupType the agent group type. (optional) @param limit The number of objects the Provisioning API should return. (optional) @param offset The number of matches the Provisioning API should skip in the returned objects. (optional) @param searchTerm The term that you want to search for in the object keys. The Provisioning API searches for the this term in the value of the key you specify in &#39;search_key&#39;. (optional) @param searchKey The key you want the Provisioning API to use when searching for the term you specified in &#39;search_term&#39;. You can find valid key names in the Platform SDK documentation for [CfgDN](https://docs.genesys.com/Documentation/PSDK/9.0.x/ConfigLayerRef/CfgDN) and [CfgAgentGroup](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgAgentGroup). (optional) @param matchMethod The method the Provisioning API should use to match the &#39;search_term&#39;. Possible values are includes, startsWith, endsWith, and isEqual. (optional, default to includes) @param sortKey A key in [CfgDN](https://docs.genesys.com/Documentation/PSDK/9.0.x/ConfigLayerRef/CfgDN), [CfgSkill](https://docs.genesys.com/Documentation/PSDK/9.0.x/ConfigLayerRef/CfgSkill) or [CfgAgentGroup](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgAgentGroup) to sort the search results. (optional) @param sortAscending Specifies whether to sort the search results in ascending or descending order. (optional, default to true) @param sortMethod Specifies the sort method. Possible values are caseSensitive, caseInsensitive or numeric. (optional, default to caseSensitive) @return Results object which includes list of AgentGroups and the total count. @throws ProvisioningApiException if the call is unsuccessful.
[ "Get", "agent", "groups", ".", "Get", "agent", "groups", "from", "Configuration", "Server", "with", "the", "specified", "filters", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/provisioning/ObjectsApi.java#L175-L206
OpenLiberty/open-liberty
dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/main/StaticTraceInstrumentation.java
StaticTraceInstrumentation.transform
final protected byte[] transform(final InputStream classfileStream) throws IOException { ClassConfigData classConfigData = processClassConfiguration(classfileStream); ClassInfo classInfo = classConfigData.getClassInfo(); // Only instrument the classes that we're supposed to. if (!getInstrumentationOptions().isPackageIncluded(classInfo.getPackageName())) { return null; } // Merge command line, config file, package annotations, and class annotations classInfo = mergeClassConfigInfo(classInfo); int classWriterOptions = isComputeFrames() ? ClassWriter.COMPUTE_FRAMES : ClassWriter.COMPUTE_MAXS; InputStream classInputStream = classConfigData.getClassInputStream(); ClassReader reader = new ClassReader(classInputStream); ClassWriter writer = new ClassWriter(reader, classWriterOptions); ClassVisitor visitor = writer; if (isDebug()) { visitor = new CheckClassAdapter(visitor); visitor = new TraceClassVisitor(visitor, new PrintWriter(System.out)); } // Get the correct tracing adapter switch (getTraceType()) { case JAVA_LOGGING: visitor = new JSR47TracingClassAdapter(visitor, classInfo); break; case TR: visitor = new WebSphereTrTracingClassAdapter(visitor, classInfo); break; } if (getInstrumentWithFFDC()) { visitor = new FFDCClassAdapter(visitor, classInfo); } // The SerialVersionUIDAdder adder must be the first visitor in // the chain in order to calculate the serialVersionUID before // the tracing class adapter mucks around and (possibly) adds a // class static initializer. visitor = new SerialVersionUIDAdder(visitor); try { // Keep all metadata information that's present in the class file reader.accept(visitor, isComputeFrames() ? ClassReader.EXPAND_FRAMES : 0); } catch (Throwable t) { IOException ioe = new IOException("Unable to instrument class stream with trace"); ioe.initCause(t); throw ioe; } return writer.toByteArray(); }
java
final protected byte[] transform(final InputStream classfileStream) throws IOException { ClassConfigData classConfigData = processClassConfiguration(classfileStream); ClassInfo classInfo = classConfigData.getClassInfo(); // Only instrument the classes that we're supposed to. if (!getInstrumentationOptions().isPackageIncluded(classInfo.getPackageName())) { return null; } // Merge command line, config file, package annotations, and class annotations classInfo = mergeClassConfigInfo(classInfo); int classWriterOptions = isComputeFrames() ? ClassWriter.COMPUTE_FRAMES : ClassWriter.COMPUTE_MAXS; InputStream classInputStream = classConfigData.getClassInputStream(); ClassReader reader = new ClassReader(classInputStream); ClassWriter writer = new ClassWriter(reader, classWriterOptions); ClassVisitor visitor = writer; if (isDebug()) { visitor = new CheckClassAdapter(visitor); visitor = new TraceClassVisitor(visitor, new PrintWriter(System.out)); } // Get the correct tracing adapter switch (getTraceType()) { case JAVA_LOGGING: visitor = new JSR47TracingClassAdapter(visitor, classInfo); break; case TR: visitor = new WebSphereTrTracingClassAdapter(visitor, classInfo); break; } if (getInstrumentWithFFDC()) { visitor = new FFDCClassAdapter(visitor, classInfo); } // The SerialVersionUIDAdder adder must be the first visitor in // the chain in order to calculate the serialVersionUID before // the tracing class adapter mucks around and (possibly) adds a // class static initializer. visitor = new SerialVersionUIDAdder(visitor); try { // Keep all metadata information that's present in the class file reader.accept(visitor, isComputeFrames() ? ClassReader.EXPAND_FRAMES : 0); } catch (Throwable t) { IOException ioe = new IOException("Unable to instrument class stream with trace"); ioe.initCause(t); throw ioe; } return writer.toByteArray(); }
[ "final", "protected", "byte", "[", "]", "transform", "(", "final", "InputStream", "classfileStream", ")", "throws", "IOException", "{", "ClassConfigData", "classConfigData", "=", "processClassConfiguration", "(", "classfileStream", ")", ";", "ClassInfo", "classInfo", ...
Instrument the class at the current position in the specified input stream. @return instrumented class file or null if the class has already been instrumented. @throws IOException if an error is encountered while reading from the <code>InputStream</code>
[ "Instrument", "the", "class", "at", "the", "current", "position", "in", "the", "specified", "input", "stream", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/main/StaticTraceInstrumentation.java#L122-L175
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java
MessagingSecurityUtility.createAuthenticationData
public static AuthenticationData createAuthenticationData(String userName, String password) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "createAuthenticationData", new Object[] { userName, "Password Not Traced" }); } AuthenticationData authData = new WSAuthenticationData(); if (userName == null) userName = ""; if (password == null) password = ""; authData.set(AuthenticationData.USERNAME, userName); authData.set(AuthenticationData.PASSWORD, new ProtectedString(password.toCharArray())); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "createAuthenticationData", authData); } return authData; }
java
public static AuthenticationData createAuthenticationData(String userName, String password) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "createAuthenticationData", new Object[] { userName, "Password Not Traced" }); } AuthenticationData authData = new WSAuthenticationData(); if (userName == null) userName = ""; if (password == null) password = ""; authData.set(AuthenticationData.USERNAME, userName); authData.set(AuthenticationData.PASSWORD, new ProtectedString(password.toCharArray())); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "createAuthenticationData", authData); } return authData; }
[ "public", "static", "AuthenticationData", "createAuthenticationData", "(", "String", "userName", ",", "String", "password", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr...
Create AuthenticationData Object from the UserName and Password passed @param userName @param password @return
[ "Create", "AuthenticationData", "Object", "from", "the", "UserName", "and", "Password", "passed" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java#L106-L121
eclipse/xtext-core
org.eclipse.xtext/src/org/eclipse/xtext/linking/lazy/LazyURIEncoder.java
LazyURIEncoder.getRelativePath
public void getRelativePath(StringBuilder result, INode parserNode, INode node) { if (parserNode == node) return; if (isAncestor(parserNode, node)) { ICompositeNode parent = node.getParent(); getRelativePath(result, parserNode, parent); int idx = 0; INode child = parent.getFirstChild(); while(child != node && child.hasNextSibling()) { idx++; child = child.getNextSibling(); } result.append("/").append(idx); } else { result.append("/.."); getRelativePath(result, parserNode.getParent(), node); } }
java
public void getRelativePath(StringBuilder result, INode parserNode, INode node) { if (parserNode == node) return; if (isAncestor(parserNode, node)) { ICompositeNode parent = node.getParent(); getRelativePath(result, parserNode, parent); int idx = 0; INode child = parent.getFirstChild(); while(child != node && child.hasNextSibling()) { idx++; child = child.getNextSibling(); } result.append("/").append(idx); } else { result.append("/.."); getRelativePath(result, parserNode.getParent(), node); } }
[ "public", "void", "getRelativePath", "(", "StringBuilder", "result", ",", "INode", "parserNode", ",", "INode", "node", ")", "{", "if", "(", "parserNode", "==", "node", ")", "return", ";", "if", "(", "isAncestor", "(", "parserNode", ",", "node", ")", ")", ...
ONLY public to be testable @noreference This method is not intended to be referenced by clients.
[ "ONLY", "public", "to", "be", "testable" ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/linking/lazy/LazyURIEncoder.java#L194-L211
motown-io/motown
chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java
DomainService.updateManufacturer
public Manufacturer updateManufacturer(Long id, Manufacturer manufacturer) { manufacturer.setId(id); return manufacturerRepository.createOrUpdate(manufacturer); }
java
public Manufacturer updateManufacturer(Long id, Manufacturer manufacturer) { manufacturer.setId(id); return manufacturerRepository.createOrUpdate(manufacturer); }
[ "public", "Manufacturer", "updateManufacturer", "(", "Long", "id", ",", "Manufacturer", "manufacturer", ")", "{", "manufacturer", ".", "setId", "(", "id", ")", ";", "return", "manufacturerRepository", ".", "createOrUpdate", "(", "manufacturer", ")", ";", "}" ]
Update a manufacturer. @param id the id of the entity to find. @param manufacturer the payload from the request.
[ "Update", "a", "manufacturer", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java#L327-L330
lucee/Lucee
core/src/main/java/lucee/runtime/type/scope/ScopeContext.java
ScopeContext.getApplicationScope
public Application getApplicationScope(PageContext pc, RefBoolean isNew) { ApplicationContext appContext = pc.getApplicationContext(); // getApplication Scope from Context ApplicationImpl application; Object objApp = applicationContexts.get(appContext.getName()); if (objApp != null) { application = (ApplicationImpl) objApp; if (application.isExpired()) { application.release(pc); isNew.setValue(true); } } else { application = new ApplicationImpl(); applicationContexts.put(appContext.getName(), application); isNew.setValue(true); } application.touchBeforeRequest(pc); // if(newApplication)listener.onApplicationStart(pc); return application; }
java
public Application getApplicationScope(PageContext pc, RefBoolean isNew) { ApplicationContext appContext = pc.getApplicationContext(); // getApplication Scope from Context ApplicationImpl application; Object objApp = applicationContexts.get(appContext.getName()); if (objApp != null) { application = (ApplicationImpl) objApp; if (application.isExpired()) { application.release(pc); isNew.setValue(true); } } else { application = new ApplicationImpl(); applicationContexts.put(appContext.getName(), application); isNew.setValue(true); } application.touchBeforeRequest(pc); // if(newApplication)listener.onApplicationStart(pc); return application; }
[ "public", "Application", "getApplicationScope", "(", "PageContext", "pc", ",", "RefBoolean", "isNew", ")", "{", "ApplicationContext", "appContext", "=", "pc", ".", "getApplicationContext", "(", ")", ";", "// getApplication Scope from Context", "ApplicationImpl", "applicat...
return the application Scope for this context (cfid,cftoken,contextname) @param pc PageContext @param isNew @return session matching the context @throws PageException
[ "return", "the", "application", "Scope", "for", "this", "context", "(", "cfid", "cftoken", "contextname", ")" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/ScopeContext.java#L778-L799
netheosgithub/pcs_api
java/src/main/java/net/netheos/pcsapi/providers/cloudme/CloudMe.java
CloudMe.getLongFromDom
private long getLongFromDom( Document dom, String tag ) { return Long.parseLong( dom.getElementsByTagName( tag ).item( 0 ).getTextContent() ); }
java
private long getLongFromDom( Document dom, String tag ) { return Long.parseLong( dom.getElementsByTagName( tag ).item( 0 ).getTextContent() ); }
[ "private", "long", "getLongFromDom", "(", "Document", "dom", ",", "String", "tag", ")", "{", "return", "Long", ".", "parseLong", "(", "dom", ".", "getElementsByTagName", "(", "tag", ")", ".", "item", "(", "0", ")", ".", "getTextContent", "(", ")", ")", ...
Retrieves a long value according to a Dom and a tag @param dom @param tag @return long value
[ "Retrieves", "a", "long", "value", "according", "to", "a", "Dom", "and", "a", "tag" ]
train
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/cloudme/CloudMe.java#L181-L184
kikinteractive/ice
ice/src/main/java/com/kik/config/ice/internal/ConfigDescriptorFactory.java
ConfigDescriptorFactory.buildDescriptor
public ConfigDescriptor buildDescriptor(Method method, Optional<String> scopeOpt) { return buildDescriptor(method, scopeOpt, Optional.empty()); }
java
public ConfigDescriptor buildDescriptor(Method method, Optional<String> scopeOpt) { return buildDescriptor(method, scopeOpt, Optional.empty()); }
[ "public", "ConfigDescriptor", "buildDescriptor", "(", "Method", "method", ",", "Optional", "<", "String", ">", "scopeOpt", ")", "{", "return", "buildDescriptor", "(", "method", ",", "scopeOpt", ",", "Optional", ".", "empty", "(", ")", ")", ";", "}" ]
Build a {@link ConfigDescriptor} for a specific Method, and given optional scope. @param method method to include in config descriptor @param scopeOpt optional scope for the config descriptor @return a {@link ConfigDescriptor} for the given method, to be used internally in the config system.
[ "Build", "a", "{", "@link", "ConfigDescriptor", "}", "for", "a", "specific", "Method", "and", "given", "optional", "scope", "." ]
train
https://github.com/kikinteractive/ice/blob/0c58d7bf2d9f6504892d0768d6022fcfa6df7514/ice/src/main/java/com/kik/config/ice/internal/ConfigDescriptorFactory.java#L110-L113
alkacon/opencms-core
src/org/opencms/i18n/CmsVfsBundleManager.java
CmsVfsBundleManager.addXmlBundle
private void addXmlBundle(CmsResource xmlBundle) { String name = xmlBundle.getName(); String path = xmlBundle.getRootPath(); m_bundleBaseNames.add(name); LOG.info(String.format("Adding property VFS bundle (path=%s, name=%s)", xmlBundle.getRootPath(), name)); for (Locale locale : getAllLocales()) { CmsVfsBundleParameters params = new CmsVfsBundleParameters( name, path, locale, false, CmsVfsResourceBundle.TYPE_XML); CmsVfsResourceBundle bundle = new CmsVfsResourceBundle(params); addBundle(name, locale, bundle); } }
java
private void addXmlBundle(CmsResource xmlBundle) { String name = xmlBundle.getName(); String path = xmlBundle.getRootPath(); m_bundleBaseNames.add(name); LOG.info(String.format("Adding property VFS bundle (path=%s, name=%s)", xmlBundle.getRootPath(), name)); for (Locale locale : getAllLocales()) { CmsVfsBundleParameters params = new CmsVfsBundleParameters( name, path, locale, false, CmsVfsResourceBundle.TYPE_XML); CmsVfsResourceBundle bundle = new CmsVfsResourceBundle(params); addBundle(name, locale, bundle); } }
[ "private", "void", "addXmlBundle", "(", "CmsResource", "xmlBundle", ")", "{", "String", "name", "=", "xmlBundle", ".", "getName", "(", ")", ";", "String", "path", "=", "xmlBundle", ".", "getRootPath", "(", ")", ";", "m_bundleBaseNames", ".", "add", "(", "n...
Adds an XML based message bundle.<p> @param xmlBundle the XML content containing the message bundle data
[ "Adds", "an", "XML", "based", "message", "bundle", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsVfsBundleManager.java#L314-L331
pwittchen/ReactiveWiFi
library/src/main/java/com/github/pwittchen/reactivewifi/AccessRequester.java
AccessRequester.buildLocationAccessDialog
public static AlertDialog.Builder buildLocationAccessDialog(final Activity activity, final DialogInterface.OnClickListener onOkClickListener) { final Resources resources = activity.getResources(); final String title = resources.getString(R.string.requesting_location_access); final String message = resources.getString(R.string.do_you_want_to_open_location_settings); return buildLocationAccessDialog(activity, onOkClickListener, title, message); }
java
public static AlertDialog.Builder buildLocationAccessDialog(final Activity activity, final DialogInterface.OnClickListener onOkClickListener) { final Resources resources = activity.getResources(); final String title = resources.getString(R.string.requesting_location_access); final String message = resources.getString(R.string.do_you_want_to_open_location_settings); return buildLocationAccessDialog(activity, onOkClickListener, title, message); }
[ "public", "static", "AlertDialog", ".", "Builder", "buildLocationAccessDialog", "(", "final", "Activity", "activity", ",", "final", "DialogInterface", ".", "OnClickListener", "onOkClickListener", ")", "{", "final", "Resources", "resources", "=", "activity", ".", "getR...
Creates dialog for accessing Location Services @param activity where dialog is build @param onOkClickListener implementation for action customisation @return dialog builder
[ "Creates", "dialog", "for", "accessing", "Location", "Services" ]
train
https://github.com/pwittchen/ReactiveWiFi/blob/eb2048663c1593b1706cfafb876542a41a223a1f/library/src/main/java/com/github/pwittchen/reactivewifi/AccessRequester.java#L86-L92
apache/incubator-atlas
common/src/main/java/org/apache/atlas/utils/ParamChecker.java
ParamChecker.notNull
public static <T> T notNull(T obj, String name) { if (obj == null) { throw new IllegalArgumentException(name + " cannot be null"); } return obj; }
java
public static <T> T notNull(T obj, String name) { if (obj == null) { throw new IllegalArgumentException(name + " cannot be null"); } return obj; }
[ "public", "static", "<", "T", ">", "T", "notNull", "(", "T", "obj", ",", "String", "name", ")", "{", "if", "(", "obj", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "name", "+", "\" cannot be null\"", ")", ";", "}", "return",...
Check that a value is not null. If null throws an IllegalArgumentException. @param obj value. @param name parameter name for the exception message. @return the given value.
[ "Check", "that", "a", "value", "is", "not", "null", ".", "If", "null", "throws", "an", "IllegalArgumentException", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/common/src/main/java/org/apache/atlas/utils/ParamChecker.java#L38-L43
ops4j/org.ops4j.base
ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java
Resources.getDate
public Date getDate( String key, Date defaultValue ) throws MissingResourceException { try { return getDate( key ); } catch( MissingResourceException mre ) { return defaultValue; } }
java
public Date getDate( String key, Date defaultValue ) throws MissingResourceException { try { return getDate( key ); } catch( MissingResourceException mre ) { return defaultValue; } }
[ "public", "Date", "getDate", "(", "String", "key", ",", "Date", "defaultValue", ")", "throws", "MissingResourceException", "{", "try", "{", "return", "getDate", "(", "key", ")", ";", "}", "catch", "(", "MissingResourceException", "mre", ")", "{", "return", "...
Retrieve a date from bundle. @param key the key of resource @param defaultValue the default value if key is missing @return the resource date @throws MissingResourceException if the requested key is unknown
[ "Retrieve", "a", "date", "from", "bundle", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java#L527-L538
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapreduce/server/jobtracker/JobTrackerJspHelper.java
JobTrackerJspHelper.generateJobTable
public void generateJobTable(JspWriter out, String label, List<JobInProgress> jobs) throws IOException { if (jobs.size() > 0) { for (JobInProgress job : jobs) { JobProfile profile = job.getProfile(); JobStatus status = job.getStatus(); JobID jobid = profile.getJobID(); int desiredMaps = job.desiredMaps(); int desiredReduces = job.desiredReduces(); int completedMaps = job.finishedMaps(); int completedReduces = job.finishedReduces(); String name = profile.getJobName(); out.print("<" + label + "_job jobid=\"" + jobid + "\">\n"); out.print(" <jobid>" + jobid + "</jobid>\n"); out.print(" <user>" + profile.getUser() + "</user>\n"); out.print(" <name>" + ("".equals(name) ? "&nbsp;" : name) + "</name>\n"); out.print(" <map_complete>" + StringUtils.formatPercent(status.mapProgress(), 2) + "</map_complete>\n"); out.print(" <map_total>" + desiredMaps + "</map_total>\n"); out.print(" <maps_completed>" + completedMaps + "</maps_completed>\n"); out.print(" <reduce_complete>" + StringUtils.formatPercent(status.reduceProgress(), 2) + "</reduce_complete>\n"); out.print(" <reduce_total>" + desiredReduces + "</reduce_total>\n"); out.print(" <reduces_completed>" + completedReduces + "</reduces_completed>\n"); out.print("</" + label + "_job>\n"); } } }
java
public void generateJobTable(JspWriter out, String label, List<JobInProgress> jobs) throws IOException { if (jobs.size() > 0) { for (JobInProgress job : jobs) { JobProfile profile = job.getProfile(); JobStatus status = job.getStatus(); JobID jobid = profile.getJobID(); int desiredMaps = job.desiredMaps(); int desiredReduces = job.desiredReduces(); int completedMaps = job.finishedMaps(); int completedReduces = job.finishedReduces(); String name = profile.getJobName(); out.print("<" + label + "_job jobid=\"" + jobid + "\">\n"); out.print(" <jobid>" + jobid + "</jobid>\n"); out.print(" <user>" + profile.getUser() + "</user>\n"); out.print(" <name>" + ("".equals(name) ? "&nbsp;" : name) + "</name>\n"); out.print(" <map_complete>" + StringUtils.formatPercent(status.mapProgress(), 2) + "</map_complete>\n"); out.print(" <map_total>" + desiredMaps + "</map_total>\n"); out.print(" <maps_completed>" + completedMaps + "</maps_completed>\n"); out.print(" <reduce_complete>" + StringUtils.formatPercent(status.reduceProgress(), 2) + "</reduce_complete>\n"); out.print(" <reduce_total>" + desiredReduces + "</reduce_total>\n"); out.print(" <reduces_completed>" + completedReduces + "</reduces_completed>\n"); out.print("</" + label + "_job>\n"); } } }
[ "public", "void", "generateJobTable", "(", "JspWriter", "out", ",", "String", "label", ",", "List", "<", "JobInProgress", ">", "jobs", ")", "throws", "IOException", "{", "if", "(", "jobs", ".", "size", "(", ")", ">", "0", ")", "{", "for", "(", "JobInPr...
Returns an XML-formatted table of the jobs in the list. This is called repeatedly for different lists of jobs (e.g., running, completed, failed).
[ "Returns", "an", "XML", "-", "formatted", "table", "of", "the", "jobs", "in", "the", "list", ".", "This", "is", "called", "repeatedly", "for", "different", "lists", "of", "jobs", "(", "e", ".", "g", ".", "running", "completed", "failed", ")", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/server/jobtracker/JobTrackerJspHelper.java#L53-L80
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/DoubleStream.java
DoubleStream.peek
@NotNull public DoubleStream peek(@NotNull final DoubleConsumer action) { return new DoubleStream(params, new DoublePeek(iterator, action)); }
java
@NotNull public DoubleStream peek(@NotNull final DoubleConsumer action) { return new DoubleStream(params, new DoublePeek(iterator, action)); }
[ "@", "NotNull", "public", "DoubleStream", "peek", "(", "@", "NotNull", "final", "DoubleConsumer", "action", ")", "{", "return", "new", "DoubleStream", "(", "params", ",", "new", "DoublePeek", "(", "iterator", ",", "action", ")", ")", ";", "}" ]
Performs provided action on each element. <p>This is an intermediate operation. @param action the action to be performed on each element @return the new stream
[ "Performs", "provided", "action", "on", "each", "element", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/DoubleStream.java#L621-L624
groupon/odo
client/src/main/java/com/groupon/odo/client/Client.java
Client.uploadConfigurationAndProfile
public boolean uploadConfigurationAndProfile(String fileName, String odoImport) { File file = new File(fileName); MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create(); FileBody fileBody = new FileBody(file, ContentType.MULTIPART_FORM_DATA); multipartEntityBuilder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); multipartEntityBuilder.addPart("fileData", fileBody); multipartEntityBuilder.addTextBody("odoImport", odoImport); try { JSONObject response = new JSONObject(doMultipartPost(BASE_BACKUP_PROFILE + "/" + uriEncode(this._profileName) + "/" + this._clientId, multipartEntityBuilder)); if (response.length() == 0) { return true; } else { return false; } } catch (Exception e) { return false; } }
java
public boolean uploadConfigurationAndProfile(String fileName, String odoImport) { File file = new File(fileName); MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create(); FileBody fileBody = new FileBody(file, ContentType.MULTIPART_FORM_DATA); multipartEntityBuilder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); multipartEntityBuilder.addPart("fileData", fileBody); multipartEntityBuilder.addTextBody("odoImport", odoImport); try { JSONObject response = new JSONObject(doMultipartPost(BASE_BACKUP_PROFILE + "/" + uriEncode(this._profileName) + "/" + this._clientId, multipartEntityBuilder)); if (response.length() == 0) { return true; } else { return false; } } catch (Exception e) { return false; } }
[ "public", "boolean", "uploadConfigurationAndProfile", "(", "String", "fileName", ",", "String", "odoImport", ")", "{", "File", "file", "=", "new", "File", "(", "fileName", ")", ";", "MultipartEntityBuilder", "multipartEntityBuilder", "=", "MultipartEntityBuilder", "."...
Upload file and set odo overrides and configuration of odo @param fileName File containing configuration @param odoImport Import odo configuration in addition to overrides @return If upload was successful
[ "Upload", "file", "and", "set", "odo", "overrides", "and", "configuration", "of", "odo" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L1347-L1364
otto-de/edison-microservice
edison-jobs/src/main/java/de/otto/edison/jobs/definition/DefaultJobDefinition.java
DefaultJobDefinition.retryableCronJobDefinition
public static JobDefinition retryableCronJobDefinition(final String jobType, final String jobName, final String description, final String cron, final int restarts, final int retries, final Duration retryDelay, final Optional<Duration> maxAge) { return new DefaultJobDefinition(jobType, jobName, description, maxAge, Optional.empty(), Optional.of(cron), restarts, retries, Optional.of(retryDelay)); }
java
public static JobDefinition retryableCronJobDefinition(final String jobType, final String jobName, final String description, final String cron, final int restarts, final int retries, final Duration retryDelay, final Optional<Duration> maxAge) { return new DefaultJobDefinition(jobType, jobName, description, maxAge, Optional.empty(), Optional.of(cron), restarts, retries, Optional.of(retryDelay)); }
[ "public", "static", "JobDefinition", "retryableCronJobDefinition", "(", "final", "String", "jobType", ",", "final", "String", "jobName", ",", "final", "String", "description", ",", "final", "String", "cron", ",", "final", "int", "restarts", ",", "final", "int", ...
Create a JobDefinition that is using a cron expression to specify, when and how often the job should be triggered. @param jobType The type of the Job @param jobName A human readable name of the Job @param description A human readable description of the Job. @param cron The cron expression. Must conform to {@link CronSequenceGenerator}s cron expressions. @param restarts The number of restarts if the job failed because of errors or exceptions @param retries Specifies how often a job trigger should retry to start the job if triggering fails for some reason. @param retryDelay The optional delay between retries. @param maxAge Optional maximum age of a job. When the job is not run for longer than this duration, a warning is displayed on the status page @return JobDefinition @throws IllegalArgumentException if cron expression is invalid.
[ "Create", "a", "JobDefinition", "that", "is", "using", "a", "cron", "expression", "to", "specify", "when", "and", "how", "often", "the", "job", "should", "be", "triggered", "." ]
train
https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-jobs/src/main/java/de/otto/edison/jobs/definition/DefaultJobDefinition.java#L83-L92
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAccountUrl.java
CustomerAccountUrl.getLoginStateByEmailAddressUrl
public static MozuUrl getLoginStateByEmailAddressUrl(String customerSetCode, String emailAddress, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/loginstatebyemailaddress?emailAddress={emailAddress}&responseFields={responseFields}"); formatter.formatUrl("customerSetCode", customerSetCode); formatter.formatUrl("emailAddress", emailAddress); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getLoginStateByEmailAddressUrl(String customerSetCode, String emailAddress, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/loginstatebyemailaddress?emailAddress={emailAddress}&responseFields={responseFields}"); formatter.formatUrl("customerSetCode", customerSetCode); formatter.formatUrl("emailAddress", emailAddress); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getLoginStateByEmailAddressUrl", "(", "String", "customerSetCode", ",", "String", "emailAddress", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/customer/accounts/logi...
Get Resource Url for GetLoginStateByEmailAddress @param customerSetCode The unique idenfitier of the customer set. @param emailAddress The email address associated with the customer account. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetLoginStateByEmailAddress" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAccountUrl.java#L201-L208
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/BaseField.java
BaseField.setupTablePopup
public ScreenComponent setupTablePopup(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Rec record, String iQueryKeySeq, String iDisplayFieldSeq, boolean bIncludeBlankOption, boolean bIncludeFormButton) { if ((!(this instanceof ReferenceField)) && (!(this instanceof CounterField))) Debug.doAssert(false); // error, wrong field type ((Record)record).setKeyArea(iQueryKeySeq); ((Record)record).close(); if (converter == null) converter = this; if (iDisplayFieldSeq == null) iDisplayFieldSeq = ((Record)record).getDefaultDisplayFieldName(); FieldConverter convert = new QueryConverter((Converter)converter, (Record)record, iDisplayFieldSeq, bIncludeBlankOption); ScreenComponent screenField = createScreenComponent(ScreenModel.POPUP_BOX, itsLocation, targetScreen, convert, iDisplayFieldDesc, null); if (bIncludeFormButton) if (!(targetScreen instanceof GridScreenParent)) { Map<String,Object> properties = new HashMap<String,Object>(); properties.put(ScreenModel.RECORD, record); properties.put(ScreenModel.COMMAND, ThinMenuConstants.FORM); properties.put(ScreenModel.IMAGE, ThinMenuConstants.FORM); screenField = createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties); } ((Record)record).selectScreenFields(); // Only select fields that you will display return screenField; }
java
public ScreenComponent setupTablePopup(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Rec record, String iQueryKeySeq, String iDisplayFieldSeq, boolean bIncludeBlankOption, boolean bIncludeFormButton) { if ((!(this instanceof ReferenceField)) && (!(this instanceof CounterField))) Debug.doAssert(false); // error, wrong field type ((Record)record).setKeyArea(iQueryKeySeq); ((Record)record).close(); if (converter == null) converter = this; if (iDisplayFieldSeq == null) iDisplayFieldSeq = ((Record)record).getDefaultDisplayFieldName(); FieldConverter convert = new QueryConverter((Converter)converter, (Record)record, iDisplayFieldSeq, bIncludeBlankOption); ScreenComponent screenField = createScreenComponent(ScreenModel.POPUP_BOX, itsLocation, targetScreen, convert, iDisplayFieldDesc, null); if (bIncludeFormButton) if (!(targetScreen instanceof GridScreenParent)) { Map<String,Object> properties = new HashMap<String,Object>(); properties.put(ScreenModel.RECORD, record); properties.put(ScreenModel.COMMAND, ThinMenuConstants.FORM); properties.put(ScreenModel.IMAGE, ThinMenuConstants.FORM); screenField = createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties); } ((Record)record).selectScreenFields(); // Only select fields that you will display return screenField; }
[ "public", "ScreenComponent", "setupTablePopup", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "targetScreen", ",", "Convert", "converter", ",", "int", "iDisplayFieldDesc", ",", "Rec", "record", ",", "String", "iQueryKeySeq", ",", "String", "iDisplayFieldSeq",...
Add a popup for the table tied to this field. Key must be the first and primary and only key. @param record Record to display in a popup @param iQueryKeySeq Order to display the record (-1 = Primary field) @param iDisplayFieldSeq Description field for the popup (-1 = second field) @param bIncludeBlankOption Include a blank option in the popup? @return Return the component or ScreenField that is created for this field.
[ "Add", "a", "popup", "for", "the", "table", "tied", "to", "this", "field", ".", "Key", "must", "be", "the", "first", "and", "primary", "and", "only", "key", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseField.java#L1226-L1249
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/DistributedObjectCacheAdapter.java
DistributedObjectCacheAdapter.addAlias
@Override public void addAlias(Object key, Object[] aliasArray) { final String methodName = "addAlias(key, aliasArray)"; functionNotAvailable(methodName); }
java
@Override public void addAlias(Object key, Object[] aliasArray) { final String methodName = "addAlias(key, aliasArray)"; functionNotAvailable(methodName); }
[ "@", "Override", "public", "void", "addAlias", "(", "Object", "key", ",", "Object", "[", "]", "aliasArray", ")", "{", "final", "String", "methodName", "=", "\"addAlias(key, aliasArray)\"", ";", "functionNotAvailable", "(", "methodName", ")", ";", "}" ]
Adds one or more aliases for the given key in the cache's mapping table. If the alias is already associated with another key, it will be changed to associate with the new key. @param key the key assoicated with alias @param aliasArray the aliases to use for lookups @throws IllegalArgumentException if the key is not in the cache's mapping table.
[ "Adds", "one", "or", "more", "aliases", "for", "the", "given", "key", "in", "the", "cache", "s", "mapping", "table", ".", "If", "the", "alias", "is", "already", "associated", "with", "another", "key", "it", "will", "be", "changed", "to", "associate", "wi...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/DistributedObjectCacheAdapter.java#L964-L968
beanshell/beanshell
src/main/java/bsh/Types.java
Types.areSignaturesEqual
static boolean areSignaturesEqual(Class[] from, Class[] to) { if (from.length != to.length) return false; for (int i = 0; i < from.length; i++) if (from[i] != to[i]) return false; return true; }
java
static boolean areSignaturesEqual(Class[] from, Class[] to) { if (from.length != to.length) return false; for (int i = 0; i < from.length; i++) if (from[i] != to[i]) return false; return true; }
[ "static", "boolean", "areSignaturesEqual", "(", "Class", "[", "]", "from", ",", "Class", "[", "]", "to", ")", "{", "if", "(", "from", ".", "length", "!=", "to", ".", "length", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i...
Are the two signatures exactly equal? This is checked for a special case in overload resolution.
[ "Are", "the", "two", "signatures", "exactly", "equal?", "This", "is", "checked", "for", "a", "special", "case", "in", "overload", "resolution", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Types.java#L220-L230
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getProfessionInfo
public void getProfessionInfo(String[] ids, Callback<List<Profession>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getProfessionInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getProfessionInfo(String[] ids, Callback<List<Profession>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getProfessionInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getProfessionInfo", "(", "String", "[", "]", "ids", ",", "Callback", "<", "List", "<", "Profession", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(",...
For more info on professions API go <a href="https://wiki.guildwars2.com/wiki/API:2/professions">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of profession id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see Profession profession info
[ "For", "more", "info", "on", "professions", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "professions", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "u...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1992-L1995
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/Controller.java
Controller.mapInField
void mapInField(Object from, String from_field, Object to, String to_in) { if (to == ca.getComponent()) { throw new ComponentException("wrong connect:" + from_field); } ComponentAccess ca_to = lookup(to); Access to_access = ca_to.input(to_in); checkFA(to_access, to, to_in); try { FieldContent.FA f = new FieldContent.FA(from, from_field); ca_to.setInput(to_in, new FieldObjectAccess(to_access, f, ens)); if (log.isLoggable(Level.CONFIG)) { log.config(String.format("Field(%s) -> @In(%s)", f.toString(), to_access.toString())); } } catch (Exception E) { throw new ComponentException("No such field '" + from.getClass().getCanonicalName() + "." + from_field + "'"); } }
java
void mapInField(Object from, String from_field, Object to, String to_in) { if (to == ca.getComponent()) { throw new ComponentException("wrong connect:" + from_field); } ComponentAccess ca_to = lookup(to); Access to_access = ca_to.input(to_in); checkFA(to_access, to, to_in); try { FieldContent.FA f = new FieldContent.FA(from, from_field); ca_to.setInput(to_in, new FieldObjectAccess(to_access, f, ens)); if (log.isLoggable(Level.CONFIG)) { log.config(String.format("Field(%s) -> @In(%s)", f.toString(), to_access.toString())); } } catch (Exception E) { throw new ComponentException("No such field '" + from.getClass().getCanonicalName() + "." + from_field + "'"); } }
[ "void", "mapInField", "(", "Object", "from", ",", "String", "from_field", ",", "Object", "to", ",", "String", "to_in", ")", "{", "if", "(", "to", "==", "ca", ".", "getComponent", "(", ")", ")", "{", "throw", "new", "ComponentException", "(", "\"wrong con...
Map an input field. @param from @param from_field @param to @param to_in
[ "Map", "an", "input", "field", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/Controller.java#L165-L182
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.countLockedResources
public int countLockedResources(CmsRequestContext context, CmsUUID id) throws CmsException, CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsProject project = null; int result = 0; try { project = m_driverManager.readProject(dbc, id); checkManagerOfProjectRole(dbc, project); result = m_driverManager.countLockedResources(project); } catch (Exception e) { dbc.report( null, Messages.get().container( Messages.ERR_COUNT_LOCKED_RESOURCES_PROJECT_2, (project == null) ? "<failed to read>" : project.getName(), id), e); } finally { dbc.clear(); } return result; }
java
public int countLockedResources(CmsRequestContext context, CmsUUID id) throws CmsException, CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsProject project = null; int result = 0; try { project = m_driverManager.readProject(dbc, id); checkManagerOfProjectRole(dbc, project); result = m_driverManager.countLockedResources(project); } catch (Exception e) { dbc.report( null, Messages.get().container( Messages.ERR_COUNT_LOCKED_RESOURCES_PROJECT_2, (project == null) ? "<failed to read>" : project.getName(), id), e); } finally { dbc.clear(); } return result; }
[ "public", "int", "countLockedResources", "(", "CmsRequestContext", "context", ",", "CmsUUID", "id", ")", "throws", "CmsException", ",", "CmsRoleViolationException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", ...
Counts the locked resources in this project.<p> @param context the current request context @param id the id of the project @return the amount of locked resources in this project @throws CmsException if something goes wrong @throws CmsRoleViolationException if the current user does not have management access to the project
[ "Counts", "the", "locked", "resources", "in", "this", "project", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L855-L877
beangle/beangle3
struts/s2/src/main/java/org/beangle/struts2/view/component/Component.java
Component.stripExpressionIfAltSyntax
public static String stripExpressionIfAltSyntax(ValueStack stack, String expr) { if (altSyntax(stack)) { // does the expression start with %{ and end with }? if so, just cut // it off! if (expr.startsWith("%{") && expr.endsWith("}")) { return expr.substring(2, expr.length() - 1); } } return expr; }
java
public static String stripExpressionIfAltSyntax(ValueStack stack, String expr) { if (altSyntax(stack)) { // does the expression start with %{ and end with }? if so, just cut // it off! if (expr.startsWith("%{") && expr.endsWith("}")) { return expr.substring(2, expr.length() - 1); } } return expr; }
[ "public", "static", "String", "stripExpressionIfAltSyntax", "(", "ValueStack", "stack", ",", "String", "expr", ")", "{", "if", "(", "altSyntax", "(", "stack", ")", ")", "{", "// does the expression start with %{ and end with }? if so, just cut", "// it off!", "if", "(",...
If altsyntax (%{...}) is applied, simply strip the "%{" and "}" off. @param stack the ValueStack where the context value is searched for. @param expr the expression (must be not null) @return the stripped expression if altSyntax is enabled. Otherwise the parameter expression is returned as is.
[ "If", "altsyntax", "(", "%", "{", "...", "}", ")", "is", "applied", "simply", "strip", "the", "%", "{", "and", "}", "off", "." ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/view/component/Component.java#L252-L259
craigwblake/redline
src/main/java/org/redline_rpm/Builder.java
Builder.addDirectory
public void addDirectory( final String path, final int permissions, final Directive directive, final String uname, final String gname) throws NoSuchAlgorithmException, IOException { contents.addDirectory( path, permissions, directive, uname, gname); }
java
public void addDirectory( final String path, final int permissions, final Directive directive, final String uname, final String gname) throws NoSuchAlgorithmException, IOException { contents.addDirectory( path, permissions, directive, uname, gname); }
[ "public", "void", "addDirectory", "(", "final", "String", "path", ",", "final", "int", "permissions", ",", "final", "Directive", "directive", ",", "final", "String", "uname", ",", "final", "String", "gname", ")", "throws", "NoSuchAlgorithmException", ",", "IOExc...
Adds the directory to the repository. @param path the absolute path to add as a directory. @param permissions the mode of the directory in standard three octet notation. @param directive directive indicating special handling for this file. @param uname user owner of the directory @param gname group owner of the directory @throws NoSuchAlgorithmException the algorithm isn't supported @throws IOException there was an IO error
[ "Adds", "the", "directory", "to", "the", "repository", "." ]
train
https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L1094-L1096
Red5/red5-io
src/main/java/org/red5/io/object/Serializer.java
Serializer.writeObjectType
@SuppressWarnings("all") protected static boolean writeObjectType(Output out, Object obj) { if (obj instanceof ObjectMap || obj instanceof BeanMap) { out.writeObject((Map) obj); } else if (obj instanceof Map) { out.writeMap((Map) obj); } else if (obj instanceof RecordSet) { out.writeRecordSet((RecordSet) obj); } else { out.writeObject(obj); } return true; }
java
@SuppressWarnings("all") protected static boolean writeObjectType(Output out, Object obj) { if (obj instanceof ObjectMap || obj instanceof BeanMap) { out.writeObject((Map) obj); } else if (obj instanceof Map) { out.writeMap((Map) obj); } else if (obj instanceof RecordSet) { out.writeRecordSet((RecordSet) obj); } else { out.writeObject(obj); } return true; }
[ "@", "SuppressWarnings", "(", "\"all\"", ")", "protected", "static", "boolean", "writeObjectType", "(", "Output", "out", ",", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "ObjectMap", "||", "obj", "instanceof", "BeanMap", ")", "{", "out", ".", ...
Write typed object to the output @param out Output writer @param obj Object type to write @return <tt>true</tt> if the object has been written, otherwise <tt>false</tt>
[ "Write", "typed", "object", "to", "the", "output" ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L330-L342
zaproxy/zaproxy
src/org/parosproxy/paros/network/GenericMethod.java
GenericMethod.setParameter
public void setParameter(String parameterName, String parameterValue) { log.trace("enter PostMethod.setParameter(String, String)"); removeParameter(parameterName); addParameter(parameterName, parameterValue); }
java
public void setParameter(String parameterName, String parameterValue) { log.trace("enter PostMethod.setParameter(String, String)"); removeParameter(parameterName); addParameter(parameterName, parameterValue); }
[ "public", "void", "setParameter", "(", "String", "parameterName", ",", "String", "parameterValue", ")", "{", "log", ".", "trace", "(", "\"enter PostMethod.setParameter(String, String)\"", ")", ";", "removeParameter", "(", "parameterName", ")", ";", "addParameter", "("...
Sets the value of parameter with parameterName to parameterValue. This method does not preserve the initial insertion order. @param parameterName name of the parameter @param parameterValue value of the parameter @since 2.0
[ "Sets", "the", "value", "of", "parameter", "with", "parameterName", "to", "parameterValue", ".", "This", "method", "does", "not", "preserve", "the", "initial", "insertion", "order", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/network/GenericMethod.java#L151-L156
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/workmanager/WorkWrapper.java
WorkWrapper.addWorkContext
public void addWorkContext(Class<? extends WorkContext> workContextClass, WorkContext workContext) { if (workContextClass == null) { throw new IllegalArgumentException("Work context class is null"); } if (workContext == null) { throw new IllegalArgumentException("Work context is null"); } if (workContexts == null) { workContexts = new HashMap<Class<? extends WorkContext>, WorkContext>(1); } if (trace) log.tracef("Adding work context %s for %s", workContextClass, this); workContexts.put(workContextClass, workContext); }
java
public void addWorkContext(Class<? extends WorkContext> workContextClass, WorkContext workContext) { if (workContextClass == null) { throw new IllegalArgumentException("Work context class is null"); } if (workContext == null) { throw new IllegalArgumentException("Work context is null"); } if (workContexts == null) { workContexts = new HashMap<Class<? extends WorkContext>, WorkContext>(1); } if (trace) log.tracef("Adding work context %s for %s", workContextClass, this); workContexts.put(workContextClass, workContext); }
[ "public", "void", "addWorkContext", "(", "Class", "<", "?", "extends", "WorkContext", ">", "workContextClass", ",", "WorkContext", "workContext", ")", "{", "if", "(", "workContextClass", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\...
Adds new work context. @param workContext new work context @param workContextClass work context class
[ "Adds", "new", "work", "context", "." ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/WorkWrapper.java#L522-L543
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.scaleAroundLocal
public Matrix4d scaleAroundLocal(double sx, double sy, double sz, double ox, double oy, double oz) { return scaleAroundLocal(sx, sy, sz, ox, oy, oz, this); }
java
public Matrix4d scaleAroundLocal(double sx, double sy, double sz, double ox, double oy, double oz) { return scaleAroundLocal(sx, sy, sz, ox, oy, oz, this); }
[ "public", "Matrix4d", "scaleAroundLocal", "(", "double", "sx", ",", "double", "sy", ",", "double", "sz", ",", "double", "ox", ",", "double", "oy", ",", "double", "oz", ")", "{", "return", "scaleAroundLocal", "(", "sx", ",", "sy", ",", "sz", ",", "ox", ...
Pre-multiply scaling to this matrix by scaling the base axes by the given sx, sy and sz factors while using <code>(ox, oy, oz)</code> as the scaling origin. <p> If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix, then the new matrix will be <code>S * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>S * M * v</code>, the scaling will be applied last! <p> This method is equivalent to calling: <code>new Matrix4d().translate(ox, oy, oz).scale(sx, sy, sz).translate(-ox, -oy, -oz).mul(this, this)</code> @param sx the scaling factor of the x component @param sy the scaling factor of the y component @param sz the scaling factor of the z component @param ox the x coordinate of the scaling origin @param oy the y coordinate of the scaling origin @param oz the z coordinate of the scaling origin @return this
[ "Pre", "-", "multiply", "scaling", "to", "this", "matrix", "by", "scaling", "the", "base", "axes", "by", "the", "given", "sx", "sy", "and", "sz", "factors", "while", "using", "<code", ">", "(", "ox", "oy", "oz", ")", "<", "/", "code", ">", "as", "t...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L4656-L4658
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/DatagramChannelImpl.java
DatagramChannelImpl.translateAndSetInterestOps
public void translateAndSetInterestOps(int ops, SelectionKeyImpl sk) { int newOps = 0; if ((ops & SelectionKey.OP_READ) != 0) newOps |= PollArrayWrapper.POLLIN; if ((ops & SelectionKey.OP_WRITE) != 0) newOps |= PollArrayWrapper.POLLOUT; if ((ops & SelectionKey.OP_CONNECT) != 0) newOps |= PollArrayWrapper.POLLIN; sk.selector.putEventOps(sk, newOps); }
java
public void translateAndSetInterestOps(int ops, SelectionKeyImpl sk) { int newOps = 0; if ((ops & SelectionKey.OP_READ) != 0) newOps |= PollArrayWrapper.POLLIN; if ((ops & SelectionKey.OP_WRITE) != 0) newOps |= PollArrayWrapper.POLLOUT; if ((ops & SelectionKey.OP_CONNECT) != 0) newOps |= PollArrayWrapper.POLLIN; sk.selector.putEventOps(sk, newOps); }
[ "public", "void", "translateAndSetInterestOps", "(", "int", "ops", ",", "SelectionKeyImpl", "sk", ")", "{", "int", "newOps", "=", "0", ";", "if", "(", "(", "ops", "&", "SelectionKey", ".", "OP_READ", ")", "!=", "0", ")", "newOps", "|=", "PollArrayWrapper",...
Translates an interest operation set into a native poll event set
[ "Translates", "an", "interest", "operation", "set", "into", "a", "native", "poll", "event", "set" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/DatagramChannelImpl.java#L876-L886
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/concurrent/JRebirth.java
JRebirth.runIntoJTPSync
public static void runIntoJTPSync(final JRebirthRunnable runnable, final long... timeout) { final SyncRunnable sync = new SyncRunnable(runnable); if (JRebirth.isJTPSlot()) { // We are into a JTP slot so just run it synchronously sync.run(); // Be careful in this case no timeout protection is achieved } else { // The runnable will be run into the JTP slot during the next round JRebirthThread.getThread().runIntoJTP(sync); // Wait the end of the runnable execution sync.waitEnd(timeout); } }
java
public static void runIntoJTPSync(final JRebirthRunnable runnable, final long... timeout) { final SyncRunnable sync = new SyncRunnable(runnable); if (JRebirth.isJTPSlot()) { // We are into a JTP slot so just run it synchronously sync.run(); // Be careful in this case no timeout protection is achieved } else { // The runnable will be run into the JTP slot during the next round JRebirthThread.getThread().runIntoJTP(sync); // Wait the end of the runnable execution sync.waitEnd(timeout); } }
[ "public", "static", "void", "runIntoJTPSync", "(", "final", "JRebirthRunnable", "runnable", ",", "final", "long", "...", "timeout", ")", "{", "final", "SyncRunnable", "sync", "=", "new", "SyncRunnable", "(", "runnable", ")", ";", "if", "(", "JRebirth", ".", ...
Run into the JRebirth Thread Pool [JTP] <b>Synchronously</b>. Be careful this method can be called through any thread. @param runnable the task to run @param timeout the optional timeout value after which the thread will be released (default is 1000 ms)
[ "Run", "into", "the", "JRebirth", "Thread", "Pool", "[", "JTP", "]", "<b", ">", "Synchronously<", "/", "b", ">", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/concurrent/JRebirth.java#L392-L405
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java
TypesafeConfigUtils.getValueList
public static ConfigList getValueList(Config config, String path) { try { return config.getList(path); } catch (ConfigException.Missing | ConfigException.WrongType e) { if (e instanceof ConfigException.WrongType) { LOGGER.warn(e.getMessage(), e); } return null; } }
java
public static ConfigList getValueList(Config config, String path) { try { return config.getList(path); } catch (ConfigException.Missing | ConfigException.WrongType e) { if (e instanceof ConfigException.WrongType) { LOGGER.warn(e.getMessage(), e); } return null; } }
[ "public", "static", "ConfigList", "getValueList", "(", "Config", "config", ",", "String", "path", ")", "{", "try", "{", "return", "config", ".", "getList", "(", "path", ")", ";", "}", "catch", "(", "ConfigException", ".", "Missing", "|", "ConfigException", ...
Get a configuration as list of Values. Return {@code null} if missing or wrong type. @param config @param path @return
[ "Get", "a", "configuration", "as", "list", "of", "Values", ".", "Return", "{", "@code", "null", "}", "if", "missing", "or", "wrong", "type", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java#L912-L921
cverges/expect4j
src/main/java/expect4j/Expect4j.java
Expect4j.expect
public int expect(String pattern, Closure handler) throws MalformedPatternException, Exception { logger.trace("Searching for '" + pattern + "' in the reader stream and executing Closure " + handler + " if found"); PatternPair match = new GlobMatch(pattern, handler); List<Match> list = new ArrayList<>(); list.add(match); return expect(list); }
java
public int expect(String pattern, Closure handler) throws MalformedPatternException, Exception { logger.trace("Searching for '" + pattern + "' in the reader stream and executing Closure " + handler + " if found"); PatternPair match = new GlobMatch(pattern, handler); List<Match> list = new ArrayList<>(); list.add(match); return expect(list); }
[ "public", "int", "expect", "(", "String", "pattern", ",", "Closure", "handler", ")", "throws", "MalformedPatternException", ",", "Exception", "{", "logger", ".", "trace", "(", "\"Searching for '\"", "+", "pattern", "+", "\"' in the reader stream and executing Closure \"...
Attempts to detect the provided pattern and executes the provided {@link Closure} if it is detected. @param pattern the pattern to find in the reader stream @param handler the handler to execute if the pattern is found @return the number of times the pattern is found, or an error code @throws MalformedPatternException if the pattern is invalid @throws Exception if a generic error is encountered while processing the {@link Closure}
[ "Attempts", "to", "detect", "the", "provided", "pattern", "and", "executes", "the", "provided", "{" ]
train
https://github.com/cverges/expect4j/blob/97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6/src/main/java/expect4j/Expect4j.java#L277-L283
google/error-prone
check_api/src/main/java/com/google/errorprone/util/Comments.java
Comments.after
private static <T> T after(T target, Iterable<? extends T> iterable, T defaultValue) { Iterator<? extends T> iterator = iterable.iterator(); while (iterator.hasNext()) { if (iterator.next().equals(target)) { break; } } if (iterator.hasNext()) { return iterator.next(); } return defaultValue; }
java
private static <T> T after(T target, Iterable<? extends T> iterable, T defaultValue) { Iterator<? extends T> iterator = iterable.iterator(); while (iterator.hasNext()) { if (iterator.next().equals(target)) { break; } } if (iterator.hasNext()) { return iterator.next(); } return defaultValue; }
[ "private", "static", "<", "T", ">", "T", "after", "(", "T", "target", ",", "Iterable", "<", "?", "extends", "T", ">", "iterable", ",", "T", "defaultValue", ")", "{", "Iterator", "<", "?", "extends", "T", ">", "iterator", "=", "iterable", ".", "iterat...
Find the element in the iterable following the target @param target is the element to search for @param iterable is the iterable to search @param defaultValue will be returned if there is no item following the searched for item @return the item following {@code target} or {@code defaultValue} if not found
[ "Find", "the", "element", "in", "the", "iterable", "following", "the", "target" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/Comments.java#L300-L313
czyzby/gdx-lml
lml/src/main/java/com/github/czyzby/lml/parser/impl/DefaultLmlTemplateReader.java
DefaultLmlTemplateReader.appendSequence
protected void appendSequence(final CharSequence sequence, final String name) { if (Strings.isNotEmpty(sequence)) { queueCurrentSequence(); setCurrentSequence(new CharSequenceEntry(sequence, name)); } }
java
protected void appendSequence(final CharSequence sequence, final String name) { if (Strings.isNotEmpty(sequence)) { queueCurrentSequence(); setCurrentSequence(new CharSequenceEntry(sequence, name)); } }
[ "protected", "void", "appendSequence", "(", "final", "CharSequence", "sequence", ",", "final", "String", "name", ")", "{", "if", "(", "Strings", ".", "isNotEmpty", "(", "sequence", ")", ")", "{", "queueCurrentSequence", "(", ")", ";", "setCurrentSequence", "("...
Actual appending method, referenced by all others. @param sequence should be appended to the reader and set as currently parsed sequence. @param name name of the template for debugging purposes.
[ "Actual", "appending", "method", "referenced", "by", "all", "others", "." ]
train
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml/src/main/java/com/github/czyzby/lml/parser/impl/DefaultLmlTemplateReader.java#L59-L64
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/table/Relation.java
Relation.get
public Object get(int r, int c) { Column<?> column = column(c); return column.get(r); }
java
public Object get(int r, int c) { Column<?> column = column(c); return column.get(r); }
[ "public", "Object", "get", "(", "int", "r", ",", "int", "c", ")", "{", "Column", "<", "?", ">", "column", "=", "column", "(", "c", ")", ";", "return", "column", ".", "get", "(", "r", ")", ";", "}" ]
Returns the value at the given row and column indexes @param r the row index, 0 based @param c the column index, 0 based
[ "Returns", "the", "value", "at", "the", "given", "row", "and", "column", "indexes" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/table/Relation.java#L175-L178
dropbox/dropbox-sdk-java
src/main/java/com/dropbox/core/android/AuthActivity.java
AuthActivity.makeIntent
public static Intent makeIntent(Context context, String appKey, String webHost, String apiType) { return makeIntent(context, appKey, null, null, null, webHost, apiType); }
java
public static Intent makeIntent(Context context, String appKey, String webHost, String apiType) { return makeIntent(context, appKey, null, null, null, webHost, apiType); }
[ "public", "static", "Intent", "makeIntent", "(", "Context", "context", ",", "String", "appKey", ",", "String", "webHost", ",", "String", "apiType", ")", "{", "return", "makeIntent", "(", "context", ",", "appKey", ",", "null", ",", "null", ",", "null", ",",...
Create an intent which can be sent to this activity to start OAuth 2 authentication. @param context the source context @param appKey the consumer key for the app @param webHost the host to use for web authentication, or null for the default @param apiType an identifier for the type of API being supported, or null for the default @return a newly created intent.
[ "Create", "an", "intent", "which", "can", "be", "sent", "to", "this", "activity", "to", "start", "OAuth", "2", "authentication", "." ]
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/android/AuthActivity.java#L230-L233
jroyalty/jglm
src/main/java/com/hackoeur/jglm/Matrices.java
Matrices.lookAt
public static final Mat4 lookAt(final Vec3 eye, final Vec3 center, final Vec3 up) { final Vec3 f = center.subtract(eye).getUnitVector(); Vec3 u = up.getUnitVector(); final Vec3 s = f.cross(u).getUnitVector(); u = s.cross(f); return new Mat4( s.x, u.x, -f.x, 0f, s.y, u.y, -f.y, 0f, s.z, u.z, -f.z, 0f, -s.dot(eye), -u.dot(eye), f.dot(eye), 1f ); }
java
public static final Mat4 lookAt(final Vec3 eye, final Vec3 center, final Vec3 up) { final Vec3 f = center.subtract(eye).getUnitVector(); Vec3 u = up.getUnitVector(); final Vec3 s = f.cross(u).getUnitVector(); u = s.cross(f); return new Mat4( s.x, u.x, -f.x, 0f, s.y, u.y, -f.y, 0f, s.z, u.z, -f.z, 0f, -s.dot(eye), -u.dot(eye), f.dot(eye), 1f ); }
[ "public", "static", "final", "Mat4", "lookAt", "(", "final", "Vec3", "eye", ",", "final", "Vec3", "center", ",", "final", "Vec3", "up", ")", "{", "final", "Vec3", "f", "=", "center", ".", "subtract", "(", "eye", ")", ".", "getUnitVector", "(", ")", "...
Defines a viewing transformation. This method is analogous to the now deprecated {@code gluLookAt} method. @param eye position of the eye point @param center position of the reference point @param up direction of the up vector @return
[ "Defines", "a", "viewing", "transformation", ".", "This", "method", "is", "analogous", "to", "the", "now", "deprecated", "{", "@code", "gluLookAt", "}", "method", "." ]
train
https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/Matrices.java#L94-L106
alkacon/opencms-core
src/org/opencms/xml/CmsXmlMessages.java
CmsXmlMessages.keyDefault
@Override public String keyDefault(String keyName, String defaultValue) { if (hasConfigValue(keyName)) { return getConfigValue(keyName); } return m_messages.keyDefault(keyName, defaultValue); }
java
@Override public String keyDefault(String keyName, String defaultValue) { if (hasConfigValue(keyName)) { return getConfigValue(keyName); } return m_messages.keyDefault(keyName, defaultValue); }
[ "@", "Override", "public", "String", "keyDefault", "(", "String", "keyName", ",", "String", "defaultValue", ")", "{", "if", "(", "hasConfigValue", "(", "keyName", ")", ")", "{", "return", "getConfigValue", "(", "keyName", ")", ";", "}", "return", "m_messages...
Returns the localized resource String from the configuration file, if not found or set from the resource bundle.<p> @see org.opencms.i18n.CmsMessages#keyDefault(java.lang.String, java.lang.String)
[ "Returns", "the", "localized", "resource", "String", "from", "the", "configuration", "file", "if", "not", "found", "or", "set", "from", "the", "resource", "bundle", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlMessages.java#L192-L199
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java
SDMath.diagPart
public SDVariable diagPart(String name, SDVariable x) { SDVariable ret = f().diagPart(x); return updateVariableNameAndReference(ret, name); }
java
public SDVariable diagPart(String name, SDVariable x) { SDVariable ret = f().diagPart(x); return updateVariableNameAndReference(ret, name); }
[ "public", "SDVariable", "diagPart", "(", "String", "name", ",", "SDVariable", "x", ")", "{", "SDVariable", "ret", "=", "f", "(", ")", ".", "diagPart", "(", "x", ")", ";", "return", "updateVariableNameAndReference", "(", "ret", ",", "name", ")", ";", "}" ...
Extract the diagonal part from the input array.<br> If input is<br> [ 1, 0, 0]<br> [ 0, 2, 0]<br> [ 0, 0, 3]<br> then output is [1, 2, 3].<br> Supports higher dimensions: in general, out[i,...,k] = in[i,...,k,i,...,k] @param x Input variable @return Diagonal part of the input @see #diag(String, SDVariable)
[ "Extract", "the", "diagonal", "part", "from", "the", "input", "array", ".", "<br", ">", "If", "input", "is<br", ">", "[", "1", "0", "0", "]", "<br", ">", "[", "0", "2", "0", "]", "<br", ">", "[", "0", "0", "3", "]", "<br", ">", "then", "outpu...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L824-L827
lightblueseas/swing-components
src/main/java/de/alpharogroup/swing/tree/model/AbstractGenericTreeNode.java
AbstractGenericTreeNode.addChildAt
@Override public void addChildAt(final int index, final ITreeNode<T> child) throws IndexOutOfBoundsException { if (children != null && children.size() < index) { children.add(index, child); } else { addChild(child); } }
java
@Override public void addChildAt(final int index, final ITreeNode<T> child) throws IndexOutOfBoundsException { if (children != null && children.size() < index) { children.add(index, child); } else { addChild(child); } }
[ "@", "Override", "public", "void", "addChildAt", "(", "final", "int", "index", ",", "final", "ITreeNode", "<", "T", ">", "child", ")", "throws", "IndexOutOfBoundsException", "{", "if", "(", "children", "!=", "null", "&&", "children", ".", "size", "(", ")",...
Adds the child. @param index the index @param child the child @throws IndexOutOfBoundsException the index out of bounds exception
[ "Adds", "the", "child", "." ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/tree/model/AbstractGenericTreeNode.java#L96-L108
XDean/Java-EX
src/main/java/xdean/jex/util/reflect/TypeUtil.java
TypeUtil.isAssignableFrom
public static boolean isAssignableFrom(Type from, Class<?> to) { return TypeVisitor.of(from, b -> b .onClass(to::isAssignableFrom) .onParameterizedType(pt -> TypeVisitor.of(pt.getRawType(), bb -> bb .onClass(to::isAssignableFrom) .result())) .onTypeVariable(tv -> isAssignableFrom(tv.getBounds(), to)) .onWildcardType(tv -> isAssignableFrom(tv.getUpperBounds(), to)) .result()); }
java
public static boolean isAssignableFrom(Type from, Class<?> to) { return TypeVisitor.of(from, b -> b .onClass(to::isAssignableFrom) .onParameterizedType(pt -> TypeVisitor.of(pt.getRawType(), bb -> bb .onClass(to::isAssignableFrom) .result())) .onTypeVariable(tv -> isAssignableFrom(tv.getBounds(), to)) .onWildcardType(tv -> isAssignableFrom(tv.getUpperBounds(), to)) .result()); }
[ "public", "static", "boolean", "isAssignableFrom", "(", "Type", "from", ",", "Class", "<", "?", ">", "to", ")", "{", "return", "TypeVisitor", ".", "of", "(", "from", ",", "b", "->", "b", ".", "onClass", "(", "to", "::", "isAssignableFrom", ")", ".", ...
Determine if a 'from' type object can assign to 'to' type.<br> If the to class is primitive type, see {@link Class#isAssignableFrom(Class)} @see Class#isAssignableFrom(Class) @param from @param to @return
[ "Determine", "if", "a", "from", "type", "object", "can", "assign", "to", "to", "type", ".", "<br", ">", "If", "the", "to", "class", "is", "primitive", "type", "see", "{", "@link", "Class#isAssignableFrom", "(", "Class", ")", "}" ]
train
https://github.com/XDean/Java-EX/blob/9208ba71c5b2af9f9bd979d01fab2ff5e433b3e7/src/main/java/xdean/jex/util/reflect/TypeUtil.java#L16-L25