repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
google/closure-templates
java/src/com/google/template/soy/types/SoyTypeRegistry.java
SoyTypeRegistry.getOrCreateMapType
public MapType getOrCreateMapType(SoyType keyType, SoyType valueType) { return mapTypes.intern(MapType.of(keyType, valueType)); }
java
public MapType getOrCreateMapType(SoyType keyType, SoyType valueType) { return mapTypes.intern(MapType.of(keyType, valueType)); }
[ "public", "MapType", "getOrCreateMapType", "(", "SoyType", "keyType", ",", "SoyType", "valueType", ")", "{", "return", "mapTypes", ".", "intern", "(", "MapType", ".", "of", "(", "keyType", ",", "valueType", ")", ")", ";", "}" ]
Factory function which creates a map type, given a key and value type. This folds map types with identical key/value types together, so asking for the same key/value type twice will return a pointer to the same type object. @param keyType The key type of the map. @param valueType The value type of the map. @return The map type.
[ "Factory", "function", "which", "creates", "a", "map", "type", "given", "a", "key", "and", "value", "type", ".", "This", "folds", "map", "types", "with", "identical", "key", "/", "value", "types", "together", "so", "asking", "for", "the", "same", "key", ...
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/SoyTypeRegistry.java#L259-L261
sonatype/sisu-guice
extensions/servlet/src/com/google/inject/servlet/ServletScopes.java
ServletScopes.scopeRequest
public static RequestScoper scopeRequest(Map<Key<?>, Object> seedMap) { Preconditions.checkArgument( null != seedMap, "Seed map cannot be null, try passing in Collections.emptyMap() instead."); // Copy the seed values into our local scope map. final Context context = new Context(); Map<Key<?>, Object> validatedAndCanonicalizedMap = Maps.transformEntries( seedMap, new EntryTransformer<Key<?>, Object, Object>() { @Override public Object transformEntry(Key<?> key, Object value) { return validateAndCanonicalizeValue(key, value); } }); context.map.putAll(validatedAndCanonicalizedMap); return new RequestScoper() { @Override public CloseableScope open() { checkScopingState( null == GuiceFilter.localContext.get(), "An HTTP request is already in progress, cannot scope a new request in this thread."); checkScopingState( null == requestScopeContext.get(), "A request scope is already in progress, cannot scope a new request in this thread."); return context.open(); } }; }
java
public static RequestScoper scopeRequest(Map<Key<?>, Object> seedMap) { Preconditions.checkArgument( null != seedMap, "Seed map cannot be null, try passing in Collections.emptyMap() instead."); // Copy the seed values into our local scope map. final Context context = new Context(); Map<Key<?>, Object> validatedAndCanonicalizedMap = Maps.transformEntries( seedMap, new EntryTransformer<Key<?>, Object, Object>() { @Override public Object transformEntry(Key<?> key, Object value) { return validateAndCanonicalizeValue(key, value); } }); context.map.putAll(validatedAndCanonicalizedMap); return new RequestScoper() { @Override public CloseableScope open() { checkScopingState( null == GuiceFilter.localContext.get(), "An HTTP request is already in progress, cannot scope a new request in this thread."); checkScopingState( null == requestScopeContext.get(), "A request scope is already in progress, cannot scope a new request in this thread."); return context.open(); } }; }
[ "public", "static", "RequestScoper", "scopeRequest", "(", "Map", "<", "Key", "<", "?", ">", ",", "Object", ">", "seedMap", ")", "{", "Preconditions", ".", "checkArgument", "(", "null", "!=", "seedMap", ",", "\"Seed map cannot be null, try passing in Collections.empt...
Returns an object that will apply request scope to a block of code. This is not the same as the HTTP request scope, but is used if no HTTP request scope is in progress. In this way, keys can be scoped as @RequestScoped and exist in non-HTTP requests (for example: RPC requests) as well as in HTTP request threads. <p>The returned object will throw a {@link ScopingException} when opened if there is a request scope already active on the current thread. @param seedMap the initial set of scoped instances for Guice to seed the request scope with. To seed a key with null, use {@code null} as the value. @return an object that when opened will initiate the request scope @since 4.1
[ "Returns", "an", "object", "that", "will", "apply", "request", "scope", "to", "a", "block", "of", "code", ".", "This", "is", "not", "the", "same", "as", "the", "HTTP", "request", "scope", "but", "is", "used", "if", "no", "HTTP", "request", "scope", "is...
train
https://github.com/sonatype/sisu-guice/blob/45f5c89834c189c5338640bf55e6e6181b9b5611/extensions/servlet/src/com/google/inject/servlet/ServletScopes.java#L359-L387
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getCompositeEntityRole
public EntityRole getCompositeEntityRole(UUID appId, String versionId, UUID cEntityId, UUID roleId) { return getCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, roleId).toBlocking().single().body(); }
java
public EntityRole getCompositeEntityRole(UUID appId, String versionId, UUID cEntityId, UUID roleId) { return getCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, roleId).toBlocking().single().body(); }
[ "public", "EntityRole", "getCompositeEntityRole", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "cEntityId", ",", "UUID", "roleId", ")", "{", "return", "getCompositeEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "cEntityId",...
Get one entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @param roleId entity role ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the EntityRole object if successful.
[ "Get", "one", "entity", "role", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L12354-L12356
JOML-CI/JOML
src/org/joml/Matrix3d.java
Matrix3d.rotateLocal
public Matrix3d rotateLocal(double ang, double x, double y, double z) { return rotateLocal(ang, x, y, z, this); }
java
public Matrix3d rotateLocal(double ang, double x, double y, double z) { return rotateLocal(ang, x, y, z, this); }
[ "public", "Matrix3d", "rotateLocal", "(", "double", "ang", ",", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "return", "rotateLocal", "(", "ang", ",", "x", ",", "y", ",", "z", ",", "this", ")", ";", "}" ]
Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified <code>(x, y, z)</code> axis. <p> The axis described by the three components needs to be a unit vector. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotation(double, double, double, double) rotation()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotation(double, double, double, double) @param ang the angle in radians @param x the x component of the axis @param y the y component of the axis @param z the z component of the axis @return this
[ "Pre", "-", "multiply", "a", "rotation", "to", "this", "matrix", "by", "rotating", "the", "given", "amount", "of", "radians", "about", "the", "specified", "<code", ">", "(", "x", "y", "z", ")", "<", "/", "code", ">", "axis", ".", "<p", ">", "The", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3d.java#L2652-L2654
sematext/ActionGenerator
ag-player-es/src/main/java/com/sematext/ag/es/util/JSONUtils.java
JSONUtils.getElasticSearchAddDocument
public static String getElasticSearchAddDocument(Map<String, String> values) { StringBuilder builder = new StringBuilder(); builder.append("{"); boolean first = true; for (Map.Entry<String, String> pair : values.entrySet()) { if (!first) { builder.append(","); } JSONUtils.addElasticSearchField(builder, pair); first = false; } builder.append("}"); return builder.toString(); }
java
public static String getElasticSearchAddDocument(Map<String, String> values) { StringBuilder builder = new StringBuilder(); builder.append("{"); boolean first = true; for (Map.Entry<String, String> pair : values.entrySet()) { if (!first) { builder.append(","); } JSONUtils.addElasticSearchField(builder, pair); first = false; } builder.append("}"); return builder.toString(); }
[ "public", "static", "String", "getElasticSearchAddDocument", "(", "Map", "<", "String", ",", "String", ">", "values", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "builder", ".", "append", "(", "\"{\"", ")", ";", "boolean...
Returns ElasticSearch add command. @param values values to include @return XML as String
[ "Returns", "ElasticSearch", "add", "command", "." ]
train
https://github.com/sematext/ActionGenerator/blob/10f4a3e680f20d7d151f5d40e6758aeb072d474f/ag-player-es/src/main/java/com/sematext/ag/es/util/JSONUtils.java#L39-L52
Metatavu/edelphi
rest/src/main/java/fi/metatavu/edelphi/rest/AbstractApi.java
AbstractApi.streamResponse
protected Response streamResponse(String type, InputStream inputStream, int contentLength) { return Response.ok(new StreamingOutputImpl(inputStream), type) .header("Content-Length", contentLength) .build(); }
java
protected Response streamResponse(String type, InputStream inputStream, int contentLength) { return Response.ok(new StreamingOutputImpl(inputStream), type) .header("Content-Length", contentLength) .build(); }
[ "protected", "Response", "streamResponse", "(", "String", "type", ",", "InputStream", "inputStream", ",", "int", "contentLength", ")", "{", "return", "Response", ".", "ok", "(", "new", "StreamingOutputImpl", "(", "inputStream", ")", ",", "type", ")", ".", "hea...
Creates streamed response from input stream @param inputStream data @param type content type @param contentLength content length @return Response
[ "Creates", "streamed", "response", "from", "input", "stream" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/rest/src/main/java/fi/metatavu/edelphi/rest/AbstractApi.java#L177-L181
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/GeneralPurposeFFT_F64_2D.java
GeneralPurposeFFT_F64_2D.realInverse
public void realInverse(double[] a, boolean scale) { // handle special case if( rows == 1 || columns == 1 ) { if( rows > 1 ) fftRows.realInverse(a, scale); else fftColumns.realInverse(a, scale); return; } if (isPowerOfTwo == false) { throw new IllegalArgumentException("rows and columns must be power of two numbers"); } else { rdft2d_sub(-1, a); cdft2d_sub(1, a, scale); for (int r = 0; r < rows; r++) { fftColumns.realInverse(a, r * columns, scale); } } }
java
public void realInverse(double[] a, boolean scale) { // handle special case if( rows == 1 || columns == 1 ) { if( rows > 1 ) fftRows.realInverse(a, scale); else fftColumns.realInverse(a, scale); return; } if (isPowerOfTwo == false) { throw new IllegalArgumentException("rows and columns must be power of two numbers"); } else { rdft2d_sub(-1, a); cdft2d_sub(1, a, scale); for (int r = 0; r < rows; r++) { fftColumns.realInverse(a, r * columns, scale); } } }
[ "public", "void", "realInverse", "(", "double", "[", "]", "a", ",", "boolean", "scale", ")", "{", "// handle special case", "if", "(", "rows", "==", "1", "||", "columns", "==", "1", ")", "{", "if", "(", "rows", ">", "1", ")", "fftRows", ".", "realInv...
Computes 2D inverse DFT of real data leaving the result in <code>a</code> . This method only works when the sizes of both dimensions are power-of-two numbers. The physical layout of the input data has to be as follows: <pre> a[k1*columns+2*k2] = Re[k1][k2] = Re[rows-k1][columns-k2], a[k1*columns+2*k2+1] = Im[k1][k2] = -Im[rows-k1][columns-k2], 0&lt;k1&lt;rows, 0&lt;k2&lt;columns/2, a[2*k2] = Re[0][k2] = Re[0][columns-k2], a[2*k2+1] = Im[0][k2] = -Im[0][columns-k2], 0&lt;k2&lt;columns/2, a[k1*columns] = Re[k1][0] = Re[rows-k1][0], a[k1*columns+1] = Im[k1][0] = -Im[rows-k1][0], a[(rows-k1)*columns+1] = Re[k1][columns/2] = Re[rows-k1][columns/2], a[(rows-k1)*columns] = -Im[k1][columns/2] = Im[rows-k1][columns/2], 0&lt;k1&lt;rows/2, a[0] = Re[0][0], a[1] = Re[0][columns/2], a[(rows/2)*columns] = Re[rows/2][0], a[(rows/2)*columns+1] = Re[rows/2][columns/2] </pre> This method computes only half of the elements of the real transform. The other half satisfies the symmetry condition. If you want the full real inverse transform, use <code>realInverseFull</code>. @param a data to transform @param scale if true then scaling is performed
[ "Computes", "2D", "inverse", "DFT", "of", "real", "data", "leaving", "the", "result", "in", "<code", ">", "a<", "/", "code", ">", ".", "This", "method", "only", "works", "when", "the", "sizes", "of", "both", "dimensions", "are", "power", "-", "of", "-"...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/GeneralPurposeFFT_F64_2D.java#L342-L361
astrapi69/mystic-crypt
crypt-data/src/main/java/de/alpharogroup/crypto/key/PublicKeyExtensions.java
PublicKeyExtensions.toHexString
public static String toHexString(final PublicKey publicKey, final boolean lowerCase) { return HexExtensions.toHexString(publicKey.getEncoded(), lowerCase); }
java
public static String toHexString(final PublicKey publicKey, final boolean lowerCase) { return HexExtensions.toHexString(publicKey.getEncoded(), lowerCase); }
[ "public", "static", "String", "toHexString", "(", "final", "PublicKey", "publicKey", ",", "final", "boolean", "lowerCase", ")", "{", "return", "HexExtensions", ".", "toHexString", "(", "publicKey", ".", "getEncoded", "(", ")", ",", "lowerCase", ")", ";", "}" ]
Transform the given {@link PublicKey} to a hexadecimal {@link String} value. @param publicKey the public key @param lowerCase the flag if the result shell be transform in lower case. If true the result is @return the new hexadecimal {@link String} value.
[ "Transform", "the", "given", "{", "@link", "PublicKey", "}", "to", "a", "hexadecimal", "{", "@link", "String", "}", "value", "." ]
train
https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/key/PublicKeyExtensions.java#L138-L141
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java
JobSchedulesImpl.disableAsync
public Observable<Void> disableAsync(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions) { return disableWithServiceResponseAsync(jobScheduleId, jobScheduleDisableOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders> response) { return response.body(); } }); }
java
public Observable<Void> disableAsync(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions) { return disableWithServiceResponseAsync(jobScheduleId, jobScheduleDisableOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "disableAsync", "(", "String", "jobScheduleId", ",", "JobScheduleDisableOptions", "jobScheduleDisableOptions", ")", "{", "return", "disableWithServiceResponseAsync", "(", "jobScheduleId", ",", "jobScheduleDisableOptions", ")", ".", ...
Disables a job schedule. No new jobs will be created until the job schedule is enabled again. @param jobScheduleId The ID of the job schedule to disable. @param jobScheduleDisableOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Disables", "a", "job", "schedule", ".", "No", "new", "jobs", "will", "be", "created", "until", "the", "job", "schedule", "is", "enabled", "again", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java#L1450-L1457
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleUtility.java
LocaleUtility.isFallbackOf
public static boolean isFallbackOf(Locale parent, Locale child) { return isFallbackOf(parent.toString(), child.toString()); }
java
public static boolean isFallbackOf(Locale parent, Locale child) { return isFallbackOf(parent.toString(), child.toString()); }
[ "public", "static", "boolean", "isFallbackOf", "(", "Locale", "parent", ",", "Locale", "child", ")", "{", "return", "isFallbackOf", "(", "parent", ".", "toString", "(", ")", ",", "child", ".", "toString", "(", ")", ")", ";", "}" ]
Compare two locales, and return true if the parent is a 'strict' fallback of the child (parent string is a fallback of child string).
[ "Compare", "two", "locales", "and", "return", "true", "if", "the", "parent", "is", "a", "strict", "fallback", "of", "the", "child", "(", "parent", "string", "is", "a", "fallback", "of", "child", "string", ")", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleUtility.java#L69-L71
phax/ph-bdve
ph-bdve/src/main/java/com/helger/bdve/execute/ValidationExecutionManager.java
ValidationExecutionManager.executeValidation
@Nonnull public ValidationResultList executeValidation (@Nonnull final IValidationSource aSource) { return executeValidation (aSource, (Locale) null); }
java
@Nonnull public ValidationResultList executeValidation (@Nonnull final IValidationSource aSource) { return executeValidation (aSource, (Locale) null); }
[ "@", "Nonnull", "public", "ValidationResultList", "executeValidation", "(", "@", "Nonnull", "final", "IValidationSource", "aSource", ")", "{", "return", "executeValidation", "(", "aSource", ",", "(", "Locale", ")", "null", ")", ";", "}" ]
Perform a validation with all the contained executors and the system default locale. @param aSource The source artefact to be validated. May not be <code>null</code>. contained executor a result is added to the result list. @return The validation result list. Never <code>null</code>. For each contained executor a result is added to the result list. @see #executeValidation(IValidationSource, ValidationResultList, Locale) @since 5.1.1
[ "Perform", "a", "validation", "with", "all", "the", "contained", "executors", "and", "the", "system", "default", "locale", "." ]
train
https://github.com/phax/ph-bdve/blob/2438f491174cd8989567fcdf129b273bd217e89f/ph-bdve/src/main/java/com/helger/bdve/execute/ValidationExecutionManager.java#L278-L282
baratine/baratine
framework/src/main/java/com/caucho/v5/vfs/XmlWriter.java
XmlWriter.writeElement
public void writeElement(String name, Object text) { startElement(name); writeText(text); endElement(name); }
java
public void writeElement(String name, Object text) { startElement(name); writeText(text); endElement(name); }
[ "public", "void", "writeElement", "(", "String", "name", ",", "Object", "text", ")", "{", "startElement", "(", "name", ")", ";", "writeText", "(", "text", ")", ";", "endElement", "(", "name", ")", ";", "}" ]
Convenience method, same as doing a startElement(), writeText(text), endElement().
[ "Convenience", "method", "same", "as", "doing", "a", "startElement", "()", "writeText", "(", "text", ")", "endElement", "()", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/XmlWriter.java#L257-L262
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonSerializationContext.java
JsonSerializationContext.traceError
public JsonSerializationException traceError( Object value, String message ) { getLogger().log( Level.SEVERE, message ); return new JsonSerializationException( message ); }
java
public JsonSerializationException traceError( Object value, String message ) { getLogger().log( Level.SEVERE, message ); return new JsonSerializationException( message ); }
[ "public", "JsonSerializationException", "traceError", "(", "Object", "value", ",", "String", "message", ")", "{", "getLogger", "(", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "message", ")", ";", "return", "new", "JsonSerializationException", "(", "mes...
Trace an error and returns a corresponding exception. @param value current value @param message error message @return a {@link JsonSerializationException} with the given message
[ "Trace", "an", "error", "and", "returns", "a", "corresponding", "exception", "." ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonSerializationContext.java#L505-L508
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java
AbstractBlobClob.truncate
public synchronized void truncate(long len) throws SQLException { checkFreed(); if (!conn.haveMinimumServerVersion(ServerVersion.v8_3)) { throw new PSQLException( GT.tr("Truncation of large objects is only implemented in 8.3 and later servers."), PSQLState.NOT_IMPLEMENTED); } if (len < 0) { throw new PSQLException(GT.tr("Cannot truncate LOB to a negative length."), PSQLState.INVALID_PARAMETER_VALUE); } if (len > Integer.MAX_VALUE) { if (support64bit) { getLo(true).truncate64(len); } else { throw new PSQLException(GT.tr("PostgreSQL LOBs can only index to: {0}", Integer.MAX_VALUE), PSQLState.INVALID_PARAMETER_VALUE); } } else { getLo(true).truncate((int) len); } }
java
public synchronized void truncate(long len) throws SQLException { checkFreed(); if (!conn.haveMinimumServerVersion(ServerVersion.v8_3)) { throw new PSQLException( GT.tr("Truncation of large objects is only implemented in 8.3 and later servers."), PSQLState.NOT_IMPLEMENTED); } if (len < 0) { throw new PSQLException(GT.tr("Cannot truncate LOB to a negative length."), PSQLState.INVALID_PARAMETER_VALUE); } if (len > Integer.MAX_VALUE) { if (support64bit) { getLo(true).truncate64(len); } else { throw new PSQLException(GT.tr("PostgreSQL LOBs can only index to: {0}", Integer.MAX_VALUE), PSQLState.INVALID_PARAMETER_VALUE); } } else { getLo(true).truncate((int) len); } }
[ "public", "synchronized", "void", "truncate", "(", "long", "len", ")", "throws", "SQLException", "{", "checkFreed", "(", ")", ";", "if", "(", "!", "conn", ".", "haveMinimumServerVersion", "(", "ServerVersion", ".", "v8_3", ")", ")", "{", "throw", "new", "P...
For Blobs this should be in bytes while for Clobs it should be in characters. Since we really haven't figured out how to handle character sets for Clobs the current implementation uses bytes for both Blobs and Clobs. @param len maximum length @throws SQLException if operation fails
[ "For", "Blobs", "this", "should", "be", "in", "bytes", "while", "for", "Clobs", "it", "should", "be", "in", "characters", ".", "Since", "we", "really", "haven", "t", "figured", "out", "how", "to", "handle", "character", "sets", "for", "Clobs", "the", "cu...
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java#L73-L95
jenkinsci/jenkins
core/src/main/java/jenkins/model/lazy/SortedIntList.java
SortedIntList.binarySearch
private static int binarySearch(int[] a, int start, int end, int key) { int lo = start, hi = end-1; // search range is [lo,hi] // invariant lo<=hi while (lo <= hi) { int pivot = (lo + hi)/2; int v = a[pivot]; if (v < key) // needs to search upper half lo = pivot+1; else if (v > key) // needs to search lower half hi = pivot-1; else // eureka! return pivot; } return -(lo + 1); // insertion point }
java
private static int binarySearch(int[] a, int start, int end, int key) { int lo = start, hi = end-1; // search range is [lo,hi] // invariant lo<=hi while (lo <= hi) { int pivot = (lo + hi)/2; int v = a[pivot]; if (v < key) // needs to search upper half lo = pivot+1; else if (v > key) // needs to search lower half hi = pivot-1; else // eureka! return pivot; } return -(lo + 1); // insertion point }
[ "private", "static", "int", "binarySearch", "(", "int", "[", "]", "a", ",", "int", "start", ",", "int", "end", ",", "int", "key", ")", "{", "int", "lo", "=", "start", ",", "hi", "=", "end", "-", "1", ";", "// search range is [lo,hi]", "// invariant lo<...
Switch to {@code java.util.Arrays.binarySearch} when we depend on Java6.
[ "Switch", "to", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/lazy/SortedIntList.java#L159-L175
google/closure-compiler
src/com/google/javascript/rhino/jstype/JSTypeRegistry.java
JSTypeRegistry.getType
public JSType getType( StaticTypedScope scope, String jsTypeName, String sourceName, int lineno, int charno) { return getType(scope, jsTypeName, sourceName, lineno, charno, true); }
java
public JSType getType( StaticTypedScope scope, String jsTypeName, String sourceName, int lineno, int charno) { return getType(scope, jsTypeName, sourceName, lineno, charno, true); }
[ "public", "JSType", "getType", "(", "StaticTypedScope", "scope", ",", "String", "jsTypeName", ",", "String", "sourceName", ",", "int", "lineno", ",", "int", "charno", ")", "{", "return", "getType", "(", "scope", ",", "jsTypeName", ",", "sourceName", ",", "li...
Looks up a type by name. To allow for forward references to types, an unrecognized string has to be bound to a NamedType object that will be resolved later. @param scope A scope for doing type name resolution. @param jsTypeName The name string. @param sourceName The name of the source file where this reference appears. @param lineno The line number of the reference. @return a NamedType if the string argument is not one of the known types, otherwise the corresponding JSType object.
[ "Looks", "up", "a", "type", "by", "name", ".", "To", "allow", "for", "forward", "references", "to", "types", "an", "unrecognized", "string", "has", "to", "be", "bound", "to", "a", "NamedType", "object", "that", "will", "be", "resolved", "later", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1361-L1364
couchbaselabs/couchbase-lite-java-forestdb
src/main/java/com/couchbase/lite/store/ForestDBViewStore.java
ForestDBViewStore.openIndex
private View openIndex(int flags, boolean dryRun) throws ForestException { if (_view == null) { // Flags: if (_dbStore.getAutoCompact()) flags |= Database.AutoCompact; // Encryption: SymmetricKey encryptionKey = _dbStore.getEncryptionKey(); int enAlgorithm = Database.NoEncryption; byte[] enKey = null; if (encryptionKey != null) { enAlgorithm = Database.AES256Encryption; enKey = encryptionKey.getKey(); } _view = new View(_dbStore.forest, _path, flags, enAlgorithm, enKey, name, dryRun ? "0" : delegate.getMapVersion()); if (dryRun) { closeIndex(); } } return _view; }
java
private View openIndex(int flags, boolean dryRun) throws ForestException { if (_view == null) { // Flags: if (_dbStore.getAutoCompact()) flags |= Database.AutoCompact; // Encryption: SymmetricKey encryptionKey = _dbStore.getEncryptionKey(); int enAlgorithm = Database.NoEncryption; byte[] enKey = null; if (encryptionKey != null) { enAlgorithm = Database.AES256Encryption; enKey = encryptionKey.getKey(); } _view = new View(_dbStore.forest, _path, flags, enAlgorithm, enKey, name, dryRun ? "0" : delegate.getMapVersion()); if (dryRun) { closeIndex(); } } return _view; }
[ "private", "View", "openIndex", "(", "int", "flags", ",", "boolean", "dryRun", ")", "throws", "ForestException", "{", "if", "(", "_view", "==", "null", ")", "{", "// Flags:", "if", "(", "_dbStore", ".", "getAutoCompact", "(", ")", ")", "flags", "|=", "Da...
Opens the index, specifying ForestDB database flags in CBLView.m - (MapReduceIndex*) openIndexWithOptions: (Database::openFlags)options
[ "Opens", "the", "index", "specifying", "ForestDB", "database", "flags", "in", "CBLView", ".", "m", "-", "(", "MapReduceIndex", "*", ")", "openIndexWithOptions", ":", "(", "Database", "::", "openFlags", ")", "options" ]
train
https://github.com/couchbaselabs/couchbase-lite-java-forestdb/blob/fd806b251dd7dcc7a76ab7a8db618e30c3419f06/src/main/java/com/couchbase/lite/store/ForestDBViewStore.java#L583-L605
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.updateApiKey
public JSONObject updateApiKey(String key, JSONObject params) throws AlgoliaException { return this.updateApiKey(key, params, RequestOptions.empty); }
java
public JSONObject updateApiKey(String key, JSONObject params) throws AlgoliaException { return this.updateApiKey(key, params, RequestOptions.empty); }
[ "public", "JSONObject", "updateApiKey", "(", "String", "key", ",", "JSONObject", "params", ")", "throws", "AlgoliaException", "{", "return", "this", ".", "updateApiKey", "(", "key", ",", "params", ",", "RequestOptions", ".", "empty", ")", ";", "}" ]
Update a new api key @param params the list of parameters for this key. Defined by a JSONObject that can contains the following values: - acl: array of string - indices: array of string - validity: int - referers: array of string - description: string - maxHitsPerQuery: integer - queryParameters: string - maxQueriesPerIPPerHour: integer
[ "Update", "a", "new", "api", "key" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1116-L1118
zerodhatech/javakiteconnect
kiteconnect/src/com/zerodhatech/kiteconnect/kitehttp/KiteRequestHandler.java
KiteRequestHandler.createGetRequest
public Request createGetRequest(String url, Map<String, Object> params, String apiKey, String accessToken) { HttpUrl.Builder httpBuilder = HttpUrl.parse(url).newBuilder(); for(Map.Entry<String, Object> entry: params.entrySet()){ httpBuilder.addQueryParameter(entry.getKey(), entry.getValue().toString()); } return new Request.Builder().url(httpBuilder.build()).header("User-Agent", USER_AGENT).header("X-Kite-Version", "3").header("Authorization", "token "+apiKey+":"+accessToken).build(); }
java
public Request createGetRequest(String url, Map<String, Object> params, String apiKey, String accessToken) { HttpUrl.Builder httpBuilder = HttpUrl.parse(url).newBuilder(); for(Map.Entry<String, Object> entry: params.entrySet()){ httpBuilder.addQueryParameter(entry.getKey(), entry.getValue().toString()); } return new Request.Builder().url(httpBuilder.build()).header("User-Agent", USER_AGENT).header("X-Kite-Version", "3").header("Authorization", "token "+apiKey+":"+accessToken).build(); }
[ "public", "Request", "createGetRequest", "(", "String", "url", ",", "Map", "<", "String", ",", "Object", ">", "params", ",", "String", "apiKey", ",", "String", "accessToken", ")", "{", "HttpUrl", ".", "Builder", "httpBuilder", "=", "HttpUrl", ".", "parse", ...
Creates a GET request. @param url is the endpoint to which request has to be done. @param apiKey is the api key of the Kite Connect app. @param accessToken is the access token obtained after successful login process. @param params is the map of data that has to be sent in query params.
[ "Creates", "a", "GET", "request", "." ]
train
https://github.com/zerodhatech/javakiteconnect/blob/4a3f15ff2c8a1b3b6ec61799f8bb047e4dfeb92d/kiteconnect/src/com/zerodhatech/kiteconnect/kitehttp/KiteRequestHandler.java#L169-L175
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/PeriodDuration.java
PeriodDuration.of
public static PeriodDuration of(Period period) { Objects.requireNonNull(period, "The period must not be null"); return new PeriodDuration(period, Duration.ZERO); }
java
public static PeriodDuration of(Period period) { Objects.requireNonNull(period, "The period must not be null"); return new PeriodDuration(period, Duration.ZERO); }
[ "public", "static", "PeriodDuration", "of", "(", "Period", "period", ")", "{", "Objects", ".", "requireNonNull", "(", "period", ",", "\"The period must not be null\"", ")", ";", "return", "new", "PeriodDuration", "(", "period", ",", "Duration", ".", "ZERO", ")",...
Obtains an instance based on a period. <p> The duration will be zero. @param period the period, not null @return the combined period-duration, not null
[ "Obtains", "an", "instance", "based", "on", "a", "period", ".", "<p", ">", "The", "duration", "will", "be", "zero", "." ]
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/PeriodDuration.java#L139-L142
landawn/AbacusUtil
src/com/landawn/abacus/util/FileSystemUtil.java
FileSystemUtil.freeSpaceKb
public static long freeSpaceKb(final String path, final long timeout) throws IOException { return INSTANCE.freeSpaceOS(path, OS, true, timeout); }
java
public static long freeSpaceKb(final String path, final long timeout) throws IOException { return INSTANCE.freeSpaceOS(path, OS, true, timeout); }
[ "public", "static", "long", "freeSpaceKb", "(", "final", "String", "path", ",", "final", "long", "timeout", ")", "throws", "IOException", "{", "return", "INSTANCE", ".", "freeSpaceOS", "(", "path", ",", "OS", ",", "true", ",", "timeout", ")", ";", "}" ]
Returns the free space on a drive or volume in kilobytes by invoking the command line. <pre> FileSystemUtils.freeSpaceKb("C:"); // Windows FileSystemUtils.freeSpaceKb("/volume"); // *nix </pre> The free space is calculated via the command line. It uses 'dir /-c' on Windows, 'df -kP' on AIX/HP-UX and 'df -k' on other Unix. <p> In order to work, you must be running Windows, or have a implementation of Unix df that supports GNU format when passed -k (or -kP). If you are going to rely on this code, please check that it works on your OS by running some simple tests to compare the command line with the output from this class. If your operating system isn't supported, please raise a JIRA call detailing the exact result from df -k and as much other detail as possible, thanks. @param path the path to get free space for, not null, not empty on Unix @param timeout The timeout amount in milliseconds or no timeout if the value is zero or less @return the amount of free drive space on the drive or volume in kilobytes @throws IllegalArgumentException if the path is invalid @throws IllegalStateException if an error occurred in initialisation @throws IOException if an error occurs when finding the free space @since 2.0
[ "Returns", "the", "free", "space", "on", "a", "drive", "or", "volume", "in", "kilobytes", "by", "invoking", "the", "command", "line", ".", "<pre", ">", "FileSystemUtils", ".", "freeSpaceKb", "(", "C", ":", ")", ";", "//", "Windows", "FileSystemUtils", ".",...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/FileSystemUtil.java#L161-L163
watson-developer-cloud/java-sdk
discovery/src/main/java/com/ibm/watson/discovery/v1/query/AggregationDeserializer.java
AggregationDeserializer.parseArray
private void parseArray(JsonReader in, HashMap<String, Object> objMap, String name) throws IOException { List<HashMap<String, Object>> array = new ArrayList<>(); in.beginArray(); while (in.peek() != JsonToken.END_ARRAY) { HashMap<String, Object> arrayItem = new HashMap<>(); parseNext(in, arrayItem); array.add(arrayItem); } in.endArray(); objMap.put(name, array); }
java
private void parseArray(JsonReader in, HashMap<String, Object> objMap, String name) throws IOException { List<HashMap<String, Object>> array = new ArrayList<>(); in.beginArray(); while (in.peek() != JsonToken.END_ARRAY) { HashMap<String, Object> arrayItem = new HashMap<>(); parseNext(in, arrayItem); array.add(arrayItem); } in.endArray(); objMap.put(name, array); }
[ "private", "void", "parseArray", "(", "JsonReader", "in", ",", "HashMap", "<", "String", ",", "Object", ">", "objMap", ",", "String", "name", ")", "throws", "IOException", "{", "List", "<", "HashMap", "<", "String", ",", "Object", ">", ">", "array", "=",...
Parses a JSON array and adds it to the main object map. @param in {@link JsonReader} object used for parsing @param objMap Map used to build the structure for the resulting {@link QueryAggregation} object @param name key value to go with the resulting value of this method pass @throws IOException signals that there has been an IO exception
[ "Parses", "a", "JSON", "array", "and", "adds", "it", "to", "the", "main", "object", "map", "." ]
train
https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/query/AggregationDeserializer.java#L157-L169
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/message/MessageSelectorBuilder.java
MessageSelectorBuilder.fromKeyValueMap
public static MessageSelectorBuilder fromKeyValueMap(Map<String, Object> valueMap) { StringBuffer buf = new StringBuffer(); Iterator<Entry<String, Object>> iter = valueMap.entrySet().iterator(); if (iter.hasNext()) { Entry<String, Object> entry = iter.next(); String key = entry.getKey(); String value = entry.getValue().toString(); buf.append(key + " = '" + value + "'"); } while (iter.hasNext()) { Entry<String, Object> entry = iter.next(); String key = entry.getKey(); String value = entry.getValue().toString(); buf.append(" AND " + key + " = '" + value + "'"); } return new MessageSelectorBuilder(buf.toString()); }
java
public static MessageSelectorBuilder fromKeyValueMap(Map<String, Object> valueMap) { StringBuffer buf = new StringBuffer(); Iterator<Entry<String, Object>> iter = valueMap.entrySet().iterator(); if (iter.hasNext()) { Entry<String, Object> entry = iter.next(); String key = entry.getKey(); String value = entry.getValue().toString(); buf.append(key + " = '" + value + "'"); } while (iter.hasNext()) { Entry<String, Object> entry = iter.next(); String key = entry.getKey(); String value = entry.getValue().toString(); buf.append(" AND " + key + " = '" + value + "'"); } return new MessageSelectorBuilder(buf.toString()); }
[ "public", "static", "MessageSelectorBuilder", "fromKeyValueMap", "(", "Map", "<", "String", ",", "Object", ">", "valueMap", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "Iterator", "<", "Entry", "<", "String", ",", "Object", ">...
Static builder method using a key value map. @param valueMap @return
[ "Static", "builder", "method", "using", "a", "key", "value", "map", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/message/MessageSelectorBuilder.java#L77-L99
nguyenq/tess4j
src/main/java/net/sourceforge/tess4j/util/ImageIOHelper.java
ImageIOHelper.deskewImage
public static File deskewImage(File imageFile, double minimumDeskewThreshold) throws IOException { List<BufferedImage> imageList = getImageList(imageFile); for (int i = 0; i < imageList.size(); i++) { BufferedImage bi = imageList.get(i); ImageDeskew deskew = new ImageDeskew(bi); double imageSkewAngle = deskew.getSkewAngle(); if ((imageSkewAngle > minimumDeskewThreshold || imageSkewAngle < -(minimumDeskewThreshold))) { bi = ImageUtil.rotate(bi, -imageSkewAngle, bi.getWidth() / 2, bi.getHeight() / 2); imageList.set(i, bi); // replace original with deskewed image } } File tempImageFile = File.createTempFile(FilenameUtils.getBaseName(imageFile.getName()), ".tif"); mergeTiff(imageList.toArray(new BufferedImage[0]), tempImageFile); return tempImageFile; }
java
public static File deskewImage(File imageFile, double minimumDeskewThreshold) throws IOException { List<BufferedImage> imageList = getImageList(imageFile); for (int i = 0; i < imageList.size(); i++) { BufferedImage bi = imageList.get(i); ImageDeskew deskew = new ImageDeskew(bi); double imageSkewAngle = deskew.getSkewAngle(); if ((imageSkewAngle > minimumDeskewThreshold || imageSkewAngle < -(minimumDeskewThreshold))) { bi = ImageUtil.rotate(bi, -imageSkewAngle, bi.getWidth() / 2, bi.getHeight() / 2); imageList.set(i, bi); // replace original with deskewed image } } File tempImageFile = File.createTempFile(FilenameUtils.getBaseName(imageFile.getName()), ".tif"); mergeTiff(imageList.toArray(new BufferedImage[0]), tempImageFile); return tempImageFile; }
[ "public", "static", "File", "deskewImage", "(", "File", "imageFile", ",", "double", "minimumDeskewThreshold", ")", "throws", "IOException", "{", "List", "<", "BufferedImage", ">", "imageList", "=", "getImageList", "(", "imageFile", ")", ";", "for", "(", "int", ...
Deskews image. @param imageFile input image @param minimumDeskewThreshold minimum deskew threshold (typically, 0.05d) @return temporary multi-page TIFF image file @throws IOException
[ "Deskews", "image", "." ]
train
https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/ImageIOHelper.java#L604-L621
iig-uni-freiburg/SEWOL
ext/org/deckfour/spex/SXTag.java
SXTag.addAttribute
public synchronized void addAttribute(String aName, String aValue) throws IOException { // reject modification of already closed node if(isOpen==false) { throw new IOException("Attempted to add attribute '" + aName + "' to already closed tag '" + name + "'!"); } // check for sane input if((aName==null) || (aValue==null) || (aName.trim().length()==0) || (aValue.trim().length()==0)) { return; // reject unnecessary attributes } // add attributes if(lastChildNode==null) { // encode and write attribute aName = aName.trim(); aValue = SXmlCharacterMethods.convertCharsToXml(aValue.trim()); writer.write(" " + aName + "=\"" + aValue + "\""); } else { // usage contract broken! (no adding of attributes after adding first child node) throw new IOException("No attributes can be added to a node " + "after the first child has been added! ('" + name + "')"); } }
java
public synchronized void addAttribute(String aName, String aValue) throws IOException { // reject modification of already closed node if(isOpen==false) { throw new IOException("Attempted to add attribute '" + aName + "' to already closed tag '" + name + "'!"); } // check for sane input if((aName==null) || (aValue==null) || (aName.trim().length()==0) || (aValue.trim().length()==0)) { return; // reject unnecessary attributes } // add attributes if(lastChildNode==null) { // encode and write attribute aName = aName.trim(); aValue = SXmlCharacterMethods.convertCharsToXml(aValue.trim()); writer.write(" " + aName + "=\"" + aValue + "\""); } else { // usage contract broken! (no adding of attributes after adding first child node) throw new IOException("No attributes can be added to a node " + "after the first child has been added! ('" + name + "')"); } }
[ "public", "synchronized", "void", "addAttribute", "(", "String", "aName", ",", "String", "aValue", ")", "throws", "IOException", "{", "// reject modification of already closed node", "if", "(", "isOpen", "==", "false", ")", "{", "throw", "new", "IOException", "(", ...
Adds an attribute to this tag node. Will result in something like: <code><i>aName</i>=<i>aValue</i></code> <b>WARNING:</b> <ul> <li>Attributes must be added immediately after creation of a tag, i.e.:</li> <li>All attributes must have been added <b>before</b> adding the first child node.</li> </ul> @param aName Name, i.e. key, of this attribute @param aValue Value of this attribute
[ "Adds", "an", "attribute", "to", "this", "tag", "node", ".", "Will", "result", "in", "something", "like", ":", "<code", ">", "<i", ">", "aName<", "/", "i", ">", "=", "<i", ">", "aValue<", "/", "i", ">", "<", "/", "code", ">", "<b", ">", "WARNING"...
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/spex/SXTag.java#L111-L134
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/AnnotationUtility.java
AnnotationUtility.extractAsInt
public static int extractAsInt(Element item, Class<? extends Annotation> annotationClass, AnnotationAttributeType attributeName) { final Elements elementUtils=BaseProcessor.elementUtils; final One<Integer> result = new One<Integer>(); result.value0 = 0; extractString(elementUtils, item, annotationClass, attributeName, new OnAttributeFoundListener() { @Override public void onFound(String value) { result.value0 = Integer.parseInt(value); } }); return result.value0; }
java
public static int extractAsInt(Element item, Class<? extends Annotation> annotationClass, AnnotationAttributeType attributeName) { final Elements elementUtils=BaseProcessor.elementUtils; final One<Integer> result = new One<Integer>(); result.value0 = 0; extractString(elementUtils, item, annotationClass, attributeName, new OnAttributeFoundListener() { @Override public void onFound(String value) { result.value0 = Integer.parseInt(value); } }); return result.value0; }
[ "public", "static", "int", "extractAsInt", "(", "Element", "item", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ",", "AnnotationAttributeType", "attributeName", ")", "{", "final", "Elements", "elementUtils", "=", "BaseProcessor", ".", "...
Extract as int. @param item the item @param annotationClass the annotation class @param attributeName the attribute name @return the int
[ "Extract", "as", "int", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/AnnotationUtility.java#L532-L546
aws/aws-sdk-java
aws-java-sdk-secretsmanager/src/main/java/com/amazonaws/services/secretsmanager/model/DescribeSecretResult.java
DescribeSecretResult.setVersionIdsToStages
public void setVersionIdsToStages(java.util.Map<String, java.util.List<String>> versionIdsToStages) { this.versionIdsToStages = versionIdsToStages; }
java
public void setVersionIdsToStages(java.util.Map<String, java.util.List<String>> versionIdsToStages) { this.versionIdsToStages = versionIdsToStages; }
[ "public", "void", "setVersionIdsToStages", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", "versionIdsToStages", ")", "{", "this", ".", "versionIdsToStages", "=", "versionIdsToStages", ";",...
<p> A list of all of the currently assigned <code>VersionStage</code> staging labels and the <code>VersionId</code> that each is attached to. Staging labels are used to keep track of the different versions during the rotation process. </p> <note> <p> A version that does not have any staging labels attached is considered deprecated and subject to deletion. Such versions are not included in this list. </p> </note> @param versionIdsToStages A list of all of the currently assigned <code>VersionStage</code> staging labels and the <code>VersionId</code> that each is attached to. Staging labels are used to keep track of the different versions during the rotation process.</p> <note> <p> A version that does not have any staging labels attached is considered deprecated and subject to deletion. Such versions are not included in this list. </p>
[ "<p", ">", "A", "list", "of", "all", "of", "the", "currently", "assigned", "<code", ">", "VersionStage<", "/", "code", ">", "staging", "labels", "and", "the", "<code", ">", "VersionId<", "/", "code", ">", "that", "each", "is", "attached", "to", ".", "S...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-secretsmanager/src/main/java/com/amazonaws/services/secretsmanager/model/DescribeSecretResult.java#L799-L801
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLImportsDeclarationImpl_CustomFieldSerializer.java
OWLImportsDeclarationImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLImportsDeclarationImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLImportsDeclarationImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLImportsDeclarationImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLImportsDeclarationImpl_CustomFieldSerializer.java#L63-L66
apache/predictionio-sdk-java
client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java
EventClient.deleteUser
public String deleteUser(String uid, DateTime eventTime) throws ExecutionException, InterruptedException, IOException { return createEvent(deleteUserAsFuture(uid, eventTime)); }
java
public String deleteUser(String uid, DateTime eventTime) throws ExecutionException, InterruptedException, IOException { return createEvent(deleteUserAsFuture(uid, eventTime)); }
[ "public", "String", "deleteUser", "(", "String", "uid", ",", "DateTime", "eventTime", ")", "throws", "ExecutionException", ",", "InterruptedException", ",", "IOException", "{", "return", "createEvent", "(", "deleteUserAsFuture", "(", "uid", ",", "eventTime", ")", ...
Deletes a user. @param uid ID of the user @param eventTime timestamp of the event @return ID of this event
[ "Deletes", "a", "user", "." ]
train
https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L428-L431
sockeqwe/SwipeBack
library/src/com/hannesdorfmann/swipeback/SwipeBack.java
SwipeBack.setContentView
public SwipeBack setContentView(View view) { setContentView(view, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); return this; }
java
public SwipeBack setContentView(View view) { setContentView(view, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); return this; }
[ "public", "SwipeBack", "setContentView", "(", "View", "view", ")", "{", "setContentView", "(", "view", ",", "new", "LayoutParams", "(", "LayoutParams", ".", "MATCH_PARENT", ",", "LayoutParams", ".", "MATCH_PARENT", ")", ")", ";", "return", "this", ";", "}" ]
Set the content to an explicit view. @param view The desired content to display.
[ "Set", "the", "content", "to", "an", "explicit", "view", "." ]
train
https://github.com/sockeqwe/SwipeBack/blob/09ed11f48e930ed47fd4f07ad1c786fc9fff3c48/library/src/com/hannesdorfmann/swipeback/SwipeBack.java#L1443-L1446
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java
DataFrameJoiner.rightOuter
public Table rightOuter(Table table2, String[] col2Names) { return rightOuter(table2, false, col2Names); }
java
public Table rightOuter(Table table2, String[] col2Names) { return rightOuter(table2, false, col2Names); }
[ "public", "Table", "rightOuter", "(", "Table", "table2", ",", "String", "[", "]", "col2Names", ")", "{", "return", "rightOuter", "(", "table2", ",", "false", ",", "col2Names", ")", ";", "}" ]
Joins the joiner to the table2, using the given columns for the second table and returns the resulting table @param table2 The table to join with @param col2Names The columns to join on. If a name refers to a double column, the join is performed after rounding to integers. @return The resulting table
[ "Joins", "the", "joiner", "to", "the", "table2", "using", "the", "given", "columns", "for", "the", "second", "table", "and", "returns", "the", "resulting", "table" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java#L590-L592
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/Validate.java
Validate.isInstanceOf
@GwtIncompatible("incompatible method") public static void isInstanceOf(final Class<?> type, final Object obj) { // TODO when breaking BC, consider returning obj if (!type.isInstance(obj)) { throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_IS_INSTANCE_OF_EX_MESSAGE, type.getName(), obj == null ? "null" : obj.getClass().getName())); } }
java
@GwtIncompatible("incompatible method") public static void isInstanceOf(final Class<?> type, final Object obj) { // TODO when breaking BC, consider returning obj if (!type.isInstance(obj)) { throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_IS_INSTANCE_OF_EX_MESSAGE, type.getName(), obj == null ? "null" : obj.getClass().getName())); } }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "void", "isInstanceOf", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "Object", "obj", ")", "{", "// TODO when breaking BC, consider returning obj", "if", "(", "!", "typ...
Validates that the argument is an instance of the specified class, if not throws an exception. <p>This method is useful when validating according to an arbitrary class</p> <pre>Validate.isInstanceOf(OkClass.class, object);</pre> <p>The message of the exception is &quot;Expected type: {type}, actual: {obj_type}&quot;</p> @param type the class the object must be validated against, not null @param obj the object to check, null throws an exception @throws IllegalArgumentException if argument is not of specified class @see #isInstanceOf(Class, Object, String, Object...) @since 3.0
[ "Validates", "that", "the", "argument", "is", "an", "instance", "of", "the", "specified", "class", "if", "not", "throws", "an", "exception", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L1266-L1273
Ordinastie/MalisisCore
src/main/java/net/malisis/core/renderer/animation/transformation/Transformation.java
Transformation.forTicks
public T forTicks(int duration, int delay) { this.duration = Timer.tickToTime(duration); this.delay = Timer.tickToTime(delay); return self(); }
java
public T forTicks(int duration, int delay) { this.duration = Timer.tickToTime(duration); this.delay = Timer.tickToTime(delay); return self(); }
[ "public", "T", "forTicks", "(", "int", "duration", ",", "int", "delay", ")", "{", "this", ".", "duration", "=", "Timer", ".", "tickToTime", "(", "duration", ")", ";", "this", ".", "delay", "=", "Timer", ".", "tickToTime", "(", "delay", ")", ";", "ret...
Sets the duration and delay for this {@link Transformation}. @param duration the duration @param delay the delay @return the t
[ "Sets", "the", "duration", "and", "delay", "for", "this", "{", "@link", "Transformation", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/Transformation.java#L93-L99
wkgcass/Style
src/main/java/net/cassite/style/IfBlock.java
IfBlock.ElseIf
public IfBlock<T, INIT> ElseIf(RFunc0<INIT> init, RFunc1<T, INIT> body) { return ElseIf(init, $(body)); }
java
public IfBlock<T, INIT> ElseIf(RFunc0<INIT> init, RFunc1<T, INIT> body) { return ElseIf(init, $(body)); }
[ "public", "IfBlock", "<", "T", ",", "INIT", ">", "ElseIf", "(", "RFunc0", "<", "INIT", ">", "init", ",", "RFunc1", "<", "T", ",", "INIT", ">", "body", ")", "{", "return", "ElseIf", "(", "init", ",", "$", "(", "body", ")", ")", ";", "}" ]
define an ElseIf block.<br> @param init lambda expression returns an object or boolean value, init==null || init.equals(false) will be considered <b>false</b> in traditional if expression. in other cases, considered true @param body takes in INIT value, and return body's return value if init is considered true @return if body
[ "define", "an", "ElseIf", "block", ".", "<br", ">" ]
train
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/IfBlock.java#L208-L210
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.alternateCalls
public void alternateCalls(String connId, String heldConnId) throws WorkspaceApiException { this.alternateCalls(connId, heldConnId, null, null); }
java
public void alternateCalls(String connId, String heldConnId) throws WorkspaceApiException { this.alternateCalls(connId, heldConnId, null, null); }
[ "public", "void", "alternateCalls", "(", "String", "connId", ",", "String", "heldConnId", ")", "throws", "WorkspaceApiException", "{", "this", ".", "alternateCalls", "(", "connId", ",", "heldConnId", ",", "null", ",", "null", ")", ";", "}" ]
Alternate two calls so that you retrieve a call on hold and place the established call on hold instead. This is a shortcut for doing `holdCall()` and `retrieveCall()` separately. @param connId The connection ID of the established call that should be placed on hold. @param heldConnId The connection ID of the held call that should be retrieved.
[ "Alternate", "two", "calls", "so", "that", "you", "retrieve", "a", "call", "on", "hold", "and", "place", "the", "established", "call", "on", "hold", "instead", ".", "This", "is", "a", "shortcut", "for", "doing", "holdCall", "()", "and", "retrieveCall", "()...
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L868-L870
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/spatialite/SpatialDbsImportUtils.java
SpatialDbsImportUtils.createTableFromShp
public static String createTableFromShp( ASpatialDb db, File shapeFile, String newTableName, boolean avoidSpatialIndex ) throws Exception { FileDataStore store = FileDataStoreFinder.getDataStore(shapeFile); SimpleFeatureSource featureSource = store.getFeatureSource(); SimpleFeatureType schema = featureSource.getSchema(); if (newTableName == null) { newTableName = FileUtilities.getNameWithoutExtention(shapeFile); } return createTableFromSchema(db, schema, newTableName, avoidSpatialIndex); }
java
public static String createTableFromShp( ASpatialDb db, File shapeFile, String newTableName, boolean avoidSpatialIndex ) throws Exception { FileDataStore store = FileDataStoreFinder.getDataStore(shapeFile); SimpleFeatureSource featureSource = store.getFeatureSource(); SimpleFeatureType schema = featureSource.getSchema(); if (newTableName == null) { newTableName = FileUtilities.getNameWithoutExtention(shapeFile); } return createTableFromSchema(db, schema, newTableName, avoidSpatialIndex); }
[ "public", "static", "String", "createTableFromShp", "(", "ASpatialDb", "db", ",", "File", "shapeFile", ",", "String", "newTableName", ",", "boolean", "avoidSpatialIndex", ")", "throws", "Exception", "{", "FileDataStore", "store", "=", "FileDataStoreFinder", ".", "ge...
Create a spatial table using a shapefile as schema. @param db the database to use. @param shapeFile the shapefile to use. @param newTableName the new name of the table. If null, the shp name is used. @return the name of the created table. @param avoidSpatialIndex if <code>true</code>, no spatial index will be created. This is useful if many records have to be inserted and the index will be created later manually. @return the name of the created table. @throws Exception
[ "Create", "a", "spatial", "table", "using", "a", "shapefile", "as", "schema", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/spatialite/SpatialDbsImportUtils.java#L88-L97
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/lang/Strings.java
Strings.leftPad
public static String leftPad(String str, int size, char padChar) { if (str == null) { return null; } int pads = size - str.length(); if (pads <= 0) { return str; // returns original String when possible } return repeat(padChar, pads).concat(str); }
java
public static String leftPad(String str, int size, char padChar) { if (str == null) { return null; } int pads = size - str.length(); if (pads <= 0) { return str; // returns original String when possible } return repeat(padChar, pads).concat(str); }
[ "public", "static", "String", "leftPad", "(", "String", "str", ",", "int", "size", ",", "char", "padChar", ")", "{", "if", "(", "str", "==", "null", ")", "{", "return", "null", ";", "}", "int", "pads", "=", "size", "-", "str", ".", "length", "(", ...
<p> Left pad a String with a specified character. </p> <p> Pad to a size of {@code size}. </p> <pre> leftPad(null, *, *) = null leftPad("", 3, 'z') = "zzz" leftPad("bat", 3, 'z') = "bat" leftPad("bat", 5, 'z') = "zzbat" leftPad("bat", 1, 'z') = "bat" leftPad("bat", -1, 'z') = "bat" </pre> @param str the String to pad out, may be null @param size the size to pad to @param padChar the character to pad with @return left padded String or original String if no padding is necessary, {@code null} if null String input @since 3.0
[ "<p", ">", "Left", "pad", "a", "String", "with", "a", "specified", "character", ".", "<", "/", "p", ">", "<p", ">", "Pad", "to", "a", "size", "of", "{", "@code", "size", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L522-L528
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/SerializeInterceptor.java
SerializeInterceptor.getMime
private String getMime(String name, String delimiter) { if (StringUtils.hasText(name)) { return name.substring(name.lastIndexOf(delimiter), name.length()); } return null; }
java
private String getMime(String name, String delimiter) { if (StringUtils.hasText(name)) { return name.substring(name.lastIndexOf(delimiter), name.length()); } return null; }
[ "private", "String", "getMime", "(", "String", "name", ",", "String", "delimiter", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "name", ")", ")", "{", "return", "name", ".", "substring", "(", "name", ".", "lastIndexOf", "(", "delimiter", ")",...
Method get the mime value from the given file name @param name the filename @param delimiter the delimiter @return String the mime value
[ "Method", "get", "the", "mime", "value", "from", "the", "given", "file", "name" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/SerializeInterceptor.java#L203-L208
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java
AbstractCachedGenerator.addLinkedResources
protected void addLinkedResources(String path, GeneratorContext context, FilePathMapping fMapping) { addLinkedResources(path, context, Arrays.asList(fMapping)); }
java
protected void addLinkedResources(String path, GeneratorContext context, FilePathMapping fMapping) { addLinkedResources(path, context, Arrays.asList(fMapping)); }
[ "protected", "void", "addLinkedResources", "(", "String", "path", ",", "GeneratorContext", "context", ",", "FilePathMapping", "fMapping", ")", "{", "addLinkedResources", "(", "path", ",", "context", ",", "Arrays", ".", "asList", "(", "fMapping", ")", ")", ";", ...
Adds the linked resource to the linked resource map @param path the resource path @param context the generator context @param fMapping the file path mapping linked to the resource
[ "Adds", "the", "linked", "resource", "to", "the", "linked", "resource", "map" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L361-L363
ykrasik/jaci
jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java
ReflectionUtils.assertReturnValue
public static void assertReturnValue(ReflectionMethod method, Class<?> expectedReturnType) { final Class<?> returnType = method.getReturnType(); if (returnType != expectedReturnType) { final String message = "Class='"+method.getDeclaringClass()+"', method='"+method.getName()+"': Must return a value of type '"+expectedReturnType+"'!"; throw new IllegalArgumentException(message); } }
java
public static void assertReturnValue(ReflectionMethod method, Class<?> expectedReturnType) { final Class<?> returnType = method.getReturnType(); if (returnType != expectedReturnType) { final String message = "Class='"+method.getDeclaringClass()+"', method='"+method.getName()+"': Must return a value of type '"+expectedReturnType+"'!"; throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "assertReturnValue", "(", "ReflectionMethod", "method", ",", "Class", "<", "?", ">", "expectedReturnType", ")", "{", "final", "Class", "<", "?", ">", "returnType", "=", "method", ".", "getReturnType", "(", ")", ";", "if", "(", "...
Assert that the given method returns the expected return type. @param method Method to assert. @param expectedReturnType Expected return type of the method. @throws IllegalArgumentException If the method's return type doesn't match the expected type.
[ "Assert", "that", "the", "given", "method", "returns", "the", "expected", "return", "type", "." ]
train
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java#L207-L213
samskivert/pythagoras
src/main/java/pythagoras/f/Crossing.java
Crossing.crossQuad
public static int crossQuad (float x1, float y1, float cx, float cy, float x2, float y2, float x, float y) { // LEFT/RIGHT/UP/EMPTY if ((x < x1 && x < cx && x < x2) || (x > x1 && x > cx && x > x2) || (y > y1 && y > cy && y > y2) || (x1 == cx && cx == x2)) { return 0; } // DOWN if (y < y1 && y < cy && y < y2 && x != x1 && x != x2) { if (x1 < x2) { return x1 < x && x < x2 ? 1 : 0; } return x2 < x && x < x1 ? -1 : 0; } // INSIDE QuadCurve c = new QuadCurve(x1, y1, cx, cy, x2, y2); float px = x - x1, py = y - y1; float[] res = new float[3]; int rc = c.solvePoint(res, px); return c.cross(res, rc, py, py); }
java
public static int crossQuad (float x1, float y1, float cx, float cy, float x2, float y2, float x, float y) { // LEFT/RIGHT/UP/EMPTY if ((x < x1 && x < cx && x < x2) || (x > x1 && x > cx && x > x2) || (y > y1 && y > cy && y > y2) || (x1 == cx && cx == x2)) { return 0; } // DOWN if (y < y1 && y < cy && y < y2 && x != x1 && x != x2) { if (x1 < x2) { return x1 < x && x < x2 ? 1 : 0; } return x2 < x && x < x1 ? -1 : 0; } // INSIDE QuadCurve c = new QuadCurve(x1, y1, cx, cy, x2, y2); float px = x - x1, py = y - y1; float[] res = new float[3]; int rc = c.solvePoint(res, px); return c.cross(res, rc, py, py); }
[ "public", "static", "int", "crossQuad", "(", "float", "x1", ",", "float", "y1", ",", "float", "cx", ",", "float", "cy", ",", "float", "x2", ",", "float", "y2", ",", "float", "x", ",", "float", "y", ")", "{", "// LEFT/RIGHT/UP/EMPTY", "if", "(", "(", ...
Returns how many times ray from point (x,y) cross quard curve
[ "Returns", "how", "many", "times", "ray", "from", "point", "(", "x", "y", ")", "cross", "quard", "curve" ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Crossing.java#L369-L391
OpenLiberty/open-liberty
dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java
JaxWsDDHelper.getPortComponentByServletLink
static PortComponent getPortComponentByServletLink(String servletLink, Adaptable containerToAdapt) throws UnableToAdaptException { return getHighLevelElementByServiceImplBean(servletLink, containerToAdapt, PortComponent.class, LinkType.SERVLET); }
java
static PortComponent getPortComponentByServletLink(String servletLink, Adaptable containerToAdapt) throws UnableToAdaptException { return getHighLevelElementByServiceImplBean(servletLink, containerToAdapt, PortComponent.class, LinkType.SERVLET); }
[ "static", "PortComponent", "getPortComponentByServletLink", "(", "String", "servletLink", ",", "Adaptable", "containerToAdapt", ")", "throws", "UnableToAdaptException", "{", "return", "getHighLevelElementByServiceImplBean", "(", "servletLink", ",", "containerToAdapt", ",", "P...
Get the PortComponent by servlet-link. @param servletLink @param containerToAdapt @return @throws UnableToAdaptException
[ "Get", "the", "PortComponent", "by", "servlet", "-", "link", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java#L56-L58
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java
DocBookXMLPreProcessor.createLinkWrapperElement
protected Element createLinkWrapperElement(final Document document, final Node node, final String cssClass) { // Create the bug/editor link root element final Element linkElement = document.createElement("para"); if (cssClass != null) { linkElement.setAttribute("role", cssClass); } node.appendChild(linkElement); return linkElement; }
java
protected Element createLinkWrapperElement(final Document document, final Node node, final String cssClass) { // Create the bug/editor link root element final Element linkElement = document.createElement("para"); if (cssClass != null) { linkElement.setAttribute("role", cssClass); } node.appendChild(linkElement); return linkElement; }
[ "protected", "Element", "createLinkWrapperElement", "(", "final", "Document", "document", ",", "final", "Node", "node", ",", "final", "String", "cssClass", ")", "{", "// Create the bug/editor link root element", "final", "Element", "linkElement", "=", "document", ".", ...
Creates the wrapper element for bug or editor links and adds it to the document. @param document The document to add the wrapper/link to. @param node The specific node the wrapper/link should be added to. @param cssClass The css class name to use for the wrapper. @return The wrapper element that links can be added to.
[ "Creates", "the", "wrapper", "element", "for", "bug", "or", "editor", "links", "and", "adds", "it", "to", "the", "document", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java#L227-L237
lucee/Lucee
core/src/main/java/lucee/commons/net/HTTPUtil.java
HTTPUtil.optimizeRealPath
public static String optimizeRealPath(PageContext pc, String realPath) { int index; String requestURI = realPath, queryString = null; if ((index = realPath.indexOf('?')) != -1) { requestURI = realPath.substring(0, index); queryString = realPath.substring(index + 1); } PageSource ps = PageSourceImpl.best(((PageContextImpl) pc).getRelativePageSources(requestURI)); requestURI = ps.getRealpathWithVirtual(); if (queryString != null) return requestURI + "?" + queryString; return requestURI; }
java
public static String optimizeRealPath(PageContext pc, String realPath) { int index; String requestURI = realPath, queryString = null; if ((index = realPath.indexOf('?')) != -1) { requestURI = realPath.substring(0, index); queryString = realPath.substring(index + 1); } PageSource ps = PageSourceImpl.best(((PageContextImpl) pc).getRelativePageSources(requestURI)); requestURI = ps.getRealpathWithVirtual(); if (queryString != null) return requestURI + "?" + queryString; return requestURI; }
[ "public", "static", "String", "optimizeRealPath", "(", "PageContext", "pc", ",", "String", "realPath", ")", "{", "int", "index", ";", "String", "requestURI", "=", "realPath", ",", "queryString", "=", "null", ";", "if", "(", "(", "index", "=", "realPath", "...
/* public static URL toURL(HttpMethod httpMethod) { HostConfiguration config = httpMethod.getHostConfiguration(); try { String qs = httpMethod.getQueryString(); if(StringUtil.isEmpty(qs)) return new URL(config.getProtocol().getScheme(),config.getHost(),config.getPort(),httpMethod.getPath()); return new URL(config.getProtocol().getScheme(),config.getHost(),config.getPort(),httpMethod.getPath()+"?"+ qs); } catch (MalformedURLException e) { return null; } }
[ "/", "*", "public", "static", "URL", "toURL", "(", "HttpMethod", "httpMethod", ")", "{", "HostConfiguration", "config", "=", "httpMethod", ".", "getHostConfiguration", "()", ";" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/net/HTTPUtil.java#L388-L399
devnied/Bit-lib4j
src/main/java/fr/devnied/bitlib/BytesUtils.java
BytesUtils.setBit
public static byte setBit(final byte pData, final int pBitIndex, final boolean pOn) { if (pBitIndex < 0 || pBitIndex > 7) { throw new IllegalArgumentException("parameter 'pBitIndex' must be between 0 and 7. pBitIndex=" + pBitIndex); } byte ret = pData; if (pOn) { // Set bit ret |= 1 << pBitIndex; } else { // Unset bit ret &= ~(1 << pBitIndex); } return ret; }
java
public static byte setBit(final byte pData, final int pBitIndex, final boolean pOn) { if (pBitIndex < 0 || pBitIndex > 7) { throw new IllegalArgumentException("parameter 'pBitIndex' must be between 0 and 7. pBitIndex=" + pBitIndex); } byte ret = pData; if (pOn) { // Set bit ret |= 1 << pBitIndex; } else { // Unset bit ret &= ~(1 << pBitIndex); } return ret; }
[ "public", "static", "byte", "setBit", "(", "final", "byte", "pData", ",", "final", "int", "pBitIndex", ",", "final", "boolean", "pOn", ")", "{", "if", "(", "pBitIndex", "<", "0", "||", "pBitIndex", ">", "7", ")", "{", "throw", "new", "IllegalArgumentExce...
Method used to set a bit index to 1 or 0. @param pData data to modify @param pBitIndex index to set @param pOn set bit at specified index to 1 or 0 @return the modified byte
[ "Method", "used", "to", "set", "a", "bit", "index", "to", "1", "or", "0", "." ]
train
https://github.com/devnied/Bit-lib4j/blob/bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0/src/main/java/fr/devnied/bitlib/BytesUtils.java#L265-L276
drewwills/cernunnos
cernunnos-core/src/main/java/org/danann/cernunnos/CurrentDirectoryUrlPhrase.java
CurrentDirectoryUrlPhrase.evaluate
public Object evaluate(TaskRequest req, TaskResponse res) { String rslt = null; try { rslt = new File(".").toURI().toURL().toExternalForm(); } catch (Throwable t) { String msg = "Unable to represent the current directory as a URL."; throw new RuntimeException(msg, t); } return rslt; }
java
public Object evaluate(TaskRequest req, TaskResponse res) { String rslt = null; try { rslt = new File(".").toURI().toURL().toExternalForm(); } catch (Throwable t) { String msg = "Unable to represent the current directory as a URL."; throw new RuntimeException(msg, t); } return rslt; }
[ "public", "Object", "evaluate", "(", "TaskRequest", "req", ",", "TaskResponse", "res", ")", "{", "String", "rslt", "=", "null", ";", "try", "{", "rslt", "=", "new", "File", "(", "\".\"", ")", ".", "toURI", "(", ")", ".", "toURL", "(", ")", ".", "to...
Always returns a <code>URL</code> representation of the filesystem directory from which Java is executing. @param req Representations the input to the current task. @param res Representations the output of the current task. @return The final, actual value of this <code>Phrase</code>.
[ "Always", "returns", "a", "<code", ">", "URL<", "/", "code", ">", "representation", "of", "the", "filesystem", "directory", "from", "which", "Java", "is", "executing", "." ]
train
https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/CurrentDirectoryUrlPhrase.java#L51-L60
GumTreeDiff/gumtree
core/src/main/java/com/github/gumtreediff/matchers/optimal/rted/RtedAlgorithm.java
RtedAlgorithm.spfR
private double spfR(InfoTree it1, InfoTree it2) { int fReversedPostorder = it1.getSize() - 1 - it1.info[POST2_PRE][it1.getCurrentNode()]; int gReversedPostorder = it2.getSize() - 1 - it2.info[POST2_PRE][it2.getCurrentNode()]; int minRKR = it2.info[RPOST2_MIN_RKR][gReversedPostorder]; int[] rkr = it2.info[RKR]; if (minRKR > -1) for (int j = minRKR; rkr[j] < gReversedPostorder; j++) treeEditDistRev(it1, it2, fReversedPostorder, rkr[j]); treeEditDistRev(it1, it2, fReversedPostorder, gReversedPostorder); return it1.isSwitched() ? delta[it2.getCurrentNode()][it1 .getCurrentNode()] + deltaBit[it2.getCurrentNode()][it1.getCurrentNode()] * costMatch : delta[it1.getCurrentNode()][it2.getCurrentNode()] + deltaBit[it1.getCurrentNode()][it2.getCurrentNode()] * costMatch; }
java
private double spfR(InfoTree it1, InfoTree it2) { int fReversedPostorder = it1.getSize() - 1 - it1.info[POST2_PRE][it1.getCurrentNode()]; int gReversedPostorder = it2.getSize() - 1 - it2.info[POST2_PRE][it2.getCurrentNode()]; int minRKR = it2.info[RPOST2_MIN_RKR][gReversedPostorder]; int[] rkr = it2.info[RKR]; if (minRKR > -1) for (int j = minRKR; rkr[j] < gReversedPostorder; j++) treeEditDistRev(it1, it2, fReversedPostorder, rkr[j]); treeEditDistRev(it1, it2, fReversedPostorder, gReversedPostorder); return it1.isSwitched() ? delta[it2.getCurrentNode()][it1 .getCurrentNode()] + deltaBit[it2.getCurrentNode()][it1.getCurrentNode()] * costMatch : delta[it1.getCurrentNode()][it2.getCurrentNode()] + deltaBit[it1.getCurrentNode()][it2.getCurrentNode()] * costMatch; }
[ "private", "double", "spfR", "(", "InfoTree", "it1", ",", "InfoTree", "it2", ")", "{", "int", "fReversedPostorder", "=", "it1", ".", "getSize", "(", ")", "-", "1", "-", "it1", ".", "info", "[", "POST2_PRE", "]", "[", "it1", ".", "getCurrentNode", "(", ...
Single-path function for right-most path based on symmetric version of Zhang and Shasha algorithm. @param it1 @param it2 @return distance between subtrees it1 and it2
[ "Single", "-", "path", "function", "for", "right", "-", "most", "path", "based", "on", "symmetric", "version", "of", "Zhang", "and", "Shasha", "algorithm", "." ]
train
https://github.com/GumTreeDiff/gumtree/blob/a772d4d652af44bff22c38a234ddffbfbd365a37/core/src/main/java/com/github/gumtreediff/matchers/optimal/rted/RtedAlgorithm.java#L494-L510
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/utils/HttpRequestUtils.java
HttpRequestUtils.getShortRequestDump
public static String getShortRequestDump(String fromMethod, boolean includeHeaders, HttpServletRequest request) { StringBuilder dump = new StringBuilder(); dump.append("Timestamp : ").append(ISO8601.getTimestamp()).append("\n"); dump.append("fromMethod : ").append(fromMethod).append("\n"); dump.append("Method : ").append(request.getMethod()).append('\n'); dump.append("Scheme : ").append(request.getScheme()).append('\n'); dump.append("URI : ").append(request.getRequestURI()).append('\n'); dump.append("Query-String : ").append(request.getQueryString()).append('\n'); dump.append("Auth-Type : ").append(request.getAuthType()).append('\n'); dump.append("Remote-Addr : ").append(request.getRemoteAddr()).append('\n'); dump.append("Scheme : ").append(request.getScheme()).append('\n'); dump.append("Content-Type : ").append(request.getContentType()).append('\n'); dump.append("Content-Length: ").append(request.getContentLength()).append('\n'); if (includeHeaders) { dump.append("Headers :\n"); Enumeration<String> headers = request.getHeaderNames(); while (headers.hasMoreElements()) { String header = headers.nextElement(); dump.append("\t").append(header).append(": ").append(request.getHeader(header)).append('\n'); } } return (dump.toString()); }
java
public static String getShortRequestDump(String fromMethod, boolean includeHeaders, HttpServletRequest request) { StringBuilder dump = new StringBuilder(); dump.append("Timestamp : ").append(ISO8601.getTimestamp()).append("\n"); dump.append("fromMethod : ").append(fromMethod).append("\n"); dump.append("Method : ").append(request.getMethod()).append('\n'); dump.append("Scheme : ").append(request.getScheme()).append('\n'); dump.append("URI : ").append(request.getRequestURI()).append('\n'); dump.append("Query-String : ").append(request.getQueryString()).append('\n'); dump.append("Auth-Type : ").append(request.getAuthType()).append('\n'); dump.append("Remote-Addr : ").append(request.getRemoteAddr()).append('\n'); dump.append("Scheme : ").append(request.getScheme()).append('\n'); dump.append("Content-Type : ").append(request.getContentType()).append('\n'); dump.append("Content-Length: ").append(request.getContentLength()).append('\n'); if (includeHeaders) { dump.append("Headers :\n"); Enumeration<String> headers = request.getHeaderNames(); while (headers.hasMoreElements()) { String header = headers.nextElement(); dump.append("\t").append(header).append(": ").append(request.getHeader(header)).append('\n'); } } return (dump.toString()); }
[ "public", "static", "String", "getShortRequestDump", "(", "String", "fromMethod", ",", "boolean", "includeHeaders", ",", "HttpServletRequest", "request", ")", "{", "StringBuilder", "dump", "=", "new", "StringBuilder", "(", ")", ";", "dump", ".", "append", "(", "...
Build a String containing a short multi-line dump of an HTTP request. @param fromMethod the method that this method was called from @param request the HTTP request build the request dump from @param includeHeaders if true will include the HTTP headers in the dump @return a String containing a short multi-line dump of the HTTP request
[ "Build", "a", "String", "containing", "a", "short", "multi", "-", "line", "dump", "of", "an", "HTTP", "request", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/utils/HttpRequestUtils.java#L32-L57
Alluxio/alluxio
core/server/proxy/src/main/java/alluxio/proxy/s3/S3RestServiceHandler.java
S3RestServiceHandler.completeMultipartUpload
private Response completeMultipartUpload(final String bucket, final String object, final long uploadId) { return S3RestUtils.call(bucket, new S3RestUtils.RestCallable<CompleteMultipartUploadResult>() { @Override public CompleteMultipartUploadResult call() throws S3Exception { String bucketPath = parseBucketPath(AlluxioURI.SEPARATOR + bucket); checkBucketIsAlluxioDirectory(bucketPath); String objectPath = bucketPath + AlluxioURI.SEPARATOR + object; AlluxioURI multipartTemporaryDir = new AlluxioURI(S3RestUtils.getMultipartTemporaryDirForObject(bucketPath, object)); checkUploadId(multipartTemporaryDir, uploadId); try { List<URIStatus> parts = mFileSystem.listStatus(multipartTemporaryDir); Collections.sort(parts, new URIStatusNameComparator()); CreateFilePOptions options = CreateFilePOptions.newBuilder().setRecursive(true) .setWriteType(getS3WriteType()).build(); FileOutStream os = mFileSystem.createFile(new AlluxioURI(objectPath), options); MessageDigest md5 = MessageDigest.getInstance("MD5"); DigestOutputStream digestOutputStream = new DigestOutputStream(os, md5); try { for (URIStatus part : parts) { try (FileInStream is = mFileSystem.openFile(new AlluxioURI(part.getPath()))) { ByteStreams.copy(is, digestOutputStream); } } } finally { digestOutputStream.close(); } mFileSystem.delete(multipartTemporaryDir, DeletePOptions.newBuilder().setRecursive(true).build()); String entityTag = Hex.encodeHexString(md5.digest()); return new CompleteMultipartUploadResult(objectPath, bucket, object, entityTag); } catch (Exception e) { throw toObjectS3Exception(e, objectPath); } } }); }
java
private Response completeMultipartUpload(final String bucket, final String object, final long uploadId) { return S3RestUtils.call(bucket, new S3RestUtils.RestCallable<CompleteMultipartUploadResult>() { @Override public CompleteMultipartUploadResult call() throws S3Exception { String bucketPath = parseBucketPath(AlluxioURI.SEPARATOR + bucket); checkBucketIsAlluxioDirectory(bucketPath); String objectPath = bucketPath + AlluxioURI.SEPARATOR + object; AlluxioURI multipartTemporaryDir = new AlluxioURI(S3RestUtils.getMultipartTemporaryDirForObject(bucketPath, object)); checkUploadId(multipartTemporaryDir, uploadId); try { List<URIStatus> parts = mFileSystem.listStatus(multipartTemporaryDir); Collections.sort(parts, new URIStatusNameComparator()); CreateFilePOptions options = CreateFilePOptions.newBuilder().setRecursive(true) .setWriteType(getS3WriteType()).build(); FileOutStream os = mFileSystem.createFile(new AlluxioURI(objectPath), options); MessageDigest md5 = MessageDigest.getInstance("MD5"); DigestOutputStream digestOutputStream = new DigestOutputStream(os, md5); try { for (URIStatus part : parts) { try (FileInStream is = mFileSystem.openFile(new AlluxioURI(part.getPath()))) { ByteStreams.copy(is, digestOutputStream); } } } finally { digestOutputStream.close(); } mFileSystem.delete(multipartTemporaryDir, DeletePOptions.newBuilder().setRecursive(true).build()); String entityTag = Hex.encodeHexString(md5.digest()); return new CompleteMultipartUploadResult(objectPath, bucket, object, entityTag); } catch (Exception e) { throw toObjectS3Exception(e, objectPath); } } }); }
[ "private", "Response", "completeMultipartUpload", "(", "final", "String", "bucket", ",", "final", "String", "object", ",", "final", "long", "uploadId", ")", "{", "return", "S3RestUtils", ".", "call", "(", "bucket", ",", "new", "S3RestUtils", ".", "RestCallable",...
under the temporary multipart upload directory are combined into the final object.
[ "under", "the", "temporary", "multipart", "upload", "directory", "are", "combined", "into", "the", "final", "object", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/proxy/src/main/java/alluxio/proxy/s3/S3RestServiceHandler.java#L330-L372
apache/groovy
src/main/groovy/groovy/lang/ProxyMetaClass.java
ProxyMetaClass.invokeMethod
@Override public Object invokeMethod(final Class sender, final Object object, final String methodName, final Object[] arguments, final boolean isCallToSuper, final boolean fromInsideClass) { return doCall(object, methodName, arguments, interceptor, new Callable() { public Object call() { return adaptee.invokeMethod(sender, object, methodName, arguments, isCallToSuper, fromInsideClass); } }); }
java
@Override public Object invokeMethod(final Class sender, final Object object, final String methodName, final Object[] arguments, final boolean isCallToSuper, final boolean fromInsideClass) { return doCall(object, methodName, arguments, interceptor, new Callable() { public Object call() { return adaptee.invokeMethod(sender, object, methodName, arguments, isCallToSuper, fromInsideClass); } }); }
[ "@", "Override", "public", "Object", "invokeMethod", "(", "final", "Class", "sender", ",", "final", "Object", "object", ",", "final", "String", "methodName", ",", "final", "Object", "[", "]", "arguments", ",", "final", "boolean", "isCallToSuper", ",", "final",...
Call invokeMethod on adaptee with logic like in MetaClass unless we have an Interceptor. With Interceptor the call is nested in its beforeInvoke and afterInvoke methods. The method call is suppressed if Interceptor.doInvoke() returns false. See Interceptor for details.
[ "Call", "invokeMethod", "on", "adaptee", "with", "logic", "like", "in", "MetaClass", "unless", "we", "have", "an", "Interceptor", ".", "With", "Interceptor", "the", "call", "is", "nested", "in", "its", "beforeInvoke", "and", "afterInvoke", "methods", ".", "The...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/ProxyMetaClass.java#L131-L138
JavaMoney/jsr354-ri
moneta-core/src/main/java/org/javamoney/moneta/spi/MoneyUtils.java
MoneyUtils.getMathContext
public static MathContext getMathContext(MonetaryContext monetaryContext, RoundingMode defaultMode) { MathContext ctx = monetaryContext.get(MathContext.class); if (Objects.nonNull(ctx)) { return ctx; } RoundingMode roundingMode = monetaryContext.get(RoundingMode.class); if (roundingMode == null) { roundingMode = Optional.ofNullable(defaultMode).orElse(HALF_EVEN); } return new MathContext(monetaryContext.getPrecision(), roundingMode); }
java
public static MathContext getMathContext(MonetaryContext monetaryContext, RoundingMode defaultMode) { MathContext ctx = monetaryContext.get(MathContext.class); if (Objects.nonNull(ctx)) { return ctx; } RoundingMode roundingMode = monetaryContext.get(RoundingMode.class); if (roundingMode == null) { roundingMode = Optional.ofNullable(defaultMode).orElse(HALF_EVEN); } return new MathContext(monetaryContext.getPrecision(), roundingMode); }
[ "public", "static", "MathContext", "getMathContext", "(", "MonetaryContext", "monetaryContext", ",", "RoundingMode", "defaultMode", ")", "{", "MathContext", "ctx", "=", "monetaryContext", ".", "get", "(", "MathContext", ".", "class", ")", ";", "if", "(", "Objects"...
Evaluates the {@link MathContext} from the given {@link MonetaryContext}. @param monetaryContext the {@link MonetaryContext} @param defaultMode the default {@link RoundingMode}, to be used if no one is set in {@link MonetaryContext}. @return the corresponding {@link MathContext}
[ "Evaluates", "the", "{", "@link", "MathContext", "}", "from", "the", "given", "{", "@link", "MonetaryContext", "}", "." ]
train
https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-core/src/main/java/org/javamoney/moneta/spi/MoneyUtils.java#L127-L137
bushidowallet/bushido-java-service
bushido-service-lib/src/main/java/com/bccapi/bitlib/crypto/PublicKeyRing.java
PublicKeyRing.addPublicKey
public void addPublicKey(PublicKey key, NetworkParameters network) { Address address = Address.fromStandardPublicKey(key, network); _addresses.add(address); _addressSet.add(address); _publicKeys.put(address, key); }
java
public void addPublicKey(PublicKey key, NetworkParameters network) { Address address = Address.fromStandardPublicKey(key, network); _addresses.add(address); _addressSet.add(address); _publicKeys.put(address, key); }
[ "public", "void", "addPublicKey", "(", "PublicKey", "key", ",", "NetworkParameters", "network", ")", "{", "Address", "address", "=", "Address", ".", "fromStandardPublicKey", "(", "key", ",", "network", ")", ";", "_addresses", ".", "add", "(", "address", ")", ...
Add a public key to the key ring. @param key public key @param network Bitcoin network to talk to
[ "Add", "a", "public", "key", "to", "the", "key", "ring", "." ]
train
https://github.com/bushidowallet/bushido-java-service/blob/e1a0157527e57459b509718044d2df44084876a2/bushido-service-lib/src/main/java/com/bccapi/bitlib/crypto/PublicKeyRing.java#L25-L30
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java
DateUtil.ceiling
public static DateTime ceiling(Date date, DateField dateField) { return new DateTime(ceiling(calendar(date), dateField)); }
java
public static DateTime ceiling(Date date, DateField dateField) { return new DateTime(ceiling(calendar(date), dateField)); }
[ "public", "static", "DateTime", "ceiling", "(", "Date", "date", ",", "DateField", "dateField", ")", "{", "return", "new", "DateTime", "(", "ceiling", "(", "calendar", "(", "date", ")", ",", "dateField", ")", ")", ";", "}" ]
修改日期为某个时间字段结束时间 @param date {@link Date} @param dateField 时间字段 @return {@link DateTime} @since 4.5.7
[ "修改日期为某个时间字段结束时间" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L803-L805
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.java
ArchiveAnalyzer.extractAndAnalyze
private void extractAndAnalyze(Dependency dependency, Engine engine, int scanDepth) throws AnalysisException { final File f = new File(dependency.getActualFilePath()); final File tmpDir = getNextTempDirectory(); extractFiles(f, tmpDir, engine); //make a copy final List<Dependency> dependencySet = findMoreDependencies(engine, tmpDir); if (dependencySet != null && !dependencySet.isEmpty()) { for (Dependency d : dependencySet) { if (d.getFilePath().startsWith(tmpDir.getAbsolutePath())) { //fix the dependency's display name and path final String displayPath = String.format("%s%s", dependency.getFilePath(), d.getActualFilePath().substring(tmpDir.getAbsolutePath().length())); final String displayName = String.format("%s: %s", dependency.getFileName(), d.getFileName()); d.setFilePath(displayPath); d.setFileName(displayName); d.addAllProjectReferences(dependency.getProjectReferences()); //TODO - can we get more evidence from the parent? EAR contains module name, etc. //analyze the dependency (i.e. extract files) if it is a supported type. if (this.accept(d.getActualFile()) && scanDepth < maxScanDepth) { extractAndAnalyze(d, engine, scanDepth + 1); } } else { dependencySet.stream().filter((sub) -> sub.getFilePath().startsWith(tmpDir.getAbsolutePath())).forEach((sub) -> { final String displayPath = String.format("%s%s", dependency.getFilePath(), sub.getActualFilePath().substring(tmpDir.getAbsolutePath().length())); final String displayName = String.format("%s: %s", dependency.getFileName(), sub.getFileName()); sub.setFilePath(displayPath); sub.setFileName(displayName); }); } } }
java
private void extractAndAnalyze(Dependency dependency, Engine engine, int scanDepth) throws AnalysisException { final File f = new File(dependency.getActualFilePath()); final File tmpDir = getNextTempDirectory(); extractFiles(f, tmpDir, engine); //make a copy final List<Dependency> dependencySet = findMoreDependencies(engine, tmpDir); if (dependencySet != null && !dependencySet.isEmpty()) { for (Dependency d : dependencySet) { if (d.getFilePath().startsWith(tmpDir.getAbsolutePath())) { //fix the dependency's display name and path final String displayPath = String.format("%s%s", dependency.getFilePath(), d.getActualFilePath().substring(tmpDir.getAbsolutePath().length())); final String displayName = String.format("%s: %s", dependency.getFileName(), d.getFileName()); d.setFilePath(displayPath); d.setFileName(displayName); d.addAllProjectReferences(dependency.getProjectReferences()); //TODO - can we get more evidence from the parent? EAR contains module name, etc. //analyze the dependency (i.e. extract files) if it is a supported type. if (this.accept(d.getActualFile()) && scanDepth < maxScanDepth) { extractAndAnalyze(d, engine, scanDepth + 1); } } else { dependencySet.stream().filter((sub) -> sub.getFilePath().startsWith(tmpDir.getAbsolutePath())).forEach((sub) -> { final String displayPath = String.format("%s%s", dependency.getFilePath(), sub.getActualFilePath().substring(tmpDir.getAbsolutePath().length())); final String displayName = String.format("%s: %s", dependency.getFileName(), sub.getFileName()); sub.setFilePath(displayPath); sub.setFileName(displayName); }); } } }
[ "private", "void", "extractAndAnalyze", "(", "Dependency", "dependency", ",", "Engine", "engine", ",", "int", "scanDepth", ")", "throws", "AnalysisException", "{", "final", "File", "f", "=", "new", "File", "(", "dependency", ".", "getActualFilePath", "(", ")", ...
Extracts the contents of the archive dependency and scans for additional dependencies. @param dependency the dependency being analyzed @param engine the engine doing the analysis @param scanDepth the current scan depth; extracctAndAnalyze is recursive and will, be default, only go 3 levels deep @throws AnalysisException thrown if there is a problem analyzing the dependencies
[ "Extracts", "the", "contents", "of", "the", "archive", "dependency", "and", "scans", "for", "additional", "dependencies", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.java#L248-L288
Alluxio/alluxio
core/common/src/main/java/alluxio/util/io/FileUtils.java
FileUtils.changeLocalFileGroup
public static void changeLocalFileGroup(String path, String group) throws IOException { UserPrincipalLookupService lookupService = FileSystems.getDefault().getUserPrincipalLookupService(); PosixFileAttributeView view = Files.getFileAttributeView(Paths.get(path), PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS); GroupPrincipal groupPrincipal = lookupService.lookupPrincipalByGroupName(group); view.setGroup(groupPrincipal); }
java
public static void changeLocalFileGroup(String path, String group) throws IOException { UserPrincipalLookupService lookupService = FileSystems.getDefault().getUserPrincipalLookupService(); PosixFileAttributeView view = Files.getFileAttributeView(Paths.get(path), PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS); GroupPrincipal groupPrincipal = lookupService.lookupPrincipalByGroupName(group); view.setGroup(groupPrincipal); }
[ "public", "static", "void", "changeLocalFileGroup", "(", "String", "path", ",", "String", "group", ")", "throws", "IOException", "{", "UserPrincipalLookupService", "lookupService", "=", "FileSystems", ".", "getDefault", "(", ")", ".", "getUserPrincipalLookupService", ...
Changes the local file's group. @param path that will change owner @param group the new group
[ "Changes", "the", "local", "file", "s", "group", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/FileUtils.java#L57-L65
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java
UnicodeSet.applyPropertyAlias
public UnicodeSet applyPropertyAlias(String propertyAlias, String valueAlias) { return applyPropertyAlias(propertyAlias, valueAlias, null); }
java
public UnicodeSet applyPropertyAlias(String propertyAlias, String valueAlias) { return applyPropertyAlias(propertyAlias, valueAlias, null); }
[ "public", "UnicodeSet", "applyPropertyAlias", "(", "String", "propertyAlias", ",", "String", "valueAlias", ")", "{", "return", "applyPropertyAlias", "(", "propertyAlias", ",", "valueAlias", ",", "null", ")", ";", "}" ]
Modifies this set to contain those code points which have the given value for the given property. Prior contents of this set are lost. @param propertyAlias a property alias, either short or long. The name is matched loosely. See PropertyAliases.txt for names and a description of loose matching. If the value string is empty, then this string is interpreted as either a General_Category value alias, a Script value alias, a binary property alias, or a special ID. Special IDs are matched loosely and correspond to the following sets: "ANY" = [\\u0000-\\u0010FFFF], "ASCII" = [\\u0000-\\u007F]. @param valueAlias a value alias, either short or long. The name is matched loosely. See PropertyValueAliases.txt for names and a description of loose matching. In addition to aliases listed, numeric values and canonical combining classes may be expressed numerically, e.g., ("nv", "0.5") or ("ccc", "220"). The value string may also be empty. @return a reference to this set
[ "Modifies", "this", "set", "to", "contain", "those", "code", "points", "which", "have", "the", "given", "value", "for", "the", "given", "property", ".", "Prior", "contents", "of", "this", "set", "are", "lost", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L3349-L3351
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java
RelativeDateTimeFormatter.formatNumeric
public String formatNumeric(double offset, RelativeDateTimeUnit unit) { // TODO: // The full implementation of this depends on CLDR data that is not yet available, // see: http://unicode.org/cldr/trac/ticket/9165 Add more relative field data. // In the meantime do a quick bring-up by calling the old format method. When the // new CLDR data is available, update the data storage accordingly, rewrite this // to use it directly, and rewrite the old format method to call this new one; // that is covered by http://bugs.icu-project.org/trac/ticket/12171. RelativeUnit relunit = RelativeUnit.SECONDS; switch (unit) { case YEAR: relunit = RelativeUnit.YEARS; break; case QUARTER: relunit = RelativeUnit.QUARTERS; break; case MONTH: relunit = RelativeUnit.MONTHS; break; case WEEK: relunit = RelativeUnit.WEEKS; break; case DAY: relunit = RelativeUnit.DAYS; break; case HOUR: relunit = RelativeUnit.HOURS; break; case MINUTE: relunit = RelativeUnit.MINUTES; break; case SECOND: break; // set above default: // SUNDAY..SATURDAY throw new UnsupportedOperationException("formatNumeric does not currently support RelativeUnit.SUNDAY..SATURDAY"); } Direction direction = Direction.NEXT; if (offset < 0) { direction = Direction.LAST; offset = -offset; } String result = format(offset, direction, relunit); return (result != null)? result: ""; }
java
public String formatNumeric(double offset, RelativeDateTimeUnit unit) { // TODO: // The full implementation of this depends on CLDR data that is not yet available, // see: http://unicode.org/cldr/trac/ticket/9165 Add more relative field data. // In the meantime do a quick bring-up by calling the old format method. When the // new CLDR data is available, update the data storage accordingly, rewrite this // to use it directly, and rewrite the old format method to call this new one; // that is covered by http://bugs.icu-project.org/trac/ticket/12171. RelativeUnit relunit = RelativeUnit.SECONDS; switch (unit) { case YEAR: relunit = RelativeUnit.YEARS; break; case QUARTER: relunit = RelativeUnit.QUARTERS; break; case MONTH: relunit = RelativeUnit.MONTHS; break; case WEEK: relunit = RelativeUnit.WEEKS; break; case DAY: relunit = RelativeUnit.DAYS; break; case HOUR: relunit = RelativeUnit.HOURS; break; case MINUTE: relunit = RelativeUnit.MINUTES; break; case SECOND: break; // set above default: // SUNDAY..SATURDAY throw new UnsupportedOperationException("formatNumeric does not currently support RelativeUnit.SUNDAY..SATURDAY"); } Direction direction = Direction.NEXT; if (offset < 0) { direction = Direction.LAST; offset = -offset; } String result = format(offset, direction, relunit); return (result != null)? result: ""; }
[ "public", "String", "formatNumeric", "(", "double", "offset", ",", "RelativeDateTimeUnit", "unit", ")", "{", "// TODO:", "// The full implementation of this depends on CLDR data that is not yet available,", "// see: http://unicode.org/cldr/trac/ticket/9165 Add more relative field data.", ...
Format a combination of RelativeDateTimeUnit and numeric offset using a numeric style, e.g. "1 week ago", "in 1 week", "5 weeks ago", "in 5 weeks". @param offset The signed offset for the specified unit. This will be formatted according to this object's NumberFormat object. @param unit The unit to use when formatting the relative date, e.g. RelativeDateTimeUnit.WEEK, RelativeDateTimeUnit.FRIDAY. @return The formatted string (may be empty in case of error) @hide draft / provisional / internal are hidden on Android
[ "Format", "a", "combination", "of", "RelativeDateTimeUnit", "and", "numeric", "offset", "using", "a", "numeric", "style", "e", ".", "g", ".", "1", "week", "ago", "in", "1", "week", "5", "weeks", "ago", "in", "5", "weeks", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java#L493-L521
Netflix/netflix-commons
netflix-infix/src/main/java/com/netflix/infix/lang/infix/antlr/EqualityComparisonBaseTreeNode.java
EqualityComparisonBaseTreeNode.getEqualFilter
protected Predicate<Object> getEqualFilter() { String xpath = getXPath(getChild(0)); Tree valueNode = getChild(1); switch(valueNode.getType()){ case NUMBER: Number value = (Number)((ValueTreeNode)valueNode).getValue(); return new PathValueEventFilter(xpath, new NumericValuePredicate(value, "=")); case STRING: String sValue = (String)((ValueTreeNode)valueNode).getValue(); return new PathValueEventFilter(xpath, new StringValuePredicate(sValue)); case TRUE: return new PathValueEventFilter(xpath, BooleanValuePredicate.TRUE); case FALSE: return new PathValueEventFilter(xpath, BooleanValuePredicate.FALSE); case NULL: return new PathValueEventFilter(xpath, NullValuePredicate.INSTANCE); case XPATH_FUN_NAME: String aPath = (String)((ValueTreeNode)valueNode).getValue(); return new PathValueEventFilter(xpath, new XPathValuePredicate(aPath, xpath)); case TIME_MILLIS_FUN_NAME: TimeMillisValueTreeNode timeNode = (TimeMillisValueTreeNode)valueNode; return new PathValueEventFilter(xpath, new TimeMillisValuePredicate( timeNode.getValueFormat(), timeNode.getValue(), "=")); case TIME_STRING_FUN_NAME: TimeStringValueTreeNode timeStringNode = (TimeStringValueTreeNode)valueNode; return new PathValueEventFilter(xpath, new TimeStringValuePredicate( timeStringNode.getValueTimeFormat(), timeStringNode.getInputTimeFormat(), timeStringNode.getValue(), "=")); default: throw new UnexpectedTokenException(valueNode, "Number", "String", "TRUE", "FALSE"); } }
java
protected Predicate<Object> getEqualFilter() { String xpath = getXPath(getChild(0)); Tree valueNode = getChild(1); switch(valueNode.getType()){ case NUMBER: Number value = (Number)((ValueTreeNode)valueNode).getValue(); return new PathValueEventFilter(xpath, new NumericValuePredicate(value, "=")); case STRING: String sValue = (String)((ValueTreeNode)valueNode).getValue(); return new PathValueEventFilter(xpath, new StringValuePredicate(sValue)); case TRUE: return new PathValueEventFilter(xpath, BooleanValuePredicate.TRUE); case FALSE: return new PathValueEventFilter(xpath, BooleanValuePredicate.FALSE); case NULL: return new PathValueEventFilter(xpath, NullValuePredicate.INSTANCE); case XPATH_FUN_NAME: String aPath = (String)((ValueTreeNode)valueNode).getValue(); return new PathValueEventFilter(xpath, new XPathValuePredicate(aPath, xpath)); case TIME_MILLIS_FUN_NAME: TimeMillisValueTreeNode timeNode = (TimeMillisValueTreeNode)valueNode; return new PathValueEventFilter(xpath, new TimeMillisValuePredicate( timeNode.getValueFormat(), timeNode.getValue(), "=")); case TIME_STRING_FUN_NAME: TimeStringValueTreeNode timeStringNode = (TimeStringValueTreeNode)valueNode; return new PathValueEventFilter(xpath, new TimeStringValuePredicate( timeStringNode.getValueTimeFormat(), timeStringNode.getInputTimeFormat(), timeStringNode.getValue(), "=")); default: throw new UnexpectedTokenException(valueNode, "Number", "String", "TRUE", "FALSE"); } }
[ "protected", "Predicate", "<", "Object", ">", "getEqualFilter", "(", ")", "{", "String", "xpath", "=", "getXPath", "(", "getChild", "(", "0", ")", ")", ";", "Tree", "valueNode", "=", "getChild", "(", "1", ")", ";", "switch", "(", "valueNode", ".", "get...
but I can't get ANTLR to generated nested tree with added node.
[ "but", "I", "can", "t", "get", "ANTLR", "to", "generated", "nested", "tree", "with", "added", "node", "." ]
train
https://github.com/Netflix/netflix-commons/blob/7a158af76906d4a9b753e9344ce3e7abeb91dc01/netflix-infix/src/main/java/com/netflix/infix/lang/infix/antlr/EqualityComparisonBaseTreeNode.java#L24-L63
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java
StyleUtils.setFeatureStyle
public static boolean setFeatureStyle(MarkerOptions markerOptions, FeatureStyle featureStyle, float density, IconCache iconCache) { boolean featureStyleSet = false; if (featureStyle != null) { featureStyleSet = setIcon(markerOptions, featureStyle.getIcon(), density, iconCache); if (!featureStyleSet) { featureStyleSet = setStyle(markerOptions, featureStyle.getStyle()); } } return featureStyleSet; }
java
public static boolean setFeatureStyle(MarkerOptions markerOptions, FeatureStyle featureStyle, float density, IconCache iconCache) { boolean featureStyleSet = false; if (featureStyle != null) { featureStyleSet = setIcon(markerOptions, featureStyle.getIcon(), density, iconCache); if (!featureStyleSet) { featureStyleSet = setStyle(markerOptions, featureStyle.getStyle()); } } return featureStyleSet; }
[ "public", "static", "boolean", "setFeatureStyle", "(", "MarkerOptions", "markerOptions", ",", "FeatureStyle", "featureStyle", ",", "float", "density", ",", "IconCache", "iconCache", ")", "{", "boolean", "featureStyleSet", "=", "false", ";", "if", "(", "featureStyle"...
Set the feature style (icon or style) into the marker options @param markerOptions marker options @param featureStyle feature style @param density display density: {@link android.util.DisplayMetrics#density} @param iconCache icon cache @return true if icon or style was set into the marker options
[ "Set", "the", "feature", "style", "(", "icon", "or", "style", ")", "into", "the", "marker", "options" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L197-L214
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/ImagesInner.java
ImagesInner.beginUpdate
public ImageInner beginUpdate(String resourceGroupName, String imageName, ImageUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters).toBlocking().single().body(); }
java
public ImageInner beginUpdate(String resourceGroupName, String imageName, ImageUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters).toBlocking().single().body(); }
[ "public", "ImageInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "imageName", ",", "ImageUpdate", "parameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "imageName", ",", "parameters", ")", ".", ...
Update an image. @param resourceGroupName The name of the resource group. @param imageName The name of the image. @param parameters Parameters supplied to the Update Image operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ImageInner object if successful.
[ "Update", "an", "image", "." ]
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/ImagesInner.java#L375-L377
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/approval/TokenApprovalStore.java
TokenApprovalStore.getApprovals
@Override public Collection<Approval> getApprovals(String userId, String clientId) { Collection<Approval> result = new HashSet<Approval>(); Collection<OAuth2AccessToken> tokens = store.findTokensByClientIdAndUserName(clientId, userId); for (OAuth2AccessToken token : tokens) { OAuth2Authentication authentication = store.readAuthentication(token); if (authentication != null) { Date expiresAt = token.getExpiration(); for (String scope : token.getScope()) { result.add(new Approval(userId, clientId, scope, expiresAt, ApprovalStatus.APPROVED)); } } } return result; }
java
@Override public Collection<Approval> getApprovals(String userId, String clientId) { Collection<Approval> result = new HashSet<Approval>(); Collection<OAuth2AccessToken> tokens = store.findTokensByClientIdAndUserName(clientId, userId); for (OAuth2AccessToken token : tokens) { OAuth2Authentication authentication = store.readAuthentication(token); if (authentication != null) { Date expiresAt = token.getExpiration(); for (String scope : token.getScope()) { result.add(new Approval(userId, clientId, scope, expiresAt, ApprovalStatus.APPROVED)); } } } return result; }
[ "@", "Override", "public", "Collection", "<", "Approval", ">", "getApprovals", "(", "String", "userId", ",", "String", "clientId", ")", "{", "Collection", "<", "Approval", ">", "result", "=", "new", "HashSet", "<", "Approval", ">", "(", ")", ";", "Collecti...
Extract the implied approvals from any tokens associated with the user and client id supplied. @see org.springframework.security.oauth2.provider.approval.ApprovalStore#getApprovals(java.lang.String, java.lang.String)
[ "Extract", "the", "implied", "approvals", "from", "any", "tokens", "associated", "with", "the", "user", "and", "client", "id", "supplied", "." ]
train
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/approval/TokenApprovalStore.java#L88-L102
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.listPrebuiltEntitiesAsync
public Observable<List<AvailablePrebuiltEntityModel>> listPrebuiltEntitiesAsync(UUID appId, String versionId) { return listPrebuiltEntitiesWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<List<AvailablePrebuiltEntityModel>>, List<AvailablePrebuiltEntityModel>>() { @Override public List<AvailablePrebuiltEntityModel> call(ServiceResponse<List<AvailablePrebuiltEntityModel>> response) { return response.body(); } }); }
java
public Observable<List<AvailablePrebuiltEntityModel>> listPrebuiltEntitiesAsync(UUID appId, String versionId) { return listPrebuiltEntitiesWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<List<AvailablePrebuiltEntityModel>>, List<AvailablePrebuiltEntityModel>>() { @Override public List<AvailablePrebuiltEntityModel> call(ServiceResponse<List<AvailablePrebuiltEntityModel>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "AvailablePrebuiltEntityModel", ">", ">", "listPrebuiltEntitiesAsync", "(", "UUID", "appId", ",", "String", "versionId", ")", "{", "return", "listPrebuiltEntitiesWithServiceResponseAsync", "(", "appId", ",", "versionId", ")", ...
Gets all the available prebuilt entity extractors for the application. @param appId The application ID. @param versionId The version ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;AvailablePrebuiltEntityModel&gt; object
[ "Gets", "all", "the", "available", "prebuilt", "entity", "extractors", "for", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L2384-L2391
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java
MathBindings.addExact
public static IntegerBinding addExact(final ObservableIntegerValue x, final ObservableIntegerValue y) { return createIntegerBinding(() -> Math.addExact(x.get(), y.get()), x, y); }
java
public static IntegerBinding addExact(final ObservableIntegerValue x, final ObservableIntegerValue y) { return createIntegerBinding(() -> Math.addExact(x.get(), y.get()), x, y); }
[ "public", "static", "IntegerBinding", "addExact", "(", "final", "ObservableIntegerValue", "x", ",", "final", "ObservableIntegerValue", "y", ")", "{", "return", "createIntegerBinding", "(", "(", ")", "->", "Math", ".", "addExact", "(", "x", ".", "get", "(", ")"...
Binding for {@link java.lang.Math#addExact(int, int)} @param x the first value @param y the second value @return the result @throws ArithmeticException if the result overflows an int
[ "Binding", "for", "{", "@link", "java", ".", "lang", ".", "Math#addExact", "(", "int", "int", ")", "}" ]
train
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java#L92-L94
BlueBrain/bluima
modules/bluima_scripting/src/main/java/ch/epfl/bbp/uima/laucher/PipelineScriptParser.java
PipelineScriptParser.parseJava
private static void parseJava(IteratorWithPrevious<String> it, Pipeline pipeline) throws ParseException { String script = ""; while (it.hasNext()) { String current = it.next(); if (isBlank(current)) break; script += current + "\n"; } if (script.length() < 3) throw new ParseException("empty script", -1); try { pipeline.aeds.add(createEngineDescription(BeanshellAnnotator.class, SCRIPT_STRING, script)); } catch (ResourceInitializationException e) { throw new ParseException("could not create aed with script " + script, -1); } }
java
private static void parseJava(IteratorWithPrevious<String> it, Pipeline pipeline) throws ParseException { String script = ""; while (it.hasNext()) { String current = it.next(); if (isBlank(current)) break; script += current + "\n"; } if (script.length() < 3) throw new ParseException("empty script", -1); try { pipeline.aeds.add(createEngineDescription(BeanshellAnnotator.class, SCRIPT_STRING, script)); } catch (ResourceInitializationException e) { throw new ParseException("could not create aed with script " + script, -1); } }
[ "private", "static", "void", "parseJava", "(", "IteratorWithPrevious", "<", "String", ">", "it", ",", "Pipeline", "pipeline", ")", "throws", "ParseException", "{", "String", "script", "=", "\"\"", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{"...
Parses inline, raw java code and executes it with Beanshell @return
[ "Parses", "inline", "raw", "java", "code", "and", "executes", "it", "with", "Beanshell" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_scripting/src/main/java/ch/epfl/bbp/uima/laucher/PipelineScriptParser.java#L240-L260
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageHandler.java
CmsContainerpageHandler.decorateMenuEntry
protected void decorateMenuEntry(CmsContextMenuEntry entry, String name, boolean checked) { CmsContextMenuEntryBean bean = new CmsContextMenuEntryBean(); bean.setLabel(name); bean.setActive(true); bean.setVisible(true); I_CmsInputCss inputCss = I_CmsInputLayoutBundle.INSTANCE.inputCss(); bean.setIconClass(checked ? inputCss.checkBoxImageChecked() : ""); entry.setBean(bean); }
java
protected void decorateMenuEntry(CmsContextMenuEntry entry, String name, boolean checked) { CmsContextMenuEntryBean bean = new CmsContextMenuEntryBean(); bean.setLabel(name); bean.setActive(true); bean.setVisible(true); I_CmsInputCss inputCss = I_CmsInputLayoutBundle.INSTANCE.inputCss(); bean.setIconClass(checked ? inputCss.checkBoxImageChecked() : ""); entry.setBean(bean); }
[ "protected", "void", "decorateMenuEntry", "(", "CmsContextMenuEntry", "entry", ",", "String", "name", ",", "boolean", "checked", ")", "{", "CmsContextMenuEntryBean", "bean", "=", "new", "CmsContextMenuEntryBean", "(", ")", ";", "bean", ".", "setLabel", "(", "name"...
Fills in label and checkbox of a menu entry.<p> @param entry the menu entry @param name the label @param checked true if checkbox should be shown
[ "Fills", "in", "label", "and", "checkbox", "of", "a", "menu", "entry", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageHandler.java#L1496-L1505
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java
ClassPathBuilder.addToWorkList
private void addToWorkList(LinkedList<WorkListItem> workList, WorkListItem itemToAdd) { if (DEBUG) { new RuntimeException("Adding work list item " + itemToAdd).printStackTrace(System.out); } if (!itemToAdd.isAppCodeBase()) { // Auxiliary codebases are always added at the end workList.addLast(itemToAdd); return; } // Adding an application codebase: position a ListIterator // just before first auxiliary codebase (or at the end of the list // if there are no auxiliary codebases) ListIterator<WorkListItem> i = workList.listIterator(); while (i.hasNext()) { WorkListItem listItem = i.next(); if (!listItem.isAppCodeBase()) { i.previous(); break; } } // Add the codebase to the worklist i.add(itemToAdd); }
java
private void addToWorkList(LinkedList<WorkListItem> workList, WorkListItem itemToAdd) { if (DEBUG) { new RuntimeException("Adding work list item " + itemToAdd).printStackTrace(System.out); } if (!itemToAdd.isAppCodeBase()) { // Auxiliary codebases are always added at the end workList.addLast(itemToAdd); return; } // Adding an application codebase: position a ListIterator // just before first auxiliary codebase (or at the end of the list // if there are no auxiliary codebases) ListIterator<WorkListItem> i = workList.listIterator(); while (i.hasNext()) { WorkListItem listItem = i.next(); if (!listItem.isAppCodeBase()) { i.previous(); break; } } // Add the codebase to the worklist i.add(itemToAdd); }
[ "private", "void", "addToWorkList", "(", "LinkedList", "<", "WorkListItem", ">", "workList", ",", "WorkListItem", "itemToAdd", ")", "{", "if", "(", "DEBUG", ")", "{", "new", "RuntimeException", "(", "\"Adding work list item \"", "+", "itemToAdd", ")", ".", "prin...
Add a worklist item to the worklist. This method maintains the invariant that all of the worklist items representing application codebases appear <em>before</em> all of the worklist items representing auxiliary codebases. @param projectWorkList the worklist @param itemToAdd the worklist item to add
[ "Add", "a", "worklist", "item", "to", "the", "worklist", ".", "This", "method", "maintains", "the", "invariant", "that", "all", "of", "the", "worklist", "items", "representing", "application", "codebases", "appear", "<em", ">", "before<", "/", "em", ">", "al...
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java#L805-L829
voldemort/voldemort
src/java/voldemort/utils/UpdateClusterUtils.java
UpdateClusterUtils.removePartitionFromNode
public static Node removePartitionFromNode(final Node node, Integer donatedPartition) { return UpdateClusterUtils.removePartitionsFromNode(node, Sets.newHashSet(donatedPartition)); }
java
public static Node removePartitionFromNode(final Node node, Integer donatedPartition) { return UpdateClusterUtils.removePartitionsFromNode(node, Sets.newHashSet(donatedPartition)); }
[ "public", "static", "Node", "removePartitionFromNode", "(", "final", "Node", "node", ",", "Integer", "donatedPartition", ")", "{", "return", "UpdateClusterUtils", ".", "removePartitionsFromNode", "(", "node", ",", "Sets", ".", "newHashSet", "(", "donatedPartition", ...
Remove a partition from the node provided @param node The node from which we're removing the partition @param donatedPartition The partitions to remove @return The new node without the partition
[ "Remove", "a", "partition", "from", "the", "node", "provided" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/UpdateClusterUtils.java#L78-L80
box/box-java-sdk
src/main/java/com/box/sdk/BoxFile.java
BoxFile.downloadRange
public void downloadRange(OutputStream output, long rangeStart, long rangeEnd, ProgressListener listener) { URL url = CONTENT_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, "GET"); if (rangeEnd > 0) { request.addHeader("Range", String.format("bytes=%s-%s", Long.toString(rangeStart), Long.toString(rangeEnd))); } else { request.addHeader("Range", String.format("bytes=%s-", Long.toString(rangeStart))); } BoxAPIResponse response = request.send(); InputStream input = response.getBody(listener); byte[] buffer = new byte[BUFFER_SIZE]; try { int n = input.read(buffer); while (n != -1) { output.write(buffer, 0, n); n = input.read(buffer); } } catch (IOException e) { throw new BoxAPIException("Couldn't connect to the Box API due to a network error.", e); } finally { response.disconnect(); } }
java
public void downloadRange(OutputStream output, long rangeStart, long rangeEnd, ProgressListener listener) { URL url = CONTENT_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, "GET"); if (rangeEnd > 0) { request.addHeader("Range", String.format("bytes=%s-%s", Long.toString(rangeStart), Long.toString(rangeEnd))); } else { request.addHeader("Range", String.format("bytes=%s-", Long.toString(rangeStart))); } BoxAPIResponse response = request.send(); InputStream input = response.getBody(listener); byte[] buffer = new byte[BUFFER_SIZE]; try { int n = input.read(buffer); while (n != -1) { output.write(buffer, 0, n); n = input.read(buffer); } } catch (IOException e) { throw new BoxAPIException("Couldn't connect to the Box API due to a network error.", e); } finally { response.disconnect(); } }
[ "public", "void", "downloadRange", "(", "OutputStream", "output", ",", "long", "rangeStart", ",", "long", "rangeEnd", ",", "ProgressListener", "listener", ")", "{", "URL", "url", "=", "CONTENT_URL_TEMPLATE", ".", "build", "(", "this", ".", "getAPI", "(", ")", ...
Downloads a part of this file's contents, starting at rangeStart and stopping at rangeEnd, while reporting the progress to a ProgressListener. @param output the stream to where the file will be written. @param rangeStart the byte offset at which to start the download. @param rangeEnd the byte offset at which to stop the download. @param listener a listener for monitoring the download's progress.
[ "Downloads", "a", "part", "of", "this", "file", "s", "contents", "starting", "at", "rangeStart", "and", "stopping", "at", "rangeEnd", "while", "reporting", "the", "progress", "to", "a", "ProgressListener", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFile.java#L342-L367
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java
ElemNumber.getLocale
Locale getLocale(TransformerImpl transformer, int contextNode) throws TransformerException { Locale locale = null; if (null != m_lang_avt) { XPathContext xctxt = transformer.getXPathContext(); String langValue = m_lang_avt.evaluate(xctxt, contextNode, this); if (null != langValue) { // Not really sure what to do about the country code, so I use the // default from the system. // TODO: fix xml:lang handling. locale = new Locale(langValue.toUpperCase(), ""); //Locale.getDefault().getDisplayCountry()); if (null == locale) { transformer.getMsgMgr().warn(this, null, xctxt.getDTM(contextNode).getNode(contextNode), XSLTErrorResources.WG_LOCALE_NOT_FOUND, new Object[]{ langValue }); //"Warning: Could not find locale for xml:lang="+langValue); locale = Locale.getDefault(); } } } else { locale = Locale.getDefault(); } return locale; }
java
Locale getLocale(TransformerImpl transformer, int contextNode) throws TransformerException { Locale locale = null; if (null != m_lang_avt) { XPathContext xctxt = transformer.getXPathContext(); String langValue = m_lang_avt.evaluate(xctxt, contextNode, this); if (null != langValue) { // Not really sure what to do about the country code, so I use the // default from the system. // TODO: fix xml:lang handling. locale = new Locale(langValue.toUpperCase(), ""); //Locale.getDefault().getDisplayCountry()); if (null == locale) { transformer.getMsgMgr().warn(this, null, xctxt.getDTM(contextNode).getNode(contextNode), XSLTErrorResources.WG_LOCALE_NOT_FOUND, new Object[]{ langValue }); //"Warning: Could not find locale for xml:lang="+langValue); locale = Locale.getDefault(); } } } else { locale = Locale.getDefault(); } return locale; }
[ "Locale", "getLocale", "(", "TransformerImpl", "transformer", ",", "int", "contextNode", ")", "throws", "TransformerException", "{", "Locale", "locale", "=", "null", ";", "if", "(", "null", "!=", "m_lang_avt", ")", "{", "XPathContext", "xctxt", "=", "transformer...
Get the locale we should be using. @param transformer non-null reference to the the current transform-time state. @param contextNode The node that "." expresses. @return The locale to use. May be specified by "lang" attribute, but if not, use default locale on the system. @throws TransformerException
[ "Get", "the", "locale", "we", "should", "be", "using", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java#L1033-L1069
RestComm/jss7
isup/isup-impl/src/main/java/org/restcomm/protocols/ss7/isup/impl/message/ISUPMessageImpl.java
ISUPMessageImpl.decodeMandatoryVariableParameters
protected int decodeMandatoryVariableParameters(ISUPParameterFactory parameterFactory, byte[] b, int index) throws ParameterException { // FIXME: possibly this should also be per msg, since if msg lacks // proper parameter, decoding wotn pick this up and will throw // some bad output, which wont give a clue about reason... int readCount = 0; // int optionalOffset = 0; if (b.length - index > 0) { byte extPIndex = -1; try { int count = getNumberOfMandatoryVariableLengthParameters(); readCount = count; for (int parameterIndex = 0; parameterIndex < count; parameterIndex++) { int lengthPointerIndex = index + parameterIndex; int parameterLengthIndex = b[lengthPointerIndex] + lengthPointerIndex; int parameterLength = b[parameterLengthIndex]; byte[] parameterBody = new byte[parameterLength]; System.arraycopy(b, parameterLengthIndex + 1, parameterBody, 0, parameterLength); decodeMandatoryVariableBody(parameterFactory, parameterBody, parameterIndex); } // optionalOffset = b[index + readCount]; } catch (ArrayIndexOutOfBoundsException aioobe) { throw new ParameterException( "Failed to read parameter, to few octets in buffer, parameter index: " + extPIndex, aioobe); } catch (IllegalArgumentException e) { throw new ParameterException("Failed to parse, paramet index: " + extPIndex, e); } } else { throw new ParameterException( "To few bytes to decode mandatory variable part. There should be atleast on byte to indicate optional part."); } // return readCount + optionalOffset; return readCount; }
java
protected int decodeMandatoryVariableParameters(ISUPParameterFactory parameterFactory, byte[] b, int index) throws ParameterException { // FIXME: possibly this should also be per msg, since if msg lacks // proper parameter, decoding wotn pick this up and will throw // some bad output, which wont give a clue about reason... int readCount = 0; // int optionalOffset = 0; if (b.length - index > 0) { byte extPIndex = -1; try { int count = getNumberOfMandatoryVariableLengthParameters(); readCount = count; for (int parameterIndex = 0; parameterIndex < count; parameterIndex++) { int lengthPointerIndex = index + parameterIndex; int parameterLengthIndex = b[lengthPointerIndex] + lengthPointerIndex; int parameterLength = b[parameterLengthIndex]; byte[] parameterBody = new byte[parameterLength]; System.arraycopy(b, parameterLengthIndex + 1, parameterBody, 0, parameterLength); decodeMandatoryVariableBody(parameterFactory, parameterBody, parameterIndex); } // optionalOffset = b[index + readCount]; } catch (ArrayIndexOutOfBoundsException aioobe) { throw new ParameterException( "Failed to read parameter, to few octets in buffer, parameter index: " + extPIndex, aioobe); } catch (IllegalArgumentException e) { throw new ParameterException("Failed to parse, paramet index: " + extPIndex, e); } } else { throw new ParameterException( "To few bytes to decode mandatory variable part. There should be atleast on byte to indicate optional part."); } // return readCount + optionalOffset; return readCount; }
[ "protected", "int", "decodeMandatoryVariableParameters", "(", "ISUPParameterFactory", "parameterFactory", ",", "byte", "[", "]", "b", ",", "int", "index", ")", "throws", "ParameterException", "{", "// FIXME: possibly this should also be per msg, since if msg lacks", "// proper ...
decodes ptrs and returns offset from passed index value to first optional parameter parameter @param b @param index @return @throws ParameterException
[ "decodes", "ptrs", "and", "returns", "offset", "from", "passed", "index", "value", "to", "first", "optional", "parameter", "parameter" ]
train
https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/isup/isup-impl/src/main/java/org/restcomm/protocols/ss7/isup/impl/message/ISUPMessageImpl.java#L375-L414
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/TrustedIdProvidersInner.java
TrustedIdProvidersInner.createOrUpdateAsync
public Observable<TrustedIdProviderInner> createOrUpdateAsync(String resourceGroupName, String accountName, String trustedIdProviderName, CreateOrUpdateTrustedIdProviderParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, trustedIdProviderName, parameters).map(new Func1<ServiceResponse<TrustedIdProviderInner>, TrustedIdProviderInner>() { @Override public TrustedIdProviderInner call(ServiceResponse<TrustedIdProviderInner> response) { return response.body(); } }); }
java
public Observable<TrustedIdProviderInner> createOrUpdateAsync(String resourceGroupName, String accountName, String trustedIdProviderName, CreateOrUpdateTrustedIdProviderParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, trustedIdProviderName, parameters).map(new Func1<ServiceResponse<TrustedIdProviderInner>, TrustedIdProviderInner>() { @Override public TrustedIdProviderInner call(ServiceResponse<TrustedIdProviderInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TrustedIdProviderInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "trustedIdProviderName", ",", "CreateOrUpdateTrustedIdProviderParameters", "parameters", ")", "{", "return", "...
Creates or updates the specified trusted identity provider. During update, the trusted identity provider with the specified name will be replaced with this new provider. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Store account. @param trustedIdProviderName The name of the trusted identity provider. This is used for differentiation of providers in the account. @param parameters Parameters supplied to create or replace the trusted identity provider. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TrustedIdProviderInner object
[ "Creates", "or", "updates", "the", "specified", "trusted", "identity", "provider", ".", "During", "update", "the", "trusted", "identity", "provider", "with", "the", "specified", "name", "will", "be", "replaced", "with", "this", "new", "provider", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/TrustedIdProvidersInner.java#L257-L264
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/view/ApptentiveNestedScrollView.java
ApptentiveNestedScrollView.pageScroll
public boolean pageScroll(int direction) { boolean down = direction == View.FOCUS_DOWN; int height = getHeight(); if (down) { mTempRect.top = getScrollY() + height; int count = getChildCount(); if (count > 0) { View view = getChildAt(count - 1); if (mTempRect.top + height > view.getBottom()) { mTempRect.top = view.getBottom() - height; } } } else { mTempRect.top = getScrollY() - height; if (mTempRect.top < 0) { mTempRect.top = 0; } } mTempRect.bottom = mTempRect.top + height; return scrollAndFocus(direction, mTempRect.top, mTempRect.bottom); }
java
public boolean pageScroll(int direction) { boolean down = direction == View.FOCUS_DOWN; int height = getHeight(); if (down) { mTempRect.top = getScrollY() + height; int count = getChildCount(); if (count > 0) { View view = getChildAt(count - 1); if (mTempRect.top + height > view.getBottom()) { mTempRect.top = view.getBottom() - height; } } } else { mTempRect.top = getScrollY() - height; if (mTempRect.top < 0) { mTempRect.top = 0; } } mTempRect.bottom = mTempRect.top + height; return scrollAndFocus(direction, mTempRect.top, mTempRect.bottom); }
[ "public", "boolean", "pageScroll", "(", "int", "direction", ")", "{", "boolean", "down", "=", "direction", "==", "View", ".", "FOCUS_DOWN", ";", "int", "height", "=", "getHeight", "(", ")", ";", "if", "(", "down", ")", "{", "mTempRect", ".", "top", "="...
<p>Handles scrolling in response to a "page up/down" shortcut press. This method will scroll the view by one page up or down and give the focus to the topmost/bottommost component in the new visible area. If no component is a good candidate for focus, this scrollview reclaims the focus.</p> @param direction the scroll direction: {@link android.view.View#FOCUS_UP} to go one page up or {@link android.view.View#FOCUS_DOWN} to go one page down @return true if the key event is consumed by this method, false otherwise
[ "<p", ">", "Handles", "scrolling", "in", "response", "to", "a", "page", "up", "/", "down", "shortcut", "press", ".", "This", "method", "will", "scroll", "the", "view", "by", "one", "page", "up", "or", "down", "and", "give", "the", "focus", "to", "the",...
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/view/ApptentiveNestedScrollView.java#L1112-L1134
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java
ApiOvhHostingprivateDatabase.serviceName_database_databaseName_GET
public OvhDatabase serviceName_database_databaseName_GET(String serviceName, String databaseName) throws IOException { String qPath = "/hosting/privateDatabase/{serviceName}/database/{databaseName}"; StringBuilder sb = path(qPath, serviceName, databaseName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDatabase.class); }
java
public OvhDatabase serviceName_database_databaseName_GET(String serviceName, String databaseName) throws IOException { String qPath = "/hosting/privateDatabase/{serviceName}/database/{databaseName}"; StringBuilder sb = path(qPath, serviceName, databaseName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDatabase.class); }
[ "public", "OvhDatabase", "serviceName_database_databaseName_GET", "(", "String", "serviceName", ",", "String", "databaseName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/privateDatabase/{serviceName}/database/{databaseName}\"", ";", "StringBuilder", ...
Get this object properties REST: GET /hosting/privateDatabase/{serviceName}/database/{databaseName} @param serviceName [required] The internal name of your private database @param databaseName [required] Database name
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java#L578-L583
CloudBees-community/syslog-java-client
src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java
LogManagerHelper.getLevelProperty
@Nullable public static Level getLevelProperty(@Nonnull LogManager manager, @Nonnull String name, @Nullable Level defaultValue) { if (name == null) { return defaultValue; } String val = manager.getProperty(name); if (val == null) { return defaultValue; } Level l = LevelHelper.findLevel(val.trim()); return l != null ? l : defaultValue; }
java
@Nullable public static Level getLevelProperty(@Nonnull LogManager manager, @Nonnull String name, @Nullable Level defaultValue) { if (name == null) { return defaultValue; } String val = manager.getProperty(name); if (val == null) { return defaultValue; } Level l = LevelHelper.findLevel(val.trim()); return l != null ? l : defaultValue; }
[ "@", "Nullable", "public", "static", "Level", "getLevelProperty", "(", "@", "Nonnull", "LogManager", "manager", ",", "@", "Nonnull", "String", "name", ",", "@", "Nullable", "Level", "defaultValue", ")", "{", "if", "(", "name", "==", "null", ")", "{", "retu...
Visible version of {@link java.util.logging.LogManager#getLevelProperty(String, java.util.logging.Level)}. If the property is not defined or cannot be parsed we return the given default value.
[ "Visible", "version", "of", "{", "@link", "java", ".", "util", ".", "logging", ".", "LogManager#getLevelProperty", "(", "String", "java", ".", "util", ".", "logging", ".", "Level", ")", "}", "." ]
train
https://github.com/CloudBees-community/syslog-java-client/blob/41e01206e4ce17c6d225ffb443bf19792a3f3c3a/src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java#L43-L54
mgm-tp/jfunk
jfunk-core/src/main/java/com/mgmtp/jfunk/core/config/ModulesLoader.java
ModulesLoader.loadModulesFromProperties
public static Module loadModulesFromProperties(final Module jFunkModule, final String propertiesFile) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException { final List<Module> modules = Lists.newArrayList(); LOG.debug("Using jfunk.props.file=" + propertiesFile); Properties props = loadProperties(propertiesFile); for (final Enumeration<?> en = props.propertyNames(); en.hasMoreElements();) { String name = (String) en.nextElement(); if (name.startsWith("module.")) { String className = props.getProperty(name); LOG.info("Loading " + name + "=" + className); Class<? extends Module> moduleClass = Class.forName(className).asSubclass(Module.class); Module module = moduleClass.newInstance(); modules.add(module); } } return Modules.override(jFunkModule).with(modules); }
java
public static Module loadModulesFromProperties(final Module jFunkModule, final String propertiesFile) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException { final List<Module> modules = Lists.newArrayList(); LOG.debug("Using jfunk.props.file=" + propertiesFile); Properties props = loadProperties(propertiesFile); for (final Enumeration<?> en = props.propertyNames(); en.hasMoreElements();) { String name = (String) en.nextElement(); if (name.startsWith("module.")) { String className = props.getProperty(name); LOG.info("Loading " + name + "=" + className); Class<? extends Module> moduleClass = Class.forName(className).asSubclass(Module.class); Module module = moduleClass.newInstance(); modules.add(module); } } return Modules.override(jFunkModule).with(modules); }
[ "public", "static", "Module", "loadModulesFromProperties", "(", "final", "Module", "jFunkModule", ",", "final", "String", "propertiesFile", ")", "throws", "ClassNotFoundException", ",", "InstantiationException", ",", "IllegalAccessException", ",", "IOException", "{", "fin...
Loads Guice modules whose class names are specified as properties. All properties starting with "module." are considered to have a fully qualified class name representing a Guice module. The modules are combined and override thespecified jFunkModule. @param propertiesFile The properties file @return the combined module
[ "Loads", "Guice", "modules", "whose", "class", "names", "are", "specified", "as", "properties", ".", "All", "properties", "starting", "with", "module", ".", "are", "considered", "to", "have", "a", "fully", "qualified", "class", "name", "representing", "a", "Gu...
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/config/ModulesLoader.java#L60-L78
lukin0110/poeditor-java
src/main/java/be/lukin/poeditor/POEditorClient.java
POEditorClient.addAdministrator
public boolean addAdministrator(String projectId, String name, String email){ ResponseWrapper wrapper = service.addProjectMember(Action.ADD_CONTRIBUTOR, apiKey, projectId, name, email, null, 1); return "200".equals(wrapper.response.code); }
java
public boolean addAdministrator(String projectId, String name, String email){ ResponseWrapper wrapper = service.addProjectMember(Action.ADD_CONTRIBUTOR, apiKey, projectId, name, email, null, 1); return "200".equals(wrapper.response.code); }
[ "public", "boolean", "addAdministrator", "(", "String", "projectId", ",", "String", "name", ",", "String", "email", ")", "{", "ResponseWrapper", "wrapper", "=", "service", ".", "addProjectMember", "(", "Action", ".", "ADD_CONTRIBUTOR", ",", "apiKey", ",", "proje...
Create a new admin for a project @param projectId id of the project @param name name of the admin @param email email of the admin @return boolean if the administrator has been created
[ "Create", "a", "new", "admin", "for", "a", "project" ]
train
https://github.com/lukin0110/poeditor-java/blob/42a2cd3136da1276b29a57a483c94050cc7d1d01/src/main/java/be/lukin/poeditor/POEditorClient.java#L183-L186
jenkinsci/jenkins
core/src/main/java/hudson/FilePath.java
FilePath.createZipArchive
@Deprecated public void createZipArchive(OutputStream os, final String glob) throws IOException, InterruptedException { archive(ArchiverFactory.ZIP,os,glob); }
java
@Deprecated public void createZipArchive(OutputStream os, final String glob) throws IOException, InterruptedException { archive(ArchiverFactory.ZIP,os,glob); }
[ "@", "Deprecated", "public", "void", "createZipArchive", "(", "OutputStream", "os", ",", "final", "String", "glob", ")", "throws", "IOException", ",", "InterruptedException", "{", "archive", "(", "ArchiverFactory", ".", "ZIP", ",", "os", ",", "glob", ")", ";",...
Creates a zip file from this directory by only including the files that match the given glob. @param glob Ant style glob, like "**&#x2F;*.xml". If empty or null, this method works like {@link #createZipArchive(OutputStream)} @since 1.129 @deprecated as of 1.315 Use {@link #zip(OutputStream,String)} that has more consistent name.
[ "Creates", "a", "zip", "file", "from", "this", "directory", "by", "only", "including", "the", "files", "that", "match", "the", "given", "glob", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/FilePath.java#L448-L451
jtrfp/jfdt
src/main/java/org/jtrfp/jfdt/Parser.java
Parser.writeBean
public void writeBean(ThirdPartyParseable bean, EndianAwareDataOutputStream os){ if(bean==null)throw new NullPointerException(); ensureContextInstantiatedForWriting(os,bean); try{bean.describeFormat(this);} catch(UnrecognizedFormatException e){e.printStackTrace();}//Shouldn't happen. popBean(); }
java
public void writeBean(ThirdPartyParseable bean, EndianAwareDataOutputStream os){ if(bean==null)throw new NullPointerException(); ensureContextInstantiatedForWriting(os,bean); try{bean.describeFormat(this);} catch(UnrecognizedFormatException e){e.printStackTrace();}//Shouldn't happen. popBean(); }
[ "public", "void", "writeBean", "(", "ThirdPartyParseable", "bean", ",", "EndianAwareDataOutputStream", "os", ")", "{", "if", "(", "bean", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "ensureContextInstantiatedForWriting", "(", "os", ",...
Write ThirdPartyParseable bean to the given EndianAwareDataOutputStream. @param bean @param os @since Sep 17, 2012
[ "Write", "ThirdPartyParseable", "bean", "to", "the", "given", "EndianAwareDataOutputStream", "." ]
train
https://github.com/jtrfp/jfdt/blob/64e665669b5fcbfe96736346b4e7893e466dd8a0/src/main/java/org/jtrfp/jfdt/Parser.java#L185-L191
liyiorg/weixin-popular
src/main/java/weixin/popular/util/XMLConverUtil.java
XMLConverUtil.convertToObject
public static <T> T convertToObject(Class<T> clazz, String xml) { return convertToObject(clazz, new StringReader(xml)); }
java
public static <T> T convertToObject(Class<T> clazz, String xml) { return convertToObject(clazz, new StringReader(xml)); }
[ "public", "static", "<", "T", ">", "T", "convertToObject", "(", "Class", "<", "T", ">", "clazz", ",", "String", "xml", ")", "{", "return", "convertToObject", "(", "clazz", ",", "new", "StringReader", "(", "xml", ")", ")", ";", "}" ]
XML to Object @param <T> T @param clazz clazz @param xml xml @return T
[ "XML", "to", "Object" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/XMLConverUtil.java#L62-L64
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java
SM2Engine.init
public void init(boolean forEncryption, CipherParameters param) { this.forEncryption = forEncryption; if (param instanceof ParametersWithRandom) { final ParametersWithRandom rParam = (ParametersWithRandom) param; this.ecKey = (ECKeyParameters) rParam.getParameters(); this.random = rParam.getRandom(); } else { this.ecKey = (ECKeyParameters) param; } this.ecParams = this.ecKey.getParameters(); if (forEncryption) { // 检查曲线点 final ECPoint ecPoint = ((ECPublicKeyParameters) ecKey).getQ().multiply(ecParams.getH()); if (ecPoint.isInfinity()) { throw new IllegalArgumentException("invalid key: [h]Q at infinity"); } // 检查随机参数 if (null == this.random) { this.random = CryptoServicesRegistrar.getSecureRandom(); } } // 曲线位长度 this.curveLength = (this.ecParams.getCurve().getFieldSize() + 7) / 8; }
java
public void init(boolean forEncryption, CipherParameters param) { this.forEncryption = forEncryption; if (param instanceof ParametersWithRandom) { final ParametersWithRandom rParam = (ParametersWithRandom) param; this.ecKey = (ECKeyParameters) rParam.getParameters(); this.random = rParam.getRandom(); } else { this.ecKey = (ECKeyParameters) param; } this.ecParams = this.ecKey.getParameters(); if (forEncryption) { // 检查曲线点 final ECPoint ecPoint = ((ECPublicKeyParameters) ecKey).getQ().multiply(ecParams.getH()); if (ecPoint.isInfinity()) { throw new IllegalArgumentException("invalid key: [h]Q at infinity"); } // 检查随机参数 if (null == this.random) { this.random = CryptoServicesRegistrar.getSecureRandom(); } } // 曲线位长度 this.curveLength = (this.ecParams.getCurve().getFieldSize() + 7) / 8; }
[ "public", "void", "init", "(", "boolean", "forEncryption", ",", "CipherParameters", "param", ")", "{", "this", ".", "forEncryption", "=", "forEncryption", ";", "if", "(", "param", "instanceof", "ParametersWithRandom", ")", "{", "final", "ParametersWithRandom", "rP...
初始化引擎 @param forEncryption 是否为加密模式 @param param {@link CipherParameters},此处应为{@link ParametersWithRandom}(加密时)或{@link ECKeyParameters}(解密时)
[ "初始化引擎" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java#L94-L121
dbracewell/hermes
hermes-core/src/main/java/com/davidbracewell/hermes/Document.java
Document.create
public static Document create(@NonNull String id, @NonNull String text, @NonNull Language language, @NonNull Map<AttributeType, ?> attributes) { return DocumentFactory.getInstance().create(id, text, language, attributes); }
java
public static Document create(@NonNull String id, @NonNull String text, @NonNull Language language, @NonNull Map<AttributeType, ?> attributes) { return DocumentFactory.getInstance().create(id, text, language, attributes); }
[ "public", "static", "Document", "create", "(", "@", "NonNull", "String", "id", ",", "@", "NonNull", "String", "text", ",", "@", "NonNull", "Language", "language", ",", "@", "NonNull", "Map", "<", "AttributeType", ",", "?", ">", "attributes", ")", "{", "r...
Convenience method for creating a document using the default document factory. @param id the document id @param text the text content making up the document @param language the language of the content @param attributes the attributes, i.e. metadata, associated with the document @return the document
[ "Convenience", "method", "for", "creating", "a", "document", "using", "the", "default", "document", "factory", "." ]
train
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/Document.java#L174-L176
OpenLiberty/open-liberty
dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/session/internal/SessionManager.java
SessionManager.processConfig
public void processConfig(Dictionary<?, ?> props) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Session manager configuration updated"); } this.myConfig.updated(props); String value = (String) props.get("purge.interval"); if (null != value) { try { // convert the configuration in seconds to runtime milliseconds this.purgeInterval = Long.parseLong(value.trim()); } catch (NumberFormatException nfe) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Ignoring incorrect purge interval [" + value + "]", nfe.getMessage()); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: purge interval [" + this.purgeInterval + "]"); } }
java
public void processConfig(Dictionary<?, ?> props) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Session manager configuration updated"); } this.myConfig.updated(props); String value = (String) props.get("purge.interval"); if (null != value) { try { // convert the configuration in seconds to runtime milliseconds this.purgeInterval = Long.parseLong(value.trim()); } catch (NumberFormatException nfe) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Ignoring incorrect purge interval [" + value + "]", nfe.getMessage()); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: purge interval [" + this.purgeInterval + "]"); } }
[ "public", "void", "processConfig", "(", "Dictionary", "<", "?", ",", "?", ">", "props", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ...
Method called when the properties for the session manager have been found or udpated. @param props
[ "Method", "called", "when", "the", "properties", "for", "the", "session", "manager", "have", "been", "found", "or", "udpated", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/session/internal/SessionManager.java#L112-L132
jaxio/javaee-lab
javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/ByPatternUtil.java
ByPatternUtil.byPattern
@SuppressWarnings("unchecked") public <T> Predicate byPattern(Root<T> root, CriteriaBuilder builder, SearchParameters sp, Class<T> type) { if (!sp.hasSearchPattern()) { return null; } List<Predicate> predicates = newArrayList(); EntityType<T> entity = em.getMetamodel().entity(type); String pattern = sp.getSearchPattern(); for (SingularAttribute<? super T, ?> attr : entity.getSingularAttributes()) { if (attr.getPersistentAttributeType() == MANY_TO_ONE || attr.getPersistentAttributeType() == ONE_TO_ONE) { continue; } if (attr.getJavaType() == String.class) { predicates.add(jpaUtil.stringPredicate((Expression<String>) root.get(jpaUtil.attribute(entity, attr)), pattern, sp, builder)); } } return jpaUtil.orPredicate(builder, predicates); }
java
@SuppressWarnings("unchecked") public <T> Predicate byPattern(Root<T> root, CriteriaBuilder builder, SearchParameters sp, Class<T> type) { if (!sp.hasSearchPattern()) { return null; } List<Predicate> predicates = newArrayList(); EntityType<T> entity = em.getMetamodel().entity(type); String pattern = sp.getSearchPattern(); for (SingularAttribute<? super T, ?> attr : entity.getSingularAttributes()) { if (attr.getPersistentAttributeType() == MANY_TO_ONE || attr.getPersistentAttributeType() == ONE_TO_ONE) { continue; } if (attr.getJavaType() == String.class) { predicates.add(jpaUtil.stringPredicate((Expression<String>) root.get(jpaUtil.attribute(entity, attr)), pattern, sp, builder)); } } return jpaUtil.orPredicate(builder, predicates); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "Predicate", "byPattern", "(", "Root", "<", "T", ">", "root", ",", "CriteriaBuilder", "builder", ",", "SearchParameters", "sp", ",", "Class", "<", "T", ">", "type", ")", "{", "i...
/* Lookup entities having at least one String attribute matching the passed sp's pattern
[ "/", "*", "Lookup", "entities", "having", "at", "least", "one", "String", "attribute", "matching", "the", "passed", "sp", "s", "pattern" ]
train
https://github.com/jaxio/javaee-lab/blob/61238b967952446d81cc68424a4e809093a77fcf/javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/ByPatternUtil.java#L45-L66
michaelliao/jsonstream
src/main/java/com/itranswarp/jsonstream/JsonBuilder.java
JsonBuilder.createReader
public JsonReader createReader(Reader reader) { return new JsonReader(reader, jsonObjectFactory, jsonArrayFactory, objectMapper, typeAdapters); }
java
public JsonReader createReader(Reader reader) { return new JsonReader(reader, jsonObjectFactory, jsonArrayFactory, objectMapper, typeAdapters); }
[ "public", "JsonReader", "createReader", "(", "Reader", "reader", ")", "{", "return", "new", "JsonReader", "(", "reader", ",", "jsonObjectFactory", ",", "jsonArrayFactory", ",", "objectMapper", ",", "typeAdapters", ")", ";", "}" ]
Create a JsonReader by providing a Reader. @param reader The Reader object. @return JsonReader object.
[ "Create", "a", "JsonReader", "by", "providing", "a", "Reader", "." ]
train
https://github.com/michaelliao/jsonstream/blob/50adcff2e1293e655462eef5fc5f1b59277de514/src/main/java/com/itranswarp/jsonstream/JsonBuilder.java#L92-L94
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/xmlhelpers/AbstractXmlReader.java
AbstractXmlReader.isStartTagEvent
protected boolean isStartTagEvent(XMLEvent event, QName tagName) { return event.isStartElement() && event.asStartElement().getName().equals(tagName); }
java
protected boolean isStartTagEvent(XMLEvent event, QName tagName) { return event.isStartElement() && event.asStartElement().getName().equals(tagName); }
[ "protected", "boolean", "isStartTagEvent", "(", "XMLEvent", "event", ",", "QName", "tagName", ")", "{", "return", "event", ".", "isStartElement", "(", ")", "&&", "event", ".", "asStartElement", "(", ")", ".", "getName", "(", ")", ".", "equals", "(", "tagNa...
Test an event to see whether it is an start tag with the expected name.
[ "Test", "an", "event", "to", "see", "whether", "it", "is", "an", "start", "tag", "with", "the", "expected", "name", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/xmlhelpers/AbstractXmlReader.java#L56-L59
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/util/GeoPoint.java
GeoPoint.destinationPoint
public GeoPoint destinationPoint(final double aDistanceInMeters, final double aBearingInDegrees) { // convert distance to angular distance final double dist = aDistanceInMeters / RADIUS_EARTH_METERS; // convert bearing to radians final double brng = DEG2RAD * aBearingInDegrees; // get current location in radians final double lat1 = DEG2RAD * getLatitude(); final double lon1 = DEG2RAD * getLongitude(); final double lat2 = Math.asin(Math.sin(lat1) * Math.cos(dist) + Math.cos(lat1) * Math.sin(dist) * Math.cos(brng)); final double lon2 = lon1 + Math.atan2(Math.sin(brng) * Math.sin(dist) * Math.cos(lat1), Math.cos(dist) - Math.sin(lat1) * Math.sin(lat2)); final double lat2deg = lat2 / DEG2RAD; final double lon2deg = lon2 / DEG2RAD; return new GeoPoint(lat2deg, lon2deg); }
java
public GeoPoint destinationPoint(final double aDistanceInMeters, final double aBearingInDegrees) { // convert distance to angular distance final double dist = aDistanceInMeters / RADIUS_EARTH_METERS; // convert bearing to radians final double brng = DEG2RAD * aBearingInDegrees; // get current location in radians final double lat1 = DEG2RAD * getLatitude(); final double lon1 = DEG2RAD * getLongitude(); final double lat2 = Math.asin(Math.sin(lat1) * Math.cos(dist) + Math.cos(lat1) * Math.sin(dist) * Math.cos(brng)); final double lon2 = lon1 + Math.atan2(Math.sin(brng) * Math.sin(dist) * Math.cos(lat1), Math.cos(dist) - Math.sin(lat1) * Math.sin(lat2)); final double lat2deg = lat2 / DEG2RAD; final double lon2deg = lon2 / DEG2RAD; return new GeoPoint(lat2deg, lon2deg); }
[ "public", "GeoPoint", "destinationPoint", "(", "final", "double", "aDistanceInMeters", ",", "final", "double", "aBearingInDegrees", ")", "{", "// convert distance to angular distance", "final", "double", "dist", "=", "aDistanceInMeters", "/", "RADIUS_EARTH_METERS", ";", "...
Calculate a point that is the specified distance and bearing away from this point. @see <a href="http://www.movable-type.co.uk/scripts/latlong.html">latlong.html</a> @see <a href="http://www.movable-type.co.uk/scripts/latlon.js">latlon.js</a>
[ "Calculate", "a", "point", "that", "is", "the", "specified", "distance", "and", "bearing", "away", "from", "this", "point", "." ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/GeoPoint.java#L288-L310
m-m-m/util
event/src/main/java/net/sf/mmm/util/event/base/AbstractEventBus.java
AbstractEventBus.getEventDispatcherRequired
@SuppressWarnings("unchecked") protected <E> EventDispatcher<E> getEventDispatcherRequired(Class<E> eventType) { return getEventDispatcher(eventType, true); }
java
@SuppressWarnings("unchecked") protected <E> EventDispatcher<E> getEventDispatcherRequired(Class<E> eventType) { return getEventDispatcher(eventType, true); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "<", "E", ">", "EventDispatcher", "<", "E", ">", "getEventDispatcherRequired", "(", "Class", "<", "E", ">", "eventType", ")", "{", "return", "getEventDispatcher", "(", "eventType", ",", "true", "...
Gets or creates the {@link EventDispatcher} for the given {@code eventType}. @param <E> is the generic type of {@code eventType}. @param eventType is the {@link Class} reflecting the {@link net.sf.mmm.util.event.api.Event event}. @return the {@link EventDispatcher} responsible for the given {@code eventType}.
[ "Gets", "or", "creates", "the", "{", "@link", "EventDispatcher", "}", "for", "the", "given", "{", "@code", "eventType", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/event/src/main/java/net/sf/mmm/util/event/base/AbstractEventBus.java#L179-L183
netty/netty
common/src/main/java/io/netty/util/internal/StringUtil.java
StringUtil.toHexString
public static <T extends Appendable> T toHexString(T dst, byte[] src, int offset, int length) { assert length >= 0; if (length == 0) { return dst; } final int end = offset + length; final int endMinusOne = end - 1; int i; // Skip preceding zeroes. for (i = offset; i < endMinusOne; i++) { if (src[i] != 0) { break; } } byteToHexString(dst, src[i++]); int remaining = end - i; toHexStringPadded(dst, src, i, remaining); return dst; }
java
public static <T extends Appendable> T toHexString(T dst, byte[] src, int offset, int length) { assert length >= 0; if (length == 0) { return dst; } final int end = offset + length; final int endMinusOne = end - 1; int i; // Skip preceding zeroes. for (i = offset; i < endMinusOne; i++) { if (src[i] != 0) { break; } } byteToHexString(dst, src[i++]); int remaining = end - i; toHexStringPadded(dst, src, i, remaining); return dst; }
[ "public", "static", "<", "T", "extends", "Appendable", ">", "T", "toHexString", "(", "T", "dst", ",", "byte", "[", "]", "src", ",", "int", "offset", ",", "int", "length", ")", "{", "assert", "length", ">=", "0", ";", "if", "(", "length", "==", "0",...
Converts the specified byte array into a hexadecimal value and appends it to the specified buffer.
[ "Converts", "the", "specified", "byte", "array", "into", "a", "hexadecimal", "value", "and", "appends", "it", "to", "the", "specified", "buffer", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L181-L203
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/tileprovider/cachemanager/CacheManager.java
CacheManager.cleanAreaAsync
public CacheManagerTask cleanAreaAsync(final Context ctx, ArrayList<GeoPoint> geoPoints, int zoomMin, int zoomMax) { BoundingBox extendedBounds = extendedBoundsFromGeoPoints(geoPoints,zoomMin); return cleanAreaAsync(ctx, extendedBounds, zoomMin, zoomMax); }
java
public CacheManagerTask cleanAreaAsync(final Context ctx, ArrayList<GeoPoint> geoPoints, int zoomMin, int zoomMax) { BoundingBox extendedBounds = extendedBoundsFromGeoPoints(geoPoints,zoomMin); return cleanAreaAsync(ctx, extendedBounds, zoomMin, zoomMax); }
[ "public", "CacheManagerTask", "cleanAreaAsync", "(", "final", "Context", "ctx", ",", "ArrayList", "<", "GeoPoint", ">", "geoPoints", ",", "int", "zoomMin", ",", "int", "zoomMax", ")", "{", "BoundingBox", "extendedBounds", "=", "extendedBoundsFromGeoPoints", "(", "...
Remove all cached tiles covered by the GeoPoints list. @param ctx @param geoPoints @param zoomMin @param zoomMax
[ "Remove", "all", "cached", "tiles", "covered", "by", "the", "GeoPoints", "list", "." ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/tileprovider/cachemanager/CacheManager.java#L905-L908
taimos/dvalin
jaxrs-jwtauth/src/main/java/de/taimos/dvalin/jaxrs/security/jwt/JWTAuth.java
JWTAuth.verifyToken
public SignedJWT verifyToken(String jwtString) throws ParseException { try { SignedJWT jwt = SignedJWT.parse(jwtString); if (jwt.verify(new MACVerifier(this.jwtSharedSecret))) { return jwt; } return null; } catch (JOSEException e) { throw new RuntimeException("Error verifying JSON Web Token", e); } }
java
public SignedJWT verifyToken(String jwtString) throws ParseException { try { SignedJWT jwt = SignedJWT.parse(jwtString); if (jwt.verify(new MACVerifier(this.jwtSharedSecret))) { return jwt; } return null; } catch (JOSEException e) { throw new RuntimeException("Error verifying JSON Web Token", e); } }
[ "public", "SignedJWT", "verifyToken", "(", "String", "jwtString", ")", "throws", "ParseException", "{", "try", "{", "SignedJWT", "jwt", "=", "SignedJWT", ".", "parse", "(", "jwtString", ")", ";", "if", "(", "jwt", ".", "verify", "(", "new", "MACVerifier", ...
Check the given JWT @param jwtString the JSON Web Token @return the parsed and verified token or null if token is invalid @throws ParseException if the token cannot be parsed
[ "Check", "the", "given", "JWT" ]
train
https://github.com/taimos/dvalin/blob/ff8f1bf594e43d7e8ca8de0b4da9f923b66a1a47/jaxrs-jwtauth/src/main/java/de/taimos/dvalin/jaxrs/security/jwt/JWTAuth.java#L97-L107
googleads/googleads-java-lib
modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/utils/v201902/DateTimes.java
DateTimes.toCalendar
public static Calendar toCalendar(DateTime dateTime, Locale locale) { return dateTimesHelper.toCalendar(dateTime, locale); }
java
public static Calendar toCalendar(DateTime dateTime, Locale locale) { return dateTimesHelper.toCalendar(dateTime, locale); }
[ "public", "static", "Calendar", "toCalendar", "(", "DateTime", "dateTime", ",", "Locale", "locale", ")", "{", "return", "dateTimesHelper", ".", "toCalendar", "(", "dateTime", ",", "locale", ")", ";", "}" ]
Gets a calendar for a {@code DateTime} in the supplied locale.
[ "Gets", "a", "calendar", "for", "a", "{" ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/utils/v201902/DateTimes.java#L75-L77
UrielCh/ovh-java-sdk
ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java
ApiOvhVps.serviceName_disks_id_use_GET
public OvhUnitAndValue<Double> serviceName_disks_id_use_GET(String serviceName, Long id, OvhStatisticTypeEnum type) throws IOException { String qPath = "/vps/{serviceName}/disks/{id}/use"; StringBuilder sb = path(qPath, serviceName, id); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
java
public OvhUnitAndValue<Double> serviceName_disks_id_use_GET(String serviceName, Long id, OvhStatisticTypeEnum type) throws IOException { String qPath = "/vps/{serviceName}/disks/{id}/use"; StringBuilder sb = path(qPath, serviceName, id); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
[ "public", "OvhUnitAndValue", "<", "Double", ">", "serviceName_disks_id_use_GET", "(", "String", "serviceName", ",", "Long", "id", ",", "OvhStatisticTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/vps/{serviceName}/disks/{id}/use\"", ";"...
Return many statistics about the disk at that time REST: GET /vps/{serviceName}/disks/{id}/use @param type [required] The type of statistic to be fetched @param serviceName [required] The internal name of your VPS offer @param id [required] Id of the object
[ "Return", "many", "statistics", "about", "the", "disk", "at", "that", "time" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L908-L914
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.enableKeyVaultAsync
public Observable<Void> enableKeyVaultAsync(String resourceGroupName, String accountName) { return enableKeyVaultWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> enableKeyVaultAsync(String resourceGroupName, String accountName) { return enableKeyVaultWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "enableKeyVaultAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ")", "{", "return", "enableKeyVaultWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ")", ".", "map", "(", "new", ...
Attempts to enable a user managed key vault for encryption of the specified Data Lake Store account. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account. @param accountName The name of the Data Lake Store account to attempt to enable the Key Vault for. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Attempts", "to", "enable", "a", "user", "managed", "key", "vault", "for", "encryption", "of", "the", "specified", "Data", "Lake", "Store", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java#L1169-L1176
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.dedicated_server_serviceName_staticIP_duration_GET
public OvhOrder dedicated_server_serviceName_staticIP_duration_GET(String serviceName, String duration, OvhIpStaticCountryEnum country) throws IOException { String qPath = "/order/dedicated/server/{serviceName}/staticIP/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "country", country); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder dedicated_server_serviceName_staticIP_duration_GET(String serviceName, String duration, OvhIpStaticCountryEnum country) throws IOException { String qPath = "/order/dedicated/server/{serviceName}/staticIP/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "country", country); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "dedicated_server_serviceName_staticIP_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhIpStaticCountryEnum", "country", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/dedicated/server/{serviceName}/sta...
Get prices and contracts information REST: GET /order/dedicated/server/{serviceName}/staticIP/{duration} @param country [required] Ip localization @param serviceName [required] The internal name of your dedicated server @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#L2290-L2296
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/document/RtfDocumentSettings.java
RtfDocumentSettings.setProtection
public boolean setProtection(int level, String pwd) { boolean result = false; if(this.protectionHash == null) { if(!setProtectionLevel(level)) { result = false; } else { protectionHash = RtfProtection.generateHash(pwd); result = true; } } else { if(this.protectionHash.equals(RtfProtection.generateHash(pwd))) { if(!setProtectionLevel(level)) { result = false; } else { protectionHash = RtfProtection.generateHash(pwd); result = true; } } } return result; }
java
public boolean setProtection(int level, String pwd) { boolean result = false; if(this.protectionHash == null) { if(!setProtectionLevel(level)) { result = false; } else { protectionHash = RtfProtection.generateHash(pwd); result = true; } } else { if(this.protectionHash.equals(RtfProtection.generateHash(pwd))) { if(!setProtectionLevel(level)) { result = false; } else { protectionHash = RtfProtection.generateHash(pwd); result = true; } } } return result; }
[ "public", "boolean", "setProtection", "(", "int", "level", ",", "String", "pwd", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "this", ".", "protectionHash", "==", "null", ")", "{", "if", "(", "!", "setProtectionLevel", "(", "level", ")", ...
Author: Howard Shank (hgshank@yahoo.com) @param level Document protecton level @param pwd Document password - clear text @since 2.1.1
[ "Author", ":", "Howard", "Shank", "(", "hgshank" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/document/RtfDocumentSettings.java#L353-L378
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java
MatrixFeatures_DDRM.isEquals
public static boolean isEquals(BMatrixRMaj a, BMatrixRMaj b ) { if( a.numRows != b.numRows || a.numCols != b.numCols ) { return false; } final int length = a.getNumElements(); for( int i = 0; i < length; i++ ) { if( !(a.get(i) == b.get(i)) ) { return false; } } return true; }
java
public static boolean isEquals(BMatrixRMaj a, BMatrixRMaj b ) { if( a.numRows != b.numRows || a.numCols != b.numCols ) { return false; } final int length = a.getNumElements(); for( int i = 0; i < length; i++ ) { if( !(a.get(i) == b.get(i)) ) { return false; } } return true; }
[ "public", "static", "boolean", "isEquals", "(", "BMatrixRMaj", "a", ",", "BMatrixRMaj", "b", ")", "{", "if", "(", "a", ".", "numRows", "!=", "b", ".", "numRows", "||", "a", ".", "numCols", "!=", "b", ".", "numCols", ")", "{", "return", "false", ";", ...
<p> Checks to see if each element in the two matrices are equal: a<sub>ij</sub> == b<sub>ij</sub> <p> <p> NOTE: If any of the elements are NaN then false is returned. If two corresponding elements are both positive or negative infinity then they are equal. </p> @param a A matrix. Not modified. @param b A matrix. Not modified. @return true if identical and false otherwise.
[ "<p", ">", "Checks", "to", "see", "if", "each", "element", "in", "the", "two", "matrices", "are", "equal", ":", "a<sub", ">", "ij<", "/", "sub", ">", "==", "b<sub", ">", "ij<", "/", "sub", ">", "<p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java#L417-L430
xmlunit/xmlunit
xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java
XMLAssert.assertXMLEqual
public static void assertXMLEqual(String control, String test) throws SAXException, IOException { assertXMLEqual(null, control, test); }
java
public static void assertXMLEqual(String control, String test) throws SAXException, IOException { assertXMLEqual(null, control, test); }
[ "public", "static", "void", "assertXMLEqual", "(", "String", "control", ",", "String", "test", ")", "throws", "SAXException", ",", "IOException", "{", "assertXMLEqual", "(", "null", ",", "control", ",", "test", ")", ";", "}" ]
Assert that two XML documents are similar @param control XML to be compared against @param test XML to be tested @throws SAXException @throws IOException
[ "Assert", "that", "two", "XML", "documents", "are", "similar" ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java#L181-L184
omise/omise-java
src/main/java/co/omise/resources/Resource.java
Resource.httpOp
protected Operation httpOp(String method, HttpUrl url) { return new Operation(httpClient).method(method).httpUrl(url); }
java
protected Operation httpOp(String method, HttpUrl url) { return new Operation(httpClient).method(method).httpUrl(url); }
[ "protected", "Operation", "httpOp", "(", "String", "method", ",", "HttpUrl", "url", ")", "{", "return", "new", "Operation", "(", "httpClient", ")", ".", "method", "(", "method", ")", ".", "httpUrl", "(", "url", ")", ";", "}" ]
Starts an HTTP {@link Operation} with the given method and {@link HttpUrl}. @param method The uppercased HTTP method to use. @param url An {@link HttpUrl} target. @return An {@link Operation} builder.
[ "Starts", "an", "HTTP", "{", "@link", "Operation", "}", "with", "the", "given", "method", "and", "{", "@link", "HttpUrl", "}", "." ]
train
https://github.com/omise/omise-java/blob/95aafc5e8c21b44e6d00a5a9080b9e353fe98042/src/main/java/co/omise/resources/Resource.java#L91-L93
astrapi69/mystic-crypt
crypt-data/src/main/java/de/alpharogroup/crypto/hex/HexExtensions.java
HexExtensions.toHexString
public static String toHexString(final byte[] data, final boolean lowerCase) { final StringBuilder sb = new StringBuilder(); sb.append(HexExtensions.encodeHex(data, lowerCase)); return sb.toString(); }
java
public static String toHexString(final byte[] data, final boolean lowerCase) { final StringBuilder sb = new StringBuilder(); sb.append(HexExtensions.encodeHex(data, lowerCase)); return sb.toString(); }
[ "public", "static", "String", "toHexString", "(", "final", "byte", "[", "]", "data", ",", "final", "boolean", "lowerCase", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "HexExtensions", ".",...
Transform the given {@code byte array} to a hexadecimal {@link String} value. @param data the byte array @param lowerCase the flag if the result shell be transform in lower case. If true the result is lowercase otherwise uppercase. @return the new hexadecimal {@link String} value.
[ "Transform", "the", "given", "{", "@code", "byte", "array", "}", "to", "a", "hexadecimal", "{", "@link", "String", "}", "value", "." ]
train
https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/hex/HexExtensions.java#L210-L215
treasure-data/td-client-java
src/main/java/com/treasuredata/client/TDHttpClient.java
TDHttpClient.call
public <Result> Result call(TDApiRequest apiRequest, Optional<String> apiKeyCache, final Function<InputStream, Result> contentStreamHandler) { return submitRequest(apiRequest, apiKeyCache, newByteStreamHandler(contentStreamHandler)); }
java
public <Result> Result call(TDApiRequest apiRequest, Optional<String> apiKeyCache, final Function<InputStream, Result> contentStreamHandler) { return submitRequest(apiRequest, apiKeyCache, newByteStreamHandler(contentStreamHandler)); }
[ "public", "<", "Result", ">", "Result", "call", "(", "TDApiRequest", "apiRequest", ",", "Optional", "<", "String", ">", "apiKeyCache", ",", "final", "Function", "<", "InputStream", ",", "Result", ">", "contentStreamHandler", ")", "{", "return", "submitRequest", ...
Submit an API request, and returns the byte InputStream. This stream is valid until exiting this function. @param apiRequest @param apiKeyCache @param contentStreamHandler @param <Result> @return
[ "Submit", "an", "API", "request", "and", "returns", "the", "byte", "InputStream", ".", "This", "stream", "is", "valid", "until", "exiting", "this", "function", "." ]
train
https://github.com/treasure-data/td-client-java/blob/2769cbcf0e787d457344422cfcdde467399bd684/src/main/java/com/treasuredata/client/TDHttpClient.java#L499-L502