repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
elki-project/elki | elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/covertree/SimplifiedCoverTree.java | SimplifiedCoverTree.checkCoverTree | private void checkCoverTree(Node cur, int[] counts, int depth) {
counts[0] += 1; // Node count
counts[1] += depth; // Sum of depth
counts[2] = depth > counts[2] ? depth : counts[2]; // Max depth
counts[3] += cur.singletons.size() - 1;
counts[4] += cur.singletons.size() - (cur.children == null ? 0 : 1);
if(cur.children != null) {
++depth;
for(Node chi : cur.children) {
checkCoverTree(chi, counts, depth);
}
assert (!cur.children.isEmpty()) : "Empty childs list.";
}
} | java | private void checkCoverTree(Node cur, int[] counts, int depth) {
counts[0] += 1; // Node count
counts[1] += depth; // Sum of depth
counts[2] = depth > counts[2] ? depth : counts[2]; // Max depth
counts[3] += cur.singletons.size() - 1;
counts[4] += cur.singletons.size() - (cur.children == null ? 0 : 1);
if(cur.children != null) {
++depth;
for(Node chi : cur.children) {
checkCoverTree(chi, counts, depth);
}
assert (!cur.children.isEmpty()) : "Empty childs list.";
}
} | [
"private",
"void",
"checkCoverTree",
"(",
"Node",
"cur",
",",
"int",
"[",
"]",
"counts",
",",
"int",
"depth",
")",
"{",
"counts",
"[",
"0",
"]",
"+=",
"1",
";",
"// Node count",
"counts",
"[",
"1",
"]",
"+=",
"depth",
";",
"// Sum of depth",
"counts",
... | Collect some statistics on the tree.
@param cur Current node
@param counts Counter set
@param depth Current depth | [
"Collect",
"some",
"statistics",
"on",
"the",
"tree",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/covertree/SimplifiedCoverTree.java#L269-L282 |
Netflix/conductor | core/src/main/java/com/netflix/conductor/core/execution/mapper/ForkJoinDynamicTaskMapper.java | ForkJoinDynamicTaskMapper.getDynamicForkTasksAndInput | @SuppressWarnings("unchecked")
@VisibleForTesting
Pair<List<WorkflowTask>, Map<String, Map<String, Object>>> getDynamicForkTasksAndInput(WorkflowTask taskToSchedule, Workflow workflowInstance,
String dynamicForkTaskParam) throws TerminateWorkflowException {
Map<String, Object> input = parametersUtils.getTaskInput(taskToSchedule.getInputParameters(), workflowInstance, null, null);
Object dynamicForkTasksJson = input.get(dynamicForkTaskParam);
List<WorkflowTask> dynamicForkWorkflowTasks = objectMapper.convertValue(dynamicForkTasksJson, ListOfWorkflowTasks);
for (WorkflowTask workflowTask : dynamicForkWorkflowTasks) {
if (MetadataMapperService.shouldPopulateDefinition(workflowTask)) {
workflowTask.setTaskDefinition(metadataDAO.getTaskDef(workflowTask.getName()));
}
}
Object dynamicForkTasksInput = input.get(taskToSchedule.getDynamicForkTasksInputParamName());
if (!(dynamicForkTasksInput instanceof Map)) {
throw new TerminateWorkflowException("Input to the dynamically forked tasks is not a map -> expecting a map of K,V but found " + dynamicForkTasksInput);
}
return new ImmutablePair<>(dynamicForkWorkflowTasks, (Map<String, Map<String, Object>>) dynamicForkTasksInput);
} | java | @SuppressWarnings("unchecked")
@VisibleForTesting
Pair<List<WorkflowTask>, Map<String, Map<String, Object>>> getDynamicForkTasksAndInput(WorkflowTask taskToSchedule, Workflow workflowInstance,
String dynamicForkTaskParam) throws TerminateWorkflowException {
Map<String, Object> input = parametersUtils.getTaskInput(taskToSchedule.getInputParameters(), workflowInstance, null, null);
Object dynamicForkTasksJson = input.get(dynamicForkTaskParam);
List<WorkflowTask> dynamicForkWorkflowTasks = objectMapper.convertValue(dynamicForkTasksJson, ListOfWorkflowTasks);
for (WorkflowTask workflowTask : dynamicForkWorkflowTasks) {
if (MetadataMapperService.shouldPopulateDefinition(workflowTask)) {
workflowTask.setTaskDefinition(metadataDAO.getTaskDef(workflowTask.getName()));
}
}
Object dynamicForkTasksInput = input.get(taskToSchedule.getDynamicForkTasksInputParamName());
if (!(dynamicForkTasksInput instanceof Map)) {
throw new TerminateWorkflowException("Input to the dynamically forked tasks is not a map -> expecting a map of K,V but found " + dynamicForkTasksInput);
}
return new ImmutablePair<>(dynamicForkWorkflowTasks, (Map<String, Map<String, Object>>) dynamicForkTasksInput);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"VisibleForTesting",
"Pair",
"<",
"List",
"<",
"WorkflowTask",
">",
",",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"Object",
">",
">",
">",
"getDynamicForkTasksAndInput",
"(",
"WorkflowTask",... | This method is used to get the List of dynamic workflow tasks and their input based on the {@link WorkflowTask#getDynamicForkTasksParam()}
@param taskToSchedule: The Task of type FORK_JOIN_DYNAMIC that needs to scheduled, which has the input parameters
@param workflowInstance: The instance of the {@link Workflow} which represents the workflow being executed.
@param dynamicForkTaskParam: The key representing the dynamic fork join json payload which is available in {@link WorkflowTask#getInputParameters()}
@throws TerminateWorkflowException : In case of input parameters of the dynamic fork tasks not represented as {@link Map}
@return a {@link Pair} representing the list of dynamic fork tasks in {@link Pair#getLeft()} and the input for the dynamic fork tasks in {@link Pair#getRight()} | [
"This",
"method",
"is",
"used",
"to",
"get",
"the",
"List",
"of",
"dynamic",
"workflow",
"tasks",
"and",
"their",
"input",
"based",
"on",
"the",
"{",
"@link",
"WorkflowTask#getDynamicForkTasksParam",
"()",
"}"
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/core/execution/mapper/ForkJoinDynamicTaskMapper.java#L234-L252 |
BlueBrain/bluima | modules/bluima_abbreviations/src/main/java/com/wcohen/ss/SourcedTFIDF.java | SourcedTFIDF.prepare | public StringWrapper prepare(String s) {
System.out.println("unknown source for "+s);
lastVector = new UnitVector(s, tokenizer.sourcedTokenize(s, "*UNKNOWN SOURCE*"));
return lastVector;
} | java | public StringWrapper prepare(String s) {
System.out.println("unknown source for "+s);
lastVector = new UnitVector(s, tokenizer.sourcedTokenize(s, "*UNKNOWN SOURCE*"));
return lastVector;
} | [
"public",
"StringWrapper",
"prepare",
"(",
"String",
"s",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"unknown source for \"",
"+",
"s",
")",
";",
"lastVector",
"=",
"new",
"UnitVector",
"(",
"s",
",",
"tokenizer",
".",
"sourcedTokenize",
"(",
"... | Preprocess a string by finding tokens and giving them TFIDF weights | [
"Preprocess",
"a",
"string",
"by",
"finding",
"tokens",
"and",
"giving",
"them",
"TFIDF",
"weights"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/SourcedTFIDF.java#L45-L49 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/FormatUtils.java | FormatUtils.appendUnpaddedInteger | public static void appendUnpaddedInteger(StringBuffer buf, int value) {
try {
appendUnpaddedInteger((Appendable) buf, value);
} catch (IOException e) {
// StringBuffer do not throw IOException
}
} | java | public static void appendUnpaddedInteger(StringBuffer buf, int value) {
try {
appendUnpaddedInteger((Appendable) buf, value);
} catch (IOException e) {
// StringBuffer do not throw IOException
}
} | [
"public",
"static",
"void",
"appendUnpaddedInteger",
"(",
"StringBuffer",
"buf",
",",
"int",
"value",
")",
"{",
"try",
"{",
"appendUnpaddedInteger",
"(",
"(",
"Appendable",
")",
"buf",
",",
"value",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{"... | Converts an integer to a string, and appends it to the given buffer.
<p>This method is optimized for converting small values to strings.
@param buf receives integer converted to a string
@param value value to convert to a string | [
"Converts",
"an",
"integer",
"to",
"a",
"string",
"and",
"appends",
"it",
"to",
"the",
"given",
"buffer",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/FormatUtils.java#L273-L279 |
aws/aws-sdk-java | aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateIntegrationResponseRequest.java | CreateIntegrationResponseRequest.withResponseTemplates | public CreateIntegrationResponseRequest withResponseTemplates(java.util.Map<String, String> responseTemplates) {
setResponseTemplates(responseTemplates);
return this;
} | java | public CreateIntegrationResponseRequest withResponseTemplates(java.util.Map<String, String> responseTemplates) {
setResponseTemplates(responseTemplates);
return this;
} | [
"public",
"CreateIntegrationResponseRequest",
"withResponseTemplates",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"responseTemplates",
")",
"{",
"setResponseTemplates",
"(",
"responseTemplates",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The collection of response templates for the integration response as a string-to-string map of key-value pairs.
Response templates are represented as a key/value map, with a content-type as the key and a template as the
value.
</p>
@param responseTemplates
The collection of response templates for the integration response as a string-to-string map of key-value
pairs. Response templates are represented as a key/value map, with a content-type as the key and a
template as the value.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"collection",
"of",
"response",
"templates",
"for",
"the",
"integration",
"response",
"as",
"a",
"string",
"-",
"to",
"-",
"string",
"map",
"of",
"key",
"-",
"value",
"pairs",
".",
"Response",
"templates",
"are",
"represented",
"as",
"a",... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateIntegrationResponseRequest.java#L497-L500 |
grails/grails-core | grails-encoder/src/main/groovy/org/grails/charsequences/CharSequences.java | CharSequences.writeCharSequence | public static void writeCharSequence(Writer target, CharSequence csq, int start, int end) throws IOException {
final Class<?> csqClass = csq.getClass();
if (csqClass == String.class) {
target.write((String)csq, start, end - start);
}
else if (csqClass == StringBuffer.class) {
char[] buf = new char[end - start];
((StringBuffer)csq).getChars(start, end, buf, 0);
target.write(buf);
}
else if (csqClass == StringBuilder.class) {
char[] buf = new char[end - start];
((StringBuilder)csq).getChars(start, end, buf, 0);
target.write(buf);
}
else if (csq instanceof CharArrayAccessible) {
char[] buf = new char[end - start];
((CharArrayAccessible)csq).getChars(start, end, buf, 0);
target.write(buf);
}
else {
String str = csq.subSequence(start, end).toString();
target.write(str, 0, str.length());
}
} | java | public static void writeCharSequence(Writer target, CharSequence csq, int start, int end) throws IOException {
final Class<?> csqClass = csq.getClass();
if (csqClass == String.class) {
target.write((String)csq, start, end - start);
}
else if (csqClass == StringBuffer.class) {
char[] buf = new char[end - start];
((StringBuffer)csq).getChars(start, end, buf, 0);
target.write(buf);
}
else if (csqClass == StringBuilder.class) {
char[] buf = new char[end - start];
((StringBuilder)csq).getChars(start, end, buf, 0);
target.write(buf);
}
else if (csq instanceof CharArrayAccessible) {
char[] buf = new char[end - start];
((CharArrayAccessible)csq).getChars(start, end, buf, 0);
target.write(buf);
}
else {
String str = csq.subSequence(start, end).toString();
target.write(str, 0, str.length());
}
} | [
"public",
"static",
"void",
"writeCharSequence",
"(",
"Writer",
"target",
",",
"CharSequence",
"csq",
",",
"int",
"start",
",",
"int",
"end",
")",
"throws",
"IOException",
"{",
"final",
"Class",
"<",
"?",
">",
"csqClass",
"=",
"csq",
".",
"getClass",
"(",
... | Writes a CharSequence instance in the most optimal way to the target writer
@param target writer
@param csq source CharSequence instance
@param start start/offset index
@param end end index + 1
@throws IOException | [
"Writes",
"a",
"CharSequence",
"instance",
"in",
"the",
"most",
"optimal",
"way",
"to",
"the",
"target",
"writer"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-encoder/src/main/groovy/org/grails/charsequences/CharSequences.java#L86-L110 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java | AttributesImpl.setValue | public void setValue (int index, String value)
{
if (index >= 0 && index < length) {
data[index*5+4] = value;
} else {
badIndex(index);
}
} | java | public void setValue (int index, String value)
{
if (index >= 0 && index < length) {
data[index*5+4] = value;
} else {
badIndex(index);
}
} | [
"public",
"void",
"setValue",
"(",
"int",
"index",
",",
"String",
"value",
")",
"{",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"length",
")",
"{",
"data",
"[",
"index",
"*",
"5",
"+",
"4",
"]",
"=",
"value",
";",
"}",
"else",
"{",
"bad... | Set the value of a specific attribute.
@param index The index of the attribute (zero-based).
@param value The attribute's value.
@exception java.lang.ArrayIndexOutOfBoundsException When the
supplied index does not point to an attribute
in the list. | [
"Set",
"the",
"value",
"of",
"a",
"specific",
"attribute",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L544-L551 |
DDTH/ddth-redis | src/main/java/com/github/ddth/redis/RedisClientFactory.java | RedisClientFactory.createRedisClientPool | protected JedisClientPool createRedisClientPool(String host, int port, String username,
String password) {
return createRedisClientPool(host, port, username, password, null);
} | java | protected JedisClientPool createRedisClientPool(String host, int port, String username,
String password) {
return createRedisClientPool(host, port, username, password, null);
} | [
"protected",
"JedisClientPool",
"createRedisClientPool",
"(",
"String",
"host",
",",
"int",
"port",
",",
"String",
"username",
",",
"String",
"password",
")",
"{",
"return",
"createRedisClientPool",
"(",
"host",
",",
"port",
",",
"username",
",",
"password",
","... | Creates a new {@link JedisClientPool}.
@param host
@param port
@param username
@param password
@return | [
"Creates",
"a",
"new",
"{",
"@link",
"JedisClientPool",
"}",
"."
] | train | https://github.com/DDTH/ddth-redis/blob/7e6abc3e43c9efe7e9c293d421c94227253ded87/src/main/java/com/github/ddth/redis/RedisClientFactory.java#L127-L130 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.serviceName_lines_number_statistics_GET | public OvhUnitAndValues<OvhTimestampAndValue> serviceName_lines_number_statistics_GET(String serviceName, String number, OvhStatisticsPeriodEnum period, OvhLineStatisticsTypeEnum type) throws IOException {
String qPath = "/xdsl/{serviceName}/lines/{number}/statistics";
StringBuilder sb = path(qPath, serviceName, number);
query(sb, "period", period);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t12);
} | java | public OvhUnitAndValues<OvhTimestampAndValue> serviceName_lines_number_statistics_GET(String serviceName, String number, OvhStatisticsPeriodEnum period, OvhLineStatisticsTypeEnum type) throws IOException {
String qPath = "/xdsl/{serviceName}/lines/{number}/statistics";
StringBuilder sb = path(qPath, serviceName, number);
query(sb, "period", period);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t12);
} | [
"public",
"OvhUnitAndValues",
"<",
"OvhTimestampAndValue",
">",
"serviceName_lines_number_statistics_GET",
"(",
"String",
"serviceName",
",",
"String",
"number",
",",
"OvhStatisticsPeriodEnum",
"period",
",",
"OvhLineStatisticsTypeEnum",
"type",
")",
"throws",
"IOException",
... | Get various statistics about the line
REST: GET /xdsl/{serviceName}/lines/{number}/statistics
@param type [required]
@param period [required]
@param serviceName [required] The internal name of your XDSL offer
@param number [required] The number of the line | [
"Get",
"various",
"statistics",
"about",
"the",
"line"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L459-L466 |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java | ProxyFilter.sessionCreated | @Override
public void sessionCreated(NextFilter nextFilter, IoSession session)
throws Exception {
LOGGER.debug("Session created: " + session);
ProxyIoSession proxyIoSession = (ProxyIoSession) session
.getAttribute(ProxyIoSession.PROXY_SESSION);
LOGGER.debug(" get proxyIoSession: " + proxyIoSession);
proxyIoSession.setProxyFilter(this);
// Create a HTTP proxy handler and start handshake.
ProxyLogicHandler handler = proxyIoSession.getHandler();
// This test prevents from loosing handler conversationnal state when
// reconnection occurs during an http handshake.
if (handler == null) {
ProxyRequest request = proxyIoSession.getRequest();
if (request instanceof SocksProxyRequest) {
SocksProxyRequest req = (SocksProxyRequest) request;
if (req.getProtocolVersion() == SocksProxyConstants.SOCKS_VERSION_4) {
handler = new Socks4LogicHandler(proxyIoSession);
} else {
handler = new Socks5LogicHandler(proxyIoSession);
}
} else {
handler = new HttpSmartProxyHandler(proxyIoSession);
}
proxyIoSession.setHandler(handler);
handler.doHandshake(nextFilter);
}
proxyIoSession.getEventQueue().enqueueEventIfNecessary(
new IoSessionEvent(nextFilter, session,
IoSessionEventType.CREATED));
} | java | @Override
public void sessionCreated(NextFilter nextFilter, IoSession session)
throws Exception {
LOGGER.debug("Session created: " + session);
ProxyIoSession proxyIoSession = (ProxyIoSession) session
.getAttribute(ProxyIoSession.PROXY_SESSION);
LOGGER.debug(" get proxyIoSession: " + proxyIoSession);
proxyIoSession.setProxyFilter(this);
// Create a HTTP proxy handler and start handshake.
ProxyLogicHandler handler = proxyIoSession.getHandler();
// This test prevents from loosing handler conversationnal state when
// reconnection occurs during an http handshake.
if (handler == null) {
ProxyRequest request = proxyIoSession.getRequest();
if (request instanceof SocksProxyRequest) {
SocksProxyRequest req = (SocksProxyRequest) request;
if (req.getProtocolVersion() == SocksProxyConstants.SOCKS_VERSION_4) {
handler = new Socks4LogicHandler(proxyIoSession);
} else {
handler = new Socks5LogicHandler(proxyIoSession);
}
} else {
handler = new HttpSmartProxyHandler(proxyIoSession);
}
proxyIoSession.setHandler(handler);
handler.doHandshake(nextFilter);
}
proxyIoSession.getEventQueue().enqueueEventIfNecessary(
new IoSessionEvent(nextFilter, session,
IoSessionEventType.CREATED));
} | [
"@",
"Override",
"public",
"void",
"sessionCreated",
"(",
"NextFilter",
"nextFilter",
",",
"IoSession",
"session",
")",
"throws",
"Exception",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Session created: \"",
"+",
"session",
")",
";",
"ProxyIoSession",
"proxyIoSession",
... | Called when the session is created. Will create the handler able to handle
the {@link ProxyIoSession#getRequest()} request stored in the session. Event
is stored in an {@link IoSessionEventQueue} for later delivery to the next filter
in the chain when the handshake would have succeed. This will prevent the rest of
the filter chain from being affected by this filter internals.
Please note that this event can occur multiple times because of some http
proxies not handling keep-alive connections thus needing multiple sessions
during the handshake.
@param nextFilter the next filter in filter chain
@param session the session object | [
"Called",
"when",
"the",
"session",
"is",
"created",
".",
"Will",
"create",
"the",
"handler",
"able",
"to",
"handle",
"the",
"{",
"@link",
"ProxyIoSession#getRequest",
"()",
"}",
"request",
"stored",
"in",
"the",
"session",
".",
"Event",
"is",
"stored",
"in"... | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java#L271-L306 |
alkacon/opencms-core | src/org/opencms/ui/components/extensions/CmsGwtDialogExtension.java | CmsGwtDialogExtension.openPublishDailog | protected void openPublishDailog(CmsProject project, List<CmsResource> directPublishResources) {
CmsPublishData publishData = getPublishData(project, directPublishResources);
String data = getSerializedPublishData(publishData);
getRpcProxy(I_CmsGwtDialogClientRpc.class).openPublishDialog(data);
} | java | protected void openPublishDailog(CmsProject project, List<CmsResource> directPublishResources) {
CmsPublishData publishData = getPublishData(project, directPublishResources);
String data = getSerializedPublishData(publishData);
getRpcProxy(I_CmsGwtDialogClientRpc.class).openPublishDialog(data);
} | [
"protected",
"void",
"openPublishDailog",
"(",
"CmsProject",
"project",
",",
"List",
"<",
"CmsResource",
">",
"directPublishResources",
")",
"{",
"CmsPublishData",
"publishData",
"=",
"getPublishData",
"(",
"project",
",",
"directPublishResources",
")",
";",
"String",... | Opens the publish dialog for the given project.<p>
@param project the project for which to open the dialog
@param directPublishResources the resources for which to open the publish dialog. | [
"Opens",
"the",
"publish",
"dialog",
"for",
"the",
"given",
"project",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/extensions/CmsGwtDialogExtension.java#L337-L342 |
google/closure-compiler | src/com/google/javascript/jscomp/graph/LinkedDirectedGraph.java | LinkedDirectedGraph.connectIfNotConnectedInDirection | public void connectIfNotConnectedInDirection(N srcValue, E edgeValue, N destValue) {
LinkedDirectedGraphNode<N, E> src = createDirectedGraphNode(srcValue);
LinkedDirectedGraphNode<N, E> dest = createDirectedGraphNode(destValue);
if (!this.isConnectedInDirection(src, Predicates.equalTo(edgeValue), dest)) {
this.connect(src, edgeValue, dest);
}
} | java | public void connectIfNotConnectedInDirection(N srcValue, E edgeValue, N destValue) {
LinkedDirectedGraphNode<N, E> src = createDirectedGraphNode(srcValue);
LinkedDirectedGraphNode<N, E> dest = createDirectedGraphNode(destValue);
if (!this.isConnectedInDirection(src, Predicates.equalTo(edgeValue), dest)) {
this.connect(src, edgeValue, dest);
}
} | [
"public",
"void",
"connectIfNotConnectedInDirection",
"(",
"N",
"srcValue",
",",
"E",
"edgeValue",
",",
"N",
"destValue",
")",
"{",
"LinkedDirectedGraphNode",
"<",
"N",
",",
"E",
">",
"src",
"=",
"createDirectedGraphNode",
"(",
"srcValue",
")",
";",
"LinkedDirec... | DiGraphNode look ups can be expensive for a large graph operation, prefer this
method if you have the DiGraphNode available. | [
"DiGraphNode",
"look",
"ups",
"can",
"be",
"expensive",
"for",
"a",
"large",
"graph",
"operation",
"prefer",
"this",
"method",
"if",
"you",
"have",
"the",
"DiGraphNode",
"available",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/LinkedDirectedGraph.java#L101-L107 |
sniggle/simple-pgp | simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java | BasePGPCommon.findPrivateKey | protected PGPPrivateKey findPrivateKey(InputStream secretKey, final long keyId, String password) throws PGPException, IOException {
LOGGER.trace("findPrivateKey(InputStream, long, String)");
LOGGER.trace("Secret Key: {}, Key ID: {}, Password: {}", secretKey == null ? "not set" : "set", keyId, password == null ? "not set" : "********");
return findPrivateKey(secretKey, password, new KeyFilter<PGPSecretKey>() {
@Override
public boolean accept(PGPSecretKey secretKey) {
return secretKey.getKeyID() == keyId;
}
});
} | java | protected PGPPrivateKey findPrivateKey(InputStream secretKey, final long keyId, String password) throws PGPException, IOException {
LOGGER.trace("findPrivateKey(InputStream, long, String)");
LOGGER.trace("Secret Key: {}, Key ID: {}, Password: {}", secretKey == null ? "not set" : "set", keyId, password == null ? "not set" : "********");
return findPrivateKey(secretKey, password, new KeyFilter<PGPSecretKey>() {
@Override
public boolean accept(PGPSecretKey secretKey) {
return secretKey.getKeyID() == keyId;
}
});
} | [
"protected",
"PGPPrivateKey",
"findPrivateKey",
"(",
"InputStream",
"secretKey",
",",
"final",
"long",
"keyId",
",",
"String",
"password",
")",
"throws",
"PGPException",
",",
"IOException",
"{",
"LOGGER",
".",
"trace",
"(",
"\"findPrivateKey(InputStream, long, String)\"... | read a private key and unlock it with the given password
@param secretKey
the secret key stream
@param keyId
the required key id
@param password
the password to unlock the private key
@return the applicable private key or null if none is found
@throws PGPException
@throws IOException | [
"read",
"a",
"private",
"key",
"and",
"unlock",
"it",
"with",
"the",
"given",
"password"
] | train | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java#L221-L230 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.serviceName_owo_field_GET | public OvhOwo serviceName_owo_field_GET(String serviceName, net.minidev.ovh.api.domain.OvhWhoisObfuscatorFieldsEnum field) throws IOException {
String qPath = "/domain/{serviceName}/owo/{field}";
StringBuilder sb = path(qPath, serviceName, field);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOwo.class);
} | java | public OvhOwo serviceName_owo_field_GET(String serviceName, net.minidev.ovh.api.domain.OvhWhoisObfuscatorFieldsEnum field) throws IOException {
String qPath = "/domain/{serviceName}/owo/{field}";
StringBuilder sb = path(qPath, serviceName, field);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOwo.class);
} | [
"public",
"OvhOwo",
"serviceName_owo_field_GET",
"(",
"String",
"serviceName",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"domain",
".",
"OvhWhoisObfuscatorFieldsEnum",
"field",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/{s... | Get this object properties
REST: GET /domain/{serviceName}/owo/{field}
@param serviceName [required] The internal name of your domain
@param field [required] Obfuscated field | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L1472-L1477 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListUserSegmentEntryRelPersistenceImpl.java | CommercePriceListUserSegmentEntryRelPersistenceImpl.removeByUuid_C | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CommercePriceListUserSegmentEntryRel commercePriceListUserSegmentEntryRel : findByUuid_C(
uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commercePriceListUserSegmentEntryRel);
}
} | java | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CommercePriceListUserSegmentEntryRel commercePriceListUserSegmentEntryRel : findByUuid_C(
uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commercePriceListUserSegmentEntryRel);
}
} | [
"@",
"Override",
"public",
"void",
"removeByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"for",
"(",
"CommercePriceListUserSegmentEntryRel",
"commercePriceListUserSegmentEntryRel",
":",
"findByUuid_C",
"(",
"uuid",
",",
"companyId",
",",
"QueryU... | Removes all the commerce price list user segment entry rels where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID | [
"Removes",
"all",
"the",
"commerce",
"price",
"list",
"user",
"segment",
"entry",
"rels",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListUserSegmentEntryRelPersistenceImpl.java#L1438-L1444 |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.deleteModule | public void deleteModule(final String name, final String version, final String user, final String password) throws GrapesCommunicationException, AuthenticationException{
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getModulePath(name, version));
final ClientResponse response = resource.delete(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = String.format(FAILED_TO_GET_MODULE, "to delete module", name, version);
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | java | public void deleteModule(final String name, final String version, final String user, final String password) throws GrapesCommunicationException, AuthenticationException{
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getModulePath(name, version));
final ClientResponse response = resource.delete(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = String.format(FAILED_TO_GET_MODULE, "to delete module", name, version);
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | [
"public",
"void",
"deleteModule",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"version",
",",
"final",
"String",
"user",
",",
"final",
"String",
"password",
")",
"throws",
"GrapesCommunicationException",
",",
"AuthenticationException",
"{",
"final",
"C... | Delete a module from Grapes server
@param name
@param version
@throws GrapesCommunicationException
@throws javax.naming.AuthenticationException | [
"Delete",
"a",
"module",
"from",
"Grapes",
"server"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L201-L215 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readLines | public static List<String> readLines(File file, String charset) throws IORuntimeException {
return readLines(file, charset, new ArrayList<String>());
} | java | public static List<String> readLines(File file, String charset) throws IORuntimeException {
return readLines(file, charset, new ArrayList<String>());
} | [
"public",
"static",
"List",
"<",
"String",
">",
"readLines",
"(",
"File",
"file",
",",
"String",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"readLines",
"(",
"file",
",",
"charset",
",",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",... | 从文件中读取每一行数据
@param file 文件
@param charset 字符集
@return 文件中的每行内容的集合List
@throws IORuntimeException IO异常 | [
"从文件中读取每一行数据"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2380-L2382 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/config/ServiceKernel.java | ServiceKernel.redefineService | public <T extends IService, Q extends T> void redefineService(Class<? extends T> service, Q newProvider)
{
if( _definingServices )
{
throw new IllegalStateException( "Service definition in progress, so service redefinition is not allowed. Please " +
"move redefinitions to the redefineServices method." );
}
IService existingServiceImpl = _services.get( service );
if( existingServiceImpl == null )
{
throw new IllegalArgumentException( "Service " + service.getName() + " is not defined in this ServiceKernel.");
}
if( existingServiceImpl.isInited() )
{
throw new IllegalStateException( "Service " + service.getName() + " has already been " +
"initialized with the " + existingServiceImpl.getClass().getName() +
" implementation");
}
_services.put( service, newProvider );
} | java | public <T extends IService, Q extends T> void redefineService(Class<? extends T> service, Q newProvider)
{
if( _definingServices )
{
throw new IllegalStateException( "Service definition in progress, so service redefinition is not allowed. Please " +
"move redefinitions to the redefineServices method." );
}
IService existingServiceImpl = _services.get( service );
if( existingServiceImpl == null )
{
throw new IllegalArgumentException( "Service " + service.getName() + " is not defined in this ServiceKernel.");
}
if( existingServiceImpl.isInited() )
{
throw new IllegalStateException( "Service " + service.getName() + " has already been " +
"initialized with the " + existingServiceImpl.getClass().getName() +
" implementation");
}
_services.put( service, newProvider );
} | [
"public",
"<",
"T",
"extends",
"IService",
",",
"Q",
"extends",
"T",
">",
"void",
"redefineService",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"service",
",",
"Q",
"newProvider",
")",
"{",
"if",
"(",
"_definingServices",
")",
"{",
"throw",
"new",
"I... | Overrides the default implemenation of the service with a different provider. Note that the current
provider cannot have been accessed (all services must be consistent during runtime.)
@param service - the service to provide
@param newProvider - the new provider of this service | [
"Overrides",
"the",
"default",
"implemenation",
"of",
"the",
"service",
"with",
"a",
"different",
"provider",
".",
"Note",
"that",
"the",
"current",
"provider",
"cannot",
"have",
"been",
"accessed",
"(",
"all",
"services",
"must",
"be",
"consistent",
"during",
... | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/config/ServiceKernel.java#L79-L98 |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyZipUtils.java | MyZipUtils.recursiveAddZip | public static void recursiveAddZip(File parent, ZipOutputStream zout, File fileSource)
throws IOException {
File[] files = fileSource.listFiles();
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
recursiveAddZip(parent, zout, files[i]);
continue;
}
byte[] buffer = new byte[1024];
FileInputStream fin = new FileInputStream(files[i]);
ZipEntry zipEntry =
new ZipEntry(files[i].getAbsolutePath()
.replace(parent.getAbsolutePath(), "").substring(1)); //$NON-NLS-1$
zout.putNextEntry(zipEntry);
int length;
while ((length = fin.read(buffer)) > 0) {
zout.write(buffer, 0, length);
}
zout.closeEntry();
fin.close();
}
} | java | public static void recursiveAddZip(File parent, ZipOutputStream zout, File fileSource)
throws IOException {
File[] files = fileSource.listFiles();
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
recursiveAddZip(parent, zout, files[i]);
continue;
}
byte[] buffer = new byte[1024];
FileInputStream fin = new FileInputStream(files[i]);
ZipEntry zipEntry =
new ZipEntry(files[i].getAbsolutePath()
.replace(parent.getAbsolutePath(), "").substring(1)); //$NON-NLS-1$
zout.putNextEntry(zipEntry);
int length;
while ((length = fin.read(buffer)) > 0) {
zout.write(buffer, 0, length);
}
zout.closeEntry();
fin.close();
}
} | [
"public",
"static",
"void",
"recursiveAddZip",
"(",
"File",
"parent",
",",
"ZipOutputStream",
"zout",
",",
"File",
"fileSource",
")",
"throws",
"IOException",
"{",
"File",
"[",
"]",
"files",
"=",
"fileSource",
".",
"listFiles",
"(",
")",
";",
"for",
"(",
"... | Recursively add files to a ZipOutputStream
@param parent Parent file
@param zout ZipOutputStream to append
@param fileSource The file source
@throws IOException I/O Error | [
"Recursively",
"add",
"files",
"to",
"a",
"ZipOutputStream"
] | train | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyZipUtils.java#L136-L167 |
wuman/orientdb-android | commons/src/main/java/com/orientechnologies/common/parser/OBaseParser.java | OBaseParser.parserRequiredWord | protected String parserRequiredWord(final boolean iUpperCase, final String iCustomMessage, String iSeparators) {
if (iSeparators == null)
iSeparators = " =><(),\r\n";
parserNextWord(iUpperCase, iSeparators);
if (parserLastWord.length() == 0)
throwSyntaxErrorException(iCustomMessage);
return parserLastWord.toString();
} | java | protected String parserRequiredWord(final boolean iUpperCase, final String iCustomMessage, String iSeparators) {
if (iSeparators == null)
iSeparators = " =><(),\r\n";
parserNextWord(iUpperCase, iSeparators);
if (parserLastWord.length() == 0)
throwSyntaxErrorException(iCustomMessage);
return parserLastWord.toString();
} | [
"protected",
"String",
"parserRequiredWord",
"(",
"final",
"boolean",
"iUpperCase",
",",
"final",
"String",
"iCustomMessage",
",",
"String",
"iSeparators",
")",
"{",
"if",
"(",
"iSeparators",
"==",
"null",
")",
"iSeparators",
"=",
"\" =><(),\\r\\n\"",
";",
"parser... | Parses the next word. If no word is found or the parsed word is not present in the word array received as parameter then a
SyntaxError exception with the custom message received as parameter is thrown. It returns the word parsed if any.
@param iUpperCase
True if must return UPPERCASE, otherwise false
@param iCustomMessage
Custom message to include in case of SyntaxError exception
@param iSeparators
Separator characters
@return The word parsed | [
"Parses",
"the",
"next",
"word",
".",
"If",
"no",
"word",
"is",
"found",
"or",
"the",
"parsed",
"word",
"is",
"not",
"present",
"in",
"the",
"word",
"array",
"received",
"as",
"parameter",
"then",
"a",
"SyntaxError",
"exception",
"with",
"the",
"custom",
... | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/commons/src/main/java/com/orientechnologies/common/parser/OBaseParser.java#L140-L148 |
restfb/restfb | src/main/java/com/restfb/util/EncodingUtils.java | EncodingUtils.encodeAppSecretProof | public static String encodeAppSecretProof(String appSecret, String accessToken) {
try {
byte[] key = appSecret.getBytes(StandardCharsets.UTF_8);
SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA256");
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(signingKey);
byte[] raw = mac.doFinal(accessToken.getBytes());
byte[] hex = encodeHex(raw);
return new String(hex, StandardCharsets.UTF_8);
} catch (Exception e) {
throw new IllegalStateException("Creation of appsecret_proof has failed", e);
}
} | java | public static String encodeAppSecretProof(String appSecret, String accessToken) {
try {
byte[] key = appSecret.getBytes(StandardCharsets.UTF_8);
SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA256");
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(signingKey);
byte[] raw = mac.doFinal(accessToken.getBytes());
byte[] hex = encodeHex(raw);
return new String(hex, StandardCharsets.UTF_8);
} catch (Exception e) {
throw new IllegalStateException("Creation of appsecret_proof has failed", e);
}
} | [
"public",
"static",
"String",
"encodeAppSecretProof",
"(",
"String",
"appSecret",
",",
"String",
"accessToken",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"key",
"=",
"appSecret",
".",
"getBytes",
"(",
"StandardCharsets",
".",
"UTF_8",
")",
";",
"SecretKeySpec",
... | Generates an appsecret_proof for facebook.
See https://developers.facebook.com/docs/graph-api/securing-requests for more info
@param appSecret
The facebook application secret
@param accessToken
The facebook access token
@return A Hex encoded SHA256 Hash as a String | [
"Generates",
"an",
"appsecret_proof",
"for",
"facebook",
"."
] | train | https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/EncodingUtils.java#L112-L124 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/ProcessEngines.java | ProcessEngines.retry | public static ProcessEngineInfo retry(String resourceUrl) {
try {
return initProcessEngineFromResource(new URL(resourceUrl));
} catch (MalformedURLException e) {
throw new ProcessEngineException("invalid url: "+resourceUrl, e);
}
} | java | public static ProcessEngineInfo retry(String resourceUrl) {
try {
return initProcessEngineFromResource(new URL(resourceUrl));
} catch (MalformedURLException e) {
throw new ProcessEngineException("invalid url: "+resourceUrl, e);
}
} | [
"public",
"static",
"ProcessEngineInfo",
"retry",
"(",
"String",
"resourceUrl",
")",
"{",
"try",
"{",
"return",
"initProcessEngineFromResource",
"(",
"new",
"URL",
"(",
"resourceUrl",
")",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"t... | retries to initialize a process engine that previously failed. | [
"retries",
"to",
"initialize",
"a",
"process",
"engine",
"that",
"previously",
"failed",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/ProcessEngines.java#L255-L261 |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java | Resources.getDouble | public double getDouble( String key, double defaultValue )
throws MissingResourceException
{
try
{
return getDouble( key );
}
catch( MissingResourceException mre )
{
return defaultValue;
}
} | java | public double getDouble( String key, double defaultValue )
throws MissingResourceException
{
try
{
return getDouble( key );
}
catch( MissingResourceException mre )
{
return defaultValue;
}
} | [
"public",
"double",
"getDouble",
"(",
"String",
"key",
",",
"double",
"defaultValue",
")",
"throws",
"MissingResourceException",
"{",
"try",
"{",
"return",
"getDouble",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"MissingResourceException",
"mre",
")",
"{",
"retu... | Retrieve a double from bundle.
@param key the key of resource
@param defaultValue the default value if key is missing
@return the resource double
@throws MissingResourceException if the requested key is unknown | [
"Retrieve",
"a",
"double",
"from",
"bundle",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java#L477-L488 |
OpenBEL/openbel-framework | org.openbel.framework.core/src/main/java/org/openbel/framework/core/CommandLineApplication.java | CommandLineApplication.addOption | public final void addOption(String shortOpt, String longOpt, String desc,
boolean hasArg) {
cliOptions.addOption(new Option(shortOpt, longOpt, hasArg, desc));
} | java | public final void addOption(String shortOpt, String longOpt, String desc,
boolean hasArg) {
cliOptions.addOption(new Option(shortOpt, longOpt, hasArg, desc));
} | [
"public",
"final",
"void",
"addOption",
"(",
"String",
"shortOpt",
",",
"String",
"longOpt",
",",
"String",
"desc",
",",
"boolean",
"hasArg",
")",
"{",
"cliOptions",
".",
"addOption",
"(",
"new",
"Option",
"(",
"shortOpt",
",",
"longOpt",
",",
"hasArg",
",... | Adds a command-line option. This is only useful before calling
{@link #start() start}.
@param shortOpt Short, one character option (e.g., {@code -t})
@param longOpt Long, one or two word option (e.g., {@code --long-option})
@param desc Option description (e.g., {@code does something great})
@param hasArg boolean {@code true} if the option requires an argument,
{@code false} otherwise | [
"Adds",
"a",
"command",
"-",
"line",
"option",
".",
"This",
"is",
"only",
"useful",
"before",
"calling",
"{",
"@link",
"#start",
"()",
"start",
"}",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/CommandLineApplication.java#L423-L426 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java | ST_GeometryShadow.computeShadow | public static Geometry computeShadow(Geometry geometry, Geometry sunPosition, double height) {
if (sunPosition != null) {
if (sunPosition instanceof Point) {
return computeShadow(geometry, sunPosition.getCoordinate().x, sunPosition.getCoordinate().y, height, true);
}
throw new IllegalArgumentException("The sun position must be stored in a point with \n"
+ "x = sun azimuth in radians (direction along the horizon, measured from north to\n"
+ "east and y = sun altitude above the horizon in radians.");
}
return null;
} | java | public static Geometry computeShadow(Geometry geometry, Geometry sunPosition, double height) {
if (sunPosition != null) {
if (sunPosition instanceof Point) {
return computeShadow(geometry, sunPosition.getCoordinate().x, sunPosition.getCoordinate().y, height, true);
}
throw new IllegalArgumentException("The sun position must be stored in a point with \n"
+ "x = sun azimuth in radians (direction along the horizon, measured from north to\n"
+ "east and y = sun altitude above the horizon in radians.");
}
return null;
} | [
"public",
"static",
"Geometry",
"computeShadow",
"(",
"Geometry",
"geometry",
",",
"Geometry",
"sunPosition",
",",
"double",
"height",
")",
"{",
"if",
"(",
"sunPosition",
"!=",
"null",
")",
"{",
"if",
"(",
"sunPosition",
"instanceof",
"Point",
")",
"{",
"ret... | Compute the shadow footprint based on
@param geometry input geometry
@param sunPosition as a point where x = azimuth and y=altitude
@param height of the geometry
@return | [
"Compute",
"the",
"shadow",
"footprint",
"based",
"on"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java#L70-L80 |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/Utils.java | Utils.parseBoolean | public static boolean parseBoolean(String valueName, String value, boolean defaultValue) {
boolean result = defaultValue;
if (value != null) {
boolean valid = true;
result = Boolean.parseBoolean(value);
// parseBoolean allows any value, e.g. so a typo like "trye" would be silently interpreted as false
if (!result) {
if (!Boolean.FALSE.toString().equalsIgnoreCase(value)) {
valid = false;
}
}
if (!valid) {
String message = String.format("Invalid value \"%s\" for %s, must be \"%s\" or \"%s\"",
value, valueName, Boolean.TRUE.toString(), Boolean.FALSE.toString());
throw new IllegalArgumentException(message);
}
}
return result;
} | java | public static boolean parseBoolean(String valueName, String value, boolean defaultValue) {
boolean result = defaultValue;
if (value != null) {
boolean valid = true;
result = Boolean.parseBoolean(value);
// parseBoolean allows any value, e.g. so a typo like "trye" would be silently interpreted as false
if (!result) {
if (!Boolean.FALSE.toString().equalsIgnoreCase(value)) {
valid = false;
}
}
if (!valid) {
String message = String.format("Invalid value \"%s\" for %s, must be \"%s\" or \"%s\"",
value, valueName, Boolean.TRUE.toString(), Boolean.FALSE.toString());
throw new IllegalArgumentException(message);
}
}
return result;
} | [
"public",
"static",
"boolean",
"parseBoolean",
"(",
"String",
"valueName",
",",
"String",
"value",
",",
"boolean",
"defaultValue",
")",
"{",
"boolean",
"result",
"=",
"defaultValue",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"boolean",
"valid",
"=",
... | Validate that the given string value is a valid boolean ("true" or "false", case insensitive) and convert it to a boolean
@param valueName
@param value
@param defaultValue result to be returned if value is null
@return
@throws IllegalArgumentException if the value is not a positive integer (including if it is an empty string) | [
"Validate",
"that",
"the",
"given",
"string",
"value",
"is",
"a",
"valid",
"boolean",
"(",
"true",
"or",
"false",
"case",
"insensitive",
")",
"and",
"convert",
"it",
"to",
"a",
"boolean"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/Utils.java#L525-L543 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/android/Util.java | Util.encodePostBody | @Deprecated
public static String encodePostBody(Bundle parameters, String boundary) {
if (parameters == null) return "";
StringBuilder sb = new StringBuilder();
for (String key : parameters.keySet()) {
Object parameter = parameters.get(key);
if (!(parameter instanceof String)) {
continue;
}
sb.append("Content-Disposition: form-data; name=\"" + key +
"\"\r\n\r\n" + (String)parameter);
sb.append("\r\n" + "--" + boundary + "\r\n");
}
return sb.toString();
} | java | @Deprecated
public static String encodePostBody(Bundle parameters, String boundary) {
if (parameters == null) return "";
StringBuilder sb = new StringBuilder();
for (String key : parameters.keySet()) {
Object parameter = parameters.get(key);
if (!(parameter instanceof String)) {
continue;
}
sb.append("Content-Disposition: form-data; name=\"" + key +
"\"\r\n\r\n" + (String)parameter);
sb.append("\r\n" + "--" + boundary + "\r\n");
}
return sb.toString();
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"encodePostBody",
"(",
"Bundle",
"parameters",
",",
"String",
"boundary",
")",
"{",
"if",
"(",
"parameters",
"==",
"null",
")",
"return",
"\"\"",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"... | Generate the multi-part post body providing the parameters and boundary
string
@param parameters the parameters need to be posted
@param boundary the random string as boundary
@return a string of the post body | [
"Generate",
"the",
"multi",
"-",
"part",
"post",
"body",
"providing",
"the",
"parameters",
"and",
"boundary",
"string"
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/android/Util.java#L56-L73 |
stevespringett/Alpine | alpine/src/main/java/alpine/persistence/AlpineQueryManager.java | AlpineQueryManager.hasPermission | public boolean hasPermission(final UserPrincipal user, String permissionName, boolean includeTeams) {
Query query;
if (user instanceof ManagedUser) {
query = pm.newQuery(Permission.class, "name == :permissionName && managedUsers.contains(:user)");
} else {
query = pm.newQuery(Permission.class, "name == :permissionName && ldapUsers.contains(:user)");
}
query.setResult("count(id)");
final long count = (Long) query.execute(permissionName, user);
if (count > 0) {
return true;
}
if (includeTeams) {
for (final Team team: user.getTeams()) {
if (hasPermission(team, permissionName)) {
return true;
}
}
}
return false;
} | java | public boolean hasPermission(final UserPrincipal user, String permissionName, boolean includeTeams) {
Query query;
if (user instanceof ManagedUser) {
query = pm.newQuery(Permission.class, "name == :permissionName && managedUsers.contains(:user)");
} else {
query = pm.newQuery(Permission.class, "name == :permissionName && ldapUsers.contains(:user)");
}
query.setResult("count(id)");
final long count = (Long) query.execute(permissionName, user);
if (count > 0) {
return true;
}
if (includeTeams) {
for (final Team team: user.getTeams()) {
if (hasPermission(team, permissionName)) {
return true;
}
}
}
return false;
} | [
"public",
"boolean",
"hasPermission",
"(",
"final",
"UserPrincipal",
"user",
",",
"String",
"permissionName",
",",
"boolean",
"includeTeams",
")",
"{",
"Query",
"query",
";",
"if",
"(",
"user",
"instanceof",
"ManagedUser",
")",
"{",
"query",
"=",
"pm",
".",
... | Determines if the specified UserPrincipal has been assigned the specified permission.
@param user the UserPrincipal to query
@param permissionName the name of the permission
@param includeTeams if true, will query all Team membership assigned to the user for the specified permission
@return true if the user has the permission assigned, false if not
@since 1.0.0 | [
"Determines",
"if",
"the",
"specified",
"UserPrincipal",
"has",
"been",
"assigned",
"the",
"specified",
"permission",
"."
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L528-L548 |
amaembo/streamex | src/main/java/one/util/streamex/IntStreamEx.java | IntStreamEx.mapFirst | public IntStreamEx mapFirst(IntUnaryOperator mapper) {
return delegate(new PairSpliterator.PSOfInt((a, b) -> b, mapper, spliterator(),
PairSpliterator.MODE_MAP_FIRST));
} | java | public IntStreamEx mapFirst(IntUnaryOperator mapper) {
return delegate(new PairSpliterator.PSOfInt((a, b) -> b, mapper, spliterator(),
PairSpliterator.MODE_MAP_FIRST));
} | [
"public",
"IntStreamEx",
"mapFirst",
"(",
"IntUnaryOperator",
"mapper",
")",
"{",
"return",
"delegate",
"(",
"new",
"PairSpliterator",
".",
"PSOfInt",
"(",
"(",
"a",
",",
"b",
")",
"->",
"b",
",",
"mapper",
",",
"spliterator",
"(",
")",
",",
"PairSpliterat... | Returns a stream where the first element is the replaced with the result
of applying the given function while the other elements are left intact.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate
operation</a>.
@param mapper a
<a href="package-summary.html#NonInterference">non-interfering
</a>, <a href="package-summary.html#Statelessness">stateless</a>
function to apply to the first element
@return the new stream
@since 0.4.1 | [
"Returns",
"a",
"stream",
"where",
"the",
"first",
"element",
"is",
"the",
"replaced",
"with",
"the",
"result",
"of",
"applying",
"the",
"given",
"function",
"while",
"the",
"other",
"elements",
"are",
"left",
"intact",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L1704-L1707 |
apereo/cas | support/cas-server-support-gauth-couchdb/src/main/java/org/apereo/cas/couchdb/gauth/token/GoogleAuthenticatorTokenCouchDbRepository.java | GoogleAuthenticatorTokenCouchDbRepository.findByToken | @View(name = "by_token", map = "function(doc) { if(doc.token && doc.userId) { emit(doc.token, doc) } }")
public List<CouchDbGoogleAuthenticatorToken> findByToken(final Integer otp) {
return queryView("by_token", otp);
} | java | @View(name = "by_token", map = "function(doc) { if(doc.token && doc.userId) { emit(doc.token, doc) } }")
public List<CouchDbGoogleAuthenticatorToken> findByToken(final Integer otp) {
return queryView("by_token", otp);
} | [
"@",
"View",
"(",
"name",
"=",
"\"by_token\"",
",",
"map",
"=",
"\"function(doc) { if(doc.token && doc.userId) { emit(doc.token, doc) } }\"",
")",
"public",
"List",
"<",
"CouchDbGoogleAuthenticatorToken",
">",
"findByToken",
"(",
"final",
"Integer",
"otp",
")",
"{",
"re... | Find by token.
@param otp token to search for
@return token for the otp | [
"Find",
"by",
"token",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-gauth-couchdb/src/main/java/org/apereo/cas/couchdb/gauth/token/GoogleAuthenticatorTokenCouchDbRepository.java#L122-L125 |
ansell/restlet-utils | src/main/java/com/github/ansell/restletutils/RestletUtilSesameRealm.java | RestletUtilSesameRealm.getUsers | public List<RestletUtilUser> getUsers()
{
List<RestletUtilUser> result = new ArrayList<RestletUtilUser>();
RepositoryConnection conn = null;
try
{
conn = this.repository.getConnection();
final String query = this.buildSparqlQueryToFindUser(null, true);
this.log.debug("findUser: query={}", query);
final TupleQuery tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, query);
final TupleQueryResult queryResult = tupleQuery.evaluate();
try
{
while(queryResult.hasNext())
{
final BindingSet bindingSet = queryResult.next();
Binding binding = bindingSet.getBinding("userIdentifier");
result.add(this.buildRestletUserFromSparqlResult(binding.getValue().stringValue(), bindingSet));
}
}
finally
{
queryResult.close();
}
}
catch(final RepositoryException e)
{
throw new RuntimeException("Failure finding user in repository", e);
}
catch(final MalformedQueryException e)
{
throw new RuntimeException("Failure finding user in repository", e);
}
catch(final QueryEvaluationException e)
{
throw new RuntimeException("Failure finding user in repository", e);
}
finally
{
try
{
conn.close();
}
catch(final RepositoryException e)
{
this.log.error("Failure to close connection", e);
}
}
return Collections.unmodifiableList(result);
} | java | public List<RestletUtilUser> getUsers()
{
List<RestletUtilUser> result = new ArrayList<RestletUtilUser>();
RepositoryConnection conn = null;
try
{
conn = this.repository.getConnection();
final String query = this.buildSparqlQueryToFindUser(null, true);
this.log.debug("findUser: query={}", query);
final TupleQuery tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, query);
final TupleQueryResult queryResult = tupleQuery.evaluate();
try
{
while(queryResult.hasNext())
{
final BindingSet bindingSet = queryResult.next();
Binding binding = bindingSet.getBinding("userIdentifier");
result.add(this.buildRestletUserFromSparqlResult(binding.getValue().stringValue(), bindingSet));
}
}
finally
{
queryResult.close();
}
}
catch(final RepositoryException e)
{
throw new RuntimeException("Failure finding user in repository", e);
}
catch(final MalformedQueryException e)
{
throw new RuntimeException("Failure finding user in repository", e);
}
catch(final QueryEvaluationException e)
{
throw new RuntimeException("Failure finding user in repository", e);
}
finally
{
try
{
conn.close();
}
catch(final RepositoryException e)
{
this.log.error("Failure to close connection", e);
}
}
return Collections.unmodifiableList(result);
} | [
"public",
"List",
"<",
"RestletUtilUser",
">",
"getUsers",
"(",
")",
"{",
"List",
"<",
"RestletUtilUser",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"RestletUtilUser",
">",
"(",
")",
";",
"RepositoryConnection",
"conn",
"=",
"null",
";",
"try",
"{",
"con... | Returns an unmodifiable list of users.
@return An unmodifiable list of users. | [
"Returns",
"an",
"unmodifiable",
"list",
"of",
"users",
"."
] | train | https://github.com/ansell/restlet-utils/blob/6c39a3e91aa8295936af1dbfccd6ba27230c40a9/src/main/java/com/github/ansell/restletutils/RestletUtilSesameRealm.java#L1338-L1396 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java | Http2ConnectionHandler.checkCloseConnection | private void checkCloseConnection(ChannelFuture future) {
// If this connection is closing and the graceful shutdown has completed, close the connection
// once this operation completes.
if (closeListener != null && isGracefulShutdownComplete()) {
ChannelFutureListener closeListener = this.closeListener;
// This method could be called multiple times
// and we don't want to notify the closeListener multiple times.
this.closeListener = null;
try {
closeListener.operationComplete(future);
} catch (Exception e) {
throw new IllegalStateException("Close listener threw an unexpected exception", e);
}
}
} | java | private void checkCloseConnection(ChannelFuture future) {
// If this connection is closing and the graceful shutdown has completed, close the connection
// once this operation completes.
if (closeListener != null && isGracefulShutdownComplete()) {
ChannelFutureListener closeListener = this.closeListener;
// This method could be called multiple times
// and we don't want to notify the closeListener multiple times.
this.closeListener = null;
try {
closeListener.operationComplete(future);
} catch (Exception e) {
throw new IllegalStateException("Close listener threw an unexpected exception", e);
}
}
} | [
"private",
"void",
"checkCloseConnection",
"(",
"ChannelFuture",
"future",
")",
"{",
"// If this connection is closing and the graceful shutdown has completed, close the connection",
"// once this operation completes.",
"if",
"(",
"closeListener",
"!=",
"null",
"&&",
"isGracefulShutd... | Closes the connection if the graceful shutdown process has completed.
@param future Represents the status that will be passed to the {@link #closeListener}. | [
"Closes",
"the",
"connection",
"if",
"the",
"graceful",
"shutdown",
"process",
"has",
"completed",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L853-L867 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/html/embedded/AbstractHCImg.java | AbstractHCImg.scaleBestMatching | @Nonnull
public final IMPLTYPE scaleBestMatching (@Nonnegative final int nMaxWidth, @Nonnegative final int nMaxHeight)
{
if (m_aExtent != null)
m_aExtent = m_aExtent.getBestMatchingSize (nMaxWidth, nMaxHeight);
return thisAsT ();
} | java | @Nonnull
public final IMPLTYPE scaleBestMatching (@Nonnegative final int nMaxWidth, @Nonnegative final int nMaxHeight)
{
if (m_aExtent != null)
m_aExtent = m_aExtent.getBestMatchingSize (nMaxWidth, nMaxHeight);
return thisAsT ();
} | [
"@",
"Nonnull",
"public",
"final",
"IMPLTYPE",
"scaleBestMatching",
"(",
"@",
"Nonnegative",
"final",
"int",
"nMaxWidth",
",",
"@",
"Nonnegative",
"final",
"int",
"nMaxHeight",
")",
"{",
"if",
"(",
"m_aExtent",
"!=",
"null",
")",
"m_aExtent",
"=",
"m_aExtent",... | Scales the image so that neither with nor height are exceeded, keeping the
aspect ratio.
@param nMaxWidth
Maximum with
@param nMaxHeight
Maximum height
@return the correctly resized image tag | [
"Scales",
"the",
"image",
"so",
"that",
"neither",
"with",
"nor",
"height",
"are",
"exceeded",
"keeping",
"the",
"aspect",
"ratio",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/html/embedded/AbstractHCImg.java#L159-L165 |
cojen/Cojen | src/main/java/org/cojen/classfile/ClassFile.java | ClassFile.addMethod | public MethodInfo addMethod(Modifiers modifiers,
String methodName,
TypeDesc ret,
TypeDesc[] params) {
MethodDesc md = MethodDesc.forArguments(ret, params);
return addMethod(modifiers, methodName, md);
} | java | public MethodInfo addMethod(Modifiers modifiers,
String methodName,
TypeDesc ret,
TypeDesc[] params) {
MethodDesc md = MethodDesc.forArguments(ret, params);
return addMethod(modifiers, methodName, md);
} | [
"public",
"MethodInfo",
"addMethod",
"(",
"Modifiers",
"modifiers",
",",
"String",
"methodName",
",",
"TypeDesc",
"ret",
",",
"TypeDesc",
"[",
"]",
"params",
")",
"{",
"MethodDesc",
"md",
"=",
"MethodDesc",
".",
"forArguments",
"(",
"ret",
",",
"params",
")"... | Add a method to this class.
@param ret Is null if method returns void.
@param params May be null if method accepts no parameters. | [
"Add",
"a",
"method",
"to",
"this",
"class",
"."
] | train | https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/classfile/ClassFile.java#L746-L752 |
3pillarlabs/spring-data-simpledb | spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/core/DomainItemBuilder.java | DomainItemBuilder.populateDomainItem | public T populateDomainItem(SimpleDbEntityInformation<T, ?> entityInformation, Item item) {
return buildDomainItem(entityInformation, item);
} | java | public T populateDomainItem(SimpleDbEntityInformation<T, ?> entityInformation, Item item) {
return buildDomainItem(entityInformation, item);
} | [
"public",
"T",
"populateDomainItem",
"(",
"SimpleDbEntityInformation",
"<",
"T",
",",
"?",
">",
"entityInformation",
",",
"Item",
"item",
")",
"{",
"return",
"buildDomainItem",
"(",
"entityInformation",
",",
"item",
")",
";",
"}"
] | Used during deserialization process, each item being populated based on attributes retrieved from DB
@param entityInformation
@param item
@return T the Item Instance | [
"Used",
"during",
"deserialization",
"process",
"each",
"item",
"being",
"populated",
"based",
"on",
"attributes",
"retrieved",
"from",
"DB"
] | train | https://github.com/3pillarlabs/spring-data-simpledb/blob/f1e0eb4e48ec4674d3966e8f5bc04c95031f93ae/spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/core/DomainItemBuilder.java#L35-L37 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.mapToBeanIgnoreCase | public static <T> T mapToBeanIgnoreCase(Map<?, ?> map, Class<T> beanClass, boolean isIgnoreError) {
return fillBeanWithMapIgnoreCase(map, ReflectUtil.newInstance(beanClass), isIgnoreError);
} | java | public static <T> T mapToBeanIgnoreCase(Map<?, ?> map, Class<T> beanClass, boolean isIgnoreError) {
return fillBeanWithMapIgnoreCase(map, ReflectUtil.newInstance(beanClass), isIgnoreError);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"mapToBeanIgnoreCase",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"Class",
"<",
"T",
">",
"beanClass",
",",
"boolean",
"isIgnoreError",
")",
"{",
"return",
"fillBeanWithMapIgnoreCase",
"(",
"map",
",",
"Refle... | Map转换为Bean对象<br>
忽略大小写
@param <T> Bean类型
@param map Map
@param beanClass Bean Class
@param isIgnoreError 是否忽略注入错误
@return Bean | [
"Map转换为Bean对象<br",
">",
"忽略大小写"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L341-L343 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestClientConfiguration.java | RestClientConfiguration.fromConfiguration | public static RestClientConfiguration fromConfiguration(Configuration config) throws ConfigurationException {
Preconditions.checkNotNull(config);
final SSLHandlerFactory sslHandlerFactory;
if (SSLUtils.isRestSSLEnabled(config)) {
try {
sslHandlerFactory = SSLUtils.createRestClientSSLEngineFactory(config);
} catch (Exception e) {
throw new ConfigurationException("Failed to initialize SSLContext for the REST client", e);
}
} else {
sslHandlerFactory = null;
}
final long connectionTimeout = config.getLong(RestOptions.CONNECTION_TIMEOUT);
final long idlenessTimeout = config.getLong(RestOptions.IDLENESS_TIMEOUT);
int maxContentLength = config.getInteger(RestOptions.CLIENT_MAX_CONTENT_LENGTH);
return new RestClientConfiguration(sslHandlerFactory, connectionTimeout, idlenessTimeout, maxContentLength);
} | java | public static RestClientConfiguration fromConfiguration(Configuration config) throws ConfigurationException {
Preconditions.checkNotNull(config);
final SSLHandlerFactory sslHandlerFactory;
if (SSLUtils.isRestSSLEnabled(config)) {
try {
sslHandlerFactory = SSLUtils.createRestClientSSLEngineFactory(config);
} catch (Exception e) {
throw new ConfigurationException("Failed to initialize SSLContext for the REST client", e);
}
} else {
sslHandlerFactory = null;
}
final long connectionTimeout = config.getLong(RestOptions.CONNECTION_TIMEOUT);
final long idlenessTimeout = config.getLong(RestOptions.IDLENESS_TIMEOUT);
int maxContentLength = config.getInteger(RestOptions.CLIENT_MAX_CONTENT_LENGTH);
return new RestClientConfiguration(sslHandlerFactory, connectionTimeout, idlenessTimeout, maxContentLength);
} | [
"public",
"static",
"RestClientConfiguration",
"fromConfiguration",
"(",
"Configuration",
"config",
")",
"throws",
"ConfigurationException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"config",
")",
";",
"final",
"SSLHandlerFactory",
"sslHandlerFactory",
";",
"if",
... | Creates and returns a new {@link RestClientConfiguration} from the given {@link Configuration}.
@param config configuration from which the REST client endpoint configuration should be created from
@return REST client endpoint configuration
@throws ConfigurationException if SSL was configured incorrectly | [
"Creates",
"and",
"returns",
"a",
"new",
"{",
"@link",
"RestClientConfiguration",
"}",
"from",
"the",
"given",
"{",
"@link",
"Configuration",
"}",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestClientConfiguration.java#L100-L121 |
rzwitserloot/lombok | src/core/lombok/core/handlers/HandlerUtil.java | HandlerUtil.toGetterName | public static String toGetterName(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) {
return toAccessorName(ast, accessors, fieldName, isBoolean, "is", "get", true);
} | java | public static String toGetterName(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) {
return toAccessorName(ast, accessors, fieldName, isBoolean, "is", "get", true);
} | [
"public",
"static",
"String",
"toGetterName",
"(",
"AST",
"<",
"?",
",",
"?",
",",
"?",
">",
"ast",
",",
"AnnotationValues",
"<",
"Accessors",
">",
"accessors",
",",
"CharSequence",
"fieldName",
",",
"boolean",
"isBoolean",
")",
"{",
"return",
"toAccessorNam... | Generates a getter name from a given field name.
Strategy:
<ul>
<li>Reduce the field's name to its base name by stripping off any prefix (from {@code Accessors}). If the field name does not fit
the prefix list, this method immediately returns {@code null}.</li>
<li>If {@code Accessors} has {@code fluent=true}, then return the basename.</li>
<li>Pick a prefix. 'get' normally, but 'is' if {@code isBoolean} is true.</li>
<li>Only if {@code isBoolean} is true: Check if the field starts with {@code is} followed by a non-lowercase character. If so, return the field name verbatim.</li>
<li>Check if the first character of the field is lowercase. If so, check if the second character
exists and is title or upper case. If so, uppercase the first character. If not, titlecase the first character.</li>
<li>Return the prefix plus the possibly title/uppercased first character, and the rest of the field name.</li>
</ul>
@param accessors Accessors configuration.
@param fieldName the name of the field.
@param isBoolean if the field is of type 'boolean'. For fields of type {@code java.lang.Boolean}, you should provide {@code false}.
@return The getter name for this field, or {@code null} if this field does not fit expected patterns and therefore cannot be turned into a getter name. | [
"Generates",
"a",
"getter",
"name",
"from",
"a",
"given",
"field",
"name",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/handlers/HandlerUtil.java#L472-L474 |
UrielCh/ovh-java-sdk | ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java | ApiOvhPrice.dedicated_server_backupStorage_capacity_GET | public OvhPrice dedicated_server_backupStorage_capacity_GET(net.minidev.ovh.api.price.dedicated.server.OvhBackupStorageEnum capacity) throws IOException {
String qPath = "/price/dedicated/server/backupStorage/{capacity}";
StringBuilder sb = path(qPath, capacity);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | java | public OvhPrice dedicated_server_backupStorage_capacity_GET(net.minidev.ovh.api.price.dedicated.server.OvhBackupStorageEnum capacity) throws IOException {
String qPath = "/price/dedicated/server/backupStorage/{capacity}";
StringBuilder sb = path(qPath, capacity);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | [
"public",
"OvhPrice",
"dedicated_server_backupStorage_capacity_GET",
"(",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"price",
".",
"dedicated",
".",
"server",
".",
"OvhBackupStorageEnum",
"capacity",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"... | Get price of backup storage offer
REST: GET /price/dedicated/server/backupStorage/{capacity}
@param capacity [required] Capacity in gigabytes of backup storage offer | [
"Get",
"price",
"of",
"backup",
"storage",
"offer"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java#L141-L146 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/process/LinearInterpolatedTimeDiscreteProcess.java | LinearInterpolatedTimeDiscreteProcess.getProcessValue | public RandomVariable getProcessValue(double time, int component) {
double timeLower = timeDiscretization.getTimeIndexNearestLessOrEqual(time);
double timeUpper = timeDiscretization.getTimeIndexNearestGreaterOrEqual(time);
if(timeLower == timeUpper) {
return realizations.get(timeLower);
}
RandomVariable valueLower = realizations.get(timeLower);
RandomVariable valueUpper = realizations.get(timeUpper);
return valueUpper.mult((time-timeLower)/(timeUpper-timeLower)).add(valueLower.mult((timeUpper-time)/(timeUpper-timeLower)));
} | java | public RandomVariable getProcessValue(double time, int component) {
double timeLower = timeDiscretization.getTimeIndexNearestLessOrEqual(time);
double timeUpper = timeDiscretization.getTimeIndexNearestGreaterOrEqual(time);
if(timeLower == timeUpper) {
return realizations.get(timeLower);
}
RandomVariable valueLower = realizations.get(timeLower);
RandomVariable valueUpper = realizations.get(timeUpper);
return valueUpper.mult((time-timeLower)/(timeUpper-timeLower)).add(valueLower.mult((timeUpper-time)/(timeUpper-timeLower)));
} | [
"public",
"RandomVariable",
"getProcessValue",
"(",
"double",
"time",
",",
"int",
"component",
")",
"{",
"double",
"timeLower",
"=",
"timeDiscretization",
".",
"getTimeIndexNearestLessOrEqual",
"(",
"time",
")",
";",
"double",
"timeUpper",
"=",
"timeDiscretization",
... | Returns the (possibly interpolated) value of this stochastic process at a given time \( t \).
@param time The time \( t \).
@param component The component to be returned (if this is a vector valued process), otherwise 0.
@return The random variable \( X(t) \). | [
"Returns",
"the",
"(",
"possibly",
"interpolated",
")",
"value",
"of",
"this",
"stochastic",
"process",
"at",
"a",
"given",
"time",
"\\",
"(",
"t",
"\\",
")",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/process/LinearInterpolatedTimeDiscreteProcess.java#L110-L121 |
geomajas/geomajas-project-client-gwt2 | common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/Dom.java | Dom.disAssembleId | public static String disAssembleId(String id, String... suffixes) {
return IMPL.disAssembleId(id, suffixes);
} | java | public static String disAssembleId(String id, String... suffixes) {
return IMPL.disAssembleId(id, suffixes);
} | [
"public",
"static",
"String",
"disAssembleId",
"(",
"String",
"id",
",",
"String",
"...",
"suffixes",
")",
"{",
"return",
"IMPL",
".",
"disAssembleId",
"(",
"id",
",",
"suffixes",
")",
";",
"}"
] | Disassemble an DOM id, removing suffixes.
@param id base id
@param suffixes suffixes to remove
@return id | [
"Disassemble",
"an",
"DOM",
"id",
"removing",
"suffixes",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/Dom.java#L90-L92 |
demidenko05/beigesoft-webcrud-jar | src/main/java/org/beigesoft/web/model/HttpRequestData.java | HttpRequestData.setCookieValue | @Override
public final void setCookieValue(final String pName, final String pValue) {
Cookie cookie = null;
if (this.httpReq.getCookies() != null) {
for (Cookie co : this.httpReq.getCookies()) {
if (co.getName().equals(pName)) {
cookie = co;
cookie.setValue(pValue);
break;
}
}
}
if (cookie == null) {
cookie = new Cookie(pName, pValue);
cookie.setMaxAge(Integer.MAX_VALUE);
}
//application path is either root "/" of server address
//or WEB application name e.g. /bsa-433
String path = this.httpReq.getServletContext().getContextPath();
if ("".equals(path)) {
path = "/";
}
cookie.setPath(path);
this.httpResp.addCookie(cookie);
} | java | @Override
public final void setCookieValue(final String pName, final String pValue) {
Cookie cookie = null;
if (this.httpReq.getCookies() != null) {
for (Cookie co : this.httpReq.getCookies()) {
if (co.getName().equals(pName)) {
cookie = co;
cookie.setValue(pValue);
break;
}
}
}
if (cookie == null) {
cookie = new Cookie(pName, pValue);
cookie.setMaxAge(Integer.MAX_VALUE);
}
//application path is either root "/" of server address
//or WEB application name e.g. /bsa-433
String path = this.httpReq.getServletContext().getContextPath();
if ("".equals(path)) {
path = "/";
}
cookie.setPath(path);
this.httpResp.addCookie(cookie);
} | [
"@",
"Override",
"public",
"final",
"void",
"setCookieValue",
"(",
"final",
"String",
"pName",
",",
"final",
"String",
"pValue",
")",
"{",
"Cookie",
"cookie",
"=",
"null",
";",
"if",
"(",
"this",
".",
"httpReq",
".",
"getCookies",
"(",
")",
"!=",
"null",... | <p>Set(add/change) cookie value.</p>
@param pName Name
@param pValue Value | [
"<p",
">",
"Set",
"(",
"add",
"/",
"change",
")",
"cookie",
"value",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/demidenko05/beigesoft-webcrud-jar/blob/e973170f8fc1f164f0b67af9bb6a52b04579b64a/src/main/java/org/beigesoft/web/model/HttpRequestData.java#L139-L163 |
enioka/jqm | jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobInstance.java | JobInstance.addParameter | public RuntimeParameter addParameter(String key, String value)
{
RuntimeParameter jp = new RuntimeParameter();
jp.setJi(this.getId());
jp.setKey(key);
jp.setValue(value);
return jp;
} | java | public RuntimeParameter addParameter(String key, String value)
{
RuntimeParameter jp = new RuntimeParameter();
jp.setJi(this.getId());
jp.setKey(key);
jp.setValue(value);
return jp;
} | [
"public",
"RuntimeParameter",
"addParameter",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"RuntimeParameter",
"jp",
"=",
"new",
"RuntimeParameter",
"(",
")",
";",
"jp",
".",
"setJi",
"(",
"this",
".",
"getId",
"(",
")",
")",
";",
"jp",
".",
... | Helper method to add a parameter without having to create it explicitely. The created parameter should be persisted afterwards.
@param key
name of the parameter to add
@param value
value of the parameter to create
@return the newly created parameter | [
"Helper",
"method",
"to",
"add",
"a",
"parameter",
"without",
"having",
"to",
"create",
"it",
"explicitely",
".",
"The",
"created",
"parameter",
"should",
"be",
"persisted",
"afterwards",
"."
] | train | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobInstance.java#L89-L96 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/utils/DeploymentHelper.java | DeploymentHelper.runInNewTransaction | public static <T> T runInNewTransaction(@NotNull final PlatformTransactionManager txManager,
final String transactionName, final int isolationLevel, @NotNull final TransactionCallback<T> action) {
final DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setName(transactionName);
def.setReadOnly(false);
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
def.setIsolationLevel(isolationLevel);
return new TransactionTemplate(txManager, def).execute(action);
} | java | public static <T> T runInNewTransaction(@NotNull final PlatformTransactionManager txManager,
final String transactionName, final int isolationLevel, @NotNull final TransactionCallback<T> action) {
final DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setName(transactionName);
def.setReadOnly(false);
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
def.setIsolationLevel(isolationLevel);
return new TransactionTemplate(txManager, def).execute(action);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"runInNewTransaction",
"(",
"@",
"NotNull",
"final",
"PlatformTransactionManager",
"txManager",
",",
"final",
"String",
"transactionName",
",",
"final",
"int",
"isolationLevel",
",",
"@",
"NotNull",
"final",
"TransactionCallba... | Executes the modifying action in new transaction
@param txManager
transaction manager interface
@param transactionName
the name of the new transaction
@param isolationLevel
isolation level of the new transaction
@param action
the callback to execute in new tranaction
@return the result of the action | [
"Executes",
"the",
"modifying",
"action",
"in",
"new",
"transaction"
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/utils/DeploymentHelper.java#L104-L112 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/DdosProtectionPlansInner.java | DdosProtectionPlansInner.beginCreateOrUpdateAsync | public Observable<DdosProtectionPlanInner> beginCreateOrUpdateAsync(String resourceGroupName, String ddosProtectionPlanName, DdosProtectionPlanInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName, parameters).map(new Func1<ServiceResponse<DdosProtectionPlanInner>, DdosProtectionPlanInner>() {
@Override
public DdosProtectionPlanInner call(ServiceResponse<DdosProtectionPlanInner> response) {
return response.body();
}
});
} | java | public Observable<DdosProtectionPlanInner> beginCreateOrUpdateAsync(String resourceGroupName, String ddosProtectionPlanName, DdosProtectionPlanInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName, parameters).map(new Func1<ServiceResponse<DdosProtectionPlanInner>, DdosProtectionPlanInner>() {
@Override
public DdosProtectionPlanInner call(ServiceResponse<DdosProtectionPlanInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DdosProtectionPlanInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"ddosProtectionPlanName",
",",
"DdosProtectionPlanInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
... | Creates or updates a DDoS protection plan.
@param resourceGroupName The name of the resource group.
@param ddosProtectionPlanName The name of the DDoS protection plan.
@param parameters Parameters supplied to the create or update operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DdosProtectionPlanInner object | [
"Creates",
"or",
"updates",
"a",
"DDoS",
"protection",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/DdosProtectionPlansInner.java#L453-L460 |
osglworks/java-tool | src/main/java/org/osgl/Lang.java | F2.andThen | public <T> F2<P1, P2, T> andThen(final Function<? super R, ? extends T> f) {
E.NPE(f);
final Func2<P1, P2, R> me = this;
return new F2<P1, P2, T>() {
@Override
public T apply(P1 p1, P2 p2) {
R r = me.apply(p1, p2);
return f.apply(r);
}
};
} | java | public <T> F2<P1, P2, T> andThen(final Function<? super R, ? extends T> f) {
E.NPE(f);
final Func2<P1, P2, R> me = this;
return new F2<P1, P2, T>() {
@Override
public T apply(P1 p1, P2 p2) {
R r = me.apply(p1, p2);
return f.apply(r);
}
};
} | [
"public",
"<",
"T",
">",
"F2",
"<",
"P1",
",",
"P2",
",",
"T",
">",
"andThen",
"(",
"final",
"Function",
"<",
"?",
"super",
"R",
",",
"?",
"extends",
"T",
">",
"f",
")",
"{",
"E",
".",
"NPE",
"(",
"f",
")",
";",
"final",
"Func2",
"<",
"P1",... | Returns a composed function from this function and the specified function that takes the
result of this function. When applying the composed function, this function is applied
first to given parameter and then the specified function is applied to the result of
this function.
@param f
the function takes the <code>R</code> type parameter and return <code>T</code>
type result
@param <T>
the return type of function {@code f}
@return the composed function
@throws NullPointerException
if <code>f</code> is null | [
"Returns",
"a",
"composed",
"function",
"from",
"this",
"function",
"and",
"the",
"specified",
"function",
"that",
"takes",
"the",
"result",
"of",
"this",
"function",
".",
"When",
"applying",
"the",
"composed",
"function",
"this",
"function",
"is",
"applied",
... | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L988-L998 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/spout/DrpcTridentEmitter.java | DrpcTridentEmitter.initialize | @SuppressWarnings("rawtypes")
public void initialize(Map conf, TopologyContext context, String function)
{
this.context = context;
this.stormConf = conf;
this.function = function;
this.idsMap = new RotatingMap<TransactionAttempt, DrpcRequestInfo>(ROTATE_SIZE);
this.rotateTime = TimeUnit.SECONDS.toMillis(((Number) conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS)).intValue());
this.lastRotate = getCurrentTime();
} | java | @SuppressWarnings("rawtypes")
public void initialize(Map conf, TopologyContext context, String function)
{
this.context = context;
this.stormConf = conf;
this.function = function;
this.idsMap = new RotatingMap<TransactionAttempt, DrpcRequestInfo>(ROTATE_SIZE);
this.rotateTime = TimeUnit.SECONDS.toMillis(((Number) conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS)).intValue());
this.lastRotate = getCurrentTime();
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"void",
"initialize",
"(",
"Map",
"conf",
",",
"TopologyContext",
"context",
",",
"String",
"function",
")",
"{",
"this",
".",
"context",
"=",
"context",
";",
"this",
".",
"stormConf",
"=",
"conf",... | 設定値、Context、DRPC機能名称を指定して初期化を行う。
@param conf 設定値
@param context Context
@param function DRPC機能名称 | [
"設定値、Context、DRPC機能名称を指定して初期化を行う。"
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/spout/DrpcTridentEmitter.java#L82-L91 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transaction/src/com/ibm/ws/transaction/services/TransactionJavaColonHelper.java | TransactionJavaColonHelper.getUserTransaction | protected UserTransaction getUserTransaction(boolean injection, Object injectionContext) throws NamingException
{
final UserTransaction ut = AccessController.doPrivileged(new PrivilegedAction<UserTransaction>() {
@Override
public UserTransaction run() {
return userTranSvcRef.getBundle().getBundleContext().getService(userTranSvcRef);
}
});
final UserTransactionDecorator utd = getUserTransactionDecorator();
if (utd == null) {
return ut;
} else {
return utd.decorateUserTransaction(ut, injection, injectionContext);
}
} | java | protected UserTransaction getUserTransaction(boolean injection, Object injectionContext) throws NamingException
{
final UserTransaction ut = AccessController.doPrivileged(new PrivilegedAction<UserTransaction>() {
@Override
public UserTransaction run() {
return userTranSvcRef.getBundle().getBundleContext().getService(userTranSvcRef);
}
});
final UserTransactionDecorator utd = getUserTransactionDecorator();
if (utd == null) {
return ut;
} else {
return utd.decorateUserTransaction(ut, injection, injectionContext);
}
} | [
"protected",
"UserTransaction",
"getUserTransaction",
"(",
"boolean",
"injection",
",",
"Object",
"injectionContext",
")",
"throws",
"NamingException",
"{",
"final",
"UserTransaction",
"ut",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"... | Helper method for use with injection TransactionObjectFactoruy.
@param injection if the UserTransaction is being obtained for injection
@param injectionContext the injection target context if injection is true, or null if unspecified
@return UserTransaction object with decorator applied if present
@throws NamingException if the decorator determines the UserTransaction is not available | [
"Helper",
"method",
"for",
"use",
"with",
"injection",
"TransactionObjectFactoruy",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transaction/src/com/ibm/ws/transaction/services/TransactionJavaColonHelper.java#L152-L166 |
hortonworks/dstream | dstream-tez/src/main/java/io/dstream/tez/TaskDescriptorChainBuilder.java | TaskDescriptorChainBuilder.createTaskDescriptorForStreamCombineOperations | private TaskDescriptor createTaskDescriptorForStreamCombineOperations(DStreamOperation streamOperation){
TaskDescriptor taskDescriptor = this.createTaskDescriptor(streamOperation.getLastOperationName());
for (DStreamExecutionGraph dependentOps : streamOperation.getCombinableExecutionGraphs()) {
TaskDescriptorChainBuilder builder = new TaskDescriptorChainBuilder(executionName, dependentOps, executionConfig);
List<TaskDescriptor> dependentDescriptors = builder.build();
taskDescriptor.addDependentTasksChain(dependentDescriptors);
}
return taskDescriptor;
} | java | private TaskDescriptor createTaskDescriptorForStreamCombineOperations(DStreamOperation streamOperation){
TaskDescriptor taskDescriptor = this.createTaskDescriptor(streamOperation.getLastOperationName());
for (DStreamExecutionGraph dependentOps : streamOperation.getCombinableExecutionGraphs()) {
TaskDescriptorChainBuilder builder = new TaskDescriptorChainBuilder(executionName, dependentOps, executionConfig);
List<TaskDescriptor> dependentDescriptors = builder.build();
taskDescriptor.addDependentTasksChain(dependentDescriptors);
}
return taskDescriptor;
} | [
"private",
"TaskDescriptor",
"createTaskDescriptorForStreamCombineOperations",
"(",
"DStreamOperation",
"streamOperation",
")",
"{",
"TaskDescriptor",
"taskDescriptor",
"=",
"this",
".",
"createTaskDescriptor",
"(",
"streamOperation",
".",
"getLastOperationName",
"(",
")",
")... | Creates {@link TaskDescriptor} for stream combine operations (i.e., join, union, unionAll) | [
"Creates",
"{"
] | train | https://github.com/hortonworks/dstream/blob/3a106c0f14725b028fe7fe2dbc660406d9a5f142/dstream-tez/src/main/java/io/dstream/tez/TaskDescriptorChainBuilder.java#L87-L96 |
podio/podio-java | src/main/java/com/podio/conversation/ConversationAPI.java | ConversationAPI.addReply | public int addReply(int conversationId, String text) {
return getResourceFactory()
.getApiResource("/conversation/" + conversationId + "/reply")
.entity(new MessageCreate(text),
MediaType.APPLICATION_JSON_TYPE)
.get(MessageCreateResponse.class).getMessageId();
} | java | public int addReply(int conversationId, String text) {
return getResourceFactory()
.getApiResource("/conversation/" + conversationId + "/reply")
.entity(new MessageCreate(text),
MediaType.APPLICATION_JSON_TYPE)
.get(MessageCreateResponse.class).getMessageId();
} | [
"public",
"int",
"addReply",
"(",
"int",
"conversationId",
",",
"String",
"text",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/conversation/\"",
"+",
"conversationId",
"+",
"\"/reply\"",
")",
".",
"entity",
"(",
"new",
"M... | Creates a reply to the conversation.
@param conversationId
The id of the conversation to reply to
@param text
The text of the reply
@return The id of the new message | [
"Creates",
"a",
"reply",
"to",
"the",
"conversation",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/conversation/ConversationAPI.java#L106-L112 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/MenuLoader.java | MenuLoader.requestSearchResultsFrom | public List<Message> requestSearchResultsFrom(final int player, final CdjStatus.TrackSourceSlot slot,
final int sortOrder, final String text,
final AtomicInteger count)
throws Exception {
ConnectionManager.ClientTask<List<Message>> task = new ConnectionManager.ClientTask<List<Message>>() {
@Override
public List<Message> useClient(Client client) throws Exception {
return getSearchItems(slot, sortOrder, text.toUpperCase(), count, client);
}
};
return ConnectionManager.getInstance().invokeWithClientSession(player, task, "performing search");
} | java | public List<Message> requestSearchResultsFrom(final int player, final CdjStatus.TrackSourceSlot slot,
final int sortOrder, final String text,
final AtomicInteger count)
throws Exception {
ConnectionManager.ClientTask<List<Message>> task = new ConnectionManager.ClientTask<List<Message>>() {
@Override
public List<Message> useClient(Client client) throws Exception {
return getSearchItems(slot, sortOrder, text.toUpperCase(), count, client);
}
};
return ConnectionManager.getInstance().invokeWithClientSession(player, task, "performing search");
} | [
"public",
"List",
"<",
"Message",
">",
"requestSearchResultsFrom",
"(",
"final",
"int",
"player",
",",
"final",
"CdjStatus",
".",
"TrackSourceSlot",
"slot",
",",
"final",
"int",
"sortOrder",
",",
"final",
"String",
"text",
",",
"final",
"AtomicInteger",
"count",... | Ask the specified player for database records whose names contain {@code text}. If {@code count} is not
{@code null}, no more than that many results will be returned, and the value will be set to the total number
of results that were available. Otherwise all results will be returned.
@param player the player number whose database is to be searched
@param slot the slot in which the database can be found
@param sortOrder the order in which responses should be sorted, 0 for default, see Section 6.11.1 of the
<a href="https://github.com/Deep-Symmetry/dysentery/blob/master/doc/Analysis.pdf">Packet Analysis
document</a> for details, although it does not seem to have an effect on searches.
@param text the search text used to filter the results
@param count if present, sets an upper limit on the number of results to return, and will get set
to the actual number that were available
@return the items that the specified search string; they may be a variety of different types
@throws Exception if there is a problem performing the search | [
"Ask",
"the",
"specified",
"player",
"for",
"database",
"records",
"whose",
"names",
"contain",
"{",
"@code",
"text",
"}",
".",
"If",
"{",
"@code",
"count",
"}",
"is",
"not",
"{",
"@code",
"null",
"}",
"no",
"more",
"than",
"that",
"many",
"results",
"... | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MenuLoader.java#L1672-L1684 |
aol/cyclops | cyclops/src/main/java/com/oath/cyclops/internal/stream/FutureStreamUtils.java | FutureStreamUtils.forEachXWithError | public static <T, X extends Throwable> Tuple3<CompletableFuture<Subscription>, Runnable, CompletableFuture<Boolean>> forEachXWithError(
final Stream<T> stream, final long x, final Consumer<? super T> consumerElement, final Consumer<? super Throwable> consumerError) {
return forEachXEvents(stream, x, consumerElement, consumerError, () -> {
});
} | java | public static <T, X extends Throwable> Tuple3<CompletableFuture<Subscription>, Runnable, CompletableFuture<Boolean>> forEachXWithError(
final Stream<T> stream, final long x, final Consumer<? super T> consumerElement, final Consumer<? super Throwable> consumerError) {
return forEachXEvents(stream, x, consumerElement, consumerError, () -> {
});
} | [
"public",
"static",
"<",
"T",
",",
"X",
"extends",
"Throwable",
">",
"Tuple3",
"<",
"CompletableFuture",
"<",
"Subscription",
">",
",",
"Runnable",
",",
"CompletableFuture",
"<",
"Boolean",
">",
">",
"forEachXWithError",
"(",
"final",
"Stream",
"<",
"T",
">"... | Perform a forEach operation over the Stream without closing it, capturing any elements and errors in the supplied consumers, but only consuming
the specified number of elements from the Stream, at this time. More elements can be consumed later, by called request on the returned Subscription
<pre>
{@code
Subscription next = Streams.forEach(Stream.of(()->1,()->2,()->throw new RuntimeException(),()->4)
.map(Supplier::getValue),System.out::println, e->e.printStackTrace());
System.out.println("First batch processed!");
next.request(2);
System.out.println("Second batch processed!");
//prints
1
2
First batch processed!
RuntimeException Stack Trace on System.err
4
Second batch processed!
}
</pre>
@param stream - the Stream to consume data from
@param x To consume from the Stream at this time
@param consumerElement To accept incoming elements from the Stream
@param consumerError To accept incoming processing errors from the Stream
@return Subscription so that further processing can be continued or cancelled. | [
"Perform",
"a",
"forEach",
"operation",
"over",
"the",
"Stream",
"without",
"closing",
"it",
"capturing",
"any",
"elements",
"and",
"errors",
"in",
"the",
"supplied",
"consumers",
"but",
"only",
"consuming",
"the",
"specified",
"number",
"of",
"elements",
"from"... | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/internal/stream/FutureStreamUtils.java#L85-L89 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmUtils.java | XsdAsmUtils.getClassSignature | static String getClassSignature(String[] interfaces, String className, String apiName) {
StringBuilder signature;
signature = new StringBuilder("<Z::" + XsdSupportingStructure.elementTypeDesc + ">" + JAVA_OBJECT_DESC);
if (interfaces != null){
for (String anInterface : interfaces) {
signature.append("L")
.append(getFullClassTypeName(anInterface, apiName))
.append("<L")
.append(getFullClassTypeName(className, apiName))
.append("<TZ;>;TZ;>;");
}
}
return signature.toString();
} | java | static String getClassSignature(String[] interfaces, String className, String apiName) {
StringBuilder signature;
signature = new StringBuilder("<Z::" + XsdSupportingStructure.elementTypeDesc + ">" + JAVA_OBJECT_DESC);
if (interfaces != null){
for (String anInterface : interfaces) {
signature.append("L")
.append(getFullClassTypeName(anInterface, apiName))
.append("<L")
.append(getFullClassTypeName(className, apiName))
.append("<TZ;>;TZ;>;");
}
}
return signature.toString();
} | [
"static",
"String",
"getClassSignature",
"(",
"String",
"[",
"]",
"interfaces",
",",
"String",
"className",
",",
"String",
"apiName",
")",
"{",
"StringBuilder",
"signature",
";",
"signature",
"=",
"new",
"StringBuilder",
"(",
"\"<Z::\"",
"+",
"XsdSupportingStructu... | Obtains the signature for a class given the interface names.
@param interfaces The implemented interfaces.
@param className The class name.
@param apiName The name of the generated fluent interface.
@return The signature of the class. | [
"Obtains",
"the",
"signature",
"for",
"a",
"class",
"given",
"the",
"interface",
"names",
"."
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmUtils.java#L468-L484 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/Assert.java | Assert.isInstanceOf | public static void isInstanceOf(Object obj, Class<?> type, Supplier<String> message) {
if (isNotInstanceOf(obj, type)) {
throw new IllegalTypeException(message.get());
}
} | java | public static void isInstanceOf(Object obj, Class<?> type, Supplier<String> message) {
if (isNotInstanceOf(obj, type)) {
throw new IllegalTypeException(message.get());
}
} | [
"public",
"static",
"void",
"isInstanceOf",
"(",
"Object",
"obj",
",",
"Class",
"<",
"?",
">",
"type",
",",
"Supplier",
"<",
"String",
">",
"message",
")",
"{",
"if",
"(",
"isNotInstanceOf",
"(",
"obj",
",",
"type",
")",
")",
"{",
"throw",
"new",
"Il... | Asserts that the given {@link Object} is an instance of the specified {@link Class type}.
The assertion holds if and only if the {@link Object} is not {@literal null} and is an instance of
the specified {@link Class type}. This assertion functions exactly the same as
the Java {@literal instanceof} operator.
@param obj {@link Object} evaluated as an instance of the {@link Class type}.
@param type {@link Class type} used to evaluate the {@link Object} in the {@literal instanceof} operator.
@param message {@link Supplier} containing the message used in the {@link IllegalArgumentException} thrown
if the assertion fails.
@throws org.cp.elements.lang.IllegalTypeException if the {@link Object} is not an instance of
the specified {@link Class type}.
@see java.lang.Class#isInstance(Object) | [
"Asserts",
"that",
"the",
"given",
"{",
"@link",
"Object",
"}",
"is",
"an",
"instance",
"of",
"the",
"specified",
"{",
"@link",
"Class",
"type",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L738-L742 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/TargetsApi.java | TargetsApi.savePersonalFavorite | public void savePersonalFavorite(Target target, String category) throws WorkspaceApiException {
TargetspersonalfavoritessaveData data = new TargetspersonalfavoritessaveData();
data.setCategory(category);
data.setTarget(toInformation(target));
PersonalFavoriteData favData = new PersonalFavoriteData();
favData.setData(data);
try {
ApiSuccessResponse resp = targetsApi.savePersonalFavorite(favData);
Util.throwIfNotOk(resp);
}
catch(ApiException ex) {
throw new WorkspaceApiException("Cannot save personal favorites", ex);
}
} | java | public void savePersonalFavorite(Target target, String category) throws WorkspaceApiException {
TargetspersonalfavoritessaveData data = new TargetspersonalfavoritessaveData();
data.setCategory(category);
data.setTarget(toInformation(target));
PersonalFavoriteData favData = new PersonalFavoriteData();
favData.setData(data);
try {
ApiSuccessResponse resp = targetsApi.savePersonalFavorite(favData);
Util.throwIfNotOk(resp);
}
catch(ApiException ex) {
throw new WorkspaceApiException("Cannot save personal favorites", ex);
}
} | [
"public",
"void",
"savePersonalFavorite",
"(",
"Target",
"target",
",",
"String",
"category",
")",
"throws",
"WorkspaceApiException",
"{",
"TargetspersonalfavoritessaveData",
"data",
"=",
"new",
"TargetspersonalfavoritessaveData",
"(",
")",
";",
"data",
".",
"setCategor... | Save a target to the agent's personal favorites in the specified category.
@param target The target to save.
@param category The agent's personal favorites category. | [
"Save",
"a",
"target",
"to",
"the",
"agent",
"s",
"personal",
"favorites",
"in",
"the",
"specified",
"category",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/TargetsApi.java#L266-L280 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/clientlibs/service/DenyPostServiceImpl.java | DenyPostServiceImpl.process | @Override
public void process(SlingHttpServletRequest request, List<Modification> changes) throws ResourceNotFoundException {
if (!deniedPathList.isEmpty()) {
Resource resource = request.getResource();
String path = resource != null ? resource.getPath() : null;
if (path != null) {
for (Pattern pat : deniedPathList) {
if (pat.matcher(path).matches()) {
LOG.warn("POST to {} reached default SlingPostServlet, but is forbidden via pattern {}", path, pat.pattern());
throw new IllegalArgumentException("POSTing to resource via default SlingPostServlet forbidden at this JCR path");
}
}
}
}
} | java | @Override
public void process(SlingHttpServletRequest request, List<Modification> changes) throws ResourceNotFoundException {
if (!deniedPathList.isEmpty()) {
Resource resource = request.getResource();
String path = resource != null ? resource.getPath() : null;
if (path != null) {
for (Pattern pat : deniedPathList) {
if (pat.matcher(path).matches()) {
LOG.warn("POST to {} reached default SlingPostServlet, but is forbidden via pattern {}", path, pat.pattern());
throw new IllegalArgumentException("POSTing to resource via default SlingPostServlet forbidden at this JCR path");
}
}
}
}
} | [
"@",
"Override",
"public",
"void",
"process",
"(",
"SlingHttpServletRequest",
"request",
",",
"List",
"<",
"Modification",
">",
"changes",
")",
"throws",
"ResourceNotFoundException",
"{",
"if",
"(",
"!",
"deniedPathList",
".",
"isEmpty",
"(",
")",
")",
"{",
"R... | We check whether the resource path matches a configurable set of paths (configured via regex). If it matches, this request is forbidden, and
we throw an exception. | [
"We",
"check",
"whether",
"the",
"resource",
"path",
"matches",
"a",
"configurable",
"set",
"of",
"paths",
"(",
"configured",
"via",
"regex",
")",
".",
"If",
"it",
"matches",
"this",
"request",
"is",
"forbidden",
"and",
"we",
"throw",
"an",
"exception",
".... | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/clientlibs/service/DenyPostServiceImpl.java#L54-L68 |
trellis-ldp/trellis | core/http/src/main/java/org/trellisldp/http/core/Prefer.java | Prefer.ofInclude | public static Prefer ofInclude(final String... includes) {
final List<String> iris = asList(includes);
if (iris.isEmpty()) {
return valueOf(join("=", PREFER_RETURN, PREFER_REPRESENTATION));
}
return valueOf(join("=", PREFER_RETURN, PREFER_REPRESENTATION) + "; " + PREFER_INCLUDE + "=\"" +
iris.stream().collect(joining(" ")) + "\"");
} | java | public static Prefer ofInclude(final String... includes) {
final List<String> iris = asList(includes);
if (iris.isEmpty()) {
return valueOf(join("=", PREFER_RETURN, PREFER_REPRESENTATION));
}
return valueOf(join("=", PREFER_RETURN, PREFER_REPRESENTATION) + "; " + PREFER_INCLUDE + "=\"" +
iris.stream().collect(joining(" ")) + "\"");
} | [
"public",
"static",
"Prefer",
"ofInclude",
"(",
"final",
"String",
"...",
"includes",
")",
"{",
"final",
"List",
"<",
"String",
">",
"iris",
"=",
"asList",
"(",
"includes",
")",
";",
"if",
"(",
"iris",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"v... | Build a Prefer object with a set of included IRIs.
@param includes the IRIs to include
@return the Prefer object | [
"Build",
"a",
"Prefer",
"object",
"with",
"a",
"set",
"of",
"included",
"IRIs",
"."
] | train | https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/core/http/src/main/java/org/trellisldp/http/core/Prefer.java#L161-L168 |
rapid7/conqueso-client-java | src/main/java/com/rapid7/conqueso/client/ConquesoClient.java | ConquesoClient.getRoleInstancesWithMetadata | public ImmutableList<InstanceInfo> getRoleInstancesWithMetadata(String roleName,
Map<String, String> metadataQuery) {
checkArgument(!checkNotNull(metadataQuery, "metadataQuery").isEmpty(), "No metadata query arguments specified");
return getRoleInstancesWithMetadataImpl(roleName, metadataQuery);
} | java | public ImmutableList<InstanceInfo> getRoleInstancesWithMetadata(String roleName,
Map<String, String> metadataQuery) {
checkArgument(!checkNotNull(metadataQuery, "metadataQuery").isEmpty(), "No metadata query arguments specified");
return getRoleInstancesWithMetadataImpl(roleName, metadataQuery);
} | [
"public",
"ImmutableList",
"<",
"InstanceInfo",
">",
"getRoleInstancesWithMetadata",
"(",
"String",
"roleName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"metadataQuery",
")",
"{",
"checkArgument",
"(",
"!",
"checkNotNull",
"(",
"metadataQuery",
",",
"\"metad... | Retrieve information about all online instances of a particular role matching the given metadata query from
the Conqueso Server.
The metadata query is expressed as key/value pairs in the provided map. For example, calling this method like
this:
<p>
<code>
conquesoClient.getRoleInstancesWithMetadata("reporting-service", ImmutableMap.of("availability-zone",
"us-east-1c", "instance-type", "m1.small"));
</code>
</p>
will return all instances of role reporting-service with metadata that matches availability-zone=us-east-1c and
instance-type=m1.small.
@param roleName the role to retrieve
@param metadataQuery the map key/value pairs representing a query for instances matching the metadata
@return the information about the matching instances
@throws ConquesoCommunicationException if there's an error communicating with the Conqueso Server. | [
"Retrieve",
"information",
"about",
"all",
"online",
"instances",
"of",
"a",
"particular",
"role",
"matching",
"the",
"given",
"metadata",
"query",
"from",
"the",
"Conqueso",
"Server",
".",
"The",
"metadata",
"query",
"is",
"expressed",
"as",
"key",
"/",
"valu... | train | https://github.com/rapid7/conqueso-client-java/blob/fa4a7a6dbf67e5afe6b4f68cbc97b1929af864e2/src/main/java/com/rapid7/conqueso/client/ConquesoClient.java#L560-L564 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.fillBeanWithMap | public static <T> T fillBeanWithMap(Map<?, ?> map, T bean, boolean isToCamelCase, boolean isIgnoreError) {
return fillBeanWithMap(map, bean, isToCamelCase, CopyOptions.create().setIgnoreError(isIgnoreError));
} | java | public static <T> T fillBeanWithMap(Map<?, ?> map, T bean, boolean isToCamelCase, boolean isIgnoreError) {
return fillBeanWithMap(map, bean, isToCamelCase, CopyOptions.create().setIgnoreError(isIgnoreError));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"fillBeanWithMap",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"T",
"bean",
",",
"boolean",
"isToCamelCase",
",",
"boolean",
"isIgnoreError",
")",
"{",
"return",
"fillBeanWithMap",
"(",
"map",
",",
"bean",
"... | 使用Map填充Bean对象,可配置将下划线转换为驼峰
@param <T> Bean类型
@param map Map
@param bean Bean
@param isToCamelCase 是否将下划线模式转换为驼峰模式
@param isIgnoreError 是否忽略注入错误
@return Bean | [
"使用Map填充Bean对象,可配置将下划线转换为驼峰"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L382-L384 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/lib/StringConverter.java | StringConverter.byteArrayToSQLBitString | public static String byteArrayToSQLBitString(byte[] bytes, int bitCount) {
char[] s = new char[bitCount + 3];
s[0] = 'B';
s[1] = '\'';
int pos = 2;
for (int j = 0; j < bitCount; j++) {
byte b = bytes[j / 8];
s[pos++] = BitMap.isSet(b, j % 8) ? '1'
: '0';
}
s[pos] = '\'';
return new String(s);
} | java | public static String byteArrayToSQLBitString(byte[] bytes, int bitCount) {
char[] s = new char[bitCount + 3];
s[0] = 'B';
s[1] = '\'';
int pos = 2;
for (int j = 0; j < bitCount; j++) {
byte b = bytes[j / 8];
s[pos++] = BitMap.isSet(b, j % 8) ? '1'
: '0';
}
s[pos] = '\'';
return new String(s);
} | [
"public",
"static",
"String",
"byteArrayToSQLBitString",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"bitCount",
")",
"{",
"char",
"[",
"]",
"s",
"=",
"new",
"char",
"[",
"bitCount",
"+",
"3",
"]",
";",
"s",
"[",
"0",
"]",
"=",
"'",
"'",
";",
"s"... | Converts a byte array into an SQL binary string
@param bytes byte array
@param bitCount number of bits
@return hex string | [
"Converts",
"a",
"byte",
"array",
"into",
"an",
"SQL",
"binary",
"string"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/StringConverter.java#L292-L311 |
pagehelper/Mybatis-PageHelper | src/main/java/com/github/pagehelper/page/PageMethod.java | PageMethod.startPage | public static <E> Page<E> startPage(int pageNum, int pageSize, boolean count) {
return startPage(pageNum, pageSize, count, null, null);
} | java | public static <E> Page<E> startPage(int pageNum, int pageSize, boolean count) {
return startPage(pageNum, pageSize, count, null, null);
} | [
"public",
"static",
"<",
"E",
">",
"Page",
"<",
"E",
">",
"startPage",
"(",
"int",
"pageNum",
",",
"int",
"pageSize",
",",
"boolean",
"count",
")",
"{",
"return",
"startPage",
"(",
"pageNum",
",",
"pageSize",
",",
"count",
",",
"null",
",",
"null",
"... | 开始分页
@param pageNum 页码
@param pageSize 每页显示数量
@param count 是否进行count查询 | [
"开始分页"
] | train | https://github.com/pagehelper/Mybatis-PageHelper/blob/319750fd47cf75328ff321f38125fa15e954e60f/src/main/java/com/github/pagehelper/page/PageMethod.java#L112-L114 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/Environment.java | Environment.doHttpPost | public void doHttpPost(String url, HttpResponse result, Map<String, Object> headers, String contentType) {
httpClient.post(url, result, headers, contentType);
} | java | public void doHttpPost(String url, HttpResponse result, Map<String, Object> headers, String contentType) {
httpClient.post(url, result, headers, contentType);
} | [
"public",
"void",
"doHttpPost",
"(",
"String",
"url",
",",
"HttpResponse",
"result",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"headers",
",",
"String",
"contentType",
")",
"{",
"httpClient",
".",
"post",
"(",
"url",
",",
"result",
",",
"headers",
"... | Performs POST to supplied url of result's request.
@param url url to post to.
@param result result containing request, its response will be filled.
@param headers headers to add.
@param contentType contentType for request. | [
"Performs",
"POST",
"to",
"supplied",
"url",
"of",
"result",
"s",
"request",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L285-L287 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxCollaboration.java | BoxCollaboration.updateInfo | public void updateInfo(Info info) {
BoxAPIConnection api = this.getAPI();
URL url = COLLABORATION_URL_TEMPLATE.build(api.getBaseURL(), this.getID());
BoxJSONRequest request = new BoxJSONRequest(api, url, "PUT");
request.setBody(info.getPendingChanges());
BoxAPIResponse boxAPIResponse = request.send();
if (boxAPIResponse instanceof BoxJSONResponse) {
BoxJSONResponse response = (BoxJSONResponse) boxAPIResponse;
JsonObject jsonObject = JsonObject.readFrom(response.getJSON());
info.update(jsonObject);
}
} | java | public void updateInfo(Info info) {
BoxAPIConnection api = this.getAPI();
URL url = COLLABORATION_URL_TEMPLATE.build(api.getBaseURL(), this.getID());
BoxJSONRequest request = new BoxJSONRequest(api, url, "PUT");
request.setBody(info.getPendingChanges());
BoxAPIResponse boxAPIResponse = request.send();
if (boxAPIResponse instanceof BoxJSONResponse) {
BoxJSONResponse response = (BoxJSONResponse) boxAPIResponse;
JsonObject jsonObject = JsonObject.readFrom(response.getJSON());
info.update(jsonObject);
}
} | [
"public",
"void",
"updateInfo",
"(",
"Info",
"info",
")",
"{",
"BoxAPIConnection",
"api",
"=",
"this",
".",
"getAPI",
"(",
")",
";",
"URL",
"url",
"=",
"COLLABORATION_URL_TEMPLATE",
".",
"build",
"(",
"api",
".",
"getBaseURL",
"(",
")",
",",
"this",
".",... | Updates the information about this collaboration with any info fields that have been modified locally.
@param info the updated info. | [
"Updates",
"the",
"information",
"about",
"this",
"collaboration",
"with",
"any",
"info",
"fields",
"that",
"have",
"been",
"modified",
"locally",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxCollaboration.java#L162-L175 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/liveweb/FileRegion.java | FileRegion.copyToOutputStream | public void copyToOutputStream(OutputStream o) throws IOException {
long left = end - start;
int BUFF_SIZE = 4096;
byte buf[] = new byte[BUFF_SIZE];
RandomAccessFile raf = new RandomAccessFile(file, "r");
try {
raf.seek(start);
while(left > 0) {
int amtToRead = (int) Math.min(left, BUFF_SIZE);
int amtRead = raf.read(buf, 0, amtToRead);
if(amtRead < 0) {
throw new IOException("Not enough to read! EOF before expected region end");
}
o.write(buf,0,amtRead);
left -= amtRead;
}
} finally {
raf.close();
}
} | java | public void copyToOutputStream(OutputStream o) throws IOException {
long left = end - start;
int BUFF_SIZE = 4096;
byte buf[] = new byte[BUFF_SIZE];
RandomAccessFile raf = new RandomAccessFile(file, "r");
try {
raf.seek(start);
while(left > 0) {
int amtToRead = (int) Math.min(left, BUFF_SIZE);
int amtRead = raf.read(buf, 0, amtToRead);
if(amtRead < 0) {
throw new IOException("Not enough to read! EOF before expected region end");
}
o.write(buf,0,amtRead);
left -= amtRead;
}
} finally {
raf.close();
}
} | [
"public",
"void",
"copyToOutputStream",
"(",
"OutputStream",
"o",
")",
"throws",
"IOException",
"{",
"long",
"left",
"=",
"end",
"-",
"start",
";",
"int",
"BUFF_SIZE",
"=",
"4096",
";",
"byte",
"buf",
"[",
"]",
"=",
"new",
"byte",
"[",
"BUFF_SIZE",
"]",
... | Copy this record to the provided OutputStream
@param o the OutputStream where the bytes should be sent.
@throws IOException for usual reasons | [
"Copy",
"this",
"record",
"to",
"the",
"provided",
"OutputStream"
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/liveweb/FileRegion.java#L49-L68 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/constraint/Equality.java | Equality.satisfies | @Override
public boolean satisfies(Match match, int... ind)
{
assert ind.length == 2;
return (match.get(ind[0]) == match.get(ind[1])) == equals;
} | java | @Override
public boolean satisfies(Match match, int... ind)
{
assert ind.length == 2;
return (match.get(ind[0]) == match.get(ind[1])) == equals;
} | [
"@",
"Override",
"public",
"boolean",
"satisfies",
"(",
"Match",
"match",
",",
"int",
"...",
"ind",
")",
"{",
"assert",
"ind",
".",
"length",
"==",
"2",
";",
"return",
"(",
"match",
".",
"get",
"(",
"ind",
"[",
"0",
"]",
")",
"==",
"match",
".",
... | Checks if the two elements are identical or not identical as desired.
@param match current pattern match
@param ind mapped indices
@return true if identity checks equals the desired value | [
"Checks",
"if",
"the",
"two",
"elements",
"are",
"identical",
"or",
"not",
"identical",
"as",
"desired",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/Equality.java#L35-L41 |
GoogleCloudPlatform/appengine-gcs-client | java/src/main/java/com/google/appengine/tools/cloudstorage/dev/LocalRawGcsService.java | LocalRawGcsService.continueObjectCreationAsync | @Override
public Future<RawGcsCreationToken> continueObjectCreationAsync(final RawGcsCreationToken token,
final ByteBuffer chunk, long timeoutMillis) {
try {
ensureInitialized();
} catch (IOException e) {
throw new RuntimeException(e);
}
final Environment environment = ApiProxy.getCurrentEnvironment();
return writePool.schedule(new Callable<RawGcsCreationToken>() {
@Override
public RawGcsCreationToken call() throws Exception {
ApiProxy.setEnvironmentForCurrentThread(environment);
return append(token, chunk);
}
}, 50, TimeUnit.MILLISECONDS);
} | java | @Override
public Future<RawGcsCreationToken> continueObjectCreationAsync(final RawGcsCreationToken token,
final ByteBuffer chunk, long timeoutMillis) {
try {
ensureInitialized();
} catch (IOException e) {
throw new RuntimeException(e);
}
final Environment environment = ApiProxy.getCurrentEnvironment();
return writePool.schedule(new Callable<RawGcsCreationToken>() {
@Override
public RawGcsCreationToken call() throws Exception {
ApiProxy.setEnvironmentForCurrentThread(environment);
return append(token, chunk);
}
}, 50, TimeUnit.MILLISECONDS);
} | [
"@",
"Override",
"public",
"Future",
"<",
"RawGcsCreationToken",
">",
"continueObjectCreationAsync",
"(",
"final",
"RawGcsCreationToken",
"token",
",",
"final",
"ByteBuffer",
"chunk",
",",
"long",
"timeoutMillis",
")",
"{",
"try",
"{",
"ensureInitialized",
"(",
")",... | Runs calls in a background thread so that the results will actually be asynchronous.
@see com.google.appengine.tools.cloudstorage.RawGcsService#continueObjectCreationAsync(
com.google.appengine.tools.cloudstorage.RawGcsService.RawGcsCreationToken,
java.nio.ByteBuffer, long) | [
"Runs",
"calls",
"in",
"a",
"background",
"thread",
"so",
"that",
"the",
"results",
"will",
"actually",
"be",
"asynchronous",
"."
] | train | https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/dev/LocalRawGcsService.java#L286-L302 |
Azure/azure-sdk-for-java | authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java | RoleAssignmentsInner.createAsync | public Observable<RoleAssignmentInner> createAsync(String scope, String roleAssignmentName, RoleAssignmentProperties properties) {
return createWithServiceResponseAsync(scope, roleAssignmentName, properties).map(new Func1<ServiceResponse<RoleAssignmentInner>, RoleAssignmentInner>() {
@Override
public RoleAssignmentInner call(ServiceResponse<RoleAssignmentInner> response) {
return response.body();
}
});
} | java | public Observable<RoleAssignmentInner> createAsync(String scope, String roleAssignmentName, RoleAssignmentProperties properties) {
return createWithServiceResponseAsync(scope, roleAssignmentName, properties).map(new Func1<ServiceResponse<RoleAssignmentInner>, RoleAssignmentInner>() {
@Override
public RoleAssignmentInner call(ServiceResponse<RoleAssignmentInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RoleAssignmentInner",
">",
"createAsync",
"(",
"String",
"scope",
",",
"String",
"roleAssignmentName",
",",
"RoleAssignmentProperties",
"properties",
")",
"{",
"return",
"createWithServiceResponseAsync",
"(",
"scope",
",",
"roleAssignmentName... | Creates a role assignment.
@param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource.
@param roleAssignmentName The name of the role assignment to create. It can be any valid GUID.
@param properties Role assignment properties.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RoleAssignmentInner object | [
"Creates",
"a",
"role",
"assignment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java#L769-L776 |
Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/DoubleMaxGauge.java | DoubleMaxGauge.updateMax | private void updateMax(int idx, double v) {
AtomicLong current = max.getCurrent(idx);
long m = current.get();
while (v > Double.longBitsToDouble(m)) {
if (current.compareAndSet(m, Double.doubleToLongBits(v))) {
break;
}
m = current.get();
}
} | java | private void updateMax(int idx, double v) {
AtomicLong current = max.getCurrent(idx);
long m = current.get();
while (v > Double.longBitsToDouble(m)) {
if (current.compareAndSet(m, Double.doubleToLongBits(v))) {
break;
}
m = current.get();
}
} | [
"private",
"void",
"updateMax",
"(",
"int",
"idx",
",",
"double",
"v",
")",
"{",
"AtomicLong",
"current",
"=",
"max",
".",
"getCurrent",
"(",
"idx",
")",
";",
"long",
"m",
"=",
"current",
".",
"get",
"(",
")",
";",
"while",
"(",
"v",
">",
"Double",... | Update the max for the given index if the provided value is larger than the current max. | [
"Update",
"the",
"max",
"for",
"the",
"given",
"index",
"if",
"the",
"provided",
"value",
"is",
"larger",
"than",
"the",
"current",
"max",
"."
] | train | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/DoubleMaxGauge.java#L58-L67 |
VoltDB/voltdb | src/frontend/org/voltdb/importer/formatter/FormatterBuilder.java | FormatterBuilder.createFormatterBuilder | public static FormatterBuilder createFormatterBuilder(Properties formatterProperties) throws Exception {
FormatterBuilder builder;
AbstractFormatterFactory factory;
if (formatterProperties.size() > 0) {
String formatterClass = formatterProperties.getProperty("formatter");
String format = formatterProperties.getProperty("format", "csv");
Class<?> classz = Class.forName(formatterClass);
Class<?>[] ctorParmTypes = new Class[]{ String.class, Properties.class };
Constructor<?> ctor = classz.getDeclaredConstructor(ctorParmTypes);
Object[] ctorParms = new Object[]{ format, formatterProperties };
factory = new AbstractFormatterFactory() {
@Override
public Formatter create(String formatName, Properties props) {
try {
return (Formatter) ctor.newInstance(ctorParms);
}
catch (Exception e) {
VoltDB.crashLocalVoltDB("Failed to create formatter " + formatName);
return null;
}
}
};
builder = new FormatterBuilder(format, formatterProperties);
} else {
factory = new VoltCSVFormatterFactory();
Properties props = new Properties();
factory.create("csv", props);
builder = new FormatterBuilder("csv", props);
}
builder.setFormatterFactory(factory);
return builder;
} | java | public static FormatterBuilder createFormatterBuilder(Properties formatterProperties) throws Exception {
FormatterBuilder builder;
AbstractFormatterFactory factory;
if (formatterProperties.size() > 0) {
String formatterClass = formatterProperties.getProperty("formatter");
String format = formatterProperties.getProperty("format", "csv");
Class<?> classz = Class.forName(formatterClass);
Class<?>[] ctorParmTypes = new Class[]{ String.class, Properties.class };
Constructor<?> ctor = classz.getDeclaredConstructor(ctorParmTypes);
Object[] ctorParms = new Object[]{ format, formatterProperties };
factory = new AbstractFormatterFactory() {
@Override
public Formatter create(String formatName, Properties props) {
try {
return (Formatter) ctor.newInstance(ctorParms);
}
catch (Exception e) {
VoltDB.crashLocalVoltDB("Failed to create formatter " + formatName);
return null;
}
}
};
builder = new FormatterBuilder(format, formatterProperties);
} else {
factory = new VoltCSVFormatterFactory();
Properties props = new Properties();
factory.create("csv", props);
builder = new FormatterBuilder("csv", props);
}
builder.setFormatterFactory(factory);
return builder;
} | [
"public",
"static",
"FormatterBuilder",
"createFormatterBuilder",
"(",
"Properties",
"formatterProperties",
")",
"throws",
"Exception",
"{",
"FormatterBuilder",
"builder",
";",
"AbstractFormatterFactory",
"factory",
";",
"if",
"(",
"formatterProperties",
".",
"size",
"(",... | /*
Create a FormatterBuilder from the supplied arguments. If no formatter is specified by configuration, return a default CSV formatter builder. | [
"/",
"*",
"Create",
"a",
"FormatterBuilder",
"from",
"the",
"supplied",
"arguments",
".",
"If",
"no",
"formatter",
"is",
"specified",
"by",
"configuration",
"return",
"a",
"default",
"CSV",
"formatter",
"builder",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/importer/formatter/FormatterBuilder.java#L90-L126 |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.copyTo | public final void copyTo(int offset, MemorySegment target, int targetOffset, int numBytes) {
final byte[] thisHeapRef = this.heapMemory;
final byte[] otherHeapRef = target.heapMemory;
final long thisPointer = this.address + offset;
final long otherPointer = target.address + targetOffset;
if ((numBytes | offset | targetOffset) >= 0 &&
thisPointer <= this.addressLimit - numBytes && otherPointer <= target.addressLimit - numBytes) {
UNSAFE.copyMemory(thisHeapRef, thisPointer, otherHeapRef, otherPointer, numBytes);
}
else if (this.address > this.addressLimit) {
throw new IllegalStateException("this memory segment has been freed.");
}
else if (target.address > target.addressLimit) {
throw new IllegalStateException("target memory segment has been freed.");
}
else {
throw new IndexOutOfBoundsException(
String.format("offset=%d, targetOffset=%d, numBytes=%d, address=%d, targetAddress=%d",
offset, targetOffset, numBytes, this.address, target.address));
}
} | java | public final void copyTo(int offset, MemorySegment target, int targetOffset, int numBytes) {
final byte[] thisHeapRef = this.heapMemory;
final byte[] otherHeapRef = target.heapMemory;
final long thisPointer = this.address + offset;
final long otherPointer = target.address + targetOffset;
if ((numBytes | offset | targetOffset) >= 0 &&
thisPointer <= this.addressLimit - numBytes && otherPointer <= target.addressLimit - numBytes) {
UNSAFE.copyMemory(thisHeapRef, thisPointer, otherHeapRef, otherPointer, numBytes);
}
else if (this.address > this.addressLimit) {
throw new IllegalStateException("this memory segment has been freed.");
}
else if (target.address > target.addressLimit) {
throw new IllegalStateException("target memory segment has been freed.");
}
else {
throw new IndexOutOfBoundsException(
String.format("offset=%d, targetOffset=%d, numBytes=%d, address=%d, targetAddress=%d",
offset, targetOffset, numBytes, this.address, target.address));
}
} | [
"public",
"final",
"void",
"copyTo",
"(",
"int",
"offset",
",",
"MemorySegment",
"target",
",",
"int",
"targetOffset",
",",
"int",
"numBytes",
")",
"{",
"final",
"byte",
"[",
"]",
"thisHeapRef",
"=",
"this",
".",
"heapMemory",
";",
"final",
"byte",
"[",
... | Bulk copy method. Copies {@code numBytes} bytes from this memory segment, starting at position
{@code offset} to the target memory segment. The bytes will be put into the target segment
starting at position {@code targetOffset}.
@param offset The position where the bytes are started to be read from in this memory segment.
@param target The memory segment to copy the bytes to.
@param targetOffset The position in the target memory segment to copy the chunk to.
@param numBytes The number of bytes to copy.
@throws IndexOutOfBoundsException If either of the offsets is invalid, or the source segment does not
contain the given number of bytes (starting from offset), or the target segment does
not have enough space for the bytes (counting from targetOffset). | [
"Bulk",
"copy",
"method",
".",
"Copies",
"{",
"@code",
"numBytes",
"}",
"bytes",
"from",
"this",
"memory",
"segment",
"starting",
"at",
"position",
"{",
"@code",
"offset",
"}",
"to",
"the",
"target",
"memory",
"segment",
".",
"The",
"bytes",
"will",
"be",
... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L1250-L1271 |
NessComputing/service-discovery | jms/src/main/java/com/nesscomputing/jms/activemq/ServiceDiscoveryTransportFactory.java | ServiceDiscoveryTransportFactory.interceptPropertySetters | private Transport interceptPropertySetters(Transport transport) {
final Enhancer e = new Enhancer();
e.setInterfaces(new Class<?>[] {Transport.class, ServiceTransportBeanSetters.class});
final TransportDelegationFilter filter = new TransportDelegationFilter(transport, ServiceTransportBeanSetters.class);
e.setCallbackFilter(filter);
e.setCallbacks(filter.getCallbacks());
return (Transport) e.create();
} | java | private Transport interceptPropertySetters(Transport transport) {
final Enhancer e = new Enhancer();
e.setInterfaces(new Class<?>[] {Transport.class, ServiceTransportBeanSetters.class});
final TransportDelegationFilter filter = new TransportDelegationFilter(transport, ServiceTransportBeanSetters.class);
e.setCallbackFilter(filter);
e.setCallbacks(filter.getCallbacks());
return (Transport) e.create();
} | [
"private",
"Transport",
"interceptPropertySetters",
"(",
"Transport",
"transport",
")",
"{",
"final",
"Enhancer",
"e",
"=",
"new",
"Enhancer",
"(",
")",
";",
"e",
".",
"setInterfaces",
"(",
"new",
"Class",
"<",
"?",
">",
"[",
"]",
"{",
"Transport",
".",
... | ActiveMQ expects to reflectively call setX for every property x specified in the connection string.
Since we are actually constructing a failover transport, these properties are obviously not expected
and ActiveMQ complains that we are specifying invalid parameters. So create a CGLIB proxy that
intercepts and ignores appropriate setter calls. | [
"ActiveMQ",
"expects",
"to",
"reflectively",
"call",
"setX",
"for",
"every",
"property",
"x",
"specified",
"in",
"the",
"connection",
"string",
".",
"Since",
"we",
"are",
"actually",
"constructing",
"a",
"failover",
"transport",
"these",
"properties",
"are",
"ob... | train | https://github.com/NessComputing/service-discovery/blob/5091ffdb1de6b12d216d1c238f72858037c7b765/jms/src/main/java/com/nesscomputing/jms/activemq/ServiceDiscoveryTransportFactory.java#L183-L190 |
google/closure-compiler | src/com/google/javascript/jscomp/JSError.java | JSError.make | public static JSError make(String sourceName, int lineno, int charno,
DiagnosticType type, String... arguments) {
return new JSError(sourceName, null, lineno, charno, type, null, arguments);
} | java | public static JSError make(String sourceName, int lineno, int charno,
DiagnosticType type, String... arguments) {
return new JSError(sourceName, null, lineno, charno, type, null, arguments);
} | [
"public",
"static",
"JSError",
"make",
"(",
"String",
"sourceName",
",",
"int",
"lineno",
",",
"int",
"charno",
",",
"DiagnosticType",
"type",
",",
"String",
"...",
"arguments",
")",
"{",
"return",
"new",
"JSError",
"(",
"sourceName",
",",
"null",
",",
"li... | Creates a JSError at a given source location
@param sourceName The source file name
@param lineno Line number with source file, or -1 if unknown
@param charno Column number within line, or -1 for whole line.
@param type The DiagnosticType
@param arguments Arguments to be incorporated into the message | [
"Creates",
"a",
"JSError",
"at",
"a",
"given",
"source",
"location"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSError.java#L92-L95 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java | PixelMath.boundImage | public static void boundImage( GrayS32 img , int min , int max ) {
ImplPixelMath.boundImage(img,min,max);
} | java | public static void boundImage( GrayS32 img , int min , int max ) {
ImplPixelMath.boundImage(img,min,max);
} | [
"public",
"static",
"void",
"boundImage",
"(",
"GrayS32",
"img",
",",
"int",
"min",
",",
"int",
"max",
")",
"{",
"ImplPixelMath",
".",
"boundImage",
"(",
"img",
",",
"min",
",",
"max",
")",
";",
"}"
] | Bounds image pixels to be between these two values
@param img Image
@param min minimum value.
@param max maximum value. | [
"Bounds",
"image",
"pixels",
"to",
"be",
"between",
"these",
"two",
"values"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java#L4422-L4424 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/SparkUtils.java | SparkUtils.readObjectFromFile | public static <T> T readObjectFromFile(String path, Class<T> type, SparkContext sc) throws IOException {
FileSystem fileSystem = FileSystem.get(sc.hadoopConfiguration());
try (ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(fileSystem.open(new Path(path))))) {
Object o;
try {
o = ois.readObject();
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
return (T) o;
}
} | java | public static <T> T readObjectFromFile(String path, Class<T> type, SparkContext sc) throws IOException {
FileSystem fileSystem = FileSystem.get(sc.hadoopConfiguration());
try (ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(fileSystem.open(new Path(path))))) {
Object o;
try {
o = ois.readObject();
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
return (T) o;
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"readObjectFromFile",
"(",
"String",
"path",
",",
"Class",
"<",
"T",
">",
"type",
",",
"SparkContext",
"sc",
")",
"throws",
"IOException",
"{",
"FileSystem",
"fileSystem",
"=",
"FileSystem",
".",
"get",
"(",
"sc",
... | Read an object from HDFS (or local) using default Java object serialization
@param path File to read
@param type Class of the object to read
@param sc Spark context
@param <T> Type of the object to read | [
"Read",
"an",
"object",
"from",
"HDFS",
"(",
"or",
"local",
")",
"using",
"default",
"Java",
"object",
"serialization"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/SparkUtils.java#L234-L246 |
michael-rapp/AndroidMaterialPreferences | library/src/main/java/de/mrapp/android/preference/ResolutionPreference.java | ResolutionPreference.setResolution | public final void setResolution(final int width, final int height) {
Condition.INSTANCE.ensureAtLeast(width, 1, "The width must be at least 1");
Condition.INSTANCE.ensureAtLeast(height, 1, "The height must be at least 1");
this.width = width;
this.height = height;
persistString(formatResolution(getContext(), width, height));
notifyChanged();
} | java | public final void setResolution(final int width, final int height) {
Condition.INSTANCE.ensureAtLeast(width, 1, "The width must be at least 1");
Condition.INSTANCE.ensureAtLeast(height, 1, "The height must be at least 1");
this.width = width;
this.height = height;
persistString(formatResolution(getContext(), width, height));
notifyChanged();
} | [
"public",
"final",
"void",
"setResolution",
"(",
"final",
"int",
"width",
",",
"final",
"int",
"height",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureAtLeast",
"(",
"width",
",",
"1",
",",
"\"The width must be at least 1\"",
")",
";",
"Condition",
".",
... | Sets the current resolution of the preference. By setting a value, it will be persisted.
@param width
The width, which should be set, as an {@link Integer} value. The width must be at
least 1
@param height
The height, which should be set, as an {@link Integer} value. The height must be at
least 1 | [
"Sets",
"the",
"current",
"resolution",
"of",
"the",
"preference",
".",
"By",
"setting",
"a",
"value",
"it",
"will",
"be",
"persisted",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialPreferences/blob/73a7e449458313bd041fc8d6038e290506b68eb1/library/src/main/java/de/mrapp/android/preference/ResolutionPreference.java#L439-L446 |
tvesalainen/util | util/src/main/java/org/vesalainen/ui/LineDrawer.java | LineDrawer.drawLine | public static void drawLine(int x0, int y0, int x1, int y1, PlotOperator plot)
{
if (x0 > x1)
{
drawLine(x1, y1, x0, y0, plot);
}
else
{
if (y0 > y1)
{
drawLine(x0, -y0, x1, -y1, (x, y) -> plot.plot(x, -y));
}
else
{
drawLine1(x0, y0, x1, y1, plot); // ok to go ahead
}
}
} | java | public static void drawLine(int x0, int y0, int x1, int y1, PlotOperator plot)
{
if (x0 > x1)
{
drawLine(x1, y1, x0, y0, plot);
}
else
{
if (y0 > y1)
{
drawLine(x0, -y0, x1, -y1, (x, y) -> plot.plot(x, -y));
}
else
{
drawLine1(x0, y0, x1, y1, plot); // ok to go ahead
}
}
} | [
"public",
"static",
"void",
"drawLine",
"(",
"int",
"x0",
",",
"int",
"y0",
",",
"int",
"x1",
",",
"int",
"y1",
",",
"PlotOperator",
"plot",
")",
"{",
"if",
"(",
"x0",
">",
"x1",
")",
"{",
"drawLine",
"(",
"x1",
",",
"y1",
",",
"x0",
",",
"y0",... | Draws line ((x0, y0), (x1, y1)) by plotting points using plot
@param x0
@param y0
@param x1
@param y1
@param plot
@param color | [
"Draws",
"line",
"((",
"x0",
"y0",
")",
"(",
"x1",
"y1",
"))",
"by",
"plotting",
"points",
"using",
"plot"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/LineDrawer.java#L84-L101 |
casmi/casmi | src/main/java/casmi/graphics/element/Box.java | Box.setGradationColor | public void setGradationColor(GradationMode3D mode, ColorSet colorSet1, ColorSet colorSet2) {
setGradationColor(mode, new RGBColor(colorSet1), new RGBColor(colorSet2));
} | java | public void setGradationColor(GradationMode3D mode, ColorSet colorSet1, ColorSet colorSet2) {
setGradationColor(mode, new RGBColor(colorSet1), new RGBColor(colorSet2));
} | [
"public",
"void",
"setGradationColor",
"(",
"GradationMode3D",
"mode",
",",
"ColorSet",
"colorSet1",
",",
"ColorSet",
"colorSet2",
")",
"{",
"setGradationColor",
"(",
"mode",
",",
"new",
"RGBColor",
"(",
"colorSet1",
")",
",",
"new",
"RGBColor",
"(",
"colorSet2"... | Sets the gradation mode and colors.
@param mode The mode of gradation.
@param colorSet1 The colorSet for gradation.
@param colorSet2 The colorSet for gradation.
@see casmi.GradationMode2D | [
"Sets",
"the",
"gradation",
"mode",
"and",
"colors",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Box.java#L390-L392 |
Netflix/eureka | eureka-core/src/main/java/com/netflix/eureka/aws/AwsAsgUtil.java | AwsAsgUtil.isAddToLoadBalancerSuspended | private boolean isAddToLoadBalancerSuspended(String asgAccountId, String asgName) {
AutoScalingGroup asg;
if(asgAccountId == null || asgAccountId.equals(accountId)) {
asg = retrieveAutoScalingGroup(asgName);
} else {
asg = retrieveAutoScalingGroupCrossAccount(asgAccountId, asgName);
}
if (asg == null) {
logger.warn("The ASG information for {} could not be found. So returning false.", asgName);
return false;
}
return isAddToLoadBalancerSuspended(asg);
} | java | private boolean isAddToLoadBalancerSuspended(String asgAccountId, String asgName) {
AutoScalingGroup asg;
if(asgAccountId == null || asgAccountId.equals(accountId)) {
asg = retrieveAutoScalingGroup(asgName);
} else {
asg = retrieveAutoScalingGroupCrossAccount(asgAccountId, asgName);
}
if (asg == null) {
logger.warn("The ASG information for {} could not be found. So returning false.", asgName);
return false;
}
return isAddToLoadBalancerSuspended(asg);
} | [
"private",
"boolean",
"isAddToLoadBalancerSuspended",
"(",
"String",
"asgAccountId",
",",
"String",
"asgName",
")",
"{",
"AutoScalingGroup",
"asg",
";",
"if",
"(",
"asgAccountId",
"==",
"null",
"||",
"asgAccountId",
".",
"equals",
"(",
"accountId",
")",
")",
"{"... | Check if the ASG is disabled. The amazon flag "AddToLoadBalancer" is
queried to figure out if it is or not.
@param asgName
- The name of the ASG for which the status needs to be queried
@return - true if the ASG is disabled, false otherwise | [
"Check",
"if",
"the",
"ASG",
"is",
"disabled",
".",
"The",
"amazon",
"flag",
"AddToLoadBalancer",
"is",
"queried",
"to",
"figure",
"out",
"if",
"it",
"is",
"or",
"not",
"."
] | train | https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/aws/AwsAsgUtil.java#L206-L218 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java | FailoverGroupsInner.beginUpdateAsync | public Observable<FailoverGroupInner> beginUpdateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).map(new Func1<ServiceResponse<FailoverGroupInner>, FailoverGroupInner>() {
@Override
public FailoverGroupInner call(ServiceResponse<FailoverGroupInner> response) {
return response.body();
}
});
} | java | public Observable<FailoverGroupInner> beginUpdateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).map(new Func1<ServiceResponse<FailoverGroupInner>, FailoverGroupInner>() {
@Override
public FailoverGroupInner call(ServiceResponse<FailoverGroupInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"FailoverGroupInner",
">",
"beginUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"failoverGroupName",
",",
"FailoverGroupUpdate",
"parameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsyn... | Updates a failover group.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server containing the failover group.
@param failoverGroupName The name of the failover group.
@param parameters The failover group parameters.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the FailoverGroupInner object | [
"Updates",
"a",
"failover",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java#L695-L702 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java | ComputerVisionImpl.recognizePrintedText | public OcrResult recognizePrintedText(boolean detectOrientation, String url, RecognizePrintedTextOptionalParameter recognizePrintedTextOptionalParameter) {
return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url, recognizePrintedTextOptionalParameter).toBlocking().single().body();
} | java | public OcrResult recognizePrintedText(boolean detectOrientation, String url, RecognizePrintedTextOptionalParameter recognizePrintedTextOptionalParameter) {
return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url, recognizePrintedTextOptionalParameter).toBlocking().single().body();
} | [
"public",
"OcrResult",
"recognizePrintedText",
"(",
"boolean",
"detectOrientation",
",",
"String",
"url",
",",
"RecognizePrintedTextOptionalParameter",
"recognizePrintedTextOptionalParameter",
")",
"{",
"return",
"recognizePrintedTextWithServiceResponseAsync",
"(",
"detectOrientati... | Optical Character Recognition (OCR) detects printed text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
@param detectOrientation Whether detect the text orientation in the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down).
@param url Publicly reachable URL of an image
@param recognizePrintedTextOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ComputerVisionErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OcrResult object if successful. | [
"Optical",
"Character",
"Recognition",
"(",
"OCR",
")",
"detects",
"printed",
"text",
"in",
"an",
"image",
"and",
"extracts",
"the",
"recognized",
"characters",
"into",
"a",
"machine",
"-",
"usable",
"character",
"stream",
".",
"Upon",
"success",
"the",
"OCR",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L1900-L1902 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/fdt/FdtSketch.java | FdtSketch.getUpperBound | public double getUpperBound(final int numStdDev, final int numSubsetEntries) {
if (!isEstimationMode()) { return numSubsetEntries; }
return BinomialBoundsN.getUpperBound(numSubsetEntries, getTheta(), numStdDev, isEmpty());
} | java | public double getUpperBound(final int numStdDev, final int numSubsetEntries) {
if (!isEstimationMode()) { return numSubsetEntries; }
return BinomialBoundsN.getUpperBound(numSubsetEntries, getTheta(), numStdDev, isEmpty());
} | [
"public",
"double",
"getUpperBound",
"(",
"final",
"int",
"numStdDev",
",",
"final",
"int",
"numSubsetEntries",
")",
"{",
"if",
"(",
"!",
"isEstimationMode",
"(",
")",
")",
"{",
"return",
"numSubsetEntries",
";",
"}",
"return",
"BinomialBoundsN",
".",
"getUppe... | Gets the estimate of the upper bound of the true distinct population represented by the count
of entries in a group.
@param numStdDev
<a href="{@docRoot}/resources/dictionary.html#numStdDev">See Number of Standard Deviations</a>
@param numSubsetEntries number of entries for a chosen subset of the sketch.
@return the estimate of the upper bound of the true distinct population represented by the count
of entries in a group. | [
"Gets",
"the",
"estimate",
"of",
"the",
"upper",
"bound",
"of",
"the",
"true",
"distinct",
"population",
"represented",
"by",
"the",
"count",
"of",
"entries",
"in",
"a",
"group",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/fdt/FdtSketch.java#L149-L152 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/TileWriter.java | TileWriter.cutCurrentCache | private void cutCurrentCache() {
final File lock=Configuration.getInstance().getOsmdroidTileCache();
synchronized (lock) {
if (mUsedCacheSpace > Configuration.getInstance().getTileFileSystemCacheTrimBytes()) {
Log.d(IMapView.LOGTAG,"Trimming tile cache from " + mUsedCacheSpace + " to "
+ Configuration.getInstance().getTileFileSystemCacheTrimBytes());
final List<File> z = getDirectoryFileList(Configuration.getInstance().getOsmdroidTileCache());
// order list by files day created from old to new
final File[] files = z.toArray(new File[0]);
Arrays.sort(files, new Comparator<File>() {
@Override
public int compare(final File f1, final File f2) {
return Long.valueOf(f1.lastModified()).compareTo(f2.lastModified());
}
});
for (final File file : files) {
if (mUsedCacheSpace <= Configuration.getInstance().getTileFileSystemCacheTrimBytes()) {
break;
}
final long length = file.length();
if (file.delete()) {
if (Configuration.getInstance().isDebugTileProviders()){
Log.d(IMapView.LOGTAG,"Cache trim deleting " + file.getAbsolutePath());
}
mUsedCacheSpace -= length;
}
}
Log.d(IMapView.LOGTAG,"Finished trimming tile cache");
}
}
} | java | private void cutCurrentCache() {
final File lock=Configuration.getInstance().getOsmdroidTileCache();
synchronized (lock) {
if (mUsedCacheSpace > Configuration.getInstance().getTileFileSystemCacheTrimBytes()) {
Log.d(IMapView.LOGTAG,"Trimming tile cache from " + mUsedCacheSpace + " to "
+ Configuration.getInstance().getTileFileSystemCacheTrimBytes());
final List<File> z = getDirectoryFileList(Configuration.getInstance().getOsmdroidTileCache());
// order list by files day created from old to new
final File[] files = z.toArray(new File[0]);
Arrays.sort(files, new Comparator<File>() {
@Override
public int compare(final File f1, final File f2) {
return Long.valueOf(f1.lastModified()).compareTo(f2.lastModified());
}
});
for (final File file : files) {
if (mUsedCacheSpace <= Configuration.getInstance().getTileFileSystemCacheTrimBytes()) {
break;
}
final long length = file.length();
if (file.delete()) {
if (Configuration.getInstance().isDebugTileProviders()){
Log.d(IMapView.LOGTAG,"Cache trim deleting " + file.getAbsolutePath());
}
mUsedCacheSpace -= length;
}
}
Log.d(IMapView.LOGTAG,"Finished trimming tile cache");
}
}
} | [
"private",
"void",
"cutCurrentCache",
"(",
")",
"{",
"final",
"File",
"lock",
"=",
"Configuration",
".",
"getInstance",
"(",
")",
".",
"getOsmdroidTileCache",
"(",
")",
";",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"mUsedCacheSpace",
">",
"Configura... | If the cache size is greater than the max then trim it down to the trim level. This method is
synchronized so that only one thread can run it at a time. | [
"If",
"the",
"cache",
"size",
"is",
"greater",
"than",
"the",
"max",
"then",
"trim",
"it",
"down",
"to",
"the",
"trim",
"level",
".",
"This",
"method",
"is",
"synchronized",
"so",
"that",
"only",
"one",
"thread",
"can",
"run",
"it",
"at",
"a",
"time",
... | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/TileWriter.java#L266-L304 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/vna/ValueNumberFrameModelingVisitor.java | ValueNumberFrameModelingVisitor.popInputValues | private ValueNumber[] popInputValues(int numWordsConsumed) {
ValueNumberFrame frame = getFrame();
ValueNumber[] inputValueList = allocateValueNumberArray(numWordsConsumed);
// Pop off the input operands.
try {
frame.getTopStackWords(inputValueList);
while (numWordsConsumed-- > 0) {
frame.popValue();
}
} catch (DataflowAnalysisException e) {
throw new InvalidBytecodeException("Error getting input operands", e);
}
return inputValueList;
} | java | private ValueNumber[] popInputValues(int numWordsConsumed) {
ValueNumberFrame frame = getFrame();
ValueNumber[] inputValueList = allocateValueNumberArray(numWordsConsumed);
// Pop off the input operands.
try {
frame.getTopStackWords(inputValueList);
while (numWordsConsumed-- > 0) {
frame.popValue();
}
} catch (DataflowAnalysisException e) {
throw new InvalidBytecodeException("Error getting input operands", e);
}
return inputValueList;
} | [
"private",
"ValueNumber",
"[",
"]",
"popInputValues",
"(",
"int",
"numWordsConsumed",
")",
"{",
"ValueNumberFrame",
"frame",
"=",
"getFrame",
"(",
")",
";",
"ValueNumber",
"[",
"]",
"inputValueList",
"=",
"allocateValueNumberArray",
"(",
"numWordsConsumed",
")",
"... | Pop the input values for the given instruction from the current frame. | [
"Pop",
"the",
"input",
"values",
"for",
"the",
"given",
"instruction",
"from",
"the",
"current",
"frame",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/vna/ValueNumberFrameModelingVisitor.java#L595-L610 |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.setDivider | public final void setDivider(final int index, @StringRes final int titleId) {
Divider divider = new Divider();
divider.setTitle(getContext(), titleId);
adapter.set(index, divider);
adaptGridViewHeight();
} | java | public final void setDivider(final int index, @StringRes final int titleId) {
Divider divider = new Divider();
divider.setTitle(getContext(), titleId);
adapter.set(index, divider);
adaptGridViewHeight();
} | [
"public",
"final",
"void",
"setDivider",
"(",
"final",
"int",
"index",
",",
"@",
"StringRes",
"final",
"int",
"titleId",
")",
"{",
"Divider",
"divider",
"=",
"new",
"Divider",
"(",
")",
";",
"divider",
".",
"setTitle",
"(",
"getContext",
"(",
")",
",",
... | Replaces the item at a specific index with a divider.
@param index
The index of the item, which should be replaced, as an {@link Integer} value
@param titleId
The resource id of the title of the divider, which should be added, as an {@link
Integer} value. The resource id must correspond to a valid string resource | [
"Replaces",
"the",
"item",
"at",
"a",
"specific",
"index",
"with",
"a",
"divider",
"."
] | train | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L2201-L2206 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java | Strs.isEmpty | public static boolean isEmpty(String target, String... specialValueAsEmpty) {
if (isEmpty(target)) {
return true;
}
return matcher(target).isEmpty(specialValueAsEmpty);
} | java | public static boolean isEmpty(String target, String... specialValueAsEmpty) {
if (isEmpty(target)) {
return true;
}
return matcher(target).isEmpty(specialValueAsEmpty);
} | [
"public",
"static",
"boolean",
"isEmpty",
"(",
"String",
"target",
",",
"String",
"...",
"specialValueAsEmpty",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"target",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"matcher",
"(",
"target",
")",
".",
"isEmp... | Checks if a String is empty ("") or null or special value.
@param target
@param specialValueAsEmpty
@return | [
"Checks",
"if",
"a",
"String",
"is",
"empty",
"(",
")",
"or",
"null",
"or",
"special",
"value",
"."
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java#L150-L156 |
google/error-prone-javac | make/tools/propertiesparser/gen/ClassGenerator.java | ClassGenerator.generateFactory | public void generateFactory(MessageFile messageFile, File outDir) {
Map<FactoryKind, List<Map.Entry<String, Message>>> groupedEntries =
messageFile.messages.entrySet().stream()
.collect(Collectors.groupingBy(e -> FactoryKind.parseFrom(e.getKey().split("\\.")[1])));
//generate nested classes
List<String> nestedDecls = new ArrayList<>();
Set<String> importedTypes = new TreeSet<>();
for (Map.Entry<FactoryKind, List<Map.Entry<String, Message>>> entry : groupedEntries.entrySet()) {
if (entry.getKey() == FactoryKind.OTHER) continue;
//emit members
String members = entry.getValue().stream()
.flatMap(e -> generateFactoryMethodsAndFields(e.getKey(), e.getValue()).stream())
.collect(Collectors.joining("\n\n"));
//emit nested class
String factoryDecl =
StubKind.FACTORY_CLASS.format(entry.getKey().factoryClazz, indent(members, 1));
nestedDecls.add(indent(factoryDecl, 1));
//add imports
entry.getValue().stream().forEach(e ->
importedTypes.addAll(importedTypes(e.getValue().getMessageInfo().getTypes())));
}
String clazz = StubKind.TOPLEVEL.format(
packageName(messageFile.file),
String.join("\n", generateImports(importedTypes)),
toplevelName(messageFile.file),
String.join("\n", nestedDecls));
try (FileWriter fw = new FileWriter(new File(outDir, toplevelName(messageFile.file) + ".java"))) {
fw.append(clazz);
} catch (Throwable ex) {
throw new AssertionError(ex);
}
} | java | public void generateFactory(MessageFile messageFile, File outDir) {
Map<FactoryKind, List<Map.Entry<String, Message>>> groupedEntries =
messageFile.messages.entrySet().stream()
.collect(Collectors.groupingBy(e -> FactoryKind.parseFrom(e.getKey().split("\\.")[1])));
//generate nested classes
List<String> nestedDecls = new ArrayList<>();
Set<String> importedTypes = new TreeSet<>();
for (Map.Entry<FactoryKind, List<Map.Entry<String, Message>>> entry : groupedEntries.entrySet()) {
if (entry.getKey() == FactoryKind.OTHER) continue;
//emit members
String members = entry.getValue().stream()
.flatMap(e -> generateFactoryMethodsAndFields(e.getKey(), e.getValue()).stream())
.collect(Collectors.joining("\n\n"));
//emit nested class
String factoryDecl =
StubKind.FACTORY_CLASS.format(entry.getKey().factoryClazz, indent(members, 1));
nestedDecls.add(indent(factoryDecl, 1));
//add imports
entry.getValue().stream().forEach(e ->
importedTypes.addAll(importedTypes(e.getValue().getMessageInfo().getTypes())));
}
String clazz = StubKind.TOPLEVEL.format(
packageName(messageFile.file),
String.join("\n", generateImports(importedTypes)),
toplevelName(messageFile.file),
String.join("\n", nestedDecls));
try (FileWriter fw = new FileWriter(new File(outDir, toplevelName(messageFile.file) + ".java"))) {
fw.append(clazz);
} catch (Throwable ex) {
throw new AssertionError(ex);
}
} | [
"public",
"void",
"generateFactory",
"(",
"MessageFile",
"messageFile",
",",
"File",
"outDir",
")",
"{",
"Map",
"<",
"FactoryKind",
",",
"List",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Message",
">",
">",
">",
"groupedEntries",
"=",
"messageFile",
"... | Main entry-point: generate a Java enum-like set of nested factory classes into given output
folder. The factories are populated as mandated by the comments in the input resource file. | [
"Main",
"entry",
"-",
"point",
":",
"generate",
"a",
"Java",
"enum",
"-",
"like",
"set",
"of",
"nested",
"factory",
"classes",
"into",
"given",
"output",
"folder",
".",
"The",
"factories",
"are",
"populated",
"as",
"mandated",
"by",
"the",
"comments",
"in"... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/make/tools/propertiesparser/gen/ClassGenerator.java#L148-L179 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/SyncErrorResponseDeserializer.java | SyncErrorResponseDeserializer.getSyncError | private SyncError getSyncError(JsonNode jsonNode) throws IOException {
ObjectMapper mapper = new ObjectMapper();
SimpleModule simpleModule = new SimpleModule("SyncErrorDeserializer", new Version(1, 0, 0, null));
simpleModule.addDeserializer(SyncError.class, new SyncErrorDeserializer());
mapper.registerModule(simpleModule);
return mapper.treeToValue(jsonNode, SyncError.class);
} | java | private SyncError getSyncError(JsonNode jsonNode) throws IOException {
ObjectMapper mapper = new ObjectMapper();
SimpleModule simpleModule = new SimpleModule("SyncErrorDeserializer", new Version(1, 0, 0, null));
simpleModule.addDeserializer(SyncError.class, new SyncErrorDeserializer());
mapper.registerModule(simpleModule);
return mapper.treeToValue(jsonNode, SyncError.class);
} | [
"private",
"SyncError",
"getSyncError",
"(",
"JsonNode",
"jsonNode",
")",
"throws",
"IOException",
"{",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"SimpleModule",
"simpleModule",
"=",
"new",
"SimpleModule",
"(",
"\"SyncErrorDeserializer\"",
... | Method to deserialize the SyncError object
@param jsonNode
@return QueryResponse | [
"Method",
"to",
"deserialize",
"the",
"SyncError",
"object"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/SyncErrorResponseDeserializer.java#L145-L154 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.getImage | public GetImageResponse getImage(GetImageRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getImageId(), "request imageId should not be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.GET, IMAGE_PREFIX, request.getImageId());
return invokeHttpClient(internalRequest, GetImageResponse.class);
} | java | public GetImageResponse getImage(GetImageRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getImageId(), "request imageId should not be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.GET, IMAGE_PREFIX, request.getImageId());
return invokeHttpClient(internalRequest, GetImageResponse.class);
} | [
"public",
"GetImageResponse",
"getImage",
"(",
"GetImageRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getImageId",
"(",
")",
",",
"\"request imageId should no... | Get the detail information of specified image.
@param request The request containing all options for getting the detail information of specified image.
@return The response with the image detail information. | [
"Get",
"the",
"detail",
"information",
"of",
"specified",
"image",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1312-L1318 |
52inc/android-52Kit | library/src/main/java/com/ftinc/kit/util/IntentUtils.java | IntentUtils.showLocation | public static Intent showLocation(float latitude, float longitude, Integer zoomLevel) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
String data = String.format("geo:%s,%s", latitude, longitude);
if (zoomLevel != null) {
data = String.format("%s?z=%s", data, zoomLevel);
}
intent.setData(Uri.parse(data));
return intent;
} | java | public static Intent showLocation(float latitude, float longitude, Integer zoomLevel) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
String data = String.format("geo:%s,%s", latitude, longitude);
if (zoomLevel != null) {
data = String.format("%s?z=%s", data, zoomLevel);
}
intent.setData(Uri.parse(data));
return intent;
} | [
"public",
"static",
"Intent",
"showLocation",
"(",
"float",
"latitude",
",",
"float",
"longitude",
",",
"Integer",
"zoomLevel",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
")",
";",
"intent",
".",
"setAction",
"(",
"Intent",
".",
"ACTION_VIEW",
... | Opens the Maps application to the given location.
@param latitude Latitude
@param longitude Longitude
@param zoomLevel A zoom level of 1 shows the whole Earth, centered at the given lat,lng.
A zoom level of 2 shows a quarter of the Earth, and so on. The highest zoom level is 23.
A larger zoom level will be clamped to 23.
@see #findLocation(String) | [
"Opens",
"the",
"Maps",
"application",
"to",
"the",
"given",
"location",
"."
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/IntentUtils.java#L177-L186 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/GuiUtils.java | GuiUtils.wrapFlow | public static JPanel wrapFlow(JComponent component)
{
JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
p.add(component);
return p;
} | java | public static JPanel wrapFlow(JComponent component)
{
JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
p.add(component);
return p;
} | [
"public",
"static",
"JPanel",
"wrapFlow",
"(",
"JComponent",
"component",
")",
"{",
"JPanel",
"p",
"=",
"new",
"JPanel",
"(",
"new",
"FlowLayout",
"(",
"FlowLayout",
".",
"CENTER",
",",
"0",
",",
"0",
")",
")",
";",
"p",
".",
"add",
"(",
"component",
... | Wrap the given component into a panel with flow layout
@param component The component
@return The panel | [
"Wrap",
"the",
"given",
"component",
"into",
"a",
"panel",
"with",
"flow",
"layout"
] | train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/GuiUtils.java#L86-L91 |
pravega/pravega | common/src/main/java/io/pravega/common/Exceptions.java | Exceptions.checkNotNullOrEmpty | public static <T, V extends Collection<T>> V checkNotNullOrEmpty(V arg, String argName) throws NullPointerException, IllegalArgumentException {
Preconditions.checkNotNull(arg, argName);
checkArgument(!arg.isEmpty(), argName, "Cannot be an empty collection.");
return arg;
} | java | public static <T, V extends Collection<T>> V checkNotNullOrEmpty(V arg, String argName) throws NullPointerException, IllegalArgumentException {
Preconditions.checkNotNull(arg, argName);
checkArgument(!arg.isEmpty(), argName, "Cannot be an empty collection.");
return arg;
} | [
"public",
"static",
"<",
"T",
",",
"V",
"extends",
"Collection",
"<",
"T",
">",
">",
"V",
"checkNotNullOrEmpty",
"(",
"V",
"arg",
",",
"String",
"argName",
")",
"throws",
"NullPointerException",
",",
"IllegalArgumentException",
"{",
"Preconditions",
".",
"chec... | Throws a NullPointerException if the arg argument is null. Throws an IllegalArgumentException if the Collections arg
argument has a size of zero.
@param <T> The type of elements in the provided collection.
@param <V> The actual type of the collection.
@param arg The argument to check.
@param argName The name of the argument (to be included in the exception message).
@return The arg.
@throws NullPointerException If arg is null.
@throws IllegalArgumentException If arg is not null, but has a length of zero. | [
"Throws",
"a",
"NullPointerException",
"if",
"the",
"arg",
"argument",
"is",
"null",
".",
"Throws",
"an",
"IllegalArgumentException",
"if",
"the",
"Collections",
"arg",
"argument",
"has",
"a",
"size",
"of",
"zero",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/Exceptions.java#L173-L177 |
dwdyer/watchmaker | swing/src/java/main/org/uncommons/watchmaker/swing/SwingConsole.java | SwingConsole.select | public int select(final List<? extends JComponent> renderedEntities)
{
selectedIndex.set(-1);
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
removeAll();
int index = -1;
for (JComponent entity : renderedEntities)
{
add(new EntityPanel(entity, ++index));
}
revalidate();
}
});
waitForSelection();
return selectedIndex.get();
} | java | public int select(final List<? extends JComponent> renderedEntities)
{
selectedIndex.set(-1);
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
removeAll();
int index = -1;
for (JComponent entity : renderedEntities)
{
add(new EntityPanel(entity, ++index));
}
revalidate();
}
});
waitForSelection();
return selectedIndex.get();
} | [
"public",
"int",
"select",
"(",
"final",
"List",
"<",
"?",
"extends",
"JComponent",
">",
"renderedEntities",
")",
"{",
"selectedIndex",
".",
"set",
"(",
"-",
"1",
")",
";",
"SwingUtilities",
".",
"invokeLater",
"(",
"new",
"Runnable",
"(",
")",
"{",
"pub... | This method blocks and therefore must not be invoked from the Event
Dispatch Thread.
{@inheritDoc} | [
"This",
"method",
"blocks",
"and",
"therefore",
"must",
"not",
"be",
"invoked",
"from",
"the",
"Event",
"Dispatch",
"Thread",
".",
"{"
] | train | https://github.com/dwdyer/watchmaker/blob/33d942350e6bf7d9a17b9262a4f898158530247e/swing/src/java/main/org/uncommons/watchmaker/swing/SwingConsole.java#L70-L88 |
GCRC/nunaliit | nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntryResource.java | FSEntryResource.getPositionedResource | static public FSEntry getPositionedResource(String path, ClassLoader classLoader, String resourceName) throws Exception {
List<String> pathFrags = FSEntrySupport.interpretPath(path);
// Start at leaf and work our way back
int index = pathFrags.size() - 1;
FSEntry root = create(pathFrags.get(index), classLoader, resourceName);
--index;
while(index >= 0){
FSEntryVirtualDirectory parent = new FSEntryVirtualDirectory(pathFrags.get(index));
parent.addChildEntry(root);
root = parent;
--index;
}
return root;
} | java | static public FSEntry getPositionedResource(String path, ClassLoader classLoader, String resourceName) throws Exception {
List<String> pathFrags = FSEntrySupport.interpretPath(path);
// Start at leaf and work our way back
int index = pathFrags.size() - 1;
FSEntry root = create(pathFrags.get(index), classLoader, resourceName);
--index;
while(index >= 0){
FSEntryVirtualDirectory parent = new FSEntryVirtualDirectory(pathFrags.get(index));
parent.addChildEntry(root);
root = parent;
--index;
}
return root;
} | [
"static",
"public",
"FSEntry",
"getPositionedResource",
"(",
"String",
"path",
",",
"ClassLoader",
"classLoader",
",",
"String",
"resourceName",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"pathFrags",
"=",
"FSEntrySupport",
".",
"interpretPath",
... | Create a virtual tree hierarchy with a resource supporting the leaf.
@param path Position of the file in the hierarchy, including its name
@param classLoader Class loader used to find the needed resource
@param resourceName Name of the actual resource to obtain using class loader
@return The FSEntry root for this hierarchy
@throws Exception Invalid parameter | [
"Create",
"a",
"virtual",
"tree",
"hierarchy",
"with",
"a",
"resource",
"supporting",
"the",
"leaf",
"."
] | train | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntryResource.java#L24-L40 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/cache/Cache.java | Cache.putInCache | protected final void putInCache (@Nonnull final KEYTYPE aKey, @Nonnull final VALUETYPE aValue)
{
ValueEnforcer.notNull (aKey, "cacheKey");
ValueEnforcer.notNull (aValue, "cacheValue");
m_aRWLock.writeLocked ( () -> putInCacheNotLocked (aKey, aValue));
} | java | protected final void putInCache (@Nonnull final KEYTYPE aKey, @Nonnull final VALUETYPE aValue)
{
ValueEnforcer.notNull (aKey, "cacheKey");
ValueEnforcer.notNull (aValue, "cacheValue");
m_aRWLock.writeLocked ( () -> putInCacheNotLocked (aKey, aValue));
} | [
"protected",
"final",
"void",
"putInCache",
"(",
"@",
"Nonnull",
"final",
"KEYTYPE",
"aKey",
",",
"@",
"Nonnull",
"final",
"VALUETYPE",
"aValue",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aKey",
",",
"\"cacheKey\"",
")",
";",
"ValueEnforcer",
".",
"no... | Put a new value into the cache.
@param aKey
The cache key. May not be <code>null</code>.
@param aValue
The cache value. May not be <code>null</code>. | [
"Put",
"a",
"new",
"value",
"into",
"the",
"cache",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/cache/Cache.java#L165-L171 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/GitLabApiForm.java | GitLabApiForm.withParam | public GitLabApiForm withParam(String name, Object value, boolean required) throws IllegalArgumentException {
if (value == null) {
if (required) {
throw new IllegalArgumentException(name + " cannot be empty or null");
}
return (this);
}
String stringValue = value.toString();
if (required && stringValue.trim().length() == 0) {
throw new IllegalArgumentException(name + " cannot be empty or null");
}
this.param(name, stringValue);
return (this);
} | java | public GitLabApiForm withParam(String name, Object value, boolean required) throws IllegalArgumentException {
if (value == null) {
if (required) {
throw new IllegalArgumentException(name + " cannot be empty or null");
}
return (this);
}
String stringValue = value.toString();
if (required && stringValue.trim().length() == 0) {
throw new IllegalArgumentException(name + " cannot be empty or null");
}
this.param(name, stringValue);
return (this);
} | [
"public",
"GitLabApiForm",
"withParam",
"(",
"String",
"name",
",",
"Object",
"value",
",",
"boolean",
"required",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"if",
"(",
"required",
")",
"{",
"throw",
"new",
... | Fluent method for adding query and form parameters to a get() or post() call.
If required is true and value is null, will throw an IllegalArgumentException.
@param name the name of the field/attribute to add
@param value the value of the field/attribute to add
@param required the field is required flag
@return this GitLabAPiForm instance
@throws IllegalArgumentException if a required parameter is null or empty | [
"Fluent",
"method",
"for",
"adding",
"query",
"and",
"form",
"parameters",
"to",
"a",
"get",
"()",
"or",
"post",
"()",
"call",
".",
"If",
"required",
"is",
"true",
"and",
"value",
"is",
"null",
"will",
"throw",
"an",
"IllegalArgumentException",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GitLabApiForm.java#L179-L196 |
Swagger2Markup/swagger2markup | src/main/java/io/github/swagger2markup/internal/utils/ExamplesUtil.java | ExamplesUtil.generateExampleForArrayProperty | private static Object[] generateExampleForArrayProperty(ArrayProperty value, Map<String, Model> definitions, DocumentResolver definitionDocumentResolver, MarkupDocBuilder markupDocBuilder, Map<String, Integer> refStack) {
Property property = value.getItems();
return getExample(property, definitions, definitionDocumentResolver, markupDocBuilder, refStack);
} | java | private static Object[] generateExampleForArrayProperty(ArrayProperty value, Map<String, Model> definitions, DocumentResolver definitionDocumentResolver, MarkupDocBuilder markupDocBuilder, Map<String, Integer> refStack) {
Property property = value.getItems();
return getExample(property, definitions, definitionDocumentResolver, markupDocBuilder, refStack);
} | [
"private",
"static",
"Object",
"[",
"]",
"generateExampleForArrayProperty",
"(",
"ArrayProperty",
"value",
",",
"Map",
"<",
"String",
",",
"Model",
">",
"definitions",
",",
"DocumentResolver",
"definitionDocumentResolver",
",",
"MarkupDocBuilder",
"markupDocBuilder",
",... | Generates examples from an ArrayProperty
@param value ArrayProperty
@param definitions map of definitions
@param markupDocBuilder the markup builder
@return array of Object | [
"Generates",
"examples",
"from",
"an",
"ArrayProperty"
] | train | https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/utils/ExamplesUtil.java#L334-L337 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java | SeaGlassSynthPainterImpl.paintTabbedPaneBorder | public void paintTabbedPaneBorder(SynthContext context, Graphics g, int x, int y, int w, int h) {
paintBorder(context, g, x, y, w, h, null);
} | java | public void paintTabbedPaneBorder(SynthContext context, Graphics g, int x, int y, int w, int h) {
paintBorder(context, g, x, y, w, h, null);
} | [
"public",
"void",
"paintTabbedPaneBorder",
"(",
"SynthContext",
"context",
",",
"Graphics",
"g",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"w",
",",
"int",
"h",
")",
"{",
"paintBorder",
"(",
"context",
",",
"g",
",",
"x",
",",
"y",
",",
"w",
",... | Paints the border of a tabbed pane.
@param context SynthContext identifying the <code>JComponent</code> and
<code>Region</code> to paint to
@param g <code>Graphics</code> to paint to
@param x X coordinate of the area to paint to
@param y Y coordinate of the area to paint to
@param w Width of the area to paint to
@param h Height of the area to paint to | [
"Paints",
"the",
"border",
"of",
"a",
"tabbed",
"pane",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1941-L1943 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/descriptions/DefaultOperationDescriptionProvider.java | DefaultOperationDescriptionProvider.getReplyValueTypeDescription | protected ModelNode getReplyValueTypeDescription(ResourceDescriptionResolver descriptionResolver, Locale locale, ResourceBundle bundle) {
// bug -- user specifies a complex reply type but does not override this method to describe it
return new ModelNode(ModelType.OBJECT); //todo rethink this
//throw MESSAGES.operationReplyValueTypeRequired(operationName);
} | java | protected ModelNode getReplyValueTypeDescription(ResourceDescriptionResolver descriptionResolver, Locale locale, ResourceBundle bundle) {
// bug -- user specifies a complex reply type but does not override this method to describe it
return new ModelNode(ModelType.OBJECT); //todo rethink this
//throw MESSAGES.operationReplyValueTypeRequired(operationName);
} | [
"protected",
"ModelNode",
"getReplyValueTypeDescription",
"(",
"ResourceDescriptionResolver",
"descriptionResolver",
",",
"Locale",
"locale",
",",
"ResourceBundle",
"bundle",
")",
"{",
"// bug -- user specifies a complex reply type but does not override this method to describe it",
"re... | Hook for subclasses to provide a description object for any complex "value-type" description of the operation reply.
<p>This default implementation throws an {@code IllegalStateException}; it is the responsibility of
subclasses to override this method if a complex "value-type" description is required.</p>
@param descriptionResolver resolver for localizing any text in the description
@param locale locale for any text description
@param bundle resource bundle previously {@link ResourceDescriptionResolver#getResourceBundle(Locale) obtained from the description resolver}
@return a node describing the reply's "value-type"
@throws IllegalStateException if not overridden by an implementation that does not | [
"Hook",
"for",
"subclasses",
"to",
"provide",
"a",
"description",
"object",
"for",
"any",
"complex",
"value",
"-",
"type",
"description",
"of",
"the",
"operation",
"reply",
".",
"<p",
">",
"This",
"default",
"implementation",
"throws",
"an",
"{",
"@code",
"I... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/descriptions/DefaultOperationDescriptionProvider.java#L242-L246 |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java | ReceiveMessageBuilder.validateScript | public T validateScript(Resource scriptResource, Charset charset) {
try {
validateScript(FileUtils.readToString(scriptResource, charset));
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read script resource file", e);
}
return self;
} | java | public T validateScript(Resource scriptResource, Charset charset) {
try {
validateScript(FileUtils.readToString(scriptResource, charset));
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read script resource file", e);
}
return self;
} | [
"public",
"T",
"validateScript",
"(",
"Resource",
"scriptResource",
",",
"Charset",
"charset",
")",
"{",
"try",
"{",
"validateScript",
"(",
"FileUtils",
".",
"readToString",
"(",
"scriptResource",
",",
"charset",
")",
")",
";",
"}",
"catch",
"(",
"IOException"... | Reads validation script file resource and sets content as validation script.
@param scriptResource
@param charset
@return | [
"Reads",
"validation",
"script",
"file",
"resource",
"and",
"sets",
"content",
"as",
"validation",
"script",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java#L477-L485 |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/NodeIdRepresentation.java | NodeIdRepresentation.deleteResource | public void deleteResource(final String resourceName, final long nodeId) throws JaxRxException {
synchronized (resourceName) {
ISession session = null;
INodeWriteTrx wtx = null;
boolean abort = false;
if (mDatabase.existsResource(resourceName)) {
try {
// Creating a new session
session =
mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY));
// Creating a write transaction
wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling);
// move to node with given rest id and deletes it
if (wtx.moveTo(nodeId)) {
wtx.remove();
wtx.commit();
} else {
// workerHelper.closeWTX(abort, wtx, session, database);
throw new JaxRxException(404, NOTFOUND);
}
} catch (final TTException exce) {
abort = true;
throw new JaxRxException(exce);
} finally {
try {
WorkerHelper.closeWTX(abort, wtx, session);
} catch (final TTException exce) {
throw new JaxRxException(exce);
}
}
} else {
throw new JaxRxException(404, "DB not found");
}
}
} | java | public void deleteResource(final String resourceName, final long nodeId) throws JaxRxException {
synchronized (resourceName) {
ISession session = null;
INodeWriteTrx wtx = null;
boolean abort = false;
if (mDatabase.existsResource(resourceName)) {
try {
// Creating a new session
session =
mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY));
// Creating a write transaction
wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling);
// move to node with given rest id and deletes it
if (wtx.moveTo(nodeId)) {
wtx.remove();
wtx.commit();
} else {
// workerHelper.closeWTX(abort, wtx, session, database);
throw new JaxRxException(404, NOTFOUND);
}
} catch (final TTException exce) {
abort = true;
throw new JaxRxException(exce);
} finally {
try {
WorkerHelper.closeWTX(abort, wtx, session);
} catch (final TTException exce) {
throw new JaxRxException(exce);
}
}
} else {
throw new JaxRxException(404, "DB not found");
}
}
} | [
"public",
"void",
"deleteResource",
"(",
"final",
"String",
"resourceName",
",",
"final",
"long",
"nodeId",
")",
"throws",
"JaxRxException",
"{",
"synchronized",
"(",
"resourceName",
")",
"{",
"ISession",
"session",
"=",
"null",
";",
"INodeWriteTrx",
"wtx",
"=",... | This method is responsible to delete an XML resource addressed through a
unique node id (except root node id).
@param resourceName
The name of the database, which the node id belongs to.
@param nodeId
The unique node id.
@throws JaxRxException
The exception occurred. | [
"This",
"method",
"is",
"responsible",
"to",
"delete",
"an",
"XML",
"resource",
"addressed",
"through",
"a",
"unique",
"node",
"id",
"(",
"except",
"root",
"node",
"id",
")",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/NodeIdRepresentation.java#L225-L259 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.