repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
jtmelton/appsensor | appsensor-core/src/main/java/org/owasp/appsensor/core/util/XmlUtils.java | XmlUtils.getElementQualifiedName | public static String getElementQualifiedName(XMLStreamReader xmlReader, Map<String, String> namespaces) {
String namespaceUri = null;
String localName = null;
switch(xmlReader.getEventType()) {
case XMLStreamConstants.START_ELEMENT:
case XMLStreamConstants.END_ELEMENT:
namespaceUri = xmlReader.getNamespaceURI();
localName = xmlReader.getLocalName();
break;
default:
localName = StringUtils.EMPTY;
break;
}
return namespaces.get(namespaceUri) + ":" + localName;
} | java | public static String getElementQualifiedName(XMLStreamReader xmlReader, Map<String, String> namespaces) {
String namespaceUri = null;
String localName = null;
switch(xmlReader.getEventType()) {
case XMLStreamConstants.START_ELEMENT:
case XMLStreamConstants.END_ELEMENT:
namespaceUri = xmlReader.getNamespaceURI();
localName = xmlReader.getLocalName();
break;
default:
localName = StringUtils.EMPTY;
break;
}
return namespaces.get(namespaceUri) + ":" + localName;
} | [
"public",
"static",
"String",
"getElementQualifiedName",
"(",
"XMLStreamReader",
"xmlReader",
",",
"Map",
"<",
"String",
",",
"String",
">",
"namespaces",
")",
"{",
"String",
"namespaceUri",
"=",
"null",
";",
"String",
"localName",
"=",
"null",
";",
"switch",
... | Helper method for getting qualified name from stax reader given a set of specified schema namespaces
@param xmlReader stax reader
@param namespaces specified schema namespaces
@return qualified element name | [
"Helper",
"method",
"for",
"getting",
"qualified",
"name",
"from",
"stax",
"reader",
"given",
"a",
"set",
"of",
"specified",
"schema",
"namespaces"
] | train | https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/appsensor-core/src/main/java/org/owasp/appsensor/core/util/XmlUtils.java#L97-L113 |
augustd/burp-suite-utils | src/main/java/com/codemagi/burp/parser/HttpRequest.java | HttpRequest.setParameter | public void setParameter(String name, String value) {
sortedParams = null;
parameters.add(new Parameter(name, value));
} | java | public void setParameter(String name, String value) {
sortedParams = null;
parameters.add(new Parameter(name, value));
} | [
"public",
"void",
"setParameter",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"sortedParams",
"=",
"null",
";",
"parameters",
".",
"add",
"(",
"new",
"Parameter",
"(",
"name",
",",
"value",
")",
")",
";",
"}"
] | Sets a parameter value based on its name.
@param name The parameter name to set
@param value The parameter value to set | [
"Sets",
"a",
"parameter",
"value",
"based",
"on",
"its",
"name",
"."
] | train | https://github.com/augustd/burp-suite-utils/blob/5e34a6b9147f5705382f98049dd9e4f387b78629/src/main/java/com/codemagi/burp/parser/HttpRequest.java#L309-L312 |
alkacon/opencms-core | src-setup/org/opencms/setup/CmsSetupDb.java | CmsSetupDb.replaceTokens | private String replaceTokens(String sql, Map<String, String> replacers) {
Iterator<Map.Entry<String, String>> keys = replacers.entrySet().iterator();
while (keys.hasNext()) {
Map.Entry<String, String> entry = keys.next();
String key = entry.getKey();
String value = entry.getValue();
sql = CmsStringUtil.substitute(sql, key, value);
}
return sql;
} | java | private String replaceTokens(String sql, Map<String, String> replacers) {
Iterator<Map.Entry<String, String>> keys = replacers.entrySet().iterator();
while (keys.hasNext()) {
Map.Entry<String, String> entry = keys.next();
String key = entry.getKey();
String value = entry.getValue();
sql = CmsStringUtil.substitute(sql, key, value);
}
return sql;
} | [
"private",
"String",
"replaceTokens",
"(",
"String",
"sql",
",",
"Map",
"<",
"String",
",",
"String",
">",
"replacers",
")",
"{",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"keys",
"=",
"replacers",
".",
"entrySet",
"... | Replaces tokens "${xxx}" in a specified SQL query.<p>
@param sql a SQL query
@param replacers a Map with values keyed by "${xxx}" tokens
@return the SQl query with all "${xxx}" tokens replaced | [
"Replaces",
"tokens",
"$",
"{",
"xxx",
"}",
"in",
"a",
"specified",
"SQL",
"query",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupDb.java#L774-L787 |
tanhaichao/leopard-lang | leopard-servlet/src/main/java/io/leopard/web/servlet/CookieUtil.java | CookieUtil.deleteCookie | public static void deleteCookie(String name, HttpServletRequest request, HttpServletResponse response) {
if (name == null || name.length() == 0) {
throw new IllegalArgumentException("cookie名称不能为空.");
}
CookieUtil.setCookie(name, "", -1, false, request, response);
} | java | public static void deleteCookie(String name, HttpServletRequest request, HttpServletResponse response) {
if (name == null || name.length() == 0) {
throw new IllegalArgumentException("cookie名称不能为空.");
}
CookieUtil.setCookie(name, "", -1, false, request, response);
} | [
"public",
"static",
"void",
"deleteCookie",
"(",
"String",
"name",
",",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",... | 删除cookie</br>
@param name cookie名称
@param request http请求
@param response http响应 | [
"删除cookie<",
"/",
"br",
">"
] | train | https://github.com/tanhaichao/leopard-lang/blob/8ab110f6ca4ea84484817a3d752253ac69ea268b/leopard-servlet/src/main/java/io/leopard/web/servlet/CookieUtil.java#L124-L129 |
janus-project/guava.janusproject.io | guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/FluentIterable.java | FluentIterable.append | @Beta
@CheckReturnValue
public final FluentIterable<E> append(E... elements) {
return from(Iterables.concat(iterable, Arrays.asList(elements)));
} | java | @Beta
@CheckReturnValue
public final FluentIterable<E> append(E... elements) {
return from(Iterables.concat(iterable, Arrays.asList(elements)));
} | [
"@",
"Beta",
"@",
"CheckReturnValue",
"public",
"final",
"FluentIterable",
"<",
"E",
">",
"append",
"(",
"E",
"...",
"elements",
")",
"{",
"return",
"from",
"(",
"Iterables",
".",
"concat",
"(",
"iterable",
",",
"Arrays",
".",
"asList",
"(",
"elements",
... | Returns a fluent iterable whose iterators traverse first the elements of this fluent iterable,
followed by {@code elements}.
@since 18.0 | [
"Returns",
"a",
"fluent",
"iterable",
"whose",
"iterators",
"traverse",
"first",
"the",
"elements",
"of",
"this",
"fluent",
"iterable",
"followed",
"by",
"{",
"@code",
"elements",
"}",
"."
] | train | https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/FluentIterable.java#L186-L190 |
osiam/connector4java | src/main/java/org/osiam/client/OsiamConnector.java | OsiamConnector.updateUser | @Deprecated
public User updateUser(String id, UpdateUser updateUser, AccessToken accessToken) {
return getUserService().updateUser(id, updateUser, accessToken);
} | java | @Deprecated
public User updateUser(String id, UpdateUser updateUser, AccessToken accessToken) {
return getUserService().updateUser(id, updateUser, accessToken);
} | [
"@",
"Deprecated",
"public",
"User",
"updateUser",
"(",
"String",
"id",
",",
"UpdateUser",
"updateUser",
",",
"AccessToken",
"accessToken",
")",
"{",
"return",
"getUserService",
"(",
")",
".",
"updateUser",
"(",
"id",
",",
"updateUser",
",",
"accessToken",
")"... | update the user of the given id with the values given in the User Object. For more detailed information how to
set new field, update Fields or to delete Fields please look in the documentation. This method is not compatible
with OSIAM 3.x.
@param id if of the User to be updated
@param updateUser all Fields that need to be updated
@param accessToken the OSIAM access token from for the current session
@return the updated User Object with all new Fields
@throws UnauthorizedException if the request could not be authorized.
@throws ConflictException if the User could not be updated
@throws NoResultException if no user with the given id can be found
@throws ForbiddenException if the scope doesn't allow this request
@throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized
@throws IllegalStateException if OSIAM's endpoint(s) are not properly configured
@see <a href="https://github.com/osiam/connector4java/docs/working-with-user.md">Working with user</a>
@deprecated Updating with PATCH has been removed in OSIAM 3.0. This method is going to go away with version 1.12 or 2.0. | [
"update",
"the",
"user",
"of",
"the",
"given",
"id",
"with",
"the",
"values",
"given",
"in",
"the",
"User",
"Object",
".",
"For",
"more",
"detailed",
"information",
"how",
"to",
"set",
"new",
"field",
"update",
"Fields",
"or",
"to",
"delete",
"Fields",
"... | train | https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L524-L527 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscCompilationJobStreamsInner.java | DscCompilationJobStreamsInner.listByJob | public JobStreamListResultInner listByJob(String resourceGroupName, String automationAccountName, UUID jobId) {
return listByJobWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).toBlocking().single().body();
} | java | public JobStreamListResultInner listByJob(String resourceGroupName, String automationAccountName, UUID jobId) {
return listByJobWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).toBlocking().single().body();
} | [
"public",
"JobStreamListResultInner",
"listByJob",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"UUID",
"jobId",
")",
"{",
"return",
"listByJobWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
",",
"jobId"... | Retrieve all the job streams for the compilation Job.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param jobId The job id.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the JobStreamListResultInner object if successful. | [
"Retrieve",
"all",
"the",
"job",
"streams",
"for",
"the",
"compilation",
"Job",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscCompilationJobStreamsInner.java#L72-L74 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/Util.java | Util.convertDotNetBytesToUUID | public static UUID convertDotNetBytesToUUID(byte[] dotNetBytes)
{
if(dotNetBytes == null || dotNetBytes.length != GUIDSIZE)
{
return new UUID(0l, 0l);
}
byte[] reOrderedBytes = new byte[GUIDSIZE];
for(int i=0; i<GUIDSIZE; i++)
{
int indexInReorderedBytes;
switch(i)
{
case 0:
indexInReorderedBytes = 3;
break;
case 1:
indexInReorderedBytes = 2;
break;
case 2:
indexInReorderedBytes = 1;
break;
case 3:
indexInReorderedBytes = 0;
break;
case 4:
indexInReorderedBytes = 5;
break;
case 5:
indexInReorderedBytes = 4;
break;
case 6:
indexInReorderedBytes = 7;
break;
case 7:
indexInReorderedBytes = 6;
break;
default:
indexInReorderedBytes = i;
}
reOrderedBytes[indexInReorderedBytes] = dotNetBytes[i];
}
ByteBuffer buffer = ByteBuffer.wrap(reOrderedBytes);
long mostSignificantBits = buffer.getLong();
long leastSignificantBits = buffer.getLong();
return new UUID(mostSignificantBits, leastSignificantBits);
} | java | public static UUID convertDotNetBytesToUUID(byte[] dotNetBytes)
{
if(dotNetBytes == null || dotNetBytes.length != GUIDSIZE)
{
return new UUID(0l, 0l);
}
byte[] reOrderedBytes = new byte[GUIDSIZE];
for(int i=0; i<GUIDSIZE; i++)
{
int indexInReorderedBytes;
switch(i)
{
case 0:
indexInReorderedBytes = 3;
break;
case 1:
indexInReorderedBytes = 2;
break;
case 2:
indexInReorderedBytes = 1;
break;
case 3:
indexInReorderedBytes = 0;
break;
case 4:
indexInReorderedBytes = 5;
break;
case 5:
indexInReorderedBytes = 4;
break;
case 6:
indexInReorderedBytes = 7;
break;
case 7:
indexInReorderedBytes = 6;
break;
default:
indexInReorderedBytes = i;
}
reOrderedBytes[indexInReorderedBytes] = dotNetBytes[i];
}
ByteBuffer buffer = ByteBuffer.wrap(reOrderedBytes);
long mostSignificantBits = buffer.getLong();
long leastSignificantBits = buffer.getLong();
return new UUID(mostSignificantBits, leastSignificantBits);
} | [
"public",
"static",
"UUID",
"convertDotNetBytesToUUID",
"(",
"byte",
"[",
"]",
"dotNetBytes",
")",
"{",
"if",
"(",
"dotNetBytes",
"==",
"null",
"||",
"dotNetBytes",
".",
"length",
"!=",
"GUIDSIZE",
")",
"{",
"return",
"new",
"UUID",
"(",
"0l",
",",
"0l",
... | First 4 bytes are in reverse order, 5th and 6th bytes are in reverse order, 7th and 8th bytes are also in reverse order | [
"First",
"4",
"bytes",
"are",
"in",
"reverse",
"order",
"5th",
"and",
"6th",
"bytes",
"are",
"in",
"reverse",
"order",
"7th",
"and",
"8th",
"bytes",
"are",
"also",
"in",
"reverse",
"order"
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/Util.java#L215-L263 |
i-net-software/jlessc | src/com/inet/lib/less/FunctionExpression.java | FunctionExpression.getColor | private double getColor( Expression exp, CssFormatter formatter ) {
type = exp.getDataType( formatter );
switch( type ) {
case COLOR:
case RGBA:
return exp.doubleValue( formatter );
}
throw new ParameterOutOfBoundsException();
} | java | private double getColor( Expression exp, CssFormatter formatter ) {
type = exp.getDataType( formatter );
switch( type ) {
case COLOR:
case RGBA:
return exp.doubleValue( formatter );
}
throw new ParameterOutOfBoundsException();
} | [
"private",
"double",
"getColor",
"(",
"Expression",
"exp",
",",
"CssFormatter",
"formatter",
")",
"{",
"type",
"=",
"exp",
".",
"getDataType",
"(",
"formatter",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"COLOR",
":",
"case",
"RGBA",
":",
"return... | Get a color value from the expression. And set the type variable.
@param exp
the expression
@param formatter
current formatter
@return the the color value
@throws ParameterOutOfBoundsException if the parameter with the index does not exists | [
"Get",
"a",
"color",
"value",
"from",
"the",
"expression",
".",
"And",
"set",
"the",
"type",
"variable",
"."
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L993-L1001 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/AbstractFormBuilder.java | AbstractFormBuilder.createLabelFor | protected JLabel createLabelFor(String fieldName, JComponent component) {
JLabel label = getComponentFactory().createLabel("");
getFormModel().getFieldFace(fieldName).configure(label);
label.setLabelFor(component);
FormComponentInterceptor interceptor = getFormComponentInterceptor();
if (interceptor != null) {
interceptor.processLabel(fieldName, label);
}
return label;
} | java | protected JLabel createLabelFor(String fieldName, JComponent component) {
JLabel label = getComponentFactory().createLabel("");
getFormModel().getFieldFace(fieldName).configure(label);
label.setLabelFor(component);
FormComponentInterceptor interceptor = getFormComponentInterceptor();
if (interceptor != null) {
interceptor.processLabel(fieldName, label);
}
return label;
} | [
"protected",
"JLabel",
"createLabelFor",
"(",
"String",
"fieldName",
",",
"JComponent",
"component",
")",
"{",
"JLabel",
"label",
"=",
"getComponentFactory",
"(",
")",
".",
"createLabel",
"(",
"\"\"",
")",
";",
"getFormModel",
"(",
")",
".",
"getFieldFace",
"(... | Create a label for the property.
@param fieldName the name of the property.
@param component the component of the property which is related to the
label.
@return a {@link JLabel} for the property. | [
"Create",
"a",
"label",
"for",
"the",
"property",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/AbstractFormBuilder.java#L184-L195 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java | IotHubResourcesInner.exportDevicesAsync | public Observable<JobResponseInner> exportDevicesAsync(String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters) {
return exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters).map(new Func1<ServiceResponse<JobResponseInner>, JobResponseInner>() {
@Override
public JobResponseInner call(ServiceResponse<JobResponseInner> response) {
return response.body();
}
});
} | java | public Observable<JobResponseInner> exportDevicesAsync(String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters) {
return exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters).map(new Func1<ServiceResponse<JobResponseInner>, JobResponseInner>() {
@Override
public JobResponseInner call(ServiceResponse<JobResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"JobResponseInner",
">",
"exportDevicesAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"ExportDevicesRequest",
"exportDevicesParameters",
")",
"{",
"return",
"exportDevicesWithServiceResponseAsync",
"(",
"resourceGr... | Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@param exportDevicesParameters The parameters that specify the export devices operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the JobResponseInner object | [
"Exports",
"all",
"the",
"device",
"identities",
"in",
"the",
"IoT",
"hub",
"identity",
"registry",
"to",
"an",
"Azure",
"Storage",
"blob",
"container",
".",
"For",
"more",
"information",
"see",
":",
"https",
":",
"//",
"docs",
".",
"microsoft",
".",
"com"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L3096-L3103 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/interactions/Actions.java | Actions.clickAndHold | public Actions clickAndHold() {
if (isBuildingActions()) {
action.addAction(new ClickAndHoldAction(jsonMouse, null));
}
return tick(defaultMouse.createPointerDown(LEFT.asArg()));
} | java | public Actions clickAndHold() {
if (isBuildingActions()) {
action.addAction(new ClickAndHoldAction(jsonMouse, null));
}
return tick(defaultMouse.createPointerDown(LEFT.asArg()));
} | [
"public",
"Actions",
"clickAndHold",
"(",
")",
"{",
"if",
"(",
"isBuildingActions",
"(",
")",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"ClickAndHoldAction",
"(",
"jsonMouse",
",",
"null",
")",
")",
";",
"}",
"return",
"tick",
"(",
"defaultMouse",
... | Clicks (without releasing) at the current mouse location.
@return A self reference. | [
"Clicks",
"(",
"without",
"releasing",
")",
"at",
"the",
"current",
"mouse",
"location",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L244-L250 |
bignerdranch/expandable-recycler-view | expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java | ExpandableRecyclerAdapter.expandParentRange | @UiThread
public void expandParentRange(int startParentPosition, int parentCount) {
int endParentPosition = startParentPosition + parentCount;
for (int i = startParentPosition; i < endParentPosition; i++) {
expandParent(i);
}
} | java | @UiThread
public void expandParentRange(int startParentPosition, int parentCount) {
int endParentPosition = startParentPosition + parentCount;
for (int i = startParentPosition; i < endParentPosition; i++) {
expandParent(i);
}
} | [
"@",
"UiThread",
"public",
"void",
"expandParentRange",
"(",
"int",
"startParentPosition",
",",
"int",
"parentCount",
")",
"{",
"int",
"endParentPosition",
"=",
"startParentPosition",
"+",
"parentCount",
";",
"for",
"(",
"int",
"i",
"=",
"startParentPosition",
";"... | Expands all parents in a range of indices in the list of parents.
@param startParentPosition The index at which to to start expanding parents
@param parentCount The number of parents to expand | [
"Expands",
"all",
"parents",
"in",
"a",
"range",
"of",
"indices",
"in",
"the",
"list",
"of",
"parents",
"."
] | train | https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L497-L503 |
auth0/auth0-java | src/main/java/com/auth0/client/mgmt/filter/GrantsFilter.java | GrantsFilter.withPage | public GrantsFilter withPage(int pageNumber, int amountPerPage) {
parameters.put("page", pageNumber);
parameters.put("per_page", amountPerPage);
return this;
} | java | public GrantsFilter withPage(int pageNumber, int amountPerPage) {
parameters.put("page", pageNumber);
parameters.put("per_page", amountPerPage);
return this;
} | [
"public",
"GrantsFilter",
"withPage",
"(",
"int",
"pageNumber",
",",
"int",
"amountPerPage",
")",
"{",
"parameters",
".",
"put",
"(",
"\"page\"",
",",
"pageNumber",
")",
";",
"parameters",
".",
"put",
"(",
"\"per_page\"",
",",
"amountPerPage",
")",
";",
"ret... | Filter by page
@param pageNumber the page number to retrieve.
@param amountPerPage the amount of items per page to retrieve.
@return this filter instance | [
"Filter",
"by",
"page"
] | train | https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/mgmt/filter/GrantsFilter.java#L37-L41 |
alkacon/opencms-core | src/org/opencms/util/CmsStringUtil.java | CmsStringUtil.substituteContextPath | public static String substituteContextPath(String htmlContent, String context) {
if (m_contextSearch == null) {
m_contextSearch = "([^\\w/])" + context;
m_contextReplace = "$1" + CmsStringUtil.escapePattern(CmsStringUtil.MACRO_OPENCMS_CONTEXT) + "/";
}
return substitutePerl(htmlContent, m_contextSearch, m_contextReplace, "g");
} | java | public static String substituteContextPath(String htmlContent, String context) {
if (m_contextSearch == null) {
m_contextSearch = "([^\\w/])" + context;
m_contextReplace = "$1" + CmsStringUtil.escapePattern(CmsStringUtil.MACRO_OPENCMS_CONTEXT) + "/";
}
return substitutePerl(htmlContent, m_contextSearch, m_contextReplace, "g");
} | [
"public",
"static",
"String",
"substituteContextPath",
"(",
"String",
"htmlContent",
",",
"String",
"context",
")",
"{",
"if",
"(",
"m_contextSearch",
"==",
"null",
")",
"{",
"m_contextSearch",
"=",
"\"([^\\\\w/])\"",
"+",
"context",
";",
"m_contextReplace",
"=",
... | Substitutes the OpenCms context path (e.g. /opencms/opencms/) in a HTML page with a
special variable so that the content also runs if the context path of the server changes.<p>
@param htmlContent the HTML to replace the context path in
@param context the context path of the server
@return the HTML with the replaced context path | [
"Substitutes",
"the",
"OpenCms",
"context",
"path",
"(",
"e",
".",
"g",
".",
"/",
"opencms",
"/",
"opencms",
"/",
")",
"in",
"a",
"HTML",
"page",
"with",
"a",
"special",
"variable",
"so",
"that",
"the",
"content",
"also",
"runs",
"if",
"the",
"context"... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L1731-L1738 |
ykrasik/jaci | jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java | ReflectionUtils.getNoArgsMethod | public static ReflectionMethod getNoArgsMethod(Class<?> clazz, String methodName) {
assertReflectionAccessor();
try {
// TODO: Support inheritance?
return accessor.getDeclaredMethod(clazz, methodName, NO_ARGS_TYPE);
} catch (Exception e) {
throw SneakyException.sneakyThrow(e);
}
} | java | public static ReflectionMethod getNoArgsMethod(Class<?> clazz, String methodName) {
assertReflectionAccessor();
try {
// TODO: Support inheritance?
return accessor.getDeclaredMethod(clazz, methodName, NO_ARGS_TYPE);
} catch (Exception e) {
throw SneakyException.sneakyThrow(e);
}
} | [
"public",
"static",
"ReflectionMethod",
"getNoArgsMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
")",
"{",
"assertReflectionAccessor",
"(",
")",
";",
"try",
"{",
"// TODO: Support inheritance?",
"return",
"accessor",
".",
"getDeclaredMet... | Returns a method with the provided name that takes no-args.
@param clazz Class to search.
@param methodName Method name.
@return A method with the provided name that takes no-args.
@throws RuntimeException If the class doesn't contain a no-args method with the given name. | [
"Returns",
"a",
"method",
"with",
"the",
"provided",
"name",
"that",
"takes",
"no",
"-",
"args",
"."
] | train | https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java#L108-L116 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.serviceName_database_name_statistics_GET | public ArrayList<OvhChartSerie<OvhChartTimestampValue>> serviceName_database_name_statistics_GET(String serviceName, String name, OvhStatisticsPeriodEnum period, net.minidev.ovh.api.hosting.web.database.OvhStatisticsTypeEnum type) throws IOException {
String qPath = "/hosting/web/{serviceName}/database/{name}/statistics";
StringBuilder sb = path(qPath, serviceName, name);
query(sb, "period", period);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t6);
} | java | public ArrayList<OvhChartSerie<OvhChartTimestampValue>> serviceName_database_name_statistics_GET(String serviceName, String name, OvhStatisticsPeriodEnum period, net.minidev.ovh.api.hosting.web.database.OvhStatisticsTypeEnum type) throws IOException {
String qPath = "/hosting/web/{serviceName}/database/{name}/statistics";
StringBuilder sb = path(qPath, serviceName, name);
query(sb, "period", period);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t6);
} | [
"public",
"ArrayList",
"<",
"OvhChartSerie",
"<",
"OvhChartTimestampValue",
">",
">",
"serviceName_database_name_statistics_GET",
"(",
"String",
"serviceName",
",",
"String",
"name",
",",
"OvhStatisticsPeriodEnum",
"period",
",",
"net",
".",
"minidev",
".",
"ovh",
"."... | Get statistics about this database
REST: GET /hosting/web/{serviceName}/database/{name}/statistics
@param type [required] Types of statistics available for the database
@param period [required] Available periods for statistics
@param serviceName [required] The internal name of your hosting
@param name [required] Database name (like mydb.mysql.db or mydb.postgres.db) | [
"Get",
"statistics",
"about",
"this",
"database"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1312-L1319 |
auth0/Auth0.Android | auth0/src/main/java/com/auth0/android/authentication/ParameterBuilder.java | ParameterBuilder.addAll | public ParameterBuilder addAll(Map<String, Object> parameters) {
if (parameters != null) {
for (String k : parameters.keySet()) {
if (parameters.get(k) != null) {
this.parameters.put(k, parameters.get(k));
}
}
}
return this;
} | java | public ParameterBuilder addAll(Map<String, Object> parameters) {
if (parameters != null) {
for (String k : parameters.keySet()) {
if (parameters.get(k) != null) {
this.parameters.put(k, parameters.get(k));
}
}
}
return this;
} | [
"public",
"ParameterBuilder",
"addAll",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
")",
"{",
"if",
"(",
"parameters",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"k",
":",
"parameters",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"("... | Adds all parameter from a map
@param parameters map with parameters to add. Null values will be skipped.
@return itself | [
"Adds",
"all",
"parameter",
"from",
"a",
"map"
] | train | https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/ParameterBuilder.java#L202-L211 |
bozaro/git-lfs-java | gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java | Client.postMeta | @Nullable
public ObjectRes postMeta(@NotNull final Meta meta) throws IOException {
return doWork(auth -> doRequest(auth, new MetaPost(meta), AuthHelper.join(auth.getHref(), PATH_OBJECTS)), Operation.Upload);
} | java | @Nullable
public ObjectRes postMeta(@NotNull final Meta meta) throws IOException {
return doWork(auth -> doRequest(auth, new MetaPost(meta), AuthHelper.join(auth.getHref(), PATH_OBJECTS)), Operation.Upload);
} | [
"@",
"Nullable",
"public",
"ObjectRes",
"postMeta",
"(",
"@",
"NotNull",
"final",
"Meta",
"meta",
")",
"throws",
"IOException",
"{",
"return",
"doWork",
"(",
"auth",
"->",
"doRequest",
"(",
"auth",
",",
"new",
"MetaPost",
"(",
"meta",
")",
",",
"AuthHelper... | Get metadata for object by hash.
@param meta Object meta.
@return Object metadata or null, if object not found.
@throws IOException | [
"Get",
"metadata",
"for",
"object",
"by",
"hash",
"."
] | train | https://github.com/bozaro/git-lfs-java/blob/ee05bf0472ee61bf362cf93d283e5ee5d44ef685/gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java#L104-L107 |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java | GraphPath.removeUntil | public boolean removeUntil(ST obj, PT pt) {
return removeUntil(indexOf(obj, pt), true);
} | java | public boolean removeUntil(ST obj, PT pt) {
return removeUntil(indexOf(obj, pt), true);
} | [
"public",
"boolean",
"removeUntil",
"(",
"ST",
"obj",
",",
"PT",
"pt",
")",
"{",
"return",
"removeUntil",
"(",
"indexOf",
"(",
"obj",
",",
"pt",
")",
",",
"true",
")",
";",
"}"
] | Remove the path's elements before the
specified one which is starting
at the specified point. The specified element will
be removed.
<p>This function removes until the <i>first occurence</i>
of the given object.
@param obj is the segment to remove
@param pt is the point on which the segment was connected
as its first point.
@return <code>true</code> on success, otherwise <code>false</code> | [
"Remove",
"the",
"path",
"s",
"elements",
"before",
"the",
"specified",
"one",
"which",
"is",
"starting",
"at",
"the",
"specified",
"point",
".",
"The",
"specified",
"element",
"will",
"be",
"removed",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L611-L613 |
Scout24/appmon4j | core/src/main/java/de/is24/util/monitoring/InApplicationMonitor.java | InApplicationMonitor.incrementCounter | public void incrementCounter(String name, int increment) {
if (monitorActive) {
String escapedName = keyHandler.handle(name);
for (MonitorPlugin p : getPlugins()) {
p.incrementCounter(escapedName, increment);
}
}
} | java | public void incrementCounter(String name, int increment) {
if (monitorActive) {
String escapedName = keyHandler.handle(name);
for (MonitorPlugin p : getPlugins()) {
p.incrementCounter(escapedName, increment);
}
}
} | [
"public",
"void",
"incrementCounter",
"(",
"String",
"name",
",",
"int",
"increment",
")",
"{",
"if",
"(",
"monitorActive",
")",
"{",
"String",
"escapedName",
"=",
"keyHandler",
".",
"handle",
"(",
"name",
")",
";",
"for",
"(",
"MonitorPlugin",
"p",
":",
... | <p>Increase the specified counter by a variable amount.</p>
@param name
the name of the {@code Counter} to increase
@param increment
the added to add | [
"<p",
">",
"Increase",
"the",
"specified",
"counter",
"by",
"a",
"variable",
"amount",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/Scout24/appmon4j/blob/a662e5123805ea455cfd01e1b9ae5d808f83529c/core/src/main/java/de/is24/util/monitoring/InApplicationMonitor.java#L197-L204 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/config/RegistryConfig.java | RegistryConfig.setParameters | public RegistryConfig setParameters(Map<String, String> parameters) {
if (this.parameters == null) {
this.parameters = new ConcurrentHashMap<String, String>();
this.parameters.putAll(parameters);
}
return this;
} | java | public RegistryConfig setParameters(Map<String, String> parameters) {
if (this.parameters == null) {
this.parameters = new ConcurrentHashMap<String, String>();
this.parameters.putAll(parameters);
}
return this;
} | [
"public",
"RegistryConfig",
"setParameters",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"if",
"(",
"this",
".",
"parameters",
"==",
"null",
")",
"{",
"this",
".",
"parameters",
"=",
"new",
"ConcurrentHashMap",
"<",
"String",
","... | Sets parameters.
@param parameters the parameters
@return the RegistryConfig | [
"Sets",
"parameters",
"."
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/config/RegistryConfig.java#L368-L374 |
neo4j/neo4j-java-driver | driver/src/main/java/org/neo4j/driver/internal/summary/InternalResultSummary.java | InternalResultSummary.resolvePlan | private static Plan resolvePlan( Plan plan, ProfiledPlan profiledPlan )
{
return plan == null ? profiledPlan : plan;
} | java | private static Plan resolvePlan( Plan plan, ProfiledPlan profiledPlan )
{
return plan == null ? profiledPlan : plan;
} | [
"private",
"static",
"Plan",
"resolvePlan",
"(",
"Plan",
"plan",
",",
"ProfiledPlan",
"profiledPlan",
")",
"{",
"return",
"plan",
"==",
"null",
"?",
"profiledPlan",
":",
"plan",
";",
"}"
] | Profiled plan is a superset of plan. This method returns profiled plan if plan is {@code null}.
@param plan the given plan, possibly {@code null}.
@param profiledPlan the given profiled plan, possibly {@code null}.
@return available plan. | [
"Profiled",
"plan",
"is",
"a",
"superset",
"of",
"plan",
".",
"This",
"method",
"returns",
"profiled",
"plan",
"if",
"plan",
"is",
"{",
"@code",
"null",
"}",
"."
] | train | https://github.com/neo4j/neo4j-java-driver/blob/8dad6c48251fa1ab7017e72d9998a24fa2337a22/driver/src/main/java/org/neo4j/driver/internal/summary/InternalResultSummary.java#L183-L186 |
nominanuda/zen-project | zen-dataobject/src/main/java/com/nominanuda/dataobject/DataStructHelper.java | DataStructHelper.sort | @SuppressWarnings("unchecked")
public <T> void sort(Arr arr, Comparator<T> c) {
int l = arr.getLength();
Object[] objs = new Object[l];
for (int i=0; i<l; i++) {
objs[i] = arr.get(i);
}
Arrays.sort((T[])objs, c);
for (int i=0; i<l; i++) {
arr.put(i, objs[i]);
}
} | java | @SuppressWarnings("unchecked")
public <T> void sort(Arr arr, Comparator<T> c) {
int l = arr.getLength();
Object[] objs = new Object[l];
for (int i=0; i<l; i++) {
objs[i] = arr.get(i);
}
Arrays.sort((T[])objs, c);
for (int i=0; i<l; i++) {
arr.put(i, objs[i]);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"void",
"sort",
"(",
"Arr",
"arr",
",",
"Comparator",
"<",
"T",
">",
"c",
")",
"{",
"int",
"l",
"=",
"arr",
".",
"getLength",
"(",
")",
";",
"Object",
"[",
"]",
"objs",
... | can lead to classcastexception if comparator is not of the right type | [
"can",
"lead",
"to",
"classcastexception",
"if",
"comparator",
"is",
"not",
"of",
"the",
"right",
"type"
] | train | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-dataobject/src/main/java/com/nominanuda/dataobject/DataStructHelper.java#L859-L870 |
mpetazzoni/ttorrent | common/src/main/java/com/turn/ttorrent/common/protocol/http/HTTPAnnounceResponseMessage.java | HTTPAnnounceResponseMessage.toPeerList | private static List<Peer> toPeerList(byte[] data)
throws InvalidBEncodingException, UnknownHostException {
if (data.length % 6 != 0) {
throw new InvalidBEncodingException("Invalid peers " +
"binary information string!");
}
List<Peer> result = new LinkedList<Peer>();
ByteBuffer peers = ByteBuffer.wrap(data);
for (int i = 0; i < data.length / 6; i++) {
byte[] ipBytes = new byte[4];
peers.get(ipBytes);
InetAddress ip = InetAddress.getByAddress(ipBytes);
int port =
(0xFF & (int) peers.get()) << 8 |
(0xFF & (int) peers.get());
result.add(new Peer(new InetSocketAddress(ip, port)));
}
return result;
} | java | private static List<Peer> toPeerList(byte[] data)
throws InvalidBEncodingException, UnknownHostException {
if (data.length % 6 != 0) {
throw new InvalidBEncodingException("Invalid peers " +
"binary information string!");
}
List<Peer> result = new LinkedList<Peer>();
ByteBuffer peers = ByteBuffer.wrap(data);
for (int i = 0; i < data.length / 6; i++) {
byte[] ipBytes = new byte[4];
peers.get(ipBytes);
InetAddress ip = InetAddress.getByAddress(ipBytes);
int port =
(0xFF & (int) peers.get()) << 8 |
(0xFF & (int) peers.get());
result.add(new Peer(new InetSocketAddress(ip, port)));
}
return result;
} | [
"private",
"static",
"List",
"<",
"Peer",
">",
"toPeerList",
"(",
"byte",
"[",
"]",
"data",
")",
"throws",
"InvalidBEncodingException",
",",
"UnknownHostException",
"{",
"if",
"(",
"data",
".",
"length",
"%",
"6",
"!=",
"0",
")",
"{",
"throw",
"new",
"In... | Build a peer list as a list of {@link Peer}s from the
announce response's binary compact peer list.
@param data The bytes representing the compact peer list from the
announce response.
@return A {@link List} of {@link Peer}s representing the
peers' addresses. Peer IDs are lost, but they are not crucial. | [
"Build",
"a",
"peer",
"list",
"as",
"a",
"list",
"of",
"{",
"@link",
"Peer",
"}",
"s",
"from",
"the",
"announce",
"response",
"s",
"binary",
"compact",
"peer",
"list",
"."
] | train | https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/common/src/main/java/com/turn/ttorrent/common/protocol/http/HTTPAnnounceResponseMessage.java#L167-L188 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/SchemasInner.java | SchemasInner.createOrUpdate | public IntegrationAccountSchemaInner createOrUpdate(String resourceGroupName, String integrationAccountName, String schemaName, IntegrationAccountSchemaInner schema) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, schemaName, schema).toBlocking().single().body();
} | java | public IntegrationAccountSchemaInner createOrUpdate(String resourceGroupName, String integrationAccountName, String schemaName, IntegrationAccountSchemaInner schema) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, schemaName, schema).toBlocking().single().body();
} | [
"public",
"IntegrationAccountSchemaInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
",",
"String",
"schemaName",
",",
"IntegrationAccountSchemaInner",
"schema",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"... | Creates or updates an integration account schema.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param schemaName The integration account schema name.
@param schema The integration account schema.
@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 IntegrationAccountSchemaInner object if successful. | [
"Creates",
"or",
"updates",
"an",
"integration",
"account",
"schema",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/SchemasInner.java#L448-L450 |
lucee/Lucee | core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java | XMLConfigWebFactory.loadExtensionBundles | private static void loadExtensionBundles(ConfigServerImpl cs, ConfigImpl config, Document doc, Log log) {
try {
Element parent = getChildByName(doc.getDocumentElement(), "extensions");
Element[] children = getChildren(parent, "rhextension");
String strBundles;
List<RHExtension> extensions = new ArrayList<RHExtension>();
RHExtension rhe;
for (Element child: children) {
BundleInfo[] bfsq;
try {
rhe = new RHExtension(config, child);
if (rhe.getStartBundles()) rhe.deployBundles(config);
extensions.add(rhe);
}
catch (Exception e) {
log.error("load-extension", e);
continue;
}
}
config.setExtensions(extensions.toArray(new RHExtension[extensions.size()]));
}
catch (Exception e) {
log(config, log, e);
}
} | java | private static void loadExtensionBundles(ConfigServerImpl cs, ConfigImpl config, Document doc, Log log) {
try {
Element parent = getChildByName(doc.getDocumentElement(), "extensions");
Element[] children = getChildren(parent, "rhextension");
String strBundles;
List<RHExtension> extensions = new ArrayList<RHExtension>();
RHExtension rhe;
for (Element child: children) {
BundleInfo[] bfsq;
try {
rhe = new RHExtension(config, child);
if (rhe.getStartBundles()) rhe.deployBundles(config);
extensions.add(rhe);
}
catch (Exception e) {
log.error("load-extension", e);
continue;
}
}
config.setExtensions(extensions.toArray(new RHExtension[extensions.size()]));
}
catch (Exception e) {
log(config, log, e);
}
} | [
"private",
"static",
"void",
"loadExtensionBundles",
"(",
"ConfigServerImpl",
"cs",
",",
"ConfigImpl",
"config",
",",
"Document",
"doc",
",",
"Log",
"log",
")",
"{",
"try",
"{",
"Element",
"parent",
"=",
"getChildByName",
"(",
"doc",
".",
"getDocumentElement",
... | loads the bundles defined in the extensions
@param cs
@param config
@param doc
@param log | [
"loads",
"the",
"bundles",
"defined",
"in",
"the",
"extensions"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java#L4229-L4255 |
sockeqwe/AdapterDelegates | library/src/main/java/com/hannesdorfmann/adapterdelegates4/AdapterDelegatesManager.java | AdapterDelegatesManager.addDelegate | public AdapterDelegatesManager<T> addDelegate(int viewType,
@NonNull AdapterDelegate<T> delegate) {
return addDelegate(viewType, false, delegate);
} | java | public AdapterDelegatesManager<T> addDelegate(int viewType,
@NonNull AdapterDelegate<T> delegate) {
return addDelegate(viewType, false, delegate);
} | [
"public",
"AdapterDelegatesManager",
"<",
"T",
">",
"addDelegate",
"(",
"int",
"viewType",
",",
"@",
"NonNull",
"AdapterDelegate",
"<",
"T",
">",
"delegate",
")",
"{",
"return",
"addDelegate",
"(",
"viewType",
",",
"false",
",",
"delegate",
")",
";",
"}"
] | Adds an {@link AdapterDelegate} with the specified view type.
<p>
Internally calls {@link #addDelegate(int, boolean, AdapterDelegate)} with
allowReplacingDelegate = false as parameter.
@param viewType the view type integer if you want to assign manually the view type. Otherwise
use {@link #addDelegate(AdapterDelegate)} where a viewtype will be assigned automatically.
@param delegate the delegate to add
@return self
@throws NullPointerException if passed delegate is null
@see #addDelegate(AdapterDelegate)
@see #addDelegate(int, boolean, AdapterDelegate) | [
"Adds",
"an",
"{",
"@link",
"AdapterDelegate",
"}",
"with",
"the",
"specified",
"view",
"type",
".",
"<p",
">",
"Internally",
"calls",
"{",
"@link",
"#addDelegate",
"(",
"int",
"boolean",
"AdapterDelegate",
")",
"}",
"with",
"allowReplacingDelegate",
"=",
"fal... | train | https://github.com/sockeqwe/AdapterDelegates/blob/d18dc609415e5d17a3354bddf4bae62440e017af/library/src/main/java/com/hannesdorfmann/adapterdelegates4/AdapterDelegatesManager.java#L119-L122 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/Endpoint.java | Endpoint.withIpAddr | public Endpoint withIpAddr(@Nullable String ipAddr) {
ensureSingle();
if (ipAddr == null) {
return withoutIpAddr();
}
if (NetUtil.isValidIpV4Address(ipAddr)) {
return withIpAddr(ipAddr, StandardProtocolFamily.INET);
}
if (NetUtil.isValidIpV6Address(ipAddr)) {
if (ipAddr.charAt(0) == '[') {
ipAddr = ipAddr.substring(1, ipAddr.length() - 1);
}
return withIpAddr(ipAddr, StandardProtocolFamily.INET6);
}
throw new IllegalArgumentException("ipAddr: " + ipAddr + " (expected: an IP address)");
} | java | public Endpoint withIpAddr(@Nullable String ipAddr) {
ensureSingle();
if (ipAddr == null) {
return withoutIpAddr();
}
if (NetUtil.isValidIpV4Address(ipAddr)) {
return withIpAddr(ipAddr, StandardProtocolFamily.INET);
}
if (NetUtil.isValidIpV6Address(ipAddr)) {
if (ipAddr.charAt(0) == '[') {
ipAddr = ipAddr.substring(1, ipAddr.length() - 1);
}
return withIpAddr(ipAddr, StandardProtocolFamily.INET6);
}
throw new IllegalArgumentException("ipAddr: " + ipAddr + " (expected: an IP address)");
} | [
"public",
"Endpoint",
"withIpAddr",
"(",
"@",
"Nullable",
"String",
"ipAddr",
")",
"{",
"ensureSingle",
"(",
")",
";",
"if",
"(",
"ipAddr",
"==",
"null",
")",
"{",
"return",
"withoutIpAddr",
"(",
")",
";",
"}",
"if",
"(",
"NetUtil",
".",
"isValidIpV4Addr... | Returns a new host endpoint with the specified IP address.
@return the new endpoint with the specified IP address.
{@code this} if this endpoint has the same IP address.
@throws IllegalStateException if this endpoint is not a host but a group | [
"Returns",
"a",
"new",
"host",
"endpoint",
"with",
"the",
"specified",
"IP",
"address",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/Endpoint.java#L336-L354 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/matrix/AtomicGrowingSparseHashMatrix.java | AtomicGrowingSparseHashMatrix.checkIndices | private void checkIndices(int row, int col, boolean expand) {
if (row < 0 || col < 0) {
throw new ArrayIndexOutOfBoundsException();
}
if (expand) {
int r = row + 1;
int cur = 0;
while (r > (cur = rows.get()) && !rows.compareAndSet(cur, r))
;
int c = col + 1;
cur = 0;
while (c > (cur = cols.get()) && !cols.compareAndSet(cur, c))
;
}
} | java | private void checkIndices(int row, int col, boolean expand) {
if (row < 0 || col < 0) {
throw new ArrayIndexOutOfBoundsException();
}
if (expand) {
int r = row + 1;
int cur = 0;
while (r > (cur = rows.get()) && !rows.compareAndSet(cur, r))
;
int c = col + 1;
cur = 0;
while (c > (cur = cols.get()) && !cols.compareAndSet(cur, c))
;
}
} | [
"private",
"void",
"checkIndices",
"(",
"int",
"row",
",",
"int",
"col",
",",
"boolean",
"expand",
")",
"{",
"if",
"(",
"row",
"<",
"0",
"||",
"col",
"<",
"0",
")",
"{",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
")",
";",
"}",
"if",
"(",... | Verify that the given row and column value is non-negative, and
optionally expand the size of the matrix if the row or column are outside
the current bounds.
@param row the row index to check.
@param the the column index to check.
@param expand {@code true} if the current dimensions of the matrix should
be updated if either parameter exceeds the current values | [
"Verify",
"that",
"the",
"given",
"row",
"and",
"column",
"value",
"is",
"non",
"-",
"negative",
"and",
"optionally",
"expand",
"the",
"size",
"of",
"the",
"matrix",
"if",
"the",
"row",
"or",
"column",
"are",
"outside",
"the",
"current",
"bounds",
"."
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/AtomicGrowingSparseHashMatrix.java#L191-L205 |
Jasig/uPortal | uPortal-io/uPortal-io-core/src/main/java/org/apereo/portal/io/xml/JaxbPortalDataHandlerService.java | JaxbPortalDataHandlerService.importDataArchive | private void importDataArchive(
final Resource resource,
final ArchiveInputStream resourceStream,
BatchImportOptions options) {
final File tempDir = Files.createTempDir();
try {
ArchiveEntry archiveEntry;
while ((archiveEntry = resourceStream.getNextEntry()) != null) {
final File entryFile = new File(tempDir, archiveEntry.getName());
if (!archiveEntry.isDirectory()) {
entryFile.getParentFile().mkdirs();
IOUtils.copy(
new CloseShieldInputStream(resourceStream),
new FileOutputStream(entryFile));
}
}
importDataDirectory(tempDir, null, options);
} catch (IOException e) {
throw new RuntimeException(
"Failed to extract data from '"
+ resource
+ "' to '"
+ tempDir
+ "' for batch import.",
e);
} finally {
FileUtils.deleteQuietly(tempDir);
}
} | java | private void importDataArchive(
final Resource resource,
final ArchiveInputStream resourceStream,
BatchImportOptions options) {
final File tempDir = Files.createTempDir();
try {
ArchiveEntry archiveEntry;
while ((archiveEntry = resourceStream.getNextEntry()) != null) {
final File entryFile = new File(tempDir, archiveEntry.getName());
if (!archiveEntry.isDirectory()) {
entryFile.getParentFile().mkdirs();
IOUtils.copy(
new CloseShieldInputStream(resourceStream),
new FileOutputStream(entryFile));
}
}
importDataDirectory(tempDir, null, options);
} catch (IOException e) {
throw new RuntimeException(
"Failed to extract data from '"
+ resource
+ "' to '"
+ tempDir
+ "' for batch import.",
e);
} finally {
FileUtils.deleteQuietly(tempDir);
}
} | [
"private",
"void",
"importDataArchive",
"(",
"final",
"Resource",
"resource",
",",
"final",
"ArchiveInputStream",
"resourceStream",
",",
"BatchImportOptions",
"options",
")",
"{",
"final",
"File",
"tempDir",
"=",
"Files",
".",
"createTempDir",
"(",
")",
";",
"try"... | Extracts the archive resource and then runs the batch-import process on it. | [
"Extracts",
"the",
"archive",
"resource",
"and",
"then",
"runs",
"the",
"batch",
"-",
"import",
"process",
"on",
"it",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-io/uPortal-io-core/src/main/java/org/apereo/portal/io/xml/JaxbPortalDataHandlerService.java#L490-L520 |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/git/GitService.java | GitService.initializeConfigDirectory | public static GitService initializeConfigDirectory(String uri, String branch, String root, String warName, HistoryManager historyManager, ConfigManager configManager) throws Exception {
initializeBaseDirectoryStructure(root, warName);
String warDir = FileSystemManager.getChildDirectoryIfExists(root, warName);
Properties configProperties = configManager.getDefaultProperties();
GitLocation gitLocation = new GitLocation(uri, branch, configProperties.getProperty("config.git.ref.sha"));
GitService cloned = initializeRepo(gitLocation, warDir, "git-config-checkout");
try {
String renderedContentDir = initializeSnapshotDirectory(warDir,
configProperties, "com.meltmedia.cadmium.config.lastUpdated", "git-config-checkout", "config");
boolean hasExisting = configProperties.containsKey("com.meltmedia.cadmium.config.lastUpdated") && renderedContentDir != null && renderedContentDir.equals(configProperties.getProperty("com.meltmedia.cadmium.config.lastUpdated"));
if(renderedContentDir != null) {
configProperties.setProperty("com.meltmedia.cadmium.config.lastUpdated", renderedContentDir);
}
configProperties.setProperty("config.branch", cloned.getBranchName());
configProperties.setProperty("config.git.ref.sha", cloned.getCurrentRevision());
configProperties.setProperty("config.repo", cloned.getRemoteRepository());
configManager.persistDefaultProperties();
ExecutorService pool = null;
if(historyManager == null) {
pool = Executors.newSingleThreadExecutor();
historyManager = new HistoryManager(warDir, pool);
}
try{
if(historyManager != null && !hasExisting) {
historyManager.logEvent(EntryType.CONFIG,
// NOTE: We should integrate the git pointer into this class.
new GitLocation(cloned.getRemoteRepository(), cloned.getBranchName(), cloned.getCurrentRevision()),
"AUTO",
renderedContentDir,
"", "Initial config pull.",
true,
true);
}
} finally {
if(pool != null) {
pool.shutdownNow();
}
}
return cloned;
} catch (Throwable e){
cloned.close();
throw new Exception(e);
}
} | java | public static GitService initializeConfigDirectory(String uri, String branch, String root, String warName, HistoryManager historyManager, ConfigManager configManager) throws Exception {
initializeBaseDirectoryStructure(root, warName);
String warDir = FileSystemManager.getChildDirectoryIfExists(root, warName);
Properties configProperties = configManager.getDefaultProperties();
GitLocation gitLocation = new GitLocation(uri, branch, configProperties.getProperty("config.git.ref.sha"));
GitService cloned = initializeRepo(gitLocation, warDir, "git-config-checkout");
try {
String renderedContentDir = initializeSnapshotDirectory(warDir,
configProperties, "com.meltmedia.cadmium.config.lastUpdated", "git-config-checkout", "config");
boolean hasExisting = configProperties.containsKey("com.meltmedia.cadmium.config.lastUpdated") && renderedContentDir != null && renderedContentDir.equals(configProperties.getProperty("com.meltmedia.cadmium.config.lastUpdated"));
if(renderedContentDir != null) {
configProperties.setProperty("com.meltmedia.cadmium.config.lastUpdated", renderedContentDir);
}
configProperties.setProperty("config.branch", cloned.getBranchName());
configProperties.setProperty("config.git.ref.sha", cloned.getCurrentRevision());
configProperties.setProperty("config.repo", cloned.getRemoteRepository());
configManager.persistDefaultProperties();
ExecutorService pool = null;
if(historyManager == null) {
pool = Executors.newSingleThreadExecutor();
historyManager = new HistoryManager(warDir, pool);
}
try{
if(historyManager != null && !hasExisting) {
historyManager.logEvent(EntryType.CONFIG,
// NOTE: We should integrate the git pointer into this class.
new GitLocation(cloned.getRemoteRepository(), cloned.getBranchName(), cloned.getCurrentRevision()),
"AUTO",
renderedContentDir,
"", "Initial config pull.",
true,
true);
}
} finally {
if(pool != null) {
pool.shutdownNow();
}
}
return cloned;
} catch (Throwable e){
cloned.close();
throw new Exception(e);
}
} | [
"public",
"static",
"GitService",
"initializeConfigDirectory",
"(",
"String",
"uri",
",",
"String",
"branch",
",",
"String",
"root",
",",
"String",
"warName",
",",
"HistoryManager",
"historyManager",
",",
"ConfigManager",
"configManager",
")",
"throws",
"Exception",
... | Initializes war configuration directory for a Cadmium war.
@param uri The remote Git repository ssh URI.
@param branch The remote branch to checkout.
@param root The shared root.
@param warName The name of the war file.
@param historyManager The history manager to log the initialization event.
@return A GitService object the points to the freshly cloned Git repository.
@throws RefNotFoundException
@throws Exception | [
"Initializes",
"war",
"configuration",
"directory",
"for",
"a",
"Cadmium",
"war",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/git/GitService.java#L175-L225 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/SimpleDateFormat.java | SimpleDateFormat.matchString | private int matchString(String text, int start, int field, String[] data, CalendarBuilder calb)
{
int i = 0;
int count = data.length;
if (field == Calendar.DAY_OF_WEEK) i = 1;
// There may be multiple strings in the data[] array which begin with
// the same prefix (e.g., Cerven and Cervenec (June and July) in Czech).
// We keep track of the longest match, and return that. Note that this
// unfortunately requires us to test all array elements.
int bestMatchLength = 0, bestMatch = -1;
for (; i<count; ++i)
{
int length = data[i].length();
// Always compare if we have no match yet; otherwise only compare
// against potentially better matches (longer strings).
if (length > bestMatchLength &&
text.regionMatches(true, start, data[i], 0, length))
{
bestMatch = i;
bestMatchLength = length;
}
// When the input option ends with a period (usually an abbreviated form), attempt
// to match all chars up to that period.
if ((data[i].charAt(length - 1) == '.') &&
((length - 1) > bestMatchLength) &&
text.regionMatches(true, start, data[i], 0, length - 1)) {
bestMatch = i;
bestMatchLength = (length - 1);
}
}
if (bestMatch >= 0)
{
calb.set(field, bestMatch);
return start + bestMatchLength;
}
return -start;
} | java | private int matchString(String text, int start, int field, String[] data, CalendarBuilder calb)
{
int i = 0;
int count = data.length;
if (field == Calendar.DAY_OF_WEEK) i = 1;
// There may be multiple strings in the data[] array which begin with
// the same prefix (e.g., Cerven and Cervenec (June and July) in Czech).
// We keep track of the longest match, and return that. Note that this
// unfortunately requires us to test all array elements.
int bestMatchLength = 0, bestMatch = -1;
for (; i<count; ++i)
{
int length = data[i].length();
// Always compare if we have no match yet; otherwise only compare
// against potentially better matches (longer strings).
if (length > bestMatchLength &&
text.regionMatches(true, start, data[i], 0, length))
{
bestMatch = i;
bestMatchLength = length;
}
// When the input option ends with a period (usually an abbreviated form), attempt
// to match all chars up to that period.
if ((data[i].charAt(length - 1) == '.') &&
((length - 1) > bestMatchLength) &&
text.regionMatches(true, start, data[i], 0, length - 1)) {
bestMatch = i;
bestMatchLength = (length - 1);
}
}
if (bestMatch >= 0)
{
calb.set(field, bestMatch);
return start + bestMatchLength;
}
return -start;
} | [
"private",
"int",
"matchString",
"(",
"String",
"text",
",",
"int",
"start",
",",
"int",
"field",
",",
"String",
"[",
"]",
"data",
",",
"CalendarBuilder",
"calb",
")",
"{",
"int",
"i",
"=",
"0",
";",
"int",
"count",
"=",
"data",
".",
"length",
";",
... | Private code-size reduction function used by subParse.
@param text the time text being parsed.
@param start where to start parsing.
@param field the date field being parsed.
@param data the string array to parsed.
@return the new start position if matching succeeded; a negative number
indicating matching failure, otherwise. | [
"Private",
"code",
"-",
"size",
"reduction",
"function",
"used",
"by",
"subParse",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/SimpleDateFormat.java#L1581-L1620 |
VoltDB/voltdb | src/frontend/org/voltdb/importer/AbstractImporter.java | AbstractImporter.callProcedure | public boolean callProcedure(Invocation invocation, ProcedureCallback callback)
{
try {
boolean result = m_importServerAdapter.callProcedure(this,
m_backPressurePredicate,
callback, invocation.getProcedure(), invocation.getParams());
reportStat(result, invocation.getProcedure());
return result;
} catch (Exception ex) {
rateLimitedLog(Level.ERROR, ex, "%s: Error trying to import", getName());
reportFailureStat(invocation.getProcedure());
return false;
}
} | java | public boolean callProcedure(Invocation invocation, ProcedureCallback callback)
{
try {
boolean result = m_importServerAdapter.callProcedure(this,
m_backPressurePredicate,
callback, invocation.getProcedure(), invocation.getParams());
reportStat(result, invocation.getProcedure());
return result;
} catch (Exception ex) {
rateLimitedLog(Level.ERROR, ex, "%s: Error trying to import", getName());
reportFailureStat(invocation.getProcedure());
return false;
}
} | [
"public",
"boolean",
"callProcedure",
"(",
"Invocation",
"invocation",
",",
"ProcedureCallback",
"callback",
")",
"{",
"try",
"{",
"boolean",
"result",
"=",
"m_importServerAdapter",
".",
"callProcedure",
"(",
"this",
",",
"m_backPressurePredicate",
",",
"callback",
... | This should be used importer implementations to execute a stored procedure.
@param invocation Invocation object with procedure name and parameter information
@param callback the callback that will receive procedure invocation status
@return returns true if the procedure execution went through successfully; false otherwise | [
"This",
"should",
"be",
"used",
"importer",
"implementations",
"to",
"execute",
"a",
"stored",
"procedure",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/importer/AbstractImporter.java#L108-L121 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/CQLTranslator.java | CQLTranslator.appendMap | private boolean appendMap(StringBuilder builder, Object value)
{
boolean isPresent = false;
if (value instanceof Map)
{
Map map = ((Map) value);
isPresent = true;
builder.append(Constants.OPEN_CURLY_BRACKET);
for (Object mapKey : map.keySet())
{
Object mapValue = map.get(mapKey);
// Allowing null keys.
appendValue(builder, mapKey != null ? mapKey.getClass() : null, mapKey, false);
builder.append(Constants.COLON);
// Allowing null values.
appendValue(builder, mapValue != null ? mapValue.getClass() : null, mapValue, false);
builder.append(Constants.COMMA);
}
if (!map.isEmpty())
{
builder.deleteCharAt(builder.length() - 1);
}
builder.append(Constants.CLOSE_CURLY_BRACKET);
}
else
{
appendValue(builder, value.getClass(), value, false);
}
return isPresent;
} | java | private boolean appendMap(StringBuilder builder, Object value)
{
boolean isPresent = false;
if (value instanceof Map)
{
Map map = ((Map) value);
isPresent = true;
builder.append(Constants.OPEN_CURLY_BRACKET);
for (Object mapKey : map.keySet())
{
Object mapValue = map.get(mapKey);
// Allowing null keys.
appendValue(builder, mapKey != null ? mapKey.getClass() : null, mapKey, false);
builder.append(Constants.COLON);
// Allowing null values.
appendValue(builder, mapValue != null ? mapValue.getClass() : null, mapValue, false);
builder.append(Constants.COMMA);
}
if (!map.isEmpty())
{
builder.deleteCharAt(builder.length() - 1);
}
builder.append(Constants.CLOSE_CURLY_BRACKET);
}
else
{
appendValue(builder, value.getClass(), value, false);
}
return isPresent;
} | [
"private",
"boolean",
"appendMap",
"(",
"StringBuilder",
"builder",
",",
"Object",
"value",
")",
"{",
"boolean",
"isPresent",
"=",
"false",
";",
"if",
"(",
"value",
"instanceof",
"Map",
")",
"{",
"Map",
"map",
"=",
"(",
"(",
"Map",
")",
"value",
")",
"... | Appends a object of type {@link java.util.List}
@param builder
the builder
@param value
the value
@return true, if successful | [
"Appends",
"a",
"object",
"of",
"type",
"{",
"@link",
"java",
".",
"util",
".",
"List",
"}"
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/CQLTranslator.java#L1210-L1240 |
jbundle/jbundle | thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/transport/BaseTransport.java | BaseTransport.addParam | public void addParam(String strParam, boolean bValue)
{
this.addParam(strParam, bValue ? Constants.TRUE : Constants.FALSE);
} | java | public void addParam(String strParam, boolean bValue)
{
this.addParam(strParam, bValue ? Constants.TRUE : Constants.FALSE);
} | [
"public",
"void",
"addParam",
"(",
"String",
"strParam",
",",
"boolean",
"bValue",
")",
"{",
"this",
".",
"addParam",
"(",
"strParam",
",",
"bValue",
"?",
"Constants",
".",
"TRUE",
":",
"Constants",
".",
"FALSE",
")",
";",
"}"
] | Add this method param to the param list.
@param strParam The param name.
@param strValue The param value. | [
"Add",
"this",
"method",
"param",
"to",
"the",
"param",
"list",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/transport/BaseTransport.java#L101-L104 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/regex/RegExHelper.java | RegExHelper.getAsIdentifier | @Nullable
public static String getAsIdentifier (@Nullable final String s, final char cReplacement)
{
if (StringHelper.hasNoText (s))
return s;
String sReplacement;
if (cReplacement == '$' || cReplacement == '\\')
{
// These 2 chars must be quoted, otherwise an
// StringIndexOutOfBoundsException occurs!
sReplacement = "\\" + cReplacement;
}
else
sReplacement = Character.toString (cReplacement);
// replace all non-word characters with the replacement character
// Important: quote the replacement in case it is a backslash or another
// special regex character
final String ret = stringReplacePattern ("\\W", s, sReplacement);
if (!Character.isJavaIdentifierStart (ret.charAt (0)))
return sReplacement + ret;
return ret;
} | java | @Nullable
public static String getAsIdentifier (@Nullable final String s, final char cReplacement)
{
if (StringHelper.hasNoText (s))
return s;
String sReplacement;
if (cReplacement == '$' || cReplacement == '\\')
{
// These 2 chars must be quoted, otherwise an
// StringIndexOutOfBoundsException occurs!
sReplacement = "\\" + cReplacement;
}
else
sReplacement = Character.toString (cReplacement);
// replace all non-word characters with the replacement character
// Important: quote the replacement in case it is a backslash or another
// special regex character
final String ret = stringReplacePattern ("\\W", s, sReplacement);
if (!Character.isJavaIdentifierStart (ret.charAt (0)))
return sReplacement + ret;
return ret;
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getAsIdentifier",
"(",
"@",
"Nullable",
"final",
"String",
"s",
",",
"final",
"char",
"cReplacement",
")",
"{",
"if",
"(",
"StringHelper",
".",
"hasNoText",
"(",
"s",
")",
")",
"return",
"s",
";",
"String",
... | Convert an identifier to a programming language identifier by replacing all
non-word characters with an underscore.
@param s
The string to convert. May be <code>null</code> or empty.
@param cReplacement
The replacement character to be used for all non-identifier
characters
@return The converted string or <code>null</code> if the input string is
<code>null</code>. | [
"Convert",
"an",
"identifier",
"to",
"a",
"programming",
"language",
"identifier",
"by",
"replacing",
"all",
"non",
"-",
"word",
"characters",
"with",
"an",
"underscore",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/regex/RegExHelper.java#L279-L302 |
riversun/d6 | src/main/java/org/riversun/d6/core/D6Crud.java | D6Crud.execSelectTable | public <T extends D6Model> T[] execSelectTable(String preparedSql, Object[] searchKeys, Class<T> modelClazz) {
@SuppressWarnings("unchecked")
final Map<Class<?>, List<Object>> result = execSelectTableWithJoin(preparedSql, searchKeys, modelClazz);
final List<Object> rowList = result.get(modelClazz);
return toArray(rowList, modelClazz);
} | java | public <T extends D6Model> T[] execSelectTable(String preparedSql, Object[] searchKeys, Class<T> modelClazz) {
@SuppressWarnings("unchecked")
final Map<Class<?>, List<Object>> result = execSelectTableWithJoin(preparedSql, searchKeys, modelClazz);
final List<Object> rowList = result.get(modelClazz);
return toArray(rowList, modelClazz);
} | [
"public",
"<",
"T",
"extends",
"D6Model",
">",
"T",
"[",
"]",
"execSelectTable",
"(",
"String",
"preparedSql",
",",
"Object",
"[",
"]",
"searchKeys",
",",
"Class",
"<",
"T",
">",
"modelClazz",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
... | Execute select statement for the single table. <br>
<br>
-About SQL<br>
You can use prepared SQL.<br>
<br>
In addition,you can also use non-wildcard ('?') SQL (=raw SQL).In this
case searchKeys must be null or empty array(size 0 array).<br>
When you use a wildcard('?'), you must not include the "'"(=>single
quotes) to preparedSQL.<br>
<br>
-About processing<br>
Used when you execute the SQL that is JOIN multiple tables.<br>
In this method, you can specify more than one model class.<br>
When the column name specified in the annotation of the model classes is
included in the resultSet,<br>
a value corresponding to the column name is set to the corresponding
field of model objects.<br>
In other words, if multiple model class has the same column name, values
in the resultSet is set in the same manner for each mode class.<br>
<br>
@param preparedSql
@param searchKeys
@param modelClazz
@return | [
"Execute",
"select",
"statement",
"for",
"the",
"single",
"table",
".",
"<br",
">",
"<br",
">",
"-",
"About",
"SQL<br",
">",
"You",
"can",
"use",
"prepared",
"SQL",
".",
"<br",
">",
"<br",
">",
"In",
"addition",
"you",
"can",
"also",
"use",
"non",
"-... | train | https://github.com/riversun/d6/blob/2798bd876b9380dbfea8182d11ad306cb1b0e114/src/main/java/org/riversun/d6/core/D6Crud.java#L806-L814 |
pravega/pravega | segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/stat/SegmentStatsRecorderImpl.java | SegmentStatsRecorderImpl.recordAppend | @Override
public void recordAppend(String streamSegmentName, long dataLength, int numOfEvents, Duration elapsed) {
getWriteStreamSegment().reportSuccessEvent(elapsed);
DynamicLogger dl = getDynamicLogger();
dl.incCounterValue(globalMetricName(SEGMENT_WRITE_BYTES), dataLength);
dl.incCounterValue(globalMetricName(SEGMENT_WRITE_EVENTS), numOfEvents);
if (!StreamSegmentNameUtils.isTransactionSegment(streamSegmentName)) {
//Don't report segment specific metrics if segment is a transaction
//The parent segment metrics will be updated once the transaction is merged
dl.incCounterValue(SEGMENT_WRITE_BYTES, dataLength, segmentTags(streamSegmentName));
dl.incCounterValue(SEGMENT_WRITE_EVENTS, numOfEvents, segmentTags(streamSegmentName));
try {
SegmentAggregates aggregates = getSegmentAggregate(streamSegmentName);
// Note: we could get stats for a transaction segment. We will simply ignore this as we
// do not maintain intermittent txn segment stats. Txn stats will be accounted for
// only upon txn commit. This is done via merge method. So here we can get a txn which
// we do not know about and hence we can get null and ignore.
if (aggregates != null && aggregates.update(dataLength, numOfEvents)) {
report(streamSegmentName, aggregates);
}
} catch (Exception e) {
log.warn("Record statistic for {} for data: {} and events:{} threw exception", streamSegmentName, dataLength, numOfEvents, e);
}
}
} | java | @Override
public void recordAppend(String streamSegmentName, long dataLength, int numOfEvents, Duration elapsed) {
getWriteStreamSegment().reportSuccessEvent(elapsed);
DynamicLogger dl = getDynamicLogger();
dl.incCounterValue(globalMetricName(SEGMENT_WRITE_BYTES), dataLength);
dl.incCounterValue(globalMetricName(SEGMENT_WRITE_EVENTS), numOfEvents);
if (!StreamSegmentNameUtils.isTransactionSegment(streamSegmentName)) {
//Don't report segment specific metrics if segment is a transaction
//The parent segment metrics will be updated once the transaction is merged
dl.incCounterValue(SEGMENT_WRITE_BYTES, dataLength, segmentTags(streamSegmentName));
dl.incCounterValue(SEGMENT_WRITE_EVENTS, numOfEvents, segmentTags(streamSegmentName));
try {
SegmentAggregates aggregates = getSegmentAggregate(streamSegmentName);
// Note: we could get stats for a transaction segment. We will simply ignore this as we
// do not maintain intermittent txn segment stats. Txn stats will be accounted for
// only upon txn commit. This is done via merge method. So here we can get a txn which
// we do not know about and hence we can get null and ignore.
if (aggregates != null && aggregates.update(dataLength, numOfEvents)) {
report(streamSegmentName, aggregates);
}
} catch (Exception e) {
log.warn("Record statistic for {} for data: {} and events:{} threw exception", streamSegmentName, dataLength, numOfEvents, e);
}
}
} | [
"@",
"Override",
"public",
"void",
"recordAppend",
"(",
"String",
"streamSegmentName",
",",
"long",
"dataLength",
",",
"int",
"numOfEvents",
",",
"Duration",
"elapsed",
")",
"{",
"getWriteStreamSegment",
"(",
")",
".",
"reportSuccessEvent",
"(",
"elapsed",
")",
... | Updates segment specific aggregates.
Then if two minutes have elapsed between last report
of aggregates for this segment, send a new update to the monitor.
This update to the monitor is processed by monitor asynchronously.
@param streamSegmentName stream segment name
@param dataLength length of data that was written
@param numOfEvents number of events that were written
@param elapsed elapsed time for the append | [
"Updates",
"segment",
"specific",
"aggregates",
".",
"Then",
"if",
"two",
"minutes",
"have",
"elapsed",
"between",
"last",
"report",
"of",
"aggregates",
"for",
"this",
"segment",
"send",
"a",
"new",
"update",
"to",
"the",
"monitor",
".",
"This",
"update",
"t... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/stat/SegmentStatsRecorderImpl.java#L191-L215 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/interfaces/LoopbackAddressInterfaceCriteria.java | LoopbackAddressInterfaceCriteria.isAcceptable | @Override
protected InetAddress isAcceptable(NetworkInterface networkInterface, InetAddress address) throws SocketException {
try {
if( networkInterface.isLoopback() ) {
return getAddress();
}
} catch (UnknownHostException e) {
// One time only log a warning
if (!unknownHostLogged) {
MGMT_OP_LOGGER.cannotResolveAddress(this.address);
unknownHostLogged = true;
}
}
return null;
} | java | @Override
protected InetAddress isAcceptable(NetworkInterface networkInterface, InetAddress address) throws SocketException {
try {
if( networkInterface.isLoopback() ) {
return getAddress();
}
} catch (UnknownHostException e) {
// One time only log a warning
if (!unknownHostLogged) {
MGMT_OP_LOGGER.cannotResolveAddress(this.address);
unknownHostLogged = true;
}
}
return null;
} | [
"@",
"Override",
"protected",
"InetAddress",
"isAcceptable",
"(",
"NetworkInterface",
"networkInterface",
",",
"InetAddress",
"address",
")",
"throws",
"SocketException",
"{",
"try",
"{",
"if",
"(",
"networkInterface",
".",
"isLoopback",
"(",
")",
")",
"{",
"retur... | {@inheritDoc}
@return <code>{@link #getAddress()}()</code> if {@link NetworkInterface#isLoopback()} is true, null otherwise. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/interfaces/LoopbackAddressInterfaceCriteria.java#L83-L98 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java | IotHubResourcesInner.listJobsAsync | public Observable<Page<JobResponseInner>> listJobsAsync(final String resourceGroupName, final String resourceName) {
return listJobsWithServiceResponseAsync(resourceGroupName, resourceName)
.map(new Func1<ServiceResponse<Page<JobResponseInner>>, Page<JobResponseInner>>() {
@Override
public Page<JobResponseInner> call(ServiceResponse<Page<JobResponseInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<JobResponseInner>> listJobsAsync(final String resourceGroupName, final String resourceName) {
return listJobsWithServiceResponseAsync(resourceGroupName, resourceName)
.map(new Func1<ServiceResponse<Page<JobResponseInner>>, Page<JobResponseInner>>() {
@Override
public Page<JobResponseInner> call(ServiceResponse<Page<JobResponseInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"JobResponseInner",
">",
">",
"listJobsAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"resourceName",
")",
"{",
"return",
"listJobsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resour... | Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<JobResponseInner> object | [
"Get",
"a",
"list",
"of",
"all",
"the",
"jobs",
"in",
"an",
"IoT",
"hub",
".",
"For",
"more",
"information",
"see",
":",
"https",
":",
"//",
"docs",
".",
"microsoft",
".",
"com",
"/",
"azure",
"/",
"iot",
"-",
"hub",
"/",
"iot",
"-",
"hub",
"-",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L2120-L2128 |
deephacks/confit | provider-jpa20/src/main/java/org/deephacks/confit/internal/jpa/JpaBeanQueryAssembler.java | JpaBeanQueryAssembler.addRefs | public void addRefs(Multimap<BeanId, JpaRef> queryRefs) {
refs.putAll(queryRefs);
for (BeanId id : refs.keySet()) {
putIfAbsent(id);
for (JpaRef ref : refs.get(id)) {
putIfAbsent(ref.getTarget());
}
}
} | java | public void addRefs(Multimap<BeanId, JpaRef> queryRefs) {
refs.putAll(queryRefs);
for (BeanId id : refs.keySet()) {
putIfAbsent(id);
for (JpaRef ref : refs.get(id)) {
putIfAbsent(ref.getTarget());
}
}
} | [
"public",
"void",
"addRefs",
"(",
"Multimap",
"<",
"BeanId",
",",
"JpaRef",
">",
"queryRefs",
")",
"{",
"refs",
".",
"putAll",
"(",
"queryRefs",
")",
";",
"for",
"(",
"BeanId",
"id",
":",
"refs",
".",
"keySet",
"(",
")",
")",
"{",
"putIfAbsent",
"(",... | Add references found from a partial query of bean references. | [
"Add",
"references",
"found",
"from",
"a",
"partial",
"query",
"of",
"bean",
"references",
"."
] | train | https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/provider-jpa20/src/main/java/org/deephacks/confit/internal/jpa/JpaBeanQueryAssembler.java#L80-L88 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java | XmlStringBuilder.attribute | public XmlStringBuilder attribute(String name, String value) {
assert value != null;
sb.append(' ').append(name).append("='");
escapeAttributeValue(value);
sb.append('\'');
return this;
} | java | public XmlStringBuilder attribute(String name, String value) {
assert value != null;
sb.append(' ').append(name).append("='");
escapeAttributeValue(value);
sb.append('\'');
return this;
} | [
"public",
"XmlStringBuilder",
"attribute",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"assert",
"value",
"!=",
"null",
";",
"sb",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"name",
")",
".",
"append",
"(",
"\"='\"",
")",
";"... | Does nothing if value is null.
@param name
@param value
@return the XmlStringBuilder | [
"Does",
"nothing",
"if",
"value",
"is",
"null",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java#L241-L247 |
apache/spark | common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java | ExternalShuffleBlockResolver.createNormalizedInternedPathname | @VisibleForTesting
static String createNormalizedInternedPathname(String dir1, String dir2, String fname) {
String pathname = dir1 + File.separator + dir2 + File.separator + fname;
Matcher m = MULTIPLE_SEPARATORS.matcher(pathname);
pathname = m.replaceAll("/");
// A single trailing slash needs to be taken care of separately
if (pathname.length() > 1 && pathname.endsWith("/")) {
pathname = pathname.substring(0, pathname.length() - 1);
}
return pathname.intern();
} | java | @VisibleForTesting
static String createNormalizedInternedPathname(String dir1, String dir2, String fname) {
String pathname = dir1 + File.separator + dir2 + File.separator + fname;
Matcher m = MULTIPLE_SEPARATORS.matcher(pathname);
pathname = m.replaceAll("/");
// A single trailing slash needs to be taken care of separately
if (pathname.length() > 1 && pathname.endsWith("/")) {
pathname = pathname.substring(0, pathname.length() - 1);
}
return pathname.intern();
} | [
"@",
"VisibleForTesting",
"static",
"String",
"createNormalizedInternedPathname",
"(",
"String",
"dir1",
",",
"String",
"dir2",
",",
"String",
"fname",
")",
"{",
"String",
"pathname",
"=",
"dir1",
"+",
"File",
".",
"separator",
"+",
"dir2",
"+",
"File",
".",
... | This method is needed to avoid the situation when multiple File instances for the
same pathname "foo/bar" are created, each with a separate copy of the "foo/bar" String.
According to measurements, in some scenarios such duplicate strings may waste a lot
of memory (~ 10% of the heap). To avoid that, we intern the pathname, and before that
we make sure that it's in a normalized form (contains no "//", "///" etc.) Otherwise,
the internal code in java.io.File would normalize it later, creating a new "foo/bar"
String copy. Unfortunately, we cannot just reuse the normalization code that java.io.File
uses, since it is in the package-private class java.io.FileSystem. | [
"This",
"method",
"is",
"needed",
"to",
"avoid",
"the",
"situation",
"when",
"multiple",
"File",
"instances",
"for",
"the",
"same",
"pathname",
"foo",
"/",
"bar",
"are",
"created",
"each",
"with",
"a",
"separate",
"copy",
"of",
"the",
"foo",
"/",
"bar",
... | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java#L334-L344 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/attribute/map/MapfishMapContext.java | MapfishMapContext.getRotatedBounds | public MapBounds getRotatedBounds(final Rectangle2D.Double paintAreaPrecise, final Rectangle paintArea) {
final MapBounds rotatedBounds = this.getRotatedBounds();
if (rotatedBounds instanceof CenterScaleMapBounds) {
return rotatedBounds;
}
final ReferencedEnvelope envelope = ((BBoxMapBounds) rotatedBounds).toReferencedEnvelope(null);
// the paint area size and the map bounds are rotated independently. because
// the paint area size is rounded to integers, the map bounds have to be adjusted
// to these rounding changes.
final double widthRatio = paintArea.getWidth() / paintAreaPrecise.getWidth();
final double heightRatio = paintArea.getHeight() / paintAreaPrecise.getHeight();
final double adaptedWidth = envelope.getWidth() * widthRatio;
final double adaptedHeight = envelope.getHeight() * heightRatio;
final double widthDiff = adaptedWidth - envelope.getWidth();
final double heigthDiff = adaptedHeight - envelope.getHeight();
envelope.expandBy(widthDiff / 2.0, heigthDiff / 2.0);
return new BBoxMapBounds(envelope);
} | java | public MapBounds getRotatedBounds(final Rectangle2D.Double paintAreaPrecise, final Rectangle paintArea) {
final MapBounds rotatedBounds = this.getRotatedBounds();
if (rotatedBounds instanceof CenterScaleMapBounds) {
return rotatedBounds;
}
final ReferencedEnvelope envelope = ((BBoxMapBounds) rotatedBounds).toReferencedEnvelope(null);
// the paint area size and the map bounds are rotated independently. because
// the paint area size is rounded to integers, the map bounds have to be adjusted
// to these rounding changes.
final double widthRatio = paintArea.getWidth() / paintAreaPrecise.getWidth();
final double heightRatio = paintArea.getHeight() / paintAreaPrecise.getHeight();
final double adaptedWidth = envelope.getWidth() * widthRatio;
final double adaptedHeight = envelope.getHeight() * heightRatio;
final double widthDiff = adaptedWidth - envelope.getWidth();
final double heigthDiff = adaptedHeight - envelope.getHeight();
envelope.expandBy(widthDiff / 2.0, heigthDiff / 2.0);
return new BBoxMapBounds(envelope);
} | [
"public",
"MapBounds",
"getRotatedBounds",
"(",
"final",
"Rectangle2D",
".",
"Double",
"paintAreaPrecise",
",",
"final",
"Rectangle",
"paintArea",
")",
"{",
"final",
"MapBounds",
"rotatedBounds",
"=",
"this",
".",
"getRotatedBounds",
"(",
")",
";",
"if",
"(",
"r... | Return the map bounds rotated with the set rotation. The bounds are adapted to rounding changes of the
size of the paint area.
@param paintAreaPrecise The exact size of the paint area.
@param paintArea The rounded size of the paint area.
@return Rotated bounds. | [
"Return",
"the",
"map",
"bounds",
"rotated",
"with",
"the",
"set",
"rotation",
".",
"The",
"bounds",
"are",
"adapted",
"to",
"rounding",
"changes",
"of",
"the",
"size",
"of",
"the",
"paint",
"area",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/attribute/map/MapfishMapContext.java#L150-L172 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/PhoneNumberUtil.java | PhoneNumberUtil.formatUrl | public final String formatUrl(final String pphoneNumber, final String pcountryCode) {
return this.formatUrl(this.parsePhoneNumber(pphoneNumber, pcountryCode));
} | java | public final String formatUrl(final String pphoneNumber, final String pcountryCode) {
return this.formatUrl(this.parsePhoneNumber(pphoneNumber, pcountryCode));
} | [
"public",
"final",
"String",
"formatUrl",
"(",
"final",
"String",
"pphoneNumber",
",",
"final",
"String",
"pcountryCode",
")",
"{",
"return",
"this",
".",
"formatUrl",
"(",
"this",
".",
"parsePhoneNumber",
"(",
"pphoneNumber",
",",
"pcountryCode",
")",
")",
";... | format phone number in URL format.
@param pphoneNumber phone number to format
@param pcountryCode iso code of country
@return formated phone number as String | [
"format",
"phone",
"number",
"in",
"URL",
"format",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/PhoneNumberUtil.java#L1285-L1287 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/AbstractDsAssignmentStrategy.java | AbstractDsAssignmentStrategy.cancelAssignDistributionSetEvent | void cancelAssignDistributionSetEvent(final Target target, final Long actionId) {
afterCommit.afterCommit(
() -> eventPublisher.publishEvent(new CancelTargetAssignmentEvent(target, actionId, bus.getId())));
} | java | void cancelAssignDistributionSetEvent(final Target target, final Long actionId) {
afterCommit.afterCommit(
() -> eventPublisher.publishEvent(new CancelTargetAssignmentEvent(target, actionId, bus.getId())));
} | [
"void",
"cancelAssignDistributionSetEvent",
"(",
"final",
"Target",
"target",
",",
"final",
"Long",
"actionId",
")",
"{",
"afterCommit",
".",
"afterCommit",
"(",
"(",
")",
"->",
"eventPublisher",
".",
"publishEvent",
"(",
"new",
"CancelTargetAssignmentEvent",
"(",
... | Sends the {@link CancelTargetAssignmentEvent} for a specific target to
the eventPublisher.
@param target
the Target which has been assigned to a distribution set
@param actionId
the action id of the assignment | [
"Sends",
"the",
"{",
"@link",
"CancelTargetAssignmentEvent",
"}",
"for",
"a",
"specific",
"target",
"to",
"the",
"eventPublisher",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/AbstractDsAssignmentStrategy.java#L216-L219 |
indeedeng/util | urlparsing/src/main/java/com/indeed/util/urlparsing/ParseUtils.java | ParseUtils.parseSignedLong | public static long parseSignedLong(CharSequence s, final int start, final int end) throws NumberFormatException {
if (s.charAt(start) == '-') {
// negative!
return -parseUnsignedLong(s, start + 1, end);
} else {
return parseUnsignedLong(s, start, end);
}
} | java | public static long parseSignedLong(CharSequence s, final int start, final int end) throws NumberFormatException {
if (s.charAt(start) == '-') {
// negative!
return -parseUnsignedLong(s, start + 1, end);
} else {
return parseUnsignedLong(s, start, end);
}
} | [
"public",
"static",
"long",
"parseSignedLong",
"(",
"CharSequence",
"s",
",",
"final",
"int",
"start",
",",
"final",
"int",
"end",
")",
"throws",
"NumberFormatException",
"{",
"if",
"(",
"s",
".",
"charAt",
"(",
"start",
")",
"==",
"'",
"'",
")",
"{",
... | Parses out a long value from the provided string, equivalent to Long.parseLong(s.substring(start, end)),
but has significantly less overhead, no object creation and later garbage collection required
@throws {@link NumberFormatException} if it encounters any character that is not [-0-9]. | [
"Parses",
"out",
"a",
"long",
"value",
"from",
"the",
"provided",
"string",
"equivalent",
"to",
"Long",
".",
"parseLong",
"(",
"s",
".",
"substring",
"(",
"start",
"end",
"))",
"but",
"has",
"significantly",
"less",
"overhead",
"no",
"object",
"creation",
... | train | https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/urlparsing/src/main/java/com/indeed/util/urlparsing/ParseUtils.java#L65-L72 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java | VariableUtils.getValueFromScript | public static String getValueFromScript(String scriptEngine, String code) {
try {
ScriptEngine engine = new ScriptEngineManager().getEngineByName(scriptEngine);
if (engine == null) {
throw new CitrusRuntimeException("Unable to find script engine with name '" + scriptEngine + "'");
}
return engine.eval(code).toString();
} catch (ScriptException e) {
throw new CitrusRuntimeException("Failed to evaluate " + scriptEngine + " script", e);
}
} | java | public static String getValueFromScript(String scriptEngine, String code) {
try {
ScriptEngine engine = new ScriptEngineManager().getEngineByName(scriptEngine);
if (engine == null) {
throw new CitrusRuntimeException("Unable to find script engine with name '" + scriptEngine + "'");
}
return engine.eval(code).toString();
} catch (ScriptException e) {
throw new CitrusRuntimeException("Failed to evaluate " + scriptEngine + " script", e);
}
} | [
"public",
"static",
"String",
"getValueFromScript",
"(",
"String",
"scriptEngine",
",",
"String",
"code",
")",
"{",
"try",
"{",
"ScriptEngine",
"engine",
"=",
"new",
"ScriptEngineManager",
"(",
")",
".",
"getEngineByName",
"(",
"scriptEngine",
")",
";",
"if",
... | Evaluates script code and returns a variable value as result.
@param scriptEngine the name of the scripting engine.
@param code the script code.
@return the variable value as String. | [
"Evaluates",
"script",
"code",
"and",
"returns",
"a",
"variable",
"value",
"as",
"result",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java#L47-L59 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/ImplDisparityScoreSadRectFive_U8.java | ImplDisparityScoreSadRectFive_U8.computeRemainingRows | private void computeRemainingRows(GrayU8 left, GrayU8 right )
{
for( int row = regionHeight; row < left.height; row++ , activeVerticalScore++) {
int oldRow = row%regionHeight;
int previous[] = verticalScore[ (activeVerticalScore -1) % regionHeight ];
int active[] = verticalScore[ activeVerticalScore % regionHeight ];
// subtract first row from vertical score
int scores[] = horizontalScore[oldRow];
for( int i = 0; i < lengthHorizontal; i++ ) {
active[i] = previous[i] - scores[i];
}
UtilDisparityScore.computeScoreRow(left, right, row, scores,
minDisparity,maxDisparity,regionWidth,elementScore);
// add the new score
for( int i = 0; i < lengthHorizontal; i++ ) {
active[i] += scores[i];
}
if( activeVerticalScore >= regionHeight-1 ) {
int top[] = verticalScore[ (activeVerticalScore -2*radiusY) % regionHeight ];
int middle[] = verticalScore[ (activeVerticalScore -radiusY) % regionHeight ];
int bottom[] = verticalScore[ activeVerticalScore % regionHeight ];
computeScoreFive(top,middle,bottom,fiveScore,left.width);
computeDisparity.process(row - (1 + 4*radiusY) + 2*radiusY+1, fiveScore );
}
}
} | java | private void computeRemainingRows(GrayU8 left, GrayU8 right )
{
for( int row = regionHeight; row < left.height; row++ , activeVerticalScore++) {
int oldRow = row%regionHeight;
int previous[] = verticalScore[ (activeVerticalScore -1) % regionHeight ];
int active[] = verticalScore[ activeVerticalScore % regionHeight ];
// subtract first row from vertical score
int scores[] = horizontalScore[oldRow];
for( int i = 0; i < lengthHorizontal; i++ ) {
active[i] = previous[i] - scores[i];
}
UtilDisparityScore.computeScoreRow(left, right, row, scores,
minDisparity,maxDisparity,regionWidth,elementScore);
// add the new score
for( int i = 0; i < lengthHorizontal; i++ ) {
active[i] += scores[i];
}
if( activeVerticalScore >= regionHeight-1 ) {
int top[] = verticalScore[ (activeVerticalScore -2*radiusY) % regionHeight ];
int middle[] = verticalScore[ (activeVerticalScore -radiusY) % regionHeight ];
int bottom[] = verticalScore[ activeVerticalScore % regionHeight ];
computeScoreFive(top,middle,bottom,fiveScore,left.width);
computeDisparity.process(row - (1 + 4*radiusY) + 2*radiusY+1, fiveScore );
}
}
} | [
"private",
"void",
"computeRemainingRows",
"(",
"GrayU8",
"left",
",",
"GrayU8",
"right",
")",
"{",
"for",
"(",
"int",
"row",
"=",
"regionHeight",
";",
"row",
"<",
"left",
".",
"height",
";",
"row",
"++",
",",
"activeVerticalScore",
"++",
")",
"{",
"int"... | Using previously computed results it efficiently finds the disparity in the remaining rows.
When a new block is processes the last row/column is subtracted and the new row/column is
added. | [
"Using",
"previously",
"computed",
"results",
"it",
"efficiently",
"finds",
"the",
"disparity",
"in",
"the",
"remaining",
"rows",
".",
"When",
"a",
"new",
"block",
"is",
"processes",
"the",
"last",
"row",
"/",
"column",
"is",
"subtracted",
"and",
"the",
"new... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/ImplDisparityScoreSadRectFive_U8.java#L113-L143 |
podio/podio-java | src/main/java/com/podio/org/OrgAPI.java | OrgAPI.updateOrganization | public void updateOrganization(int orgId, OrganizationCreate data) {
getResourceFactory().getApiResource("/org/" + orgId)
.entity(data, MediaType.APPLICATION_JSON_TYPE).put();
} | java | public void updateOrganization(int orgId, OrganizationCreate data) {
getResourceFactory().getApiResource("/org/" + orgId)
.entity(data, MediaType.APPLICATION_JSON_TYPE).put();
} | [
"public",
"void",
"updateOrganization",
"(",
"int",
"orgId",
",",
"OrganizationCreate",
"data",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/org/\"",
"+",
"orgId",
")",
".",
"entity",
"(",
"data",
",",
"MediaType",
".",
"APPLICATIO... | Updates an organization with new name and logo. Note that the URL of the
organization will not change even though the name changes.
@param orgId
The id of the organization
@param data
The new data | [
"Updates",
"an",
"organization",
"with",
"new",
"name",
"and",
"logo",
".",
"Note",
"that",
"the",
"URL",
"of",
"the",
"organization",
"will",
"not",
"change",
"even",
"though",
"the",
"name",
"changes",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/org/OrgAPI.java#L42-L45 |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/archive/AbstractCDIArchive.java | AbstractCDIArchive.getBeanDiscoveryMode | public BeanDiscoveryMode getBeanDiscoveryMode(CDIRuntime cdiRuntime, BeansXml beansXml) {
BeanDiscoveryMode mode = BeanDiscoveryMode.ANNOTATED;
if (beansXml != null) {
mode = beansXml.getBeanDiscoveryMode();
} else if (cdiRuntime.isImplicitBeanArchivesScanningDisabled(this)) {
// If the server.xml has the configuration of enableImplicitBeanArchives sets to false, we will not scan the implicit bean archives
mode = BeanDiscoveryMode.NONE;
}
return mode;
} | java | public BeanDiscoveryMode getBeanDiscoveryMode(CDIRuntime cdiRuntime, BeansXml beansXml) {
BeanDiscoveryMode mode = BeanDiscoveryMode.ANNOTATED;
if (beansXml != null) {
mode = beansXml.getBeanDiscoveryMode();
} else if (cdiRuntime.isImplicitBeanArchivesScanningDisabled(this)) {
// If the server.xml has the configuration of enableImplicitBeanArchives sets to false, we will not scan the implicit bean archives
mode = BeanDiscoveryMode.NONE;
}
return mode;
} | [
"public",
"BeanDiscoveryMode",
"getBeanDiscoveryMode",
"(",
"CDIRuntime",
"cdiRuntime",
",",
"BeansXml",
"beansXml",
")",
"{",
"BeanDiscoveryMode",
"mode",
"=",
"BeanDiscoveryMode",
".",
"ANNOTATED",
";",
"if",
"(",
"beansXml",
"!=",
"null",
")",
"{",
"mode",
"=",... | Determine the bean deployment archive scanning mode
If there is a beans.xml, the bean discovery mode will be used.
If there is no beans.xml, the mode will be annotated, unless the enableImplicitBeanArchives is configured as false via the server.xml.
If there is no beans.xml and the enableImplicitBeanArchives attribute on cdi12 is configured to false, the scanning mode is none.
@return | [
"Determine",
"the",
"bean",
"deployment",
"archive",
"scanning",
"mode",
"If",
"there",
"is",
"a",
"beans",
".",
"xml",
"the",
"bean",
"discovery",
"mode",
"will",
"be",
"used",
".",
"If",
"there",
"is",
"no",
"beans",
".",
"xml",
"the",
"mode",
"will",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/archive/AbstractCDIArchive.java#L183-L192 |
wcm-io-caravan/caravan-hal | resource/src/main/java/io/wcm/caravan/hal/resource/HalResource.java | HalResource.removeEmbedded | public HalResource removeEmbedded(String relation, int index) {
return removeResource(HalResourceType.EMBEDDED, relation, index);
} | java | public HalResource removeEmbedded(String relation, int index) {
return removeResource(HalResourceType.EMBEDDED, relation, index);
} | [
"public",
"HalResource",
"removeEmbedded",
"(",
"String",
"relation",
",",
"int",
"index",
")",
"{",
"return",
"removeResource",
"(",
"HalResourceType",
".",
"EMBEDDED",
",",
"relation",
",",
"index",
")",
";",
"}"
] | Removes one embedded resource for the given relation and index.
@param relation Embedded resource relation
@param index Array index
@return HAL resource | [
"Removes",
"one",
"embedded",
"resource",
"for",
"the",
"given",
"relation",
"and",
"index",
"."
] | train | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/resource/src/main/java/io/wcm/caravan/hal/resource/HalResource.java#L469-L471 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.updateCertificateIssuerAsync | public ServiceFuture<IssuerBundle> updateCertificateIssuerAsync(String vaultBaseUrl, String issuerName, String provider, IssuerCredentials credentials, OrganizationDetails organizationDetails, IssuerAttributes attributes, final ServiceCallback<IssuerBundle> serviceCallback) {
return ServiceFuture.fromResponse(updateCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName, provider, credentials, organizationDetails, attributes), serviceCallback);
} | java | public ServiceFuture<IssuerBundle> updateCertificateIssuerAsync(String vaultBaseUrl, String issuerName, String provider, IssuerCredentials credentials, OrganizationDetails organizationDetails, IssuerAttributes attributes, final ServiceCallback<IssuerBundle> serviceCallback) {
return ServiceFuture.fromResponse(updateCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName, provider, credentials, organizationDetails, attributes), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"IssuerBundle",
">",
"updateCertificateIssuerAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"issuerName",
",",
"String",
"provider",
",",
"IssuerCredentials",
"credentials",
",",
"OrganizationDetails",
"organizationDetails",
",",
"Is... | Updates the specified certificate issuer.
The UpdateCertificateIssuer operation performs an update on the specified certificate issuer entity. This operation requires the certificates/setissuers permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param issuerName The name of the issuer.
@param provider The issuer provider.
@param credentials The credentials to be used for the issuer.
@param organizationDetails Details of the organization as provided to the issuer.
@param attributes Attributes of the issuer object.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Updates",
"the",
"specified",
"certificate",
"issuer",
".",
"The",
"UpdateCertificateIssuer",
"operation",
"performs",
"an",
"update",
"on",
"the",
"specified",
"certificate",
"issuer",
"entity",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"se... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6222-L6224 |
ops4j/org.ops4j.pax.logging | pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ResolverUtil.java | ResolverUtil.loadImplementationsInJar | private void loadImplementationsInJar(final Test test, final String parent, final File jarFile) {
@SuppressWarnings("resource")
JarInputStream jarStream = null;
try {
jarStream = new JarInputStream(new FileInputStream(jarFile));
loadImplementationsInJar(test, parent, jarFile.getPath(), jarStream);
} catch (final FileNotFoundException ex) {
LOGGER.error("Could not search jar file '" + jarFile + "' for classes matching criteria: " + test
+ " file not found", ex);
} catch (final IOException ioe) {
LOGGER.error("Could not search jar file '" + jarFile + "' for classes matching criteria: " + test
+ " due to an IOException", ioe);
} finally {
close(jarStream, jarFile);
}
} | java | private void loadImplementationsInJar(final Test test, final String parent, final File jarFile) {
@SuppressWarnings("resource")
JarInputStream jarStream = null;
try {
jarStream = new JarInputStream(new FileInputStream(jarFile));
loadImplementationsInJar(test, parent, jarFile.getPath(), jarStream);
} catch (final FileNotFoundException ex) {
LOGGER.error("Could not search jar file '" + jarFile + "' for classes matching criteria: " + test
+ " file not found", ex);
} catch (final IOException ioe) {
LOGGER.error("Could not search jar file '" + jarFile + "' for classes matching criteria: " + test
+ " due to an IOException", ioe);
} finally {
close(jarStream, jarFile);
}
} | [
"private",
"void",
"loadImplementationsInJar",
"(",
"final",
"Test",
"test",
",",
"final",
"String",
"parent",
",",
"final",
"File",
"jarFile",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"JarInputStream",
"jarStream",
"=",
"null",
";",
"try",
... | Finds matching classes within a jar files that contains a folder structure matching the package structure. If the
File is not a JarFile or does not exist a warning will be logged, but no error will be raised.
@param test
a Test used to filter the classes that are discovered
@param parent
the parent package under which classes must be in order to be considered
@param jarFile
the jar file to be examined for classes | [
"Finds",
"matching",
"classes",
"within",
"a",
"jar",
"files",
"that",
"contains",
"a",
"folder",
"structure",
"matching",
"the",
"package",
"structure",
".",
"If",
"the",
"File",
"is",
"not",
"a",
"JarFile",
"or",
"does",
"not",
"exist",
"a",
"warning",
"... | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ResolverUtil.java#L309-L324 |
GerdHolz/TOVAL | src/de/invation/code/toval/graphic/diagrams/panels/ScatterChartPanel.java | ScatterChartPanel.setTickSpacing | public void setTickSpacing(ValueDimension dim, double minorTickSpacing, int multiplicator, boolean repaint) {
double tickSpacing = minorTickSpacing;
if(onlyIntegerTicks.get(dim)) {
tickSpacing = (int) tickSpacing;
if (tickSpacing == 0) tickSpacing = 1;
}
getTickInfo(dim).setTickSpacing(tickSpacing, multiplicator);
if(repaint){
revalidate();
repaint();
}
} | java | public void setTickSpacing(ValueDimension dim, double minorTickSpacing, int multiplicator, boolean repaint) {
double tickSpacing = minorTickSpacing;
if(onlyIntegerTicks.get(dim)) {
tickSpacing = (int) tickSpacing;
if (tickSpacing == 0) tickSpacing = 1;
}
getTickInfo(dim).setTickSpacing(tickSpacing, multiplicator);
if(repaint){
revalidate();
repaint();
}
} | [
"public",
"void",
"setTickSpacing",
"(",
"ValueDimension",
"dim",
",",
"double",
"minorTickSpacing",
",",
"int",
"multiplicator",
",",
"boolean",
"repaint",
")",
"{",
"double",
"tickSpacing",
"=",
"minorTickSpacing",
";",
"if",
"(",
"onlyIntegerTicks",
".",
"get",... | Sets the tick spacing for the coordinate axis of the given dimension.<br>
<value>minorTickSpacing</value> sets the minor tick spacing,
major tick spacing is a multiple of minor tick spacing and determined with the help of <value>multiplicator</value>
@param dim Reference dimension for calculation
@param minorTickSpacing Minor tick spacing
@param multiplicator Multiplicator for detrermining the major tick spacing. | [
"Sets",
"the",
"tick",
"spacing",
"for",
"the",
"coordinate",
"axis",
"of",
"the",
"given",
"dimension",
".",
"<br",
">",
"<value",
">",
"minorTickSpacing<",
"/",
"value",
">",
"sets",
"the",
"minor",
"tick",
"spacing",
"major",
"tick",
"spacing",
"is",
"a... | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/diagrams/panels/ScatterChartPanel.java#L223-L234 |
Nexmo/nexmo-java | src/main/java/com/nexmo/client/auth/RequestSigning.java | RequestSigning.verifyRequestSignature | public static boolean verifyRequestSignature(HttpServletRequest request, String secretKey) {
return verifyRequestSignature(request, secretKey, System.currentTimeMillis());
} | java | public static boolean verifyRequestSignature(HttpServletRequest request, String secretKey) {
return verifyRequestSignature(request, secretKey, System.currentTimeMillis());
} | [
"public",
"static",
"boolean",
"verifyRequestSignature",
"(",
"HttpServletRequest",
"request",
",",
"String",
"secretKey",
")",
"{",
"return",
"verifyRequestSignature",
"(",
"request",
",",
"secretKey",
",",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
... | Verifies the signature in an HttpServletRequest.
@param request The HttpServletRequest to be verified
@param secretKey The pre-shared secret key used by the sender of the request to create the signature
@return true if the signature is correct for this request and secret key. | [
"Verifies",
"the",
"signature",
"in",
"an",
"HttpServletRequest",
"."
] | train | https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/auth/RequestSigning.java#L127-L129 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/execution/buffer/ClientBuffer.java | ClientBuffer.loadPagesIfNecessary | private boolean loadPagesIfNecessary(PagesSupplier pagesSupplier, DataSize maxSize)
{
checkState(!Thread.holdsLock(this), "Can not load pages while holding a lock on this");
boolean dataAddedOrNoMorePages;
List<SerializedPageReference> pageReferences;
synchronized (this) {
if (noMorePages) {
return false;
}
if (!pages.isEmpty()) {
return false;
}
// The page supplier has incremented the page reference count, and addPages below also increments
// the reference count, so we need to drop the page supplier reference. The call dereferencePage
// is performed outside of synchronized to avoid making a callback while holding a lock.
pageReferences = pagesSupplier.getPages(maxSize);
// add the pages to this buffer, which will increase the reference count
addPages(pageReferences);
// check for no more pages
if (!pagesSupplier.mayHaveMorePages()) {
noMorePages = true;
}
dataAddedOrNoMorePages = !pageReferences.isEmpty() || noMorePages;
}
// sent pages will have an initial reference count, so drop it
pageReferences.forEach(SerializedPageReference::dereferencePage);
return dataAddedOrNoMorePages;
} | java | private boolean loadPagesIfNecessary(PagesSupplier pagesSupplier, DataSize maxSize)
{
checkState(!Thread.holdsLock(this), "Can not load pages while holding a lock on this");
boolean dataAddedOrNoMorePages;
List<SerializedPageReference> pageReferences;
synchronized (this) {
if (noMorePages) {
return false;
}
if (!pages.isEmpty()) {
return false;
}
// The page supplier has incremented the page reference count, and addPages below also increments
// the reference count, so we need to drop the page supplier reference. The call dereferencePage
// is performed outside of synchronized to avoid making a callback while holding a lock.
pageReferences = pagesSupplier.getPages(maxSize);
// add the pages to this buffer, which will increase the reference count
addPages(pageReferences);
// check for no more pages
if (!pagesSupplier.mayHaveMorePages()) {
noMorePages = true;
}
dataAddedOrNoMorePages = !pageReferences.isEmpty() || noMorePages;
}
// sent pages will have an initial reference count, so drop it
pageReferences.forEach(SerializedPageReference::dereferencePage);
return dataAddedOrNoMorePages;
} | [
"private",
"boolean",
"loadPagesIfNecessary",
"(",
"PagesSupplier",
"pagesSupplier",
",",
"DataSize",
"maxSize",
")",
"{",
"checkState",
"(",
"!",
"Thread",
".",
"holdsLock",
"(",
"this",
")",
",",
"\"Can not load pages while holding a lock on this\"",
")",
";",
"bool... | If there no data, attempt to load some from the pages supplier. | [
"If",
"there",
"no",
"data",
"attempt",
"to",
"load",
"some",
"from",
"the",
"pages",
"supplier",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/buffer/ClientBuffer.java#L257-L291 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java | GoogleCloudStorageImpl.createItemInfoForBucket | public static GoogleCloudStorageItemInfo createItemInfoForBucket(
StorageResourceId resourceId, Bucket bucket) {
Preconditions.checkArgument(resourceId != null, "resourceId must not be null");
Preconditions.checkArgument(bucket != null, "bucket must not be null");
Preconditions.checkArgument(
resourceId.isBucket(), "resourceId must be a Bucket. resourceId: %s", resourceId);
Preconditions.checkArgument(
resourceId.getBucketName().equals(bucket.getName()),
"resourceId.getBucketName() must equal bucket.getName(): '%s' vs '%s'",
resourceId.getBucketName(), bucket.getName());
// For buckets, size is 0.
return new GoogleCloudStorageItemInfo(resourceId, bucket.getTimeCreated().getValue(),
0, bucket.getLocation(), bucket.getStorageClass());
} | java | public static GoogleCloudStorageItemInfo createItemInfoForBucket(
StorageResourceId resourceId, Bucket bucket) {
Preconditions.checkArgument(resourceId != null, "resourceId must not be null");
Preconditions.checkArgument(bucket != null, "bucket must not be null");
Preconditions.checkArgument(
resourceId.isBucket(), "resourceId must be a Bucket. resourceId: %s", resourceId);
Preconditions.checkArgument(
resourceId.getBucketName().equals(bucket.getName()),
"resourceId.getBucketName() must equal bucket.getName(): '%s' vs '%s'",
resourceId.getBucketName(), bucket.getName());
// For buckets, size is 0.
return new GoogleCloudStorageItemInfo(resourceId, bucket.getTimeCreated().getValue(),
0, bucket.getLocation(), bucket.getStorageClass());
} | [
"public",
"static",
"GoogleCloudStorageItemInfo",
"createItemInfoForBucket",
"(",
"StorageResourceId",
"resourceId",
",",
"Bucket",
"bucket",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"resourceId",
"!=",
"null",
",",
"\"resourceId must not be null\"",
")",
";"... | Helper for converting a StorageResourceId + Bucket into a GoogleCloudStorageItemInfo. | [
"Helper",
"for",
"converting",
"a",
"StorageResourceId",
"+",
"Bucket",
"into",
"a",
"GoogleCloudStorageItemInfo",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java#L1451-L1465 |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/EventHelper.java | EventHelper.printFailureHeader | protected void printFailureHeader(PdfTemplate template, float x, float y) {
Font f = DebugHelper.debugFontLink(template, getSettings());
Chunk c = new Chunk(getSettings().getProperty("failures in report, see end of report", "failureheader"), f);
ColumnText.showTextAligned(template, Element.ALIGN_LEFT, new Phrase(c), x, y, 0);
} | java | protected void printFailureHeader(PdfTemplate template, float x, float y) {
Font f = DebugHelper.debugFontLink(template, getSettings());
Chunk c = new Chunk(getSettings().getProperty("failures in report, see end of report", "failureheader"), f);
ColumnText.showTextAligned(template, Element.ALIGN_LEFT, new Phrase(c), x, y, 0);
} | [
"protected",
"void",
"printFailureHeader",
"(",
"PdfTemplate",
"template",
",",
"float",
"x",
",",
"float",
"y",
")",
"{",
"Font",
"f",
"=",
"DebugHelper",
".",
"debugFontLink",
"(",
"template",
",",
"getSettings",
"(",
")",
")",
";",
"Chunk",
"c",
"=",
... | when failure information is appended to the report, a header on each page will be printed refering to this
information.
@param template
@param x
@param y | [
"when",
"failure",
"information",
"is",
"appended",
"to",
"the",
"report",
"a",
"header",
"on",
"each",
"page",
"will",
"be",
"printed",
"refering",
"to",
"this",
"information",
"."
] | train | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/EventHelper.java#L242-L246 |
mbeiter/util | db/src/main/java/org/beiter/michael/db/ConnectionProperties.java | ConnectionProperties.setAdditionalProperties | public final void setAdditionalProperties(final Map<String, String> additionalProperties) {
// no need for validation, the method will create a new (empty) object if the provided parameter is null.
// create a defensive copy of the map and all its properties
if (additionalProperties == null) {
// create a new (empty) properties map if the provided parameter was null
this.additionalProperties = new ConcurrentHashMap<>();
} else {
// create a defensive copy of the map and all its properties
// the code looks a little more complicated than a simple "putAll()", but it catches situations
// where a Map is provided that supports null values (e.g. a HashMap) vs Map implementations
// that do not (e.g. ConcurrentHashMap).
this.additionalProperties = new ConcurrentHashMap<>();
for (final Map.Entry<String, String> entry : additionalProperties.entrySet()) {
final String key = entry.getKey();
final String value = entry.getValue();
if (value != null) {
this.additionalProperties.put(key, value);
}
}
}
} | java | public final void setAdditionalProperties(final Map<String, String> additionalProperties) {
// no need for validation, the method will create a new (empty) object if the provided parameter is null.
// create a defensive copy of the map and all its properties
if (additionalProperties == null) {
// create a new (empty) properties map if the provided parameter was null
this.additionalProperties = new ConcurrentHashMap<>();
} else {
// create a defensive copy of the map and all its properties
// the code looks a little more complicated than a simple "putAll()", but it catches situations
// where a Map is provided that supports null values (e.g. a HashMap) vs Map implementations
// that do not (e.g. ConcurrentHashMap).
this.additionalProperties = new ConcurrentHashMap<>();
for (final Map.Entry<String, String> entry : additionalProperties.entrySet()) {
final String key = entry.getKey();
final String value = entry.getValue();
if (value != null) {
this.additionalProperties.put(key, value);
}
}
}
} | [
"public",
"final",
"void",
"setAdditionalProperties",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"additionalProperties",
")",
"{",
"// no need for validation, the method will create a new (empty) object if the provided parameter is null.",
"// create a defensive copy of ... | Any additional properties which have not been parsed, and for which no getter/setter exists, but are to be
stored in this object nevertheless.
<p>
This property is commonly used to preserve original properties from upstream components that are to be passed
on to downstream components unchanged. This properties set may or may not include properties that have been
extracted from the map, and been made available through this POJO.
<p>
Note that these additional properties may be <code>null</code> or empty, even in a fully populated POJO where
other properties commonly have values assigned to.
@param additionalProperties The additional properties to store | [
"Any",
"additional",
"properties",
"which",
"have",
"not",
"been",
"parsed",
"and",
"for",
"which",
"no",
"getter",
"/",
"setter",
"exists",
"but",
"are",
"to",
"be",
"stored",
"in",
"this",
"object",
"nevertheless",
".",
"<p",
">",
"This",
"property",
"is... | train | https://github.com/mbeiter/util/blob/490fcebecb936e00c2f2ce2096b679b2fd10865e/db/src/main/java/org/beiter/michael/db/ConnectionProperties.java#L889-L912 |
dlemmermann/CalendarFX | CalendarFXGoogle/src/main/java/com/calendarfx/google/model/GoogleAccount.java | GoogleAccount.createCalendar | public final GoogleCalendar createCalendar(String name, Calendar.Style style) {
GoogleCalendar calendar = new GoogleCalendar();
calendar.setName(name);
calendar.setStyle(style);
return calendar;
} | java | public final GoogleCalendar createCalendar(String name, Calendar.Style style) {
GoogleCalendar calendar = new GoogleCalendar();
calendar.setName(name);
calendar.setStyle(style);
return calendar;
} | [
"public",
"final",
"GoogleCalendar",
"createCalendar",
"(",
"String",
"name",
",",
"Calendar",
".",
"Style",
"style",
")",
"{",
"GoogleCalendar",
"calendar",
"=",
"new",
"GoogleCalendar",
"(",
")",
";",
"calendar",
".",
"setName",
"(",
"name",
")",
";",
"cal... | Creates one single calendar with the given name and style.
@param name The name of the calendar.
@param style The style of the calendar.
@return The new google calendar. | [
"Creates",
"one",
"single",
"calendar",
"with",
"the",
"given",
"name",
"and",
"style",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXGoogle/src/main/java/com/calendarfx/google/model/GoogleAccount.java#L51-L56 |
baratine/baratine | web/src/main/java/com/caucho/v5/log/impl/EnvironmentStream.java | EnvironmentStream.logStderr | public static void logStderr(String msg, Throwable e)
{
try {
long now = CurrentTime.currentTime();
//msg = QDate.formatLocal(now, "[%Y-%m-%d %H:%M:%S] ") + msg;
_origSystemErr.println(msg);
//e.printStackTrace(_origSystemErr.getPrintWriter());
_origSystemErr.flush();
} catch (Throwable e1) {
}
} | java | public static void logStderr(String msg, Throwable e)
{
try {
long now = CurrentTime.currentTime();
//msg = QDate.formatLocal(now, "[%Y-%m-%d %H:%M:%S] ") + msg;
_origSystemErr.println(msg);
//e.printStackTrace(_origSystemErr.getPrintWriter());
_origSystemErr.flush();
} catch (Throwable e1) {
}
} | [
"public",
"static",
"void",
"logStderr",
"(",
"String",
"msg",
",",
"Throwable",
"e",
")",
"{",
"try",
"{",
"long",
"now",
"=",
"CurrentTime",
".",
"currentTime",
"(",
")",
";",
"//msg = QDate.formatLocal(now, \"[%Y-%m-%d %H:%M:%S] \") + msg;",
"_origSystemErr",
"."... | Logs a message to the original stderr in cases where java.util.logging
is dangerous, e.g. in the logging code itself. | [
"Logs",
"a",
"message",
"to",
"the",
"original",
"stderr",
"in",
"cases",
"where",
"java",
".",
"util",
".",
"logging",
"is",
"dangerous",
"e",
".",
"g",
".",
"in",
"the",
"logging",
"code",
"itself",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/log/impl/EnvironmentStream.java#L345-L359 |
JOML-CI/JOML | src/org/joml/Matrix3f.java | Matrix3f.setSkewSymmetric | public Matrix3f setSkewSymmetric(float a, float b, float c) {
m00 = m11 = m22 = 0;
m01 = -a;
m02 = b;
m10 = a;
m12 = -c;
m20 = -b;
m21 = c;
return this;
} | java | public Matrix3f setSkewSymmetric(float a, float b, float c) {
m00 = m11 = m22 = 0;
m01 = -a;
m02 = b;
m10 = a;
m12 = -c;
m20 = -b;
m21 = c;
return this;
} | [
"public",
"Matrix3f",
"setSkewSymmetric",
"(",
"float",
"a",
",",
"float",
"b",
",",
"float",
"c",
")",
"{",
"m00",
"=",
"m11",
"=",
"m22",
"=",
"0",
";",
"m01",
"=",
"-",
"a",
";",
"m02",
"=",
"b",
";",
"m10",
"=",
"a",
";",
"m12",
"=",
"-",... | Set this matrix to a skew-symmetric matrix using the following layout:
<pre>
0, a, -b
-a, 0, c
b, -c, 0
</pre>
Reference: <a href="https://en.wikipedia.org/wiki/Skew-symmetric_matrix">https://en.wikipedia.org</a>
@param a
the value used for the matrix elements m01 and m10
@param b
the value used for the matrix elements m02 and m20
@param c
the value used for the matrix elements m12 and m21
@return this | [
"Set",
"this",
"matrix",
"to",
"a",
"skew",
"-",
"symmetric",
"matrix",
"using",
"the",
"following",
"layout",
":",
"<pre",
">",
"0",
"a",
"-",
"b",
"-",
"a",
"0",
"c",
"b",
"-",
"c",
"0",
"<",
"/",
"pre",
">"
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L3790-L3799 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java | EscapedFunctions2.sqllog10 | public static void sqllog10(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
singleArgumentFunctionCall(buf, "log(", "log10", parsedArgs);
} | java | public static void sqllog10(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
singleArgumentFunctionCall(buf, "log(", "log10", parsedArgs);
} | [
"public",
"static",
"void",
"sqllog10",
"(",
"StringBuilder",
"buf",
",",
"List",
"<",
"?",
"extends",
"CharSequence",
">",
"parsedArgs",
")",
"throws",
"SQLException",
"{",
"singleArgumentFunctionCall",
"(",
"buf",
",",
"\"log(\"",
",",
"\"log10\"",
",",
"parse... | log10 to log translation
@param buf The buffer to append into
@param parsedArgs arguments
@throws SQLException if something wrong happens | [
"log10",
"to",
"log",
"translation"
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java#L109-L111 |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java | AbstractFileStorageEngine.moveDirectory | protected boolean moveDirectory(Path src, Path target) throws IOException {
if(Files.exists(src)) {
createDirectoryIfNotExists(target.getParent());
deleteDirectory(target, false);
Files.move(src, target);
cleanEmptyParentDirectory(src.getParent());
return true;
}
else {
return false;
}
} | java | protected boolean moveDirectory(Path src, Path target) throws IOException {
if(Files.exists(src)) {
createDirectoryIfNotExists(target.getParent());
deleteDirectory(target, false);
Files.move(src, target);
cleanEmptyParentDirectory(src.getParent());
return true;
}
else {
return false;
}
} | [
"protected",
"boolean",
"moveDirectory",
"(",
"Path",
"src",
",",
"Path",
"target",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Files",
".",
"exists",
"(",
"src",
")",
")",
"{",
"createDirectoryIfNotExists",
"(",
"target",
".",
"getParent",
"(",
")",
")... | Moves a directory in the target location.
@param src
@param target
@return
@throws IOException | [
"Moves",
"a",
"directory",
"in",
"the",
"target",
"location",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java#L143-L154 |
qatools/properties | src/main/java/ru/qatools/properties/PropertyLoader.java | PropertyLoader.setValueToField | protected void setValueToField(Field field, Object bean, Object value) {
try {
field.setAccessible(true);
field.set(bean, value);
} catch (Exception e) {
throw new PropertyLoaderException(
String.format("Can not set bean <%s> field <%s> value", bean, field), e
);
}
} | java | protected void setValueToField(Field field, Object bean, Object value) {
try {
field.setAccessible(true);
field.set(bean, value);
} catch (Exception e) {
throw new PropertyLoaderException(
String.format("Can not set bean <%s> field <%s> value", bean, field), e
);
}
} | [
"protected",
"void",
"setValueToField",
"(",
"Field",
"field",
",",
"Object",
"bean",
",",
"Object",
"value",
")",
"{",
"try",
"{",
"field",
".",
"setAccessible",
"(",
"true",
")",
";",
"field",
".",
"set",
"(",
"bean",
",",
"value",
")",
";",
"}",
"... | Set given value to specified field of given object.
@throws PropertyLoaderException if some exceptions occurs during reflection calls.
@see Field#setAccessible(boolean)
@see Field#set(Object, Object) | [
"Set",
"given",
"value",
"to",
"specified",
"field",
"of",
"given",
"object",
"."
] | train | https://github.com/qatools/properties/blob/ae50b460a6bb4fcb21afe888b2e86a7613cd2115/src/main/java/ru/qatools/properties/PropertyLoader.java#L104-L113 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java | CommsUtils.getRuntimeIntProperty | public static int getRuntimeIntProperty(String property, String defaultValue)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getRuntimeIntProperty", new Object[] {property, defaultValue});
// Note that we parse the default value outside of the try / catch so that if we muck
// up then we blow up. Customer settable properties however, we do not want to blow if they
// screw up.
int runtimeProp = Integer.parseInt(defaultValue);
try
{
runtimeProp = Integer.parseInt(RuntimeInfo.getPropertyWithMsg(property, defaultValue));
}
catch (NumberFormatException e)
{
FFDCFilter.processException(e, CLASS_NAME + ".getRuntimeIntProperty" ,
CommsConstants.COMMSUTILS_GETRUNTIMEINT_01);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "NumberFormatException: ", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRuntimeIntProperty", ""+runtimeProp);
return runtimeProp;
} | java | public static int getRuntimeIntProperty(String property, String defaultValue)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getRuntimeIntProperty", new Object[] {property, defaultValue});
// Note that we parse the default value outside of the try / catch so that if we muck
// up then we blow up. Customer settable properties however, we do not want to blow if they
// screw up.
int runtimeProp = Integer.parseInt(defaultValue);
try
{
runtimeProp = Integer.parseInt(RuntimeInfo.getPropertyWithMsg(property, defaultValue));
}
catch (NumberFormatException e)
{
FFDCFilter.processException(e, CLASS_NAME + ".getRuntimeIntProperty" ,
CommsConstants.COMMSUTILS_GETRUNTIMEINT_01);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "NumberFormatException: ", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRuntimeIntProperty", ""+runtimeProp);
return runtimeProp;
} | [
"public",
"static",
"int",
"getRuntimeIntProperty",
"(",
"String",
"property",
",",
"String",
"defaultValue",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
... | This method will get a runtime property from the sib.properties file and will convert the
value (if set) to an int. If the property in the file was set to something that was not
parseable as an integer, then the default value will be returned.
@param property The property key used to look up in the file.
@param defaultValue The default value if the property is not in the file.
@return Returns the property value. | [
"This",
"method",
"will",
"get",
"a",
"runtime",
"property",
"from",
"the",
"sib",
".",
"properties",
"file",
"and",
"will",
"convert",
"the",
"value",
"(",
"if",
"set",
")",
"to",
"an",
"int",
".",
"If",
"the",
"property",
"in",
"the",
"file",
"was",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java#L97-L120 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/ReferenceStream.java | ReferenceStream.removeFirstMatching | public final ItemReference removeFirstMatching(final Filter filter, final Transaction transaction)
throws MessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "removeFirstMatching", new Object[] { filter, transaction });
ReferenceCollection ic = ((ReferenceCollection) _getMembership());
ItemReference item = null;
if (ic != null)
{
item = (ItemReference) ic.removeFirstMatching(filter, transaction);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "removeFirstMatching", item);
return item;
} | java | public final ItemReference removeFirstMatching(final Filter filter, final Transaction transaction)
throws MessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "removeFirstMatching", new Object[] { filter, transaction });
ReferenceCollection ic = ((ReferenceCollection) _getMembership());
ItemReference item = null;
if (ic != null)
{
item = (ItemReference) ic.removeFirstMatching(filter, transaction);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "removeFirstMatching", item);
return item;
} | [
"public",
"final",
"ItemReference",
"removeFirstMatching",
"(",
"final",
"Filter",
"filter",
",",
"final",
"Transaction",
"transaction",
")",
"throws",
"MessageStoreException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
... | removeFirstMatching (aka DestructiveGet).
@param filter
@param transaction
must not be null.
@return Item may be null.
@throws {@link MessageStoreException} if the item was spilled and could not
be unspilled. Or if item not found in backing store.
@throws {@link MessageStoreException} indicates that an unrecoverable exception has
occurred in the underlying persistence mechanism.
@throws MessageStoreException | [
"removeFirstMatching",
"(",
"aka",
"DestructiveGet",
")",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/ReferenceStream.java#L549-L565 |
kaazing/gateway | transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java | LoggingUtils.addSession | public static String addSession(String message, IoSession session) {
return format("[%s] %s", getId(session), message);
} | java | public static String addSession(String message, IoSession session) {
return format("[%s] %s", getId(session), message);
} | [
"public",
"static",
"String",
"addSession",
"(",
"String",
"message",
",",
"IoSession",
"session",
")",
"{",
"return",
"format",
"(",
"\"[%s] %s\"",
",",
"getId",
"(",
"session",
")",
",",
"message",
")",
";",
"}"
] | Prepends short session details (result of getId) for the session in square brackets to the message.
@param message the message to be logged
@param session an instance of IoSessionEx
@return example: "[wsn#34 127.0.0.0.1:41234] this is the log message" | [
"Prepends",
"short",
"session",
"details",
"(",
"result",
"of",
"getId",
")",
"for",
"the",
"session",
"in",
"square",
"brackets",
"to",
"the",
"message",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java#L55-L57 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java | OverlyConcreteParameter.methodIsSpecial | private static boolean methodIsSpecial(String methodName, String methodSig) {
return SignatureBuilder.SIG_READ_OBJECT.equals(methodName + methodSig);
} | java | private static boolean methodIsSpecial(String methodName, String methodSig) {
return SignatureBuilder.SIG_READ_OBJECT.equals(methodName + methodSig);
} | [
"private",
"static",
"boolean",
"methodIsSpecial",
"(",
"String",
"methodName",
",",
"String",
"methodSig",
")",
"{",
"return",
"SignatureBuilder",
".",
"SIG_READ_OBJECT",
".",
"equals",
"(",
"methodName",
"+",
"methodSig",
")",
";",
"}"
] | determines whether the method is a baked in special method of the jdk
@param methodName the method name to check
@param methodSig the parameter signature of the method to check
@return if it is a well known baked in method | [
"determines",
"whether",
"the",
"method",
"is",
"a",
"baked",
"in",
"special",
"method",
"of",
"the",
"jdk"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java#L357-L359 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/ForkOperatorUtils.java | ForkOperatorUtils.getPropertyNameForBranch | public static String getPropertyNameForBranch(String key, int numBranches, int branchId) {
Preconditions.checkArgument(numBranches >= 0, "The number of branches is expected to be non-negative");
Preconditions.checkArgument(branchId >= 0, "The branchId is expected to be non-negative");
return numBranches > 1 ? key + "." + branchId : key;
} | java | public static String getPropertyNameForBranch(String key, int numBranches, int branchId) {
Preconditions.checkArgument(numBranches >= 0, "The number of branches is expected to be non-negative");
Preconditions.checkArgument(branchId >= 0, "The branchId is expected to be non-negative");
return numBranches > 1 ? key + "." + branchId : key;
} | [
"public",
"static",
"String",
"getPropertyNameForBranch",
"(",
"String",
"key",
",",
"int",
"numBranches",
",",
"int",
"branchId",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"numBranches",
">=",
"0",
",",
"\"The number of branches is expected to be non-negati... | Get a new property key from an original one with branch index (if applicable).
@param key property key
@param numBranches number of branches (non-negative)
@param branchId branch id (non-negative)
@return a new property key | [
"Get",
"a",
"new",
"property",
"key",
"from",
"an",
"original",
"one",
"with",
"branch",
"index",
"(",
"if",
"applicable",
")",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ForkOperatorUtils.java#L45-L49 |
lessthanoptimal/ddogleg | src/org/ddogleg/clustering/FactoryClustering.java | FactoryClustering.gaussianMixtureModelEM_F64 | public static ExpectationMaximizationGmm_F64 gaussianMixtureModelEM_F64(
int maxIterations, int maxConverge , double convergeTol) {
StandardKMeans_F64 kmeans = kMeans_F64(null,maxIterations,maxConverge,convergeTol);
SeedFromKMeans_F64 seeds = new SeedFromKMeans_F64(kmeans);
return new ExpectationMaximizationGmm_F64(maxIterations,convergeTol,seeds);
} | java | public static ExpectationMaximizationGmm_F64 gaussianMixtureModelEM_F64(
int maxIterations, int maxConverge , double convergeTol) {
StandardKMeans_F64 kmeans = kMeans_F64(null,maxIterations,maxConverge,convergeTol);
SeedFromKMeans_F64 seeds = new SeedFromKMeans_F64(kmeans);
return new ExpectationMaximizationGmm_F64(maxIterations,convergeTol,seeds);
} | [
"public",
"static",
"ExpectationMaximizationGmm_F64",
"gaussianMixtureModelEM_F64",
"(",
"int",
"maxIterations",
",",
"int",
"maxConverge",
",",
"double",
"convergeTol",
")",
"{",
"StandardKMeans_F64",
"kmeans",
"=",
"kMeans_F64",
"(",
"null",
",",
"maxIterations",
",",... | <p>
High level interface for creating GMM cluster. If more flexibility is needed (e.g. custom seeds)
then create and instance of {@link ExpectationMaximizationGmm_F64} directly
</p>
<p>WARNING: DEVELOPMENTAL AND IS LIKELY TO FAIL HORRIBLY</p>
@param maxIterations Maximum number of iterations it will perform.
@param maxConverge Maximum iterations allowed before convergence. Re-seeded if it doesn't converge.
@param convergeTol Distance based convergence tolerance. Try 1e-8
@return ExpectationMaximizationGmm_F64 | [
"<p",
">",
"High",
"level",
"interface",
"for",
"creating",
"GMM",
"cluster",
".",
"If",
"more",
"flexibility",
"is",
"needed",
"(",
"e",
".",
"g",
".",
"custom",
"seeds",
")",
"then",
"create",
"and",
"instance",
"of",
"{",
"@link",
"ExpectationMaximizati... | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/clustering/FactoryClustering.java#L48-L55 |
SahaginOrg/sahagin-java | src/main/java/org/sahagin/share/yaml/YamlUtils.java | YamlUtils.getIntValue | public static Integer getIntValue(Map<String, Object> yamlObject, String key, boolean allowsEmpty)
throws YamlConvertException {
Object obj = getObjectValue(yamlObject, key, allowsEmpty);
if (obj == null && allowsEmpty) {
return null;
}
String objStr;
if (obj == null) {
objStr = null;
} else {
objStr = obj.toString();
}
try {
return new Integer(objStr);
} catch (NumberFormatException e) {
throw new YamlConvertException(String.format(MSG_VALUE_NOT_INT, key, objStr));
}
} | java | public static Integer getIntValue(Map<String, Object> yamlObject, String key, boolean allowsEmpty)
throws YamlConvertException {
Object obj = getObjectValue(yamlObject, key, allowsEmpty);
if (obj == null && allowsEmpty) {
return null;
}
String objStr;
if (obj == null) {
objStr = null;
} else {
objStr = obj.toString();
}
try {
return new Integer(objStr);
} catch (NumberFormatException e) {
throw new YamlConvertException(String.format(MSG_VALUE_NOT_INT, key, objStr));
}
} | [
"public",
"static",
"Integer",
"getIntValue",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"yamlObject",
",",
"String",
"key",
",",
"boolean",
"allowsEmpty",
")",
"throws",
"YamlConvertException",
"{",
"Object",
"obj",
"=",
"getObjectValue",
"(",
"yamlObject",... | if allowsEmpty, returns null for the case no key entry or null value | [
"if",
"allowsEmpty",
"returns",
"null",
"for",
"the",
"case",
"no",
"key",
"entry",
"or",
"null",
"value"
] | train | https://github.com/SahaginOrg/sahagin-java/blob/7ace428adebe3466ceb5826bc9681f8e3d52be68/src/main/java/org/sahagin/share/yaml/YamlUtils.java#L111-L128 |
lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/CalculateDateExtensions.java | CalculateDateExtensions.addHours | public static Date addHours(final Date date, final int addHours)
{
final Calendar dateOnCalendar = Calendar.getInstance();
dateOnCalendar.setTime(date);
dateOnCalendar.add(Calendar.HOUR, addHours);
return dateOnCalendar.getTime();
} | java | public static Date addHours(final Date date, final int addHours)
{
final Calendar dateOnCalendar = Calendar.getInstance();
dateOnCalendar.setTime(date);
dateOnCalendar.add(Calendar.HOUR, addHours);
return dateOnCalendar.getTime();
} | [
"public",
"static",
"Date",
"addHours",
"(",
"final",
"Date",
"date",
",",
"final",
"int",
"addHours",
")",
"{",
"final",
"Calendar",
"dateOnCalendar",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"dateOnCalendar",
".",
"setTime",
"(",
"date",
")",
... | Adds hours to the given Date object and returns it. Note: you can add negative values too for
get date in past.
@param date
The Date object to add the hours.
@param addHours
The days to add.
@return The resulted Date object. | [
"Adds",
"hours",
"to",
"the",
"given",
"Date",
"object",
"and",
"returns",
"it",
".",
"Note",
":",
"you",
"can",
"add",
"negative",
"values",
"too",
"for",
"get",
"date",
"in",
"past",
"."
] | train | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L74-L80 |
teatrove/teatrove | trove/src/main/java/org/teatrove/trove/classfile/ConstantIntegerInfo.java | ConstantIntegerInfo.make | static ConstantIntegerInfo make(ConstantPool cp, int value) {
ConstantInfo ci = new ConstantIntegerInfo(value);
return (ConstantIntegerInfo)cp.addConstant(ci);
} | java | static ConstantIntegerInfo make(ConstantPool cp, int value) {
ConstantInfo ci = new ConstantIntegerInfo(value);
return (ConstantIntegerInfo)cp.addConstant(ci);
} | [
"static",
"ConstantIntegerInfo",
"make",
"(",
"ConstantPool",
"cp",
",",
"int",
"value",
")",
"{",
"ConstantInfo",
"ci",
"=",
"new",
"ConstantIntegerInfo",
"(",
"value",
")",
";",
"return",
"(",
"ConstantIntegerInfo",
")",
"cp",
".",
"addConstant",
"(",
"ci",
... | Will return either a new ConstantIntegerInfo object or one already in
the constant pool. If it is a new ConstantIntegerInfo, it will be
inserted into the pool. | [
"Will",
"return",
"either",
"a",
"new",
"ConstantIntegerInfo",
"object",
"or",
"one",
"already",
"in",
"the",
"constant",
"pool",
".",
"If",
"it",
"is",
"a",
"new",
"ConstantIntegerInfo",
"it",
"will",
"be",
"inserted",
"into",
"the",
"pool",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ConstantIntegerInfo.java#L35-L38 |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.removePathPrefix | public static final String removePathPrefix(File prefix, File file) {
final String r = file.getAbsolutePath().replaceFirst(
"^" //$NON-NLS-1$
+ Pattern.quote(prefix.getAbsolutePath()),
EMPTY_STRING);
if (r.startsWith(File.separator)) {
return r.substring(File.separator.length());
}
return r;
} | java | public static final String removePathPrefix(File prefix, File file) {
final String r = file.getAbsolutePath().replaceFirst(
"^" //$NON-NLS-1$
+ Pattern.quote(prefix.getAbsolutePath()),
EMPTY_STRING);
if (r.startsWith(File.separator)) {
return r.substring(File.separator.length());
}
return r;
} | [
"public",
"static",
"final",
"String",
"removePathPrefix",
"(",
"File",
"prefix",
",",
"File",
"file",
")",
"{",
"final",
"String",
"r",
"=",
"file",
".",
"getAbsolutePath",
"(",
")",
".",
"replaceFirst",
"(",
"\"^\"",
"//$NON-NLS-1$",
"+",
"Pattern",
".",
... | Remove the path prefix from a file.
@param prefix path prefix to remove.
@param file input filename.
@return the {@code file} without the prefix. | [
"Remove",
"the",
"path",
"prefix",
"from",
"a",
"file",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L398-L407 |
kakawait/cas-security-spring-boot-starter | spring-security-cas-extension/src/main/java/com/kakawait/spring/security/cas/client/CasAuthorizationInterceptor.java | CasAuthorizationInterceptor.intercept | @Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
throws IOException {
String service = request.getURI().toASCIIString();
String proxyTicket = proxyTicketProvider.getProxyTicket(service);
if (!StringUtils.hasText(proxyTicket)) {
throw new IllegalStateException(
String.format("Proxy ticket provider returned a null proxy ticket for service %s.", service));
}
URI uri = UriComponentsBuilder
.fromUri(request.getURI())
.replaceQueryParam(serviceProperties.getArtifactParameter(), proxyTicket)
.build().toUri();
return execution.execute(new HttpRequestWrapper(request) {
@Override
public URI getURI() {
return uri;
}
}, body);
} | java | @Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
throws IOException {
String service = request.getURI().toASCIIString();
String proxyTicket = proxyTicketProvider.getProxyTicket(service);
if (!StringUtils.hasText(proxyTicket)) {
throw new IllegalStateException(
String.format("Proxy ticket provider returned a null proxy ticket for service %s.", service));
}
URI uri = UriComponentsBuilder
.fromUri(request.getURI())
.replaceQueryParam(serviceProperties.getArtifactParameter(), proxyTicket)
.build().toUri();
return execution.execute(new HttpRequestWrapper(request) {
@Override
public URI getURI() {
return uri;
}
}, body);
} | [
"@",
"Override",
"public",
"ClientHttpResponse",
"intercept",
"(",
"HttpRequest",
"request",
",",
"byte",
"[",
"]",
"body",
",",
"ClientHttpRequestExecution",
"execution",
")",
"throws",
"IOException",
"{",
"String",
"service",
"=",
"request",
".",
"getURI",
"(",
... | {@inheritDoc}
@throws IllegalStateException if proxy ticket retrieves from {@link ProxyTicketProvider#getProxyTicket(String)}
is null or blank | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/kakawait/cas-security-spring-boot-starter/blob/f42e7829f6f3ff1f64803a09577bca3c6f60e347/spring-security-cas-extension/src/main/java/com/kakawait/spring/security/cas/client/CasAuthorizationInterceptor.java#L42-L61 |
redkale/redkale | src/org/redkale/net/http/MultiPart.java | MultiPart.save | public boolean save(long max, OutputStream out) throws IOException {
byte[] bytes = new byte[4096];
int pos;
InputStream in0 = this.getInputStream();
while ((pos = in0.read(bytes)) != -1) {
if (max < 0) return false;
out.write(bytes, 0, pos);
max -= pos;
}
return true;
} | java | public boolean save(long max, OutputStream out) throws IOException {
byte[] bytes = new byte[4096];
int pos;
InputStream in0 = this.getInputStream();
while ((pos = in0.read(bytes)) != -1) {
if (max < 0) return false;
out.write(bytes, 0, pos);
max -= pos;
}
return true;
} | [
"public",
"boolean",
"save",
"(",
"long",
"max",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"4096",
"]",
";",
"int",
"pos",
";",
"InputStream",
"in0",
"=",
"this",
".",
"getInputSt... | 将文件流写进out, 如果超出max指定的值则中断并返回false
@param max 最大长度限制
@param out 输出流
@return 是否成功
@throws IOException 异常 | [
"将文件流写进out,",
"如果超出max指定的值则中断并返回false"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/MultiPart.java#L80-L90 |
lucee/Lucee | core/src/main/java/lucee/runtime/schedule/StorageUtil.java | StorageUtil.toResource | public Resource toResource(Config config, Element el, String attributeName) {
String attributeValue = el.getAttribute(attributeName);
if (attributeValue == null || attributeValue.trim().length() == 0) return null;
return config.getResource(attributeValue);
} | java | public Resource toResource(Config config, Element el, String attributeName) {
String attributeValue = el.getAttribute(attributeName);
if (attributeValue == null || attributeValue.trim().length() == 0) return null;
return config.getResource(attributeValue);
} | [
"public",
"Resource",
"toResource",
"(",
"Config",
"config",
",",
"Element",
"el",
",",
"String",
"attributeName",
")",
"{",
"String",
"attributeValue",
"=",
"el",
".",
"getAttribute",
"(",
"attributeName",
")",
";",
"if",
"(",
"attributeValue",
"==",
"null",
... | /*
public File toFile(Element el,String attributeName) { String attributeValue =
el.getAttribute(attributeName); if(attributeValue==null || attributeValue.trim().length()==0)
return null; return new File(attributeValue); } | [
"/",
"*",
"public",
"File",
"toFile",
"(",
"Element",
"el",
"String",
"attributeName",
")",
"{",
"String",
"attributeValue",
"=",
"el",
".",
"getAttribute",
"(",
"attributeName",
")",
";",
"if",
"(",
"attributeValue",
"==",
"null",
"||",
"attributeValue",
".... | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L173-L177 |
threerings/nenya | core/src/main/java/com/threerings/media/image/ImageManager.java | ImageManager.getMirage | public Mirage getMirage (ImageKey key, Rectangle bounds, Colorization[] zations)
{
BufferedImage src = null;
if (bounds == null) {
// if they specified no bounds, we need to load up the raw image and determine its
// bounds so that we can pass those along to the created mirage
src = getImage(key, zations);
bounds = new Rectangle(0, 0, src.getWidth(), src.getHeight());
}
return new CachedVolatileMirage(this, key, bounds, zations);
} | java | public Mirage getMirage (ImageKey key, Rectangle bounds, Colorization[] zations)
{
BufferedImage src = null;
if (bounds == null) {
// if they specified no bounds, we need to load up the raw image and determine its
// bounds so that we can pass those along to the created mirage
src = getImage(key, zations);
bounds = new Rectangle(0, 0, src.getWidth(), src.getHeight());
}
return new CachedVolatileMirage(this, key, bounds, zations);
} | [
"public",
"Mirage",
"getMirage",
"(",
"ImageKey",
"key",
",",
"Rectangle",
"bounds",
",",
"Colorization",
"[",
"]",
"zations",
")",
"{",
"BufferedImage",
"src",
"=",
"null",
";",
"if",
"(",
"bounds",
"==",
"null",
")",
"{",
"// if they specified no bounds, we ... | Like {@link #getMirage(ImageKey,Colorization[])} except that the mirage is created using
only the specified subset of the original image. | [
"Like",
"{"
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L356-L367 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/utils/TextUtils.java | TextUtils.splitUnescape | public static String[] splitUnescape(String input, char separator, char echar, char[] special) {
return splitUnescape(input, new char[]{separator}, echar, special);
} | java | public static String[] splitUnescape(String input, char separator, char echar, char[] special) {
return splitUnescape(input, new char[]{separator}, echar, special);
} | [
"public",
"static",
"String",
"[",
"]",
"splitUnescape",
"(",
"String",
"input",
",",
"char",
"separator",
",",
"char",
"echar",
",",
"char",
"[",
"]",
"special",
")",
"{",
"return",
"splitUnescape",
"(",
"input",
",",
"new",
"char",
"[",
"]",
"{",
"se... | Split the input on the given separator char, and unescape each portion using the escape char and special chars
@param input input string
@param separator char separating each component
@param echar escape char
@param special chars that are escaped
@return results | [
"Split",
"the",
"input",
"on",
"the",
"given",
"separator",
"char",
"and",
"unescape",
"each",
"portion",
"using",
"the",
"escape",
"char",
"and",
"special",
"chars"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/TextUtils.java#L218-L220 |
apache/incubator-shardingsphere | sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/payload/MySQLPacketPayload.java | MySQLPacketPayload.readStringNulByBytes | public byte[] readStringNulByBytes() {
byte[] result = new byte[byteBuf.bytesBefore((byte) 0)];
byteBuf.readBytes(result);
byteBuf.skipBytes(1);
return result;
} | java | public byte[] readStringNulByBytes() {
byte[] result = new byte[byteBuf.bytesBefore((byte) 0)];
byteBuf.readBytes(result);
byteBuf.skipBytes(1);
return result;
} | [
"public",
"byte",
"[",
"]",
"readStringNulByBytes",
"(",
")",
"{",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"byteBuf",
".",
"bytesBefore",
"(",
"(",
"byte",
")",
"0",
")",
"]",
";",
"byteBuf",
".",
"readBytes",
"(",
"result",
")",
";",
... | Read null terminated string from byte buffers and return bytes.
@see <a href="https://dev.mysql.com/doc/internals/en/string.html#packet-Protocol::NulTerminatedString">NulTerminatedString</a>
@return null terminated bytes | [
"Read",
"null",
"terminated",
"string",
"from",
"byte",
"buffers",
"and",
"return",
"bytes",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/payload/MySQLPacketPayload.java#L380-L385 |
apache/groovy | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.executeUpdate | public int executeUpdate(String sql, Object[] params) throws SQLException {
return executeUpdate(sql, Arrays.asList(params));
} | java | public int executeUpdate(String sql, Object[] params) throws SQLException {
return executeUpdate(sql, Arrays.asList(params));
} | [
"public",
"int",
"executeUpdate",
"(",
"String",
"sql",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"SQLException",
"{",
"return",
"executeUpdate",
"(",
"sql",
",",
"Arrays",
".",
"asList",
"(",
"params",
")",
")",
";",
"}"
] | Executes the given SQL update with parameters.
<p>
An Object array variant of {@link #executeUpdate(String, List)}.
@param sql the SQL statement
@param params an array of parameters
@return the number of rows updated or 0 for SQL statements that return nothing
@throws SQLException if a database access error occurs | [
"Executes",
"the",
"given",
"SQL",
"update",
"with",
"parameters",
".",
"<p",
">",
"An",
"Object",
"array",
"variant",
"of",
"{",
"@link",
"#executeUpdate",
"(",
"String",
"List",
")",
"}",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L2958-L2960 |
landawn/AbacusUtil | src/com/landawn/abacus/util/DoubleList.java | DoubleList.noneMatch | public <E extends Exception> boolean noneMatch(Try.DoublePredicate<E> filter) throws E {
return noneMatch(0, size(), filter);
} | java | public <E extends Exception> boolean noneMatch(Try.DoublePredicate<E> filter) throws E {
return noneMatch(0, size(), filter);
} | [
"public",
"<",
"E",
"extends",
"Exception",
">",
"boolean",
"noneMatch",
"(",
"Try",
".",
"DoublePredicate",
"<",
"E",
">",
"filter",
")",
"throws",
"E",
"{",
"return",
"noneMatch",
"(",
"0",
",",
"size",
"(",
")",
",",
"filter",
")",
";",
"}"
] | Returns whether no elements of this List match the provided predicate.
@param filter
@return | [
"Returns",
"whether",
"no",
"elements",
"of",
"this",
"List",
"match",
"the",
"provided",
"predicate",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DoubleList.java#L951-L953 |
joniles/mpxj | src/main/java/net/sf/mpxj/CustomFieldContainer.java | CustomFieldContainer.getCustomField | public CustomField getCustomField(FieldType field)
{
CustomField result = m_configMap.get(field);
if (result == null)
{
result = new CustomField(field, this);
m_configMap.put(field, result);
}
return result;
} | java | public CustomField getCustomField(FieldType field)
{
CustomField result = m_configMap.get(field);
if (result == null)
{
result = new CustomField(field, this);
m_configMap.put(field, result);
}
return result;
} | [
"public",
"CustomField",
"getCustomField",
"(",
"FieldType",
"field",
")",
"{",
"CustomField",
"result",
"=",
"m_configMap",
".",
"get",
"(",
"field",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"new",
"CustomField",
"(",
"field",... | Retrieve configuration details for a given custom field.
@param field required custom field
@return configuration detail | [
"Retrieve",
"configuration",
"details",
"for",
"a",
"given",
"custom",
"field",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/CustomFieldContainer.java#L44-L53 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/JTables.java | JTables.setDerivedFont | private static void setDerivedFont(JTable t, float size)
{
t.setFont(t.getFont().deriveFont(size));
t.getTableHeader().setFont(
t.getTableHeader().getFont().deriveFont(size));
} | java | private static void setDerivedFont(JTable t, float size)
{
t.setFont(t.getFont().deriveFont(size));
t.getTableHeader().setFont(
t.getTableHeader().getFont().deriveFont(size));
} | [
"private",
"static",
"void",
"setDerivedFont",
"(",
"JTable",
"t",
",",
"float",
"size",
")",
"{",
"t",
".",
"setFont",
"(",
"t",
".",
"getFont",
"(",
")",
".",
"deriveFont",
"(",
"size",
")",
")",
";",
"t",
".",
"getTableHeader",
"(",
")",
".",
"s... | Set a derived font with the given size for the given
table and its header
@param t The table
@param size The font size | [
"Set",
"a",
"derived",
"font",
"with",
"the",
"given",
"size",
"for",
"the",
"given",
"table",
"and",
"its",
"header"
] | train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/JTables.java#L168-L173 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_resiliationTerms_GET | public OvhResiliationTerms packName_resiliationTerms_GET(String packName, Date resiliationDate) throws IOException {
String qPath = "/pack/xdsl/{packName}/resiliationTerms";
StringBuilder sb = path(qPath, packName);
query(sb, "resiliationDate", resiliationDate);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhResiliationTerms.class);
} | java | public OvhResiliationTerms packName_resiliationTerms_GET(String packName, Date resiliationDate) throws IOException {
String qPath = "/pack/xdsl/{packName}/resiliationTerms";
StringBuilder sb = path(qPath, packName);
query(sb, "resiliationDate", resiliationDate);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhResiliationTerms.class);
} | [
"public",
"OvhResiliationTerms",
"packName_resiliationTerms_GET",
"(",
"String",
"packName",
",",
"Date",
"resiliationDate",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xdsl/{packName}/resiliationTerms\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"... | Get resiliation terms
REST: GET /pack/xdsl/{packName}/resiliationTerms
@param resiliationDate [required] The desired resiliation date
@param packName [required] The internal name of your pack | [
"Get",
"resiliation",
"terms"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L743-L749 |
BigBadaboom/androidsvg | androidsvg/src/main/java/com/caverock/androidsvg/SimpleAssetResolver.java | SimpleAssetResolver.resolveFont | @Override
public Typeface resolveFont(String fontFamily, int fontWeight, String fontStyle)
{
Log.i(TAG, "resolveFont("+fontFamily+","+fontWeight+","+fontStyle+")");
// Try font name with suffix ".ttf"
try
{
return Typeface.createFromAsset(assetManager, fontFamily + ".ttf");
}
catch (RuntimeException ignored) {}
// That failed, so try ".otf"
try
{
return Typeface.createFromAsset(assetManager, fontFamily + ".otf");
}
catch (RuntimeException e)
{
return null;
}
} | java | @Override
public Typeface resolveFont(String fontFamily, int fontWeight, String fontStyle)
{
Log.i(TAG, "resolveFont("+fontFamily+","+fontWeight+","+fontStyle+")");
// Try font name with suffix ".ttf"
try
{
return Typeface.createFromAsset(assetManager, fontFamily + ".ttf");
}
catch (RuntimeException ignored) {}
// That failed, so try ".otf"
try
{
return Typeface.createFromAsset(assetManager, fontFamily + ".otf");
}
catch (RuntimeException e)
{
return null;
}
} | [
"@",
"Override",
"public",
"Typeface",
"resolveFont",
"(",
"String",
"fontFamily",
",",
"int",
"fontWeight",
",",
"String",
"fontStyle",
")",
"{",
"Log",
".",
"i",
"(",
"TAG",
",",
"\"resolveFont(\"",
"+",
"fontFamily",
"+",
"\",\"",
"+",
"fontWeight",
"+",
... | Attempt to find the specified font in the "assets" folder and return a Typeface object.
For the font name "Foo", first the file "Foo.ttf" will be tried and if that fails, "Foo.otf". | [
"Attempt",
"to",
"find",
"the",
"specified",
"font",
"in",
"the",
"assets",
"folder",
"and",
"return",
"a",
"Typeface",
"object",
".",
"For",
"the",
"font",
"name",
"Foo",
"first",
"the",
"file",
"Foo",
".",
"ttf",
"will",
"be",
"tried",
"and",
"if",
"... | train | https://github.com/BigBadaboom/androidsvg/blob/0d1614dd1a4da10ea4afe3b0cea1361a4ac6b45a/androidsvg/src/main/java/com/caverock/androidsvg/SimpleAssetResolver.java#L78-L99 |
Netflix/eureka | eureka-core/src/main/java/com/netflix/eureka/aws/AwsAsgUtil.java | AwsAsgUtil.isASGEnabledinAWS | private Boolean isASGEnabledinAWS(String asgAccountid, String asgName) {
try {
Stopwatch t = this.loadASGInfoTimer.start();
boolean returnValue = !isAddToLoadBalancerSuspended(asgAccountid, asgName);
t.stop();
return returnValue;
} catch (Throwable e) {
logger.error("Could not get ASG information from AWS: ", e);
}
return Boolean.TRUE;
} | java | private Boolean isASGEnabledinAWS(String asgAccountid, String asgName) {
try {
Stopwatch t = this.loadASGInfoTimer.start();
boolean returnValue = !isAddToLoadBalancerSuspended(asgAccountid, asgName);
t.stop();
return returnValue;
} catch (Throwable e) {
logger.error("Could not get ASG information from AWS: ", e);
}
return Boolean.TRUE;
} | [
"private",
"Boolean",
"isASGEnabledinAWS",
"(",
"String",
"asgAccountid",
",",
"String",
"asgName",
")",
"{",
"try",
"{",
"Stopwatch",
"t",
"=",
"this",
".",
"loadASGInfoTimer",
".",
"start",
"(",
")",
";",
"boolean",
"returnValue",
"=",
"!",
"isAddToLoadBalan... | Queries AWS to see if the load balancer flag is suspended.
@param asgAccountid the accountId this asg resides in, if applicable (null will use the default accountId)
@param asgName the name of the asg
@return true, if the load balancer flag is not suspended, false otherwise. | [
"Queries",
"AWS",
"to",
"see",
"if",
"the",
"load",
"balancer",
"flag",
"is",
"suspended",
"."
] | train | https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/aws/AwsAsgUtil.java#L326-L336 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CRLSelector.java | X509CRLSelector.addIssuerNameInternal | private void addIssuerNameInternal(Object name, X500Principal principal) {
if (issuerNames == null) {
issuerNames = new HashSet<Object>();
}
if (issuerX500Principals == null) {
issuerX500Principals = new HashSet<X500Principal>();
}
issuerNames.add(name);
issuerX500Principals.add(principal);
} | java | private void addIssuerNameInternal(Object name, X500Principal principal) {
if (issuerNames == null) {
issuerNames = new HashSet<Object>();
}
if (issuerX500Principals == null) {
issuerX500Principals = new HashSet<X500Principal>();
}
issuerNames.add(name);
issuerX500Principals.add(principal);
} | [
"private",
"void",
"addIssuerNameInternal",
"(",
"Object",
"name",
",",
"X500Principal",
"principal",
")",
"{",
"if",
"(",
"issuerNames",
"==",
"null",
")",
"{",
"issuerNames",
"=",
"new",
"HashSet",
"<",
"Object",
">",
"(",
")",
";",
"}",
"if",
"(",
"is... | A private method that adds a name (String or byte array) to the
issuerNames criterion. The issuer distinguished
name in the {@code X509CRL} must match at least one of the specified
distinguished names.
@param name the name in string or byte array form
@param principal the name in X500Principal form
@throws IOException if a parsing error occurs | [
"A",
"private",
"method",
"that",
"adds",
"a",
"name",
"(",
"String",
"or",
"byte",
"array",
")",
"to",
"the",
"issuerNames",
"criterion",
".",
"The",
"issuer",
"distinguished",
"name",
"in",
"the",
"{",
"@code",
"X509CRL",
"}",
"must",
"match",
"at",
"l... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CRLSelector.java#L289-L298 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/model/AxiomType_CustomFieldSerializer.java | AxiomType_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, AxiomType instance) throws SerializationException {
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, AxiomType instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"AxiomType",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/model/AxiomType_CustomFieldSerializer.java#L82-L85 |
opoo/opoopress | core/src/main/java/org/opoo/press/impl/SiteConfigImpl.java | SiteConfigImpl.resolveConfigFiles | private File[] resolveConfigFiles(File base, Map<String, Object> override) {
//system properties
//-Dconfig=config.json -> override
//Override
if (override != null) {
String configFilesString = (String) override.remove("config");
if (StringUtils.isNotBlank(configFilesString)) {
log.info("Using config files: {}", configFilesString);
String[] strings = StringUtils.split(configFilesString, ',');
File[] files = new File[strings.length];
for (int i = 0; i < strings.length; i++) {
files[i] = new File(base, strings[i]);
}
return files;
}
}
//default
useDefaultConfigFiles = true;
return base.listFiles(DEFAULT_CONFIG_FILES_FILTER);
} | java | private File[] resolveConfigFiles(File base, Map<String, Object> override) {
//system properties
//-Dconfig=config.json -> override
//Override
if (override != null) {
String configFilesString = (String) override.remove("config");
if (StringUtils.isNotBlank(configFilesString)) {
log.info("Using config files: {}", configFilesString);
String[] strings = StringUtils.split(configFilesString, ',');
File[] files = new File[strings.length];
for (int i = 0; i < strings.length; i++) {
files[i] = new File(base, strings[i]);
}
return files;
}
}
//default
useDefaultConfigFiles = true;
return base.listFiles(DEFAULT_CONFIG_FILES_FILTER);
} | [
"private",
"File",
"[",
"]",
"resolveConfigFiles",
"(",
"File",
"base",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"override",
")",
"{",
"//system properties",
"//-Dconfig=config.json -> override",
"//Override",
"if",
"(",
"override",
"!=",
"null",
")",
"{",... | Find all config files.
@param base site base site
@param override command options, system properties, etc.
@return | [
"Find",
"all",
"config",
"files",
"."
] | train | https://github.com/opoo/opoopress/blob/4ed0265d294c8b748be48cf097949aa905ff1df2/core/src/main/java/org/opoo/press/impl/SiteConfigImpl.java#L173-L194 |
sonyxperiadev/gerrit-events | src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshUtil.java | SshUtil.checkPassPhrase | public static boolean checkPassPhrase(File keyFilePath, String passPhrase) {
KeyPair key = parsePrivateKeyFile(keyFilePath);
boolean isValidPhrase = passPhrase != null && !passPhrase.trim().isEmpty();
if (key == null) {
return false;
} else if (key.isEncrypted() != isValidPhrase) {
return false;
} else if (key.isEncrypted()) {
return key.decrypt(passPhrase);
}
return true;
} | java | public static boolean checkPassPhrase(File keyFilePath, String passPhrase) {
KeyPair key = parsePrivateKeyFile(keyFilePath);
boolean isValidPhrase = passPhrase != null && !passPhrase.trim().isEmpty();
if (key == null) {
return false;
} else if (key.isEncrypted() != isValidPhrase) {
return false;
} else if (key.isEncrypted()) {
return key.decrypt(passPhrase);
}
return true;
} | [
"public",
"static",
"boolean",
"checkPassPhrase",
"(",
"File",
"keyFilePath",
",",
"String",
"passPhrase",
")",
"{",
"KeyPair",
"key",
"=",
"parsePrivateKeyFile",
"(",
"keyFilePath",
")",
";",
"boolean",
"isValidPhrase",
"=",
"passPhrase",
"!=",
"null",
"&&",
"!... | Checks to see if the passPhrase is valid for the private key file.
@param keyFilePath the private key file.
@param passPhrase the password for the file.
@return true if it is valid. | [
"Checks",
"to",
"see",
"if",
"the",
"passPhrase",
"is",
"valid",
"for",
"the",
"private",
"key",
"file",
"."
] | train | https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshUtil.java#L79-L90 |
mjdbc/mjdbc | src/main/java/com/github/mjdbc/DbPreparedStatement.java | DbPreparedStatement.bindBean | @NotNull
public DbPreparedStatement<T> bindBean(@NotNull Db db, @NotNull Object bean, boolean allowCustomFields) throws SQLException {
List<BindInfo> binders = ((DbImpl) db).getBeanBinders(bean.getClass());
for (String key : parametersMapping.keySet()) {
BindInfo info = binders.stream().filter(i -> i.mappedName.equals(key)).findFirst().orElse(null);
if (info == null) {
if (allowCustomFields) {
continue;
}
throw new SQLException("No mapping found for field: " + key);
}
try {
bindArg(this, info, getIndexes(key), bean);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new SQLException("Error applying bean properties: " + bean, e);
}
}
return this;
} | java | @NotNull
public DbPreparedStatement<T> bindBean(@NotNull Db db, @NotNull Object bean, boolean allowCustomFields) throws SQLException {
List<BindInfo> binders = ((DbImpl) db).getBeanBinders(bean.getClass());
for (String key : parametersMapping.keySet()) {
BindInfo info = binders.stream().filter(i -> i.mappedName.equals(key)).findFirst().orElse(null);
if (info == null) {
if (allowCustomFields) {
continue;
}
throw new SQLException("No mapping found for field: " + key);
}
try {
bindArg(this, info, getIndexes(key), bean);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new SQLException("Error applying bean properties: " + bean, e);
}
}
return this;
} | [
"@",
"NotNull",
"public",
"DbPreparedStatement",
"<",
"T",
">",
"bindBean",
"(",
"@",
"NotNull",
"Db",
"db",
",",
"@",
"NotNull",
"Object",
"bean",
",",
"boolean",
"allowCustomFields",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"BindInfo",
">",
"binder... | Sets all bean properties to named parameters.
@param db database to use. This method call relies on binders registered in this database instance.
@param bean bean to map to named SQL parameters.
@param allowCustomFields if false and SQL contains keys not resolved with this bean -> SQLException will be thrown.
@return this.
@throws SQLException if anything bad happens during SQL operations or bean field accessors calls. | [
"Sets",
"all",
"bean",
"properties",
"to",
"named",
"parameters",
"."
] | train | https://github.com/mjdbc/mjdbc/blob/9db720a5b3218df38a1e5e59459045234bb6386b/src/main/java/com/github/mjdbc/DbPreparedStatement.java#L255-L273 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/jmx/JMXUtils.java | JMXUtils.getObjectName | static ObjectName getObjectName(String type, String name) {
try {
return new ObjectName(JMXUtils.class.getPackage().getName() + ":type=" + type + ",name=" + name);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | static ObjectName getObjectName(String type, String name) {
try {
return new ObjectName(JMXUtils.class.getPackage().getName() + ":type=" + type + ",name=" + name);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"static",
"ObjectName",
"getObjectName",
"(",
"String",
"type",
",",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"new",
"ObjectName",
"(",
"JMXUtils",
".",
"class",
".",
"getPackage",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\":type=\"",
"+",
"typ... | Gets the object name.
@param type the type
@param name the name
@return the object name | [
"Gets",
"the",
"object",
"name",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/jmx/JMXUtils.java#L46-L52 |
alkacon/opencms-core | src/org/opencms/main/CmsShellCommands.java | CmsShellCommands.createWebOU | public CmsOrganizationalUnit createWebOU(String ouFqn, String description, boolean hideLogin) {
try {
return OpenCms.getOrgUnitManager().createOrganizationalUnit(
m_cms,
ouFqn,
description,
(hideLogin ? CmsOrganizationalUnit.FLAG_HIDE_LOGIN : 0) | CmsOrganizationalUnit.FLAG_WEBUSERS,
null);
} catch (CmsException e) {
// TODO Auto-generated catch block
m_shell.getOut().println(
getMessages().key(Messages.GUI_SHELL_WEB_OU_CREATION_FAILED_2, ouFqn, description));
return null;
}
} | java | public CmsOrganizationalUnit createWebOU(String ouFqn, String description, boolean hideLogin) {
try {
return OpenCms.getOrgUnitManager().createOrganizationalUnit(
m_cms,
ouFqn,
description,
(hideLogin ? CmsOrganizationalUnit.FLAG_HIDE_LOGIN : 0) | CmsOrganizationalUnit.FLAG_WEBUSERS,
null);
} catch (CmsException e) {
// TODO Auto-generated catch block
m_shell.getOut().println(
getMessages().key(Messages.GUI_SHELL_WEB_OU_CREATION_FAILED_2, ouFqn, description));
return null;
}
} | [
"public",
"CmsOrganizationalUnit",
"createWebOU",
"(",
"String",
"ouFqn",
",",
"String",
"description",
",",
"boolean",
"hideLogin",
")",
"{",
"try",
"{",
"return",
"OpenCms",
".",
"getOrgUnitManager",
"(",
")",
".",
"createOrganizationalUnit",
"(",
"m_cms",
",",
... | Create a web OU
@param ouFqn the fully qualified name of the OU
@param description the description of the OU
@param hideLogin flag, indicating if the OU should be hidden from the login form.
@return the created OU, or <code>null</code> if creation fails. | [
"Create",
"a",
"web",
"OU",
"@param",
"ouFqn",
"the",
"fully",
"qualified",
"name",
"of",
"the",
"OU",
"@param",
"description",
"the",
"description",
"of",
"the",
"OU",
"@param",
"hideLogin",
"flag",
"indicating",
"if",
"the",
"OU",
"should",
"be",
"hidden",... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L434-L449 |
AgNO3/jcifs-ng | src/main/java/jcifs/Config.java | Config.getLong | public static long getLong ( Properties props, String key, long def ) {
String s = props.getProperty(key);
if ( s != null ) {
try {
def = Long.parseLong(s);
}
catch ( NumberFormatException nfe ) {
log.error("Not a number", nfe);
}
}
return def;
} | java | public static long getLong ( Properties props, String key, long def ) {
String s = props.getProperty(key);
if ( s != null ) {
try {
def = Long.parseLong(s);
}
catch ( NumberFormatException nfe ) {
log.error("Not a number", nfe);
}
}
return def;
} | [
"public",
"static",
"long",
"getLong",
"(",
"Properties",
"props",
",",
"String",
"key",
",",
"long",
"def",
")",
"{",
"String",
"s",
"=",
"props",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"try",
"{",
"def",... | Retrieve a <code>long</code>. If the key does not exist or
cannot be converted to a <code>long</code>, the provided default
argument will be returned. | [
"Retrieve",
"a",
"<code",
">",
"long<",
"/",
"code",
">",
".",
"If",
"the",
"key",
"does",
"not",
"exist",
"or",
"cannot",
"be",
"converted",
"to",
"a",
"<code",
">",
"long<",
"/",
"code",
">",
"the",
"provided",
"default",
"argument",
"will",
"be",
... | train | https://github.com/AgNO3/jcifs-ng/blob/0311107a077ea372527ae74839eec8042197332f/src/main/java/jcifs/Config.java#L116-L127 |
tomgibara/streams | src/main/java/com/tomgibara/streams/StreamBytes.java | StreamBytes.readStream | public ReadStream readStream() {
detachWriter();
if (reader == null) {
reader = new BytesReadStream(bytes, 0, length);
}
return reader;
} | java | public ReadStream readStream() {
detachWriter();
if (reader == null) {
reader = new BytesReadStream(bytes, 0, length);
}
return reader;
} | [
"public",
"ReadStream",
"readStream",
"(",
")",
"{",
"detachWriter",
"(",
")",
";",
"if",
"(",
"reader",
"==",
"null",
")",
"{",
"reader",
"=",
"new",
"BytesReadStream",
"(",
"bytes",
",",
"0",
",",
"length",
")",
";",
"}",
"return",
"reader",
";",
"... | Attaches a reader to the object. If there is already any attached reader,
the existing reader is returned. If a writer is attached to the object
when this method is called, the writer is closed and immediately detached
before the reader is created.
@return the reader attached to this object | [
"Attaches",
"a",
"reader",
"to",
"the",
"object",
".",
"If",
"there",
"is",
"already",
"any",
"attached",
"reader",
"the",
"existing",
"reader",
"is",
"returned",
".",
"If",
"a",
"writer",
"is",
"attached",
"to",
"the",
"object",
"when",
"this",
"method",
... | train | https://github.com/tomgibara/streams/blob/553dc97293a1f1fd2d88e08d26e19369e9ffa6d3/src/main/java/com/tomgibara/streams/StreamBytes.java#L125-L131 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/NormalizationPoint2D.java | NormalizationPoint2D.apply | public void apply( DMatrixRMaj H , DMatrixRMaj output ) {
output.reshape(3,H.numCols);
int stride = H.numCols;
for (int col = 0; col < H.numCols; col++) {
// This column in H
double h1 = H.data[col], h2 = H.data[col+stride], h3 = H.data[col+2*stride];
output.data[col] = h1/stdX - meanX*h3/stdX;
output.data[col+stride] = h2/stdY - meanY*h3/stdY;
output.data[col+2*stride] = h3;
}
} | java | public void apply( DMatrixRMaj H , DMatrixRMaj output ) {
output.reshape(3,H.numCols);
int stride = H.numCols;
for (int col = 0; col < H.numCols; col++) {
// This column in H
double h1 = H.data[col], h2 = H.data[col+stride], h3 = H.data[col+2*stride];
output.data[col] = h1/stdX - meanX*h3/stdX;
output.data[col+stride] = h2/stdY - meanY*h3/stdY;
output.data[col+2*stride] = h3;
}
} | [
"public",
"void",
"apply",
"(",
"DMatrixRMaj",
"H",
",",
"DMatrixRMaj",
"output",
")",
"{",
"output",
".",
"reshape",
"(",
"3",
",",
"H",
".",
"numCols",
")",
";",
"int",
"stride",
"=",
"H",
".",
"numCols",
";",
"for",
"(",
"int",
"col",
"=",
"0",
... | Applies normalization to a H=3xN matrix
out = Norm*H
@param H 3xN matrix. Can be same as input matrix | [
"Applies",
"normalization",
"to",
"a",
"H",
"=",
"3xN",
"matrix"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/NormalizationPoint2D.java#L76-L87 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.