repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
networknt/light-4j | client/src/main/java/org/apache/hc/core5/util/copied/ByteArrayBuffer.java | ByteArrayBuffer.indexOf | public int indexOf(final byte b, final int from, final int to) {
int beginIndex = from;
if (beginIndex < 0) {
beginIndex = 0;
}
int endIndex = to;
if (endIndex > this.len) {
endIndex = this.len;
}
if (beginIndex > endIndex) {
return -1;
}
for (int i = beginIndex; i < endIndex; i++) {
if (this.array[i] == b) {
return i;
}
}
return -1;
} | java | public int indexOf(final byte b, final int from, final int to) {
int beginIndex = from;
if (beginIndex < 0) {
beginIndex = 0;
}
int endIndex = to;
if (endIndex > this.len) {
endIndex = this.len;
}
if (beginIndex > endIndex) {
return -1;
}
for (int i = beginIndex; i < endIndex; i++) {
if (this.array[i] == b) {
return i;
}
}
return -1;
} | [
"public",
"int",
"indexOf",
"(",
"final",
"byte",
"b",
",",
"final",
"int",
"from",
",",
"final",
"int",
"to",
")",
"{",
"int",
"beginIndex",
"=",
"from",
";",
"if",
"(",
"beginIndex",
"<",
"0",
")",
"{",
"beginIndex",
"=",
"0",
";",
"}",
"int",
... | Returns the index within this buffer of the first occurrence of the
specified byte, starting the search at the specified
{@code beginIndex} and finishing at {@code endIndex}.
If no such byte occurs in this buffer within the specified bounds,
{@code -1} is returned.
<p>
There is no restriction on the value of {@code beginIndex} and
{@code endIndex}. If {@code beginIndex} is negative,
it has the same effect as if it were zero. If {@code endIndex} is
greater than {@link #length()}, it has the same effect as if it were
{@link #length()}. If the {@code beginIndex} is greater than
the {@code endIndex}, {@code -1} is returned.
@param b the byte to search for.
@param from the index to start the search from.
@param to the index to finish the search at.
@return the index of the first occurrence of the byte in the buffer
within the given bounds, or {@code -1} if the byte does
not occur.
@since 4.1 | [
"Returns",
"the",
"index",
"within",
"this",
"buffer",
"of",
"the",
"first",
"occurrence",
"of",
"the",
"specified",
"byte",
"starting",
"the",
"search",
"at",
"the",
"specified",
"{",
"@code",
"beginIndex",
"}",
"and",
"finishing",
"at",
"{",
"@code",
"endI... | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/util/copied/ByteArrayBuffer.java#L309-L327 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java | VirtualMachineScaleSetsInner.powerOffAsync | public Observable<OperationStatusResponseInner> powerOffAsync(String resourceGroupName, String vmScaleSetName) {
return powerOffWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | java | public Observable<OperationStatusResponseInner> powerOffAsync(String resourceGroupName, String vmScaleSetName) {
return powerOffWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatusResponseInner",
">",
"powerOffAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
")",
"{",
"return",
"powerOffWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmScaleSetName",
")",
".",
"map"... | Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Power",
"off",
"(",
"stop",
")",
"one",
"or",
"more",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
".",
"Note",
"that",
"resources",
"are",
"still",
"attached",
"and",
"you",
"are",
"getting",
"charged",
"for",
"the",
"resources",
".",
"Inste... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L1751-L1758 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java | DateTimeFormatter.ofPattern | public static DateTimeFormatter ofPattern(String pattern, Locale locale) {
return new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter(locale);
} | java | public static DateTimeFormatter ofPattern(String pattern, Locale locale) {
return new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter(locale);
} | [
"public",
"static",
"DateTimeFormatter",
"ofPattern",
"(",
"String",
"pattern",
",",
"Locale",
"locale",
")",
"{",
"return",
"new",
"DateTimeFormatterBuilder",
"(",
")",
".",
"appendPattern",
"(",
"pattern",
")",
".",
"toFormatter",
"(",
"locale",
")",
";",
"}... | Creates a formatter using the specified pattern and locale.
<p>
This method will create a formatter based on a simple
<a href="#patterns">pattern of letters and symbols</a>
as described in the class documentation.
For example, {@code d MMM uuuu} will format 2011-12-03 as '3 Dec 2011'.
<p>
The formatter will use the specified locale.
This can be changed using {@link DateTimeFormatter#withLocale(Locale)} on the returned formatter
<p>
The returned formatter has no override chronology or zone.
It uses {@link ResolverStyle#SMART SMART} resolver style.
@param pattern the pattern to use, not null
@param locale the locale to use, not null
@return the formatter based on the pattern, not null
@throws IllegalArgumentException if the pattern is invalid
@see DateTimeFormatterBuilder#appendPattern(String) | [
"Creates",
"a",
"formatter",
"using",
"the",
"specified",
"pattern",
"and",
"locale",
".",
"<p",
">",
"This",
"method",
"will",
"create",
"a",
"formatter",
"based",
"on",
"a",
"simple",
"<a",
"href",
"=",
"#patterns",
">",
"pattern",
"of",
"letters",
"and"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java#L559-L561 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/DefaultBeanContext.java | DefaultBeanContext.getBean | public @Nonnull <T> T getBean(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType, @Nullable Qualifier<T> qualifier) {
ArgumentUtils.requireNonNull("beanType", beanType);
return getBeanInternal(resolutionContext, beanType, qualifier, true, true);
} | java | public @Nonnull <T> T getBean(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType, @Nullable Qualifier<T> qualifier) {
ArgumentUtils.requireNonNull("beanType", beanType);
return getBeanInternal(resolutionContext, beanType, qualifier, true, true);
} | [
"public",
"@",
"Nonnull",
"<",
"T",
">",
"T",
"getBean",
"(",
"@",
"Nullable",
"BeanResolutionContext",
"resolutionContext",
",",
"@",
"Nonnull",
"Class",
"<",
"T",
">",
"beanType",
",",
"@",
"Nullable",
"Qualifier",
"<",
"T",
">",
"qualifier",
")",
"{",
... | Get a bean of the given type and qualifier.
@param resolutionContext The bean context resolution
@param beanType The bean type
@param qualifier The qualifier
@param <T> The bean type parameter
@return The found bean | [
"Get",
"a",
"bean",
"of",
"the",
"given",
"type",
"and",
"qualifier",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/DefaultBeanContext.java#L1011-L1014 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java | ClassFinder.loadClass | public ClassSymbol loadClass(ModuleSymbol msym, Name flatname) throws CompletionFailure {
Assert.checkNonNull(msym);
Name packageName = Convert.packagePart(flatname);
PackageSymbol ps = syms.lookupPackage(msym, packageName);
Assert.checkNonNull(ps.modle, () -> "msym=" + msym + "; flatName=" + flatname);
boolean absent = syms.getClass(ps.modle, flatname) == null;
ClassSymbol c = syms.enterClass(ps.modle, flatname);
if (c.members_field == null) {
try {
c.complete();
} catch (CompletionFailure ex) {
if (absent) syms.removeClass(ps.modle, flatname);
throw ex;
}
}
return c;
} | java | public ClassSymbol loadClass(ModuleSymbol msym, Name flatname) throws CompletionFailure {
Assert.checkNonNull(msym);
Name packageName = Convert.packagePart(flatname);
PackageSymbol ps = syms.lookupPackage(msym, packageName);
Assert.checkNonNull(ps.modle, () -> "msym=" + msym + "; flatName=" + flatname);
boolean absent = syms.getClass(ps.modle, flatname) == null;
ClassSymbol c = syms.enterClass(ps.modle, flatname);
if (c.members_field == null) {
try {
c.complete();
} catch (CompletionFailure ex) {
if (absent) syms.removeClass(ps.modle, flatname);
throw ex;
}
}
return c;
} | [
"public",
"ClassSymbol",
"loadClass",
"(",
"ModuleSymbol",
"msym",
",",
"Name",
"flatname",
")",
"throws",
"CompletionFailure",
"{",
"Assert",
".",
"checkNonNull",
"(",
"msym",
")",
";",
"Name",
"packageName",
"=",
"Convert",
".",
"packagePart",
"(",
"flatname",... | Load a toplevel class with given fully qualified name
The class is entered into `classes' only if load was successful. | [
"Load",
"a",
"toplevel",
"class",
"with",
"given",
"fully",
"qualified",
"name",
"The",
"class",
"is",
"entered",
"into",
"classes",
"only",
"if",
"load",
"was",
"successful",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java#L399-L418 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java | GeneratedDFactoryDaoImpl.queryByUpdatedBy | public Iterable<DFactory> queryByUpdatedBy(java.lang.String updatedBy) {
return queryByField(null, DFactoryMapper.Field.UPDATEDBY.getFieldName(), updatedBy);
} | java | public Iterable<DFactory> queryByUpdatedBy(java.lang.String updatedBy) {
return queryByField(null, DFactoryMapper.Field.UPDATEDBY.getFieldName(), updatedBy);
} | [
"public",
"Iterable",
"<",
"DFactory",
">",
"queryByUpdatedBy",
"(",
"java",
".",
"lang",
".",
"String",
"updatedBy",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DFactoryMapper",
".",
"Field",
".",
"UPDATEDBY",
".",
"getFieldName",
"(",
")",
",",
... | query-by method for field updatedBy
@param updatedBy the specified attribute
@return an Iterable of DFactorys for the specified updatedBy | [
"query",
"-",
"by",
"method",
"for",
"field",
"updatedBy"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java#L115-L117 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/subset/neigh/SingleAdditionNeighbourhood.java | SingleAdditionNeighbourhood.getRandomMove | @Override
public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) {
// check size limit
if(maxSizeReached(solution)){
// size limit would be exceeded
return null;
}
// get set of candidate IDs for addition (possibly fixed IDs are discarded)
Set<Integer> addCandidates = getAddCandidates(solution);
// check if addition is possible
if(addCandidates.isEmpty()){
return null;
}
// select random ID to add to selection
int add = SetUtilities.getRandomElement(addCandidates, rnd);
// create and return addition move
return new AdditionMove(add);
} | java | @Override
public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) {
// check size limit
if(maxSizeReached(solution)){
// size limit would be exceeded
return null;
}
// get set of candidate IDs for addition (possibly fixed IDs are discarded)
Set<Integer> addCandidates = getAddCandidates(solution);
// check if addition is possible
if(addCandidates.isEmpty()){
return null;
}
// select random ID to add to selection
int add = SetUtilities.getRandomElement(addCandidates, rnd);
// create and return addition move
return new AdditionMove(add);
} | [
"@",
"Override",
"public",
"SubsetMove",
"getRandomMove",
"(",
"SubsetSolution",
"solution",
",",
"Random",
"rnd",
")",
"{",
"// check size limit",
"if",
"(",
"maxSizeReached",
"(",
"solution",
")",
")",
"{",
"// size limit would be exceeded",
"return",
"null",
";",... | Generates a random addition move for the given subset solution that adds a single ID to the selection.
Possible fixed IDs are not considered to be added and the maximum subset size is taken into account.
If no addition move can be generated, <code>null</code> is returned.
@param solution solution for which a random addition move is generated
@param rnd source of randomness used to generate random move
@return random addition move, <code>null</code> if no move can be generated | [
"Generates",
"a",
"random",
"addition",
"move",
"for",
"the",
"given",
"subset",
"solution",
"that",
"adds",
"a",
"single",
"ID",
"to",
"the",
"selection",
".",
"Possible",
"fixed",
"IDs",
"are",
"not",
"considered",
"to",
"be",
"added",
"and",
"the",
"max... | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/SingleAdditionNeighbourhood.java#L104-L121 |
querydsl/querydsl | querydsl-jpa/src/main/java/com/querydsl/jpa/hibernate/HibernateUpdateClause.java | HibernateUpdateClause.setLockMode | @SuppressWarnings("unchecked")
public HibernateUpdateClause setLockMode(Path<?> path, LockMode lockMode) {
lockModes.put(path, lockMode);
return this;
} | java | @SuppressWarnings("unchecked")
public HibernateUpdateClause setLockMode(Path<?> path, LockMode lockMode) {
lockModes.put(path, lockMode);
return this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"HibernateUpdateClause",
"setLockMode",
"(",
"Path",
"<",
"?",
">",
"path",
",",
"LockMode",
"lockMode",
")",
"{",
"lockModes",
".",
"put",
"(",
"path",
",",
"lockMode",
")",
";",
"return",
"this"... | Set the lock mode for the given path.
@return the current object | [
"Set",
"the",
"lock",
"mode",
"for",
"the",
"given",
"path",
"."
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-jpa/src/main/java/com/querydsl/jpa/hibernate/HibernateUpdateClause.java#L143-L147 |
spotify/docker-client | src/main/java/com/spotify/docker/client/DockerHost.java | DockerHost.fromEnv | public static DockerHost fromEnv() {
final String host = endpointFromEnv();
final String certPath = certPathFromEnv();
return new DockerHost(host, certPath);
} | java | public static DockerHost fromEnv() {
final String host = endpointFromEnv();
final String certPath = certPathFromEnv();
return new DockerHost(host, certPath);
} | [
"public",
"static",
"DockerHost",
"fromEnv",
"(",
")",
"{",
"final",
"String",
"host",
"=",
"endpointFromEnv",
"(",
")",
";",
"final",
"String",
"certPath",
"=",
"certPathFromEnv",
"(",
")",
";",
"return",
"new",
"DockerHost",
"(",
"host",
",",
"certPath",
... | Create a {@link DockerHost} from DOCKER_HOST and DOCKER_PORT env vars.
@return The DockerHost object. | [
"Create",
"a",
"{",
"@link",
"DockerHost",
"}",
"from",
"DOCKER_HOST",
"and",
"DOCKER_PORT",
"env",
"vars",
"."
] | train | https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/DockerHost.java#L169-L173 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/text/RtfSection.java | RtfSection.updateIndentation | private void updateIndentation(float indentLeft, float indentRight, float indentContent) {
if(this.title != null) {
this.title.setIndentLeft((int) (this.title.getIndentLeft() + indentLeft * RtfElement.TWIPS_FACTOR));
this.title.setIndentRight((int) (this.title.getIndentRight() + indentRight * RtfElement.TWIPS_FACTOR));
}
for(int i = 0; i < this.items.size(); i++) {
RtfBasicElement rtfElement = (RtfBasicElement) this.items.get(i);
if(rtfElement instanceof RtfSection) {
((RtfSection) rtfElement).updateIndentation(indentLeft + indentContent, indentRight, 0);
} else if(rtfElement instanceof RtfParagraph) {
((RtfParagraph) rtfElement).setIndentLeft((int) (((RtfParagraph) rtfElement).getIndentLeft() + (indentLeft + indentContent) * RtfElement.TWIPS_FACTOR));
((RtfParagraph) rtfElement).setIndentRight((int) (((RtfParagraph) rtfElement).getIndentRight() + indentRight * RtfElement.TWIPS_FACTOR));
}
}
} | java | private void updateIndentation(float indentLeft, float indentRight, float indentContent) {
if(this.title != null) {
this.title.setIndentLeft((int) (this.title.getIndentLeft() + indentLeft * RtfElement.TWIPS_FACTOR));
this.title.setIndentRight((int) (this.title.getIndentRight() + indentRight * RtfElement.TWIPS_FACTOR));
}
for(int i = 0; i < this.items.size(); i++) {
RtfBasicElement rtfElement = (RtfBasicElement) this.items.get(i);
if(rtfElement instanceof RtfSection) {
((RtfSection) rtfElement).updateIndentation(indentLeft + indentContent, indentRight, 0);
} else if(rtfElement instanceof RtfParagraph) {
((RtfParagraph) rtfElement).setIndentLeft((int) (((RtfParagraph) rtfElement).getIndentLeft() + (indentLeft + indentContent) * RtfElement.TWIPS_FACTOR));
((RtfParagraph) rtfElement).setIndentRight((int) (((RtfParagraph) rtfElement).getIndentRight() + indentRight * RtfElement.TWIPS_FACTOR));
}
}
} | [
"private",
"void",
"updateIndentation",
"(",
"float",
"indentLeft",
",",
"float",
"indentRight",
",",
"float",
"indentContent",
")",
"{",
"if",
"(",
"this",
".",
"title",
"!=",
"null",
")",
"{",
"this",
".",
"title",
".",
"setIndentLeft",
"(",
"(",
"int",
... | Updates the left, right and content indentation of all RtfParagraph and RtfSection
elements that this RtfSection contains.
@param indentLeft The left indentation to add.
@param indentRight The right indentation to add.
@param indentContent The content indentation to add. | [
"Updates",
"the",
"left",
"right",
"and",
"content",
"indentation",
"of",
"all",
"RtfParagraph",
"and",
"RtfSection",
"elements",
"that",
"this",
"RtfSection",
"contains",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/text/RtfSection.java#L183-L197 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java | ManagedDatabasesInner.createOrUpdateAsync | public Observable<ManagedDatabaseInner> createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1<ServiceResponse<ManagedDatabaseInner>, ManagedDatabaseInner>() {
@Override
public ManagedDatabaseInner call(ServiceResponse<ManagedDatabaseInner> response) {
return response.body();
}
});
} | java | public Observable<ManagedDatabaseInner> createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1<ServiceResponse<ManagedDatabaseInner>, ManagedDatabaseInner>() {
@Override
public ManagedDatabaseInner call(ServiceResponse<ManagedDatabaseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ManagedDatabaseInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
",",
"String",
"databaseName",
",",
"ManagedDatabaseInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServic... | Creates a new database or updates an existing database.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance.
@param databaseName The name of the database.
@param parameters The requested database resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"a",
"new",
"database",
"or",
"updates",
"an",
"existing",
"database",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java#L544-L551 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbSearch.java | TmdbSearch.searchPeople | public ResultList<PersonFind> searchPeople(String query, Integer page, Boolean includeAdult, SearchType searchType) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.QUERY, query);
parameters.add(Param.ADULT, includeAdult);
parameters.add(Param.PAGE, page);
if (searchType != null) {
parameters.add(Param.SEARCH_TYPE, searchType.getPropertyString());
}
URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.PERSON).buildUrl(parameters);
WrapperGenericList<PersonFind> wrapper = processWrapper(getTypeReference(PersonFind.class), url, "person");
return wrapper.getResultsList();
} | java | public ResultList<PersonFind> searchPeople(String query, Integer page, Boolean includeAdult, SearchType searchType) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.QUERY, query);
parameters.add(Param.ADULT, includeAdult);
parameters.add(Param.PAGE, page);
if (searchType != null) {
parameters.add(Param.SEARCH_TYPE, searchType.getPropertyString());
}
URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.PERSON).buildUrl(parameters);
WrapperGenericList<PersonFind> wrapper = processWrapper(getTypeReference(PersonFind.class), url, "person");
return wrapper.getResultsList();
} | [
"public",
"ResultList",
"<",
"PersonFind",
">",
"searchPeople",
"(",
"String",
"query",
",",
"Integer",
"page",
",",
"Boolean",
"includeAdult",
",",
"SearchType",
"searchType",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"Tm... | This is a good starting point to start finding people on TMDb.
The idea is to be a quick and light method so you can iterate through people quickly.
@param query
@param includeAdult
@param page
@param searchType
@return
@throws MovieDbException | [
"This",
"is",
"a",
"good",
"starting",
"point",
"to",
"start",
"finding",
"people",
"on",
"TMDb",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbSearch.java#L206-L217 |
matomo-org/piwik-java-tracker | src/main/java/org/piwik/java/tracking/PiwikRequest.java | PiwikRequest.setPageCustomVariable | @Deprecated
public void setPageCustomVariable(String key, String value){
if (value == null){
removeCustomVariable(PAGE_CUSTOM_VARIABLE, key);
} else {
setCustomVariable(PAGE_CUSTOM_VARIABLE, new CustomVariable(key, value), null);
}
} | java | @Deprecated
public void setPageCustomVariable(String key, String value){
if (value == null){
removeCustomVariable(PAGE_CUSTOM_VARIABLE, key);
} else {
setCustomVariable(PAGE_CUSTOM_VARIABLE, new CustomVariable(key, value), null);
}
} | [
"@",
"Deprecated",
"public",
"void",
"setPageCustomVariable",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"removeCustomVariable",
"(",
"PAGE_CUSTOM_VARIABLE",
",",
"key",
")",
";",
"}",
"else",
"{",
"... | Set a page custom variable with the specified key and value at the first available index.
All page custom variables with this key will be overwritten or deleted
@param key the key of the variable to set
@param value the value of the variable to set at the specified key. A null value will remove this custom variable
@deprecated Use the {@link #setPageCustomVariable(CustomVariable, int)} method instead. | [
"Set",
"a",
"page",
"custom",
"variable",
"with",
"the",
"specified",
"key",
"and",
"value",
"at",
"the",
"first",
"available",
"index",
".",
"All",
"page",
"custom",
"variables",
"with",
"this",
"key",
"will",
"be",
"overwritten",
"or",
"deleted"
] | train | https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikRequest.java#L985-L992 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationCalibration.java | EvaluationCalibration.getProbabilityHistogram | public Histogram getProbabilityHistogram(int labelClassIdx) {
String title = "Network Probabilities Histogram - P(class " + labelClassIdx + ") - Data Labelled Class "
+ labelClassIdx + " Only";
int[] counts = probHistogramByLabelClass.getColumn(labelClassIdx).dup().data().asInt();
return new Histogram(title, 0.0, 1.0, counts);
} | java | public Histogram getProbabilityHistogram(int labelClassIdx) {
String title = "Network Probabilities Histogram - P(class " + labelClassIdx + ") - Data Labelled Class "
+ labelClassIdx + " Only";
int[] counts = probHistogramByLabelClass.getColumn(labelClassIdx).dup().data().asInt();
return new Histogram(title, 0.0, 1.0, counts);
} | [
"public",
"Histogram",
"getProbabilityHistogram",
"(",
"int",
"labelClassIdx",
")",
"{",
"String",
"title",
"=",
"\"Network Probabilities Histogram - P(class \"",
"+",
"labelClassIdx",
"+",
"\") - Data Labelled Class \"",
"+",
"labelClassIdx",
"+",
"\" Only\"",
";",
"int",
... | Return a probability histogram of the specified label class index. That is, for label class index i,
a histogram of P(class_i | input) is returned, only for those examples that are labelled as class i.
@param labelClassIdx Index of the label class to get the histogram for
@return Probability histogram | [
"Return",
"a",
"probability",
"histogram",
"of",
"the",
"specified",
"label",
"class",
"index",
".",
"That",
"is",
"for",
"label",
"class",
"index",
"i",
"a",
"histogram",
"of",
"P",
"(",
"class_i",
"|",
"input",
")",
"is",
"returned",
"only",
"for",
"th... | 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#L467-L472 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.isAssignable | public static void isAssignable(Class<?> superType, Class<?> subType) throws IllegalArgumentException {
isAssignable(superType, subType, "{} is not assignable to {})", subType, superType);
} | java | public static void isAssignable(Class<?> superType, Class<?> subType) throws IllegalArgumentException {
isAssignable(superType, subType, "{} is not assignable to {})", subType, superType);
} | [
"public",
"static",
"void",
"isAssignable",
"(",
"Class",
"<",
"?",
">",
"superType",
",",
"Class",
"<",
"?",
">",
"subType",
")",
"throws",
"IllegalArgumentException",
"{",
"isAssignable",
"(",
"superType",
",",
"subType",
",",
"\"{} is not assignable to {})\"",
... | 断言 {@code superType.isAssignableFrom(subType)} 是否为 {@code true}.
<pre class="code">
Assert.isAssignable(Number.class, myClass);
</pre>
@param superType 需要检查的父类或接口
@param subType 需要检查的子类
@throws IllegalArgumentException 如果子类非继承父类,抛出此异常 | [
"断言",
"{",
"@code",
"superType",
".",
"isAssignableFrom",
"(",
"subType",
")",
"}",
"是否为",
"{",
"@code",
"true",
"}",
"."
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L468-L470 |
beanshell/beanshell | src/main/java/bsh/Interpreter.java | Interpreter.source | public Object source( String filename )
throws FileNotFoundException, IOException, EvalError
{
return source( filename, globalNameSpace );
} | java | public Object source( String filename )
throws FileNotFoundException, IOException, EvalError
{
return source( filename, globalNameSpace );
} | [
"public",
"Object",
"source",
"(",
"String",
"filename",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
",",
"EvalError",
"{",
"return",
"source",
"(",
"filename",
",",
"globalNameSpace",
")",
";",
"}"
] | Read text from fileName and eval it.
Convenience method. Use the global namespace. | [
"Read",
"text",
"from",
"fileName",
"and",
"eval",
"it",
".",
"Convenience",
"method",
".",
"Use",
"the",
"global",
"namespace",
"."
] | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Interpreter.java#L580-L584 |
baratine/baratine | framework/src/main/java/com/caucho/v5/amp/remote/ServiceRefLinkFactory.java | ServiceRefLinkFactory.createLinkService | public ServiceRefAmp createLinkService(String path, PodRef podCaller)
{
StubLink actorLink;
String address = _scheme + "//" + _serviceRefOut.address() + path;
ServiceRefAmp parentRef = _actorOut.getServiceRef();
if (_queryMapRef != null) {
//String addressSelf = "/system";
//ServiceRefAmp systemRef = _manager.getSystemInbox().getServiceRef();
actorLink = new StubLinkUnidir(_manager, path, parentRef, _queryMapRef, podCaller, _actorOut);
}
else {
actorLink = new StubLink(_manager, path, parentRef, podCaller, _actorOut);
}
ServiceRefAmp linkRef = _serviceRefOut.pin(actorLink, address);
// ServiceRefClient needed to maintain workers, cloud/0420
ServiceRefAmp clientRef = new ServiceRefClient(address,
linkRef.stub(),
linkRef.inbox());
actorLink.initSelfRef(clientRef);
return clientRef;
} | java | public ServiceRefAmp createLinkService(String path, PodRef podCaller)
{
StubLink actorLink;
String address = _scheme + "//" + _serviceRefOut.address() + path;
ServiceRefAmp parentRef = _actorOut.getServiceRef();
if (_queryMapRef != null) {
//String addressSelf = "/system";
//ServiceRefAmp systemRef = _manager.getSystemInbox().getServiceRef();
actorLink = new StubLinkUnidir(_manager, path, parentRef, _queryMapRef, podCaller, _actorOut);
}
else {
actorLink = new StubLink(_manager, path, parentRef, podCaller, _actorOut);
}
ServiceRefAmp linkRef = _serviceRefOut.pin(actorLink, address);
// ServiceRefClient needed to maintain workers, cloud/0420
ServiceRefAmp clientRef = new ServiceRefClient(address,
linkRef.stub(),
linkRef.inbox());
actorLink.initSelfRef(clientRef);
return clientRef;
} | [
"public",
"ServiceRefAmp",
"createLinkService",
"(",
"String",
"path",
",",
"PodRef",
"podCaller",
")",
"{",
"StubLink",
"actorLink",
";",
"String",
"address",
"=",
"_scheme",
"+",
"\"//\"",
"+",
"_serviceRefOut",
".",
"address",
"(",
")",
"+",
"path",
";",
... | Return the serviceRef for a foreign path and calling pod.
@param path the service path on the foreign server
@param podCaller the name of the calling pod. | [
"Return",
"the",
"serviceRef",
"for",
"a",
"foreign",
"path",
"and",
"calling",
"pod",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/amp/remote/ServiceRefLinkFactory.java#L86-L115 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/db/GeoPackageCoreConnection.java | GeoPackageCoreConnection.querySingleRowResults | public List<Object> querySingleRowResults(String sql, String[] args) {
return querySingleRowResults(sql, args, null);
} | java | public List<Object> querySingleRowResults(String sql, String[] args) {
return querySingleRowResults(sql, args, null);
} | [
"public",
"List",
"<",
"Object",
">",
"querySingleRowResults",
"(",
"String",
"sql",
",",
"String",
"[",
"]",
"args",
")",
"{",
"return",
"querySingleRowResults",
"(",
"sql",
",",
"args",
",",
"null",
")",
";",
"}"
] | Query for values in a single (first) row
@param sql
sql statement
@param args
arguments
@return single row results
@since 3.1.0 | [
"Query",
"for",
"values",
"in",
"a",
"single",
"(",
"first",
")",
"row"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/db/GeoPackageCoreConnection.java#L634-L636 |
joniles/mpxj | src/main/java/net/sf/mpxj/json/JsonWriter.java | JsonWriter.writeIntegerField | private void writeIntegerField(String fieldName, Object value) throws IOException
{
int val = ((Number) value).intValue();
if (val != 0)
{
m_writer.writeNameValuePair(fieldName, val);
}
} | java | private void writeIntegerField(String fieldName, Object value) throws IOException
{
int val = ((Number) value).intValue();
if (val != 0)
{
m_writer.writeNameValuePair(fieldName, val);
}
} | [
"private",
"void",
"writeIntegerField",
"(",
"String",
"fieldName",
",",
"Object",
"value",
")",
"throws",
"IOException",
"{",
"int",
"val",
"=",
"(",
"(",
"Number",
")",
"value",
")",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"val",
"!=",
"0",
")",
... | Write an integer field to the JSON file.
@param fieldName field name
@param value field value | [
"Write",
"an",
"integer",
"field",
"to",
"the",
"JSON",
"file",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonWriter.java#L370-L377 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/LogAnalyticsInner.java | LogAnalyticsInner.beginExportThrottledRequestsAsync | public Observable<LogAnalyticsOperationResultInner> beginExportThrottledRequestsAsync(String location, ThrottledRequestsInput parameters) {
return beginExportThrottledRequestsWithServiceResponseAsync(location, parameters).map(new Func1<ServiceResponse<LogAnalyticsOperationResultInner>, LogAnalyticsOperationResultInner>() {
@Override
public LogAnalyticsOperationResultInner call(ServiceResponse<LogAnalyticsOperationResultInner> response) {
return response.body();
}
});
} | java | public Observable<LogAnalyticsOperationResultInner> beginExportThrottledRequestsAsync(String location, ThrottledRequestsInput parameters) {
return beginExportThrottledRequestsWithServiceResponseAsync(location, parameters).map(new Func1<ServiceResponse<LogAnalyticsOperationResultInner>, LogAnalyticsOperationResultInner>() {
@Override
public LogAnalyticsOperationResultInner call(ServiceResponse<LogAnalyticsOperationResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LogAnalyticsOperationResultInner",
">",
"beginExportThrottledRequestsAsync",
"(",
"String",
"location",
",",
"ThrottledRequestsInput",
"parameters",
")",
"{",
"return",
"beginExportThrottledRequestsWithServiceResponseAsync",
"(",
"location",
",",
"... | Export logs that show total throttled Api requests for this subscription in the given time window.
@param location The location upon which virtual-machine-sizes is queried.
@param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the LogAnalyticsOperationResultInner object | [
"Export",
"logs",
"that",
"show",
"total",
"throttled",
"Api",
"requests",
"for",
"this",
"subscription",
"in",
"the",
"given",
"time",
"window",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/LogAnalyticsInner.java#L339-L346 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java | VersionsImpl.cloneWithServiceResponseAsync | public Observable<ServiceResponse<String>> cloneWithServiceResponseAsync(UUID appId, String versionId, CloneOptionalParameter cloneOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final String version = cloneOptionalParameter != null ? cloneOptionalParameter.version() : null;
return cloneWithServiceResponseAsync(appId, versionId, version);
} | java | public Observable<ServiceResponse<String>> cloneWithServiceResponseAsync(UUID appId, String versionId, CloneOptionalParameter cloneOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final String version = cloneOptionalParameter != null ? cloneOptionalParameter.version() : null;
return cloneWithServiceResponseAsync(appId, versionId, version);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"String",
">",
">",
"cloneWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"CloneOptionalParameter",
"cloneOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
".",
"e... | Creates a new version using the current snapshot of the selected application version.
@param appId The application ID.
@param versionId The version ID.
@param cloneOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the String object | [
"Creates",
"a",
"new",
"version",
"using",
"the",
"current",
"snapshot",
"of",
"the",
"selected",
"application",
"version",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java#L162-L175 |
joniles/mpxj | src/main/java/net/sf/mpxj/sample/MpxjConvert.java | MpxjConvert.process | public void process(String inputFile, String outputFile) throws Exception
{
System.out.println("Reading input file started.");
long start = System.currentTimeMillis();
ProjectFile projectFile = readFile(inputFile);
long elapsed = System.currentTimeMillis() - start;
System.out.println("Reading input file completed in " + elapsed + "ms.");
System.out.println("Writing output file started.");
start = System.currentTimeMillis();
ProjectWriter writer = ProjectWriterUtility.getProjectWriter(outputFile);
writer.write(projectFile, outputFile);
elapsed = System.currentTimeMillis() - start;
System.out.println("Writing output completed in " + elapsed + "ms.");
} | java | public void process(String inputFile, String outputFile) throws Exception
{
System.out.println("Reading input file started.");
long start = System.currentTimeMillis();
ProjectFile projectFile = readFile(inputFile);
long elapsed = System.currentTimeMillis() - start;
System.out.println("Reading input file completed in " + elapsed + "ms.");
System.out.println("Writing output file started.");
start = System.currentTimeMillis();
ProjectWriter writer = ProjectWriterUtility.getProjectWriter(outputFile);
writer.write(projectFile, outputFile);
elapsed = System.currentTimeMillis() - start;
System.out.println("Writing output completed in " + elapsed + "ms.");
} | [
"public",
"void",
"process",
"(",
"String",
"inputFile",
",",
"String",
"outputFile",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Reading input file started.\"",
")",
";",
"long",
"start",
"=",
"System",
".",
"currentTimeMillis... | Convert one project file format to another.
@param inputFile input file
@param outputFile output file
@throws Exception | [
"Convert",
"one",
"project",
"file",
"format",
"to",
"another",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjConvert.java#L80-L94 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.validateRevocationStatus | void validateRevocationStatus(X509Certificate[] chain, String peerHost) throws CertificateException
{
final List<Certificate> bcChain = convertToBouncyCastleCertificate(chain);
final List<SFPair<Certificate, Certificate>> pairIssuerSubjectList =
getPairIssuerSubject(bcChain);
if (peerHost.startsWith("ocspssd"))
{
return;
}
if (ocspCacheServer.new_endpoint_enabled)
{
ocspCacheServer.resetOCSPResponseCacheServer(peerHost);
}
synchronized (OCSP_RESPONSE_CACHE_LOCK)
{
boolean isCached = isCached(pairIssuerSubjectList);
if (this.useOcspResponseCacheServer && !isCached)
{
if (!ocspCacheServer.new_endpoint_enabled)
{
LOGGER.debug(
"Downloading OCSP response cache from the server. URL: {}",
SF_OCSP_RESPONSE_CACHE_SERVER_URL);
}
else
{
LOGGER.debug(
"Downloading OCSP response cache from the server. URL: {}",
ocspCacheServer.SF_OCSP_RESPONSE_CACHE_SERVER);
}
readOcspResponseCacheServer();
// if the cache is downloaded from the server, it should be written
// to the file cache at all times.
WAS_CACHE_UPDATED = true;
}
executeRevocationStatusChecks(pairIssuerSubjectList, peerHost);
if (WAS_CACHE_UPDATED)
{
JsonNode input = encodeCacheToJSON();
fileCacheManager.writeCacheFile(input);
WAS_CACHE_UPDATED = false;
}
}
} | java | void validateRevocationStatus(X509Certificate[] chain, String peerHost) throws CertificateException
{
final List<Certificate> bcChain = convertToBouncyCastleCertificate(chain);
final List<SFPair<Certificate, Certificate>> pairIssuerSubjectList =
getPairIssuerSubject(bcChain);
if (peerHost.startsWith("ocspssd"))
{
return;
}
if (ocspCacheServer.new_endpoint_enabled)
{
ocspCacheServer.resetOCSPResponseCacheServer(peerHost);
}
synchronized (OCSP_RESPONSE_CACHE_LOCK)
{
boolean isCached = isCached(pairIssuerSubjectList);
if (this.useOcspResponseCacheServer && !isCached)
{
if (!ocspCacheServer.new_endpoint_enabled)
{
LOGGER.debug(
"Downloading OCSP response cache from the server. URL: {}",
SF_OCSP_RESPONSE_CACHE_SERVER_URL);
}
else
{
LOGGER.debug(
"Downloading OCSP response cache from the server. URL: {}",
ocspCacheServer.SF_OCSP_RESPONSE_CACHE_SERVER);
}
readOcspResponseCacheServer();
// if the cache is downloaded from the server, it should be written
// to the file cache at all times.
WAS_CACHE_UPDATED = true;
}
executeRevocationStatusChecks(pairIssuerSubjectList, peerHost);
if (WAS_CACHE_UPDATED)
{
JsonNode input = encodeCacheToJSON();
fileCacheManager.writeCacheFile(input);
WAS_CACHE_UPDATED = false;
}
}
} | [
"void",
"validateRevocationStatus",
"(",
"X509Certificate",
"[",
"]",
"chain",
",",
"String",
"peerHost",
")",
"throws",
"CertificateException",
"{",
"final",
"List",
"<",
"Certificate",
">",
"bcChain",
"=",
"convertToBouncyCastleCertificate",
"(",
"chain",
")",
";"... | Certificate Revocation checks
@param chain chain of certificates attached.
@param peerHost Hostname of the server
@throws CertificateException if any certificate validation fails | [
"Certificate",
"Revocation",
"checks"
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L585-L631 |
the-fascinator/plugin-indexer-solr | src/main/java/com/googlecode/fascinator/indexer/SolrIndexer.java | SolrIndexer.cacheConfig | private void cacheConfig(String oid, JsonSimpleConfig config) {
if (useCache && config != null) {
configCache.put(oid, config);
}
} | java | private void cacheConfig(String oid, JsonSimpleConfig config) {
if (useCache && config != null) {
configCache.put(oid, config);
}
} | [
"private",
"void",
"cacheConfig",
"(",
"String",
"oid",
",",
"JsonSimpleConfig",
"config",
")",
"{",
"if",
"(",
"useCache",
"&&",
"config",
"!=",
"null",
")",
"{",
"configCache",
".",
"put",
"(",
"oid",
",",
"config",
")",
";",
"}",
"}"
] | Add a config class to the cache if caching if configured
@param oid
: The config OID to use as an index
@param config
: The instantiated JsonConfigHelper to cache | [
"Add",
"a",
"config",
"class",
"to",
"the",
"cache",
"if",
"caching",
"if",
"configured"
] | train | https://github.com/the-fascinator/plugin-indexer-solr/blob/001159b18b78a87daa5d8b2a17ced28694bae156/src/main/java/com/googlecode/fascinator/indexer/SolrIndexer.java#L1163-L1167 |
GenesysPureEngage/authentication-client-java | src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java | AuthenticationApi.retrieveTokenWithHttpInfo | public ApiResponse<DefaultOAuth2AccessToken> retrieveTokenWithHttpInfo(String grantType, String accept, String authorization, String clientId, String password, String refreshToken, String scope, String username) throws ApiException {
com.squareup.okhttp.Call call = retrieveTokenValidateBeforeCall(grantType, accept, authorization, clientId, password, refreshToken, scope, username, null, null);
Type localVarReturnType = new TypeToken<DefaultOAuth2AccessToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
} | java | public ApiResponse<DefaultOAuth2AccessToken> retrieveTokenWithHttpInfo(String grantType, String accept, String authorization, String clientId, String password, String refreshToken, String scope, String username) throws ApiException {
com.squareup.okhttp.Call call = retrieveTokenValidateBeforeCall(grantType, accept, authorization, clientId, password, refreshToken, scope, username, null, null);
Type localVarReturnType = new TypeToken<DefaultOAuth2AccessToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
} | [
"public",
"ApiResponse",
"<",
"DefaultOAuth2AccessToken",
">",
"retrieveTokenWithHttpInfo",
"(",
"String",
"grantType",
",",
"String",
"accept",
",",
"String",
"authorization",
",",
"String",
"clientId",
",",
"String",
"password",
",",
"String",
"refreshToken",
",",
... | Retrieve access token
Retrieve an access token based on the grant type &mdash; Authorization Code Grant, Resource Owner Password Credentials Grant or Client Credentials Grant. For more information, see [Token Endpoint](https://tools.ietf.org/html/rfc6749). **Note:** For the optional **scope** parameter, the Authentication API supports only the `*` value.
@param grantType The grant type you use to implement authentication. (required)
@param accept The media type the Authentication API should should use for the response. For example: 'Accept: application/x-www-form-urlencoded' (optional)
@param authorization Basic authorization. For example: 'Authorization: Basic Y3...MQ==' (optional)
@param clientId The ID of the application or service that is registered as the client. You'll need to get this value from your PureEngage Cloud representative. (optional)
@param password The agent's password. (optional)
@param refreshToken See [Refresh Token](https://tools.ietf.org/html/rfc6749#section-1.5) for details. (optional)
@param scope The scope of the access request. The Authentication API supports only the `*` value. (optional)
@param username The agent's username. (optional)
@return ApiResponse<DefaultOAuth2AccessToken>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Retrieve",
"access",
"token",
"Retrieve",
"an",
"access",
"token",
"based",
"on",
"the",
"grant",
"type",
"&",
";",
"mdash",
";",
"Authorization",
"Code",
"Grant",
"Resource",
"Owner",
"Password",
"Credentials",
"Grant",
"or",
"Client",
"Credentials",
"Grant... | train | https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java#L1068-L1072 |
janvanbesien/java-ipv6 | src/main/java/com/googlecode/ipv6/IPv6Network.java | IPv6Network.fromTwoAddresses | public static IPv6Network fromTwoAddresses(IPv6Address one, IPv6Address two)
{
final IPv6NetworkMask longestPrefixLength = IPv6NetworkMask.fromPrefixLength(IPv6NetworkHelpers.longestPrefixLength(one, two));
return new IPv6Network(one.maskWithNetworkMask(longestPrefixLength), longestPrefixLength);
} | java | public static IPv6Network fromTwoAddresses(IPv6Address one, IPv6Address two)
{
final IPv6NetworkMask longestPrefixLength = IPv6NetworkMask.fromPrefixLength(IPv6NetworkHelpers.longestPrefixLength(one, two));
return new IPv6Network(one.maskWithNetworkMask(longestPrefixLength), longestPrefixLength);
} | [
"public",
"static",
"IPv6Network",
"fromTwoAddresses",
"(",
"IPv6Address",
"one",
",",
"IPv6Address",
"two",
")",
"{",
"final",
"IPv6NetworkMask",
"longestPrefixLength",
"=",
"IPv6NetworkMask",
".",
"fromPrefixLength",
"(",
"IPv6NetworkHelpers",
".",
"longestPrefixLength"... | Create an IPv6 network from the two addresses within the network. This will construct the smallest possible network ("longest prefix
length") which contains both addresses.
@param one address one
@param two address two, should be bigger than address one
@return ipv6 network | [
"Create",
"an",
"IPv6",
"network",
"from",
"the",
"two",
"addresses",
"within",
"the",
"network",
".",
"This",
"will",
"construct",
"the",
"smallest",
"possible",
"network",
"(",
"longest",
"prefix",
"length",
")",
"which",
"contains",
"both",
"addresses",
"."... | train | https://github.com/janvanbesien/java-ipv6/blob/9af15b4a6c0074f9fa23dfa030027c631b9c2f78/src/main/java/com/googlecode/ipv6/IPv6Network.java#L76-L80 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricStore.java | MetricStore.getSubtaskMetricStore | public synchronized ComponentMetricStore getSubtaskMetricStore(String jobID, String taskID, int subtaskIndex) {
JobMetricStore job = jobID == null ? null : jobs.get(jobID);
if (job == null) {
return null;
}
TaskMetricStore task = job.getTaskMetricStore(taskID);
if (task == null) {
return null;
}
return ComponentMetricStore.unmodifiable(task.getSubtaskMetricStore(subtaskIndex));
} | java | public synchronized ComponentMetricStore getSubtaskMetricStore(String jobID, String taskID, int subtaskIndex) {
JobMetricStore job = jobID == null ? null : jobs.get(jobID);
if (job == null) {
return null;
}
TaskMetricStore task = job.getTaskMetricStore(taskID);
if (task == null) {
return null;
}
return ComponentMetricStore.unmodifiable(task.getSubtaskMetricStore(subtaskIndex));
} | [
"public",
"synchronized",
"ComponentMetricStore",
"getSubtaskMetricStore",
"(",
"String",
"jobID",
",",
"String",
"taskID",
",",
"int",
"subtaskIndex",
")",
"{",
"JobMetricStore",
"job",
"=",
"jobID",
"==",
"null",
"?",
"null",
":",
"jobs",
".",
"get",
"(",
"j... | Returns the {@link ComponentMetricStore} for the given job/task ID and subtask index.
@param jobID job ID
@param taskID task ID
@param subtaskIndex subtask index
@return SubtaskMetricStore for the given IDs and index, or null if no store for the given arguments exists | [
"Returns",
"the",
"{",
"@link",
"ComponentMetricStore",
"}",
"for",
"the",
"given",
"job",
"/",
"task",
"ID",
"and",
"subtask",
"index",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricStore.java#L145-L155 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/ExampleSection.java | ExampleSection.selectExample | public void selectExample(final WComponent example, final String exampleName) {
WComponent currentExample = container.getChildAt(0).getParent();
if (currentExample != null && currentExample.getClass().equals(example.getClass())) {
// Same example selected, do nothing
return;
}
resetExample();
container.removeAll();
this.getDecoratedLabel().setBody(new WText(exampleName));
WApplication app = WebUtilities.getAncestorOfClass(WApplication.class, this);
if (app != null) {
app.setTitle(exampleName);
}
if (example instanceof ErrorComponent) {
tabset.getTab(0).setText("Error");
source.setSource(null);
} else {
String className = example.getClass().getName();
WDefinitionList list = new WDefinitionList(WDefinitionList.Type.COLUMN);
container.add(list);
list.addTerm("Example path", new WText(className.replaceAll("\\.", " / ")));
list.addTerm("Example JavaDoc", new JavaDocText(getSource(className)));
container.add(new WHorizontalRule());
tabset.getTab(0).setText(example.getClass().getSimpleName());
source.setSource(getSource(className));
}
container.add(example);
example.setLocked(true);
} | java | public void selectExample(final WComponent example, final String exampleName) {
WComponent currentExample = container.getChildAt(0).getParent();
if (currentExample != null && currentExample.getClass().equals(example.getClass())) {
// Same example selected, do nothing
return;
}
resetExample();
container.removeAll();
this.getDecoratedLabel().setBody(new WText(exampleName));
WApplication app = WebUtilities.getAncestorOfClass(WApplication.class, this);
if (app != null) {
app.setTitle(exampleName);
}
if (example instanceof ErrorComponent) {
tabset.getTab(0).setText("Error");
source.setSource(null);
} else {
String className = example.getClass().getName();
WDefinitionList list = new WDefinitionList(WDefinitionList.Type.COLUMN);
container.add(list);
list.addTerm("Example path", new WText(className.replaceAll("\\.", " / ")));
list.addTerm("Example JavaDoc", new JavaDocText(getSource(className)));
container.add(new WHorizontalRule());
tabset.getTab(0).setText(example.getClass().getSimpleName());
source.setSource(getSource(className));
}
container.add(example);
example.setLocked(true);
} | [
"public",
"void",
"selectExample",
"(",
"final",
"WComponent",
"example",
",",
"final",
"String",
"exampleName",
")",
"{",
"WComponent",
"currentExample",
"=",
"container",
".",
"getChildAt",
"(",
"0",
")",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"curren... | Selects an example.
@param example the example to select.
@param exampleName the name of the example being selected. | [
"Selects",
"an",
"example",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/ExampleSection.java#L149-L183 |
classgraph/classgraph | src/main/java/io/github/classgraph/ClassInfo.java | ClassInfo.addImplementedInterface | void addImplementedInterface(final String interfaceName, final Map<String, ClassInfo> classNameToClassInfo) {
final ClassInfo interfaceClassInfo = getOrCreateClassInfo(interfaceName,
/* classModifiers = */ Modifier.INTERFACE, classNameToClassInfo);
interfaceClassInfo.isInterface = true;
interfaceClassInfo.modifiers |= Modifier.INTERFACE;
this.addRelatedClass(RelType.IMPLEMENTED_INTERFACES, interfaceClassInfo);
interfaceClassInfo.addRelatedClass(RelType.CLASSES_IMPLEMENTING, this);
} | java | void addImplementedInterface(final String interfaceName, final Map<String, ClassInfo> classNameToClassInfo) {
final ClassInfo interfaceClassInfo = getOrCreateClassInfo(interfaceName,
/* classModifiers = */ Modifier.INTERFACE, classNameToClassInfo);
interfaceClassInfo.isInterface = true;
interfaceClassInfo.modifiers |= Modifier.INTERFACE;
this.addRelatedClass(RelType.IMPLEMENTED_INTERFACES, interfaceClassInfo);
interfaceClassInfo.addRelatedClass(RelType.CLASSES_IMPLEMENTING, this);
} | [
"void",
"addImplementedInterface",
"(",
"final",
"String",
"interfaceName",
",",
"final",
"Map",
"<",
"String",
",",
"ClassInfo",
">",
"classNameToClassInfo",
")",
"{",
"final",
"ClassInfo",
"interfaceClassInfo",
"=",
"getOrCreateClassInfo",
"(",
"interfaceName",
",",... | Add an implemented interface to this class.
@param interfaceName
the interface name
@param classNameToClassInfo
the map from class name to class info | [
"Add",
"an",
"implemented",
"interface",
"to",
"this",
"class",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ClassInfo.java#L383-L390 |
super-csv/super-csv | super-csv-joda/src/main/java/org/supercsv/cellprocessor/joda/ParseDateTimeZone.java | ParseDateTimeZone.execute | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
if (!(value instanceof String)) {
throw new SuperCsvCellProcessorException(String.class, value,
context, this);
}
final DateTimeZone result;
try {
result = DateTimeZone.forID((String) value);
} catch (IllegalArgumentException e) {
throw new SuperCsvCellProcessorException(
"Failed to parse value as a DateTimeZone", context, this, e);
}
return next.execute(result, context);
} | java | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
if (!(value instanceof String)) {
throw new SuperCsvCellProcessorException(String.class, value,
context, this);
}
final DateTimeZone result;
try {
result = DateTimeZone.forID((String) value);
} catch (IllegalArgumentException e) {
throw new SuperCsvCellProcessorException(
"Failed to parse value as a DateTimeZone", context, this, e);
}
return next.execute(result, context);
} | [
"public",
"Object",
"execute",
"(",
"final",
"Object",
"value",
",",
"final",
"CsvContext",
"context",
")",
"{",
"validateInputNotNull",
"(",
"value",
",",
"context",
")",
";",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"String",
")",
")",
"{",
"throw",
... | {@inheritDoc}
@throws SuperCsvCellProcessorException
if value is null or is not a String | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv-joda/src/main/java/org/supercsv/cellprocessor/joda/ParseDateTimeZone.java#L59-L74 |
johnkil/Android-AppMsg | library/src/com/devspark/appmsg/AppMsg.java | AppMsg.makeText | private static AppMsg makeText(Activity context, CharSequence text, Style style, View view, boolean floating) {
return makeText(context, text, style, view, floating, 0);
} | java | private static AppMsg makeText(Activity context, CharSequence text, Style style, View view, boolean floating) {
return makeText(context, text, style, view, floating, 0);
} | [
"private",
"static",
"AppMsg",
"makeText",
"(",
"Activity",
"context",
",",
"CharSequence",
"text",
",",
"Style",
"style",
",",
"View",
"view",
",",
"boolean",
"floating",
")",
"{",
"return",
"makeText",
"(",
"context",
",",
"text",
",",
"style",
",",
"vie... | Make a {@link AppMsg} with a custom view. It can be used to create non-floating notifications if floating is false.
@param context The context to use. Usually your
{@link android.app.Activity} object.
@param view
View to be used.
@param text The text to show. Can be formatted text.
@param style The style with a background and a duration.
@param floating true if it'll float. | [
"Make",
"a",
"{",
"@link",
"AppMsg",
"}",
"with",
"a",
"custom",
"view",
".",
"It",
"can",
"be",
"used",
"to",
"create",
"non",
"-",
"floating",
"notifications",
"if",
"floating",
"is",
"false",
"."
] | train | https://github.com/johnkil/Android-AppMsg/blob/e7fdd7870530a24e6d825278ee0863be0521e8b8/library/src/com/devspark/appmsg/AppMsg.java#L292-L294 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java | Matrix.constructWithCopy | public static Matrix constructWithCopy(double[][] A)
{
int m = A.length;
int n = A[0].length;
Matrix X = new Matrix(m, n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++)
{
if (A[i].length != n)
{
throw new IllegalArgumentException
("All rows must have the same length.");
}
for (int j = 0; j < n; j++)
{
C[i][j] = A[i][j];
}
}
return X;
} | java | public static Matrix constructWithCopy(double[][] A)
{
int m = A.length;
int n = A[0].length;
Matrix X = new Matrix(m, n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++)
{
if (A[i].length != n)
{
throw new IllegalArgumentException
("All rows must have the same length.");
}
for (int j = 0; j < n; j++)
{
C[i][j] = A[i][j];
}
}
return X;
} | [
"public",
"static",
"Matrix",
"constructWithCopy",
"(",
"double",
"[",
"]",
"[",
"]",
"A",
")",
"{",
"int",
"m",
"=",
"A",
".",
"length",
";",
"int",
"n",
"=",
"A",
"[",
"0",
"]",
".",
"length",
";",
"Matrix",
"X",
"=",
"new",
"Matrix",
"(",
"m... | Construct a matrix from a copy of a 2-D array.
@param A Two-dimensional array of doubles.
@throws IllegalArgumentException All rows must have the same length | [
"Construct",
"a",
"matrix",
"from",
"a",
"copy",
"of",
"a",
"2",
"-",
"D",
"array",
"."
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L199-L218 |
calrissian/mango | mango-core/src/main/java/org/calrissian/mango/collect/CloseableIterators.java | CloseableIterators.groupBy | public static <T> CloseableIterator<List<T>> groupBy(final CloseableIterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) {
return wrap(Iterators2.groupBy(iterator, groupingFunction), iterator);
} | java | public static <T> CloseableIterator<List<T>> groupBy(final CloseableIterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) {
return wrap(Iterators2.groupBy(iterator, groupingFunction), iterator);
} | [
"public",
"static",
"<",
"T",
">",
"CloseableIterator",
"<",
"List",
"<",
"T",
">",
">",
"groupBy",
"(",
"final",
"CloseableIterator",
"<",
"?",
"extends",
"T",
">",
"iterator",
",",
"final",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
">",
"grouping... | Divides a closeableiterator into unmodifiable sublists of equivalent elements. The iterator groups elements
in consecutive order, forming a new partition when the value from the provided function changes. For example,
grouping the iterator {@code [1, 3, 2, 4, 5]} with a function grouping even and odd numbers
yields {@code [[1, 3], [2, 4], [5]} all in the original order.
<p/>
<p>The returned lists implement {@link java.util.RandomAccess}. | [
"Divides",
"a",
"closeableiterator",
"into",
"unmodifiable",
"sublists",
"of",
"equivalent",
"elements",
".",
"The",
"iterator",
"groups",
"elements",
"in",
"consecutive",
"order",
"forming",
"a",
"new",
"partition",
"when",
"the",
"value",
"from",
"the",
"provide... | train | https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-core/src/main/java/org/calrissian/mango/collect/CloseableIterators.java#L104-L106 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java | TheMovieDbApi.getSeasonExternalID | public ExternalID getSeasonExternalID(int tvID, int seasonNumber, String language) throws MovieDbException {
return tmdbSeasons.getSeasonExternalID(tvID, seasonNumber, language);
} | java | public ExternalID getSeasonExternalID(int tvID, int seasonNumber, String language) throws MovieDbException {
return tmdbSeasons.getSeasonExternalID(tvID, seasonNumber, language);
} | [
"public",
"ExternalID",
"getSeasonExternalID",
"(",
"int",
"tvID",
",",
"int",
"seasonNumber",
",",
"String",
"language",
")",
"throws",
"MovieDbException",
"{",
"return",
"tmdbSeasons",
".",
"getSeasonExternalID",
"(",
"tvID",
",",
"seasonNumber",
",",
"language",
... | Get the external ids that we have stored for a TV season by season
number.
@param tvID tvID
@param seasonNumber seasonNumber
@param language language
@return
@throws MovieDbException exception | [
"Get",
"the",
"external",
"ids",
"that",
"we",
"have",
"stored",
"for",
"a",
"TV",
"season",
"by",
"season",
"number",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1726-L1728 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.valueArrayOf | @Override
public INDArray valueArrayOf(int[] shape, double value) {
INDArray ret = Nd4j.createUninitialized(shape, Nd4j.order());
ret.assign(value);
return ret;
} | java | @Override
public INDArray valueArrayOf(int[] shape, double value) {
INDArray ret = Nd4j.createUninitialized(shape, Nd4j.order());
ret.assign(value);
return ret;
} | [
"@",
"Override",
"public",
"INDArray",
"valueArrayOf",
"(",
"int",
"[",
"]",
"shape",
",",
"double",
"value",
")",
"{",
"INDArray",
"ret",
"=",
"Nd4j",
".",
"createUninitialized",
"(",
"shape",
",",
"Nd4j",
".",
"order",
"(",
")",
")",
";",
"ret",
".",... | Creates an ndarray with the specified value
as the only value in the ndarray
@param shape the shape of the ndarray
@param value the value to assign
@return the created ndarray | [
"Creates",
"an",
"ndarray",
"with",
"the",
"specified",
"value",
"as",
"the",
"only",
"value",
"in",
"the",
"ndarray"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L796-L801 |
shinesolutions/swagger-aem | java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/SlingApi.java | SlingApi.postConfigApacheFelixJettyBasedHttpServiceAsync | public com.squareup.okhttp.Call postConfigApacheFelixJettyBasedHttpServiceAsync(String runmode, Boolean orgApacheFelixHttpsNio, String orgApacheFelixHttpsNioTypeHint, String orgApacheFelixHttpsKeystore, String orgApacheFelixHttpsKeystoreTypeHint, String orgApacheFelixHttpsKeystorePassword, String orgApacheFelixHttpsKeystorePasswordTypeHint, String orgApacheFelixHttpsKeystoreKey, String orgApacheFelixHttpsKeystoreKeyTypeHint, String orgApacheFelixHttpsKeystoreKeyPassword, String orgApacheFelixHttpsKeystoreKeyPasswordTypeHint, String orgApacheFelixHttpsTruststore, String orgApacheFelixHttpsTruststoreTypeHint, String orgApacheFelixHttpsTruststorePassword, String orgApacheFelixHttpsTruststorePasswordTypeHint, String orgApacheFelixHttpsClientcertificate, String orgApacheFelixHttpsClientcertificateTypeHint, Boolean orgApacheFelixHttpsEnable, String orgApacheFelixHttpsEnableTypeHint, String orgOsgiServiceHttpPortSecure, String orgOsgiServiceHttpPortSecureTypeHint, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = postConfigApacheFelixJettyBasedHttpServiceValidateBeforeCall(runmode, orgApacheFelixHttpsNio, orgApacheFelixHttpsNioTypeHint, orgApacheFelixHttpsKeystore, orgApacheFelixHttpsKeystoreTypeHint, orgApacheFelixHttpsKeystorePassword, orgApacheFelixHttpsKeystorePasswordTypeHint, orgApacheFelixHttpsKeystoreKey, orgApacheFelixHttpsKeystoreKeyTypeHint, orgApacheFelixHttpsKeystoreKeyPassword, orgApacheFelixHttpsKeystoreKeyPasswordTypeHint, orgApacheFelixHttpsTruststore, orgApacheFelixHttpsTruststoreTypeHint, orgApacheFelixHttpsTruststorePassword, orgApacheFelixHttpsTruststorePasswordTypeHint, orgApacheFelixHttpsClientcertificate, orgApacheFelixHttpsClientcertificateTypeHint, orgApacheFelixHttpsEnable, orgApacheFelixHttpsEnableTypeHint, orgOsgiServiceHttpPortSecure, orgOsgiServiceHttpPortSecureTypeHint, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
} | java | public com.squareup.okhttp.Call postConfigApacheFelixJettyBasedHttpServiceAsync(String runmode, Boolean orgApacheFelixHttpsNio, String orgApacheFelixHttpsNioTypeHint, String orgApacheFelixHttpsKeystore, String orgApacheFelixHttpsKeystoreTypeHint, String orgApacheFelixHttpsKeystorePassword, String orgApacheFelixHttpsKeystorePasswordTypeHint, String orgApacheFelixHttpsKeystoreKey, String orgApacheFelixHttpsKeystoreKeyTypeHint, String orgApacheFelixHttpsKeystoreKeyPassword, String orgApacheFelixHttpsKeystoreKeyPasswordTypeHint, String orgApacheFelixHttpsTruststore, String orgApacheFelixHttpsTruststoreTypeHint, String orgApacheFelixHttpsTruststorePassword, String orgApacheFelixHttpsTruststorePasswordTypeHint, String orgApacheFelixHttpsClientcertificate, String orgApacheFelixHttpsClientcertificateTypeHint, Boolean orgApacheFelixHttpsEnable, String orgApacheFelixHttpsEnableTypeHint, String orgOsgiServiceHttpPortSecure, String orgOsgiServiceHttpPortSecureTypeHint, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = postConfigApacheFelixJettyBasedHttpServiceValidateBeforeCall(runmode, orgApacheFelixHttpsNio, orgApacheFelixHttpsNioTypeHint, orgApacheFelixHttpsKeystore, orgApacheFelixHttpsKeystoreTypeHint, orgApacheFelixHttpsKeystorePassword, orgApacheFelixHttpsKeystorePasswordTypeHint, orgApacheFelixHttpsKeystoreKey, orgApacheFelixHttpsKeystoreKeyTypeHint, orgApacheFelixHttpsKeystoreKeyPassword, orgApacheFelixHttpsKeystoreKeyPasswordTypeHint, orgApacheFelixHttpsTruststore, orgApacheFelixHttpsTruststoreTypeHint, orgApacheFelixHttpsTruststorePassword, orgApacheFelixHttpsTruststorePasswordTypeHint, orgApacheFelixHttpsClientcertificate, orgApacheFelixHttpsClientcertificateTypeHint, orgApacheFelixHttpsEnable, orgApacheFelixHttpsEnableTypeHint, orgOsgiServiceHttpPortSecure, orgOsgiServiceHttpPortSecureTypeHint, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"postConfigApacheFelixJettyBasedHttpServiceAsync",
"(",
"String",
"runmode",
",",
"Boolean",
"orgApacheFelixHttpsNio",
",",
"String",
"orgApacheFelixHttpsNioTypeHint",
",",
"String",
"orgApacheFelixHttpsKeystore",
... | (asynchronously)
@param runmode (required)
@param orgApacheFelixHttpsNio (optional)
@param orgApacheFelixHttpsNioTypeHint (optional)
@param orgApacheFelixHttpsKeystore (optional)
@param orgApacheFelixHttpsKeystoreTypeHint (optional)
@param orgApacheFelixHttpsKeystorePassword (optional)
@param orgApacheFelixHttpsKeystorePasswordTypeHint (optional)
@param orgApacheFelixHttpsKeystoreKey (optional)
@param orgApacheFelixHttpsKeystoreKeyTypeHint (optional)
@param orgApacheFelixHttpsKeystoreKeyPassword (optional)
@param orgApacheFelixHttpsKeystoreKeyPasswordTypeHint (optional)
@param orgApacheFelixHttpsTruststore (optional)
@param orgApacheFelixHttpsTruststoreTypeHint (optional)
@param orgApacheFelixHttpsTruststorePassword (optional)
@param orgApacheFelixHttpsTruststorePasswordTypeHint (optional)
@param orgApacheFelixHttpsClientcertificate (optional)
@param orgApacheFelixHttpsClientcertificateTypeHint (optional)
@param orgApacheFelixHttpsEnable (optional)
@param orgApacheFelixHttpsEnableTypeHint (optional)
@param orgOsgiServiceHttpPortSecure (optional)
@param orgOsgiServiceHttpPortSecureTypeHint (optional)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"(",
"asynchronously",
")"
] | train | https://github.com/shinesolutions/swagger-aem/blob/ae7da4df93e817dc2bad843779b2069d9c4e7c6b/java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/SlingApi.java#L3112-L3136 |
jparsec/jparsec | jparsec-examples/src/main/java/org/jparsec/examples/common/Strings.java | Strings.prependEach | public static String prependEach(String delim, Iterable<?> objects) {
StringBuilder builder = new StringBuilder();
for (Object obj : objects) {
builder.append(delim);
builder.append(obj);
}
return builder.toString();
} | java | public static String prependEach(String delim, Iterable<?> objects) {
StringBuilder builder = new StringBuilder();
for (Object obj : objects) {
builder.append(delim);
builder.append(obj);
}
return builder.toString();
} | [
"public",
"static",
"String",
"prependEach",
"(",
"String",
"delim",
",",
"Iterable",
"<",
"?",
">",
"objects",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Object",
"obj",
":",
"objects",
")",
"{",
"buil... | Prepends {@code delim} before each object of {@code objects}. | [
"Prepends",
"{"
] | train | https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec-examples/src/main/java/org/jparsec/examples/common/Strings.java#L28-L35 |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspContentAccessValueWrapper.java | CmsJspContentAccessValueWrapper.createWrapper | public static CmsJspContentAccessValueWrapper createWrapper(
CmsObject cms,
I_CmsXmlContentValue value,
I_CmsXmlDocument content,
String valueName,
Locale locale) {
if ((value != null) && (cms != null)) {
return new CmsJspContentAccessValueWrapper(cms, value);
}
if ((content != null) && (valueName != null) && (locale != null) && (cms != null)) {
CmsJspContentAccessValueWrapper wrapper = new CmsJspContentAccessValueWrapper();
wrapper.m_nullValueInfo = new NullValueInfo(content, valueName, locale);
wrapper.m_cms = cms;
return wrapper;
}
// if no value is available,
return NULL_VALUE_WRAPPER;
} | java | public static CmsJspContentAccessValueWrapper createWrapper(
CmsObject cms,
I_CmsXmlContentValue value,
I_CmsXmlDocument content,
String valueName,
Locale locale) {
if ((value != null) && (cms != null)) {
return new CmsJspContentAccessValueWrapper(cms, value);
}
if ((content != null) && (valueName != null) && (locale != null) && (cms != null)) {
CmsJspContentAccessValueWrapper wrapper = new CmsJspContentAccessValueWrapper();
wrapper.m_nullValueInfo = new NullValueInfo(content, valueName, locale);
wrapper.m_cms = cms;
return wrapper;
}
// if no value is available,
return NULL_VALUE_WRAPPER;
} | [
"public",
"static",
"CmsJspContentAccessValueWrapper",
"createWrapper",
"(",
"CmsObject",
"cms",
",",
"I_CmsXmlContentValue",
"value",
",",
"I_CmsXmlDocument",
"content",
",",
"String",
"valueName",
",",
"Locale",
"locale",
")",
"{",
"if",
"(",
"(",
"value",
"!=",
... | Factory method to create a new XML content value wrapper.<p>
In case either parameter is <code>null</code>, the {@link #NULL_VALUE_WRAPPER} is returned.<p>
@param cms the current users OpenCms context
@param value the value to warp
@param content the content document, required to set the null value info
@param valueName the value path name
@param locale the selected locale
@return a new content value wrapper instance, or <code>null</code> if any parameter is <code>null</code> | [
"Factory",
"method",
"to",
"create",
"a",
"new",
"XML",
"content",
"value",
"wrapper",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspContentAccessValueWrapper.java#L419-L437 |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/util/Contracts.java | Contracts.assertNotEmpty | public static void assertNotEmpty(final String pstring, final String pmessage) {
if (pstring == null || pstring.length() == 0) {
throw new IllegalArgumentException(pmessage);
}
} | java | public static void assertNotEmpty(final String pstring, final String pmessage) {
if (pstring == null || pstring.length() == 0) {
throw new IllegalArgumentException(pmessage);
}
} | [
"public",
"static",
"void",
"assertNotEmpty",
"(",
"final",
"String",
"pstring",
",",
"final",
"String",
"pmessage",
")",
"{",
"if",
"(",
"pstring",
"==",
"null",
"||",
"pstring",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgu... | check if a string is not empty.
@param pstring string to check
@param pmessage error message to throw if test fails | [
"check",
"if",
"a",
"string",
"is",
"not",
"empty",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/util/Contracts.java#L77-L81 |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/BAMInputFormat.java | BAMInputFormat.addProbabilisticSplits | private int addProbabilisticSplits(
List<InputSplit> splits, int i, List<InputSplit> newSplits,
Configuration cfg)
throws IOException
{
final Path path = ((FileSplit)splits.get(i)).getPath();
try (final SeekableStream sin = WrapSeekable.openPath(path.getFileSystem(cfg), path)) {
final BAMSplitGuesser guesser = new BAMSplitGuesser(sin, cfg);
FileVirtualSplit previousSplit = null;
for (; i < splits.size(); ++i) {
FileSplit fspl = (FileSplit)splits.get(i);
if (!fspl.getPath().equals(path))
break;
long beg = fspl.getStart();
long end = beg + fspl.getLength();
long alignedBeg = guesser.guessNextBAMRecordStart(beg, end);
// As the guesser goes to the next BGZF block before looking for BAM
// records, the ending BGZF blocks have to always be traversed fully.
// Hence force the length to be 0xffff, the maximum possible.
long alignedEnd = end << 16 | 0xffff;
if (alignedBeg == end) {
// No records detected in this split: merge it to the previous one.
// This could legitimately happen e.g. if we have a split that is
// so small that it only contains the middle part of a BGZF block.
//
// Of course, if it's the first split, then this is simply not a
// valid BAM file.
//
// FIXME: In theory, any number of splits could only contain parts
// of the BAM header before we start to see splits that contain BAM
// records. For now, we require that the split size is at least as
// big as the header and don't handle that case.
if (previousSplit == null)
throw new IOException("'" + path + "': "+
"no reads in first split: bad BAM file or tiny split size?");
previousSplit.setEndVirtualOffset(alignedEnd);
} else {
previousSplit = new FileVirtualSplit(
path, alignedBeg, alignedEnd, fspl.getLocations());
if (logger.isDebugEnabled()) {
final long byteOffset = alignedBeg >>> 16;
final long recordOffset = alignedBeg & 0xffff;
logger.debug(
"Split {}: byte offset: {} record offset: {}, virtual offset: {}",
i, byteOffset, recordOffset, alignedBeg);
}
newSplits.add(previousSplit);
}
}
}
return i;
} | java | private int addProbabilisticSplits(
List<InputSplit> splits, int i, List<InputSplit> newSplits,
Configuration cfg)
throws IOException
{
final Path path = ((FileSplit)splits.get(i)).getPath();
try (final SeekableStream sin = WrapSeekable.openPath(path.getFileSystem(cfg), path)) {
final BAMSplitGuesser guesser = new BAMSplitGuesser(sin, cfg);
FileVirtualSplit previousSplit = null;
for (; i < splits.size(); ++i) {
FileSplit fspl = (FileSplit)splits.get(i);
if (!fspl.getPath().equals(path))
break;
long beg = fspl.getStart();
long end = beg + fspl.getLength();
long alignedBeg = guesser.guessNextBAMRecordStart(beg, end);
// As the guesser goes to the next BGZF block before looking for BAM
// records, the ending BGZF blocks have to always be traversed fully.
// Hence force the length to be 0xffff, the maximum possible.
long alignedEnd = end << 16 | 0xffff;
if (alignedBeg == end) {
// No records detected in this split: merge it to the previous one.
// This could legitimately happen e.g. if we have a split that is
// so small that it only contains the middle part of a BGZF block.
//
// Of course, if it's the first split, then this is simply not a
// valid BAM file.
//
// FIXME: In theory, any number of splits could only contain parts
// of the BAM header before we start to see splits that contain BAM
// records. For now, we require that the split size is at least as
// big as the header and don't handle that case.
if (previousSplit == null)
throw new IOException("'" + path + "': "+
"no reads in first split: bad BAM file or tiny split size?");
previousSplit.setEndVirtualOffset(alignedEnd);
} else {
previousSplit = new FileVirtualSplit(
path, alignedBeg, alignedEnd, fspl.getLocations());
if (logger.isDebugEnabled()) {
final long byteOffset = alignedBeg >>> 16;
final long recordOffset = alignedBeg & 0xffff;
logger.debug(
"Split {}: byte offset: {} record offset: {}, virtual offset: {}",
i, byteOffset, recordOffset, alignedBeg);
}
newSplits.add(previousSplit);
}
}
}
return i;
} | [
"private",
"int",
"addProbabilisticSplits",
"(",
"List",
"<",
"InputSplit",
">",
"splits",
",",
"int",
"i",
",",
"List",
"<",
"InputSplit",
">",
"newSplits",
",",
"Configuration",
"cfg",
")",
"throws",
"IOException",
"{",
"final",
"Path",
"path",
"=",
"(",
... | file repeatedly and checking addIndexedSplits for an index repeatedly. | [
"file",
"repeatedly",
"and",
"checking",
"addIndexedSplits",
"for",
"an",
"index",
"repeatedly",
"."
] | train | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/BAMInputFormat.java#L481-L540 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringParser.java | StringParser.parseFloat | public static float parseFloat (@Nullable final Object aObject, final float fDefault)
{
if (aObject == null)
return fDefault;
if (aObject instanceof Number)
return ((Number) aObject).floatValue ();
return parseFloat (aObject.toString (), fDefault);
} | java | public static float parseFloat (@Nullable final Object aObject, final float fDefault)
{
if (aObject == null)
return fDefault;
if (aObject instanceof Number)
return ((Number) aObject).floatValue ();
return parseFloat (aObject.toString (), fDefault);
} | [
"public",
"static",
"float",
"parseFloat",
"(",
"@",
"Nullable",
"final",
"Object",
"aObject",
",",
"final",
"float",
"fDefault",
")",
"{",
"if",
"(",
"aObject",
"==",
"null",
")",
"return",
"fDefault",
";",
"if",
"(",
"aObject",
"instanceof",
"Number",
")... | Parse the given {@link Object} as float. Note: both the locale independent
form of a float can be parsed here (e.g. 4.523) as well as a localized form
using the comma as the decimal separator (e.g. the German 4,523).
@param aObject
The object to parse. May be <code>null</code>.
@param fDefault
The default value to be returned if the passed object could not be
converted to a valid value.
@return The default value if the object does not represent a valid value. | [
"Parse",
"the",
"given",
"{",
"@link",
"Object",
"}",
"as",
"float",
".",
"Note",
":",
"both",
"the",
"locale",
"independent",
"form",
"of",
"a",
"float",
"can",
"be",
"parsed",
"here",
"(",
"e",
".",
"g",
".",
"4",
".",
"523",
")",
"as",
"well",
... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L588-L595 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.setOrthoSymmetric | public Matrix4x3f setOrthoSymmetric(float width, float height, float zNear, float zFar) {
return setOrthoSymmetric(width, height, zNear, zFar, false);
} | java | public Matrix4x3f setOrthoSymmetric(float width, float height, float zNear, float zFar) {
return setOrthoSymmetric(width, height, zNear, zFar, false);
} | [
"public",
"Matrix4x3f",
"setOrthoSymmetric",
"(",
"float",
"width",
",",
"float",
"height",
",",
"float",
"zNear",
",",
"float",
"zFar",
")",
"{",
"return",
"setOrthoSymmetric",
"(",
"width",
",",
"height",
",",
"zNear",
",",
"zFar",
",",
"false",
")",
";"... | Set this matrix to be a symmetric orthographic projection transformation for a right-handed coordinate system
using OpenGL's NDC z range of <code>[-1..+1]</code>.
<p>
This method is equivalent to calling {@link #setOrtho(float, float, float, float, float, float) setOrtho()} with
<code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>.
<p>
In order to apply the symmetric orthographic projection to an already existing transformation,
use {@link #orthoSymmetric(float, float, float, float) orthoSymmetric()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #orthoSymmetric(float, float, float, float)
@param width
the distance between the right and left frustum edges
@param height
the distance between the top and bottom frustum edges
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"a",
"symmetric",
"orthographic",
"projection",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"using",
"OpenGL",
"s",
"NDC",
"z",
"range",
"of",
"<code",
">",
"[",
"-",
"1",
"..",
"+",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L5584-L5586 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.doubleToLongFunction | public static DoubleToLongFunction doubleToLongFunction(CheckedDoubleToLongFunction function, Consumer<Throwable> handler) {
return t -> {
try {
return function.applyAsLong(t);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | java | public static DoubleToLongFunction doubleToLongFunction(CheckedDoubleToLongFunction function, Consumer<Throwable> handler) {
return t -> {
try {
return function.applyAsLong(t);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | [
"public",
"static",
"DoubleToLongFunction",
"doubleToLongFunction",
"(",
"CheckedDoubleToLongFunction",
"function",
",",
"Consumer",
"<",
"Throwable",
">",
"handler",
")",
"{",
"return",
"t",
"->",
"{",
"try",
"{",
"return",
"function",
".",
"applyAsLong",
"(",
"t... | Wrap a {@link CheckedDoubleToLongFunction} in a {@link DoubleToLongFunction} with a custom handler for checked exceptions.
<p>
Example:
<code><pre>
DoubleStream.of(1.0, 2.0, 3.0).mapToLong(Unchecked.doubleToLongFunction(
d -> {
if (d < 0.0)
throw new Exception("Only positive numbers allowed");
return (long) d;
},
e -> {
throw new IllegalStateException(e);
}
));
</pre></code> | [
"Wrap",
"a",
"{",
"@link",
"CheckedDoubleToLongFunction",
"}",
"in",
"a",
"{",
"@link",
"DoubleToLongFunction",
"}",
"with",
"a",
"custom",
"handler",
"for",
"checked",
"exceptions",
".",
"<p",
">",
"Example",
":",
"<code",
">",
"<pre",
">",
"DoubleStream",
... | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L1451-L1462 |
plaid/plaid-java | src/main/java/com/plaid/client/internal/Util.java | Util.isPositive | public static void isPositive(Integer value, String name) {
notNull(value, name);
if (value < 0) {
throw new IllegalArgumentException(name + "must be a positive number.");
}
} | java | public static void isPositive(Integer value, String name) {
notNull(value, name);
if (value < 0) {
throw new IllegalArgumentException(name + "must be a positive number.");
}
} | [
"public",
"static",
"void",
"isPositive",
"(",
"Integer",
"value",
",",
"String",
"name",
")",
"{",
"notNull",
"(",
"value",
",",
"name",
")",
";",
"if",
"(",
"value",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"name",
"+",
"\... | Checks that i is not null and is a positive number
@param value The integer value to check.
@param name The name of the variable being checked, included when an error is raised.
@throws IllegalArgumentException If i is null or less than 0 | [
"Checks",
"that",
"i",
"is",
"not",
"null",
"and",
"is",
"a",
"positive",
"number"
] | train | https://github.com/plaid/plaid-java/blob/360f1f8a5178fa0c3c2c2e07a58f8ccec5f33117/src/main/java/com/plaid/client/internal/Util.java#L92-L98 |
trellis-ldp/trellis | components/webdav/src/main/java/org/trellisldp/webdav/TrellisWebDAV.java | TrellisWebDAV.updateProperties | @PROPPATCH
@Consumes({APPLICATION_XML})
@Produces({APPLICATION_XML})
@Timed
public void updateProperties(@Suspended final AsyncResponse response,
@Context final Request request, @Context final UriInfo uriInfo,
@Context final HttpHeaders headers, @Context final SecurityContext security,
final DavPropertyUpdate propertyUpdate) throws ParserConfigurationException {
final Document doc = getDocument();
final TrellisRequest req = new TrellisRequest(request, uriInfo, headers, security);
final IRI identifier = rdf.createIRI(TRELLIS_DATA_PREFIX + req.getPath());
final String baseUrl = getBaseUrl(req);
final String location = fromUri(baseUrl).path(req.getPath()).build().toString();
final Session session = getSession(req.getPrincipalName());
services.getResourceService().get(identifier)
.thenApply(this::checkResource)
.thenCompose(resourceToMultiStatus(doc, identifier, location, baseUrl, session, propertyUpdate))
.thenApply(multistatus -> status(MULTI_STATUS).entity(multistatus).build())
.exceptionally(this::handleException).thenApply(response::resume);
} | java | @PROPPATCH
@Consumes({APPLICATION_XML})
@Produces({APPLICATION_XML})
@Timed
public void updateProperties(@Suspended final AsyncResponse response,
@Context final Request request, @Context final UriInfo uriInfo,
@Context final HttpHeaders headers, @Context final SecurityContext security,
final DavPropertyUpdate propertyUpdate) throws ParserConfigurationException {
final Document doc = getDocument();
final TrellisRequest req = new TrellisRequest(request, uriInfo, headers, security);
final IRI identifier = rdf.createIRI(TRELLIS_DATA_PREFIX + req.getPath());
final String baseUrl = getBaseUrl(req);
final String location = fromUri(baseUrl).path(req.getPath()).build().toString();
final Session session = getSession(req.getPrincipalName());
services.getResourceService().get(identifier)
.thenApply(this::checkResource)
.thenCompose(resourceToMultiStatus(doc, identifier, location, baseUrl, session, propertyUpdate))
.thenApply(multistatus -> status(MULTI_STATUS).entity(multistatus).build())
.exceptionally(this::handleException).thenApply(response::resume);
} | [
"@",
"PROPPATCH",
"@",
"Consumes",
"(",
"{",
"APPLICATION_XML",
"}",
")",
"@",
"Produces",
"(",
"{",
"APPLICATION_XML",
"}",
")",
"@",
"Timed",
"public",
"void",
"updateProperties",
"(",
"@",
"Suspended",
"final",
"AsyncResponse",
"response",
",",
"@",
"Cont... | Update properties on a resource.
@param response the async response
@param request the request
@param uriInfo the URI info
@param headers the headers
@param security the security context
@param propertyUpdate the property update request
@throws ParserConfigurationException if the XML parser is not properly configured | [
"Update",
"properties",
"on",
"a",
"resource",
"."
] | train | https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/components/webdav/src/main/java/org/trellisldp/webdav/TrellisWebDAV.java#L266-L286 |
BioPAX/Paxtools | paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java | QueryExecuter.runPathsFromToMultiSet | public static Set<BioPAXElement> runPathsFromToMultiSet(
Set<Set<BioPAXElement>> sourceSets,
Set<Set<BioPAXElement>> targetSets,
Model model,
LimitType limitType,
int limit,
Filter... filters)
{
Graph graph;
if (model.getLevel() == BioPAXLevel.L3)
{
graph = new GraphL3(model, filters);
}
else return Collections.emptySet();
Set<Node> source = prepareSingleNodeSetFromSets(sourceSets, graph);
Set<Node> target = prepareSingleNodeSetFromSets(targetSets, graph);
PathsFromToQuery query = new PathsFromToQuery(source, target, limitType, limit, true);
Set<GraphObject> resultWrappers = query.run();
return convertQueryResult(resultWrappers, graph, true);
} | java | public static Set<BioPAXElement> runPathsFromToMultiSet(
Set<Set<BioPAXElement>> sourceSets,
Set<Set<BioPAXElement>> targetSets,
Model model,
LimitType limitType,
int limit,
Filter... filters)
{
Graph graph;
if (model.getLevel() == BioPAXLevel.L3)
{
graph = new GraphL3(model, filters);
}
else return Collections.emptySet();
Set<Node> source = prepareSingleNodeSetFromSets(sourceSets, graph);
Set<Node> target = prepareSingleNodeSetFromSets(targetSets, graph);
PathsFromToQuery query = new PathsFromToQuery(source, target, limitType, limit, true);
Set<GraphObject> resultWrappers = query.run();
return convertQueryResult(resultWrappers, graph, true);
} | [
"public",
"static",
"Set",
"<",
"BioPAXElement",
">",
"runPathsFromToMultiSet",
"(",
"Set",
"<",
"Set",
"<",
"BioPAXElement",
">",
">",
"sourceSets",
",",
"Set",
"<",
"Set",
"<",
"BioPAXElement",
">",
">",
"targetSets",
",",
"Model",
"model",
",",
"LimitType... | Gets paths the graph composed of the paths from a source node, and ends at a target node.
@param sourceSets Seeds for start points of paths
@param targetSets Seeds for end points of paths
@param model BioPAX model
@param limitType either NORMAL or SHORTEST_PLUS_K
@param limit Length limit fothe paths to be found
@param filters for filtering graph elements
@return BioPAX elements in the result | [
"Gets",
"paths",
"the",
"graph",
"composed",
"of",
"the",
"paths",
"from",
"a",
"source",
"node",
"and",
"ends",
"at",
"a",
"target",
"node",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L229-L251 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonObject.java | JsonObject.put | public JsonObject put(String name, Number value) {
content.put(name, value);
return this;
} | java | public JsonObject put(String name, Number value) {
content.put(name, value);
return this;
} | [
"public",
"JsonObject",
"put",
"(",
"String",
"name",
",",
"Number",
"value",
")",
"{",
"content",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Stores a {@link Number} value identified by the field name.
@param name the name of the JSON field.
@param value the value of the JSON field.
@return the {@link JsonObject}. | [
"Stores",
"a",
"{",
"@link",
"Number",
"}",
"value",
"identified",
"by",
"the",
"field",
"name",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L811-L814 |
alkacon/opencms-core | src/org/opencms/xml/CmsXmlUtils.java | CmsXmlUtils.unmarshalHelper | public static Document unmarshalHelper(InputSource source, EntityResolver resolver) throws CmsXmlException {
return unmarshalHelper(source, resolver, false);
} | java | public static Document unmarshalHelper(InputSource source, EntityResolver resolver) throws CmsXmlException {
return unmarshalHelper(source, resolver, false);
} | [
"public",
"static",
"Document",
"unmarshalHelper",
"(",
"InputSource",
"source",
",",
"EntityResolver",
"resolver",
")",
"throws",
"CmsXmlException",
"{",
"return",
"unmarshalHelper",
"(",
"source",
",",
"resolver",
",",
"false",
")",
";",
"}"
] | Helper to unmarshal (read) xml contents from an input source into a document.<p>
Using this method ensures that the OpenCms XML entity resolver is used.<p>
Important: The encoding provided will NOT be used during unmarshalling,
the XML parser will do this on the base of the information in the source String.
The encoding is used for initializing the created instance of the document,
which means it will be used when marshalling the document again later.<p>
@param source the XML input source to use
@param resolver the XML entity resolver to use
@return the unmarshalled XML document
@throws CmsXmlException if something goes wrong | [
"Helper",
"to",
"unmarshal",
"(",
"read",
")",
"xml",
"contents",
"from",
"an",
"input",
"source",
"into",
"a",
"document",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlUtils.java#L745-L748 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.delegatedAccount_email_filter_name_changeActivity_POST | public OvhTaskFilter delegatedAccount_email_filter_name_changeActivity_POST(String email, String name, Boolean activity) throws IOException {
String qPath = "/email/domain/delegatedAccount/{email}/filter/{name}/changeActivity";
StringBuilder sb = path(qPath, email, name);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "activity", activity);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskFilter.class);
} | java | public OvhTaskFilter delegatedAccount_email_filter_name_changeActivity_POST(String email, String name, Boolean activity) throws IOException {
String qPath = "/email/domain/delegatedAccount/{email}/filter/{name}/changeActivity";
StringBuilder sb = path(qPath, email, name);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "activity", activity);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskFilter.class);
} | [
"public",
"OvhTaskFilter",
"delegatedAccount_email_filter_name_changeActivity_POST",
"(",
"String",
"email",
",",
"String",
"name",
",",
"Boolean",
"activity",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/delegatedAccount/{email}/filter/{name}/cha... | Change filter activity
REST: POST /email/domain/delegatedAccount/{email}/filter/{name}/changeActivity
@param activity [required] New activity
@param email [required] Email
@param name [required] Filter name | [
"Change",
"filter",
"activity"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L161-L168 |
mikepenz/Android-Iconics | library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java | IconicsDrawable.iconText | @NonNull
public IconicsDrawable iconText(@NonNull String icon, @Nullable Typeface typeface) {
mPlainIcon = icon;
mIcon = null;
mIconBrush.getPaint().setTypeface(typeface == null ? Typeface.DEFAULT : typeface);
invalidateSelf();
return this;
} | java | @NonNull
public IconicsDrawable iconText(@NonNull String icon, @Nullable Typeface typeface) {
mPlainIcon = icon;
mIcon = null;
mIconBrush.getPaint().setTypeface(typeface == null ? Typeface.DEFAULT : typeface);
invalidateSelf();
return this;
} | [
"@",
"NonNull",
"public",
"IconicsDrawable",
"iconText",
"(",
"@",
"NonNull",
"String",
"icon",
",",
"@",
"Nullable",
"Typeface",
"typeface",
")",
"{",
"mPlainIcon",
"=",
"icon",
";",
"mIcon",
"=",
"null",
";",
"mIconBrush",
".",
"getPaint",
"(",
")",
".",... | Loads and draws given text
@return The current IconicsDrawable for chaining. | [
"Loads",
"and",
"draws",
"given",
"text"
] | train | https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L404-L412 |
cache2k/cache2k | cache2k-core/src/main/java/org/cache2k/core/HeapCache.java | HeapCache.removeEntryForEviction | public void removeEntryForEviction(Entry<K, V> e) {
boolean f = hash.remove(e);
checkForHashCodeChange(e);
timing.cancelExpiryTimer(e);
e.setGone();
} | java | public void removeEntryForEviction(Entry<K, V> e) {
boolean f = hash.remove(e);
checkForHashCodeChange(e);
timing.cancelExpiryTimer(e);
e.setGone();
} | [
"public",
"void",
"removeEntryForEviction",
"(",
"Entry",
"<",
"K",
",",
"V",
">",
"e",
")",
"{",
"boolean",
"f",
"=",
"hash",
".",
"remove",
"(",
"e",
")",
";",
"checkForHashCodeChange",
"(",
"e",
")",
";",
"timing",
".",
"cancelExpiryTimer",
"(",
"e"... | Remove the entry from the hash table. The entry is already removed from the replacement list.
Stop the timer, if needed. The remove races with a clear. The clear
is not updating each entry state to e.isGone() but just drops the whole hash table instead.
<p>With completion of the method the entry content is no more visible. "Nulling" out the key
or value of the entry is incorrect, since there can be another thread which is just about to
return the entry contents. | [
"Remove",
"the",
"entry",
"from",
"the",
"hash",
"table",
".",
"The",
"entry",
"is",
"already",
"removed",
"from",
"the",
"replacement",
"list",
".",
"Stop",
"the",
"timer",
"if",
"needed",
".",
"The",
"remove",
"races",
"with",
"a",
"clear",
".",
"The",... | train | https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L1322-L1327 |
mozilla/rhino | src/org/mozilla/javascript/UintMap.java | UintMap.getInt | public int getInt(int key, int defaultValue) {
if (key < 0) Kit.codeBug();
int index = findIndex(key);
if (0 <= index) {
if (ivaluesShift != 0) {
return keys[ivaluesShift + index];
}
return 0;
}
return defaultValue;
} | java | public int getInt(int key, int defaultValue) {
if (key < 0) Kit.codeBug();
int index = findIndex(key);
if (0 <= index) {
if (ivaluesShift != 0) {
return keys[ivaluesShift + index];
}
return 0;
}
return defaultValue;
} | [
"public",
"int",
"getInt",
"(",
"int",
"key",
",",
"int",
"defaultValue",
")",
"{",
"if",
"(",
"key",
"<",
"0",
")",
"Kit",
".",
"codeBug",
"(",
")",
";",
"int",
"index",
"=",
"findIndex",
"(",
"key",
")",
";",
"if",
"(",
"0",
"<=",
"index",
")... | Get integer value assigned with key.
@return key integer value or defaultValue if key is absent | [
"Get",
"integer",
"value",
"assigned",
"with",
"key",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/UintMap.java#L77-L87 |
banq/jdonframework | src/main/java/com/jdon/util/UtilDateTime.java | UtilDateTime.toDate | public static java.util.Date toDate(String monthStr, String dayStr, String yearStr, String hourStr, String minuteStr, String secondStr) {
int month, day, year, hour, minute, second;
try {
month = Integer.parseInt(monthStr);
day = Integer.parseInt(dayStr);
year = Integer.parseInt(yearStr);
hour = Integer.parseInt(hourStr);
minute = Integer.parseInt(minuteStr);
second = Integer.parseInt(secondStr);
} catch (Exception e) {
return null;
}
return toDate(month, day, year, hour, minute, second);
} | java | public static java.util.Date toDate(String monthStr, String dayStr, String yearStr, String hourStr, String minuteStr, String secondStr) {
int month, day, year, hour, minute, second;
try {
month = Integer.parseInt(monthStr);
day = Integer.parseInt(dayStr);
year = Integer.parseInt(yearStr);
hour = Integer.parseInt(hourStr);
minute = Integer.parseInt(minuteStr);
second = Integer.parseInt(secondStr);
} catch (Exception e) {
return null;
}
return toDate(month, day, year, hour, minute, second);
} | [
"public",
"static",
"java",
".",
"util",
".",
"Date",
"toDate",
"(",
"String",
"monthStr",
",",
"String",
"dayStr",
",",
"String",
"yearStr",
",",
"String",
"hourStr",
",",
"String",
"minuteStr",
",",
"String",
"secondStr",
")",
"{",
"int",
"month",
",",
... | Makes a Date from separate Strings for month, day, year, hour, minute,
and second.
@param monthStr
The month String
@param dayStr
The day String
@param yearStr
The year String
@param hourStr
The hour String
@param minuteStr
The minute String
@param secondStr
The second String
@return A Date made from separate Strings for month, day, year, hour,
minute, and second. | [
"Makes",
"a",
"Date",
"from",
"separate",
"Strings",
"for",
"month",
"day",
"year",
"hour",
"minute",
"and",
"second",
"."
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L375-L389 |
apiman/apiman | gateway/engine/ispn/src/main/java/io/apiman/gateway/engine/ispn/io/RegistryCacheMapWrapper.java | RegistryCacheMapWrapper.unmarshalAs | private <T> T unmarshalAs(String valueAsString, Class<T> asClass) throws IOException {
return mapper.reader(asClass).readValue(valueAsString);
} | java | private <T> T unmarshalAs(String valueAsString, Class<T> asClass) throws IOException {
return mapper.reader(asClass).readValue(valueAsString);
} | [
"private",
"<",
"T",
">",
"T",
"unmarshalAs",
"(",
"String",
"valueAsString",
",",
"Class",
"<",
"T",
">",
"asClass",
")",
"throws",
"IOException",
"{",
"return",
"mapper",
".",
"reader",
"(",
"asClass",
")",
".",
"readValue",
"(",
"valueAsString",
")",
... | Unmarshall the given type of object.
@param valueAsString
@param asClass
@throws IOException | [
"Unmarshall",
"the",
"given",
"type",
"of",
"object",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/ispn/src/main/java/io/apiman/gateway/engine/ispn/io/RegistryCacheMapWrapper.java#L188-L190 |
lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.getPathToChild | public static String getPathToChild(Resource file, Resource dir) {
if (dir == null || !file.getResourceProvider().getScheme().equals(dir.getResourceProvider().getScheme())) return null;
boolean isFile = file.isFile();
String str = "/";
while (file != null) {
if (file.equals(dir)) {
if (isFile) return str.substring(0, str.length() - 1);
return str;
}
str = "/" + file.getName() + str;
file = file.getParentResource();
}
return null;
} | java | public static String getPathToChild(Resource file, Resource dir) {
if (dir == null || !file.getResourceProvider().getScheme().equals(dir.getResourceProvider().getScheme())) return null;
boolean isFile = file.isFile();
String str = "/";
while (file != null) {
if (file.equals(dir)) {
if (isFile) return str.substring(0, str.length() - 1);
return str;
}
str = "/" + file.getName() + str;
file = file.getParentResource();
}
return null;
} | [
"public",
"static",
"String",
"getPathToChild",
"(",
"Resource",
"file",
",",
"Resource",
"dir",
")",
"{",
"if",
"(",
"dir",
"==",
"null",
"||",
"!",
"file",
".",
"getResourceProvider",
"(",
")",
".",
"getScheme",
"(",
")",
".",
"equals",
"(",
"dir",
"... | return diffrents of one file to a other if first is child of second otherwise return null
@param file file to search
@param dir directory to search | [
"return",
"diffrents",
"of",
"one",
"file",
"to",
"a",
"other",
"if",
"first",
"is",
"child",
"of",
"second",
"otherwise",
"return",
"null"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L819-L832 |
jhunters/jprotobuf | src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java | ProtobufIDLProxy.createSingle | public static IDLProxyObject createSingle(Reader reader, boolean debug, File path) throws IOException {
return createSingle(reader, debug, path, true);
} | java | public static IDLProxyObject createSingle(Reader reader, boolean debug, File path) throws IOException {
return createSingle(reader, debug, path, true);
} | [
"public",
"static",
"IDLProxyObject",
"createSingle",
"(",
"Reader",
"reader",
",",
"boolean",
"debug",
",",
"File",
"path",
")",
"throws",
"IOException",
"{",
"return",
"createSingle",
"(",
"reader",
",",
"debug",
",",
"path",
",",
"true",
")",
";",
"}"
] | Creates the single.
@param reader the reader
@param debug the debug
@param path the path
@return the IDL proxy object
@throws IOException Signals that an I/O exception has occurred. | [
"Creates",
"the",
"single",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java#L1057-L1059 |
networknt/light-4j | client/src/main/java/com/networknt/client/Http2Client.java | Http2Client.populateHeader | public Result populateHeader(ClientRequest request, String authToken, String correlationId, String traceabilityId) {
if(traceabilityId != null) {
addAuthTokenTrace(request, authToken, traceabilityId);
} else {
addAuthToken(request, authToken);
}
Result<Jwt> result = tokenManager.getJwt(request);
if(result.isFailure()) { return Failure.of(result.getError()); }
request.getRequestHeaders().put(HttpStringConstants.CORRELATION_ID, correlationId);
request.getRequestHeaders().put(HttpStringConstants.SCOPE_TOKEN, "Bearer " + result.getResult().getJwt());
return result;
} | java | public Result populateHeader(ClientRequest request, String authToken, String correlationId, String traceabilityId) {
if(traceabilityId != null) {
addAuthTokenTrace(request, authToken, traceabilityId);
} else {
addAuthToken(request, authToken);
}
Result<Jwt> result = tokenManager.getJwt(request);
if(result.isFailure()) { return Failure.of(result.getError()); }
request.getRequestHeaders().put(HttpStringConstants.CORRELATION_ID, correlationId);
request.getRequestHeaders().put(HttpStringConstants.SCOPE_TOKEN, "Bearer " + result.getResult().getJwt());
return result;
} | [
"public",
"Result",
"populateHeader",
"(",
"ClientRequest",
"request",
",",
"String",
"authToken",
",",
"String",
"correlationId",
",",
"String",
"traceabilityId",
")",
"{",
"if",
"(",
"traceabilityId",
"!=",
"null",
")",
"{",
"addAuthTokenTrace",
"(",
"request",
... | Support API to API calls with scope token. The token is the original token from consumer and
the client credentials token of caller API is added from cache. authToken, correlationId and
traceabilityId are passed in as strings.
This method is used in API to API call
@param request the http request
@param authToken the authorization token
@param correlationId the correlation id
@param traceabilityId the traceability id
@return Result when fail to get jwt, it will return a Status. | [
"Support",
"API",
"to",
"API",
"calls",
"with",
"scope",
"token",
".",
"The",
"token",
"is",
"the",
"original",
"token",
"from",
"consumer",
"and",
"the",
"client",
"credentials",
"token",
"of",
"caller",
"API",
"is",
"added",
"from",
"cache",
".",
"authTo... | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/Http2Client.java#L370-L381 |
derari/cthul | objects/src/main/java/org/cthul/objects/Boxing.java | Boxing.unboxAll | public static Object unboxAll(Object[] src, int srcPos, int len) {
if (srcPos >= src.length) {
throw new IndexOutOfBoundsException(String.valueOf(srcPos));
}
Class<?> type = src[srcPos].getClass();
return unboxAll(type, src, srcPos, len);
} | java | public static Object unboxAll(Object[] src, int srcPos, int len) {
if (srcPos >= src.length) {
throw new IndexOutOfBoundsException(String.valueOf(srcPos));
}
Class<?> type = src[srcPos].getClass();
return unboxAll(type, src, srcPos, len);
} | [
"public",
"static",
"Object",
"unboxAll",
"(",
"Object",
"[",
"]",
"src",
",",
"int",
"srcPos",
",",
"int",
"len",
")",
"{",
"if",
"(",
"srcPos",
">=",
"src",
".",
"length",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"String",
".",
"va... | Transforms an array of {@code Boolean}, {@code Character}, or {@code Number}
into a primitive array.
@param src source array
@param srcPos start position
@param len length
@return primitive array | [
"Transforms",
"an",
"array",
"of",
"{"
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/Boxing.java#L157-L163 |
vatbub/common | core/src/main/java/com/github/vatbub/common/core/Prefs.java | Prefs.setPreference | public void setPreference(String prefKey, String prefValue) {
props.setProperty(prefKey, prefValue);
savePreferences();
} | java | public void setPreference(String prefKey, String prefValue) {
props.setProperty(prefKey, prefValue);
savePreferences();
} | [
"public",
"void",
"setPreference",
"(",
"String",
"prefKey",
",",
"String",
"prefValue",
")",
"{",
"props",
".",
"setProperty",
"(",
"prefKey",
",",
"prefValue",
")",
";",
"savePreferences",
"(",
")",
";",
"}"
] | Sets the value of the specified preference in the properties file
@param prefKey The key of the preference to save
@param prefValue The value of the preference to save | [
"Sets",
"the",
"value",
"of",
"the",
"specified",
"preference",
"in",
"the",
"properties",
"file"
] | train | https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/core/src/main/java/com/github/vatbub/common/core/Prefs.java#L73-L76 |
Azure/azure-sdk-for-java | kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java | ClustersInner.beginUpdate | public ClusterInner beginUpdate(String resourceGroupName, String clusterName, ClusterUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body();
} | java | public ClusterInner beginUpdate(String resourceGroupName, String clusterName, ClusterUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body();
} | [
"public",
"ClusterInner",
"beginUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"ClusterUpdate",
"parameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
",",
"parameters",
")",
... | Update a Kusto cluster.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@param parameters The Kusto cluster parameters supplied to the Update operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ClusterInner object if successful. | [
"Update",
"a",
"Kusto",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java#L480-L482 |
cdk/cdk | base/core/src/main/java/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java | CDKAtomTypeMatcher.isSingleHeteroAtom | private boolean isSingleHeteroAtom(IAtom atom, IAtomContainer container) {
List<IAtom> connected = container.getConnectedAtomsList(atom);
for (IAtom atom1 : connected) {
boolean aromatic = container.getBond(atom, atom1).isAromatic();
// ignoring non-aromatic bonds
if (!aromatic) continue;
// found a hetroatom - we're not a single hetroatom
if (!"C".equals(atom1.getSymbol())) return false;
// check the second sphere
for (IAtom atom2 : container.getConnectedAtomsList(atom1)) {
if (!atom2.equals(atom) && container.getBond(atom1, atom2).isAromatic()
&& !"C".equals(atom2.getSymbol())) {
return false;
}
}
}
return true;
} | java | private boolean isSingleHeteroAtom(IAtom atom, IAtomContainer container) {
List<IAtom> connected = container.getConnectedAtomsList(atom);
for (IAtom atom1 : connected) {
boolean aromatic = container.getBond(atom, atom1).isAromatic();
// ignoring non-aromatic bonds
if (!aromatic) continue;
// found a hetroatom - we're not a single hetroatom
if (!"C".equals(atom1.getSymbol())) return false;
// check the second sphere
for (IAtom atom2 : container.getConnectedAtomsList(atom1)) {
if (!atom2.equals(atom) && container.getBond(atom1, atom2).isAromatic()
&& !"C".equals(atom2.getSymbol())) {
return false;
}
}
}
return true;
} | [
"private",
"boolean",
"isSingleHeteroAtom",
"(",
"IAtom",
"atom",
",",
"IAtomContainer",
"container",
")",
"{",
"List",
"<",
"IAtom",
">",
"connected",
"=",
"container",
".",
"getConnectedAtomsList",
"(",
"atom",
")",
";",
"for",
"(",
"IAtom",
"atom1",
":",
... | Determines whether the bonds (up to two spheres away) are only to non
hetroatoms. Currently used in N.planar3 perception of (e.g. pyrrole).
@param atom an atom to test
@param container container of the atom
@return whether the atom's only bonds are to heteroatoms
@see #perceiveNitrogens(IAtomContainer, IAtom, RingSearch, List) | [
"Determines",
"whether",
"the",
"bonds",
"(",
"up",
"to",
"two",
"spheres",
"away",
")",
"are",
"only",
"to",
"non",
"hetroatoms",
".",
"Currently",
"used",
"in",
"N",
".",
"planar3",
"perception",
"of",
"(",
"e",
".",
"g",
".",
"pyrrole",
")",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java#L989-L1017 |
jglobus/JGlobus | ssl-proxies/src/main/java/org/globus/gsi/X509Credential.java | X509Credential.verify | public void verify() throws CredentialException {
try {
String caCertsLocation = "file:" + CoGProperties.getDefault().getCaCertLocations();
KeyStore keyStore = Stores.getTrustStore(caCertsLocation + "/" + Stores.getDefaultCAFilesPattern());
CertStore crlStore = Stores.getCRLStore(caCertsLocation + "/" + Stores.getDefaultCRLFilesPattern());
ResourceSigningPolicyStore sigPolStore = Stores.getSigningPolicyStore(caCertsLocation + "/" + Stores.getDefaultSigningPolicyFilesPattern());
X509ProxyCertPathParameters parameters = new X509ProxyCertPathParameters(keyStore, crlStore, sigPolStore, false);
X509ProxyCertPathValidator validator = new X509ProxyCertPathValidator();
validator.engineValidate(CertificateUtil.getCertPath(certChain), parameters);
} catch (Exception e) {
throw new CredentialException(e);
}
} | java | public void verify() throws CredentialException {
try {
String caCertsLocation = "file:" + CoGProperties.getDefault().getCaCertLocations();
KeyStore keyStore = Stores.getTrustStore(caCertsLocation + "/" + Stores.getDefaultCAFilesPattern());
CertStore crlStore = Stores.getCRLStore(caCertsLocation + "/" + Stores.getDefaultCRLFilesPattern());
ResourceSigningPolicyStore sigPolStore = Stores.getSigningPolicyStore(caCertsLocation + "/" + Stores.getDefaultSigningPolicyFilesPattern());
X509ProxyCertPathParameters parameters = new X509ProxyCertPathParameters(keyStore, crlStore, sigPolStore, false);
X509ProxyCertPathValidator validator = new X509ProxyCertPathValidator();
validator.engineValidate(CertificateUtil.getCertPath(certChain), parameters);
} catch (Exception e) {
throw new CredentialException(e);
}
} | [
"public",
"void",
"verify",
"(",
")",
"throws",
"CredentialException",
"{",
"try",
"{",
"String",
"caCertsLocation",
"=",
"\"file:\"",
"+",
"CoGProperties",
".",
"getDefault",
"(",
")",
".",
"getCaCertLocations",
"(",
")",
";",
"KeyStore",
"keyStore",
"=",
"St... | Verifies the validity of the credentials. All certificate path validation is performed using trusted
certificates in default locations.
@exception CredentialException
if one of the certificates in the chain expired or if path validiation fails. | [
"Verifies",
"the",
"validity",
"of",
"the",
"credentials",
".",
"All",
"certificate",
"path",
"validation",
"is",
"performed",
"using",
"trusted",
"certificates",
"in",
"default",
"locations",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/X509Credential.java#L435-L449 |
alkacon/opencms-core | src/org/opencms/workplace/editors/CmsEditor.java | CmsEditor.commitTempFile | protected void commitTempFile() throws CmsException {
CmsObject cms = getCms();
CmsFile tempFile;
List<CmsProperty> properties;
try {
switchToTempProject();
tempFile = cms.readFile(getParamTempfile(), CmsResourceFilter.ALL);
properties = cms.readPropertyObjects(getParamTempfile(), false);
} finally {
// make sure the project is reset in case of any exception
switchToCurrentProject();
}
if (cms.existsResource(getParamResource(), CmsResourceFilter.ALL)) {
// update properties of original file first (required if change in encoding occurred)
cms.writePropertyObjects(getParamResource(), properties);
// now replace the content of the original file
CmsFile orgFile = cms.readFile(getParamResource(), CmsResourceFilter.ALL);
orgFile.setContents(tempFile.getContents());
getCloneCms().writeFile(orgFile);
} else {
// original file does not exist, remove visibility permission entries and copy temporary file
// switch to the temporary file project
try {
switchToTempProject();
// lock the temporary file
cms.changeLock(getParamTempfile());
// remove visibility permissions for everybody on temporary file if possible
if (cms.hasPermissions(tempFile, CmsPermissionSet.ACCESS_CONTROL)) {
cms.rmacc(
getParamTempfile(),
I_CmsPrincipal.PRINCIPAL_GROUP,
OpenCms.getDefaultUsers().getGroupUsers());
}
} finally {
// make sure the project is reset in case of any exception
switchToCurrentProject();
}
cms.copyResource(getParamTempfile(), getParamResource(), CmsResource.COPY_AS_NEW);
// ensure the content handler is called
CmsFile orgFile = cms.readFile(getParamResource(), CmsResourceFilter.ALL);
getCloneCms().writeFile(orgFile);
}
// remove the temporary file flag
int flags = cms.readResource(getParamResource(), CmsResourceFilter.ALL).getFlags();
if ((flags & CmsResource.FLAG_TEMPFILE) == CmsResource.FLAG_TEMPFILE) {
flags ^= CmsResource.FLAG_TEMPFILE;
cms.chflags(getParamResource(), flags);
}
} | java | protected void commitTempFile() throws CmsException {
CmsObject cms = getCms();
CmsFile tempFile;
List<CmsProperty> properties;
try {
switchToTempProject();
tempFile = cms.readFile(getParamTempfile(), CmsResourceFilter.ALL);
properties = cms.readPropertyObjects(getParamTempfile(), false);
} finally {
// make sure the project is reset in case of any exception
switchToCurrentProject();
}
if (cms.existsResource(getParamResource(), CmsResourceFilter.ALL)) {
// update properties of original file first (required if change in encoding occurred)
cms.writePropertyObjects(getParamResource(), properties);
// now replace the content of the original file
CmsFile orgFile = cms.readFile(getParamResource(), CmsResourceFilter.ALL);
orgFile.setContents(tempFile.getContents());
getCloneCms().writeFile(orgFile);
} else {
// original file does not exist, remove visibility permission entries and copy temporary file
// switch to the temporary file project
try {
switchToTempProject();
// lock the temporary file
cms.changeLock(getParamTempfile());
// remove visibility permissions for everybody on temporary file if possible
if (cms.hasPermissions(tempFile, CmsPermissionSet.ACCESS_CONTROL)) {
cms.rmacc(
getParamTempfile(),
I_CmsPrincipal.PRINCIPAL_GROUP,
OpenCms.getDefaultUsers().getGroupUsers());
}
} finally {
// make sure the project is reset in case of any exception
switchToCurrentProject();
}
cms.copyResource(getParamTempfile(), getParamResource(), CmsResource.COPY_AS_NEW);
// ensure the content handler is called
CmsFile orgFile = cms.readFile(getParamResource(), CmsResourceFilter.ALL);
getCloneCms().writeFile(orgFile);
}
// remove the temporary file flag
int flags = cms.readResource(getParamResource(), CmsResourceFilter.ALL).getFlags();
if ((flags & CmsResource.FLAG_TEMPFILE) == CmsResource.FLAG_TEMPFILE) {
flags ^= CmsResource.FLAG_TEMPFILE;
cms.chflags(getParamResource(), flags);
}
} | [
"protected",
"void",
"commitTempFile",
"(",
")",
"throws",
"CmsException",
"{",
"CmsObject",
"cms",
"=",
"getCms",
"(",
")",
";",
"CmsFile",
"tempFile",
";",
"List",
"<",
"CmsProperty",
">",
"properties",
";",
"try",
"{",
"switchToTempProject",
"(",
")",
";"... | Writes the content of a temporary file back to the original file.<p>
@throws CmsException if something goes wrong | [
"Writes",
"the",
"content",
"of",
"a",
"temporary",
"file",
"back",
"to",
"the",
"original",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsEditor.java#L786-L838 |
Jasig/uPortal | uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/PositionManager.java | PositionManager.applyToNodes | static void applyToNodes(List<NodeInfo> order, Element compViewParent) {
// first set up a bogus node to assist with inserting
Node insertPoint = compViewParent.getOwnerDocument().createElement("bogus");
Node first = compViewParent.getFirstChild();
if (first != null) compViewParent.insertBefore(insertPoint, first);
else compViewParent.appendChild(insertPoint);
// now pass through the order list inserting the nodes as you go
for (int i = 0; i < order.size(); i++)
compViewParent.insertBefore(order.get(i).getNode(), insertPoint);
compViewParent.removeChild(insertPoint);
} | java | static void applyToNodes(List<NodeInfo> order, Element compViewParent) {
// first set up a bogus node to assist with inserting
Node insertPoint = compViewParent.getOwnerDocument().createElement("bogus");
Node first = compViewParent.getFirstChild();
if (first != null) compViewParent.insertBefore(insertPoint, first);
else compViewParent.appendChild(insertPoint);
// now pass through the order list inserting the nodes as you go
for (int i = 0; i < order.size(); i++)
compViewParent.insertBefore(order.get(i).getNode(), insertPoint);
compViewParent.removeChild(insertPoint);
} | [
"static",
"void",
"applyToNodes",
"(",
"List",
"<",
"NodeInfo",
">",
"order",
",",
"Element",
"compViewParent",
")",
"{",
"// first set up a bogus node to assist with inserting",
"Node",
"insertPoint",
"=",
"compViewParent",
".",
"getOwnerDocument",
"(",
")",
".",
"cr... | This method applies the ordering specified in the passed in order list to the child nodes of
the compViewParent. Nodes specified in the list but located elsewhere are pulled in. | [
"This",
"method",
"applies",
"the",
"ordering",
"specified",
"in",
"the",
"passed",
"in",
"order",
"list",
"to",
"the",
"child",
"nodes",
"of",
"the",
"compViewParent",
".",
"Nodes",
"specified",
"in",
"the",
"list",
"but",
"located",
"elsewhere",
"are",
"pu... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/PositionManager.java#L241-L254 |
marvinlabs/android-intents | library/src/main/java/com/marvinlabs/intents/PhoneIntents.java | PhoneIntents.newCallNumberIntent | public static Intent newCallNumberIntent(String phoneNumber) {
final Intent intent;
if (phoneNumber == null || phoneNumber.trim().length() <= 0) {
intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"));
} else {
intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber.replace(" ", "")));
}
return intent;
} | java | public static Intent newCallNumberIntent(String phoneNumber) {
final Intent intent;
if (phoneNumber == null || phoneNumber.trim().length() <= 0) {
intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"));
} else {
intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber.replace(" ", "")));
}
return intent;
} | [
"public",
"static",
"Intent",
"newCallNumberIntent",
"(",
"String",
"phoneNumber",
")",
"{",
"final",
"Intent",
"intent",
";",
"if",
"(",
"phoneNumber",
"==",
"null",
"||",
"phoneNumber",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"<=",
"0",
")",
"{... | Creates an intent that will immediately dispatch a call to the given number. NOTE that unlike
{@link #newDialNumberIntent(String)}, this intent requires the {@link android.Manifest.permission#CALL_PHONE}
permission to be set.
@param phoneNumber the number to call
@return the intent | [
"Creates",
"an",
"intent",
"that",
"will",
"immediately",
"dispatch",
"a",
"call",
"to",
"the",
"given",
"number",
".",
"NOTE",
"that",
"unlike",
"{",
"@link",
"#newDialNumberIntent",
"(",
"String",
")",
"}",
"this",
"intent",
"requires",
"the",
"{",
"@link"... | train | https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/PhoneIntents.java#L143-L151 |
mangstadt/biweekly | src/main/java/biweekly/component/ICalComponent.java | ICalComponent.removeComponents | public <T extends ICalComponent> List<T> removeComponents(Class<T> clazz) {
List<ICalComponent> removed = components.removeAll(clazz);
return castList(removed, clazz);
} | java | public <T extends ICalComponent> List<T> removeComponents(Class<T> clazz) {
List<ICalComponent> removed = components.removeAll(clazz);
return castList(removed, clazz);
} | [
"public",
"<",
"T",
"extends",
"ICalComponent",
">",
"List",
"<",
"T",
">",
"removeComponents",
"(",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"List",
"<",
"ICalComponent",
">",
"removed",
"=",
"components",
".",
"removeAll",
"(",
"clazz",
")",
";",
"... | Removes all sub-components of the given class from this component.
@param clazz the class of the components to remove (e.g. "VEvent.class")
@param <T> the component class
@return the removed components (this list is immutable) | [
"Removes",
"all",
"sub",
"-",
"components",
"of",
"the",
"given",
"class",
"from",
"this",
"component",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/ICalComponent.java#L175-L178 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/tabs/Tabs.java | Tabs.setAjaxActivateEvent | public Tabs setAjaxActivateEvent(ITabsAjaxEvent activateEvent)
{
this.ajaxEvents.put(TabEvent.activate, activateEvent);
setActivateEvent(new TabsAjaxJsScopeUiEvent(this, TabEvent.activate));
return this;
} | java | public Tabs setAjaxActivateEvent(ITabsAjaxEvent activateEvent)
{
this.ajaxEvents.put(TabEvent.activate, activateEvent);
setActivateEvent(new TabsAjaxJsScopeUiEvent(this, TabEvent.activate));
return this;
} | [
"public",
"Tabs",
"setAjaxActivateEvent",
"(",
"ITabsAjaxEvent",
"activateEvent",
")",
"{",
"this",
".",
"ajaxEvents",
".",
"put",
"(",
"TabEvent",
".",
"activate",
",",
"activateEvent",
")",
";",
"setActivateEvent",
"(",
"new",
"TabsAjaxJsScopeUiEvent",
"(",
"thi... | Sets the call-back for the AJAX activate event.
@param activateEvent
The ITabsAjaxEvent. | [
"Sets",
"the",
"call",
"-",
"back",
"for",
"the",
"AJAX",
"activate",
"event",
"."
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/tabs/Tabs.java#L654-L659 |
Kurento/kurento-module-creator | src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java | ExpressionParser.parseTildeExpression | private Expression parseTildeExpression() {
consumeNextToken(TILDE);
int major = intOf(consumeNextToken(NUMERIC).lexeme);
if (!tokens.positiveLookahead(DOT)) {
return new GreaterOrEqual(versionOf(major, 0, 0));
}
consumeNextToken(DOT);
int minor = intOf(consumeNextToken(NUMERIC).lexeme);
if (!tokens.positiveLookahead(DOT)) {
return new And(new GreaterOrEqual(versionOf(major, minor, 0)),
new Less(versionOf(major + 1, 0, 0)));
}
consumeNextToken(DOT);
int patch = intOf(consumeNextToken(NUMERIC).lexeme);
return new And(new GreaterOrEqual(versionOf(major, minor, patch)),
new Less(versionOf(major, minor + 1, 0)));
} | java | private Expression parseTildeExpression() {
consumeNextToken(TILDE);
int major = intOf(consumeNextToken(NUMERIC).lexeme);
if (!tokens.positiveLookahead(DOT)) {
return new GreaterOrEqual(versionOf(major, 0, 0));
}
consumeNextToken(DOT);
int minor = intOf(consumeNextToken(NUMERIC).lexeme);
if (!tokens.positiveLookahead(DOT)) {
return new And(new GreaterOrEqual(versionOf(major, minor, 0)),
new Less(versionOf(major + 1, 0, 0)));
}
consumeNextToken(DOT);
int patch = intOf(consumeNextToken(NUMERIC).lexeme);
return new And(new GreaterOrEqual(versionOf(major, minor, patch)),
new Less(versionOf(major, minor + 1, 0)));
} | [
"private",
"Expression",
"parseTildeExpression",
"(",
")",
"{",
"consumeNextToken",
"(",
"TILDE",
")",
";",
"int",
"major",
"=",
"intOf",
"(",
"consumeNextToken",
"(",
"NUMERIC",
")",
".",
"lexeme",
")",
";",
"if",
"(",
"!",
"tokens",
".",
"positiveLookahead... | Parses the {@literal <tilde-expr>} non-terminal.
<pre>
{@literal
<tilde-expr> ::= "~" <version>
}
</pre>
@return the expression AST | [
"Parses",
"the",
"{",
"@literal",
"<tilde",
"-",
"expr",
">",
"}",
"non",
"-",
"terminal",
"."
] | train | https://github.com/Kurento/kurento-module-creator/blob/c371516c665b902b5476433496a5aefcbca86d64/src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java#L247-L263 |
google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.assignmentWithRhs | public static Matcher assignmentWithRhs(final Matcher rhsMatcher) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return node.isAssign() && rhsMatcher.matches(node.getLastChild(), metadata);
}
};
} | java | public static Matcher assignmentWithRhs(final Matcher rhsMatcher) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return node.isAssign() && rhsMatcher.matches(node.getLastChild(), metadata);
}
};
} | [
"public",
"static",
"Matcher",
"assignmentWithRhs",
"(",
"final",
"Matcher",
"rhsMatcher",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"... | Returns a Matcher that matches an ASSIGN node where the RHS of the assignment matches the given
rhsMatcher. | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"an",
"ASSIGN",
"node",
"where",
"the",
"RHS",
"of",
"the",
"assignment",
"matches",
"the",
"given",
"rhsMatcher",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L306-L312 |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.performWithLock | public void performWithLock (final NodeObject.Lock lock, final LockedOperation operation)
{
acquireLock(lock, new ResultListener<String>() {
public void requestCompleted (String nodeName) {
if (getNodeObject().nodeName.equals(nodeName)) {
// lock acquired successfully - perform the operation, and release the lock.
try {
operation.run();
} finally {
releaseLock(lock, new ResultListener.NOOP<String>());
}
} else {
// some other peer beat us to it
operation.fail(nodeName);
if (nodeName == null) {
log.warning("Lock acquired by null?", "lock", lock);
}
}
}
public void requestFailed (Exception cause) {
log.warning("Lock acquisition failed", "lock", lock, cause);
operation.fail(null);
}
});
} | java | public void performWithLock (final NodeObject.Lock lock, final LockedOperation operation)
{
acquireLock(lock, new ResultListener<String>() {
public void requestCompleted (String nodeName) {
if (getNodeObject().nodeName.equals(nodeName)) {
// lock acquired successfully - perform the operation, and release the lock.
try {
operation.run();
} finally {
releaseLock(lock, new ResultListener.NOOP<String>());
}
} else {
// some other peer beat us to it
operation.fail(nodeName);
if (nodeName == null) {
log.warning("Lock acquired by null?", "lock", lock);
}
}
}
public void requestFailed (Exception cause) {
log.warning("Lock acquisition failed", "lock", lock, cause);
operation.fail(null);
}
});
} | [
"public",
"void",
"performWithLock",
"(",
"final",
"NodeObject",
".",
"Lock",
"lock",
",",
"final",
"LockedOperation",
"operation",
")",
"{",
"acquireLock",
"(",
"lock",
",",
"new",
"ResultListener",
"<",
"String",
">",
"(",
")",
"{",
"public",
"void",
"requ... | Tries to acquire the resource lock and, if successful, performs the operation and releases
the lock; if unsuccessful, calls the operation's failure handler. Please note: the lock will
be released immediately after the operation. | [
"Tries",
"to",
"acquire",
"the",
"resource",
"lock",
"and",
"if",
"successful",
"performs",
"the",
"operation",
"and",
"releases",
"the",
"lock",
";",
"if",
"unsuccessful",
"calls",
"the",
"operation",
"s",
"failure",
"handler",
".",
"Please",
"note",
":",
"... | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L908-L932 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.getJaroWinklerDistance | @Deprecated
public static double getJaroWinklerDistance(final CharSequence first, final CharSequence second) {
final double DEFAULT_SCALING_FACTOR = 0.1;
if (first == null || second == null) {
throw new IllegalArgumentException("Strings must not be null");
}
final int[] mtp = matches(first, second);
final double m = mtp[0];
if (m == 0) {
return 0D;
}
final double j = ((m / first.length() + m / second.length() + (m - mtp[1]) / m)) / 3;
final double jw = j < 0.7D ? j : j + Math.min(DEFAULT_SCALING_FACTOR, 1D / mtp[3]) * mtp[2] * (1D - j);
return Math.round(jw * 100.0D) / 100.0D;
} | java | @Deprecated
public static double getJaroWinklerDistance(final CharSequence first, final CharSequence second) {
final double DEFAULT_SCALING_FACTOR = 0.1;
if (first == null || second == null) {
throw new IllegalArgumentException("Strings must not be null");
}
final int[] mtp = matches(first, second);
final double m = mtp[0];
if (m == 0) {
return 0D;
}
final double j = ((m / first.length() + m / second.length() + (m - mtp[1]) / m)) / 3;
final double jw = j < 0.7D ? j : j + Math.min(DEFAULT_SCALING_FACTOR, 1D / mtp[3]) * mtp[2] * (1D - j);
return Math.round(jw * 100.0D) / 100.0D;
} | [
"@",
"Deprecated",
"public",
"static",
"double",
"getJaroWinklerDistance",
"(",
"final",
"CharSequence",
"first",
",",
"final",
"CharSequence",
"second",
")",
"{",
"final",
"double",
"DEFAULT_SCALING_FACTOR",
"=",
"0.1",
";",
"if",
"(",
"first",
"==",
"null",
"|... | <p>Find the Jaro Winkler Distance which indicates the similarity score between two Strings.</p>
<p>The Jaro measure is the weighted sum of percentage of matched characters from each file and transposed characters.
Winkler increased this measure for matching initial characters.</p>
<p>This implementation is based on the Jaro Winkler similarity algorithm
from <a href="http://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance">http://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance</a>.</p>
<pre>
StringUtils.getJaroWinklerDistance(null, null) = IllegalArgumentException
StringUtils.getJaroWinklerDistance("","") = 0.0
StringUtils.getJaroWinklerDistance("","a") = 0.0
StringUtils.getJaroWinklerDistance("aaapppp", "") = 0.0
StringUtils.getJaroWinklerDistance("frog", "fog") = 0.93
StringUtils.getJaroWinklerDistance("fly", "ant") = 0.0
StringUtils.getJaroWinklerDistance("elephant", "hippo") = 0.44
StringUtils.getJaroWinklerDistance("hippo", "elephant") = 0.44
StringUtils.getJaroWinklerDistance("hippo", "zzzzzzzz") = 0.0
StringUtils.getJaroWinklerDistance("hello", "hallo") = 0.88
StringUtils.getJaroWinklerDistance("ABC Corporation", "ABC Corp") = 0.93
StringUtils.getJaroWinklerDistance("D N H Enterprises Inc", "D & H Enterprises, Inc.") = 0.95
StringUtils.getJaroWinklerDistance("My Gym Children's Fitness Center", "My Gym. Childrens Fitness") = 0.92
StringUtils.getJaroWinklerDistance("PENNSYLVANIA", "PENNCISYLVNIA") = 0.88
</pre>
@param first the first String, must not be null
@param second the second String, must not be null
@return result distance
@throws IllegalArgumentException if either String input {@code null}
@since 3.3
@deprecated as of 3.6, use commons-text
<a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/similarity/JaroWinklerDistance.html">
JaroWinklerDistance</a> instead | [
"<p",
">",
"Find",
"the",
"Jaro",
"Winkler",
"Distance",
"which",
"indicates",
"the",
"similarity",
"score",
"between",
"two",
"Strings",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L8303-L8319 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/DerivativeIntegralImage.java | DerivativeIntegralImage.kernelHaarX | public static IntegralKernel kernelHaarX( int r , IntegralKernel ret) {
if( ret == null )
ret = new IntegralKernel(2);
ret.blocks[0].set(-r, -r, 0, r);
ret.blocks[1].set(0,-r,r,r);
ret.scales[0] = -1;
ret.scales[1] = 1;
return ret;
} | java | public static IntegralKernel kernelHaarX( int r , IntegralKernel ret) {
if( ret == null )
ret = new IntegralKernel(2);
ret.blocks[0].set(-r, -r, 0, r);
ret.blocks[1].set(0,-r,r,r);
ret.scales[0] = -1;
ret.scales[1] = 1;
return ret;
} | [
"public",
"static",
"IntegralKernel",
"kernelHaarX",
"(",
"int",
"r",
",",
"IntegralKernel",
"ret",
")",
"{",
"if",
"(",
"ret",
"==",
"null",
")",
"ret",
"=",
"new",
"IntegralKernel",
"(",
"2",
")",
";",
"ret",
".",
"blocks",
"[",
"0",
"]",
".",
"set... | Creates a kernel for the Haar wavelet "centered" around the target pixel.
@param r Radius of the box. width is 2*r
@return Kernel for a Haar x-axis wavelet. | [
"Creates",
"a",
"kernel",
"for",
"the",
"Haar",
"wavelet",
"centered",
"around",
"the",
"target",
"pixel",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/DerivativeIntegralImage.java#L72-L82 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageFactoryImpl.java | JsJmsMessageFactoryImpl.createInboundJmsMessage | final JsJmsMessage createInboundJmsMessage(JsMsgObject jmo, int messageType) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())SibTr.entry(tc, "createInboundJmsMessage " + messageType );
JsJmsMessage jmsMessage = null;
switch (messageType) {
case JmsBodyType.BYTES_INT:
jmsMessage = new JsJmsBytesMessageImpl(jmo);
break;
case JmsBodyType.MAP_INT:
jmsMessage = new JsJmsMapMessageImpl(jmo);
break;
case JmsBodyType.OBJECT_INT:
jmsMessage = new JsJmsObjectMessageImpl(jmo);
break;
case JmsBodyType.STREAM_INT:
jmsMessage = new JsJmsStreamMessageImpl(jmo);
break;
case JmsBodyType.TEXT_INT:
jmsMessage = new JsJmsTextMessageImpl(jmo);
break;
default:
jmsMessage = new JsJmsMessageImpl(jmo);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())SibTr.exit(tc, "createInboundJmsMessage");
return jmsMessage;
} | java | final JsJmsMessage createInboundJmsMessage(JsMsgObject jmo, int messageType) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())SibTr.entry(tc, "createInboundJmsMessage " + messageType );
JsJmsMessage jmsMessage = null;
switch (messageType) {
case JmsBodyType.BYTES_INT:
jmsMessage = new JsJmsBytesMessageImpl(jmo);
break;
case JmsBodyType.MAP_INT:
jmsMessage = new JsJmsMapMessageImpl(jmo);
break;
case JmsBodyType.OBJECT_INT:
jmsMessage = new JsJmsObjectMessageImpl(jmo);
break;
case JmsBodyType.STREAM_INT:
jmsMessage = new JsJmsStreamMessageImpl(jmo);
break;
case JmsBodyType.TEXT_INT:
jmsMessage = new JsJmsTextMessageImpl(jmo);
break;
default:
jmsMessage = new JsJmsMessageImpl(jmo);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())SibTr.exit(tc, "createInboundJmsMessage");
return jmsMessage;
} | [
"final",
"JsJmsMessage",
"createInboundJmsMessage",
"(",
"JsMsgObject",
"jmo",
",",
"int",
"messageType",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",... | Create an instance of the appropriate sub-class, e.g. JsJmsTextMessage
if the inbound message is actually a JMS Text Message, for the
given JMO.
@return JsJmsMessage A JsJmsMessage of the appropriate subtype | [
"Create",
"an",
"instance",
"of",
"the",
"appropriate",
"sub",
"-",
"class",
"e",
".",
"g",
".",
"JsJmsTextMessage",
"if",
"the",
"inbound",
"message",
"is",
"actually",
"a",
"JMS",
"Text",
"Message",
"for",
"the",
"given",
"JMO",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageFactoryImpl.java#L180-L214 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/PathBuilder.java | PathBuilder.get | public BooleanPath get(BooleanPath path) {
BooleanPath newPath = getBoolean(toString(path));
return addMetadataOf(newPath, path);
} | java | public BooleanPath get(BooleanPath path) {
BooleanPath newPath = getBoolean(toString(path));
return addMetadataOf(newPath, path);
} | [
"public",
"BooleanPath",
"get",
"(",
"BooleanPath",
"path",
")",
"{",
"BooleanPath",
"newPath",
"=",
"getBoolean",
"(",
"toString",
"(",
"path",
")",
")",
";",
"return",
"addMetadataOf",
"(",
"newPath",
",",
"path",
")",
";",
"}"
] | Create a new Boolean typed path
@param path existing path
@return property path | [
"Create",
"a",
"new",
"Boolean",
"typed",
"path"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/PathBuilder.java#L183-L186 |
coursera/courier | generator-api/src/main/java/org/coursera/courier/lang/DocEscaping.java | DocEscaping.stringToDocComment | public static String stringToDocComment(String doc, DocCommentStyle style) {
if (doc == null || doc.trim().isEmpty()) return "";
String commentNewline = (style == DocCommentStyle.ASTRISK_MARGIN) ? "\n * " : "\n";
String schemadoc = wrap(escape(doc)).replaceAll("\\n", commentNewline);
StringBuilder builder = new StringBuilder();
builder.append("/**\n");
if (style == DocCommentStyle.ASTRISK_MARGIN) builder.append(" * ");
builder.append(schemadoc).append("\n");
if (style == DocCommentStyle.ASTRISK_MARGIN) builder.append(" ");
builder.append("*/");
return builder.toString();
} | java | public static String stringToDocComment(String doc, DocCommentStyle style) {
if (doc == null || doc.trim().isEmpty()) return "";
String commentNewline = (style == DocCommentStyle.ASTRISK_MARGIN) ? "\n * " : "\n";
String schemadoc = wrap(escape(doc)).replaceAll("\\n", commentNewline);
StringBuilder builder = new StringBuilder();
builder.append("/**\n");
if (style == DocCommentStyle.ASTRISK_MARGIN) builder.append(" * ");
builder.append(schemadoc).append("\n");
if (style == DocCommentStyle.ASTRISK_MARGIN) builder.append(" ");
builder.append("*/");
return builder.toString();
} | [
"public",
"static",
"String",
"stringToDocComment",
"(",
"String",
"doc",
",",
"DocCommentStyle",
"style",
")",
"{",
"if",
"(",
"doc",
"==",
"null",
"||",
"doc",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"return",
"\"\"",
";",
"String",
"co... | Returns a doc comment, as a string of source, for the given documentation string
and deprecated property.
@param doc provides the schemadoc for the symbol, if any. May be null.
@return an escaped schemadoc string. | [
"Returns",
"a",
"doc",
"comment",
"as",
"a",
"string",
"of",
"source",
"for",
"the",
"given",
"documentation",
"string",
"and",
"deprecated",
"property",
"."
] | train | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/lang/DocEscaping.java#L30-L42 |
Stratio/stratio-connector-commons | connector-commons/src/main/java/com/stratio/connector/commons/connection/ConnectionHandler.java | ConnectionHandler.createConnection | public void createConnection(ICredentials credentials, ConnectorClusterConfig config) throws ConnectionException {
logger.info("Creating new connection...");
Connection connection = createNativeConnection(credentials, config);
String connectionName = config.getName().getName();
synchronized (connections) {
if (!connections.containsKey(connectionName)) {
connections.put(connectionName, connection);
logger.info("Connected to [" + connectionName + "]");
} else {
String msg = "The connection [" + connectionName + "] already exists";
logger.error(msg);
throw new ConnectionException(msg);
}
}
} | java | public void createConnection(ICredentials credentials, ConnectorClusterConfig config) throws ConnectionException {
logger.info("Creating new connection...");
Connection connection = createNativeConnection(credentials, config);
String connectionName = config.getName().getName();
synchronized (connections) {
if (!connections.containsKey(connectionName)) {
connections.put(connectionName, connection);
logger.info("Connected to [" + connectionName + "]");
} else {
String msg = "The connection [" + connectionName + "] already exists";
logger.error(msg);
throw new ConnectionException(msg);
}
}
} | [
"public",
"void",
"createConnection",
"(",
"ICredentials",
"credentials",
",",
"ConnectorClusterConfig",
"config",
")",
"throws",
"ConnectionException",
"{",
"logger",
".",
"info",
"(",
"\"Creating new connection...\"",
")",
";",
"Connection",
"connection",
"=",
"create... | This method create a connection.
@param credentials the cluster configuration.
@param config the connection options.
@throws ConnectionException if the connection already exists. | [
"This",
"method",
"create",
"a",
"connection",
"."
] | train | https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/connection/ConnectionHandler.java#L72-L90 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.readGroup | public CmsGroup readGroup(CmsDbContext dbc, String groupname) throws CmsDataAccessException {
CmsGroup group = null;
// try to read group from cache
group = m_monitor.getCachedGroup(groupname);
if (group == null) {
group = getUserDriver(dbc).readGroup(dbc, groupname);
m_monitor.cacheGroup(group);
}
return group;
} | java | public CmsGroup readGroup(CmsDbContext dbc, String groupname) throws CmsDataAccessException {
CmsGroup group = null;
// try to read group from cache
group = m_monitor.getCachedGroup(groupname);
if (group == null) {
group = getUserDriver(dbc).readGroup(dbc, groupname);
m_monitor.cacheGroup(group);
}
return group;
} | [
"public",
"CmsGroup",
"readGroup",
"(",
"CmsDbContext",
"dbc",
",",
"String",
"groupname",
")",
"throws",
"CmsDataAccessException",
"{",
"CmsGroup",
"group",
"=",
"null",
";",
"// try to read group from cache",
"group",
"=",
"m_monitor",
".",
"getCachedGroup",
"(",
... | Reads a group based on its name.<p>
@param dbc the current database context
@param groupname the name of the group that is to be read
@return the requested group
@throws CmsDataAccessException if operation was not successful | [
"Reads",
"a",
"group",
"based",
"on",
"its",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L6927-L6937 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/convert/DoubleConverter.java | DoubleConverter.toDoubleWithDefault | public static double toDoubleWithDefault(Object value, double defaultValue) {
Double result = toNullableDouble(value);
return result != null ? (double) result : defaultValue;
} | java | public static double toDoubleWithDefault(Object value, double defaultValue) {
Double result = toNullableDouble(value);
return result != null ? (double) result : defaultValue;
} | [
"public",
"static",
"double",
"toDoubleWithDefault",
"(",
"Object",
"value",
",",
"double",
"defaultValue",
")",
"{",
"Double",
"result",
"=",
"toNullableDouble",
"(",
"value",
")",
";",
"return",
"result",
"!=",
"null",
"?",
"(",
"double",
")",
"result",
":... | Converts value into doubles or returns default value when conversion is not
possible.
@param value the value to convert.
@param defaultValue the default value.
@return double value or default when conversion is not supported.
@see DoubleConverter#toNullableDouble(Object) | [
"Converts",
"value",
"into",
"doubles",
"or",
"returns",
"default",
"value",
"when",
"conversion",
"is",
"not",
"possible",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/convert/DoubleConverter.java#L89-L92 |
netty/netty | common/src/main/java/io/netty/util/internal/ReflectionUtil.java | ReflectionUtil.trySetAccessible | public static Throwable trySetAccessible(AccessibleObject object, boolean checkAccessible) {
if (checkAccessible && !PlatformDependent0.isExplicitTryReflectionSetAccessible()) {
return new UnsupportedOperationException("Reflective setAccessible(true) disabled");
}
try {
object.setAccessible(true);
return null;
} catch (SecurityException e) {
return e;
} catch (RuntimeException e) {
return handleInaccessibleObjectException(e);
}
} | java | public static Throwable trySetAccessible(AccessibleObject object, boolean checkAccessible) {
if (checkAccessible && !PlatformDependent0.isExplicitTryReflectionSetAccessible()) {
return new UnsupportedOperationException("Reflective setAccessible(true) disabled");
}
try {
object.setAccessible(true);
return null;
} catch (SecurityException e) {
return e;
} catch (RuntimeException e) {
return handleInaccessibleObjectException(e);
}
} | [
"public",
"static",
"Throwable",
"trySetAccessible",
"(",
"AccessibleObject",
"object",
",",
"boolean",
"checkAccessible",
")",
"{",
"if",
"(",
"checkAccessible",
"&&",
"!",
"PlatformDependent0",
".",
"isExplicitTryReflectionSetAccessible",
"(",
")",
")",
"{",
"return... | Try to call {@link AccessibleObject#setAccessible(boolean)} but will catch any {@link SecurityException} and
{@link java.lang.reflect.InaccessibleObjectException} and return it.
The caller must check if it returns {@code null} and if not handle the returned exception. | [
"Try",
"to",
"call",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/ReflectionUtil.java#L29-L41 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java | Parameters.getPositiveDoubleList | public List<Double> getPositiveDoubleList(final String param) {
return getList(param, new StringToDouble(),
new IsPositive<Double>(), "positive double");
} | java | public List<Double> getPositiveDoubleList(final String param) {
return getList(param, new StringToDouble(),
new IsPositive<Double>(), "positive double");
} | [
"public",
"List",
"<",
"Double",
">",
"getPositiveDoubleList",
"(",
"final",
"String",
"param",
")",
"{",
"return",
"getList",
"(",
"param",
",",
"new",
"StringToDouble",
"(",
")",
",",
"new",
"IsPositive",
"<",
"Double",
">",
"(",
")",
",",
"\"positive do... | Gets a parameter whose value is a (possibly empty) list of positive doubles. | [
"Gets",
"a",
"parameter",
"whose",
"value",
"is",
"a",
"(",
"possibly",
"empty",
")",
"list",
"of",
"positive",
"doubles",
"."
] | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L701-L704 |
aws/aws-sdk-java | aws-java-sdk-budgets/src/main/java/com/amazonaws/services/budgets/model/Budget.java | Budget.withCostFilters | public Budget withCostFilters(java.util.Map<String, java.util.List<String>> costFilters) {
setCostFilters(costFilters);
return this;
} | java | public Budget withCostFilters(java.util.Map<String, java.util.List<String>> costFilters) {
setCostFilters(costFilters);
return this;
} | [
"public",
"Budget",
"withCostFilters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
">",
"costFilters",
")",
"{",
"setCostFilters",
"(",
"costFilters",
")",
";",
"return",
"this",
";",
... | <p>
The cost filters, such as service or region, that are applied to a budget.
</p>
<p>
AWS Budgets supports the following services as a filter for RI budgets:
</p>
<ul>
<li>
<p>
Amazon Elastic Compute Cloud - Compute
</p>
</li>
<li>
<p>
Amazon Redshift
</p>
</li>
<li>
<p>
Amazon Relational Database Service
</p>
</li>
<li>
<p>
Amazon ElastiCache
</p>
</li>
<li>
<p>
Amazon Elasticsearch Service
</p>
</li>
</ul>
@param costFilters
The cost filters, such as service or region, that are applied to a budget.</p>
<p>
AWS Budgets supports the following services as a filter for RI budgets:
</p>
<ul>
<li>
<p>
Amazon Elastic Compute Cloud - Compute
</p>
</li>
<li>
<p>
Amazon Redshift
</p>
</li>
<li>
<p>
Amazon Relational Database Service
</p>
</li>
<li>
<p>
Amazon ElastiCache
</p>
</li>
<li>
<p>
Amazon Elasticsearch Service
</p>
</li>
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"cost",
"filters",
"such",
"as",
"service",
"or",
"region",
"that",
"are",
"applied",
"to",
"a",
"budget",
".",
"<",
"/",
"p",
">",
"<p",
">",
"AWS",
"Budgets",
"supports",
"the",
"following",
"services",
"as",
"a",
"filter",
"for",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-budgets/src/main/java/com/amazonaws/services/budgets/model/Budget.java#L474-L477 |
opentelecoms-org/zrtp-java | src/zorg/platform/android/AndroidCryptoUtils.java | AndroidCryptoUtils.aesDecrypt | @Override
public byte[] aesDecrypt(byte[] data, int offset, int length, byte[] key,
byte[] initVector) throws CryptoException {
try {
SecretKeySpec scs = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES/CFB/NoPadding", "ZBC");
IvParameterSpec iv = new IvParameterSpec(initVector);
ByteArrayOutputStream baos = new ByteArrayOutputStream(length);
cipher.init(Cipher.DECRYPT_MODE, scs, iv);
CipherOutputStream out = new CipherOutputStream(baos, cipher);
out.write(data, offset, length);
out.close();
baos.close();
return baos.toByteArray();
} catch (Exception e) {
throw new CryptoException(e);
}
} | java | @Override
public byte[] aesDecrypt(byte[] data, int offset, int length, byte[] key,
byte[] initVector) throws CryptoException {
try {
SecretKeySpec scs = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES/CFB/NoPadding", "ZBC");
IvParameterSpec iv = new IvParameterSpec(initVector);
ByteArrayOutputStream baos = new ByteArrayOutputStream(length);
cipher.init(Cipher.DECRYPT_MODE, scs, iv);
CipherOutputStream out = new CipherOutputStream(baos, cipher);
out.write(data, offset, length);
out.close();
baos.close();
return baos.toByteArray();
} catch (Exception e) {
throw new CryptoException(e);
}
} | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"aesDecrypt",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
",",
"byte",
"[",
"]",
"key",
",",
"byte",
"[",
"]",
"initVector",
")",
"throws",
"CryptoException",
"{",
"try",
"{"... | /* (non-Javadoc)
@see zorg.platform.CryptoUtils#aesDecrypt(byte[], int, int, byte[], byte[]) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/platform/android/AndroidCryptoUtils.java#L48-L65 |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/IgnoredNonAffectedServerGroupsUtil.java | IgnoredNonAffectedServerGroupsUtil.addCurrentServerGroupsToHostInfoModel | public static ModelNode addCurrentServerGroupsToHostInfoModel(boolean ignoreUnaffectedServerGroups, Resource hostModel, ModelNode model) {
if (!ignoreUnaffectedServerGroups) {
return model;
}
model.get(IGNORE_UNUSED_CONFIG).set(ignoreUnaffectedServerGroups);
addServerGroupsToModel(hostModel, model);
return model;
} | java | public static ModelNode addCurrentServerGroupsToHostInfoModel(boolean ignoreUnaffectedServerGroups, Resource hostModel, ModelNode model) {
if (!ignoreUnaffectedServerGroups) {
return model;
}
model.get(IGNORE_UNUSED_CONFIG).set(ignoreUnaffectedServerGroups);
addServerGroupsToModel(hostModel, model);
return model;
} | [
"public",
"static",
"ModelNode",
"addCurrentServerGroupsToHostInfoModel",
"(",
"boolean",
"ignoreUnaffectedServerGroups",
",",
"Resource",
"hostModel",
",",
"ModelNode",
"model",
")",
"{",
"if",
"(",
"!",
"ignoreUnaffectedServerGroups",
")",
"{",
"return",
"model",
";",... | Used by the slave host when creating the host info dmr sent across to the DC during the registration process
@param ignoreUnaffectedServerGroups whether the slave host is set up to ignore config for server groups it does not have servers for
@param hostModel the resource containing the host model
@param model the dmr sent across to theDC
@return the modified dmr | [
"Used",
"by",
"the",
"slave",
"host",
"when",
"creating",
"the",
"host",
"info",
"dmr",
"sent",
"across",
"to",
"the",
"DC",
"during",
"the",
"registration",
"process"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/IgnoredNonAffectedServerGroupsUtil.java#L84-L91 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/contextmenu/CmsShowWorkplace.java | CmsShowWorkplace.openWorkplace | public static void openWorkplace(final CmsUUID structureId, final boolean classic) {
CmsRpcAction<String> callback = new CmsRpcAction<String>() {
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
*/
@Override
public void execute() {
start(0, true);
CmsCoreProvider.getService().getWorkplaceLink(structureId, this);
}
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
*/
@Override
protected void onResponse(String result) {
stop(false);
Window.Location.assign(result);
}
};
callback.execute();
} | java | public static void openWorkplace(final CmsUUID structureId, final boolean classic) {
CmsRpcAction<String> callback = new CmsRpcAction<String>() {
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
*/
@Override
public void execute() {
start(0, true);
CmsCoreProvider.getService().getWorkplaceLink(structureId, this);
}
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
*/
@Override
protected void onResponse(String result) {
stop(false);
Window.Location.assign(result);
}
};
callback.execute();
} | [
"public",
"static",
"void",
"openWorkplace",
"(",
"final",
"CmsUUID",
"structureId",
",",
"final",
"boolean",
"classic",
")",
"{",
"CmsRpcAction",
"<",
"String",
">",
"callback",
"=",
"new",
"CmsRpcAction",
"<",
"String",
">",
"(",
")",
"{",
"/**\n ... | Opens the workplace.<p>
@param structureId the structure id of the resource for which the workplace should be opened
@param classic if true, opens the old workplace, else the new workplace | [
"Opens",
"the",
"workplace",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/contextmenu/CmsShowWorkplace.java#L88-L113 |
jenkinsci/java-client-api | jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java | JenkinsServer.deleteJob | public JenkinsServer deleteJob(FolderJob folder, String jobName) throws IOException {
return deleteJob(folder, jobName, false);
} | java | public JenkinsServer deleteJob(FolderJob folder, String jobName) throws IOException {
return deleteJob(folder, jobName, false);
} | [
"public",
"JenkinsServer",
"deleteJob",
"(",
"FolderJob",
"folder",
",",
"String",
"jobName",
")",
"throws",
"IOException",
"{",
"return",
"deleteJob",
"(",
"folder",
",",
"jobName",
",",
"false",
")",
";",
"}"
] | Delete a job from Jenkins within a folder.
@param folder The folder where the given job is located.
@param jobName The job which should be deleted.
@throws IOException in case of an error. | [
"Delete",
"a",
"job",
"from",
"Jenkins",
"within",
"a",
"folder",
"."
] | train | https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L692-L694 |
grails/grails-core | grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java | GroovyPagesUriSupport.getNoSuffixViewURI | public String getNoSuffixViewURI(GroovyObject controller, String viewName) {
return getNoSuffixViewURI(getLogicalControllerName(controller), viewName);
} | java | public String getNoSuffixViewURI(GroovyObject controller, String viewName) {
return getNoSuffixViewURI(getLogicalControllerName(controller), viewName);
} | [
"public",
"String",
"getNoSuffixViewURI",
"(",
"GroovyObject",
"controller",
",",
"String",
"viewName",
")",
"{",
"return",
"getNoSuffixViewURI",
"(",
"getLogicalControllerName",
"(",
"controller",
")",
",",
"viewName",
")",
";",
"}"
] | Obtains a view URI of the given controller and view name without the suffix
@param controller The name of the controller
@param viewName The name of the view
@return The view URI | [
"Obtains",
"a",
"view",
"URI",
"of",
"the",
"given",
"controller",
"and",
"view",
"name",
"without",
"the",
"suffix"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java#L79-L81 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddZ.java | ST_AddZ.addZ | public static Geometry addZ(Geometry geometry, double z) throws SQLException {
if(geometry == null){
return null;
}
geometry.apply(new AddZCoordinateSequenceFilter(z));
return geometry;
} | java | public static Geometry addZ(Geometry geometry, double z) throws SQLException {
if(geometry == null){
return null;
}
geometry.apply(new AddZCoordinateSequenceFilter(z));
return geometry;
} | [
"public",
"static",
"Geometry",
"addZ",
"(",
"Geometry",
"geometry",
",",
"double",
"z",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"geometry",
".",
"apply",
"(",
"new",
"AddZCoordinateSeq... | Add a z with to the existing value (do the sum). NaN values are not
updated.
@param geometry
@param z
@return
@throws java.sql.SQLException | [
"Add",
"a",
"z",
"with",
"to",
"the",
"existing",
"value",
"(",
"do",
"the",
"sum",
")",
".",
"NaN",
"values",
"are",
"not",
"updated",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddZ.java#L58-L64 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebApp.java | WebApp.addMappingFilter | public void addMappingFilter(IServletConfig sConfig, IFilterConfig config) {
IFilterMapping fmapping = new FilterMapping(null, config, sConfig);
_addMapingFilter(config, fmapping);
} | java | public void addMappingFilter(IServletConfig sConfig, IFilterConfig config) {
IFilterMapping fmapping = new FilterMapping(null, config, sConfig);
_addMapingFilter(config, fmapping);
} | [
"public",
"void",
"addMappingFilter",
"(",
"IServletConfig",
"sConfig",
",",
"IFilterConfig",
"config",
")",
"{",
"IFilterMapping",
"fmapping",
"=",
"new",
"FilterMapping",
"(",
"null",
",",
"config",
",",
"sConfig",
")",
";",
"_addMapingFilter",
"(",
"config",
... | Adds a filter against a specified servlet config into this context
@param sConfig
@param config | [
"Adds",
"a",
"filter",
"against",
"a",
"specified",
"servlet",
"config",
"into",
"this",
"context"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebApp.java#L5554-L5557 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/slim/CompareFixture.java | CompareFixture.differenceBetweenExplicitWhitespaceAnd | public String differenceBetweenExplicitWhitespaceAnd(String first, String second) {
Formatter whitespaceFormatter = new Formatter() {
@Override
public String format(String value) {
return explicitWhitespace(value);
}
};
return getDifferencesHtml(first, second, whitespaceFormatter);
} | java | public String differenceBetweenExplicitWhitespaceAnd(String first, String second) {
Formatter whitespaceFormatter = new Formatter() {
@Override
public String format(String value) {
return explicitWhitespace(value);
}
};
return getDifferencesHtml(first, second, whitespaceFormatter);
} | [
"public",
"String",
"differenceBetweenExplicitWhitespaceAnd",
"(",
"String",
"first",
",",
"String",
"second",
")",
"{",
"Formatter",
"whitespaceFormatter",
"=",
"new",
"Formatter",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"format",
"(",
"String",
"valu... | Determines difference between two strings, visualizing various forms of whitespace.
@param first first string to compare.
@param second second string to compare.
@return HTML of difference between the two. | [
"Determines",
"difference",
"between",
"two",
"strings",
"visualizing",
"various",
"forms",
"of",
"whitespace",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/CompareFixture.java#L37-L45 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/parser/PdfContentReaderTool.java | PdfContentReaderTool.getDictionaryDetail | static public String getDictionaryDetail(PdfDictionary dic, int depth){
StringBuffer builder = new StringBuffer();
builder.append('(');
List subDictionaries = new ArrayList();
for (Iterator i = dic.getKeys().iterator(); i.hasNext(); ) {
PdfName key = (PdfName)i.next();
PdfObject val = dic.getDirectObject(key);
if (val.isDictionary())
subDictionaries.add(key);
builder.append(key);
builder.append('=');
builder.append(val);
builder.append(", ");
}
builder.setLength(builder.length()-2);
builder.append(')');
PdfName pdfSubDictionaryName;
for (Iterator it = subDictionaries.iterator(); it.hasNext(); ) {
pdfSubDictionaryName = (PdfName)it.next();
builder.append('\n');
for(int i = 0; i < depth+1; i++){
builder.append('\t');
}
builder.append("Subdictionary ");
builder.append(pdfSubDictionaryName);
builder.append(" = ");
builder.append(getDictionaryDetail(dic.getAsDict(pdfSubDictionaryName), depth+1));
}
return builder.toString();
} | java | static public String getDictionaryDetail(PdfDictionary dic, int depth){
StringBuffer builder = new StringBuffer();
builder.append('(');
List subDictionaries = new ArrayList();
for (Iterator i = dic.getKeys().iterator(); i.hasNext(); ) {
PdfName key = (PdfName)i.next();
PdfObject val = dic.getDirectObject(key);
if (val.isDictionary())
subDictionaries.add(key);
builder.append(key);
builder.append('=');
builder.append(val);
builder.append(", ");
}
builder.setLength(builder.length()-2);
builder.append(')');
PdfName pdfSubDictionaryName;
for (Iterator it = subDictionaries.iterator(); it.hasNext(); ) {
pdfSubDictionaryName = (PdfName)it.next();
builder.append('\n');
for(int i = 0; i < depth+1; i++){
builder.append('\t');
}
builder.append("Subdictionary ");
builder.append(pdfSubDictionaryName);
builder.append(" = ");
builder.append(getDictionaryDetail(dic.getAsDict(pdfSubDictionaryName), depth+1));
}
return builder.toString();
} | [
"static",
"public",
"String",
"getDictionaryDetail",
"(",
"PdfDictionary",
"dic",
",",
"int",
"depth",
")",
"{",
"StringBuffer",
"builder",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"List",
"subDictionaries... | Shows the detail of a dictionary.
@param dic the dictionary of which you want the detail
@param depth the depth of the current dictionary (for nested dictionaries)
@return a String representation of the dictionary | [
"Shows",
"the",
"detail",
"of",
"a",
"dictionary",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/parser/PdfContentReaderTool.java#L87-L116 |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.getInstance | public static synchronized SailthruClient getInstance(String apiKey, String apiSecret, String apiUrl) {
if (_instance == null) {
_instance = new SailthruClient(apiKey, apiSecret, apiUrl);
}
return _instance;
} | java | public static synchronized SailthruClient getInstance(String apiKey, String apiSecret, String apiUrl) {
if (_instance == null) {
_instance = new SailthruClient(apiKey, apiSecret, apiUrl);
}
return _instance;
} | [
"public",
"static",
"synchronized",
"SailthruClient",
"getInstance",
"(",
"String",
"apiKey",
",",
"String",
"apiSecret",
",",
"String",
"apiUrl",
")",
"{",
"if",
"(",
"_instance",
"==",
"null",
")",
"{",
"_instance",
"=",
"new",
"SailthruClient",
"(",
"apiKey... | Synchronized singleton instance method using default URL string
@param apiKey Sailthru API key string
@param apiSecret Sailthru API secret string
@param apiUrl Sailthru API URL
@return singleton instance of SailthruClient
@deprecated | [
"Synchronized",
"singleton",
"instance",
"method",
"using",
"default",
"URL",
"string"
] | train | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L71-L76 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/KunderaMetadataManager.java | KunderaMetadataManager.getEntityMetadata | public static EntityMetadata getEntityMetadata(final KunderaMetadata kunderaMetadata, Class entityClass)
{
if (entityClass == null)
{
throw new KunderaException("Invalid class provided " + entityClass);
}
List<String> persistenceUnits = kunderaMetadata.getApplicationMetadata().getMappedPersistenceUnit(entityClass);
// persistence units will only have more than 1 persistence unit in case
// of RDBMS.
if (persistenceUnits != null)
{
for (String pu : persistenceUnits)
{
MetamodelImpl metamodel = getMetamodel(kunderaMetadata, pu);
EntityMetadata metadata = metamodel.getEntityMetadata(entityClass);
if (metadata != null && metadata.getPersistenceUnit().equals(pu))
{
return metadata;
}
}
}
if (log.isDebugEnabled())
log.warn("No Entity metadata found for the class " + entityClass
+ ". Any CRUD operation on this entity will fail."
+ "If your entity is for RDBMS, make sure you put fully qualified entity class"
+ " name under <class></class> tag in persistence.xml for RDBMS "
+ "persistence unit. Returning null value.");
return null;
// throw new KunderaException("Unable to load entity metadata for :" +
// entityClass);
} | java | public static EntityMetadata getEntityMetadata(final KunderaMetadata kunderaMetadata, Class entityClass)
{
if (entityClass == null)
{
throw new KunderaException("Invalid class provided " + entityClass);
}
List<String> persistenceUnits = kunderaMetadata.getApplicationMetadata().getMappedPersistenceUnit(entityClass);
// persistence units will only have more than 1 persistence unit in case
// of RDBMS.
if (persistenceUnits != null)
{
for (String pu : persistenceUnits)
{
MetamodelImpl metamodel = getMetamodel(kunderaMetadata, pu);
EntityMetadata metadata = metamodel.getEntityMetadata(entityClass);
if (metadata != null && metadata.getPersistenceUnit().equals(pu))
{
return metadata;
}
}
}
if (log.isDebugEnabled())
log.warn("No Entity metadata found for the class " + entityClass
+ ". Any CRUD operation on this entity will fail."
+ "If your entity is for RDBMS, make sure you put fully qualified entity class"
+ " name under <class></class> tag in persistence.xml for RDBMS "
+ "persistence unit. Returning null value.");
return null;
// throw new KunderaException("Unable to load entity metadata for :" +
// entityClass);
} | [
"public",
"static",
"EntityMetadata",
"getEntityMetadata",
"(",
"final",
"KunderaMetadata",
"kunderaMetadata",
",",
"Class",
"entityClass",
")",
"{",
"if",
"(",
"entityClass",
"==",
"null",
")",
"{",
"throw",
"new",
"KunderaException",
"(",
"\"Invalid class provided \... | Finds ands returns Entity metadata for a given array of PUs.
@param entityClass
the entity class
@param persistenceUnits
the persistence units
@return the entity metadata | [
"Finds",
"ands",
"returns",
"Entity",
"metadata",
"for",
"a",
"given",
"array",
"of",
"PUs",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/KunderaMetadataManager.java#L126-L158 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/SetDirtyOnChangeHandler.java | SetDirtyOnChangeHandler.fieldChanged | public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
int result = DBConstants.NORMAL_RETURN;
Record record = m_fldTarget.getRecord();
boolean bSetDirty = true;
if (m_bIfNewRecord) if (record.getEditMode() == Constants.EDIT_ADD)
bSetDirty = true;
if (m_bIfCurrentRecord) if ((record.getEditMode() == Constants.EDIT_CURRENT) || (record.getEditMode() == Constants.EDIT_IN_PROGRESS))
bSetDirty = true;
if (bSetDirty)
{
m_fldTarget.setModified(true);
result = record.handleRecordChange(m_fldTarget, DBConstants.FIELD_CHANGED_TYPE, bDisplayOption); // Tell table that I'm getting changed (if not locked)
}
return result;
} | java | public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
int result = DBConstants.NORMAL_RETURN;
Record record = m_fldTarget.getRecord();
boolean bSetDirty = true;
if (m_bIfNewRecord) if (record.getEditMode() == Constants.EDIT_ADD)
bSetDirty = true;
if (m_bIfCurrentRecord) if ((record.getEditMode() == Constants.EDIT_CURRENT) || (record.getEditMode() == Constants.EDIT_IN_PROGRESS))
bSetDirty = true;
if (bSetDirty)
{
m_fldTarget.setModified(true);
result = record.handleRecordChange(m_fldTarget, DBConstants.FIELD_CHANGED_TYPE, bDisplayOption); // Tell table that I'm getting changed (if not locked)
}
return result;
} | [
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"int",
"result",
"=",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"Record",
"record",
"=",
"m_fldTarget",
".",
"getRecord",
"(",
")",
";",
"boolean",
"bSetDirty... | The Field has Changed.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay). | [
"The",
"Field",
"has",
"Changed",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/SetDirtyOnChangeHandler.java#L93-L108 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/EnumFacingUtils.java | EnumFacingUtils.rotateFacing | public static EnumFacing rotateFacing(EnumFacing facing, int count)
{
if (facing == null)
return null;
while (count-- > 0)
facing = facing.rotateAround(EnumFacing.Axis.Y);
return facing;
} | java | public static EnumFacing rotateFacing(EnumFacing facing, int count)
{
if (facing == null)
return null;
while (count-- > 0)
facing = facing.rotateAround(EnumFacing.Axis.Y);
return facing;
} | [
"public",
"static",
"EnumFacing",
"rotateFacing",
"(",
"EnumFacing",
"facing",
",",
"int",
"count",
")",
"{",
"if",
"(",
"facing",
"==",
"null",
")",
"return",
"null",
";",
"while",
"(",
"count",
"--",
">",
"0",
")",
"facing",
"=",
"facing",
".",
"rota... | Rotates facing {@code count} times.
@param facing the facing
@param count the count
@return the enum facing | [
"Rotates",
"facing",
"{",
"@code",
"count",
"}",
"times",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/EnumFacingUtils.java#L82-L90 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java | FormatUtil.format | public static String format(double[][] m, String pre) {
StringBuilder output = new StringBuilder() //
.append(pre).append("[\n").append(pre);
for(int i = 0; i < m.length; i++) {
formatTo(output.append(" ["), m[i], ", ").append("]\n").append(pre);
}
return output.append("]\n").toString();
} | java | public static String format(double[][] m, String pre) {
StringBuilder output = new StringBuilder() //
.append(pre).append("[\n").append(pre);
for(int i = 0; i < m.length; i++) {
formatTo(output.append(" ["), m[i], ", ").append("]\n").append(pre);
}
return output.append("]\n").toString();
} | [
"public",
"static",
"String",
"format",
"(",
"double",
"[",
"]",
"[",
"]",
"m",
",",
"String",
"pre",
")",
"{",
"StringBuilder",
"output",
"=",
"new",
"StringBuilder",
"(",
")",
"//",
".",
"append",
"(",
"pre",
")",
".",
"append",
"(",
"\"[\\n\"",
")... | Returns a string representation of this matrix. In each line the specified
String <code>pre</code> is prefixed.
@param pre the prefix of each line
@return a string representation of this matrix | [
"Returns",
"a",
"string",
"representation",
"of",
"this",
"matrix",
".",
"In",
"each",
"line",
"the",
"specified",
"String",
"<code",
">",
"pre<",
"/",
"code",
">",
"is",
"prefixed",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java#L677-L684 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java | TmdbPeople.getPersonTaggedImages | public ResultList<ArtworkMedia> getPersonTaggedImages(int personId, Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, personId);
parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.TAGGED_IMAGES).buildUrl(parameters);
WrapperGenericList<ArtworkMedia> wrapper = processWrapper(getTypeReference(ArtworkMedia.class), url, "tagged images");
return wrapper.getResultsList();
} | java | public ResultList<ArtworkMedia> getPersonTaggedImages(int personId, Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, personId);
parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.TAGGED_IMAGES).buildUrl(parameters);
WrapperGenericList<ArtworkMedia> wrapper = processWrapper(getTypeReference(ArtworkMedia.class), url, "tagged images");
return wrapper.getResultsList();
} | [
"public",
"ResultList",
"<",
"ArtworkMedia",
">",
"getPersonTaggedImages",
"(",
"int",
"personId",
",",
"Integer",
"page",
",",
"String",
"language",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";... | Get the images that have been tagged with a specific person id.
We return all of the image results with a media object mapped for each
image.
@param personId
@param page
@param language
@return
@throws com.omertron.themoviedbapi.MovieDbException | [
"Get",
"the",
"images",
"that",
"have",
"been",
"tagged",
"with",
"a",
"specific",
"person",
"id",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java#L245-L254 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.illegalCode | public static void illegalCode(Exception e, String methodName, String className){
throw new IllegalCodeException(MSG.INSTANCE.message(nullPointer,methodName,className,e.getClass().getSimpleName(),""+e.getMessage()));
} | java | public static void illegalCode(Exception e, String methodName, String className){
throw new IllegalCodeException(MSG.INSTANCE.message(nullPointer,methodName,className,e.getClass().getSimpleName(),""+e.getMessage()));
} | [
"public",
"static",
"void",
"illegalCode",
"(",
"Exception",
"e",
",",
"String",
"methodName",
",",
"String",
"className",
")",
"{",
"throw",
"new",
"IllegalCodeException",
"(",
"MSG",
".",
"INSTANCE",
".",
"message",
"(",
"nullPointer",
",",
"methodName",
","... | Thrown when the explicit conversion method defined has a null pointer.<br>
Used in the generated code, in case of dynamic methods defined.
@param e byteCode library exception
@param methodName method name
@param className class name | [
"Thrown",
"when",
"the",
"explicit",
"conversion",
"method",
"defined",
"has",
"a",
"null",
"pointer",
".",
"<br",
">",
"Used",
"in",
"the",
"generated",
"code",
"in",
"case",
"of",
"dynamic",
"methods",
"defined",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L145-L147 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java | StringUtils.replaceAll | public static String replaceAll(final String input, final String regex,
final Function<MatchResult, String> replacementFunction) {
return replaceAll(input, Pattern.compile(regex), replacementFunction);
} | java | public static String replaceAll(final String input, final String regex,
final Function<MatchResult, String> replacementFunction) {
return replaceAll(input, Pattern.compile(regex), replacementFunction);
} | [
"public",
"static",
"String",
"replaceAll",
"(",
"final",
"String",
"input",
",",
"final",
"String",
"regex",
",",
"final",
"Function",
"<",
"MatchResult",
",",
"String",
">",
"replacementFunction",
")",
"{",
"return",
"replaceAll",
"(",
"input",
",",
"Pattern... | Returns a string which is the result of replacing every match of regex in the input string with
the results of applying replacementFunction to the matched string. This is a candidate to be
moved to a more general utility package.
@param replacementFunction May not return null. | [
"Returns",
"a",
"string",
"which",
"is",
"the",
"result",
"of",
"replacing",
"every",
"match",
"of",
"regex",
"in",
"the",
"input",
"string",
"with",
"the",
"results",
"of",
"applying",
"replacementFunction",
"to",
"the",
"matched",
"string",
".",
"This",
"i... | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java#L102-L105 |
line/armeria | core/src/main/java/com/linecorp/armeria/internal/ArmeriaHttpUtil.java | ArmeriaHttpUtil.toArmeria | public static HttpHeaders toArmeria(HttpResponse in) {
final io.netty.handler.codec.http.HttpHeaders inHeaders = in.headers();
final HttpHeaders out = new DefaultHttpHeaders(true, inHeaders.size());
out.status(in.status().code());
// Add the HTTP headers which have not been consumed above
toArmeria(inHeaders, out);
return out;
} | java | public static HttpHeaders toArmeria(HttpResponse in) {
final io.netty.handler.codec.http.HttpHeaders inHeaders = in.headers();
final HttpHeaders out = new DefaultHttpHeaders(true, inHeaders.size());
out.status(in.status().code());
// Add the HTTP headers which have not been consumed above
toArmeria(inHeaders, out);
return out;
} | [
"public",
"static",
"HttpHeaders",
"toArmeria",
"(",
"HttpResponse",
"in",
")",
"{",
"final",
"io",
".",
"netty",
".",
"handler",
".",
"codec",
".",
"http",
".",
"HttpHeaders",
"inHeaders",
"=",
"in",
".",
"headers",
"(",
")",
";",
"final",
"HttpHeaders",
... | Converts the headers of the given Netty HTTP/1.x response into Armeria HTTP/2 headers. | [
"Converts",
"the",
"headers",
"of",
"the",
"given",
"Netty",
"HTTP",
"/",
"1",
".",
"x",
"response",
"into",
"Armeria",
"HTTP",
"/",
"2",
"headers",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/ArmeriaHttpUtil.java#L551-L559 |
johnkil/Android-AppMsg | library/src/com/devspark/appmsg/AppMsg.java | AppMsg.setAnimation | public AppMsg setAnimation(Animation inAnimation, Animation outAnimation) {
mInAnimation = inAnimation;
mOutAnimation = outAnimation;
return this;
} | java | public AppMsg setAnimation(Animation inAnimation, Animation outAnimation) {
mInAnimation = inAnimation;
mOutAnimation = outAnimation;
return this;
} | [
"public",
"AppMsg",
"setAnimation",
"(",
"Animation",
"inAnimation",
",",
"Animation",
"outAnimation",
")",
"{",
"mInAnimation",
"=",
"inAnimation",
";",
"mOutAnimation",
"=",
"outAnimation",
";",
"return",
"this",
";",
"}"
] | Sets the Animations to be used when displaying/removing the Crouton.
@param inAnimation the Animation to be used when displaying.
@param outAnimation the Animation to be used when removing. | [
"Sets",
"the",
"Animations",
"to",
"be",
"used",
"when",
"displaying",
"/",
"removing",
"the",
"Crouton",
"."
] | train | https://github.com/johnkil/Android-AppMsg/blob/e7fdd7870530a24e6d825278ee0863be0521e8b8/library/src/com/devspark/appmsg/AppMsg.java#L612-L616 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.