repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
Azure/azure-sdk-for-java
redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java
RedisInner.forceReboot
public RedisForceRebootResponseInner forceReboot(String resourceGroupName, String name, RedisRebootParameters parameters) { return forceRebootWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body(); }
java
public RedisForceRebootResponseInner forceReboot(String resourceGroupName, String name, RedisRebootParameters parameters) { return forceRebootWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body(); }
[ "public", "RedisForceRebootResponseInner", "forceReboot", "(", "String", "resourceGroupName", ",", "String", "name", ",", "RedisRebootParameters", "parameters", ")", "{", "return", "forceRebootWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "parameter...
Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. @param resourceGroupName The name of the resource group. @param name The name of the Redis cache. @param parameters Specifies which Redis node(s) to reboot. @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 RedisForceRebootResponseInner object if successful.
[ "Reboot", "specified", "Redis", "node", "(", "s", ")", ".", "This", "operation", "requires", "write", "permission", "to", "the", "cache", "resource", ".", "There", "can", "be", "potential", "data", "loss", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L1244-L1246
overturetool/overture
ide/ui/src/main/java/org/overture/ide/ui/commands/ToggleComment.java
ToggleComment.getTextBlockFromSelection
private IRegion getTextBlockFromSelection(ITextSelection selection, IDocument document) { try { IRegion line= document.getLineInformationOfOffset(selection.getOffset()); int length= selection.getLength() == 0 ? line.getLength() : selection.getLength() + (selection.getOffset() - line.getOffset()); return new Region(line.getOffset(), length); } catch (BadLocationException x) { // should not happen VdmUIPlugin.log(x); } return null; }
java
private IRegion getTextBlockFromSelection(ITextSelection selection, IDocument document) { try { IRegion line= document.getLineInformationOfOffset(selection.getOffset()); int length= selection.getLength() == 0 ? line.getLength() : selection.getLength() + (selection.getOffset() - line.getOffset()); return new Region(line.getOffset(), length); } catch (BadLocationException x) { // should not happen VdmUIPlugin.log(x); } return null; }
[ "private", "IRegion", "getTextBlockFromSelection", "(", "ITextSelection", "selection", ",", "IDocument", "document", ")", "{", "try", "{", "IRegion", "line", "=", "document", ".", "getLineInformationOfOffset", "(", "selection", ".", "getOffset", "(", ")", ")", ";"...
Creates a region describing the text block (something that starts at the beginning of a line) completely containing the current selection. @param selection The selection to use @param document The document @return the region describing the text block comprising the given selection
[ "Creates", "a", "region", "describing", "the", "text", "block", "(", "something", "that", "starts", "at", "the", "beginning", "of", "a", "line", ")", "completely", "containing", "the", "current", "selection", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/ui/src/main/java/org/overture/ide/ui/commands/ToggleComment.java#L199-L212
carewebframework/carewebframework-vista
org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.documents/src/main/java/org/carewebframework/vista/plugin/documents/DocumentListRenderer.java
DocumentListRenderer.addCell
private void addCell(Listitem item, Object value) { createCell(item, value, null, null); }
java
private void addCell(Listitem item, Object value) { createCell(item, value, null, null); }
[ "private", "void", "addCell", "(", "Listitem", "item", ",", "Object", "value", ")", "{", "createCell", "(", "item", ",", "value", ",", "null", ",", "null", ")", ";", "}" ]
Add a cell to the list item containing the specified text value. @param item List item to receive new cell. @param value Text to include in the new cell.
[ "Add", "a", "cell", "to", "the", "list", "item", "containing", "the", "specified", "text", "value", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.documents/src/main/java/org/carewebframework/vista/plugin/documents/DocumentListRenderer.java#L72-L74
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/security/CredentialReference.java
CredentialReference.getAttributeBuilder
public static ObjectTypeAttributeDefinition.Builder getAttributeBuilder(String name, String xmlName, boolean allowNull, CapabilityReferenceRecorder capabilityStoreReferenceRecorder) { if (capabilityStoreReferenceRecorder == null) { return getAttributeBuilder(name, xmlName, allowNull, false); } assert CREDENTIAL_STORE_CAPABILITY.equals(capabilityStoreReferenceRecorder.getBaseRequirementName()); AttributeDefinition csAttr = new SimpleAttributeDefinitionBuilder(credentialStoreAttribute) .setCapabilityReference(capabilityStoreReferenceRecorder) .build(); return getAttributeBuilder(name, xmlName, allowNull, csAttr); }
java
public static ObjectTypeAttributeDefinition.Builder getAttributeBuilder(String name, String xmlName, boolean allowNull, CapabilityReferenceRecorder capabilityStoreReferenceRecorder) { if (capabilityStoreReferenceRecorder == null) { return getAttributeBuilder(name, xmlName, allowNull, false); } assert CREDENTIAL_STORE_CAPABILITY.equals(capabilityStoreReferenceRecorder.getBaseRequirementName()); AttributeDefinition csAttr = new SimpleAttributeDefinitionBuilder(credentialStoreAttribute) .setCapabilityReference(capabilityStoreReferenceRecorder) .build(); return getAttributeBuilder(name, xmlName, allowNull, csAttr); }
[ "public", "static", "ObjectTypeAttributeDefinition", ".", "Builder", "getAttributeBuilder", "(", "String", "name", ",", "String", "xmlName", ",", "boolean", "allowNull", ",", "CapabilityReferenceRecorder", "capabilityStoreReferenceRecorder", ")", "{", "if", "(", "capabili...
Get an attribute builder for a credential-reference attribute with the specified characteristics, optionally configured to {@link org.jboss.as.controller.AbstractAttributeDefinitionBuilder#setCapabilityReference(CapabilityReferenceRecorder)} register a requirement} for a {@link #CREDENTIAL_STORE_CAPABILITY credential store capability}. @param name name of attribute @param xmlName name of xml element @param allowNull {@code false} if the attribute is required @param capabilityStoreReferenceRecorder a capability reference recorder that can record a requirement for the credential store referenced by the {@code store} field of the returned attribute definition. Can be {@code null}, in which case no requirement would be recorded. If not {@code null} the recorder's {@link CapabilityReferenceRecorder#getBaseRequirementName() base requirement name} must equal {@link #CREDENTIAL_STORE_CAPABILITY} @return an {@link ObjectTypeAttributeDefinition.Builder} which can be used to build attribute definition
[ "Get", "an", "attribute", "builder", "for", "a", "credential", "-", "reference", "attribute", "with", "the", "specified", "characteristics", "optionally", "configured", "to", "{", "@link", "org", ".", "jboss", ".", "as", ".", "controller", ".", "AbstractAttribut...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/security/CredentialReference.java#L243-L254
Sproutigy/Java-Commons-Binary
src/main/java/com/sproutigy/commons/binary/Binary.java
Binary.asBase64
public String asBase64() throws IOException { return asBase64(BaseEncoding.Dialect.STANDARD, BaseEncoding.Padding.STANDARD); }
java
public String asBase64() throws IOException { return asBase64(BaseEncoding.Dialect.STANDARD, BaseEncoding.Padding.STANDARD); }
[ "public", "String", "asBase64", "(", ")", "throws", "IOException", "{", "return", "asBase64", "(", "BaseEncoding", ".", "Dialect", ".", "STANDARD", ",", "BaseEncoding", ".", "Padding", ".", "STANDARD", ")", ";", "}" ]
Represent as Base 64 with standard dialect and standard padding @return Base 64 encoded string
[ "Represent", "as", "Base", "64", "with", "standard", "dialect", "and", "standard", "padding" ]
train
https://github.com/Sproutigy/Java-Commons-Binary/blob/547ab53d16e454d53ed5cef1d1ee514ec2d7c726/src/main/java/com/sproutigy/commons/binary/Binary.java#L316-L318
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.getSecurityPolicy
public GetSecurityPolicyResponse getSecurityPolicy(GetSecurityPolicyRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getName(), "The parameter name should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_SECURITY_POLICY, request.getName()); return invokeHttpClient(internalRequest, GetSecurityPolicyResponse.class); }
java
public GetSecurityPolicyResponse getSecurityPolicy(GetSecurityPolicyRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getName(), "The parameter name should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_SECURITY_POLICY, request.getName()); return invokeHttpClient(internalRequest, GetSecurityPolicyResponse.class); }
[ "public", "GetSecurityPolicyResponse", "getSecurityPolicy", "(", "GetSecurityPolicyRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getName", "(", ")",...
Get your live security policy by live security policy name. @param request The request object containing all parameters for getting live security policy. @return Your live security policy.
[ "Get", "your", "live", "security", "policy", "by", "live", "security", "policy", "name", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1267-L1275
google/error-prone-javac
src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java
ElementKindVisitor6.visitType
@Override public R visitType(TypeElement e, P p) { ElementKind k = e.getKind(); switch(k) { case ANNOTATION_TYPE: return visitTypeAsAnnotationType(e, p); case CLASS: return visitTypeAsClass(e, p); case ENUM: return visitTypeAsEnum(e, p); case INTERFACE: return visitTypeAsInterface(e, p); default: throw new AssertionError("Bad kind " + k + " for TypeElement" + e); } }
java
@Override public R visitType(TypeElement e, P p) { ElementKind k = e.getKind(); switch(k) { case ANNOTATION_TYPE: return visitTypeAsAnnotationType(e, p); case CLASS: return visitTypeAsClass(e, p); case ENUM: return visitTypeAsEnum(e, p); case INTERFACE: return visitTypeAsInterface(e, p); default: throw new AssertionError("Bad kind " + k + " for TypeElement" + e); } }
[ "@", "Override", "public", "R", "visitType", "(", "TypeElement", "e", ",", "P", "p", ")", "{", "ElementKind", "k", "=", "e", ".", "getKind", "(", ")", ";", "switch", "(", "k", ")", "{", "case", "ANNOTATION_TYPE", ":", "return", "visitTypeAsAnnotationType...
Visits a type element, dispatching to the visit method for the specific {@linkplain ElementKind kind} of type, {@code ANNOTATION_TYPE}, {@code CLASS}, {@code ENUM}, or {@code INTERFACE}. @param e {@inheritDoc} @param p {@inheritDoc} @return the result of the kind-specific visit method
[ "Visits", "a", "type", "element", "dispatching", "to", "the", "visit", "method", "for", "the", "specific", "{", "@linkplain", "ElementKind", "kind", "}", "of", "type", "{", "@code", "ANNOTATION_TYPE", "}", "{", "@code", "CLASS", "}", "{", "@code", "ENUM", ...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java#L137-L156
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java
PoolsImpl.getAllLifetimeStatisticsAsync
public Observable<PoolStatistics> getAllLifetimeStatisticsAsync(PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions) { return getAllLifetimeStatisticsWithServiceResponseAsync(poolGetAllLifetimeStatisticsOptions).map(new Func1<ServiceResponseWithHeaders<PoolStatistics, PoolGetAllLifetimeStatisticsHeaders>, PoolStatistics>() { @Override public PoolStatistics call(ServiceResponseWithHeaders<PoolStatistics, PoolGetAllLifetimeStatisticsHeaders> response) { return response.body(); } }); }
java
public Observable<PoolStatistics> getAllLifetimeStatisticsAsync(PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions) { return getAllLifetimeStatisticsWithServiceResponseAsync(poolGetAllLifetimeStatisticsOptions).map(new Func1<ServiceResponseWithHeaders<PoolStatistics, PoolGetAllLifetimeStatisticsHeaders>, PoolStatistics>() { @Override public PoolStatistics call(ServiceResponseWithHeaders<PoolStatistics, PoolGetAllLifetimeStatisticsHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PoolStatistics", ">", "getAllLifetimeStatisticsAsync", "(", "PoolGetAllLifetimeStatisticsOptions", "poolGetAllLifetimeStatisticsOptions", ")", "{", "return", "getAllLifetimeStatisticsWithServiceResponseAsync", "(", "poolGetAllLifetimeStatisticsOptions", ")...
Gets lifetime summary statistics for all of the pools in the specified account. Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. @param poolGetAllLifetimeStatisticsOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PoolStatistics object
[ "Gets", "lifetime", "summary", "statistics", "for", "all", "of", "the", "pools", "in", "the", "specified", "account", ".", "Statistics", "are", "aggregated", "across", "all", "pools", "that", "have", "ever", "existed", "in", "the", "account", "from", "account"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L590-L597
kazocsaba/imageviewer
src/main/java/hu/kazocsaba/imageviewer/PixelModel.java
PixelModel.set
public void set(int x, int y) { if (x<0 || y<0) { x=-1; y=-1; } if (this.x!=x || this.y!=y) { this.x=x; this.y=y; fireChange(); } }
java
public void set(int x, int y) { if (x<0 || y<0) { x=-1; y=-1; } if (this.x!=x || this.y!=y) { this.x=x; this.y=y; fireChange(); } }
[ "public", "void", "set", "(", "int", "x", ",", "int", "y", ")", "{", "if", "(", "x", "<", "0", "||", "y", "<", "0", ")", "{", "x", "=", "-", "1", ";", "y", "=", "-", "1", ";", "}", "if", "(", "this", ".", "x", "!=", "x", "||", "this",...
Changes the pixel stored in this model. If either coordinate is negative, the new value of the model will be (-1, -1). @param x the new x coordinate @param y the new y coordinate
[ "Changes", "the", "pixel", "stored", "in", "this", "model", ".", "If", "either", "coordinate", "is", "negative", "the", "new", "value", "of", "the", "model", "will", "be", "(", "-", "1", "-", "1", ")", "." ]
train
https://github.com/kazocsaba/imageviewer/blob/59b8834c9dbf87bd9ca0898da3458ae592e3851e/src/main/java/hu/kazocsaba/imageviewer/PixelModel.java#L52-L62
bwkimmel/java-util
src/main/java/ca/eandb/util/ByteArray.java
ByteArray.setAll
public void setAll(int index, Collection<? extends Byte> items) { rangeCheck(index, index + items.size()); for (byte e : items) { elements[index++] = e; } }
java
public void setAll(int index, Collection<? extends Byte> items) { rangeCheck(index, index + items.size()); for (byte e : items) { elements[index++] = e; } }
[ "public", "void", "setAll", "(", "int", "index", ",", "Collection", "<", "?", "extends", "Byte", ">", "items", ")", "{", "rangeCheck", "(", "index", ",", "index", "+", "items", ".", "size", "(", ")", ")", ";", "for", "(", "byte", "e", ":", "items",...
Sets a range of elements of this array. @param index The index of the first element to set. @param items The values to set. @throws IndexOutOfBoundsException if <code>index &lt; 0 || index + items.size() &gt; size()</code>.
[ "Sets", "a", "range", "of", "elements", "of", "this", "array", "." ]
train
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/ByteArray.java#L291-L296
Whiley/WhileyCompiler
src/main/java/wyc/io/WhileyFileParser.java
WhileyFileParser.parseReferenceType
private Type parseReferenceType(EnclosingScope scope) { int start = index; match(Ampersand); // Try to parse an annotated lifetime int backtrack = index; Identifier lifetimeIdentifier = parseOptionalLifetimeIdentifier(scope, false); if (lifetimeIdentifier != null) { // We cannot allow a newline after the colon, as it would // unintentionally match a return type that happens to be reference // type without lifetime annotation (return type in method signature // is always followed by colon and newline). if (tryAndMatch(true, Colon) != null && !isAtEOL()) { // Now we know that there is an annotated lifetime scope.mustBeLifetime(lifetimeIdentifier); Type element = parseArrayType(scope); Type type = new Type.Reference(element, lifetimeIdentifier); return annotateSourceLocation(type,start); } } index = backtrack; Type element = parseArrayType(scope); Type type = new Type.Reference(element); return annotateSourceLocation(type,start); }
java
private Type parseReferenceType(EnclosingScope scope) { int start = index; match(Ampersand); // Try to parse an annotated lifetime int backtrack = index; Identifier lifetimeIdentifier = parseOptionalLifetimeIdentifier(scope, false); if (lifetimeIdentifier != null) { // We cannot allow a newline after the colon, as it would // unintentionally match a return type that happens to be reference // type without lifetime annotation (return type in method signature // is always followed by colon and newline). if (tryAndMatch(true, Colon) != null && !isAtEOL()) { // Now we know that there is an annotated lifetime scope.mustBeLifetime(lifetimeIdentifier); Type element = parseArrayType(scope); Type type = new Type.Reference(element, lifetimeIdentifier); return annotateSourceLocation(type,start); } } index = backtrack; Type element = parseArrayType(scope); Type type = new Type.Reference(element); return annotateSourceLocation(type,start); }
[ "private", "Type", "parseReferenceType", "(", "EnclosingScope", "scope", ")", "{", "int", "start", "=", "index", ";", "match", "(", "Ampersand", ")", ";", "// Try to parse an annotated lifetime", "int", "backtrack", "=", "index", ";", "Identifier", "lifetimeIdentifi...
Parse a reference type, which is of the form: <pre> ReferenceType ::= '&' Type | '&' Lifetime ':' Type Lifetime ::= Identifier | 'this' | '*' </pre> @return
[ "Parse", "a", "reference", "type", "which", "is", "of", "the", "form", ":" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L3693-L3718
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.iterateCodePoints
public static void iterateCodePoints (@Nullable final String sInputString, @Nonnull final IntConsumer aConsumer) { ValueEnforcer.notNull (aConsumer, "Consumer"); if (sInputString != null) { final int nStringLength = sInputString.length (); int nOfs = 0; while (nOfs < nStringLength) { final int nCodePoint = sInputString.codePointAt (nOfs); nOfs += Character.charCount (nCodePoint); aConsumer.accept (nCodePoint); } } }
java
public static void iterateCodePoints (@Nullable final String sInputString, @Nonnull final IntConsumer aConsumer) { ValueEnforcer.notNull (aConsumer, "Consumer"); if (sInputString != null) { final int nStringLength = sInputString.length (); int nOfs = 0; while (nOfs < nStringLength) { final int nCodePoint = sInputString.codePointAt (nOfs); nOfs += Character.charCount (nCodePoint); aConsumer.accept (nCodePoint); } } }
[ "public", "static", "void", "iterateCodePoints", "(", "@", "Nullable", "final", "String", "sInputString", ",", "@", "Nonnull", "final", "IntConsumer", "aConsumer", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aConsumer", ",", "\"Consumer\"", ")", ";", "if", ...
Iterate all code points and pass them to the provided consumer. This implementation is approximately 20% quicker than <code>CharSequence.codePoints().forEachOrdered(c)</code> @param sInputString Input String to use. May be <code>null</code> or empty. @param aConsumer The consumer to be used. May not be <code>null</code>.
[ "Iterate", "all", "code", "points", "and", "pass", "them", "to", "the", "provided", "consumer", ".", "This", "implementation", "is", "approximately", "20%", "quicker", "than", "<code", ">", "CharSequence", ".", "codePoints", "()", ".", "forEachOrdered", "(", "...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L5247-L5263
landawn/AbacusUtil
src/com/landawn/abacus/util/ByteList.java
ByteList.anyMatch
public <E extends Exception> boolean anyMatch(Try.BytePredicate<E> filter) throws E { return anyMatch(0, size(), filter); }
java
public <E extends Exception> boolean anyMatch(Try.BytePredicate<E> filter) throws E { return anyMatch(0, size(), filter); }
[ "public", "<", "E", "extends", "Exception", ">", "boolean", "anyMatch", "(", "Try", ".", "BytePredicate", "<", "E", ">", "filter", ")", "throws", "E", "{", "return", "anyMatch", "(", "0", ",", "size", "(", ")", ",", "filter", ")", ";", "}" ]
Returns whether any elements of this List match the provided predicate. @param filter @return
[ "Returns", "whether", "any", "elements", "of", "this", "List", "match", "the", "provided", "predicate", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/ByteList.java#L947-L949
ops4j/org.ops4j.pax.logging
pax-logging-service/src/main/java/org/apache/log4j/rolling/RollingFileAppender.java
RollingFileAppender.createFileOutputStream
private FileOutputStream createFileOutputStream(String newFileName, boolean append) throws FileNotFoundException { try { // // attempt to create file // return new FileOutputStream(newFileName, append); } catch (FileNotFoundException ex) { // // if parent directory does not exist then // attempt to create it and try to create file // see bug 9150 // String parentName = new File(newFileName).getParent(); if (parentName != null) { File parentDir = new File(parentName); if (!parentDir.exists() && parentDir.mkdirs()) { return new FileOutputStream(newFileName, append); } else { throw ex; } } else { throw ex; } } }
java
private FileOutputStream createFileOutputStream(String newFileName, boolean append) throws FileNotFoundException { try { // // attempt to create file // return new FileOutputStream(newFileName, append); } catch (FileNotFoundException ex) { // // if parent directory does not exist then // attempt to create it and try to create file // see bug 9150 // String parentName = new File(newFileName).getParent(); if (parentName != null) { File parentDir = new File(parentName); if (!parentDir.exists() && parentDir.mkdirs()) { return new FileOutputStream(newFileName, append); } else { throw ex; } } else { throw ex; } } }
[ "private", "FileOutputStream", "createFileOutputStream", "(", "String", "newFileName", ",", "boolean", "append", ")", "throws", "FileNotFoundException", "{", "try", "{", "//", "// attempt to create file", "//", "return", "new", "FileOutputStream", "(", "newFileName", ...
Creates a new FileOutputStream of a new log file, possibly creating first all the needed parent directories @param newFileName Filename of new log file to be created @param append If file should be appended @return newly created FileOutputStream @throws FileNotFoundException if creating log file or parent directories was unsuccessful
[ "Creates", "a", "new", "FileOutputStream", "of", "a", "new", "log", "file", "possibly", "creating", "first", "all", "the", "needed", "parent", "directories" ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/rolling/RollingFileAppender.java#L350-L375
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.replaceFirst
public static String replaceFirst(final CharSequence self, final CharSequence regex, final @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) { return replaceFirst(self, Pattern.compile(regex.toString()), closure); }
java
public static String replaceFirst(final CharSequence self, final CharSequence regex, final @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) { return replaceFirst(self, Pattern.compile(regex.toString()), closure); }
[ "public", "static", "String", "replaceFirst", "(", "final", "CharSequence", "self", ",", "final", "CharSequence", "regex", ",", "final", "@", "ClosureParams", "(", "value", "=", "FromString", ".", "class", ",", "options", "=", "{", "\"List<String>\"", ",", "\"...
Replaces the first occurrence of a captured group by the result of a closure call on that text. <p> For example (with some replaceAll variants thrown in for comparison purposes), <pre> assert "hellO world" == "hello world".replaceFirst("(o)") { it[0].toUpperCase() } // first match assert "hellO wOrld" == "hello world".replaceAll("(o)") { it[0].toUpperCase() } // all matches assert '1-FISH, two fish' == "one fish, two fish".replaceFirst(/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() } assert '1-FISH, 2-FISH' == "one fish, two fish".replaceAll(/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() } </pre> @param self a CharSequence @param regex the capturing regex @param closure the closure to apply on the first captured group @return a CharSequence with replaced content @throws java.util.regex.PatternSyntaxException if the regular expression's syntax is invalid @see #replaceFirst(String, String, groovy.lang.Closure) @since 1.8.2
[ "Replaces", "the", "first", "occurrence", "of", "a", "captured", "group", "by", "the", "result", "of", "a", "closure", "call", "on", "that", "text", ".", "<p", ">", "For", "example", "(", "with", "some", "replaceAll", "variants", "thrown", "in", "for", "...
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2653-L2655
h2oai/h2o-3
h2o-core/src/main/java/jsr166y/LinkedTransferQueue.java
LinkedTransferQueue.spinsFor
private static int spinsFor(Node pred, boolean haveData) { if (MP && pred != null) { if (pred.isData != haveData) // phase change return FRONT_SPINS + CHAINED_SPINS; if (pred.isMatched()) // probably at front return FRONT_SPINS; if (pred.waiter == null) // pred apparently spinning return CHAINED_SPINS; } return 0; }
java
private static int spinsFor(Node pred, boolean haveData) { if (MP && pred != null) { if (pred.isData != haveData) // phase change return FRONT_SPINS + CHAINED_SPINS; if (pred.isMatched()) // probably at front return FRONT_SPINS; if (pred.waiter == null) // pred apparently spinning return CHAINED_SPINS; } return 0; }
[ "private", "static", "int", "spinsFor", "(", "Node", "pred", ",", "boolean", "haveData", ")", "{", "if", "(", "MP", "&&", "pred", "!=", "null", ")", "{", "if", "(", "pred", ".", "isData", "!=", "haveData", ")", "// phase change", "return", "FRONT_SPINS",...
Returns spin/yield value for a node with given predecessor and data mode. See above for explanation.
[ "Returns", "spin", "/", "yield", "value", "for", "a", "node", "with", "given", "predecessor", "and", "data", "mode", ".", "See", "above", "for", "explanation", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/jsr166y/LinkedTransferQueue.java#L715-L725
ujmp/universal-java-matrix-package
ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java
Ginv.canSwapRows
public static boolean canSwapRows(Matrix matrix, int row1, int row2, int col1) { boolean response = true; for (int col = 0; col < col1; ++col) { if (0 == matrix.getAsDouble(row1, col)) { if (0 != matrix.getAsDouble(row2, col)) { response = false; break; } } } return response; }
java
public static boolean canSwapRows(Matrix matrix, int row1, int row2, int col1) { boolean response = true; for (int col = 0; col < col1; ++col) { if (0 == matrix.getAsDouble(row1, col)) { if (0 != matrix.getAsDouble(row2, col)) { response = false; break; } } } return response; }
[ "public", "static", "boolean", "canSwapRows", "(", "Matrix", "matrix", ",", "int", "row1", ",", "int", "row2", ",", "int", "col1", ")", "{", "boolean", "response", "=", "true", ";", "for", "(", "int", "col", "=", "0", ";", "col", "<", "col1", ";", ...
Check to see if a non-zero and a zero value in the rows leading up to this column can be swapped. This is part of the bandwidth reduction algorithm. @param matrix the matrix to check @param row1 the first row @param row2 the second row @param col1 the column @return true if the rows can be swapped
[ "Check", "to", "see", "if", "a", "non", "-", "zero", "and", "a", "zero", "value", "in", "the", "rows", "leading", "up", "to", "this", "column", "can", "be", "swapped", ".", "This", "is", "part", "of", "the", "bandwidth", "reduction", "algorithm", "." ]
train
https://github.com/ujmp/universal-java-matrix-package/blob/b7e1d293adeadaf35d208ffe8884028d6c06b63b/ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java#L865-L876
spotify/apollo
apollo-api-impl/src/main/java/com/spotify/apollo/request/RequestHandlerImpl.java
RequestHandlerImpl.handleEndpointMatch
private void handleEndpointMatch(OngoingRequest request, RuleMatch<Endpoint> match) { final Endpoint endpoint = match.getRule().getTarget(); final Map<String, String> parsedPathArguments = match.parsedPathArguments(); final Client requestScopedClient = client.wrapRequest(request.request()); final RequestContext requestContext = RequestContexts.create(request.request(), requestScopedClient, parsedPathArguments, request.arrivalTimeNanos(), request.metadata()); erf.create(request, requestContext, endpoint) .run(); }
java
private void handleEndpointMatch(OngoingRequest request, RuleMatch<Endpoint> match) { final Endpoint endpoint = match.getRule().getTarget(); final Map<String, String> parsedPathArguments = match.parsedPathArguments(); final Client requestScopedClient = client.wrapRequest(request.request()); final RequestContext requestContext = RequestContexts.create(request.request(), requestScopedClient, parsedPathArguments, request.arrivalTimeNanos(), request.metadata()); erf.create(request, requestContext, endpoint) .run(); }
[ "private", "void", "handleEndpointMatch", "(", "OngoingRequest", "request", ",", "RuleMatch", "<", "Endpoint", ">", "match", ")", "{", "final", "Endpoint", "endpoint", "=", "match", ".", "getRule", "(", ")", ".", "getTarget", "(", ")", ";", "final", "Map", ...
Continuation for the {@link RequestRunnableFactory} @param request request being processed @param match the match that was made
[ "Continuation", "for", "the", "{", "@link", "RequestRunnableFactory", "}" ]
train
https://github.com/spotify/apollo/blob/3aba09840538a2aff9cdac5be42cc114dd276c70/apollo-api-impl/src/main/java/com/spotify/apollo/request/RequestHandlerImpl.java#L83-L96
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/query/QueryImpl.java
QueryImpl.addToRelationStack
protected void addToRelationStack(Map<Object, Object> relationStack, Object entity, EntityMetadata m) { Object obj = entity; if (entity instanceof EnhanceEntity) { obj = ((EnhanceEntity) entity).getEntity(); } relationStack.put(obj.getClass().getCanonicalName() + "#" + PropertyAccessorHelper.getId(obj, m), obj); }
java
protected void addToRelationStack(Map<Object, Object> relationStack, Object entity, EntityMetadata m) { Object obj = entity; if (entity instanceof EnhanceEntity) { obj = ((EnhanceEntity) entity).getEntity(); } relationStack.put(obj.getClass().getCanonicalName() + "#" + PropertyAccessorHelper.getId(obj, m), obj); }
[ "protected", "void", "addToRelationStack", "(", "Map", "<", "Object", ",", "Object", ">", "relationStack", ",", "Object", "entity", ",", "EntityMetadata", "m", ")", "{", "Object", "obj", "=", "entity", ";", "if", "(", "entity", "instanceof", "EnhanceEntity", ...
Adds the to relation stack. @param relationStack the relation stack @param entity the entity @param m the m
[ "Adds", "the", "to", "relation", "stack", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/query/QueryImpl.java#L267-L276
jblas-project/jblas
src/main/java/org/jblas/ComplexFloat.java
ComplexFloat.muli
public ComplexFloat muli(ComplexFloat c, ComplexFloat result) { float newR = r * c.r - i * c.i; float newI = r * c.i + i * c.r; result.r = newR; result.i = newI; return result; }
java
public ComplexFloat muli(ComplexFloat c, ComplexFloat result) { float newR = r * c.r - i * c.i; float newI = r * c.i + i * c.r; result.r = newR; result.i = newI; return result; }
[ "public", "ComplexFloat", "muli", "(", "ComplexFloat", "c", ",", "ComplexFloat", "result", ")", "{", "float", "newR", "=", "r", "*", "c", ".", "r", "-", "i", "*", "c", ".", "i", ";", "float", "newI", "=", "r", "*", "c", ".", "i", "+", "i", "*",...
Multiply two complex numbers, in-place @param c other complex number @param result complex number where product is stored @return same as result
[ "Multiply", "two", "complex", "numbers", "in", "-", "place" ]
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/ComplexFloat.java#L226-L232
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.getOrGenerateMatchLabel
public static String getOrGenerateMatchLabel(QuerySolution row, boolean operationDiscovery) { String label; if (operationDiscovery) { label = getOrGenerateOperationLabel(row); } else { label = getOrGenerateServiceLabel(row); } return label; }
java
public static String getOrGenerateMatchLabel(QuerySolution row, boolean operationDiscovery) { String label; if (operationDiscovery) { label = getOrGenerateOperationLabel(row); } else { label = getOrGenerateServiceLabel(row); } return label; }
[ "public", "static", "String", "getOrGenerateMatchLabel", "(", "QuerySolution", "row", ",", "boolean", "operationDiscovery", ")", "{", "String", "label", ";", "if", "(", "operationDiscovery", ")", "{", "label", "=", "getOrGenerateOperationLabel", "(", "row", ")", "...
Obtain or generate a label for the match result given a row resulting from a query. @param row the result from a SPARQL query @param operationDiscovery true if we are doing operation discovery @return
[ "Obtain", "or", "generate", "a", "label", "for", "the", "match", "result", "given", "a", "row", "resulting", "from", "a", "query", "." ]
train
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L639-L647
cdk/cdk
legacy/src/main/java/org/openscience/cdk/normalize/SMSDNormalizer.java
SMSDNormalizer.getImplicitHydrogenCount
public static int getImplicitHydrogenCount(IAtomContainer atomContainer, IAtom atom) { return atom.getImplicitHydrogenCount() == CDKConstants.UNSET ? 0 : atom.getImplicitHydrogenCount(); }
java
public static int getImplicitHydrogenCount(IAtomContainer atomContainer, IAtom atom) { return atom.getImplicitHydrogenCount() == CDKConstants.UNSET ? 0 : atom.getImplicitHydrogenCount(); }
[ "public", "static", "int", "getImplicitHydrogenCount", "(", "IAtomContainer", "atomContainer", ",", "IAtom", "atom", ")", "{", "return", "atom", ".", "getImplicitHydrogenCount", "(", ")", "==", "CDKConstants", ".", "UNSET", "?", "0", ":", "atom", ".", "getImplic...
Returns The number of Implicit Hydrogen Count for a given IAtom. @param atomContainer @param atom @return Implicit Hydrogen Count
[ "Returns", "The", "number", "of", "Implicit", "Hydrogen", "Count", "for", "a", "given", "IAtom", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/normalize/SMSDNormalizer.java#L203-L205
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/StringUtil.java
StringUtil.equalsIgnoreCaseOrValueIsWildcard
public static boolean equalsIgnoreCaseOrValueIsWildcard(final String value, final String toCheck) { if (value == null && toCheck == null) { return true; } if (value != null && StringUtil.WILDCARD.equals(value)) { return true; } if (value != null && toCheck != null) { return value.equalsIgnoreCase(toCheck); } return false; }
java
public static boolean equalsIgnoreCaseOrValueIsWildcard(final String value, final String toCheck) { if (value == null && toCheck == null) { return true; } if (value != null && StringUtil.WILDCARD.equals(value)) { return true; } if (value != null && toCheck != null) { return value.equalsIgnoreCase(toCheck); } return false; }
[ "public", "static", "boolean", "equalsIgnoreCaseOrValueIsWildcard", "(", "final", "String", "value", ",", "final", "String", "toCheck", ")", "{", "if", "(", "value", "==", "null", "&&", "toCheck", "==", "null", ")", "{", "return", "true", ";", "}", "if", "...
Does equalsIgnoreCase call but if the value is '*', immediately returns true.
[ "Does", "equalsIgnoreCase", "call", "but", "if", "the", "value", "is", "*", "immediately", "returns", "true", "." ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L577-L588
alkacon/opencms-core
src/org/opencms/util/CmsMacroResolver.java
CmsMacroResolver.localizedKeyMacro
public static String localizedKeyMacro(String keyName, Object[] params) { String parameters = ""; if ((params != null) && (params.length > 0)) { for (int i = 0; i < params.length; i++) { if (params[i] != null) { parameters += "|" + params[i].toString(); } } } return "" + I_CmsMacroResolver.MACRO_DELIMITER + I_CmsMacroResolver.MACRO_START + CmsMacroResolver.KEY_LOCALIZED_PREFIX + keyName + parameters + I_CmsMacroResolver.MACRO_END; }
java
public static String localizedKeyMacro(String keyName, Object[] params) { String parameters = ""; if ((params != null) && (params.length > 0)) { for (int i = 0; i < params.length; i++) { if (params[i] != null) { parameters += "|" + params[i].toString(); } } } return "" + I_CmsMacroResolver.MACRO_DELIMITER + I_CmsMacroResolver.MACRO_START + CmsMacroResolver.KEY_LOCALIZED_PREFIX + keyName + parameters + I_CmsMacroResolver.MACRO_END; }
[ "public", "static", "String", "localizedKeyMacro", "(", "String", "keyName", ",", "Object", "[", "]", "params", ")", "{", "String", "parameters", "=", "\"\"", ";", "if", "(", "(", "params", "!=", "null", ")", "&&", "(", "params", ".", "length", ">", "0...
Returns a macro for the given localization key with the given parameters.<p> @param keyName the name of the localized key @param params the optional parameter array @return a macro for the given localization key with the given parameters
[ "Returns", "a", "macro", "for", "the", "given", "localization", "key", "with", "the", "given", "parameters", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsMacroResolver.java#L462-L479
indeedeng/util
util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java
Quicksortables.med3
private static int med3(Quicksortable q, int a, int b, int c) { return (q.compare(a, b) < 0 ? (q.compare(b, c) < 0 ? b : q.compare(a, c) < 0 ? c : a) : (q.compare(b, c) > 0 ? b : q.compare(a, c) > 0 ? c : a)); }
java
private static int med3(Quicksortable q, int a, int b, int c) { return (q.compare(a, b) < 0 ? (q.compare(b, c) < 0 ? b : q.compare(a, c) < 0 ? c : a) : (q.compare(b, c) > 0 ? b : q.compare(a, c) > 0 ? c : a)); }
[ "private", "static", "int", "med3", "(", "Quicksortable", "q", ",", "int", "a", ",", "int", "b", ",", "int", "c", ")", "{", "return", "(", "q", ".", "compare", "(", "a", ",", "b", ")", "<", "0", "?", "(", "q", ".", "compare", "(", "b", ",", ...
/* Returns the index of the median of the three indexed integers.
[ "/", "*", "Returns", "the", "index", "of", "the", "median", "of", "the", "three", "indexed", "integers", "." ]
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L229-L233
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java
DateFormatSymbols.setQuarters
public void setQuarters(String[] newQuarters, int context, int width) { switch (context) { case FORMAT : switch(width) { case WIDE : quarters = duplicate(newQuarters); break; case ABBREVIATED : shortQuarters = duplicate(newQuarters); break; case NARROW : //narrowQuarters = duplicate(newQuarters); break; default : // HANDLE SHORT, etc. break; } break; case STANDALONE : switch(width) { case WIDE : standaloneQuarters = duplicate(newQuarters); break; case ABBREVIATED : standaloneShortQuarters = duplicate(newQuarters); break; case NARROW : //standaloneNarrowQuarters = duplicate(newQuarters); break; default : // HANDLE SHORT, etc. break; } break; } }
java
public void setQuarters(String[] newQuarters, int context, int width) { switch (context) { case FORMAT : switch(width) { case WIDE : quarters = duplicate(newQuarters); break; case ABBREVIATED : shortQuarters = duplicate(newQuarters); break; case NARROW : //narrowQuarters = duplicate(newQuarters); break; default : // HANDLE SHORT, etc. break; } break; case STANDALONE : switch(width) { case WIDE : standaloneQuarters = duplicate(newQuarters); break; case ABBREVIATED : standaloneShortQuarters = duplicate(newQuarters); break; case NARROW : //standaloneNarrowQuarters = duplicate(newQuarters); break; default : // HANDLE SHORT, etc. break; } break; } }
[ "public", "void", "setQuarters", "(", "String", "[", "]", "newQuarters", ",", "int", "context", ",", "int", "width", ")", "{", "switch", "(", "context", ")", "{", "case", "FORMAT", ":", "switch", "(", "width", ")", "{", "case", "WIDE", ":", "quarters",...
<strong>[icu]</strong> Sets quarter strings. For example: "1st Quarter", "2nd Quarter", etc. @param newQuarters the new quarter strings. @param context The formatting context, FORMAT or STANDALONE. @param width The width of the quarter string, either WIDE or ABBREVIATED. There are no NARROW quarters.
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Sets", "quarter", "strings", ".", "For", "example", ":", "1st", "Quarter", "2nd", "Quarter", "etc", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java#L1063-L1096
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java
ClientFactory.acceptSessionFromEntityPath
public static IMessageSession acceptSessionFromEntityPath(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings) throws InterruptedException, ServiceBusException { return Utils.completeFuture(acceptSessionFromEntityPathAsync(namespaceName, entityPath, sessionId, clientSettings)); }
java
public static IMessageSession acceptSessionFromEntityPath(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings) throws InterruptedException, ServiceBusException { return Utils.completeFuture(acceptSessionFromEntityPathAsync(namespaceName, entityPath, sessionId, clientSettings)); }
[ "public", "static", "IMessageSession", "acceptSessionFromEntityPath", "(", "String", "namespaceName", ",", "String", "entityPath", ",", "String", "sessionId", ",", "ClientSettings", "clientSettings", ")", "throws", "InterruptedException", ",", "ServiceBusException", "{", ...
Accept a {@link IMessageSession} from service bus using the client settings with specified session id in PeekLock mode. Session Id can be null, if null, service will return the first available session. @param namespaceName namespace of entity @param entityPath path of entity @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session @param clientSettings client settings @return IMessageSession instance @throws InterruptedException if the current thread was interrupted while waiting @throws ServiceBusException if the session cannot be accepted
[ "Accept", "a", "{" ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L540-L542
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java
DocumentImpl.cloneOrImportNode
Node cloneOrImportNode(short operation, Node node, boolean deep) { NodeImpl copy = shallowCopy(operation, node); if (deep) { NodeList list = node.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { copy.appendChild(cloneOrImportNode(operation, list.item(i), deep)); } } notifyUserDataHandlers(operation, node, copy); return copy; }
java
Node cloneOrImportNode(short operation, Node node, boolean deep) { NodeImpl copy = shallowCopy(operation, node); if (deep) { NodeList list = node.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { copy.appendChild(cloneOrImportNode(operation, list.item(i), deep)); } } notifyUserDataHandlers(operation, node, copy); return copy; }
[ "Node", "cloneOrImportNode", "(", "short", "operation", ",", "Node", "node", ",", "boolean", "deep", ")", "{", "NodeImpl", "copy", "=", "shallowCopy", "(", "operation", ",", "node", ")", ";", "if", "(", "deep", ")", "{", "NodeList", "list", "=", "node", ...
Returns a copy of the given node or subtree with this document as its owner. @param operation either {@link UserDataHandler#NODE_CLONED} or {@link UserDataHandler#NODE_IMPORTED}. @param node a node belonging to any document or DOM implementation. @param deep true to recursively copy any child nodes; false to do no such copying and return a node with no children.
[ "Returns", "a", "copy", "of", "the", "given", "node", "or", "subtree", "with", "this", "document", "as", "its", "owner", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java#L219-L231
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java
IntegralImageOps.block_zero
public static int block_zero(GrayS32 integral , int x0 , int y0 , int x1 , int y1 ) { return ImplIntegralImageOps.block_zero(integral,x0,y0,x1,y1); }
java
public static int block_zero(GrayS32 integral , int x0 , int y0 , int x1 , int y1 ) { return ImplIntegralImageOps.block_zero(integral,x0,y0,x1,y1); }
[ "public", "static", "int", "block_zero", "(", "GrayS32", "integral", ",", "int", "x0", ",", "int", "y0", ",", "int", "x1", ",", "int", "y1", ")", "{", "return", "ImplIntegralImageOps", ".", "block_zero", "(", "integral", ",", "x0", ",", "y0", ",", "x1"...
<p> Computes the value of a block inside an integral image and treats pixels outside of the image as zero. The block is defined as follows: x0 &lt; x &le; x1 and y0 &lt; y &le; y1. </p> @param integral Integral image. @param x0 Lower bound of the block. Exclusive. @param y0 Lower bound of the block. Exclusive. @param x1 Upper bound of the block. Inclusive. @param y1 Upper bound of the block. Inclusive. @return Value inside the block.
[ "<p", ">", "Computes", "the", "value", "of", "a", "block", "inside", "an", "integral", "image", "and", "treats", "pixels", "outside", "of", "the", "image", "as", "zero", ".", "The", "block", "is", "defined", "as", "follows", ":", "x0", "&lt", ";", "x",...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java#L480-L483
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslWithProvider.java
PactDslWithProvider.uponReceiving
public PactDslRequestWithoutPath uponReceiving(String description) { return new PactDslWithState(consumerPactBuilder, consumerPactBuilder.getConsumerName(), providerName, defaultRequestValues, defaultResponseValues) .uponReceiving(description); }
java
public PactDslRequestWithoutPath uponReceiving(String description) { return new PactDslWithState(consumerPactBuilder, consumerPactBuilder.getConsumerName(), providerName, defaultRequestValues, defaultResponseValues) .uponReceiving(description); }
[ "public", "PactDslRequestWithoutPath", "uponReceiving", "(", "String", "description", ")", "{", "return", "new", "PactDslWithState", "(", "consumerPactBuilder", ",", "consumerPactBuilder", ".", "getConsumerName", "(", ")", ",", "providerName", ",", "defaultRequestValues",...
Description of the request that is expected to be received @param description request description
[ "Description", "of", "the", "request", "that", "is", "expected", "to", "be", "received" ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslWithProvider.java#L71-L75
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/trace/TraceOptions.java
TraceOptions.copyBytesTo
public void copyBytesTo(byte[] dest, int destOffset) { Utils.checkIndex(destOffset, dest.length); dest[destOffset] = options; }
java
public void copyBytesTo(byte[] dest, int destOffset) { Utils.checkIndex(destOffset, dest.length); dest[destOffset] = options; }
[ "public", "void", "copyBytesTo", "(", "byte", "[", "]", "dest", ",", "int", "destOffset", ")", "{", "Utils", ".", "checkIndex", "(", "destOffset", ",", "dest", ".", "length", ")", ";", "dest", "[", "destOffset", "]", "=", "options", ";", "}" ]
Copies the byte representations of the {@code TraceOptions} into the {@code dest} beginning at the {@code destOffset} offset. <p>Equivalent with (but faster because it avoids any new allocations): <pre>{@code System.arraycopy(getBytes(), 0, dest, destOffset, TraceOptions.SIZE); }</pre> @param dest the destination buffer. @param destOffset the starting offset in the destination buffer. @throws NullPointerException if {@code dest} is null. @throws IndexOutOfBoundsException if {@code destOffset+TraceOptions.SIZE} is greater than {@code dest.length}. @since 0.5
[ "Copies", "the", "byte", "representations", "of", "the", "{", "@code", "TraceOptions", "}", "into", "the", "{", "@code", "dest", "}", "beginning", "at", "the", "{", "@code", "destOffset", "}", "offset", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/TraceOptions.java#L176-L179
jMetal/jMetal
jmetal-core/src/main/java/org/uma/jmetal/util/neighborhood/util/TwoDimensionalMesh.java
TwoDimensionalMesh.getNeighbor
private int getNeighbor(int solution, int [] neighbor) { int row = getRow(solution) ; int col = getColumn((solution)) ; int r ; int c ; r = (row + neighbor[0]) % this.rows ; if (r < 0) r = rows - 1; c = (col + neighbor[1]) % this.columns ; if (c < 0) c = columns - 1 ; return this.mesh[r][c]; }
java
private int getNeighbor(int solution, int [] neighbor) { int row = getRow(solution) ; int col = getColumn((solution)) ; int r ; int c ; r = (row + neighbor[0]) % this.rows ; if (r < 0) r = rows - 1; c = (col + neighbor[1]) % this.columns ; if (c < 0) c = columns - 1 ; return this.mesh[r][c]; }
[ "private", "int", "getNeighbor", "(", "int", "solution", ",", "int", "[", "]", "neighbor", ")", "{", "int", "row", "=", "getRow", "(", "solution", ")", ";", "int", "col", "=", "getColumn", "(", "(", "solution", ")", ")", ";", "int", "r", ";", "int"...
Returns the neighbor of solution @param solution Represents the location of the solution @param neighbor Represents the neighbor we want to get as a shift of solution. The first component represents the shift on rows, and the second the shift on column @return
[ "Returns", "the", "neighbor", "of", "solution" ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/util/neighborhood/util/TwoDimensionalMesh.java#L77-L93
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/helpers/POJOHelper.java
POJOHelper.setCommonJSONElements
private static OrderedJSONObject setCommonJSONElements(OrderedJSONObject obj, Object representation, String description) { obj.put("Representation", representation); obj.put("Description", description); return obj; }
java
private static OrderedJSONObject setCommonJSONElements(OrderedJSONObject obj, Object representation, String description) { obj.put("Representation", representation); obj.put("Description", description); return obj; }
[ "private", "static", "OrderedJSONObject", "setCommonJSONElements", "(", "OrderedJSONObject", "obj", ",", "Object", "representation", ",", "String", "description", ")", "{", "obj", ".", "put", "(", "\"Representation\"", ",", "representation", ")", ";", "obj", ".", ...
Sets common structure to JSON objects { "Representation": "string", "Description": "For a leaf (primitive, BigInteger/Decimal, Date, etc.)" } @param OrderedJSONObject objects to be added here @param representation Value of representation element @param description Value of description @return OrderedJSONObject
[ "Sets", "common", "structure", "to", "JSON", "objects", "{", "Representation", ":", "string", "Description", ":", "For", "a", "leaf", "(", "primitive", "BigInteger", "/", "Decimal", "Date", "etc", ".", ")", "}" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/helpers/POJOHelper.java#L236-L241
reactor/reactor-netty
src/main/java/reactor/netty/channel/BootstrapHandlers.java
BootstrapHandlers.finalizeHandler
public static void finalizeHandler(Bootstrap b, ChannelOperations.OnSetup opsFactory, ConnectionObserver listener) { Objects.requireNonNull(b, "bootstrap"); Objects.requireNonNull(listener, "listener"); BootstrapPipelineHandler pipeline = null; ChannelHandler handler = b.config().handler(); if (handler instanceof BootstrapPipelineHandler){ pipeline = (BootstrapPipelineHandler) handler; } if (pipeline != null) { PipelineConfiguration pipelineConfiguration; for (int i = 0; i < pipeline.size(); i++) { pipelineConfiguration = pipeline.get(i); if (pipelineConfiguration.deferredConsumer != null) { pipeline.set(i, new PipelineConfiguration( pipelineConfiguration.deferredConsumer.apply(b), pipelineConfiguration.name)); } } } b.handler(new BootstrapInitializerHandler(pipeline, opsFactory, listener)); }
java
public static void finalizeHandler(Bootstrap b, ChannelOperations.OnSetup opsFactory, ConnectionObserver listener) { Objects.requireNonNull(b, "bootstrap"); Objects.requireNonNull(listener, "listener"); BootstrapPipelineHandler pipeline = null; ChannelHandler handler = b.config().handler(); if (handler instanceof BootstrapPipelineHandler){ pipeline = (BootstrapPipelineHandler) handler; } if (pipeline != null) { PipelineConfiguration pipelineConfiguration; for (int i = 0; i < pipeline.size(); i++) { pipelineConfiguration = pipeline.get(i); if (pipelineConfiguration.deferredConsumer != null) { pipeline.set(i, new PipelineConfiguration( pipelineConfiguration.deferredConsumer.apply(b), pipelineConfiguration.name)); } } } b.handler(new BootstrapInitializerHandler(pipeline, opsFactory, listener)); }
[ "public", "static", "void", "finalizeHandler", "(", "Bootstrap", "b", ",", "ChannelOperations", ".", "OnSetup", "opsFactory", ",", "ConnectionObserver", "listener", ")", "{", "Objects", ".", "requireNonNull", "(", "b", ",", "\"bootstrap\"", ")", ";", "Objects", ...
Finalize a bootstrap pipeline configuration by turning it into a {@link ChannelInitializer} to safely initialize each child channel. @param b a bootstrap @param opsFactory an operation factory @param listener a connection observer
[ "Finalize", "a", "bootstrap", "pipeline", "configuration", "by", "turning", "it", "into", "a", "{", "@link", "ChannelInitializer", "}", "to", "safely", "initialize", "each", "child", "channel", "." ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/channel/BootstrapHandlers.java#L101-L128
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java
SqlGeneratorDefaultImpl.getInsertMNStatement
public String getInsertMNStatement(String table, String[] pkColumns1, String[] pkColumns2) { SqlStatement sql; String result; String[] cols = new String[pkColumns1.length + pkColumns2.length]; System.arraycopy(pkColumns1, 0, cols, 0, pkColumns1.length); System.arraycopy(pkColumns2, 0, cols, pkColumns1.length, pkColumns2.length); sql = new SqlInsertMNStatement(table, cols, logger); result = sql.getStatement(); if (logger.isDebugEnabled()) { logger.debug("SQL:" + result); } return result; }
java
public String getInsertMNStatement(String table, String[] pkColumns1, String[] pkColumns2) { SqlStatement sql; String result; String[] cols = new String[pkColumns1.length + pkColumns2.length]; System.arraycopy(pkColumns1, 0, cols, 0, pkColumns1.length); System.arraycopy(pkColumns2, 0, cols, pkColumns1.length, pkColumns2.length); sql = new SqlInsertMNStatement(table, cols, logger); result = sql.getStatement(); if (logger.isDebugEnabled()) { logger.debug("SQL:" + result); } return result; }
[ "public", "String", "getInsertMNStatement", "(", "String", "table", ",", "String", "[", "]", "pkColumns1", ",", "String", "[", "]", "pkColumns2", ")", "{", "SqlStatement", "sql", ";", "String", "result", ";", "String", "[", "]", "cols", "=", "new", "String...
generate an INSERT-Statement for M:N indirection table @param table @param pkColumns1 @param pkColumns2
[ "generate", "an", "INSERT", "-", "Statement", "for", "M", ":", "N", "indirection", "table" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java#L235-L252
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/ClassUtils.java
ClassUtils.getSimpleName
public static String getSimpleName(final Class<?> cls, String valueIfNull) { return cls == null ? valueIfNull : cls.getSimpleName(); }
java
public static String getSimpleName(final Class<?> cls, String valueIfNull) { return cls == null ? valueIfNull : cls.getSimpleName(); }
[ "public", "static", "String", "getSimpleName", "(", "final", "Class", "<", "?", ">", "cls", ",", "String", "valueIfNull", ")", "{", "return", "cls", "==", "null", "?", "valueIfNull", ":", "cls", ".", "getSimpleName", "(", ")", ";", "}" ]
<p>Null-safe version of <code>aClass.getSimpleName()</code></p> @param cls the class for which to get the simple name; may be null @param valueIfNull the value to return if null @return the simple class name or {@code valueIfNull} @since 3.0 @see Class#getSimpleName()
[ "<p", ">", "Null", "-", "safe", "version", "of", "<code", ">", "aClass", ".", "getSimpleName", "()", "<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassUtils.java#L266-L268
voldemort/voldemort
src/java/voldemort/server/protocol/admin/AsyncOperationService.java
AsyncOperationService.isComplete
public synchronized boolean isComplete(int requestId, boolean remove) { if (!operations.containsKey(requestId)) throw new VoldemortException("No operation with id " + requestId + " found"); if (operations.get(requestId).getStatus().isComplete()) { if (logger.isDebugEnabled()) logger.debug("Operation complete " + requestId); if (remove) operations.remove(requestId); return true; } return false; }
java
public synchronized boolean isComplete(int requestId, boolean remove) { if (!operations.containsKey(requestId)) throw new VoldemortException("No operation with id " + requestId + " found"); if (operations.get(requestId).getStatus().isComplete()) { if (logger.isDebugEnabled()) logger.debug("Operation complete " + requestId); if (remove) operations.remove(requestId); return true; } return false; }
[ "public", "synchronized", "boolean", "isComplete", "(", "int", "requestId", ",", "boolean", "remove", ")", "{", "if", "(", "!", "operations", ".", "containsKey", "(", "requestId", ")", ")", "throw", "new", "VoldemortException", "(", "\"No operation with id \"", ...
Check if the an operation is done or not. @param requestId Id of the request @param remove Whether remove the request out of the list if it is done. @return True if request is complete, false otherwise
[ "Check", "if", "the", "an", "operation", "is", "done", "or", "not", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/AsyncOperationService.java#L85-L100
facebookarchive/hadoop-20
src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/HadoopLogParser.java
HadoopLogParser.parseLine
public EventRecord parseLine(String line) throws IOException { EventRecord retval = null; if (line != null) { // process line String patternStr = "(" + dateformat + ")"; patternStr += "\\s+"; patternStr += "(" + timeformat + ")"; patternStr += ".{4}\\s(\\w*)\\s"; // for logLevel patternStr += "\\s*([\\w+\\.?]+)"; // for source patternStr += ":\\s+(.+)"; // for the message Pattern pattern = Pattern.compile(patternStr); Matcher matcher = pattern.matcher(line); if (matcher.find(0) && matcher.groupCount() >= 5) { retval = new EventRecord(hostname, ips, parseDate(matcher.group(1), matcher.group(2)), "HadoopLog", matcher.group(3), // loglevel matcher.group(4), // source matcher.group(5)); // message } else { retval = new EventRecord(); } } return retval; }
java
public EventRecord parseLine(String line) throws IOException { EventRecord retval = null; if (line != null) { // process line String patternStr = "(" + dateformat + ")"; patternStr += "\\s+"; patternStr += "(" + timeformat + ")"; patternStr += ".{4}\\s(\\w*)\\s"; // for logLevel patternStr += "\\s*([\\w+\\.?]+)"; // for source patternStr += ":\\s+(.+)"; // for the message Pattern pattern = Pattern.compile(patternStr); Matcher matcher = pattern.matcher(line); if (matcher.find(0) && matcher.groupCount() >= 5) { retval = new EventRecord(hostname, ips, parseDate(matcher.group(1), matcher.group(2)), "HadoopLog", matcher.group(3), // loglevel matcher.group(4), // source matcher.group(5)); // message } else { retval = new EventRecord(); } } return retval; }
[ "public", "EventRecord", "parseLine", "(", "String", "line", ")", "throws", "IOException", "{", "EventRecord", "retval", "=", "null", ";", "if", "(", "line", "!=", "null", ")", "{", "// process line", "String", "patternStr", "=", "\"(\"", "+", "dateformat", ...
Parses one line of the log. If the line contains a valid log entry, then an appropriate EventRecord is returned, after all relevant fields have been parsed. @param line the log line to be parsed @return the EventRecord representing the log entry of the line. If the line does not contain a valid log entry, then the EventRecord returned has isValid() = false. When the end-of-file has been reached, null is returned to the caller.
[ "Parses", "one", "line", "of", "the", "log", ".", "If", "the", "line", "contains", "a", "valid", "log", "entry", "then", "an", "appropriate", "EventRecord", "is", "returned", "after", "all", "relevant", "fields", "have", "been", "parsed", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/HadoopLogParser.java#L60-L87
JavaMoney/jsr354-ri-bp
src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryRoundingsSingletonSpi.java
BaseMonetaryRoundingsSingletonSpi.isRoundingAvailable
public boolean isRoundingAvailable(CurrencyUnit currencyUnit, String... providers) { return isRoundingAvailable(RoundingQueryBuilder.of().setProviderNames(providers).setCurrency(currencyUnit).build()); }
java
public boolean isRoundingAvailable(CurrencyUnit currencyUnit, String... providers) { return isRoundingAvailable(RoundingQueryBuilder.of().setProviderNames(providers).setCurrency(currencyUnit).build()); }
[ "public", "boolean", "isRoundingAvailable", "(", "CurrencyUnit", "currencyUnit", ",", "String", "...", "providers", ")", "{", "return", "isRoundingAvailable", "(", "RoundingQueryBuilder", ".", "of", "(", ")", ".", "setProviderNames", "(", "providers", ")", ".", "s...
Checks if a {@link javax.money.MonetaryRounding} is available given a {@link javax.money.CurrencyUnit}. @param currencyUnit The currency, which determines the required precision. As {@link java.math.RoundingMode}, by default, {@link java.math.RoundingMode#HALF_UP} is used. @param providers the providers and ordering to be used. By default providers and ordering as defined in #getDefaultProviders is used. @return true, if a corresponding {@link javax.money.MonetaryRounding} is available. @throws IllegalArgumentException if no such rounding is registered using a {@link javax.money.spi.RoundingProviderSpi} instance.
[ "Checks", "if", "a", "{", "@link", "javax", ".", "money", ".", "MonetaryRounding", "}", "is", "available", "given", "a", "{", "@link", "javax", ".", "money", ".", "CurrencyUnit", "}", "." ]
train
https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryRoundingsSingletonSpi.java#L127-L129
frostwire/frostwire-jlibtorrent
src/main/java/com/frostwire/jlibtorrent/FileStorage.java
FileStorage.mapBlock
public ArrayList<FileSlice> mapBlock(int piece, long offset, int size) { return mapBlock(fs.map_block(piece, offset, size)); }
java
public ArrayList<FileSlice> mapBlock(int piece, long offset, int size) { return mapBlock(fs.map_block(piece, offset, size)); }
[ "public", "ArrayList", "<", "FileSlice", ">", "mapBlock", "(", "int", "piece", ",", "long", "offset", ",", "int", "size", ")", "{", "return", "mapBlock", "(", "fs", ".", "map_block", "(", "piece", ",", "offset", ",", "size", ")", ")", ";", "}" ]
Returns a list of {@link com.frostwire.jlibtorrent.FileSlice} objects representing the portions of files the specified piece index, byte offset and size range overlaps. <p> This is the inverse mapping of {@link #mapFile(int, long, int)}. @param piece @param offset @param size @return
[ "Returns", "a", "list", "of", "{", "@link", "com", ".", "frostwire", ".", "jlibtorrent", ".", "FileSlice", "}", "objects", "representing", "the", "portions", "of", "files", "the", "specified", "piece", "index", "byte", "offset", "and", "size", "range", "over...
train
https://github.com/frostwire/frostwire-jlibtorrent/blob/a29249a940d34aba8c4677d238b472ef01833506/src/main/java/com/frostwire/jlibtorrent/FileStorage.java#L193-L195
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.summarizeForResourceGroupLevelPolicyAssignment
public SummarizeResultsInner summarizeForResourceGroupLevelPolicyAssignment(String subscriptionId, String resourceGroupName, String policyAssignmentName) { return summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).toBlocking().single().body(); }
java
public SummarizeResultsInner summarizeForResourceGroupLevelPolicyAssignment(String subscriptionId, String resourceGroupName, String policyAssignmentName) { return summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).toBlocking().single().body(); }
[ "public", "SummarizeResultsInner", "summarizeForResourceGroupLevelPolicyAssignment", "(", "String", "subscriptionId", ",", "String", "resourceGroupName", ",", "String", "policyAssignmentName", ")", "{", "return", "summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync",...
Summarizes policy states for the resource group level policy assignment. @param subscriptionId Microsoft Azure subscription ID. @param resourceGroupName Resource group name. @param policyAssignmentName Policy assignment name. @throws IllegalArgumentException thrown if parameters fail the validation @throws QueryFailureException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SummarizeResultsInner object if successful.
[ "Summarizes", "policy", "states", "for", "the", "resource", "group", "level", "policy", "assignment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L3109-L3111
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FileUtil.java
FileUtil.slurp
public static String slurp(InputStream is) throws IOException { StringBuilder buf = new StringBuilder(); final byte[] b = new byte[4096]; for(int n; (n = is.read(b)) != -1;) { buf.append(new String(b, 0, n)); } is.close(); return buf.toString(); }
java
public static String slurp(InputStream is) throws IOException { StringBuilder buf = new StringBuilder(); final byte[] b = new byte[4096]; for(int n; (n = is.read(b)) != -1;) { buf.append(new String(b, 0, n)); } is.close(); return buf.toString(); }
[ "public", "static", "String", "slurp", "(", "InputStream", "is", ")", "throws", "IOException", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "final", "byte", "[", "]", "b", "=", "new", "byte", "[", "4096", "]", ";", "for", "(...
Load an input stream (e.g., a Java resource) into a String buffer. The stream is closed afterwards. @param is Input stream @return String with file/resource contents. @throws IOException on IO errors
[ "Load", "an", "input", "stream", "(", "e", ".", "g", ".", "a", "Java", "resource", ")", "into", "a", "String", "buffer", ".", "The", "stream", "is", "closed", "afterwards", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FileUtil.java#L195-L203
milaboratory/milib
src/main/java/com/milaboratory/core/io/util/IOUtil.java
IOUtil.readRawVarint32
public static int readRawVarint32(final InputStream is, int eofVaule) throws IOException { int result = 0; int shift = 0; for (; shift < 32; shift += 7) { final int b = is.read(); if (b == -1) if (shift == 0) return eofVaule; else throw new IOException("Malformed Varint"); result |= (b & 0x7f) << shift; if ((b & 0x80) == 0) return result; } throw new IOException("Malformed Varint"); }
java
public static int readRawVarint32(final InputStream is, int eofVaule) throws IOException { int result = 0; int shift = 0; for (; shift < 32; shift += 7) { final int b = is.read(); if (b == -1) if (shift == 0) return eofVaule; else throw new IOException("Malformed Varint"); result |= (b & 0x7f) << shift; if ((b & 0x80) == 0) return result; } throw new IOException("Malformed Varint"); }
[ "public", "static", "int", "readRawVarint32", "(", "final", "InputStream", "is", ",", "int", "eofVaule", ")", "throws", "IOException", "{", "int", "result", "=", "0", ";", "int", "shift", "=", "0", ";", "for", "(", ";", "shift", "<", "32", ";", "shift"...
Read a raw Varint from the stream. <p>Based on com.google.protobuf.CodedInputStream class from Google's protobuf library.</p>
[ "Read", "a", "raw", "Varint", "from", "the", "stream", "." ]
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/io/util/IOUtil.java#L34-L51
Erudika/para
para-server/src/main/java/com/erudika/para/persistence/AWSDynamoUtils.java
AWSDynamoUtils.fromRow
protected static <P extends ParaObject> P fromRow(Map<String, AttributeValue> row) { if (row == null || row.isEmpty()) { return null; } Map<String, Object> props = new HashMap<>(); for (Map.Entry<String, AttributeValue> col : row.entrySet()) { props.put(col.getKey(), col.getValue().getS()); } props.put(Config._VERSION, row.getOrDefault(Config._VERSION, new AttributeValue().withN("0")).getN()); return ParaObjectUtils.setAnnotatedFields(props); }
java
protected static <P extends ParaObject> P fromRow(Map<String, AttributeValue> row) { if (row == null || row.isEmpty()) { return null; } Map<String, Object> props = new HashMap<>(); for (Map.Entry<String, AttributeValue> col : row.entrySet()) { props.put(col.getKey(), col.getValue().getS()); } props.put(Config._VERSION, row.getOrDefault(Config._VERSION, new AttributeValue().withN("0")).getN()); return ParaObjectUtils.setAnnotatedFields(props); }
[ "protected", "static", "<", "P", "extends", "ParaObject", ">", "P", "fromRow", "(", "Map", "<", "String", ",", "AttributeValue", ">", "row", ")", "{", "if", "(", "row", "==", "null", "||", "row", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ...
Converts a DynamoDB row to a {@link ParaObject}. @param <P> type of object @param row a DynamoDB row @return a populated Para object.
[ "Converts", "a", "DynamoDB", "row", "to", "a", "{" ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/persistence/AWSDynamoUtils.java#L399-L409
hellosign/hellosign-java-sdk
src/main/java/com/hellosign/sdk/HelloSignClient.java
HelloSignClient.updateTemplateFiles
public String updateTemplateFiles(String existingTemplateId, TemplateDraft newTemplate, String clientId) throws HelloSignException { String url = BASE_URI + TEMPLATE_UPDATE_FILES_URI + "/" + existingTemplateId; HttpClient client = httpClient.withAuth(auth).withPostFields(newTemplate.getPostFields()); if (clientId != null) { client = client.withPostField(EmbeddedRequest.EMBEDDED_CLIENT_ID, clientId); } Template t = new Template(client.post(url).asJson()); return t.getId(); }
java
public String updateTemplateFiles(String existingTemplateId, TemplateDraft newTemplate, String clientId) throws HelloSignException { String url = BASE_URI + TEMPLATE_UPDATE_FILES_URI + "/" + existingTemplateId; HttpClient client = httpClient.withAuth(auth).withPostFields(newTemplate.getPostFields()); if (clientId != null) { client = client.withPostField(EmbeddedRequest.EMBEDDED_CLIENT_ID, clientId); } Template t = new Template(client.post(url).asJson()); return t.getId(); }
[ "public", "String", "updateTemplateFiles", "(", "String", "existingTemplateId", ",", "TemplateDraft", "newTemplate", ",", "String", "clientId", ")", "throws", "HelloSignException", "{", "String", "url", "=", "BASE_URI", "+", "TEMPLATE_UPDATE_FILES_URI", "+", "\"/\"", ...
Replaces the backing documents for the given template with the given files. Note that certain rules apply to this endpoint: https://app.hellosign.com/api/reference#update_template_files @param existingTemplateId String ID of the template from which the overlay data (signatures, text fields, etc.) will be retrieved. @param newTemplate TemplateDraft that holds the data and documents which will be used as the basis for the new template. The following fields can be set in this request: files or file_urls, subject, message, and test_mode. @param clientId String optional ID of the app which is generating this new template. Set to null if not used. @return String ID of the template to be created @throws HelloSignException thrown if there is a problem processing the HTTP request
[ "Replaces", "the", "backing", "documents", "for", "the", "given", "template", "with", "the", "given", "files", "." ]
train
https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/HelloSignClient.java#L660-L669
guardtime/ksi-java-sdk
ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java
ContextAwarePolicyAdapter.createPublicationsFilePolicy
public static ContextAwarePolicy createPublicationsFilePolicy(PublicationsHandler handler, Extender extender) { Util.notNull(handler, "Publications handler"); PolicyContext context = new PolicyContext(handler, extender != null ? extender.getExtendingService() : null); return new ContextAwarePolicyAdapter(new PublicationsFileBasedVerificationPolicy(), context); }
java
public static ContextAwarePolicy createPublicationsFilePolicy(PublicationsHandler handler, Extender extender) { Util.notNull(handler, "Publications handler"); PolicyContext context = new PolicyContext(handler, extender != null ? extender.getExtendingService() : null); return new ContextAwarePolicyAdapter(new PublicationsFileBasedVerificationPolicy(), context); }
[ "public", "static", "ContextAwarePolicy", "createPublicationsFilePolicy", "(", "PublicationsHandler", "handler", ",", "Extender", "extender", ")", "{", "Util", ".", "notNull", "(", "handler", ",", "\"Publications handler\"", ")", ";", "PolicyContext", "context", "=", ...
Creates context aware policy using {@link PublicationsFileBasedVerificationPolicy} for verification. If extender is provided, then extending is allowed while verifying signature. @param handler Publications handler. @param extender Extender. @return Publications file based verification policy with suitable context.
[ "Creates", "context", "aware", "policy", "using", "{", "@link", "PublicationsFileBasedVerificationPolicy", "}", "for", "verification", ".", "If", "extender", "is", "provided", "then", "extending", "is", "allowed", "while", "verifying", "signature", "." ]
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java#L86-L90
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java
DateSpinner.setMinDate
public void setMinDate(@Nullable Calendar minDate) { this.minDate = minDate; // update the date picker (even if it is not used right now) if(minDate == null) datePickerDialog.setMinDate(MINIMUM_POSSIBLE_DATE); else if(maxDate != null && compareCalendarDates(minDate, maxDate) > 0) throw new IllegalArgumentException("Minimum date must be before maximum date!"); else datePickerDialog.setMinDate(new CalendarDay(minDate)); updateEnabledItems(); }
java
public void setMinDate(@Nullable Calendar minDate) { this.minDate = minDate; // update the date picker (even if it is not used right now) if(minDate == null) datePickerDialog.setMinDate(MINIMUM_POSSIBLE_DATE); else if(maxDate != null && compareCalendarDates(minDate, maxDate) > 0) throw new IllegalArgumentException("Minimum date must be before maximum date!"); else datePickerDialog.setMinDate(new CalendarDay(minDate)); updateEnabledItems(); }
[ "public", "void", "setMinDate", "(", "@", "Nullable", "Calendar", "minDate", ")", "{", "this", ".", "minDate", "=", "minDate", ";", "// update the date picker (even if it is not used right now)", "if", "(", "minDate", "==", "null", ")", "datePickerDialog", ".", "set...
Sets the minimum allowed date. Spinner items and dates in the date picker before the given date will get disabled. @param minDate The minimum date, or null to clear the previous min date.
[ "Sets", "the", "minimum", "allowed", "date", ".", "Spinner", "items", "and", "dates", "in", "the", "date", "picker", "before", "the", "given", "date", "will", "get", "disabled", "." ]
train
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java#L359-L369
hellosign/hellosign-java-sdk
src/main/java/com/hellosign/sdk/resource/SignatureRequest.java
SignatureRequest.getSignatureBySigner
public Signature getSignatureBySigner(String email, String name) { if (email == null || name == null) { return null; } for (Signature s : getSignatures()) { if (name.equalsIgnoreCase(s.getName()) && email.equalsIgnoreCase(s.getEmail())) { return s; } } return null; }
java
public Signature getSignatureBySigner(String email, String name) { if (email == null || name == null) { return null; } for (Signature s : getSignatures()) { if (name.equalsIgnoreCase(s.getName()) && email.equalsIgnoreCase(s.getEmail())) { return s; } } return null; }
[ "public", "Signature", "getSignatureBySigner", "(", "String", "email", ",", "String", "name", ")", "{", "if", "(", "email", "==", "null", "||", "name", "==", "null", ")", "{", "return", "null", ";", "}", "for", "(", "Signature", "s", ":", "getSignatures"...
Utility method that allows you to search for a Signature object on this request by email and name. It requires both because neither alone is enough to guarantee uniqueness (some requests can have multiple signers using the same email address or name). @param email String @param name String @return Signature, if found on this request, or null @deprecated Use getSignature(email, name)
[ "Utility", "method", "that", "allows", "you", "to", "search", "for", "a", "Signature", "object", "on", "this", "request", "by", "email", "and", "name", ".", "It", "requires", "both", "because", "neither", "alone", "is", "enough", "to", "guarantee", "uniquene...
train
https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/resource/SignatureRequest.java#L252-L262
MenoData/Time4J
base/src/main/java/net/time4j/tz/model/GregorianTimezoneRule.java
GregorianTimezoneRule.ofFixedDay
public static GregorianTimezoneRule ofFixedDay( Month month, int dayOfMonth, PlainTime timeOfDay, OffsetIndicator indicator, int savings ) { return ofFixedDay(month, dayOfMonth, timeOfDay.getInt(PlainTime.SECOND_OF_DAY), indicator, savings); }
java
public static GregorianTimezoneRule ofFixedDay( Month month, int dayOfMonth, PlainTime timeOfDay, OffsetIndicator indicator, int savings ) { return ofFixedDay(month, dayOfMonth, timeOfDay.getInt(PlainTime.SECOND_OF_DAY), indicator, savings); }
[ "public", "static", "GregorianTimezoneRule", "ofFixedDay", "(", "Month", "month", ",", "int", "dayOfMonth", ",", "PlainTime", "timeOfDay", ",", "OffsetIndicator", "indicator", ",", "int", "savings", ")", "{", "return", "ofFixedDay", "(", "month", ",", "dayOfMonth"...
/*[deutsch] <p>Konstruiert ein Muster f&uuml;r einen festen Tag im angegebenen Monat. </p> @param month calendar month @param dayOfMonth day of month (1 - 31) @param timeOfDay clock time when time switch happens @param indicator offset indicator @param savings fixed DST-offset in seconds @return new daylight saving rule @throws IllegalArgumentException if the last argument is out of range or if the day of month is not valid in context of given month @since 2.2
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Konstruiert", "ein", "Muster", "f&uuml", ";", "r", "einen", "festen", "Tag", "im", "angegebenen", "Monat", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/tz/model/GregorianTimezoneRule.java#L127-L137
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator._generate
protected void _generate(SarlBehavior behavior, IExtraLanguageGeneratorContext context) { final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(behavior); final PyAppendable appendable = createAppendable(jvmType, context); final List<JvmTypeReference> superTypes; if (behavior.getExtends() != null) { superTypes = Collections.singletonList(behavior.getExtends()); } else { superTypes = Collections.singletonList(getTypeReferences().getTypeForName(Behavior.class, behavior)); } final String qualifiedName = this.qualifiedNameProvider.getFullyQualifiedName(behavior).toString(); if (generateTypeDeclaration( qualifiedName, behavior.getName(), behavior.isAbstract(), superTypes, getTypeBuilder().getDocumentation(behavior), true, behavior.getMembers(), appendable, context, (it, context2) -> { generateGuardEvaluators(qualifiedName, it, context2); })) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(behavior); writeFile(name, appendable, context); } }
java
protected void _generate(SarlBehavior behavior, IExtraLanguageGeneratorContext context) { final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(behavior); final PyAppendable appendable = createAppendable(jvmType, context); final List<JvmTypeReference> superTypes; if (behavior.getExtends() != null) { superTypes = Collections.singletonList(behavior.getExtends()); } else { superTypes = Collections.singletonList(getTypeReferences().getTypeForName(Behavior.class, behavior)); } final String qualifiedName = this.qualifiedNameProvider.getFullyQualifiedName(behavior).toString(); if (generateTypeDeclaration( qualifiedName, behavior.getName(), behavior.isAbstract(), superTypes, getTypeBuilder().getDocumentation(behavior), true, behavior.getMembers(), appendable, context, (it, context2) -> { generateGuardEvaluators(qualifiedName, it, context2); })) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(behavior); writeFile(name, appendable, context); } }
[ "protected", "void", "_generate", "(", "SarlBehavior", "behavior", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "final", "JvmDeclaredType", "jvmType", "=", "getJvmModelAssociations", "(", ")", ".", "getInferredType", "(", "behavior", ")", ";", "final", ...
Generate the given object. @param behavior the behavior. @param context the context.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L797-L818
podio/podio-java
src/main/java/com/podio/status/StatusAPI.java
StatusAPI.createStatus
public int createStatus(int spaceId, StatusCreate status) { return getResourceFactory() .getApiResource("/status/space/" + spaceId + "/") .entity(status, MediaType.APPLICATION_JSON_TYPE) .post(StatusCreateResponse.class).getId(); }
java
public int createStatus(int spaceId, StatusCreate status) { return getResourceFactory() .getApiResource("/status/space/" + spaceId + "/") .entity(status, MediaType.APPLICATION_JSON_TYPE) .post(StatusCreateResponse.class).getId(); }
[ "public", "int", "createStatus", "(", "int", "spaceId", ",", "StatusCreate", "status", ")", "{", "return", "getResourceFactory", "(", ")", ".", "getApiResource", "(", "\"/status/space/\"", "+", "spaceId", "+", "\"/\"", ")", ".", "entity", "(", "status", ",", ...
Creates a new status message for a user on a specific space. A status update is simply a short text message that the user wishes to share with the rest of the space. @param status The data for the new status message @return The id of the newly created status message
[ "Creates", "a", "new", "status", "message", "for", "a", "user", "on", "a", "specific", "space", ".", "A", "status", "update", "is", "simply", "a", "short", "text", "message", "that", "the", "user", "wishes", "to", "share", "with", "the", "rest", "of", ...
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/status/StatusAPI.java#L32-L37
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java
CmsGalleryControllerHandler.onUpdateCategoriesTree
public void onUpdateCategoriesTree(List<CmsCategoryTreeEntry> categoryTreeEntry, List<String> selectedCategories) { m_galleryDialog.getCategoriesTab().updateContentTree(categoryTreeEntry, selectedCategories); }
java
public void onUpdateCategoriesTree(List<CmsCategoryTreeEntry> categoryTreeEntry, List<String> selectedCategories) { m_galleryDialog.getCategoriesTab().updateContentTree(categoryTreeEntry, selectedCategories); }
[ "public", "void", "onUpdateCategoriesTree", "(", "List", "<", "CmsCategoryTreeEntry", ">", "categoryTreeEntry", ",", "List", "<", "String", ">", "selectedCategories", ")", "{", "m_galleryDialog", ".", "getCategoriesTab", "(", ")", ".", "updateContentTree", "(", "cat...
Will be triggered when the tree is selected.<p> @param categoryTreeEntry the category root entry @param selectedCategories the selected categories
[ "Will", "be", "triggered", "when", "the", "tree", "is", "selected", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java#L374-L377
sarl/sarl
docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java
Utils.isDefaultValuedParameter
public static boolean isDefaultValuedParameter(Parameter param, SarlConfiguration configuration) { final AnnotationDesc annotation = Utils.findFirst(param.annotations(), it -> qualifiedNameEquals(it.annotationType().qualifiedTypeName(), getKeywords().getDefaultValueAnnnotationName())); return annotation != null; }
java
public static boolean isDefaultValuedParameter(Parameter param, SarlConfiguration configuration) { final AnnotationDesc annotation = Utils.findFirst(param.annotations(), it -> qualifiedNameEquals(it.annotationType().qualifiedTypeName(), getKeywords().getDefaultValueAnnnotationName())); return annotation != null; }
[ "public", "static", "boolean", "isDefaultValuedParameter", "(", "Parameter", "param", ",", "SarlConfiguration", "configuration", ")", "{", "final", "AnnotationDesc", "annotation", "=", "Utils", ".", "findFirst", "(", "param", ".", "annotations", "(", ")", ",", "it...
Replies the default value of the given parameter. @param param the parameter. @param configuration the configuration. @return the default value or {@code null}.
[ "Replies", "the", "default", "value", "of", "the", "given", "parameter", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java#L253-L257
baratine/baratine
kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java
UpgradeScanner10.addLeaf
private void addLeaf(Segment10 segment, int pid, int nextPid, int address, int length) { Page10 page = _pageMap.get(pid); if (page != null && page.sequence() < segment.sequence()) { return; } page = new Page10(PageType10.LEAF, segment, pid, nextPid, address, length); _pageMap.put(pid, page); }
java
private void addLeaf(Segment10 segment, int pid, int nextPid, int address, int length) { Page10 page = _pageMap.get(pid); if (page != null && page.sequence() < segment.sequence()) { return; } page = new Page10(PageType10.LEAF, segment, pid, nextPid, address, length); _pageMap.put(pid, page); }
[ "private", "void", "addLeaf", "(", "Segment10", "segment", ",", "int", "pid", ",", "int", "nextPid", ",", "int", "address", ",", "int", "length", ")", "{", "Page10", "page", "=", "_pageMap", ".", "get", "(", "pid", ")", ";", "if", "(", "page", "!=", ...
Adds a new leaf entry to the page list. Because pages are added in order, each new page overrides the older one.
[ "Adds", "a", "new", "leaf", "entry", "to", "the", "page", "list", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L481-L496
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
DfuBaseService.openInputStream
private InputStream openInputStream(final int resId, final String mimeType, final int mbrSize, final int types) throws IOException { final InputStream is = getResources().openRawResource(resId); if (MIME_TYPE_ZIP.equals(mimeType)) return new ArchiveInputStream(is, mbrSize, types); is.mark(2); int firstByte = is.read(); is.reset(); if (firstByte == ':') return new HexInputStream(is, mbrSize); return is; }
java
private InputStream openInputStream(final int resId, final String mimeType, final int mbrSize, final int types) throws IOException { final InputStream is = getResources().openRawResource(resId); if (MIME_TYPE_ZIP.equals(mimeType)) return new ArchiveInputStream(is, mbrSize, types); is.mark(2); int firstByte = is.read(); is.reset(); if (firstByte == ':') return new HexInputStream(is, mbrSize); return is; }
[ "private", "InputStream", "openInputStream", "(", "final", "int", "resId", ",", "final", "String", "mimeType", ",", "final", "int", "mbrSize", ",", "final", "int", "types", ")", "throws", "IOException", "{", "final", "InputStream", "is", "=", "getResources", "...
Opens the binary input stream that returns the firmware image content. A resource id in the res/raw is given. @param resId the if of the resource file. @param mimeType the file type. @param mbrSize the size of MBR, by default 0x1000. @param types the content files types in ZIP. @return The input stream with binary image content.
[ "Opens", "the", "binary", "input", "stream", "that", "returns", "the", "firmware", "image", "content", ".", "A", "resource", "id", "in", "the", "res", "/", "raw", "is", "given", "." ]
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1466-L1477
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.evaluateTypeTransformations
private Map<TemplateType, JSType> evaluateTypeTransformations( ImmutableList<TemplateType> templateTypes, Map<TemplateType, JSType> inferredTypes, FlowScope scope) { Map<String, JSType> typeVars = null; Map<TemplateType, JSType> result = null; TypeTransformation ttlObj = null; for (TemplateType type : templateTypes) { if (type.isTypeTransformation()) { // Lazy initialization when the first type transformation is found if (ttlObj == null) { ttlObj = new TypeTransformation(compiler, scope.getDeclarationScope()); typeVars = buildTypeVariables(inferredTypes); result = new LinkedHashMap<>(); } // Evaluate the type transformation expression using the current // known types for the template type variables JSType transformedType = ttlObj.eval( type.getTypeTransformation(), ImmutableMap.copyOf(typeVars)); result.put(type, transformedType); // Add the transformed type to the type variables typeVars.put(type.getReferenceName(), transformedType); } } return result; }
java
private Map<TemplateType, JSType> evaluateTypeTransformations( ImmutableList<TemplateType> templateTypes, Map<TemplateType, JSType> inferredTypes, FlowScope scope) { Map<String, JSType> typeVars = null; Map<TemplateType, JSType> result = null; TypeTransformation ttlObj = null; for (TemplateType type : templateTypes) { if (type.isTypeTransformation()) { // Lazy initialization when the first type transformation is found if (ttlObj == null) { ttlObj = new TypeTransformation(compiler, scope.getDeclarationScope()); typeVars = buildTypeVariables(inferredTypes); result = new LinkedHashMap<>(); } // Evaluate the type transformation expression using the current // known types for the template type variables JSType transformedType = ttlObj.eval( type.getTypeTransformation(), ImmutableMap.copyOf(typeVars)); result.put(type, transformedType); // Add the transformed type to the type variables typeVars.put(type.getReferenceName(), transformedType); } } return result; }
[ "private", "Map", "<", "TemplateType", ",", "JSType", ">", "evaluateTypeTransformations", "(", "ImmutableList", "<", "TemplateType", ">", "templateTypes", ",", "Map", "<", "TemplateType", ",", "JSType", ">", "inferredTypes", ",", "FlowScope", "scope", ")", "{", ...
This function will evaluate the type transformations associated to the template types
[ "This", "function", "will", "evaluate", "the", "type", "transformations", "associated", "to", "the", "template", "types" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L2005-L2033
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java
StyleUtils.setFeatureStyle
public static boolean setFeatureStyle(MarkerOptions markerOptions, GeoPackage geoPackage, FeatureRow featureRow, float density) { return setFeatureStyle(markerOptions, geoPackage, featureRow, density, null); }
java
public static boolean setFeatureStyle(MarkerOptions markerOptions, GeoPackage geoPackage, FeatureRow featureRow, float density) { return setFeatureStyle(markerOptions, geoPackage, featureRow, density, null); }
[ "public", "static", "boolean", "setFeatureStyle", "(", "MarkerOptions", "markerOptions", ",", "GeoPackage", "geoPackage", ",", "FeatureRow", "featureRow", ",", "float", "density", ")", "{", "return", "setFeatureStyle", "(", "markerOptions", ",", "geoPackage", ",", "...
Set the feature row style (icon or style) into the marker options @param markerOptions marker options @param geoPackage GeoPackage @param featureRow feature row @param density display density: {@link android.util.DisplayMetrics#density} @return true if icon or style was set into the marker options
[ "Set", "the", "feature", "row", "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#L65-L67
camunda/camunda-bpm-camel
camunda-bpm-camel-common/src/main/java/org/camunda/bpm/camel/component/externaltasks/BatchConsumer.java
BatchConsumer.removeExcessiveInProgressTasks
protected void removeExcessiveInProgressTasks(Queue<Exchange> exchanges, int limit) { while (exchanges.size() > limit) { // must remove last Exchange exchange = exchanges.poll(); releaseTask(exchange); } }
java
protected void removeExcessiveInProgressTasks(Queue<Exchange> exchanges, int limit) { while (exchanges.size() > limit) { // must remove last Exchange exchange = exchanges.poll(); releaseTask(exchange); } }
[ "protected", "void", "removeExcessiveInProgressTasks", "(", "Queue", "<", "Exchange", ">", "exchanges", ",", "int", "limit", ")", "{", "while", "(", "exchanges", ".", "size", "(", ")", ">", "limit", ")", "{", "// must remove last", "Exchange", "exchange", "=",...
Drain any in progress files as we are done with this batch @param exchanges the exchanges @param limit the limit
[ "Drain", "any", "in", "progress", "files", "as", "we", "are", "done", "with", "this", "batch" ]
train
https://github.com/camunda/camunda-bpm-camel/blob/224cd7563430f8792287022923ee27491f5a4b60/camunda-bpm-camel-common/src/main/java/org/camunda/bpm/camel/component/externaltasks/BatchConsumer.java#L177-L185
FaritorKang/unmz-common-util
src/main/java/net/unmz/java/util/security/RSAUtils.java
RSAUtils.verify
public static boolean verify(byte[] data, String publicKey, String sign) throws Exception { String keyBytes = Base64Utils.encode(publicKey); X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes.getBytes()); KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); PublicKey publicK = keyFactory.generatePublic(keySpec); Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); signature.initVerify(publicK); signature.update(data); return signature.verify(Base64Utils.decode(sign).getBytes()); }
java
public static boolean verify(byte[] data, String publicKey, String sign) throws Exception { String keyBytes = Base64Utils.encode(publicKey); X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes.getBytes()); KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); PublicKey publicK = keyFactory.generatePublic(keySpec); Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); signature.initVerify(publicK); signature.update(data); return signature.verify(Base64Utils.decode(sign).getBytes()); }
[ "public", "static", "boolean", "verify", "(", "byte", "[", "]", "data", ",", "String", "publicKey", ",", "String", "sign", ")", "throws", "Exception", "{", "String", "keyBytes", "=", "Base64Utils", ".", "encode", "(", "publicKey", ")", ";", "X509EncodedKeySp...
<p> 校验数字签名 </p> @param data 已加密数据 @param publicKey 公钥(BASE64编码) @param sign 数字签名 @return @throws Exception
[ "<p", ">", "校验数字签名", "<", "/", "p", ">" ]
train
https://github.com/FaritorKang/unmz-common-util/blob/2912b8889b85ed910d536f85b24b6fa68035814a/src/main/java/net/unmz/java/util/security/RSAUtils.java#L111-L120
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectExactCardinalityImpl_CustomFieldSerializer.java
OWLObjectExactCardinalityImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectExactCardinalityImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectExactCardinalityImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLObjectExactCardinalityImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectExactCardinalityImpl_CustomFieldSerializer.java#L95-L98
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/JavaBean.java
JavaBean.getCollectionProperties
public static Collection<Object> getCollectionProperties(Collection<?> collection,String name) throws Exception { if(collection == null) throw new IllegalArgumentException("collection, name"); ArrayList<Object> list = new ArrayList<Object>(collection.size()); for (Object bean : collection) { list.add(getNestedProperty(bean, name)); } return list; }
java
public static Collection<Object> getCollectionProperties(Collection<?> collection,String name) throws Exception { if(collection == null) throw new IllegalArgumentException("collection, name"); ArrayList<Object> list = new ArrayList<Object>(collection.size()); for (Object bean : collection) { list.add(getNestedProperty(bean, name)); } return list; }
[ "public", "static", "Collection", "<", "Object", ">", "getCollectionProperties", "(", "Collection", "<", "?", ">", "collection", ",", "String", "name", ")", "throws", "Exception", "{", "if", "(", "collection", "==", "null", ")", "throw", "new", "IllegalArgumen...
Retrieve the list of properties that exists in a given collection @param collection the collection of object @param name the name of property @return collection of objects @throws Exception when an unknown error occurs
[ "Retrieve", "the", "list", "of", "properties", "that", "exists", "in", "a", "given", "collection" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/JavaBean.java#L565-L579
Netflix/conductor
grpc-client/src/main/java/com/netflix/conductor/client/grpc/TaskClient.java
TaskClient.removeTaskFromQueue
public void removeTaskFromQueue(String taskType, String taskId) { Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank"); Preconditions.checkArgument(StringUtils.isNotBlank(taskId), "Task id cannot be blank"); stub.removeTaskFromQueue( TaskServicePb.RemoveTaskRequest.newBuilder() .setTaskType(taskType) .setTaskId(taskId) .build() ); }
java
public void removeTaskFromQueue(String taskType, String taskId) { Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank"); Preconditions.checkArgument(StringUtils.isNotBlank(taskId), "Task id cannot be blank"); stub.removeTaskFromQueue( TaskServicePb.RemoveTaskRequest.newBuilder() .setTaskType(taskType) .setTaskId(taskId) .build() ); }
[ "public", "void", "removeTaskFromQueue", "(", "String", "taskType", ",", "String", "taskId", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "taskType", ")", ",", "\"Task type cannot be blank\"", ")", ";", "Preconditions"...
Removes a task from a taskType queue @param taskType the taskType to identify the queue @param taskId the id of the task to be removed
[ "Removes", "a", "task", "from", "a", "taskType", "queue" ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/grpc-client/src/main/java/com/netflix/conductor/client/grpc/TaskClient.java#L222-L231
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/channelfw/objectpool/TwoTierObjectPool.java
TwoTierObjectPool.getThreadLocalObjectPool
private LocalThreadObjectPool getThreadLocalObjectPool() { if (threadPoolSize <= 0) { // no local thread pool needed. return null; } LocalThreadObjectPool localPool = null; if (threadLocals != null) { localPool = threadLocals.get(); if (localPool == null) { localPool = new LocalThreadObjectPool(threadPoolSize, null, destroyer); // @PK36998C threadLocals.set(localPool); localPool.setCleanUpOld(cleanUpOld); } } return localPool; }
java
private LocalThreadObjectPool getThreadLocalObjectPool() { if (threadPoolSize <= 0) { // no local thread pool needed. return null; } LocalThreadObjectPool localPool = null; if (threadLocals != null) { localPool = threadLocals.get(); if (localPool == null) { localPool = new LocalThreadObjectPool(threadPoolSize, null, destroyer); // @PK36998C threadLocals.set(localPool); localPool.setCleanUpOld(cleanUpOld); } } return localPool; }
[ "private", "LocalThreadObjectPool", "getThreadLocalObjectPool", "(", ")", "{", "if", "(", "threadPoolSize", "<=", "0", ")", "{", "// no local thread pool needed.", "return", "null", ";", "}", "LocalThreadObjectPool", "localPool", "=", "null", ";", "if", "(", "thread...
get a local thread specific pool. To be used for threads that frequently access this pool system.
[ "get", "a", "local", "thread", "specific", "pool", ".", "To", "be", "used", "for", "threads", "that", "frequently", "access", "this", "pool", "system", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/channelfw/objectpool/TwoTierObjectPool.java#L203-L220
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/ReflectionUtils.java
ReflectionUtils.setField
public static void setField(Field field, Object target, Object value) { try { field.set(target, value); } catch (IllegalAccessException e) { throw new IllegalStateException("Could not access field: " + field, e); } }
java
public static void setField(Field field, Object target, Object value) { try { field.set(target, value); } catch (IllegalAccessException e) { throw new IllegalStateException("Could not access field: " + field, e); } }
[ "public", "static", "void", "setField", "(", "Field", "field", ",", "Object", "target", ",", "Object", "value", ")", "{", "try", "{", "field", ".", "set", "(", "target", ",", "value", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{"...
Set the field represented by the supplied {@link Field field object} on the specified {@link Object target object} to the specified {@code value}. In accordance with {@link Field#set(Object, Object)} semantics, the new value is automatically unwrapped if the underlying field has a primitive type. @param field the field to set @param target the target object on which to set the field @param value the value to set (may be {@code null})
[ "Set", "the", "field", "represented", "by", "the", "supplied", "{", "@link", "Field", "field", "object", "}", "on", "the", "specified", "{", "@link", "Object", "target", "object", "}", "to", "the", "specified", "{", "@code", "value", "}", ".", "In", "acc...
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ReflectionUtils.java#L58-L64
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/shared/FakeTable.java
FakeTable.doSetHandle
public boolean doSetHandle(Object bookmark, int iHandleType) throws DBException { FieldList fieldList = this.getSharedTable().setHandle(bookmark, iHandleType); if (fieldList != null) if (fieldList.getTable() != this) // Must be this type of record throw new DBException("Can't set handle in an inherited class"); return (fieldList != null); }
java
public boolean doSetHandle(Object bookmark, int iHandleType) throws DBException { FieldList fieldList = this.getSharedTable().setHandle(bookmark, iHandleType); if (fieldList != null) if (fieldList.getTable() != this) // Must be this type of record throw new DBException("Can't set handle in an inherited class"); return (fieldList != null); }
[ "public", "boolean", "doSetHandle", "(", "Object", "bookmark", ",", "int", "iHandleType", ")", "throws", "DBException", "{", "FieldList", "fieldList", "=", "this", ".", "getSharedTable", "(", ")", ".", "setHandle", "(", "bookmark", ",", "iHandleType", ")", ";"...
Reposition to this record using this bookmark. @param bookmark The handle to use to position the record. @param iHandleType The type of handle (DATA_SOURCE/OBJECT_ID,OBJECT_SOURCE,BOOKMARK). @return - true - record found/false - record not found @exception FILE_NOT_OPEN. @exception DBException File exception.
[ "Reposition", "to", "this", "record", "using", "this", "bookmark", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/shared/FakeTable.java#L238-L245
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/circulant/CirculantTracker.java
CirculantTracker.subpixelPeak
protected void subpixelPeak(int peakX, int peakY) { // this function for r was determined empirically by using work regions of 32,64,128 int r = Math.min(2,response.width/25); if( r < 0 ) return; localPeak.setSearchRadius(r); localPeak.search(peakX,peakY); offX = localPeak.getPeakX() - peakX; offY = localPeak.getPeakY() - peakY; }
java
protected void subpixelPeak(int peakX, int peakY) { // this function for r was determined empirically by using work regions of 32,64,128 int r = Math.min(2,response.width/25); if( r < 0 ) return; localPeak.setSearchRadius(r); localPeak.search(peakX,peakY); offX = localPeak.getPeakX() - peakX; offY = localPeak.getPeakY() - peakY; }
[ "protected", "void", "subpixelPeak", "(", "int", "peakX", ",", "int", "peakY", ")", "{", "// this function for r was determined empirically by using work regions of 32,64,128", "int", "r", "=", "Math", ".", "min", "(", "2", ",", "response", ".", "width", "/", "25", ...
Refine the local-peak using a search algorithm for sub-pixel accuracy.
[ "Refine", "the", "local", "-", "peak", "using", "a", "search", "algorithm", "for", "sub", "-", "pixel", "accuracy", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/circulant/CirculantTracker.java#L377-L388
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.removeAll
@Nullable public static String removeAll (@Nullable final String sInputString, @Nullable final String sRemoveString) { // Is input string empty? if (hasNoText (sInputString)) return sInputString; final int nRemoveLength = getLength (sRemoveString); if (nRemoveLength == 0) { // Nothing to be removed return sInputString; } if (nRemoveLength == 1) { // Shortcut to char version return removeAll (sInputString, sRemoveString.charAt (0)); } // Does the string occur anywhere? int nIndex = sInputString.indexOf (sRemoveString, 0); if (nIndex == STRING_NOT_FOUND) return sInputString; // build output buffer final StringBuilder ret = new StringBuilder (sInputString.length ()); int nOldIndex = 0; do { ret.append (sInputString, nOldIndex, nIndex); nOldIndex = nIndex + nRemoveLength; nIndex = sInputString.indexOf (sRemoveString, nOldIndex); } while (nIndex != STRING_NOT_FOUND); ret.append (sInputString, nOldIndex, sInputString.length ()); return ret.toString (); }
java
@Nullable public static String removeAll (@Nullable final String sInputString, @Nullable final String sRemoveString) { // Is input string empty? if (hasNoText (sInputString)) return sInputString; final int nRemoveLength = getLength (sRemoveString); if (nRemoveLength == 0) { // Nothing to be removed return sInputString; } if (nRemoveLength == 1) { // Shortcut to char version return removeAll (sInputString, sRemoveString.charAt (0)); } // Does the string occur anywhere? int nIndex = sInputString.indexOf (sRemoveString, 0); if (nIndex == STRING_NOT_FOUND) return sInputString; // build output buffer final StringBuilder ret = new StringBuilder (sInputString.length ()); int nOldIndex = 0; do { ret.append (sInputString, nOldIndex, nIndex); nOldIndex = nIndex + nRemoveLength; nIndex = sInputString.indexOf (sRemoveString, nOldIndex); } while (nIndex != STRING_NOT_FOUND); ret.append (sInputString, nOldIndex, sInputString.length ()); return ret.toString (); }
[ "@", "Nullable", "public", "static", "String", "removeAll", "(", "@", "Nullable", "final", "String", "sInputString", ",", "@", "Nullable", "final", "String", "sRemoveString", ")", "{", "// Is input string empty?", "if", "(", "hasNoText", "(", "sInputString", ")", ...
Remove all occurrences of the passed character from the specified input string @param sInputString The input string where the character should be removed. If this parameter is <code>null</code> or empty, no removing is done. @param sRemoveString The String to be removed. May be <code>null</code> or empty in which case nothing happens. @return The input string as is, if the input string is empty or if the remove string is empty or not contained.
[ "Remove", "all", "occurrences", "of", "the", "passed", "character", "from", "the", "specified", "input", "string" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L4447-L4483
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.processAmbiguousProperty
private void processAmbiguousProperty(XMLStreamWriter writer, Set<Method> methodSet, Class<?> aClass, PropertyDescriptor propertyDescriptor) throws SecurityException, XMLStreamException { String name = propertyDescriptor.getName(); name = name.toUpperCase().charAt(0) + name.substring(1); Method readMethod = null; try { readMethod = aClass.getMethod("get" + name, (Class<?>[]) null); } catch (NoSuchMethodException ex) { // Silently ignore } if (readMethod != null) { Method writeMethod = null; try { writeMethod = aClass.getMethod("set" + name, readMethod.getReturnType()); } catch (NoSuchMethodException ex) { // Silently ignore } String readMethodName = readMethod.getName(); String writeMethodName = writeMethod == null ? null : writeMethod.getName(); addProperty(writer, name, readMethod.getReturnType(), readMethodName, writeMethodName); methodSet.add(readMethod); if (writeMethod != null) { methodSet.add(writeMethod); } } }
java
private void processAmbiguousProperty(XMLStreamWriter writer, Set<Method> methodSet, Class<?> aClass, PropertyDescriptor propertyDescriptor) throws SecurityException, XMLStreamException { String name = propertyDescriptor.getName(); name = name.toUpperCase().charAt(0) + name.substring(1); Method readMethod = null; try { readMethod = aClass.getMethod("get" + name, (Class<?>[]) null); } catch (NoSuchMethodException ex) { // Silently ignore } if (readMethod != null) { Method writeMethod = null; try { writeMethod = aClass.getMethod("set" + name, readMethod.getReturnType()); } catch (NoSuchMethodException ex) { // Silently ignore } String readMethodName = readMethod.getName(); String writeMethodName = writeMethod == null ? null : writeMethod.getName(); addProperty(writer, name, readMethod.getReturnType(), readMethodName, writeMethodName); methodSet.add(readMethod); if (writeMethod != null) { methodSet.add(writeMethod); } } }
[ "private", "void", "processAmbiguousProperty", "(", "XMLStreamWriter", "writer", ",", "Set", "<", "Method", ">", "methodSet", ",", "Class", "<", "?", ">", "aClass", ",", "PropertyDescriptor", "propertyDescriptor", ")", "throws", "SecurityException", ",", "XMLStreamE...
Where bean introspection is confused by getProperty() and getProperty(int index), this method determines the correct properties to add. @param writer XML stream writer @param methodSet set of methods processed @param aClass Java class @param propertyDescriptor Java property @throws SecurityException @throws XMLStreamException
[ "Where", "bean", "introspection", "is", "confused", "by", "getProperty", "()", "and", "getProperty", "(", "int", "index", ")", "this", "method", "determines", "the", "correct", "properties", "to", "add", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L313-L350
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CertificatesInner.java
CertificatesInner.getAsync
public Observable<CertificateInner> getAsync(String resourceGroupName, String automationAccountName, String certificateName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, certificateName).map(new Func1<ServiceResponse<CertificateInner>, CertificateInner>() { @Override public CertificateInner call(ServiceResponse<CertificateInner> response) { return response.body(); } }); }
java
public Observable<CertificateInner> getAsync(String resourceGroupName, String automationAccountName, String certificateName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, certificateName).map(new Func1<ServiceResponse<CertificateInner>, CertificateInner>() { @Override public CertificateInner call(ServiceResponse<CertificateInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CertificateInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "certificateName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAcc...
Retrieve the certificate identified by certificate name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param certificateName The name of certificate. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CertificateInner object
[ "Retrieve", "the", "certificate", "identified", "by", "certificate", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CertificatesInner.java#L221-L228
ReactiveX/RxJavaComputationExpressions
src/main/java/rx/Statement.java
Statement.doWhile
public static <T> Observable<T> doWhile(Observable<? extends T> source, Func0<Boolean> postCondition) { return Observable.create(new OperatorWhileDoWhile<T>(source, TRUE, postCondition)); }
java
public static <T> Observable<T> doWhile(Observable<? extends T> source, Func0<Boolean> postCondition) { return Observable.create(new OperatorWhileDoWhile<T>(source, TRUE, postCondition)); }
[ "public", "static", "<", "T", ">", "Observable", "<", "T", ">", "doWhile", "(", "Observable", "<", "?", "extends", "T", ">", "source", ",", "Func0", "<", "Boolean", ">", "postCondition", ")", "{", "return", "Observable", ".", "create", "(", "new", "Ope...
Return an Observable that replays the emissions from the source Observable, and then continues to replay them so long as a condtion is true. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/doWhile.png" alt=""> @param postCondition the post condition to test after the source Observable completes @return an Observable that replays the emissions from the source Observable, and then continues to replay them so long as the post condition is true
[ "Return", "an", "Observable", "that", "replays", "the", "emissions", "from", "the", "source", "Observable", "and", "then", "continues", "to", "replay", "them", "so", "long", "as", "a", "condtion", "is", "true", ".", "<p", ">", "<img", "width", "=", "640", ...
train
https://github.com/ReactiveX/RxJavaComputationExpressions/blob/f9d04ab762223b36fad47402ac36ce7969320d69/src/main/java/rx/Statement.java#L121-L123
pravega/pravega
client/src/main/java/io/pravega/client/segment/impl/Segment.java
Segment.fromScopedName
public static Segment fromScopedName(String qualifiedName) { if (StreamSegmentNameUtils.isTransactionSegment(qualifiedName)) { String originalSegmentName = StreamSegmentNameUtils.getParentStreamSegmentName(qualifiedName); return fromScopedName(originalSegmentName); } else { List<String> tokens = StreamSegmentNameUtils.extractSegmentTokens(qualifiedName); if (tokens.size() == 2) { // scope not present String scope = null; String streamName = tokens.get(0); long segmentId = Long.parseLong(tokens.get(1)); return new Segment(scope, streamName, segmentId); } else { // scope present String scope = tokens.get(0); String streamName = tokens.get(1); long segmentId = Long.parseLong(tokens.get(2)); return new Segment(scope, streamName, segmentId); } } }
java
public static Segment fromScopedName(String qualifiedName) { if (StreamSegmentNameUtils.isTransactionSegment(qualifiedName)) { String originalSegmentName = StreamSegmentNameUtils.getParentStreamSegmentName(qualifiedName); return fromScopedName(originalSegmentName); } else { List<String> tokens = StreamSegmentNameUtils.extractSegmentTokens(qualifiedName); if (tokens.size() == 2) { // scope not present String scope = null; String streamName = tokens.get(0); long segmentId = Long.parseLong(tokens.get(1)); return new Segment(scope, streamName, segmentId); } else { // scope present String scope = tokens.get(0); String streamName = tokens.get(1); long segmentId = Long.parseLong(tokens.get(2)); return new Segment(scope, streamName, segmentId); } } }
[ "public", "static", "Segment", "fromScopedName", "(", "String", "qualifiedName", ")", "{", "if", "(", "StreamSegmentNameUtils", ".", "isTransactionSegment", "(", "qualifiedName", ")", ")", "{", "String", "originalSegmentName", "=", "StreamSegmentNameUtils", ".", "getP...
Parses fully scoped name, and creates the segment. @param qualifiedName Fully scoped segment name @return Segment name.
[ "Parses", "fully", "scoped", "name", "and", "creates", "the", "segment", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/segment/impl/Segment.java#L69-L87
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/UsersApi.java
UsersApi.addUserWithHttpInfo
public ApiResponse<CreateUserSuccessResponse> addUserWithHttpInfo(AddUserData body) throws ApiException { com.squareup.okhttp.Call call = addUserValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken<CreateUserSuccessResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
public ApiResponse<CreateUserSuccessResponse> addUserWithHttpInfo(AddUserData body) throws ApiException { com.squareup.okhttp.Call call = addUserValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken<CreateUserSuccessResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
[ "public", "ApiResponse", "<", "CreateUserSuccessResponse", ">", "addUserWithHttpInfo", "(", "AddUserData", "body", ")", "throws", "ApiException", "{", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "addUserValidateBeforeCall", "(", "body", ",", "...
Create a user. Create a user ([CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson)) with the specified attributes. @param body Body Data (required) @return ApiResponse&lt;CreateUserSuccessResponse&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Create", "a", "user", ".", "Create", "a", "user", "(", "[", "CfgPerson", "]", "(", "https", ":", "//", "docs", ".", "genesys", ".", "com", "/", "Documentation", "/", "PSDK", "/", "latest", "/", "ConfigLayerRef", "/", "CfgPerson", "))", "with", "the", ...
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/UsersApi.java#L144-L148
cloudfoundry/uaa
server/src/main/java/org/cloudfoundry/identity/uaa/scim/endpoints/UserIdConversionEndpoints.java
UserIdConversionEndpoints.checkFilter
private boolean checkFilter(SCIMFilter filter) { switch (filter.getFilterType()) { case AND: case OR: return checkFilter(filter.getFilterComponents().get(0)) | checkFilter(filter.getFilterComponents().get(1)); case EQUALITY: String name = filter.getFilterAttribute().getAttributeName(); if ("id".equalsIgnoreCase(name) || "userName".equalsIgnoreCase(name)) { return true; } else if (OriginKeys.ORIGIN.equalsIgnoreCase(name)) { return false; } else { throw new ScimException("Invalid filter attribute.", HttpStatus.BAD_REQUEST); } case PRESENCE: case STARTS_WITH: case CONTAINS: throw new ScimException("Wildcards are not allowed in filter.", HttpStatus.BAD_REQUEST); case GREATER_THAN: case GREATER_OR_EQUAL: case LESS_THAN: case LESS_OR_EQUAL: throw new ScimException("Invalid operator.", HttpStatus.BAD_REQUEST); } return false; }
java
private boolean checkFilter(SCIMFilter filter) { switch (filter.getFilterType()) { case AND: case OR: return checkFilter(filter.getFilterComponents().get(0)) | checkFilter(filter.getFilterComponents().get(1)); case EQUALITY: String name = filter.getFilterAttribute().getAttributeName(); if ("id".equalsIgnoreCase(name) || "userName".equalsIgnoreCase(name)) { return true; } else if (OriginKeys.ORIGIN.equalsIgnoreCase(name)) { return false; } else { throw new ScimException("Invalid filter attribute.", HttpStatus.BAD_REQUEST); } case PRESENCE: case STARTS_WITH: case CONTAINS: throw new ScimException("Wildcards are not allowed in filter.", HttpStatus.BAD_REQUEST); case GREATER_THAN: case GREATER_OR_EQUAL: case LESS_THAN: case LESS_OR_EQUAL: throw new ScimException("Invalid operator.", HttpStatus.BAD_REQUEST); } return false; }
[ "private", "boolean", "checkFilter", "(", "SCIMFilter", "filter", ")", "{", "switch", "(", "filter", ".", "getFilterType", "(", ")", ")", "{", "case", "AND", ":", "case", "OR", ":", "return", "checkFilter", "(", "filter", ".", "getFilterComponents", "(", "...
Returns true if the field 'id' or 'userName' are present in the query. @param filter @return
[ "Returns", "true", "if", "the", "field", "id", "or", "userName", "are", "present", "in", "the", "query", "." ]
train
https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/scim/endpoints/UserIdConversionEndpoints.java#L151-L177
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java
SymbolType.typeVariableOf
public static SymbolType typeVariableOf(final String typeVariable, List<SymbolType> upperBounds) { return new SymbolType(upperBounds, typeVariable); }
java
public static SymbolType typeVariableOf(final String typeVariable, List<SymbolType> upperBounds) { return new SymbolType(upperBounds, typeVariable); }
[ "public", "static", "SymbolType", "typeVariableOf", "(", "final", "String", "typeVariable", ",", "List", "<", "SymbolType", ">", "upperBounds", ")", "{", "return", "new", "SymbolType", "(", "upperBounds", ",", "typeVariable", ")", ";", "}" ]
Builds a symbol for a type variable from a list of upper bounds. @param typeVariable the name of the variable @param upperBounds the upper bounds of the type variable @return a SymbolType that represents a variable (for generics)
[ "Builds", "a", "symbol", "for", "a", "type", "variable", "from", "a", "list", "of", "upper", "bounds", "." ]
train
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java#L804-L806
projectodd/wunderboss-release
ruby/src/main/java/org/projectodd/wunderboss/ruby/RubyHelper.java
RubyHelper.setIfPossible
public static boolean setIfPossible(final Ruby ruby, final Object target, final String name, final Object value) { boolean success = false; if (defined( ruby, target, name + "=" )) { JavaEmbedUtils.invokeMethod( ruby, target, name + "=", new Object[] { value }, void.class ); success = true; } return success; }
java
public static boolean setIfPossible(final Ruby ruby, final Object target, final String name, final Object value) { boolean success = false; if (defined( ruby, target, name + "=" )) { JavaEmbedUtils.invokeMethod( ruby, target, name + "=", new Object[] { value }, void.class ); success = true; } return success; }
[ "public", "static", "boolean", "setIfPossible", "(", "final", "Ruby", "ruby", ",", "final", "Object", "target", ",", "final", "String", "name", ",", "final", "Object", "value", ")", "{", "boolean", "success", "=", "false", ";", "if", "(", "defined", "(", ...
Set a property on a Ruby object, if possible. <p> If the target responds to {@code name=}, the property will be set. Otherwise, not. </p> @param ruby The Ruby interpreter. @param target The target object. @param name The basic name of the property. @param value The value to attempt to set. @return {@code true} if successful, otherwise {@code false}
[ "Set", "a", "property", "on", "a", "Ruby", "object", "if", "possible", "." ]
train
https://github.com/projectodd/wunderboss-release/blob/f67c68e80c5798169e3a9b2015e278239dbf005d/ruby/src/main/java/org/projectodd/wunderboss/ruby/RubyHelper.java#L58-L65
spockframework/spock
spock-core/src/main/java/spock/util/concurrent/AsyncConditions.java
AsyncConditions.await
public void await(double seconds) throws Throwable { latch.await((long) (seconds * 1000), TimeUnit.MILLISECONDS); if (!exceptions.isEmpty()) throw exceptions.poll(); long pendingEvalBlocks = latch.getCount(); if (pendingEvalBlocks > 0) { String msg = String.format("Async conditions timed out " + "after %1.2f seconds; %d out of %d evaluate blocks did not complete in time", seconds, pendingEvalBlocks, numEvalBlocks); throw new SpockTimeoutError(seconds, msg); } }
java
public void await(double seconds) throws Throwable { latch.await((long) (seconds * 1000), TimeUnit.MILLISECONDS); if (!exceptions.isEmpty()) throw exceptions.poll(); long pendingEvalBlocks = latch.getCount(); if (pendingEvalBlocks > 0) { String msg = String.format("Async conditions timed out " + "after %1.2f seconds; %d out of %d evaluate blocks did not complete in time", seconds, pendingEvalBlocks, numEvalBlocks); throw new SpockTimeoutError(seconds, msg); } }
[ "public", "void", "await", "(", "double", "seconds", ")", "throws", "Throwable", "{", "latch", ".", "await", "(", "(", "long", ")", "(", "seconds", "*", "1000", ")", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "if", "(", "!", "exceptions", ".", "...
Waits until all evaluate blocks have completed or the specified timeout (in seconds) expires. If one of the evaluate blocks throws an exception, it is rethrown from this method. @param seconds the timeout (in seconds) @throws InterruptedException if the calling thread is interrupted @throws Throwable the first exception thrown by an evaluate block
[ "Waits", "until", "all", "evaluate", "blocks", "have", "completed", "or", "the", "specified", "timeout", "(", "in", "seconds", ")", "expires", ".", "If", "one", "of", "the", "evaluate", "blocks", "throws", "an", "exception", "it", "is", "rethrown", "from", ...
train
https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/util/concurrent/AsyncConditions.java#L133-L145
coursera/courier
typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java
TSSyntax.docComment
private static String docComment(String doc, Object deprecation /* nullable */) { StringBuilder docStr = new StringBuilder(); if (doc != null) { docStr.append(doc.trim()); } if (deprecation != null) { docStr.append("\n\n").append("@deprecated"); if (deprecation instanceof String) { docStr.append(" ").append(((String)deprecation).trim()); } } return DocEscaping.stringToDocComment(docStr.toString(), DocCommentStyle.ASTRISK_MARGIN); }
java
private static String docComment(String doc, Object deprecation /* nullable */) { StringBuilder docStr = new StringBuilder(); if (doc != null) { docStr.append(doc.trim()); } if (deprecation != null) { docStr.append("\n\n").append("@deprecated"); if (deprecation instanceof String) { docStr.append(" ").append(((String)deprecation).trim()); } } return DocEscaping.stringToDocComment(docStr.toString(), DocCommentStyle.ASTRISK_MARGIN); }
[ "private", "static", "String", "docComment", "(", "String", "doc", ",", "Object", "deprecation", "/* nullable */", ")", "{", "StringBuilder", "docStr", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "doc", "!=", "null", ")", "{", "docStr", ".", "ap...
Return a full tsdoc for a type. @param doc the doc string in the type's DataSchema. @param deprecation the object listed under the schema's "deprecation" property @return a fully formed tsdoc for the type.
[ "Return", "a", "full", "tsdoc", "for", "a", "type", "." ]
train
https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java#L202-L216
rometools/rome
rome/src/main/java/com/rometools/rome/feed/impl/CloneableBean.java
CloneableBean.beanClone
public static Object beanClone(Object obj, Set<String> ignoreProperties) throws CloneNotSupportedException { final Class<?> clazz = obj.getClass(); try { final Object clonedBean = clazz.newInstance(); final List<PropertyDescriptor> propertyDescriptors = BeanIntrospector.getPropertyDescriptorsWithGettersAndSetters(clazz); for (final PropertyDescriptor propertyDescriptor : propertyDescriptors) { final String propertyName = propertyDescriptor.getName(); final boolean ignoredProperty = ignoreProperties.contains(propertyName); if (!ignoredProperty) { final Method getter = propertyDescriptor.getReadMethod(); final Method setter = propertyDescriptor.getWriteMethod(); Object value = getter.invoke(obj, NO_PARAMS); if (value != null) { value = doClone(value); setter.invoke(clonedBean, new Object[] { value }); } } } return clonedBean; } catch (final CloneNotSupportedException e) { LOG.error("Error while cloning bean", e); throw e; } catch (final Exception e) { LOG.error("Error while cloning bean", e); throw new CloneNotSupportedException("Cannot clone a " + clazz + " object"); } }
java
public static Object beanClone(Object obj, Set<String> ignoreProperties) throws CloneNotSupportedException { final Class<?> clazz = obj.getClass(); try { final Object clonedBean = clazz.newInstance(); final List<PropertyDescriptor> propertyDescriptors = BeanIntrospector.getPropertyDescriptorsWithGettersAndSetters(clazz); for (final PropertyDescriptor propertyDescriptor : propertyDescriptors) { final String propertyName = propertyDescriptor.getName(); final boolean ignoredProperty = ignoreProperties.contains(propertyName); if (!ignoredProperty) { final Method getter = propertyDescriptor.getReadMethod(); final Method setter = propertyDescriptor.getWriteMethod(); Object value = getter.invoke(obj, NO_PARAMS); if (value != null) { value = doClone(value); setter.invoke(clonedBean, new Object[] { value }); } } } return clonedBean; } catch (final CloneNotSupportedException e) { LOG.error("Error while cloning bean", e); throw e; } catch (final Exception e) { LOG.error("Error while cloning bean", e); throw new CloneNotSupportedException("Cannot clone a " + clazz + " object"); } }
[ "public", "static", "Object", "beanClone", "(", "Object", "obj", ",", "Set", "<", "String", ">", "ignoreProperties", ")", "throws", "CloneNotSupportedException", "{", "final", "Class", "<", "?", ">", "clazz", "=", "obj", ".", "getClass", "(", ")", ";", "tr...
Makes a deep bean clone of the object passed in the constructor. <p> To be used by classes using CloneableBean in a delegation pattern, @return a clone of the object bean. @throws CloneNotSupportedException thrown if the object bean could not be cloned.
[ "Makes", "a", "deep", "bean", "clone", "of", "the", "object", "passed", "in", "the", "constructor", ".", "<p", ">", "To", "be", "used", "by", "classes", "using", "CloneableBean", "in", "a", "delegation", "pattern" ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/feed/impl/CloneableBean.java#L76-L116
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationCalibration.java
EvaluationCalibration.getProbabilityHistogramAllClasses
public Histogram getProbabilityHistogramAllClasses() { String title = "Network Probabilities Histogram - All Predictions and Classes"; int[] counts = probHistogramOverall.data().asInt(); return new Histogram(title, 0.0, 1.0, counts); }
java
public Histogram getProbabilityHistogramAllClasses() { String title = "Network Probabilities Histogram - All Predictions and Classes"; int[] counts = probHistogramOverall.data().asInt(); return new Histogram(title, 0.0, 1.0, counts); }
[ "public", "Histogram", "getProbabilityHistogramAllClasses", "(", ")", "{", "String", "title", "=", "\"Network Probabilities Histogram - All Predictions and Classes\"", ";", "int", "[", "]", "counts", "=", "probHistogramOverall", ".", "data", "(", ")", ".", "asInt", "(",...
Return a probability histogram for all predictions/classes. @return Probability histogram
[ "Return", "a", "probability", "histogram", "for", "all", "predictions", "/", "classes", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationCalibration.java#L454-L458
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getFromLastIncl
@Nullable public static String getFromLastIncl (@Nullable final String sStr, @Nullable final String sSearch) { return _getFromLast (sStr, sSearch, true); }
java
@Nullable public static String getFromLastIncl (@Nullable final String sStr, @Nullable final String sSearch) { return _getFromLast (sStr, sSearch, true); }
[ "@", "Nullable", "public", "static", "String", "getFromLastIncl", "(", "@", "Nullable", "final", "String", "sStr", ",", "@", "Nullable", "final", "String", "sSearch", ")", "{", "return", "_getFromLast", "(", "sStr", ",", "sSearch", ",", "true", ")", ";", "...
Get everything from the string from and including the passed string. @param sStr The source string. May be <code>null</code>. @param sSearch The string to search. May be <code>null</code>. @return <code>null</code> if the passed string does not contain the search string. If the search string is empty, the input string is returned unmodified.
[ "Get", "everything", "from", "the", "string", "from", "and", "including", "the", "passed", "string", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L5072-L5076
JoeKerouac/utils
src/main/java/com/joe/utils/secure/KeyTools.java
KeyTools.buildKey
public static SecretKey buildKey(AbstractCipher.Algorithms algorithm, String seed, int keySize) { log.debug("开始构建对称加密[{}]的Key,Keysize为:[{}]", algorithm, keySize); String name = algorithm.name(); try { KeyGenerator kgen = KeyGenerator.getInstance(name); kgen.init(keySize, new SecureRandom(seed.getBytes())); return kgen.generateKey(); } catch (NoSuchAlgorithmException e) { throw new SecureException("构建[" + algorithm + "]的key失败,keySize是:" + keySize, e); } }
java
public static SecretKey buildKey(AbstractCipher.Algorithms algorithm, String seed, int keySize) { log.debug("开始构建对称加密[{}]的Key,Keysize为:[{}]", algorithm, keySize); String name = algorithm.name(); try { KeyGenerator kgen = KeyGenerator.getInstance(name); kgen.init(keySize, new SecureRandom(seed.getBytes())); return kgen.generateKey(); } catch (NoSuchAlgorithmException e) { throw new SecureException("构建[" + algorithm + "]的key失败,keySize是:" + keySize, e); } }
[ "public", "static", "SecretKey", "buildKey", "(", "AbstractCipher", ".", "Algorithms", "algorithm", ",", "String", "seed", ",", "int", "keySize", ")", "{", "log", ".", "debug", "(", "\"开始构建对称加密[{}]的Key,Keysize为:[{}]\", algorithm, keySize);", "", "", "", "", "", ...
使用指定password构建对称加密的Key,即使seed相同构建出来的key也会不同,因为seed仅用于生成随机数种 子,keySize有一定限制,详情参照README @param algorithm 算法名称,当前仅支持AES和DES @param seed 用来生成随机数的种子 @param keySize keySize @return 对称加密的key
[ "使用指定password构建对称加密的Key,即使seed相同构建出来的key也会不同,因为seed仅用于生成随机数种", "子,keySize有一定限制,详情参照README" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/secure/KeyTools.java#L105-L116
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/filter/RawScale2x.java
RawScale2x.setDestPixel
private void setDestPixel(int[] dstImage, int x, int y, int p) { dstImage[x + y * width * SCALE] = p; }
java
private void setDestPixel(int[] dstImage, int x, int y, int p) { dstImage[x + y * width * SCALE] = p; }
[ "private", "void", "setDestPixel", "(", "int", "[", "]", "dstImage", ",", "int", "x", ",", "int", "y", ",", "int", "p", ")", "{", "dstImage", "[", "x", "+", "y", "*", "width", "*", "SCALE", "]", "=", "p", ";", "}" ]
Set destination pixel. @param dstImage The image destination. @param x The location x. @param y The location y. @param p The pixel destination value.
[ "Set", "destination", "pixel", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/filter/RawScale2x.java#L76-L79
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java
GeoJsonWriteDriver.writeProperties
private void writeProperties(JsonGenerator jsonGenerator, ResultSet rs) throws IOException, SQLException { if (columnCountProperties != -1) { jsonGenerator.writeObjectFieldStart("properties"); for (Map.Entry<String, Integer> entry : cachedColumnNames.entrySet()) { String string = entry.getKey(); string = string.toLowerCase(); Integer fieldId = entry.getValue(); if (rs.getObject(fieldId) instanceof Object[]) { Object[] array = (Object[]) rs.getObject(fieldId); jsonGenerator.writeArrayFieldStart(string); writeArray(jsonGenerator, array, true); jsonGenerator.writeEndArray(); } else if (rs.getObject(fieldId) != null && rs.getObject(fieldId).equals("{}")){ jsonGenerator.writeObjectFieldStart(string); jsonGenerator.writeEndObject(); } else if (rs.getObject(fieldId) == "null") { jsonGenerator.writeFieldName(string); jsonGenerator.writeNull(); } else { jsonGenerator.writeObjectField(string, rs.getObject(fieldId)); } } jsonGenerator.writeEndObject(); } }
java
private void writeProperties(JsonGenerator jsonGenerator, ResultSet rs) throws IOException, SQLException { if (columnCountProperties != -1) { jsonGenerator.writeObjectFieldStart("properties"); for (Map.Entry<String, Integer> entry : cachedColumnNames.entrySet()) { String string = entry.getKey(); string = string.toLowerCase(); Integer fieldId = entry.getValue(); if (rs.getObject(fieldId) instanceof Object[]) { Object[] array = (Object[]) rs.getObject(fieldId); jsonGenerator.writeArrayFieldStart(string); writeArray(jsonGenerator, array, true); jsonGenerator.writeEndArray(); } else if (rs.getObject(fieldId) != null && rs.getObject(fieldId).equals("{}")){ jsonGenerator.writeObjectFieldStart(string); jsonGenerator.writeEndObject(); } else if (rs.getObject(fieldId) == "null") { jsonGenerator.writeFieldName(string); jsonGenerator.writeNull(); } else { jsonGenerator.writeObjectField(string, rs.getObject(fieldId)); } } jsonGenerator.writeEndObject(); } }
[ "private", "void", "writeProperties", "(", "JsonGenerator", "jsonGenerator", ",", "ResultSet", "rs", ")", "throws", "IOException", ",", "SQLException", "{", "if", "(", "columnCountProperties", "!=", "-", "1", ")", "{", "jsonGenerator", ".", "writeObjectFieldStart", ...
Write the GeoJSON properties. @param jsonGenerator @param rs @throws IOException
[ "Write", "the", "GeoJSON", "properties", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java#L564-L588
woo-j/OkapiBarcode
src/main/java/uk/org/okapibarcode/util/Arrays.java
Arrays.positionOf
public static int positionOf(char value, char[] array) { for (int i = 0; i < array.length; i++) { if (value == array[i]) { return i; } } throw new OkapiException("Unable to find character '" + value + "' in character array."); }
java
public static int positionOf(char value, char[] array) { for (int i = 0; i < array.length; i++) { if (value == array[i]) { return i; } } throw new OkapiException("Unable to find character '" + value + "' in character array."); }
[ "public", "static", "int", "positionOf", "(", "char", "value", ",", "char", "[", "]", "array", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "if", "(", "value", "==", "array", "[", ...
Returns the position of the specified value in the specified array. @param value the value to search for @param array the array to search in @return the position of the specified value in the specified array
[ "Returns", "the", "position", "of", "the", "specified", "value", "in", "the", "specified", "array", "." ]
train
https://github.com/woo-j/OkapiBarcode/blob/d1cb4f4ab64557cd3db64d9a473528a52ce58081/src/main/java/uk/org/okapibarcode/util/Arrays.java#L39-L46
pravega/pravega
controller/src/main/java/io/pravega/controller/server/rest/ModelHelper.java
ModelHelper.encodeStreamResponse
public static final StreamProperty encodeStreamResponse(String scope, String streamName, final StreamConfiguration streamConfiguration) { ScalingConfig scalingPolicy = new ScalingConfig(); if (streamConfiguration.getScalingPolicy().getScaleType() == ScalingPolicy.ScaleType.FIXED_NUM_SEGMENTS) { scalingPolicy.setType(ScalingConfig.TypeEnum.valueOf(streamConfiguration.getScalingPolicy(). getScaleType().name())); scalingPolicy.setMinSegments(streamConfiguration.getScalingPolicy().getMinNumSegments()); } else { scalingPolicy.setType(ScalingConfig.TypeEnum.valueOf(streamConfiguration.getScalingPolicy(). getScaleType().name())); scalingPolicy.setTargetRate(streamConfiguration.getScalingPolicy().getTargetRate()); scalingPolicy.setScaleFactor(streamConfiguration.getScalingPolicy().getScaleFactor()); scalingPolicy.setMinSegments(streamConfiguration.getScalingPolicy().getMinNumSegments()); } RetentionConfig retentionConfig = null; if (streamConfiguration.getRetentionPolicy() != null) { retentionConfig = new RetentionConfig(); switch (streamConfiguration.getRetentionPolicy().getRetentionType()) { case SIZE: retentionConfig.setType(RetentionConfig.TypeEnum.LIMITED_SIZE_MB); retentionConfig.setValue(streamConfiguration.getRetentionPolicy().getRetentionParam() / (1024 * 1024)); break; case TIME: retentionConfig.setType(RetentionConfig.TypeEnum.LIMITED_DAYS); retentionConfig.setValue( Duration.ofMillis(streamConfiguration.getRetentionPolicy().getRetentionParam()).toDays()); break; } } StreamProperty streamProperty = new StreamProperty(); streamProperty.setScopeName(scope); streamProperty.setStreamName(streamName); streamProperty.setScalingPolicy(scalingPolicy); streamProperty.setRetentionPolicy(retentionConfig); return streamProperty; }
java
public static final StreamProperty encodeStreamResponse(String scope, String streamName, final StreamConfiguration streamConfiguration) { ScalingConfig scalingPolicy = new ScalingConfig(); if (streamConfiguration.getScalingPolicy().getScaleType() == ScalingPolicy.ScaleType.FIXED_NUM_SEGMENTS) { scalingPolicy.setType(ScalingConfig.TypeEnum.valueOf(streamConfiguration.getScalingPolicy(). getScaleType().name())); scalingPolicy.setMinSegments(streamConfiguration.getScalingPolicy().getMinNumSegments()); } else { scalingPolicy.setType(ScalingConfig.TypeEnum.valueOf(streamConfiguration.getScalingPolicy(). getScaleType().name())); scalingPolicy.setTargetRate(streamConfiguration.getScalingPolicy().getTargetRate()); scalingPolicy.setScaleFactor(streamConfiguration.getScalingPolicy().getScaleFactor()); scalingPolicy.setMinSegments(streamConfiguration.getScalingPolicy().getMinNumSegments()); } RetentionConfig retentionConfig = null; if (streamConfiguration.getRetentionPolicy() != null) { retentionConfig = new RetentionConfig(); switch (streamConfiguration.getRetentionPolicy().getRetentionType()) { case SIZE: retentionConfig.setType(RetentionConfig.TypeEnum.LIMITED_SIZE_MB); retentionConfig.setValue(streamConfiguration.getRetentionPolicy().getRetentionParam() / (1024 * 1024)); break; case TIME: retentionConfig.setType(RetentionConfig.TypeEnum.LIMITED_DAYS); retentionConfig.setValue( Duration.ofMillis(streamConfiguration.getRetentionPolicy().getRetentionParam()).toDays()); break; } } StreamProperty streamProperty = new StreamProperty(); streamProperty.setScopeName(scope); streamProperty.setStreamName(streamName); streamProperty.setScalingPolicy(scalingPolicy); streamProperty.setRetentionPolicy(retentionConfig); return streamProperty; }
[ "public", "static", "final", "StreamProperty", "encodeStreamResponse", "(", "String", "scope", ",", "String", "streamName", ",", "final", "StreamConfiguration", "streamConfiguration", ")", "{", "ScalingConfig", "scalingPolicy", "=", "new", "ScalingConfig", "(", ")", "...
The method translates the internal object StreamConfiguration into REST response object. @param scope the scope of the stream @param streamName the name of the stream @param streamConfiguration The configuration of stream @return Stream properties wrapped in StreamResponse object
[ "The", "method", "translates", "the", "internal", "object", "StreamConfiguration", "into", "REST", "response", "object", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rest/ModelHelper.java#L122-L158
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/dos/dos_stats.java
dos_stats.get_nitro_response
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { dos_stats[] resources = new dos_stats[1]; dos_response result = (dos_response) service.get_payload_formatter().string_to_resource(dos_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.dos; return resources; }
java
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { dos_stats[] resources = new dos_stats[1]; dos_response result = (dos_response) service.get_payload_formatter().string_to_resource(dos_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.dos; return resources; }
[ "protected", "base_resource", "[", "]", "get_nitro_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "dos_stats", "[", "]", "resources", "=", "new", "dos_stats", "[", "1", "]", ";", "dos_response", "result", ...
<pre> converts nitro response into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "converts", "nitro", "response", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/dos/dos_stats.java#L117-L136
HtmlUnit/htmlunit-cssparser
src/main/java/com/gargoylesoftware/css/dom/MediaListImpl.java
MediaListImpl.setMediaText
public void setMediaText(final String mediaText) throws DOMException { try { final CSSOMParser parser = new CSSOMParser(); parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE); final MediaQueryList sml = parser.parseMedia(mediaText); setMediaList(sml); } catch (final CSSParseException e) { throw new DOMException(DOMException.SYNTAX_ERR, e.getLocalizedMessage()); } catch (final IOException e) { throw new DOMException(DOMException.NOT_FOUND_ERR, e.getLocalizedMessage()); } }
java
public void setMediaText(final String mediaText) throws DOMException { try { final CSSOMParser parser = new CSSOMParser(); parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE); final MediaQueryList sml = parser.parseMedia(mediaText); setMediaList(sml); } catch (final CSSParseException e) { throw new DOMException(DOMException.SYNTAX_ERR, e.getLocalizedMessage()); } catch (final IOException e) { throw new DOMException(DOMException.NOT_FOUND_ERR, e.getLocalizedMessage()); } }
[ "public", "void", "setMediaText", "(", "final", "String", "mediaText", ")", "throws", "DOMException", "{", "try", "{", "final", "CSSOMParser", "parser", "=", "new", "CSSOMParser", "(", ")", ";", "parser", ".", "setErrorHandler", "(", "ThrowCssExceptionErrorHandler...
Parses the given media text. @param mediaText text to be parsed @throws DOMException in case of error
[ "Parses", "the", "given", "media", "text", "." ]
train
https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/dom/MediaListImpl.java#L77-L90
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.processCalendarExceptions
private void processCalendarExceptions(ProjectCalendar calendar, Record root) { // Retrieve exceptions Record exceptions = root.getChild("Exceptions"); if (exceptions != null) { for (Record exception : exceptions.getChildren()) { long daysFromEpoch = Integer.parseInt(exception.getValue().split("\\|")[1]); Date startEx = DateHelper.getDateFromLong(EXCEPTION_EPOCH + (daysFromEpoch * DateHelper.MS_PER_DAY)); ProjectCalendarException pce = calendar.addCalendarException(startEx, startEx); for (Record exceptionHours : exception.getChildren()) { addHours(pce, exceptionHours); } } } }
java
private void processCalendarExceptions(ProjectCalendar calendar, Record root) { // Retrieve exceptions Record exceptions = root.getChild("Exceptions"); if (exceptions != null) { for (Record exception : exceptions.getChildren()) { long daysFromEpoch = Integer.parseInt(exception.getValue().split("\\|")[1]); Date startEx = DateHelper.getDateFromLong(EXCEPTION_EPOCH + (daysFromEpoch * DateHelper.MS_PER_DAY)); ProjectCalendarException pce = calendar.addCalendarException(startEx, startEx); for (Record exceptionHours : exception.getChildren()) { addHours(pce, exceptionHours); } } } }
[ "private", "void", "processCalendarExceptions", "(", "ProjectCalendar", "calendar", ",", "Record", "root", ")", "{", "// Retrieve exceptions", "Record", "exceptions", "=", "root", ".", "getChild", "(", "\"Exceptions\"", ")", ";", "if", "(", "exceptions", "!=", "nu...
Process calendar exceptions. @param calendar project calendar @param root calendar data
[ "Process", "calendar", "exceptions", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L454-L472
leadware/jpersistence-tools
jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java
RestrictionsContainer.addLe
public <Y extends Comparable<? super Y>> RestrictionsContainer addLe(String property, Y value) { // Ajout de la restriction restrictions.add(new Le<Y>(property, value)); // On retourne le conteneur return this; }
java
public <Y extends Comparable<? super Y>> RestrictionsContainer addLe(String property, Y value) { // Ajout de la restriction restrictions.add(new Le<Y>(property, value)); // On retourne le conteneur return this; }
[ "public", "<", "Y", "extends", "Comparable", "<", "?", "super", "Y", ">", ">", "RestrictionsContainer", "addLe", "(", "String", "property", ",", "Y", "value", ")", "{", "// Ajout de la restriction\r", "restrictions", ".", "add", "(", "new", "Le", "<", "Y", ...
Methode d'ajout de la restriction Le @param property Nom de la Propriete @param value Valeur de la propriete @param <Y> Type de valeur @return Conteneur
[ "Methode", "d", "ajout", "de", "la", "restriction", "Le" ]
train
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java#L199-L206
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.queryMessages
public Observable<ComapiResult<MessagesQueryResponse>> queryMessages(@NonNull final String conversationId, final Long from, @NonNull final Integer limit) { final String token = getToken(); if (sessionController.isCreatingSession()) { return getTaskQueue().queueQueryMessages(conversationId, from, limit); } else if (TextUtils.isEmpty(token)) { return Observable.error(getSessionStateErrorDescription()); } else { return doQueryMessages(token, conversationId, from, limit); } }
java
public Observable<ComapiResult<MessagesQueryResponse>> queryMessages(@NonNull final String conversationId, final Long from, @NonNull final Integer limit) { final String token = getToken(); if (sessionController.isCreatingSession()) { return getTaskQueue().queueQueryMessages(conversationId, from, limit); } else if (TextUtils.isEmpty(token)) { return Observable.error(getSessionStateErrorDescription()); } else { return doQueryMessages(token, conversationId, from, limit); } }
[ "public", "Observable", "<", "ComapiResult", "<", "MessagesQueryResponse", ">", ">", "queryMessages", "(", "@", "NonNull", "final", "String", "conversationId", ",", "final", "Long", "from", ",", "@", "NonNull", "final", "Integer", "limit", ")", "{", "final", "...
Query chanel messages. @param conversationId ID of a conversation to query messages in it. @param from ID of the message to start from. @param limit Limit of events to obtain in this call. @return Observable to get messages in a conversation.
[ "Query", "chanel", "messages", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L881-L892
yanzhenjie/AndPermission
support/src/main/java/com/yanzhenjie/permission/AndPermission.java
AndPermission.hasPermissions
public static boolean hasPermissions(android.app.Fragment fragment, String[]... permissions) { return hasPermissions(fragment.getActivity(), permissions); }
java
public static boolean hasPermissions(android.app.Fragment fragment, String[]... permissions) { return hasPermissions(fragment.getActivity(), permissions); }
[ "public", "static", "boolean", "hasPermissions", "(", "android", ".", "app", ".", "Fragment", "fragment", ",", "String", "[", "]", "...", "permissions", ")", "{", "return", "hasPermissions", "(", "fragment", ".", "getActivity", "(", ")", ",", "permissions", ...
Judgment already has the target permission. @param fragment {@link android.app.Fragment}. @param permissions one or more permission groups. @return true, other wise is false.
[ "Judgment", "already", "has", "the", "target", "permission", "." ]
train
https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/AndPermission.java#L295-L297
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF5.java
CommonOps_DDF5.fill
public static void fill( DMatrix5x5 a , double v ) { a.a11 = v; a.a12 = v; a.a13 = v; a.a14 = v; a.a15 = v; a.a21 = v; a.a22 = v; a.a23 = v; a.a24 = v; a.a25 = v; a.a31 = v; a.a32 = v; a.a33 = v; a.a34 = v; a.a35 = v; a.a41 = v; a.a42 = v; a.a43 = v; a.a44 = v; a.a45 = v; a.a51 = v; a.a52 = v; a.a53 = v; a.a54 = v; a.a55 = v; }
java
public static void fill( DMatrix5x5 a , double v ) { a.a11 = v; a.a12 = v; a.a13 = v; a.a14 = v; a.a15 = v; a.a21 = v; a.a22 = v; a.a23 = v; a.a24 = v; a.a25 = v; a.a31 = v; a.a32 = v; a.a33 = v; a.a34 = v; a.a35 = v; a.a41 = v; a.a42 = v; a.a43 = v; a.a44 = v; a.a45 = v; a.a51 = v; a.a52 = v; a.a53 = v; a.a54 = v; a.a55 = v; }
[ "public", "static", "void", "fill", "(", "DMatrix5x5", "a", ",", "double", "v", ")", "{", "a", ".", "a11", "=", "v", ";", "a", ".", "a12", "=", "v", ";", "a", ".", "a13", "=", "v", ";", "a", ".", "a14", "=", "v", ";", "a", ".", "a15", "="...
<p> Sets every element in the matrix to the specified value.<br> <br> a<sub>ij</sub> = value <p> @param a A matrix whose elements are about to be set. Modified. @param v The value each element will have.
[ "<p", ">", "Sets", "every", "element", "in", "the", "matrix", "to", "the", "specified", "value", ".", "<br", ">", "<br", ">", "a<sub", ">", "ij<", "/", "sub", ">", "=", "value", "<p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF5.java#L1920-L1926
twitter/twitter-korean-text
src/main/java/com/twitter/penguin/korean/util/CharacterUtils.java
CharacterUtils.toCodePoints
public final int toCodePoints(char[] src, int srcOff, int srcLen, int[] dest, int destOff) { if (srcLen < 0) { throw new IllegalArgumentException("srcLen must be >= 0"); } int codePointCount = 0; for (int i = 0; i < srcLen; ) { final int cp = codePointAt(src, srcOff + i, srcOff + srcLen); final int charCount = Character.charCount(cp); dest[destOff + codePointCount++] = cp; i += charCount; } return codePointCount; }
java
public final int toCodePoints(char[] src, int srcOff, int srcLen, int[] dest, int destOff) { if (srcLen < 0) { throw new IllegalArgumentException("srcLen must be >= 0"); } int codePointCount = 0; for (int i = 0; i < srcLen; ) { final int cp = codePointAt(src, srcOff + i, srcOff + srcLen); final int charCount = Character.charCount(cp); dest[destOff + codePointCount++] = cp; i += charCount; } return codePointCount; }
[ "public", "final", "int", "toCodePoints", "(", "char", "[", "]", "src", ",", "int", "srcOff", ",", "int", "srcLen", ",", "int", "[", "]", "dest", ",", "int", "destOff", ")", "{", "if", "(", "srcLen", "<", "0", ")", "{", "throw", "new", "IllegalArgu...
Converts a sequence of Java characters to a sequence of unicode code points. @return the number of code points written to the destination buffer
[ "Converts", "a", "sequence", "of", "Java", "characters", "to", "a", "sequence", "of", "unicode", "code", "points", "." ]
train
https://github.com/twitter/twitter-korean-text/blob/95bbe21fcc62fa7bf50b769ae80a5734fef6b903/src/main/java/com/twitter/penguin/korean/util/CharacterUtils.java#L134-L146
lukas-krecan/json2xml
src/main/java/net/javacrumbs/json2xml/JsonSaxAdapter.java
JsonSaxAdapter.parseElement
private void parseElement(final String elementName, final boolean inArray) throws Exception { JsonToken currentToken = jsonParser.getCurrentToken(); if (inArray) { startElement(elementName); } if (START_OBJECT.equals(currentToken)) { parseObject(); } else if (START_ARRAY.equals(currentToken)) { parseArray(elementName); } else if (currentToken.isScalarValue()) { parseValue(); } if (inArray) { endElement(elementName); } }
java
private void parseElement(final String elementName, final boolean inArray) throws Exception { JsonToken currentToken = jsonParser.getCurrentToken(); if (inArray) { startElement(elementName); } if (START_OBJECT.equals(currentToken)) { parseObject(); } else if (START_ARRAY.equals(currentToken)) { parseArray(elementName); } else if (currentToken.isScalarValue()) { parseValue(); } if (inArray) { endElement(elementName); } }
[ "private", "void", "parseElement", "(", "final", "String", "elementName", ",", "final", "boolean", "inArray", ")", "throws", "Exception", "{", "JsonToken", "currentToken", "=", "jsonParser", ".", "getCurrentToken", "(", ")", ";", "if", "(", "inArray", ")", "{"...
Pares JSON element. @param elementName @param inArray if the element is in an array @throws Exception
[ "Pares", "JSON", "element", "." ]
train
https://github.com/lukas-krecan/json2xml/blob/8fba4f942ebed5d6f7ad851390c634fff8559cac/src/main/java/net/javacrumbs/json2xml/JsonSaxAdapter.java#L225-L240
3pillarlabs/spring-data-simpledb
spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/attributeutil/AmazonSimpleDBUtil.java
AmazonSimpleDBUtil.decodeByteArray
public static byte[] decodeByteArray(String value) throws ParseException { try { return Base64.decodeBase64(value.getBytes(UTF8_ENCODING)); } catch(UnsupportedEncodingException e) { throw new MappingException("Could not decode byteArray to UTF8 encoding", e); } }
java
public static byte[] decodeByteArray(String value) throws ParseException { try { return Base64.decodeBase64(value.getBytes(UTF8_ENCODING)); } catch(UnsupportedEncodingException e) { throw new MappingException("Could not decode byteArray to UTF8 encoding", e); } }
[ "public", "static", "byte", "[", "]", "decodeByteArray", "(", "String", "value", ")", "throws", "ParseException", "{", "try", "{", "return", "Base64", ".", "decodeBase64", "(", "value", ".", "getBytes", "(", "UTF8_ENCODING", ")", ")", ";", "}", "catch", "(...
Decodes byte[] value from the string representation created using encodeDate(..) function. @param value string representation of the date value @return original byte[] value
[ "Decodes", "byte", "[]", "value", "from", "the", "string", "representation", "created", "using", "encodeDate", "(", "..", ")", "function", "." ]
train
https://github.com/3pillarlabs/spring-data-simpledb/blob/f1e0eb4e48ec4674d3966e8f5bc04c95031f93ae/spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/attributeutil/AmazonSimpleDBUtil.java#L187-L194
kuujo/vertigo
core/src/main/java/net/kuujo/vertigo/cluster/impl/ClusterLocator.java
ClusterLocator.locateGroup
public void locateGroup(String cluster, String group, Handler<AsyncResult<String>> doneHandler) { locateGroup(String.format("%s.%s", cluster, group), doneHandler); }
java
public void locateGroup(String cluster, String group, Handler<AsyncResult<String>> doneHandler) { locateGroup(String.format("%s.%s", cluster, group), doneHandler); }
[ "public", "void", "locateGroup", "(", "String", "cluster", ",", "String", "group", ",", "Handler", "<", "AsyncResult", "<", "String", ">", ">", "doneHandler", ")", "{", "locateGroup", "(", "String", ".", "format", "(", "\"%s.%s\"", ",", "cluster", ",", "gr...
Locates the local address of the nearest group node if one exists. @param cluster The cluster in which to search for the node. @param group The group to search. @param doneHandler A handler to be called once the address has been located.
[ "Locates", "the", "local", "address", "of", "the", "nearest", "group", "node", "if", "one", "exists", "." ]
train
https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/cluster/impl/ClusterLocator.java#L63-L65
UrielCh/ovh-java-sdk
ovh-java-sdk-vrack/src/main/java/net/minidev/ovh/api/ApiOvhVrack.java
ApiOvhVrack.serviceName_dedicatedServer_dedicatedServer_mrtg_GET
public ArrayList<OvhMrtgTimestampValue> serviceName_dedicatedServer_dedicatedServer_mrtg_GET(String serviceName, String dedicatedServer, OvhMrtgPeriodEnum period, OvhMrtgTypeEnum type) throws IOException { String qPath = "/vrack/{serviceName}/dedicatedServer/{dedicatedServer}/mrtg"; StringBuilder sb = path(qPath, serviceName, dedicatedServer); query(sb, "period", period); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<OvhMrtgTimestampValue> serviceName_dedicatedServer_dedicatedServer_mrtg_GET(String serviceName, String dedicatedServer, OvhMrtgPeriodEnum period, OvhMrtgTypeEnum type) throws IOException { String qPath = "/vrack/{serviceName}/dedicatedServer/{dedicatedServer}/mrtg"; StringBuilder sb = path(qPath, serviceName, dedicatedServer); query(sb, "period", period); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "OvhMrtgTimestampValue", ">", "serviceName_dedicatedServer_dedicatedServer_mrtg_GET", "(", "String", "serviceName", ",", "String", "dedicatedServer", ",", "OvhMrtgPeriodEnum", "period", ",", "OvhMrtgTypeEnum", "type", ")", "throws", "IOException", ...
Retrieve vrack traffic graph values REST: GET /vrack/{serviceName}/dedicatedServer/{dedicatedServer}/mrtg @param period [required] mrtg period @param type [required] mrtg type @param serviceName [required] The internal name of your vrack @param dedicatedServer [required] Dedicated Server @deprecated
[ "Retrieve", "vrack", "traffic", "graph", "values" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vrack/src/main/java/net/minidev/ovh/api/ApiOvhVrack.java#L323-L330
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularDistortBase_F64.java
EquirectangularDistortBase_F64.declareVectors
protected void declareVectors( int width , int height ) { this.outWidth = width; if( vectors.length < width*height ) { Point3D_F64[] tmp = new Point3D_F64[width*height]; System.arraycopy(vectors,0,tmp,0,vectors.length); for (int i = vectors.length; i < tmp.length; i++) { tmp[i] = new Point3D_F64(); } vectors = tmp; } }
java
protected void declareVectors( int width , int height ) { this.outWidth = width; if( vectors.length < width*height ) { Point3D_F64[] tmp = new Point3D_F64[width*height]; System.arraycopy(vectors,0,tmp,0,vectors.length); for (int i = vectors.length; i < tmp.length; i++) { tmp[i] = new Point3D_F64(); } vectors = tmp; } }
[ "protected", "void", "declareVectors", "(", "int", "width", ",", "int", "height", ")", "{", "this", ".", "outWidth", "=", "width", ";", "if", "(", "vectors", ".", "length", "<", "width", "*", "height", ")", "{", "Point3D_F64", "[", "]", "tmp", "=", "...
Declares storage for precomputed pointing vectors to output image @param width output image width @param height output image height
[ "Declares", "storage", "for", "precomputed", "pointing", "vectors", "to", "output", "image" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularDistortBase_F64.java#L87-L99
OpenBEL/openbel-framework
org.openbel.framework.core/src/main/java/org/openbel/framework/core/df/cache/CacheUtil.java
CacheUtil.downloadResource
public static File downloadResource(String remoteLocation, ResourceType type) throws ResourceDownloadError { String localResourcePath = getResourceFolderPath(type) + File.separator + encodeLocation(remoteLocation); String localResourceLocation = CacheLookupService.DEFAULT_RESOURCE_FILE_NAME + type.getResourceExtension(); File latestResource = resolveResource(remoteLocation, localResourcePath, localResourceLocation); // attempt to download resource hash String remoteHashLocation = remoteLocation + SHA256_EXTENSION; String localHashLocation = localResourceLocation + SHA256_EXTENSION; try { resolveResource(remoteHashLocation, localResourcePath, localHashLocation); } catch (ResourceDownloadError e) { // remote hash does not exist but create local hash createLocalHash(latestResource, remoteLocation); } return latestResource; }
java
public static File downloadResource(String remoteLocation, ResourceType type) throws ResourceDownloadError { String localResourcePath = getResourceFolderPath(type) + File.separator + encodeLocation(remoteLocation); String localResourceLocation = CacheLookupService.DEFAULT_RESOURCE_FILE_NAME + type.getResourceExtension(); File latestResource = resolveResource(remoteLocation, localResourcePath, localResourceLocation); // attempt to download resource hash String remoteHashLocation = remoteLocation + SHA256_EXTENSION; String localHashLocation = localResourceLocation + SHA256_EXTENSION; try { resolveResource(remoteHashLocation, localResourcePath, localHashLocation); } catch (ResourceDownloadError e) { // remote hash does not exist but create local hash createLocalHash(latestResource, remoteLocation); } return latestResource; }
[ "public", "static", "File", "downloadResource", "(", "String", "remoteLocation", ",", "ResourceType", "type", ")", "throws", "ResourceDownloadError", "{", "String", "localResourcePath", "=", "getResourceFolderPath", "(", "type", ")", "+", "File", ".", "separator", "...
Download the resource and hash the contents using {@link Hasher}. @param remoteLocation {@link String}, the remote resource location @param type {@link ResourceType}, the resource type @return {@link File} the downloaded resource file, decompressed if the file is in GZIP format @throws ResourceDownloadError Thrown if the remote resource could not be downloaded @throws IOException Thrown if an IO error occurred while handling the resources
[ "Download", "the", "resource", "and", "hash", "the", "contents", "using", "{", "@link", "Hasher", "}", "." ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/df/cache/CacheUtil.java#L139-L165
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceRegionPersistenceImpl.java
CommerceRegionPersistenceImpl.findByUUID_G
@Override public CommerceRegion findByUUID_G(String uuid, long groupId) throws NoSuchRegionException { CommerceRegion commerceRegion = fetchByUUID_G(uuid, groupId); if (commerceRegion == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchRegionException(msg.toString()); } return commerceRegion; }
java
@Override public CommerceRegion findByUUID_G(String uuid, long groupId) throws NoSuchRegionException { CommerceRegion commerceRegion = fetchByUUID_G(uuid, groupId); if (commerceRegion == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchRegionException(msg.toString()); } return commerceRegion; }
[ "@", "Override", "public", "CommerceRegion", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchRegionException", "{", "CommerceRegion", "commerceRegion", "=", "fetchByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "if", "(", "...
Returns the commerce region where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchRegionException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce region @throws NoSuchRegionException if a matching commerce region could not be found
[ "Returns", "the", "commerce", "region", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchRegionException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceRegionPersistenceImpl.java#L665-L691