repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/metadata/builder/HandlerChainInfoBuilder.java | HandlerChainInfoBuilder.resolveHandlerChainFileName | protected URL resolveHandlerChainFileName(String clzName, String fileName) {
URL handlerFile = null;
InputStream in = null;
String handlerChainFileName = fileName;
URL baseUrl = classLoader.getResource(getClassResourceName(clzName));
try {
//if the filename start with '/', then find and return the resource under the web application home directory directory.
if (handlerChainFileName.charAt(0) == '/') {
return classLoader.getResource(handlerChainFileName.substring(1));
}
//otherwise, create a new url instance according to the baseurl and the fileName
handlerFile = new URL(baseUrl, handlerChainFileName);
in = handlerFile.openStream();
} catch (Exception e) {
// log the error msg
} finally {
if (in != null) {
try {
in.close();
} catch (Exception e) {
}
}
}
return handlerFile;
} | java | protected URL resolveHandlerChainFileName(String clzName, String fileName) {
URL handlerFile = null;
InputStream in = null;
String handlerChainFileName = fileName;
URL baseUrl = classLoader.getResource(getClassResourceName(clzName));
try {
//if the filename start with '/', then find and return the resource under the web application home directory directory.
if (handlerChainFileName.charAt(0) == '/') {
return classLoader.getResource(handlerChainFileName.substring(1));
}
//otherwise, create a new url instance according to the baseurl and the fileName
handlerFile = new URL(baseUrl, handlerChainFileName);
in = handlerFile.openStream();
} catch (Exception e) {
// log the error msg
} finally {
if (in != null) {
try {
in.close();
} catch (Exception e) {
}
}
}
return handlerFile;
} | [
"protected",
"URL",
"resolveHandlerChainFileName",
"(",
"String",
"clzName",
",",
"String",
"fileName",
")",
"{",
"URL",
"handlerFile",
"=",
"null",
";",
"InputStream",
"in",
"=",
"null",
";",
"String",
"handlerChainFileName",
"=",
"fileName",
";",
"URL",
"baseU... | Resolve handler chain configuration file associated with the given class
@param clzName
@param fileName
@return A URL object or null if no resource with this name is found | [
"Resolve",
"handler",
"chain",
"configuration",
"file",
"associated",
"with",
"the",
"given",
"class"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/metadata/builder/HandlerChainInfoBuilder.java#L356-L383 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/servlet/JawrBinaryResourceRequestHandler.java | JawrBinaryResourceRequestHandler.getContentType | @Override
protected String getContentType(String filePath, HttpServletRequest request) {
String requestUri = request.getRequestURI();
// Retrieve the extension
String extension = getExtension(filePath);
if (extension == null) {
LOGGER.info("No extension found for the request URI : " + requestUri);
return null;
}
String binContentType = (String) binaryMimeTypeMap.get(extension);
if (binContentType == null) {
LOGGER.info(
"No binary extension match the extension '" + extension + "' for the request URI : " + requestUri);
return null;
}
return binContentType;
} | java | @Override
protected String getContentType(String filePath, HttpServletRequest request) {
String requestUri = request.getRequestURI();
// Retrieve the extension
String extension = getExtension(filePath);
if (extension == null) {
LOGGER.info("No extension found for the request URI : " + requestUri);
return null;
}
String binContentType = (String) binaryMimeTypeMap.get(extension);
if (binContentType == null) {
LOGGER.info(
"No binary extension match the extension '" + extension + "' for the request URI : " + requestUri);
return null;
}
return binContentType;
} | [
"@",
"Override",
"protected",
"String",
"getContentType",
"(",
"String",
"filePath",
",",
"HttpServletRequest",
"request",
")",
"{",
"String",
"requestUri",
"=",
"request",
".",
"getRequestURI",
"(",
")",
";",
"// Retrieve the extension",
"String",
"extension",
"=",... | Returns the content type for the image
@param filePath
the image file path
@param request
the request
@return the content type of the image | [
"Returns",
"the",
"content",
"type",
"for",
"the",
"image"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/servlet/JawrBinaryResourceRequestHandler.java#L532-L552 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/content/PublishSetSummaryUrl.java | PublishSetSummaryUrl.deletePublishSetUrl | public static MozuUrl deletePublishSetUrl(String code, String responseFields, Boolean shouldDiscard)
{
UrlFormatter formatter = new UrlFormatter("/api/content/publishsets/{code}?shouldDiscard={shouldDiscard}&responseFields={responseFields}");
formatter.formatUrl("code", code);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("shouldDiscard", shouldDiscard);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deletePublishSetUrl(String code, String responseFields, Boolean shouldDiscard)
{
UrlFormatter formatter = new UrlFormatter("/api/content/publishsets/{code}?shouldDiscard={shouldDiscard}&responseFields={responseFields}");
formatter.formatUrl("code", code);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("shouldDiscard", shouldDiscard);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deletePublishSetUrl",
"(",
"String",
"code",
",",
"String",
"responseFields",
",",
"Boolean",
"shouldDiscard",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/content/publishsets/{code}?shouldDiscard={shouldDis... | Get Resource Url for DeletePublishSet
@param code User-defined code that uniqely identifies the channel group.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param shouldDiscard Specifies whether to discard the pending content changes assigned to the content publish set when the publish set is deleted.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeletePublishSet"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/content/PublishSetSummaryUrl.java#L61-L68 |
google/closure-templates | java/src/com/google/template/soy/data/SanitizedContents.java | SanitizedContents.pretendValidateResource | @VisibleForTesting
static void pretendValidateResource(String resourceName, ContentKind kind) {
int index = resourceName.lastIndexOf('.');
Preconditions.checkArgument(
index >= 0, "Currently, we only validate resources with explicit extensions.");
String fileExtension = resourceName.substring(index + 1).toLowerCase();
switch (kind) {
case JS:
Preconditions.checkArgument(fileExtension.equals("js"));
break;
case HTML:
Preconditions.checkArgument(SAFE_HTML_FILE_EXTENSIONS.contains(fileExtension));
break;
case CSS:
Preconditions.checkArgument(fileExtension.equals("css"));
break;
default:
throw new IllegalArgumentException("Don't know how to validate resources of kind " + kind);
}
} | java | @VisibleForTesting
static void pretendValidateResource(String resourceName, ContentKind kind) {
int index = resourceName.lastIndexOf('.');
Preconditions.checkArgument(
index >= 0, "Currently, we only validate resources with explicit extensions.");
String fileExtension = resourceName.substring(index + 1).toLowerCase();
switch (kind) {
case JS:
Preconditions.checkArgument(fileExtension.equals("js"));
break;
case HTML:
Preconditions.checkArgument(SAFE_HTML_FILE_EXTENSIONS.contains(fileExtension));
break;
case CSS:
Preconditions.checkArgument(fileExtension.equals("css"));
break;
default:
throw new IllegalArgumentException("Don't know how to validate resources of kind " + kind);
}
} | [
"@",
"VisibleForTesting",
"static",
"void",
"pretendValidateResource",
"(",
"String",
"resourceName",
",",
"ContentKind",
"kind",
")",
"{",
"int",
"index",
"=",
"resourceName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"Preconditions",
".",
"checkArgument",
"... | Very basic but strict validation that the resource's extension matches the content kind.
<p>In practice, this may be unnecessary, but it's always good to start out strict. This list
can either be expanded as needed, or removed if too onerous. | [
"Very",
"basic",
"but",
"strict",
"validation",
"that",
"the",
"resource",
"s",
"extension",
"matches",
"the",
"content",
"kind",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SanitizedContents.java#L352-L372 |
elki-project/elki | addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/util/XSplitter.java | XSplitter.topologicalSplit | public SplitSorting topologicalSplit() {
if(node.getNumEntries() < 2) {
throw new IllegalArgumentException("Splitting less than two entries is pointless.");
}
int minEntries = (node.getEntry(0) instanceof LeafEntry ? tree.getLeafMinimum() : tree.getDirMinimum());
int maxEntries = (node.getEntry(0) instanceof LeafEntry ? tree.getLeafCapacity() - 1 : tree.getDirCapacity() - 1);
if(node.getNumEntries() < maxEntries) {
throw new IllegalArgumentException("This entry list has not yet reached the maximum limit: " + node.getNumEntries() + "<=" + maxEntries);
}
maxEntries = maxEntries + 1 - minEntries;
chooseSplitAxis(new IntegerRangeIterator(0, node.getEntry(0).getDimensionality()), minEntries, maxEntries);
return chooseMinimumOverlapSplit(splitAxis, minEntries, maxEntries, false);
} | java | public SplitSorting topologicalSplit() {
if(node.getNumEntries() < 2) {
throw new IllegalArgumentException("Splitting less than two entries is pointless.");
}
int minEntries = (node.getEntry(0) instanceof LeafEntry ? tree.getLeafMinimum() : tree.getDirMinimum());
int maxEntries = (node.getEntry(0) instanceof LeafEntry ? tree.getLeafCapacity() - 1 : tree.getDirCapacity() - 1);
if(node.getNumEntries() < maxEntries) {
throw new IllegalArgumentException("This entry list has not yet reached the maximum limit: " + node.getNumEntries() + "<=" + maxEntries);
}
maxEntries = maxEntries + 1 - minEntries;
chooseSplitAxis(new IntegerRangeIterator(0, node.getEntry(0).getDimensionality()), minEntries, maxEntries);
return chooseMinimumOverlapSplit(splitAxis, minEntries, maxEntries, false);
} | [
"public",
"SplitSorting",
"topologicalSplit",
"(",
")",
"{",
"if",
"(",
"node",
".",
"getNumEntries",
"(",
")",
"<",
"2",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Splitting less than two entries is pointless.\"",
")",
";",
"}",
"int",
"minEntr... | Perform a topological (R*-Tree) split of a list of node entries.
<p>
Only distributions that have between <code>m</code> and <code>M-m+1</code>
entries in the first group will be tested.
@return chosen split distribution; note that this method returns null, if
the minimum overlap split has a volume which is larger than the
allowed <code>maxOverlap</code> ratio of #tree | [
"Perform",
"a",
"topological",
"(",
"R",
"*",
"-",
"Tree",
")",
"split",
"of",
"a",
"list",
"of",
"node",
"entries",
".",
"<p",
">",
"Only",
"distributions",
"that",
"have",
"between",
"<code",
">",
"m<",
"/",
"code",
">",
"and",
"<code",
">",
"M",
... | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/util/XSplitter.java#L699-L713 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_storage_containerId_publicUrl_POST | public OvhContainerObjectTempURL project_serviceName_storage_containerId_publicUrl_POST(String serviceName, String containerId, Date expirationDate, String objectName) throws IOException {
String qPath = "/cloud/project/{serviceName}/storage/{containerId}/publicUrl";
StringBuilder sb = path(qPath, serviceName, containerId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "expirationDate", expirationDate);
addBody(o, "objectName", objectName);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhContainerObjectTempURL.class);
} | java | public OvhContainerObjectTempURL project_serviceName_storage_containerId_publicUrl_POST(String serviceName, String containerId, Date expirationDate, String objectName) throws IOException {
String qPath = "/cloud/project/{serviceName}/storage/{containerId}/publicUrl";
StringBuilder sb = path(qPath, serviceName, containerId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "expirationDate", expirationDate);
addBody(o, "objectName", objectName);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhContainerObjectTempURL.class);
} | [
"public",
"OvhContainerObjectTempURL",
"project_serviceName_storage_containerId_publicUrl_POST",
"(",
"String",
"serviceName",
",",
"String",
"containerId",
",",
"Date",
"expirationDate",
",",
"String",
"objectName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"="... | Get a public temporary URL to access to one of your object
REST: POST /cloud/project/{serviceName}/storage/{containerId}/publicUrl
@param containerId [required] Container ID
@param expirationDate [required] Temporary URL expiration
@param objectName [required] Object name
@param serviceName [required] Service name | [
"Get",
"a",
"public",
"temporary",
"URL",
"to",
"access",
"to",
"one",
"of",
"your",
"object"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L589-L597 |
sgroschupf/zkclient | src/main/java/org/I0Itec/zkclient/ZkClient.java | ZkClient.setAcl | public void setAcl(final String path, final List<ACL> acl) throws ZkException {
if (path == null) {
throw new NullPointerException("Missing value for path");
}
if (acl == null || acl.size() == 0) {
throw new NullPointerException("Missing value for ACL");
}
if (!exists(path)) {
throw new RuntimeException("trying to set acls on non existing node " + path);
}
retryUntilConnected(new Callable<Void>() {
@Override
public Void call() throws Exception {
Stat stat = new Stat();
_connection.readData(path, stat, false);
_connection.setAcl(path, acl, stat.getAversion());
return null;
}
});
} | java | public void setAcl(final String path, final List<ACL> acl) throws ZkException {
if (path == null) {
throw new NullPointerException("Missing value for path");
}
if (acl == null || acl.size() == 0) {
throw new NullPointerException("Missing value for ACL");
}
if (!exists(path)) {
throw new RuntimeException("trying to set acls on non existing node " + path);
}
retryUntilConnected(new Callable<Void>() {
@Override
public Void call() throws Exception {
Stat stat = new Stat();
_connection.readData(path, stat, false);
_connection.setAcl(path, acl, stat.getAversion());
return null;
}
});
} | [
"public",
"void",
"setAcl",
"(",
"final",
"String",
"path",
",",
"final",
"List",
"<",
"ACL",
">",
"acl",
")",
"throws",
"ZkException",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Missing value for path\"",... | Sets the acl on path
@param path
@param acl
List of ACL permissions to assign to the path.
@throws ZkException
if any ZooKeeper exception occurred
@throws RuntimeException
if any other exception occurs | [
"Sets",
"the",
"acl",
"on",
"path"
] | train | https://github.com/sgroschupf/zkclient/blob/03ccf12c70aca2f771bfcd94d44dc7c4d4a1495e/src/main/java/org/I0Itec/zkclient/ZkClient.java#L320-L342 |
bignerdranch/expandable-recycler-view | expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java | ExpandableRecyclerAdapter.updateCollapsedParent | @UiThread
private void updateCollapsedParent(@NonNull ExpandableWrapper<P, C> parentWrapper, int flatParentPosition, boolean collapseTriggeredByListItemClick) {
if (!parentWrapper.isExpanded()) {
return;
}
parentWrapper.setExpanded(false);
mExpansionStateMap.put(parentWrapper.getParent(), false);
List<ExpandableWrapper<P, C>> wrappedChildList = parentWrapper.getWrappedChildList();
if (wrappedChildList != null) {
int childCount = wrappedChildList.size();
for (int i = childCount - 1; i >= 0; i--) {
mFlatItemList.remove(flatParentPosition + i + 1);
}
notifyItemRangeRemoved(flatParentPosition + 1, childCount);
}
if (collapseTriggeredByListItemClick && mExpandCollapseListener != null) {
mExpandCollapseListener.onParentCollapsed(getNearestParentPosition(flatParentPosition));
}
} | java | @UiThread
private void updateCollapsedParent(@NonNull ExpandableWrapper<P, C> parentWrapper, int flatParentPosition, boolean collapseTriggeredByListItemClick) {
if (!parentWrapper.isExpanded()) {
return;
}
parentWrapper.setExpanded(false);
mExpansionStateMap.put(parentWrapper.getParent(), false);
List<ExpandableWrapper<P, C>> wrappedChildList = parentWrapper.getWrappedChildList();
if (wrappedChildList != null) {
int childCount = wrappedChildList.size();
for (int i = childCount - 1; i >= 0; i--) {
mFlatItemList.remove(flatParentPosition + i + 1);
}
notifyItemRangeRemoved(flatParentPosition + 1, childCount);
}
if (collapseTriggeredByListItemClick && mExpandCollapseListener != null) {
mExpandCollapseListener.onParentCollapsed(getNearestParentPosition(flatParentPosition));
}
} | [
"@",
"UiThread",
"private",
"void",
"updateCollapsedParent",
"(",
"@",
"NonNull",
"ExpandableWrapper",
"<",
"P",
",",
"C",
">",
"parentWrapper",
",",
"int",
"flatParentPosition",
",",
"boolean",
"collapseTriggeredByListItemClick",
")",
"{",
"if",
"(",
"!",
"parent... | Collapses a specified parent item. Calls through to the
ExpandCollapseListener and removes children of the specified parent from the
flat list of items.
@param parentWrapper The ExpandableWrapper of the parent to collapse
@param flatParentPosition The index of the parent to collapse
@param collapseTriggeredByListItemClick true if expansion was triggered
by a click event, false otherwise. | [
"Collapses",
"a",
"specified",
"parent",
"item",
".",
"Calls",
"through",
"to",
"the",
"ExpandCollapseListener",
"and",
"removes",
"children",
"of",
"the",
"specified",
"parent",
"from",
"the",
"flat",
"list",
"of",
"items",
"."
] | train | https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L728-L750 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/protocol/LayoutVersion.java | LayoutVersion.supports | public static boolean supports(final Feature f, final int lv) {
final EnumSet<Feature> set = map.get(lv);
return set != null && set.contains(f);
} | java | public static boolean supports(final Feature f, final int lv) {
final EnumSet<Feature> set = map.get(lv);
return set != null && set.contains(f);
} | [
"public",
"static",
"boolean",
"supports",
"(",
"final",
"Feature",
"f",
",",
"final",
"int",
"lv",
")",
"{",
"final",
"EnumSet",
"<",
"Feature",
">",
"set",
"=",
"map",
".",
"get",
"(",
"lv",
")",
";",
"return",
"set",
"!=",
"null",
"&&",
"set",
"... | Returns true if a given feature is supported in the given layout version
@param f Feature
@param lv LayoutVersion
@return true if {@code f} is supported in layout version {@code lv} | [
"Returns",
"true",
"if",
"a",
"given",
"feature",
"is",
"supported",
"in",
"the",
"given",
"layout",
"version"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/protocol/LayoutVersion.java#L181-L184 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixNoViableAlternativeAtKeyword | @Fix(SyntaxIssueCodes.USED_RESERVED_KEYWORD)
public void fixNoViableAlternativeAtKeyword(final Issue issue, IssueResolutionAcceptor acceptor) {
ProtectKeywordModification.accept(this, issue, acceptor);
} | java | @Fix(SyntaxIssueCodes.USED_RESERVED_KEYWORD)
public void fixNoViableAlternativeAtKeyword(final Issue issue, IssueResolutionAcceptor acceptor) {
ProtectKeywordModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"SyntaxIssueCodes",
".",
"USED_RESERVED_KEYWORD",
")",
"public",
"void",
"fixNoViableAlternativeAtKeyword",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"ProtectKeywordModification",
".",
"accept",
"(",
"this",
... | Quick fix for the no viable alternative at an input that is a SARL keyword.
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"the",
"no",
"viable",
"alternative",
"at",
"an",
"input",
"that",
"is",
"a",
"SARL",
"keyword",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L964-L967 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java | PropertiesConfigHelper.getBooleanValue | public static boolean getBooleanValue(Properties prop, String name, boolean defaultValue) {
String strProp = prop.getProperty(name, Boolean.toString(defaultValue));
return Boolean.valueOf(strProp);
} | java | public static boolean getBooleanValue(Properties prop, String name, boolean defaultValue) {
String strProp = prop.getProperty(name, Boolean.toString(defaultValue));
return Boolean.valueOf(strProp);
} | [
"public",
"static",
"boolean",
"getBooleanValue",
"(",
"Properties",
"prop",
",",
"String",
"name",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"strProp",
"=",
"prop",
".",
"getProperty",
"(",
"name",
",",
"Boolean",
".",
"toString",
"(",
"defaultValue... | Returns the boolean value of a property
@param prop
the properties
@param name
the name of the property
@param defaultValue
the default value
@return false; | [
"Returns",
"the",
"boolean",
"value",
"of",
"a",
"property"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java#L386-L389 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataHasValueImpl_CustomFieldSerializer.java | OWLDataHasValueImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLDataHasValueImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLDataHasValueImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLDataHasValueImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
] | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataHasValueImpl_CustomFieldSerializer.java#L72-L75 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.management.j2ee/src/com/ibm/ws/jca/management/j2ee/internal/ResourceAdapterModuleMBeanImpl.java | ResourceAdapterModuleMBeanImpl.setResourceAdapterChild | protected ResourceAdapterMBeanImpl setResourceAdapterChild(String key, ResourceAdapterMBeanImpl ra) {
return raMBeanChildrenList.put(key, ra);
} | java | protected ResourceAdapterMBeanImpl setResourceAdapterChild(String key, ResourceAdapterMBeanImpl ra) {
return raMBeanChildrenList.put(key, ra);
} | [
"protected",
"ResourceAdapterMBeanImpl",
"setResourceAdapterChild",
"(",
"String",
"key",
",",
"ResourceAdapterMBeanImpl",
"ra",
")",
"{",
"return",
"raMBeanChildrenList",
".",
"put",
"(",
"key",
",",
"ra",
")",
";",
"}"
] | setResourceAdapterChild add a child of type ResourceAdapterMBeanImpl to this MBean.
@param key the String value which will be used as the key for the ResourceAdapterMBeanImpl item
@param ra the ResourceAdapterMBeanImpl value to be associated with the specified key
@return The previous value associated with key, or null if there was no mapping for key.
(A null return can also indicate that the map previously associated null with key.) | [
"setResourceAdapterChild",
"add",
"a",
"child",
"of",
"type",
"ResourceAdapterMBeanImpl",
"to",
"this",
"MBean",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.management.j2ee/src/com/ibm/ws/jca/management/j2ee/internal/ResourceAdapterModuleMBeanImpl.java#L367-L369 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/xml/pom/Model.java | Model.interpolateString | public static String interpolateString(String text, Properties properties) {
if (null == text || null == properties) {
return text;
}
final StringSubstitutor substitutor = new StringSubstitutor(new PropertyLookup(properties));
return substitutor.replace(text);
} | java | public static String interpolateString(String text, Properties properties) {
if (null == text || null == properties) {
return text;
}
final StringSubstitutor substitutor = new StringSubstitutor(new PropertyLookup(properties));
return substitutor.replace(text);
} | [
"public",
"static",
"String",
"interpolateString",
"(",
"String",
"text",
",",
"Properties",
"properties",
")",
"{",
"if",
"(",
"null",
"==",
"text",
"||",
"null",
"==",
"properties",
")",
"{",
"return",
"text",
";",
"}",
"final",
"StringSubstitutor",
"subst... | <p>
A utility function that will interpolate strings based on values given in
the properties file. It will also interpolate the strings contained
within the properties file so that properties can reference other
properties.</p>
<p>
<b>Note:</b> if there is no property found the reference will be removed.
In other words, if the interpolated string will be replaced with an empty
string.
</p>
<p>
Example:</p>
<code>
Properties p = new Properties();
p.setProperty("key", "value");
String s = interpolateString("'${key}' and '${nothing}'", p);
System.out.println(s);
</code>
<p>
Will result in:</p>
<code>
'value' and ''
</code>
@param text the string that contains references to properties.
@param properties a collection of properties that may be referenced
within the text.
@return the interpolated text. | [
"<p",
">",
"A",
"utility",
"function",
"that",
"will",
"interpolate",
"strings",
"based",
"on",
"values",
"given",
"in",
"the",
"properties",
"file",
".",
"It",
"will",
"also",
"interpolate",
"the",
"strings",
"contained",
"within",
"the",
"properties",
"file"... | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/pom/Model.java#L353-L359 |
joniles/mpxj | src/main/java/net/sf/mpxj/RecurringData.java | RecurringData.getYearlyAbsoluteDates | private void getYearlyAbsoluteDates(Calendar calendar, List<Date> dates)
{
long startDate = calendar.getTimeInMillis();
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.MONTH, NumberHelper.getInt(m_monthNumber) - 1);
int requiredDayNumber = NumberHelper.getInt(m_dayNumber);
while (moreDates(calendar, dates))
{
int useDayNumber = requiredDayNumber;
int maxDayNumber = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
if (useDayNumber > maxDayNumber)
{
useDayNumber = maxDayNumber;
}
calendar.set(Calendar.DAY_OF_MONTH, useDayNumber);
if (calendar.getTimeInMillis() < startDate)
{
calendar.add(Calendar.YEAR, 1);
}
dates.add(calendar.getTime());
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.add(Calendar.YEAR, 1);
}
} | java | private void getYearlyAbsoluteDates(Calendar calendar, List<Date> dates)
{
long startDate = calendar.getTimeInMillis();
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.MONTH, NumberHelper.getInt(m_monthNumber) - 1);
int requiredDayNumber = NumberHelper.getInt(m_dayNumber);
while (moreDates(calendar, dates))
{
int useDayNumber = requiredDayNumber;
int maxDayNumber = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
if (useDayNumber > maxDayNumber)
{
useDayNumber = maxDayNumber;
}
calendar.set(Calendar.DAY_OF_MONTH, useDayNumber);
if (calendar.getTimeInMillis() < startDate)
{
calendar.add(Calendar.YEAR, 1);
}
dates.add(calendar.getTime());
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.add(Calendar.YEAR, 1);
}
} | [
"private",
"void",
"getYearlyAbsoluteDates",
"(",
"Calendar",
"calendar",
",",
"List",
"<",
"Date",
">",
"dates",
")",
"{",
"long",
"startDate",
"=",
"calendar",
".",
"getTimeInMillis",
"(",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"DAY_OF_MON... | Calculate start dates for a yearly absolute recurrence.
@param calendar current date
@param dates array of start dates | [
"Calculate",
"start",
"dates",
"for",
"a",
"yearly",
"absolute",
"recurrence",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L606-L632 |
jparsec/jparsec | jparsec/src/main/java/org/jparsec/pattern/Patterns.java | Patterns.many | public static Pattern many(final CharPredicate predicate) {
return new Pattern() {
@Override public int match(CharSequence src, int begin, int end) {
return matchMany(predicate, src, end, begin, 0);
}
@Override public String toString() {
return predicate + "*";
}
};
} | java | public static Pattern many(final CharPredicate predicate) {
return new Pattern() {
@Override public int match(CharSequence src, int begin, int end) {
return matchMany(predicate, src, end, begin, 0);
}
@Override public String toString() {
return predicate + "*";
}
};
} | [
"public",
"static",
"Pattern",
"many",
"(",
"final",
"CharPredicate",
"predicate",
")",
"{",
"return",
"new",
"Pattern",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"match",
"(",
"CharSequence",
"src",
",",
"int",
"begin",
",",
"int",
"end",
")",
"{... | Returns a {@link Pattern} that matches 0 or more characters satisfying {@code predicate}. | [
"Returns",
"a",
"{"
] | train | https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/pattern/Patterns.java#L384-L393 |
finmath/finmath-lib | src/main/java/net/finmath/time/ScheduleGenerator.java | ScheduleGenerator.createScheduleFromConventions | public static Schedule createScheduleFromConventions(
LocalDate referenceDate,
LocalDate tradeDate,
int spotOffsetDays,
String startOffsetString,
String maturityString,
String frequency,
String daycountConvention,
String shortPeriodConvention,
String dateRollConvention,
BusinessdayCalendar businessdayCalendar,
int fixingOffsetDays,
int paymentOffsetDays
)
{
LocalDate spotDate = businessdayCalendar.getRolledDate(tradeDate, spotOffsetDays);
LocalDate startDate = businessdayCalendar.getDateFromDateAndOffsetCode(spotDate, startOffsetString);
LocalDate maturityDate = businessdayCalendar.getDateFromDateAndOffsetCode(startDate, maturityString);
return createScheduleFromConventions(referenceDate, startDate, maturityDate, frequency, daycountConvention, shortPeriodConvention, dateRollConvention, businessdayCalendar, fixingOffsetDays, paymentOffsetDays);
} | java | public static Schedule createScheduleFromConventions(
LocalDate referenceDate,
LocalDate tradeDate,
int spotOffsetDays,
String startOffsetString,
String maturityString,
String frequency,
String daycountConvention,
String shortPeriodConvention,
String dateRollConvention,
BusinessdayCalendar businessdayCalendar,
int fixingOffsetDays,
int paymentOffsetDays
)
{
LocalDate spotDate = businessdayCalendar.getRolledDate(tradeDate, spotOffsetDays);
LocalDate startDate = businessdayCalendar.getDateFromDateAndOffsetCode(spotDate, startOffsetString);
LocalDate maturityDate = businessdayCalendar.getDateFromDateAndOffsetCode(startDate, maturityString);
return createScheduleFromConventions(referenceDate, startDate, maturityDate, frequency, daycountConvention, shortPeriodConvention, dateRollConvention, businessdayCalendar, fixingOffsetDays, paymentOffsetDays);
} | [
"public",
"static",
"Schedule",
"createScheduleFromConventions",
"(",
"LocalDate",
"referenceDate",
",",
"LocalDate",
"tradeDate",
",",
"int",
"spotOffsetDays",
",",
"String",
"startOffsetString",
",",
"String",
"maturityString",
",",
"String",
"frequency",
",",
"String... | Simple schedule generation where startDate and maturityDate are calculated based on tradeDate, spotOffsetDays, startOffsetString and maturityString.
The schedule generation considers short periods. Date rolling is ignored.
@param referenceDate The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
@param tradeDate Base date for the schedule generation (used to build spot date).
@param spotOffsetDays Number of business days to be added to the trade date to obtain the spot date.
@param startOffsetString The start date as an offset from the spotDate (build from tradeDate and spotOffsetDays) entered as a code like 1D, 1W, 1M, 2M, 3M, 1Y, etc.
@param maturityString The end date of the last period entered as a code like 1D, 1W, 1M, 2M, 3M, 1Y, etc.
@param frequency The frequency (as String).
@param daycountConvention The daycount convention (as String).
@param shortPeriodConvention If short period exists, have it first or last (as String).
@param dateRollConvention Adjustment to be applied to the all dates (as String).
@param businessdayCalendar Business day calendar (holiday calendar) to be used for date roll adjustment.
@param fixingOffsetDays Number of business days to be added to period start to get the fixing date.
@param paymentOffsetDays Number of business days to be added to period end to get the payment date.
@return The corresponding schedule | [
"Simple",
"schedule",
"generation",
"where",
"startDate",
"and",
"maturityDate",
"are",
"calculated",
"based",
"on",
"tradeDate",
"spotOffsetDays",
"startOffsetString",
"and",
"maturityString",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/ScheduleGenerator.java#L520-L540 |
jhunters/jprotobuf | v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java | CodedConstant.computeListSize | public static int computeListSize(int order, List<?> list, FieldType type, boolean debug, File path) {
return computeListSize(order, list, type, debug, path, false, false);
} | java | public static int computeListSize(int order, List<?> list, FieldType type, boolean debug, File path) {
return computeListSize(order, list, type, debug, path, false, false);
} | [
"public",
"static",
"int",
"computeListSize",
"(",
"int",
"order",
",",
"List",
"<",
"?",
">",
"list",
",",
"FieldType",
"type",
",",
"boolean",
"debug",
",",
"File",
"path",
")",
"{",
"return",
"computeListSize",
"(",
"order",
",",
"list",
",",
"type",
... | Compute list size.
@param order field order
@param list field value
@param type field type of list obj
@param debug the debug
@param path the path
@return full java expression | [
"Compute",
"list",
"size",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java#L357-L359 |
hawkular/hawkular-commons | hawkular-bus/hawkular-bus-rest-client/src/main/java/org/hawkular/bus/restclient/RestClient.java | RestClient.postQueueMessage | public HttpResponse postQueueMessage(String queueName, String jsonPayload, Map<String, String> headers)
throws RestClientException {
return postMessage(Type.QUEUE, queueName, jsonPayload, headers);
} | java | public HttpResponse postQueueMessage(String queueName, String jsonPayload, Map<String, String> headers)
throws RestClientException {
return postMessage(Type.QUEUE, queueName, jsonPayload, headers);
} | [
"public",
"HttpResponse",
"postQueueMessage",
"(",
"String",
"queueName",
",",
"String",
"jsonPayload",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"throws",
"RestClientException",
"{",
"return",
"postMessage",
"(",
"Type",
".",
"QUEUE",
",",
... | Sends a message to the REST endpoint in order to put a message on the given queue.
@param queueName name of the queue
@param jsonPayload the actual message (as a JSON string) to put on the bus
@param headers any headers to send with the message (can be null or empty)
@return the response
@throws RestClientException if the response was not a 200 status code | [
"Sends",
"a",
"message",
"to",
"the",
"REST",
"endpoint",
"in",
"order",
"to",
"put",
"a",
"message",
"on",
"the",
"given",
"queue",
"."
] | train | https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-rest-client/src/main/java/org/hawkular/bus/restclient/RestClient.java#L143-L146 |
centic9/commons-dost | src/main/java/org/dstadler/commons/net/UrlUtils.java | UrlUtils.isAvailable | public static boolean isAvailable(String destinationUrl, boolean fireRequest, int timeout) throws IllegalArgumentException {
return isAvailable(destinationUrl, fireRequest, false, timeout);
} | java | public static boolean isAvailable(String destinationUrl, boolean fireRequest, int timeout) throws IllegalArgumentException {
return isAvailable(destinationUrl, fireRequest, false, timeout);
} | [
"public",
"static",
"boolean",
"isAvailable",
"(",
"String",
"destinationUrl",
",",
"boolean",
"fireRequest",
",",
"int",
"timeout",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"isAvailable",
"(",
"destinationUrl",
",",
"fireRequest",
",",
"false",
","... | Check if the HTTP resource specified by the destination URL is available.
@param destinationUrl the destination URL to check for availability
@param fireRequest if true a request will be sent to the given URL in addition to opening the
connection
@param timeout Timeout in milliseconds after which the call fails because of timeout.
@return <code>true</code> if a connection could be set up and the response was received
@throws IllegalArgumentException if the destination URL is invalid | [
"Check",
"if",
"the",
"HTTP",
"resource",
"specified",
"by",
"the",
"destination",
"URL",
"is",
"available",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/net/UrlUtils.java#L324-L326 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/converter/avro/AvroToAvroCopyableConverter.java | AvroToAvroCopyableConverter.convertSchema | @Override
public CopyableSchema convertSchema(Schema inputSchema, WorkUnitState workUnit) throws SchemaConversionException {
return new CopyableSchema(inputSchema);
} | java | @Override
public CopyableSchema convertSchema(Schema inputSchema, WorkUnitState workUnit) throws SchemaConversionException {
return new CopyableSchema(inputSchema);
} | [
"@",
"Override",
"public",
"CopyableSchema",
"convertSchema",
"(",
"Schema",
"inputSchema",
",",
"WorkUnitState",
"workUnit",
")",
"throws",
"SchemaConversionException",
"{",
"return",
"new",
"CopyableSchema",
"(",
"inputSchema",
")",
";",
"}"
] | Returns a {@link org.apache.gobblin.fork.CopyableSchema} wrapper around the given {@link Schema}.
{@inheritDoc}
@see org.apache.gobblin.converter.Converter#convertSchema(java.lang.Object, org.apache.gobblin.configuration.WorkUnitState) | [
"Returns",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/converter/avro/AvroToAvroCopyableConverter.java#L44-L47 |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/pod/ServiceRefPod.java | ServiceRefPod.getLocalService | public ServiceRefAmp getLocalService()
{
ServiceRefAmp serviceRefRoot = _podRoot.getLocalService();
//ServiceRefAmp serviceRefRoot = _podRoot.getClientService();
if (serviceRefRoot == null) {
return null;
}
ServiceRefActive serviceRefLocal = _serviceRefLocal;
if (serviceRefLocal != null) {
ServiceRefAmp serviceRef = serviceRefLocal.getService(serviceRefRoot);
if (serviceRef != null) {
return serviceRef;
}
}
ServiceRefAmp serviceRef = serviceRefRoot.onLookup(_path);
_serviceRefLocal = new ServiceRefActive(serviceRefRoot, serviceRef);
// serviceRef.start();
return serviceRef;
} | java | public ServiceRefAmp getLocalService()
{
ServiceRefAmp serviceRefRoot = _podRoot.getLocalService();
//ServiceRefAmp serviceRefRoot = _podRoot.getClientService();
if (serviceRefRoot == null) {
return null;
}
ServiceRefActive serviceRefLocal = _serviceRefLocal;
if (serviceRefLocal != null) {
ServiceRefAmp serviceRef = serviceRefLocal.getService(serviceRefRoot);
if (serviceRef != null) {
return serviceRef;
}
}
ServiceRefAmp serviceRef = serviceRefRoot.onLookup(_path);
_serviceRefLocal = new ServiceRefActive(serviceRefRoot, serviceRef);
// serviceRef.start();
return serviceRef;
} | [
"public",
"ServiceRefAmp",
"getLocalService",
"(",
")",
"{",
"ServiceRefAmp",
"serviceRefRoot",
"=",
"_podRoot",
".",
"getLocalService",
"(",
")",
";",
"//ServiceRefAmp serviceRefRoot = _podRoot.getClientService();",
"if",
"(",
"serviceRefRoot",
"==",
"null",
")",
"{",
... | Returns the active service for this pod and path's hash.
The hash of the path selects the pod's node. The active server is the
first server in the node's server list that is up. | [
"Returns",
"the",
"active",
"service",
"for",
"this",
"pod",
"and",
"path",
"s",
"hash",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/pod/ServiceRefPod.java#L239-L265 |
apache/groovy | subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java | SwingGroovyMethods.putAt | public static void putAt(MutableComboBoxModel self, int index, Object i) {
self.insertElementAt(i, index);
} | java | public static void putAt(MutableComboBoxModel self, int index, Object i) {
self.insertElementAt(i, index);
} | [
"public",
"static",
"void",
"putAt",
"(",
"MutableComboBoxModel",
"self",
",",
"int",
"index",
",",
"Object",
"i",
")",
"{",
"self",
".",
"insertElementAt",
"(",
"i",
",",
"index",
")",
";",
"}"
] | Allow MutableComboBoxModel to work with subscript operators.<p>
<b>WARNING:</b> this operation does not replace the item at the
specified index, rather it inserts the item at that index, thus
increasing the size of the model by 1.
@param self a MutableComboBoxModel
@param index an index
@param i the item to insert at the given index
@since 1.6.4 | [
"Allow",
"MutableComboBoxModel",
"to",
"work",
"with",
"subscript",
"operators",
".",
"<p",
">",
"<b",
">",
"WARNING",
":",
"<",
"/",
"b",
">",
"this",
"operation",
"does",
"not",
"replace",
"the",
"item",
"at",
"the",
"specified",
"index",
"rather",
"it",... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L352-L354 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java | AbstractBeanDefinition.getBeansOfTypeForMethodArgument | @SuppressWarnings("WeakerAccess")
@Internal
protected final Collection getBeansOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, MethodInjectionPoint injectionPoint, Argument argument) {
return resolveBeanWithGenericsFromMethodArgument(resolutionContext, injectionPoint, argument, (beanType, qualifier) -> {
boolean hasNoGenerics = !argument.getType().isArray() && argument.getTypeVariables().isEmpty();
if (hasNoGenerics) {
return ((DefaultBeanContext) context).getBean(resolutionContext, beanType, qualifier);
} else {
return ((DefaultBeanContext) context).getBeansOfType(resolutionContext, beanType, qualifier);
}
}
);
} | java | @SuppressWarnings("WeakerAccess")
@Internal
protected final Collection getBeansOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, MethodInjectionPoint injectionPoint, Argument argument) {
return resolveBeanWithGenericsFromMethodArgument(resolutionContext, injectionPoint, argument, (beanType, qualifier) -> {
boolean hasNoGenerics = !argument.getType().isArray() && argument.getTypeVariables().isEmpty();
if (hasNoGenerics) {
return ((DefaultBeanContext) context).getBean(resolutionContext, beanType, qualifier);
} else {
return ((DefaultBeanContext) context).getBeansOfType(resolutionContext, beanType, qualifier);
}
}
);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"@",
"Internal",
"protected",
"final",
"Collection",
"getBeansOfTypeForMethodArgument",
"(",
"BeanResolutionContext",
"resolutionContext",
",",
"BeanContext",
"context",
",",
"MethodInjectionPoint",
"injectionPoint",
",",... | Obtains all bean definitions for the method at the given index and the argument at the given index
<p>
Warning: this method is used by internal generated code and should not be called by user code.
@param resolutionContext The resolution context
@param context The context
@param injectionPoint The method injection point
@param argument The argument
@return The resolved bean | [
"Obtains",
"all",
"bean",
"definitions",
"for",
"the",
"method",
"at",
"the",
"given",
"index",
"and",
"the",
"argument",
"at",
"the",
"given",
"index",
"<p",
">",
"Warning",
":",
"this",
"method",
"is",
"used",
"by",
"internal",
"generated",
"code",
"and"... | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L863-L876 |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseScsr2gebsr_bufferSize | public static int cusparseScsr2gebsr_bufferSize(
cusparseHandle handle,
int dirA,
int m,
int n,
cusparseMatDescr descrA,
Pointer csrSortedValA,
Pointer csrSortedRowPtrA,
Pointer csrSortedColIndA,
int rowBlockDim,
int colBlockDim,
int[] pBufferSizeInBytes)
{
return checkResult(cusparseScsr2gebsr_bufferSizeNative(handle, dirA, m, n, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, rowBlockDim, colBlockDim, pBufferSizeInBytes));
} | java | public static int cusparseScsr2gebsr_bufferSize(
cusparseHandle handle,
int dirA,
int m,
int n,
cusparseMatDescr descrA,
Pointer csrSortedValA,
Pointer csrSortedRowPtrA,
Pointer csrSortedColIndA,
int rowBlockDim,
int colBlockDim,
int[] pBufferSizeInBytes)
{
return checkResult(cusparseScsr2gebsr_bufferSizeNative(handle, dirA, m, n, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, rowBlockDim, colBlockDim, pBufferSizeInBytes));
} | [
"public",
"static",
"int",
"cusparseScsr2gebsr_bufferSize",
"(",
"cusparseHandle",
"handle",
",",
"int",
"dirA",
",",
"int",
"m",
",",
"int",
"n",
",",
"cusparseMatDescr",
"descrA",
",",
"Pointer",
"csrSortedValA",
",",
"Pointer",
"csrSortedRowPtrA",
",",
"Pointer... | Description: This routine converts a sparse matrix in CSR storage format
to a sparse matrix in general block-CSR storage format. | [
"Description",
":",
"This",
"routine",
"converts",
"a",
"sparse",
"matrix",
"in",
"CSR",
"storage",
"format",
"to",
"a",
"sparse",
"matrix",
"in",
"general",
"block",
"-",
"CSR",
"storage",
"format",
"."
] | train | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L13199-L13213 |
mangstadt/biweekly | src/main/java/biweekly/io/TimezoneInfo.java | TimezoneInfo.setTimezone | public void setTimezone(ICalProperty property, TimezoneAssignment timezone) {
if (timezone == null) {
TimezoneAssignment existing = propertyTimezones.remove(property);
if (existing != null && existing != defaultTimezone && !propertyTimezones.values().contains(existing)) {
assignments.remove(existing);
}
return;
}
assignments.add(timezone);
propertyTimezones.put(property, timezone);
} | java | public void setTimezone(ICalProperty property, TimezoneAssignment timezone) {
if (timezone == null) {
TimezoneAssignment existing = propertyTimezones.remove(property);
if (existing != null && existing != defaultTimezone && !propertyTimezones.values().contains(existing)) {
assignments.remove(existing);
}
return;
}
assignments.add(timezone);
propertyTimezones.put(property, timezone);
} | [
"public",
"void",
"setTimezone",
"(",
"ICalProperty",
"property",
",",
"TimezoneAssignment",
"timezone",
")",
"{",
"if",
"(",
"timezone",
"==",
"null",
")",
"{",
"TimezoneAssignment",
"existing",
"=",
"propertyTimezones",
".",
"remove",
"(",
"property",
")",
";"... | Assigns a timezone to a specific property.
@param property the property
@param timezone the timezone or null to format the property according to
the default timezone (see {@link #setDefaultTimezone}). | [
"Assigns",
"a",
"timezone",
"to",
"a",
"specific",
"property",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/TimezoneInfo.java#L118-L129 |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/layer/vector/GetFeaturesStyleStep.java | GetFeaturesStyleStep.initStyleFilters | private List<StyleFilter> initStyleFilters(List<FeatureStyleInfo> styleDefinitions) throws GeomajasException {
List<StyleFilter> styleFilters = new ArrayList<StyleFilter>();
if (styleDefinitions == null || styleDefinitions.size() == 0) {
styleFilters.add(new StyleFilterImpl()); // use default.
} else {
for (FeatureStyleInfo styleDef : styleDefinitions) {
StyleFilterImpl styleFilterImpl = null;
String formula = styleDef.getFormula();
if (null != formula && formula.length() > 0) {
styleFilterImpl = new StyleFilterImpl(filterService.parseFilter(formula), styleDef);
} else {
styleFilterImpl = new StyleFilterImpl(Filter.INCLUDE, styleDef);
}
styleFilters.add(styleFilterImpl);
}
}
return styleFilters;
} | java | private List<StyleFilter> initStyleFilters(List<FeatureStyleInfo> styleDefinitions) throws GeomajasException {
List<StyleFilter> styleFilters = new ArrayList<StyleFilter>();
if (styleDefinitions == null || styleDefinitions.size() == 0) {
styleFilters.add(new StyleFilterImpl()); // use default.
} else {
for (FeatureStyleInfo styleDef : styleDefinitions) {
StyleFilterImpl styleFilterImpl = null;
String formula = styleDef.getFormula();
if (null != formula && formula.length() > 0) {
styleFilterImpl = new StyleFilterImpl(filterService.parseFilter(formula), styleDef);
} else {
styleFilterImpl = new StyleFilterImpl(Filter.INCLUDE, styleDef);
}
styleFilters.add(styleFilterImpl);
}
}
return styleFilters;
} | [
"private",
"List",
"<",
"StyleFilter",
">",
"initStyleFilters",
"(",
"List",
"<",
"FeatureStyleInfo",
">",
"styleDefinitions",
")",
"throws",
"GeomajasException",
"{",
"List",
"<",
"StyleFilter",
">",
"styleFilters",
"=",
"new",
"ArrayList",
"<",
"StyleFilter",
">... | Build list of style filters from style definitions.
@param styleDefinitions
list of style definitions
@return list of style filters
@throws GeomajasException | [
"Build",
"list",
"of",
"style",
"filters",
"from",
"style",
"definitions",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/layer/vector/GetFeaturesStyleStep.java#L87-L104 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfPKCS7.java | PdfPKCS7.setExternalDigest | public void setExternalDigest(byte digest[], byte RSAdata[], String digestEncryptionAlgorithm) {
externalDigest = digest;
externalRSAdata = RSAdata;
if (digestEncryptionAlgorithm != null) {
if (digestEncryptionAlgorithm.equals("RSA")) {
this.digestEncryptionAlgorithm = ID_RSA;
}
else if (digestEncryptionAlgorithm.equals("DSA")) {
this.digestEncryptionAlgorithm = ID_DSA;
}
else
throw new ExceptionConverter(new NoSuchAlgorithmException("Unknown Key Algorithm "+digestEncryptionAlgorithm));
}
} | java | public void setExternalDigest(byte digest[], byte RSAdata[], String digestEncryptionAlgorithm) {
externalDigest = digest;
externalRSAdata = RSAdata;
if (digestEncryptionAlgorithm != null) {
if (digestEncryptionAlgorithm.equals("RSA")) {
this.digestEncryptionAlgorithm = ID_RSA;
}
else if (digestEncryptionAlgorithm.equals("DSA")) {
this.digestEncryptionAlgorithm = ID_DSA;
}
else
throw new ExceptionConverter(new NoSuchAlgorithmException("Unknown Key Algorithm "+digestEncryptionAlgorithm));
}
} | [
"public",
"void",
"setExternalDigest",
"(",
"byte",
"digest",
"[",
"]",
",",
"byte",
"RSAdata",
"[",
"]",
",",
"String",
"digestEncryptionAlgorithm",
")",
"{",
"externalDigest",
"=",
"digest",
";",
"externalRSAdata",
"=",
"RSAdata",
";",
"if",
"(",
"digestEncr... | Sets the digest/signature to an external calculated value.
@param digest the digest. This is the actual signature
@param RSAdata the extra data that goes into the data tag in PKCS#7
@param digestEncryptionAlgorithm the encryption algorithm. It may must be <CODE>null</CODE> if the <CODE>digest</CODE>
is also <CODE>null</CODE>. If the <CODE>digest</CODE> is not <CODE>null</CODE>
then it may be "RSA" or "DSA" | [
"Sets",
"the",
"digest",
"/",
"signature",
"to",
"an",
"external",
"calculated",
"value",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java#L1124-L1137 |
op4j/op4j | src/main/java/org/op4j/functions/FnString.java | FnString.isCalendar | public static final Function<String,Boolean> isCalendar(final String pattern, final Locale locale) {
return new IsCalendar(pattern, locale);
} | java | public static final Function<String,Boolean> isCalendar(final String pattern, final Locale locale) {
return new IsCalendar(pattern, locale);
} | [
"public",
"static",
"final",
"Function",
"<",
"String",
",",
"Boolean",
">",
"isCalendar",
"(",
"final",
"String",
"pattern",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"new",
"IsCalendar",
"(",
"pattern",
",",
"locale",
")",
";",
"}"
] | <p>
Checks whether the target {@link String} represents a {@link Calendar} or not.
If it returns true, {@link FnString#toCalendar(String, Locale)} can be called
safely.
</p>
<p>
Pattern format is that of <tt>java.text.SimpleDateFormat</tt>.
</p>
@param pattern the pattern to be used.
@param locale the locale which will be used for parsing month names
@return true if the target {@link String} represents a {@link Calendar},
false otherwise | [
"<p",
">",
"Checks",
"whether",
"the",
"target",
"{",
"@link",
"String",
"}",
"represents",
"a",
"{",
"@link",
"Calendar",
"}",
"or",
"not",
".",
"If",
"it",
"returns",
"true",
"{",
"@link",
"FnString#toCalendar",
"(",
"String",
"Locale",
")",
"}",
"can"... | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L1626-L1628 |
JM-Lab/utils-java9 | src/main/java/kr/jm/utils/helper/JMJson.java | JMJson.toMapList | public static List<Map<String, Object>> toMapList(
String jsonMapListString) {
return withJsonString(jsonMapListString, LIST_MAP_TYPE_REFERENCE);
} | java | public static List<Map<String, Object>> toMapList(
String jsonMapListString) {
return withJsonString(jsonMapListString, LIST_MAP_TYPE_REFERENCE);
} | [
"public",
"static",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"toMapList",
"(",
"String",
"jsonMapListString",
")",
"{",
"return",
"withJsonString",
"(",
"jsonMapListString",
",",
"LIST_MAP_TYPE_REFERENCE",
")",
";",
"}"
] | To map list list.
@param jsonMapListString the json map list string
@return the list | [
"To",
"map",
"list",
"list",
"."
] | train | https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMJson.java#L190-L193 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/reflect/TypeSystem.java | TypeSystem.parseTypeLiteral | public static IType parseTypeLiteral(String typeName) {
try {
IType type = GosuParserFactory.createParser(typeName).parseTypeLiteral(null).getType().getType();
if (type instanceof IErrorType) {
throw new RuntimeException("Type not found: " + typeName);
}
return type;
} catch (ParseResultsException e) {
throw new RuntimeException("Type not found: " + typeName, e);
}
} | java | public static IType parseTypeLiteral(String typeName) {
try {
IType type = GosuParserFactory.createParser(typeName).parseTypeLiteral(null).getType().getType();
if (type instanceof IErrorType) {
throw new RuntimeException("Type not found: " + typeName);
}
return type;
} catch (ParseResultsException e) {
throw new RuntimeException("Type not found: " + typeName, e);
}
} | [
"public",
"static",
"IType",
"parseTypeLiteral",
"(",
"String",
"typeName",
")",
"{",
"try",
"{",
"IType",
"type",
"=",
"GosuParserFactory",
".",
"createParser",
"(",
"typeName",
")",
".",
"parseTypeLiteral",
"(",
"null",
")",
".",
"getType",
"(",
")",
".",
... | Parses a type name such as Iterable<Claim>.
@param typeName the name to parse
@return the type | [
"Parses",
"a",
"type",
"name",
"such",
"as",
"Iterable<",
";",
"Claim>",
";",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/TypeSystem.java#L709-L719 |
threerings/narya | core/src/main/java/com/threerings/crowd/client/PlaceViewUtil.java | PlaceViewUtil.dispatchDidLeavePlace | public static void dispatchDidLeavePlace (Object root, PlaceObject plobj)
{
// dispatch the call on this component if it implements PlaceView
if (root instanceof PlaceView) {
try {
((PlaceView)root).didLeavePlace(plobj);
} catch (Exception e) {
log.warning("Component choked on didLeavePlace()", "component", root,
"plobj", plobj, e);
}
}
// now traverse all of this component's children
if (root instanceof Container) {
Container cont = (Container)root;
int ccount = cont.getComponentCount();
for (int ii = 0; ii < ccount; ii++) {
dispatchDidLeavePlace(cont.getComponent(ii), plobj);
}
}
} | java | public static void dispatchDidLeavePlace (Object root, PlaceObject plobj)
{
// dispatch the call on this component if it implements PlaceView
if (root instanceof PlaceView) {
try {
((PlaceView)root).didLeavePlace(plobj);
} catch (Exception e) {
log.warning("Component choked on didLeavePlace()", "component", root,
"plobj", plobj, e);
}
}
// now traverse all of this component's children
if (root instanceof Container) {
Container cont = (Container)root;
int ccount = cont.getComponentCount();
for (int ii = 0; ii < ccount; ii++) {
dispatchDidLeavePlace(cont.getComponent(ii), plobj);
}
}
} | [
"public",
"static",
"void",
"dispatchDidLeavePlace",
"(",
"Object",
"root",
",",
"PlaceObject",
"plobj",
")",
"{",
"// dispatch the call on this component if it implements PlaceView",
"if",
"(",
"root",
"instanceof",
"PlaceView",
")",
"{",
"try",
"{",
"(",
"(",
"Place... | Dispatches a call to {@link PlaceView#didLeavePlace} to all UI elements in the hierarchy
rooted at the component provided via the <code>root</code> parameter.
@param root the component at which to start traversing the UI hierarchy.
@param plobj the place object that is about to be entered. | [
"Dispatches",
"a",
"call",
"to",
"{",
"@link",
"PlaceView#didLeavePlace",
"}",
"to",
"all",
"UI",
"elements",
"in",
"the",
"hierarchy",
"rooted",
"at",
"the",
"component",
"provided",
"via",
"the",
"<code",
">",
"root<",
"/",
"code",
">",
"parameter",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/client/PlaceViewUtil.java#L73-L93 |
VoltDB/voltdb | src/frontend/org/voltdb/sysprocs/saverestore/SnapshotUtil.java | SnapshotUtil.getRealPath | public static String getRealPath(SnapshotPathType stype, String path) {
if (stype == SnapshotPathType.SNAP_CL) {
return VoltDB.instance().getCommandLogSnapshotPath();
} else if (stype == SnapshotPathType.SNAP_AUTO) {
return VoltDB.instance().getSnapshotPath();
}
return path;
} | java | public static String getRealPath(SnapshotPathType stype, String path) {
if (stype == SnapshotPathType.SNAP_CL) {
return VoltDB.instance().getCommandLogSnapshotPath();
} else if (stype == SnapshotPathType.SNAP_AUTO) {
return VoltDB.instance().getSnapshotPath();
}
return path;
} | [
"public",
"static",
"String",
"getRealPath",
"(",
"SnapshotPathType",
"stype",
",",
"String",
"path",
")",
"{",
"if",
"(",
"stype",
"==",
"SnapshotPathType",
".",
"SNAP_CL",
")",
"{",
"return",
"VoltDB",
".",
"instance",
"(",
")",
".",
"getCommandLogSnapshotPa... | Return path based on type if type is not CL or AUTO return provided path. | [
"Return",
"path",
"based",
"on",
"type",
"if",
"type",
"is",
"not",
"CL",
"or",
"AUTO",
"return",
"provided",
"path",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/saverestore/SnapshotUtil.java#L1664-L1671 |
phax/ph-oton | ph-oton-uicore/src/main/java/com/helger/photon/uicore/html/swf/HCSWFObject.java | HCSWFObject.addObjectParam | @Nonnull
public final HCSWFObject addObjectParam (@Nonnull final String sName, final String sValue)
{
if (!JSMarshaller.isJSIdentifier (sName))
throw new IllegalArgumentException ("The name '" + sName + "' is not a legal JS identifier!");
if (m_aObjectParams == null)
m_aObjectParams = new CommonsLinkedHashMap <> ();
m_aObjectParams.put (sName, sValue);
return this;
} | java | @Nonnull
public final HCSWFObject addObjectParam (@Nonnull final String sName, final String sValue)
{
if (!JSMarshaller.isJSIdentifier (sName))
throw new IllegalArgumentException ("The name '" + sName + "' is not a legal JS identifier!");
if (m_aObjectParams == null)
m_aObjectParams = new CommonsLinkedHashMap <> ();
m_aObjectParams.put (sName, sValue);
return this;
} | [
"@",
"Nonnull",
"public",
"final",
"HCSWFObject",
"addObjectParam",
"(",
"@",
"Nonnull",
"final",
"String",
"sName",
",",
"final",
"String",
"sValue",
")",
"{",
"if",
"(",
"!",
"JSMarshaller",
".",
"isJSIdentifier",
"(",
"sName",
")",
")",
"throw",
"new",
... | Add a <code>param</code> tag to the created <code>object</code> tag
@param sName
Parameter name
@param sValue
Parameter value
@return this | [
"Add",
"a",
"<code",
">",
"param<",
"/",
"code",
">",
"tag",
"to",
"the",
"created",
"<code",
">",
"object<",
"/",
"code",
">",
"tag"
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uicore/src/main/java/com/helger/photon/uicore/html/swf/HCSWFObject.java#L204-L214 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/IssuesApi.java | IssuesApi.resetSpentTime | public TimeStats resetSpentTime(Object projectIdOrPath, Integer issueIid) throws GitLabApiException {
if (issueIid == null) {
throw new RuntimeException("issue IID cannot be null");
}
Response response = post(Response.Status.OK, new GitLabApiForm().asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "reset_spent_time");
return (response.readEntity(TimeStats.class));
} | java | public TimeStats resetSpentTime(Object projectIdOrPath, Integer issueIid) throws GitLabApiException {
if (issueIid == null) {
throw new RuntimeException("issue IID cannot be null");
}
Response response = post(Response.Status.OK, new GitLabApiForm().asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "reset_spent_time");
return (response.readEntity(TimeStats.class));
} | [
"public",
"TimeStats",
"resetSpentTime",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"issueIid",
")",
"throws",
"GitLabApiException",
"{",
"if",
"(",
"issueIid",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"issue IID cannot be null\"",
"... | Resets the total spent time for this issue to 0 seconds.
<pre><code>GitLab Endpoint: POST /projects/:id/issues/:issue_iid/reset_spent_time</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param issueIid the internal ID of a project's issue
@return a TimeSTats instance
@throws GitLabApiException if any exception occurs | [
"Resets",
"the",
"total",
"spent",
"time",
"for",
"this",
"issue",
"to",
"0",
"seconds",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/IssuesApi.java#L591-L600 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java | FieldBuilder.buildSignature | public void buildSignature(XMLNode node, Content fieldDocTree) {
fieldDocTree.addContent(writer.getSignature(currentElement));
} | java | public void buildSignature(XMLNode node, Content fieldDocTree) {
fieldDocTree.addContent(writer.getSignature(currentElement));
} | [
"public",
"void",
"buildSignature",
"(",
"XMLNode",
"node",
",",
"Content",
"fieldDocTree",
")",
"{",
"fieldDocTree",
".",
"addContent",
"(",
"writer",
".",
"getSignature",
"(",
"currentElement",
")",
")",
";",
"}"
] | Build the signature.
@param node the XML element that specifies which components to document
@param fieldDocTree the content tree to which the documentation will be added | [
"Build",
"the",
"signature",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java#L163-L165 |
glyptodon/guacamole-client | guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java | StandardTokens.addStandardTokens | public static void addStandardTokens(TokenFilter filter, AuthenticatedUser user) {
// Default to the authenticated user's username for the GUAC_USERNAME
// token
filter.setToken(USERNAME_TOKEN, user.getIdentifier());
// Add tokens specific to credentials
addStandardTokens(filter, user.getCredentials());
} | java | public static void addStandardTokens(TokenFilter filter, AuthenticatedUser user) {
// Default to the authenticated user's username for the GUAC_USERNAME
// token
filter.setToken(USERNAME_TOKEN, user.getIdentifier());
// Add tokens specific to credentials
addStandardTokens(filter, user.getCredentials());
} | [
"public",
"static",
"void",
"addStandardTokens",
"(",
"TokenFilter",
"filter",
",",
"AuthenticatedUser",
"user",
")",
"{",
"// Default to the authenticated user's username for the GUAC_USERNAME",
"// token",
"filter",
".",
"setToken",
"(",
"USERNAME_TOKEN",
",",
"user",
"."... | Adds tokens which are standardized by guacamole-ext to the given
TokenFilter using the values from the given AuthenticatedUser object,
including any associated credentials. These standardized tokens include
the current username (GUAC_USERNAME), password (GUAC_PASSWORD), and the
server date and time (GUAC_DATE and GUAC_TIME respectively). If either
the username or password are not set within the given user or their
provided credentials, the corresponding token(s) will remain unset.
@param filter
The TokenFilter to add standard tokens to.
@param user
The AuthenticatedUser to use when populating the GUAC_USERNAME and
GUAC_PASSWORD tokens. | [
"Adds",
"tokens",
"which",
"are",
"standardized",
"by",
"guacamole",
"-",
"ext",
"to",
"the",
"given",
"TokenFilter",
"using",
"the",
"values",
"from",
"the",
"given",
"AuthenticatedUser",
"object",
"including",
"any",
"associated",
"credentials",
".",
"These",
... | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java#L163-L172 |
TheBlackChamber/commons-encryption | src/main/java/net/theblackchamber/crypto/util/KeystoreUtils.java | KeystoreUtils.getSecretKey | public static SecretKey getSecretKey(File keystore, String entryName,
String keyStorePassword) throws KeyStoreException,
NoSuchAlgorithmException, CertificateException,
FileNotFoundException, IOException, UnrecoverableEntryException {
KeyStore keyStore = KeyStore.getInstance("JCEKS");
FileInputStream fis = null;
if (keystore == null || !keystore.exists()
|| FileUtils.sizeOf(keystore) == 0) {
throw new FileNotFoundException();
}
if (StringUtils.isEmpty(keyStorePassword)) {
throw new KeyStoreException("No Keystore password provided.");
}
if (StringUtils.isEmpty(entryName)) {
throw new KeyStoreException("No Keystore entry name provided.");
}
fis = new FileInputStream(keystore);
return getSecretKey(fis, entryName, keyStorePassword);
} | java | public static SecretKey getSecretKey(File keystore, String entryName,
String keyStorePassword) throws KeyStoreException,
NoSuchAlgorithmException, CertificateException,
FileNotFoundException, IOException, UnrecoverableEntryException {
KeyStore keyStore = KeyStore.getInstance("JCEKS");
FileInputStream fis = null;
if (keystore == null || !keystore.exists()
|| FileUtils.sizeOf(keystore) == 0) {
throw new FileNotFoundException();
}
if (StringUtils.isEmpty(keyStorePassword)) {
throw new KeyStoreException("No Keystore password provided.");
}
if (StringUtils.isEmpty(entryName)) {
throw new KeyStoreException("No Keystore entry name provided.");
}
fis = new FileInputStream(keystore);
return getSecretKey(fis, entryName, keyStorePassword);
} | [
"public",
"static",
"SecretKey",
"getSecretKey",
"(",
"File",
"keystore",
",",
"String",
"entryName",
",",
"String",
"keyStorePassword",
")",
"throws",
"KeyStoreException",
",",
"NoSuchAlgorithmException",
",",
"CertificateException",
",",
"FileNotFoundException",
",",
... | Method which will load a secret key from disk with the specified entry
name.
@param keystore
{@link KeyStore} file to read.
@param entryName
Entry name of the key to be retrieved
@param keyStorePassword
Password used to open the {@link KeyStore}
@return
@throws KeyStoreException
@throws NoSuchAlgorithmException
@throws CertificateException
@throws FileNotFoundException
@throws IOException
@throws UnrecoverableEntryException | [
"Method",
"which",
"will",
"load",
"a",
"secret",
"key",
"from",
"disk",
"with",
"the",
"specified",
"entry",
"name",
"."
] | train | https://github.com/TheBlackChamber/commons-encryption/blob/0cbbf7c07ae3c133cc82b6dde7ab7af91ddf64d0/src/main/java/net/theblackchamber/crypto/util/KeystoreUtils.java#L132-L153 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/tools/DependencyBasisMaker.java | DependencyBasisMaker.saveSSpace | protected void saveSSpace(SemanticSpace sspace, File outputFile)
throws IOException{
BasisMapping<String, String> savedTerms = new StringBasisMapping();
for (String term : sspace.getWords())
savedTerms.getDimension(term);
ObjectOutputStream ouStream = new ObjectOutputStream(
new FileOutputStream(outputFile));
ouStream.writeObject(savedTerms);
ouStream.close();
} | java | protected void saveSSpace(SemanticSpace sspace, File outputFile)
throws IOException{
BasisMapping<String, String> savedTerms = new StringBasisMapping();
for (String term : sspace.getWords())
savedTerms.getDimension(term);
ObjectOutputStream ouStream = new ObjectOutputStream(
new FileOutputStream(outputFile));
ouStream.writeObject(savedTerms);
ouStream.close();
} | [
"protected",
"void",
"saveSSpace",
"(",
"SemanticSpace",
"sspace",
",",
"File",
"outputFile",
")",
"throws",
"IOException",
"{",
"BasisMapping",
"<",
"String",
",",
"String",
">",
"savedTerms",
"=",
"new",
"StringBasisMapping",
"(",
")",
";",
"for",
"(",
"Stri... | Saves the {@link BasisMapping} created from the {@link
OccurrenceCounter}. | [
"Saves",
"the",
"{"
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/tools/DependencyBasisMaker.java#L125-L135 |
VoltDB/voltdb | src/frontend/org/voltdb/utils/VoltTrace.java | VoltTrace.beginAsync | public static TraceEvent beginAsync(String name, Object id, Object... args) {
return new TraceEvent(TraceEventType.ASYNC_BEGIN, name, String.valueOf(id), args);
} | java | public static TraceEvent beginAsync(String name, Object id, Object... args) {
return new TraceEvent(TraceEventType.ASYNC_BEGIN, name, String.valueOf(id), args);
} | [
"public",
"static",
"TraceEvent",
"beginAsync",
"(",
"String",
"name",
",",
"Object",
"id",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"TraceEvent",
"(",
"TraceEventType",
".",
"ASYNC_BEGIN",
",",
"name",
",",
"String",
".",
"valueOf",
"(",
"... | Creates a begin async trace event. This method does not queue the
event. Call {@link TraceEventBatch#add(Supplier)} to queue the event. | [
"Creates",
"a",
"begin",
"async",
"trace",
"event",
".",
"This",
"method",
"does",
"not",
"queue",
"the",
"event",
".",
"Call",
"{"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/VoltTrace.java#L489-L491 |
alkacon/opencms-core | src/org/opencms/ui/dialogs/permissions/CmsPermissionView.java | CmsPermissionView.getCheckBoxLabel | private Label getCheckBoxLabel(Boolean value) {
String content;
if (value.booleanValue()) {
content = "<input type='checkbox' disabled='true' checked='true' />";
} else {
content = "<input type='checkbox' disabled='true' />";
}
return new Label(content, ContentMode.HTML);
} | java | private Label getCheckBoxLabel(Boolean value) {
String content;
if (value.booleanValue()) {
content = "<input type='checkbox' disabled='true' checked='true' />";
} else {
content = "<input type='checkbox' disabled='true' />";
}
return new Label(content, ContentMode.HTML);
} | [
"private",
"Label",
"getCheckBoxLabel",
"(",
"Boolean",
"value",
")",
"{",
"String",
"content",
";",
"if",
"(",
"value",
".",
"booleanValue",
"(",
")",
")",
"{",
"content",
"=",
"\"<input type='checkbox' disabled='true' checked='true' />\"",
";",
"}",
"else",
"{",... | Generates a check box label.<p>
@param value the value to display
@return the label | [
"Generates",
"a",
"check",
"box",
"label",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dialogs/permissions/CmsPermissionView.java#L553-L563 |
TNG/JGiven | jgiven-core/src/main/java/com/tngtech/jgiven/config/AbstractJGivenConfiguration.java | AbstractJGivenConfiguration.setFormatter | public <T> void setFormatter( Class<T> typeToBeFormatted, Formatter<T> formatter ) {
formatterCache.setFormatter( typeToBeFormatted, formatter );
} | java | public <T> void setFormatter( Class<T> typeToBeFormatted, Formatter<T> formatter ) {
formatterCache.setFormatter( typeToBeFormatted, formatter );
} | [
"public",
"<",
"T",
">",
"void",
"setFormatter",
"(",
"Class",
"<",
"T",
">",
"typeToBeFormatted",
",",
"Formatter",
"<",
"T",
">",
"formatter",
")",
"{",
"formatterCache",
".",
"setFormatter",
"(",
"typeToBeFormatted",
",",
"formatter",
")",
";",
"}"
] | Sets the formatter for the given type.
<p>
When choosing a formatter, JGiven will take the formatter defined for the most specific
super type of a given type.
<p>
If no formatter can be found for a type, the {@link com.tngtech.jgiven.format.DefaultFormatter} is taken.
<p>
For example,
given the following formatter are defined:
<pre>
setFormatter( Object.class, formatterA );
setFormatter( String.class, formatterB );
</pre>
When formatting a String,<br>
Then {@code formatterB} will be taken.
<p>
If formatter for multiple super types of a type are defined, but these types have no subtype relation, then an arbitrary
formatter is taken in a non-deterministic way. Thus you should avoid this situation.
<p>
For example,
given the following formatter are defined:
<pre>
setFormatter( Cloneable.class, formatterA );
setFormatter( Serializable.class, formatterB );
</pre>
When formatting a String,<br>
Then either {@code formatterA} or {@code formatterB} will be taken non-deterministically.
<p>
The order in which the formatter are defined, does not make a difference.
<p>
Note that the formatter can still be overridden by using a formatting annotation.
@param typeToBeFormatted the type for which the formatter should be defined
@param formatter the formatter to format instances of that type | [
"Sets",
"the",
"formatter",
"for",
"the",
"given",
"type",
".",
"<p",
">",
"When",
"choosing",
"a",
"formatter",
"JGiven",
"will",
"take",
"the",
"formatter",
"defined",
"for",
"the",
"most",
"specific",
"super",
"type",
"of",
"a",
"given",
"type",
".",
... | train | https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/config/AbstractJGivenConfiguration.java#L76-L78 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/github/lgooddatepicker/components/TimePicker.java | TimePicker.getBaseline | @Override
public int getBaseline(int width, int height) {
if (timeTextField.isVisible()) {
return timeTextField.getBaseline(width, height);
}
return super.getBaseline(width, height);
} | java | @Override
public int getBaseline(int width, int height) {
if (timeTextField.isVisible()) {
return timeTextField.getBaseline(width, height);
}
return super.getBaseline(width, height);
} | [
"@",
"Override",
"public",
"int",
"getBaseline",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"if",
"(",
"timeTextField",
".",
"isVisible",
"(",
")",
")",
"{",
"return",
"timeTextField",
".",
"getBaseline",
"(",
"width",
",",
"height",
")",
";",
... | getBaseline, This returns the baseline value of the timeTextField. | [
"getBaseline",
"This",
"returns",
"the",
"baseline",
"value",
"of",
"the",
"timeTextField",
"."
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/TimePicker.java#L260-L266 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RepositoryReaderImpl.java | RepositoryReaderImpl.getLogListForServerInstance | public ServerInstanceLogRecordList getLogListForServerInstance(Date time, final LogRecordHeaderFilter filter) {
ServerInstanceByTime instance = new ServerInstanceByTime(time == null ? -1 : time.getTime());
if (instance.logs == null && instance.traces == null) {
return EMPTY_LIST;
} else {
return new ServerInstanceLogRecordListImpl(instance.logs, instance.traces, false) {
@Override
public OnePidRecordListImpl queryResult(LogRepositoryBrowser browser) {
return new LogRecordBrowser(browser).recordsInProcess(-1, -1, filter);
}
};
}
} | java | public ServerInstanceLogRecordList getLogListForServerInstance(Date time, final LogRecordHeaderFilter filter) {
ServerInstanceByTime instance = new ServerInstanceByTime(time == null ? -1 : time.getTime());
if (instance.logs == null && instance.traces == null) {
return EMPTY_LIST;
} else {
return new ServerInstanceLogRecordListImpl(instance.logs, instance.traces, false) {
@Override
public OnePidRecordListImpl queryResult(LogRepositoryBrowser browser) {
return new LogRecordBrowser(browser).recordsInProcess(-1, -1, filter);
}
};
}
} | [
"public",
"ServerInstanceLogRecordList",
"getLogListForServerInstance",
"(",
"Date",
"time",
",",
"final",
"LogRecordHeaderFilter",
"filter",
")",
"{",
"ServerInstanceByTime",
"instance",
"=",
"new",
"ServerInstanceByTime",
"(",
"time",
"==",
"null",
"?",
"-",
"1",
":... | returns log records from the binary repository which satisfy condition of the filter as specified by the parameter. The returned logs
will be from the same server instance. The server instance will be determined by the time as specified by the parameter.
@param time the {@link Date} time value used to determine the server instance where the server start time occurs before this value
and the server stop time occurs after this value
@param filter an instance implementing {@link LogRecordHeaderFilter} interface to verify one record at a time.
@return the iterable list of log records | [
"returns",
"log",
"records",
"from",
"the",
"binary",
"repository",
"which",
"satisfy",
"condition",
"of",
"the",
"filter",
"as",
"specified",
"by",
"the",
"parameter",
".",
"The",
"returned",
"logs",
"will",
"be",
"from",
"the",
"same",
"server",
"instance",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RepositoryReaderImpl.java#L822-L835 |
Scout24/appmon4j | core/src/main/java/de/is24/util/monitoring/wrapper/GenericMonitoringWrapper.java | GenericMonitoringWrapper.wrapObject | @SuppressWarnings("unchecked")
public static <E> E wrapObject(final Class<E> clazz, final Object target, final TimingReporter timingReporter) {
return (E) Proxy.newProxyInstance(GenericMonitoringWrapper.class.getClassLoader(),
new Class[] { clazz },
new GenericMonitoringWrapper<E>(clazz, target, timingReporter));
} | java | @SuppressWarnings("unchecked")
public static <E> E wrapObject(final Class<E> clazz, final Object target, final TimingReporter timingReporter) {
return (E) Proxy.newProxyInstance(GenericMonitoringWrapper.class.getClassLoader(),
new Class[] { clazz },
new GenericMonitoringWrapper<E>(clazz, target, timingReporter));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"E",
">",
"E",
"wrapObject",
"(",
"final",
"Class",
"<",
"E",
">",
"clazz",
",",
"final",
"Object",
"target",
",",
"final",
"TimingReporter",
"timingReporter",
")",
"{",
"return",
... | Wraps the given object and returns the reporting proxy. Uses the given
timing reporter to report timings.
@param <E>
the type of the public interface of the wrapped object
@param clazz
the class object to the interface
@param target
the object to wrap
@param timingReporter
the reporter to report timing information to
@return the monitoring wrapper | [
"Wraps",
"the",
"given",
"object",
"and",
"returns",
"the",
"reporting",
"proxy",
".",
"Uses",
"the",
"given",
"timing",
"reporter",
"to",
"report",
"timings",
"."
] | train | https://github.com/Scout24/appmon4j/blob/a662e5123805ea455cfd01e1b9ae5d808f83529c/core/src/main/java/de/is24/util/monitoring/wrapper/GenericMonitoringWrapper.java#L86-L91 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processNUMBER | Object processNUMBER(
StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
if (getSupportsAVT())
{
Double val;
AVT avt = null;
try
{
avt = new AVT(handler, uri, name, rawName, value, owner);
// If this attribute used an avt, then we can't validate at this time.
if (avt.isSimple())
{
val = Double.valueOf(value);
}
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
catch (NumberFormatException nfe)
{
handleError(handler,XSLTErrorResources.INVALID_NUMBER, new Object[] {name, value}, nfe);
return null;
}
return avt;
}
else
{
try
{
return Double.valueOf(value);
}
catch (NumberFormatException nfe)
{
handleError(handler,XSLTErrorResources.INVALID_NUMBER, new Object[] {name, value}, nfe);
return null;
}
}
} | java | Object processNUMBER(
StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
if (getSupportsAVT())
{
Double val;
AVT avt = null;
try
{
avt = new AVT(handler, uri, name, rawName, value, owner);
// If this attribute used an avt, then we can't validate at this time.
if (avt.isSimple())
{
val = Double.valueOf(value);
}
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
catch (NumberFormatException nfe)
{
handleError(handler,XSLTErrorResources.INVALID_NUMBER, new Object[] {name, value}, nfe);
return null;
}
return avt;
}
else
{
try
{
return Double.valueOf(value);
}
catch (NumberFormatException nfe)
{
handleError(handler,XSLTErrorResources.INVALID_NUMBER, new Object[] {name, value}, nfe);
return null;
}
}
} | [
"Object",
"processNUMBER",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
",",
"ElemTemplateElement",
"owner",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException... | Process an attribute string of type T_NUMBER into
a double value.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value A string that can be parsed into a double value.
@param number
@return A Double object.
@throws org.xml.sax.SAXException that wraps a
{@link javax.xml.transform.TransformerException}
if the string does not contain a parsable number. | [
"Process",
"an",
"attribute",
"string",
"of",
"type",
"T_NUMBER",
"into",
"a",
"double",
"value",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L868-L912 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.lookAt | public Matrix4f lookAt(Vector3fc eye, Vector3fc center, Vector3fc up, Matrix4f dest) {
return lookAt(eye.x(), eye.y(), eye.z(), center.x(), center.y(), center.z(), up.x(), up.y(), up.z(), dest);
} | java | public Matrix4f lookAt(Vector3fc eye, Vector3fc center, Vector3fc up, Matrix4f dest) {
return lookAt(eye.x(), eye.y(), eye.z(), center.x(), center.y(), center.z(), up.x(), up.y(), up.z(), dest);
} | [
"public",
"Matrix4f",
"lookAt",
"(",
"Vector3fc",
"eye",
",",
"Vector3fc",
"center",
",",
"Vector3fc",
"up",
",",
"Matrix4f",
"dest",
")",
"{",
"return",
"lookAt",
"(",
"eye",
".",
"x",
"(",
")",
",",
"eye",
".",
"y",
"(",
")",
",",
"eye",
".",
"z"... | Apply a "lookat" transformation to this matrix for a right-handed coordinate system,
that aligns <code>-z</code> with <code>center - eye</code> and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookat matrix,
then the new matrix will be <code>M * L</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * L * v</code>,
the lookat transformation will be applied first!
<p>
In order to set the matrix to a lookat transformation without post-multiplying it,
use {@link #setLookAt(Vector3fc, Vector3fc, Vector3fc)}.
@see #lookAt(float, float, float, float, float, float, float, float, float)
@see #setLookAlong(Vector3fc, Vector3fc)
@param eye
the position of the camera
@param center
the point in space to look at
@param up
the direction of 'up'
@param dest
will hold the result
@return dest | [
"Apply",
"a",
"lookat",
"transformation",
"to",
"this",
"matrix",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"that",
"aligns",
"<code",
">",
"-",
"z<",
"/",
"code",
">",
"with",
"<code",
">",
"center",
"-",
"eye<",
"/",
"code",
">",
"a... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L8465-L8467 |
google/closure-compiler | src/com/google/javascript/jscomp/deps/PathUtil.java | PathUtil.makeAbsolute | public static String makeAbsolute(String path, String rootPath) {
if (!isAbsolute(path)) {
path = rootPath + "/" + path;
}
return collapseDots(path);
} | java | public static String makeAbsolute(String path, String rootPath) {
if (!isAbsolute(path)) {
path = rootPath + "/" + path;
}
return collapseDots(path);
} | [
"public",
"static",
"String",
"makeAbsolute",
"(",
"String",
"path",
",",
"String",
"rootPath",
")",
"{",
"if",
"(",
"!",
"isAbsolute",
"(",
"path",
")",
")",
"{",
"path",
"=",
"rootPath",
"+",
"\"/\"",
"+",
"path",
";",
"}",
"return",
"collapseDots",
... | Converts the given path into an absolute one. This prepends the given
rootPath and removes all .'s from the path. If an absolute path is given,
it will not be prefixed.
<p>Unlike File.getAbsolutePath(), this function does remove .'s from the
path and unlike File.getCanonicalPath(), this function does not resolve
symlinks and does not use filesystem calls.</p>
@param rootPath The path to prefix to path if path is not already absolute.
@param path The path to make absolute.
@return The path made absolute. | [
"Converts",
"the",
"given",
"path",
"into",
"an",
"absolute",
"one",
".",
"This",
"prepends",
"the",
"given",
"rootPath",
"and",
"removes",
"all",
".",
"s",
"from",
"the",
"path",
".",
"If",
"an",
"absolute",
"path",
"is",
"given",
"it",
"will",
"not",
... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/PathUtil.java#L138-L143 |
Alluxio/alluxio | core/server/common/src/main/java/alluxio/cli/validation/Utils.java | Utils.getResultFromProcess | public static ProcessExecutionResult getResultFromProcess(String[] args) {
try {
Process process = Runtime.getRuntime().exec(args);
StringBuilder outputSb = new StringBuilder();
try (BufferedReader processOutputReader = new BufferedReader(
new InputStreamReader(process.getInputStream()))) {
String line;
while ((line = processOutputReader.readLine()) != null) {
outputSb.append(line);
outputSb.append(LINE_SEPARATOR);
}
}
StringBuilder errorSb = new StringBuilder();
try (BufferedReader processErrorReader = new BufferedReader(
new InputStreamReader(process.getErrorStream()))) {
String line;
while ((line = processErrorReader.readLine()) != null) {
errorSb.append(line);
errorSb.append(LINE_SEPARATOR);
}
}
process.waitFor();
return new ProcessExecutionResult(process.exitValue(), outputSb.toString().trim(),
errorSb.toString().trim());
} catch (IOException e) {
System.err.println("Failed to execute command.");
return new ProcessExecutionResult(1, "", e.getMessage());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
System.err.println("Interrupted.");
return new ProcessExecutionResult(1, "", e.getMessage());
}
} | java | public static ProcessExecutionResult getResultFromProcess(String[] args) {
try {
Process process = Runtime.getRuntime().exec(args);
StringBuilder outputSb = new StringBuilder();
try (BufferedReader processOutputReader = new BufferedReader(
new InputStreamReader(process.getInputStream()))) {
String line;
while ((line = processOutputReader.readLine()) != null) {
outputSb.append(line);
outputSb.append(LINE_SEPARATOR);
}
}
StringBuilder errorSb = new StringBuilder();
try (BufferedReader processErrorReader = new BufferedReader(
new InputStreamReader(process.getErrorStream()))) {
String line;
while ((line = processErrorReader.readLine()) != null) {
errorSb.append(line);
errorSb.append(LINE_SEPARATOR);
}
}
process.waitFor();
return new ProcessExecutionResult(process.exitValue(), outputSb.toString().trim(),
errorSb.toString().trim());
} catch (IOException e) {
System.err.println("Failed to execute command.");
return new ProcessExecutionResult(1, "", e.getMessage());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
System.err.println("Interrupted.");
return new ProcessExecutionResult(1, "", e.getMessage());
}
} | [
"public",
"static",
"ProcessExecutionResult",
"getResultFromProcess",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"try",
"{",
"Process",
"process",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"exec",
"(",
"args",
")",
";",
"StringBuilder",
"outputSb",
"... | Executes a command in another process and check for its execution result.
@param args array representation of the command to execute
@return {@link ProcessExecutionResult} including the process's exit value, output and error | [
"Executes",
"a",
"command",
"in",
"another",
"process",
"and",
"check",
"for",
"its",
"execution",
"result",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/cli/validation/Utils.java#L137-L169 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java | ExtendedMessageFormat.seekNonWs | private void seekNonWs(final String pattern, final ParsePosition pos) {
int len = 0;
final char[] buffer = pattern.toCharArray();
do {
len = StrMatcher.splitMatcher().isMatch(buffer, pos.getIndex());
pos.setIndex(pos.getIndex() + len);
} while (len > 0 && pos.getIndex() < pattern.length());
} | java | private void seekNonWs(final String pattern, final ParsePosition pos) {
int len = 0;
final char[] buffer = pattern.toCharArray();
do {
len = StrMatcher.splitMatcher().isMatch(buffer, pos.getIndex());
pos.setIndex(pos.getIndex() + len);
} while (len > 0 && pos.getIndex() < pattern.length());
} | [
"private",
"void",
"seekNonWs",
"(",
"final",
"String",
"pattern",
",",
"final",
"ParsePosition",
"pos",
")",
"{",
"int",
"len",
"=",
"0",
";",
"final",
"char",
"[",
"]",
"buffer",
"=",
"pattern",
".",
"toCharArray",
"(",
")",
";",
"do",
"{",
"len",
... | Consume whitespace from the current parse position.
@param pattern String to read
@param pos current position | [
"Consume",
"whitespace",
"from",
"the",
"current",
"parse",
"position",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java#L449-L456 |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpUtil.java | HttpUtil.downloadFile | public static long downloadFile(String url, File destFile, int timeout, StreamProgress streamProgress) {
if (StrUtil.isBlank(url)) {
throw new NullPointerException("[url] is null!");
}
if (null == destFile) {
throw new NullPointerException("[destFile] is null!");
}
final HttpResponse response = HttpRequest.get(url).timeout(timeout).executeAsync();
if (false == response.isOk()) {
throw new HttpException("Server response error with status code: [{}]", response.getStatus());
}
return response.writeBody(destFile, streamProgress);
} | java | public static long downloadFile(String url, File destFile, int timeout, StreamProgress streamProgress) {
if (StrUtil.isBlank(url)) {
throw new NullPointerException("[url] is null!");
}
if (null == destFile) {
throw new NullPointerException("[destFile] is null!");
}
final HttpResponse response = HttpRequest.get(url).timeout(timeout).executeAsync();
if (false == response.isOk()) {
throw new HttpException("Server response error with status code: [{}]", response.getStatus());
}
return response.writeBody(destFile, streamProgress);
} | [
"public",
"static",
"long",
"downloadFile",
"(",
"String",
"url",
",",
"File",
"destFile",
",",
"int",
"timeout",
",",
"StreamProgress",
"streamProgress",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"url",
")",
")",
"{",
"throw",
"new",
"NullPoint... | 下载远程文件
@param url 请求的url
@param destFile 目标文件或目录,当为目录时,取URL中的文件名,取不到使用编码后的URL做为文件名
@param timeout 超时,单位毫秒,-1表示默认超时
@param streamProgress 进度条
@return 文件大小
@since 4.0.4 | [
"下载远程文件"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L304-L316 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/FragmentJoiner.java | FragmentJoiner.getDensity | private double getDensity(Atom[] ca1subset, Atom[] ca2subset ) throws StructureException{
Atom centroid1 = Calc.getCentroid(ca1subset);
Atom centroid2 = Calc.getCentroid(ca2subset);
// get Average distance to centroid ...
double d1 = 0;
double d2 = 0;
for ( int i = 0 ; i < ca1subset.length;i++){
double dd1 = Calc.getDistance(centroid1, ca1subset[i]);
double dd2 = Calc.getDistance(centroid2, ca2subset[i]);
d1 += dd1;
d2 += dd2;
}
double avd1 = d1 / ca1subset.length;
double avd2 = d2 / ca2subset.length;
return Math.min(avd1,avd2);
} | java | private double getDensity(Atom[] ca1subset, Atom[] ca2subset ) throws StructureException{
Atom centroid1 = Calc.getCentroid(ca1subset);
Atom centroid2 = Calc.getCentroid(ca2subset);
// get Average distance to centroid ...
double d1 = 0;
double d2 = 0;
for ( int i = 0 ; i < ca1subset.length;i++){
double dd1 = Calc.getDistance(centroid1, ca1subset[i]);
double dd2 = Calc.getDistance(centroid2, ca2subset[i]);
d1 += dd1;
d2 += dd2;
}
double avd1 = d1 / ca1subset.length;
double avd2 = d2 / ca2subset.length;
return Math.min(avd1,avd2);
} | [
"private",
"double",
"getDensity",
"(",
"Atom",
"[",
"]",
"ca1subset",
",",
"Atom",
"[",
"]",
"ca2subset",
")",
"throws",
"StructureException",
"{",
"Atom",
"centroid1",
"=",
"Calc",
".",
"getCentroid",
"(",
"ca1subset",
")",
";",
"Atom",
"centroid2",
"=",
... | this is probably useless
@param ca1subset
@param ca2subset
@return a double
@throws StructureException | [
"this",
"is",
"probably",
"useless"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/FragmentJoiner.java#L249-L272 |
mgledi/DRUMS | src/main/java/com/unister/semweb/drums/file/HeaderIndexFile.java | HeaderIndexFile.openChannel | protected void openChannel(boolean readHeader, boolean readIndex) throws FileLockException, IOException {
super.openChannel(readHeader);
calcIndexInformations();
if (mode == AccessMode.READ_ONLY) {
indexBuffer = channel.map(FileChannel.MapMode.READ_ONLY, INDEX_OFFSET, indexSizeInBytes);
} else {
indexBuffer = channel.map(FileChannel.MapMode.READ_WRITE, INDEX_OFFSET, indexSizeInBytes);
}
if (readIndex) {
readIndex();
}
} | java | protected void openChannel(boolean readHeader, boolean readIndex) throws FileLockException, IOException {
super.openChannel(readHeader);
calcIndexInformations();
if (mode == AccessMode.READ_ONLY) {
indexBuffer = channel.map(FileChannel.MapMode.READ_ONLY, INDEX_OFFSET, indexSizeInBytes);
} else {
indexBuffer = channel.map(FileChannel.MapMode.READ_WRITE, INDEX_OFFSET, indexSizeInBytes);
}
if (readIndex) {
readIndex();
}
} | [
"protected",
"void",
"openChannel",
"(",
"boolean",
"readHeader",
",",
"boolean",
"readIndex",
")",
"throws",
"FileLockException",
",",
"IOException",
"{",
"super",
".",
"openChannel",
"(",
"readHeader",
")",
";",
"calcIndexInformations",
"(",
")",
";",
"if",
"(... | opens the {@link RandomAccessFile} and the corresponding {@link FileChannel}. Optionally reads the header. and
the index
@param should
the header be read
@param should
the index be read
@throws IOException | [
"opens",
"the",
"{",
"@link",
"RandomAccessFile",
"}",
"and",
"the",
"corresponding",
"{",
"@link",
"FileChannel",
"}",
".",
"Optionally",
"reads",
"the",
"header",
".",
"and",
"the",
"index"
] | train | https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/HeaderIndexFile.java#L328-L340 |
apache/incubator-gobblin | gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/avro/MRCompactorAvroKeyDedupJobRunner.java | MRCompactorAvroKeyDedupJobRunner.getKeySchema | @VisibleForTesting
Schema getKeySchema(Job job, Schema topicSchema) throws IOException {
Schema keySchema = null;
DedupKeyOption dedupKeyOption = getDedupKeyOption();
if (dedupKeyOption == DedupKeyOption.ALL) {
LOG.info("Using all attributes in the schema (except Map, Arrar and Enum fields) for compaction");
keySchema = AvroUtils.removeUncomparableFields(topicSchema).get();
} else if (dedupKeyOption == DedupKeyOption.KEY) {
LOG.info("Using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
} else if (keySchemaFileSpecified()) {
Path keySchemaFile = getKeySchemaFile();
LOG.info("Using attributes specified in schema file " + keySchemaFile + " for compaction");
try {
keySchema = AvroUtils.parseSchemaFromFile(keySchemaFile, this.fs);
} catch (IOException e) {
LOG.error("Failed to parse avro schema from " + keySchemaFile
+ ", using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
}
if (!isKeySchemaValid(keySchema, topicSchema)) {
LOG.warn(String.format("Key schema %s is not compatible with record schema %s.", keySchema, topicSchema)
+ "Using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
}
} else {
LOG.info("Property " + COMPACTION_JOB_AVRO_KEY_SCHEMA_LOC
+ " not provided. Using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
}
return keySchema;
} | java | @VisibleForTesting
Schema getKeySchema(Job job, Schema topicSchema) throws IOException {
Schema keySchema = null;
DedupKeyOption dedupKeyOption = getDedupKeyOption();
if (dedupKeyOption == DedupKeyOption.ALL) {
LOG.info("Using all attributes in the schema (except Map, Arrar and Enum fields) for compaction");
keySchema = AvroUtils.removeUncomparableFields(topicSchema).get();
} else if (dedupKeyOption == DedupKeyOption.KEY) {
LOG.info("Using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
} else if (keySchemaFileSpecified()) {
Path keySchemaFile = getKeySchemaFile();
LOG.info("Using attributes specified in schema file " + keySchemaFile + " for compaction");
try {
keySchema = AvroUtils.parseSchemaFromFile(keySchemaFile, this.fs);
} catch (IOException e) {
LOG.error("Failed to parse avro schema from " + keySchemaFile
+ ", using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
}
if (!isKeySchemaValid(keySchema, topicSchema)) {
LOG.warn(String.format("Key schema %s is not compatible with record schema %s.", keySchema, topicSchema)
+ "Using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
}
} else {
LOG.info("Property " + COMPACTION_JOB_AVRO_KEY_SCHEMA_LOC
+ " not provided. Using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
}
return keySchema;
} | [
"@",
"VisibleForTesting",
"Schema",
"getKeySchema",
"(",
"Job",
"job",
",",
"Schema",
"topicSchema",
")",
"throws",
"IOException",
"{",
"Schema",
"keySchema",
"=",
"null",
";",
"DedupKeyOption",
"dedupKeyOption",
"=",
"getDedupKeyOption",
"(",
")",
";",
"if",
"(... | Obtain the schema used for compaction. If compaction.dedup.key=all, it returns topicSchema.
If compaction.dedup.key=key, it returns a schema composed of all fields in topicSchema
whose doc matches "(?i).*primarykey". If there's no such field, option "all" will be used.
If compaction.dedup.key=custom, it reads the schema from compaction.avro.key.schema.loc.
If the read fails, or if the custom key schema is incompatible with topicSchema, option "key" will be used. | [
"Obtain",
"the",
"schema",
"used",
"for",
"compaction",
".",
"If",
"compaction",
".",
"dedup",
".",
"key",
"=",
"all",
"it",
"returns",
"topicSchema",
".",
"If",
"compaction",
".",
"dedup",
".",
"key",
"=",
"key",
"it",
"returns",
"a",
"schema",
"compose... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/avro/MRCompactorAvroKeyDedupJobRunner.java#L129-L161 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/ST_AsGeoJSON.java | ST_AsGeoJSON.toGeojsonLineString | public static void toGeojsonLineString(LineString lineString, StringBuilder sb) {
sb.append("{\"type\":\"LineString\",\"coordinates\":");
toGeojsonCoordinates(lineString.getCoordinates(), sb);
sb.append("}");
} | java | public static void toGeojsonLineString(LineString lineString, StringBuilder sb) {
sb.append("{\"type\":\"LineString\",\"coordinates\":");
toGeojsonCoordinates(lineString.getCoordinates(), sb);
sb.append("}");
} | [
"public",
"static",
"void",
"toGeojsonLineString",
"(",
"LineString",
"lineString",
",",
"StringBuilder",
"sb",
")",
"{",
"sb",
".",
"append",
"(",
"\"{\\\"type\\\":\\\"LineString\\\",\\\"coordinates\\\":\"",
")",
";",
"toGeojsonCoordinates",
"(",
"lineString",
".",
"ge... | Coordinates of LineString are an array of positions.
Syntax:
{ "type": "LineString", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] }
@param lineString
@param sb | [
"Coordinates",
"of",
"LineString",
"are",
"an",
"array",
"of",
"positions",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/ST_AsGeoJSON.java#L142-L146 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java | ComputerVisionImpl.recognizeTextInStreamAsync | public Observable<Void> recognizeTextInStreamAsync(byte[] image, TextRecognitionMode mode) {
return recognizeTextInStreamWithServiceResponseAsync(image, mode).map(new Func1<ServiceResponseWithHeaders<Void, RecognizeTextInStreamHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, RecognizeTextInStreamHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> recognizeTextInStreamAsync(byte[] image, TextRecognitionMode mode) {
return recognizeTextInStreamWithServiceResponseAsync(image, mode).map(new Func1<ServiceResponseWithHeaders<Void, RecognizeTextInStreamHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, RecognizeTextInStreamHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"recognizeTextInStreamAsync",
"(",
"byte",
"[",
"]",
"image",
",",
"TextRecognitionMode",
"mode",
")",
"{",
"return",
"recognizeTextInStreamWithServiceResponseAsync",
"(",
"image",
",",
"mode",
")",
".",
"map",
"(",
"new",... | Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation.
@param image An image stream.
@param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed'
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Recognize",
"Text",
"operation",
".",
"When",
"you",
"use",
"the",
"Recognize",
"Text",
"interface",
"the",
"response",
"contains",
"a",
"field",
"called",
"Operation",
"-",
"Location",
".",
"The",
"Operation",
"-",
"Location",
"field",
"contains",
"the",
"UR... | 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#L195-L202 |
cdk/cdk | tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAromaticTypeMapping.java | MmffAromaticTypeMapping.getAlphaAromaticType | private String getAlphaAromaticType(String symb, boolean imidazolium, boolean anion) {
return getAromaticType(alphaTypes, 'A', symb, imidazolium, anion);
} | java | private String getAlphaAromaticType(String symb, boolean imidazolium, boolean anion) {
return getAromaticType(alphaTypes, 'A', symb, imidazolium, anion);
} | [
"private",
"String",
"getAlphaAromaticType",
"(",
"String",
"symb",
",",
"boolean",
"imidazolium",
",",
"boolean",
"anion",
")",
"{",
"return",
"getAromaticType",
"(",
"alphaTypes",
",",
"'",
"'",
",",
"symb",
",",
"imidazolium",
",",
"anion",
")",
";",
"}"
... | Convenience method to obtain the aromatic type of a symbolic (SYMB) type in the alpha
position of a 5-member ring. This method delegates to {@link #getAromaticType(java.util.Map,
char, String, boolean, boolean)} setup for alpha atoms.
@param symb symbolic atom type
@param imidazolium imidazolium flag (IM naming from MMFFAROM.PAR)
@param anion anion flag (AN naming from MMFFAROM.PAR)
@return the aromatic type | [
"Convenience",
"method",
"to",
"obtain",
"the",
"aromatic",
"type",
"of",
"a",
"symbolic",
"(",
"SYMB",
")",
"type",
"in",
"the",
"alpha",
"position",
"of",
"a",
"5",
"-",
"member",
"ring",
".",
"This",
"method",
"delegates",
"to",
"{",
"@link",
"#getAro... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAromaticTypeMapping.java#L272-L274 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/audit/AuditServiceImpl.java | AuditServiceImpl.getAttributeSmart | private String getAttributeSmart(Element element, String attr)
{
return element.hasAttribute(attr) ? element.getAttribute(attr) : null;
} | java | private String getAttributeSmart(Element element, String attr)
{
return element.hasAttribute(attr) ? element.getAttribute(attr) : null;
} | [
"private",
"String",
"getAttributeSmart",
"(",
"Element",
"element",
",",
"String",
"attr",
")",
"{",
"return",
"element",
".",
"hasAttribute",
"(",
"attr",
")",
"?",
"element",
".",
"getAttribute",
"(",
"attr",
")",
":",
"null",
";",
"}"
] | Get attribute value.
@param element The element to get attribute value
@param attr The attribute name
@return Value of attribute if present and null in other case | [
"Get",
"attribute",
"value",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/audit/AuditServiceImpl.java#L822-L825 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/DateUtils.java | DateUtils.subHours | public static long subHours(final Date date1, final Date date2) {
return subTime(date1, date2, DatePeriod.HOUR);
} | java | public static long subHours(final Date date1, final Date date2) {
return subTime(date1, date2, DatePeriod.HOUR);
} | [
"public",
"static",
"long",
"subHours",
"(",
"final",
"Date",
"date1",
",",
"final",
"Date",
"date2",
")",
"{",
"return",
"subTime",
"(",
"date1",
",",
"date2",
",",
"DatePeriod",
".",
"HOUR",
")",
";",
"}"
] | Get how many hours between two date.
@param date1 date to be tested.
@param date2 date to be tested.
@return how many hours between two date. | [
"Get",
"how",
"many",
"hours",
"between",
"two",
"date",
"."
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L435-L438 |
wcm-io/wcm-io-handler | url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java | SuffixParser.getPage | public @Nullable Page getPage(@NotNull Predicate<Page> filter) {
return getPage(filter, (Page)null);
} | java | public @Nullable Page getPage(@NotNull Predicate<Page> filter) {
return getPage(filter, (Page)null);
} | [
"public",
"@",
"Nullable",
"Page",
"getPage",
"(",
"@",
"NotNull",
"Predicate",
"<",
"Page",
">",
"filter",
")",
"{",
"return",
"getPage",
"(",
"filter",
",",
"(",
"Page",
")",
"null",
")",
";",
"}"
] | Parse the suffix as page paths, return the first page from the suffix (relativ to the current page) that matches the given filter.
@param filter a filter that selects only the page you're interested in.
@return the page or null if no such page was selected by suffix | [
"Parse",
"the",
"suffix",
"as",
"page",
"paths",
"return",
"the",
"first",
"page",
"from",
"the",
"suffix",
"(",
"relativ",
"to",
"the",
"current",
"page",
")",
"that",
"matches",
"the",
"given",
"filter",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java#L302-L304 |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/internal/utils/SelfRegisteringRemote.java | SelfRegisteringRemote.addBrowser | public void addBrowser(DesiredCapabilities cap, int instances) {
String s = cap.getBrowserName();
if (s == null || "".equals(s)) {
throw new InvalidParameterException(cap + " does seems to be a valid browser.");
}
if (cap.getPlatform() == null) {
cap.setPlatform(Platform.getCurrent());
}
cap.setCapability(RegistrationRequest.MAX_INSTANCES, instances);
registrationRequest.getConfiguration().capabilities.add(cap);
registrationRequest.getConfiguration().fixUpCapabilities();
} | java | public void addBrowser(DesiredCapabilities cap, int instances) {
String s = cap.getBrowserName();
if (s == null || "".equals(s)) {
throw new InvalidParameterException(cap + " does seems to be a valid browser.");
}
if (cap.getPlatform() == null) {
cap.setPlatform(Platform.getCurrent());
}
cap.setCapability(RegistrationRequest.MAX_INSTANCES, instances);
registrationRequest.getConfiguration().capabilities.add(cap);
registrationRequest.getConfiguration().fixUpCapabilities();
} | [
"public",
"void",
"addBrowser",
"(",
"DesiredCapabilities",
"cap",
",",
"int",
"instances",
")",
"{",
"String",
"s",
"=",
"cap",
".",
"getBrowserName",
"(",
")",
";",
"if",
"(",
"s",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"s",
")",
")",
"{",... | Adding the browser described by the capability, automatically finding out what platform the
node is launched from
@param cap describing the browser
@param instances number of times this browser can be started on the node. | [
"Adding",
"the",
"browser",
"described",
"by",
"the",
"capability",
"automatically",
"finding",
"out",
"what",
"platform",
"the",
"node",
"is",
"launched",
"from"
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/utils/SelfRegisteringRemote.java#L139-L150 |
CenturyLinkCloud/mdw | mdw-workflow/src/com/centurylink/mdw/workflow/activity/template/VelocityTemplateActivity.java | VelocityTemplateActivity.createVelocityContext | protected VelocityContext createVelocityContext() throws ActivityException {
try {
VelocityContext context = null;
String toolboxFile = getAttributeValueSmart(VELOCITY_TOOLBOX_FILE);
if (toolboxFile != null && FileHelper.fileExistsOnClasspath(toolboxFile)) {
throw new ActivityException("TODO: Velocity Toolbox Support");
// XMLToolboxManager toolboxManager = new XMLToolboxManager();
// toolboxManager.load(FileHelper.fileInputStreamFromClasspath(toolboxFile));
// context = new VelocityContext(toolboxManager.getToolbox(toolboxFile));
}
else {
context = new VelocityContext();
}
Process processVO = getMainProcessDefinition();
List<Variable> varVOs = processVO.getVariables();
for (Variable variableVO : varVOs) {
String variableName = variableVO.getName();
Object variableValue = getVariableValue(variableName);
context.put(variableName, variableValue);
}
return context;
}
catch (Exception ex) {
throw new ActivityException(-1, ex.getMessage(), ex);
}
} | java | protected VelocityContext createVelocityContext() throws ActivityException {
try {
VelocityContext context = null;
String toolboxFile = getAttributeValueSmart(VELOCITY_TOOLBOX_FILE);
if (toolboxFile != null && FileHelper.fileExistsOnClasspath(toolboxFile)) {
throw new ActivityException("TODO: Velocity Toolbox Support");
// XMLToolboxManager toolboxManager = new XMLToolboxManager();
// toolboxManager.load(FileHelper.fileInputStreamFromClasspath(toolboxFile));
// context = new VelocityContext(toolboxManager.getToolbox(toolboxFile));
}
else {
context = new VelocityContext();
}
Process processVO = getMainProcessDefinition();
List<Variable> varVOs = processVO.getVariables();
for (Variable variableVO : varVOs) {
String variableName = variableVO.getName();
Object variableValue = getVariableValue(variableName);
context.put(variableName, variableValue);
}
return context;
}
catch (Exception ex) {
throw new ActivityException(-1, ex.getMessage(), ex);
}
} | [
"protected",
"VelocityContext",
"createVelocityContext",
"(",
")",
"throws",
"ActivityException",
"{",
"try",
"{",
"VelocityContext",
"context",
"=",
"null",
";",
"String",
"toolboxFile",
"=",
"getAttributeValueSmart",
"(",
"VELOCITY_TOOLBOX_FILE",
")",
";",
"if",
"("... | Creates the velocity context, adding process variables as parameters. | [
"Creates",
"the",
"velocity",
"context",
"adding",
"process",
"variables",
"as",
"parameters",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-workflow/src/com/centurylink/mdw/workflow/activity/template/VelocityTemplateActivity.java#L162-L189 |
heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.createSlug | public Slug createSlug(String appName, Map<String, String> processTypes) {
return connection.execute(new SlugCreate(appName, processTypes), apiKey);
} | java | public Slug createSlug(String appName, Map<String, String> processTypes) {
return connection.execute(new SlugCreate(appName, processTypes), apiKey);
} | [
"public",
"Slug",
"createSlug",
"(",
"String",
"appName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"processTypes",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"SlugCreate",
"(",
"appName",
",",
"processTypes",
")",
",",
"apiKey",
")... | Gets the slug info for an existing slug
@param appName See {@link #listApps} for a list of apps that can be used.
@param processTypes hash mapping process type names to their respective command | [
"Gets",
"the",
"slug",
"info",
"for",
"an",
"existing",
"slug"
] | train | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L413-L415 |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java | AbstractMojoInterceptor.setField | protected static void setField(String fieldName, Object mojo, Object value) throws Exception {
Field field = null;
try {
field = mojo.getClass().getDeclaredField(fieldName);
} catch (NoSuchFieldException ex) {
// Ignore exception and try superclass.
field = mojo.getClass().getSuperclass().getDeclaredField(fieldName);
}
field.setAccessible(true);
field.set(mojo, value);
} | java | protected static void setField(String fieldName, Object mojo, Object value) throws Exception {
Field field = null;
try {
field = mojo.getClass().getDeclaredField(fieldName);
} catch (NoSuchFieldException ex) {
// Ignore exception and try superclass.
field = mojo.getClass().getSuperclass().getDeclaredField(fieldName);
}
field.setAccessible(true);
field.set(mojo, value);
} | [
"protected",
"static",
"void",
"setField",
"(",
"String",
"fieldName",
",",
"Object",
"mojo",
",",
"Object",
"value",
")",
"throws",
"Exception",
"{",
"Field",
"field",
"=",
"null",
";",
"try",
"{",
"field",
"=",
"mojo",
".",
"getClass",
"(",
")",
".",
... | Sets the given field to the given value. This is an alternative to
invoking a set method.
@param fieldName
Name of the field to set
@param mojo
Mojo
@param value
New value for the field
@throws Exception
If setting the field using reflection goes wrong | [
"Sets",
"the",
"given",
"field",
"to",
"the",
"given",
"value",
".",
"This",
"is",
"an",
"alternative",
"to",
"invoking",
"a",
"set",
"method",
"."
] | train | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java#L144-L154 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java | JdbcCpoAdapter.deleteObject | @Override
public <T> long deleteObject(String name, T obj) throws CpoException {
return processUpdateGroup(obj, JdbcCpoAdapter.DELETE_GROUP, name, null, null, null);
} | java | @Override
public <T> long deleteObject(String name, T obj) throws CpoException {
return processUpdateGroup(obj, JdbcCpoAdapter.DELETE_GROUP, name, null, null, null);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"long",
"deleteObject",
"(",
"String",
"name",
",",
"T",
"obj",
")",
"throws",
"CpoException",
"{",
"return",
"processUpdateGroup",
"(",
"obj",
",",
"JdbcCpoAdapter",
".",
"DELETE_GROUP",
",",
"name",
",",
"null",
... | Removes the Object from the datasource. The assumption is that the object exists in the datasource. This method
stores the object in the datasource
<p/>
<pre>Example:
<code>
<p/>
class SomeObject so = new SomeObject();
class CpoAdapter cpo = null;
<p/>
try {
cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
} catch (CpoException ce) {
// Handle the error
cpo = null;
}
<p/>
if (cpo!=null) {
so.setId(1);
so.setName("SomeName");
try{
cpo.deleteObject("DeleteById",so);
} catch (CpoException ce) {
// Handle the error
}
}
</code>
</pre>
@param name The String name of the DELETE Function Group that will be used to create the object in the datasource.
null signifies that the default rules will be used.
@param obj This is an object that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. If the object does not exist in the datasource an exception will be thrown.
@return The number of objects deleted from the datasource
@throws CpoException Thrown if there are errors accessing the datasource | [
"Removes",
"the",
"Object",
"from",
"the",
"datasource",
".",
"The",
"assumption",
"is",
"that",
"the",
"object",
"exists",
"in",
"the",
"datasource",
".",
"This",
"method",
"stores",
"the",
"object",
"in",
"the",
"datasource",
"<p",
"/",
">",
"<pre",
">",... | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L538-L541 |
apereo/cas | core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java | WebUtils.putWarnCookieIfRequestParameterPresent | public static void putWarnCookieIfRequestParameterPresent(final CasCookieBuilder warnCookieGenerator, final RequestContext context) {
if (warnCookieGenerator != null) {
LOGGER.trace("Evaluating request to determine if warning cookie should be generated");
val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context);
if (StringUtils.isNotBlank(context.getExternalContext().getRequestParameterMap().get("warn"))) {
warnCookieGenerator.addCookie(response, "true");
}
} else {
LOGGER.trace("No warning cookie generator is defined");
}
} | java | public static void putWarnCookieIfRequestParameterPresent(final CasCookieBuilder warnCookieGenerator, final RequestContext context) {
if (warnCookieGenerator != null) {
LOGGER.trace("Evaluating request to determine if warning cookie should be generated");
val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context);
if (StringUtils.isNotBlank(context.getExternalContext().getRequestParameterMap().get("warn"))) {
warnCookieGenerator.addCookie(response, "true");
}
} else {
LOGGER.trace("No warning cookie generator is defined");
}
} | [
"public",
"static",
"void",
"putWarnCookieIfRequestParameterPresent",
"(",
"final",
"CasCookieBuilder",
"warnCookieGenerator",
",",
"final",
"RequestContext",
"context",
")",
"{",
"if",
"(",
"warnCookieGenerator",
"!=",
"null",
")",
"{",
"LOGGER",
".",
"trace",
"(",
... | Put warn cookie if request parameter present.
@param warnCookieGenerator the warn cookie generator
@param context the context | [
"Put",
"warn",
"cookie",
"if",
"request",
"parameter",
"present",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L448-L458 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/GanttChartView12.java | GanttChartView12.getGridLines | private GridLines getGridLines(byte[] data, int offset)
{
Color normalLineColor = ColorType.getInstance(data[offset]).getColor();
LineStyle normalLineStyle = LineStyle.getInstance(data[offset + 3]);
int intervalNumber = data[offset + 4];
LineStyle intervalLineStyle = LineStyle.getInstance(data[offset + 5]);
Color intervalLineColor = ColorType.getInstance(data[offset + 6]).getColor();
return new GridLines(normalLineColor, normalLineStyle, intervalNumber, intervalLineStyle, intervalLineColor);
} | java | private GridLines getGridLines(byte[] data, int offset)
{
Color normalLineColor = ColorType.getInstance(data[offset]).getColor();
LineStyle normalLineStyle = LineStyle.getInstance(data[offset + 3]);
int intervalNumber = data[offset + 4];
LineStyle intervalLineStyle = LineStyle.getInstance(data[offset + 5]);
Color intervalLineColor = ColorType.getInstance(data[offset + 6]).getColor();
return new GridLines(normalLineColor, normalLineStyle, intervalNumber, intervalLineStyle, intervalLineColor);
} | [
"private",
"GridLines",
"getGridLines",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"{",
"Color",
"normalLineColor",
"=",
"ColorType",
".",
"getInstance",
"(",
"data",
"[",
"offset",
"]",
")",
".",
"getColor",
"(",
")",
";",
"LineStyle",
"n... | Creates a new GridLines instance.
@param data data block
@param offset offset into data block
@return new GridLines instance | [
"Creates",
"a",
"new",
"GridLines",
"instance",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GanttChartView12.java#L229-L237 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/qe/FilteringScore.java | FilteringScore.getHandledFilter | public Filter<S> getHandledFilter() {
Filter<S> identity = getIdentityFilter();
Filter<S> rangeStart = buildCompositeFilter(getRangeStartFilters());
Filter<S> rangeEnd = buildCompositeFilter(getRangeEndFilters());
return and(and(identity, rangeStart), rangeEnd);
} | java | public Filter<S> getHandledFilter() {
Filter<S> identity = getIdentityFilter();
Filter<S> rangeStart = buildCompositeFilter(getRangeStartFilters());
Filter<S> rangeEnd = buildCompositeFilter(getRangeEndFilters());
return and(and(identity, rangeStart), rangeEnd);
} | [
"public",
"Filter",
"<",
"S",
">",
"getHandledFilter",
"(",
")",
"{",
"Filter",
"<",
"S",
">",
"identity",
"=",
"getIdentityFilter",
"(",
")",
";",
"Filter",
"<",
"S",
">",
"rangeStart",
"=",
"buildCompositeFilter",
"(",
"getRangeStartFilters",
"(",
")",
"... | Returns the composite handled filter, or null if no matches at all. | [
"Returns",
"the",
"composite",
"handled",
"filter",
"or",
"null",
"if",
"no",
"matches",
"at",
"all",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/qe/FilteringScore.java#L485-L491 |
ineunetOS/knife-commons | knife-commons-utils/src/main/java/com/ineunet/knife/util/ReflectionUtils.java | ReflectionUtils.getSuperClassGenricType | @SuppressWarnings("rawtypes")
public static Class getSuperClassGenricType(final Class<?> clazz, final int index) {
Type genType = clazz.getGenericSuperclass();
if (!(genType instanceof ParameterizedType)) {
/*
* By Hilbert Wang @2015-3-8
* logger.info(clazz.getSimpleName() + "'s superclass not ParameterizedType");
*/
return Object.class;
}
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
if (index >= params.length || index < 0) {
logger.warn("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: "
+ params.length);
return Object.class;
}
if (!(params[index] instanceof Class)) {
logger.warn(clazz.getSimpleName() + " not set the actual class on superclass generic parameter");
return Object.class;
}
return (Class) params[index];
} | java | @SuppressWarnings("rawtypes")
public static Class getSuperClassGenricType(final Class<?> clazz, final int index) {
Type genType = clazz.getGenericSuperclass();
if (!(genType instanceof ParameterizedType)) {
/*
* By Hilbert Wang @2015-3-8
* logger.info(clazz.getSimpleName() + "'s superclass not ParameterizedType");
*/
return Object.class;
}
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
if (index >= params.length || index < 0) {
logger.warn("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: "
+ params.length);
return Object.class;
}
if (!(params[index] instanceof Class)) {
logger.warn(clazz.getSimpleName() + " not set the actual class on superclass generic parameter");
return Object.class;
}
return (Class) params[index];
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"Class",
"getSuperClassGenricType",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"int",
"index",
")",
"{",
"Type",
"genType",
"=",
"clazz",
".",
"getGenericSuperclass",
"(",... | 通过反射, 获得Class定义中声明的父类的泛型参数的类型.
如无法找到, 返回Object.class.
如public UserDao extends HibernateDao<User,Long>
@param clazz clazz The class to introspect
@param index the Index of the generic ddeclaration,start from 0.
@return the index generic declaration, or Object.class if cannot be determined | [
"通过反射",
"获得Class定义中声明的父类的泛型参数的类型",
".",
"如无法找到",
"返回Object",
".",
"class",
"."
] | train | https://github.com/ineunetOS/knife-commons/blob/eae9e59afa020a00ae8977c10d43ac8ae46ae236/knife-commons-utils/src/main/java/com/ineunet/knife/util/ReflectionUtils.java#L217-L243 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java | VirtualNetworkGatewayConnectionsInner.beginUpdateTags | public VirtualNetworkGatewayConnectionListEntityInner beginUpdateTags(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).toBlocking().single().body();
} | java | public VirtualNetworkGatewayConnectionListEntityInner beginUpdateTags(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).toBlocking().single().body();
} | [
"public",
"VirtualNetworkGatewayConnectionListEntityInner",
"beginUpdateTags",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayConnectionName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"beginUpdateTagsWithServiceRespo... | Updates a virtual network gateway connection tags.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection.
@param tags Resource tags.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VirtualNetworkGatewayConnectionListEntityInner object if successful. | [
"Updates",
"a",
"virtual",
"network",
"gateway",
"connection",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L765-L767 |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/model/Item.java | Item.setIcon | public final void setIcon(@NonNull final Context context, @DrawableRes final int resourceId) {
setIcon(ContextCompat.getDrawable(context, resourceId));
} | java | public final void setIcon(@NonNull final Context context, @DrawableRes final int resourceId) {
setIcon(ContextCompat.getDrawable(context, resourceId));
} | [
"public",
"final",
"void",
"setIcon",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"DrawableRes",
"final",
"int",
"resourceId",
")",
"{",
"setIcon",
"(",
"ContextCompat",
".",
"getDrawable",
"(",
"context",
",",
"resourceId",
")",
")",
";",
... | Sets the item's icon.
@param context
The context, which should be used, as an instance of the class {@link Context}. The
context may not be null
@param resourceId
The resource id of the icon, which should be set, as an {@link Integer} value. The
resource id must correspond to a valid drawable resource | [
"Sets",
"the",
"item",
"s",
"icon",
"."
] | train | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/model/Item.java#L113-L115 |
jamesagnew/hapi-fhir | hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java | AuditingInterceptor.makeObjectDetail | protected ObjectDetail makeObjectDetail(String type, String value) {
ObjectDetail detail = new ObjectDetail();
if (type != null)
detail.setType(type);
if (value != null)
detail.setValue(value.getBytes());
return detail;
} | java | protected ObjectDetail makeObjectDetail(String type, String value) {
ObjectDetail detail = new ObjectDetail();
if (type != null)
detail.setType(type);
if (value != null)
detail.setValue(value.getBytes());
return detail;
} | [
"protected",
"ObjectDetail",
"makeObjectDetail",
"(",
"String",
"type",
",",
"String",
"value",
")",
"{",
"ObjectDetail",
"detail",
"=",
"new",
"ObjectDetail",
"(",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"detail",
".",
"setType",
"(",
"type",
")",... | Helper method to create an ObjectDetail from a pair of Strings.
@param type
the type of the ObjectDetail
@param value
the value of the ObejctDetail to be encoded
@return an ObjectDetail of the given type and value | [
"Helper",
"method",
"to",
"create",
"an",
"ObjectDetail",
"from",
"a",
"pair",
"of",
"Strings",
"."
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java#L332-L339 |
groupon/monsoon | remote_history/src/main/java/com/groupon/monsoon/remote/history/AbstractServer.java | AbstractServer.newTscStream | private static stream_response newTscStream(Stream<TimeSeriesCollection> tsc, int fetch) {
final BufferedIterator<TimeSeriesCollection> iter = new BufferedIterator(tsc.iterator(), TSC_QUEUE_SIZE);
final long idx = TSC_ITERS_ALLOC.getAndIncrement();
final IteratorAndCookie<TimeSeriesCollection> iterAndCookie = new IteratorAndCookie<>(iter);
TSC_ITERS.put(idx, iterAndCookie);
final List<TimeSeriesCollection> result = fetchFromIter(iter, fetch, MAX_TSC_FETCH);
EncDec.NewIterResponse<TimeSeriesCollection> responseObj
= new EncDec.NewIterResponse<>(idx, result, iter.atEnd(), iterAndCookie.getCookie());
LOG.log(Level.FINE, "responseObj = {0}", responseObj);
return EncDec.encodeStreamResponse(responseObj);
} | java | private static stream_response newTscStream(Stream<TimeSeriesCollection> tsc, int fetch) {
final BufferedIterator<TimeSeriesCollection> iter = new BufferedIterator(tsc.iterator(), TSC_QUEUE_SIZE);
final long idx = TSC_ITERS_ALLOC.getAndIncrement();
final IteratorAndCookie<TimeSeriesCollection> iterAndCookie = new IteratorAndCookie<>(iter);
TSC_ITERS.put(idx, iterAndCookie);
final List<TimeSeriesCollection> result = fetchFromIter(iter, fetch, MAX_TSC_FETCH);
EncDec.NewIterResponse<TimeSeriesCollection> responseObj
= new EncDec.NewIterResponse<>(idx, result, iter.atEnd(), iterAndCookie.getCookie());
LOG.log(Level.FINE, "responseObj = {0}", responseObj);
return EncDec.encodeStreamResponse(responseObj);
} | [
"private",
"static",
"stream_response",
"newTscStream",
"(",
"Stream",
"<",
"TimeSeriesCollection",
">",
"tsc",
",",
"int",
"fetch",
")",
"{",
"final",
"BufferedIterator",
"<",
"TimeSeriesCollection",
">",
"iter",
"=",
"new",
"BufferedIterator",
"(",
"tsc",
".",
... | Create a new TimeSeriesCollection iterator from the given stream. | [
"Create",
"a",
"new",
"TimeSeriesCollection",
"iterator",
"from",
"the",
"given",
"stream",
"."
] | train | https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/remote_history/src/main/java/com/groupon/monsoon/remote/history/AbstractServer.java#L167-L178 |
deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/AnalyzeSpark.java | AnalyzeSpark.analyzeQuality | public static DataQualityAnalysis analyzeQuality(final Schema schema, final JavaRDD<List<Writable>> data) {
int nColumns = schema.numColumns();
List<QualityAnalysisState> states = data.aggregate(null,
new BiFunctionAdapter<>(new QualityAnalysisAddFunction(schema)),
new BiFunctionAdapter<>(new QualityAnalysisCombineFunction()));
List<ColumnQuality> list = new ArrayList<>(nColumns);
for (QualityAnalysisState qualityState : states) {
list.add(qualityState.getColumnQuality());
}
return new DataQualityAnalysis(schema, list);
} | java | public static DataQualityAnalysis analyzeQuality(final Schema schema, final JavaRDD<List<Writable>> data) {
int nColumns = schema.numColumns();
List<QualityAnalysisState> states = data.aggregate(null,
new BiFunctionAdapter<>(new QualityAnalysisAddFunction(schema)),
new BiFunctionAdapter<>(new QualityAnalysisCombineFunction()));
List<ColumnQuality> list = new ArrayList<>(nColumns);
for (QualityAnalysisState qualityState : states) {
list.add(qualityState.getColumnQuality());
}
return new DataQualityAnalysis(schema, list);
} | [
"public",
"static",
"DataQualityAnalysis",
"analyzeQuality",
"(",
"final",
"Schema",
"schema",
",",
"final",
"JavaRDD",
"<",
"List",
"<",
"Writable",
">",
">",
"data",
")",
"{",
"int",
"nColumns",
"=",
"schema",
".",
"numColumns",
"(",
")",
";",
"List",
"<... | Analyze the data quality of data - provides a report on missing values, values that don't comply with schema, etc
@param schema Schema for data
@param data Data to analyze
@return DataQualityAnalysis object | [
"Analyze",
"the",
"data",
"quality",
"of",
"data",
"-",
"provides",
"a",
"report",
"on",
"missing",
"values",
"values",
"that",
"don",
"t",
"comply",
"with",
"schema",
"etc"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/AnalyzeSpark.java#L288-L300 |
TimeAndSpaceIO/SmoothieMap | src/main/java/net/openhft/smoothie/SmoothieMap.java | SmoothieMap.forEach | @Override
public final void forEach(BiConsumer<? super K, ? super V> action) {
Objects.requireNonNull(action);
int mc = this.modCount;
Segment<K, V> segment;
for (long segmentIndex = 0; segmentIndex >= 0;
segmentIndex = nextSegmentIndex(segmentIndex, segment)) {
(segment = segment(segmentIndex)).forEach(action);
}
if (mc != modCount)
throw new ConcurrentModificationException();
} | java | @Override
public final void forEach(BiConsumer<? super K, ? super V> action) {
Objects.requireNonNull(action);
int mc = this.modCount;
Segment<K, V> segment;
for (long segmentIndex = 0; segmentIndex >= 0;
segmentIndex = nextSegmentIndex(segmentIndex, segment)) {
(segment = segment(segmentIndex)).forEach(action);
}
if (mc != modCount)
throw new ConcurrentModificationException();
} | [
"@",
"Override",
"public",
"final",
"void",
"forEach",
"(",
"BiConsumer",
"<",
"?",
"super",
"K",
",",
"?",
"super",
"V",
">",
"action",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"action",
")",
";",
"int",
"mc",
"=",
"this",
".",
"modCount",
"... | Performs the given action for each entry in this map until all entries have been processed or
the action throws an exception. Actions are performed in the order of {@linkplain #entrySet()
entry set} iteration. Exceptions thrown by the action are relayed to the caller.
@param action The action to be performed for each entry
@throws NullPointerException if the specified action is null
@throws ConcurrentModificationException if any structural modification of the map (new entry
insertion or an entry removal) is detected during iteration
@see #forEachWhile(BiPredicate) | [
"Performs",
"the",
"given",
"action",
"for",
"each",
"entry",
"in",
"this",
"map",
"until",
"all",
"entries",
"have",
"been",
"processed",
"or",
"the",
"action",
"throws",
"an",
"exception",
".",
"Actions",
"are",
"performed",
"in",
"the",
"order",
"of",
"... | train | https://github.com/TimeAndSpaceIO/SmoothieMap/blob/c798f6cae1d377f6913e8821a1fcf5bf45ee0412/src/main/java/net/openhft/smoothie/SmoothieMap.java#L1048-L1059 |
imsweb/seerapi-client-java | src/main/java/com/imsweb/seerapi/client/staging/cs/CsStagingData.java | CsStagingData.setSsf | public void setSsf(Integer id, String ssf) {
if (id < 1 || id > 25)
throw new IllegalStateException("Site specific factor must be between 1 and 25.");
setInput(INPUT_SSF_PREFIX + id, ssf);
} | java | public void setSsf(Integer id, String ssf) {
if (id < 1 || id > 25)
throw new IllegalStateException("Site specific factor must be between 1 and 25.");
setInput(INPUT_SSF_PREFIX + id, ssf);
} | [
"public",
"void",
"setSsf",
"(",
"Integer",
"id",
",",
"String",
"ssf",
")",
"{",
"if",
"(",
"id",
"<",
"1",
"||",
"id",
">",
"25",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Site specific factor must be between 1 and 25.\"",
")",
";",
"setInput",
... | Set the specified input site-specific factor
@param id site-specific factor number
@param ssf site-specfic factor value | [
"Set",
"the",
"specified",
"input",
"site",
"-",
"specific",
"factor"
] | train | https://github.com/imsweb/seerapi-client-java/blob/04f509961c3a5ece7b232ecb8d8cb8f89d810a85/src/main/java/com/imsweb/seerapi/client/staging/cs/CsStagingData.java#L203-L208 |
bazaarvoice/emodb | web/src/main/java/com/bazaarvoice/emodb/web/uac/LocalSubjectUserAccessControl.java | LocalSubjectUserAccessControl.verifyPermission | private void verifyPermission(Subject subject, String permission)
throws UnauthorizedException {
if (!subject.hasPermission(permission)) {
throw new UnauthorizedException();
}
} | java | private void verifyPermission(Subject subject, String permission)
throws UnauthorizedException {
if (!subject.hasPermission(permission)) {
throw new UnauthorizedException();
}
} | [
"private",
"void",
"verifyPermission",
"(",
"Subject",
"subject",
",",
"String",
"permission",
")",
"throws",
"UnauthorizedException",
"{",
"if",
"(",
"!",
"subject",
".",
"hasPermission",
"(",
"permission",
")",
")",
"{",
"throw",
"new",
"UnauthorizedException",
... | Verifies whether the user has a specific permission. If not it throws a standard UnauthorizedException.
@throws UnauthorizedException User did not have the permission | [
"Verifies",
"whether",
"the",
"user",
"has",
"a",
"specific",
"permission",
".",
"If",
"not",
"it",
"throws",
"a",
"standard",
"UnauthorizedException",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/uac/LocalSubjectUserAccessControl.java#L583-L588 |
Cornutum/tcases | tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java | ProjectJson.asSystemInputDef | private static SystemInputDef asSystemInputDef( JsonValue json)
{
try
{
SystemInputDef systemInput = null;
if( json != null && json.getValueType() == OBJECT)
{
systemInput = SystemInputJson.asSystemInputDef( (JsonObject) json);
}
return systemInput;
}
catch( Exception e)
{
throw new ProjectException( "Error reading input definition", e);
}
} | java | private static SystemInputDef asSystemInputDef( JsonValue json)
{
try
{
SystemInputDef systemInput = null;
if( json != null && json.getValueType() == OBJECT)
{
systemInput = SystemInputJson.asSystemInputDef( (JsonObject) json);
}
return systemInput;
}
catch( Exception e)
{
throw new ProjectException( "Error reading input definition", e);
}
} | [
"private",
"static",
"SystemInputDef",
"asSystemInputDef",
"(",
"JsonValue",
"json",
")",
"{",
"try",
"{",
"SystemInputDef",
"systemInput",
"=",
"null",
";",
"if",
"(",
"json",
"!=",
"null",
"&&",
"json",
".",
"getValueType",
"(",
")",
"==",
"OBJECT",
")",
... | Returns the system input definition represented by the given JSON value. | [
"Returns",
"the",
"system",
"input",
"definition",
"represented",
"by",
"the",
"given",
"JSON",
"value",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java#L75-L91 |
unbescape/unbescape | src/main/java/org/unbescape/uri/UriEscape.java | UriEscape.escapeUriPath | public static void escapeUriPath(final char[] text, final int offset, final int len, final Writer writer)
throws IOException {
escapeUriPath(text, offset, len, writer, DEFAULT_ENCODING);
} | java | public static void escapeUriPath(final char[] text, final int offset, final int len, final Writer writer)
throws IOException {
escapeUriPath(text, offset, len, writer, DEFAULT_ENCODING);
} | [
"public",
"static",
"void",
"escapeUriPath",
"(",
"final",
"char",
"[",
"]",
"text",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"len",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapeUriPath",
"(",
"text",
",",
"offset"... | <p>
Perform am URI path <strong>escape</strong> operation
on a <tt>char[]</tt> input using <tt>UTF-8</tt> as encoding.
</p>
<p>
The following are the only allowed chars in an URI path (will not be escaped):
</p>
<ul>
<li><tt>A-Z a-z 0-9</tt></li>
<li><tt>- . _ ~</tt></li>
<li><tt>! $ & ' ( ) * + , ; =</tt></li>
<li><tt>: @</tt></li>
<li><tt>/</tt></li>
</ul>
<p>
All other chars will be escaped by converting them to the sequence of bytes that
represents them in the <tt>UTF-8</tt> and then representing each byte
in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>char[]</tt> to be escaped.
@param offset the position in <tt>text</tt> at which the escape operation should start.
@param len the number of characters in <tt>text</tt> that should be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs | [
"<p",
">",
"Perform",
"am",
"URI",
"path",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"char",
"[]",
"<",
"/",
"tt",
">",
"input",
"using",
"<tt",
">",
"UTF",
"-",
"8<",
"/",
"tt",
">",
"as",
"encoding",
"."... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L1146-L1149 |
Coveros/selenified | src/main/java/com/coveros/selenified/application/WaitFor.java | WaitFor.textPresent | public void textPresent(double seconds, String expectedText) {
double end = System.currentTimeMillis() + (seconds * 1000);
while (!app.is().textPresent(expectedText) && System.currentTimeMillis() < end) ;
double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000;
checkTextPresent(expectedText, seconds, timeTook);
} | java | public void textPresent(double seconds, String expectedText) {
double end = System.currentTimeMillis() + (seconds * 1000);
while (!app.is().textPresent(expectedText) && System.currentTimeMillis() < end) ;
double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000;
checkTextPresent(expectedText, seconds, timeTook);
} | [
"public",
"void",
"textPresent",
"(",
"double",
"seconds",
",",
"String",
"expectedText",
")",
"{",
"double",
"end",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"(",
"seconds",
"*",
"1000",
")",
";",
"while",
"(",
"!",
"app",
".",
"is",
"("... | Waits up to the provided wait time for provided text(s) are on the current page. This information
will be logged and recorded, with a screenshot for traceability and added
debugging support.
@param expectedText the expected text to be present
@param seconds the number of seconds to wait | [
"Waits",
"up",
"to",
"the",
"provided",
"wait",
"time",
"for",
"provided",
"text",
"(",
"s",
")",
"are",
"on",
"the",
"current",
"page",
".",
"This",
"information",
"will",
"be",
"logged",
"and",
"recorded",
"with",
"a",
"screenshot",
"for",
"traceability"... | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/WaitFor.java#L664-L669 |
protostuff/protostuff | protostuff-msgpack/src/main/java/io/protostuff/MsgpackIOUtil.java | MsgpackIOUtil.mergeFrom | public static <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema, boolean numeric)
throws IOException
{
ArrayBufferInput bios = new ArrayBufferInput(data, offset, length);
MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(bios);
try
{
mergeFrom(unpacker, message, schema, numeric);
}
finally
{
unpacker.close();
}
} | java | public static <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema, boolean numeric)
throws IOException
{
ArrayBufferInput bios = new ArrayBufferInput(data, offset, length);
MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(bios);
try
{
mergeFrom(unpacker, message, schema, numeric);
}
finally
{
unpacker.close();
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"mergeFrom",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
",",
"T",
"message",
",",
"Schema",
"<",
"T",
">",
"schema",
",",
"boolean",
"numeric",
")",
"throws",
"IOException",
"... | Merges the {@code message} with the byte array using the given {@code schema}. | [
"Merges",
"the",
"{"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-msgpack/src/main/java/io/protostuff/MsgpackIOUtil.java#L124-L140 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsPositionBean.java | CmsPositionBean.isInside | public boolean isInside(CmsPositionBean child, int padding) {
return ((getLeft() + padding) < child.getLeft()) // checking left border
&& ((getTop() + padding) < child.getTop()) // checking top border
&& (((getLeft() + getWidth()) - padding) > (child.getLeft() + child.getWidth())) // checking right border
&& (((getTop() + getHeight()) - padding) > (child.getTop() + child.getHeight())); // checking bottom border
} | java | public boolean isInside(CmsPositionBean child, int padding) {
return ((getLeft() + padding) < child.getLeft()) // checking left border
&& ((getTop() + padding) < child.getTop()) // checking top border
&& (((getLeft() + getWidth()) - padding) > (child.getLeft() + child.getWidth())) // checking right border
&& (((getTop() + getHeight()) - padding) > (child.getTop() + child.getHeight())); // checking bottom border
} | [
"public",
"boolean",
"isInside",
"(",
"CmsPositionBean",
"child",
",",
"int",
"padding",
")",
"{",
"return",
"(",
"(",
"getLeft",
"(",
")",
"+",
"padding",
")",
"<",
"child",
".",
"getLeft",
"(",
")",
")",
"// checking left border",
"&&",
"(",
"(",
"getT... | Checks whether the given position is completely surrounded by this position.<p>
@param child the child position
@param padding the padding to use
@return <code>true</code> if the child position is completely surrounded | [
"Checks",
"whether",
"the",
"given",
"position",
"is",
"completely",
"surrounded",
"by",
"this",
"position",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsPositionBean.java#L534-L540 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.errorv | public void errorv(Throwable t, String format, Object... params) {
doLog(Level.ERROR, FQCN, format, params, t);
} | java | public void errorv(Throwable t, String format, Object... params) {
doLog(Level.ERROR, FQCN, format, params, t);
} | [
"public",
"void",
"errorv",
"(",
"Throwable",
"t",
",",
"String",
"format",
",",
"Object",
"...",
"params",
")",
"{",
"doLog",
"(",
"Level",
".",
"ERROR",
",",
"FQCN",
",",
"format",
",",
"params",
",",
"t",
")",
";",
"}"
] | Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting.
@param t the throwable
@param format the message format string
@param params the parameters | [
"Issue",
"a",
"log",
"message",
"with",
"a",
"level",
"of",
"ERROR",
"using",
"{",
"@link",
"java",
".",
"text",
".",
"MessageFormat",
"}",
"-",
"style",
"formatting",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1614-L1616 |
jMetal/jMetal | jmetal-exec/src/main/java/org/uma/jmetal/experiment/ZDTScalabilityIStudy2.java | ZDTScalabilityIStudy2.configureAlgorithmList | static List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> configureAlgorithmList(
List<ExperimentProblem<DoubleSolution>> problemList) {
List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> algorithms = new ArrayList<>();
for (int run = 0; run < INDEPENDENT_RUNS; run++) {
for (int i = 0; i < problemList.size(); i++) {
double mutationProbability = 1.0 / problemList.get(i).getProblem().getNumberOfVariables();
double mutationDistributionIndex = 20.0;
Algorithm<List<DoubleSolution>> algorithm = new SMPSOBuilder(
(DoubleProblem) problemList.get(i).getProblem(),
new CrowdingDistanceArchive<DoubleSolution>(100))
.setMutation(new PolynomialMutation(mutationProbability, mutationDistributionIndex))
.setMaxIterations(250)
.setSwarmSize(100)
.setSolutionListEvaluator(new SequentialSolutionListEvaluator<DoubleSolution>())
.build();
algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run));
}
for (int i = 0; i < problemList.size(); i++) {
Algorithm<List<DoubleSolution>> algorithm = new NSGAIIBuilder<DoubleSolution>(
problemList.get(i).getProblem(),
new SBXCrossover(1.0, 20.0),
new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(),
20.0),
100)
.build();
algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run));
}
for (int i = 0; i < problemList.size(); i++) {
Algorithm<List<DoubleSolution>> algorithm = new SPEA2Builder<DoubleSolution>(
problemList.get(i).getProblem(),
new SBXCrossover(1.0, 10.0),
new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(),
20.0))
.build();
algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run));
}
}
return algorithms;
} | java | static List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> configureAlgorithmList(
List<ExperimentProblem<DoubleSolution>> problemList) {
List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> algorithms = new ArrayList<>();
for (int run = 0; run < INDEPENDENT_RUNS; run++) {
for (int i = 0; i < problemList.size(); i++) {
double mutationProbability = 1.0 / problemList.get(i).getProblem().getNumberOfVariables();
double mutationDistributionIndex = 20.0;
Algorithm<List<DoubleSolution>> algorithm = new SMPSOBuilder(
(DoubleProblem) problemList.get(i).getProblem(),
new CrowdingDistanceArchive<DoubleSolution>(100))
.setMutation(new PolynomialMutation(mutationProbability, mutationDistributionIndex))
.setMaxIterations(250)
.setSwarmSize(100)
.setSolutionListEvaluator(new SequentialSolutionListEvaluator<DoubleSolution>())
.build();
algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run));
}
for (int i = 0; i < problemList.size(); i++) {
Algorithm<List<DoubleSolution>> algorithm = new NSGAIIBuilder<DoubleSolution>(
problemList.get(i).getProblem(),
new SBXCrossover(1.0, 20.0),
new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(),
20.0),
100)
.build();
algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run));
}
for (int i = 0; i < problemList.size(); i++) {
Algorithm<List<DoubleSolution>> algorithm = new SPEA2Builder<DoubleSolution>(
problemList.get(i).getProblem(),
new SBXCrossover(1.0, 10.0),
new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(),
20.0))
.build();
algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run));
}
}
return algorithms;
} | [
"static",
"List",
"<",
"ExperimentAlgorithm",
"<",
"DoubleSolution",
",",
"List",
"<",
"DoubleSolution",
">",
">",
">",
"configureAlgorithmList",
"(",
"List",
"<",
"ExperimentProblem",
"<",
"DoubleSolution",
">",
">",
"problemList",
")",
"{",
"List",
"<",
"Exper... | The algorithm list is composed of pairs {@link Algorithm} + {@link Problem} which form part of
a {@link ExperimentAlgorithm}, which is a decorator for class {@link Algorithm}. The {@link
ExperimentAlgorithm} has an optional tag component, that can be set as it is shown in this
example, where four variants of a same algorithm are defined. | [
"The",
"algorithm",
"list",
"is",
"composed",
"of",
"pairs",
"{"
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-exec/src/main/java/org/uma/jmetal/experiment/ZDTScalabilityIStudy2.java#L103-L144 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java | AiMesh.getTexCoordU | public float getTexCoordU(int vertex, int coords) {
if (!hasTexCoords(coords)) {
throw new IllegalStateException(
"mesh has no texture coordinate set " + coords);
}
checkVertexIndexBounds(vertex);
/* bound checks for coords are done by java for us */
return m_texcoords[coords].getFloat(
vertex * m_numUVComponents[coords] * SIZEOF_FLOAT);
} | java | public float getTexCoordU(int vertex, int coords) {
if (!hasTexCoords(coords)) {
throw new IllegalStateException(
"mesh has no texture coordinate set " + coords);
}
checkVertexIndexBounds(vertex);
/* bound checks for coords are done by java for us */
return m_texcoords[coords].getFloat(
vertex * m_numUVComponents[coords] * SIZEOF_FLOAT);
} | [
"public",
"float",
"getTexCoordU",
"(",
"int",
"vertex",
",",
"int",
"coords",
")",
"{",
"if",
"(",
"!",
"hasTexCoords",
"(",
"coords",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"mesh has no texture coordinate set \"",
"+",
"coords",
")",
... | Returns the u component of a coordinate from a texture coordinate set.
@param vertex the vertex index
@param coords the texture coordinate set
@return the u component | [
"Returns",
"the",
"u",
"component",
"of",
"a",
"coordinate",
"from",
"a",
"texture",
"coordinate",
"set",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L946-L957 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivitiesInner.java | DataWarehouseUserActivitiesInner.getAsync | public Observable<DataWarehouseUserActivityInner> getAsync(String resourceGroupName, String serverName, String databaseName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DataWarehouseUserActivityInner>, DataWarehouseUserActivityInner>() {
@Override
public DataWarehouseUserActivityInner call(ServiceResponse<DataWarehouseUserActivityInner> response) {
return response.body();
}
});
} | java | public Observable<DataWarehouseUserActivityInner> getAsync(String resourceGroupName, String serverName, String databaseName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DataWarehouseUserActivityInner>, DataWarehouseUserActivityInner>() {
@Override
public DataWarehouseUserActivityInner call(ServiceResponse<DataWarehouseUserActivityInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DataWarehouseUserActivityInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
... | Gets the user activities of a data warehouse which includes running and suspended queries.
@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.
@param databaseName The name of the database.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DataWarehouseUserActivityInner object | [
"Gets",
"the",
"user",
"activities",
"of",
"a",
"data",
"warehouse",
"which",
"includes",
"running",
"and",
"suspended",
"queries",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivitiesInner.java#L98-L105 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/Tr.java | Tr.formatMessage | public static String formatMessage(TraceComponent tc, Locale locale, String msgKey, Object... objs) {
return formatMessage(tc, (locale == null) ? null : Collections.singletonList(locale), msgKey, objs);
} | java | public static String formatMessage(TraceComponent tc, Locale locale, String msgKey, Object... objs) {
return formatMessage(tc, (locale == null) ? null : Collections.singletonList(locale), msgKey, objs);
} | [
"public",
"static",
"String",
"formatMessage",
"(",
"TraceComponent",
"tc",
",",
"Locale",
"locale",
",",
"String",
"msgKey",
",",
"Object",
"...",
"objs",
")",
"{",
"return",
"formatMessage",
"(",
"tc",
",",
"(",
"locale",
"==",
"null",
")",
"?",
"null",
... | Like {@link #formatMessage(TraceComponent, List, String, Object...)},
but takes a single Locale.
@see #formatMessage(TraceComponent, List, String, Object...) | [
"Like",
"{",
"@link",
"#formatMessage",
"(",
"TraceComponent",
"List",
"String",
"Object",
"...",
")",
"}",
"but",
"takes",
"a",
"single",
"Locale",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/Tr.java#L685-L687 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java | Text.isSibling | public static boolean isSibling(String p1, String p2)
{
int pos1 = p1.lastIndexOf('/');
int pos2 = p2.lastIndexOf('/');
return (pos1 == pos2 && pos1 >= 0 && p1.regionMatches(0, p2, 0, pos1));
} | java | public static boolean isSibling(String p1, String p2)
{
int pos1 = p1.lastIndexOf('/');
int pos2 = p2.lastIndexOf('/');
return (pos1 == pos2 && pos1 >= 0 && p1.regionMatches(0, p2, 0, pos1));
} | [
"public",
"static",
"boolean",
"isSibling",
"(",
"String",
"p1",
",",
"String",
"p2",
")",
"{",
"int",
"pos1",
"=",
"p1",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"int",
"pos2",
"=",
"p2",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"return",
... | Determines, if two paths denote hierarchical siblins.
@param p1
first path
@param p2
second path
@return true if on same level, false otherwise | [
"Determines",
"if",
"two",
"paths",
"denote",
"hierarchical",
"siblins",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L699-L704 |
alkacon/opencms-core | src/org/opencms/util/CmsStringUtil.java | CmsStringUtil.getColorValue | public static Color getColorValue(String value, Color defaultValue, String key) {
Color result;
try {
char pre = value.charAt(0);
if (pre != '#') {
value = "#" + value;
}
result = Color.decode(value);
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.ERR_UNABLE_TO_PARSE_COLOR_2, value, key));
}
result = defaultValue;
}
return result;
} | java | public static Color getColorValue(String value, Color defaultValue, String key) {
Color result;
try {
char pre = value.charAt(0);
if (pre != '#') {
value = "#" + value;
}
result = Color.decode(value);
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.ERR_UNABLE_TO_PARSE_COLOR_2, value, key));
}
result = defaultValue;
}
return result;
} | [
"public",
"static",
"Color",
"getColorValue",
"(",
"String",
"value",
",",
"Color",
"defaultValue",
",",
"String",
"key",
")",
"{",
"Color",
"result",
";",
"try",
"{",
"char",
"pre",
"=",
"value",
".",
"charAt",
"(",
"0",
")",
";",
"if",
"(",
"pre",
... | Returns the color value (<code>{@link Color}</code>) for the given String value.<p>
All parse errors are caught and the given default value is returned in this case.<p>
@param value the value to parse as color
@param defaultValue the default value in case of parsing errors
@param key a key to be included in the debug output in case of parse errors
@return the int value for the given parameter value String | [
"Returns",
"the",
"color",
"value",
"(",
"<code",
">",
"{",
"@link",
"Color",
"}",
"<",
"/",
"code",
">",
")",
"for",
"the",
"given",
"String",
"value",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L717-L733 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/Convert.java | Convert.convertTime | public static long convertTime(long sourceDuration, TimeUnit sourceUnit, TimeUnit destUnit) {
Assert.notNull(sourceUnit, "sourceUnit is null !");
Assert.notNull(destUnit, "destUnit is null !");
return destUnit.convert(sourceDuration, sourceUnit);
} | java | public static long convertTime(long sourceDuration, TimeUnit sourceUnit, TimeUnit destUnit) {
Assert.notNull(sourceUnit, "sourceUnit is null !");
Assert.notNull(destUnit, "destUnit is null !");
return destUnit.convert(sourceDuration, sourceUnit);
} | [
"public",
"static",
"long",
"convertTime",
"(",
"long",
"sourceDuration",
",",
"TimeUnit",
"sourceUnit",
",",
"TimeUnit",
"destUnit",
")",
"{",
"Assert",
".",
"notNull",
"(",
"sourceUnit",
",",
"\"sourceUnit is null !\"",
")",
";",
"Assert",
".",
"notNull",
"(",... | 转换时间单位
@param sourceDuration 时长
@param sourceUnit 源单位
@param destUnit 目标单位
@return 目标单位的时长 | [
"转换时间单位"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L796-L800 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/IndexWriter.java | IndexWriter.generateBackpointerUpdate | private AttributeUpdate generateBackpointerUpdate(long fromOffset, long toOffset) {
return new AttributeUpdate(getBackpointerAttributeKey(fromOffset), AttributeUpdateType.Replace, toOffset);
} | java | private AttributeUpdate generateBackpointerUpdate(long fromOffset, long toOffset) {
return new AttributeUpdate(getBackpointerAttributeKey(fromOffset), AttributeUpdateType.Replace, toOffset);
} | [
"private",
"AttributeUpdate",
"generateBackpointerUpdate",
"(",
"long",
"fromOffset",
",",
"long",
"toOffset",
")",
"{",
"return",
"new",
"AttributeUpdate",
"(",
"getBackpointerAttributeKey",
"(",
"fromOffset",
")",
",",
"AttributeUpdateType",
".",
"Replace",
",",
"to... | Generates an AttributeUpdate that creates a new or updates an existing Backpointer.
@param fromOffset The offset at which the Backpointer originates.
@param toOffset The offset at which the Backpointer ends. | [
"Generates",
"an",
"AttributeUpdate",
"that",
"creates",
"a",
"new",
"or",
"updates",
"an",
"existing",
"Backpointer",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/IndexWriter.java#L315-L317 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/RandomMatrices_ZDRM.java | RandomMatrices_ZDRM.rectangle | public static ZMatrixRMaj rectangle(int numRow , int numCol , Random rand ) {
return rectangle(numRow,numCol,-1,1,rand);
} | java | public static ZMatrixRMaj rectangle(int numRow , int numCol , Random rand ) {
return rectangle(numRow,numCol,-1,1,rand);
} | [
"public",
"static",
"ZMatrixRMaj",
"rectangle",
"(",
"int",
"numRow",
",",
"int",
"numCol",
",",
"Random",
"rand",
")",
"{",
"return",
"rectangle",
"(",
"numRow",
",",
"numCol",
",",
"-",
"1",
",",
"1",
",",
"rand",
")",
";",
"}"
] | <p>
Returns a matrix where all the elements are selected independently from
a uniform distribution between -1 and 1 inclusive.
</p>
@param numRow Number of rows in the new matrix.
@param numCol Number of columns in the new matrix.
@param rand Random number generator used to fill the matrix.
@return The randomly generated matrix. | [
"<p",
">",
"Returns",
"a",
"matrix",
"where",
"all",
"the",
"elements",
"are",
"selected",
"independently",
"from",
"a",
"uniform",
"distribution",
"between",
"-",
"1",
"and",
"1",
"inclusive",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/RandomMatrices_ZDRM.java#L43-L45 |
krummas/DrizzleJDBC | src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java | DrizzlePreparedStatement.setDate | public void setDate(final int parameterIndex, final Date date) throws SQLException {
if(date == null) {
setNull(parameterIndex, Types.DATE);
return;
}
setParameter(parameterIndex, new DateParameter(date.getTime()));
} | java | public void setDate(final int parameterIndex, final Date date) throws SQLException {
if(date == null) {
setNull(parameterIndex, Types.DATE);
return;
}
setParameter(parameterIndex, new DateParameter(date.getTime()));
} | [
"public",
"void",
"setDate",
"(",
"final",
"int",
"parameterIndex",
",",
"final",
"Date",
"date",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"setNull",
"(",
"parameterIndex",
",",
"Types",
".",
"DATE",
")",
";",
"retur... | Sets the designated parameter to the given <code>java.sql.Date</code> value using the default time zone of the
virtual machine that is running the application. The driver converts this to an SQL <code>DATE</code> value when
it sends it to the database.
@param parameterIndex the first parameter is 1, the second is 2, ...
@param date the parameter value
@throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement;
if a database access error occurs or this method is called on a closed
<code>PreparedStatement</code> | [
"Sets",
"the",
"designated",
"parameter",
"to",
"the",
"given",
"<code",
">",
"java",
".",
"sql",
".",
"Date<",
"/",
"code",
">",
"value",
"using",
"the",
"default",
"time",
"zone",
"of",
"the",
"virtual",
"machine",
"that",
"is",
"running",
"the",
"appl... | train | https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L1130-L1138 |
lucee/Lucee | core/src/main/java/lucee/runtime/type/wrap/ListAsArray.java | ListAsArray.addAll | @Override
public boolean addAll(int index, java.util.Collection c) {
return list.addAll(index, c);
} | java | @Override
public boolean addAll(int index, java.util.Collection c) {
return list.addAll(index, c);
} | [
"@",
"Override",
"public",
"boolean",
"addAll",
"(",
"int",
"index",
",",
"java",
".",
"util",
".",
"Collection",
"c",
")",
"{",
"return",
"list",
".",
"addAll",
"(",
"index",
",",
"c",
")",
";",
"}"
] | /*---@Override
public void add(int index, Object element) {
list.add(index, element);
}
@Override
public boolean addAll(java.util.Collection c) {
return list.addAll(c);
} | [
"/",
"*",
"---",
"@Override",
"public",
"void",
"add",
"(",
"int",
"index",
"Object",
"element",
")",
"{",
"list",
".",
"add",
"(",
"index",
"element",
")",
";",
"}"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/wrap/ListAsArray.java#L482-L485 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java | AppServiceCertificateOrdersInner.deleteCertificate | public void deleteCertificate(String resourceGroupName, String certificateOrderName, String name) {
deleteCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name).toBlocking().single().body();
} | java | public void deleteCertificate(String resourceGroupName, String certificateOrderName, String name) {
deleteCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name).toBlocking().single().body();
} | [
"public",
"void",
"deleteCertificate",
"(",
"String",
"resourceGroupName",
",",
"String",
"certificateOrderName",
",",
"String",
"name",
")",
"{",
"deleteCertificateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"certificateOrderName",
",",
"name",
")",
".",
... | Delete the certificate associated with a certificate order.
Delete the certificate associated with a certificate order.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param certificateOrderName Name of the certificate order.
@param name Name of the certificate.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Delete",
"the",
"certificate",
"associated",
"with",
"a",
"certificate",
"order",
".",
"Delete",
"the",
"certificate",
"associated",
"with",
"a",
"certificate",
"order",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L1381-L1383 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java | IotHubResourcesInner.createOrUpdateAsync | public Observable<IotHubDescriptionInner> createOrUpdateAsync(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription).map(new Func1<ServiceResponse<IotHubDescriptionInner>, IotHubDescriptionInner>() {
@Override
public IotHubDescriptionInner call(ServiceResponse<IotHubDescriptionInner> response) {
return response.body();
}
});
} | java | public Observable<IotHubDescriptionInner> createOrUpdateAsync(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription).map(new Func1<ServiceResponse<IotHubDescriptionInner>, IotHubDescriptionInner>() {
@Override
public IotHubDescriptionInner call(ServiceResponse<IotHubDescriptionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"IotHubDescriptionInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"IotHubDescriptionInner",
"iotHubDescription",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resour... | Create or update the metadata of an IoT hub.
Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@param iotHubDescription The IoT hub metadata and security metadata.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Create",
"or",
"update",
"the",
"metadata",
"of",
"an",
"IoT",
"hub",
".",
"Create",
"or",
"update",
"the",
"metadata",
"of",
"an",
"Iot",
"hub",
".",
"The",
"usual",
"pattern",
"to",
"modify",
"a",
"property",
"is",
"to",
"retrieve",
"the",
"IoT",
"h... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L347-L354 |
h2oai/h2o-3 | h2o-core/src/main/java/jsr166y/CountedCompleter.java | CountedCompleter.__tryComplete | public final void __tryComplete(CountedCompleter caller) {
CountedCompleter a = this, s = caller;
for (int c;;) {
if((c = a.pending) == 0) {
a.onCompletion(s);
if ((a = (s = a).completer) == null) {
s.quietlyComplete();
return;
}
}
else if (U.compareAndSwapInt(a, PENDING, c, c - 1))
return;
}
} | java | public final void __tryComplete(CountedCompleter caller) {
CountedCompleter a = this, s = caller;
for (int c;;) {
if((c = a.pending) == 0) {
a.onCompletion(s);
if ((a = (s = a).completer) == null) {
s.quietlyComplete();
return;
}
}
else if (U.compareAndSwapInt(a, PENDING, c, c - 1))
return;
}
} | [
"public",
"final",
"void",
"__tryComplete",
"(",
"CountedCompleter",
"caller",
")",
"{",
"CountedCompleter",
"a",
"=",
"this",
",",
"s",
"=",
"caller",
";",
"for",
"(",
"int",
"c",
";",
";",
")",
"{",
"if",
"(",
"(",
"c",
"=",
"a",
".",
"pending",
... | H2O Hack to get distributed FJ behavior closer to the behavior on local node.
It allows us to continue in "completion propagation" interrupted by remote task.
Should *not* be called by anyone outside of RPC mechanism.
In standard FJ, tryComplete is always called by the task itself and the task is thus it's own caller.
Afterwards, the FJ framework will start propagating the completion up the task tree, walking up the list of completers(parents)
each time calling onCompletion of the parent with the current node (the child which triggered the completion) being passed as the "caller" argument.
When there is a distributed task in the chain, the sequence is broken as the task is completed on a remote node.
We want to be able to continue the completion chain, i.e. the remote task should now call onCompletion of its parent with itself passed as the caller argument.
We can not call tryComplete on the task, since it has already been called on the remote.
Instead, we explicitly set the caller argument in this overloaded tryComplete calls
Example:
new RPC(node,task).addCompletor(f(x) {...})
When we receive the reponse, we want to pass task as x to f.
We call f.__tryComplete(task)
@param caller - The child task completing this | [
"H2O",
"Hack",
"to",
"get",
"distributed",
"FJ",
"behavior",
"closer",
"to",
"the",
"behavior",
"on",
"local",
"node",
".",
"It",
"allows",
"us",
"to",
"continue",
"in",
"completion",
"propagation",
"interrupted",
"by",
"remote",
"task",
".",
"Should",
"*",
... | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/jsr166y/CountedCompleter.java#L421-L434 |
PunchThrough/bean-sdk-android | sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java | Bean.sendMessage | private void sendMessage(BeanMessageID type, Buffer payload) {
Buffer buffer = new Buffer();
buffer.writeByte((type.getRawValue() >> 8) & 0xff);
buffer.writeByte(type.getRawValue() & 0xff);
if (payload != null) {
try {
buffer.writeAll(payload);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
GattSerialMessage serialMessage = GattSerialMessage.fromPayload(buffer.readByteArray());
gattClient.getSerialProfile().sendMessage(serialMessage.getBuffer());
} | java | private void sendMessage(BeanMessageID type, Buffer payload) {
Buffer buffer = new Buffer();
buffer.writeByte((type.getRawValue() >> 8) & 0xff);
buffer.writeByte(type.getRawValue() & 0xff);
if (payload != null) {
try {
buffer.writeAll(payload);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
GattSerialMessage serialMessage = GattSerialMessage.fromPayload(buffer.readByteArray());
gattClient.getSerialProfile().sendMessage(serialMessage.getBuffer());
} | [
"private",
"void",
"sendMessage",
"(",
"BeanMessageID",
"type",
",",
"Buffer",
"payload",
")",
"{",
"Buffer",
"buffer",
"=",
"new",
"Buffer",
"(",
")",
";",
"buffer",
".",
"writeByte",
"(",
"(",
"type",
".",
"getRawValue",
"(",
")",
">>",
"8",
")",
"&"... | Send a message to Bean with a payload.
@param type The {@link com.punchthrough.bean.sdk.internal.BeanMessageID} for the message
@param payload The message payload to send | [
"Send",
"a",
"message",
"to",
"Bean",
"with",
"a",
"payload",
"."
] | train | https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L730-L743 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/SetUserIDHandler.java | SetUserIDHandler.init | public void init(Record thisFile, String userIdFieldName, boolean bFirstTimeOnly)
{
super.init(thisFile);
this.userIdFieldName = userIdFieldName;
m_bFirstTimeOnly = bFirstTimeOnly;
} | java | public void init(Record thisFile, String userIdFieldName, boolean bFirstTimeOnly)
{
super.init(thisFile);
this.userIdFieldName = userIdFieldName;
m_bFirstTimeOnly = bFirstTimeOnly;
} | [
"public",
"void",
"init",
"(",
"Record",
"thisFile",
",",
"String",
"userIdFieldName",
",",
"boolean",
"bFirstTimeOnly",
")",
"{",
"super",
".",
"init",
"(",
"thisFile",
")",
";",
"this",
".",
"userIdFieldName",
"=",
"userIdFieldName",
";",
"m_bFirstTimeOnly",
... | Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()).
@param iFieldSeq Sequence of the user id field.
@param iFirstTimeOnly Set it on the first time only? | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SetUserIDHandler.java#L56-L61 |
grpc/grpc-java | api/src/main/java/io/grpc/Status.java | Status.withCause | public Status withCause(Throwable cause) {
if (Objects.equal(this.cause, cause)) {
return this;
}
return new Status(this.code, this.description, cause);
} | java | public Status withCause(Throwable cause) {
if (Objects.equal(this.cause, cause)) {
return this;
}
return new Status(this.code, this.description, cause);
} | [
"public",
"Status",
"withCause",
"(",
"Throwable",
"cause",
")",
"{",
"if",
"(",
"Objects",
".",
"equal",
"(",
"this",
".",
"cause",
",",
"cause",
")",
")",
"{",
"return",
"this",
";",
"}",
"return",
"new",
"Status",
"(",
"this",
".",
"code",
",",
... | Create a derived instance of {@link Status} with the given cause.
However, the cause is not transmitted from server to client. | [
"Create",
"a",
"derived",
"instance",
"of",
"{"
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/Status.java#L455-L460 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.