repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
listlengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
listlengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java | Apptentive.showMessageCenter | public static void showMessageCenter(final Context context, final BooleanCallback callback, final Map<String, Object> customData) {
"""
Opens the Apptentive Message Center UI Activity, and allows custom data to be sent with the
next message the user sends. If the user sends multiple messages, this data will only be sent
with the first message sent after this method is invoked. Additional invocations of this method
with custom data will repeat this process. If Message Center is closed without a message being
sent, the custom data is cleared. This task is performed asynchronously. Message Center
configuration may not have been downloaded yet when this is called.
@param context The context from which to launch the Message Center. This should be an
Activity, except in rare cases where you don't have access to one, in which
case Apptentive Message Center will launch in a new task.
@param callback Called after we check to see if Message Center can be displayed, but before
it is displayed. Called with true if an Interaction will be displayed, else
false.
@param customData A Map of String keys to Object values. Objects may be Strings, Numbers, or
Booleans. If any message is sent by the Person, this data is sent with it,
and then cleared. If no message is sent, this data is discarded.
"""
dispatchConversationTask(new ConversationDispatchTask(callback, DispatchQueue.mainQueue()) {
@Override
protected boolean execute(Conversation conversation) {
return ApptentiveInternal.getInstance().showMessageCenterInternal(context, customData);
}
}, "show message center");
} | java | public static void showMessageCenter(final Context context, final BooleanCallback callback, final Map<String, Object> customData) {
dispatchConversationTask(new ConversationDispatchTask(callback, DispatchQueue.mainQueue()) {
@Override
protected boolean execute(Conversation conversation) {
return ApptentiveInternal.getInstance().showMessageCenterInternal(context, customData);
}
}, "show message center");
} | [
"public",
"static",
"void",
"showMessageCenter",
"(",
"final",
"Context",
"context",
",",
"final",
"BooleanCallback",
"callback",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"customData",
")",
"{",
"dispatchConversationTask",
"(",
"new",
"ConversationDispatchTask",
"(",
"callback",
",",
"DispatchQueue",
".",
"mainQueue",
"(",
")",
")",
"{",
"@",
"Override",
"protected",
"boolean",
"execute",
"(",
"Conversation",
"conversation",
")",
"{",
"return",
"ApptentiveInternal",
".",
"getInstance",
"(",
")",
".",
"showMessageCenterInternal",
"(",
"context",
",",
"customData",
")",
";",
"}",
"}",
",",
"\"show message center\"",
")",
";",
"}"
]
| Opens the Apptentive Message Center UI Activity, and allows custom data to be sent with the
next message the user sends. If the user sends multiple messages, this data will only be sent
with the first message sent after this method is invoked. Additional invocations of this method
with custom data will repeat this process. If Message Center is closed without a message being
sent, the custom data is cleared. This task is performed asynchronously. Message Center
configuration may not have been downloaded yet when this is called.
@param context The context from which to launch the Message Center. This should be an
Activity, except in rare cases where you don't have access to one, in which
case Apptentive Message Center will launch in a new task.
@param callback Called after we check to see if Message Center can be displayed, but before
it is displayed. Called with true if an Interaction will be displayed, else
false.
@param customData A Map of String keys to Object values. Objects may be Strings, Numbers, or
Booleans. If any message is sent by the Person, this data is sent with it,
and then cleared. If no message is sent, this data is discarded. | [
"Opens",
"the",
"Apptentive",
"Message",
"Center",
"UI",
"Activity",
"and",
"allows",
"custom",
"data",
"to",
"be",
"sent",
"with",
"the",
"next",
"message",
"the",
"user",
"sends",
".",
"If",
"the",
"user",
"sends",
"multiple",
"messages",
"this",
"data",
"will",
"only",
"be",
"sent",
"with",
"the",
"first",
"message",
"sent",
"after",
"this",
"method",
"is",
"invoked",
".",
"Additional",
"invocations",
"of",
"this",
"method",
"with",
"custom",
"data",
"will",
"repeat",
"this",
"process",
".",
"If",
"Message",
"Center",
"is",
"closed",
"without",
"a",
"message",
"being",
"sent",
"the",
"custom",
"data",
"is",
"cleared",
".",
"This",
"task",
"is",
"performed",
"asynchronously",
".",
"Message",
"Center",
"configuration",
"may",
"not",
"have",
"been",
"downloaded",
"yet",
"when",
"this",
"is",
"called",
"."
]
| train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L953-L960 |
STIXProject/java-stix | src/main/java/org/mitre/stix/DocumentUtilities.java | DocumentUtilities.toXMLString | public static String toXMLString(JAXBElement<?> jaxbElement,
boolean prettyPrint) {
"""
Returns a String for a JAXBElement
@param jaxbElement
JAXB representation of an XML Element to be printed.
@param prettyPrint
True for pretty print, otherwise false
@return String containing the XML mark-up.
"""
Document document = toDocument(jaxbElement);
return toXMLString(document, prettyPrint);
} | java | public static String toXMLString(JAXBElement<?> jaxbElement,
boolean prettyPrint) {
Document document = toDocument(jaxbElement);
return toXMLString(document, prettyPrint);
} | [
"public",
"static",
"String",
"toXMLString",
"(",
"JAXBElement",
"<",
"?",
">",
"jaxbElement",
",",
"boolean",
"prettyPrint",
")",
"{",
"Document",
"document",
"=",
"toDocument",
"(",
"jaxbElement",
")",
";",
"return",
"toXMLString",
"(",
"document",
",",
"prettyPrint",
")",
";",
"}"
]
| Returns a String for a JAXBElement
@param jaxbElement
JAXB representation of an XML Element to be printed.
@param prettyPrint
True for pretty print, otherwise false
@return String containing the XML mark-up. | [
"Returns",
"a",
"String",
"for",
"a",
"JAXBElement"
]
| train | https://github.com/STIXProject/java-stix/blob/796b1314253fac3ebafca347f6eeb2c51ba4b009/src/main/java/org/mitre/stix/DocumentUtilities.java#L177-L184 |
UrielCh/ovh-java-sdk | ovh-java-sdk-core/src/main/java/net/minidev/ovh/core/ApiOvhCore.java | ApiOvhCore.registerHandler | public void registerHandler(String method, String url, OphApiHandler handler) {
"""
register and handlet linked to a method
@param method
GET PUT POST DELETE or ALL
@param url
@param handler
"""
if (mtdHandler == null)
mtdHandler = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
TreeMap<String, OphApiHandler> reg;
if (method == null)
method = "ALL";
reg = mtdHandler.get(method);
if (reg == null) {
reg = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
mtdHandler.put(method, reg);
}
reg.put(url, handler);
} | java | public void registerHandler(String method, String url, OphApiHandler handler) {
if (mtdHandler == null)
mtdHandler = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
TreeMap<String, OphApiHandler> reg;
if (method == null)
method = "ALL";
reg = mtdHandler.get(method);
if (reg == null) {
reg = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
mtdHandler.put(method, reg);
}
reg.put(url, handler);
} | [
"public",
"void",
"registerHandler",
"(",
"String",
"method",
",",
"String",
"url",
",",
"OphApiHandler",
"handler",
")",
"{",
"if",
"(",
"mtdHandler",
"==",
"null",
")",
"mtdHandler",
"=",
"new",
"TreeMap",
"<>",
"(",
"String",
".",
"CASE_INSENSITIVE_ORDER",
")",
";",
"TreeMap",
"<",
"String",
",",
"OphApiHandler",
">",
"reg",
";",
"if",
"(",
"method",
"==",
"null",
")",
"method",
"=",
"\"ALL\"",
";",
"reg",
"=",
"mtdHandler",
".",
"get",
"(",
"method",
")",
";",
"if",
"(",
"reg",
"==",
"null",
")",
"{",
"reg",
"=",
"new",
"TreeMap",
"<>",
"(",
"String",
".",
"CASE_INSENSITIVE_ORDER",
")",
";",
"mtdHandler",
".",
"put",
"(",
"method",
",",
"reg",
")",
";",
"}",
"reg",
".",
"put",
"(",
"url",
",",
"handler",
")",
";",
"}"
]
| register and handlet linked to a method
@param method
GET PUT POST DELETE or ALL
@param url
@param handler | [
"register",
"and",
"handlet",
"linked",
"to",
"a",
"method"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-core/src/main/java/net/minidev/ovh/core/ApiOvhCore.java#L62-L75 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowVersionsInner.java | WorkflowVersionsInner.listCallbackUrl | public WorkflowTriggerCallbackUrlInner listCallbackUrl(String resourceGroupName, String workflowName, String versionId, String triggerName, GetCallbackUrlParameters parameters) {
"""
Get the callback url for a trigger of a workflow version.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param versionId The workflow versionId.
@param triggerName The workflow trigger name.
@param parameters The callback URL parameters.
@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 WorkflowTriggerCallbackUrlInner object if successful.
"""
return listCallbackUrlWithServiceResponseAsync(resourceGroupName, workflowName, versionId, triggerName, parameters).toBlocking().single().body();
} | java | public WorkflowTriggerCallbackUrlInner listCallbackUrl(String resourceGroupName, String workflowName, String versionId, String triggerName, GetCallbackUrlParameters parameters) {
return listCallbackUrlWithServiceResponseAsync(resourceGroupName, workflowName, versionId, triggerName, parameters).toBlocking().single().body();
} | [
"public",
"WorkflowTriggerCallbackUrlInner",
"listCallbackUrl",
"(",
"String",
"resourceGroupName",
",",
"String",
"workflowName",
",",
"String",
"versionId",
",",
"String",
"triggerName",
",",
"GetCallbackUrlParameters",
"parameters",
")",
"{",
"return",
"listCallbackUrlWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"workflowName",
",",
"versionId",
",",
"triggerName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
]
| Get the callback url for a trigger of a workflow version.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param versionId The workflow versionId.
@param triggerName The workflow trigger name.
@param parameters The callback URL parameters.
@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 WorkflowTriggerCallbackUrlInner object if successful. | [
"Get",
"the",
"callback",
"url",
"for",
"a",
"trigger",
"of",
"a",
"workflow",
"version",
"."
]
| 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/WorkflowVersionsInner.java#L527-L529 |
square/javapoet | src/main/java/com/squareup/javapoet/ParameterizedTypeName.java | ParameterizedTypeName.nestedClass | public ParameterizedTypeName nestedClass(String name) {
"""
Returns a new {@link ParameterizedTypeName} instance for the specified {@code name} as nested
inside this class.
"""
checkNotNull(name, "name == null");
return new ParameterizedTypeName(this, rawType.nestedClass(name), new ArrayList<>(),
new ArrayList<>());
} | java | public ParameterizedTypeName nestedClass(String name) {
checkNotNull(name, "name == null");
return new ParameterizedTypeName(this, rawType.nestedClass(name), new ArrayList<>(),
new ArrayList<>());
} | [
"public",
"ParameterizedTypeName",
"nestedClass",
"(",
"String",
"name",
")",
"{",
"checkNotNull",
"(",
"name",
",",
"\"name == null\"",
")",
";",
"return",
"new",
"ParameterizedTypeName",
"(",
"this",
",",
"rawType",
".",
"nestedClass",
"(",
"name",
")",
",",
"new",
"ArrayList",
"<>",
"(",
")",
",",
"new",
"ArrayList",
"<>",
"(",
")",
")",
";",
"}"
]
| Returns a new {@link ParameterizedTypeName} instance for the specified {@code name} as nested
inside this class. | [
"Returns",
"a",
"new",
"{"
]
| train | https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/ParameterizedTypeName.java#L96-L100 |
eurekaclinical/eurekaclinical-common | src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java | EurekaClinicalClient.doPostCreate | protected URI doPostCreate(String path, Object o, MultivaluedMap<String, String> headers) throws ClientException {
"""
Creates a resource specified as a JSON object.
@param path the the API to call.
@param o the object that will be converted to JSON for sending. Must
either be a Java bean or be recognized by the object mapper.
@param headers If no Content Type header is provided, this method adds a
Content Type header for JSON.
@return the URI representing the created resource, for use in subsequent
operations on the resource.
@throws ClientException if a status code other than 200 (OK) and 201
(Created) is returned.
"""
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.POST).getRequestBuilder();
requestBuilder = ensurePostCreateJsonHeaders(headers, requestBuilder, true, false);
ClientResponse response = requestBuilder.post(ClientResponse.class, o);
errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.CREATED);
try {
return response.getLocation();
} finally {
response.close();
}
} catch (ClientHandlerException ex) {
throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage());
} finally {
this.readLock.unlock();
}
} | java | protected URI doPostCreate(String path, Object o, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.POST).getRequestBuilder();
requestBuilder = ensurePostCreateJsonHeaders(headers, requestBuilder, true, false);
ClientResponse response = requestBuilder.post(ClientResponse.class, o);
errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.CREATED);
try {
return response.getLocation();
} finally {
response.close();
}
} catch (ClientHandlerException ex) {
throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage());
} finally {
this.readLock.unlock();
}
} | [
"protected",
"URI",
"doPostCreate",
"(",
"String",
"path",
",",
"Object",
"o",
",",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"headers",
")",
"throws",
"ClientException",
"{",
"this",
".",
"readLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"WebResource",
".",
"Builder",
"requestBuilder",
"=",
"getResourceWrapper",
"(",
")",
".",
"rewritten",
"(",
"path",
",",
"HttpMethod",
".",
"POST",
")",
".",
"getRequestBuilder",
"(",
")",
";",
"requestBuilder",
"=",
"ensurePostCreateJsonHeaders",
"(",
"headers",
",",
"requestBuilder",
",",
"true",
",",
"false",
")",
";",
"ClientResponse",
"response",
"=",
"requestBuilder",
".",
"post",
"(",
"ClientResponse",
".",
"class",
",",
"o",
")",
";",
"errorIfStatusNotEqualTo",
"(",
"response",
",",
"ClientResponse",
".",
"Status",
".",
"OK",
",",
"ClientResponse",
".",
"Status",
".",
"CREATED",
")",
";",
"try",
"{",
"return",
"response",
".",
"getLocation",
"(",
")",
";",
"}",
"finally",
"{",
"response",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"ClientHandlerException",
"ex",
")",
"{",
"throw",
"new",
"ClientException",
"(",
"ClientResponse",
".",
"Status",
".",
"INTERNAL_SERVER_ERROR",
",",
"ex",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"finally",
"{",
"this",
".",
"readLock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
]
| Creates a resource specified as a JSON object.
@param path the the API to call.
@param o the object that will be converted to JSON for sending. Must
either be a Java bean or be recognized by the object mapper.
@param headers If no Content Type header is provided, this method adds a
Content Type header for JSON.
@return the URI representing the created resource, for use in subsequent
operations on the resource.
@throws ClientException if a status code other than 200 (OK) and 201
(Created) is returned. | [
"Creates",
"a",
"resource",
"specified",
"as",
"a",
"JSON",
"object",
"."
]
| train | https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L754-L771 |
bwkimmel/jdcp | jdcp-core/src/main/java/ca/eandb/jdcp/remote/JobStatus.java | JobStatus.withNewEventId | public JobStatus withNewEventId() {
"""
Creates a copy of this <code>JobStatus</code> with an auto-generated
event ID. The event ID will be greater than any previously generated
event ID.
@return A copy of this <code>JobStatus</code> with an auto-generated
event ID.
"""
return new JobStatus(jobId, description, state, Double.NaN, status, getNextEventId());
} | java | public JobStatus withNewEventId() {
return new JobStatus(jobId, description, state, Double.NaN, status, getNextEventId());
} | [
"public",
"JobStatus",
"withNewEventId",
"(",
")",
"{",
"return",
"new",
"JobStatus",
"(",
"jobId",
",",
"description",
",",
"state",
",",
"Double",
".",
"NaN",
",",
"status",
",",
"getNextEventId",
"(",
")",
")",
";",
"}"
]
| Creates a copy of this <code>JobStatus</code> with an auto-generated
event ID. The event ID will be greater than any previously generated
event ID.
@return A copy of this <code>JobStatus</code> with an auto-generated
event ID. | [
"Creates",
"a",
"copy",
"of",
"this",
"<code",
">",
"JobStatus<",
"/",
"code",
">",
"with",
"an",
"auto",
"-",
"generated",
"event",
"ID",
".",
"The",
"event",
"ID",
"will",
"be",
"greater",
"than",
"any",
"previously",
"generated",
"event",
"ID",
"."
]
| train | https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-core/src/main/java/ca/eandb/jdcp/remote/JobStatus.java#L174-L176 |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/client/CheerleaderClient.java | CheerleaderClient.getInstance | private static CheerleaderClient getInstance(Context context, String clientId, String artistName) {
"""
Simple Sound cloud client initialized with a client id.
@param context context used to instantiate internal components, no hard reference will be kept.
@param clientId sound cloud client id.
@param artistName sound cloud artiste name.
@return instance of {@link CheerleaderClient}
"""
if (clientId == null) {
throw new IllegalArgumentException("Sound cloud client id can't be null.");
}
if (artistName == null) {
throw new IllegalArgumentException("Sound cloud artistName can't be null.");
}
if (sInstance == null || sInstance.mIsClosed) {
sInstance = new CheerleaderClient(context.getApplicationContext(), clientId, artistName);
} else {
sInstance.mRequestSignatorInterceptor.setClientId(clientId);
sInstance.mClientKey = clientId;
sInstance.mArtistName = artistName;
}
return sInstance;
} | java | private static CheerleaderClient getInstance(Context context, String clientId, String artistName) {
if (clientId == null) {
throw new IllegalArgumentException("Sound cloud client id can't be null.");
}
if (artistName == null) {
throw new IllegalArgumentException("Sound cloud artistName can't be null.");
}
if (sInstance == null || sInstance.mIsClosed) {
sInstance = new CheerleaderClient(context.getApplicationContext(), clientId, artistName);
} else {
sInstance.mRequestSignatorInterceptor.setClientId(clientId);
sInstance.mClientKey = clientId;
sInstance.mArtistName = artistName;
}
return sInstance;
} | [
"private",
"static",
"CheerleaderClient",
"getInstance",
"(",
"Context",
"context",
",",
"String",
"clientId",
",",
"String",
"artistName",
")",
"{",
"if",
"(",
"clientId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Sound cloud client id can't be null.\"",
")",
";",
"}",
"if",
"(",
"artistName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Sound cloud artistName can't be null.\"",
")",
";",
"}",
"if",
"(",
"sInstance",
"==",
"null",
"||",
"sInstance",
".",
"mIsClosed",
")",
"{",
"sInstance",
"=",
"new",
"CheerleaderClient",
"(",
"context",
".",
"getApplicationContext",
"(",
")",
",",
"clientId",
",",
"artistName",
")",
";",
"}",
"else",
"{",
"sInstance",
".",
"mRequestSignatorInterceptor",
".",
"setClientId",
"(",
"clientId",
")",
";",
"sInstance",
".",
"mClientKey",
"=",
"clientId",
";",
"sInstance",
".",
"mArtistName",
"=",
"artistName",
";",
"}",
"return",
"sInstance",
";",
"}"
]
| Simple Sound cloud client initialized with a client id.
@param context context used to instantiate internal components, no hard reference will be kept.
@param clientId sound cloud client id.
@param artistName sound cloud artiste name.
@return instance of {@link CheerleaderClient} | [
"Simple",
"Sound",
"cloud",
"client",
"initialized",
"with",
"a",
"client",
"id",
"."
]
| train | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/client/CheerleaderClient.java#L169-L184 |
wanglinsong/thx-webservice | src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java | WebServiceCommunication.setClientCertificate | public void setClientCertificate(String clientCertificate, String keyPassword) {
"""
Calls this to provide client certificate.
@param clientCertificate client certificate file
@param keyPassword client certificate password
"""
LOG.debug("use client certificate/password {}/********", clientCertificate);
this.clientCertificate = clientCertificate;
this.keyPassword = keyPassword;
} | java | public void setClientCertificate(String clientCertificate, String keyPassword) {
LOG.debug("use client certificate/password {}/********", clientCertificate);
this.clientCertificate = clientCertificate;
this.keyPassword = keyPassword;
} | [
"public",
"void",
"setClientCertificate",
"(",
"String",
"clientCertificate",
",",
"String",
"keyPassword",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"use client certificate/password {}/********\"",
",",
"clientCertificate",
")",
";",
"this",
".",
"clientCertificate",
"=",
"clientCertificate",
";",
"this",
".",
"keyPassword",
"=",
"keyPassword",
";",
"}"
]
| Calls this to provide client certificate.
@param clientCertificate client certificate file
@param keyPassword client certificate password | [
"Calls",
"this",
"to",
"provide",
"client",
"certificate",
"."
]
| train | https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java#L359-L363 |
goldmansachs/reladomo | reladomogen/src/main/java/com/gs/fw/common/mithra/generator/SourceFormatter.java | SourceFormatter.formatLine | public void formatLine(String line, PrintWriter writer) {
"""
blank line rules: 1) no consecutive blank line 2) no blank line after an open brace 3) no blank line before a closing brace
"""
processingState.setLine(line);
processingState.pwriter = writer;
processingState = processingState.formatState.formatPartialLine(processingState);
while (!processingState.isDoneWithLine())
{
processingState = processingState.formatState.formatPartialLine(processingState);
}
} | java | public void formatLine(String line, PrintWriter writer)
{
processingState.setLine(line);
processingState.pwriter = writer;
processingState = processingState.formatState.formatPartialLine(processingState);
while (!processingState.isDoneWithLine())
{
processingState = processingState.formatState.formatPartialLine(processingState);
}
} | [
"public",
"void",
"formatLine",
"(",
"String",
"line",
",",
"PrintWriter",
"writer",
")",
"{",
"processingState",
".",
"setLine",
"(",
"line",
")",
";",
"processingState",
".",
"pwriter",
"=",
"writer",
";",
"processingState",
"=",
"processingState",
".",
"formatState",
".",
"formatPartialLine",
"(",
"processingState",
")",
";",
"while",
"(",
"!",
"processingState",
".",
"isDoneWithLine",
"(",
")",
")",
"{",
"processingState",
"=",
"processingState",
".",
"formatState",
".",
"formatPartialLine",
"(",
"processingState",
")",
";",
"}",
"}"
]
| blank line rules: 1) no consecutive blank line 2) no blank line after an open brace 3) no blank line before a closing brace | [
"blank",
"line",
"rules",
":",
"1",
")",
"no",
"consecutive",
"blank",
"line",
"2",
")",
"no",
"blank",
"line",
"after",
"an",
"open",
"brace",
"3",
")",
"no",
"blank",
"line",
"before",
"a",
"closing",
"brace"
]
| train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomogen/src/main/java/com/gs/fw/common/mithra/generator/SourceFormatter.java#L44-L53 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java | NDArrayMath.lengthPerSlice | public static long lengthPerSlice(INDArray arr, int... dimension) {
"""
The number of elements in a slice
along a set of dimensions
@param arr the array
to calculate the length per slice for
@param dimension the dimensions to do the calculations along
@return the number of elements in a slice along
arbitrary dimensions
"""
long[] remove = ArrayUtil.removeIndex(arr.shape(), dimension);
return ArrayUtil.prodLong(remove);
} | java | public static long lengthPerSlice(INDArray arr, int... dimension) {
long[] remove = ArrayUtil.removeIndex(arr.shape(), dimension);
return ArrayUtil.prodLong(remove);
} | [
"public",
"static",
"long",
"lengthPerSlice",
"(",
"INDArray",
"arr",
",",
"int",
"...",
"dimension",
")",
"{",
"long",
"[",
"]",
"remove",
"=",
"ArrayUtil",
".",
"removeIndex",
"(",
"arr",
".",
"shape",
"(",
")",
",",
"dimension",
")",
";",
"return",
"ArrayUtil",
".",
"prodLong",
"(",
"remove",
")",
";",
"}"
]
| The number of elements in a slice
along a set of dimensions
@param arr the array
to calculate the length per slice for
@param dimension the dimensions to do the calculations along
@return the number of elements in a slice along
arbitrary dimensions | [
"The",
"number",
"of",
"elements",
"in",
"a",
"slice",
"along",
"a",
"set",
"of",
"dimensions"
]
| train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java#L49-L52 |
joniles/mpxj | src/main/java/net/sf/mpxj/json/JsonWriter.java | JsonWriter.writeStringField | private void writeStringField(String fieldName, Object value) throws IOException {
"""
Write a string field to the JSON file.
@param fieldName field name
@param value field value
"""
String val = value.toString();
if (!val.isEmpty())
{
m_writer.writeNameValuePair(fieldName, val);
}
} | java | private void writeStringField(String fieldName, Object value) throws IOException
{
String val = value.toString();
if (!val.isEmpty())
{
m_writer.writeNameValuePair(fieldName, val);
}
} | [
"private",
"void",
"writeStringField",
"(",
"String",
"fieldName",
",",
"Object",
"value",
")",
"throws",
"IOException",
"{",
"String",
"val",
"=",
"value",
".",
"toString",
"(",
")",
";",
"if",
"(",
"!",
"val",
".",
"isEmpty",
"(",
")",
")",
"{",
"m_writer",
".",
"writeNameValuePair",
"(",
"fieldName",
",",
"val",
")",
";",
"}",
"}"
]
| Write a string field to the JSON file.
@param fieldName field name
@param value field value | [
"Write",
"a",
"string",
"field",
"to",
"the",
"JSON",
"file",
"."
]
| train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonWriter.java#L512-L519 |
cesarferreira/AndroidQuickUtils | library/src/main/java/quickutils/core/cache/GsonCache.java | GsonCache.saveAsync | public static void saveAsync(String key, Object object, SaveToCacheCallback callback) {
"""
Put an object into Reservoir with the given key asynchronously. Previously
stored object with the same
key (if any) will be overwritten.
@param key the key string.
@param object the object to be stored.
@param callback a callback of type {@link quickutils.core.cache.interfaces.SaveToCacheCallback
.ReservoirPutCallback} which is called upon completion.
"""
new SaveTask(key, object, callback).execute();
} | java | public static void saveAsync(String key, Object object, SaveToCacheCallback callback) {
new SaveTask(key, object, callback).execute();
} | [
"public",
"static",
"void",
"saveAsync",
"(",
"String",
"key",
",",
"Object",
"object",
",",
"SaveToCacheCallback",
"callback",
")",
"{",
"new",
"SaveTask",
"(",
"key",
",",
"object",
",",
"callback",
")",
".",
"execute",
"(",
")",
";",
"}"
]
| Put an object into Reservoir with the given key asynchronously. Previously
stored object with the same
key (if any) will be overwritten.
@param key the key string.
@param object the object to be stored.
@param callback a callback of type {@link quickutils.core.cache.interfaces.SaveToCacheCallback
.ReservoirPutCallback} which is called upon completion. | [
"Put",
"an",
"object",
"into",
"Reservoir",
"with",
"the",
"given",
"key",
"asynchronously",
".",
"Previously",
"stored",
"object",
"with",
"the",
"same",
"key",
"(",
"if",
"any",
")",
"will",
"be",
"overwritten",
"."
]
| train | https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/cache/GsonCache.java#L69-L71 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.pressImage | public static BufferedImage pressImage(Image srcImage, Image pressImg, int x, int y, float alpha) {
"""
给图片添加图片水印<br>
此方法并不关闭流
@param srcImage 源图像流
@param pressImg 水印图片,可以使用{@link ImageIO#read(File)}方法读取文件
@param x 修正值。 默认在中间,偏移量相对于中间偏移
@param y 修正值。 默认在中间,偏移量相对于中间偏移
@param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
@return 结果图片
"""
return Img.from(srcImage).pressImage(pressImg, x, y, alpha).getImg();
} | java | public static BufferedImage pressImage(Image srcImage, Image pressImg, int x, int y, float alpha) {
return Img.from(srcImage).pressImage(pressImg, x, y, alpha).getImg();
} | [
"public",
"static",
"BufferedImage",
"pressImage",
"(",
"Image",
"srcImage",
",",
"Image",
"pressImg",
",",
"int",
"x",
",",
"int",
"y",
",",
"float",
"alpha",
")",
"{",
"return",
"Img",
".",
"from",
"(",
"srcImage",
")",
".",
"pressImage",
"(",
"pressImg",
",",
"x",
",",
"y",
",",
"alpha",
")",
".",
"getImg",
"(",
")",
";",
"}"
]
| 给图片添加图片水印<br>
此方法并不关闭流
@param srcImage 源图像流
@param pressImg 水印图片,可以使用{@link ImageIO#read(File)}方法读取文件
@param x 修正值。 默认在中间,偏移量相对于中间偏移
@param y 修正值。 默认在中间,偏移量相对于中间偏移
@param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
@return 结果图片 | [
"给图片添加图片水印<br",
">",
"此方法并不关闭流"
]
| train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L972-L974 |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/ServerRedirectService.java | ServerRedirectService.activateServerGroup | public void activateServerGroup(int groupId, int clientId) {
"""
Activate a server group
@param groupId ID of group
@param clientId client ID
"""
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"UPDATE " + Constants.DB_TABLE_CLIENT +
" SET " + Constants.CLIENT_ACTIVESERVERGROUP + " = ? " +
" WHERE " + Constants.GENERIC_ID + " = ? "
);
statement.setInt(1, groupId);
statement.setInt(2, clientId);
statement.executeUpdate();
statement.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (Exception e) {
}
}
} | java | public void activateServerGroup(int groupId, int clientId) {
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"UPDATE " + Constants.DB_TABLE_CLIENT +
" SET " + Constants.CLIENT_ACTIVESERVERGROUP + " = ? " +
" WHERE " + Constants.GENERIC_ID + " = ? "
);
statement.setInt(1, groupId);
statement.setInt(2, clientId);
statement.executeUpdate();
statement.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (Exception e) {
}
}
} | [
"public",
"void",
"activateServerGroup",
"(",
"int",
"groupId",
",",
"int",
"clientId",
")",
"{",
"PreparedStatement",
"statement",
"=",
"null",
";",
"try",
"(",
"Connection",
"sqlConnection",
"=",
"sqlService",
".",
"getConnection",
"(",
")",
")",
"{",
"statement",
"=",
"sqlConnection",
".",
"prepareStatement",
"(",
"\"UPDATE \"",
"+",
"Constants",
".",
"DB_TABLE_CLIENT",
"+",
"\" SET \"",
"+",
"Constants",
".",
"CLIENT_ACTIVESERVERGROUP",
"+",
"\" = ? \"",
"+",
"\" WHERE \"",
"+",
"Constants",
".",
"GENERIC_ID",
"+",
"\" = ? \"",
")",
";",
"statement",
".",
"setInt",
"(",
"1",
",",
"groupId",
")",
";",
"statement",
".",
"setInt",
"(",
"2",
",",
"clientId",
")",
";",
"statement",
".",
"executeUpdate",
"(",
")",
";",
"statement",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"if",
"(",
"statement",
"!=",
"null",
")",
"{",
"statement",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"}",
"}",
"}"
]
| Activate a server group
@param groupId ID of group
@param clientId client ID | [
"Activate",
"a",
"server",
"group"
]
| train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/ServerRedirectService.java#L444-L468 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/geom/Rectangle.java | Rectangle.setBounds | public void setBounds(float x, float y, float width, float height) {
"""
Set the bounds of this rectangle
@param x The x coordinate of this rectangle
@param y The y coordinate of this rectangle
@param width The width to set in this rectangle
@param height The height to set in this rectangle
"""
setX(x);
setY(y);
setSize(width, height);
} | java | public void setBounds(float x, float y, float width, float height) {
setX(x);
setY(y);
setSize(width, height);
} | [
"public",
"void",
"setBounds",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"width",
",",
"float",
"height",
")",
"{",
"setX",
"(",
"x",
")",
";",
"setY",
"(",
"y",
")",
";",
"setSize",
"(",
"width",
",",
"height",
")",
";",
"}"
]
| Set the bounds of this rectangle
@param x The x coordinate of this rectangle
@param y The y coordinate of this rectangle
@param width The width to set in this rectangle
@param height The height to set in this rectangle | [
"Set",
"the",
"bounds",
"of",
"this",
"rectangle"
]
| train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Rectangle.java#L75-L79 |
diffplug/durian | src/com/diffplug/common/base/StackDumper.java | StackDumper.wrapAndDumpWhenContains | public static PrintStream wrapAndDumpWhenContains(PrintStream source, String trigger) {
"""
Returns a PrintStream which will redirect all of its output to the source PrintStream. If
the trigger string is passed through the wrapped PrintStream, then it will dump the
stack trace of the call that printed the trigger.
@param source
the returned PrintStream will delegate to this stream
@param trigger
the string which triggers a stack dump
@return a PrintStream with the above properties
"""
StringPrinter wrapped = new StringPrinter(StringPrinter.stringsToLines(perLine -> {
source.println(perLine);
if (perLine.contains(trigger)) {
dump("Triggered by " + trigger);
}
}));
return wrapped.toPrintStream();
} | java | public static PrintStream wrapAndDumpWhenContains(PrintStream source, String trigger) {
StringPrinter wrapped = new StringPrinter(StringPrinter.stringsToLines(perLine -> {
source.println(perLine);
if (perLine.contains(trigger)) {
dump("Triggered by " + trigger);
}
}));
return wrapped.toPrintStream();
} | [
"public",
"static",
"PrintStream",
"wrapAndDumpWhenContains",
"(",
"PrintStream",
"source",
",",
"String",
"trigger",
")",
"{",
"StringPrinter",
"wrapped",
"=",
"new",
"StringPrinter",
"(",
"StringPrinter",
".",
"stringsToLines",
"(",
"perLine",
"->",
"{",
"source",
".",
"println",
"(",
"perLine",
")",
";",
"if",
"(",
"perLine",
".",
"contains",
"(",
"trigger",
")",
")",
"{",
"dump",
"(",
"\"Triggered by \"",
"+",
"trigger",
")",
";",
"}",
"}",
")",
")",
";",
"return",
"wrapped",
".",
"toPrintStream",
"(",
")",
";",
"}"
]
| Returns a PrintStream which will redirect all of its output to the source PrintStream. If
the trigger string is passed through the wrapped PrintStream, then it will dump the
stack trace of the call that printed the trigger.
@param source
the returned PrintStream will delegate to this stream
@param trigger
the string which triggers a stack dump
@return a PrintStream with the above properties | [
"Returns",
"a",
"PrintStream",
"which",
"will",
"redirect",
"all",
"of",
"its",
"output",
"to",
"the",
"source",
"PrintStream",
".",
"If",
"the",
"trigger",
"string",
"is",
"passed",
"through",
"the",
"wrapped",
"PrintStream",
"then",
"it",
"will",
"dump",
"the",
"stack",
"trace",
"of",
"the",
"call",
"that",
"printed",
"the",
"trigger",
"."
]
| train | https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/StackDumper.java#L98-L106 |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java | EntityListenersService.removeEntityListener | public boolean removeEntityListener(String repoFullName, EntityListener entityListener) {
"""
Removes an entity listener for a entity of the given class
@param entityListener entity listener for a entity
@return boolean
"""
lock.writeLock().lock();
try {
verifyRepoRegistered(repoFullName);
SetMultimap<Object, EntityListener> entityListeners =
this.entityListenersByRepo.get(repoFullName);
if (entityListeners.containsKey(entityListener.getEntityId())) {
entityListeners.remove(entityListener.getEntityId(), entityListener);
return true;
}
return false;
} finally {
lock.writeLock().unlock();
}
} | java | public boolean removeEntityListener(String repoFullName, EntityListener entityListener) {
lock.writeLock().lock();
try {
verifyRepoRegistered(repoFullName);
SetMultimap<Object, EntityListener> entityListeners =
this.entityListenersByRepo.get(repoFullName);
if (entityListeners.containsKey(entityListener.getEntityId())) {
entityListeners.remove(entityListener.getEntityId(), entityListener);
return true;
}
return false;
} finally {
lock.writeLock().unlock();
}
} | [
"public",
"boolean",
"removeEntityListener",
"(",
"String",
"repoFullName",
",",
"EntityListener",
"entityListener",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"verifyRepoRegistered",
"(",
"repoFullName",
")",
";",
"SetMultimap",
"<",
"Object",
",",
"EntityListener",
">",
"entityListeners",
"=",
"this",
".",
"entityListenersByRepo",
".",
"get",
"(",
"repoFullName",
")",
";",
"if",
"(",
"entityListeners",
".",
"containsKey",
"(",
"entityListener",
".",
"getEntityId",
"(",
")",
")",
")",
"{",
"entityListeners",
".",
"remove",
"(",
"entityListener",
".",
"getEntityId",
"(",
")",
",",
"entityListener",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"finally",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
]
| Removes an entity listener for a entity of the given class
@param entityListener entity listener for a entity
@return boolean | [
"Removes",
"an",
"entity",
"listener",
"for",
"a",
"entity",
"of",
"the",
"given",
"class"
]
| train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java#L97-L111 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterListFastStr.java | FilterListFastStr.findInList | private boolean findInList(int[] hashcodes, int[] lengths, FilterCellFastStr cell, int index) {
"""
Determine, recursively, if an string is in the address tree. The string is
to be represented by an array of hashcodes where the 0th index in the array
is the hashcode of the rightmost substring of the address. A substring is
the characters between two periods (".") in an address. The string is
also represented by an array of lengths, where the 0th index in the array
is the length of the rightmost substring. If hashcodes an length match each
for each entry in the arrays, with a path through the address tree, then
the address is found in the tree.
@param hashcodes
- array of hashcodes of the substrings of the address to find
@param lengths
- array of lengths of the substrings of the address to find
@param cell
- the current cell that is being traversed in the address tree
@param index
- the next index into the arrays that is to be matched against the
tree
@return true if this address is found in the address tree, false if
it is not.
"""
if (cell.getWildcardCell() != null) {
// a wildcard, match found
return true;
}
// no wildcard so far, see if there is a still a path
FilterCellFastStr nextCell = cell.findNextCellWithLength(hashcodes[index], lengths[index]);
if (nextCell != null) {
// see if we are at the end of a valid path
if (index == 0) {
// this path found a match, unwind returning true
return true;
}
// ok so far, recursively search this path
return findInList(hashcodes, lengths, nextCell, index - 1);
}
// this path did not find a match.
return false;
} | java | private boolean findInList(int[] hashcodes, int[] lengths, FilterCellFastStr cell, int index) {
if (cell.getWildcardCell() != null) {
// a wildcard, match found
return true;
}
// no wildcard so far, see if there is a still a path
FilterCellFastStr nextCell = cell.findNextCellWithLength(hashcodes[index], lengths[index]);
if (nextCell != null) {
// see if we are at the end of a valid path
if (index == 0) {
// this path found a match, unwind returning true
return true;
}
// ok so far, recursively search this path
return findInList(hashcodes, lengths, nextCell, index - 1);
}
// this path did not find a match.
return false;
} | [
"private",
"boolean",
"findInList",
"(",
"int",
"[",
"]",
"hashcodes",
",",
"int",
"[",
"]",
"lengths",
",",
"FilterCellFastStr",
"cell",
",",
"int",
"index",
")",
"{",
"if",
"(",
"cell",
".",
"getWildcardCell",
"(",
")",
"!=",
"null",
")",
"{",
"// a wildcard, match found",
"return",
"true",
";",
"}",
"// no wildcard so far, see if there is a still a path",
"FilterCellFastStr",
"nextCell",
"=",
"cell",
".",
"findNextCellWithLength",
"(",
"hashcodes",
"[",
"index",
"]",
",",
"lengths",
"[",
"index",
"]",
")",
";",
"if",
"(",
"nextCell",
"!=",
"null",
")",
"{",
"// see if we are at the end of a valid path",
"if",
"(",
"index",
"==",
"0",
")",
"{",
"// this path found a match, unwind returning true",
"return",
"true",
";",
"}",
"// ok so far, recursively search this path",
"return",
"findInList",
"(",
"hashcodes",
",",
"lengths",
",",
"nextCell",
",",
"index",
"-",
"1",
")",
";",
"}",
"// this path did not find a match.",
"return",
"false",
";",
"}"
]
| Determine, recursively, if an string is in the address tree. The string is
to be represented by an array of hashcodes where the 0th index in the array
is the hashcode of the rightmost substring of the address. A substring is
the characters between two periods (".") in an address. The string is
also represented by an array of lengths, where the 0th index in the array
is the length of the rightmost substring. If hashcodes an length match each
for each entry in the arrays, with a path through the address tree, then
the address is found in the tree.
@param hashcodes
- array of hashcodes of the substrings of the address to find
@param lengths
- array of lengths of the substrings of the address to find
@param cell
- the current cell that is being traversed in the address tree
@param index
- the next index into the arrays that is to be matched against the
tree
@return true if this address is found in the address tree, false if
it is not. | [
"Determine",
"recursively",
"if",
"an",
"string",
"is",
"in",
"the",
"address",
"tree",
".",
"The",
"string",
"is",
"to",
"be",
"represented",
"by",
"an",
"array",
"of",
"hashcodes",
"where",
"the",
"0th",
"index",
"in",
"the",
"array",
"is",
"the",
"hashcode",
"of",
"the",
"rightmost",
"substring",
"of",
"the",
"address",
".",
"A",
"substring",
"is",
"the",
"characters",
"between",
"two",
"periods",
"(",
".",
")",
"in",
"an",
"address",
".",
"The",
"string",
"is",
"also",
"represented",
"by",
"an",
"array",
"of",
"lengths",
"where",
"the",
"0th",
"index",
"in",
"the",
"array",
"is",
"the",
"length",
"of",
"the",
"rightmost",
"substring",
".",
"If",
"hashcodes",
"an",
"length",
"match",
"each",
"for",
"each",
"entry",
"in",
"the",
"arrays",
"with",
"a",
"path",
"through",
"the",
"address",
"tree",
"then",
"the",
"address",
"is",
"found",
"in",
"the",
"tree",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterListFastStr.java#L128-L147 |
alkacon/opencms-core | src/org/opencms/ui/login/CmsLoginUI.java | CmsLoginUI.getWorkplaceSettings | private static CmsWorkplaceSettings getWorkplaceSettings(CmsObject cms, HttpSession session) {
"""
Returns the current users workplace settings.<p>
@param cms the CMS context
@param session the session
@return the settings
"""
CmsWorkplaceSettings settings = (CmsWorkplaceSettings)session.getAttribute(
CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
if (settings == null) {
settings = CmsLoginHelper.initSiteAndProject(cms);
if (VaadinService.getCurrentRequest() != null) {
VaadinService.getCurrentRequest().getWrappedSession().setAttribute(
CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS,
settings);
} else {
session.setAttribute(CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS, settings);
}
}
return settings;
} | java | private static CmsWorkplaceSettings getWorkplaceSettings(CmsObject cms, HttpSession session) {
CmsWorkplaceSettings settings = (CmsWorkplaceSettings)session.getAttribute(
CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
if (settings == null) {
settings = CmsLoginHelper.initSiteAndProject(cms);
if (VaadinService.getCurrentRequest() != null) {
VaadinService.getCurrentRequest().getWrappedSession().setAttribute(
CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS,
settings);
} else {
session.setAttribute(CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS, settings);
}
}
return settings;
} | [
"private",
"static",
"CmsWorkplaceSettings",
"getWorkplaceSettings",
"(",
"CmsObject",
"cms",
",",
"HttpSession",
"session",
")",
"{",
"CmsWorkplaceSettings",
"settings",
"=",
"(",
"CmsWorkplaceSettings",
")",
"session",
".",
"getAttribute",
"(",
"CmsWorkplaceManager",
".",
"SESSION_WORKPLACE_SETTINGS",
")",
";",
"if",
"(",
"settings",
"==",
"null",
")",
"{",
"settings",
"=",
"CmsLoginHelper",
".",
"initSiteAndProject",
"(",
"cms",
")",
";",
"if",
"(",
"VaadinService",
".",
"getCurrentRequest",
"(",
")",
"!=",
"null",
")",
"{",
"VaadinService",
".",
"getCurrentRequest",
"(",
")",
".",
"getWrappedSession",
"(",
")",
".",
"setAttribute",
"(",
"CmsWorkplaceManager",
".",
"SESSION_WORKPLACE_SETTINGS",
",",
"settings",
")",
";",
"}",
"else",
"{",
"session",
".",
"setAttribute",
"(",
"CmsWorkplaceManager",
".",
"SESSION_WORKPLACE_SETTINGS",
",",
"settings",
")",
";",
"}",
"}",
"return",
"settings",
";",
"}"
]
| Returns the current users workplace settings.<p>
@param cms the CMS context
@param session the session
@return the settings | [
"Returns",
"the",
"current",
"users",
"workplace",
"settings",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/login/CmsLoginUI.java#L343-L358 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java | ParticleIO.loadConfiguredSystem | public static ParticleSystem loadConfiguredSystem(InputStream ref)
throws IOException {
"""
Load a set of configured emitters into a single system
@param ref
The stream to read the XML from
@return A configured particle system
@throws IOException
Indicates a failure to find, read or parse the XML file
"""
return loadConfiguredSystem(ref, null, null, null);
} | java | public static ParticleSystem loadConfiguredSystem(InputStream ref)
throws IOException {
return loadConfiguredSystem(ref, null, null, null);
} | [
"public",
"static",
"ParticleSystem",
"loadConfiguredSystem",
"(",
"InputStream",
"ref",
")",
"throws",
"IOException",
"{",
"return",
"loadConfiguredSystem",
"(",
"ref",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}"
]
| Load a set of configured emitters into a single system
@param ref
The stream to read the XML from
@return A configured particle system
@throws IOException
Indicates a failure to find, read or parse the XML file | [
"Load",
"a",
"set",
"of",
"configured",
"emitters",
"into",
"a",
"single",
"system"
]
| train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java#L109-L112 |
pip-services3-java/pip-services3-components-java | src/org/pipservices3/components/cache/CacheEntry.java | CacheEntry.setValue | public void setValue(Object value, long timeout) {
"""
Sets a new value and extends its expiration.
@param value a new cached value.
@param timeout a expiration timeout in milliseconds.
"""
_value = value;
_expiration = System.currentTimeMillis() + timeout;
} | java | public void setValue(Object value, long timeout) {
_value = value;
_expiration = System.currentTimeMillis() + timeout;
} | [
"public",
"void",
"setValue",
"(",
"Object",
"value",
",",
"long",
"timeout",
")",
"{",
"_value",
"=",
"value",
";",
"_expiration",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"timeout",
";",
"}"
]
| Sets a new value and extends its expiration.
@param value a new cached value.
@param timeout a expiration timeout in milliseconds. | [
"Sets",
"a",
"new",
"value",
"and",
"extends",
"its",
"expiration",
"."
]
| train | https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/cache/CacheEntry.java#L48-L51 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/CpuLapack.java | CpuLapack.getri | @Override
public void getri(int N, INDArray A, int lda, int[] IPIV, INDArray WORK, int lwork, int INFO) {
"""
Generate inverse given LU decomp
@param N
@param A
@param lda
@param IPIV
@param WORK
@param lwork
@param INFO
"""
} | java | @Override
public void getri(int N, INDArray A, int lda, int[] IPIV, INDArray WORK, int lwork, int INFO) {
} | [
"@",
"Override",
"public",
"void",
"getri",
"(",
"int",
"N",
",",
"INDArray",
"A",
",",
"int",
"lda",
",",
"int",
"[",
"]",
"IPIV",
",",
"INDArray",
"WORK",
",",
"int",
"lwork",
",",
"int",
"INFO",
")",
"{",
"}"
]
| Generate inverse given LU decomp
@param N
@param A
@param lda
@param IPIV
@param WORK
@param lwork
@param INFO | [
"Generate",
"inverse",
"given",
"LU",
"decomp"
]
| train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/CpuLapack.java#L286-L289 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java | ApiOvhEmailpro.service_account_email_fullAccess_POST | public OvhTask service_account_email_fullAccess_POST(String service, String email, Long allowedAccountId) throws IOException {
"""
Allow full access to a user
REST: POST /email/pro/{service}/account/{email}/fullAccess
@param allowedAccountId [required] User to give full access
@param service [required] The internal name of your pro organization
@param email [required] Default email for this mailbox
API beta
"""
String qPath = "/email/pro/{service}/account/{email}/fullAccess";
StringBuilder sb = path(qPath, service, email);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "allowedAccountId", allowedAccountId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask service_account_email_fullAccess_POST(String service, String email, Long allowedAccountId) throws IOException {
String qPath = "/email/pro/{service}/account/{email}/fullAccess";
StringBuilder sb = path(qPath, service, email);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "allowedAccountId", allowedAccountId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"service_account_email_fullAccess_POST",
"(",
"String",
"service",
",",
"String",
"email",
",",
"Long",
"allowedAccountId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/pro/{service}/account/{email}/fullAccess\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"service",
",",
"email",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"allowedAccountId\"",
",",
"allowedAccountId",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhTask",
".",
"class",
")",
";",
"}"
]
| Allow full access to a user
REST: POST /email/pro/{service}/account/{email}/fullAccess
@param allowedAccountId [required] User to give full access
@param service [required] The internal name of your pro organization
@param email [required] Default email for this mailbox
API beta | [
"Allow",
"full",
"access",
"to",
"a",
"user"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java#L318-L325 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java | GoogleCloudStorageFileSystem.updateTimestampsForParentDirectories | protected void updateTimestampsForParentDirectories(
List<URI> modifiedObjects, List<URI> excludedParents) throws IOException {
"""
For each listed modified object, attempt to update the modification time
of the parent directory.
@param modifiedObjects The objects that have been modified
@param excludedParents A list of parent directories that we shouldn't attempt to update.
"""
logger.atFine().log(
"updateTimestampsForParentDirectories(%s, %s)", modifiedObjects, excludedParents);
TimestampUpdatePredicate updatePredicate =
options.getShouldIncludeInTimestampUpdatesPredicate();
Set<URI> excludedParentPathsSet = new HashSet<>(excludedParents);
Set<URI> parentUrisToUpdate = Sets.newHashSetWithExpectedSize(modifiedObjects.size());
for (URI modifiedObjectUri : modifiedObjects) {
URI parentPathUri = getParentPath(modifiedObjectUri);
if (!excludedParentPathsSet.contains(parentPathUri)
&& updatePredicate.shouldUpdateTimestamp(parentPathUri)) {
parentUrisToUpdate.add(parentPathUri);
}
}
Map<String, byte[]> modificationAttributes = new HashMap<>();
FileInfo.addModificationTimeToAttributes(modificationAttributes, Clock.SYSTEM);
List<UpdatableItemInfo> itemUpdates = new ArrayList<>(parentUrisToUpdate.size());
for (URI parentUri : parentUrisToUpdate) {
StorageResourceId resourceId = pathCodec.validatePathAndGetId(parentUri, true);
if (!resourceId.isBucket() && !resourceId.isRoot()) {
itemUpdates.add(new UpdatableItemInfo(resourceId, modificationAttributes));
}
}
if (!itemUpdates.isEmpty()) {
gcs.updateItems(itemUpdates);
} else {
logger.atFine().log("All paths were excluded from directory timestamp updating.");
}
} | java | protected void updateTimestampsForParentDirectories(
List<URI> modifiedObjects, List<URI> excludedParents) throws IOException {
logger.atFine().log(
"updateTimestampsForParentDirectories(%s, %s)", modifiedObjects, excludedParents);
TimestampUpdatePredicate updatePredicate =
options.getShouldIncludeInTimestampUpdatesPredicate();
Set<URI> excludedParentPathsSet = new HashSet<>(excludedParents);
Set<URI> parentUrisToUpdate = Sets.newHashSetWithExpectedSize(modifiedObjects.size());
for (URI modifiedObjectUri : modifiedObjects) {
URI parentPathUri = getParentPath(modifiedObjectUri);
if (!excludedParentPathsSet.contains(parentPathUri)
&& updatePredicate.shouldUpdateTimestamp(parentPathUri)) {
parentUrisToUpdate.add(parentPathUri);
}
}
Map<String, byte[]> modificationAttributes = new HashMap<>();
FileInfo.addModificationTimeToAttributes(modificationAttributes, Clock.SYSTEM);
List<UpdatableItemInfo> itemUpdates = new ArrayList<>(parentUrisToUpdate.size());
for (URI parentUri : parentUrisToUpdate) {
StorageResourceId resourceId = pathCodec.validatePathAndGetId(parentUri, true);
if (!resourceId.isBucket() && !resourceId.isRoot()) {
itemUpdates.add(new UpdatableItemInfo(resourceId, modificationAttributes));
}
}
if (!itemUpdates.isEmpty()) {
gcs.updateItems(itemUpdates);
} else {
logger.atFine().log("All paths were excluded from directory timestamp updating.");
}
} | [
"protected",
"void",
"updateTimestampsForParentDirectories",
"(",
"List",
"<",
"URI",
">",
"modifiedObjects",
",",
"List",
"<",
"URI",
">",
"excludedParents",
")",
"throws",
"IOException",
"{",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"\"updateTimestampsForParentDirectories(%s, %s)\"",
",",
"modifiedObjects",
",",
"excludedParents",
")",
";",
"TimestampUpdatePredicate",
"updatePredicate",
"=",
"options",
".",
"getShouldIncludeInTimestampUpdatesPredicate",
"(",
")",
";",
"Set",
"<",
"URI",
">",
"excludedParentPathsSet",
"=",
"new",
"HashSet",
"<>",
"(",
"excludedParents",
")",
";",
"Set",
"<",
"URI",
">",
"parentUrisToUpdate",
"=",
"Sets",
".",
"newHashSetWithExpectedSize",
"(",
"modifiedObjects",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"URI",
"modifiedObjectUri",
":",
"modifiedObjects",
")",
"{",
"URI",
"parentPathUri",
"=",
"getParentPath",
"(",
"modifiedObjectUri",
")",
";",
"if",
"(",
"!",
"excludedParentPathsSet",
".",
"contains",
"(",
"parentPathUri",
")",
"&&",
"updatePredicate",
".",
"shouldUpdateTimestamp",
"(",
"parentPathUri",
")",
")",
"{",
"parentUrisToUpdate",
".",
"add",
"(",
"parentPathUri",
")",
";",
"}",
"}",
"Map",
"<",
"String",
",",
"byte",
"[",
"]",
">",
"modificationAttributes",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"FileInfo",
".",
"addModificationTimeToAttributes",
"(",
"modificationAttributes",
",",
"Clock",
".",
"SYSTEM",
")",
";",
"List",
"<",
"UpdatableItemInfo",
">",
"itemUpdates",
"=",
"new",
"ArrayList",
"<>",
"(",
"parentUrisToUpdate",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"URI",
"parentUri",
":",
"parentUrisToUpdate",
")",
"{",
"StorageResourceId",
"resourceId",
"=",
"pathCodec",
".",
"validatePathAndGetId",
"(",
"parentUri",
",",
"true",
")",
";",
"if",
"(",
"!",
"resourceId",
".",
"isBucket",
"(",
")",
"&&",
"!",
"resourceId",
".",
"isRoot",
"(",
")",
")",
"{",
"itemUpdates",
".",
"add",
"(",
"new",
"UpdatableItemInfo",
"(",
"resourceId",
",",
"modificationAttributes",
")",
")",
";",
"}",
"}",
"if",
"(",
"!",
"itemUpdates",
".",
"isEmpty",
"(",
")",
")",
"{",
"gcs",
".",
"updateItems",
"(",
"itemUpdates",
")",
";",
"}",
"else",
"{",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"\"All paths were excluded from directory timestamp updating.\"",
")",
";",
"}",
"}"
]
| For each listed modified object, attempt to update the modification time
of the parent directory.
@param modifiedObjects The objects that have been modified
@param excludedParents A list of parent directories that we shouldn't attempt to update. | [
"For",
"each",
"listed",
"modified",
"object",
"attempt",
"to",
"update",
"the",
"modification",
"time",
"of",
"the",
"parent",
"directory",
"."
]
| train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java#L1306-L1341 |
palaima/DebugDrawer | debugdrawer/src/main/java/io/palaima/debugdrawer/util/UIUtils.java | UIUtils.setBackground | @SuppressLint("NewApi")
public static void setBackground(View v, Drawable d) {
"""
helper method to set the background depending on the android version
@param v
@param d
"""
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
v.setBackgroundDrawable(d);
} else {
v.setBackground(d);
}
} | java | @SuppressLint("NewApi")
public static void setBackground(View v, Drawable d) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
v.setBackgroundDrawable(d);
} else {
v.setBackground(d);
}
} | [
"@",
"SuppressLint",
"(",
"\"NewApi\"",
")",
"public",
"static",
"void",
"setBackground",
"(",
"View",
"v",
",",
"Drawable",
"d",
")",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
"<",
"Build",
".",
"VERSION_CODES",
".",
"JELLY_BEAN",
")",
"{",
"v",
".",
"setBackgroundDrawable",
"(",
"d",
")",
";",
"}",
"else",
"{",
"v",
".",
"setBackground",
"(",
"d",
")",
";",
"}",
"}"
]
| helper method to set the background depending on the android version
@param v
@param d | [
"helper",
"method",
"to",
"set",
"the",
"background",
"depending",
"on",
"the",
"android",
"version"
]
| train | https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer/src/main/java/io/palaima/debugdrawer/util/UIUtils.java#L38-L45 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeDecoderBits.java | QrCodeDecoderBits.decodeEci | int decodeEci( PackedBits8 data, int bitLocation ) {
"""
Decodes Extended Channel Interpretation (ECI) Mode. Allows character set to be changed
@param data encoded data
@return Location it has read up to in bits
"""
// NOTE: I'm having trouble testing this code. Just finding an encoding which will do ECI is difficult
// almost all use UTF-8 by default and that supports a lot of characters
// number of 1 bits before first 0 define number of additional codewords
int firstByte = data.read(bitLocation,8,true);
bitLocation += 8;
int numCodeWords = 1;
while( (firstByte&(1 << (7-numCodeWords))) != 0 ) {
numCodeWords++;
}
// trip the bits that indicate the number of code words
if( numCodeWords > 1) {
firstByte <<= numCodeWords-1;
firstByte >>= numCodeWords-1;
}
// read the 6-digit designator
int assignmentValue = firstByte;
for (int i = 1; i < numCodeWords; i++) {
assignmentValue <<= 8;
assignmentValue |= data.read(bitLocation,8,true);
bitLocation += 8;
}
encodingEci = getEciCharacterSet(assignmentValue);
return bitLocation;
} | java | int decodeEci( PackedBits8 data, int bitLocation ) {
// NOTE: I'm having trouble testing this code. Just finding an encoding which will do ECI is difficult
// almost all use UTF-8 by default and that supports a lot of characters
// number of 1 bits before first 0 define number of additional codewords
int firstByte = data.read(bitLocation,8,true);
bitLocation += 8;
int numCodeWords = 1;
while( (firstByte&(1 << (7-numCodeWords))) != 0 ) {
numCodeWords++;
}
// trip the bits that indicate the number of code words
if( numCodeWords > 1) {
firstByte <<= numCodeWords-1;
firstByte >>= numCodeWords-1;
}
// read the 6-digit designator
int assignmentValue = firstByte;
for (int i = 1; i < numCodeWords; i++) {
assignmentValue <<= 8;
assignmentValue |= data.read(bitLocation,8,true);
bitLocation += 8;
}
encodingEci = getEciCharacterSet(assignmentValue);
return bitLocation;
} | [
"int",
"decodeEci",
"(",
"PackedBits8",
"data",
",",
"int",
"bitLocation",
")",
"{",
"// NOTE: I'm having trouble testing this code. Just finding an encoding which will do ECI is difficult",
"// almost all use UTF-8 by default and that supports a lot of characters",
"// number of 1 bits before first 0 define number of additional codewords",
"int",
"firstByte",
"=",
"data",
".",
"read",
"(",
"bitLocation",
",",
"8",
",",
"true",
")",
";",
"bitLocation",
"+=",
"8",
";",
"int",
"numCodeWords",
"=",
"1",
";",
"while",
"(",
"(",
"firstByte",
"&",
"(",
"1",
"<<",
"(",
"7",
"-",
"numCodeWords",
")",
")",
")",
"!=",
"0",
")",
"{",
"numCodeWords",
"++",
";",
"}",
"// trip the bits that indicate the number of code words",
"if",
"(",
"numCodeWords",
">",
"1",
")",
"{",
"firstByte",
"<<=",
"numCodeWords",
"-",
"1",
";",
"firstByte",
">>=",
"numCodeWords",
"-",
"1",
";",
"}",
"// read the 6-digit designator",
"int",
"assignmentValue",
"=",
"firstByte",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"numCodeWords",
";",
"i",
"++",
")",
"{",
"assignmentValue",
"<<=",
"8",
";",
"assignmentValue",
"|=",
"data",
".",
"read",
"(",
"bitLocation",
",",
"8",
",",
"true",
")",
";",
"bitLocation",
"+=",
"8",
";",
"}",
"encodingEci",
"=",
"getEciCharacterSet",
"(",
"assignmentValue",
")",
";",
"return",
"bitLocation",
";",
"}"
]
| Decodes Extended Channel Interpretation (ECI) Mode. Allows character set to be changed
@param data encoded data
@return Location it has read up to in bits | [
"Decodes",
"Extended",
"Channel",
"Interpretation",
"(",
"ECI",
")",
"Mode",
".",
"Allows",
"character",
"set",
"to",
"be",
"changed"
]
| train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeDecoderBits.java#L422-L451 |
OpenLiberty/open-liberty | dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/jta/embeddable/impl/EmbeddableFailureScopeController.java | EmbeddableFailureScopeController.createRecoveryManager | @Override
public void createRecoveryManager(RecoveryAgent agent, RecoveryLog tranLog, RecoveryLog xaLog, RecoveryLog recoverXaLog, byte[] defaultApplId, int defaultEpoch) {
"""
Creates a RecoveryManager object instance and associates it with this FailureScopeController
The recovery manager handles recovery processing on behalf of the managed failure scope.
@return String The new RecoveryManager instance.
"""
if (tc.isEntryEnabled())
Tr.entry(tc, "createRecoveryManager", new Object[] { this, agent, tranLog, xaLog, recoverXaLog, defaultApplId, defaultEpoch });
_tranLog = tranLog;
_xaLog = xaLog;
_recoverXaLog = recoverXaLog;
_recoveryManager = new EmbeddableRecoveryManager(this, agent, tranLog, xaLog, recoverXaLog, defaultApplId, defaultEpoch);
if (tc.isEntryEnabled())
Tr.exit(tc, "createRecoveryManager", _recoveryManager);
} | java | @Override
public void createRecoveryManager(RecoveryAgent agent, RecoveryLog tranLog, RecoveryLog xaLog, RecoveryLog recoverXaLog, byte[] defaultApplId, int defaultEpoch) {
if (tc.isEntryEnabled())
Tr.entry(tc, "createRecoveryManager", new Object[] { this, agent, tranLog, xaLog, recoverXaLog, defaultApplId, defaultEpoch });
_tranLog = tranLog;
_xaLog = xaLog;
_recoverXaLog = recoverXaLog;
_recoveryManager = new EmbeddableRecoveryManager(this, agent, tranLog, xaLog, recoverXaLog, defaultApplId, defaultEpoch);
if (tc.isEntryEnabled())
Tr.exit(tc, "createRecoveryManager", _recoveryManager);
} | [
"@",
"Override",
"public",
"void",
"createRecoveryManager",
"(",
"RecoveryAgent",
"agent",
",",
"RecoveryLog",
"tranLog",
",",
"RecoveryLog",
"xaLog",
",",
"RecoveryLog",
"recoverXaLog",
",",
"byte",
"[",
"]",
"defaultApplId",
",",
"int",
"defaultEpoch",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"createRecoveryManager\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"agent",
",",
"tranLog",
",",
"xaLog",
",",
"recoverXaLog",
",",
"defaultApplId",
",",
"defaultEpoch",
"}",
")",
";",
"_tranLog",
"=",
"tranLog",
";",
"_xaLog",
"=",
"xaLog",
";",
"_recoverXaLog",
"=",
"recoverXaLog",
";",
"_recoveryManager",
"=",
"new",
"EmbeddableRecoveryManager",
"(",
"this",
",",
"agent",
",",
"tranLog",
",",
"xaLog",
",",
"recoverXaLog",
",",
"defaultApplId",
",",
"defaultEpoch",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"createRecoveryManager\"",
",",
"_recoveryManager",
")",
";",
"}"
]
| Creates a RecoveryManager object instance and associates it with this FailureScopeController
The recovery manager handles recovery processing on behalf of the managed failure scope.
@return String The new RecoveryManager instance. | [
"Creates",
"a",
"RecoveryManager",
"object",
"instance",
"and",
"associates",
"it",
"with",
"this",
"FailureScopeController",
"The",
"recovery",
"manager",
"handles",
"recovery",
"processing",
"on",
"behalf",
"of",
"the",
"managed",
"failure",
"scope",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/jta/embeddable/impl/EmbeddableFailureScopeController.java#L40-L52 |
Impetus/Kundera | src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBQuery.java | CouchDBQuery.populateEntities | @Override
protected List populateEntities(EntityMetadata m, Client client) {
"""
Populate results.
@param m
the m
@param client
the client
@return the list
"""
ClientMetadata clientMetadata = ((ClientBase) client).getClientMetadata();
this.useLuceneOrES = !MetadataUtils.useSecondryIndex(clientMetadata);
if (useLuceneOrES)
{
return populateUsingLucene(m, client, null, kunderaQuery.getResult());
}
else
{
CouchDBQueryInterpreter interpreter = onTranslation(getKunderaQuery().getFilterClauseQueue(), m);
return ((CouchDBClient) client).createAndExecuteQuery(interpreter);
}
} | java | @Override
protected List populateEntities(EntityMetadata m, Client client)
{
ClientMetadata clientMetadata = ((ClientBase) client).getClientMetadata();
this.useLuceneOrES = !MetadataUtils.useSecondryIndex(clientMetadata);
if (useLuceneOrES)
{
return populateUsingLucene(m, client, null, kunderaQuery.getResult());
}
else
{
CouchDBQueryInterpreter interpreter = onTranslation(getKunderaQuery().getFilterClauseQueue(), m);
return ((CouchDBClient) client).createAndExecuteQuery(interpreter);
}
} | [
"@",
"Override",
"protected",
"List",
"populateEntities",
"(",
"EntityMetadata",
"m",
",",
"Client",
"client",
")",
"{",
"ClientMetadata",
"clientMetadata",
"=",
"(",
"(",
"ClientBase",
")",
"client",
")",
".",
"getClientMetadata",
"(",
")",
";",
"this",
".",
"useLuceneOrES",
"=",
"!",
"MetadataUtils",
".",
"useSecondryIndex",
"(",
"clientMetadata",
")",
";",
"if",
"(",
"useLuceneOrES",
")",
"{",
"return",
"populateUsingLucene",
"(",
"m",
",",
"client",
",",
"null",
",",
"kunderaQuery",
".",
"getResult",
"(",
")",
")",
";",
"}",
"else",
"{",
"CouchDBQueryInterpreter",
"interpreter",
"=",
"onTranslation",
"(",
"getKunderaQuery",
"(",
")",
".",
"getFilterClauseQueue",
"(",
")",
",",
"m",
")",
";",
"return",
"(",
"(",
"CouchDBClient",
")",
"client",
")",
".",
"createAndExecuteQuery",
"(",
"interpreter",
")",
";",
"}",
"}"
]
| Populate results.
@param m
the m
@param client
the client
@return the list | [
"Populate",
"results",
"."
]
| train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBQuery.java#L102-L116 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java | SftpClient.getFiles | public SftpFile[] getFiles(String remote, FileTransferProgress progress)
throws FileNotFoundException, SftpStatusException, SshException,
TransferCancelledException {
"""
<p>
Download the remote files to the local computer.
</p>
@param remote
the regular expression path to the remote file
@param progress
@return SftpFile[]
@throws FileNotFoundException
@throws SftpStatusException
@throws SshException
@throws TransferCancelledException
"""
return getFiles(remote, progress, false);
} | java | public SftpFile[] getFiles(String remote, FileTransferProgress progress)
throws FileNotFoundException, SftpStatusException, SshException,
TransferCancelledException {
return getFiles(remote, progress, false);
} | [
"public",
"SftpFile",
"[",
"]",
"getFiles",
"(",
"String",
"remote",
",",
"FileTransferProgress",
"progress",
")",
"throws",
"FileNotFoundException",
",",
"SftpStatusException",
",",
"SshException",
",",
"TransferCancelledException",
"{",
"return",
"getFiles",
"(",
"remote",
",",
"progress",
",",
"false",
")",
";",
"}"
]
| <p>
Download the remote files to the local computer.
</p>
@param remote
the regular expression path to the remote file
@param progress
@return SftpFile[]
@throws FileNotFoundException
@throws SftpStatusException
@throws SshException
@throws TransferCancelledException | [
"<p",
">",
"Download",
"the",
"remote",
"files",
"to",
"the",
"local",
"computer",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L2864-L2868 |
kiswanij/jk-util | src/main/java/com/jk/util/JKObjectUtil.java | JKObjectUtil.getPropertyValue | public static <T> T getPropertyValue(final Object instance, final String fieldName) {
"""
Gets the property value.
@param <T> the generic type
@param instance the instance
@param fieldName the field name
@return the property value
"""
try {
return (T) PropertyUtils.getProperty(instance, fieldName);
} catch (final Exception e) {
throw new RuntimeException(e);
}
} | java | public static <T> T getPropertyValue(final Object instance, final String fieldName) {
try {
return (T) PropertyUtils.getProperty(instance, fieldName);
} catch (final Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getPropertyValue",
"(",
"final",
"Object",
"instance",
",",
"final",
"String",
"fieldName",
")",
"{",
"try",
"{",
"return",
"(",
"T",
")",
"PropertyUtils",
".",
"getProperty",
"(",
"instance",
",",
"fieldName",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
]
| Gets the property value.
@param <T> the generic type
@param instance the instance
@param fieldName the field name
@return the property value | [
"Gets",
"the",
"property",
"value",
"."
]
| train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L119-L125 |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.insertSQLKey | public static Long insertSQLKey(String poolName, String sqlKey, Object[] params)
throws SQLStatementNotFoundException, YankSQLException {
"""
Executes a given INSERT SQL prepared statement matching the sqlKey String in a properties file
loaded via Yank.addSQLStatements(...). Returns the auto-increment id of the inserted row.
@param poolName The name of the connection pool to query against
@param sqlKey The SQL Key found in a properties file corresponding to the desired SQL statement
value
@param params The replacement parameters
@return the auto-increment id of the inserted row, or null if no id is available
@throws SQLStatementNotFoundException if an SQL statement could not be found for the given
sqlKey String
"""
String sql = YANK_POOL_MANAGER.getMergedSqlProperties().getProperty(sqlKey);
if (sql == null || sql.equalsIgnoreCase("")) {
throw new SQLStatementNotFoundException();
} else {
return insert(poolName, sql, params);
}
} | java | public static Long insertSQLKey(String poolName, String sqlKey, Object[] params)
throws SQLStatementNotFoundException, YankSQLException {
String sql = YANK_POOL_MANAGER.getMergedSqlProperties().getProperty(sqlKey);
if (sql == null || sql.equalsIgnoreCase("")) {
throw new SQLStatementNotFoundException();
} else {
return insert(poolName, sql, params);
}
} | [
"public",
"static",
"Long",
"insertSQLKey",
"(",
"String",
"poolName",
",",
"String",
"sqlKey",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"SQLStatementNotFoundException",
",",
"YankSQLException",
"{",
"String",
"sql",
"=",
"YANK_POOL_MANAGER",
".",
"getMergedSqlProperties",
"(",
")",
".",
"getProperty",
"(",
"sqlKey",
")",
";",
"if",
"(",
"sql",
"==",
"null",
"||",
"sql",
".",
"equalsIgnoreCase",
"(",
"\"\"",
")",
")",
"{",
"throw",
"new",
"SQLStatementNotFoundException",
"(",
")",
";",
"}",
"else",
"{",
"return",
"insert",
"(",
"poolName",
",",
"sql",
",",
"params",
")",
";",
"}",
"}"
]
| Executes a given INSERT SQL prepared statement matching the sqlKey String in a properties file
loaded via Yank.addSQLStatements(...). Returns the auto-increment id of the inserted row.
@param poolName The name of the connection pool to query against
@param sqlKey The SQL Key found in a properties file corresponding to the desired SQL statement
value
@param params The replacement parameters
@return the auto-increment id of the inserted row, or null if no id is available
@throws SQLStatementNotFoundException if an SQL statement could not be found for the given
sqlKey String | [
"Executes",
"a",
"given",
"INSERT",
"SQL",
"prepared",
"statement",
"matching",
"the",
"sqlKey",
"String",
"in",
"a",
"properties",
"file",
"loaded",
"via",
"Yank",
".",
"addSQLStatements",
"(",
"...",
")",
".",
"Returns",
"the",
"auto",
"-",
"increment",
"id",
"of",
"the",
"inserted",
"row",
"."
]
| train | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L84-L93 |
ReactiveX/RxNetty | rxnetty-tcp/src/main/java/io/reactivex/netty/protocol/tcp/client/TcpClient.java | TcpClient.newClient | public static TcpClient<ByteBuf, ByteBuf> newClient(String host, int port) {
"""
Creates a new TCP client instance with the passed address of the target server.
@param host Hostname for the target server.
@param port Port for the target server.
@return A new {@code TcpClient} instance.
"""
return newClient(new InetSocketAddress(host, port));
} | java | public static TcpClient<ByteBuf, ByteBuf> newClient(String host, int port) {
return newClient(new InetSocketAddress(host, port));
} | [
"public",
"static",
"TcpClient",
"<",
"ByteBuf",
",",
"ByteBuf",
">",
"newClient",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"return",
"newClient",
"(",
"new",
"InetSocketAddress",
"(",
"host",
",",
"port",
")",
")",
";",
"}"
]
| Creates a new TCP client instance with the passed address of the target server.
@param host Hostname for the target server.
@param port Port for the target server.
@return A new {@code TcpClient} instance. | [
"Creates",
"a",
"new",
"TCP",
"client",
"instance",
"with",
"the",
"passed",
"address",
"of",
"the",
"target",
"server",
"."
]
| train | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-tcp/src/main/java/io/reactivex/netty/protocol/tcp/client/TcpClient.java#L320-L322 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/FieldAccessor.java | FieldAccessor.setPosition | public void setPosition(final Object targetObj, final CellPosition position) {
"""
位置情報を設定します。
<p>位置情報を保持するフィールドがない場合は、処理はスキップされます。</p>
@param targetObj フィールドが定義されているクラスのインスタンス
@param position 位置情報
@throws IllegalArgumentException {@literal targetObj == null or position == null}
"""
ArgUtils.notNull(targetObj, "targetObj");
ArgUtils.notNull(position, "position");
positionSetter.ifPresent(setter -> setter.set(targetObj, position));
} | java | public void setPosition(final Object targetObj, final CellPosition position) {
ArgUtils.notNull(targetObj, "targetObj");
ArgUtils.notNull(position, "position");
positionSetter.ifPresent(setter -> setter.set(targetObj, position));
} | [
"public",
"void",
"setPosition",
"(",
"final",
"Object",
"targetObj",
",",
"final",
"CellPosition",
"position",
")",
"{",
"ArgUtils",
".",
"notNull",
"(",
"targetObj",
",",
"\"targetObj\"",
")",
";",
"ArgUtils",
".",
"notNull",
"(",
"position",
",",
"\"position\"",
")",
";",
"positionSetter",
".",
"ifPresent",
"(",
"setter",
"->",
"setter",
".",
"set",
"(",
"targetObj",
",",
"position",
")",
")",
";",
"}"
]
| 位置情報を設定します。
<p>位置情報を保持するフィールドがない場合は、処理はスキップされます。</p>
@param targetObj フィールドが定義されているクラスのインスタンス
@param position 位置情報
@throws IllegalArgumentException {@literal targetObj == null or position == null} | [
"位置情報を設定します。",
"<p",
">",
"位置情報を保持するフィールドがない場合は、処理はスキップされます。<",
"/",
"p",
">"
]
| train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/FieldAccessor.java#L355-L361 |
Azure/azure-sdk-for-java | dns/resource-manager/v2016_04_01/src/main/java/com/microsoft/azure/management/dns/v2016_04_01/implementation/ZonesInner.java | ZonesInner.deleteAsync | public Observable<ZoneDeleteResultInner> deleteAsync(String resourceGroupName, String zoneName, String ifMatch) {
"""
Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone.
@param resourceGroupName The name of the resource group.
@param zoneName The name of the DNS zone (without a terminating dot).
@param ifMatch The etag of the DNS zone. Omit this value to always delete the current zone. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return deleteWithServiceResponseAsync(resourceGroupName, zoneName, ifMatch).map(new Func1<ServiceResponse<ZoneDeleteResultInner>, ZoneDeleteResultInner>() {
@Override
public ZoneDeleteResultInner call(ServiceResponse<ZoneDeleteResultInner> response) {
return response.body();
}
});
} | java | public Observable<ZoneDeleteResultInner> deleteAsync(String resourceGroupName, String zoneName, String ifMatch) {
return deleteWithServiceResponseAsync(resourceGroupName, zoneName, ifMatch).map(new Func1<ServiceResponse<ZoneDeleteResultInner>, ZoneDeleteResultInner>() {
@Override
public ZoneDeleteResultInner call(ServiceResponse<ZoneDeleteResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ZoneDeleteResultInner",
">",
"deleteAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"zoneName",
",",
"String",
"ifMatch",
")",
"{",
"return",
"deleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"zoneName",
",",
"ifMatch",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ZoneDeleteResultInner",
">",
",",
"ZoneDeleteResultInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ZoneDeleteResultInner",
"call",
"(",
"ServiceResponse",
"<",
"ZoneDeleteResultInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone.
@param resourceGroupName The name of the resource group.
@param zoneName The name of the DNS zone (without a terminating dot).
@param ifMatch The etag of the DNS zone. Omit this value to always delete the current zone. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Deletes",
"a",
"DNS",
"zone",
".",
"WARNING",
":",
"All",
"DNS",
"records",
"in",
"the",
"zone",
"will",
"also",
"be",
"deleted",
".",
"This",
"operation",
"cannot",
"be",
"undone",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/dns/resource-manager/v2016_04_01/src/main/java/com/microsoft/azure/management/dns/v2016_04_01/implementation/ZonesInner.java#L400-L407 |
heneke/thymeleaf-extras-togglz | src/main/java/com/github/heneke/thymeleaf/togglz/processor/AbstractFeatureAttrProcessor.java | AbstractFeatureAttrProcessor.determineFeatureState | protected boolean determineFeatureState(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, boolean defaultState) {
"""
Determines the feature state
@param context the template context
@param tag the tag
@param attributeName the attribute name
@param attributeValue the attribute value
@param defaultState the default state if the expression evaluates to null
@return the feature state
"""
final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(context.getConfiguration());
final IStandardExpression expression = expressionParser.parseExpression(context, attributeValue);
final Object value = expression.execute(context);
if (value != null) {
return isFeatureActive(value.toString());
}
else {
return defaultState;
}
} | java | protected boolean determineFeatureState(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, boolean defaultState) {
final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(context.getConfiguration());
final IStandardExpression expression = expressionParser.parseExpression(context, attributeValue);
final Object value = expression.execute(context);
if (value != null) {
return isFeatureActive(value.toString());
}
else {
return defaultState;
}
} | [
"protected",
"boolean",
"determineFeatureState",
"(",
"final",
"ITemplateContext",
"context",
",",
"final",
"IProcessableElementTag",
"tag",
",",
"final",
"AttributeName",
"attributeName",
",",
"final",
"String",
"attributeValue",
",",
"boolean",
"defaultState",
")",
"{",
"final",
"IStandardExpressionParser",
"expressionParser",
"=",
"StandardExpressions",
".",
"getExpressionParser",
"(",
"context",
".",
"getConfiguration",
"(",
")",
")",
";",
"final",
"IStandardExpression",
"expression",
"=",
"expressionParser",
".",
"parseExpression",
"(",
"context",
",",
"attributeValue",
")",
";",
"final",
"Object",
"value",
"=",
"expression",
".",
"execute",
"(",
"context",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"isFeatureActive",
"(",
"value",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"defaultState",
";",
"}",
"}"
]
| Determines the feature state
@param context the template context
@param tag the tag
@param attributeName the attribute name
@param attributeValue the attribute value
@param defaultState the default state if the expression evaluates to null
@return the feature state | [
"Determines",
"the",
"feature",
"state"
]
| train | https://github.com/heneke/thymeleaf-extras-togglz/blob/768984cd373c7220c35557799e79ddbc5d7f9cf2/src/main/java/com/github/heneke/thymeleaf/togglz/processor/AbstractFeatureAttrProcessor.java#L53-L63 |
termsuite/termsuite-core | src/main/java/fr/univnantes/termsuite/engines/contextualizer/Contextualizer.java | Contextualizer.toAssocRateVector | public void toAssocRateVector(Term t, CrossTable table, AssociationRate assocRateFunction, boolean normalize) {
"""
Normalize this vector according to a cross table
and an association rate measure.
This method recomputes all <code>{@link Entry}.frequency</code> values
with the normalized ones.
@param contextVector
@param table
the pre-computed co-occurrences {@link CrossTable}
@param assocRateFunction
the {@link AssociationRate} measure implementation
@param normalize
"""
double assocRate;
for(Entry coterm:t.getContext().getEntries()) {
ContextData contextData = computeContextData(table, t, coterm.getCoTerm());
assocRate = assocRateFunction.getValue(contextData);
t.getContext().setAssocRate(coterm.getCoTerm(), assocRate);
}
if(normalize)
t.getContext().normalize();
} | java | public void toAssocRateVector(Term t, CrossTable table, AssociationRate assocRateFunction, boolean normalize) {
double assocRate;
for(Entry coterm:t.getContext().getEntries()) {
ContextData contextData = computeContextData(table, t, coterm.getCoTerm());
assocRate = assocRateFunction.getValue(contextData);
t.getContext().setAssocRate(coterm.getCoTerm(), assocRate);
}
if(normalize)
t.getContext().normalize();
} | [
"public",
"void",
"toAssocRateVector",
"(",
"Term",
"t",
",",
"CrossTable",
"table",
",",
"AssociationRate",
"assocRateFunction",
",",
"boolean",
"normalize",
")",
"{",
"double",
"assocRate",
";",
"for",
"(",
"Entry",
"coterm",
":",
"t",
".",
"getContext",
"(",
")",
".",
"getEntries",
"(",
")",
")",
"{",
"ContextData",
"contextData",
"=",
"computeContextData",
"(",
"table",
",",
"t",
",",
"coterm",
".",
"getCoTerm",
"(",
")",
")",
";",
"assocRate",
"=",
"assocRateFunction",
".",
"getValue",
"(",
"contextData",
")",
";",
"t",
".",
"getContext",
"(",
")",
".",
"setAssocRate",
"(",
"coterm",
".",
"getCoTerm",
"(",
")",
",",
"assocRate",
")",
";",
"}",
"if",
"(",
"normalize",
")",
"t",
".",
"getContext",
"(",
")",
".",
"normalize",
"(",
")",
";",
"}"
]
| Normalize this vector according to a cross table
and an association rate measure.
This method recomputes all <code>{@link Entry}.frequency</code> values
with the normalized ones.
@param contextVector
@param table
the pre-computed co-occurrences {@link CrossTable}
@param assocRateFunction
the {@link AssociationRate} measure implementation
@param normalize | [
"Normalize",
"this",
"vector",
"according",
"to",
"a",
"cross",
"table",
"and",
"an",
"association",
"rate",
"measure",
"."
]
| train | https://github.com/termsuite/termsuite-core/blob/731e5d0bc7c14180713c01a9c7dffe1925f26130/src/main/java/fr/univnantes/termsuite/engines/contextualizer/Contextualizer.java#L165-L175 |
rsocket/rsocket-java | rsocket-core/src/main/java/io/rsocket/util/ByteBufPayload.java | ByteBufPayload.create | public static Payload create(String data) {
"""
Static factory method for a text payload. Mainly looks better than "new ByteBufPayload(data)"
@param data the data of the payload.
@return a payload.
"""
return create(ByteBufUtil.writeUtf8(ByteBufAllocator.DEFAULT, data), null);
} | java | public static Payload create(String data) {
return create(ByteBufUtil.writeUtf8(ByteBufAllocator.DEFAULT, data), null);
} | [
"public",
"static",
"Payload",
"create",
"(",
"String",
"data",
")",
"{",
"return",
"create",
"(",
"ByteBufUtil",
".",
"writeUtf8",
"(",
"ByteBufAllocator",
".",
"DEFAULT",
",",
"data",
")",
",",
"null",
")",
";",
"}"
]
| Static factory method for a text payload. Mainly looks better than "new ByteBufPayload(data)"
@param data the data of the payload.
@return a payload. | [
"Static",
"factory",
"method",
"for",
"a",
"text",
"payload",
".",
"Mainly",
"looks",
"better",
"than",
"new",
"ByteBufPayload",
"(",
"data",
")"
]
| train | https://github.com/rsocket/rsocket-java/blob/5101748fbd224ec86570351cebd24d079b63fbfc/rsocket-core/src/main/java/io/rsocket/util/ByteBufPayload.java#L54-L56 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java | JavacParser.term2 | JCExpression term2() {
"""
Expression2 = Expression3 [Expression2Rest]
Type2 = Type3
TypeNoParams2 = TypeNoParams3
"""
JCExpression t = term3();
if ((mode & EXPR) != 0 && prec(token.kind) >= TreeInfo.orPrec) {
mode = EXPR;
return term2Rest(t, TreeInfo.orPrec);
} else {
return t;
}
} | java | JCExpression term2() {
JCExpression t = term3();
if ((mode & EXPR) != 0 && prec(token.kind) >= TreeInfo.orPrec) {
mode = EXPR;
return term2Rest(t, TreeInfo.orPrec);
} else {
return t;
}
} | [
"JCExpression",
"term2",
"(",
")",
"{",
"JCExpression",
"t",
"=",
"term3",
"(",
")",
";",
"if",
"(",
"(",
"mode",
"&",
"EXPR",
")",
"!=",
"0",
"&&",
"prec",
"(",
"token",
".",
"kind",
")",
">=",
"TreeInfo",
".",
"orPrec",
")",
"{",
"mode",
"=",
"EXPR",
";",
"return",
"term2Rest",
"(",
"t",
",",
"TreeInfo",
".",
"orPrec",
")",
";",
"}",
"else",
"{",
"return",
"t",
";",
"}",
"}"
]
| Expression2 = Expression3 [Expression2Rest]
Type2 = Type3
TypeNoParams2 = TypeNoParams3 | [
"Expression2",
"=",
"Expression3",
"[",
"Expression2Rest",
"]",
"Type2",
"=",
"Type3",
"TypeNoParams2",
"=",
"TypeNoParams3"
]
| train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L924-L932 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/StatementManager.java | StatementManager.linkSession | private void linkSession(long csid, long sessionID) {
"""
Links a session with a registered compiled statement. If this session has
not already been linked with the given statement, then the statement use
count is incremented.
@param csid the compiled statement identifier
@param sessionID the session identifier
"""
LongKeyIntValueHashMap scsMap;
scsMap = (LongKeyIntValueHashMap) sessionUseMap.get(sessionID);
if (scsMap == null) {
scsMap = new LongKeyIntValueHashMap();
sessionUseMap.put(sessionID, scsMap);
}
int count = scsMap.get(csid, 0);
scsMap.put(csid, count + 1);
if (count == 0) {
useMap.put(csid, useMap.get(csid, 0) + 1);
}
} | java | private void linkSession(long csid, long sessionID) {
LongKeyIntValueHashMap scsMap;
scsMap = (LongKeyIntValueHashMap) sessionUseMap.get(sessionID);
if (scsMap == null) {
scsMap = new LongKeyIntValueHashMap();
sessionUseMap.put(sessionID, scsMap);
}
int count = scsMap.get(csid, 0);
scsMap.put(csid, count + 1);
if (count == 0) {
useMap.put(csid, useMap.get(csid, 0) + 1);
}
} | [
"private",
"void",
"linkSession",
"(",
"long",
"csid",
",",
"long",
"sessionID",
")",
"{",
"LongKeyIntValueHashMap",
"scsMap",
";",
"scsMap",
"=",
"(",
"LongKeyIntValueHashMap",
")",
"sessionUseMap",
".",
"get",
"(",
"sessionID",
")",
";",
"if",
"(",
"scsMap",
"==",
"null",
")",
"{",
"scsMap",
"=",
"new",
"LongKeyIntValueHashMap",
"(",
")",
";",
"sessionUseMap",
".",
"put",
"(",
"sessionID",
",",
"scsMap",
")",
";",
"}",
"int",
"count",
"=",
"scsMap",
".",
"get",
"(",
"csid",
",",
"0",
")",
";",
"scsMap",
".",
"put",
"(",
"csid",
",",
"count",
"+",
"1",
")",
";",
"if",
"(",
"count",
"==",
"0",
")",
"{",
"useMap",
".",
"put",
"(",
"csid",
",",
"useMap",
".",
"get",
"(",
"csid",
",",
"0",
")",
"+",
"1",
")",
";",
"}",
"}"
]
| Links a session with a registered compiled statement. If this session has
not already been linked with the given statement, then the statement use
count is incremented.
@param csid the compiled statement identifier
@param sessionID the session identifier | [
"Links",
"a",
"session",
"with",
"a",
"registered",
"compiled",
"statement",
".",
"If",
"this",
"session",
"has",
"not",
"already",
"been",
"linked",
"with",
"the",
"given",
"statement",
"then",
"the",
"statement",
"use",
"count",
"is",
"incremented",
"."
]
| train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/StatementManager.java#L236-L255 |
osglworks/java-di | src/main/java/org/osgl/inject/util/AnnotationUtil.java | AnnotationUtil.hashMember | static int hashMember(String name, Object value) {
"""
Helper method for generating a hash code for a member of an annotation.
@param name
the name of the member
@param value
the value of the member
@return
a hash code for this member
"""
int part1 = name.hashCode() * 127;
if (value.getClass().isArray()) {
return part1 ^ arrayMemberHash(value.getClass().getComponentType(), value);
}
if (value instanceof Annotation) {
return part1 ^ hashCode((Annotation) value);
}
return part1 ^ value.hashCode();
} | java | static int hashMember(String name, Object value) {
int part1 = name.hashCode() * 127;
if (value.getClass().isArray()) {
return part1 ^ arrayMemberHash(value.getClass().getComponentType(), value);
}
if (value instanceof Annotation) {
return part1 ^ hashCode((Annotation) value);
}
return part1 ^ value.hashCode();
} | [
"static",
"int",
"hashMember",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"int",
"part1",
"=",
"name",
".",
"hashCode",
"(",
")",
"*",
"127",
";",
"if",
"(",
"value",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"part1",
"^",
"arrayMemberHash",
"(",
"value",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
",",
"value",
")",
";",
"}",
"if",
"(",
"value",
"instanceof",
"Annotation",
")",
"{",
"return",
"part1",
"^",
"hashCode",
"(",
"(",
"Annotation",
")",
"value",
")",
";",
"}",
"return",
"part1",
"^",
"value",
".",
"hashCode",
"(",
")",
";",
"}"
]
| Helper method for generating a hash code for a member of an annotation.
@param name
the name of the member
@param value
the value of the member
@return
a hash code for this member | [
"Helper",
"method",
"for",
"generating",
"a",
"hash",
"code",
"for",
"a",
"member",
"of",
"an",
"annotation",
"."
]
| train | https://github.com/osglworks/java-di/blob/d89871c62ff508733bfa645425596f6c917fd7ee/src/main/java/org/osgl/inject/util/AnnotationUtil.java#L144-L153 |
JadiraOrg/jadira | cdt/src/main/java/org/jadira/cdt/phonenumber/impl/E164PhoneNumberWithExtension.java | E164PhoneNumberWithExtension.ofPhoneNumberStringAndExtension | public static E164PhoneNumberWithExtension ofPhoneNumberStringAndExtension(String phoneNumber, String extension, CountryCode defaultCountryCode) {
"""
Creates a new E164 Phone Number with the given extension.
@param phoneNumber The phone number in arbitrary parseable format (may be a national format)
@param extension The extension, or null for no extension
@param defaultCountryCode The Country to apply if no country is indicated by the phone number
@return A new instance of E164PhoneNumberWithExtension
"""
return new E164PhoneNumberWithExtension(phoneNumber, extension, defaultCountryCode);
} | java | public static E164PhoneNumberWithExtension ofPhoneNumberStringAndExtension(String phoneNumber, String extension, CountryCode defaultCountryCode) {
return new E164PhoneNumberWithExtension(phoneNumber, extension, defaultCountryCode);
} | [
"public",
"static",
"E164PhoneNumberWithExtension",
"ofPhoneNumberStringAndExtension",
"(",
"String",
"phoneNumber",
",",
"String",
"extension",
",",
"CountryCode",
"defaultCountryCode",
")",
"{",
"return",
"new",
"E164PhoneNumberWithExtension",
"(",
"phoneNumber",
",",
"extension",
",",
"defaultCountryCode",
")",
";",
"}"
]
| Creates a new E164 Phone Number with the given extension.
@param phoneNumber The phone number in arbitrary parseable format (may be a national format)
@param extension The extension, or null for no extension
@param defaultCountryCode The Country to apply if no country is indicated by the phone number
@return A new instance of E164PhoneNumberWithExtension | [
"Creates",
"a",
"new",
"E164",
"Phone",
"Number",
"with",
"the",
"given",
"extension",
"."
]
| train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cdt/src/main/java/org/jadira/cdt/phonenumber/impl/E164PhoneNumberWithExtension.java#L212-L214 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/matrix/MatrixIO.java | MatrixIO.readMatrixArray | @Deprecated public static double[][] readMatrixArray(File input,
Format format)
throws IOException {
"""
Reads in the content of the file as a two dimensional Java array matrix.
This method has been deprecated in favor of using purely {@link Matrix}
objects for all operations. If a Java array is needed, the {@link
Matrix#toArray()} method may be used to generate one.
@return a two-dimensional array of the matrix contained in provided file
"""
// Use the same code path for reading the Matrix object and then dump to
// an array. This comes at a potential 2X space usage, but greatly
// reduces the possibilities for bugs.
return readMatrix(input, format).toDenseArray();
} | java | @Deprecated public static double[][] readMatrixArray(File input,
Format format)
throws IOException {
// Use the same code path for reading the Matrix object and then dump to
// an array. This comes at a potential 2X space usage, but greatly
// reduces the possibilities for bugs.
return readMatrix(input, format).toDenseArray();
} | [
"@",
"Deprecated",
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"readMatrixArray",
"(",
"File",
"input",
",",
"Format",
"format",
")",
"throws",
"IOException",
"{",
"// Use the same code path for reading the Matrix object and then dump to",
"// an array. This comes at a potential 2X space usage, but greatly",
"// reduces the possibilities for bugs.",
"return",
"readMatrix",
"(",
"input",
",",
"format",
")",
".",
"toDenseArray",
"(",
")",
";",
"}"
]
| Reads in the content of the file as a two dimensional Java array matrix.
This method has been deprecated in favor of using purely {@link Matrix}
objects for all operations. If a Java array is needed, the {@link
Matrix#toArray()} method may be used to generate one.
@return a two-dimensional array of the matrix contained in provided file | [
"Reads",
"in",
"the",
"content",
"of",
"the",
"file",
"as",
"a",
"two",
"dimensional",
"Java",
"array",
"matrix",
".",
"This",
"method",
"has",
"been",
"deprecated",
"in",
"favor",
"of",
"using",
"purely",
"{",
"@link",
"Matrix",
"}",
"objects",
"for",
"all",
"operations",
".",
"If",
"a",
"Java",
"array",
"is",
"needed",
"the",
"{",
"@link",
"Matrix#toArray",
"()",
"}",
"method",
"may",
"be",
"used",
"to",
"generate",
"one",
"."
]
| train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/MatrixIO.java#L692-L699 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.warnf | public void warnf(String format, Object param1) {
"""
Issue a formatted log message with a level of WARN.
@param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
@param param1 the sole parameter
"""
if (isEnabled(Level.WARN)) {
doLogf(Level.WARN, FQCN, format, new Object[] { param1 }, null);
}
} | java | public void warnf(String format, Object param1) {
if (isEnabled(Level.WARN)) {
doLogf(Level.WARN, FQCN, format, new Object[] { param1 }, null);
}
} | [
"public",
"void",
"warnf",
"(",
"String",
"format",
",",
"Object",
"param1",
")",
"{",
"if",
"(",
"isEnabled",
"(",
"Level",
".",
"WARN",
")",
")",
"{",
"doLogf",
"(",
"Level",
".",
"WARN",
",",
"FQCN",
",",
"format",
",",
"new",
"Object",
"[",
"]",
"{",
"param1",
"}",
",",
"null",
")",
";",
"}",
"}"
]
| Issue a formatted log message with a level of WARN.
@param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
@param param1 the sole parameter | [
"Issue",
"a",
"formatted",
"log",
"message",
"with",
"a",
"level",
"of",
"WARN",
"."
]
| train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1405-L1409 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java | TypesafeConfigUtils.getObject | public static Object getObject(Config config, String path) {
"""
Get a configuration as Java object. Return {@code null} if missing or wrong type.
@param config
@param path
@return
"""
try {
return config.getAnyRef(path);
} catch (ConfigException.Missing | ConfigException.WrongType e) {
if (e instanceof ConfigException.WrongType) {
LOGGER.warn(e.getMessage(), e);
}
return null;
}
} | java | public static Object getObject(Config config, String path) {
try {
return config.getAnyRef(path);
} catch (ConfigException.Missing | ConfigException.WrongType e) {
if (e instanceof ConfigException.WrongType) {
LOGGER.warn(e.getMessage(), e);
}
return null;
}
} | [
"public",
"static",
"Object",
"getObject",
"(",
"Config",
"config",
",",
"String",
"path",
")",
"{",
"try",
"{",
"return",
"config",
".",
"getAnyRef",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"ConfigException",
".",
"Missing",
"|",
"ConfigException",
".",
"WrongType",
"e",
")",
"{",
"if",
"(",
"e",
"instanceof",
"ConfigException",
".",
"WrongType",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"}"
]
| Get a configuration as Java object. Return {@code null} if missing or wrong type.
@param config
@param path
@return | [
"Get",
"a",
"configuration",
"as",
"Java",
"object",
".",
"Return",
"{",
"@code",
"null",
"}",
"if",
"missing",
"or",
"wrong",
"type",
"."
]
| train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java#L765-L774 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectHasValueImpl_CustomFieldSerializer.java | OWLObjectHasValueImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectHasValueImpl instance) throws SerializationException {
"""
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
"""
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectHasValueImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLObjectHasValueImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
]
| Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamReader",
"}",
"."
]
| train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectHasValueImpl_CustomFieldSerializer.java#L93-L96 |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.numberFromSql | public static Number numberFromSql(String sql, Object... args) {
"""
Get a single Number from a SQL query, useful for getting a COUNT(), SUM(), MIN/MAX(), etc.
from a SQL statement. If the SQL query is parametrized, the parameter values can
be passed in as arguments following the {@code sql} String parameter.
@param sql a SQL statement string
@param args optional values for a parametrized query
@return the resulting number or {@code null}
"""
return SqlClosure.sqlExecute(c -> numberFromSql(c, sql, args));
} | java | public static Number numberFromSql(String sql, Object... args)
{
return SqlClosure.sqlExecute(c -> numberFromSql(c, sql, args));
} | [
"public",
"static",
"Number",
"numberFromSql",
"(",
"String",
"sql",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"SqlClosure",
".",
"sqlExecute",
"(",
"c",
"->",
"numberFromSql",
"(",
"c",
",",
"sql",
",",
"args",
")",
")",
";",
"}"
]
| Get a single Number from a SQL query, useful for getting a COUNT(), SUM(), MIN/MAX(), etc.
from a SQL statement. If the SQL query is parametrized, the parameter values can
be passed in as arguments following the {@code sql} String parameter.
@param sql a SQL statement string
@param args optional values for a parametrized query
@return the resulting number or {@code null} | [
"Get",
"a",
"single",
"Number",
"from",
"a",
"SQL",
"query",
"useful",
"for",
"getting",
"a",
"COUNT",
"()",
"SUM",
"()",
"MIN",
"/",
"MAX",
"()",
"etc",
".",
"from",
"a",
"SQL",
"statement",
".",
"If",
"the",
"SQL",
"query",
"is",
"parametrized",
"the",
"parameter",
"values",
"can",
"be",
"passed",
"in",
"as",
"arguments",
"following",
"the",
"{",
"@code",
"sql",
"}",
"String",
"parameter",
"."
]
| train | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L142-L145 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_externalContact_externalEmailAddress_PUT | public void organizationName_service_exchangeService_externalContact_externalEmailAddress_PUT(String organizationName, String exchangeService, String externalEmailAddress, OvhExchangeExternalContact body) throws IOException {
"""
Alter this object properties
REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}
@param body [required] New object properties
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param externalEmailAddress [required] Contact email
"""
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}";
StringBuilder sb = path(qPath, organizationName, exchangeService, externalEmailAddress);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void organizationName_service_exchangeService_externalContact_externalEmailAddress_PUT(String organizationName, String exchangeService, String externalEmailAddress, OvhExchangeExternalContact body) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}";
StringBuilder sb = path(qPath, organizationName, exchangeService, externalEmailAddress);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"organizationName_service_exchangeService_externalContact_externalEmailAddress_PUT",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"externalEmailAddress",
",",
"OvhExchangeExternalContact",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"organizationName",
",",
"exchangeService",
",",
"externalEmailAddress",
")",
";",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"body",
")",
";",
"}"
]
| Alter this object properties
REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}
@param body [required] New object properties
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param externalEmailAddress [required] Contact email | [
"Alter",
"this",
"object",
"properties"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L928-L932 |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/MonomerStore.java | MonomerStore.hasMonomer | public boolean hasMonomer(String polymerType, String alternateId) {
"""
Checks if a specific monomer exists in the store
@param polymerType polymer type of monomer
@param alternateId alternateId of monomer
@return true if monomer exists, false if not
"""
return ((monomerDB.get(polymerType) != null) && getMonomer(polymerType, alternateId) != null);
} | java | public boolean hasMonomer(String polymerType, String alternateId) {
return ((monomerDB.get(polymerType) != null) && getMonomer(polymerType, alternateId) != null);
} | [
"public",
"boolean",
"hasMonomer",
"(",
"String",
"polymerType",
",",
"String",
"alternateId",
")",
"{",
"return",
"(",
"(",
"monomerDB",
".",
"get",
"(",
"polymerType",
")",
"!=",
"null",
")",
"&&",
"getMonomer",
"(",
"polymerType",
",",
"alternateId",
")",
"!=",
"null",
")",
";",
"}"
]
| Checks if a specific monomer exists in the store
@param polymerType polymer type of monomer
@param alternateId alternateId of monomer
@return true if monomer exists, false if not | [
"Checks",
"if",
"a",
"specific",
"monomer",
"exists",
"in",
"the",
"store"
]
| train | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/MonomerStore.java#L140-L142 |
ArcBees/gwtquery | gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java | Function.getArgument | @SuppressWarnings("unchecked")
public <T> T getArgument(int argIdx, int pos, Class<? extends T> type) {
"""
Utility method for safety getting an object present at a certain
position in the list of arguments composed by arrays.
Useful for Deferred chains where result of each resolved
promise is set as an array in the arguments list.
When the object found in the array doesn't match the type required it returns a null.
Note: If type is null, we don't check the class of the object found andd you could
eventually get a casting exception.
"""
Object[] objs = getArgumentArray(argIdx);
Object o = objs.length > pos ? objs[pos] : null;
if (o != null && (
// When type is null we don't safety check
type == null ||
// The object is an instance of the type requested
o.getClass() == type ||
// Overlay types
type == JavaScriptObject.class && o instanceof JavaScriptObject
)) {
return (T) o;
}
return null;
} | java | @SuppressWarnings("unchecked")
public <T> T getArgument(int argIdx, int pos, Class<? extends T> type) {
Object[] objs = getArgumentArray(argIdx);
Object o = objs.length > pos ? objs[pos] : null;
if (o != null && (
// When type is null we don't safety check
type == null ||
// The object is an instance of the type requested
o.getClass() == type ||
// Overlay types
type == JavaScriptObject.class && o instanceof JavaScriptObject
)) {
return (T) o;
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"getArgument",
"(",
"int",
"argIdx",
",",
"int",
"pos",
",",
"Class",
"<",
"?",
"extends",
"T",
">",
"type",
")",
"{",
"Object",
"[",
"]",
"objs",
"=",
"getArgumentArray",
"(",
"argIdx",
")",
";",
"Object",
"o",
"=",
"objs",
".",
"length",
">",
"pos",
"?",
"objs",
"[",
"pos",
"]",
":",
"null",
";",
"if",
"(",
"o",
"!=",
"null",
"&&",
"(",
"// When type is null we don't safety check",
"type",
"==",
"null",
"||",
"// The object is an instance of the type requested",
"o",
".",
"getClass",
"(",
")",
"==",
"type",
"||",
"// Overlay types",
"type",
"==",
"JavaScriptObject",
".",
"class",
"&&",
"o",
"instanceof",
"JavaScriptObject",
")",
")",
"{",
"return",
"(",
"T",
")",
"o",
";",
"}",
"return",
"null",
";",
"}"
]
| Utility method for safety getting an object present at a certain
position in the list of arguments composed by arrays.
Useful for Deferred chains where result of each resolved
promise is set as an array in the arguments list.
When the object found in the array doesn't match the type required it returns a null.
Note: If type is null, we don't check the class of the object found andd you could
eventually get a casting exception. | [
"Utility",
"method",
"for",
"safety",
"getting",
"an",
"object",
"present",
"at",
"a",
"certain",
"position",
"in",
"the",
"list",
"of",
"arguments",
"composed",
"by",
"arrays",
"."
]
| train | https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java#L238-L253 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java | CareWebShellEx.pluginById | private PluginDefinition pluginById(String id) {
"""
Lookup a plugin definition by its id. Raises a runtime exception if the plugin is not found.
@param id Plugin id.
@return The plugin definition.
"""
PluginDefinition def = pluginRegistry.get(id);
if (def == null) {
throw new PluginException(EXC_UNKNOWN_PLUGIN, null, null, id);
}
return def;
} | java | private PluginDefinition pluginById(String id) {
PluginDefinition def = pluginRegistry.get(id);
if (def == null) {
throw new PluginException(EXC_UNKNOWN_PLUGIN, null, null, id);
}
return def;
} | [
"private",
"PluginDefinition",
"pluginById",
"(",
"String",
"id",
")",
"{",
"PluginDefinition",
"def",
"=",
"pluginRegistry",
".",
"get",
"(",
"id",
")",
";",
"if",
"(",
"def",
"==",
"null",
")",
"{",
"throw",
"new",
"PluginException",
"(",
"EXC_UNKNOWN_PLUGIN",
",",
"null",
",",
"null",
",",
"id",
")",
";",
"}",
"return",
"def",
";",
"}"
]
| Lookup a plugin definition by its id. Raises a runtime exception if the plugin is not found.
@param id Plugin id.
@return The plugin definition. | [
"Lookup",
"a",
"plugin",
"definition",
"by",
"its",
"id",
".",
"Raises",
"a",
"runtime",
"exception",
"if",
"the",
"plugin",
"is",
"not",
"found",
"."
]
| train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java#L172-L180 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspNavBuilder.java | CmsJspNavBuilder.getSiteNavigation | public List<CmsJspNavElement> getSiteNavigation(String folder, int endLevel) {
"""
This method builds a complete navigation tree with entries of all branches
from the specified folder.<p>
@param folder folder the root folder of the navigation tree
@param endLevel the end level of the navigation
@return list of navigation elements, in depth first order
"""
return getSiteNavigation(folder, Visibility.navigation, endLevel);
} | java | public List<CmsJspNavElement> getSiteNavigation(String folder, int endLevel) {
return getSiteNavigation(folder, Visibility.navigation, endLevel);
} | [
"public",
"List",
"<",
"CmsJspNavElement",
">",
"getSiteNavigation",
"(",
"String",
"folder",
",",
"int",
"endLevel",
")",
"{",
"return",
"getSiteNavigation",
"(",
"folder",
",",
"Visibility",
".",
"navigation",
",",
"endLevel",
")",
";",
"}"
]
| This method builds a complete navigation tree with entries of all branches
from the specified folder.<p>
@param folder folder the root folder of the navigation tree
@param endLevel the end level of the navigation
@return list of navigation elements, in depth first order | [
"This",
"method",
"builds",
"a",
"complete",
"navigation",
"tree",
"with",
"entries",
"of",
"all",
"branches",
"from",
"the",
"specified",
"folder",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspNavBuilder.java#L706-L709 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/closure/support/Algorithms.java | Algorithms.findAll | public Collection findAll(Collection collection, Constraint constraint) {
"""
Find all the elements in the collection that match the specified
constraint.
@param collection
@param constraint
@return The objects that match, or a empty collection if none match
"""
return findAll(collection.iterator(), constraint);
} | java | public Collection findAll(Collection collection, Constraint constraint) {
return findAll(collection.iterator(), constraint);
} | [
"public",
"Collection",
"findAll",
"(",
"Collection",
"collection",
",",
"Constraint",
"constraint",
")",
"{",
"return",
"findAll",
"(",
"collection",
".",
"iterator",
"(",
")",
",",
"constraint",
")",
";",
"}"
]
| Find all the elements in the collection that match the specified
constraint.
@param collection
@param constraint
@return The objects that match, or a empty collection if none match | [
"Find",
"all",
"the",
"elements",
"in",
"the",
"collection",
"that",
"match",
"the",
"specified",
"constraint",
"."
]
| train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/closure/support/Algorithms.java#L135-L137 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java | DirectoryServiceClient.asyncGetService | public ServiceDirectoryFuture asyncGetService(String serviceName, Watcher watcher) {
"""
Asynchronized get Service.
@param serviceName
the service name.
@param watcher
the watcher.
@return
the ServiceDirectoryFuture
"""
WatcherRegistration wcb = null;
if (watcher != null) {
wcb = new WatcherRegistration(serviceName, watcher);
}
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.GetService);
GetServiceProtocol p = new GetServiceProtocol(serviceName);
p.setWatcher(false);
return connection.submitAsyncRequest(header, p, wcb);
} | java | public ServiceDirectoryFuture asyncGetService(String serviceName, Watcher watcher){
WatcherRegistration wcb = null;
if (watcher != null) {
wcb = new WatcherRegistration(serviceName, watcher);
}
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.GetService);
GetServiceProtocol p = new GetServiceProtocol(serviceName);
p.setWatcher(false);
return connection.submitAsyncRequest(header, p, wcb);
} | [
"public",
"ServiceDirectoryFuture",
"asyncGetService",
"(",
"String",
"serviceName",
",",
"Watcher",
"watcher",
")",
"{",
"WatcherRegistration",
"wcb",
"=",
"null",
";",
"if",
"(",
"watcher",
"!=",
"null",
")",
"{",
"wcb",
"=",
"new",
"WatcherRegistration",
"(",
"serviceName",
",",
"watcher",
")",
";",
"}",
"ProtocolHeader",
"header",
"=",
"new",
"ProtocolHeader",
"(",
")",
";",
"header",
".",
"setType",
"(",
"ProtocolType",
".",
"GetService",
")",
";",
"GetServiceProtocol",
"p",
"=",
"new",
"GetServiceProtocol",
"(",
"serviceName",
")",
";",
"p",
".",
"setWatcher",
"(",
"false",
")",
";",
"return",
"connection",
".",
"submitAsyncRequest",
"(",
"header",
",",
"p",
",",
"wcb",
")",
";",
"}"
]
| Asynchronized get Service.
@param serviceName
the service name.
@param watcher
the watcher.
@return
the ServiceDirectoryFuture | [
"Asynchronized",
"get",
"Service",
"."
]
| train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L746-L758 |
thorntail/thorntail | core/container/src/main/java/org/wildfly/swarm/container/runtime/xmlconfig/StandaloneXMLParser.java | StandaloneXMLParser.addDelegate | public StandaloneXMLParser addDelegate(QName elementName, XMLElementReader<List<ModelNode>> parser) {
"""
Add a parser for a subpart of the XML model.
@param elementName the FQ element name (i.e. subsystem name)
@param parser creates ModelNode's from XML input
@return
"""
this.recognizedNames.add(elementName);
xmlMapper.registerRootElement(elementName, parser);
return this;
} | java | public StandaloneXMLParser addDelegate(QName elementName, XMLElementReader<List<ModelNode>> parser) {
this.recognizedNames.add(elementName);
xmlMapper.registerRootElement(elementName, parser);
return this;
} | [
"public",
"StandaloneXMLParser",
"addDelegate",
"(",
"QName",
"elementName",
",",
"XMLElementReader",
"<",
"List",
"<",
"ModelNode",
">",
">",
"parser",
")",
"{",
"this",
".",
"recognizedNames",
".",
"add",
"(",
"elementName",
")",
";",
"xmlMapper",
".",
"registerRootElement",
"(",
"elementName",
",",
"parser",
")",
";",
"return",
"this",
";",
"}"
]
| Add a parser for a subpart of the XML model.
@param elementName the FQ element name (i.e. subsystem name)
@param parser creates ModelNode's from XML input
@return | [
"Add",
"a",
"parser",
"for",
"a",
"subpart",
"of",
"the",
"XML",
"model",
"."
]
| train | https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/core/container/src/main/java/org/wildfly/swarm/container/runtime/xmlconfig/StandaloneXMLParser.java#L110-L114 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/ScreenshotTaker.java | ScreenshotTaker.takeScreenshot | public void takeScreenshot(final String name, final int quality) {
"""
Takes a screenshot and saves it in the {@link Config} objects save path.
Requires write permission (android.permission.WRITE_EXTERNAL_STORAGE) in AndroidManifest.xml of the application under test.
@param name the name to give the screenshot image
@param quality the compression rate. From 0 (compress for lowest size) to 100 (compress for maximum quality).
"""
View decorView = getScreenshotView();
if(decorView == null)
return;
initScreenShotSaver();
ScreenshotRunnable runnable = new ScreenshotRunnable(decorView, name, quality);
synchronized (screenshotMutex) {
Activity activity = activityUtils.getCurrentActivity(false);
if(activity != null)
activity.runOnUiThread(runnable);
else
instrumentation.runOnMainSync(runnable);
try {
screenshotMutex.wait(TIMEOUT_SCREENSHOT_MUTEX);
} catch (InterruptedException ignored) {
}
}
} | java | public void takeScreenshot(final String name, final int quality) {
View decorView = getScreenshotView();
if(decorView == null)
return;
initScreenShotSaver();
ScreenshotRunnable runnable = new ScreenshotRunnable(decorView, name, quality);
synchronized (screenshotMutex) {
Activity activity = activityUtils.getCurrentActivity(false);
if(activity != null)
activity.runOnUiThread(runnable);
else
instrumentation.runOnMainSync(runnable);
try {
screenshotMutex.wait(TIMEOUT_SCREENSHOT_MUTEX);
} catch (InterruptedException ignored) {
}
}
} | [
"public",
"void",
"takeScreenshot",
"(",
"final",
"String",
"name",
",",
"final",
"int",
"quality",
")",
"{",
"View",
"decorView",
"=",
"getScreenshotView",
"(",
")",
";",
"if",
"(",
"decorView",
"==",
"null",
")",
"return",
";",
"initScreenShotSaver",
"(",
")",
";",
"ScreenshotRunnable",
"runnable",
"=",
"new",
"ScreenshotRunnable",
"(",
"decorView",
",",
"name",
",",
"quality",
")",
";",
"synchronized",
"(",
"screenshotMutex",
")",
"{",
"Activity",
"activity",
"=",
"activityUtils",
".",
"getCurrentActivity",
"(",
"false",
")",
";",
"if",
"(",
"activity",
"!=",
"null",
")",
"activity",
".",
"runOnUiThread",
"(",
"runnable",
")",
";",
"else",
"instrumentation",
".",
"runOnMainSync",
"(",
"runnable",
")",
";",
"try",
"{",
"screenshotMutex",
".",
"wait",
"(",
"TIMEOUT_SCREENSHOT_MUTEX",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ignored",
")",
"{",
"}",
"}",
"}"
]
| Takes a screenshot and saves it in the {@link Config} objects save path.
Requires write permission (android.permission.WRITE_EXTERNAL_STORAGE) in AndroidManifest.xml of the application under test.
@param name the name to give the screenshot image
@param quality the compression rate. From 0 (compress for lowest size) to 100 (compress for maximum quality). | [
"Takes",
"a",
"screenshot",
"and",
"saves",
"it",
"in",
"the",
"{",
"@link",
"Config",
"}",
"objects",
"save",
"path",
".",
"Requires",
"write",
"permission",
"(",
"android",
".",
"permission",
".",
"WRITE_EXTERNAL_STORAGE",
")",
"in",
"AndroidManifest",
".",
"xml",
"of",
"the",
"application",
"under",
"test",
"."
]
| train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/ScreenshotTaker.java#L76-L96 |
apache/incubator-atlas | repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java | GraphBackedMetadataRepository.addTrait | @Override
@GraphTransaction
public void addTrait(String guid, ITypedStruct traitInstance) throws RepositoryException {
"""
Adds a new trait to an existing entity represented by a guid.
@param guid globally unique identifier for the entity
@param traitInstance trait instance that needs to be added to entity
@throws RepositoryException
"""
Preconditions.checkNotNull(guid, "guid cannot be null");
Preconditions.checkNotNull(traitInstance, "Trait instance cannot be null");
GraphTransactionInterceptor.lockObjectAndReleasePostCommit(guid);
addTraitImpl(guid, traitInstance);
} | java | @Override
@GraphTransaction
public void addTrait(String guid, ITypedStruct traitInstance) throws RepositoryException {
Preconditions.checkNotNull(guid, "guid cannot be null");
Preconditions.checkNotNull(traitInstance, "Trait instance cannot be null");
GraphTransactionInterceptor.lockObjectAndReleasePostCommit(guid);
addTraitImpl(guid, traitInstance);
} | [
"@",
"Override",
"@",
"GraphTransaction",
"public",
"void",
"addTrait",
"(",
"String",
"guid",
",",
"ITypedStruct",
"traitInstance",
")",
"throws",
"RepositoryException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"guid",
",",
"\"guid cannot be null\"",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"traitInstance",
",",
"\"Trait instance cannot be null\"",
")",
";",
"GraphTransactionInterceptor",
".",
"lockObjectAndReleasePostCommit",
"(",
"guid",
")",
";",
"addTraitImpl",
"(",
"guid",
",",
"traitInstance",
")",
";",
"}"
]
| Adds a new trait to an existing entity represented by a guid.
@param guid globally unique identifier for the entity
@param traitInstance trait instance that needs to be added to entity
@throws RepositoryException | [
"Adds",
"a",
"new",
"trait",
"to",
"an",
"existing",
"entity",
"represented",
"by",
"a",
"guid",
"."
]
| train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java#L329-L337 |
optimaize/language-detector | src/main/java/com/optimaize/langdetect/cybozu/CommandLineInterface.java | CommandLineInterface.searchFile | private File searchFile(File directory, String pattern) {
"""
File search (easy glob)
@param directory directory path
@param pattern searching file pattern with regular representation
@return matched file
"""
if (!directory.isDirectory()) {
throw new IllegalArgumentException("Not a directly: "+directory);
}
File[] files = directory.listFiles();
assert files != null; //checked for directly above.
for (File file : files) {
if (file.getName().matches(pattern)) return file;
}
return null;
} | java | private File searchFile(File directory, String pattern) {
if (!directory.isDirectory()) {
throw new IllegalArgumentException("Not a directly: "+directory);
}
File[] files = directory.listFiles();
assert files != null; //checked for directly above.
for (File file : files) {
if (file.getName().matches(pattern)) return file;
}
return null;
} | [
"private",
"File",
"searchFile",
"(",
"File",
"directory",
",",
"String",
"pattern",
")",
"{",
"if",
"(",
"!",
"directory",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Not a directly: \"",
"+",
"directory",
")",
";",
"}",
"File",
"[",
"]",
"files",
"=",
"directory",
".",
"listFiles",
"(",
")",
";",
"assert",
"files",
"!=",
"null",
";",
"//checked for directly above.",
"for",
"(",
"File",
"file",
":",
"files",
")",
"{",
"if",
"(",
"file",
".",
"getName",
"(",
")",
".",
"matches",
"(",
"pattern",
")",
")",
"return",
"file",
";",
"}",
"return",
"null",
";",
"}"
]
| File search (easy glob)
@param directory directory path
@param pattern searching file pattern with regular representation
@return matched file | [
"File",
"search",
"(",
"easy",
"glob",
")"
]
| train | https://github.com/optimaize/language-detector/blob/1a322c462f977b29eca8d3142b816b7111d3fa19/src/main/java/com/optimaize/langdetect/cybozu/CommandLineInterface.java#L155-L165 |
nmorel/gwt-jackson | gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/AbstractConfiguration.java | AbstractConfiguration.addMixInAnnotations | protected AbstractConfiguration addMixInAnnotations( Class<?> target, Class<?> mixinSource ) {
"""
Method to use for adding mix-in annotations to use for augmenting
specified class or interface. All annotations from
<code>mixinSource</code> are taken to override annotations
that <code>target</code> (or its supertypes) has.
@param target Class (or interface) whose annotations to effectively override
@param mixinSource Class (or interface) whose annotations are to
be "added" to target's annotations, overriding as necessary
@return a {@link com.github.nmorel.gwtjackson.client.AbstractConfiguration} object.
"""
mapMixInAnnotations.put( target, mixinSource );
return this;
} | java | protected AbstractConfiguration addMixInAnnotations( Class<?> target, Class<?> mixinSource ) {
mapMixInAnnotations.put( target, mixinSource );
return this;
} | [
"protected",
"AbstractConfiguration",
"addMixInAnnotations",
"(",
"Class",
"<",
"?",
">",
"target",
",",
"Class",
"<",
"?",
">",
"mixinSource",
")",
"{",
"mapMixInAnnotations",
".",
"put",
"(",
"target",
",",
"mixinSource",
")",
";",
"return",
"this",
";",
"}"
]
| Method to use for adding mix-in annotations to use for augmenting
specified class or interface. All annotations from
<code>mixinSource</code> are taken to override annotations
that <code>target</code> (or its supertypes) has.
@param target Class (or interface) whose annotations to effectively override
@param mixinSource Class (or interface) whose annotations are to
be "added" to target's annotations, overriding as necessary
@return a {@link com.github.nmorel.gwtjackson.client.AbstractConfiguration} object. | [
"Method",
"to",
"use",
"for",
"adding",
"mix",
"-",
"in",
"annotations",
"to",
"use",
"for",
"augmenting",
"specified",
"class",
"or",
"interface",
".",
"All",
"annotations",
"from",
"<code",
">",
"mixinSource<",
"/",
"code",
">",
"are",
"taken",
"to",
"override",
"annotations",
"that",
"<code",
">",
"target<",
"/",
"code",
">",
"(",
"or",
"its",
"supertypes",
")",
"has",
"."
]
| train | https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/AbstractConfiguration.java#L176-L179 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Maybe.java | Maybe.retryUntil | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Maybe<T> retryUntil(final BooleanSupplier stop) {
"""
Retries until the given stop function returns true.
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code retryUntil} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param stop the function that should return true to stop retrying
@return the new Maybe instance
"""
ObjectHelper.requireNonNull(stop, "stop is null");
return retry(Long.MAX_VALUE, Functions.predicateReverseFor(stop));
} | java | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Maybe<T> retryUntil(final BooleanSupplier stop) {
ObjectHelper.requireNonNull(stop, "stop is null");
return retry(Long.MAX_VALUE, Functions.predicateReverseFor(stop));
} | [
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"Maybe",
"<",
"T",
">",
"retryUntil",
"(",
"final",
"BooleanSupplier",
"stop",
")",
"{",
"ObjectHelper",
".",
"requireNonNull",
"(",
"stop",
",",
"\"stop is null\"",
")",
";",
"return",
"retry",
"(",
"Long",
".",
"MAX_VALUE",
",",
"Functions",
".",
"predicateReverseFor",
"(",
"stop",
")",
")",
";",
"}"
]
| Retries until the given stop function returns true.
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code retryUntil} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param stop the function that should return true to stop retrying
@return the new Maybe instance | [
"Retries",
"until",
"the",
"given",
"stop",
"function",
"returns",
"true",
".",
"<dl",
">",
"<dt",
">",
"<b",
">",
"Scheduler",
":",
"<",
"/",
"b",
">",
"<",
"/",
"dt",
">",
"<dd",
">",
"{"
]
| train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Maybe.java#L3953-L3958 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.createClassLoader | @SuppressWarnings("static-method")
protected ClassLoader createClassLoader(Iterable<File> jarsAndFolders, ClassLoader parentClassLoader) {
"""
Create the project class loader.
@param jarsAndFolders the project class path.
@param parentClassLoader the parent class loader.
@return the class loader for the project.
"""
return new URLClassLoader(Iterables.toArray(Iterables.transform(jarsAndFolders, from -> {
try {
final URL url = from.toURI().toURL();
assert url != null;
return url;
} catch (Exception e) {
throw new RuntimeException(e);
}
}), URL.class), parentClassLoader);
} | java | @SuppressWarnings("static-method")
protected ClassLoader createClassLoader(Iterable<File> jarsAndFolders, ClassLoader parentClassLoader) {
return new URLClassLoader(Iterables.toArray(Iterables.transform(jarsAndFolders, from -> {
try {
final URL url = from.toURI().toURL();
assert url != null;
return url;
} catch (Exception e) {
throw new RuntimeException(e);
}
}), URL.class), parentClassLoader);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"ClassLoader",
"createClassLoader",
"(",
"Iterable",
"<",
"File",
">",
"jarsAndFolders",
",",
"ClassLoader",
"parentClassLoader",
")",
"{",
"return",
"new",
"URLClassLoader",
"(",
"Iterables",
".",
"toArray",
"(",
"Iterables",
".",
"transform",
"(",
"jarsAndFolders",
",",
"from",
"->",
"{",
"try",
"{",
"final",
"URL",
"url",
"=",
"from",
".",
"toURI",
"(",
")",
".",
"toURL",
"(",
")",
";",
"assert",
"url",
"!=",
"null",
";",
"return",
"url",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
")",
",",
"URL",
".",
"class",
")",
",",
"parentClassLoader",
")",
";",
"}"
]
| Create the project class loader.
@param jarsAndFolders the project class path.
@param parentClassLoader the parent class loader.
@return the class loader for the project. | [
"Create",
"the",
"project",
"class",
"loader",
"."
]
| train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L2231-L2242 |
RestComm/sip-servlets | sip-servlets-examples/alerting-app/sip-servlets/src/main/java/org/mobicents/servlet/sip/alerting/JainSleeSmsAlertServlet.java | JainSleeSmsAlertServlet.doPost | public void doPost (HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
"""
Handle the HTTP POST method on which alert can be sent so that the app sends an sms based on that
"""
String alertId = request.getParameter("alertId");
String tel = request.getParameter("tel");
String alertText = request.getParameter("alertText");
if(alertText == null || alertText.length() < 1) {
// Get the content of the request as the text to parse
byte[] content = new byte[request.getContentLength()];
request.getInputStream().read(content,0, request.getContentLength());
alertText = new String(content);
}
if(logger.isInfoEnabled()) {
logger.info("Got an alert : \n alertID : " + alertId + " \n tel : " + tel + " \n text : " +alertText);
}
//
try {
Properties jndiProps = new Properties();
Context initCtx = new InitialContext(jndiProps);
// Commented out since the preferred way is through SMS Servlets
// SleeConnectionFactory factory = (SleeConnectionFactory) initCtx.lookup("java:/MobicentsConnectionFactory");
//
// SleeConnection conn1 = factory.getConnection();
// ExternalActivityHandle handle = conn1.createActivityHandle();
//
// EventTypeID requestType = conn1.getEventTypeID(
// EVENT_TYPE,
// "org.mobicents", "1.0");
// SmsAlertingCustomEvent smsAlertingCustomEvent = new SmsAlertingCustomEvent(alertId, tel, alertText);
//
// conn1.fireEvent(smsAlertingCustomEvent, requestType, handle, null);
// conn1.close();
} catch (Exception e) {
logger.error("unexpected exception while firing the event " + EVENT_TYPE + " into jslee", e);
}
sendHttpResponse(response, OK_BODY);
} | java | public void doPost (HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String alertId = request.getParameter("alertId");
String tel = request.getParameter("tel");
String alertText = request.getParameter("alertText");
if(alertText == null || alertText.length() < 1) {
// Get the content of the request as the text to parse
byte[] content = new byte[request.getContentLength()];
request.getInputStream().read(content,0, request.getContentLength());
alertText = new String(content);
}
if(logger.isInfoEnabled()) {
logger.info("Got an alert : \n alertID : " + alertId + " \n tel : " + tel + " \n text : " +alertText);
}
//
try {
Properties jndiProps = new Properties();
Context initCtx = new InitialContext(jndiProps);
// Commented out since the preferred way is through SMS Servlets
// SleeConnectionFactory factory = (SleeConnectionFactory) initCtx.lookup("java:/MobicentsConnectionFactory");
//
// SleeConnection conn1 = factory.getConnection();
// ExternalActivityHandle handle = conn1.createActivityHandle();
//
// EventTypeID requestType = conn1.getEventTypeID(
// EVENT_TYPE,
// "org.mobicents", "1.0");
// SmsAlertingCustomEvent smsAlertingCustomEvent = new SmsAlertingCustomEvent(alertId, tel, alertText);
//
// conn1.fireEvent(smsAlertingCustomEvent, requestType, handle, null);
// conn1.close();
} catch (Exception e) {
logger.error("unexpected exception while firing the event " + EVENT_TYPE + " into jslee", e);
}
sendHttpResponse(response, OK_BODY);
} | [
"public",
"void",
"doPost",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"String",
"alertId",
"=",
"request",
".",
"getParameter",
"(",
"\"alertId\"",
")",
";",
"String",
"tel",
"=",
"request",
".",
"getParameter",
"(",
"\"tel\"",
")",
";",
"String",
"alertText",
"=",
"request",
".",
"getParameter",
"(",
"\"alertText\"",
")",
";",
"if",
"(",
"alertText",
"==",
"null",
"||",
"alertText",
".",
"length",
"(",
")",
"<",
"1",
")",
"{",
"// Get the content of the request as the text to parse",
"byte",
"[",
"]",
"content",
"=",
"new",
"byte",
"[",
"request",
".",
"getContentLength",
"(",
")",
"]",
";",
"request",
".",
"getInputStream",
"(",
")",
".",
"read",
"(",
"content",
",",
"0",
",",
"request",
".",
"getContentLength",
"(",
")",
")",
";",
"alertText",
"=",
"new",
"String",
"(",
"content",
")",
";",
"}",
"if",
"(",
"logger",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"logger",
".",
"info",
"(",
"\"Got an alert : \\n alertID : \"",
"+",
"alertId",
"+",
"\" \\n tel : \"",
"+",
"tel",
"+",
"\" \\n text : \"",
"+",
"alertText",
")",
";",
"}",
"// ",
"try",
"{",
"Properties",
"jndiProps",
"=",
"new",
"Properties",
"(",
")",
";",
"Context",
"initCtx",
"=",
"new",
"InitialContext",
"(",
"jndiProps",
")",
";",
"// Commented out since the preferred way is through SMS Servlets",
"// \tSleeConnectionFactory factory = (SleeConnectionFactory) initCtx.lookup(\"java:/MobicentsConnectionFactory\");",
"// \t",
"//\t\t\tSleeConnection conn1 = factory.getConnection();",
"//\t\t\tExternalActivityHandle handle = conn1.createActivityHandle();",
"//",
"//\t\t\tEventTypeID requestType = conn1.getEventTypeID(",
"//\t\t\t\t\tEVENT_TYPE,",
"//\t\t\t\t\t\"org.mobicents\", \"1.0\");",
"//\t\t\tSmsAlertingCustomEvent smsAlertingCustomEvent = new SmsAlertingCustomEvent(alertId, tel, alertText);",
"//\t\t\t",
"//\t\t\tconn1.fireEvent(smsAlertingCustomEvent, requestType, handle, null);",
"//\t\t\tconn1.close();",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"unexpected exception while firing the event \"",
"+",
"EVENT_TYPE",
"+",
"\" into jslee\"",
",",
"e",
")",
";",
"}",
"sendHttpResponse",
"(",
"response",
",",
"OK_BODY",
")",
";",
"}"
]
| Handle the HTTP POST method on which alert can be sent so that the app sends an sms based on that | [
"Handle",
"the",
"HTTP",
"POST",
"method",
"on",
"which",
"alert",
"can",
"be",
"sent",
"so",
"that",
"the",
"app",
"sends",
"an",
"sms",
"based",
"on",
"that"
]
| train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/alerting-app/sip-servlets/src/main/java/org/mobicents/servlet/sip/alerting/JainSleeSmsAlertServlet.java#L60-L96 |
neoremind/fluent-validator | fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/util/ArrayUtil.java | ArrayUtil.hasIntersection | public static <T> boolean hasIntersection(T[] from, T[] target) {
"""
验证数组是否有交集
<p/>
<pre>
Class<?>[] from = new Class<?>[] {};
Class<?>[] target = new Class<?>[] {};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class<?>[] {String.class};
target = new Class<?>[] {};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class<?>[] {};
target = new Class<?>[] {String.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(false));
from = new Class<?>[] {String.class};
target = new Class<?>[] {String.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class<?>[] {String.class, Object.class};
target = new Class<?>[] {String.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class<?>[] {String.class};
target = new Class<?>[] {String.class, Object.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class<?>[] {Integer.class};
target = new Class<?>[] {Object.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(false));
</pre>
@param from 基础数组
@param target 目标数组,看是否存在于基础数组中
@return 如果有交集, 则返回<code>true</code>
"""
if (isEmpty(target)) {
return true;
}
if (isEmpty(from)) {
return false;
}
for (int i = 0; i < from.length; i++) {
for (int j = 0; j < target.length; j++) {
if (from[i] == target[j]) {
return true;
}
}
}
return false;
} | java | public static <T> boolean hasIntersection(T[] from, T[] target) {
if (isEmpty(target)) {
return true;
}
if (isEmpty(from)) {
return false;
}
for (int i = 0; i < from.length; i++) {
for (int j = 0; j < target.length; j++) {
if (from[i] == target[j]) {
return true;
}
}
}
return false;
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"hasIntersection",
"(",
"T",
"[",
"]",
"from",
",",
"T",
"[",
"]",
"target",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"target",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"isEmpty",
"(",
"from",
")",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"from",
".",
"length",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"target",
".",
"length",
";",
"j",
"++",
")",
"{",
"if",
"(",
"from",
"[",
"i",
"]",
"==",
"target",
"[",
"j",
"]",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
]
| 验证数组是否有交集
<p/>
<pre>
Class<?>[] from = new Class<?>[] {};
Class<?>[] target = new Class<?>[] {};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class<?>[] {String.class};
target = new Class<?>[] {};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class<?>[] {};
target = new Class<?>[] {String.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(false));
from = new Class<?>[] {String.class};
target = new Class<?>[] {String.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class<?>[] {String.class, Object.class};
target = new Class<?>[] {String.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class<?>[] {String.class};
target = new Class<?>[] {String.class, Object.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class<?>[] {Integer.class};
target = new Class<?>[] {Object.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(false));
</pre>
@param from 基础数组
@param target 目标数组,看是否存在于基础数组中
@return 如果有交集, 则返回<code>true</code> | [
"验证数组是否有交集",
"<p",
"/",
">",
"<pre",
">",
"Class<?",
">",
"[]",
"from",
"=",
"new",
"Class<?",
">",
"[]",
"{}",
";",
"Class<?",
">",
"[]",
"target",
"=",
"new",
"Class<?",
">",
"[]",
"{}",
";",
"assertThat",
"(",
"ArrayUtil",
".",
"hasIntersection",
"(",
"from",
"target",
")",
"Matchers",
".",
"is",
"(",
"true",
"))",
";"
]
| train | https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/util/ArrayUtil.java#L69-L86 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/MutableArray.java | MutableArray.insertDictionary | @NonNull
@Override
public MutableArray insertDictionary(int index, Dictionary value) {
"""
Inserts a Dictionary object at the given index.
@param index the index. This value must not exceed the bounds of the array.
@param value the Dictionary object
@return The self object
"""
return insertValue(index, value);
} | java | @NonNull
@Override
public MutableArray insertDictionary(int index, Dictionary value) {
return insertValue(index, value);
} | [
"@",
"NonNull",
"@",
"Override",
"public",
"MutableArray",
"insertDictionary",
"(",
"int",
"index",
",",
"Dictionary",
"value",
")",
"{",
"return",
"insertValue",
"(",
"index",
",",
"value",
")",
";",
"}"
]
| Inserts a Dictionary object at the given index.
@param index the index. This value must not exceed the bounds of the array.
@param value the Dictionary object
@return The self object | [
"Inserts",
"a",
"Dictionary",
"object",
"at",
"the",
"given",
"index",
"."
]
| train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableArray.java#L553-L557 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/StratifiedSampling.java | StratifiedSampling.randomSampling | public static TransposeDataCollection randomSampling(TransposeDataList strataIdList, AssociativeArray nh, boolean withReplacement) {
"""
Samples nh ids from each strata by using Stratified Sampling
@param strataIdList
@param nh
@param withReplacement
@return
"""
TransposeDataCollection sampledIds = new TransposeDataCollection();
for(Map.Entry<Object, FlatDataList> entry : strataIdList.entrySet()) {
Object strata = entry.getKey();
Number sampleN = ((Number)nh.get(strata));
if(sampleN==null) {
continue;
}
sampledIds.put(strata, SimpleRandomSampling.randomSampling(entry.getValue(), sampleN.intValue(), withReplacement));
}
return sampledIds;
} | java | public static TransposeDataCollection randomSampling(TransposeDataList strataIdList, AssociativeArray nh, boolean withReplacement) {
TransposeDataCollection sampledIds = new TransposeDataCollection();
for(Map.Entry<Object, FlatDataList> entry : strataIdList.entrySet()) {
Object strata = entry.getKey();
Number sampleN = ((Number)nh.get(strata));
if(sampleN==null) {
continue;
}
sampledIds.put(strata, SimpleRandomSampling.randomSampling(entry.getValue(), sampleN.intValue(), withReplacement));
}
return sampledIds;
} | [
"public",
"static",
"TransposeDataCollection",
"randomSampling",
"(",
"TransposeDataList",
"strataIdList",
",",
"AssociativeArray",
"nh",
",",
"boolean",
"withReplacement",
")",
"{",
"TransposeDataCollection",
"sampledIds",
"=",
"new",
"TransposeDataCollection",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Object",
",",
"FlatDataList",
">",
"entry",
":",
"strataIdList",
".",
"entrySet",
"(",
")",
")",
"{",
"Object",
"strata",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"Number",
"sampleN",
"=",
"(",
"(",
"Number",
")",
"nh",
".",
"get",
"(",
"strata",
")",
")",
";",
"if",
"(",
"sampleN",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"sampledIds",
".",
"put",
"(",
"strata",
",",
"SimpleRandomSampling",
".",
"randomSampling",
"(",
"entry",
".",
"getValue",
"(",
")",
",",
"sampleN",
".",
"intValue",
"(",
")",
",",
"withReplacement",
")",
")",
";",
"}",
"return",
"sampledIds",
";",
"}"
]
| Samples nh ids from each strata by using Stratified Sampling
@param strataIdList
@param nh
@param withReplacement
@return | [
"Samples",
"nh",
"ids",
"from",
"each",
"strata",
"by",
"using",
"Stratified",
"Sampling"
]
| train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/StratifiedSampling.java#L63-L78 |
playn/playn | java-base/src/playn/java/JavaInput.java | JavaInput.postKey | public void postKey (long time, Key key, boolean pressed, char typedCh, int modFlags) {
"""
Posts a key event received from elsewhere (i.e. a native UI component). This is useful for
applications that are using GL in Canvas mode and sharing keyboard focus with other (non-GL)
components. The event will be queued and dispatched on the next frame, after GL keyboard
events.
@param time the time (in millis since epoch) at which the event was generated, or 0 if N/A.
@param key the key that was pressed or released, or null for a char typed event
@param pressed whether the key was pressed or released, ignored if key is null
@param typedCh the character that was typed, ignored if key is not null
@param modFlags modifier key state flags (generated by {@link #modifierFlags})
"""
kevQueue.add(key == null ?
new Keyboard.TypedEvent(modFlags, time, typedCh) :
new Keyboard.KeyEvent(modFlags, time, key, pressed));
} | java | public void postKey (long time, Key key, boolean pressed, char typedCh, int modFlags) {
kevQueue.add(key == null ?
new Keyboard.TypedEvent(modFlags, time, typedCh) :
new Keyboard.KeyEvent(modFlags, time, key, pressed));
} | [
"public",
"void",
"postKey",
"(",
"long",
"time",
",",
"Key",
"key",
",",
"boolean",
"pressed",
",",
"char",
"typedCh",
",",
"int",
"modFlags",
")",
"{",
"kevQueue",
".",
"add",
"(",
"key",
"==",
"null",
"?",
"new",
"Keyboard",
".",
"TypedEvent",
"(",
"modFlags",
",",
"time",
",",
"typedCh",
")",
":",
"new",
"Keyboard",
".",
"KeyEvent",
"(",
"modFlags",
",",
"time",
",",
"key",
",",
"pressed",
")",
")",
";",
"}"
]
| Posts a key event received from elsewhere (i.e. a native UI component). This is useful for
applications that are using GL in Canvas mode and sharing keyboard focus with other (non-GL)
components. The event will be queued and dispatched on the next frame, after GL keyboard
events.
@param time the time (in millis since epoch) at which the event was generated, or 0 if N/A.
@param key the key that was pressed or released, or null for a char typed event
@param pressed whether the key was pressed or released, ignored if key is null
@param typedCh the character that was typed, ignored if key is not null
@param modFlags modifier key state flags (generated by {@link #modifierFlags}) | [
"Posts",
"a",
"key",
"event",
"received",
"from",
"elsewhere",
"(",
"i",
".",
"e",
".",
"a",
"native",
"UI",
"component",
")",
".",
"This",
"is",
"useful",
"for",
"applications",
"that",
"are",
"using",
"GL",
"in",
"Canvas",
"mode",
"and",
"sharing",
"keyboard",
"focus",
"with",
"other",
"(",
"non",
"-",
"GL",
")",
"components",
".",
"The",
"event",
"will",
"be",
"queued",
"and",
"dispatched",
"on",
"the",
"next",
"frame",
"after",
"GL",
"keyboard",
"events",
"."
]
| train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/java-base/src/playn/java/JavaInput.java#L55-L59 |
foundation-runtime/configuration | configuration-api/src/main/java/com/cisco/oss/foundation/configuration/xml/NamespaceDefinitionMessage.java | NamespaceDefinitionMessage.addDependenciesRecursively | protected void addDependenciesRecursively(Namespace namespace, List<Namespace> namespaceList, String dependencyId, List<String> extendedDependencies) throws XmlException {
"""
Adds dependencyId, and all of it's depdencies recursively using namespaceList, to extendedDependencies for namespace.
@throws XmlException
"""
if(extendedDependencies.contains(dependencyId)) {
return;
}
if(namespace.getId().equals(dependencyId)) {
throw new XmlException("Circular dependency found in " + namespace.getId());
}
Namespace dependency = find(namespaceList, dependencyId);
extendedDependencies.add(dependency.getId());
for(String indirectDependencyId: dependency.getDirectDependencyIds()) {
addDependenciesRecursively(namespace, namespaceList, indirectDependencyId, extendedDependencies);
}
} | java | protected void addDependenciesRecursively(Namespace namespace, List<Namespace> namespaceList, String dependencyId, List<String> extendedDependencies) throws XmlException {
if(extendedDependencies.contains(dependencyId)) {
return;
}
if(namespace.getId().equals(dependencyId)) {
throw new XmlException("Circular dependency found in " + namespace.getId());
}
Namespace dependency = find(namespaceList, dependencyId);
extendedDependencies.add(dependency.getId());
for(String indirectDependencyId: dependency.getDirectDependencyIds()) {
addDependenciesRecursively(namespace, namespaceList, indirectDependencyId, extendedDependencies);
}
} | [
"protected",
"void",
"addDependenciesRecursively",
"(",
"Namespace",
"namespace",
",",
"List",
"<",
"Namespace",
">",
"namespaceList",
",",
"String",
"dependencyId",
",",
"List",
"<",
"String",
">",
"extendedDependencies",
")",
"throws",
"XmlException",
"{",
"if",
"(",
"extendedDependencies",
".",
"contains",
"(",
"dependencyId",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"namespace",
".",
"getId",
"(",
")",
".",
"equals",
"(",
"dependencyId",
")",
")",
"{",
"throw",
"new",
"XmlException",
"(",
"\"Circular dependency found in \"",
"+",
"namespace",
".",
"getId",
"(",
")",
")",
";",
"}",
"Namespace",
"dependency",
"=",
"find",
"(",
"namespaceList",
",",
"dependencyId",
")",
";",
"extendedDependencies",
".",
"add",
"(",
"dependency",
".",
"getId",
"(",
")",
")",
";",
"for",
"(",
"String",
"indirectDependencyId",
":",
"dependency",
".",
"getDirectDependencyIds",
"(",
")",
")",
"{",
"addDependenciesRecursively",
"(",
"namespace",
",",
"namespaceList",
",",
"indirectDependencyId",
",",
"extendedDependencies",
")",
";",
"}",
"}"
]
| Adds dependencyId, and all of it's depdencies recursively using namespaceList, to extendedDependencies for namespace.
@throws XmlException | [
"Adds",
"dependencyId",
"and",
"all",
"of",
"it",
"s",
"depdencies",
"recursively",
"using",
"namespaceList",
"to",
"extendedDependencies",
"for",
"namespace",
"."
]
| train | https://github.com/foundation-runtime/configuration/blob/c5bd171a2cca0dc1c8d568f987843ca47c6d1eed/configuration-api/src/main/java/com/cisco/oss/foundation/configuration/xml/NamespaceDefinitionMessage.java#L169-L182 |
eclipse/xtext-extras | org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/binary/asm/SignatureUtil.java | SignatureUtil.scanCaptureTypeSignature | private static int scanCaptureTypeSignature(String string, int start) {
"""
Scans the given string for a capture of a wildcard type signature starting at the given
index and returns the index of the last character.
<pre>
CaptureTypeSignature:
<b>!</b> TypeBoundSignature
</pre>
@param string the signature string
@param start the 0-based character index of the first character
@return the 0-based character index of the last character
@exception IllegalArgumentException if this is not a capture type signature
"""
// need a minimum 2 char
if (start >= string.length() - 1) {
throw new IllegalArgumentException();
}
char c = string.charAt(start);
if (c != C_CAPTURE) {
throw new IllegalArgumentException();
}
return scanTypeBoundSignature(string, start + 1);
} | java | private static int scanCaptureTypeSignature(String string, int start) {
// need a minimum 2 char
if (start >= string.length() - 1) {
throw new IllegalArgumentException();
}
char c = string.charAt(start);
if (c != C_CAPTURE) {
throw new IllegalArgumentException();
}
return scanTypeBoundSignature(string, start + 1);
} | [
"private",
"static",
"int",
"scanCaptureTypeSignature",
"(",
"String",
"string",
",",
"int",
"start",
")",
"{",
"// need a minimum 2 char",
"if",
"(",
"start",
">=",
"string",
".",
"length",
"(",
")",
"-",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"char",
"c",
"=",
"string",
".",
"charAt",
"(",
"start",
")",
";",
"if",
"(",
"c",
"!=",
"C_CAPTURE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"return",
"scanTypeBoundSignature",
"(",
"string",
",",
"start",
"+",
"1",
")",
";",
"}"
]
| Scans the given string for a capture of a wildcard type signature starting at the given
index and returns the index of the last character.
<pre>
CaptureTypeSignature:
<b>!</b> TypeBoundSignature
</pre>
@param string the signature string
@param start the 0-based character index of the first character
@return the 0-based character index of the last character
@exception IllegalArgumentException if this is not a capture type signature | [
"Scans",
"the",
"given",
"string",
"for",
"a",
"capture",
"of",
"a",
"wildcard",
"type",
"signature",
"starting",
"at",
"the",
"given",
"index",
"and",
"returns",
"the",
"index",
"of",
"the",
"last",
"character",
".",
"<pre",
">",
"CaptureTypeSignature",
":",
"<b",
">",
"!<",
"/",
"b",
">",
"TypeBoundSignature",
"<",
"/",
"pre",
">"
]
| train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/binary/asm/SignatureUtil.java#L282-L292 |
Stratio/stratio-cassandra | src/java/com/stratio/cassandra/index/service/RowServiceWide.java | RowServiceWide.rows | private Map<CellName, Row> rows(DecoratedKey partitionKey, List<CellName> clusteringKeys, long timestamp) {
"""
Returns the CQL3 {@link Row} identified by the specified key pair, using the specified time stamp to ignore
deleted columns. The {@link Row} is retrieved from the storage engine, so it involves IO operations.
@param partitionKey The partition key.
@param clusteringKeys The clustering keys.
@param timestamp The time stamp to ignore deleted columns.
@return The CQL3 {@link Row} identified by the specified key pair.
"""
ColumnSlice[] slices = rowMapper.columnSlices(clusteringKeys);
if (baseCfs.metadata.hasStaticColumns()) {
LinkedList<ColumnSlice> l = new LinkedList<>(Arrays.asList(slices));
l.addFirst(baseCfs.metadata.comparator.staticPrefix().slice());
slices = new ColumnSlice[l.size()];
slices = l.toArray(slices);
}
SliceQueryFilter dataFilter = new SliceQueryFilter(slices,
false,
Integer.MAX_VALUE,
baseCfs.metadata.clusteringColumns().size());
QueryFilter queryFilter = new QueryFilter(partitionKey, baseCfs.name, dataFilter, timestamp);
ColumnFamily queryColumnFamily = baseCfs.getColumnFamily(queryFilter);
// Avoid null
if (queryColumnFamily == null) {
return null;
}
// Remove deleted/expired columns
ColumnFamily cleanQueryColumnFamily = cleanExpired(queryColumnFamily, timestamp);
// Split CQL3 row column families
Map<CellName, ColumnFamily> columnFamilies = rowMapper.splitRows(cleanQueryColumnFamily);
// Build and return rows
Map<CellName, Row> rows = new HashMap<>(columnFamilies.size());
for (Map.Entry<CellName, ColumnFamily> entry : columnFamilies.entrySet()) {
Row row = new Row(partitionKey, entry.getValue());
rows.put(entry.getKey(), row);
}
return rows;
} | java | private Map<CellName, Row> rows(DecoratedKey partitionKey, List<CellName> clusteringKeys, long timestamp) {
ColumnSlice[] slices = rowMapper.columnSlices(clusteringKeys);
if (baseCfs.metadata.hasStaticColumns()) {
LinkedList<ColumnSlice> l = new LinkedList<>(Arrays.asList(slices));
l.addFirst(baseCfs.metadata.comparator.staticPrefix().slice());
slices = new ColumnSlice[l.size()];
slices = l.toArray(slices);
}
SliceQueryFilter dataFilter = new SliceQueryFilter(slices,
false,
Integer.MAX_VALUE,
baseCfs.metadata.clusteringColumns().size());
QueryFilter queryFilter = new QueryFilter(partitionKey, baseCfs.name, dataFilter, timestamp);
ColumnFamily queryColumnFamily = baseCfs.getColumnFamily(queryFilter);
// Avoid null
if (queryColumnFamily == null) {
return null;
}
// Remove deleted/expired columns
ColumnFamily cleanQueryColumnFamily = cleanExpired(queryColumnFamily, timestamp);
// Split CQL3 row column families
Map<CellName, ColumnFamily> columnFamilies = rowMapper.splitRows(cleanQueryColumnFamily);
// Build and return rows
Map<CellName, Row> rows = new HashMap<>(columnFamilies.size());
for (Map.Entry<CellName, ColumnFamily> entry : columnFamilies.entrySet()) {
Row row = new Row(partitionKey, entry.getValue());
rows.put(entry.getKey(), row);
}
return rows;
} | [
"private",
"Map",
"<",
"CellName",
",",
"Row",
">",
"rows",
"(",
"DecoratedKey",
"partitionKey",
",",
"List",
"<",
"CellName",
">",
"clusteringKeys",
",",
"long",
"timestamp",
")",
"{",
"ColumnSlice",
"[",
"]",
"slices",
"=",
"rowMapper",
".",
"columnSlices",
"(",
"clusteringKeys",
")",
";",
"if",
"(",
"baseCfs",
".",
"metadata",
".",
"hasStaticColumns",
"(",
")",
")",
"{",
"LinkedList",
"<",
"ColumnSlice",
">",
"l",
"=",
"new",
"LinkedList",
"<>",
"(",
"Arrays",
".",
"asList",
"(",
"slices",
")",
")",
";",
"l",
".",
"addFirst",
"(",
"baseCfs",
".",
"metadata",
".",
"comparator",
".",
"staticPrefix",
"(",
")",
".",
"slice",
"(",
")",
")",
";",
"slices",
"=",
"new",
"ColumnSlice",
"[",
"l",
".",
"size",
"(",
")",
"]",
";",
"slices",
"=",
"l",
".",
"toArray",
"(",
"slices",
")",
";",
"}",
"SliceQueryFilter",
"dataFilter",
"=",
"new",
"SliceQueryFilter",
"(",
"slices",
",",
"false",
",",
"Integer",
".",
"MAX_VALUE",
",",
"baseCfs",
".",
"metadata",
".",
"clusteringColumns",
"(",
")",
".",
"size",
"(",
")",
")",
";",
"QueryFilter",
"queryFilter",
"=",
"new",
"QueryFilter",
"(",
"partitionKey",
",",
"baseCfs",
".",
"name",
",",
"dataFilter",
",",
"timestamp",
")",
";",
"ColumnFamily",
"queryColumnFamily",
"=",
"baseCfs",
".",
"getColumnFamily",
"(",
"queryFilter",
")",
";",
"// Avoid null",
"if",
"(",
"queryColumnFamily",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// Remove deleted/expired columns",
"ColumnFamily",
"cleanQueryColumnFamily",
"=",
"cleanExpired",
"(",
"queryColumnFamily",
",",
"timestamp",
")",
";",
"// Split CQL3 row column families",
"Map",
"<",
"CellName",
",",
"ColumnFamily",
">",
"columnFamilies",
"=",
"rowMapper",
".",
"splitRows",
"(",
"cleanQueryColumnFamily",
")",
";",
"// Build and return rows",
"Map",
"<",
"CellName",
",",
"Row",
">",
"rows",
"=",
"new",
"HashMap",
"<>",
"(",
"columnFamilies",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"CellName",
",",
"ColumnFamily",
">",
"entry",
":",
"columnFamilies",
".",
"entrySet",
"(",
")",
")",
"{",
"Row",
"row",
"=",
"new",
"Row",
"(",
"partitionKey",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"rows",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"row",
")",
";",
"}",
"return",
"rows",
";",
"}"
]
| Returns the CQL3 {@link Row} identified by the specified key pair, using the specified time stamp to ignore
deleted columns. The {@link Row} is retrieved from the storage engine, so it involves IO operations.
@param partitionKey The partition key.
@param clusteringKeys The clustering keys.
@param timestamp The time stamp to ignore deleted columns.
@return The CQL3 {@link Row} identified by the specified key pair. | [
"Returns",
"the",
"CQL3",
"{",
"@link",
"Row",
"}",
"identified",
"by",
"the",
"specified",
"key",
"pair",
"using",
"the",
"specified",
"time",
"stamp",
"to",
"ignore",
"deleted",
"columns",
".",
"The",
"{",
"@link",
"Row",
"}",
"is",
"retrieved",
"from",
"the",
"storage",
"engine",
"so",
"it",
"involves",
"IO",
"operations",
"."
]
| train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/service/RowServiceWide.java#L166-L202 |
overturetool/overture | ide/ui/src/main/java/org/overture/ide/ui/navigator/ProblemLabelDecorator.java | ProblemLabelDecorator.containsSeverity | private boolean containsSeverity(IMarker[] markers, int severity) {
"""
Checks if any marker in the array has a defined severity which is set to the
@param markers
@param severity
@return
"""
for (int i = 0; i < markers.length; i++)
{
try
{
Object tmp = markers[i].getAttribute(IMarker.SEVERITY);
if(tmp == null && !(tmp instanceof Integer))
{
continue;
}
if (tmp!=null && ((Integer)tmp & severity)!=0)
{
return true;
}
} catch (CoreException e)
{
VdmUIPlugin.log("Faild to check marker attribute SEVERITY", e);
}
}
return false;
} | java | private boolean containsSeverity(IMarker[] markers, int severity)
{
for (int i = 0; i < markers.length; i++)
{
try
{
Object tmp = markers[i].getAttribute(IMarker.SEVERITY);
if(tmp == null && !(tmp instanceof Integer))
{
continue;
}
if (tmp!=null && ((Integer)tmp & severity)!=0)
{
return true;
}
} catch (CoreException e)
{
VdmUIPlugin.log("Faild to check marker attribute SEVERITY", e);
}
}
return false;
} | [
"private",
"boolean",
"containsSeverity",
"(",
"IMarker",
"[",
"]",
"markers",
",",
"int",
"severity",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"markers",
".",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"Object",
"tmp",
"=",
"markers",
"[",
"i",
"]",
".",
"getAttribute",
"(",
"IMarker",
".",
"SEVERITY",
")",
";",
"if",
"(",
"tmp",
"==",
"null",
"&&",
"!",
"(",
"tmp",
"instanceof",
"Integer",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"tmp",
"!=",
"null",
"&&",
"(",
"(",
"Integer",
")",
"tmp",
"&",
"severity",
")",
"!=",
"0",
")",
"{",
"return",
"true",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"VdmUIPlugin",
".",
"log",
"(",
"\"Faild to check marker attribute SEVERITY\"",
",",
"e",
")",
";",
"}",
"}",
"return",
"false",
";",
"}"
]
| Checks if any marker in the array has a defined severity which is set to the
@param markers
@param severity
@return | [
"Checks",
"if",
"any",
"marker",
"in",
"the",
"array",
"has",
"a",
"defined",
"severity",
"which",
"is",
"set",
"to",
"the"
]
| train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/ui/src/main/java/org/overture/ide/ui/navigator/ProblemLabelDecorator.java#L86-L107 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/cql3/MultiColumnRelation.java | MultiColumnRelation.createInRelation | public static MultiColumnRelation createInRelation(List<ColumnIdentifier.Raw> entities, List<? extends Term.MultiColumnRaw> inValues) {
"""
Creates a multi-column IN relation with a list of IN values or markers.
For example: "SELECT ... WHERE (a, b) IN ((0, 1), (2, 3))"
@param entities the columns on the LHS of the relation
@param inValues a list of Tuples.Literal instances or a Tuples.Raw markers
"""
return new MultiColumnRelation(entities, Operator.IN, null, inValues, null);
} | java | public static MultiColumnRelation createInRelation(List<ColumnIdentifier.Raw> entities, List<? extends Term.MultiColumnRaw> inValues)
{
return new MultiColumnRelation(entities, Operator.IN, null, inValues, null);
} | [
"public",
"static",
"MultiColumnRelation",
"createInRelation",
"(",
"List",
"<",
"ColumnIdentifier",
".",
"Raw",
">",
"entities",
",",
"List",
"<",
"?",
"extends",
"Term",
".",
"MultiColumnRaw",
">",
"inValues",
")",
"{",
"return",
"new",
"MultiColumnRelation",
"(",
"entities",
",",
"Operator",
".",
"IN",
",",
"null",
",",
"inValues",
",",
"null",
")",
";",
"}"
]
| Creates a multi-column IN relation with a list of IN values or markers.
For example: "SELECT ... WHERE (a, b) IN ((0, 1), (2, 3))"
@param entities the columns on the LHS of the relation
@param inValues a list of Tuples.Literal instances or a Tuples.Raw markers | [
"Creates",
"a",
"multi",
"-",
"column",
"IN",
"relation",
"with",
"a",
"list",
"of",
"IN",
"values",
"or",
"markers",
".",
"For",
"example",
":",
"SELECT",
"...",
"WHERE",
"(",
"a",
"b",
")",
"IN",
"((",
"0",
"1",
")",
"(",
"2",
"3",
"))"
]
| train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cql3/MultiColumnRelation.java#L71-L74 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/ds/LDAP.java | LDAP.authenicate | public Principal authenicate(String uid, char[] password)
throws SecurityException {
"""
Authenticate user ID and password against the LDAP server
@param uid i.e. greeng
@param password the user password
@return the user principal details
@throws SecurityException when security error occurs
"""
String rootDN = Config.getProperty(ROOT_DN_PROP);
int timeout = Config.getPropertyInteger(TIMEOUT_SECS_PROP).intValue();
Debugger.println(LDAP.class,"timeout="+timeout);
String uidAttributeName = Config.getProperty(UID_ATTRIB_NM_PROP);
String groupAttributeName = Config.getProperty(GROUP_ATTRIB_NM_PROP,"");
String memberOfAttributeName = Config.getProperty(MEMBEROF_ATTRIB_NM_PROP,"");
return authenicate(uid, password,rootDN,uidAttributeName,memberOfAttributeName,groupAttributeName,timeout);
} | java | public Principal authenicate(String uid, char[] password)
throws SecurityException
{
String rootDN = Config.getProperty(ROOT_DN_PROP);
int timeout = Config.getPropertyInteger(TIMEOUT_SECS_PROP).intValue();
Debugger.println(LDAP.class,"timeout="+timeout);
String uidAttributeName = Config.getProperty(UID_ATTRIB_NM_PROP);
String groupAttributeName = Config.getProperty(GROUP_ATTRIB_NM_PROP,"");
String memberOfAttributeName = Config.getProperty(MEMBEROF_ATTRIB_NM_PROP,"");
return authenicate(uid, password,rootDN,uidAttributeName,memberOfAttributeName,groupAttributeName,timeout);
} | [
"public",
"Principal",
"authenicate",
"(",
"String",
"uid",
",",
"char",
"[",
"]",
"password",
")",
"throws",
"SecurityException",
"{",
"String",
"rootDN",
"=",
"Config",
".",
"getProperty",
"(",
"ROOT_DN_PROP",
")",
";",
"int",
"timeout",
"=",
"Config",
".",
"getPropertyInteger",
"(",
"TIMEOUT_SECS_PROP",
")",
".",
"intValue",
"(",
")",
";",
"Debugger",
".",
"println",
"(",
"LDAP",
".",
"class",
",",
"\"timeout=\"",
"+",
"timeout",
")",
";",
"String",
"uidAttributeName",
"=",
"Config",
".",
"getProperty",
"(",
"UID_ATTRIB_NM_PROP",
")",
";",
"String",
"groupAttributeName",
"=",
"Config",
".",
"getProperty",
"(",
"GROUP_ATTRIB_NM_PROP",
",",
"\"\"",
")",
";",
"String",
"memberOfAttributeName",
"=",
"Config",
".",
"getProperty",
"(",
"MEMBEROF_ATTRIB_NM_PROP",
",",
"\"\"",
")",
";",
"return",
"authenicate",
"(",
"uid",
",",
"password",
",",
"rootDN",
",",
"uidAttributeName",
",",
"memberOfAttributeName",
",",
"groupAttributeName",
",",
"timeout",
")",
";",
"}"
]
| Authenticate user ID and password against the LDAP server
@param uid i.e. greeng
@param password the user password
@return the user principal details
@throws SecurityException when security error occurs | [
"Authenticate",
"user",
"ID",
"and",
"password",
"against",
"the",
"LDAP",
"server"
]
| train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/ds/LDAP.java#L270-L284 |
jbundle/jbundle | base/message/core/src/main/java/org/jbundle/base/message/core/trx/TrxMessageHeader.java | TrxMessageHeader.moveMapInfo | public void moveMapInfo(Map<String,Object> mapReplyHeader, Map<String,Object> mapInHeader, String strReplyParam, String strInParam) {
"""
Move this param from the header map to the reply map (if non null).
"""
if (mapInHeader != null)
if (mapInHeader.get(strInParam) != null)
if (mapReplyHeader != null)
mapReplyHeader.put(strReplyParam, mapInHeader.get(strInParam));
} | java | public void moveMapInfo(Map<String,Object> mapReplyHeader, Map<String,Object> mapInHeader, String strReplyParam, String strInParam)
{
if (mapInHeader != null)
if (mapInHeader.get(strInParam) != null)
if (mapReplyHeader != null)
mapReplyHeader.put(strReplyParam, mapInHeader.get(strInParam));
} | [
"public",
"void",
"moveMapInfo",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"mapReplyHeader",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"mapInHeader",
",",
"String",
"strReplyParam",
",",
"String",
"strInParam",
")",
"{",
"if",
"(",
"mapInHeader",
"!=",
"null",
")",
"if",
"(",
"mapInHeader",
".",
"get",
"(",
"strInParam",
")",
"!=",
"null",
")",
"if",
"(",
"mapReplyHeader",
"!=",
"null",
")",
"mapReplyHeader",
".",
"put",
"(",
"strReplyParam",
",",
"mapInHeader",
".",
"get",
"(",
"strInParam",
")",
")",
";",
"}"
]
| Move this param from the header map to the reply map (if non null). | [
"Move",
"this",
"param",
"from",
"the",
"header",
"map",
"to",
"the",
"reply",
"map",
"(",
"if",
"non",
"null",
")",
"."
]
| train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/trx/TrxMessageHeader.java#L396-L402 |
springfox/springfox | springfox-core/src/main/java/springfox/documentation/schema/AlternateTypeRules.java | AlternateTypeRules.newRule | public static AlternateTypeRule newRule(Type original, Type alternate) {
"""
Helper method to create a new alternate rule.
@param original the original
@param alternate the alternate
@return the alternate type rule
"""
return newRule(original, alternate, Ordered.LOWEST_PRECEDENCE);
} | java | public static AlternateTypeRule newRule(Type original, Type alternate) {
return newRule(original, alternate, Ordered.LOWEST_PRECEDENCE);
} | [
"public",
"static",
"AlternateTypeRule",
"newRule",
"(",
"Type",
"original",
",",
"Type",
"alternate",
")",
"{",
"return",
"newRule",
"(",
"original",
",",
"alternate",
",",
"Ordered",
".",
"LOWEST_PRECEDENCE",
")",
";",
"}"
]
| Helper method to create a new alternate rule.
@param original the original
@param alternate the alternate
@return the alternate type rule | [
"Helper",
"method",
"to",
"create",
"a",
"new",
"alternate",
"rule",
"."
]
| train | https://github.com/springfox/springfox/blob/e40e2d6f4b345ffa35cd5c0ca7a12589036acaf7/springfox-core/src/main/java/springfox/documentation/schema/AlternateTypeRules.java#L44-L46 |
HanSolo/tilesfx | src/main/java/eu/hansolo/tilesfx/tools/Helper.java | Helper.snapToTicks | public static double snapToTicks(final double MIN_VALUE, final double MAX_VALUE, final double VALUE, final int MINOR_TICK_COUNT, final double MAJOR_TICK_UNIT) {
"""
Can be used to implement discrete steps e.g. on a slider.
@param MIN_VALUE The min value of the range
@param MAX_VALUE The max value of the range
@param VALUE The value to snap
@param MINOR_TICK_COUNT The number of ticks between 2 major tick marks
@param MAJOR_TICK_UNIT The distance between 2 major tick marks
@return The value snapped to the next tick mark defined by the given parameters
"""
double v = VALUE;
int minorTickCount = clamp(0, 10, MINOR_TICK_COUNT);
double majorTickUnit = Double.compare(MAJOR_TICK_UNIT, 0.0) <= 0 ? 0.25 : MAJOR_TICK_UNIT;
double tickSpacing;
if (minorTickCount != 0) {
tickSpacing = majorTickUnit / (Math.max(minorTickCount, 0) + 1);
} else {
tickSpacing = majorTickUnit;
}
int prevTick = (int) ((v - MIN_VALUE) / tickSpacing);
double prevTickValue = prevTick * tickSpacing + MIN_VALUE;
double nextTickValue = (prevTick + 1) * tickSpacing + MIN_VALUE;
v = nearest(prevTickValue, v, nextTickValue);
return clamp(MIN_VALUE, MAX_VALUE, v);
} | java | public static double snapToTicks(final double MIN_VALUE, final double MAX_VALUE, final double VALUE, final int MINOR_TICK_COUNT, final double MAJOR_TICK_UNIT) {
double v = VALUE;
int minorTickCount = clamp(0, 10, MINOR_TICK_COUNT);
double majorTickUnit = Double.compare(MAJOR_TICK_UNIT, 0.0) <= 0 ? 0.25 : MAJOR_TICK_UNIT;
double tickSpacing;
if (minorTickCount != 0) {
tickSpacing = majorTickUnit / (Math.max(minorTickCount, 0) + 1);
} else {
tickSpacing = majorTickUnit;
}
int prevTick = (int) ((v - MIN_VALUE) / tickSpacing);
double prevTickValue = prevTick * tickSpacing + MIN_VALUE;
double nextTickValue = (prevTick + 1) * tickSpacing + MIN_VALUE;
v = nearest(prevTickValue, v, nextTickValue);
return clamp(MIN_VALUE, MAX_VALUE, v);
} | [
"public",
"static",
"double",
"snapToTicks",
"(",
"final",
"double",
"MIN_VALUE",
",",
"final",
"double",
"MAX_VALUE",
",",
"final",
"double",
"VALUE",
",",
"final",
"int",
"MINOR_TICK_COUNT",
",",
"final",
"double",
"MAJOR_TICK_UNIT",
")",
"{",
"double",
"v",
"=",
"VALUE",
";",
"int",
"minorTickCount",
"=",
"clamp",
"(",
"0",
",",
"10",
",",
"MINOR_TICK_COUNT",
")",
";",
"double",
"majorTickUnit",
"=",
"Double",
".",
"compare",
"(",
"MAJOR_TICK_UNIT",
",",
"0.0",
")",
"<=",
"0",
"?",
"0.25",
":",
"MAJOR_TICK_UNIT",
";",
"double",
"tickSpacing",
";",
"if",
"(",
"minorTickCount",
"!=",
"0",
")",
"{",
"tickSpacing",
"=",
"majorTickUnit",
"/",
"(",
"Math",
".",
"max",
"(",
"minorTickCount",
",",
"0",
")",
"+",
"1",
")",
";",
"}",
"else",
"{",
"tickSpacing",
"=",
"majorTickUnit",
";",
"}",
"int",
"prevTick",
"=",
"(",
"int",
")",
"(",
"(",
"v",
"-",
"MIN_VALUE",
")",
"/",
"tickSpacing",
")",
";",
"double",
"prevTickValue",
"=",
"prevTick",
"*",
"tickSpacing",
"+",
"MIN_VALUE",
";",
"double",
"nextTickValue",
"=",
"(",
"prevTick",
"+",
"1",
")",
"*",
"tickSpacing",
"+",
"MIN_VALUE",
";",
"v",
"=",
"nearest",
"(",
"prevTickValue",
",",
"v",
",",
"nextTickValue",
")",
";",
"return",
"clamp",
"(",
"MIN_VALUE",
",",
"MAX_VALUE",
",",
"v",
")",
";",
"}"
]
| Can be used to implement discrete steps e.g. on a slider.
@param MIN_VALUE The min value of the range
@param MAX_VALUE The max value of the range
@param VALUE The value to snap
@param MINOR_TICK_COUNT The number of ticks between 2 major tick marks
@param MAJOR_TICK_UNIT The distance between 2 major tick marks
@return The value snapped to the next tick mark defined by the given parameters | [
"Can",
"be",
"used",
"to",
"implement",
"discrete",
"steps",
"e",
".",
"g",
".",
"on",
"a",
"slider",
"."
]
| train | https://github.com/HanSolo/tilesfx/blob/36eb07b1119017beb851dad95256439224d1fcf4/src/main/java/eu/hansolo/tilesfx/tools/Helper.java#L500-L519 |
GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java | MaterialPathAnimator.reverseAnimate | public static void reverseAnimate(Widget source, Widget target, Functions.Func reverseCallback) {
"""
Helper method to reverse animate the source element to target element with reverse callback.
@param source Source widget to apply the Path Animator
@param target Target widget to apply the Path Animator
@param reverseCallback The reverse callback method to be called when the path animator is applied
"""
reverseAnimate(source.getElement(), target.getElement(), reverseCallback);
} | java | public static void reverseAnimate(Widget source, Widget target, Functions.Func reverseCallback) {
reverseAnimate(source.getElement(), target.getElement(), reverseCallback);
} | [
"public",
"static",
"void",
"reverseAnimate",
"(",
"Widget",
"source",
",",
"Widget",
"target",
",",
"Functions",
".",
"Func",
"reverseCallback",
")",
"{",
"reverseAnimate",
"(",
"source",
".",
"getElement",
"(",
")",
",",
"target",
".",
"getElement",
"(",
")",
",",
"reverseCallback",
")",
";",
"}"
]
| Helper method to reverse animate the source element to target element with reverse callback.
@param source Source widget to apply the Path Animator
@param target Target widget to apply the Path Animator
@param reverseCallback The reverse callback method to be called when the path animator is applied | [
"Helper",
"method",
"to",
"reverse",
"animate",
"the",
"source",
"element",
"to",
"target",
"element",
"with",
"reverse",
"callback",
"."
]
| train | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java#L234-L236 |
alkacon/opencms-core | src/org/opencms/module/CmsModuleUpdater.java | CmsModuleUpdater.readModuleData | public static CmsModuleImportData readModuleData(CmsObject cms, String importFile, I_CmsReport report)
throws CmsException {
"""
Reads the module data from an import zip file.<p>
@param cms the CMS context
@param importFile the import file
@param report the report to write to
@return the module data
@throws CmsException if something goes wrong
"""
CmsModuleImportData result = new CmsModuleImportData();
CmsModule module = CmsModuleImportExportHandler.readModuleFromImport(importFile);
cms = OpenCms.initCmsObject(cms);
String importSite = module.getImportSite();
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(importSite)) {
cms.getRequestContext().setSiteRoot(importSite);
} else {
String siteToSet = cms.getRequestContext().getSiteRoot();
if ("".equals(siteToSet)) {
siteToSet = "/";
}
module.setSite(siteToSet);
}
result.setModule(module);
result.setCms(cms);
CmsImportResourceDataReader importer = new CmsImportResourceDataReader(result);
CmsImportParameters params = new CmsImportParameters(importFile, "/", false);
importer.importData(cms, report, params); // This only reads the module data into Java objects
return result;
} | java | public static CmsModuleImportData readModuleData(CmsObject cms, String importFile, I_CmsReport report)
throws CmsException {
CmsModuleImportData result = new CmsModuleImportData();
CmsModule module = CmsModuleImportExportHandler.readModuleFromImport(importFile);
cms = OpenCms.initCmsObject(cms);
String importSite = module.getImportSite();
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(importSite)) {
cms.getRequestContext().setSiteRoot(importSite);
} else {
String siteToSet = cms.getRequestContext().getSiteRoot();
if ("".equals(siteToSet)) {
siteToSet = "/";
}
module.setSite(siteToSet);
}
result.setModule(module);
result.setCms(cms);
CmsImportResourceDataReader importer = new CmsImportResourceDataReader(result);
CmsImportParameters params = new CmsImportParameters(importFile, "/", false);
importer.importData(cms, report, params); // This only reads the module data into Java objects
return result;
} | [
"public",
"static",
"CmsModuleImportData",
"readModuleData",
"(",
"CmsObject",
"cms",
",",
"String",
"importFile",
",",
"I_CmsReport",
"report",
")",
"throws",
"CmsException",
"{",
"CmsModuleImportData",
"result",
"=",
"new",
"CmsModuleImportData",
"(",
")",
";",
"CmsModule",
"module",
"=",
"CmsModuleImportExportHandler",
".",
"readModuleFromImport",
"(",
"importFile",
")",
";",
"cms",
"=",
"OpenCms",
".",
"initCmsObject",
"(",
"cms",
")",
";",
"String",
"importSite",
"=",
"module",
".",
"getImportSite",
"(",
")",
";",
"if",
"(",
"!",
"CmsStringUtil",
".",
"isEmptyOrWhitespaceOnly",
"(",
"importSite",
")",
")",
"{",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"setSiteRoot",
"(",
"importSite",
")",
";",
"}",
"else",
"{",
"String",
"siteToSet",
"=",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getSiteRoot",
"(",
")",
";",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"siteToSet",
")",
")",
"{",
"siteToSet",
"=",
"\"/\"",
";",
"}",
"module",
".",
"setSite",
"(",
"siteToSet",
")",
";",
"}",
"result",
".",
"setModule",
"(",
"module",
")",
";",
"result",
".",
"setCms",
"(",
"cms",
")",
";",
"CmsImportResourceDataReader",
"importer",
"=",
"new",
"CmsImportResourceDataReader",
"(",
"result",
")",
";",
"CmsImportParameters",
"params",
"=",
"new",
"CmsImportParameters",
"(",
"importFile",
",",
"\"/\"",
",",
"false",
")",
";",
"importer",
".",
"importData",
"(",
"cms",
",",
"report",
",",
"params",
")",
";",
"// This only reads the module data into Java objects",
"return",
"result",
";",
"}"
]
| Reads the module data from an import zip file.<p>
@param cms the CMS context
@param importFile the import file
@param report the report to write to
@return the module data
@throws CmsException if something goes wrong | [
"Reads",
"the",
"module",
"data",
"from",
"an",
"import",
"zip",
"file",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleUpdater.java#L209-L233 |
geomajas/geomajas-project-client-gwt2 | plugin/editing/common/src/main/java/org/geomajas/plugin/editing/client/controller/AbstractGeometryIndexController.java | AbstractGeometryIndexController.getLocationWithinMaxBounds | private Coordinate getLocationWithinMaxBounds(Coordinate original) {
"""
Get a location, derived from the original, that is sure to be within the maximum bounds. If no maximum bounds
have been set, a clone of the original is returned.
@param original
The original location.
@return The derived location within the maximum bounds.
"""
double x = original.getX();
double y = original.getY();
if (maxBounds != null) {
if (original.getX() < maxBounds.getX()) {
x = maxBounds.getX();
} else if (original.getX() > maxBounds.getMaxX()) {
x = maxBounds.getMaxX();
}
if (original.getY() < maxBounds.getY()) {
y = maxBounds.getY();
} else if (original.getY() > maxBounds.getMaxY()) {
y = maxBounds.getMaxY();
}
}
return new Coordinate(x, y);
} | java | private Coordinate getLocationWithinMaxBounds(Coordinate original) {
double x = original.getX();
double y = original.getY();
if (maxBounds != null) {
if (original.getX() < maxBounds.getX()) {
x = maxBounds.getX();
} else if (original.getX() > maxBounds.getMaxX()) {
x = maxBounds.getMaxX();
}
if (original.getY() < maxBounds.getY()) {
y = maxBounds.getY();
} else if (original.getY() > maxBounds.getMaxY()) {
y = maxBounds.getMaxY();
}
}
return new Coordinate(x, y);
} | [
"private",
"Coordinate",
"getLocationWithinMaxBounds",
"(",
"Coordinate",
"original",
")",
"{",
"double",
"x",
"=",
"original",
".",
"getX",
"(",
")",
";",
"double",
"y",
"=",
"original",
".",
"getY",
"(",
")",
";",
"if",
"(",
"maxBounds",
"!=",
"null",
")",
"{",
"if",
"(",
"original",
".",
"getX",
"(",
")",
"<",
"maxBounds",
".",
"getX",
"(",
")",
")",
"{",
"x",
"=",
"maxBounds",
".",
"getX",
"(",
")",
";",
"}",
"else",
"if",
"(",
"original",
".",
"getX",
"(",
")",
">",
"maxBounds",
".",
"getMaxX",
"(",
")",
")",
"{",
"x",
"=",
"maxBounds",
".",
"getMaxX",
"(",
")",
";",
"}",
"if",
"(",
"original",
".",
"getY",
"(",
")",
"<",
"maxBounds",
".",
"getY",
"(",
")",
")",
"{",
"y",
"=",
"maxBounds",
".",
"getY",
"(",
")",
";",
"}",
"else",
"if",
"(",
"original",
".",
"getY",
"(",
")",
">",
"maxBounds",
".",
"getMaxY",
"(",
")",
")",
"{",
"y",
"=",
"maxBounds",
".",
"getMaxY",
"(",
")",
";",
"}",
"}",
"return",
"new",
"Coordinate",
"(",
"x",
",",
"y",
")",
";",
"}"
]
| Get a location, derived from the original, that is sure to be within the maximum bounds. If no maximum bounds
have been set, a clone of the original is returned.
@param original
The original location.
@return The derived location within the maximum bounds. | [
"Get",
"a",
"location",
"derived",
"from",
"the",
"original",
"that",
"is",
"sure",
"to",
"be",
"within",
"the",
"maximum",
"bounds",
".",
"If",
"no",
"maximum",
"bounds",
"have",
"been",
"set",
"a",
"clone",
"of",
"the",
"original",
"is",
"returned",
"."
]
| train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/editing/common/src/main/java/org/geomajas/plugin/editing/client/controller/AbstractGeometryIndexController.java#L151-L167 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/convert/RecipFieldConverter.java | RecipFieldConverter.setString | public int setString( String strField, boolean bDisplayOption, int iMoveMode) {
"""
Convert and move string to this field.
Get the recriprical of this string and set the string.
@param bState the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code (or NORMAL_RETURN).
"""
NumberField numberField = (NumberField)this.getNextConverter();
int iErrorCode = super.setString(strField, DBConstants.DONT_DISPLAY, iMoveMode);
if (strField.length() == 0)
numberField.displayField(); // Special Case (because we return immediately)
if ((iErrorCode != DBConstants.NORMAL_RETURN) || strField.length() == 0)
return iErrorCode;
double doubleValue = this.getValue();
if (doubleValue != 0)
doubleValue = 1 / doubleValue;
iErrorCode = this.setValue(doubleValue, bDisplayOption, DBConstants.SCREEN_MOVE);
return iErrorCode;
} | java | public int setString( String strField, boolean bDisplayOption, int iMoveMode)
{
NumberField numberField = (NumberField)this.getNextConverter();
int iErrorCode = super.setString(strField, DBConstants.DONT_DISPLAY, iMoveMode);
if (strField.length() == 0)
numberField.displayField(); // Special Case (because we return immediately)
if ((iErrorCode != DBConstants.NORMAL_RETURN) || strField.length() == 0)
return iErrorCode;
double doubleValue = this.getValue();
if (doubleValue != 0)
doubleValue = 1 / doubleValue;
iErrorCode = this.setValue(doubleValue, bDisplayOption, DBConstants.SCREEN_MOVE);
return iErrorCode;
} | [
"public",
"int",
"setString",
"(",
"String",
"strField",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"NumberField",
"numberField",
"=",
"(",
"NumberField",
")",
"this",
".",
"getNextConverter",
"(",
")",
";",
"int",
"iErrorCode",
"=",
"super",
".",
"setString",
"(",
"strField",
",",
"DBConstants",
".",
"DONT_DISPLAY",
",",
"iMoveMode",
")",
";",
"if",
"(",
"strField",
".",
"length",
"(",
")",
"==",
"0",
")",
"numberField",
".",
"displayField",
"(",
")",
";",
"// Special Case (because we return immediately)",
"if",
"(",
"(",
"iErrorCode",
"!=",
"DBConstants",
".",
"NORMAL_RETURN",
")",
"||",
"strField",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"iErrorCode",
";",
"double",
"doubleValue",
"=",
"this",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"doubleValue",
"!=",
"0",
")",
"doubleValue",
"=",
"1",
"/",
"doubleValue",
";",
"iErrorCode",
"=",
"this",
".",
"setValue",
"(",
"doubleValue",
",",
"bDisplayOption",
",",
"DBConstants",
".",
"SCREEN_MOVE",
")",
";",
"return",
"iErrorCode",
";",
"}"
]
| Convert and move string to this field.
Get the recriprical of this string and set the string.
@param bState the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code (or NORMAL_RETURN). | [
"Convert",
"and",
"move",
"string",
"to",
"this",
"field",
".",
"Get",
"the",
"recriprical",
"of",
"this",
"string",
"and",
"set",
"the",
"string",
"."
]
| train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/RecipFieldConverter.java#L77-L90 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsAuxiliary.java | ItemsAuxiliary.populateFromItemsSketch | private final static <T> void populateFromItemsSketch(
final int k, final long n, final long bitPattern, final T[] combinedBuffer,
final int baseBufferCount, final int numSamples, final T[] itemsArr, final long[] cumWtsArr,
final Comparator<? super T> comparator) {
"""
Populate the arrays and registers from an ItemsSketch
@param <T> the data type
@param k K value of sketch
@param n The current size of the stream
@param bitPattern the bit pattern for valid log levels
@param combinedBuffer the combined buffer reference
@param baseBufferCount the count of the base buffer
@param numSamples Total samples in the sketch
@param itemsArr the consolidated array of all items from the sketch populated here
@param cumWtsArr the cumulative weights for each item from the sketch populated here
@param comparator the given comparator for data type T
"""
long weight = 1;
int nxt = 0;
long bits = bitPattern;
assert bits == (n / (2L * k)); // internal consistency check
for (int lvl = 0; bits != 0L; lvl++, bits >>>= 1) {
weight *= 2;
if ((bits & 1L) > 0L) {
final int offset = (2 + lvl) * k;
for (int i = 0; i < k; i++) {
itemsArr[nxt] = combinedBuffer[i + offset];
cumWtsArr[nxt] = weight;
nxt++;
}
}
}
weight = 1; //NOT a mistake! We just copied the highest level; now we need to copy the base buffer
final int startOfBaseBufferBlock = nxt;
// Copy BaseBuffer over, along with weight = 1
for (int i = 0; i < baseBufferCount; i++) {
itemsArr[nxt] = combinedBuffer[i];
cumWtsArr[nxt] = weight;
nxt++;
}
assert nxt == numSamples;
// Must sort the items that came from the base buffer.
// Don't need to sort the corresponding weights because they are all the same.
Arrays.sort(itemsArr, startOfBaseBufferBlock, numSamples, comparator);
cumWtsArr[numSamples] = 0;
} | java | private final static <T> void populateFromItemsSketch(
final int k, final long n, final long bitPattern, final T[] combinedBuffer,
final int baseBufferCount, final int numSamples, final T[] itemsArr, final long[] cumWtsArr,
final Comparator<? super T> comparator) {
long weight = 1;
int nxt = 0;
long bits = bitPattern;
assert bits == (n / (2L * k)); // internal consistency check
for (int lvl = 0; bits != 0L; lvl++, bits >>>= 1) {
weight *= 2;
if ((bits & 1L) > 0L) {
final int offset = (2 + lvl) * k;
for (int i = 0; i < k; i++) {
itemsArr[nxt] = combinedBuffer[i + offset];
cumWtsArr[nxt] = weight;
nxt++;
}
}
}
weight = 1; //NOT a mistake! We just copied the highest level; now we need to copy the base buffer
final int startOfBaseBufferBlock = nxt;
// Copy BaseBuffer over, along with weight = 1
for (int i = 0; i < baseBufferCount; i++) {
itemsArr[nxt] = combinedBuffer[i];
cumWtsArr[nxt] = weight;
nxt++;
}
assert nxt == numSamples;
// Must sort the items that came from the base buffer.
// Don't need to sort the corresponding weights because they are all the same.
Arrays.sort(itemsArr, startOfBaseBufferBlock, numSamples, comparator);
cumWtsArr[numSamples] = 0;
} | [
"private",
"final",
"static",
"<",
"T",
">",
"void",
"populateFromItemsSketch",
"(",
"final",
"int",
"k",
",",
"final",
"long",
"n",
",",
"final",
"long",
"bitPattern",
",",
"final",
"T",
"[",
"]",
"combinedBuffer",
",",
"final",
"int",
"baseBufferCount",
",",
"final",
"int",
"numSamples",
",",
"final",
"T",
"[",
"]",
"itemsArr",
",",
"final",
"long",
"[",
"]",
"cumWtsArr",
",",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
")",
"{",
"long",
"weight",
"=",
"1",
";",
"int",
"nxt",
"=",
"0",
";",
"long",
"bits",
"=",
"bitPattern",
";",
"assert",
"bits",
"==",
"(",
"n",
"/",
"(",
"2L",
"*",
"k",
")",
")",
";",
"// internal consistency check",
"for",
"(",
"int",
"lvl",
"=",
"0",
";",
"bits",
"!=",
"0L",
";",
"lvl",
"++",
",",
"bits",
">>>=",
"1",
")",
"{",
"weight",
"*=",
"2",
";",
"if",
"(",
"(",
"bits",
"&",
"1L",
")",
">",
"0L",
")",
"{",
"final",
"int",
"offset",
"=",
"(",
"2",
"+",
"lvl",
")",
"*",
"k",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"k",
";",
"i",
"++",
")",
"{",
"itemsArr",
"[",
"nxt",
"]",
"=",
"combinedBuffer",
"[",
"i",
"+",
"offset",
"]",
";",
"cumWtsArr",
"[",
"nxt",
"]",
"=",
"weight",
";",
"nxt",
"++",
";",
"}",
"}",
"}",
"weight",
"=",
"1",
";",
"//NOT a mistake! We just copied the highest level; now we need to copy the base buffer",
"final",
"int",
"startOfBaseBufferBlock",
"=",
"nxt",
";",
"// Copy BaseBuffer over, along with weight = 1",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"baseBufferCount",
";",
"i",
"++",
")",
"{",
"itemsArr",
"[",
"nxt",
"]",
"=",
"combinedBuffer",
"[",
"i",
"]",
";",
"cumWtsArr",
"[",
"nxt",
"]",
"=",
"weight",
";",
"nxt",
"++",
";",
"}",
"assert",
"nxt",
"==",
"numSamples",
";",
"// Must sort the items that came from the base buffer.",
"// Don't need to sort the corresponding weights because they are all the same.",
"Arrays",
".",
"sort",
"(",
"itemsArr",
",",
"startOfBaseBufferBlock",
",",
"numSamples",
",",
"comparator",
")",
";",
"cumWtsArr",
"[",
"numSamples",
"]",
"=",
"0",
";",
"}"
]
| Populate the arrays and registers from an ItemsSketch
@param <T> the data type
@param k K value of sketch
@param n The current size of the stream
@param bitPattern the bit pattern for valid log levels
@param combinedBuffer the combined buffer reference
@param baseBufferCount the count of the base buffer
@param numSamples Total samples in the sketch
@param itemsArr the consolidated array of all items from the sketch populated here
@param cumWtsArr the cumulative weights for each item from the sketch populated here
@param comparator the given comparator for data type T | [
"Populate",
"the",
"arrays",
"and",
"registers",
"from",
"an",
"ItemsSketch"
]
| train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsAuxiliary.java#L111-L146 |
MaxLeap/SDK-CloudCode-Java | cloud-code-sdk/src/main/java/com/maxleap/code/impl/WebUtils.java | WebUtils.doRequestWithBody | private static String doRequestWithBody(String url, String method, Map<String, String> header, String ctype, byte[] content, int connectTimeout, int readTimeout) throws IOException {
"""
执行HTTP POST请求。
@param url 请求地址
@param ctype 请求类型
@param content 请求字节数组
@return 响应字符串
@throws IOException
"""
HttpURLConnection conn = null;
OutputStream out = null;
String rsp = null;
try {
try {
conn = getConnection(new URL(url), method, header, ctype);
conn.setConnectTimeout(connectTimeout);
conn.setReadTimeout(readTimeout);
} catch (IOException e) {
throw e;
}
try {
out = conn.getOutputStream();
out.write(content);
rsp = getResponseAsString(conn);
} catch (IOException e) {
throw e;
}
} finally {
if (out != null) {
out.close();
}
if (conn != null) {
conn.disconnect();
}
}
return rsp;
} | java | private static String doRequestWithBody(String url, String method, Map<String, String> header, String ctype, byte[] content, int connectTimeout, int readTimeout) throws IOException {
HttpURLConnection conn = null;
OutputStream out = null;
String rsp = null;
try {
try {
conn = getConnection(new URL(url), method, header, ctype);
conn.setConnectTimeout(connectTimeout);
conn.setReadTimeout(readTimeout);
} catch (IOException e) {
throw e;
}
try {
out = conn.getOutputStream();
out.write(content);
rsp = getResponseAsString(conn);
} catch (IOException e) {
throw e;
}
} finally {
if (out != null) {
out.close();
}
if (conn != null) {
conn.disconnect();
}
}
return rsp;
} | [
"private",
"static",
"String",
"doRequestWithBody",
"(",
"String",
"url",
",",
"String",
"method",
",",
"Map",
"<",
"String",
",",
"String",
">",
"header",
",",
"String",
"ctype",
",",
"byte",
"[",
"]",
"content",
",",
"int",
"connectTimeout",
",",
"int",
"readTimeout",
")",
"throws",
"IOException",
"{",
"HttpURLConnection",
"conn",
"=",
"null",
";",
"OutputStream",
"out",
"=",
"null",
";",
"String",
"rsp",
"=",
"null",
";",
"try",
"{",
"try",
"{",
"conn",
"=",
"getConnection",
"(",
"new",
"URL",
"(",
"url",
")",
",",
"method",
",",
"header",
",",
"ctype",
")",
";",
"conn",
".",
"setConnectTimeout",
"(",
"connectTimeout",
")",
";",
"conn",
".",
"setReadTimeout",
"(",
"readTimeout",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"try",
"{",
"out",
"=",
"conn",
".",
"getOutputStream",
"(",
")",
";",
"out",
".",
"write",
"(",
"content",
")",
";",
"rsp",
"=",
"getResponseAsString",
"(",
"conn",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"out",
"!=",
"null",
")",
"{",
"out",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"conn",
"!=",
"null",
")",
"{",
"conn",
".",
"disconnect",
"(",
")",
";",
"}",
"}",
"return",
"rsp",
";",
"}"
]
| 执行HTTP POST请求。
@param url 请求地址
@param ctype 请求类型
@param content 请求字节数组
@return 响应字符串
@throws IOException | [
"执行HTTP",
"POST请求。"
]
| train | https://github.com/MaxLeap/SDK-CloudCode-Java/blob/756064c65dd613919c377bf136cf8710c7507968/cloud-code-sdk/src/main/java/com/maxleap/code/impl/WebUtils.java#L99-L128 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldTracker.java | TldTracker.initialize | public void initialize( T image , int x0 , int y0 , int x1 , int y1 ) {
"""
Starts tracking the rectangular region.
@param image First image in the sequence.
@param x0 Top-left corner of rectangle. x-axis
@param y0 Top-left corner of rectangle. y-axis
@param x1 Bottom-right corner of rectangle. x-axis
@param y1 Bottom-right corner of rectangle. y-axis
"""
if( imagePyramid == null ||
imagePyramid.getInputWidth() != image.width || imagePyramid.getInputHeight() != image.height ) {
int minSize = (config.trackerFeatureRadius*2+1)*5;
int scales[] = selectPyramidScale(image.width,image.height,minSize);
imagePyramid = FactoryPyramid.discreteGaussian(scales,-1,1,true,image.getImageType());
}
imagePyramid.process(image);
reacquiring = false;
targetRegion.set(x0, y0, x1, y1);
createCascadeRegion(image.width,image.height);
template.reset();
fern.reset();
tracking.initialize(imagePyramid);
variance.setImage(image);
template.setImage(image);
fern.setImage(image);
adjustRegion.init(image.width,image.height);
learning.initialLearning(targetRegion, cascadeRegions);
strongMatch = true;
previousTrackArea = targetRegion.area();
} | java | public void initialize( T image , int x0 , int y0 , int x1 , int y1 ) {
if( imagePyramid == null ||
imagePyramid.getInputWidth() != image.width || imagePyramid.getInputHeight() != image.height ) {
int minSize = (config.trackerFeatureRadius*2+1)*5;
int scales[] = selectPyramidScale(image.width,image.height,minSize);
imagePyramid = FactoryPyramid.discreteGaussian(scales,-1,1,true,image.getImageType());
}
imagePyramid.process(image);
reacquiring = false;
targetRegion.set(x0, y0, x1, y1);
createCascadeRegion(image.width,image.height);
template.reset();
fern.reset();
tracking.initialize(imagePyramid);
variance.setImage(image);
template.setImage(image);
fern.setImage(image);
adjustRegion.init(image.width,image.height);
learning.initialLearning(targetRegion, cascadeRegions);
strongMatch = true;
previousTrackArea = targetRegion.area();
} | [
"public",
"void",
"initialize",
"(",
"T",
"image",
",",
"int",
"x0",
",",
"int",
"y0",
",",
"int",
"x1",
",",
"int",
"y1",
")",
"{",
"if",
"(",
"imagePyramid",
"==",
"null",
"||",
"imagePyramid",
".",
"getInputWidth",
"(",
")",
"!=",
"image",
".",
"width",
"||",
"imagePyramid",
".",
"getInputHeight",
"(",
")",
"!=",
"image",
".",
"height",
")",
"{",
"int",
"minSize",
"=",
"(",
"config",
".",
"trackerFeatureRadius",
"*",
"2",
"+",
"1",
")",
"*",
"5",
";",
"int",
"scales",
"[",
"]",
"=",
"selectPyramidScale",
"(",
"image",
".",
"width",
",",
"image",
".",
"height",
",",
"minSize",
")",
";",
"imagePyramid",
"=",
"FactoryPyramid",
".",
"discreteGaussian",
"(",
"scales",
",",
"-",
"1",
",",
"1",
",",
"true",
",",
"image",
".",
"getImageType",
"(",
")",
")",
";",
"}",
"imagePyramid",
".",
"process",
"(",
"image",
")",
";",
"reacquiring",
"=",
"false",
";",
"targetRegion",
".",
"set",
"(",
"x0",
",",
"y0",
",",
"x1",
",",
"y1",
")",
";",
"createCascadeRegion",
"(",
"image",
".",
"width",
",",
"image",
".",
"height",
")",
";",
"template",
".",
"reset",
"(",
")",
";",
"fern",
".",
"reset",
"(",
")",
";",
"tracking",
".",
"initialize",
"(",
"imagePyramid",
")",
";",
"variance",
".",
"setImage",
"(",
"image",
")",
";",
"template",
".",
"setImage",
"(",
"image",
")",
";",
"fern",
".",
"setImage",
"(",
"image",
")",
";",
"adjustRegion",
".",
"init",
"(",
"image",
".",
"width",
",",
"image",
".",
"height",
")",
";",
"learning",
".",
"initialLearning",
"(",
"targetRegion",
",",
"cascadeRegions",
")",
";",
"strongMatch",
"=",
"true",
";",
"previousTrackArea",
"=",
"targetRegion",
".",
"area",
"(",
")",
";",
"}"
]
| Starts tracking the rectangular region.
@param image First image in the sequence.
@param x0 Top-left corner of rectangle. x-axis
@param y0 Top-left corner of rectangle. y-axis
@param x1 Bottom-right corner of rectangle. x-axis
@param y1 Bottom-right corner of rectangle. y-axis | [
"Starts",
"tracking",
"the",
"rectangular",
"region",
"."
]
| train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldTracker.java#L148-L175 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java | Symtab.enterClass | public ClassSymbol enterClass(ModuleSymbol msym, Name flatname) {
"""
Create a new member or toplevel class symbol with given flat name
and enter in `classes' unless already there.
"""
Assert.checkNonNull(msym);
PackageSymbol ps = lookupPackage(msym, Convert.packagePart(flatname));
Assert.checkNonNull(ps);
Assert.checkNonNull(ps.modle);
ClassSymbol c = getClass(ps.modle, flatname);
if (c == null) {
c = defineClass(Convert.shortName(flatname), ps);
doEnterClass(ps.modle, c);
return c;
} else
return c;
} | java | public ClassSymbol enterClass(ModuleSymbol msym, Name flatname) {
Assert.checkNonNull(msym);
PackageSymbol ps = lookupPackage(msym, Convert.packagePart(flatname));
Assert.checkNonNull(ps);
Assert.checkNonNull(ps.modle);
ClassSymbol c = getClass(ps.modle, flatname);
if (c == null) {
c = defineClass(Convert.shortName(flatname), ps);
doEnterClass(ps.modle, c);
return c;
} else
return c;
} | [
"public",
"ClassSymbol",
"enterClass",
"(",
"ModuleSymbol",
"msym",
",",
"Name",
"flatname",
")",
"{",
"Assert",
".",
"checkNonNull",
"(",
"msym",
")",
";",
"PackageSymbol",
"ps",
"=",
"lookupPackage",
"(",
"msym",
",",
"Convert",
".",
"packagePart",
"(",
"flatname",
")",
")",
";",
"Assert",
".",
"checkNonNull",
"(",
"ps",
")",
";",
"Assert",
".",
"checkNonNull",
"(",
"ps",
".",
"modle",
")",
";",
"ClassSymbol",
"c",
"=",
"getClass",
"(",
"ps",
".",
"modle",
",",
"flatname",
")",
";",
"if",
"(",
"c",
"==",
"null",
")",
"{",
"c",
"=",
"defineClass",
"(",
"Convert",
".",
"shortName",
"(",
"flatname",
")",
",",
"ps",
")",
";",
"doEnterClass",
"(",
"ps",
".",
"modle",
",",
"c",
")",
";",
"return",
"c",
";",
"}",
"else",
"return",
"c",
";",
"}"
]
| Create a new member or toplevel class symbol with given flat name
and enter in `classes' unless already there. | [
"Create",
"a",
"new",
"member",
"or",
"toplevel",
"class",
"symbol",
"with",
"given",
"flat",
"name",
"and",
"enter",
"in",
"classes",
"unless",
"already",
"there",
"."
]
| train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java#L705-L717 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/protocol/AbstractQueryProtocol.java | AbstractQueryProtocol.executeQuery | @Override
public void executeQuery(boolean mustExecuteOnMaster, Results results, final String sql)
throws SQLException {
"""
Execute query directly to outputStream.
@param mustExecuteOnMaster was intended to be launched on master connection
@param results result
@param sql the query to executeInternal
@throws SQLException exception
"""
cmdPrologue();
try {
writer.startPacket(0);
writer.write(COM_QUERY);
writer.write(sql);
writer.flush();
getResult(results);
} catch (SQLException sqlException) {
if ("70100".equals(sqlException.getSQLState()) && 1927 == sqlException.getErrorCode()) {
throw handleIoException(sqlException);
}
throw logQuery.exceptionWithQuery(sql, sqlException, explicitClosed);
} catch (IOException e) {
throw handleIoException(e);
}
} | java | @Override
public void executeQuery(boolean mustExecuteOnMaster, Results results, final String sql)
throws SQLException {
cmdPrologue();
try {
writer.startPacket(0);
writer.write(COM_QUERY);
writer.write(sql);
writer.flush();
getResult(results);
} catch (SQLException sqlException) {
if ("70100".equals(sqlException.getSQLState()) && 1927 == sqlException.getErrorCode()) {
throw handleIoException(sqlException);
}
throw logQuery.exceptionWithQuery(sql, sqlException, explicitClosed);
} catch (IOException e) {
throw handleIoException(e);
}
} | [
"@",
"Override",
"public",
"void",
"executeQuery",
"(",
"boolean",
"mustExecuteOnMaster",
",",
"Results",
"results",
",",
"final",
"String",
"sql",
")",
"throws",
"SQLException",
"{",
"cmdPrologue",
"(",
")",
";",
"try",
"{",
"writer",
".",
"startPacket",
"(",
"0",
")",
";",
"writer",
".",
"write",
"(",
"COM_QUERY",
")",
";",
"writer",
".",
"write",
"(",
"sql",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"getResult",
"(",
"results",
")",
";",
"}",
"catch",
"(",
"SQLException",
"sqlException",
")",
"{",
"if",
"(",
"\"70100\"",
".",
"equals",
"(",
"sqlException",
".",
"getSQLState",
"(",
")",
")",
"&&",
"1927",
"==",
"sqlException",
".",
"getErrorCode",
"(",
")",
")",
"{",
"throw",
"handleIoException",
"(",
"sqlException",
")",
";",
"}",
"throw",
"logQuery",
".",
"exceptionWithQuery",
"(",
"sql",
",",
"sqlException",
",",
"explicitClosed",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"handleIoException",
"(",
"e",
")",
";",
"}",
"}"
]
| Execute query directly to outputStream.
@param mustExecuteOnMaster was intended to be launched on master connection
@param results result
@param sql the query to executeInternal
@throws SQLException exception | [
"Execute",
"query",
"directly",
"to",
"outputStream",
"."
]
| train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractQueryProtocol.java#L216-L238 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/f/FundamentalLinear8.java | FundamentalLinear8.process | public boolean process( List<AssociatedPair> points , DMatrixRMaj solution ) {
"""
<p>
Computes a fundamental or essential matrix from a set of associated point correspondences.
</p>
@param points List of corresponding image coordinates. In pixel for fundamental matrix or
normalized coordinates for essential matrix.
@return true If successful or false if it failed
"""
if( points.size() < 8 )
throw new IllegalArgumentException("Must be at least 8 points. Was only "+points.size());
// use normalized coordinates for pixel and calibrated
// TODO re-evaluate decision to normalize for calibrated case
LowLevelMultiViewOps.computeNormalization(points, N1, N2);
createA(points,A);
if (process(A,solution))
return false;
// undo normalization on F
PerspectiveOps.multTranA(N2.matrix(),solution,N1.matrix(),solution);
if( computeFundamental )
return projectOntoFundamentalSpace(solution);
else
return projectOntoEssential(solution);
} | java | public boolean process( List<AssociatedPair> points , DMatrixRMaj solution ) {
if( points.size() < 8 )
throw new IllegalArgumentException("Must be at least 8 points. Was only "+points.size());
// use normalized coordinates for pixel and calibrated
// TODO re-evaluate decision to normalize for calibrated case
LowLevelMultiViewOps.computeNormalization(points, N1, N2);
createA(points,A);
if (process(A,solution))
return false;
// undo normalization on F
PerspectiveOps.multTranA(N2.matrix(),solution,N1.matrix(),solution);
if( computeFundamental )
return projectOntoFundamentalSpace(solution);
else
return projectOntoEssential(solution);
} | [
"public",
"boolean",
"process",
"(",
"List",
"<",
"AssociatedPair",
">",
"points",
",",
"DMatrixRMaj",
"solution",
")",
"{",
"if",
"(",
"points",
".",
"size",
"(",
")",
"<",
"8",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Must be at least 8 points. Was only \"",
"+",
"points",
".",
"size",
"(",
")",
")",
";",
"// use normalized coordinates for pixel and calibrated",
"// TODO re-evaluate decision to normalize for calibrated case",
"LowLevelMultiViewOps",
".",
"computeNormalization",
"(",
"points",
",",
"N1",
",",
"N2",
")",
";",
"createA",
"(",
"points",
",",
"A",
")",
";",
"if",
"(",
"process",
"(",
"A",
",",
"solution",
")",
")",
"return",
"false",
";",
"// undo normalization on F",
"PerspectiveOps",
".",
"multTranA",
"(",
"N2",
".",
"matrix",
"(",
")",
",",
"solution",
",",
"N1",
".",
"matrix",
"(",
")",
",",
"solution",
")",
";",
"if",
"(",
"computeFundamental",
")",
"return",
"projectOntoFundamentalSpace",
"(",
"solution",
")",
";",
"else",
"return",
"projectOntoEssential",
"(",
"solution",
")",
";",
"}"
]
| <p>
Computes a fundamental or essential matrix from a set of associated point correspondences.
</p>
@param points List of corresponding image coordinates. In pixel for fundamental matrix or
normalized coordinates for essential matrix.
@return true If successful or false if it failed | [
"<p",
">",
"Computes",
"a",
"fundamental",
"or",
"essential",
"matrix",
"from",
"a",
"set",
"of",
"associated",
"point",
"correspondences",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/f/FundamentalLinear8.java#L70-L89 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsMappingProvider.java | SiftsMappingProvider.getSiftsMapping | public static List<SiftsEntity> getSiftsMapping(String pdbId) throws IOException {
"""
Return the SIFTS mappings by getting the info from individual SIFTS xml files at URL {@value EBI_SIFTS_FILE_LOCATION}
@param pdbId the pdb identifier
@return
@throws IOException if problems downloading or parsing the file
"""
// grab files from here:
AtomCache cache = new AtomCache();
String path = cache.getCachePath();
pdbId = pdbId.toLowerCase();
String dirHash = pdbId.substring(1,3);
File siftsDir = new File(path , "SIFTS");
if ( ! siftsDir.exists()) {
logger.info("Creating directory {}", siftsDir.toString());
siftsDir.mkdir();
}
File hashDir = new File(siftsDir, dirHash);
if ( ! hashDir.exists()){
logger.info("Creating directory {}", hashDir.toString());
hashDir.mkdir();
}
File dest = new File( hashDir, pdbId + ".sifts.xml.gz");
logger.debug("testing SIFTS file " + dest.getAbsolutePath());
if ( ! dest.exists()){
String u = String.format(fileLoc,pdbId);
URL url = new URL(u);
logger.debug("Downloading SIFTS file {} to {}",url,dest);
FileDownloadUtils.downloadFile(url, dest);
}
InputStreamProvider prov = new InputStreamProvider();
InputStream is = prov.getInputStream(dest);
SiftsXMLParser parser = new SiftsXMLParser();
parser.parseXmlFile(is);
//System.out.println(parser.getEntities());
return parser.getEntities();
} | java | public static List<SiftsEntity> getSiftsMapping(String pdbId) throws IOException{
// grab files from here:
AtomCache cache = new AtomCache();
String path = cache.getCachePath();
pdbId = pdbId.toLowerCase();
String dirHash = pdbId.substring(1,3);
File siftsDir = new File(path , "SIFTS");
if ( ! siftsDir.exists()) {
logger.info("Creating directory {}", siftsDir.toString());
siftsDir.mkdir();
}
File hashDir = new File(siftsDir, dirHash);
if ( ! hashDir.exists()){
logger.info("Creating directory {}", hashDir.toString());
hashDir.mkdir();
}
File dest = new File( hashDir, pdbId + ".sifts.xml.gz");
logger.debug("testing SIFTS file " + dest.getAbsolutePath());
if ( ! dest.exists()){
String u = String.format(fileLoc,pdbId);
URL url = new URL(u);
logger.debug("Downloading SIFTS file {} to {}",url,dest);
FileDownloadUtils.downloadFile(url, dest);
}
InputStreamProvider prov = new InputStreamProvider();
InputStream is = prov.getInputStream(dest);
SiftsXMLParser parser = new SiftsXMLParser();
parser.parseXmlFile(is);
//System.out.println(parser.getEntities());
return parser.getEntities();
} | [
"public",
"static",
"List",
"<",
"SiftsEntity",
">",
"getSiftsMapping",
"(",
"String",
"pdbId",
")",
"throws",
"IOException",
"{",
"// grab files from here:",
"AtomCache",
"cache",
"=",
"new",
"AtomCache",
"(",
")",
";",
"String",
"path",
"=",
"cache",
".",
"getCachePath",
"(",
")",
";",
"pdbId",
"=",
"pdbId",
".",
"toLowerCase",
"(",
")",
";",
"String",
"dirHash",
"=",
"pdbId",
".",
"substring",
"(",
"1",
",",
"3",
")",
";",
"File",
"siftsDir",
"=",
"new",
"File",
"(",
"path",
",",
"\"SIFTS\"",
")",
";",
"if",
"(",
"!",
"siftsDir",
".",
"exists",
"(",
")",
")",
"{",
"logger",
".",
"info",
"(",
"\"Creating directory {}\"",
",",
"siftsDir",
".",
"toString",
"(",
")",
")",
";",
"siftsDir",
".",
"mkdir",
"(",
")",
";",
"}",
"File",
"hashDir",
"=",
"new",
"File",
"(",
"siftsDir",
",",
"dirHash",
")",
";",
"if",
"(",
"!",
"hashDir",
".",
"exists",
"(",
")",
")",
"{",
"logger",
".",
"info",
"(",
"\"Creating directory {}\"",
",",
"hashDir",
".",
"toString",
"(",
")",
")",
";",
"hashDir",
".",
"mkdir",
"(",
")",
";",
"}",
"File",
"dest",
"=",
"new",
"File",
"(",
"hashDir",
",",
"pdbId",
"+",
"\".sifts.xml.gz\"",
")",
";",
"logger",
".",
"debug",
"(",
"\"testing SIFTS file \"",
"+",
"dest",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"if",
"(",
"!",
"dest",
".",
"exists",
"(",
")",
")",
"{",
"String",
"u",
"=",
"String",
".",
"format",
"(",
"fileLoc",
",",
"pdbId",
")",
";",
"URL",
"url",
"=",
"new",
"URL",
"(",
"u",
")",
";",
"logger",
".",
"debug",
"(",
"\"Downloading SIFTS file {} to {}\"",
",",
"url",
",",
"dest",
")",
";",
"FileDownloadUtils",
".",
"downloadFile",
"(",
"url",
",",
"dest",
")",
";",
"}",
"InputStreamProvider",
"prov",
"=",
"new",
"InputStreamProvider",
"(",
")",
";",
"InputStream",
"is",
"=",
"prov",
".",
"getInputStream",
"(",
"dest",
")",
";",
"SiftsXMLParser",
"parser",
"=",
"new",
"SiftsXMLParser",
"(",
")",
";",
"parser",
".",
"parseXmlFile",
"(",
"is",
")",
";",
"//System.out.println(parser.getEntities());",
"return",
"parser",
".",
"getEntities",
"(",
")",
";",
"}"
]
| Return the SIFTS mappings by getting the info from individual SIFTS xml files at URL {@value EBI_SIFTS_FILE_LOCATION}
@param pdbId the pdb identifier
@return
@throws IOException if problems downloading or parsing the file | [
"Return",
"the",
"SIFTS",
"mappings",
"by",
"getting",
"the",
"info",
"from",
"individual",
"SIFTS",
"xml",
"files",
"at",
"URL",
"{"
]
| train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsMappingProvider.java#L58-L104 |
apache/incubator-druid | server/src/main/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriver.java | StreamAppenderatorDriver.moveSegmentOut | public void moveSegmentOut(final String sequenceName, final List<SegmentIdWithShardSpec> identifiers) {
"""
Move a set of identifiers out from "active", making way for newer segments.
This method is to support KafkaIndexTask's legacy mode and will be removed in the future.
See KakfaIndexTask.runLegacy().
"""
synchronized (segments) {
final SegmentsForSequence activeSegmentsForSequence = segments.get(sequenceName);
if (activeSegmentsForSequence == null) {
throw new ISE("WTF?! Asked to remove segments for sequenceName[%s] which doesn't exist...", sequenceName);
}
for (final SegmentIdWithShardSpec identifier : identifiers) {
log.info("Moving segment[%s] out of active list.", identifier);
final long key = identifier.getInterval().getStartMillis();
final SegmentsOfInterval segmentsOfInterval = activeSegmentsForSequence.get(key);
if (segmentsOfInterval == null ||
segmentsOfInterval.getAppendingSegment() == null ||
!segmentsOfInterval.getAppendingSegment().getSegmentIdentifier().equals(identifier)) {
throw new ISE("WTF?! Asked to remove segment[%s] that didn't exist...", identifier);
}
segmentsOfInterval.finishAppendingToCurrentActiveSegment(SegmentWithState::finishAppending);
}
}
} | java | public void moveSegmentOut(final String sequenceName, final List<SegmentIdWithShardSpec> identifiers)
{
synchronized (segments) {
final SegmentsForSequence activeSegmentsForSequence = segments.get(sequenceName);
if (activeSegmentsForSequence == null) {
throw new ISE("WTF?! Asked to remove segments for sequenceName[%s] which doesn't exist...", sequenceName);
}
for (final SegmentIdWithShardSpec identifier : identifiers) {
log.info("Moving segment[%s] out of active list.", identifier);
final long key = identifier.getInterval().getStartMillis();
final SegmentsOfInterval segmentsOfInterval = activeSegmentsForSequence.get(key);
if (segmentsOfInterval == null ||
segmentsOfInterval.getAppendingSegment() == null ||
!segmentsOfInterval.getAppendingSegment().getSegmentIdentifier().equals(identifier)) {
throw new ISE("WTF?! Asked to remove segment[%s] that didn't exist...", identifier);
}
segmentsOfInterval.finishAppendingToCurrentActiveSegment(SegmentWithState::finishAppending);
}
}
} | [
"public",
"void",
"moveSegmentOut",
"(",
"final",
"String",
"sequenceName",
",",
"final",
"List",
"<",
"SegmentIdWithShardSpec",
">",
"identifiers",
")",
"{",
"synchronized",
"(",
"segments",
")",
"{",
"final",
"SegmentsForSequence",
"activeSegmentsForSequence",
"=",
"segments",
".",
"get",
"(",
"sequenceName",
")",
";",
"if",
"(",
"activeSegmentsForSequence",
"==",
"null",
")",
"{",
"throw",
"new",
"ISE",
"(",
"\"WTF?! Asked to remove segments for sequenceName[%s] which doesn't exist...\"",
",",
"sequenceName",
")",
";",
"}",
"for",
"(",
"final",
"SegmentIdWithShardSpec",
"identifier",
":",
"identifiers",
")",
"{",
"log",
".",
"info",
"(",
"\"Moving segment[%s] out of active list.\"",
",",
"identifier",
")",
";",
"final",
"long",
"key",
"=",
"identifier",
".",
"getInterval",
"(",
")",
".",
"getStartMillis",
"(",
")",
";",
"final",
"SegmentsOfInterval",
"segmentsOfInterval",
"=",
"activeSegmentsForSequence",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"segmentsOfInterval",
"==",
"null",
"||",
"segmentsOfInterval",
".",
"getAppendingSegment",
"(",
")",
"==",
"null",
"||",
"!",
"segmentsOfInterval",
".",
"getAppendingSegment",
"(",
")",
".",
"getSegmentIdentifier",
"(",
")",
".",
"equals",
"(",
"identifier",
")",
")",
"{",
"throw",
"new",
"ISE",
"(",
"\"WTF?! Asked to remove segment[%s] that didn't exist...\"",
",",
"identifier",
")",
";",
"}",
"segmentsOfInterval",
".",
"finishAppendingToCurrentActiveSegment",
"(",
"SegmentWithState",
"::",
"finishAppending",
")",
";",
"}",
"}",
"}"
]
| Move a set of identifiers out from "active", making way for newer segments.
This method is to support KafkaIndexTask's legacy mode and will be removed in the future.
See KakfaIndexTask.runLegacy(). | [
"Move",
"a",
"set",
"of",
"identifiers",
"out",
"from",
"active",
"making",
"way",
"for",
"newer",
"segments",
".",
"This",
"method",
"is",
"to",
"support",
"KafkaIndexTask",
"s",
"legacy",
"mode",
"and",
"will",
"be",
"removed",
"in",
"the",
"future",
".",
"See",
"KakfaIndexTask",
".",
"runLegacy",
"()",
"."
]
| train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriver.java#L188-L208 |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java | PipelineBuilder.addVarRefExpr | public void addVarRefExpr(final INodeReadTrx mTransaction, final String mVarName) {
"""
Adds a VarRefExpr to the pipeline. This Expression holds a reference to
the current context item of the specified variable.
@param mTransaction
the transaction to operate on.
@param mVarName
the name of the variable
"""
final VariableAxis axis = (VariableAxis)mVarRefMap.get(mVarName);
if (axis != null) {
getExpression().add(new VarRefExpr(mTransaction, axis));
} else {
throw new IllegalStateException("Variable " + mVarName + " unkown.");
}
} | java | public void addVarRefExpr(final INodeReadTrx mTransaction, final String mVarName) {
final VariableAxis axis = (VariableAxis)mVarRefMap.get(mVarName);
if (axis != null) {
getExpression().add(new VarRefExpr(mTransaction, axis));
} else {
throw new IllegalStateException("Variable " + mVarName + " unkown.");
}
} | [
"public",
"void",
"addVarRefExpr",
"(",
"final",
"INodeReadTrx",
"mTransaction",
",",
"final",
"String",
"mVarName",
")",
"{",
"final",
"VariableAxis",
"axis",
"=",
"(",
"VariableAxis",
")",
"mVarRefMap",
".",
"get",
"(",
"mVarName",
")",
";",
"if",
"(",
"axis",
"!=",
"null",
")",
"{",
"getExpression",
"(",
")",
".",
"add",
"(",
"new",
"VarRefExpr",
"(",
"mTransaction",
",",
"axis",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Variable \"",
"+",
"mVarName",
"+",
"\" unkown.\"",
")",
";",
"}",
"}"
]
| Adds a VarRefExpr to the pipeline. This Expression holds a reference to
the current context item of the specified variable.
@param mTransaction
the transaction to operate on.
@param mVarName
the name of the variable | [
"Adds",
"a",
"VarRefExpr",
"to",
"the",
"pipeline",
".",
"This",
"Expression",
"holds",
"a",
"reference",
"to",
"the",
"current",
"context",
"item",
"of",
"the",
"specified",
"variable",
"."
]
| train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java#L796-L805 |
iipc/openwayback-access-control | access-control/src/main/java/org/archive/accesscontrol/robotstxt/RobotRules.java | RobotRules.blocksPathForUA | public boolean blocksPathForUA(String path, String ua) {
"""
Checks first the specified ua UserAgent, if rules are present for it,
and then falls back to using rules for the '*' UserAgent.
@param path
@param ua
@return boolean value where true indicates the path is blocked for ua
"""
if(rules.containsKey(ua.toLowerCase())) {
return blocksPath(path,ua,rules.get(ua.toLowerCase()));
} else if(rules.containsKey(GLOBAL_USER_AGENT)) {
return blocksPath(path,GLOBAL_USER_AGENT,
rules.get(GLOBAL_USER_AGENT));
}
return false;
} | java | public boolean blocksPathForUA(String path, String ua) {
if(rules.containsKey(ua.toLowerCase())) {
return blocksPath(path,ua,rules.get(ua.toLowerCase()));
} else if(rules.containsKey(GLOBAL_USER_AGENT)) {
return blocksPath(path,GLOBAL_USER_AGENT,
rules.get(GLOBAL_USER_AGENT));
}
return false;
} | [
"public",
"boolean",
"blocksPathForUA",
"(",
"String",
"path",
",",
"String",
"ua",
")",
"{",
"if",
"(",
"rules",
".",
"containsKey",
"(",
"ua",
".",
"toLowerCase",
"(",
")",
")",
")",
"{",
"return",
"blocksPath",
"(",
"path",
",",
"ua",
",",
"rules",
".",
"get",
"(",
"ua",
".",
"toLowerCase",
"(",
")",
")",
")",
";",
"}",
"else",
"if",
"(",
"rules",
".",
"containsKey",
"(",
"GLOBAL_USER_AGENT",
")",
")",
"{",
"return",
"blocksPath",
"(",
"path",
",",
"GLOBAL_USER_AGENT",
",",
"rules",
".",
"get",
"(",
"GLOBAL_USER_AGENT",
")",
")",
";",
"}",
"return",
"false",
";",
"}"
]
| Checks first the specified ua UserAgent, if rules are present for it,
and then falls back to using rules for the '*' UserAgent.
@param path
@param ua
@return boolean value where true indicates the path is blocked for ua | [
"Checks",
"first",
"the",
"specified",
"ua",
"UserAgent",
"if",
"rules",
"are",
"present",
"for",
"it",
"and",
"then",
"falls",
"back",
"to",
"using",
"rules",
"for",
"the",
"*",
"UserAgent",
"."
]
| train | https://github.com/iipc/openwayback-access-control/blob/4a0f70f200fd8d7b6e313624b7628656d834bf31/access-control/src/main/java/org/archive/accesscontrol/robotstxt/RobotRules.java#L167-L179 |
jbundle/jcalendarbutton | src/main/java/org/jbundle/util/jcalendarbutton/JTimePopup.java | JTimePopup.createCalendarButton | public static JButton createCalendarButton(String strDateParam, Date dateTarget) {
"""
Create this calendar in a popup menu and synchronize the text field on change.
@param strDateParam The name of the date property (defaults to "date").
@param dateTarget The initial date for this button.
"""
JTimeButton button = new JTimeButton(strDateParam, dateTarget);
// button.setMargin(NO_INSETS);
button.setOpaque(false);
return button;
} | java | public static JButton createCalendarButton(String strDateParam, Date dateTarget)
{
JTimeButton button = new JTimeButton(strDateParam, dateTarget);
// button.setMargin(NO_INSETS);
button.setOpaque(false);
return button;
} | [
"public",
"static",
"JButton",
"createCalendarButton",
"(",
"String",
"strDateParam",
",",
"Date",
"dateTarget",
")",
"{",
"JTimeButton",
"button",
"=",
"new",
"JTimeButton",
"(",
"strDateParam",
",",
"dateTarget",
")",
";",
"// button.setMargin(NO_INSETS);",
"button",
".",
"setOpaque",
"(",
"false",
")",
";",
"return",
"button",
";",
"}"
]
| Create this calendar in a popup menu and synchronize the text field on change.
@param strDateParam The name of the date property (defaults to "date").
@param dateTarget The initial date for this button. | [
"Create",
"this",
"calendar",
"in",
"a",
"popup",
"menu",
"and",
"synchronize",
"the",
"text",
"field",
"on",
"change",
"."
]
| train | https://github.com/jbundle/jcalendarbutton/blob/2944e6a0b634b83768d5c0b7b4a2898176421403/src/main/java/org/jbundle/util/jcalendarbutton/JTimePopup.java#L236-L243 |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/Controller.java | Controller.streamOut | protected /*HttpBuilder*/void streamOut(InputStream in) {
"""
Streams content of the <code>reader</code> to the HTTP client.
@param in input stream to read bytes from.
@return {@link HttpSupport.HttpBuilder}, to accept additional information.
"""
// StreamResponse resp = new StreamResponse(context, in);
// context.setControllerResponse(resp);
// return new HttpBuilder(resp);
//TODO finish and TEST the god damn method
//------------------
Result r = ResultBuilder.ok()
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.renderable(in);
// context.setControllerResponse(r);
result = r;
} | java | protected /*HttpBuilder*/void streamOut(InputStream in) {
// StreamResponse resp = new StreamResponse(context, in);
// context.setControllerResponse(resp);
// return new HttpBuilder(resp);
//TODO finish and TEST the god damn method
//------------------
Result r = ResultBuilder.ok()
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.renderable(in);
// context.setControllerResponse(r);
result = r;
} | [
"protected",
"/*HttpBuilder*/",
"void",
"streamOut",
"(",
"InputStream",
"in",
")",
"{",
"// StreamResponse resp = new StreamResponse(context, in);",
"// context.setControllerResponse(resp);",
"// return new HttpBuilder(resp);",
"//TODO finish and TEST the god damn method",
"//------------------",
"Result",
"r",
"=",
"ResultBuilder",
".",
"ok",
"(",
")",
".",
"contentType",
"(",
"MediaType",
".",
"APPLICATION_OCTET_STREAM",
")",
".",
"renderable",
"(",
"in",
")",
";",
"// context.setControllerResponse(r);",
"result",
"=",
"r",
";",
"}"
]
| Streams content of the <code>reader</code> to the HTTP client.
@param in input stream to read bytes from.
@return {@link HttpSupport.HttpBuilder}, to accept additional information. | [
"Streams",
"content",
"of",
"the",
"<code",
">",
"reader<",
"/",
"code",
">",
"to",
"the",
"HTTP",
"client",
"."
]
| train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/Controller.java#L1457-L1468 |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerAnyRuntime.java | OStreamSerializerAnyRuntime.fromStream | public Object fromStream(final byte[] iStream) throws IOException {
"""
Re-Create any object if the class has a public constructor that accepts a String as unique parameter.
"""
if (iStream == null || iStream.length == 0)
// NULL VALUE
return null;
final ByteArrayInputStream is = new ByteArrayInputStream(iStream);
final ObjectInputStream in = new ObjectInputStream(is);
try {
return in.readObject();
} catch (ClassNotFoundException e) {
throw new OSerializationException("Cannot unmarshall Java serialized object", e);
} finally {
in.close();
is.close();
}
} | java | public Object fromStream(final byte[] iStream) throws IOException {
if (iStream == null || iStream.length == 0)
// NULL VALUE
return null;
final ByteArrayInputStream is = new ByteArrayInputStream(iStream);
final ObjectInputStream in = new ObjectInputStream(is);
try {
return in.readObject();
} catch (ClassNotFoundException e) {
throw new OSerializationException("Cannot unmarshall Java serialized object", e);
} finally {
in.close();
is.close();
}
} | [
"public",
"Object",
"fromStream",
"(",
"final",
"byte",
"[",
"]",
"iStream",
")",
"throws",
"IOException",
"{",
"if",
"(",
"iStream",
"==",
"null",
"||",
"iStream",
".",
"length",
"==",
"0",
")",
"// NULL VALUE\r",
"return",
"null",
";",
"final",
"ByteArrayInputStream",
"is",
"=",
"new",
"ByteArrayInputStream",
"(",
"iStream",
")",
";",
"final",
"ObjectInputStream",
"in",
"=",
"new",
"ObjectInputStream",
"(",
"is",
")",
";",
"try",
"{",
"return",
"in",
".",
"readObject",
"(",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"throw",
"new",
"OSerializationException",
"(",
"\"Cannot unmarshall Java serialized object\"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"in",
".",
"close",
"(",
")",
";",
"is",
".",
"close",
"(",
")",
";",
"}",
"}"
]
| Re-Create any object if the class has a public constructor that accepts a String as unique parameter. | [
"Re",
"-",
"Create",
"any",
"object",
"if",
"the",
"class",
"has",
"a",
"public",
"constructor",
"that",
"accepts",
"a",
"String",
"as",
"unique",
"parameter",
"."
]
| train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerAnyRuntime.java#L45-L60 |
alkacon/opencms-core | src/org/opencms/staticexport/CmsLinkManager.java | CmsLinkManager.substituteLinkForUnknownTarget | public String substituteLinkForUnknownTarget(CmsObject cms, String link) {
"""
Returns a link <i>from</i> the URI stored in the provided OpenCms user context
<i>to</i> the given <code>link</code>, for use on web pages.<p>
A number of tests are performed with the <code>link</code> in order to find out how to create the link:<ul>
<li>If <code>link</code> is empty, an empty String is returned.
<li>If <code>link</code> starts with an URI scheme component, for example <code>http://</code>,
and does not point to an internal OpenCms site, it is returned unchanged.
<li>If <code>link</code> is an absolute URI that starts with a configured site root,
the site root is cut from the link and
the same result as {@link #substituteLink(CmsObject, String, String)} is returned.
<li>Otherwise the same result as {@link #substituteLink(CmsObject, String)} is returned.
</ul>
@param cms the current OpenCms user context
@param link the link to process
@return a link <i>from</i> the URI stored in the provided OpenCms user context
<i>to</i> the given <code>link</code>
"""
return substituteLinkForUnknownTarget(cms, link, false);
} | java | public String substituteLinkForUnknownTarget(CmsObject cms, String link) {
return substituteLinkForUnknownTarget(cms, link, false);
} | [
"public",
"String",
"substituteLinkForUnknownTarget",
"(",
"CmsObject",
"cms",
",",
"String",
"link",
")",
"{",
"return",
"substituteLinkForUnknownTarget",
"(",
"cms",
",",
"link",
",",
"false",
")",
";",
"}"
]
| Returns a link <i>from</i> the URI stored in the provided OpenCms user context
<i>to</i> the given <code>link</code>, for use on web pages.<p>
A number of tests are performed with the <code>link</code> in order to find out how to create the link:<ul>
<li>If <code>link</code> is empty, an empty String is returned.
<li>If <code>link</code> starts with an URI scheme component, for example <code>http://</code>,
and does not point to an internal OpenCms site, it is returned unchanged.
<li>If <code>link</code> is an absolute URI that starts with a configured site root,
the site root is cut from the link and
the same result as {@link #substituteLink(CmsObject, String, String)} is returned.
<li>Otherwise the same result as {@link #substituteLink(CmsObject, String)} is returned.
</ul>
@param cms the current OpenCms user context
@param link the link to process
@return a link <i>from</i> the URI stored in the provided OpenCms user context
<i>to</i> the given <code>link</code> | [
"Returns",
"a",
"link",
"<i",
">",
"from<",
"/",
"i",
">",
"the",
"URI",
"stored",
"in",
"the",
"provided",
"OpenCms",
"user",
"context",
"<i",
">",
"to<",
"/",
"i",
">",
"the",
"given",
"<code",
">",
"link<",
"/",
"code",
">",
"for",
"use",
"on",
"web",
"pages",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsLinkManager.java#L868-L872 |
Teddy-Zhu/SilentGo | utils/src/main/java/com/silentgo/utils/asm/ClassReader.java | ClassReader.readClass | public String readClass(final int index, final char[] buf) {
"""
Reads a class constant pool item in {@link #b b}. <i>This method is
intended for {@link Attribute} sub classes, and is normally not needed by
class generators or adapters.</i>
@param index
the start index of an unsigned short value in {@link #b b},
whose value is the index of a class constant pool item.
@param buf
buffer to be used to read the item. This buffer must be
sufficiently large. It is not automatically resized.
@return the String corresponding to the specified class item.
"""
// computes the start index of the CONSTANT_Class item in b
// and reads the CONSTANT_Utf8 item designated by
// the first two bytes of this CONSTANT_Class item
String name = readUTF8(items[readUnsignedShort(index)], buf);
return (name != null ? name.intern() : null);
} | java | public String readClass(final int index, final char[] buf) {
// computes the start index of the CONSTANT_Class item in b
// and reads the CONSTANT_Utf8 item designated by
// the first two bytes of this CONSTANT_Class item
String name = readUTF8(items[readUnsignedShort(index)], buf);
return (name != null ? name.intern() : null);
} | [
"public",
"String",
"readClass",
"(",
"final",
"int",
"index",
",",
"final",
"char",
"[",
"]",
"buf",
")",
"{",
"// computes the start index of the CONSTANT_Class item in b",
"// and reads the CONSTANT_Utf8 item designated by",
"// the first two bytes of this CONSTANT_Class item",
"String",
"name",
"=",
"readUTF8",
"(",
"items",
"[",
"readUnsignedShort",
"(",
"index",
")",
"]",
",",
"buf",
")",
";",
"return",
"(",
"name",
"!=",
"null",
"?",
"name",
".",
"intern",
"(",
")",
":",
"null",
")",
";",
"}"
]
| Reads a class constant pool item in {@link #b b}. <i>This method is
intended for {@link Attribute} sub classes, and is normally not needed by
class generators or adapters.</i>
@param index
the start index of an unsigned short value in {@link #b b},
whose value is the index of a class constant pool item.
@param buf
buffer to be used to read the item. This buffer must be
sufficiently large. It is not automatically resized.
@return the String corresponding to the specified class item. | [
"Reads",
"a",
"class",
"constant",
"pool",
"item",
"in",
"{",
"@link",
"#b",
"b",
"}",
".",
"<i",
">",
"This",
"method",
"is",
"intended",
"for",
"{",
"@link",
"Attribute",
"}",
"sub",
"classes",
"and",
"is",
"normally",
"not",
"needed",
"by",
"class",
"generators",
"or",
"adapters",
".",
"<",
"/",
"i",
">"
]
| train | https://github.com/Teddy-Zhu/SilentGo/blob/27f58b0cafe56b2eb9fc6993efa9ca2b529661e1/utils/src/main/java/com/silentgo/utils/asm/ClassReader.java#L2532-L2538 |
OpenLiberty/open-liberty | dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/AbstractMBeanIntrospector.java | AbstractMBeanIntrospector.getFormattedCompositeData | String getFormattedCompositeData(CompositeData cd, String indent) {
"""
Format an open MBean composite data attribute.
@param cd the composite data attribute
@param indent the current indent level of the formatted report
@return the formatted composite data
"""
StringBuilder sb = new StringBuilder();
indent += INDENT;
CompositeType type = cd.getCompositeType();
for (String key : type.keySet()) {
sb.append("\n").append(indent);
sb.append(key).append(": ");
OpenType<?> openType = type.getType(key);
if (openType instanceof SimpleType) {
sb.append(cd.get(key));
} else if (openType instanceof CompositeType) {
CompositeData nestedData = (CompositeData) cd.get(key);
sb.append(getFormattedCompositeData(nestedData, indent));
} else if (openType instanceof TabularType) {
TabularData tabularData = (TabularData) cd.get(key);
sb.append(tabularData);
}
}
return String.valueOf(sb);
} | java | String getFormattedCompositeData(CompositeData cd, String indent) {
StringBuilder sb = new StringBuilder();
indent += INDENT;
CompositeType type = cd.getCompositeType();
for (String key : type.keySet()) {
sb.append("\n").append(indent);
sb.append(key).append(": ");
OpenType<?> openType = type.getType(key);
if (openType instanceof SimpleType) {
sb.append(cd.get(key));
} else if (openType instanceof CompositeType) {
CompositeData nestedData = (CompositeData) cd.get(key);
sb.append(getFormattedCompositeData(nestedData, indent));
} else if (openType instanceof TabularType) {
TabularData tabularData = (TabularData) cd.get(key);
sb.append(tabularData);
}
}
return String.valueOf(sb);
} | [
"String",
"getFormattedCompositeData",
"(",
"CompositeData",
"cd",
",",
"String",
"indent",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"indent",
"+=",
"INDENT",
";",
"CompositeType",
"type",
"=",
"cd",
".",
"getCompositeType",
"(",
")",
";",
"for",
"(",
"String",
"key",
":",
"type",
".",
"keySet",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"\"\\n\"",
")",
".",
"append",
"(",
"indent",
")",
";",
"sb",
".",
"append",
"(",
"key",
")",
".",
"append",
"(",
"\": \"",
")",
";",
"OpenType",
"<",
"?",
">",
"openType",
"=",
"type",
".",
"getType",
"(",
"key",
")",
";",
"if",
"(",
"openType",
"instanceof",
"SimpleType",
")",
"{",
"sb",
".",
"append",
"(",
"cd",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"else",
"if",
"(",
"openType",
"instanceof",
"CompositeType",
")",
"{",
"CompositeData",
"nestedData",
"=",
"(",
"CompositeData",
")",
"cd",
".",
"get",
"(",
"key",
")",
";",
"sb",
".",
"append",
"(",
"getFormattedCompositeData",
"(",
"nestedData",
",",
"indent",
")",
")",
";",
"}",
"else",
"if",
"(",
"openType",
"instanceof",
"TabularType",
")",
"{",
"TabularData",
"tabularData",
"=",
"(",
"TabularData",
")",
"cd",
".",
"get",
"(",
"key",
")",
";",
"sb",
".",
"append",
"(",
"tabularData",
")",
";",
"}",
"}",
"return",
"String",
".",
"valueOf",
"(",
"sb",
")",
";",
"}"
]
| Format an open MBean composite data attribute.
@param cd the composite data attribute
@param indent the current indent level of the formatted report
@return the formatted composite data | [
"Format",
"an",
"open",
"MBean",
"composite",
"data",
"attribute",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/AbstractMBeanIntrospector.java#L242-L261 |
codegist/crest | core/src/main/java/org/codegist/crest/CRestBuilder.java | CRestBuilder.bindAnnotationHandler | public <A extends Annotation> CRestBuilder bindAnnotationHandler(Class<? extends AnnotationHandler<A>> handler, Class<A> annotationCls, Map<String, Object> config) {
"""
<p>Binds an annotation handler for the given annotation.</p>
<p>Can be used to tell <b>CRest</b> how to handle user-defined annotation used in interfaces.</p>
@param handler The user-defined annotation handler
@param annotationCls The user-defined annotation
@param config State that will be passed to the annotation handler along with the CRestConfig object if the handler has declared a single argument constructor with CRestConfig parameter type
@param <A> Used-defined annotation type
@return current builder
@see org.codegist.crest.CRestConfig
"""
annotationHandlerBuilder.register(handler, new Class[]{annotationCls}, config);
return this;
} | java | public <A extends Annotation> CRestBuilder bindAnnotationHandler(Class<? extends AnnotationHandler<A>> handler, Class<A> annotationCls, Map<String, Object> config){
annotationHandlerBuilder.register(handler, new Class[]{annotationCls}, config);
return this;
} | [
"public",
"<",
"A",
"extends",
"Annotation",
">",
"CRestBuilder",
"bindAnnotationHandler",
"(",
"Class",
"<",
"?",
"extends",
"AnnotationHandler",
"<",
"A",
">",
">",
"handler",
",",
"Class",
"<",
"A",
">",
"annotationCls",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"config",
")",
"{",
"annotationHandlerBuilder",
".",
"register",
"(",
"handler",
",",
"new",
"Class",
"[",
"]",
"{",
"annotationCls",
"}",
",",
"config",
")",
";",
"return",
"this",
";",
"}"
]
| <p>Binds an annotation handler for the given annotation.</p>
<p>Can be used to tell <b>CRest</b> how to handle user-defined annotation used in interfaces.</p>
@param handler The user-defined annotation handler
@param annotationCls The user-defined annotation
@param config State that will be passed to the annotation handler along with the CRestConfig object if the handler has declared a single argument constructor with CRestConfig parameter type
@param <A> Used-defined annotation type
@return current builder
@see org.codegist.crest.CRestConfig | [
"<p",
">",
"Binds",
"an",
"annotation",
"handler",
"for",
"the",
"given",
"annotation",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Can",
"be",
"used",
"to",
"tell",
"<b",
">",
"CRest<",
"/",
"b",
">",
"how",
"to",
"handle",
"user",
"-",
"defined",
"annotation",
"used",
"in",
"interfaces",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRestBuilder.java#L495-L498 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/MediaApi.java | MediaApi.setComment | public ApiSuccessResponse setComment(String mediatype, String id, AddCommentData addCommentData) throws ApiException {
"""
Set a comment
Set a comment on the specified interaction. If a comment already exists, it's overridden.
@param mediatype The media channel. (required)
@param id The ID of the interaction. (required)
@param addCommentData (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<ApiSuccessResponse> resp = setCommentWithHttpInfo(mediatype, id, addCommentData);
return resp.getData();
} | java | public ApiSuccessResponse setComment(String mediatype, String id, AddCommentData addCommentData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = setCommentWithHttpInfo(mediatype, id, addCommentData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"setComment",
"(",
"String",
"mediatype",
",",
"String",
"id",
",",
"AddCommentData",
"addCommentData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"setCommentWithHttpInfo",
"(",
"mediatype",
",",
"id",
",",
"addCommentData",
")",
";",
"return",
"resp",
".",
"getData",
"(",
")",
";",
"}"
]
| Set a comment
Set a comment on the specified interaction. If a comment already exists, it's overridden.
@param mediatype The media channel. (required)
@param id The ID of the interaction. (required)
@param addCommentData (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Set",
"a",
"comment",
"Set",
"a",
"comment",
"on",
"the",
"specified",
"interaction",
".",
"If",
"a",
"comment",
"already",
"exists",
"it'",
";",
"s",
"overridden",
"."
]
| train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L4057-L4060 |
VoltDB/voltdb | src/frontend/org/voltdb/compiler/VoltCompiler.java | VoltCompiler.compileCatalogFromDDL | public Catalog compileCatalogFromDDL(final String... ddlFilePaths)
throws VoltCompilerException {
"""
Compile from DDL files (only).
@param ddlFilePaths input ddl files
@return compiled catalog
@throws VoltCompilerException
"""
InMemoryJarfile jarOutput = new InMemoryJarfile();
return compileCatalogInternal(null, null, DDLPathsToReaderList(ddlFilePaths), jarOutput);
} | java | public Catalog compileCatalogFromDDL(final String... ddlFilePaths)
throws VoltCompilerException
{
InMemoryJarfile jarOutput = new InMemoryJarfile();
return compileCatalogInternal(null, null, DDLPathsToReaderList(ddlFilePaths), jarOutput);
} | [
"public",
"Catalog",
"compileCatalogFromDDL",
"(",
"final",
"String",
"...",
"ddlFilePaths",
")",
"throws",
"VoltCompilerException",
"{",
"InMemoryJarfile",
"jarOutput",
"=",
"new",
"InMemoryJarfile",
"(",
")",
";",
"return",
"compileCatalogInternal",
"(",
"null",
",",
"null",
",",
"DDLPathsToReaderList",
"(",
"ddlFilePaths",
")",
",",
"jarOutput",
")",
";",
"}"
]
| Compile from DDL files (only).
@param ddlFilePaths input ddl files
@return compiled catalog
@throws VoltCompilerException | [
"Compile",
"from",
"DDL",
"files",
"(",
"only",
")",
"."
]
| train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/VoltCompiler.java#L917-L922 |
OpenTSDB/opentsdb | src/tools/ConfigArgP.java | ConfigArgP.decodeToken | public static String decodeToken(String key, String defaultValue) {
"""
Attempts to decode the passed dot delimited as a system property, and if not found, attempts a decode as an
environmental variable, replacing the dots with underscores. e.g. for the key: <b><code>buffer.size.max</code></b>,
a system property named <b><code>buffer.size.max</code></b> will be looked up, and then an environmental variable
named <b><code>buffer.size.max</code></b> will be looked up.
@param key The dot delimited key to decode
@param defaultValue The default value returned if neither source can decode the key
@return the decoded value or the default value if neither source can decode the key
"""
String value = System.getProperty(key, System.getenv(key.replace('.', '_')));
return value!=null ? value : defaultValue;
} | java | public static String decodeToken(String key, String defaultValue) {
String value = System.getProperty(key, System.getenv(key.replace('.', '_')));
return value!=null ? value : defaultValue;
} | [
"public",
"static",
"String",
"decodeToken",
"(",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"System",
".",
"getProperty",
"(",
"key",
",",
"System",
".",
"getenv",
"(",
"key",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
")",
")",
";",
"return",
"value",
"!=",
"null",
"?",
"value",
":",
"defaultValue",
";",
"}"
]
| Attempts to decode the passed dot delimited as a system property, and if not found, attempts a decode as an
environmental variable, replacing the dots with underscores. e.g. for the key: <b><code>buffer.size.max</code></b>,
a system property named <b><code>buffer.size.max</code></b> will be looked up, and then an environmental variable
named <b><code>buffer.size.max</code></b> will be looked up.
@param key The dot delimited key to decode
@param defaultValue The default value returned if neither source can decode the key
@return the decoded value or the default value if neither source can decode the key | [
"Attempts",
"to",
"decode",
"the",
"passed",
"dot",
"delimited",
"as",
"a",
"system",
"property",
"and",
"if",
"not",
"found",
"attempts",
"a",
"decode",
"as",
"an",
"environmental",
"variable",
"replacing",
"the",
"dots",
"with",
"underscores",
".",
"e",
".",
"g",
".",
"for",
"the",
"key",
":",
"<b",
">",
"<code",
">",
"buffer",
".",
"size",
".",
"max<",
"/",
"code",
">",
"<",
"/",
"b",
">",
"a",
"system",
"property",
"named",
"<b",
">",
"<code",
">",
"buffer",
".",
"size",
".",
"max<",
"/",
"code",
">",
"<",
"/",
"b",
">",
"will",
"be",
"looked",
"up",
"and",
"then",
"an",
"environmental",
"variable",
"named",
"<b",
">",
"<code",
">",
"buffer",
".",
"size",
".",
"max<",
"/",
"code",
">",
"<",
"/",
"b",
">",
"will",
"be",
"looked",
"up",
"."
]
| train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L517-L520 |
jroyalty/jglm | src/main/java/com/hackoeur/jglm/support/Precision.java | Precision.compareTo | public static int compareTo(double x, double y, double eps) {
"""
Compares two numbers given some amount of allowed error.
@param x the first number
@param y the second number
@param eps the amount of error to allow when checking for equality
@return <ul><li>0 if {@link #equals(double, double, double) equals(x, y, eps)}</li>
<li>< 0 if !{@link #equals(double, double, double) equals(x, y, eps)} && x < y</li>
<li>> 0 if !{@link #equals(double, double, double) equals(x, y, eps)} && x > y</li></ul>
"""
if (equals(x, y, eps)) {
return 0;
} else if (x < y) {
return -1;
}
return 1;
} | java | public static int compareTo(double x, double y, double eps) {
if (equals(x, y, eps)) {
return 0;
} else if (x < y) {
return -1;
}
return 1;
} | [
"public",
"static",
"int",
"compareTo",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"eps",
")",
"{",
"if",
"(",
"equals",
"(",
"x",
",",
"y",
",",
"eps",
")",
")",
"{",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"x",
"<",
"y",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"1",
";",
"}"
]
| Compares two numbers given some amount of allowed error.
@param x the first number
@param y the second number
@param eps the amount of error to allow when checking for equality
@return <ul><li>0 if {@link #equals(double, double, double) equals(x, y, eps)}</li>
<li>< 0 if !{@link #equals(double, double, double) equals(x, y, eps)} && x < y</li>
<li>> 0 if !{@link #equals(double, double, double) equals(x, y, eps)} && x > y</li></ul> | [
"Compares",
"two",
"numbers",
"given",
"some",
"amount",
"of",
"allowed",
"error",
"."
]
| train | https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/support/Precision.java#L91-L98 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.