repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
listlengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
listlengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ParsedScheduleExpression.java | ParsedScheduleExpression.getNextVariableDay | private int getNextVariableDay(int day, int lastDay, int dayOfWeek) // d659945 {
"""
Returns the next day of the month after <tt>day</tt> that satisfies
the variableDayOfMonthRanges constraint.
@param day the current 0-based day of the month
@param lastDay the current 0-based last day of the month
@param dayOfWeek the current 0-based day of the week
@return a value greater than or equal to <tt>day</tt>
"""
int nextDay = ADVANCE_TO_NEXT_MONTH;
for (int i = 0; i < variableDayOfMonthRanges.size(); i++)
{
int result = variableDayOfMonthRanges.get(i).getNextDay(day, lastDay, dayOfWeek);
if (result == day)
{
return day;
}
nextDay = Math.min(nextDay, result);
}
return nextDay;
} | java | private int getNextVariableDay(int day, int lastDay, int dayOfWeek) // d659945
{
int nextDay = ADVANCE_TO_NEXT_MONTH;
for (int i = 0; i < variableDayOfMonthRanges.size(); i++)
{
int result = variableDayOfMonthRanges.get(i).getNextDay(day, lastDay, dayOfWeek);
if (result == day)
{
return day;
}
nextDay = Math.min(nextDay, result);
}
return nextDay;
} | [
"private",
"int",
"getNextVariableDay",
"(",
"int",
"day",
",",
"int",
"lastDay",
",",
"int",
"dayOfWeek",
")",
"// d659945",
"{",
"int",
"nextDay",
"=",
"ADVANCE_TO_NEXT_MONTH",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"variableDayOfMonthRanges",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"int",
"result",
"=",
"variableDayOfMonthRanges",
".",
"get",
"(",
"i",
")",
".",
"getNextDay",
"(",
"day",
",",
"lastDay",
",",
"dayOfWeek",
")",
";",
"if",
"(",
"result",
"==",
"day",
")",
"{",
"return",
"day",
";",
"}",
"nextDay",
"=",
"Math",
".",
"min",
"(",
"nextDay",
",",
"result",
")",
";",
"}",
"return",
"nextDay",
";",
"}"
]
| Returns the next day of the month after <tt>day</tt> that satisfies
the variableDayOfMonthRanges constraint.
@param day the current 0-based day of the month
@param lastDay the current 0-based last day of the month
@param dayOfWeek the current 0-based day of the week
@return a value greater than or equal to <tt>day</tt> | [
"Returns",
"the",
"next",
"day",
"of",
"the",
"month",
"after",
"<tt",
">",
"day<",
"/",
"tt",
">",
"that",
"satisfies",
"the",
"variableDayOfMonthRanges",
"constraint",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ParsedScheduleExpression.java#L1057-L1073 |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/SpringBootUtil.java | SpringBootUtil.getSpringBootMavenPluginClassifier | public static String getSpringBootMavenPluginClassifier(MavenProject project, Log log) {
"""
Read the value of the classifier configuration parameter from the
spring-boot-maven-plugin
@param project
@param log
@return the value if it was found, null otherwise
"""
String classifier = null;
try {
classifier = MavenProjectUtil.getPluginGoalConfigurationString(project,
"org.springframework.boot:spring-boot-maven-plugin", "repackage", "classifier");
} catch (PluginScenarioException e) {
log.debug("No classifier found for spring-boot-maven-plugin");
}
return classifier;
} | java | public static String getSpringBootMavenPluginClassifier(MavenProject project, Log log) {
String classifier = null;
try {
classifier = MavenProjectUtil.getPluginGoalConfigurationString(project,
"org.springframework.boot:spring-boot-maven-plugin", "repackage", "classifier");
} catch (PluginScenarioException e) {
log.debug("No classifier found for spring-boot-maven-plugin");
}
return classifier;
} | [
"public",
"static",
"String",
"getSpringBootMavenPluginClassifier",
"(",
"MavenProject",
"project",
",",
"Log",
"log",
")",
"{",
"String",
"classifier",
"=",
"null",
";",
"try",
"{",
"classifier",
"=",
"MavenProjectUtil",
".",
"getPluginGoalConfigurationString",
"(",
"project",
",",
"\"org.springframework.boot:spring-boot-maven-plugin\"",
",",
"\"repackage\"",
",",
"\"classifier\"",
")",
";",
"}",
"catch",
"(",
"PluginScenarioException",
"e",
")",
"{",
"log",
".",
"debug",
"(",
"\"No classifier found for spring-boot-maven-plugin\"",
")",
";",
"}",
"return",
"classifier",
";",
"}"
]
| Read the value of the classifier configuration parameter from the
spring-boot-maven-plugin
@param project
@param log
@return the value if it was found, null otherwise | [
"Read",
"the",
"value",
"of",
"the",
"classifier",
"configuration",
"parameter",
"from",
"the",
"spring",
"-",
"boot",
"-",
"maven",
"-",
"plugin"
]
| train | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/SpringBootUtil.java#L35-L44 |
geomajas/geomajas-project-client-gwt2 | common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java | StyleUtil.createCssParameter | public static CssParameterInfo createCssParameter(String name, Object value) {
"""
Creates a CSS parameter with specified name and value.
@param name the name
@param value the value
@return the parameter
"""
CssParameterInfo css = new CssParameterInfo();
css.setName(name);
css.setValue(value.toString());
return css;
} | java | public static CssParameterInfo createCssParameter(String name, Object value) {
CssParameterInfo css = new CssParameterInfo();
css.setName(name);
css.setValue(value.toString());
return css;
} | [
"public",
"static",
"CssParameterInfo",
"createCssParameter",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"CssParameterInfo",
"css",
"=",
"new",
"CssParameterInfo",
"(",
")",
";",
"css",
".",
"setName",
"(",
"name",
")",
";",
"css",
".",
"setValue",
"(",
"value",
".",
"toString",
"(",
")",
")",
";",
"return",
"css",
";",
"}"
]
| Creates a CSS parameter with specified name and value.
@param name the name
@param value the value
@return the parameter | [
"Creates",
"a",
"CSS",
"parameter",
"with",
"specified",
"name",
"and",
"value",
"."
]
| train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java#L335-L340 |
apache/groovy | subprojects/groovy-swing/src/main/java/org/codehaus/groovy/binding/BindPath.java | BindPath.addAllListeners | public void addAllListeners(PropertyChangeListener listener, Object newObject, Set updateSet) {
"""
Adds all the listeners to the objects in the bind path.
This assumes that we are not added as listeners to any of them, hence
it is not idempotent.
@param listener This listener to attach.
@param newObject The object we should read our property off of.
@param updateSet The list of objects we have added listeners to
"""
addListeners(listener, newObject, updateSet);
if ((children != null) && (children.length > 0)) {
try {
Object newValue = null;
if (newObject != null) {
updateSet.add(newObject);
newValue = extractNewValue(newObject);
}
for (BindPath child : children) {
child.addAllListeners(listener, newValue, updateSet);
}
} catch (Exception e) {
e.printStackTrace(System.out);
//LOGME
// do we ignore it, or fail?
}
}
} | java | public void addAllListeners(PropertyChangeListener listener, Object newObject, Set updateSet) {
addListeners(listener, newObject, updateSet);
if ((children != null) && (children.length > 0)) {
try {
Object newValue = null;
if (newObject != null) {
updateSet.add(newObject);
newValue = extractNewValue(newObject);
}
for (BindPath child : children) {
child.addAllListeners(listener, newValue, updateSet);
}
} catch (Exception e) {
e.printStackTrace(System.out);
//LOGME
// do we ignore it, or fail?
}
}
} | [
"public",
"void",
"addAllListeners",
"(",
"PropertyChangeListener",
"listener",
",",
"Object",
"newObject",
",",
"Set",
"updateSet",
")",
"{",
"addListeners",
"(",
"listener",
",",
"newObject",
",",
"updateSet",
")",
";",
"if",
"(",
"(",
"children",
"!=",
"null",
")",
"&&",
"(",
"children",
".",
"length",
">",
"0",
")",
")",
"{",
"try",
"{",
"Object",
"newValue",
"=",
"null",
";",
"if",
"(",
"newObject",
"!=",
"null",
")",
"{",
"updateSet",
".",
"add",
"(",
"newObject",
")",
";",
"newValue",
"=",
"extractNewValue",
"(",
"newObject",
")",
";",
"}",
"for",
"(",
"BindPath",
"child",
":",
"children",
")",
"{",
"child",
".",
"addAllListeners",
"(",
"listener",
",",
"newValue",
",",
"updateSet",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
"System",
".",
"out",
")",
";",
"//LOGME",
"// do we ignore it, or fail?",
"}",
"}",
"}"
]
| Adds all the listeners to the objects in the bind path.
This assumes that we are not added as listeners to any of them, hence
it is not idempotent.
@param listener This listener to attach.
@param newObject The object we should read our property off of.
@param updateSet The list of objects we have added listeners to | [
"Adds",
"all",
"the",
"listeners",
"to",
"the",
"objects",
"in",
"the",
"bind",
"path",
".",
"This",
"assumes",
"that",
"we",
"are",
"not",
"added",
"as",
"listeners",
"to",
"any",
"of",
"them",
"hence",
"it",
"is",
"not",
"idempotent",
"."
]
| train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/binding/BindPath.java#L104-L122 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/BinaryHeapPriorityQueue.java | BinaryHeapPriorityQueue.changePriority | public boolean changePriority(E key, double priority) {
"""
Changes a priority, either up or down, adding the key it if it wasn't there already.
@param key an <code>Object</code> value
@return whether the priority actually changed.
"""
Entry<E> entry = getEntry(key);
if (entry == null) {
entry = makeEntry(key);
}
if (compare(priority, entry.priority) == 0) {
return false;
}
entry.priority = priority;
heapify(entry);
return true;
} | java | public boolean changePriority(E key, double priority) {
Entry<E> entry = getEntry(key);
if (entry == null) {
entry = makeEntry(key);
}
if (compare(priority, entry.priority) == 0) {
return false;
}
entry.priority = priority;
heapify(entry);
return true;
} | [
"public",
"boolean",
"changePriority",
"(",
"E",
"key",
",",
"double",
"priority",
")",
"{",
"Entry",
"<",
"E",
">",
"entry",
"=",
"getEntry",
"(",
"key",
")",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"entry",
"=",
"makeEntry",
"(",
"key",
")",
";",
"}",
"if",
"(",
"compare",
"(",
"priority",
",",
"entry",
".",
"priority",
")",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"entry",
".",
"priority",
"=",
"priority",
";",
"heapify",
"(",
"entry",
")",
";",
"return",
"true",
";",
"}"
]
| Changes a priority, either up or down, adding the key it if it wasn't there already.
@param key an <code>Object</code> value
@return whether the priority actually changed. | [
"Changes",
"a",
"priority",
"either",
"up",
"or",
"down",
"adding",
"the",
"key",
"it",
"if",
"it",
"wasn",
"t",
"there",
"already",
"."
]
| train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/BinaryHeapPriorityQueue.java#L356-L367 |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/CmsClientVariantDisplay.java | CmsClientVariantDisplay.buildClientVariantUrl | private String buildClientVariantUrl(String context, CmsClientVariantInfo info) {
"""
Builds the URL for the client variant.<p>
@param context the template context name
@param info the client variant info
@return the URL for the variant
"""
String currentUrl = Window.Location.getHref();
// remove fragment
currentUrl = currentUrl.replaceFirst("#.*$", "");
String connector = "?";
if (currentUrl.indexOf('?') >= 0) {
connector = "&";
}
String targetUrl = currentUrl + connector + CmsGwtConstants.PARAM_TEMPLATE_CONTEXT + "=" + context;
return targetUrl;
} | java | private String buildClientVariantUrl(String context, CmsClientVariantInfo info) {
String currentUrl = Window.Location.getHref();
// remove fragment
currentUrl = currentUrl.replaceFirst("#.*$", "");
String connector = "?";
if (currentUrl.indexOf('?') >= 0) {
connector = "&";
}
String targetUrl = currentUrl + connector + CmsGwtConstants.PARAM_TEMPLATE_CONTEXT + "=" + context;
return targetUrl;
} | [
"private",
"String",
"buildClientVariantUrl",
"(",
"String",
"context",
",",
"CmsClientVariantInfo",
"info",
")",
"{",
"String",
"currentUrl",
"=",
"Window",
".",
"Location",
".",
"getHref",
"(",
")",
";",
"// remove fragment",
"currentUrl",
"=",
"currentUrl",
".",
"replaceFirst",
"(",
"\"#.*$\"",
",",
"\"\"",
")",
";",
"String",
"connector",
"=",
"\"?\"",
";",
"if",
"(",
"currentUrl",
".",
"indexOf",
"(",
"'",
"'",
")",
">=",
"0",
")",
"{",
"connector",
"=",
"\"&\"",
";",
"}",
"String",
"targetUrl",
"=",
"currentUrl",
"+",
"connector",
"+",
"CmsGwtConstants",
".",
"PARAM_TEMPLATE_CONTEXT",
"+",
"\"=\"",
"+",
"context",
";",
"return",
"targetUrl",
";",
"}"
]
| Builds the URL for the client variant.<p>
@param context the template context name
@param info the client variant info
@return the URL for the variant | [
"Builds",
"the",
"URL",
"for",
"the",
"client",
"variant",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsClientVariantDisplay.java#L142-L153 |
google/closure-compiler | src/com/google/javascript/jscomp/DevirtualizePrototypeMethods.java | DevirtualizePrototypeMethods.replaceReferencesToThis | private void replaceReferencesToThis(Node node, String name) {
"""
Replaces references to "this" with references to name. Do not traverse function boundaries.
"""
if (node.isFunction() && !node.isArrowFunction()) {
// Functions (besides arrows) create a new binding for `this`.
return;
}
for (Node child : node.children()) {
if (child.isThis()) {
Node newName = IR.name(name).useSourceInfoFrom(child).setJSType(child.getJSType());
node.replaceChild(child, newName);
compiler.reportChangeToEnclosingScope(newName);
} else {
replaceReferencesToThis(child, name);
}
}
} | java | private void replaceReferencesToThis(Node node, String name) {
if (node.isFunction() && !node.isArrowFunction()) {
// Functions (besides arrows) create a new binding for `this`.
return;
}
for (Node child : node.children()) {
if (child.isThis()) {
Node newName = IR.name(name).useSourceInfoFrom(child).setJSType(child.getJSType());
node.replaceChild(child, newName);
compiler.reportChangeToEnclosingScope(newName);
} else {
replaceReferencesToThis(child, name);
}
}
} | [
"private",
"void",
"replaceReferencesToThis",
"(",
"Node",
"node",
",",
"String",
"name",
")",
"{",
"if",
"(",
"node",
".",
"isFunction",
"(",
")",
"&&",
"!",
"node",
".",
"isArrowFunction",
"(",
")",
")",
"{",
"// Functions (besides arrows) create a new binding for `this`.",
"return",
";",
"}",
"for",
"(",
"Node",
"child",
":",
"node",
".",
"children",
"(",
")",
")",
"{",
"if",
"(",
"child",
".",
"isThis",
"(",
")",
")",
"{",
"Node",
"newName",
"=",
"IR",
".",
"name",
"(",
"name",
")",
".",
"useSourceInfoFrom",
"(",
"child",
")",
".",
"setJSType",
"(",
"child",
".",
"getJSType",
"(",
")",
")",
";",
"node",
".",
"replaceChild",
"(",
"child",
",",
"newName",
")",
";",
"compiler",
".",
"reportChangeToEnclosingScope",
"(",
"newName",
")",
";",
"}",
"else",
"{",
"replaceReferencesToThis",
"(",
"child",
",",
"name",
")",
";",
"}",
"}",
"}"
]
| Replaces references to "this" with references to name. Do not traverse function boundaries. | [
"Replaces",
"references",
"to",
"this",
"with",
"references",
"to",
"name",
".",
"Do",
"not",
"traverse",
"function",
"boundaries",
"."
]
| train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DevirtualizePrototypeMethods.java#L475-L490 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.createResource | @SuppressWarnings("javadoc")
public CmsResource createResource(
CmsDbContext dbc,
String resourcename,
int type,
byte[] content,
List<CmsProperty> properties)
throws CmsException, CmsIllegalArgumentException {
"""
Creates a new resource of the given resource type
with the provided content and properties.<p>
If the provided content is null and the resource is not a folder,
the content will be set to an empty byte array.<p>
@param dbc the current database context
@param resourcename the name of the resource to create (full path)
@param type the type of the resource to create
@param content the content for the new resource
@param properties the properties for the new resource
@return the created resource
@throws CmsException if something goes wrong
@throws CmsIllegalArgumentException if the <code>resourcename</code> argument is null or of length 0
@see CmsObject#createResource(String, int, byte[], List)
@see CmsObject#createResource(String, int)
@see I_CmsResourceType#createResource(CmsObject, CmsSecurityManager, String, byte[], List)
"""
String targetName = resourcename;
if (content == null) {
// name based resource creation MUST have a content
content = new byte[0];
}
int size;
if (CmsFolder.isFolderType(type)) {
// must cut of trailing '/' for folder creation
if (CmsResource.isFolder(targetName)) {
targetName = targetName.substring(0, targetName.length() - 1);
}
size = -1;
} else {
size = content.length;
}
// create a new resource
CmsResource newResource = new CmsResource(
CmsUUID.getNullUUID(), // uuids will be "corrected" later
CmsUUID.getNullUUID(),
targetName,
type,
CmsFolder.isFolderType(type),
0,
dbc.currentProject().getUuid(),
CmsResource.STATE_NEW,
0,
dbc.currentUser().getId(),
0,
dbc.currentUser().getId(),
CmsResource.DATE_RELEASED_DEFAULT,
CmsResource.DATE_EXPIRED_DEFAULT,
1,
size,
0, // version number does not matter since it will be computed later
0); // content time will be corrected later
return createResource(dbc, targetName, newResource, content, properties, false);
} | java | @SuppressWarnings("javadoc")
public CmsResource createResource(
CmsDbContext dbc,
String resourcename,
int type,
byte[] content,
List<CmsProperty> properties)
throws CmsException, CmsIllegalArgumentException {
String targetName = resourcename;
if (content == null) {
// name based resource creation MUST have a content
content = new byte[0];
}
int size;
if (CmsFolder.isFolderType(type)) {
// must cut of trailing '/' for folder creation
if (CmsResource.isFolder(targetName)) {
targetName = targetName.substring(0, targetName.length() - 1);
}
size = -1;
} else {
size = content.length;
}
// create a new resource
CmsResource newResource = new CmsResource(
CmsUUID.getNullUUID(), // uuids will be "corrected" later
CmsUUID.getNullUUID(),
targetName,
type,
CmsFolder.isFolderType(type),
0,
dbc.currentProject().getUuid(),
CmsResource.STATE_NEW,
0,
dbc.currentUser().getId(),
0,
dbc.currentUser().getId(),
CmsResource.DATE_RELEASED_DEFAULT,
CmsResource.DATE_EXPIRED_DEFAULT,
1,
size,
0, // version number does not matter since it will be computed later
0); // content time will be corrected later
return createResource(dbc, targetName, newResource, content, properties, false);
} | [
"@",
"SuppressWarnings",
"(",
"\"javadoc\"",
")",
"public",
"CmsResource",
"createResource",
"(",
"CmsDbContext",
"dbc",
",",
"String",
"resourcename",
",",
"int",
"type",
",",
"byte",
"[",
"]",
"content",
",",
"List",
"<",
"CmsProperty",
">",
"properties",
")",
"throws",
"CmsException",
",",
"CmsIllegalArgumentException",
"{",
"String",
"targetName",
"=",
"resourcename",
";",
"if",
"(",
"content",
"==",
"null",
")",
"{",
"// name based resource creation MUST have a content",
"content",
"=",
"new",
"byte",
"[",
"0",
"]",
";",
"}",
"int",
"size",
";",
"if",
"(",
"CmsFolder",
".",
"isFolderType",
"(",
"type",
")",
")",
"{",
"// must cut of trailing '/' for folder creation",
"if",
"(",
"CmsResource",
".",
"isFolder",
"(",
"targetName",
")",
")",
"{",
"targetName",
"=",
"targetName",
".",
"substring",
"(",
"0",
",",
"targetName",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"size",
"=",
"-",
"1",
";",
"}",
"else",
"{",
"size",
"=",
"content",
".",
"length",
";",
"}",
"// create a new resource",
"CmsResource",
"newResource",
"=",
"new",
"CmsResource",
"(",
"CmsUUID",
".",
"getNullUUID",
"(",
")",
",",
"// uuids will be \"corrected\" later",
"CmsUUID",
".",
"getNullUUID",
"(",
")",
",",
"targetName",
",",
"type",
",",
"CmsFolder",
".",
"isFolderType",
"(",
"type",
")",
",",
"0",
",",
"dbc",
".",
"currentProject",
"(",
")",
".",
"getUuid",
"(",
")",
",",
"CmsResource",
".",
"STATE_NEW",
",",
"0",
",",
"dbc",
".",
"currentUser",
"(",
")",
".",
"getId",
"(",
")",
",",
"0",
",",
"dbc",
".",
"currentUser",
"(",
")",
".",
"getId",
"(",
")",
",",
"CmsResource",
".",
"DATE_RELEASED_DEFAULT",
",",
"CmsResource",
".",
"DATE_EXPIRED_DEFAULT",
",",
"1",
",",
"size",
",",
"0",
",",
"// version number does not matter since it will be computed later",
"0",
")",
";",
"// content time will be corrected later",
"return",
"createResource",
"(",
"dbc",
",",
"targetName",
",",
"newResource",
",",
"content",
",",
"properties",
",",
"false",
")",
";",
"}"
]
| Creates a new resource of the given resource type
with the provided content and properties.<p>
If the provided content is null and the resource is not a folder,
the content will be set to an empty byte array.<p>
@param dbc the current database context
@param resourcename the name of the resource to create (full path)
@param type the type of the resource to create
@param content the content for the new resource
@param properties the properties for the new resource
@return the created resource
@throws CmsException if something goes wrong
@throws CmsIllegalArgumentException if the <code>resourcename</code> argument is null or of length 0
@see CmsObject#createResource(String, int, byte[], List)
@see CmsObject#createResource(String, int)
@see I_CmsResourceType#createResource(CmsObject, CmsSecurityManager, String, byte[], List) | [
"Creates",
"a",
"new",
"resource",
"of",
"the",
"given",
"resource",
"type",
"with",
"the",
"provided",
"content",
"and",
"properties",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L1970-L2019 |
elibom/jogger | src/main/java/com/elibom/jogger/Jogger.java | Jogger.handle | private void handle(final Request request, final Response response, final List<Middleware> middlewares) throws Exception {
"""
Helper method. Creates a {@link MiddlewareChain} implementation to recursively call the middlewares.
@param request
@param response
@param middlewares
@throws Exception
"""
if (middlewares.isEmpty()) {
throw new NotFoundException();
}
Middleware current = middlewares.remove(0);
current.handle(request, response, new MiddlewareChain() {
@Override
public void next() throws Exception {
// recursive call
handle(request, response, middlewares);
}
});
} | java | private void handle(final Request request, final Response response, final List<Middleware> middlewares) throws Exception {
if (middlewares.isEmpty()) {
throw new NotFoundException();
}
Middleware current = middlewares.remove(0);
current.handle(request, response, new MiddlewareChain() {
@Override
public void next() throws Exception {
// recursive call
handle(request, response, middlewares);
}
});
} | [
"private",
"void",
"handle",
"(",
"final",
"Request",
"request",
",",
"final",
"Response",
"response",
",",
"final",
"List",
"<",
"Middleware",
">",
"middlewares",
")",
"throws",
"Exception",
"{",
"if",
"(",
"middlewares",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"NotFoundException",
"(",
")",
";",
"}",
"Middleware",
"current",
"=",
"middlewares",
".",
"remove",
"(",
"0",
")",
";",
"current",
".",
"handle",
"(",
"request",
",",
"response",
",",
"new",
"MiddlewareChain",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"next",
"(",
")",
"throws",
"Exception",
"{",
"// recursive call",
"handle",
"(",
"request",
",",
"response",
",",
"middlewares",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Helper method. Creates a {@link MiddlewareChain} implementation to recursively call the middlewares.
@param request
@param response
@param middlewares
@throws Exception | [
"Helper",
"method",
".",
"Creates",
"a",
"{",
"@link",
"MiddlewareChain",
"}",
"implementation",
"to",
"recursively",
"call",
"the",
"middlewares",
"."
]
| train | https://github.com/elibom/jogger/blob/d5892ff45e76328d444a68b5a38c26e7bdd0692b/src/main/java/com/elibom/jogger/Jogger.java#L131-L144 |
datacleaner/DataCleaner | desktop/api/src/main/java/org/datacleaner/util/WidgetUtils.java | WidgetUtils.decorateWithShadow | public static DCPanel decorateWithShadow(final JComponent comp, final boolean outline, final int margin) {
"""
Decorates a JComponent with a nice shadow border. Since not all JComponents handle opacity correctly, they will
be wrapped inside a DCPanel, which actually has the border.
@param comp
@param outline
@param margin
@return
"""
final DCPanel panel = new DCPanel();
panel.setLayout(new BorderLayout());
Border border = BORDER_SHADOW;
if (outline) {
border = new CompoundBorder(border, BORDER_THIN);
}
if (margin > 0) {
border = new CompoundBorder(new EmptyBorder(margin, margin, margin, margin), border);
}
panel.setBorder(border);
panel.add(comp, BorderLayout.CENTER);
return panel;
} | java | public static DCPanel decorateWithShadow(final JComponent comp, final boolean outline, final int margin) {
final DCPanel panel = new DCPanel();
panel.setLayout(new BorderLayout());
Border border = BORDER_SHADOW;
if (outline) {
border = new CompoundBorder(border, BORDER_THIN);
}
if (margin > 0) {
border = new CompoundBorder(new EmptyBorder(margin, margin, margin, margin), border);
}
panel.setBorder(border);
panel.add(comp, BorderLayout.CENTER);
return panel;
} | [
"public",
"static",
"DCPanel",
"decorateWithShadow",
"(",
"final",
"JComponent",
"comp",
",",
"final",
"boolean",
"outline",
",",
"final",
"int",
"margin",
")",
"{",
"final",
"DCPanel",
"panel",
"=",
"new",
"DCPanel",
"(",
")",
";",
"panel",
".",
"setLayout",
"(",
"new",
"BorderLayout",
"(",
")",
")",
";",
"Border",
"border",
"=",
"BORDER_SHADOW",
";",
"if",
"(",
"outline",
")",
"{",
"border",
"=",
"new",
"CompoundBorder",
"(",
"border",
",",
"BORDER_THIN",
")",
";",
"}",
"if",
"(",
"margin",
">",
"0",
")",
"{",
"border",
"=",
"new",
"CompoundBorder",
"(",
"new",
"EmptyBorder",
"(",
"margin",
",",
"margin",
",",
"margin",
",",
"margin",
")",
",",
"border",
")",
";",
"}",
"panel",
".",
"setBorder",
"(",
"border",
")",
";",
"panel",
".",
"add",
"(",
"comp",
",",
"BorderLayout",
".",
"CENTER",
")",
";",
"return",
"panel",
";",
"}"
]
| Decorates a JComponent with a nice shadow border. Since not all JComponents handle opacity correctly, they will
be wrapped inside a DCPanel, which actually has the border.
@param comp
@param outline
@param margin
@return | [
"Decorates",
"a",
"JComponent",
"with",
"a",
"nice",
"shadow",
"border",
".",
"Since",
"not",
"all",
"JComponents",
"handle",
"opacity",
"correctly",
"they",
"will",
"be",
"wrapped",
"inside",
"a",
"DCPanel",
"which",
"actually",
"has",
"the",
"border",
"."
]
| train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/util/WidgetUtils.java#L615-L628 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/media/MediaClient.java | MediaClient.createPipeline | public CreatePipelineResponse createPipeline(CreatePipelineRequest request) {
"""
Creates a pipeline which enable you to perform multiple transcodes in parallel.
@param request The request object containing all options for creating new pipeline.
"""
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getPipelineName(),
"The parameter pipelineName should NOT be null or empty string.");
checkStringNotEmpty(request.getSourceBucket(),
"The parameter sourceBucket should NOT be null or empty string.");
checkStringNotEmpty(request.getTargetBucket(),
"The parameter targetBucket should NOT be null or empty string.");
if (request.getConfig() == null || request.getConfig().getCapacity() == null) {
PipelineConfig config = new PipelineConfig();
config.setCapacity(DEFAULT_PIPELINE_CAPACITY);
request.setConfig(config);
}
InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, PIPELINE);
return invokeHttpClient(internalRequest, CreatePipelineResponse.class);
} | java | public CreatePipelineResponse createPipeline(CreatePipelineRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getPipelineName(),
"The parameter pipelineName should NOT be null or empty string.");
checkStringNotEmpty(request.getSourceBucket(),
"The parameter sourceBucket should NOT be null or empty string.");
checkStringNotEmpty(request.getTargetBucket(),
"The parameter targetBucket should NOT be null or empty string.");
if (request.getConfig() == null || request.getConfig().getCapacity() == null) {
PipelineConfig config = new PipelineConfig();
config.setCapacity(DEFAULT_PIPELINE_CAPACITY);
request.setConfig(config);
}
InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, PIPELINE);
return invokeHttpClient(internalRequest, CreatePipelineResponse.class);
} | [
"public",
"CreatePipelineResponse",
"createPipeline",
"(",
"CreatePipelineRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getPipelineName",
"(",
")",
",",
"\"The parameter pipelineName should NOT be null or empty string.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getSourceBucket",
"(",
")",
",",
"\"The parameter sourceBucket should NOT be null or empty string.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getTargetBucket",
"(",
")",
",",
"\"The parameter targetBucket should NOT be null or empty string.\"",
")",
";",
"if",
"(",
"request",
".",
"getConfig",
"(",
")",
"==",
"null",
"||",
"request",
".",
"getConfig",
"(",
")",
".",
"getCapacity",
"(",
")",
"==",
"null",
")",
"{",
"PipelineConfig",
"config",
"=",
"new",
"PipelineConfig",
"(",
")",
";",
"config",
".",
"setCapacity",
"(",
"DEFAULT_PIPELINE_CAPACITY",
")",
";",
"request",
".",
"setConfig",
"(",
"config",
")",
";",
"}",
"InternalRequest",
"internalRequest",
"=",
"createRequest",
"(",
"HttpMethodName",
".",
"POST",
",",
"request",
",",
"PIPELINE",
")",
";",
"return",
"invokeHttpClient",
"(",
"internalRequest",
",",
"CreatePipelineResponse",
".",
"class",
")",
";",
"}"
]
| Creates a pipeline which enable you to perform multiple transcodes in parallel.
@param request The request object containing all options for creating new pipeline. | [
"Creates",
"a",
"pipeline",
"which",
"enable",
"you",
"to",
"perform",
"multiple",
"transcodes",
"in",
"parallel",
"."
]
| train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L571-L587 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java | CPMeasurementUnitPersistenceImpl.findByGroupId | @Override
public List<CPMeasurementUnit> findByGroupId(long groupId, int start,
int end) {
"""
Returns a range of all the cp measurement units where groupId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPMeasurementUnitModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param start the lower bound of the range of cp measurement units
@param end the upper bound of the range of cp measurement units (not inclusive)
@return the range of matching cp measurement units
"""
return findByGroupId(groupId, start, end, null);
} | java | @Override
public List<CPMeasurementUnit> findByGroupId(long groupId, int start,
int end) {
return findByGroupId(groupId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPMeasurementUnit",
">",
"findByGroupId",
"(",
"long",
"groupId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
]
| Returns a range of all the cp measurement units where groupId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPMeasurementUnitModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param start the lower bound of the range of cp measurement units
@param end the upper bound of the range of cp measurement units (not inclusive)
@return the range of matching cp measurement units | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"measurement",
"units",
"where",
"groupId",
"=",
"?",
";",
"."
]
| train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java#L1533-L1537 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/exceptions/MessageUtils.java | MessageUtils.buildMessage | static String buildMessage(BeanResolutionContext resolutionContext, String message) {
"""
Builds an appropriate error message.
@param resolutionContext The resolution context
@param message The message
@return The message
"""
BeanResolutionContext.Path path = resolutionContext.getPath();
BeanDefinition declaringType;
boolean hasPath = !path.isEmpty();
if (hasPath) {
BeanResolutionContext.Segment segment = path.peek();
declaringType = segment.getDeclaringType();
} else {
declaringType = resolutionContext.getRootDefinition();
}
String ls = System.getProperty("line.separator");
StringBuilder builder = new StringBuilder("Error instantiating bean of type [");
builder
.append(declaringType.getName())
.append("]")
.append(ls)
.append(ls);
if (message != null) {
builder.append("Message: ").append(message).append(ls);
}
if (hasPath) {
String pathString = path.toString();
builder.append("Path Taken: ").append(pathString);
}
return builder.toString();
} | java | static String buildMessage(BeanResolutionContext resolutionContext, String message) {
BeanResolutionContext.Path path = resolutionContext.getPath();
BeanDefinition declaringType;
boolean hasPath = !path.isEmpty();
if (hasPath) {
BeanResolutionContext.Segment segment = path.peek();
declaringType = segment.getDeclaringType();
} else {
declaringType = resolutionContext.getRootDefinition();
}
String ls = System.getProperty("line.separator");
StringBuilder builder = new StringBuilder("Error instantiating bean of type [");
builder
.append(declaringType.getName())
.append("]")
.append(ls)
.append(ls);
if (message != null) {
builder.append("Message: ").append(message).append(ls);
}
if (hasPath) {
String pathString = path.toString();
builder.append("Path Taken: ").append(pathString);
}
return builder.toString();
} | [
"static",
"String",
"buildMessage",
"(",
"BeanResolutionContext",
"resolutionContext",
",",
"String",
"message",
")",
"{",
"BeanResolutionContext",
".",
"Path",
"path",
"=",
"resolutionContext",
".",
"getPath",
"(",
")",
";",
"BeanDefinition",
"declaringType",
";",
"boolean",
"hasPath",
"=",
"!",
"path",
".",
"isEmpty",
"(",
")",
";",
"if",
"(",
"hasPath",
")",
"{",
"BeanResolutionContext",
".",
"Segment",
"segment",
"=",
"path",
".",
"peek",
"(",
")",
";",
"declaringType",
"=",
"segment",
".",
"getDeclaringType",
"(",
")",
";",
"}",
"else",
"{",
"declaringType",
"=",
"resolutionContext",
".",
"getRootDefinition",
"(",
")",
";",
"}",
"String",
"ls",
"=",
"System",
".",
"getProperty",
"(",
"\"line.separator\"",
")",
";",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"\"Error instantiating bean of type [\"",
")",
";",
"builder",
".",
"append",
"(",
"declaringType",
".",
"getName",
"(",
")",
")",
".",
"append",
"(",
"\"]\"",
")",
".",
"append",
"(",
"ls",
")",
".",
"append",
"(",
"ls",
")",
";",
"if",
"(",
"message",
"!=",
"null",
")",
"{",
"builder",
".",
"append",
"(",
"\"Message: \"",
")",
".",
"append",
"(",
"message",
")",
".",
"append",
"(",
"ls",
")",
";",
"}",
"if",
"(",
"hasPath",
")",
"{",
"String",
"pathString",
"=",
"path",
".",
"toString",
"(",
")",
";",
"builder",
".",
"append",
"(",
"\"Path Taken: \"",
")",
".",
"append",
"(",
"pathString",
")",
";",
"}",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
]
| Builds an appropriate error message.
@param resolutionContext The resolution context
@param message The message
@return The message | [
"Builds",
"an",
"appropriate",
"error",
"message",
"."
]
| train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/exceptions/MessageUtils.java#L39-L65 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ContentHandler.java | ContentHandler.getContent | @SuppressWarnings("rawtypes")
public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
"""
Given a URL connect stream positioned at the beginning of the
representation of an object, this method reads that stream and
creates an object that matches one of the types specified.
The default implementation of this method should call getContent()
and screen the return type for a match of the suggested types.
@param urlc a URL connection.
@param classes an array of types requested
@return the object read by the {@code ContentHandler} that is
the first match of the suggested types.
null if none of the requested are supported.
@exception IOException if an I/O error occurs while reading the object.
@since 1.3
"""
Object obj = getContent(urlc);
for (int i = 0; i < classes.length; i++) {
if (classes[i].isInstance(obj)) {
return obj;
}
}
return null;
} | java | @SuppressWarnings("rawtypes")
public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
Object obj = getContent(urlc);
for (int i = 0; i < classes.length; i++) {
if (classes[i].isInstance(obj)) {
return obj;
}
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"Object",
"getContent",
"(",
"URLConnection",
"urlc",
",",
"Class",
"[",
"]",
"classes",
")",
"throws",
"IOException",
"{",
"Object",
"obj",
"=",
"getContent",
"(",
"urlc",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"classes",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"classes",
"[",
"i",
"]",
".",
"isInstance",
"(",
"obj",
")",
")",
"{",
"return",
"obj",
";",
"}",
"}",
"return",
"null",
";",
"}"
]
| Given a URL connect stream positioned at the beginning of the
representation of an object, this method reads that stream and
creates an object that matches one of the types specified.
The default implementation of this method should call getContent()
and screen the return type for a match of the suggested types.
@param urlc a URL connection.
@param classes an array of types requested
@return the object read by the {@code ContentHandler} that is
the first match of the suggested types.
null if none of the requested are supported.
@exception IOException if an I/O error occurs while reading the object.
@since 1.3 | [
"Given",
"a",
"URL",
"connect",
"stream",
"positioned",
"at",
"the",
"beginning",
"of",
"the",
"representation",
"of",
"an",
"object",
"this",
"method",
"reads",
"that",
"stream",
"and",
"creates",
"an",
"object",
"that",
"matches",
"one",
"of",
"the",
"types",
"specified",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ContentHandler.java#L99-L109 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java | FaceletViewDeclarationLanguage._getFacelet | private Facelet _getFacelet(FacesContext context, String viewId) throws IOException {
"""
Gets the Facelet representing the specified view identifier.
@param viewId
the view identifier
@return the Facelet representing the specified view identifier
@throws IOException
if a read or parsing error occurs
"""
// grab our FaceletFactory and create a Facelet
FaceletFactory.setInstance(_faceletFactory);
try
{
return _faceletFactory.getFacelet(context, viewId);
}
finally
{
FaceletFactory.setInstance(null);
}
} | java | private Facelet _getFacelet(FacesContext context, String viewId) throws IOException
{
// grab our FaceletFactory and create a Facelet
FaceletFactory.setInstance(_faceletFactory);
try
{
return _faceletFactory.getFacelet(context, viewId);
}
finally
{
FaceletFactory.setInstance(null);
}
} | [
"private",
"Facelet",
"_getFacelet",
"(",
"FacesContext",
"context",
",",
"String",
"viewId",
")",
"throws",
"IOException",
"{",
"// grab our FaceletFactory and create a Facelet",
"FaceletFactory",
".",
"setInstance",
"(",
"_faceletFactory",
")",
";",
"try",
"{",
"return",
"_faceletFactory",
".",
"getFacelet",
"(",
"context",
",",
"viewId",
")",
";",
"}",
"finally",
"{",
"FaceletFactory",
".",
"setInstance",
"(",
"null",
")",
";",
"}",
"}"
]
| Gets the Facelet representing the specified view identifier.
@param viewId
the view identifier
@return the Facelet representing the specified view identifier
@throws IOException
if a read or parsing error occurs | [
"Gets",
"the",
"Facelet",
"representing",
"the",
"specified",
"view",
"identifier",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java#L2577-L2589 |
line/armeria | core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedHttpServiceFactory.java | AnnotatedHttpServiceFactory.producibleMediaTypes | private static List<MediaType> producibleMediaTypes(Method method, Class<?> clazz) {
"""
Returns the list of {@link MediaType}s specified by {@link Produces} annotation.
"""
List<Produces> produces = findAll(method, Produces.class);
List<ProduceType> produceTypes = findAll(method, ProduceType.class);
if (produces.isEmpty() && produceTypes.isEmpty()) {
produces = findAll(clazz, Produces.class);
produceTypes = findAll(clazz, ProduceType.class);
}
final List<MediaType> types =
Stream.concat(produces.stream().map(Produces::value),
produceTypes.stream().map(ProduceType::value))
.map(MediaType::parse)
.peek(type -> {
if (type.hasWildcard()) {
throw new IllegalArgumentException(
"Producible media types must not have a wildcard: " + type);
}
})
.collect(toImmutableList());
return ensureUniqueTypes(types, Produces.class);
} | java | private static List<MediaType> producibleMediaTypes(Method method, Class<?> clazz) {
List<Produces> produces = findAll(method, Produces.class);
List<ProduceType> produceTypes = findAll(method, ProduceType.class);
if (produces.isEmpty() && produceTypes.isEmpty()) {
produces = findAll(clazz, Produces.class);
produceTypes = findAll(clazz, ProduceType.class);
}
final List<MediaType> types =
Stream.concat(produces.stream().map(Produces::value),
produceTypes.stream().map(ProduceType::value))
.map(MediaType::parse)
.peek(type -> {
if (type.hasWildcard()) {
throw new IllegalArgumentException(
"Producible media types must not have a wildcard: " + type);
}
})
.collect(toImmutableList());
return ensureUniqueTypes(types, Produces.class);
} | [
"private",
"static",
"List",
"<",
"MediaType",
">",
"producibleMediaTypes",
"(",
"Method",
"method",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"List",
"<",
"Produces",
">",
"produces",
"=",
"findAll",
"(",
"method",
",",
"Produces",
".",
"class",
")",
";",
"List",
"<",
"ProduceType",
">",
"produceTypes",
"=",
"findAll",
"(",
"method",
",",
"ProduceType",
".",
"class",
")",
";",
"if",
"(",
"produces",
".",
"isEmpty",
"(",
")",
"&&",
"produceTypes",
".",
"isEmpty",
"(",
")",
")",
"{",
"produces",
"=",
"findAll",
"(",
"clazz",
",",
"Produces",
".",
"class",
")",
";",
"produceTypes",
"=",
"findAll",
"(",
"clazz",
",",
"ProduceType",
".",
"class",
")",
";",
"}",
"final",
"List",
"<",
"MediaType",
">",
"types",
"=",
"Stream",
".",
"concat",
"(",
"produces",
".",
"stream",
"(",
")",
".",
"map",
"(",
"Produces",
"::",
"value",
")",
",",
"produceTypes",
".",
"stream",
"(",
")",
".",
"map",
"(",
"ProduceType",
"::",
"value",
")",
")",
".",
"map",
"(",
"MediaType",
"::",
"parse",
")",
".",
"peek",
"(",
"type",
"->",
"{",
"if",
"(",
"type",
".",
"hasWildcard",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Producible media types must not have a wildcard: \"",
"+",
"type",
")",
";",
"}",
"}",
")",
".",
"collect",
"(",
"toImmutableList",
"(",
")",
")",
";",
"return",
"ensureUniqueTypes",
"(",
"types",
",",
"Produces",
".",
"class",
")",
";",
"}"
]
| Returns the list of {@link MediaType}s specified by {@link Produces} annotation. | [
"Returns",
"the",
"list",
"of",
"{"
]
| train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedHttpServiceFactory.java#L470-L491 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/meta/LockedInodePath.java | LockedInodePath.lockFinalEdgeWrite | public LockedInodePath lockFinalEdgeWrite() throws InvalidPathException {
"""
Returns a copy of the path with the final edge write locked. This requires that we haven't
already locked the final edge, i.e. the path is incomplete.
@return the new locked path
"""
Preconditions.checkState(!fullPathExists());
LockedInodePath newPath =
new LockedInodePath(mUri, this, mPathComponents, LockPattern.WRITE_EDGE);
newPath.traverse();
return newPath;
} | java | public LockedInodePath lockFinalEdgeWrite() throws InvalidPathException {
Preconditions.checkState(!fullPathExists());
LockedInodePath newPath =
new LockedInodePath(mUri, this, mPathComponents, LockPattern.WRITE_EDGE);
newPath.traverse();
return newPath;
} | [
"public",
"LockedInodePath",
"lockFinalEdgeWrite",
"(",
")",
"throws",
"InvalidPathException",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"fullPathExists",
"(",
")",
")",
";",
"LockedInodePath",
"newPath",
"=",
"new",
"LockedInodePath",
"(",
"mUri",
",",
"this",
",",
"mPathComponents",
",",
"LockPattern",
".",
"WRITE_EDGE",
")",
";",
"newPath",
".",
"traverse",
"(",
")",
";",
"return",
"newPath",
";",
"}"
]
| Returns a copy of the path with the final edge write locked. This requires that we haven't
already locked the final edge, i.e. the path is incomplete.
@return the new locked path | [
"Returns",
"a",
"copy",
"of",
"the",
"path",
"with",
"the",
"final",
"edge",
"write",
"locked",
".",
"This",
"requires",
"that",
"we",
"haven",
"t",
"already",
"locked",
"the",
"final",
"edge",
"i",
".",
"e",
".",
"the",
"path",
"is",
"incomplete",
"."
]
| train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/LockedInodePath.java#L416-L423 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java | ElementKindVisitor6.visitVariable | @Override
public R visitVariable(VariableElement e, P p) {
"""
Visits a variable element, dispatching to the visit method for
the specific {@linkplain ElementKind kind} of variable, {@code
ENUM_CONSTANT}, {@code EXCEPTION_PARAMETER}, {@code FIELD},
{@code LOCAL_VARIABLE}, {@code PARAMETER}, or {@code RESOURCE_VARIABLE}.
@param e {@inheritDoc}
@param p {@inheritDoc}
@return the result of the kind-specific visit method
"""
ElementKind k = e.getKind();
switch(k) {
case ENUM_CONSTANT:
return visitVariableAsEnumConstant(e, p);
case EXCEPTION_PARAMETER:
return visitVariableAsExceptionParameter(e, p);
case FIELD:
return visitVariableAsField(e, p);
case LOCAL_VARIABLE:
return visitVariableAsLocalVariable(e, p);
case PARAMETER:
return visitVariableAsParameter(e, p);
case RESOURCE_VARIABLE:
return visitVariableAsResourceVariable(e, p);
default:
throw new AssertionError("Bad kind " + k + " for VariableElement" + e);
}
} | java | @Override
public R visitVariable(VariableElement e, P p) {
ElementKind k = e.getKind();
switch(k) {
case ENUM_CONSTANT:
return visitVariableAsEnumConstant(e, p);
case EXCEPTION_PARAMETER:
return visitVariableAsExceptionParameter(e, p);
case FIELD:
return visitVariableAsField(e, p);
case LOCAL_VARIABLE:
return visitVariableAsLocalVariable(e, p);
case PARAMETER:
return visitVariableAsParameter(e, p);
case RESOURCE_VARIABLE:
return visitVariableAsResourceVariable(e, p);
default:
throw new AssertionError("Bad kind " + k + " for VariableElement" + e);
}
} | [
"@",
"Override",
"public",
"R",
"visitVariable",
"(",
"VariableElement",
"e",
",",
"P",
"p",
")",
"{",
"ElementKind",
"k",
"=",
"e",
".",
"getKind",
"(",
")",
";",
"switch",
"(",
"k",
")",
"{",
"case",
"ENUM_CONSTANT",
":",
"return",
"visitVariableAsEnumConstant",
"(",
"e",
",",
"p",
")",
";",
"case",
"EXCEPTION_PARAMETER",
":",
"return",
"visitVariableAsExceptionParameter",
"(",
"e",
",",
"p",
")",
";",
"case",
"FIELD",
":",
"return",
"visitVariableAsField",
"(",
"e",
",",
"p",
")",
";",
"case",
"LOCAL_VARIABLE",
":",
"return",
"visitVariableAsLocalVariable",
"(",
"e",
",",
"p",
")",
";",
"case",
"PARAMETER",
":",
"return",
"visitVariableAsParameter",
"(",
"e",
",",
"p",
")",
";",
"case",
"RESOURCE_VARIABLE",
":",
"return",
"visitVariableAsResourceVariable",
"(",
"e",
",",
"p",
")",
";",
"default",
":",
"throw",
"new",
"AssertionError",
"(",
"\"Bad kind \"",
"+",
"k",
"+",
"\" for VariableElement\"",
"+",
"e",
")",
";",
"}",
"}"
]
| Visits a variable element, dispatching to the visit method for
the specific {@linkplain ElementKind kind} of variable, {@code
ENUM_CONSTANT}, {@code EXCEPTION_PARAMETER}, {@code FIELD},
{@code LOCAL_VARIABLE}, {@code PARAMETER}, or {@code RESOURCE_VARIABLE}.
@param e {@inheritDoc}
@param p {@inheritDoc}
@return the result of the kind-specific visit method | [
"Visits",
"a",
"variable",
"element",
"dispatching",
"to",
"the",
"visit",
"method",
"for",
"the",
"specific",
"{",
"@linkplain",
"ElementKind",
"kind",
"}",
"of",
"variable",
"{",
"@code",
"ENUM_CONSTANT",
"}",
"{",
"@code",
"EXCEPTION_PARAMETER",
"}",
"{",
"@code",
"FIELD",
"}",
"{",
"@code",
"LOCAL_VARIABLE",
"}",
"{",
"@code",
"PARAMETER",
"}",
"or",
"{",
"@code",
"RESOURCE_VARIABLE",
"}",
"."
]
| train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java#L216-L241 |
alkacon/opencms-core | src/org/opencms/widgets/serialdate/A_CmsSerialDateBean.java | A_CmsSerialDateBean.showMoreEntries | protected boolean showMoreEntries(Calendar nextDate, int previousOccurrences) {
"""
Check if the provided date or any date after it are part of the series.
@param nextDate the current date to check.
@param previousOccurrences the number of events of the series that took place before the date to check.
@return <code>true</code> if more dates (including the provided one) could be in the series, <code>false</code> otherwise.
"""
switch (getSerialEndType()) {
case DATE:
boolean moreByDate = nextDate.getTimeInMillis() < m_endMillis;
boolean moreByOccurrences = previousOccurrences < CmsSerialDateUtil.getMaxEvents();
if (moreByDate && !moreByOccurrences) {
m_hasTooManyOccurrences = Boolean.TRUE;
}
return moreByDate && moreByOccurrences;
case TIMES:
case SINGLE:
return previousOccurrences < getOccurrences();
default:
throw new IllegalArgumentException();
}
} | java | protected boolean showMoreEntries(Calendar nextDate, int previousOccurrences) {
switch (getSerialEndType()) {
case DATE:
boolean moreByDate = nextDate.getTimeInMillis() < m_endMillis;
boolean moreByOccurrences = previousOccurrences < CmsSerialDateUtil.getMaxEvents();
if (moreByDate && !moreByOccurrences) {
m_hasTooManyOccurrences = Boolean.TRUE;
}
return moreByDate && moreByOccurrences;
case TIMES:
case SINGLE:
return previousOccurrences < getOccurrences();
default:
throw new IllegalArgumentException();
}
} | [
"protected",
"boolean",
"showMoreEntries",
"(",
"Calendar",
"nextDate",
",",
"int",
"previousOccurrences",
")",
"{",
"switch",
"(",
"getSerialEndType",
"(",
")",
")",
"{",
"case",
"DATE",
":",
"boolean",
"moreByDate",
"=",
"nextDate",
".",
"getTimeInMillis",
"(",
")",
"<",
"m_endMillis",
";",
"boolean",
"moreByOccurrences",
"=",
"previousOccurrences",
"<",
"CmsSerialDateUtil",
".",
"getMaxEvents",
"(",
")",
";",
"if",
"(",
"moreByDate",
"&&",
"!",
"moreByOccurrences",
")",
"{",
"m_hasTooManyOccurrences",
"=",
"Boolean",
".",
"TRUE",
";",
"}",
"return",
"moreByDate",
"&&",
"moreByOccurrences",
";",
"case",
"TIMES",
":",
"case",
"SINGLE",
":",
"return",
"previousOccurrences",
"<",
"getOccurrences",
"(",
")",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"}"
]
| Check if the provided date or any date after it are part of the series.
@param nextDate the current date to check.
@param previousOccurrences the number of events of the series that took place before the date to check.
@return <code>true</code> if more dates (including the provided one) could be in the series, <code>false</code> otherwise. | [
"Check",
"if",
"the",
"provided",
"date",
"or",
"any",
"date",
"after",
"it",
"are",
"part",
"of",
"the",
"series",
"."
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/A_CmsSerialDateBean.java#L264-L280 |
apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java | Calcites.calciteDateTimeLiteralToJoda | public static DateTime calciteDateTimeLiteralToJoda(final RexNode literal, final DateTimeZone timeZone) {
"""
Translates "literal" (a TIMESTAMP or DATE literal) to milliseconds since the epoch using the provided
session time zone.
@param literal TIMESTAMP or DATE literal
@param timeZone session time zone
@return milliseconds time
"""
final SqlTypeName typeName = literal.getType().getSqlTypeName();
if (literal.getKind() != SqlKind.LITERAL || (typeName != SqlTypeName.TIMESTAMP && typeName != SqlTypeName.DATE)) {
throw new IAE("Expected literal but got[%s]", literal.getKind());
}
if (typeName == SqlTypeName.TIMESTAMP) {
final TimestampString timestampString = (TimestampString) RexLiteral.value(literal);
return CALCITE_TIMESTAMP_PARSER.parse(timestampString.toString()).withZoneRetainFields(timeZone);
} else if (typeName == SqlTypeName.DATE) {
final DateString dateString = (DateString) RexLiteral.value(literal);
return CALCITE_DATE_PARSER.parse(dateString.toString()).withZoneRetainFields(timeZone);
} else {
throw new IAE("Expected TIMESTAMP or DATE but got[%s]", typeName);
}
} | java | public static DateTime calciteDateTimeLiteralToJoda(final RexNode literal, final DateTimeZone timeZone)
{
final SqlTypeName typeName = literal.getType().getSqlTypeName();
if (literal.getKind() != SqlKind.LITERAL || (typeName != SqlTypeName.TIMESTAMP && typeName != SqlTypeName.DATE)) {
throw new IAE("Expected literal but got[%s]", literal.getKind());
}
if (typeName == SqlTypeName.TIMESTAMP) {
final TimestampString timestampString = (TimestampString) RexLiteral.value(literal);
return CALCITE_TIMESTAMP_PARSER.parse(timestampString.toString()).withZoneRetainFields(timeZone);
} else if (typeName == SqlTypeName.DATE) {
final DateString dateString = (DateString) RexLiteral.value(literal);
return CALCITE_DATE_PARSER.parse(dateString.toString()).withZoneRetainFields(timeZone);
} else {
throw new IAE("Expected TIMESTAMP or DATE but got[%s]", typeName);
}
} | [
"public",
"static",
"DateTime",
"calciteDateTimeLiteralToJoda",
"(",
"final",
"RexNode",
"literal",
",",
"final",
"DateTimeZone",
"timeZone",
")",
"{",
"final",
"SqlTypeName",
"typeName",
"=",
"literal",
".",
"getType",
"(",
")",
".",
"getSqlTypeName",
"(",
")",
";",
"if",
"(",
"literal",
".",
"getKind",
"(",
")",
"!=",
"SqlKind",
".",
"LITERAL",
"||",
"(",
"typeName",
"!=",
"SqlTypeName",
".",
"TIMESTAMP",
"&&",
"typeName",
"!=",
"SqlTypeName",
".",
"DATE",
")",
")",
"{",
"throw",
"new",
"IAE",
"(",
"\"Expected literal but got[%s]\"",
",",
"literal",
".",
"getKind",
"(",
")",
")",
";",
"}",
"if",
"(",
"typeName",
"==",
"SqlTypeName",
".",
"TIMESTAMP",
")",
"{",
"final",
"TimestampString",
"timestampString",
"=",
"(",
"TimestampString",
")",
"RexLiteral",
".",
"value",
"(",
"literal",
")",
";",
"return",
"CALCITE_TIMESTAMP_PARSER",
".",
"parse",
"(",
"timestampString",
".",
"toString",
"(",
")",
")",
".",
"withZoneRetainFields",
"(",
"timeZone",
")",
";",
"}",
"else",
"if",
"(",
"typeName",
"==",
"SqlTypeName",
".",
"DATE",
")",
"{",
"final",
"DateString",
"dateString",
"=",
"(",
"DateString",
")",
"RexLiteral",
".",
"value",
"(",
"literal",
")",
";",
"return",
"CALCITE_DATE_PARSER",
".",
"parse",
"(",
"dateString",
".",
"toString",
"(",
")",
")",
".",
"withZoneRetainFields",
"(",
"timeZone",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IAE",
"(",
"\"Expected TIMESTAMP or DATE but got[%s]\"",
",",
"typeName",
")",
";",
"}",
"}"
]
| Translates "literal" (a TIMESTAMP or DATE literal) to milliseconds since the epoch using the provided
session time zone.
@param literal TIMESTAMP or DATE literal
@param timeZone session time zone
@return milliseconds time | [
"Translates",
"literal",
"(",
"a",
"TIMESTAMP",
"or",
"DATE",
"literal",
")",
"to",
"milliseconds",
"since",
"the",
"epoch",
"using",
"the",
"provided",
"session",
"time",
"zone",
"."
]
| train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java#L299-L315 |
sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java | MarvinImage.multi8p | public double multi8p(int x, int y, double masc) {
"""
Multiple of gradient windwos per masc relation of x y
@return int[]
"""
int aR = getIntComponent0(x - 1, y - 1);
int bR = getIntComponent0(x - 1, y);
int cR = getIntComponent0(x - 1, y + 1);
int aG = getIntComponent1(x - 1, y - 1);
int bG = getIntComponent1(x - 1, y);
int cG = getIntComponent1(x - 1, y + 1);
int aB = getIntComponent1(x - 1, y - 1);
int bB = getIntComponent1(x - 1, y);
int cB = getIntComponent1(x - 1, y + 1);
int dR = getIntComponent0(x, y - 1);
int eR = getIntComponent0(x, y);
int fR = getIntComponent0(x, y + 1);
int dG = getIntComponent1(x, y - 1);
int eG = getIntComponent1(x, y);
int fG = getIntComponent1(x, y + 1);
int dB = getIntComponent1(x, y - 1);
int eB = getIntComponent1(x, y);
int fB = getIntComponent1(x, y + 1);
int gR = getIntComponent0(x + 1, y - 1);
int hR = getIntComponent0(x + 1, y);
int iR = getIntComponent0(x + 1, y + 1);
int gG = getIntComponent1(x + 1, y - 1);
int hG = getIntComponent1(x + 1, y);
int iG = getIntComponent1(x + 1, y + 1);
int gB = getIntComponent1(x + 1, y - 1);
int hB = getIntComponent1(x + 1, y);
int iB = getIntComponent1(x + 1, y + 1);
double rgb = 0;
rgb = ((aR * masc) + (bR * masc) + (cR * masc) +
(dR * masc) + (eR * masc) + (fR * masc) +
(gR * masc) + (hR * masc) + (iR * masc));
return (rgb);
} | java | public double multi8p(int x, int y, double masc) {
int aR = getIntComponent0(x - 1, y - 1);
int bR = getIntComponent0(x - 1, y);
int cR = getIntComponent0(x - 1, y + 1);
int aG = getIntComponent1(x - 1, y - 1);
int bG = getIntComponent1(x - 1, y);
int cG = getIntComponent1(x - 1, y + 1);
int aB = getIntComponent1(x - 1, y - 1);
int bB = getIntComponent1(x - 1, y);
int cB = getIntComponent1(x - 1, y + 1);
int dR = getIntComponent0(x, y - 1);
int eR = getIntComponent0(x, y);
int fR = getIntComponent0(x, y + 1);
int dG = getIntComponent1(x, y - 1);
int eG = getIntComponent1(x, y);
int fG = getIntComponent1(x, y + 1);
int dB = getIntComponent1(x, y - 1);
int eB = getIntComponent1(x, y);
int fB = getIntComponent1(x, y + 1);
int gR = getIntComponent0(x + 1, y - 1);
int hR = getIntComponent0(x + 1, y);
int iR = getIntComponent0(x + 1, y + 1);
int gG = getIntComponent1(x + 1, y - 1);
int hG = getIntComponent1(x + 1, y);
int iG = getIntComponent1(x + 1, y + 1);
int gB = getIntComponent1(x + 1, y - 1);
int hB = getIntComponent1(x + 1, y);
int iB = getIntComponent1(x + 1, y + 1);
double rgb = 0;
rgb = ((aR * masc) + (bR * masc) + (cR * masc) +
(dR * masc) + (eR * masc) + (fR * masc) +
(gR * masc) + (hR * masc) + (iR * masc));
return (rgb);
} | [
"public",
"double",
"multi8p",
"(",
"int",
"x",
",",
"int",
"y",
",",
"double",
"masc",
")",
"{",
"int",
"aR",
"=",
"getIntComponent0",
"(",
"x",
"-",
"1",
",",
"y",
"-",
"1",
")",
";",
"int",
"bR",
"=",
"getIntComponent0",
"(",
"x",
"-",
"1",
",",
"y",
")",
";",
"int",
"cR",
"=",
"getIntComponent0",
"(",
"x",
"-",
"1",
",",
"y",
"+",
"1",
")",
";",
"int",
"aG",
"=",
"getIntComponent1",
"(",
"x",
"-",
"1",
",",
"y",
"-",
"1",
")",
";",
"int",
"bG",
"=",
"getIntComponent1",
"(",
"x",
"-",
"1",
",",
"y",
")",
";",
"int",
"cG",
"=",
"getIntComponent1",
"(",
"x",
"-",
"1",
",",
"y",
"+",
"1",
")",
";",
"int",
"aB",
"=",
"getIntComponent1",
"(",
"x",
"-",
"1",
",",
"y",
"-",
"1",
")",
";",
"int",
"bB",
"=",
"getIntComponent1",
"(",
"x",
"-",
"1",
",",
"y",
")",
";",
"int",
"cB",
"=",
"getIntComponent1",
"(",
"x",
"-",
"1",
",",
"y",
"+",
"1",
")",
";",
"int",
"dR",
"=",
"getIntComponent0",
"(",
"x",
",",
"y",
"-",
"1",
")",
";",
"int",
"eR",
"=",
"getIntComponent0",
"(",
"x",
",",
"y",
")",
";",
"int",
"fR",
"=",
"getIntComponent0",
"(",
"x",
",",
"y",
"+",
"1",
")",
";",
"int",
"dG",
"=",
"getIntComponent1",
"(",
"x",
",",
"y",
"-",
"1",
")",
";",
"int",
"eG",
"=",
"getIntComponent1",
"(",
"x",
",",
"y",
")",
";",
"int",
"fG",
"=",
"getIntComponent1",
"(",
"x",
",",
"y",
"+",
"1",
")",
";",
"int",
"dB",
"=",
"getIntComponent1",
"(",
"x",
",",
"y",
"-",
"1",
")",
";",
"int",
"eB",
"=",
"getIntComponent1",
"(",
"x",
",",
"y",
")",
";",
"int",
"fB",
"=",
"getIntComponent1",
"(",
"x",
",",
"y",
"+",
"1",
")",
";",
"int",
"gR",
"=",
"getIntComponent0",
"(",
"x",
"+",
"1",
",",
"y",
"-",
"1",
")",
";",
"int",
"hR",
"=",
"getIntComponent0",
"(",
"x",
"+",
"1",
",",
"y",
")",
";",
"int",
"iR",
"=",
"getIntComponent0",
"(",
"x",
"+",
"1",
",",
"y",
"+",
"1",
")",
";",
"int",
"gG",
"=",
"getIntComponent1",
"(",
"x",
"+",
"1",
",",
"y",
"-",
"1",
")",
";",
"int",
"hG",
"=",
"getIntComponent1",
"(",
"x",
"+",
"1",
",",
"y",
")",
";",
"int",
"iG",
"=",
"getIntComponent1",
"(",
"x",
"+",
"1",
",",
"y",
"+",
"1",
")",
";",
"int",
"gB",
"=",
"getIntComponent1",
"(",
"x",
"+",
"1",
",",
"y",
"-",
"1",
")",
";",
"int",
"hB",
"=",
"getIntComponent1",
"(",
"x",
"+",
"1",
",",
"y",
")",
";",
"int",
"iB",
"=",
"getIntComponent1",
"(",
"x",
"+",
"1",
",",
"y",
"+",
"1",
")",
";",
"double",
"rgb",
"=",
"0",
";",
"rgb",
"=",
"(",
"(",
"aR",
"*",
"masc",
")",
"+",
"(",
"bR",
"*",
"masc",
")",
"+",
"(",
"cR",
"*",
"masc",
")",
"+",
"(",
"dR",
"*",
"masc",
")",
"+",
"(",
"eR",
"*",
"masc",
")",
"+",
"(",
"fR",
"*",
"masc",
")",
"+",
"(",
"gR",
"*",
"masc",
")",
"+",
"(",
"hR",
"*",
"masc",
")",
"+",
"(",
"iR",
"*",
"masc",
")",
")",
";",
"return",
"(",
"rgb",
")",
";",
"}"
]
| Multiple of gradient windwos per masc relation of x y
@return int[] | [
"Multiple",
"of",
"gradient",
"windwos",
"per",
"masc",
"relation",
"of",
"x",
"y"
]
| train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L565-L606 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/TapClient.java | TapClient.getNextMessage | public ResponseMessage getNextMessage(long time, TimeUnit timeunit) {
"""
Gets the next tap message from the queue of received tap messages.
@param time the amount of time to wait for a message.
@param timeunit the unit of time to use.
@return The tap message at the head of the queue or null if the queue is
empty for the given amount of time.
"""
try {
Object m = rqueue.poll(time, timeunit);
if (m == null) {
return null;
} else if (m instanceof ResponseMessage) {
return (ResponseMessage) m;
} else if (m instanceof TapAck) {
TapAck ack = (TapAck) m;
tapAck(ack.getConn(), ack.getNode(), ack.getOpcode(), ack.getOpaque(),
ack.getCallback());
return null;
} else {
throw new RuntimeException("Unexpected tap message type");
}
} catch (InterruptedException e) {
shutdown();
return null;
}
} | java | public ResponseMessage getNextMessage(long time, TimeUnit timeunit) {
try {
Object m = rqueue.poll(time, timeunit);
if (m == null) {
return null;
} else if (m instanceof ResponseMessage) {
return (ResponseMessage) m;
} else if (m instanceof TapAck) {
TapAck ack = (TapAck) m;
tapAck(ack.getConn(), ack.getNode(), ack.getOpcode(), ack.getOpaque(),
ack.getCallback());
return null;
} else {
throw new RuntimeException("Unexpected tap message type");
}
} catch (InterruptedException e) {
shutdown();
return null;
}
} | [
"public",
"ResponseMessage",
"getNextMessage",
"(",
"long",
"time",
",",
"TimeUnit",
"timeunit",
")",
"{",
"try",
"{",
"Object",
"m",
"=",
"rqueue",
".",
"poll",
"(",
"time",
",",
"timeunit",
")",
";",
"if",
"(",
"m",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"m",
"instanceof",
"ResponseMessage",
")",
"{",
"return",
"(",
"ResponseMessage",
")",
"m",
";",
"}",
"else",
"if",
"(",
"m",
"instanceof",
"TapAck",
")",
"{",
"TapAck",
"ack",
"=",
"(",
"TapAck",
")",
"m",
";",
"tapAck",
"(",
"ack",
".",
"getConn",
"(",
")",
",",
"ack",
".",
"getNode",
"(",
")",
",",
"ack",
".",
"getOpcode",
"(",
")",
",",
"ack",
".",
"getOpaque",
"(",
")",
",",
"ack",
".",
"getCallback",
"(",
")",
")",
";",
"return",
"null",
";",
"}",
"else",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Unexpected tap message type\"",
")",
";",
"}",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"shutdown",
"(",
")",
";",
"return",
"null",
";",
"}",
"}"
]
| Gets the next tap message from the queue of received tap messages.
@param time the amount of time to wait for a message.
@param timeunit the unit of time to use.
@return The tap message at the head of the queue or null if the queue is
empty for the given amount of time. | [
"Gets",
"the",
"next",
"tap",
"message",
"from",
"the",
"queue",
"of",
"received",
"tap",
"messages",
"."
]
| train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/TapClient.java#L105-L124 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ButtonFactory.java | ButtonFactory.createPhoneNumberButton | public static Button createPhoneNumberButton(String title,
String phoneNumber) {
"""
Creates a button with a phone number.
@param title
the button label.
@param phoneNumber
a phone number. Must be in the format '+' prefix followed by
the country code, area code and local number.
@return a {@link PostbackButton}.
"""
return new PostbackButton(title, ButtonType.PHONE_NUMBER, phoneNumber);
} | java | public static Button createPhoneNumberButton(String title,
String phoneNumber) {
return new PostbackButton(title, ButtonType.PHONE_NUMBER, phoneNumber);
} | [
"public",
"static",
"Button",
"createPhoneNumberButton",
"(",
"String",
"title",
",",
"String",
"phoneNumber",
")",
"{",
"return",
"new",
"PostbackButton",
"(",
"title",
",",
"ButtonType",
".",
"PHONE_NUMBER",
",",
"phoneNumber",
")",
";",
"}"
]
| Creates a button with a phone number.
@param title
the button label.
@param phoneNumber
a phone number. Must be in the format '+' prefix followed by
the country code, area code and local number.
@return a {@link PostbackButton}. | [
"Creates",
"a",
"button",
"with",
"a",
"phone",
"number",
"."
]
| train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ButtonFactory.java#L116-L119 |
joniles/mpxj | src/main/java/net/sf/mpxj/json/JsonStreamWriter.java | JsonStreamWriter.writeNameValuePair | public void writeNameValuePair(String name, int value) throws IOException {
"""
Write an int attribute.
@param name attribute name
@param value attribute value
"""
internalWriteNameValuePair(name, Integer.toString(value));
} | java | public void writeNameValuePair(String name, int value) throws IOException
{
internalWriteNameValuePair(name, Integer.toString(value));
} | [
"public",
"void",
"writeNameValuePair",
"(",
"String",
"name",
",",
"int",
"value",
")",
"throws",
"IOException",
"{",
"internalWriteNameValuePair",
"(",
"name",
",",
"Integer",
".",
"toString",
"(",
"value",
")",
")",
";",
"}"
]
| Write an int attribute.
@param name attribute name
@param value attribute value | [
"Write",
"an",
"int",
"attribute",
"."
]
| train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L151-L154 |
vkostyukov/la4j | src/main/java/org/la4j/Matrices.java | Matrices.asAccumulatorProcedure | public static MatrixProcedure asAccumulatorProcedure(final MatrixAccumulator accumulator) {
"""
Creates an accumulator procedure that adapts a matrix accumulator for procedure
interface. This is useful for reusing a single accumulator for multiple fold operations
in multiple matrices.
@param accumulator the matrix accumulator
@return an accumulator procedure
"""
return new MatrixProcedure() {
@Override
public void apply(int i, int j, double value) {
accumulator.update(i, j, value);
}
};
} | java | public static MatrixProcedure asAccumulatorProcedure(final MatrixAccumulator accumulator) {
return new MatrixProcedure() {
@Override
public void apply(int i, int j, double value) {
accumulator.update(i, j, value);
}
};
} | [
"public",
"static",
"MatrixProcedure",
"asAccumulatorProcedure",
"(",
"final",
"MatrixAccumulator",
"accumulator",
")",
"{",
"return",
"new",
"MatrixProcedure",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"apply",
"(",
"int",
"i",
",",
"int",
"j",
",",
"double",
"value",
")",
"{",
"accumulator",
".",
"update",
"(",
"i",
",",
"j",
",",
"value",
")",
";",
"}",
"}",
";",
"}"
]
| Creates an accumulator procedure that adapts a matrix accumulator for procedure
interface. This is useful for reusing a single accumulator for multiple fold operations
in multiple matrices.
@param accumulator the matrix accumulator
@return an accumulator procedure | [
"Creates",
"an",
"accumulator",
"procedure",
"that",
"adapts",
"a",
"matrix",
"accumulator",
"for",
"procedure",
"interface",
".",
"This",
"is",
"useful",
"for",
"reusing",
"a",
"single",
"accumulator",
"for",
"multiple",
"fold",
"operations",
"in",
"multiple",
"matrices",
"."
]
| train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L744-L751 |
ben-manes/caffeine | jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java | CacheProxy.putIfAbsentNoAwait | private boolean putIfAbsentNoAwait(K key, V value, boolean publishToWriter) {
"""
Associates the specified value with the specified key in the cache if there is no existing
mapping.
@param key key with which the specified value is to be associated
@param value value to be associated with the specified key
@param publishToWriter if the writer should be notified
@return if the mapping was successful
"""
boolean[] absent = { false };
cache.asMap().compute(copyOf(key), (k, expirable) -> {
if ((expirable != null) && !expirable.isEternal()
&& expirable.hasExpired(currentTimeMillis())) {
dispatcher.publishExpired(this, key, expirable.get());
statistics.recordEvictions(1L);
expirable = null;
}
if (expirable != null) {
return expirable;
}
absent[0] = true;
long expireTimeMS = getWriteExpireTimeMS(/* created */ true);
if (expireTimeMS == 0) {
return null;
}
if (publishToWriter) {
publishToCacheWriter(writer::write, () -> new EntryProxy<>(key, value));
}
V copy = copyOf(value);
dispatcher.publishCreated(this, key, copy);
return new Expirable<>(copy, expireTimeMS);
});
return absent[0];
} | java | private boolean putIfAbsentNoAwait(K key, V value, boolean publishToWriter) {
boolean[] absent = { false };
cache.asMap().compute(copyOf(key), (k, expirable) -> {
if ((expirable != null) && !expirable.isEternal()
&& expirable.hasExpired(currentTimeMillis())) {
dispatcher.publishExpired(this, key, expirable.get());
statistics.recordEvictions(1L);
expirable = null;
}
if (expirable != null) {
return expirable;
}
absent[0] = true;
long expireTimeMS = getWriteExpireTimeMS(/* created */ true);
if (expireTimeMS == 0) {
return null;
}
if (publishToWriter) {
publishToCacheWriter(writer::write, () -> new EntryProxy<>(key, value));
}
V copy = copyOf(value);
dispatcher.publishCreated(this, key, copy);
return new Expirable<>(copy, expireTimeMS);
});
return absent[0];
} | [
"private",
"boolean",
"putIfAbsentNoAwait",
"(",
"K",
"key",
",",
"V",
"value",
",",
"boolean",
"publishToWriter",
")",
"{",
"boolean",
"[",
"]",
"absent",
"=",
"{",
"false",
"}",
";",
"cache",
".",
"asMap",
"(",
")",
".",
"compute",
"(",
"copyOf",
"(",
"key",
")",
",",
"(",
"k",
",",
"expirable",
")",
"->",
"{",
"if",
"(",
"(",
"expirable",
"!=",
"null",
")",
"&&",
"!",
"expirable",
".",
"isEternal",
"(",
")",
"&&",
"expirable",
".",
"hasExpired",
"(",
"currentTimeMillis",
"(",
")",
")",
")",
"{",
"dispatcher",
".",
"publishExpired",
"(",
"this",
",",
"key",
",",
"expirable",
".",
"get",
"(",
")",
")",
";",
"statistics",
".",
"recordEvictions",
"(",
"1L",
")",
";",
"expirable",
"=",
"null",
";",
"}",
"if",
"(",
"expirable",
"!=",
"null",
")",
"{",
"return",
"expirable",
";",
"}",
"absent",
"[",
"0",
"]",
"=",
"true",
";",
"long",
"expireTimeMS",
"=",
"getWriteExpireTimeMS",
"(",
"/* created */",
"true",
")",
";",
"if",
"(",
"expireTimeMS",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"publishToWriter",
")",
"{",
"publishToCacheWriter",
"(",
"writer",
"::",
"write",
",",
"(",
")",
"->",
"new",
"EntryProxy",
"<>",
"(",
"key",
",",
"value",
")",
")",
";",
"}",
"V",
"copy",
"=",
"copyOf",
"(",
"value",
")",
";",
"dispatcher",
".",
"publishCreated",
"(",
"this",
",",
"key",
",",
"copy",
")",
";",
"return",
"new",
"Expirable",
"<>",
"(",
"copy",
",",
"expireTimeMS",
")",
";",
"}",
")",
";",
"return",
"absent",
"[",
"0",
"]",
";",
"}"
]
| Associates the specified value with the specified key in the cache if there is no existing
mapping.
@param key key with which the specified value is to be associated
@param value value to be associated with the specified key
@param publishToWriter if the writer should be notified
@return if the mapping was successful | [
"Associates",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"in",
"the",
"cache",
"if",
"there",
"is",
"no",
"existing",
"mapping",
"."
]
| train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L435-L461 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/concurrent/atomiclong/AtomicLongContainerCollector.java | AtomicLongContainerCollector.onIteration | @Override
protected void onIteration(String containerName, AtomicLongContainer container) {
"""
The {@link AtomicLongContainer} doesn't know its name or configuration, so we create these lookup maps.
This is cheaper than storing this information permanently in the container.
"""
AtomicLongConfig atomicLongConfig = config.findAtomicLongConfig(containerName);
containerNames.put(container, containerName);
containerPolicies.put(container, atomicLongConfig.getMergePolicyConfig());
} | java | @Override
protected void onIteration(String containerName, AtomicLongContainer container) {
AtomicLongConfig atomicLongConfig = config.findAtomicLongConfig(containerName);
containerNames.put(container, containerName);
containerPolicies.put(container, atomicLongConfig.getMergePolicyConfig());
} | [
"@",
"Override",
"protected",
"void",
"onIteration",
"(",
"String",
"containerName",
",",
"AtomicLongContainer",
"container",
")",
"{",
"AtomicLongConfig",
"atomicLongConfig",
"=",
"config",
".",
"findAtomicLongConfig",
"(",
"containerName",
")",
";",
"containerNames",
".",
"put",
"(",
"container",
",",
"containerName",
")",
";",
"containerPolicies",
".",
"put",
"(",
"container",
",",
"atomicLongConfig",
".",
"getMergePolicyConfig",
"(",
")",
")",
";",
"}"
]
| The {@link AtomicLongContainer} doesn't know its name or configuration, so we create these lookup maps.
This is cheaper than storing this information permanently in the container. | [
"The",
"{"
]
| train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/concurrent/atomiclong/AtomicLongContainerCollector.java#L47-L53 |
weld/core | impl/src/main/java/org/jboss/weld/util/bytecode/ConstructorUtils.java | ConstructorUtils.addConstructor | public static void addConstructor(String returnType, String[] params, String[] exceptions, ClassFile file, List<DeferredBytecode> initialValueBytecode, final boolean useUnsafeInstantiators) {
"""
Adds a constructor that delegates to a super constructor with the same
descriptor. The bytecode in initialValueBytecode will be executed at the
start of the constructor and can be used to initialize fields to a default
value. As the object is not properly constructed at this point this
bytecode may not reference this (i.e. the variable at location 0)
@param returnType the constructor descriptor
@param exceptions any exceptions that are thrown
@param file the classfile to add the constructor to
@param initialValueBytecode bytecode that can be used to set initial values
"""
try {
final String initMethodName = "<init>";
final ClassMethod ctor = file.addMethod(AccessFlag.PUBLIC, initMethodName, returnType, params);
ctor.addCheckedExceptions(exceptions);
final CodeAttribute b = ctor.getCodeAttribute();
for(final DeferredBytecode iv : initialValueBytecode) {
iv.apply(b);
}
// we need to generate a constructor with a single invokespecial call
// to the super constructor
// to do this we need to push all the arguments on the stack first
// local variables is the number of parameters +1 for this
// if some of the parameters are wide this may go up.
b.aload(0);
b.loadMethodParameters();
// now we have the parameters on the stack
b.invokespecial(file.getSuperclass(), initMethodName, methodDescriptor(params, returnType));
if(!useUnsafeInstantiators) {
// now set constructed to true
b.aload(0);
b.iconst(1);
b.putfield(file.getName(), ProxyFactory.CONSTRUCTED_FLAG_NAME, BytecodeUtils.BOOLEAN_CLASS_DESCRIPTOR);
}
b.returnInstruction();
} catch (DuplicateMemberException e) {
throw new RuntimeException(e);
}
} | java | public static void addConstructor(String returnType, String[] params, String[] exceptions, ClassFile file, List<DeferredBytecode> initialValueBytecode, final boolean useUnsafeInstantiators) {
try {
final String initMethodName = "<init>";
final ClassMethod ctor = file.addMethod(AccessFlag.PUBLIC, initMethodName, returnType, params);
ctor.addCheckedExceptions(exceptions);
final CodeAttribute b = ctor.getCodeAttribute();
for(final DeferredBytecode iv : initialValueBytecode) {
iv.apply(b);
}
// we need to generate a constructor with a single invokespecial call
// to the super constructor
// to do this we need to push all the arguments on the stack first
// local variables is the number of parameters +1 for this
// if some of the parameters are wide this may go up.
b.aload(0);
b.loadMethodParameters();
// now we have the parameters on the stack
b.invokespecial(file.getSuperclass(), initMethodName, methodDescriptor(params, returnType));
if(!useUnsafeInstantiators) {
// now set constructed to true
b.aload(0);
b.iconst(1);
b.putfield(file.getName(), ProxyFactory.CONSTRUCTED_FLAG_NAME, BytecodeUtils.BOOLEAN_CLASS_DESCRIPTOR);
}
b.returnInstruction();
} catch (DuplicateMemberException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"void",
"addConstructor",
"(",
"String",
"returnType",
",",
"String",
"[",
"]",
"params",
",",
"String",
"[",
"]",
"exceptions",
",",
"ClassFile",
"file",
",",
"List",
"<",
"DeferredBytecode",
">",
"initialValueBytecode",
",",
"final",
"boolean",
"useUnsafeInstantiators",
")",
"{",
"try",
"{",
"final",
"String",
"initMethodName",
"=",
"\"<init>\"",
";",
"final",
"ClassMethod",
"ctor",
"=",
"file",
".",
"addMethod",
"(",
"AccessFlag",
".",
"PUBLIC",
",",
"initMethodName",
",",
"returnType",
",",
"params",
")",
";",
"ctor",
".",
"addCheckedExceptions",
"(",
"exceptions",
")",
";",
"final",
"CodeAttribute",
"b",
"=",
"ctor",
".",
"getCodeAttribute",
"(",
")",
";",
"for",
"(",
"final",
"DeferredBytecode",
"iv",
":",
"initialValueBytecode",
")",
"{",
"iv",
".",
"apply",
"(",
"b",
")",
";",
"}",
"// we need to generate a constructor with a single invokespecial call",
"// to the super constructor",
"// to do this we need to push all the arguments on the stack first",
"// local variables is the number of parameters +1 for this",
"// if some of the parameters are wide this may go up.",
"b",
".",
"aload",
"(",
"0",
")",
";",
"b",
".",
"loadMethodParameters",
"(",
")",
";",
"// now we have the parameters on the stack",
"b",
".",
"invokespecial",
"(",
"file",
".",
"getSuperclass",
"(",
")",
",",
"initMethodName",
",",
"methodDescriptor",
"(",
"params",
",",
"returnType",
")",
")",
";",
"if",
"(",
"!",
"useUnsafeInstantiators",
")",
"{",
"// now set constructed to true",
"b",
".",
"aload",
"(",
"0",
")",
";",
"b",
".",
"iconst",
"(",
"1",
")",
";",
"b",
".",
"putfield",
"(",
"file",
".",
"getName",
"(",
")",
",",
"ProxyFactory",
".",
"CONSTRUCTED_FLAG_NAME",
",",
"BytecodeUtils",
".",
"BOOLEAN_CLASS_DESCRIPTOR",
")",
";",
"}",
"b",
".",
"returnInstruction",
"(",
")",
";",
"}",
"catch",
"(",
"DuplicateMemberException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
]
| Adds a constructor that delegates to a super constructor with the same
descriptor. The bytecode in initialValueBytecode will be executed at the
start of the constructor and can be used to initialize fields to a default
value. As the object is not properly constructed at this point this
bytecode may not reference this (i.e. the variable at location 0)
@param returnType the constructor descriptor
@param exceptions any exceptions that are thrown
@param file the classfile to add the constructor to
@param initialValueBytecode bytecode that can be used to set initial values | [
"Adds",
"a",
"constructor",
"that",
"delegates",
"to",
"a",
"super",
"constructor",
"with",
"the",
"same",
"descriptor",
".",
"The",
"bytecode",
"in",
"initialValueBytecode",
"will",
"be",
"executed",
"at",
"the",
"start",
"of",
"the",
"constructor",
"and",
"can",
"be",
"used",
"to",
"initialize",
"fields",
"to",
"a",
"default",
"value",
".",
"As",
"the",
"object",
"is",
"not",
"properly",
"constructed",
"at",
"this",
"point",
"this",
"bytecode",
"may",
"not",
"reference",
"this",
"(",
"i",
".",
"e",
".",
"the",
"variable",
"at",
"location",
"0",
")"
]
| train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/bytecode/ConstructorUtils.java#L59-L88 |
GoogleCloudPlatform/appengine-mapreduce | java/src/main/java/com/google/appengine/tools/mapreduce/outputs/LevelDbOutputWriter.java | LevelDbOutputWriter.generateCrc | private int generateCrc(byte[] data, int off, int len, RecordType type) {
"""
Generates a CRC32C checksum using {@link Crc32c} for a specific record.
@param data The user data over which the checksum will be generated.
@param off The offset into the user data at which to begin the computation.
@param len The length of user data to use in the computation.
@param type The {@link RecordType} of the record, which is included in the
checksum.
@return the masked checksum.
"""
Crc32c crc = new Crc32c();
crc.update(type.value());
crc.update(data, off, len);
return (int) LevelDbConstants.maskCrc(crc.getValue());
} | java | private int generateCrc(byte[] data, int off, int len, RecordType type) {
Crc32c crc = new Crc32c();
crc.update(type.value());
crc.update(data, off, len);
return (int) LevelDbConstants.maskCrc(crc.getValue());
} | [
"private",
"int",
"generateCrc",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"off",
",",
"int",
"len",
",",
"RecordType",
"type",
")",
"{",
"Crc32c",
"crc",
"=",
"new",
"Crc32c",
"(",
")",
";",
"crc",
".",
"update",
"(",
"type",
".",
"value",
"(",
")",
")",
";",
"crc",
".",
"update",
"(",
"data",
",",
"off",
",",
"len",
")",
";",
"return",
"(",
"int",
")",
"LevelDbConstants",
".",
"maskCrc",
"(",
"crc",
".",
"getValue",
"(",
")",
")",
";",
"}"
]
| Generates a CRC32C checksum using {@link Crc32c} for a specific record.
@param data The user data over which the checksum will be generated.
@param off The offset into the user data at which to begin the computation.
@param len The length of user data to use in the computation.
@param type The {@link RecordType} of the record, which is included in the
checksum.
@return the masked checksum. | [
"Generates",
"a",
"CRC32C",
"checksum",
"using",
"{",
"@link",
"Crc32c",
"}",
"for",
"a",
"specific",
"record",
"."
]
| train | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/outputs/LevelDbOutputWriter.java#L215-L220 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePositionPatternDetector.java | QrCodePositionPatternDetector.considerConnect | void considerConnect(SquareNode node0, SquareNode node1) {
"""
Connects the 'candidate' node to node 'n' if they meet several criteria. See code for details.
"""
// Find the side on each line which intersects the line connecting the two centers
lineA.a = node0.center;
lineA.b = node1.center;
int intersection0 = graph.findSideIntersect(node0,lineA,intersection,lineB);
connectLine.a.set(intersection);
int intersection1 = graph.findSideIntersect(node1,lineA,intersection,lineB);
connectLine.b.set(intersection);
if( intersection1 < 0 || intersection0 < 0 ) {
return;
}
double side0 = node0.sideLengths[intersection0];
double side1 = node1.sideLengths[intersection1];
// it should intersect about in the middle of the line
double sideLoc0 = connectLine.a.distance(node0.square.get(intersection0))/side0;
double sideLoc1 = connectLine.b.distance(node1.square.get(intersection1))/side1;
if( Math.abs(sideLoc0-0.5)>0.35 || Math.abs(sideLoc1-0.5)>0.35 )
return;
// see if connecting sides are of similar size
if( Math.abs(side0-side1)/Math.max(side0,side1) > 0.25 ) {
return;
}
// Checks to see if the two sides selected above are closest to being parallel to each other.
// Perspective distortion will make the lines not parallel, but will still have a smaller
// acute angle than the adjacent sides
if( !graph.almostParallel(node0, intersection0, node1, intersection1)) {
return;
}
double ratio = Math.max(node0.smallestSide/node1.largestSide ,
node1.smallestSide/node0.largestSide);
// System.out.println("ratio "+ratio);
if( ratio > 1.3 )
return;
double angle = graph.acuteAngle(node0, intersection0, node1, intersection1);
double score = lineA.getLength()*(1.0+angle/0.1);
graph.checkConnect(node0,intersection0,node1,intersection1,score);
} | java | void considerConnect(SquareNode node0, SquareNode node1) {
// Find the side on each line which intersects the line connecting the two centers
lineA.a = node0.center;
lineA.b = node1.center;
int intersection0 = graph.findSideIntersect(node0,lineA,intersection,lineB);
connectLine.a.set(intersection);
int intersection1 = graph.findSideIntersect(node1,lineA,intersection,lineB);
connectLine.b.set(intersection);
if( intersection1 < 0 || intersection0 < 0 ) {
return;
}
double side0 = node0.sideLengths[intersection0];
double side1 = node1.sideLengths[intersection1];
// it should intersect about in the middle of the line
double sideLoc0 = connectLine.a.distance(node0.square.get(intersection0))/side0;
double sideLoc1 = connectLine.b.distance(node1.square.get(intersection1))/side1;
if( Math.abs(sideLoc0-0.5)>0.35 || Math.abs(sideLoc1-0.5)>0.35 )
return;
// see if connecting sides are of similar size
if( Math.abs(side0-side1)/Math.max(side0,side1) > 0.25 ) {
return;
}
// Checks to see if the two sides selected above are closest to being parallel to each other.
// Perspective distortion will make the lines not parallel, but will still have a smaller
// acute angle than the adjacent sides
if( !graph.almostParallel(node0, intersection0, node1, intersection1)) {
return;
}
double ratio = Math.max(node0.smallestSide/node1.largestSide ,
node1.smallestSide/node0.largestSide);
// System.out.println("ratio "+ratio);
if( ratio > 1.3 )
return;
double angle = graph.acuteAngle(node0, intersection0, node1, intersection1);
double score = lineA.getLength()*(1.0+angle/0.1);
graph.checkConnect(node0,intersection0,node1,intersection1,score);
} | [
"void",
"considerConnect",
"(",
"SquareNode",
"node0",
",",
"SquareNode",
"node1",
")",
"{",
"// Find the side on each line which intersects the line connecting the two centers",
"lineA",
".",
"a",
"=",
"node0",
".",
"center",
";",
"lineA",
".",
"b",
"=",
"node1",
".",
"center",
";",
"int",
"intersection0",
"=",
"graph",
".",
"findSideIntersect",
"(",
"node0",
",",
"lineA",
",",
"intersection",
",",
"lineB",
")",
";",
"connectLine",
".",
"a",
".",
"set",
"(",
"intersection",
")",
";",
"int",
"intersection1",
"=",
"graph",
".",
"findSideIntersect",
"(",
"node1",
",",
"lineA",
",",
"intersection",
",",
"lineB",
")",
";",
"connectLine",
".",
"b",
".",
"set",
"(",
"intersection",
")",
";",
"if",
"(",
"intersection1",
"<",
"0",
"||",
"intersection0",
"<",
"0",
")",
"{",
"return",
";",
"}",
"double",
"side0",
"=",
"node0",
".",
"sideLengths",
"[",
"intersection0",
"]",
";",
"double",
"side1",
"=",
"node1",
".",
"sideLengths",
"[",
"intersection1",
"]",
";",
"// it should intersect about in the middle of the line",
"double",
"sideLoc0",
"=",
"connectLine",
".",
"a",
".",
"distance",
"(",
"node0",
".",
"square",
".",
"get",
"(",
"intersection0",
")",
")",
"/",
"side0",
";",
"double",
"sideLoc1",
"=",
"connectLine",
".",
"b",
".",
"distance",
"(",
"node1",
".",
"square",
".",
"get",
"(",
"intersection1",
")",
")",
"/",
"side1",
";",
"if",
"(",
"Math",
".",
"abs",
"(",
"sideLoc0",
"-",
"0.5",
")",
">",
"0.35",
"||",
"Math",
".",
"abs",
"(",
"sideLoc1",
"-",
"0.5",
")",
">",
"0.35",
")",
"return",
";",
"// see if connecting sides are of similar size",
"if",
"(",
"Math",
".",
"abs",
"(",
"side0",
"-",
"side1",
")",
"/",
"Math",
".",
"max",
"(",
"side0",
",",
"side1",
")",
">",
"0.25",
")",
"{",
"return",
";",
"}",
"// Checks to see if the two sides selected above are closest to being parallel to each other.",
"// Perspective distortion will make the lines not parallel, but will still have a smaller",
"// acute angle than the adjacent sides",
"if",
"(",
"!",
"graph",
".",
"almostParallel",
"(",
"node0",
",",
"intersection0",
",",
"node1",
",",
"intersection1",
")",
")",
"{",
"return",
";",
"}",
"double",
"ratio",
"=",
"Math",
".",
"max",
"(",
"node0",
".",
"smallestSide",
"/",
"node1",
".",
"largestSide",
",",
"node1",
".",
"smallestSide",
"/",
"node0",
".",
"largestSide",
")",
";",
"//\t\tSystem.out.println(\"ratio \"+ratio);",
"if",
"(",
"ratio",
">",
"1.3",
")",
"return",
";",
"double",
"angle",
"=",
"graph",
".",
"acuteAngle",
"(",
"node0",
",",
"intersection0",
",",
"node1",
",",
"intersection1",
")",
";",
"double",
"score",
"=",
"lineA",
".",
"getLength",
"(",
")",
"*",
"(",
"1.0",
"+",
"angle",
"/",
"0.1",
")",
";",
"graph",
".",
"checkConnect",
"(",
"node0",
",",
"intersection0",
",",
"node1",
",",
"intersection1",
",",
"score",
")",
";",
"}"
]
| Connects the 'candidate' node to node 'n' if they meet several criteria. See code for details. | [
"Connects",
"the",
"candidate",
"node",
"to",
"node",
"n",
"if",
"they",
"meet",
"several",
"criteria",
".",
"See",
"code",
"for",
"details",
"."
]
| train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePositionPatternDetector.java#L274-L322 |
paypal/SeLion | client/src/main/java/com/paypal/selion/internal/utils/RegexUtils.java | RegexUtils.wildCardMatch | public static boolean wildCardMatch(String text, String pattern) {
"""
Performs a wild-card matching for the text and pattern provided.
@param text
the text to be tested for matches.
@param pattern
the pattern to be matched for. This can contain the wildcard character '*' (asterisk).
@return <tt>true</tt> if a match is found, <tt>false</tt> otherwise.
"""
logger.entering(new Object[] { text, pattern });
Preconditions.checkArgument(text != null, "The text on which the search is to be run cannot be null.");
Preconditions.checkArgument(pattern != null, "The search pattern cannot be null.");
// Create the cards by splitting using a RegEx. If more speed
// is desired, a simpler character based splitting can be done.
String[] cards = pattern.split("\\*");
// Iterate over the cards.
for (String card : cards) {
int idx = text.indexOf(card);
// Card not detected in the text.
if (idx == -1) {
logger.exiting(false);
return false;
}
// Move ahead, towards the right of the text.
text = text.substring(idx + card.length());
}
logger.exiting(true);
return true;
} | java | public static boolean wildCardMatch(String text, String pattern) {
logger.entering(new Object[] { text, pattern });
Preconditions.checkArgument(text != null, "The text on which the search is to be run cannot be null.");
Preconditions.checkArgument(pattern != null, "The search pattern cannot be null.");
// Create the cards by splitting using a RegEx. If more speed
// is desired, a simpler character based splitting can be done.
String[] cards = pattern.split("\\*");
// Iterate over the cards.
for (String card : cards) {
int idx = text.indexOf(card);
// Card not detected in the text.
if (idx == -1) {
logger.exiting(false);
return false;
}
// Move ahead, towards the right of the text.
text = text.substring(idx + card.length());
}
logger.exiting(true);
return true;
} | [
"public",
"static",
"boolean",
"wildCardMatch",
"(",
"String",
"text",
",",
"String",
"pattern",
")",
"{",
"logger",
".",
"entering",
"(",
"new",
"Object",
"[",
"]",
"{",
"text",
",",
"pattern",
"}",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"text",
"!=",
"null",
",",
"\"The text on which the search is to be run cannot be null.\"",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"pattern",
"!=",
"null",
",",
"\"The search pattern cannot be null.\"",
")",
";",
"// Create the cards by splitting using a RegEx. If more speed",
"// is desired, a simpler character based splitting can be done.",
"String",
"[",
"]",
"cards",
"=",
"pattern",
".",
"split",
"(",
"\"\\\\*\"",
")",
";",
"// Iterate over the cards.",
"for",
"(",
"String",
"card",
":",
"cards",
")",
"{",
"int",
"idx",
"=",
"text",
".",
"indexOf",
"(",
"card",
")",
";",
"// Card not detected in the text.",
"if",
"(",
"idx",
"==",
"-",
"1",
")",
"{",
"logger",
".",
"exiting",
"(",
"false",
")",
";",
"return",
"false",
";",
"}",
"// Move ahead, towards the right of the text.",
"text",
"=",
"text",
".",
"substring",
"(",
"idx",
"+",
"card",
".",
"length",
"(",
")",
")",
";",
"}",
"logger",
".",
"exiting",
"(",
"true",
")",
";",
"return",
"true",
";",
"}"
]
| Performs a wild-card matching for the text and pattern provided.
@param text
the text to be tested for matches.
@param pattern
the pattern to be matched for. This can contain the wildcard character '*' (asterisk).
@return <tt>true</tt> if a match is found, <tt>false</tt> otherwise. | [
"Performs",
"a",
"wild",
"-",
"card",
"matching",
"for",
"the",
"text",
"and",
"pattern",
"provided",
"."
]
| train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/internal/utils/RegexUtils.java#L42-L65 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_region_regionName_GET | public OvhRegion project_serviceName_region_regionName_GET(String serviceName, String regionName) throws IOException {
"""
Get information about your region
REST: GET /cloud/project/{serviceName}/region/{regionName}
@param regionName [required] Public Cloud region
@param serviceName [required] Public Cloud project
"""
String qPath = "/cloud/project/{serviceName}/region/{regionName}";
StringBuilder sb = path(qPath, serviceName, regionName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRegion.class);
} | java | public OvhRegion project_serviceName_region_regionName_GET(String serviceName, String regionName) throws IOException {
String qPath = "/cloud/project/{serviceName}/region/{regionName}";
StringBuilder sb = path(qPath, serviceName, regionName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRegion.class);
} | [
"public",
"OvhRegion",
"project_serviceName_region_regionName_GET",
"(",
"String",
"serviceName",
",",
"String",
"regionName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/region/{regionName}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"regionName",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhRegion",
".",
"class",
")",
";",
"}"
]
| Get information about your region
REST: GET /cloud/project/{serviceName}/region/{regionName}
@param regionName [required] Public Cloud region
@param serviceName [required] Public Cloud project | [
"Get",
"information",
"about",
"your",
"region"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L154-L159 |
aws/aws-sdk-java | aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/CopyProductRequest.java | CopyProductRequest.withSourceProvisioningArtifactIdentifiers | public CopyProductRequest withSourceProvisioningArtifactIdentifiers(java.util.Map<String, String>... sourceProvisioningArtifactIdentifiers) {
"""
<p>
The identifiers of the provisioning artifacts (also known as versions) of the product to copy. By default, all
provisioning artifacts are copied.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setSourceProvisioningArtifactIdentifiers(java.util.Collection)} or
{@link #withSourceProvisioningArtifactIdentifiers(java.util.Collection)} if you want to override the existing
values.
</p>
@param sourceProvisioningArtifactIdentifiers
The identifiers of the provisioning artifacts (also known as versions) of the product to copy. By default,
all provisioning artifacts are copied.
@return Returns a reference to this object so that method calls can be chained together.
"""
if (this.sourceProvisioningArtifactIdentifiers == null) {
setSourceProvisioningArtifactIdentifiers(new java.util.ArrayList<java.util.Map<String, String>>(sourceProvisioningArtifactIdentifiers.length));
}
for (java.util.Map<String, String> ele : sourceProvisioningArtifactIdentifiers) {
this.sourceProvisioningArtifactIdentifiers.add(ele);
}
return this;
} | java | public CopyProductRequest withSourceProvisioningArtifactIdentifiers(java.util.Map<String, String>... sourceProvisioningArtifactIdentifiers) {
if (this.sourceProvisioningArtifactIdentifiers == null) {
setSourceProvisioningArtifactIdentifiers(new java.util.ArrayList<java.util.Map<String, String>>(sourceProvisioningArtifactIdentifiers.length));
}
for (java.util.Map<String, String> ele : sourceProvisioningArtifactIdentifiers) {
this.sourceProvisioningArtifactIdentifiers.add(ele);
}
return this;
} | [
"public",
"CopyProductRequest",
"withSourceProvisioningArtifactIdentifiers",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"...",
"sourceProvisioningArtifactIdentifiers",
")",
"{",
"if",
"(",
"this",
".",
"sourceProvisioningArtifactIdentifiers",
"==",
"null",
")",
"{",
"setSourceProvisioningArtifactIdentifiers",
"(",
"new",
"java",
".",
"util",
".",
"ArrayList",
"<",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
">",
"(",
"sourceProvisioningArtifactIdentifiers",
".",
"length",
")",
")",
";",
"}",
"for",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"ele",
":",
"sourceProvisioningArtifactIdentifiers",
")",
"{",
"this",
".",
"sourceProvisioningArtifactIdentifiers",
".",
"add",
"(",
"ele",
")",
";",
"}",
"return",
"this",
";",
"}"
]
| <p>
The identifiers of the provisioning artifacts (also known as versions) of the product to copy. By default, all
provisioning artifacts are copied.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setSourceProvisioningArtifactIdentifiers(java.util.Collection)} or
{@link #withSourceProvisioningArtifactIdentifiers(java.util.Collection)} if you want to override the existing
values.
</p>
@param sourceProvisioningArtifactIdentifiers
The identifiers of the provisioning artifacts (also known as versions) of the product to copy. By default,
all provisioning artifacts are copied.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"identifiers",
"of",
"the",
"provisioning",
"artifacts",
"(",
"also",
"known",
"as",
"versions",
")",
"of",
"the",
"product",
"to",
"copy",
".",
"By",
"default",
"all",
"provisioning",
"artifacts",
"are",
"copied",
".",
"<",
"/",
"p",
">",
"<p",
">",
"<b",
">",
"NOTE",
":",
"<",
"/",
"b",
">",
"This",
"method",
"appends",
"the",
"values",
"to",
"the",
"existing",
"list",
"(",
"if",
"any",
")",
".",
"Use",
"{",
"@link",
"#setSourceProvisioningArtifactIdentifiers",
"(",
"java",
".",
"util",
".",
"Collection",
")",
"}",
"or",
"{",
"@link",
"#withSourceProvisioningArtifactIdentifiers",
"(",
"java",
".",
"util",
".",
"Collection",
")",
"}",
"if",
"you",
"want",
"to",
"override",
"the",
"existing",
"values",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/CopyProductRequest.java#L402-L410 |
alipay/sofa-rpc | extension-impl/registry-sofa/src/main/java/com/alipay/sofa/rpc/registry/sofa/SofaRegistry.java | SofaRegistry.doUnRegister | protected void doUnRegister(String appName, String serviceName, String group) {
"""
反注册服务信息
@param appName 应用
@param serviceName 服务关键字
@param group 服务分组
"""
SofaRegistryClient.getRegistryClient(appName, registryConfig).unregister(serviceName, group,
RegistryType.PUBLISHER);
} | java | protected void doUnRegister(String appName, String serviceName, String group) {
SofaRegistryClient.getRegistryClient(appName, registryConfig).unregister(serviceName, group,
RegistryType.PUBLISHER);
} | [
"protected",
"void",
"doUnRegister",
"(",
"String",
"appName",
",",
"String",
"serviceName",
",",
"String",
"group",
")",
"{",
"SofaRegistryClient",
".",
"getRegistryClient",
"(",
"appName",
",",
"registryConfig",
")",
".",
"unregister",
"(",
"serviceName",
",",
"group",
",",
"RegistryType",
".",
"PUBLISHER",
")",
";",
"}"
]
| 反注册服务信息
@param appName 应用
@param serviceName 服务关键字
@param group 服务分组 | [
"反注册服务信息"
]
| train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-sofa/src/main/java/com/alipay/sofa/rpc/registry/sofa/SofaRegistry.java#L184-L188 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/authorization/AppBndAuthorizationTableService.java | AppBndAuthorizationTableService.updateMissingUserAccessId | private String updateMissingUserAccessId(AuthzTableContainer maps, User user, String userNameFromRole) {
"""
Update the map for the specified user name. If the accessID is
successfully computed, the map will be updated with the accessID.
If the accessID can not be computed due to the user not being found,
INVALID_ACCESS_ID will be stored.
@param maps
@param user
@param userNameFromRole
@return
"""
String accessIdFromRole;
accessIdFromRole = getMissingAccessId(user);
if (accessIdFromRole != null) {
maps.userToAccessIdMap.put(userNameFromRole, accessIdFromRole);
} else {
// Unable to compute the accessId, store an invalid access ID indicate this
maps.userToAccessIdMap.put(userNameFromRole, INVALID_ACCESS_ID);
}
return accessIdFromRole;
} | java | private String updateMissingUserAccessId(AuthzTableContainer maps, User user, String userNameFromRole) {
String accessIdFromRole;
accessIdFromRole = getMissingAccessId(user);
if (accessIdFromRole != null) {
maps.userToAccessIdMap.put(userNameFromRole, accessIdFromRole);
} else {
// Unable to compute the accessId, store an invalid access ID indicate this
maps.userToAccessIdMap.put(userNameFromRole, INVALID_ACCESS_ID);
}
return accessIdFromRole;
} | [
"private",
"String",
"updateMissingUserAccessId",
"(",
"AuthzTableContainer",
"maps",
",",
"User",
"user",
",",
"String",
"userNameFromRole",
")",
"{",
"String",
"accessIdFromRole",
";",
"accessIdFromRole",
"=",
"getMissingAccessId",
"(",
"user",
")",
";",
"if",
"(",
"accessIdFromRole",
"!=",
"null",
")",
"{",
"maps",
".",
"userToAccessIdMap",
".",
"put",
"(",
"userNameFromRole",
",",
"accessIdFromRole",
")",
";",
"}",
"else",
"{",
"// Unable to compute the accessId, store an invalid access ID indicate this",
"maps",
".",
"userToAccessIdMap",
".",
"put",
"(",
"userNameFromRole",
",",
"INVALID_ACCESS_ID",
")",
";",
"}",
"return",
"accessIdFromRole",
";",
"}"
]
| Update the map for the specified user name. If the accessID is
successfully computed, the map will be updated with the accessID.
If the accessID can not be computed due to the user not being found,
INVALID_ACCESS_ID will be stored.
@param maps
@param user
@param userNameFromRole
@return | [
"Update",
"the",
"map",
"for",
"the",
"specified",
"user",
"name",
".",
"If",
"the",
"accessID",
"is",
"successfully",
"computed",
"the",
"map",
"will",
"be",
"updated",
"with",
"the",
"accessID",
".",
"If",
"the",
"accessID",
"can",
"not",
"be",
"computed",
"due",
"to",
"the",
"user",
"not",
"being",
"found",
"INVALID_ACCESS_ID",
"will",
"be",
"stored",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/authorization/AppBndAuthorizationTableService.java#L385-L395 |
bekkopen/NoCommons | src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java | NorwegianDateUtil.rollGetDate | private static Date rollGetDate(Calendar calendar, int days) {
"""
Add the given number of days to the calendar and convert to Date.
@param calendar
The calendar to add to.
@param days
The number of days to add.
@return The date object given by the modified calendar.
"""
Calendar easterSunday = (Calendar) calendar.clone();
easterSunday.add(Calendar.DATE, days);
return easterSunday.getTime();
} | java | private static Date rollGetDate(Calendar calendar, int days) {
Calendar easterSunday = (Calendar) calendar.clone();
easterSunday.add(Calendar.DATE, days);
return easterSunday.getTime();
} | [
"private",
"static",
"Date",
"rollGetDate",
"(",
"Calendar",
"calendar",
",",
"int",
"days",
")",
"{",
"Calendar",
"easterSunday",
"=",
"(",
"Calendar",
")",
"calendar",
".",
"clone",
"(",
")",
";",
"easterSunday",
".",
"add",
"(",
"Calendar",
".",
"DATE",
",",
"days",
")",
";",
"return",
"easterSunday",
".",
"getTime",
"(",
")",
";",
"}"
]
| Add the given number of days to the calendar and convert to Date.
@param calendar
The calendar to add to.
@param days
The number of days to add.
@return The date object given by the modified calendar. | [
"Add",
"the",
"given",
"number",
"of",
"days",
"to",
"the",
"calendar",
"and",
"convert",
"to",
"Date",
"."
]
| train | https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java#L257-L261 |
greese/dasein-util | src/main/java/org/dasein/util/ConcurrentMultiCache.java | ConcurrentMultiCache.find | public T find(String key, Object val) {
"""
Returns the object identified by the specified key/value pair if it is currently
in memory in the cache. Just because this value returns <code>null</code> does
not mean the object does not exist. Instead, it may be that it is simply not
cached in memory.
@param key they unique identifier attribute on which you are searching
@param val the value of the unique identifier on which you are searching
@return the matching object from the cache
"""
return find(key, val, null);
} | java | public T find(String key, Object val) {
return find(key, val, null);
} | [
"public",
"T",
"find",
"(",
"String",
"key",
",",
"Object",
"val",
")",
"{",
"return",
"find",
"(",
"key",
",",
"val",
",",
"null",
")",
";",
"}"
]
| Returns the object identified by the specified key/value pair if it is currently
in memory in the cache. Just because this value returns <code>null</code> does
not mean the object does not exist. Instead, it may be that it is simply not
cached in memory.
@param key they unique identifier attribute on which you are searching
@param val the value of the unique identifier on which you are searching
@return the matching object from the cache | [
"Returns",
"the",
"object",
"identified",
"by",
"the",
"specified",
"key",
"/",
"value",
"pair",
"if",
"it",
"is",
"currently",
"in",
"memory",
"in",
"the",
"cache",
".",
"Just",
"because",
"this",
"value",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"does",
"not",
"mean",
"the",
"object",
"does",
"not",
"exist",
".",
"Instead",
"it",
"may",
"be",
"that",
"it",
"is",
"simply",
"not",
"cached",
"in",
"memory",
"."
]
| train | https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentMultiCache.java#L210-L212 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceClient.java | InstanceClient.insertInstance | @BetaApi
public final Operation insertInstance(ProjectZoneName zone, Instance instanceResource) {
"""
Creates an instance resource in the specified project using the data included in the request.
<p>Sample code:
<pre><code>
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
Instance instanceResource = Instance.newBuilder().build();
Operation response = instanceClient.insertInstance(zone, instanceResource);
}
</code></pre>
@param zone The name of the zone for this request.
@param instanceResource An Instance resource. (== resource_for beta.instances ==) (==
resource_for v1.instances ==)
@throws com.google.api.gax.rpc.ApiException if the remote call fails
"""
InsertInstanceHttpRequest request =
InsertInstanceHttpRequest.newBuilder()
.setZone(zone == null ? null : zone.toString())
.setInstanceResource(instanceResource)
.build();
return insertInstance(request);
} | java | @BetaApi
public final Operation insertInstance(ProjectZoneName zone, Instance instanceResource) {
InsertInstanceHttpRequest request =
InsertInstanceHttpRequest.newBuilder()
.setZone(zone == null ? null : zone.toString())
.setInstanceResource(instanceResource)
.build();
return insertInstance(request);
} | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"insertInstance",
"(",
"ProjectZoneName",
"zone",
",",
"Instance",
"instanceResource",
")",
"{",
"InsertInstanceHttpRequest",
"request",
"=",
"InsertInstanceHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setZone",
"(",
"zone",
"==",
"null",
"?",
"null",
":",
"zone",
".",
"toString",
"(",
")",
")",
".",
"setInstanceResource",
"(",
"instanceResource",
")",
".",
"build",
"(",
")",
";",
"return",
"insertInstance",
"(",
"request",
")",
";",
"}"
]
| Creates an instance resource in the specified project using the data included in the request.
<p>Sample code:
<pre><code>
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
Instance instanceResource = Instance.newBuilder().build();
Operation response = instanceClient.insertInstance(zone, instanceResource);
}
</code></pre>
@param zone The name of the zone for this request.
@param instanceResource An Instance resource. (== resource_for beta.instances ==) (==
resource_for v1.instances ==)
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"an",
"instance",
"resource",
"in",
"the",
"specified",
"project",
"using",
"the",
"data",
"included",
"in",
"the",
"request",
"."
]
| train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceClient.java#L1340-L1349 |
Azure/azure-sdk-for-java | batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/WorkspacesInner.java | WorkspacesInner.beginCreateAsync | public Observable<WorkspaceInner> beginCreateAsync(String resourceGroupName, String workspaceName, WorkspaceCreateParameters parameters) {
"""
Creates a Workspace.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param parameters Workspace creation parameters.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkspaceInner object
"""
return beginCreateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).map(new Func1<ServiceResponse<WorkspaceInner>, WorkspaceInner>() {
@Override
public WorkspaceInner call(ServiceResponse<WorkspaceInner> response) {
return response.body();
}
});
} | java | public Observable<WorkspaceInner> beginCreateAsync(String resourceGroupName, String workspaceName, WorkspaceCreateParameters parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).map(new Func1<ServiceResponse<WorkspaceInner>, WorkspaceInner>() {
@Override
public WorkspaceInner call(ServiceResponse<WorkspaceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkspaceInner",
">",
"beginCreateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"workspaceName",
",",
"WorkspaceCreateParameters",
"parameters",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"workspaceName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"WorkspaceInner",
">",
",",
"WorkspaceInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"WorkspaceInner",
"call",
"(",
"ServiceResponse",
"<",
"WorkspaceInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Creates a Workspace.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param parameters Workspace creation parameters.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkspaceInner object | [
"Creates",
"a",
"Workspace",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/WorkspacesInner.java#L677-L684 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/FolderResourcesImpl.java | FolderResourcesImpl.createFolder | public Folder createFolder(long parentFolderId, Folder folder) throws SmartsheetException {
"""
Create a folder.
It mirrors to the following Smartsheet REST API method: POST /folder/{id}/folders
Exceptions:
IllegalArgumentException : if folder is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param parentFolderId the parent folder id
@param folder the folder to create
@return the folder
@throws SmartsheetException the smartsheet exception
"""
return this.createResource("folders/" + parentFolderId + "/folders", Folder.class, folder);
} | java | public Folder createFolder(long parentFolderId, Folder folder) throws SmartsheetException {
return this.createResource("folders/" + parentFolderId + "/folders", Folder.class, folder);
} | [
"public",
"Folder",
"createFolder",
"(",
"long",
"parentFolderId",
",",
"Folder",
"folder",
")",
"throws",
"SmartsheetException",
"{",
"return",
"this",
".",
"createResource",
"(",
"\"folders/\"",
"+",
"parentFolderId",
"+",
"\"/folders\"",
",",
"Folder",
".",
"class",
",",
"folder",
")",
";",
"}"
]
| Create a folder.
It mirrors to the following Smartsheet REST API method: POST /folder/{id}/folders
Exceptions:
IllegalArgumentException : if folder is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param parentFolderId the parent folder id
@param folder the folder to create
@return the folder
@throws SmartsheetException the smartsheet exception | [
"Create",
"a",
"folder",
"."
]
| train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/FolderResourcesImpl.java#L179-L182 |
venmo/cursor-utils | cursor-utils/src/main/java/com/venmo/cursor/IterableCursorWrapper.java | IterableCursorWrapper.getBoolean | public boolean getBoolean(String columnName, boolean defaultValue) {
"""
Booleans in SQLite are handled as {@code int}s. Use this as a convenience to retrieve a
boolean from a column.
"""
int defaultValueAsInt = (defaultValue) ? SQLITE_TRUE : SQLITE_FALSE;
return getInteger(columnName, defaultValueAsInt) == SQLITE_TRUE;
} | java | public boolean getBoolean(String columnName, boolean defaultValue) {
int defaultValueAsInt = (defaultValue) ? SQLITE_TRUE : SQLITE_FALSE;
return getInteger(columnName, defaultValueAsInt) == SQLITE_TRUE;
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"columnName",
",",
"boolean",
"defaultValue",
")",
"{",
"int",
"defaultValueAsInt",
"=",
"(",
"defaultValue",
")",
"?",
"SQLITE_TRUE",
":",
"SQLITE_FALSE",
";",
"return",
"getInteger",
"(",
"columnName",
",",
"defaultValueAsInt",
")",
"==",
"SQLITE_TRUE",
";",
"}"
]
| Booleans in SQLite are handled as {@code int}s. Use this as a convenience to retrieve a
boolean from a column. | [
"Booleans",
"in",
"SQLite",
"are",
"handled",
"as",
"{"
]
| train | https://github.com/venmo/cursor-utils/blob/52cf91c4253346632fe70b8d7b7eab8bbcc9b248/cursor-utils/src/main/java/com/venmo/cursor/IterableCursorWrapper.java#L52-L56 |
diirt/util | src/main/java/org/epics/util/array/ListNumbers.java | ListNumbers.binarySearchValueOrLower | public static int binarySearchValueOrLower(ListNumber values, double value) {
"""
Finds the value in the list, or the one right below it.
@param values a list of values
@param value a value
@return the index of the value
"""
if (value <= values.getDouble(0)) {
return 0;
}
if (value >= values.getDouble(values.size() -1)) {
return values.size() - 1;
}
int index = binarySearch(0, values.size() - 1, values, value);
while (index != 0 && value == values.getDouble(index - 1)) {
index--;
}
return index;
} | java | public static int binarySearchValueOrLower(ListNumber values, double value) {
if (value <= values.getDouble(0)) {
return 0;
}
if (value >= values.getDouble(values.size() -1)) {
return values.size() - 1;
}
int index = binarySearch(0, values.size() - 1, values, value);
while (index != 0 && value == values.getDouble(index - 1)) {
index--;
}
return index;
} | [
"public",
"static",
"int",
"binarySearchValueOrLower",
"(",
"ListNumber",
"values",
",",
"double",
"value",
")",
"{",
"if",
"(",
"value",
"<=",
"values",
".",
"getDouble",
"(",
"0",
")",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"value",
">=",
"values",
".",
"getDouble",
"(",
"values",
".",
"size",
"(",
")",
"-",
"1",
")",
")",
"{",
"return",
"values",
".",
"size",
"(",
")",
"-",
"1",
";",
"}",
"int",
"index",
"=",
"binarySearch",
"(",
"0",
",",
"values",
".",
"size",
"(",
")",
"-",
"1",
",",
"values",
",",
"value",
")",
";",
"while",
"(",
"index",
"!=",
"0",
"&&",
"value",
"==",
"values",
".",
"getDouble",
"(",
"index",
"-",
"1",
")",
")",
"{",
"index",
"--",
";",
"}",
"return",
"index",
";",
"}"
]
| Finds the value in the list, or the one right below it.
@param values a list of values
@param value a value
@return the index of the value | [
"Finds",
"the",
"value",
"in",
"the",
"list",
"or",
"the",
"one",
"right",
"below",
"it",
"."
]
| train | https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/array/ListNumbers.java#L69-L84 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validate4NonNegative | public static int[] validate4NonNegative(int[] data, String paramName) {
"""
Reformats the input array to a length 4 array and checks that all values >= 0.
If the array is length 1, returns [a, a, a, a]
If the array is length 2, return [a, a, b, b]
If the array is length 4, returns the array.
@param data An array
@param paramName The param name, for error reporting
@return An int array of length 4 that represents the input
"""
validateNonNegative(data, paramName);
return validate4(data, paramName);
} | java | public static int[] validate4NonNegative(int[] data, String paramName){
validateNonNegative(data, paramName);
return validate4(data, paramName);
} | [
"public",
"static",
"int",
"[",
"]",
"validate4NonNegative",
"(",
"int",
"[",
"]",
"data",
",",
"String",
"paramName",
")",
"{",
"validateNonNegative",
"(",
"data",
",",
"paramName",
")",
";",
"return",
"validate4",
"(",
"data",
",",
"paramName",
")",
";",
"}"
]
| Reformats the input array to a length 4 array and checks that all values >= 0.
If the array is length 1, returns [a, a, a, a]
If the array is length 2, return [a, a, b, b]
If the array is length 4, returns the array.
@param data An array
@param paramName The param name, for error reporting
@return An int array of length 4 that represents the input | [
"Reformats",
"the",
"input",
"array",
"to",
"a",
"length",
"4",
"array",
"and",
"checks",
"that",
"all",
"values",
">",
"=",
"0",
"."
]
| train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L272-L275 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.getIntHeader | @Deprecated
public static int getIntHeader(HttpMessage message, String name, int defaultValue) {
"""
@deprecated Use {@link #getInt(CharSequence, int)} instead.
@see #getIntHeader(HttpMessage, CharSequence, int)
"""
return message.headers().getInt(name, defaultValue);
} | java | @Deprecated
public static int getIntHeader(HttpMessage message, String name, int defaultValue) {
return message.headers().getInt(name, defaultValue);
} | [
"@",
"Deprecated",
"public",
"static",
"int",
"getIntHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
",",
"int",
"defaultValue",
")",
"{",
"return",
"message",
".",
"headers",
"(",
")",
".",
"getInt",
"(",
"name",
",",
"defaultValue",
")",
";",
"}"
]
| @deprecated Use {@link #getInt(CharSequence, int)} instead.
@see #getIntHeader(HttpMessage, CharSequence, int) | [
"@deprecated",
"Use",
"{",
"@link",
"#getInt",
"(",
"CharSequence",
"int",
")",
"}",
"instead",
"."
]
| train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L739-L742 |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/AggregateOperationFactory.java | AggregateOperationFactory.createWindowAggregate | public TableOperation createWindowAggregate(
List<Expression> groupings,
List<Expression> aggregates,
List<Expression> windowProperties,
ResolvedGroupWindow window,
TableOperation child) {
"""
Creates a valid {@link WindowAggregateTableOperation} operation.
@param groupings expressions describing grouping key of aggregates
@param aggregates expressions describing aggregation functions
@param windowProperties expressions describing window properties
@param window grouping window of this aggregation
@param child relational operation on top of which to apply the aggregation
@return valid window aggregate operation
"""
validateGroupings(groupings);
validateAggregates(aggregates);
validateWindowProperties(windowProperties, window);
List<PlannerExpression> convertedGroupings = bridge(groupings);
List<PlannerExpression> convertedAggregates = bridge(aggregates);
List<PlannerExpression> convertedWindowProperties = bridge(windowProperties);
TypeInformation[] fieldTypes = concat(
convertedGroupings.stream(),
convertedAggregates.stream(),
convertedWindowProperties.stream()
).map(PlannerExpression::resultType)
.toArray(TypeInformation[]::new);
String[] fieldNames = concat(
groupings.stream(),
aggregates.stream(),
windowProperties.stream()
).map(expr -> extractName(expr).orElseGet(expr::toString))
.toArray(String[]::new);
TableSchema tableSchema = new TableSchema(fieldNames, fieldTypes);
return new WindowAggregateTableOperation(
groupings,
aggregates,
windowProperties,
window,
child,
tableSchema);
} | java | public TableOperation createWindowAggregate(
List<Expression> groupings,
List<Expression> aggregates,
List<Expression> windowProperties,
ResolvedGroupWindow window,
TableOperation child) {
validateGroupings(groupings);
validateAggregates(aggregates);
validateWindowProperties(windowProperties, window);
List<PlannerExpression> convertedGroupings = bridge(groupings);
List<PlannerExpression> convertedAggregates = bridge(aggregates);
List<PlannerExpression> convertedWindowProperties = bridge(windowProperties);
TypeInformation[] fieldTypes = concat(
convertedGroupings.stream(),
convertedAggregates.stream(),
convertedWindowProperties.stream()
).map(PlannerExpression::resultType)
.toArray(TypeInformation[]::new);
String[] fieldNames = concat(
groupings.stream(),
aggregates.stream(),
windowProperties.stream()
).map(expr -> extractName(expr).orElseGet(expr::toString))
.toArray(String[]::new);
TableSchema tableSchema = new TableSchema(fieldNames, fieldTypes);
return new WindowAggregateTableOperation(
groupings,
aggregates,
windowProperties,
window,
child,
tableSchema);
} | [
"public",
"TableOperation",
"createWindowAggregate",
"(",
"List",
"<",
"Expression",
">",
"groupings",
",",
"List",
"<",
"Expression",
">",
"aggregates",
",",
"List",
"<",
"Expression",
">",
"windowProperties",
",",
"ResolvedGroupWindow",
"window",
",",
"TableOperation",
"child",
")",
"{",
"validateGroupings",
"(",
"groupings",
")",
";",
"validateAggregates",
"(",
"aggregates",
")",
";",
"validateWindowProperties",
"(",
"windowProperties",
",",
"window",
")",
";",
"List",
"<",
"PlannerExpression",
">",
"convertedGroupings",
"=",
"bridge",
"(",
"groupings",
")",
";",
"List",
"<",
"PlannerExpression",
">",
"convertedAggregates",
"=",
"bridge",
"(",
"aggregates",
")",
";",
"List",
"<",
"PlannerExpression",
">",
"convertedWindowProperties",
"=",
"bridge",
"(",
"windowProperties",
")",
";",
"TypeInformation",
"[",
"]",
"fieldTypes",
"=",
"concat",
"(",
"convertedGroupings",
".",
"stream",
"(",
")",
",",
"convertedAggregates",
".",
"stream",
"(",
")",
",",
"convertedWindowProperties",
".",
"stream",
"(",
")",
")",
".",
"map",
"(",
"PlannerExpression",
"::",
"resultType",
")",
".",
"toArray",
"(",
"TypeInformation",
"[",
"]",
"::",
"new",
")",
";",
"String",
"[",
"]",
"fieldNames",
"=",
"concat",
"(",
"groupings",
".",
"stream",
"(",
")",
",",
"aggregates",
".",
"stream",
"(",
")",
",",
"windowProperties",
".",
"stream",
"(",
")",
")",
".",
"map",
"(",
"expr",
"->",
"extractName",
"(",
"expr",
")",
".",
"orElseGet",
"(",
"expr",
"::",
"toString",
")",
")",
".",
"toArray",
"(",
"String",
"[",
"]",
"::",
"new",
")",
";",
"TableSchema",
"tableSchema",
"=",
"new",
"TableSchema",
"(",
"fieldNames",
",",
"fieldTypes",
")",
";",
"return",
"new",
"WindowAggregateTableOperation",
"(",
"groupings",
",",
"aggregates",
",",
"windowProperties",
",",
"window",
",",
"child",
",",
"tableSchema",
")",
";",
"}"
]
| Creates a valid {@link WindowAggregateTableOperation} operation.
@param groupings expressions describing grouping key of aggregates
@param aggregates expressions describing aggregation functions
@param windowProperties expressions describing window properties
@param window grouping window of this aggregation
@param child relational operation on top of which to apply the aggregation
@return valid window aggregate operation | [
"Creates",
"a",
"valid",
"{",
"@link",
"WindowAggregateTableOperation",
"}",
"operation",
"."
]
| train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/AggregateOperationFactory.java#L127-L164 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsToolbarClipboardView.java | CmsToolbarClipboardView.addModified | public void addModified(CmsClientSitemapEntry entry, String previousPath) {
"""
Adds a modified entry.<p>
@param entry the entry
@param previousPath the previous path
"""
removeDeleted(entry.getId().toString());
removeModified(entry.getId().toString());
getModified().insertItem(createModifiedItem(entry), 0);
m_clipboardButton.enableClearModified(true);
} | java | public void addModified(CmsClientSitemapEntry entry, String previousPath) {
removeDeleted(entry.getId().toString());
removeModified(entry.getId().toString());
getModified().insertItem(createModifiedItem(entry), 0);
m_clipboardButton.enableClearModified(true);
} | [
"public",
"void",
"addModified",
"(",
"CmsClientSitemapEntry",
"entry",
",",
"String",
"previousPath",
")",
"{",
"removeDeleted",
"(",
"entry",
".",
"getId",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"removeModified",
"(",
"entry",
".",
"getId",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"getModified",
"(",
")",
".",
"insertItem",
"(",
"createModifiedItem",
"(",
"entry",
")",
",",
"0",
")",
";",
"m_clipboardButton",
".",
"enableClearModified",
"(",
"true",
")",
";",
"}"
]
| Adds a modified entry.<p>
@param entry the entry
@param previousPath the previous path | [
"Adds",
"a",
"modified",
"entry",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsToolbarClipboardView.java#L144-L150 |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/AbstractBusPrimitive.java | AbstractBusPrimitive.removeListener | protected final <T extends EventListener> void removeListener(Class<T> listenerType, T listener) {
"""
Remove a listener.
@param <T> is the type of listener to add.
@param listenerType is the type of listener to remove.
@param listener is the new listener.
"""
if (this.listeners != null) {
this.listeners.remove(listenerType, listener);
if (this.listeners.isEmpty()) {
this.listeners = null;
}
}
} | java | protected final <T extends EventListener> void removeListener(Class<T> listenerType, T listener) {
if (this.listeners != null) {
this.listeners.remove(listenerType, listener);
if (this.listeners.isEmpty()) {
this.listeners = null;
}
}
} | [
"protected",
"final",
"<",
"T",
"extends",
"EventListener",
">",
"void",
"removeListener",
"(",
"Class",
"<",
"T",
">",
"listenerType",
",",
"T",
"listener",
")",
"{",
"if",
"(",
"this",
".",
"listeners",
"!=",
"null",
")",
"{",
"this",
".",
"listeners",
".",
"remove",
"(",
"listenerType",
",",
"listener",
")",
";",
"if",
"(",
"this",
".",
"listeners",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"listeners",
"=",
"null",
";",
"}",
"}",
"}"
]
| Remove a listener.
@param <T> is the type of listener to add.
@param listenerType is the type of listener to remove.
@param listener is the new listener. | [
"Remove",
"a",
"listener",
"."
]
| train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/AbstractBusPrimitive.java#L162-L169 |
soarcn/COCOQuery | query/src/main/java/com/cocosw/query/AbstractViewQuery.java | AbstractViewQuery.increaseHitRect | public T increaseHitRect(final int top, final int left, final int bottom, final int right) {
"""
Increases the hit rect of a view. This should be used when an icon is small and cannot be easily tapped on.
Source: http://stackoverflow.com/a/1343796/5210
@param top The amount of dp's to be added to the top for hit purposes.
@param left The amount of dp's to be added to the left for hit purposes.
@param bottom The amount of dp's to be added to the bottom for hit purposes.
@param right The amount of dp's to be added to the right for hit purposes.
"""
final View parent = (View) view.getParent();
if (parent != null && view.getContext() != null) {
parent.post(new Runnable() {
// Post in the parent's message queue to make sure the parent
// lays out its children before we call getHitRect()
public void run() {
final Rect r = new Rect();
view.getHitRect(r);
r.top -= dip2pixel(top);
r.left -= dip2pixel(left);
r.bottom += dip2pixel(bottom);
r.right += dip2pixel(right);
parent.setTouchDelegate(new TouchDelegate(r, view));
}
});
}
return self();
} | java | public T increaseHitRect(final int top, final int left, final int bottom, final int right) {
final View parent = (View) view.getParent();
if (parent != null && view.getContext() != null) {
parent.post(new Runnable() {
// Post in the parent's message queue to make sure the parent
// lays out its children before we call getHitRect()
public void run() {
final Rect r = new Rect();
view.getHitRect(r);
r.top -= dip2pixel(top);
r.left -= dip2pixel(left);
r.bottom += dip2pixel(bottom);
r.right += dip2pixel(right);
parent.setTouchDelegate(new TouchDelegate(r, view));
}
});
}
return self();
} | [
"public",
"T",
"increaseHitRect",
"(",
"final",
"int",
"top",
",",
"final",
"int",
"left",
",",
"final",
"int",
"bottom",
",",
"final",
"int",
"right",
")",
"{",
"final",
"View",
"parent",
"=",
"(",
"View",
")",
"view",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
"&&",
"view",
".",
"getContext",
"(",
")",
"!=",
"null",
")",
"{",
"parent",
".",
"post",
"(",
"new",
"Runnable",
"(",
")",
"{",
"// Post in the parent's message queue to make sure the parent",
"// lays out its children before we call getHitRect()",
"public",
"void",
"run",
"(",
")",
"{",
"final",
"Rect",
"r",
"=",
"new",
"Rect",
"(",
")",
";",
"view",
".",
"getHitRect",
"(",
"r",
")",
";",
"r",
".",
"top",
"-=",
"dip2pixel",
"(",
"top",
")",
";",
"r",
".",
"left",
"-=",
"dip2pixel",
"(",
"left",
")",
";",
"r",
".",
"bottom",
"+=",
"dip2pixel",
"(",
"bottom",
")",
";",
"r",
".",
"right",
"+=",
"dip2pixel",
"(",
"right",
")",
";",
"parent",
".",
"setTouchDelegate",
"(",
"new",
"TouchDelegate",
"(",
"r",
",",
"view",
")",
")",
";",
"}",
"}",
")",
";",
"}",
"return",
"self",
"(",
")",
";",
"}"
]
| Increases the hit rect of a view. This should be used when an icon is small and cannot be easily tapped on.
Source: http://stackoverflow.com/a/1343796/5210
@param top The amount of dp's to be added to the top for hit purposes.
@param left The amount of dp's to be added to the left for hit purposes.
@param bottom The amount of dp's to be added to the bottom for hit purposes.
@param right The amount of dp's to be added to the right for hit purposes. | [
"Increases",
"the",
"hit",
"rect",
"of",
"a",
"view",
".",
"This",
"should",
"be",
"used",
"when",
"an",
"icon",
"is",
"small",
"and",
"cannot",
"be",
"easily",
"tapped",
"on",
".",
"Source",
":",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"a",
"/",
"1343796",
"/",
"5210"
]
| train | https://github.com/soarcn/COCOQuery/blob/712eac37ab65ef3dbdf55dbfae28750edfc36608/query/src/main/java/com/cocosw/query/AbstractViewQuery.java#L1037-L1055 |
facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/BookKeeperJournalManager.java | BookKeeperJournalManager.purgeLogsOlderThan | @Override
public void purgeLogsOlderThan(long minTxIdToKeep) throws IOException {
"""
For edit log segment that contains transactions with ids earlier than the
earliest txid to be retained, remove the ZooKeeper-based metadata and
BookKeeper ledgers associated with these segments.
@param minTxIdToKeep the earliest txid that must be retained after purging
old logs
@throws IOException If there is an error talking to BookKeeper or
ZooKeeper
"""
checkEnv();
Collection<EditLogLedgerMetadata> ledgers =
metadataManager.listLedgers(false); // Don't list in-progress ledgers
for (EditLogLedgerMetadata ledger : ledgers) {
if (ledger.getFirstTxId() < minTxIdToKeep &&
ledger.getLastTxId() < minTxIdToKeep) {
LOG.info("Purging edit log segment: " + ledger);
// Try to delete the associated ZooKeeper metadata
if (!metadataManager.deleteLedgerMetadata(ledger, -1)) {
// It's possible that another process has already deleted the
// metadata
LOG.warn(ledger + " has already been purged!");
} else {
try {
// Remove the ledger from BookKeeper itself to reclaim diskspace.
bookKeeperClient.deleteLedger(ledger.getLedgerId());
} catch (BKException e) {
bkException("Unrecoverable error deleting " + ledger +
" from BookKeeper", e);
} catch (InterruptedException e) {
interruptedException("Interrupted deleting " + ledger +
" from BookKeeper", e);
}
}
}
}
} | java | @Override
public void purgeLogsOlderThan(long minTxIdToKeep) throws IOException {
checkEnv();
Collection<EditLogLedgerMetadata> ledgers =
metadataManager.listLedgers(false); // Don't list in-progress ledgers
for (EditLogLedgerMetadata ledger : ledgers) {
if (ledger.getFirstTxId() < minTxIdToKeep &&
ledger.getLastTxId() < minTxIdToKeep) {
LOG.info("Purging edit log segment: " + ledger);
// Try to delete the associated ZooKeeper metadata
if (!metadataManager.deleteLedgerMetadata(ledger, -1)) {
// It's possible that another process has already deleted the
// metadata
LOG.warn(ledger + " has already been purged!");
} else {
try {
// Remove the ledger from BookKeeper itself to reclaim diskspace.
bookKeeperClient.deleteLedger(ledger.getLedgerId());
} catch (BKException e) {
bkException("Unrecoverable error deleting " + ledger +
" from BookKeeper", e);
} catch (InterruptedException e) {
interruptedException("Interrupted deleting " + ledger +
" from BookKeeper", e);
}
}
}
}
} | [
"@",
"Override",
"public",
"void",
"purgeLogsOlderThan",
"(",
"long",
"minTxIdToKeep",
")",
"throws",
"IOException",
"{",
"checkEnv",
"(",
")",
";",
"Collection",
"<",
"EditLogLedgerMetadata",
">",
"ledgers",
"=",
"metadataManager",
".",
"listLedgers",
"(",
"false",
")",
";",
"// Don't list in-progress ledgers",
"for",
"(",
"EditLogLedgerMetadata",
"ledger",
":",
"ledgers",
")",
"{",
"if",
"(",
"ledger",
".",
"getFirstTxId",
"(",
")",
"<",
"minTxIdToKeep",
"&&",
"ledger",
".",
"getLastTxId",
"(",
")",
"<",
"minTxIdToKeep",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Purging edit log segment: \"",
"+",
"ledger",
")",
";",
"// Try to delete the associated ZooKeeper metadata",
"if",
"(",
"!",
"metadataManager",
".",
"deleteLedgerMetadata",
"(",
"ledger",
",",
"-",
"1",
")",
")",
"{",
"// It's possible that another process has already deleted the",
"// metadata",
"LOG",
".",
"warn",
"(",
"ledger",
"+",
"\" has already been purged!\"",
")",
";",
"}",
"else",
"{",
"try",
"{",
"// Remove the ledger from BookKeeper itself to reclaim diskspace.",
"bookKeeperClient",
".",
"deleteLedger",
"(",
"ledger",
".",
"getLedgerId",
"(",
")",
")",
";",
"}",
"catch",
"(",
"BKException",
"e",
")",
"{",
"bkException",
"(",
"\"Unrecoverable error deleting \"",
"+",
"ledger",
"+",
"\" from BookKeeper\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"interruptedException",
"(",
"\"Interrupted deleting \"",
"+",
"ledger",
"+",
"\" from BookKeeper\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}",
"}"
]
| For edit log segment that contains transactions with ids earlier than the
earliest txid to be retained, remove the ZooKeeper-based metadata and
BookKeeper ledgers associated with these segments.
@param minTxIdToKeep the earliest txid that must be retained after purging
old logs
@throws IOException If there is an error talking to BookKeeper or
ZooKeeper | [
"For",
"edit",
"log",
"segment",
"that",
"contains",
"transactions",
"with",
"ids",
"earlier",
"than",
"the",
"earliest",
"txid",
"to",
"be",
"retained",
"remove",
"the",
"ZooKeeper",
"-",
"based",
"metadata",
"and",
"BookKeeper",
"ledgers",
"associated",
"with",
"these",
"segments",
"."
]
| train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/BookKeeperJournalManager.java#L631-L662 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java | DocTreeScanner.visitLink | @Override
public R visitLink(LinkTree node, P p) {
"""
{@inheritDoc} This implementation scans the children in left to right order.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of scanning
"""
R r = scan(node.getReference(), p);
r = scanAndReduce(node.getLabel(), p, r);
return r;
} | java | @Override
public R visitLink(LinkTree node, P p) {
R r = scan(node.getReference(), p);
r = scanAndReduce(node.getLabel(), p, r);
return r;
} | [
"@",
"Override",
"public",
"R",
"visitLink",
"(",
"LinkTree",
"node",
",",
"P",
"p",
")",
"{",
"R",
"r",
"=",
"scan",
"(",
"node",
".",
"getReference",
"(",
")",
",",
"p",
")",
";",
"r",
"=",
"scanAndReduce",
"(",
"node",
".",
"getLabel",
"(",
")",
",",
"p",
",",
"r",
")",
";",
"return",
"r",
";",
"}"
]
| {@inheritDoc} This implementation scans the children in left to right order.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of scanning | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"scans",
"the",
"children",
"in",
"left",
"to",
"right",
"order",
"."
]
| train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java#L294-L299 |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/NodeIdRepresentation.java | NodeIdRepresentation.modifyResource | public void modifyResource(final String resourceName, final long nodeId, final InputStream newValue)
throws JaxRxException {
"""
This method is responsible to modify the XML resource, which is addressed
through a unique node id.
@param resourceName
The name of the database, where the node id belongs to.
@param nodeId
The node id.
@param newValue
The new value of the node that has to be replaced.
@throws JaxRxException
The exception occurred.
"""
synchronized (resourceName) {
ISession session = null;
INodeWriteTrx wtx = null;
boolean abort = false;
if (mDatabase.existsResource(resourceName)) {
try {
// Creating a new session
session =
mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY));
// Creating a write transaction
wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling);
if (wtx.moveTo(nodeId)) {
final long parentKey = wtx.getNode().getParentKey();
wtx.remove();
wtx.moveTo(parentKey);
WorkerHelper.shredInputStream(wtx, newValue, EShredderInsert.ADDASFIRSTCHILD);
} else {
// workerHelper.closeWTX(abort, wtx, session, database);
throw new JaxRxException(404, NOTFOUND);
}
} catch (final TTException exc) {
abort = true;
throw new JaxRxException(exc);
} finally {
try {
WorkerHelper.closeWTX(abort, wtx, session);
} catch (final TTException exce) {
throw new JaxRxException(exce);
}
}
} else {
throw new JaxRxException(404, "Requested resource not found");
}
}
} | java | public void modifyResource(final String resourceName, final long nodeId, final InputStream newValue)
throws JaxRxException {
synchronized (resourceName) {
ISession session = null;
INodeWriteTrx wtx = null;
boolean abort = false;
if (mDatabase.existsResource(resourceName)) {
try {
// Creating a new session
session =
mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY));
// Creating a write transaction
wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling);
if (wtx.moveTo(nodeId)) {
final long parentKey = wtx.getNode().getParentKey();
wtx.remove();
wtx.moveTo(parentKey);
WorkerHelper.shredInputStream(wtx, newValue, EShredderInsert.ADDASFIRSTCHILD);
} else {
// workerHelper.closeWTX(abort, wtx, session, database);
throw new JaxRxException(404, NOTFOUND);
}
} catch (final TTException exc) {
abort = true;
throw new JaxRxException(exc);
} finally {
try {
WorkerHelper.closeWTX(abort, wtx, session);
} catch (final TTException exce) {
throw new JaxRxException(exce);
}
}
} else {
throw new JaxRxException(404, "Requested resource not found");
}
}
} | [
"public",
"void",
"modifyResource",
"(",
"final",
"String",
"resourceName",
",",
"final",
"long",
"nodeId",
",",
"final",
"InputStream",
"newValue",
")",
"throws",
"JaxRxException",
"{",
"synchronized",
"(",
"resourceName",
")",
"{",
"ISession",
"session",
"=",
"null",
";",
"INodeWriteTrx",
"wtx",
"=",
"null",
";",
"boolean",
"abort",
"=",
"false",
";",
"if",
"(",
"mDatabase",
".",
"existsResource",
"(",
"resourceName",
")",
")",
"{",
"try",
"{",
"// Creating a new session",
"session",
"=",
"mDatabase",
".",
"getSession",
"(",
"new",
"SessionConfiguration",
"(",
"resourceName",
",",
"StandardSettings",
".",
"KEY",
")",
")",
";",
"// Creating a write transaction",
"wtx",
"=",
"new",
"NodeWriteTrx",
"(",
"session",
",",
"session",
".",
"beginBucketWtx",
"(",
")",
",",
"HashKind",
".",
"Rolling",
")",
";",
"if",
"(",
"wtx",
".",
"moveTo",
"(",
"nodeId",
")",
")",
"{",
"final",
"long",
"parentKey",
"=",
"wtx",
".",
"getNode",
"(",
")",
".",
"getParentKey",
"(",
")",
";",
"wtx",
".",
"remove",
"(",
")",
";",
"wtx",
".",
"moveTo",
"(",
"parentKey",
")",
";",
"WorkerHelper",
".",
"shredInputStream",
"(",
"wtx",
",",
"newValue",
",",
"EShredderInsert",
".",
"ADDASFIRSTCHILD",
")",
";",
"}",
"else",
"{",
"// workerHelper.closeWTX(abort, wtx, session, database);",
"throw",
"new",
"JaxRxException",
"(",
"404",
",",
"NOTFOUND",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"TTException",
"exc",
")",
"{",
"abort",
"=",
"true",
";",
"throw",
"new",
"JaxRxException",
"(",
"exc",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"WorkerHelper",
".",
"closeWTX",
"(",
"abort",
",",
"wtx",
",",
"session",
")",
";",
"}",
"catch",
"(",
"final",
"TTException",
"exce",
")",
"{",
"throw",
"new",
"JaxRxException",
"(",
"exce",
")",
";",
"}",
"}",
"}",
"else",
"{",
"throw",
"new",
"JaxRxException",
"(",
"404",
",",
"\"Requested resource not found\"",
")",
";",
"}",
"}",
"}"
]
| This method is responsible to modify the XML resource, which is addressed
through a unique node id.
@param resourceName
The name of the database, where the node id belongs to.
@param nodeId
The node id.
@param newValue
The new value of the node that has to be replaced.
@throws JaxRxException
The exception occurred. | [
"This",
"method",
"is",
"responsible",
"to",
"modify",
"the",
"XML",
"resource",
"which",
"is",
"addressed",
"through",
"a",
"unique",
"node",
"id",
"."
]
| train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/NodeIdRepresentation.java#L274-L313 |
PrashamTrivedi/SharedPreferenceInspector | sharedpreferenceinspector/src/main/java/com/ceelites/sharedpreferenceinspector/Utils/SharedPreferenceUtils.java | SharedPreferenceUtils.inflateDebugMenu | public void inflateDebugMenu(MenuInflater inflater, Menu menu) {
"""
Inflate menu item for debug.
@param inflater:
MenuInflater to inflate the menu.
@param menu
: Menu object to inflate debug menu.
"""
inflater.inflate(R.menu.debug, menu);
} | java | public void inflateDebugMenu(MenuInflater inflater, Menu menu) {
inflater.inflate(R.menu.debug, menu);
} | [
"public",
"void",
"inflateDebugMenu",
"(",
"MenuInflater",
"inflater",
",",
"Menu",
"menu",
")",
"{",
"inflater",
".",
"inflate",
"(",
"R",
".",
"menu",
".",
"debug",
",",
"menu",
")",
";",
"}"
]
| Inflate menu item for debug.
@param inflater:
MenuInflater to inflate the menu.
@param menu
: Menu object to inflate debug menu. | [
"Inflate",
"menu",
"item",
"for",
"debug",
"."
]
| train | https://github.com/PrashamTrivedi/SharedPreferenceInspector/blob/c04d567c4d0fc5e0f8cda308ca85df19c6b3b838/sharedpreferenceinspector/src/main/java/com/ceelites/sharedpreferenceinspector/Utils/SharedPreferenceUtils.java#L167-L169 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoin/NativeSecp256k1.java | NativeSecp256k1.secKeyVerify | public static boolean secKeyVerify(byte[] seckey) {
"""
libsecp256k1 Seckey Verify - returns 1 if valid, 0 if invalid
@param seckey ECDSA Secret key, 32 bytes
"""
Preconditions.checkArgument(seckey.length == 32);
ByteBuffer byteBuff = nativeECDSABuffer.get();
if (byteBuff == null || byteBuff.capacity() < seckey.length) {
byteBuff = ByteBuffer.allocateDirect(seckey.length);
byteBuff.order(ByteOrder.nativeOrder());
nativeECDSABuffer.set(byteBuff);
}
byteBuff.rewind();
byteBuff.put(seckey);
r.lock();
try {
return secp256k1_ec_seckey_verify(byteBuff, Secp256k1Context.getContext()) == 1;
} finally {
r.unlock();
}
} | java | public static boolean secKeyVerify(byte[] seckey) {
Preconditions.checkArgument(seckey.length == 32);
ByteBuffer byteBuff = nativeECDSABuffer.get();
if (byteBuff == null || byteBuff.capacity() < seckey.length) {
byteBuff = ByteBuffer.allocateDirect(seckey.length);
byteBuff.order(ByteOrder.nativeOrder());
nativeECDSABuffer.set(byteBuff);
}
byteBuff.rewind();
byteBuff.put(seckey);
r.lock();
try {
return secp256k1_ec_seckey_verify(byteBuff, Secp256k1Context.getContext()) == 1;
} finally {
r.unlock();
}
} | [
"public",
"static",
"boolean",
"secKeyVerify",
"(",
"byte",
"[",
"]",
"seckey",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"seckey",
".",
"length",
"==",
"32",
")",
";",
"ByteBuffer",
"byteBuff",
"=",
"nativeECDSABuffer",
".",
"get",
"(",
")",
";",
"if",
"(",
"byteBuff",
"==",
"null",
"||",
"byteBuff",
".",
"capacity",
"(",
")",
"<",
"seckey",
".",
"length",
")",
"{",
"byteBuff",
"=",
"ByteBuffer",
".",
"allocateDirect",
"(",
"seckey",
".",
"length",
")",
";",
"byteBuff",
".",
"order",
"(",
"ByteOrder",
".",
"nativeOrder",
"(",
")",
")",
";",
"nativeECDSABuffer",
".",
"set",
"(",
"byteBuff",
")",
";",
"}",
"byteBuff",
".",
"rewind",
"(",
")",
";",
"byteBuff",
".",
"put",
"(",
"seckey",
")",
";",
"r",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"secp256k1_ec_seckey_verify",
"(",
"byteBuff",
",",
"Secp256k1Context",
".",
"getContext",
"(",
")",
")",
"==",
"1",
";",
"}",
"finally",
"{",
"r",
".",
"unlock",
"(",
")",
";",
"}",
"}"
]
| libsecp256k1 Seckey Verify - returns 1 if valid, 0 if invalid
@param seckey ECDSA Secret key, 32 bytes | [
"libsecp256k1",
"Seckey",
"Verify",
"-",
"returns",
"1",
"if",
"valid",
"0",
"if",
"invalid"
]
| train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoin/NativeSecp256k1.java#L120-L138 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/Step.java | Step.expectText | protected void expectText(PageElement pageElement, String textOrKey) throws FailureException, TechnicalException {
"""
Expects that an element contains expected value.
@param pageElement
Is target element
@param textOrKey
Is the expected data (text or text in context (after a save))
@throws FailureException
if the scenario encounters a functional error
@throws TechnicalException
"""
WebElement element = null;
String value = getTextOrKey(textOrKey);
try {
element = Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(pageElement)));
} catch (final Exception e) {
new Result.Failure<>(e.getMessage(), Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT), true, pageElement.getPage().getCallBack());
}
try {
Context.waitUntil(ExpectSteps.textToBeEqualsToExpectedValue(Utilities.getLocator(pageElement), value));
} catch (final Exception e) {
logger.error("error in expectText. element is [{}]", element == null ? null : element.getText());
new Result.Failure<>(element == null ? null : element.getText(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_WRONG_EXPECTED_VALUE), pageElement,
textOrKey.startsWith(cryptoService.getPrefix()) ? SECURE_MASK : value, pageElement.getPage().getApplication()), true, pageElement.getPage().getCallBack());
}
} | java | protected void expectText(PageElement pageElement, String textOrKey) throws FailureException, TechnicalException {
WebElement element = null;
String value = getTextOrKey(textOrKey);
try {
element = Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(pageElement)));
} catch (final Exception e) {
new Result.Failure<>(e.getMessage(), Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT), true, pageElement.getPage().getCallBack());
}
try {
Context.waitUntil(ExpectSteps.textToBeEqualsToExpectedValue(Utilities.getLocator(pageElement), value));
} catch (final Exception e) {
logger.error("error in expectText. element is [{}]", element == null ? null : element.getText());
new Result.Failure<>(element == null ? null : element.getText(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_WRONG_EXPECTED_VALUE), pageElement,
textOrKey.startsWith(cryptoService.getPrefix()) ? SECURE_MASK : value, pageElement.getPage().getApplication()), true, pageElement.getPage().getCallBack());
}
} | [
"protected",
"void",
"expectText",
"(",
"PageElement",
"pageElement",
",",
"String",
"textOrKey",
")",
"throws",
"FailureException",
",",
"TechnicalException",
"{",
"WebElement",
"element",
"=",
"null",
";",
"String",
"value",
"=",
"getTextOrKey",
"(",
"textOrKey",
")",
";",
"try",
"{",
"element",
"=",
"Context",
".",
"waitUntil",
"(",
"ExpectedConditions",
".",
"presenceOfElementLocated",
"(",
"Utilities",
".",
"getLocator",
"(",
"pageElement",
")",
")",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"new",
"Result",
".",
"Failure",
"<>",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"Messages",
".",
"getMessage",
"(",
"Messages",
".",
"FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT",
")",
",",
"true",
",",
"pageElement",
".",
"getPage",
"(",
")",
".",
"getCallBack",
"(",
")",
")",
";",
"}",
"try",
"{",
"Context",
".",
"waitUntil",
"(",
"ExpectSteps",
".",
"textToBeEqualsToExpectedValue",
"(",
"Utilities",
".",
"getLocator",
"(",
"pageElement",
")",
",",
"value",
")",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"error in expectText. element is [{}]\"",
",",
"element",
"==",
"null",
"?",
"null",
":",
"element",
".",
"getText",
"(",
")",
")",
";",
"new",
"Result",
".",
"Failure",
"<>",
"(",
"element",
"==",
"null",
"?",
"null",
":",
"element",
".",
"getText",
"(",
")",
",",
"Messages",
".",
"format",
"(",
"Messages",
".",
"getMessage",
"(",
"Messages",
".",
"FAIL_MESSAGE_WRONG_EXPECTED_VALUE",
")",
",",
"pageElement",
",",
"textOrKey",
".",
"startsWith",
"(",
"cryptoService",
".",
"getPrefix",
"(",
")",
")",
"?",
"SECURE_MASK",
":",
"value",
",",
"pageElement",
".",
"getPage",
"(",
")",
".",
"getApplication",
"(",
")",
")",
",",
"true",
",",
"pageElement",
".",
"getPage",
"(",
")",
".",
"getCallBack",
"(",
")",
")",
";",
"}",
"}"
]
| Expects that an element contains expected value.
@param pageElement
Is target element
@param textOrKey
Is the expected data (text or text in context (after a save))
@throws FailureException
if the scenario encounters a functional error
@throws TechnicalException | [
"Expects",
"that",
"an",
"element",
"contains",
"expected",
"value",
"."
]
| train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L310-L326 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Hex.java | Hex.toDigit | protected static int toDigit(final char ch, final int index) throws IllegalArgumentException {
"""
Converts a hexadecimal character to an integer.
@param ch
A character to convert to an integer digit
@param index
The index of the character in the source
@return An integer
@throws DecoderException
Thrown if ch is an illegal hex character
"""
final int digit = Character.digit(ch, 16);
if (digit == -1) {
throw new IllegalArgumentException("Illegal hexadecimal character " + ch + " at index " + index);
}
return digit;
} | java | protected static int toDigit(final char ch, final int index) throws IllegalArgumentException {
final int digit = Character.digit(ch, 16);
if (digit == -1) {
throw new IllegalArgumentException("Illegal hexadecimal character " + ch + " at index " + index);
}
return digit;
} | [
"protected",
"static",
"int",
"toDigit",
"(",
"final",
"char",
"ch",
",",
"final",
"int",
"index",
")",
"throws",
"IllegalArgumentException",
"{",
"final",
"int",
"digit",
"=",
"Character",
".",
"digit",
"(",
"ch",
",",
"16",
")",
";",
"if",
"(",
"digit",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illegal hexadecimal character \"",
"+",
"ch",
"+",
"\" at index \"",
"+",
"index",
")",
";",
"}",
"return",
"digit",
";",
"}"
]
| Converts a hexadecimal character to an integer.
@param ch
A character to convert to an integer digit
@param index
The index of the character in the source
@return An integer
@throws DecoderException
Thrown if ch is an illegal hex character | [
"Converts",
"a",
"hexadecimal",
"character",
"to",
"an",
"integer",
"."
]
| train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Hex.java#L170-L176 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.truncate | public static Calendar truncate(Calendar calendar, DateField dateField) {
"""
修改日期为某个时间字段起始时间
@param calendar {@link Calendar}
@param dateField 时间字段
@return 原{@link Calendar}
@since 4.5.7
"""
return DateModifier.modify(calendar, dateField.getValue(), ModifyType.TRUNCATE);
} | java | public static Calendar truncate(Calendar calendar, DateField dateField) {
return DateModifier.modify(calendar, dateField.getValue(), ModifyType.TRUNCATE);
} | [
"public",
"static",
"Calendar",
"truncate",
"(",
"Calendar",
"calendar",
",",
"DateField",
"dateField",
")",
"{",
"return",
"DateModifier",
".",
"modify",
"(",
"calendar",
",",
"dateField",
".",
"getValue",
"(",
")",
",",
"ModifyType",
".",
"TRUNCATE",
")",
";",
"}"
]
| 修改日期为某个时间字段起始时间
@param calendar {@link Calendar}
@param dateField 时间字段
@return 原{@link Calendar}
@since 4.5.7 | [
"修改日期为某个时间字段起始时间"
]
| train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L767-L769 |
Azure/azure-sdk-for-java | locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java | ManagementLocksInner.deleteAtResourceLevelAsync | public Observable<Void> deleteAtResourceLevelAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName) {
"""
Deletes the management lock of a resource or any level below the resource.
To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
@param resourceGroupName The name of the resource group containing the resource with the lock to delete.
@param resourceProviderNamespace The resource provider namespace of the resource with the lock to delete.
@param parentResourcePath The parent resource identity.
@param resourceType The resource type of the resource with the lock to delete.
@param resourceName The name of the resource with the lock to delete.
@param lockName The name of the lock to delete.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return deleteAtResourceLevelWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> deleteAtResourceLevelAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName) {
return deleteAtResourceLevelWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"deleteAtResourceLevelAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceProviderNamespace",
",",
"String",
"parentResourcePath",
",",
"String",
"resourceType",
",",
"String",
"resourceName",
",",
"String",
"lockName",
")",
"{",
"return",
"deleteAtResourceLevelWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceProviderNamespace",
",",
"parentResourcePath",
",",
"resourceType",
",",
"resourceName",
",",
"lockName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Void",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponse",
"<",
"Void",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Deletes the management lock of a resource or any level below the resource.
To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
@param resourceGroupName The name of the resource group containing the resource with the lock to delete.
@param resourceProviderNamespace The resource provider namespace of the resource with the lock to delete.
@param parentResourcePath The parent resource identity.
@param resourceType The resource type of the resource with the lock to delete.
@param resourceName The name of the resource with the lock to delete.
@param lockName The name of the lock to delete.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Deletes",
"the",
"management",
"lock",
"of",
"a",
"resource",
"or",
"any",
"level",
"below",
"the",
"resource",
".",
"To",
"delete",
"management",
"locks",
"you",
"must",
"have",
"access",
"to",
"Microsoft",
".",
"Authorization",
"/",
"*",
"or",
"Microsoft",
".",
"Authorization",
"/",
"locks",
"/",
"*",
"actions",
".",
"Of",
"the",
"built",
"-",
"in",
"roles",
"only",
"Owner",
"and",
"User",
"Access",
"Administrator",
"are",
"granted",
"those",
"actions",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java#L849-L856 |
Azure/azure-sdk-for-java | compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java | SnapshotsInner.getByResourceGroupAsync | public Observable<SnapshotInner> getByResourceGroupAsync(String resourceGroupName, String snapshotName) {
"""
Gets information about a snapshot.
@param resourceGroupName The name of the resource group.
@param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SnapshotInner object
"""
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, snapshotName).map(new Func1<ServiceResponse<SnapshotInner>, SnapshotInner>() {
@Override
public SnapshotInner call(ServiceResponse<SnapshotInner> response) {
return response.body();
}
});
} | java | public Observable<SnapshotInner> getByResourceGroupAsync(String resourceGroupName, String snapshotName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, snapshotName).map(new Func1<ServiceResponse<SnapshotInner>, SnapshotInner>() {
@Override
public SnapshotInner call(ServiceResponse<SnapshotInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SnapshotInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"snapshotName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"snapshotName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"SnapshotInner",
">",
",",
"SnapshotInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"SnapshotInner",
"call",
"(",
"ServiceResponse",
"<",
"SnapshotInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Gets information about a snapshot.
@param resourceGroupName The name of the resource group.
@param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SnapshotInner object | [
"Gets",
"information",
"about",
"a",
"snapshot",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java#L512-L519 |
qiujiayu/AutoLoadCache | src/main/java/com/jarvis/cache/script/AbstractScriptParser.java | AbstractScriptParser.getElValue | public <T> T getElValue(String keyEL, Object target, Object[] arguments, Class<T> valueType) throws Exception {
"""
将表达式转换期望的值
@param keyEL 生成缓存Key的表达式
@param target AOP 拦截到的实例
@param arguments 参数
@param valueType 值类型
@param <T> 泛型
@return T Value 返回值
@throws Exception 异常
"""
return this.getElValue(keyEL, target, arguments, null, false, valueType);
} | java | public <T> T getElValue(String keyEL, Object target, Object[] arguments, Class<T> valueType) throws Exception {
return this.getElValue(keyEL, target, arguments, null, false, valueType);
} | [
"public",
"<",
"T",
">",
"T",
"getElValue",
"(",
"String",
"keyEL",
",",
"Object",
"target",
",",
"Object",
"[",
"]",
"arguments",
",",
"Class",
"<",
"T",
">",
"valueType",
")",
"throws",
"Exception",
"{",
"return",
"this",
".",
"getElValue",
"(",
"keyEL",
",",
"target",
",",
"arguments",
",",
"null",
",",
"false",
",",
"valueType",
")",
";",
"}"
]
| 将表达式转换期望的值
@param keyEL 生成缓存Key的表达式
@param target AOP 拦截到的实例
@param arguments 参数
@param valueType 值类型
@param <T> 泛型
@return T Value 返回值
@throws Exception 异常 | [
"将表达式转换期望的值"
]
| train | https://github.com/qiujiayu/AutoLoadCache/blob/8121c146f1a420fa6d6832e849acadb547c13622/src/main/java/com/jarvis/cache/script/AbstractScriptParser.java#L62-L64 |
unbescape/unbescape | src/main/java/org/unbescape/properties/PropertiesEscape.java | PropertiesEscape.escapePropertiesKey | public static void escapePropertiesKey(final String text, final Writer writer, final PropertiesKeyEscapeLevel level)
throws IOException {
"""
<p>
Perform a (configurable) Java Properties Key <strong>escape</strong> operation on a <tt>String</tt> input,
writing results to a <tt>Writer</tt>.
</p>
<p>
This method will perform an escape operation according to the specified
{@link org.unbescape.properties.PropertiesKeyEscapeLevel} argument value.
</p>
<p>
All other <tt>String</tt>/<tt>Writer</tt>-based <tt>escapePropertiesKey*(...)</tt> methods call this one with
preconfigured <tt>level</tt> values.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to 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>.
@param level the escape level to be applied, see {@link org.unbescape.properties.PropertiesKeyEscapeLevel}.
@throws IOException if an input/output exception occurs
"""
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
if (level == null) {
throw new IllegalArgumentException("The 'level' argument cannot be null");
}
PropertiesKeyEscapeUtil.escape(new InternalStringReader(text), writer, level);
} | java | public static void escapePropertiesKey(final String text, final Writer writer, final PropertiesKeyEscapeLevel level)
throws IOException {
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
if (level == null) {
throw new IllegalArgumentException("The 'level' argument cannot be null");
}
PropertiesKeyEscapeUtil.escape(new InternalStringReader(text), writer, level);
} | [
"public",
"static",
"void",
"escapePropertiesKey",
"(",
"final",
"String",
"text",
",",
"final",
"Writer",
"writer",
",",
"final",
"PropertiesKeyEscapeLevel",
"level",
")",
"throws",
"IOException",
"{",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument 'writer' cannot be null\"",
")",
";",
"}",
"if",
"(",
"level",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The 'level' argument cannot be null\"",
")",
";",
"}",
"PropertiesKeyEscapeUtil",
".",
"escape",
"(",
"new",
"InternalStringReader",
"(",
"text",
")",
",",
"writer",
",",
"level",
")",
";",
"}"
]
| <p>
Perform a (configurable) Java Properties Key <strong>escape</strong> operation on a <tt>String</tt> input,
writing results to a <tt>Writer</tt>.
</p>
<p>
This method will perform an escape operation according to the specified
{@link org.unbescape.properties.PropertiesKeyEscapeLevel} argument value.
</p>
<p>
All other <tt>String</tt>/<tt>Writer</tt>-based <tt>escapePropertiesKey*(...)</tt> methods call this one with
preconfigured <tt>level</tt> values.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to 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>.
@param level the escape level to be applied, see {@link org.unbescape.properties.PropertiesKeyEscapeLevel}.
@throws IOException if an input/output exception occurs | [
"<p",
">",
"Perform",
"a",
"(",
"configurable",
")",
"Java",
"Properties",
"Key",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
"writing",
"results",
"to",
"a",
"<tt",
">",
"Writer<",
"/",
"tt",
">",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"method",
"will",
"perform",
"an",
"escape",
"operation",
"according",
"to",
"the",
"specified",
"{",
"@link",
"org",
".",
"unbescape",
".",
"properties",
".",
"PropertiesKeyEscapeLevel",
"}",
"argument",
"value",
".",
"<",
"/",
"p",
">",
"<p",
">",
"All",
"other",
"<tt",
">",
"String<",
"/",
"tt",
">",
"/",
"<tt",
">",
"Writer<",
"/",
"tt",
">",
"-",
"based",
"<tt",
">",
"escapePropertiesKey",
"*",
"(",
"...",
")",
"<",
"/",
"tt",
">",
"methods",
"call",
"this",
"one",
"with",
"preconfigured",
"<tt",
">",
"level<",
"/",
"tt",
">",
"values",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"method",
"is",
"<strong",
">",
"thread",
"-",
"safe<",
"/",
"strong",
">",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/properties/PropertiesEscape.java#L1023-L1035 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java | Configurer.getBoolean | public final boolean getBoolean(String attribute, String... path) {
"""
Get a boolean in the xml tree.
@param attribute The attribute to get as boolean.
@param path The node path (child list)
@return The boolean value.
@throws LionEngineException If unable to read node.
"""
return Boolean.parseBoolean(getNodeString(attribute, path));
} | java | public final boolean getBoolean(String attribute, String... path)
{
return Boolean.parseBoolean(getNodeString(attribute, path));
} | [
"public",
"final",
"boolean",
"getBoolean",
"(",
"String",
"attribute",
",",
"String",
"...",
"path",
")",
"{",
"return",
"Boolean",
".",
"parseBoolean",
"(",
"getNodeString",
"(",
"attribute",
",",
"path",
")",
")",
";",
"}"
]
| Get a boolean in the xml tree.
@param attribute The attribute to get as boolean.
@param path The node path (child list)
@return The boolean value.
@throws LionEngineException If unable to read node. | [
"Get",
"a",
"boolean",
"in",
"the",
"xml",
"tree",
"."
]
| train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java#L185-L188 |
Fleker/ChannelSurfer | library/src/main/java/com/felkertech/channelsurfer/utils/LiveChannelsUtils.java | LiveChannelsUtils.getTvInputProvider | public static TvInputProvider getTvInputProvider(Context mContext, final TvInputProviderCallback callback) {
"""
Returns the TvInputProvider that was defined by the project's manifest
"""
ApplicationInfo app = null;
try {
Log.d(TAG, mContext.getPackageName()+" >");
app = mContext.getPackageManager().getApplicationInfo(mContext.getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = app.metaData;
final String service = bundle.getString("TvInputService");
Log.d(TAG, service);
Log.d(TAG, mContext.getString(R.string.app_name));
try {
Log.d(TAG, "Constructors: " + Class.forName(service).getConstructors().length);
// Log.d(TAG, "Constructor 1: " + Class.forName(service).getConstructors()[0].toString());
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
TvInputProvider provider = null;
try {
provider = (TvInputProvider) Class.forName(service).getConstructors()[0].newInstance();
Log.d(TAG, provider.toString());
callback.onTvInputProviderCallback(provider);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | ClassNotFoundException e) {
e.printStackTrace();
}
}
});
} catch(ClassNotFoundException e) {
Log.e(TAG, e.getMessage());
e.printStackTrace();
} catch(Exception e) {
e.printStackTrace();
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return null;
} | java | public static TvInputProvider getTvInputProvider(Context mContext, final TvInputProviderCallback callback) {
ApplicationInfo app = null;
try {
Log.d(TAG, mContext.getPackageName()+" >");
app = mContext.getPackageManager().getApplicationInfo(mContext.getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = app.metaData;
final String service = bundle.getString("TvInputService");
Log.d(TAG, service);
Log.d(TAG, mContext.getString(R.string.app_name));
try {
Log.d(TAG, "Constructors: " + Class.forName(service).getConstructors().length);
// Log.d(TAG, "Constructor 1: " + Class.forName(service).getConstructors()[0].toString());
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
TvInputProvider provider = null;
try {
provider = (TvInputProvider) Class.forName(service).getConstructors()[0].newInstance();
Log.d(TAG, provider.toString());
callback.onTvInputProviderCallback(provider);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | ClassNotFoundException e) {
e.printStackTrace();
}
}
});
} catch(ClassNotFoundException e) {
Log.e(TAG, e.getMessage());
e.printStackTrace();
} catch(Exception e) {
e.printStackTrace();
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return null;
} | [
"public",
"static",
"TvInputProvider",
"getTvInputProvider",
"(",
"Context",
"mContext",
",",
"final",
"TvInputProviderCallback",
"callback",
")",
"{",
"ApplicationInfo",
"app",
"=",
"null",
";",
"try",
"{",
"Log",
".",
"d",
"(",
"TAG",
",",
"mContext",
".",
"getPackageName",
"(",
")",
"+",
"\" >\"",
")",
";",
"app",
"=",
"mContext",
".",
"getPackageManager",
"(",
")",
".",
"getApplicationInfo",
"(",
"mContext",
".",
"getPackageName",
"(",
")",
",",
"PackageManager",
".",
"GET_META_DATA",
")",
";",
"Bundle",
"bundle",
"=",
"app",
".",
"metaData",
";",
"final",
"String",
"service",
"=",
"bundle",
".",
"getString",
"(",
"\"TvInputService\"",
")",
";",
"Log",
".",
"d",
"(",
"TAG",
",",
"service",
")",
";",
"Log",
".",
"d",
"(",
"TAG",
",",
"mContext",
".",
"getString",
"(",
"R",
".",
"string",
".",
"app_name",
")",
")",
";",
"try",
"{",
"Log",
".",
"d",
"(",
"TAG",
",",
"\"Constructors: \"",
"+",
"Class",
".",
"forName",
"(",
"service",
")",
".",
"getConstructors",
"(",
")",
".",
"length",
")",
";",
"// Log.d(TAG, \"Constructor 1: \" + Class.forName(service).getConstructors()[0].toString());",
"new",
"Handler",
"(",
"Looper",
".",
"getMainLooper",
"(",
")",
")",
".",
"post",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"TvInputProvider",
"provider",
"=",
"null",
";",
"try",
"{",
"provider",
"=",
"(",
"TvInputProvider",
")",
"Class",
".",
"forName",
"(",
"service",
")",
".",
"getConstructors",
"(",
")",
"[",
"0",
"]",
".",
"newInstance",
"(",
")",
";",
"Log",
".",
"d",
"(",
"TAG",
",",
"provider",
".",
"toString",
"(",
")",
")",
";",
"callback",
".",
"onTvInputProviderCallback",
"(",
"provider",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"|",
"IllegalAccessException",
"|",
"InvocationTargetException",
"|",
"ClassNotFoundException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"PackageManager",
".",
"NameNotFoundException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
]
| Returns the TvInputProvider that was defined by the project's manifest | [
"Returns",
"the",
"TvInputProvider",
"that",
"was",
"defined",
"by",
"the",
"project",
"s",
"manifest"
]
| train | https://github.com/Fleker/ChannelSurfer/blob/f677beae37112f463c0c4783967fdb8fa97eb633/library/src/main/java/com/felkertech/channelsurfer/utils/LiveChannelsUtils.java#L52-L87 |
sagiegurari/fax4j | src/main/java/org/fax4j/util/IOHelper.java | IOHelper.writeTextFile | public static void writeTextFile(String text,File file) throws IOException {
"""
Writes the text to the file.
@param text
The text to write to the provided file
@param file
The text file
@throws IOException
Any IO exception
"""
Writer writer=null;
try
{
//create writer to file (with default encoding)
OutputStream outputStream=new FileOutputStream(file);
writer=IOHelper.createWriter(outputStream,null);
//write to file
writer.write(text);
}
finally
{
//close writer
IOHelper.closeResource(writer);
}
} | java | public static void writeTextFile(String text,File file) throws IOException
{
Writer writer=null;
try
{
//create writer to file (with default encoding)
OutputStream outputStream=new FileOutputStream(file);
writer=IOHelper.createWriter(outputStream,null);
//write to file
writer.write(text);
}
finally
{
//close writer
IOHelper.closeResource(writer);
}
} | [
"public",
"static",
"void",
"writeTextFile",
"(",
"String",
"text",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"Writer",
"writer",
"=",
"null",
";",
"try",
"{",
"//create writer to file (with default encoding)",
"OutputStream",
"outputStream",
"=",
"new",
"FileOutputStream",
"(",
"file",
")",
";",
"writer",
"=",
"IOHelper",
".",
"createWriter",
"(",
"outputStream",
",",
"null",
")",
";",
"//write to file",
"writer",
".",
"write",
"(",
"text",
")",
";",
"}",
"finally",
"{",
"//close writer",
"IOHelper",
".",
"closeResource",
"(",
"writer",
")",
";",
"}",
"}"
]
| Writes the text to the file.
@param text
The text to write to the provided file
@param file
The text file
@throws IOException
Any IO exception | [
"Writes",
"the",
"text",
"to",
"the",
"file",
"."
]
| train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/util/IOHelper.java#L354-L371 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java | JPAIssues.sawOpcode | @Override
public void sawOpcode(int seen) {
"""
implements the visitor to look for calls to @Transactional methods that do not go through a spring proxy. These methods are easily seen as internal class
calls. There are other cases as well, from external/internal classes but these aren't reported.
@param seen
the currently parsed opcode
"""
JPAUserValue userValue = null;
try {
switch (seen) {
case Const.INVOKEVIRTUAL:
case Const.INVOKEINTERFACE: {
userValue = processInvoke();
break;
}
case Const.POP: {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
if (itm.getUserValue() == JPAUserValue.MERGE) {
bugReporter.reportBug(new BugInstance(this, BugType.JPAI_IGNORED_MERGE_RESULT.name(), LOW_PRIORITY).addClass(this).addMethod(this)
.addSourceLine(this));
}
}
break;
}
default:
break;
}
} finally {
stack.sawOpcode(this, seen);
if ((userValue != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item itm = stack.getStackItem(0);
itm.setUserValue(userValue);
}
}
} | java | @Override
public void sawOpcode(int seen) {
JPAUserValue userValue = null;
try {
switch (seen) {
case Const.INVOKEVIRTUAL:
case Const.INVOKEINTERFACE: {
userValue = processInvoke();
break;
}
case Const.POP: {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
if (itm.getUserValue() == JPAUserValue.MERGE) {
bugReporter.reportBug(new BugInstance(this, BugType.JPAI_IGNORED_MERGE_RESULT.name(), LOW_PRIORITY).addClass(this).addMethod(this)
.addSourceLine(this));
}
}
break;
}
default:
break;
}
} finally {
stack.sawOpcode(this, seen);
if ((userValue != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item itm = stack.getStackItem(0);
itm.setUserValue(userValue);
}
}
} | [
"@",
"Override",
"public",
"void",
"sawOpcode",
"(",
"int",
"seen",
")",
"{",
"JPAUserValue",
"userValue",
"=",
"null",
";",
"try",
"{",
"switch",
"(",
"seen",
")",
"{",
"case",
"Const",
".",
"INVOKEVIRTUAL",
":",
"case",
"Const",
".",
"INVOKEINTERFACE",
":",
"{",
"userValue",
"=",
"processInvoke",
"(",
")",
";",
"break",
";",
"}",
"case",
"Const",
".",
"POP",
":",
"{",
"if",
"(",
"stack",
".",
"getStackDepth",
"(",
")",
">",
"0",
")",
"{",
"OpcodeStack",
".",
"Item",
"itm",
"=",
"stack",
".",
"getStackItem",
"(",
"0",
")",
";",
"if",
"(",
"itm",
".",
"getUserValue",
"(",
")",
"==",
"JPAUserValue",
".",
"MERGE",
")",
"{",
"bugReporter",
".",
"reportBug",
"(",
"new",
"BugInstance",
"(",
"this",
",",
"BugType",
".",
"JPAI_IGNORED_MERGE_RESULT",
".",
"name",
"(",
")",
",",
"LOW_PRIORITY",
")",
".",
"addClass",
"(",
"this",
")",
".",
"addMethod",
"(",
"this",
")",
".",
"addSourceLine",
"(",
"this",
")",
")",
";",
"}",
"}",
"break",
";",
"}",
"default",
":",
"break",
";",
"}",
"}",
"finally",
"{",
"stack",
".",
"sawOpcode",
"(",
"this",
",",
"seen",
")",
";",
"if",
"(",
"(",
"userValue",
"!=",
"null",
")",
"&&",
"(",
"stack",
".",
"getStackDepth",
"(",
")",
">",
"0",
")",
")",
"{",
"OpcodeStack",
".",
"Item",
"itm",
"=",
"stack",
".",
"getStackItem",
"(",
"0",
")",
";",
"itm",
".",
"setUserValue",
"(",
"userValue",
")",
";",
"}",
"}",
"}"
]
| implements the visitor to look for calls to @Transactional methods that do not go through a spring proxy. These methods are easily seen as internal class
calls. There are other cases as well, from external/internal classes but these aren't reported.
@param seen
the currently parsed opcode | [
"implements",
"the",
"visitor",
"to",
"look",
"for",
"calls",
"to",
"@Transactional",
"methods",
"that",
"do",
"not",
"go",
"through",
"a",
"spring",
"proxy",
".",
"These",
"methods",
"are",
"easily",
"seen",
"as",
"internal",
"class",
"calls",
".",
"There",
"are",
"other",
"cases",
"as",
"well",
"from",
"external",
"/",
"internal",
"classes",
"but",
"these",
"aren",
"t",
"reported",
"."
]
| train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java#L209-L242 |
stephenc/simple-java-mail | src/main/java/org/codemonkey/simplejavamail/Email.java | Email.addEmbeddedImage | public void addEmbeddedImage(final String name, final byte[] data, final String mimetype) {
"""
Adds an embedded image (attachment type) to the email message and generates the necessary {@link DataSource} with
the given byte data. Then delegates to {@link #addEmbeddedImage(String, DataSource)}. At this point the
datasource is actually a {@link ByteArrayDataSource}.
@param name The name of the image as being referred to from the message content body (eg.
'<cid:signature>').
@param data The byte data of the image to be embedded.
@param mimetype The content type of the given data (eg. "image/gif" or "image/jpeg").
@see ByteArrayDataSource
@see #addEmbeddedImage(String, DataSource)
"""
final ByteArrayDataSource dataSource = new ByteArrayDataSource(data, mimetype);
dataSource.setName(name);
addEmbeddedImage(name, dataSource);
} | java | public void addEmbeddedImage(final String name, final byte[] data, final String mimetype) {
final ByteArrayDataSource dataSource = new ByteArrayDataSource(data, mimetype);
dataSource.setName(name);
addEmbeddedImage(name, dataSource);
} | [
"public",
"void",
"addEmbeddedImage",
"(",
"final",
"String",
"name",
",",
"final",
"byte",
"[",
"]",
"data",
",",
"final",
"String",
"mimetype",
")",
"{",
"final",
"ByteArrayDataSource",
"dataSource",
"=",
"new",
"ByteArrayDataSource",
"(",
"data",
",",
"mimetype",
")",
";",
"dataSource",
".",
"setName",
"(",
"name",
")",
";",
"addEmbeddedImage",
"(",
"name",
",",
"dataSource",
")",
";",
"}"
]
| Adds an embedded image (attachment type) to the email message and generates the necessary {@link DataSource} with
the given byte data. Then delegates to {@link #addEmbeddedImage(String, DataSource)}. At this point the
datasource is actually a {@link ByteArrayDataSource}.
@param name The name of the image as being referred to from the message content body (eg.
'<cid:signature>').
@param data The byte data of the image to be embedded.
@param mimetype The content type of the given data (eg. "image/gif" or "image/jpeg").
@see ByteArrayDataSource
@see #addEmbeddedImage(String, DataSource) | [
"Adds",
"an",
"embedded",
"image",
"(",
"attachment",
"type",
")",
"to",
"the",
"email",
"message",
"and",
"generates",
"the",
"necessary",
"{",
"@link",
"DataSource",
"}",
"with",
"the",
"given",
"byte",
"data",
".",
"Then",
"delegates",
"to",
"{",
"@link",
"#addEmbeddedImage",
"(",
"String",
"DataSource",
")",
"}",
".",
"At",
"this",
"point",
"the",
"datasource",
"is",
"actually",
"a",
"{",
"@link",
"ByteArrayDataSource",
"}",
"."
]
| train | https://github.com/stephenc/simple-java-mail/blob/8c5897e6bbc23c11e7c7eb5064f407625c653923/src/main/java/org/codemonkey/simplejavamail/Email.java#L116-L120 |
datasift/datasift-java | src/main/java/com/datasift/client/accounts/DataSiftAccount.java | DataSiftAccount.getUsage | public FutureData<UsageResult> getUsage(String period, int start, int end) {
"""
/*
Get the usage for the current account.
Period can be "hourly", "daily" or "monthly", and is optional.
If start timestamp is set to 0, start time is calculated based on a single unit of the period passed in.
i.e if the period is daily, this will be one day prior to the end timestamp.
If end timestamp is set to 0, end time is defaulted to current time.
For information on this endpoint see documentation page:
http://dev.datasift.com/pylon/docs/api/acct-api-endpoints
@param period the frequency at which to report usage data within the query period
@param start POSIX timestamp representing the time from which to report usage
@param end POSIX timestamp representing the latest time at which to report usage
@return Usage information in the form of a list of Usage objects
"""
FutureData<UsageResult> future = new FutureData<>();
if (start != 0 && end != 0 && start >= end) {
throw new IllegalArgumentException("getUsage start timestamp must be earlier than the end timestamp");
}
ParamBuilder b = newParams();
if (period != null && period.length() > 0) {
b.put("period", period);
}
if (start != 0) {
b.put("start", start);
}
if (end != 0) {
b.put("end", end);
}
URI uri = b.forURL(config.newAPIEndpointURI(USAGE));
Request request = config.http().
GET(uri, new PageReader(newRequestCallback(future, new UsageResult(), config)));
performRequest(future, request);
return future;
} | java | public FutureData<UsageResult> getUsage(String period, int start, int end) {
FutureData<UsageResult> future = new FutureData<>();
if (start != 0 && end != 0 && start >= end) {
throw new IllegalArgumentException("getUsage start timestamp must be earlier than the end timestamp");
}
ParamBuilder b = newParams();
if (period != null && period.length() > 0) {
b.put("period", period);
}
if (start != 0) {
b.put("start", start);
}
if (end != 0) {
b.put("end", end);
}
URI uri = b.forURL(config.newAPIEndpointURI(USAGE));
Request request = config.http().
GET(uri, new PageReader(newRequestCallback(future, new UsageResult(), config)));
performRequest(future, request);
return future;
} | [
"public",
"FutureData",
"<",
"UsageResult",
">",
"getUsage",
"(",
"String",
"period",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"FutureData",
"<",
"UsageResult",
">",
"future",
"=",
"new",
"FutureData",
"<>",
"(",
")",
";",
"if",
"(",
"start",
"!=",
"0",
"&&",
"end",
"!=",
"0",
"&&",
"start",
">=",
"end",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"getUsage start timestamp must be earlier than the end timestamp\"",
")",
";",
"}",
"ParamBuilder",
"b",
"=",
"newParams",
"(",
")",
";",
"if",
"(",
"period",
"!=",
"null",
"&&",
"period",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"b",
".",
"put",
"(",
"\"period\"",
",",
"period",
")",
";",
"}",
"if",
"(",
"start",
"!=",
"0",
")",
"{",
"b",
".",
"put",
"(",
"\"start\"",
",",
"start",
")",
";",
"}",
"if",
"(",
"end",
"!=",
"0",
")",
"{",
"b",
".",
"put",
"(",
"\"end\"",
",",
"end",
")",
";",
"}",
"URI",
"uri",
"=",
"b",
".",
"forURL",
"(",
"config",
".",
"newAPIEndpointURI",
"(",
"USAGE",
")",
")",
";",
"Request",
"request",
"=",
"config",
".",
"http",
"(",
")",
".",
"GET",
"(",
"uri",
",",
"new",
"PageReader",
"(",
"newRequestCallback",
"(",
"future",
",",
"new",
"UsageResult",
"(",
")",
",",
"config",
")",
")",
")",
";",
"performRequest",
"(",
"future",
",",
"request",
")",
";",
"return",
"future",
";",
"}"
]
| /*
Get the usage for the current account.
Period can be "hourly", "daily" or "monthly", and is optional.
If start timestamp is set to 0, start time is calculated based on a single unit of the period passed in.
i.e if the period is daily, this will be one day prior to the end timestamp.
If end timestamp is set to 0, end time is defaulted to current time.
For information on this endpoint see documentation page:
http://dev.datasift.com/pylon/docs/api/acct-api-endpoints
@param period the frequency at which to report usage data within the query period
@param start POSIX timestamp representing the time from which to report usage
@param end POSIX timestamp representing the latest time at which to report usage
@return Usage information in the form of a list of Usage objects | [
"/",
"*",
"Get",
"the",
"usage",
"for",
"the",
"current",
"account",
".",
"Period",
"can",
"be",
"hourly",
"daily",
"or",
"monthly",
"and",
"is",
"optional",
".",
"If",
"start",
"timestamp",
"is",
"set",
"to",
"0",
"start",
"time",
"is",
"calculated",
"based",
"on",
"a",
"single",
"unit",
"of",
"the",
"period",
"passed",
"in",
".",
"i",
".",
"e",
"if",
"the",
"period",
"is",
"daily",
"this",
"will",
"be",
"one",
"day",
"prior",
"to",
"the",
"end",
"timestamp",
".",
"If",
"end",
"timestamp",
"is",
"set",
"to",
"0",
"end",
"time",
"is",
"defaulted",
"to",
"current",
"time",
"."
]
| train | https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/accounts/DataSiftAccount.java#L450-L473 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.getRegexEntityEntityInfo | public RegexEntityExtractor getRegexEntityEntityInfo(UUID appId, String versionId, UUID regexEntityId) {
"""
Gets information of a regex entity model.
@param appId The application ID.
@param versionId The version ID.
@param regexEntityId The regex entity model ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RegexEntityExtractor object if successful.
"""
return getRegexEntityEntityInfoWithServiceResponseAsync(appId, versionId, regexEntityId).toBlocking().single().body();
} | java | public RegexEntityExtractor getRegexEntityEntityInfo(UUID appId, String versionId, UUID regexEntityId) {
return getRegexEntityEntityInfoWithServiceResponseAsync(appId, versionId, regexEntityId).toBlocking().single().body();
} | [
"public",
"RegexEntityExtractor",
"getRegexEntityEntityInfo",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"regexEntityId",
")",
"{",
"return",
"getRegexEntityEntityInfoWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"regexEntityId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
]
| Gets information of a regex entity model.
@param appId The application ID.
@param versionId The version ID.
@param regexEntityId The regex entity model ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RegexEntityExtractor object if successful. | [
"Gets",
"information",
"of",
"a",
"regex",
"entity",
"model",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L10179-L10181 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/appqoe/appqoe_stats.java | appqoe_stats.get_nitro_response | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
"""
<pre>
converts nitro response into object and returns the object array in case of get request.
</pre>
"""
appqoe_stats[] resources = new appqoe_stats[1];
appqoe_response result = (appqoe_response) service.get_payload_formatter().string_to_resource(appqoe_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
resources[0] = result.appqoe;
return resources;
} | java | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
appqoe_stats[] resources = new appqoe_stats[1];
appqoe_response result = (appqoe_response) service.get_payload_formatter().string_to_resource(appqoe_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
resources[0] = result.appqoe;
return resources;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"appqoe_stats",
"[",
"]",
"resources",
"=",
"new",
"appqoe_stats",
"[",
"1",
"]",
";",
"appqoe_response",
"result",
"=",
"(",
"appqoe_response",
")",
"service",
".",
"get_payload_formatter",
"(",
")",
".",
"string_to_resource",
"(",
"appqoe_response",
".",
"class",
",",
"response",
")",
";",
"if",
"(",
"result",
".",
"errorcode",
"!=",
"0",
")",
"{",
"if",
"(",
"result",
".",
"errorcode",
"==",
"444",
")",
"{",
"service",
".",
"clear_session",
"(",
")",
";",
"}",
"if",
"(",
"result",
".",
"severity",
"!=",
"null",
")",
"{",
"if",
"(",
"result",
".",
"severity",
".",
"equals",
"(",
"\"ERROR\"",
")",
")",
"throw",
"new",
"nitro_exception",
"(",
"result",
".",
"message",
",",
"result",
".",
"errorcode",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"nitro_exception",
"(",
"result",
".",
"message",
",",
"result",
".",
"errorcode",
")",
";",
"}",
"}",
"resources",
"[",
"0",
"]",
"=",
"result",
".",
"appqoe",
";",
"return",
"resources",
";",
"}"
]
| <pre>
converts nitro response into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"converts",
"nitro",
"response",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
]
| train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/appqoe/appqoe_stats.java#L557-L576 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/DataModelSerializer.java | DataModelSerializer.getClassForCollectionOfFieldName | private static ClassAndMethod getClassForCollectionOfFieldName(String fieldName, Class<?> classToLookForFieldIn) {
"""
Gets a class for a JSON field name, by looking in a given Class for an appropriate setter.
The setter is assumed to be a Collection.
@param fieldName the name to use to search for the getter.
@param classToLookForFieldIn the Class to search for the getter within.
@return instance of ClassAndMethod if one is found, null otherwise
"""
return internalGetClassForFieldName(fieldName, classToLookForFieldIn, true);
} | java | private static ClassAndMethod getClassForCollectionOfFieldName(String fieldName, Class<?> classToLookForFieldIn) {
return internalGetClassForFieldName(fieldName, classToLookForFieldIn, true);
} | [
"private",
"static",
"ClassAndMethod",
"getClassForCollectionOfFieldName",
"(",
"String",
"fieldName",
",",
"Class",
"<",
"?",
">",
"classToLookForFieldIn",
")",
"{",
"return",
"internalGetClassForFieldName",
"(",
"fieldName",
",",
"classToLookForFieldIn",
",",
"true",
")",
";",
"}"
]
| Gets a class for a JSON field name, by looking in a given Class for an appropriate setter.
The setter is assumed to be a Collection.
@param fieldName the name to use to search for the getter.
@param classToLookForFieldIn the Class to search for the getter within.
@return instance of ClassAndMethod if one is found, null otherwise | [
"Gets",
"a",
"class",
"for",
"a",
"JSON",
"field",
"name",
"by",
"looking",
"in",
"a",
"given",
"Class",
"for",
"an",
"appropriate",
"setter",
".",
"The",
"setter",
"is",
"assumed",
"to",
"be",
"a",
"Collection",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/DataModelSerializer.java#L407-L409 |
tempodb/tempodb-java | src/main/java/com/tempodb/Client.java | Client.getSeries | public Result<Series> getSeries(String key) {
"""
Returns a Series referenced by key.
@param key The Series key to retrieve
@return The requested Series.
@since 1.0.0
"""
checkNotNull(key);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/", API_VERSION, urlencode(key)));
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s", key);
throw new IllegalArgumentException(message, e);
}
HttpRequest request = buildRequest(uri.toString());
Result<Series> result = execute(request, Series.class);
return result;
} | java | public Result<Series> getSeries(String key) {
checkNotNull(key);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/", API_VERSION, urlencode(key)));
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s", key);
throw new IllegalArgumentException(message, e);
}
HttpRequest request = buildRequest(uri.toString());
Result<Series> result = execute(request, Series.class);
return result;
} | [
"public",
"Result",
"<",
"Series",
">",
"getSeries",
"(",
"String",
"key",
")",
"{",
"checkNotNull",
"(",
"key",
")",
";",
"URI",
"uri",
"=",
"null",
";",
"try",
"{",
"URIBuilder",
"builder",
"=",
"new",
"URIBuilder",
"(",
"String",
".",
"format",
"(",
"\"/%s/series/key/%s/\"",
",",
"API_VERSION",
",",
"urlencode",
"(",
"key",
")",
")",
")",
";",
"uri",
"=",
"builder",
".",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Could not build URI with inputs: key: %s\"",
",",
"key",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
",",
"e",
")",
";",
"}",
"HttpRequest",
"request",
"=",
"buildRequest",
"(",
"uri",
".",
"toString",
"(",
")",
")",
";",
"Result",
"<",
"Series",
">",
"result",
"=",
"execute",
"(",
"request",
",",
"Series",
".",
"class",
")",
";",
"return",
"result",
";",
"}"
]
| Returns a Series referenced by key.
@param key The Series key to retrieve
@return The requested Series.
@since 1.0.0 | [
"Returns",
"a",
"Series",
"referenced",
"by",
"key",
"."
]
| train | https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L345-L360 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java | PaymentProtocol.parsePaymentRequest | public static PaymentSession parsePaymentRequest(Protos.PaymentRequest paymentRequest)
throws PaymentProtocolException {
"""
Parse a payment request.
@param paymentRequest payment request to parse
@return instance of {@link PaymentSession}, used as a value object
@throws PaymentProtocolException
"""
return new PaymentSession(paymentRequest, false, null);
} | java | public static PaymentSession parsePaymentRequest(Protos.PaymentRequest paymentRequest)
throws PaymentProtocolException {
return new PaymentSession(paymentRequest, false, null);
} | [
"public",
"static",
"PaymentSession",
"parsePaymentRequest",
"(",
"Protos",
".",
"PaymentRequest",
"paymentRequest",
")",
"throws",
"PaymentProtocolException",
"{",
"return",
"new",
"PaymentSession",
"(",
"paymentRequest",
",",
"false",
",",
"null",
")",
";",
"}"
]
| Parse a payment request.
@param paymentRequest payment request to parse
@return instance of {@link PaymentSession}, used as a value object
@throws PaymentProtocolException | [
"Parse",
"a",
"payment",
"request",
"."
]
| train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java#L113-L116 |
jbundle/webapp | files/src/main/java/org/jbundle/util/webapp/files/DefaultServlet.java | DefaultServlet.setDocBase | @SuppressWarnings( {
"""
Set the local file path to serve files from.
@param basePath
@return
""" "rawtypes", "unchecked" })
public boolean setDocBase(String basePath)
{
proxyDirContext = null;
if (basePath == null)
return false;
Hashtable env = new Hashtable();
File file = new File(basePath);
if (!file.exists())
return false;
if (!file.isDirectory())
return false;
env.put(ProxyDirContext.CONTEXT, file.getPath());
FileDirContext fileContext = new FileDirContext(env);
fileContext.setDocBase(file.getPath());
proxyDirContext = new ProxyDirContext(env, fileContext);
/* Can't figure this one out
InitialContext cx = null;
try {
cx.rebind(RESOURCES_JNDI_NAME, obj);
} catch (NamingException e) {
e.printStackTrace();
}
*/
// Load the proxy dir context.
return true;
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
public boolean setDocBase(String basePath)
{
proxyDirContext = null;
if (basePath == null)
return false;
Hashtable env = new Hashtable();
File file = new File(basePath);
if (!file.exists())
return false;
if (!file.isDirectory())
return false;
env.put(ProxyDirContext.CONTEXT, file.getPath());
FileDirContext fileContext = new FileDirContext(env);
fileContext.setDocBase(file.getPath());
proxyDirContext = new ProxyDirContext(env, fileContext);
/* Can't figure this one out
InitialContext cx = null;
try {
cx.rebind(RESOURCES_JNDI_NAME, obj);
} catch (NamingException e) {
e.printStackTrace();
}
*/
// Load the proxy dir context.
return true;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"boolean",
"setDocBase",
"(",
"String",
"basePath",
")",
"{",
"proxyDirContext",
"=",
"null",
";",
"if",
"(",
"basePath",
"==",
"null",
")",
"return",
"false",
";",
"Hashtable",
"env",
"=",
"new",
"Hashtable",
"(",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"basePath",
")",
";",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"file",
".",
"isDirectory",
"(",
")",
")",
"return",
"false",
";",
"env",
".",
"put",
"(",
"ProxyDirContext",
".",
"CONTEXT",
",",
"file",
".",
"getPath",
"(",
")",
")",
";",
"FileDirContext",
"fileContext",
"=",
"new",
"FileDirContext",
"(",
"env",
")",
";",
"fileContext",
".",
"setDocBase",
"(",
"file",
".",
"getPath",
"(",
")",
")",
";",
"proxyDirContext",
"=",
"new",
"ProxyDirContext",
"(",
"env",
",",
"fileContext",
")",
";",
"/* Can't figure this one out\n InitialContext cx = null;\n try {\n cx.rebind(RESOURCES_JNDI_NAME, obj);\n } catch (NamingException e) {\n e.printStackTrace();\n }\n */",
"// Load the proxy dir context.",
"return",
"true",
";",
"}"
]
| Set the local file path to serve files from.
@param basePath
@return | [
"Set",
"the",
"local",
"file",
"path",
"to",
"serve",
"files",
"from",
"."
]
| train | https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/files/src/main/java/org/jbundle/util/webapp/files/DefaultServlet.java#L123-L151 |
JodaOrg/joda-time | src/main/java/org/joda/time/chrono/BasicChronology.java | BasicChronology.getYearMonthMillis | long getYearMonthMillis(int year, int month) {
"""
Get the milliseconds for the start of a month.
@param year The year to use.
@param month The month to use
@return millis from 1970-01-01T00:00:00Z
"""
long millis = getYearMillis(year);
millis += getTotalMillisByYearMonth(year, month);
return millis;
} | java | long getYearMonthMillis(int year, int month) {
long millis = getYearMillis(year);
millis += getTotalMillisByYearMonth(year, month);
return millis;
} | [
"long",
"getYearMonthMillis",
"(",
"int",
"year",
",",
"int",
"month",
")",
"{",
"long",
"millis",
"=",
"getYearMillis",
"(",
"year",
")",
";",
"millis",
"+=",
"getTotalMillisByYearMonth",
"(",
"year",
",",
"month",
")",
";",
"return",
"millis",
";",
"}"
]
| Get the milliseconds for the start of a month.
@param year The year to use.
@param month The month to use
@return millis from 1970-01-01T00:00:00Z | [
"Get",
"the",
"milliseconds",
"for",
"the",
"start",
"of",
"a",
"month",
"."
]
| train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/chrono/BasicChronology.java#L397-L401 |
ggrandes/kvstore | src/main/java/org/javastack/kvstore/structures/hash/FixedIntHashMap.java | FixedIntHashMap.put | public T put(final int key, final T value) {
"""
Maps the specified key to the specified value.
@param key the key.
@param value the value.
@return the value of any previous mapping with the specified key or {@code -1} if there was no such
mapping.
"""
int index = ((key & 0x7FFFFFFF) % elementKeys.length);
T oldvalue = null;
long entry = elementKeys[index];
if (entry == Integer.MIN_VALUE) {
++elementCount;
} else {
oldvalue = elementValues[index];
collisions++;
}
elementKeys[index] = key;
elementValues[index] = value;
return oldvalue;
} | java | public T put(final int key, final T value) {
int index = ((key & 0x7FFFFFFF) % elementKeys.length);
T oldvalue = null;
long entry = elementKeys[index];
if (entry == Integer.MIN_VALUE) {
++elementCount;
} else {
oldvalue = elementValues[index];
collisions++;
}
elementKeys[index] = key;
elementValues[index] = value;
return oldvalue;
} | [
"public",
"T",
"put",
"(",
"final",
"int",
"key",
",",
"final",
"T",
"value",
")",
"{",
"int",
"index",
"=",
"(",
"(",
"key",
"&",
"0x7FFFFFFF",
")",
"%",
"elementKeys",
".",
"length",
")",
";",
"T",
"oldvalue",
"=",
"null",
";",
"long",
"entry",
"=",
"elementKeys",
"[",
"index",
"]",
";",
"if",
"(",
"entry",
"==",
"Integer",
".",
"MIN_VALUE",
")",
"{",
"++",
"elementCount",
";",
"}",
"else",
"{",
"oldvalue",
"=",
"elementValues",
"[",
"index",
"]",
";",
"collisions",
"++",
";",
"}",
"elementKeys",
"[",
"index",
"]",
"=",
"key",
";",
"elementValues",
"[",
"index",
"]",
"=",
"value",
";",
"return",
"oldvalue",
";",
"}"
]
| Maps the specified key to the specified value.
@param key the key.
@param value the value.
@return the value of any previous mapping with the specified key or {@code -1} if there was no such
mapping. | [
"Maps",
"the",
"specified",
"key",
"to",
"the",
"specified",
"value",
"."
]
| train | https://github.com/ggrandes/kvstore/blob/c79277f79f4604e0fec8349a98519838e3de38f0/src/main/java/org/javastack/kvstore/structures/hash/FixedIntHashMap.java#L169-L183 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java | CPDefinitionPersistenceImpl.findByC_ERC | @Override
public CPDefinition findByC_ERC(long companyId, String externalReferenceCode)
throws NoSuchCPDefinitionException {
"""
Returns the cp definition where companyId = ? and externalReferenceCode = ? or throws a {@link NoSuchCPDefinitionException} if it could not be found.
@param companyId the company ID
@param externalReferenceCode the external reference code
@return the matching cp definition
@throws NoSuchCPDefinitionException if a matching cp definition could not be found
"""
CPDefinition cpDefinition = fetchByC_ERC(companyId,
externalReferenceCode);
if (cpDefinition == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("companyId=");
msg.append(companyId);
msg.append(", externalReferenceCode=");
msg.append(externalReferenceCode);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPDefinitionException(msg.toString());
}
return cpDefinition;
} | java | @Override
public CPDefinition findByC_ERC(long companyId, String externalReferenceCode)
throws NoSuchCPDefinitionException {
CPDefinition cpDefinition = fetchByC_ERC(companyId,
externalReferenceCode);
if (cpDefinition == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("companyId=");
msg.append(companyId);
msg.append(", externalReferenceCode=");
msg.append(externalReferenceCode);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPDefinitionException(msg.toString());
}
return cpDefinition;
} | [
"@",
"Override",
"public",
"CPDefinition",
"findByC_ERC",
"(",
"long",
"companyId",
",",
"String",
"externalReferenceCode",
")",
"throws",
"NoSuchCPDefinitionException",
"{",
"CPDefinition",
"cpDefinition",
"=",
"fetchByC_ERC",
"(",
"companyId",
",",
"externalReferenceCode",
")",
";",
"if",
"(",
"cpDefinition",
"==",
"null",
")",
"{",
"StringBundler",
"msg",
"=",
"new",
"StringBundler",
"(",
"6",
")",
";",
"msg",
".",
"append",
"(",
"_NO_SUCH_ENTITY_WITH_KEY",
")",
";",
"msg",
".",
"append",
"(",
"\"companyId=\"",
")",
";",
"msg",
".",
"append",
"(",
"companyId",
")",
";",
"msg",
".",
"append",
"(",
"\", externalReferenceCode=\"",
")",
";",
"msg",
".",
"append",
"(",
"externalReferenceCode",
")",
";",
"msg",
".",
"append",
"(",
"\"}\"",
")",
";",
"if",
"(",
"_log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"_log",
".",
"debug",
"(",
"msg",
".",
"toString",
"(",
")",
")",
";",
"}",
"throw",
"new",
"NoSuchCPDefinitionException",
"(",
"msg",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"cpDefinition",
";",
"}"
]
| Returns the cp definition where companyId = ? and externalReferenceCode = ? or throws a {@link NoSuchCPDefinitionException} if it could not be found.
@param companyId the company ID
@param externalReferenceCode the external reference code
@return the matching cp definition
@throws NoSuchCPDefinitionException if a matching cp definition could not be found | [
"Returns",
"the",
"cp",
"definition",
"where",
"companyId",
"=",
"?",
";",
"and",
"externalReferenceCode",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchCPDefinitionException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
]
| train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L5196-L5223 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java | ThreadLocalRandom.ints | public IntStream ints(long streamSize) {
"""
Returns a stream producing the given {@code streamSize} number of
pseudorandom {@code int} values.
@param streamSize the number of values to generate
@return a stream of pseudorandom {@code int} values
@throws IllegalArgumentException if {@code streamSize} is
less than zero
@since 1.8
"""
if (streamSize < 0L)
throw new IllegalArgumentException(BAD_SIZE);
return StreamSupport.intStream
(new RandomIntsSpliterator
(0L, streamSize, Integer.MAX_VALUE, 0),
false);
} | java | public IntStream ints(long streamSize) {
if (streamSize < 0L)
throw new IllegalArgumentException(BAD_SIZE);
return StreamSupport.intStream
(new RandomIntsSpliterator
(0L, streamSize, Integer.MAX_VALUE, 0),
false);
} | [
"public",
"IntStream",
"ints",
"(",
"long",
"streamSize",
")",
"{",
"if",
"(",
"streamSize",
"<",
"0L",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"BAD_SIZE",
")",
";",
"return",
"StreamSupport",
".",
"intStream",
"(",
"new",
"RandomIntsSpliterator",
"(",
"0L",
",",
"streamSize",
",",
"Integer",
".",
"MAX_VALUE",
",",
"0",
")",
",",
"false",
")",
";",
"}"
]
| Returns a stream producing the given {@code streamSize} number of
pseudorandom {@code int} values.
@param streamSize the number of values to generate
@return a stream of pseudorandom {@code int} values
@throws IllegalArgumentException if {@code streamSize} is
less than zero
@since 1.8 | [
"Returns",
"a",
"stream",
"producing",
"the",
"given",
"{",
"@code",
"streamSize",
"}",
"number",
"of",
"pseudorandom",
"{",
"@code",
"int",
"}",
"values",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java#L474-L481 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/common/impl/URLFileUpdater.java | URLFileUpdater.applyCacheHeaders | private void applyCacheHeaders(final Properties cacheProperties, final httpClientInteraction method) {
"""
Add appropriate cache headers to the request method, but only if there is valid data in the cache (content type
as well as file content)
"""
if (isCachedContentPresent() && null != contentType) {
if (cacheProperties.containsKey(E_TAG)) {
method.setRequestHeader(IF_NONE_MATCH, cacheProperties.getProperty(E_TAG));
}
if (cacheProperties.containsKey(LAST_MODIFIED)) {
method.setRequestHeader(IF_MODIFIED_SINCE, cacheProperties.getProperty(LAST_MODIFIED));
}
}
} | java | private void applyCacheHeaders(final Properties cacheProperties, final httpClientInteraction method) {
if (isCachedContentPresent() && null != contentType) {
if (cacheProperties.containsKey(E_TAG)) {
method.setRequestHeader(IF_NONE_MATCH, cacheProperties.getProperty(E_TAG));
}
if (cacheProperties.containsKey(LAST_MODIFIED)) {
method.setRequestHeader(IF_MODIFIED_SINCE, cacheProperties.getProperty(LAST_MODIFIED));
}
}
} | [
"private",
"void",
"applyCacheHeaders",
"(",
"final",
"Properties",
"cacheProperties",
",",
"final",
"httpClientInteraction",
"method",
")",
"{",
"if",
"(",
"isCachedContentPresent",
"(",
")",
"&&",
"null",
"!=",
"contentType",
")",
"{",
"if",
"(",
"cacheProperties",
".",
"containsKey",
"(",
"E_TAG",
")",
")",
"{",
"method",
".",
"setRequestHeader",
"(",
"IF_NONE_MATCH",
",",
"cacheProperties",
".",
"getProperty",
"(",
"E_TAG",
")",
")",
";",
"}",
"if",
"(",
"cacheProperties",
".",
"containsKey",
"(",
"LAST_MODIFIED",
")",
")",
"{",
"method",
".",
"setRequestHeader",
"(",
"IF_MODIFIED_SINCE",
",",
"cacheProperties",
".",
"getProperty",
"(",
"LAST_MODIFIED",
")",
")",
";",
"}",
"}",
"}"
]
| Add appropriate cache headers to the request method, but only if there is valid data in the cache (content type
as well as file content) | [
"Add",
"appropriate",
"cache",
"headers",
"to",
"the",
"request",
"method",
"but",
"only",
"if",
"there",
"is",
"valid",
"data",
"in",
"the",
"cache",
"(",
"content",
"type",
"as",
"well",
"as",
"file",
"content",
")"
]
| train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/impl/URLFileUpdater.java#L316-L325 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncLookupInBuilder.java | AsyncLookupInBuilder.getCount | public AsyncLookupInBuilder getCount(String... paths) {
"""
Get the count of values inside the JSON document.
This method is only available with Couchbase Server 5.0 and later.
@param paths the path inside the document where to get the count from.
@return this builder for chaining.
"""
if (paths == null || paths.length == 0) {
throw new IllegalArgumentException("Path is mandatory for subdoc get count");
}
for (String path : paths) {
if (StringUtil.isNullOrEmpty(path)) {
throw new IllegalArgumentException("Path is mandatory for subdoc get count");
}
this.specs.add(new LookupSpec(Lookup.GET_COUNT, path));
}
return this;
} | java | public AsyncLookupInBuilder getCount(String... paths) {
if (paths == null || paths.length == 0) {
throw new IllegalArgumentException("Path is mandatory for subdoc get count");
}
for (String path : paths) {
if (StringUtil.isNullOrEmpty(path)) {
throw new IllegalArgumentException("Path is mandatory for subdoc get count");
}
this.specs.add(new LookupSpec(Lookup.GET_COUNT, path));
}
return this;
} | [
"public",
"AsyncLookupInBuilder",
"getCount",
"(",
"String",
"...",
"paths",
")",
"{",
"if",
"(",
"paths",
"==",
"null",
"||",
"paths",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Path is mandatory for subdoc get count\"",
")",
";",
"}",
"for",
"(",
"String",
"path",
":",
"paths",
")",
"{",
"if",
"(",
"StringUtil",
".",
"isNullOrEmpty",
"(",
"path",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Path is mandatory for subdoc get count\"",
")",
";",
"}",
"this",
".",
"specs",
".",
"add",
"(",
"new",
"LookupSpec",
"(",
"Lookup",
".",
"GET_COUNT",
",",
"path",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
]
| Get the count of values inside the JSON document.
This method is only available with Couchbase Server 5.0 and later.
@param paths the path inside the document where to get the count from.
@return this builder for chaining. | [
"Get",
"the",
"count",
"of",
"values",
"inside",
"the",
"JSON",
"document",
"."
]
| train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncLookupInBuilder.java#L384-L395 |
michel-kraemer/citeproc-java | citeproc-java/src/main/java/de/undercouch/citeproc/zotero/ZoteroItemDataProvider.java | ZoteroItemDataProvider.getYear | private static int getYear(CSLDate date, CSLDateParser dateParser) {
"""
Retrieves the year from a {@link CSLDate} object. Parses the raw
string if necessary.
@param date the date object
@param dateParser a date parser
@return the year or -1 if the year could not be retrieved
"""
if (date == null) {
return -1;
}
if (date.getDateParts() == null ||
date.getDateParts().length == 0 ||
date.getDateParts()[0] == null ||
date.getDateParts()[0].length == 0) {
if (date.getRaw() != null && !date.getRaw().isEmpty()) {
CSLDate d = dateParser.parse(date.getRaw());
return getYear(d, dateParser);
}
return -1;
}
return date.getDateParts()[0][0];
} | java | private static int getYear(CSLDate date, CSLDateParser dateParser) {
if (date == null) {
return -1;
}
if (date.getDateParts() == null ||
date.getDateParts().length == 0 ||
date.getDateParts()[0] == null ||
date.getDateParts()[0].length == 0) {
if (date.getRaw() != null && !date.getRaw().isEmpty()) {
CSLDate d = dateParser.parse(date.getRaw());
return getYear(d, dateParser);
}
return -1;
}
return date.getDateParts()[0][0];
} | [
"private",
"static",
"int",
"getYear",
"(",
"CSLDate",
"date",
",",
"CSLDateParser",
"dateParser",
")",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"if",
"(",
"date",
".",
"getDateParts",
"(",
")",
"==",
"null",
"||",
"date",
".",
"getDateParts",
"(",
")",
".",
"length",
"==",
"0",
"||",
"date",
".",
"getDateParts",
"(",
")",
"[",
"0",
"]",
"==",
"null",
"||",
"date",
".",
"getDateParts",
"(",
")",
"[",
"0",
"]",
".",
"length",
"==",
"0",
")",
"{",
"if",
"(",
"date",
".",
"getRaw",
"(",
")",
"!=",
"null",
"&&",
"!",
"date",
".",
"getRaw",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"CSLDate",
"d",
"=",
"dateParser",
".",
"parse",
"(",
"date",
".",
"getRaw",
"(",
")",
")",
";",
"return",
"getYear",
"(",
"d",
",",
"dateParser",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"return",
"date",
".",
"getDateParts",
"(",
")",
"[",
"0",
"]",
"[",
"0",
"]",
";",
"}"
]
| Retrieves the year from a {@link CSLDate} object. Parses the raw
string if necessary.
@param date the date object
@param dateParser a date parser
@return the year or -1 if the year could not be retrieved | [
"Retrieves",
"the",
"year",
"from",
"a",
"{"
]
| train | https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java/src/main/java/de/undercouch/citeproc/zotero/ZoteroItemDataProvider.java#L150-L165 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java | ApplicationGatewaysInner.updateTagsAsync | public Observable<ApplicationGatewayInner> updateTagsAsync(String resourceGroupName, String applicationGatewayName, Map<String, String> tags) {
"""
Updates the specified application gateway tags.
@param resourceGroupName The name of the resource group.
@param applicationGatewayName The name of the application gateway.
@param tags Resource tags.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return updateTagsWithServiceResponseAsync(resourceGroupName, applicationGatewayName, tags).map(new Func1<ServiceResponse<ApplicationGatewayInner>, ApplicationGatewayInner>() {
@Override
public ApplicationGatewayInner call(ServiceResponse<ApplicationGatewayInner> response) {
return response.body();
}
});
} | java | public Observable<ApplicationGatewayInner> updateTagsAsync(String resourceGroupName, String applicationGatewayName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, applicationGatewayName, tags).map(new Func1<ServiceResponse<ApplicationGatewayInner>, ApplicationGatewayInner>() {
@Override
public ApplicationGatewayInner call(ServiceResponse<ApplicationGatewayInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationGatewayInner",
">",
"updateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"applicationGatewayName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"applicationGatewayName",
",",
"tags",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ApplicationGatewayInner",
">",
",",
"ApplicationGatewayInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ApplicationGatewayInner",
"call",
"(",
"ServiceResponse",
"<",
"ApplicationGatewayInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Updates the specified application gateway tags.
@param resourceGroupName The name of the resource group.
@param applicationGatewayName The name of the application gateway.
@param tags Resource tags.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"the",
"specified",
"application",
"gateway",
"tags",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L670-L677 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsAreaSelectPanel.java | CmsAreaSelectPanel.setSelectPositionY | private void setSelectPositionY(int posY, int height) {
"""
Sets Y position and height of the select area.<p>
@param posY the new Y position
@param height the new height
"""
m_markerStyle.setTop(posY, Unit.PX);
m_markerStyle.setHeight(height, Unit.PX);
m_overlayTopStyle.setHeight(posY, Unit.PX);
m_overlayBottomStyle.setHeight(m_elementHeight - posY - height, Unit.PX);
m_currentSelection.setTop(posY);
m_currentSelection.setHeight(height);
} | java | private void setSelectPositionY(int posY, int height) {
m_markerStyle.setTop(posY, Unit.PX);
m_markerStyle.setHeight(height, Unit.PX);
m_overlayTopStyle.setHeight(posY, Unit.PX);
m_overlayBottomStyle.setHeight(m_elementHeight - posY - height, Unit.PX);
m_currentSelection.setTop(posY);
m_currentSelection.setHeight(height);
} | [
"private",
"void",
"setSelectPositionY",
"(",
"int",
"posY",
",",
"int",
"height",
")",
"{",
"m_markerStyle",
".",
"setTop",
"(",
"posY",
",",
"Unit",
".",
"PX",
")",
";",
"m_markerStyle",
".",
"setHeight",
"(",
"height",
",",
"Unit",
".",
"PX",
")",
";",
"m_overlayTopStyle",
".",
"setHeight",
"(",
"posY",
",",
"Unit",
".",
"PX",
")",
";",
"m_overlayBottomStyle",
".",
"setHeight",
"(",
"m_elementHeight",
"-",
"posY",
"-",
"height",
",",
"Unit",
".",
"PX",
")",
";",
"m_currentSelection",
".",
"setTop",
"(",
"posY",
")",
";",
"m_currentSelection",
".",
"setHeight",
"(",
"height",
")",
";",
"}"
]
| Sets Y position and height of the select area.<p>
@param posY the new Y position
@param height the new height | [
"Sets",
"Y",
"position",
"and",
"height",
"of",
"the",
"select",
"area",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsAreaSelectPanel.java#L813-L823 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java | ExpressRouteConnectionsInner.getAsync | public Observable<ExpressRouteConnectionInner> getAsync(String resourceGroupName, String expressRouteGatewayName, String connectionName) {
"""
Gets the specified ExpressRouteConnection.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param connectionName The name of the ExpressRoute connection.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteConnectionInner object
"""
return getWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName).map(new Func1<ServiceResponse<ExpressRouteConnectionInner>, ExpressRouteConnectionInner>() {
@Override
public ExpressRouteConnectionInner call(ServiceResponse<ExpressRouteConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteConnectionInner> getAsync(String resourceGroupName, String expressRouteGatewayName, String connectionName) {
return getWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName).map(new Func1<ServiceResponse<ExpressRouteConnectionInner>, ExpressRouteConnectionInner>() {
@Override
public ExpressRouteConnectionInner call(ServiceResponse<ExpressRouteConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteConnectionInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRouteGatewayName",
",",
"String",
"connectionName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"expressRouteGatewayName",
",",
"connectionName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ExpressRouteConnectionInner",
">",
",",
"ExpressRouteConnectionInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ExpressRouteConnectionInner",
"call",
"(",
"ServiceResponse",
"<",
"ExpressRouteConnectionInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Gets the specified ExpressRouteConnection.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param connectionName The name of the ExpressRoute connection.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteConnectionInner object | [
"Gets",
"the",
"specified",
"ExpressRouteConnection",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java#L304-L311 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/utils/ThreadLocalProxyCopyOnWriteArrayList.java | ThreadLocalProxyCopyOnWriteArrayList.lastIndexOf | public int lastIndexOf(E e, int index) {
"""
Returns the index of the last occurrence of the specified element in
this list, searching backwards from <tt>index</tt>, or returns -1 if
the element is not found.
More formally, returns the highest index <tt>i</tt> such that
<tt>(i <= index && (e==null ? get(i)==null : e.equals(get(i))))</tt>,
or -1 if there is no such index.
@param e element to search for
@param index index to start searching backwards from
@return the index of the last occurrence of the element at position
less than or equal to <tt>index</tt> in this list;
-1 if the element is not found.
@throws IndexOutOfBoundsException if the specified index is greater
than or equal to the current size of this list
"""
Object[] elements = getArray();
return lastIndexOf(e, elements, index);
} | java | public int lastIndexOf(E e, int index) {
Object[] elements = getArray();
return lastIndexOf(e, elements, index);
} | [
"public",
"int",
"lastIndexOf",
"(",
"E",
"e",
",",
"int",
"index",
")",
"{",
"Object",
"[",
"]",
"elements",
"=",
"getArray",
"(",
")",
";",
"return",
"lastIndexOf",
"(",
"e",
",",
"elements",
",",
"index",
")",
";",
"}"
]
| Returns the index of the last occurrence of the specified element in
this list, searching backwards from <tt>index</tt>, or returns -1 if
the element is not found.
More formally, returns the highest index <tt>i</tt> such that
<tt>(i <= index && (e==null ? get(i)==null : e.equals(get(i))))</tt>,
or -1 if there is no such index.
@param e element to search for
@param index index to start searching backwards from
@return the index of the last occurrence of the element at position
less than or equal to <tt>index</tt> in this list;
-1 if the element is not found.
@throws IndexOutOfBoundsException if the specified index is greater
than or equal to the current size of this list | [
"Returns",
"the",
"index",
"of",
"the",
"last",
"occurrence",
"of",
"the",
"specified",
"element",
"in",
"this",
"list",
"searching",
"backwards",
"from",
"<tt",
">",
"index<",
"/",
"tt",
">",
"or",
"returns",
"-",
"1",
"if",
"the",
"element",
"is",
"not",
"found",
".",
"More",
"formally",
"returns",
"the",
"highest",
"index",
"<tt",
">",
"i<",
"/",
"tt",
">",
"such",
"that",
"<tt",
">",
"(",
"i ",
";",
"<",
";",
"=",
" ",
";",
"index ",
";",
"&",
";",
"&",
";",
" ",
";",
"(",
"e",
"==",
"null ",
";",
"? ",
";",
"get",
"(",
"i",
")",
"==",
"null ",
";",
":",
" ",
";",
"e",
".",
"equals",
"(",
"get",
"(",
"i",
"))))",
"<",
"/",
"tt",
">",
"or",
"-",
"1",
"if",
"there",
"is",
"no",
"such",
"index",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/utils/ThreadLocalProxyCopyOnWriteArrayList.java#L224-L227 |
banq/jdonframework | JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/handler/HandlerMethodMetaArgsFactory.java | HandlerMethodMetaArgsFactory.createDeleteMethod | public MethodMetaArgs createDeleteMethod(HandlerMetaDef handlerMetaDef, EventModel em) {
"""
create update method the service/s method parameter type must be
EventModel type;
@param handlerMetaDef
@param em
EventModel
@return MethodMetaArgs instance
"""
String p_methodName = handlerMetaDef.getDeleteMethod();
if (p_methodName == null) {
Debug.logError("[JdonFramework] not configure the deleteMethod parameter: <deleteMethod name=XXXXX /> ", module);
}
return createCRUDMethodMetaArgs(p_methodName, em);
} | java | public MethodMetaArgs createDeleteMethod(HandlerMetaDef handlerMetaDef, EventModel em) {
String p_methodName = handlerMetaDef.getDeleteMethod();
if (p_methodName == null) {
Debug.logError("[JdonFramework] not configure the deleteMethod parameter: <deleteMethod name=XXXXX /> ", module);
}
return createCRUDMethodMetaArgs(p_methodName, em);
} | [
"public",
"MethodMetaArgs",
"createDeleteMethod",
"(",
"HandlerMetaDef",
"handlerMetaDef",
",",
"EventModel",
"em",
")",
"{",
"String",
"p_methodName",
"=",
"handlerMetaDef",
".",
"getDeleteMethod",
"(",
")",
";",
"if",
"(",
"p_methodName",
"==",
"null",
")",
"{",
"Debug",
".",
"logError",
"(",
"\"[JdonFramework] not configure the deleteMethod parameter: <deleteMethod name=XXXXX /> \"",
",",
"module",
")",
";",
"}",
"return",
"createCRUDMethodMetaArgs",
"(",
"p_methodName",
",",
"em",
")",
";",
"}"
]
| create update method the service/s method parameter type must be
EventModel type;
@param handlerMetaDef
@param em
EventModel
@return MethodMetaArgs instance | [
"create",
"update",
"method",
"the",
"service",
"/",
"s",
"method",
"parameter",
"type",
"must",
"be",
"EventModel",
"type",
";"
]
| train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/handler/HandlerMethodMetaArgsFactory.java#L118-L126 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.getSummaryTableHeader | public Content getSummaryTableHeader(String[] header, String scope) {
"""
Get summary table header.
@param header the header for the table
@param scope the scope of the headers
@return a content tree for the header
"""
Content tr = new HtmlTree(HtmlTag.TR);
int size = header.length;
Content tableHeader;
if (size == 1) {
tableHeader = new StringContent(header[0]);
tr.addContent(HtmlTree.TH(HtmlStyle.colOne, scope, tableHeader));
return tr;
}
for (int i = 0; i < size; i++) {
tableHeader = new StringContent(header[i]);
if(i == 0)
tr.addContent(HtmlTree.TH(HtmlStyle.colFirst, scope, tableHeader));
else if(i == (size - 1))
tr.addContent(HtmlTree.TH(HtmlStyle.colLast, scope, tableHeader));
else
tr.addContent(HtmlTree.TH(scope, tableHeader));
}
return tr;
} | java | public Content getSummaryTableHeader(String[] header, String scope) {
Content tr = new HtmlTree(HtmlTag.TR);
int size = header.length;
Content tableHeader;
if (size == 1) {
tableHeader = new StringContent(header[0]);
tr.addContent(HtmlTree.TH(HtmlStyle.colOne, scope, tableHeader));
return tr;
}
for (int i = 0; i < size; i++) {
tableHeader = new StringContent(header[i]);
if(i == 0)
tr.addContent(HtmlTree.TH(HtmlStyle.colFirst, scope, tableHeader));
else if(i == (size - 1))
tr.addContent(HtmlTree.TH(HtmlStyle.colLast, scope, tableHeader));
else
tr.addContent(HtmlTree.TH(scope, tableHeader));
}
return tr;
} | [
"public",
"Content",
"getSummaryTableHeader",
"(",
"String",
"[",
"]",
"header",
",",
"String",
"scope",
")",
"{",
"Content",
"tr",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"TR",
")",
";",
"int",
"size",
"=",
"header",
".",
"length",
";",
"Content",
"tableHeader",
";",
"if",
"(",
"size",
"==",
"1",
")",
"{",
"tableHeader",
"=",
"new",
"StringContent",
"(",
"header",
"[",
"0",
"]",
")",
";",
"tr",
".",
"addContent",
"(",
"HtmlTree",
".",
"TH",
"(",
"HtmlStyle",
".",
"colOne",
",",
"scope",
",",
"tableHeader",
")",
")",
";",
"return",
"tr",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"tableHeader",
"=",
"new",
"StringContent",
"(",
"header",
"[",
"i",
"]",
")",
";",
"if",
"(",
"i",
"==",
"0",
")",
"tr",
".",
"addContent",
"(",
"HtmlTree",
".",
"TH",
"(",
"HtmlStyle",
".",
"colFirst",
",",
"scope",
",",
"tableHeader",
")",
")",
";",
"else",
"if",
"(",
"i",
"==",
"(",
"size",
"-",
"1",
")",
")",
"tr",
".",
"addContent",
"(",
"HtmlTree",
".",
"TH",
"(",
"HtmlStyle",
".",
"colLast",
",",
"scope",
",",
"tableHeader",
")",
")",
";",
"else",
"tr",
".",
"addContent",
"(",
"HtmlTree",
".",
"TH",
"(",
"scope",
",",
"tableHeader",
")",
")",
";",
"}",
"return",
"tr",
";",
"}"
]
| Get summary table header.
@param header the header for the table
@param scope the scope of the headers
@return a content tree for the header | [
"Get",
"summary",
"table",
"header",
"."
]
| train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L765-L784 |
Harium/keel | src/main/java/com/harium/keel/catalano/core/IntPoint.java | IntPoint.Multiply | public static IntPoint Multiply(IntPoint point1, IntPoint point2) {
"""
Multiply values of two points.
@param point1 IntPoint.
@param point2 IntPoint.
@return IntPoint that contains X and Y axis coordinate.
"""
IntPoint result = new IntPoint(point1);
result.Multiply(point2);
return result;
} | java | public static IntPoint Multiply(IntPoint point1, IntPoint point2) {
IntPoint result = new IntPoint(point1);
result.Multiply(point2);
return result;
} | [
"public",
"static",
"IntPoint",
"Multiply",
"(",
"IntPoint",
"point1",
",",
"IntPoint",
"point2",
")",
"{",
"IntPoint",
"result",
"=",
"new",
"IntPoint",
"(",
"point1",
")",
";",
"result",
".",
"Multiply",
"(",
"point2",
")",
";",
"return",
"result",
";",
"}"
]
| Multiply values of two points.
@param point1 IntPoint.
@param point2 IntPoint.
@return IntPoint that contains X and Y axis coordinate. | [
"Multiply",
"values",
"of",
"two",
"points",
"."
]
| train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/IntPoint.java#L205-L209 |
voldemort/voldemort | src/java/voldemort/utils/UpdateClusterUtils.java | UpdateClusterUtils.updateNode | public static Node updateNode(Node node, List<Integer> partitionsList) {
"""
Creates a replica of the node with the new partitions list
@param node The node whose replica we are creating
@param partitionsList The new partitions list
@return Replica of node with new partitions list
"""
return new Node(node.getId(),
node.getHost(),
node.getHttpPort(),
node.getSocketPort(),
node.getAdminPort(),
node.getZoneId(),
partitionsList);
} | java | public static Node updateNode(Node node, List<Integer> partitionsList) {
return new Node(node.getId(),
node.getHost(),
node.getHttpPort(),
node.getSocketPort(),
node.getAdminPort(),
node.getZoneId(),
partitionsList);
} | [
"public",
"static",
"Node",
"updateNode",
"(",
"Node",
"node",
",",
"List",
"<",
"Integer",
">",
"partitionsList",
")",
"{",
"return",
"new",
"Node",
"(",
"node",
".",
"getId",
"(",
")",
",",
"node",
".",
"getHost",
"(",
")",
",",
"node",
".",
"getHttpPort",
"(",
")",
",",
"node",
".",
"getSocketPort",
"(",
")",
",",
"node",
".",
"getAdminPort",
"(",
")",
",",
"node",
".",
"getZoneId",
"(",
")",
",",
"partitionsList",
")",
";",
"}"
]
| Creates a replica of the node with the new partitions list
@param node The node whose replica we are creating
@param partitionsList The new partitions list
@return Replica of node with new partitions list | [
"Creates",
"a",
"replica",
"of",
"the",
"node",
"with",
"the",
"new",
"partitions",
"list"
]
| train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/UpdateClusterUtils.java#L50-L58 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java | ServerParams.setLegacy | private static void setLegacy(String moduleName, String legacyParamName) {
"""
Register the given legacy parameter name as owned by the given module name.
"""
String oldValue = g_legacyToModuleMap.put(legacyParamName, moduleName);
if (oldValue != null) {
logger.warn("Legacy parameter name used twice: {}", legacyParamName);
}
} | java | private static void setLegacy(String moduleName, String legacyParamName) {
String oldValue = g_legacyToModuleMap.put(legacyParamName, moduleName);
if (oldValue != null) {
logger.warn("Legacy parameter name used twice: {}", legacyParamName);
}
} | [
"private",
"static",
"void",
"setLegacy",
"(",
"String",
"moduleName",
",",
"String",
"legacyParamName",
")",
"{",
"String",
"oldValue",
"=",
"g_legacyToModuleMap",
".",
"put",
"(",
"legacyParamName",
",",
"moduleName",
")",
";",
"if",
"(",
"oldValue",
"!=",
"null",
")",
"{",
"logger",
".",
"warn",
"(",
"\"Legacy parameter name used twice: {}\"",
",",
"legacyParamName",
")",
";",
"}",
"}"
]
| Register the given legacy parameter name as owned by the given module name. | [
"Register",
"the",
"given",
"legacy",
"parameter",
"name",
"as",
"owned",
"by",
"the",
"given",
"module",
"name",
"."
]
| train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java#L63-L68 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java | Character.codePointAt | public static int codePointAt(char[] a, int index, int limit) {
"""
Returns the code point at the given index of the
{@code char} array, where only array elements with
{@code index} less than {@code limit} can be used. If
the {@code char} value at the given index in the
{@code char} array is in the high-surrogate range, the
following index is less than the {@code limit}, and the
{@code char} value at the following index is in the
low-surrogate range, then the supplementary code point
corresponding to this surrogate pair is returned. Otherwise,
the {@code char} value at the given index is returned.
@param a the {@code char} array
@param index the index to the {@code char} values (Unicode
code units) in the {@code char} array to be converted
@param limit the index after the last array element that
can be used in the {@code char} array
@return the Unicode code point at the given index
@exception NullPointerException if {@code a} is null.
@exception IndexOutOfBoundsException if the {@code index}
argument is negative or not less than the {@code limit}
argument, or if the {@code limit} argument is negative or
greater than the length of the {@code char} array.
@since 1.5
"""
if (index >= limit || limit < 0 || limit > a.length) {
throw new IndexOutOfBoundsException();
}
return codePointAtImpl(a, index, limit);
} | java | public static int codePointAt(char[] a, int index, int limit) {
if (index >= limit || limit < 0 || limit > a.length) {
throw new IndexOutOfBoundsException();
}
return codePointAtImpl(a, index, limit);
} | [
"public",
"static",
"int",
"codePointAt",
"(",
"char",
"[",
"]",
"a",
",",
"int",
"index",
",",
"int",
"limit",
")",
"{",
"if",
"(",
"index",
">=",
"limit",
"||",
"limit",
"<",
"0",
"||",
"limit",
">",
"a",
".",
"length",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"}",
"return",
"codePointAtImpl",
"(",
"a",
",",
"index",
",",
"limit",
")",
";",
"}"
]
| Returns the code point at the given index of the
{@code char} array, where only array elements with
{@code index} less than {@code limit} can be used. If
the {@code char} value at the given index in the
{@code char} array is in the high-surrogate range, the
following index is less than the {@code limit}, and the
{@code char} value at the following index is in the
low-surrogate range, then the supplementary code point
corresponding to this surrogate pair is returned. Otherwise,
the {@code char} value at the given index is returned.
@param a the {@code char} array
@param index the index to the {@code char} values (Unicode
code units) in the {@code char} array to be converted
@param limit the index after the last array element that
can be used in the {@code char} array
@return the Unicode code point at the given index
@exception NullPointerException if {@code a} is null.
@exception IndexOutOfBoundsException if the {@code index}
argument is negative or not less than the {@code limit}
argument, or if the {@code limit} argument is negative or
greater than the length of the {@code char} array.
@since 1.5 | [
"Returns",
"the",
"code",
"point",
"at",
"the",
"given",
"index",
"of",
"the",
"{",
"@code",
"char",
"}",
"array",
"where",
"only",
"array",
"elements",
"with",
"{",
"@code",
"index",
"}",
"less",
"than",
"{",
"@code",
"limit",
"}",
"can",
"be",
"used",
".",
"If",
"the",
"{",
"@code",
"char",
"}",
"value",
"at",
"the",
"given",
"index",
"in",
"the",
"{",
"@code",
"char",
"}",
"array",
"is",
"in",
"the",
"high",
"-",
"surrogate",
"range",
"the",
"following",
"index",
"is",
"less",
"than",
"the",
"{",
"@code",
"limit",
"}",
"and",
"the",
"{",
"@code",
"char",
"}",
"value",
"at",
"the",
"following",
"index",
"is",
"in",
"the",
"low",
"-",
"surrogate",
"range",
"then",
"the",
"supplementary",
"code",
"point",
"corresponding",
"to",
"this",
"surrogate",
"pair",
"is",
"returned",
".",
"Otherwise",
"the",
"{",
"@code",
"char",
"}",
"value",
"at",
"the",
"given",
"index",
"is",
"returned",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java#L4987-L4992 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskInProgress.java | TaskInProgress.completedTask | private void completedTask(TaskAttemptID taskId, TaskStatus.State finalTaskState) {
"""
Finalize the <b>completed</b> task; note that this might not be the first
task-attempt of the {@link TaskInProgress} and hence might be declared
{@link TaskStatus.State.SUCCEEDED} or {@link TaskStatus.State.KILLED}
@param taskId id of the completed task-attempt
@param finalTaskState final {@link TaskStatus.State} of the task-attempt
"""
TaskStatus status = taskStatuses.get(taskId);
status.setRunState(finalTaskState);
activeTasks.remove(taskId);
} | java | private void completedTask(TaskAttemptID taskId, TaskStatus.State finalTaskState) {
TaskStatus status = taskStatuses.get(taskId);
status.setRunState(finalTaskState);
activeTasks.remove(taskId);
} | [
"private",
"void",
"completedTask",
"(",
"TaskAttemptID",
"taskId",
",",
"TaskStatus",
".",
"State",
"finalTaskState",
")",
"{",
"TaskStatus",
"status",
"=",
"taskStatuses",
".",
"get",
"(",
"taskId",
")",
";",
"status",
".",
"setRunState",
"(",
"finalTaskState",
")",
";",
"activeTasks",
".",
"remove",
"(",
"taskId",
")",
";",
"}"
]
| Finalize the <b>completed</b> task; note that this might not be the first
task-attempt of the {@link TaskInProgress} and hence might be declared
{@link TaskStatus.State.SUCCEEDED} or {@link TaskStatus.State.KILLED}
@param taskId id of the completed task-attempt
@param finalTaskState final {@link TaskStatus.State} of the task-attempt | [
"Finalize",
"the",
"<b",
">",
"completed<",
"/",
"b",
">",
"task",
";",
"note",
"that",
"this",
"might",
"not",
"be",
"the",
"first",
"task",
"-",
"attempt",
"of",
"the",
"{",
"@link",
"TaskInProgress",
"}",
"and",
"hence",
"might",
"be",
"declared",
"{",
"@link",
"TaskStatus",
".",
"State",
".",
"SUCCEEDED",
"}",
"or",
"{",
"@link",
"TaskStatus",
".",
"State",
".",
"KILLED",
"}"
]
| train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskInProgress.java#L889-L893 |
mirage-sql/mirage | src/main/java/com/miragesql/miragesql/util/OgnlUtil.java | OgnlUtil.getValue | public static Object getValue(Object exp, Map ctx, Object root, String path, int lineNumber) {
"""
Returns the value using the OGNL expression, the root object, a context mpa, a path and a line number.
@param exp the OGNL expression
@param ctx the context map
@param root the root object
@param path the path
@param lineNumber the line number
@return the value
@throws OgnlRuntimeException when a {@link ognl.OgnlException} occurs
"""
try {
OgnlContext context = new OgnlContext(null, null, new DefaultMemberAccess(true));
return Ognl.getValue(exp, context, root);
} catch (OgnlException ex) {
throw new OgnlRuntimeException(ex.getReason() == null ? ex : ex
.getReason(), path, lineNumber);
} catch (Exception ex) {
throw new OgnlRuntimeException(ex, path, lineNumber);
}
} | java | public static Object getValue(Object exp, Map ctx, Object root, String path, int lineNumber) {
try {
OgnlContext context = new OgnlContext(null, null, new DefaultMemberAccess(true));
return Ognl.getValue(exp, context, root);
} catch (OgnlException ex) {
throw new OgnlRuntimeException(ex.getReason() == null ? ex : ex
.getReason(), path, lineNumber);
} catch (Exception ex) {
throw new OgnlRuntimeException(ex, path, lineNumber);
}
} | [
"public",
"static",
"Object",
"getValue",
"(",
"Object",
"exp",
",",
"Map",
"ctx",
",",
"Object",
"root",
",",
"String",
"path",
",",
"int",
"lineNumber",
")",
"{",
"try",
"{",
"OgnlContext",
"context",
"=",
"new",
"OgnlContext",
"(",
"null",
",",
"null",
",",
"new",
"DefaultMemberAccess",
"(",
"true",
")",
")",
";",
"return",
"Ognl",
".",
"getValue",
"(",
"exp",
",",
"context",
",",
"root",
")",
";",
"}",
"catch",
"(",
"OgnlException",
"ex",
")",
"{",
"throw",
"new",
"OgnlRuntimeException",
"(",
"ex",
".",
"getReason",
"(",
")",
"==",
"null",
"?",
"ex",
":",
"ex",
".",
"getReason",
"(",
")",
",",
"path",
",",
"lineNumber",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"OgnlRuntimeException",
"(",
"ex",
",",
"path",
",",
"lineNumber",
")",
";",
"}",
"}"
]
| Returns the value using the OGNL expression, the root object, a context mpa, a path and a line number.
@param exp the OGNL expression
@param ctx the context map
@param root the root object
@param path the path
@param lineNumber the line number
@return the value
@throws OgnlRuntimeException when a {@link ognl.OgnlException} occurs | [
"Returns",
"the",
"value",
"using",
"the",
"OGNL",
"expression",
"the",
"root",
"object",
"a",
"context",
"mpa",
"a",
"path",
"and",
"a",
"line",
"number",
"."
]
| train | https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/util/OgnlUtil.java#L96-L106 |
ontop/ontop | core/model/src/main/java/it/unibz/inf/ontop/iq/node/impl/LeftJoinNodeImpl.java | LeftJoinNodeImpl.createProvenanceElements | private Optional<RightProvenance> createProvenanceElements(IQTree rightTree,
ImmutableSubstitution<? extends ImmutableTerm> selectedSubstitution,
ImmutableSet<Variable> leftVariables,
VariableGenerator variableGenerator) {
"""
When at least one value does not depend on a right-specific variable
(i.e. is a ground term or only depends on left variables)
"""
if (selectedSubstitution.getImmutableMap().entrySet().stream()
.filter(e -> !leftVariables.contains(e.getKey()))
.map(Map.Entry::getValue)
.anyMatch(value -> value.getVariableStream()
.allMatch(leftVariables::contains)
|| value.isGround())) {
VariableNullability rightVariableNullability = rightTree.getVariableNullability();
Optional<Variable> nonNullableRightVariable = rightTree.getVariables().stream()
.filter(v -> !leftVariables.contains(v))
.filter(v -> !rightVariableNullability.isPossiblyNullable(v))
.findFirst();
if (nonNullableRightVariable.isPresent()) {
return Optional.of(new RightProvenance(nonNullableRightVariable.get()));
}
/*
* Otherwise, creates a fresh variable and its construction node
*/
else {
Variable provenanceVariable = variableGenerator.generateNewVariable();
ImmutableSet<Variable> newRightProjectedVariables =
Stream.concat(
Stream.of(provenanceVariable),
rightTree.getVariables().stream())
.collect(ImmutableCollectors.toSet());
ConstructionNode newRightConstructionNode = iqFactory.createConstructionNode(
newRightProjectedVariables,
substitutionFactory.getSubstitution(provenanceVariable,
termFactory.getProvenanceSpecialConstant()));
return Optional.of(new RightProvenance(provenanceVariable, newRightConstructionNode));
}
}
else {
return Optional.empty();
}
} | java | private Optional<RightProvenance> createProvenanceElements(IQTree rightTree,
ImmutableSubstitution<? extends ImmutableTerm> selectedSubstitution,
ImmutableSet<Variable> leftVariables,
VariableGenerator variableGenerator) {
if (selectedSubstitution.getImmutableMap().entrySet().stream()
.filter(e -> !leftVariables.contains(e.getKey()))
.map(Map.Entry::getValue)
.anyMatch(value -> value.getVariableStream()
.allMatch(leftVariables::contains)
|| value.isGround())) {
VariableNullability rightVariableNullability = rightTree.getVariableNullability();
Optional<Variable> nonNullableRightVariable = rightTree.getVariables().stream()
.filter(v -> !leftVariables.contains(v))
.filter(v -> !rightVariableNullability.isPossiblyNullable(v))
.findFirst();
if (nonNullableRightVariable.isPresent()) {
return Optional.of(new RightProvenance(nonNullableRightVariable.get()));
}
/*
* Otherwise, creates a fresh variable and its construction node
*/
else {
Variable provenanceVariable = variableGenerator.generateNewVariable();
ImmutableSet<Variable> newRightProjectedVariables =
Stream.concat(
Stream.of(provenanceVariable),
rightTree.getVariables().stream())
.collect(ImmutableCollectors.toSet());
ConstructionNode newRightConstructionNode = iqFactory.createConstructionNode(
newRightProjectedVariables,
substitutionFactory.getSubstitution(provenanceVariable,
termFactory.getProvenanceSpecialConstant()));
return Optional.of(new RightProvenance(provenanceVariable, newRightConstructionNode));
}
}
else {
return Optional.empty();
}
} | [
"private",
"Optional",
"<",
"RightProvenance",
">",
"createProvenanceElements",
"(",
"IQTree",
"rightTree",
",",
"ImmutableSubstitution",
"<",
"?",
"extends",
"ImmutableTerm",
">",
"selectedSubstitution",
",",
"ImmutableSet",
"<",
"Variable",
">",
"leftVariables",
",",
"VariableGenerator",
"variableGenerator",
")",
"{",
"if",
"(",
"selectedSubstitution",
".",
"getImmutableMap",
"(",
")",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"e",
"->",
"!",
"leftVariables",
".",
"contains",
"(",
"e",
".",
"getKey",
"(",
")",
")",
")",
".",
"map",
"(",
"Map",
".",
"Entry",
"::",
"getValue",
")",
".",
"anyMatch",
"(",
"value",
"->",
"value",
".",
"getVariableStream",
"(",
")",
".",
"allMatch",
"(",
"leftVariables",
"::",
"contains",
")",
"||",
"value",
".",
"isGround",
"(",
")",
")",
")",
"{",
"VariableNullability",
"rightVariableNullability",
"=",
"rightTree",
".",
"getVariableNullability",
"(",
")",
";",
"Optional",
"<",
"Variable",
">",
"nonNullableRightVariable",
"=",
"rightTree",
".",
"getVariables",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"v",
"->",
"!",
"leftVariables",
".",
"contains",
"(",
"v",
")",
")",
".",
"filter",
"(",
"v",
"->",
"!",
"rightVariableNullability",
".",
"isPossiblyNullable",
"(",
"v",
")",
")",
".",
"findFirst",
"(",
")",
";",
"if",
"(",
"nonNullableRightVariable",
".",
"isPresent",
"(",
")",
")",
"{",
"return",
"Optional",
".",
"of",
"(",
"new",
"RightProvenance",
"(",
"nonNullableRightVariable",
".",
"get",
"(",
")",
")",
")",
";",
"}",
"/*\n * Otherwise, creates a fresh variable and its construction node\n */",
"else",
"{",
"Variable",
"provenanceVariable",
"=",
"variableGenerator",
".",
"generateNewVariable",
"(",
")",
";",
"ImmutableSet",
"<",
"Variable",
">",
"newRightProjectedVariables",
"=",
"Stream",
".",
"concat",
"(",
"Stream",
".",
"of",
"(",
"provenanceVariable",
")",
",",
"rightTree",
".",
"getVariables",
"(",
")",
".",
"stream",
"(",
")",
")",
".",
"collect",
"(",
"ImmutableCollectors",
".",
"toSet",
"(",
")",
")",
";",
"ConstructionNode",
"newRightConstructionNode",
"=",
"iqFactory",
".",
"createConstructionNode",
"(",
"newRightProjectedVariables",
",",
"substitutionFactory",
".",
"getSubstitution",
"(",
"provenanceVariable",
",",
"termFactory",
".",
"getProvenanceSpecialConstant",
"(",
")",
")",
")",
";",
"return",
"Optional",
".",
"of",
"(",
"new",
"RightProvenance",
"(",
"provenanceVariable",
",",
"newRightConstructionNode",
")",
")",
";",
"}",
"}",
"else",
"{",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}",
"}"
]
| When at least one value does not depend on a right-specific variable
(i.e. is a ground term or only depends on left variables) | [
"When",
"at",
"least",
"one",
"value",
"does",
"not",
"depend",
"on",
"a",
"right",
"-",
"specific",
"variable",
"(",
"i",
".",
"e",
".",
"is",
"a",
"ground",
"term",
"or",
"only",
"depends",
"on",
"left",
"variables",
")"
]
| train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/model/src/main/java/it/unibz/inf/ontop/iq/node/impl/LeftJoinNodeImpl.java#L684-L728 |
looly/hutool | hutool-log/src/main/java/cn/hutool/log/dialect/slf4j/Slf4jLog.java | Slf4jLog.locationAwareLog | private boolean locationAwareLog(int level_int, Throwable t, String msgTemplate, Object[] arguments) {
"""
打印日志<br>
此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题
@param level_int 日志级别,使用LocationAwareLogger中的常量
@param msgTemplate 消息模板
@param arguments 参数
@param t 异常
@return 是否支持 LocationAwareLogger对象,如果不支持需要日志方法调用被包装类的相应方法
"""
return locationAwareLog(FQCN, level_int, t, msgTemplate, arguments);
} | java | private boolean locationAwareLog(int level_int, Throwable t, String msgTemplate, Object[] arguments) {
return locationAwareLog(FQCN, level_int, t, msgTemplate, arguments);
} | [
"private",
"boolean",
"locationAwareLog",
"(",
"int",
"level_int",
",",
"Throwable",
"t",
",",
"String",
"msgTemplate",
",",
"Object",
"[",
"]",
"arguments",
")",
"{",
"return",
"locationAwareLog",
"(",
"FQCN",
",",
"level_int",
",",
"t",
",",
"msgTemplate",
",",
"arguments",
")",
";",
"}"
]
| 打印日志<br>
此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题
@param level_int 日志级别,使用LocationAwareLogger中的常量
@param msgTemplate 消息模板
@param arguments 参数
@param t 异常
@return 是否支持 LocationAwareLogger对象,如果不支持需要日志方法调用被包装类的相应方法 | [
"打印日志<br",
">",
"此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题"
]
| train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/dialect/slf4j/Slf4jLog.java#L200-L202 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java | Resolve.findIdent | Symbol findIdent(Env<AttrContext> env, Name name, KindSelector kind) {
"""
Find an unqualified identifier which matches a specified kind set.
@param env The current environment.
@param name The identifier's name.
@param kind Indicates the possible symbol kinds
(a subset of VAL, TYP, PCK).
"""
Symbol bestSoFar = typeNotFound;
Symbol sym;
if (kind.contains(KindSelector.VAL)) {
sym = findVar(env, name);
if (sym.exists()) return sym;
else bestSoFar = bestOf(bestSoFar, sym);
}
if (kind.contains(KindSelector.TYP)) {
sym = findType(env, name);
if (sym.exists()) return sym;
else bestSoFar = bestOf(bestSoFar, sym);
}
if (kind.contains(KindSelector.PCK))
return lookupPackage(env, name);
else return bestSoFar;
} | java | Symbol findIdent(Env<AttrContext> env, Name name, KindSelector kind) {
Symbol bestSoFar = typeNotFound;
Symbol sym;
if (kind.contains(KindSelector.VAL)) {
sym = findVar(env, name);
if (sym.exists()) return sym;
else bestSoFar = bestOf(bestSoFar, sym);
}
if (kind.contains(KindSelector.TYP)) {
sym = findType(env, name);
if (sym.exists()) return sym;
else bestSoFar = bestOf(bestSoFar, sym);
}
if (kind.contains(KindSelector.PCK))
return lookupPackage(env, name);
else return bestSoFar;
} | [
"Symbol",
"findIdent",
"(",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"Name",
"name",
",",
"KindSelector",
"kind",
")",
"{",
"Symbol",
"bestSoFar",
"=",
"typeNotFound",
";",
"Symbol",
"sym",
";",
"if",
"(",
"kind",
".",
"contains",
"(",
"KindSelector",
".",
"VAL",
")",
")",
"{",
"sym",
"=",
"findVar",
"(",
"env",
",",
"name",
")",
";",
"if",
"(",
"sym",
".",
"exists",
"(",
")",
")",
"return",
"sym",
";",
"else",
"bestSoFar",
"=",
"bestOf",
"(",
"bestSoFar",
",",
"sym",
")",
";",
"}",
"if",
"(",
"kind",
".",
"contains",
"(",
"KindSelector",
".",
"TYP",
")",
")",
"{",
"sym",
"=",
"findType",
"(",
"env",
",",
"name",
")",
";",
"if",
"(",
"sym",
".",
"exists",
"(",
")",
")",
"return",
"sym",
";",
"else",
"bestSoFar",
"=",
"bestOf",
"(",
"bestSoFar",
",",
"sym",
")",
";",
"}",
"if",
"(",
"kind",
".",
"contains",
"(",
"KindSelector",
".",
"PCK",
")",
")",
"return",
"lookupPackage",
"(",
"env",
",",
"name",
")",
";",
"else",
"return",
"bestSoFar",
";",
"}"
]
| Find an unqualified identifier which matches a specified kind set.
@param env The current environment.
@param name The identifier's name.
@param kind Indicates the possible symbol kinds
(a subset of VAL, TYP, PCK). | [
"Find",
"an",
"unqualified",
"identifier",
"which",
"matches",
"a",
"specified",
"kind",
"set",
"."
]
| train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2335-L2355 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/impl/config/copy/DefaultCopyProviderConfiguration.java | DefaultCopyProviderConfiguration.addCopierFor | public <T> DefaultCopyProviderConfiguration addCopierFor(Class<T> clazz, Class<? extends Copier<T>> copierClass, boolean overwrite) {
"""
Adds a new {@code Class} - {@link Copier} pair to this configuration object
@param clazz the {@code Class} for which this copier is
@param copierClass the {@link Copier} type to use
@param overwrite indicates if an existing mapping is to be overwritten
@param <T> the type of objects the copier will deal with
@return this configuration instance
@throws NullPointerException if any argument is null
@throws IllegalArgumentException in a case a mapping for {@code clazz} already exists and {@code overwrite} is {@code false}
"""
if (clazz == null) {
throw new NullPointerException("Copy target class cannot be null");
}
if (copierClass == null) {
throw new NullPointerException("Copier class cannot be null");
}
if (!overwrite && getDefaults().containsKey(clazz)) {
throw new IllegalArgumentException("Duplicate copier for class : " + clazz);
}
getDefaults().put(clazz, new DefaultCopierConfiguration<>(copierClass));
return this;
} | java | public <T> DefaultCopyProviderConfiguration addCopierFor(Class<T> clazz, Class<? extends Copier<T>> copierClass, boolean overwrite) {
if (clazz == null) {
throw new NullPointerException("Copy target class cannot be null");
}
if (copierClass == null) {
throw new NullPointerException("Copier class cannot be null");
}
if (!overwrite && getDefaults().containsKey(clazz)) {
throw new IllegalArgumentException("Duplicate copier for class : " + clazz);
}
getDefaults().put(clazz, new DefaultCopierConfiguration<>(copierClass));
return this;
} | [
"public",
"<",
"T",
">",
"DefaultCopyProviderConfiguration",
"addCopierFor",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Class",
"<",
"?",
"extends",
"Copier",
"<",
"T",
">",
">",
"copierClass",
",",
"boolean",
"overwrite",
")",
"{",
"if",
"(",
"clazz",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Copy target class cannot be null\"",
")",
";",
"}",
"if",
"(",
"copierClass",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Copier class cannot be null\"",
")",
";",
"}",
"if",
"(",
"!",
"overwrite",
"&&",
"getDefaults",
"(",
")",
".",
"containsKey",
"(",
"clazz",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Duplicate copier for class : \"",
"+",
"clazz",
")",
";",
"}",
"getDefaults",
"(",
")",
".",
"put",
"(",
"clazz",
",",
"new",
"DefaultCopierConfiguration",
"<>",
"(",
"copierClass",
")",
")",
";",
"return",
"this",
";",
"}"
]
| Adds a new {@code Class} - {@link Copier} pair to this configuration object
@param clazz the {@code Class} for which this copier is
@param copierClass the {@link Copier} type to use
@param overwrite indicates if an existing mapping is to be overwritten
@param <T> the type of objects the copier will deal with
@return this configuration instance
@throws NullPointerException if any argument is null
@throws IllegalArgumentException in a case a mapping for {@code clazz} already exists and {@code overwrite} is {@code false} | [
"Adds",
"a",
"new",
"{",
"@code",
"Class",
"}",
"-",
"{",
"@link",
"Copier",
"}",
"pair",
"to",
"this",
"configuration",
"object"
]
| train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/config/copy/DefaultCopyProviderConfiguration.java#L85-L97 |
alkacon/opencms-core | src/org/opencms/workplace/CmsDialog.java | CmsDialog.dialogScriptSubmit | @Override
public String dialogScriptSubmit() {
"""
Builds the standard javascript for submitting the dialog.<p>
@return the standard javascript for submitting the dialog
"""
if (useNewStyle()) {
return super.dialogScriptSubmit();
}
StringBuffer result = new StringBuffer(512);
result.append("function submitAction(actionValue, theForm, formName) {\n");
result.append("\tif (theForm == null) {\n");
result.append("\t\ttheForm = document.forms[formName];\n");
result.append("\t}\n");
result.append("\ttheForm." + PARAM_FRAMENAME + ".value = window.name;\n");
result.append("\tif (actionValue == \"" + DIALOG_OK + "\") {\n");
result.append("\t\treturn true;\n");
result.append("\t}\n");
result.append("\ttheForm." + PARAM_ACTION + ".value = actionValue;\n");
result.append("\ttheForm.submit();\n");
result.append("\treturn false;\n");
result.append("}\n");
return result.toString();
} | java | @Override
public String dialogScriptSubmit() {
if (useNewStyle()) {
return super.dialogScriptSubmit();
}
StringBuffer result = new StringBuffer(512);
result.append("function submitAction(actionValue, theForm, formName) {\n");
result.append("\tif (theForm == null) {\n");
result.append("\t\ttheForm = document.forms[formName];\n");
result.append("\t}\n");
result.append("\ttheForm." + PARAM_FRAMENAME + ".value = window.name;\n");
result.append("\tif (actionValue == \"" + DIALOG_OK + "\") {\n");
result.append("\t\treturn true;\n");
result.append("\t}\n");
result.append("\ttheForm." + PARAM_ACTION + ".value = actionValue;\n");
result.append("\ttheForm.submit();\n");
result.append("\treturn false;\n");
result.append("}\n");
return result.toString();
} | [
"@",
"Override",
"public",
"String",
"dialogScriptSubmit",
"(",
")",
"{",
"if",
"(",
"useNewStyle",
"(",
")",
")",
"{",
"return",
"super",
".",
"dialogScriptSubmit",
"(",
")",
";",
"}",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"512",
")",
";",
"result",
".",
"append",
"(",
"\"function submitAction(actionValue, theForm, formName) {\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\tif (theForm == null) {\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\\ttheForm = document.forms[formName];\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t}\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\ttheForm.\"",
"+",
"PARAM_FRAMENAME",
"+",
"\".value = window.name;\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\tif (actionValue == \\\"\"",
"+",
"DIALOG_OK",
"+",
"\"\\\") {\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\\treturn true;\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t}\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\ttheForm.\"",
"+",
"PARAM_ACTION",
"+",
"\".value = actionValue;\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\ttheForm.submit();\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\treturn false;\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"}\\n\"",
")",
";",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
]
| Builds the standard javascript for submitting the dialog.<p>
@return the standard javascript for submitting the dialog | [
"Builds",
"the",
"standard",
"javascript",
"for",
"submitting",
"the",
"dialog",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsDialog.java#L907-L928 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementPlugin.java | ElementPlugin.setPropertyValue | @Override
public void setPropertyValue(PropertyInfo propInfo, Object value) throws Exception {
"""
Sets a value for a registered property.
@param propInfo Property info.
@param value The value to set.
@throws Exception Unspecified exception.
"""
String propId = propInfo.getId();
Object obj = registeredProperties == null ? null : registeredProperties.get(propId);
if (obj == null) {
obj = new PropertyProxy(propInfo, value);
registerProperties(obj, propId);
} else if (obj instanceof PropertyProxy) {
((PropertyProxy) obj).setValue(value);
} else {
propInfo.setPropertyValue(obj, value, obj == this);
}
} | java | @Override
public void setPropertyValue(PropertyInfo propInfo, Object value) throws Exception {
String propId = propInfo.getId();
Object obj = registeredProperties == null ? null : registeredProperties.get(propId);
if (obj == null) {
obj = new PropertyProxy(propInfo, value);
registerProperties(obj, propId);
} else if (obj instanceof PropertyProxy) {
((PropertyProxy) obj).setValue(value);
} else {
propInfo.setPropertyValue(obj, value, obj == this);
}
} | [
"@",
"Override",
"public",
"void",
"setPropertyValue",
"(",
"PropertyInfo",
"propInfo",
",",
"Object",
"value",
")",
"throws",
"Exception",
"{",
"String",
"propId",
"=",
"propInfo",
".",
"getId",
"(",
")",
";",
"Object",
"obj",
"=",
"registeredProperties",
"==",
"null",
"?",
"null",
":",
"registeredProperties",
".",
"get",
"(",
"propId",
")",
";",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"obj",
"=",
"new",
"PropertyProxy",
"(",
"propInfo",
",",
"value",
")",
";",
"registerProperties",
"(",
"obj",
",",
"propId",
")",
";",
"}",
"else",
"if",
"(",
"obj",
"instanceof",
"PropertyProxy",
")",
"{",
"(",
"(",
"PropertyProxy",
")",
"obj",
")",
".",
"setValue",
"(",
"value",
")",
";",
"}",
"else",
"{",
"propInfo",
".",
"setPropertyValue",
"(",
"obj",
",",
"value",
",",
"obj",
"==",
"this",
")",
";",
"}",
"}"
]
| Sets a value for a registered property.
@param propInfo Property info.
@param value The value to set.
@throws Exception Unspecified exception. | [
"Sets",
"a",
"value",
"for",
"a",
"registered",
"property",
"."
]
| train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementPlugin.java#L261-L274 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/jackson/GeometryDeserializer.java | GeometryDeserializer.asLineString | private LineString asLineString(List<List> coords, CrsId crsId) throws IOException {
"""
Parses the JSON as a linestring geometry
@param coords The coordinates for the linestring, which is a list of coordinates (which in turn are lists of
two values, x and y)
@param crsId
@return An instance of linestring
@throws IOException if the given json does not correspond to a linestring or can be parsed as such.
"""
if (coords == null || coords.size() < 2) {
throw new IOException("A linestring requires a valid series of coordinates (at least two coordinates)");
}
PointSequence coordinates = getPointSequence(coords, crsId);
return new LineString(coordinates);
} | java | private LineString asLineString(List<List> coords, CrsId crsId) throws IOException {
if (coords == null || coords.size() < 2) {
throw new IOException("A linestring requires a valid series of coordinates (at least two coordinates)");
}
PointSequence coordinates = getPointSequence(coords, crsId);
return new LineString(coordinates);
} | [
"private",
"LineString",
"asLineString",
"(",
"List",
"<",
"List",
">",
"coords",
",",
"CrsId",
"crsId",
")",
"throws",
"IOException",
"{",
"if",
"(",
"coords",
"==",
"null",
"||",
"coords",
".",
"size",
"(",
")",
"<",
"2",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"A linestring requires a valid series of coordinates (at least two coordinates)\"",
")",
";",
"}",
"PointSequence",
"coordinates",
"=",
"getPointSequence",
"(",
"coords",
",",
"crsId",
")",
";",
"return",
"new",
"LineString",
"(",
"coordinates",
")",
";",
"}"
]
| Parses the JSON as a linestring geometry
@param coords The coordinates for the linestring, which is a list of coordinates (which in turn are lists of
two values, x and y)
@param crsId
@return An instance of linestring
@throws IOException if the given json does not correspond to a linestring or can be parsed as such. | [
"Parses",
"the",
"JSON",
"as",
"a",
"linestring",
"geometry"
]
| train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/GeometryDeserializer.java#L303-L309 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createScopeWithTemplates | public StaticTypedScope createScopeWithTemplates(
StaticTypedScope scope, Iterable<TemplateType> templates) {
"""
Returns a new scope that includes the given template names for type resolution
purposes.
"""
return new SyntheticTemplateScope(scope, templates);
} | java | public StaticTypedScope createScopeWithTemplates(
StaticTypedScope scope, Iterable<TemplateType> templates) {
return new SyntheticTemplateScope(scope, templates);
} | [
"public",
"StaticTypedScope",
"createScopeWithTemplates",
"(",
"StaticTypedScope",
"scope",
",",
"Iterable",
"<",
"TemplateType",
">",
"templates",
")",
"{",
"return",
"new",
"SyntheticTemplateScope",
"(",
"scope",
",",
"templates",
")",
";",
"}"
]
| Returns a new scope that includes the given template names for type resolution
purposes. | [
"Returns",
"a",
"new",
"scope",
"that",
"includes",
"the",
"given",
"template",
"names",
"for",
"type",
"resolution",
"purposes",
"."
]
| train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L2267-L2270 |
kiswanij/jk-util | src/main/java/com/jk/util/zip/JKZipUtility.java | JKZipUtility.unzip | public static void unzip(InputStream in, String destDirectory) throws IOException {
"""
Extracts a zip file specified by the zipFilePath to a directory specified by
destDirectory (will be created if does not exists)
@param zipFilePath
@param destDirectory
@throws IOException
"""
File destDir = new File(destDirectory);
if (!destDir.exists()) {
destDir.mkdir();
}
ZipInputStream zipIn = new ZipInputStream(in);
ZipEntry entry = zipIn.getNextEntry();
// iterates over entries in the zip file
while (entry != null) {
String filePath = destDirectory + File.separator + entry.getName();
if (!entry.isDirectory()) {
// if the entry is a file, extracts it
extractFile(zipIn, filePath);
} else {
// if the entry is a directory, make the directory
File dir = new File(filePath);
dir.mkdir();
}
zipIn.closeEntry();
entry = zipIn.getNextEntry();
}
zipIn.close();
} | java | public static void unzip(InputStream in, String destDirectory) throws IOException {
File destDir = new File(destDirectory);
if (!destDir.exists()) {
destDir.mkdir();
}
ZipInputStream zipIn = new ZipInputStream(in);
ZipEntry entry = zipIn.getNextEntry();
// iterates over entries in the zip file
while (entry != null) {
String filePath = destDirectory + File.separator + entry.getName();
if (!entry.isDirectory()) {
// if the entry is a file, extracts it
extractFile(zipIn, filePath);
} else {
// if the entry is a directory, make the directory
File dir = new File(filePath);
dir.mkdir();
}
zipIn.closeEntry();
entry = zipIn.getNextEntry();
}
zipIn.close();
} | [
"public",
"static",
"void",
"unzip",
"(",
"InputStream",
"in",
",",
"String",
"destDirectory",
")",
"throws",
"IOException",
"{",
"File",
"destDir",
"=",
"new",
"File",
"(",
"destDirectory",
")",
";",
"if",
"(",
"!",
"destDir",
".",
"exists",
"(",
")",
")",
"{",
"destDir",
".",
"mkdir",
"(",
")",
";",
"}",
"ZipInputStream",
"zipIn",
"=",
"new",
"ZipInputStream",
"(",
"in",
")",
";",
"ZipEntry",
"entry",
"=",
"zipIn",
".",
"getNextEntry",
"(",
")",
";",
"// iterates over entries in the zip file\r",
"while",
"(",
"entry",
"!=",
"null",
")",
"{",
"String",
"filePath",
"=",
"destDirectory",
"+",
"File",
".",
"separator",
"+",
"entry",
".",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"entry",
".",
"isDirectory",
"(",
")",
")",
"{",
"// if the entry is a file, extracts it\r",
"extractFile",
"(",
"zipIn",
",",
"filePath",
")",
";",
"}",
"else",
"{",
"// if the entry is a directory, make the directory\r",
"File",
"dir",
"=",
"new",
"File",
"(",
"filePath",
")",
";",
"dir",
".",
"mkdir",
"(",
")",
";",
"}",
"zipIn",
".",
"closeEntry",
"(",
")",
";",
"entry",
"=",
"zipIn",
".",
"getNextEntry",
"(",
")",
";",
"}",
"zipIn",
".",
"close",
"(",
")",
";",
"}"
]
| Extracts a zip file specified by the zipFilePath to a directory specified by
destDirectory (will be created if does not exists)
@param zipFilePath
@param destDirectory
@throws IOException | [
"Extracts",
"a",
"zip",
"file",
"specified",
"by",
"the",
"zipFilePath",
"to",
"a",
"directory",
"specified",
"by",
"destDirectory",
"(",
"will",
"be",
"created",
"if",
"does",
"not",
"exists",
")"
]
| train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/zip/JKZipUtility.java#L38-L60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.