repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcipher_individualcipher_binding.java | sslcipher_individualcipher_binding.count_filtered | public static long count_filtered(nitro_service service, String ciphergroupname, String filter) throws Exception{
sslcipher_individualcipher_binding obj = new sslcipher_individualcipher_binding();
obj.set_ciphergroupname(ciphergroupname);
options option = new options();
option.set_count(true);
option.set_filter(filter);
sslcipher_individualcipher_binding[] response = (sslcipher_individualcipher_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | java | public static long count_filtered(nitro_service service, String ciphergroupname, String filter) throws Exception{
sslcipher_individualcipher_binding obj = new sslcipher_individualcipher_binding();
obj.set_ciphergroupname(ciphergroupname);
options option = new options();
option.set_count(true);
option.set_filter(filter);
sslcipher_individualcipher_binding[] response = (sslcipher_individualcipher_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | [
"public",
"static",
"long",
"count_filtered",
"(",
"nitro_service",
"service",
",",
"String",
"ciphergroupname",
",",
"String",
"filter",
")",
"throws",
"Exception",
"{",
"sslcipher_individualcipher_binding",
"obj",
"=",
"new",
"sslcipher_individualcipher_binding",
"(",
... | Use this API to count the filtered set of sslcipher_individualcipher_binding resources.
filter string should be in JSON format.eg: "port:80,servicetype:HTTP". | [
"Use",
"this",
"API",
"to",
"count",
"the",
"filtered",
"set",
"of",
"sslcipher_individualcipher_binding",
"resources",
".",
"filter",
"string",
"should",
"be",
"in",
"JSON",
"format",
".",
"eg",
":",
"port",
":",
"80",
"servicetype",
":",
"HTTP",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcipher_individualcipher_binding.java#L231-L242 |
Netflix/conductor | client/src/main/java/com/netflix/conductor/client/http/WorkflowClient.java | WorkflowClient.getRunningWorkflow | public List<String> getRunningWorkflow(String workflowName, Integer version) {
Preconditions.checkArgument(StringUtils.isNotBlank(workflowName), "Workflow name cannot be blank");
return getForEntity("workflow/running/{name}", new Object[]{"version", version}, new GenericType<List<String>>() {
}, workflowName);
} | java | public List<String> getRunningWorkflow(String workflowName, Integer version) {
Preconditions.checkArgument(StringUtils.isNotBlank(workflowName), "Workflow name cannot be blank");
return getForEntity("workflow/running/{name}", new Object[]{"version", version}, new GenericType<List<String>>() {
}, workflowName);
} | [
"public",
"List",
"<",
"String",
">",
"getRunningWorkflow",
"(",
"String",
"workflowName",
",",
"Integer",
"version",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"workflowName",
")",
",",
"\"Workflow name cannot be bl... | Retrieve all running workflow instances for a given name and version
@param workflowName the name of the workflow
@param version the version of the wokflow definition. Defaults to 1.
@return the list of running workflow instances | [
"Retrieve",
"all",
"running",
"workflow",
"instances",
"for",
"a",
"given",
"name",
"and",
"version"
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/WorkflowClient.java#L203-L207 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/io/IO.java | IO.skipFully | public static void skipFully(InputStream in, long bytes) throws IOException {
if (bytes < 0) {
throw new IllegalArgumentException("Can't skip " + bytes + " bytes");
}
long remaining = bytes;
while (remaining > 0) {
long skipped = in.skip(remaining);
if (skipped <= 0) {
throw new EOFException("Reached EOF while trying to skip a total of " + bytes);
}
remaining -= skipped;
}
} | java | public static void skipFully(InputStream in, long bytes) throws IOException {
if (bytes < 0) {
throw new IllegalArgumentException("Can't skip " + bytes + " bytes");
}
long remaining = bytes;
while (remaining > 0) {
long skipped = in.skip(remaining);
if (skipped <= 0) {
throw new EOFException("Reached EOF while trying to skip a total of " + bytes);
}
remaining -= skipped;
}
} | [
"public",
"static",
"void",
"skipFully",
"(",
"InputStream",
"in",
",",
"long",
"bytes",
")",
"throws",
"IOException",
"{",
"if",
"(",
"bytes",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Can't skip \"",
"+",
"bytes",
"+",
"\" byt... | Provide a skip fully method. Either skips the requested number of bytes
or throws an IOException;
@param in
The input stream on which to perform the skip
@param bytes
Number of bytes to skip
@throws EOFException
if we reach EOF and still need to skip more bytes
@throws IOException
if in.skip throws an IOException | [
"Provide",
"a",
"skip",
"fully",
"method",
".",
"Either",
"skips",
"the",
"requested",
"number",
"of",
"bytes",
"or",
"throws",
"an",
"IOException",
";"
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/io/IO.java#L245-L258 |
javagl/ND | nd-arrays/src/main/java/de/javagl/nd/arrays/i/IntArraysND.java | IntArraysND.wrap | public static IntArrayND wrap(IntTuple t, IntTuple size)
{
Objects.requireNonNull(t, "The tuple is null");
Objects.requireNonNull(size, "The size is null");
int totalSize = IntTupleFunctions.reduce(size, 1, (a, b) -> a * b);
if (t.getSize() != totalSize)
{
throw new IllegalArgumentException(
"The tuple has a size of " + t.getSize() + ", the expected " +
"array size is " + size + " (total: " + totalSize + ")");
}
return new TupleIntArrayND(t, size);
} | java | public static IntArrayND wrap(IntTuple t, IntTuple size)
{
Objects.requireNonNull(t, "The tuple is null");
Objects.requireNonNull(size, "The size is null");
int totalSize = IntTupleFunctions.reduce(size, 1, (a, b) -> a * b);
if (t.getSize() != totalSize)
{
throw new IllegalArgumentException(
"The tuple has a size of " + t.getSize() + ", the expected " +
"array size is " + size + " (total: " + totalSize + ")");
}
return new TupleIntArrayND(t, size);
} | [
"public",
"static",
"IntArrayND",
"wrap",
"(",
"IntTuple",
"t",
",",
"IntTuple",
"size",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"t",
",",
"\"The tuple is null\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"size",
",",
"\"The size is null\"",
"... | Creates a <i>view</i> on the given tuple as a {@link IntArrayND}.
Changes in the given tuple will be visible in the returned array.
@param t The tuple
@param size The size of the array
@return The view on the tuple
@throws NullPointerException If any argument is <code>null</code>
@throws IllegalArgumentException If the
{@link IntTuple#getSize() size} of the tuple does not match the
given array size (that is, the product of all elements of the given
tuple). | [
"Creates",
"a",
"<i",
">",
"view<",
"/",
"i",
">",
"on",
"the",
"given",
"tuple",
"as",
"a",
"{",
"@link",
"IntArrayND",
"}",
".",
"Changes",
"in",
"the",
"given",
"tuple",
"will",
"be",
"visible",
"in",
"the",
"returned",
"array",
"."
] | train | https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-arrays/src/main/java/de/javagl/nd/arrays/i/IntArraysND.java#L110-L122 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/VirtualFile.java | VirtualFile.asFileURL | public URL asFileURL() throws MalformedURLException {
return new URL(VFSUtils.VFS_PROTOCOL, "", -1, getPathName(false), VFSUtils.VFS_URL_HANDLER);
} | java | public URL asFileURL() throws MalformedURLException {
return new URL(VFSUtils.VFS_PROTOCOL, "", -1, getPathName(false), VFSUtils.VFS_URL_HANDLER);
} | [
"public",
"URL",
"asFileURL",
"(",
")",
"throws",
"MalformedURLException",
"{",
"return",
"new",
"URL",
"(",
"VFSUtils",
".",
"VFS_PROTOCOL",
",",
"\"\"",
",",
"-",
"1",
",",
"getPathName",
"(",
"false",
")",
",",
"VFSUtils",
".",
"VFS_URL_HANDLER",
")",
"... | Get file's URL as a file. There will be no trailing {@code "/"} character unless this {@code VirtualFile}
represents a root.
@return the url
@throws MalformedURLException if the URL is somehow malformed | [
"Get",
"file",
"s",
"URL",
"as",
"a",
"file",
".",
"There",
"will",
"be",
"no",
"trailing",
"{",
"@code",
"/",
"}",
"character",
"unless",
"this",
"{",
"@code",
"VirtualFile",
"}",
"represents",
"a",
"root",
"."
] | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFile.java#L570-L572 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/ClientRequestContextBuilder.java | ClientRequestContextBuilder.of | public static ClientRequestContextBuilder of(RpcRequest request, String uri) {
return of(request, URI.create(requireNonNull(uri, "uri")));
} | java | public static ClientRequestContextBuilder of(RpcRequest request, String uri) {
return of(request, URI.create(requireNonNull(uri, "uri")));
} | [
"public",
"static",
"ClientRequestContextBuilder",
"of",
"(",
"RpcRequest",
"request",
",",
"String",
"uri",
")",
"{",
"return",
"of",
"(",
"request",
",",
"URI",
".",
"create",
"(",
"requireNonNull",
"(",
"uri",
",",
"\"uri\"",
")",
")",
")",
";",
"}"
] | Returns a new {@link ClientRequestContextBuilder} created from the specified {@link RpcRequest} and URI. | [
"Returns",
"a",
"new",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/ClientRequestContextBuilder.java#L47-L49 |
HeidelTime/heideltime | src/de/unihd/dbs/uima/consumer/tempeval3writer/TempEval3Writer.java | TempEval3Writer.writeTimeMLDocument | private void writeTimeMLDocument(Document xmlDoc, String filename) {
// create output file handle
File outFile = new File(mOutputDir, filename+".tml");
BufferedWriter bw = null;
try {
// create a buffered writer for the output file
bw = new BufferedWriter(new FileWriter(outFile));
// prepare the transformer to convert from the xml doc to output text
Transformer transformer = TransformerFactory.newInstance().newTransformer();
// some pretty printing
transformer.setOutputProperty(OutputKeys.INDENT, "no");
DOMSource source = new DOMSource(xmlDoc);
StreamResult result = new StreamResult(bw);
// transform
transformer.transform(source, result);
} catch (IOException e) { // something went wrong with the bufferedwriter
e.printStackTrace();
Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be written.");
} catch (TransformerException e) { // the transformer malfunctioned (call optimus prime)
e.printStackTrace();
Logger.printError(component, "XML transformer could not be properly initialized.");
} finally { // clean up for the bufferedwriter
try {
bw.close();
} catch(IOException e) {
e.printStackTrace();
Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be closed.");
}
}
} | java | private void writeTimeMLDocument(Document xmlDoc, String filename) {
// create output file handle
File outFile = new File(mOutputDir, filename+".tml");
BufferedWriter bw = null;
try {
// create a buffered writer for the output file
bw = new BufferedWriter(new FileWriter(outFile));
// prepare the transformer to convert from the xml doc to output text
Transformer transformer = TransformerFactory.newInstance().newTransformer();
// some pretty printing
transformer.setOutputProperty(OutputKeys.INDENT, "no");
DOMSource source = new DOMSource(xmlDoc);
StreamResult result = new StreamResult(bw);
// transform
transformer.transform(source, result);
} catch (IOException e) { // something went wrong with the bufferedwriter
e.printStackTrace();
Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be written.");
} catch (TransformerException e) { // the transformer malfunctioned (call optimus prime)
e.printStackTrace();
Logger.printError(component, "XML transformer could not be properly initialized.");
} finally { // clean up for the bufferedwriter
try {
bw.close();
} catch(IOException e) {
e.printStackTrace();
Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be closed.");
}
}
} | [
"private",
"void",
"writeTimeMLDocument",
"(",
"Document",
"xmlDoc",
",",
"String",
"filename",
")",
"{",
"// create output file handle",
"File",
"outFile",
"=",
"new",
"File",
"(",
"mOutputDir",
",",
"filename",
"+",
"\".tml\"",
")",
";",
"BufferedWriter",
"bw",
... | writes a populated DOM xml(timeml) document to a given directory/file
@param xmlDoc xml dom object
@param filename name of the file that gets appended to the set output path | [
"writes",
"a",
"populated",
"DOM",
"xml",
"(",
"timeml",
")",
"document",
"to",
"a",
"given",
"directory",
"/",
"file"
] | train | https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/de/unihd/dbs/uima/consumer/tempeval3writer/TempEval3Writer.java#L237-L269 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.readUser | public CmsUser readUser(String username, String password) throws CmsException {
return m_securityManager.readUser(m_context, username, password);
} | java | public CmsUser readUser(String username, String password) throws CmsException {
return m_securityManager.readUser(m_context, username, password);
} | [
"public",
"CmsUser",
"readUser",
"(",
"String",
"username",
",",
"String",
"password",
")",
"throws",
"CmsException",
"{",
"return",
"m_securityManager",
".",
"readUser",
"(",
"m_context",
",",
"username",
",",
"password",
")",
";",
"}"
] | Returns a user, if the password is correct.<p>
If the user/pwd pair is not valid a <code>{@link CmsException}</code> is thrown.<p>
@param username the name of the user to be returned
@param password the password of the user to be returned
@return the validated user
@throws CmsException if operation was not successful | [
"Returns",
"a",
"user",
"if",
"the",
"password",
"is",
"correct",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3579-L3582 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java | GeometryFactory.createMultiPolygon | public MultiPolygon createMultiPolygon(Polygon[] polygons) {
if (polygons == null) {
return new MultiPolygon(srid, precision);
}
Polygon[] clones = new Polygon[polygons.length];
for (int i = 0; i < polygons.length; i++) {
clones[i] = (Polygon) polygons[i].clone();
}
return new MultiPolygon(srid, precision, clones);
} | java | public MultiPolygon createMultiPolygon(Polygon[] polygons) {
if (polygons == null) {
return new MultiPolygon(srid, precision);
}
Polygon[] clones = new Polygon[polygons.length];
for (int i = 0; i < polygons.length; i++) {
clones[i] = (Polygon) polygons[i].clone();
}
return new MultiPolygon(srid, precision, clones);
} | [
"public",
"MultiPolygon",
"createMultiPolygon",
"(",
"Polygon",
"[",
"]",
"polygons",
")",
"{",
"if",
"(",
"polygons",
"==",
"null",
")",
"{",
"return",
"new",
"MultiPolygon",
"(",
"srid",
",",
"precision",
")",
";",
"}",
"Polygon",
"[",
"]",
"clones",
"... | Create a new {@link MultiPolygon}, given an array of polygons.
@param polygons
An array of {@link Polygon} objects .
@return Returns a {@link MultiPolygon} object. | [
"Create",
"a",
"new",
"{",
"@link",
"MultiPolygon",
"}",
"given",
"an",
"array",
"of",
"polygons",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java#L212-L221 |
VoltDB/voltdb | src/frontend/org/voltcore/zk/ZKUtil.java | ZKUtil.joinZKPath | public static String joinZKPath(String path, String name) {
if (path.endsWith("/")) {
return path + name;
} else {
return path + "/" + name;
}
} | java | public static String joinZKPath(String path, String name) {
if (path.endsWith("/")) {
return path + name;
} else {
return path + "/" + name;
}
} | [
"public",
"static",
"String",
"joinZKPath",
"(",
"String",
"path",
",",
"String",
"name",
")",
"{",
"if",
"(",
"path",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"return",
"path",
"+",
"name",
";",
"}",
"else",
"{",
"return",
"path",
"+",
"\"/\"",... | Joins a path with a filename, if the path already ends with "/", it won't
add another "/" to the path.
@param path
@param name
@return | [
"Joins",
"a",
"path",
"with",
"a",
"filename",
"if",
"the",
"path",
"already",
"ends",
"with",
"/",
"it",
"won",
"t",
"add",
"another",
"/",
"to",
"the",
"path",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/zk/ZKUtil.java#L67-L73 |
algolia/instantsearch-android | core/src/main/java/com/algolia/instantsearch/core/helpers/Highlighter.java | Highlighter.setInput | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public Styler setInput(@NonNull JSONObject result, @NonNull String attribute) {
return setInput(result, attribute, false);
} | java | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public Styler setInput(@NonNull JSONObject result, @NonNull String attribute) {
return setInput(result, attribute, false);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"unused\"",
"}",
")",
"// For library users",
"public",
"Styler",
"setInput",
"(",
"@",
"NonNull",
"JSONObject",
"result",
",",
"@",
"NonNull",
"String",
"attribute",
")",
"{",
"return",
"setInput",
"... | Sets the input to highlight.
@param result a JSONObject containing our attribute.
@param attribute the attribute to highlight.
@return a {@link Styler} to specify the style before rendering. | [
"Sets",
"the",
"input",
"to",
"highlight",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/helpers/Highlighter.java#L140-L143 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java | WikipediaTemplateInfo.getRevisionIdsNotContainingTemplateNames | public List<Integer> getRevisionIdsNotContainingTemplateNames(List<String> templateNames) throws WikiApiException{
return getFilteredRevisionIds(templateNames, false);
} | java | public List<Integer> getRevisionIdsNotContainingTemplateNames(List<String> templateNames) throws WikiApiException{
return getFilteredRevisionIds(templateNames, false);
} | [
"public",
"List",
"<",
"Integer",
">",
"getRevisionIdsNotContainingTemplateNames",
"(",
"List",
"<",
"String",
">",
"templateNames",
")",
"throws",
"WikiApiException",
"{",
"return",
"getFilteredRevisionIds",
"(",
"templateNames",
",",
"false",
")",
";",
"}"
] | Returns a list containing the ids of all revisions that do not contain a template
the name of which equals any of the given Strings.
@param templateNames
the names of the template that we want to match
@return A list with the ids of all revisions that do not contain any of the the
specified templates
@throws WikiApiException
If there was any error retrieving the page object (most
likely if the templates are corrupted) | [
"Returns",
"a",
"list",
"containing",
"the",
"ids",
"of",
"all",
"revisions",
"that",
"do",
"not",
"contain",
"a",
"template",
"the",
"name",
"of",
"which",
"equals",
"any",
"of",
"the",
"given",
"Strings",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java#L1096-L1098 |
netplex/json-smart-v2 | accessors-smart/src/main/java/net/minidev/asm/BeansAccessConfig.java | BeansAccessConfig.addTypeMapper | public static void addTypeMapper(Class<?> clz, Class<?> mapper) {
synchronized (classMapper) {
LinkedHashSet<Class<?>> h = classMapper.get(clz);
if (h == null) {
h = new LinkedHashSet<Class<?>>();
classMapper.put(clz, h);
}
h.add(mapper);
}
} | java | public static void addTypeMapper(Class<?> clz, Class<?> mapper) {
synchronized (classMapper) {
LinkedHashSet<Class<?>> h = classMapper.get(clz);
if (h == null) {
h = new LinkedHashSet<Class<?>>();
classMapper.put(clz, h);
}
h.add(mapper);
}
} | [
"public",
"static",
"void",
"addTypeMapper",
"(",
"Class",
"<",
"?",
">",
"clz",
",",
"Class",
"<",
"?",
">",
"mapper",
")",
"{",
"synchronized",
"(",
"classMapper",
")",
"{",
"LinkedHashSet",
"<",
"Class",
"<",
"?",
">",
">",
"h",
"=",
"classMapper",
... | Field type convertor for all classes
Convertor classes should contains mapping method Prototyped as:
public static DestinationType Method(Object data);
@see DefaultConverter | [
"Field",
"type",
"convertor",
"for",
"all",
"classes"
] | train | https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/accessors-smart/src/main/java/net/minidev/asm/BeansAccessConfig.java#L63-L73 |
osglworks/java-tool | src/main/java/org/osgl/util/E.java | E.NPE | public static void NPE(Object o1, Object o2, Object o3, Object... objects) {
NPE(o1, o2, o3);
for (Object o : objects) {
if (null == o) {
throw new NullPointerException();
}
}
} | java | public static void NPE(Object o1, Object o2, Object o3, Object... objects) {
NPE(o1, o2, o3);
for (Object o : objects) {
if (null == o) {
throw new NullPointerException();
}
}
} | [
"public",
"static",
"void",
"NPE",
"(",
"Object",
"o1",
",",
"Object",
"o2",
",",
"Object",
"o3",
",",
"Object",
"...",
"objects",
")",
"{",
"NPE",
"(",
"o1",
",",
"o2",
",",
"o3",
")",
";",
"for",
"(",
"Object",
"o",
":",
"objects",
")",
"{",
... | Throw out NullPointerException if any one of the passed objects is null.
@param o1
the first object to be evaluated
@param o2
the second object to be evaluated
@param o3
the third object to be evaluated
@param objects
other object instances to be evaluated | [
"Throw",
"out",
"NullPointerException",
"if",
"any",
"one",
"of",
"the",
"passed",
"objects",
"is",
"null",
"."
] | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/E.java#L150-L157 |
Azure/azure-sdk-for-java | resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/DeploymentOperationsInner.java | DeploymentOperationsInner.getAsync | public Observable<DeploymentOperationInner> getAsync(String resourceGroupName, String deploymentName, String operationId) {
return getWithServiceResponseAsync(resourceGroupName, deploymentName, operationId).map(new Func1<ServiceResponse<DeploymentOperationInner>, DeploymentOperationInner>() {
@Override
public DeploymentOperationInner call(ServiceResponse<DeploymentOperationInner> response) {
return response.body();
}
});
} | java | public Observable<DeploymentOperationInner> getAsync(String resourceGroupName, String deploymentName, String operationId) {
return getWithServiceResponseAsync(resourceGroupName, deploymentName, operationId).map(new Func1<ServiceResponse<DeploymentOperationInner>, DeploymentOperationInner>() {
@Override
public DeploymentOperationInner call(ServiceResponse<DeploymentOperationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DeploymentOperationInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"deploymentName",
",",
"String",
"operationId",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"deploymentName",... | Gets a deployments operation.
@param resourceGroupName The name of the resource group. The name is case insensitive.
@param deploymentName The name of the deployment.
@param operationId The ID of the operation to get.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DeploymentOperationInner object | [
"Gets",
"a",
"deployments",
"operation",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/DeploymentOperationsInner.java#L112-L119 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java | ContinuousDistributions.exponentialCdf | public static double exponentialCdf(double x, double lamda) {
if(x<0 || lamda<=0) {
throw new IllegalArgumentException("All the parameters must be positive.");
}
double probability = 1.0 - Math.exp(-lamda*x);
return probability;
} | java | public static double exponentialCdf(double x, double lamda) {
if(x<0 || lamda<=0) {
throw new IllegalArgumentException("All the parameters must be positive.");
}
double probability = 1.0 - Math.exp(-lamda*x);
return probability;
} | [
"public",
"static",
"double",
"exponentialCdf",
"(",
"double",
"x",
",",
"double",
"lamda",
")",
"{",
"if",
"(",
"x",
"<",
"0",
"||",
"lamda",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"All the parameters must be positive.\"",
")"... | Calculates the probability from 0 to X under Exponential Distribution
@param x
@param lamda
@return | [
"Calculates",
"the",
"probability",
"from",
"0",
"to",
"X",
"under",
"Exponential",
"Distribution"
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java#L195-L203 |
JodaOrg/joda-convert | src/main/java/org/joda/convert/StringConvert.java | StringConvert.loadType | static Class<?> loadType(String fullName) throws ClassNotFoundException {
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
return loader != null ? loader.loadClass(fullName) : Class.forName(fullName);
} catch (ClassNotFoundException ex) {
return loadPrimitiveType(fullName, ex);
}
} | java | static Class<?> loadType(String fullName) throws ClassNotFoundException {
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
return loader != null ? loader.loadClass(fullName) : Class.forName(fullName);
} catch (ClassNotFoundException ex) {
return loadPrimitiveType(fullName, ex);
}
} | [
"static",
"Class",
"<",
"?",
">",
"loadType",
"(",
"String",
"fullName",
")",
"throws",
"ClassNotFoundException",
"{",
"try",
"{",
"ClassLoader",
"loader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"return",
... | loads a type avoiding nulls, context class loader if available | [
"loads",
"a",
"type",
"avoiding",
"nulls",
"context",
"class",
"loader",
"if",
"available"
] | train | https://github.com/JodaOrg/joda-convert/blob/266bd825f4550590d5dafdf4225c548559e0633b/src/main/java/org/joda/convert/StringConvert.java#L854-L861 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/internal/ParseUtils.java | ParseUtils.parseQueryString | public static void parseQueryString( String str, Map res, String encoding )
{
// "Within the query string, the plus sign is reserved as
// shorthand notation for a space. Therefore, real plus signs must
// be encoded. This method was used to make query URIs easier to
// pass in systems which did not allow spaces." -- RFC 1630
int i = str.indexOf( '#' );
if ( i > 0 )
{
str = str.substring( 0, i );
}
StringTokenizer st = new StringTokenizer( str.replace( '+', ' ' ), "&" );
while ( st.hasMoreTokens() )
{
String qp = st.nextToken();
String[] pair = qp.split( "=" ); // was String[] pair = StringUtils.split(qp, '=');
//String s = unescape(pair[1], encoding);
res.put( unescape( pair[0], encoding ), unescape( pair[1], encoding ) );
}
} | java | public static void parseQueryString( String str, Map res, String encoding )
{
// "Within the query string, the plus sign is reserved as
// shorthand notation for a space. Therefore, real plus signs must
// be encoded. This method was used to make query URIs easier to
// pass in systems which did not allow spaces." -- RFC 1630
int i = str.indexOf( '#' );
if ( i > 0 )
{
str = str.substring( 0, i );
}
StringTokenizer st = new StringTokenizer( str.replace( '+', ' ' ), "&" );
while ( st.hasMoreTokens() )
{
String qp = st.nextToken();
String[] pair = qp.split( "=" ); // was String[] pair = StringUtils.split(qp, '=');
//String s = unescape(pair[1], encoding);
res.put( unescape( pair[0], encoding ), unescape( pair[1], encoding ) );
}
} | [
"public",
"static",
"void",
"parseQueryString",
"(",
"String",
"str",
",",
"Map",
"res",
",",
"String",
"encoding",
")",
"{",
"// \"Within the query string, the plus sign is reserved as",
"// shorthand notation for a space. Therefore, real plus signs must",
"// be encoded. This met... | Parses an RFC1630 query string into an existing Map.
@param str Query string
@param res Map into which insert the values.
@param encoding Encoding to be used for stored Strings | [
"Parses",
"an",
"RFC1630",
"query",
"string",
"into",
"an",
"existing",
"Map",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/internal/ParseUtils.java#L38-L59 |
Whiley/WhileyCompiler | src/main/java/wyil/interpreter/Interpreter.java | Interpreter.executeIf | private Status executeIf(Stmt.IfElse stmt, CallStack frame, EnclosingScope scope) {
RValue.Bool operand = executeExpression(BOOL_T, stmt.getCondition(), frame);
if (operand == RValue.True) {
// branch taken, so execute true branch
return executeBlock(stmt.getTrueBranch(), frame, scope);
} else if (stmt.hasFalseBranch()) {
// branch not taken, so execute false branch
return executeBlock(stmt.getFalseBranch(), frame, scope);
} else {
return Status.NEXT;
}
} | java | private Status executeIf(Stmt.IfElse stmt, CallStack frame, EnclosingScope scope) {
RValue.Bool operand = executeExpression(BOOL_T, stmt.getCondition(), frame);
if (operand == RValue.True) {
// branch taken, so execute true branch
return executeBlock(stmt.getTrueBranch(), frame, scope);
} else if (stmt.hasFalseBranch()) {
// branch not taken, so execute false branch
return executeBlock(stmt.getFalseBranch(), frame, scope);
} else {
return Status.NEXT;
}
} | [
"private",
"Status",
"executeIf",
"(",
"Stmt",
".",
"IfElse",
"stmt",
",",
"CallStack",
"frame",
",",
"EnclosingScope",
"scope",
")",
"{",
"RValue",
".",
"Bool",
"operand",
"=",
"executeExpression",
"(",
"BOOL_T",
",",
"stmt",
".",
"getCondition",
"(",
")",
... | Execute an if statement at a given point in the function or method body.
This will proceed done either the true or false branch.
@param stmt
--- The if statement to execute
@param frame
--- The current stack frame
@return | [
"Execute",
"an",
"if",
"statement",
"at",
"a",
"given",
"point",
"in",
"the",
"function",
"or",
"method",
"body",
".",
"This",
"will",
"proceed",
"done",
"either",
"the",
"true",
"or",
"false",
"branch",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L380-L391 |
line/armeria | core/src/main/java/com/linecorp/armeria/common/util/EventLoopGroups.java | EventLoopGroups.newEventLoopGroup | public static EventLoopGroup newEventLoopGroup(int numThreads, ThreadFactory threadFactory) {
checkArgument(numThreads > 0, "numThreads: %s (expected: > 0)", numThreads);
requireNonNull(threadFactory, "threadFactory");
final TransportType type = TransportType.detectTransportType();
return type.newEventLoopGroup(numThreads, unused -> threadFactory);
} | java | public static EventLoopGroup newEventLoopGroup(int numThreads, ThreadFactory threadFactory) {
checkArgument(numThreads > 0, "numThreads: %s (expected: > 0)", numThreads);
requireNonNull(threadFactory, "threadFactory");
final TransportType type = TransportType.detectTransportType();
return type.newEventLoopGroup(numThreads, unused -> threadFactory);
} | [
"public",
"static",
"EventLoopGroup",
"newEventLoopGroup",
"(",
"int",
"numThreads",
",",
"ThreadFactory",
"threadFactory",
")",
"{",
"checkArgument",
"(",
"numThreads",
">",
"0",
",",
"\"numThreads: %s (expected: > 0)\"",
",",
"numThreads",
")",
";",
"requireNonNull",
... | Returns a newly-created {@link EventLoopGroup}.
@param numThreads the number of event loop threads
@param threadFactory the factory of event loop threads | [
"Returns",
"a",
"newly",
"-",
"created",
"{",
"@link",
"EventLoopGroup",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/util/EventLoopGroups.java#L101-L108 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/ExtendedAnswerProvider.java | ExtendedAnswerProvider.addJsonObjectToKitEvent | private void addJsonObjectToKitEvent(KitEvent kitEvent, JSONObject jsonData, String keyPathPrepend) throws JSONException {
Iterator<String> keyIterator = jsonData.keys();
while (keyIterator.hasNext()) {
String key = keyIterator.next();
Object value = jsonData.get(key);
if (!key.startsWith(EXTRA_PARAM_NOTATION)) {
if (value instanceof JSONObject) {
addJsonObjectToKitEvent(kitEvent, (JSONObject) value, keyPathPrepend + key + INNER_PARAM_NOTATION);
} else if (value instanceof JSONArray) {
addJsonArrayToKitEvent(kitEvent, (JSONArray) value, key + INNER_PARAM_NOTATION);
} else {
addBranchAttributes(kitEvent, keyPathPrepend, key, jsonData.getString(key));
}
}
}
} | java | private void addJsonObjectToKitEvent(KitEvent kitEvent, JSONObject jsonData, String keyPathPrepend) throws JSONException {
Iterator<String> keyIterator = jsonData.keys();
while (keyIterator.hasNext()) {
String key = keyIterator.next();
Object value = jsonData.get(key);
if (!key.startsWith(EXTRA_PARAM_NOTATION)) {
if (value instanceof JSONObject) {
addJsonObjectToKitEvent(kitEvent, (JSONObject) value, keyPathPrepend + key + INNER_PARAM_NOTATION);
} else if (value instanceof JSONArray) {
addJsonArrayToKitEvent(kitEvent, (JSONArray) value, key + INNER_PARAM_NOTATION);
} else {
addBranchAttributes(kitEvent, keyPathPrepend, key, jsonData.getString(key));
}
}
}
} | [
"private",
"void",
"addJsonObjectToKitEvent",
"(",
"KitEvent",
"kitEvent",
",",
"JSONObject",
"jsonData",
",",
"String",
"keyPathPrepend",
")",
"throws",
"JSONException",
"{",
"Iterator",
"<",
"String",
">",
"keyIterator",
"=",
"jsonData",
".",
"keys",
"(",
")",
... | <p>
Converts the given JsonObject to key-value pairs and update the {@link KitEvent}
</p>
@param kitEvent {@link KitEvent} to update with key-value pairs from the JsonObject
@param jsonData {@link JSONObject} to add to the {@link KitEvent}
@param keyPathPrepend {@link String} with value to prepend to the keys adding to the {@link KitEvent}
@throws JSONException {@link JSONException} on any Json converting errors | [
"<p",
">",
"Converts",
"the",
"given",
"JsonObject",
"to",
"key",
"-",
"value",
"pairs",
"and",
"update",
"the",
"{",
"@link",
"KitEvent",
"}",
"<",
"/",
"p",
">"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/ExtendedAnswerProvider.java#L63-L79 |
apache/incubator-gobblin | gobblin-api/src/main/java/org/apache/gobblin/publisher/SingleTaskDataPublisher.java | SingleTaskDataPublisher.getInstance | public static SingleTaskDataPublisher getInstance(Class<? extends DataPublisher> dataPublisherClass, State state)
throws ReflectiveOperationException {
Preconditions.checkArgument(SingleTaskDataPublisher.class.isAssignableFrom(dataPublisherClass),
String.format("Cannot instantiate %s since it does not extend %s", dataPublisherClass.getSimpleName(),
SingleTaskDataPublisher.class.getSimpleName()));
return (SingleTaskDataPublisher) DataPublisher.getInstance(dataPublisherClass, state);
} | java | public static SingleTaskDataPublisher getInstance(Class<? extends DataPublisher> dataPublisherClass, State state)
throws ReflectiveOperationException {
Preconditions.checkArgument(SingleTaskDataPublisher.class.isAssignableFrom(dataPublisherClass),
String.format("Cannot instantiate %s since it does not extend %s", dataPublisherClass.getSimpleName(),
SingleTaskDataPublisher.class.getSimpleName()));
return (SingleTaskDataPublisher) DataPublisher.getInstance(dataPublisherClass, state);
} | [
"public",
"static",
"SingleTaskDataPublisher",
"getInstance",
"(",
"Class",
"<",
"?",
"extends",
"DataPublisher",
">",
"dataPublisherClass",
",",
"State",
"state",
")",
"throws",
"ReflectiveOperationException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"SingleTas... | Get an instance of {@link SingleTaskDataPublisher}.
@param dataPublisherClass A concrete class that extends {@link SingleTaskDataPublisher}.
@param state A {@link State} used to instantiate the {@link SingleTaskDataPublisher}.
@return A {@link SingleTaskDataPublisher} instance.
@throws ReflectiveOperationException | [
"Get",
"an",
"instance",
"of",
"{",
"@link",
"SingleTaskDataPublisher",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/publisher/SingleTaskDataPublisher.java#L70-L77 |
apache/groovy | subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java | SwingGroovyMethods.leftShift | public static JPopupMenu leftShift(JPopupMenu self, Action action) {
self.add(action);
return self;
} | java | public static JPopupMenu leftShift(JPopupMenu self, Action action) {
self.add(action);
return self;
} | [
"public",
"static",
"JPopupMenu",
"leftShift",
"(",
"JPopupMenu",
"self",
",",
"Action",
"action",
")",
"{",
"self",
".",
"add",
"(",
"action",
")",
";",
"return",
"self",
";",
"}"
] | Overloads the left shift operator to provide an easy way to add
components to a popupMenu.<p>
@param self a JPopupMenu
@param action an action to be added to the popupMenu.
@return same popupMenu, after the value was added to it.
@since 1.6.4 | [
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"easy",
"way",
"to",
"add",
"components",
"to",
"a",
"popupMenu",
".",
"<p",
">"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L896-L899 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMaterial.java | GVRMaterial.setDiffuseColor | public void setDiffuseColor(float r, float g, float b, float a) {
setVec4("diffuse_color", r, g, b, a);
} | java | public void setDiffuseColor(float r, float g, float b, float a) {
setVec4("diffuse_color", r, g, b, a);
} | [
"public",
"void",
"setDiffuseColor",
"(",
"float",
"r",
",",
"float",
"g",
",",
"float",
"b",
",",
"float",
"a",
")",
"{",
"setVec4",
"(",
"\"diffuse_color\"",
",",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
";",
"}"
] | Set the {@code diffuse_color} uniform for lighting.
By convention, GVRF shaders can use a {@code vec4} uniform named
{@code diffuse_color}. With the {@linkplain GVRShaderType.Texture
shader,} this allows you to add an overlay diffuse light color on
top of the texture. Values are between {@code 0.0f} and {@code 1.0f},
inclusive.
@param r
Red
@param g
Green
@param b
Blue
@param a
Alpha | [
"Set",
"the",
"{",
"@code",
"diffuse_color",
"}",
"uniform",
"for",
"lighting",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMaterial.java#L446-L448 |
square/javapoet | src/main/java/com/squareup/javapoet/ParameterizedTypeName.java | ParameterizedTypeName.get | public static ParameterizedTypeName get(ClassName rawType, TypeName... typeArguments) {
return new ParameterizedTypeName(null, rawType, Arrays.asList(typeArguments));
} | java | public static ParameterizedTypeName get(ClassName rawType, TypeName... typeArguments) {
return new ParameterizedTypeName(null, rawType, Arrays.asList(typeArguments));
} | [
"public",
"static",
"ParameterizedTypeName",
"get",
"(",
"ClassName",
"rawType",
",",
"TypeName",
"...",
"typeArguments",
")",
"{",
"return",
"new",
"ParameterizedTypeName",
"(",
"null",
",",
"rawType",
",",
"Arrays",
".",
"asList",
"(",
"typeArguments",
")",
")... | Returns a parameterized type, applying {@code typeArguments} to {@code rawType}. | [
"Returns",
"a",
"parameterized",
"type",
"applying",
"{"
] | train | https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/ParameterizedTypeName.java#L113-L115 |
passwordmaker/java-passwordmaker-lib | src/main/java/org/daveware/passwordmaker/Account.java | Account.getChild | public Account getChild(int index) throws IndexOutOfBoundsException {
if (index < 0 || index >= children.size())
throw new IndexOutOfBoundsException("Illegal child index, " + index);
return children.get(index);
} | java | public Account getChild(int index) throws IndexOutOfBoundsException {
if (index < 0 || index >= children.size())
throw new IndexOutOfBoundsException("Illegal child index, " + index);
return children.get(index);
} | [
"public",
"Account",
"getChild",
"(",
"int",
"index",
")",
"throws",
"IndexOutOfBoundsException",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"children",
".",
"size",
"(",
")",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Illegal child... | Gets a specifically indexed child.
@param index The index of the child to get.
@return The child at the index.
@throws IndexOutOfBoundsException upon invalid index. | [
"Gets",
"a",
"specifically",
"indexed",
"child",
"."
] | train | https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/Account.java#L617-L621 |
pressgang-ccms/PressGangCCMSQuery | src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java | BaseFilterQueryBuilder.addLikeIgnoresCaseCondition | protected void addLikeIgnoresCaseCondition(final String propertyName, final String value) {
final Expression<String> propertyNameField = getCriteriaBuilder().lower(getRootPath().get(propertyName).as(String.class));
fieldConditions.add(getCriteriaBuilder().like(propertyNameField, "%" + cleanLikeCondition(value).toLowerCase() + "%"));
} | java | protected void addLikeIgnoresCaseCondition(final String propertyName, final String value) {
final Expression<String> propertyNameField = getCriteriaBuilder().lower(getRootPath().get(propertyName).as(String.class));
fieldConditions.add(getCriteriaBuilder().like(propertyNameField, "%" + cleanLikeCondition(value).toLowerCase() + "%"));
} | [
"protected",
"void",
"addLikeIgnoresCaseCondition",
"(",
"final",
"String",
"propertyName",
",",
"final",
"String",
"value",
")",
"{",
"final",
"Expression",
"<",
"String",
">",
"propertyNameField",
"=",
"getCriteriaBuilder",
"(",
")",
".",
"lower",
"(",
"getRootP... | Add a Field Search Condition that will search a field for a specified value using the following SQL logic:
{@code LOWER(field) LIKE LOWER('%value%')}
@param propertyName The name of the field as defined in the Entity mapping class.
@param value The value to search against. | [
"Add",
"a",
"Field",
"Search",
"Condition",
"that",
"will",
"search",
"a",
"field",
"for",
"a",
"specified",
"value",
"using",
"the",
"following",
"SQL",
"logic",
":",
"{",
"@code",
"LOWER",
"(",
"field",
")",
"LIKE",
"LOWER",
"(",
"%value%",
")",
"}"
] | train | https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L223-L226 |
FINRAOS/DataGenerator | dg-core/src/main/java/org/finra/datagenerator/engine/scxml/tags/boundary/BoundaryDate.java | BoundaryDate.getNextDay | public String getNextDay(String dateString, boolean onlyBusinessDays) {
DateTimeFormatter parser = ISODateTimeFormat.date();
DateTime date = parser.parseDateTime(dateString).plusDays(1);
Calendar cal = Calendar.getInstance();
cal.setTime(date.toDate());
if (onlyBusinessDays) {
if (cal.get(Calendar.DAY_OF_WEEK) == 1 || cal.get(Calendar.DAY_OF_WEEK) == 7
|| isHoliday(date.toString().substring(0, 10))) {
return getNextDay(date.toString().substring(0, 10), true);
} else {
return parser.print(date);
}
} else {
return parser.print(date);
}
} | java | public String getNextDay(String dateString, boolean onlyBusinessDays) {
DateTimeFormatter parser = ISODateTimeFormat.date();
DateTime date = parser.parseDateTime(dateString).plusDays(1);
Calendar cal = Calendar.getInstance();
cal.setTime(date.toDate());
if (onlyBusinessDays) {
if (cal.get(Calendar.DAY_OF_WEEK) == 1 || cal.get(Calendar.DAY_OF_WEEK) == 7
|| isHoliday(date.toString().substring(0, 10))) {
return getNextDay(date.toString().substring(0, 10), true);
} else {
return parser.print(date);
}
} else {
return parser.print(date);
}
} | [
"public",
"String",
"getNextDay",
"(",
"String",
"dateString",
",",
"boolean",
"onlyBusinessDays",
")",
"{",
"DateTimeFormatter",
"parser",
"=",
"ISODateTimeFormat",
".",
"date",
"(",
")",
";",
"DateTime",
"date",
"=",
"parser",
".",
"parseDateTime",
"(",
"dateS... | Takes a date, and retrieves the next business day
@param dateString the date
@param onlyBusinessDays only business days
@return a string containing the next business day | [
"Takes",
"a",
"date",
"and",
"retrieves",
"the",
"next",
"business",
"day"
] | train | https://github.com/FINRAOS/DataGenerator/blob/1f69f949401cbed4db4f553c3eb8350832c4d45a/dg-core/src/main/java/org/finra/datagenerator/engine/scxml/tags/boundary/BoundaryDate.java#L98-L114 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/lang/AtomicBiInteger.java | AtomicBiInteger.compareAndSetHi | public boolean compareAndSetHi(int expectHi, int hi) {
while (true) {
long encoded = get();
if (getHi(encoded) != expectHi)
return false;
long update = encodeHi(encoded, hi);
if (compareAndSet(encoded, update))
return true;
}
} | java | public boolean compareAndSetHi(int expectHi, int hi) {
while (true) {
long encoded = get();
if (getHi(encoded) != expectHi)
return false;
long update = encodeHi(encoded, hi);
if (compareAndSet(encoded, update))
return true;
}
} | [
"public",
"boolean",
"compareAndSetHi",
"(",
"int",
"expectHi",
",",
"int",
"hi",
")",
"{",
"while",
"(",
"true",
")",
"{",
"long",
"encoded",
"=",
"get",
"(",
")",
";",
"if",
"(",
"getHi",
"(",
"encoded",
")",
"!=",
"expectHi",
")",
"return",
"false... | <p>Atomically sets the hi value to the given updated value
only if the current value {@code ==} the expected value.</p>
<p>Concurrent changes to the lo value result in a retry.</p>
@param expectHi the expected hi value
@param hi the new hi value
@return {@code true} if successful. False return indicates that
the actual hi value was not equal to the expected hi value. | [
"<p",
">",
"Atomically",
"sets",
"the",
"hi",
"value",
"to",
"the",
"given",
"updated",
"value",
"only",
"if",
"the",
"current",
"value",
"{",
"@code",
"==",
"}",
"the",
"expected",
"value",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Concurrent",
"changes",
... | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/AtomicBiInteger.java#L73-L82 |
h2oai/h2o-3 | h2o-core/src/main/java/water/fvec/CStrChunk.java | CStrChunk.asciiSubstring | public NewChunk asciiSubstring(NewChunk nc, int startIndex, int endIndex) {
// copy existing data
nc = this.extractRows(nc, 0,_len);
//update offsets and byte array
for (int i = 0; i < _len; i++) {
int off = UnsafeUtils.get4(_mem, idx(i));
if (off != NA) {
int len = 0;
while (_mem[_valstart + off + len] != 0) len++; //Find length
nc.set_is(i,startIndex < len ? off + startIndex : off + len);
for (; len > endIndex - 1; len--) {
nc._ss[off + len] = 0; //Set new end
}
}
}
return nc;
} | java | public NewChunk asciiSubstring(NewChunk nc, int startIndex, int endIndex) {
// copy existing data
nc = this.extractRows(nc, 0,_len);
//update offsets and byte array
for (int i = 0; i < _len; i++) {
int off = UnsafeUtils.get4(_mem, idx(i));
if (off != NA) {
int len = 0;
while (_mem[_valstart + off + len] != 0) len++; //Find length
nc.set_is(i,startIndex < len ? off + startIndex : off + len);
for (; len > endIndex - 1; len--) {
nc._ss[off + len] = 0; //Set new end
}
}
}
return nc;
} | [
"public",
"NewChunk",
"asciiSubstring",
"(",
"NewChunk",
"nc",
",",
"int",
"startIndex",
",",
"int",
"endIndex",
")",
"{",
"// copy existing data",
"nc",
"=",
"this",
".",
"extractRows",
"(",
"nc",
",",
"0",
",",
"_len",
")",
";",
"//update offsets and byte ar... | Optimized substring() method for a buffer of only ASCII characters.
The presence of UTF-8 multi-byte characters would give incorrect results
for the string length, which is required here.
@param nc NewChunk to be filled with substrings in this chunk
@param startIndex The beginning index of the substring, inclusive
@param endIndex The ending index of the substring, exclusive
@return Filled NewChunk | [
"Optimized",
"substring",
"()",
"method",
"for",
"a",
"buffer",
"of",
"only",
"ASCII",
"characters",
".",
"The",
"presence",
"of",
"UTF",
"-",
"8",
"multi",
"-",
"byte",
"characters",
"would",
"give",
"incorrect",
"results",
"for",
"the",
"string",
"length",... | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/fvec/CStrChunk.java#L207-L223 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java | JDBC4CallableStatement.getTime | @Override
public Time getTime(int parameterIndex, Calendar cal) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java | @Override
public Time getTime(int parameterIndex, Calendar cal) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | [
"@",
"Override",
"public",
"Time",
"getTime",
"(",
"int",
"parameterIndex",
",",
"Calendar",
"cal",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"throw",
"SQLError",
".",
"noSupport",
"(",
")",
";",
"}"
] | Retrieves the value of the designated JDBC TIME parameter as a java.sql.Time object, using the given Calendar object to construct the time. | [
"Retrieves",
"the",
"value",
"of",
"the",
"designated",
"JDBC",
"TIME",
"parameter",
"as",
"a",
"java",
".",
"sql",
".",
"Time",
"object",
"using",
"the",
"given",
"Calendar",
"object",
"to",
"construct",
"the",
"time",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L447-L452 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.rotateAffine | public Matrix4d rotateAffine(double ang, double x, double y, double z) {
return rotateAffine(ang, x, y, z, this);
} | java | public Matrix4d rotateAffine(double ang, double x, double y, double z) {
return rotateAffine(ang, x, y, z, this);
} | [
"public",
"Matrix4d",
"rotateAffine",
"(",
"double",
"ang",
",",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"return",
"rotateAffine",
"(",
"ang",
",",
"x",
",",
"y",
",",
"z",
",",
"this",
")",
";",
"}"
] | Apply rotation to this {@link #isAffine() affine} matrix by rotating the given amount of radians
about the specified <code>(x, y, z)</code> axis.
<p>
This method assumes <code>this</code> to be {@link #isAffine() affine}.
<p>
The axis described by the three components needs to be a unit vector.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
In order to set the matrix to a rotation matrix without post-multiplying the rotation
transformation, use {@link #rotation(double, double, double, double) rotation()}.
<p>
Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a>
@see #rotation(double, double, double, double)
@param ang
the angle in radians
@param x
the x component of the axis
@param y
the y component of the axis
@param z
the z component of the axis
@return this | [
"Apply",
"rotation",
"to",
"this",
"{",
"@link",
"#isAffine",
"()",
"affine",
"}",
"matrix",
"by",
"rotating",
"the",
"given",
"amount",
"of",
"radians",
"about",
"the",
"specified",
"<code",
">",
"(",
"x",
"y",
"z",
")",
"<",
"/",
"code",
">",
"axis",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L4975-L4977 |
rzwitserloot/lombok | src/core/lombok/eclipse/handlers/HandleSuperBuilder.java | HandleSuperBuilder.generateFillValuesMethod | private MethodDeclaration generateFillValuesMethod(EclipseNode tdParent, boolean inherited, String builderGenericName, String classGenericName, String builderClassName, TypeParameter[] typeParams) {
MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) tdParent.top().get()).compilationResult);
out.selector = FILL_VALUES_METHOD_NAME;
out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
out.modifiers = ClassFileConstants.AccProtected;
if (inherited) out.annotations = new Annotation[] {makeMarkerAnnotation(TypeConstants.JAVA_LANG_OVERRIDE, tdParent.get())};
out.returnType = new SingleTypeReference(builderGenericName.toCharArray(), 0);
TypeReference builderType = new SingleTypeReference(classGenericName.toCharArray(), 0);
out.arguments = new Argument[] {new Argument(INSTANCE_VARIABLE_NAME, 0, builderType, Modifier.FINAL)};
List<Statement> body = new ArrayList<Statement>();
if (inherited) {
// Call super.
MessageSend callToSuper = new MessageSend();
callToSuper.receiver = new SuperReference(0, 0);
callToSuper.selector = FILL_VALUES_METHOD_NAME;
callToSuper.arguments = new Expression[] {new SingleNameReference(INSTANCE_VARIABLE_NAME, 0)};
body.add(callToSuper);
}
// Call the builder implemention's helper method that actually fills the values from the instance.
MessageSend callStaticFillValuesMethod = new MessageSend();
callStaticFillValuesMethod.receiver = new SingleNameReference(builderClassName.toCharArray(), 0);
callStaticFillValuesMethod.selector = FILL_VALUES_STATIC_METHOD_NAME;
callStaticFillValuesMethod.arguments = new Expression[] {new SingleNameReference(INSTANCE_VARIABLE_NAME, 0), new ThisReference(0, 0)};
body.add(callStaticFillValuesMethod);
// Return self().
MessageSend returnCall = new MessageSend();
returnCall.receiver = ThisReference.implicitThis();
returnCall.selector = SELF_METHOD_NAME;
body.add(new ReturnStatement(returnCall, 0, 0));
out.statements = body.isEmpty() ? null : body.toArray(new Statement[0]);
return out;
} | java | private MethodDeclaration generateFillValuesMethod(EclipseNode tdParent, boolean inherited, String builderGenericName, String classGenericName, String builderClassName, TypeParameter[] typeParams) {
MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) tdParent.top().get()).compilationResult);
out.selector = FILL_VALUES_METHOD_NAME;
out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
out.modifiers = ClassFileConstants.AccProtected;
if (inherited) out.annotations = new Annotation[] {makeMarkerAnnotation(TypeConstants.JAVA_LANG_OVERRIDE, tdParent.get())};
out.returnType = new SingleTypeReference(builderGenericName.toCharArray(), 0);
TypeReference builderType = new SingleTypeReference(classGenericName.toCharArray(), 0);
out.arguments = new Argument[] {new Argument(INSTANCE_VARIABLE_NAME, 0, builderType, Modifier.FINAL)};
List<Statement> body = new ArrayList<Statement>();
if (inherited) {
// Call super.
MessageSend callToSuper = new MessageSend();
callToSuper.receiver = new SuperReference(0, 0);
callToSuper.selector = FILL_VALUES_METHOD_NAME;
callToSuper.arguments = new Expression[] {new SingleNameReference(INSTANCE_VARIABLE_NAME, 0)};
body.add(callToSuper);
}
// Call the builder implemention's helper method that actually fills the values from the instance.
MessageSend callStaticFillValuesMethod = new MessageSend();
callStaticFillValuesMethod.receiver = new SingleNameReference(builderClassName.toCharArray(), 0);
callStaticFillValuesMethod.selector = FILL_VALUES_STATIC_METHOD_NAME;
callStaticFillValuesMethod.arguments = new Expression[] {new SingleNameReference(INSTANCE_VARIABLE_NAME, 0), new ThisReference(0, 0)};
body.add(callStaticFillValuesMethod);
// Return self().
MessageSend returnCall = new MessageSend();
returnCall.receiver = ThisReference.implicitThis();
returnCall.selector = SELF_METHOD_NAME;
body.add(new ReturnStatement(returnCall, 0, 0));
out.statements = body.isEmpty() ? null : body.toArray(new Statement[0]);
return out;
} | [
"private",
"MethodDeclaration",
"generateFillValuesMethod",
"(",
"EclipseNode",
"tdParent",
",",
"boolean",
"inherited",
",",
"String",
"builderGenericName",
",",
"String",
"classGenericName",
",",
"String",
"builderClassName",
",",
"TypeParameter",
"[",
"]",
"typeParams"... | Generates a <code>$fillValuesFrom()</code> method in the abstract builder class that looks
like this:
<pre>
protected B $fillValuesFrom(final C instance) {
super.$fillValuesFrom(instance);
FoobarBuilderImpl.$fillValuesFromInstanceIntoBuilder(instance, this);
return self();
}
</pre> | [
"Generates",
"a",
"<code",
">",
"$fillValuesFrom",
"()",
"<",
"/",
"code",
">",
"method",
"in",
"the",
"abstract",
"builder",
"class",
"that",
"looks",
"like",
"this",
":",
"<pre",
">",
"protected",
"B",
"$fillValuesFrom",
"(",
"final",
"C",
"instance",
")... | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java#L637-L675 |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/Main.java | Main.prepareWindowsCommand | private static String prepareWindowsCommand(List<String> cmd, Map<String, String> childEnv) {
StringBuilder cmdline = new StringBuilder();
for (Map.Entry<String, String> e : childEnv.entrySet()) {
cmdline.append(String.format("set %s=%s", e.getKey(), e.getValue()));
cmdline.append(" && ");
}
for (String arg : cmd) {
cmdline.append(quoteForBatchScript(arg));
cmdline.append(" ");
}
return cmdline.toString();
} | java | private static String prepareWindowsCommand(List<String> cmd, Map<String, String> childEnv) {
StringBuilder cmdline = new StringBuilder();
for (Map.Entry<String, String> e : childEnv.entrySet()) {
cmdline.append(String.format("set %s=%s", e.getKey(), e.getValue()));
cmdline.append(" && ");
}
for (String arg : cmd) {
cmdline.append(quoteForBatchScript(arg));
cmdline.append(" ");
}
return cmdline.toString();
} | [
"private",
"static",
"String",
"prepareWindowsCommand",
"(",
"List",
"<",
"String",
">",
"cmd",
",",
"Map",
"<",
"String",
",",
"String",
">",
"childEnv",
")",
"{",
"StringBuilder",
"cmdline",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Map",
... | Prepare a command line for execution from a Windows batch script.
The method quotes all arguments so that spaces are handled as expected. Quotes within arguments
are "double quoted" (which is batch for escaping a quote). This page has more details about
quoting and other batch script fun stuff: http://ss64.com/nt/syntax-esc.html | [
"Prepare",
"a",
"command",
"line",
"for",
"execution",
"from",
"a",
"Windows",
"batch",
"script",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/Main.java#L125-L136 |
antlrjavaparser/antlr-java-parser | src/main/java/com/github/antlrjavaparser/ASTHelper.java | ASTHelper.addParameter | public static void addParameter(MethodDeclaration method, Parameter parameter) {
List<Parameter> parameters = method.getParameters();
if (parameters == null) {
parameters = new ArrayList<Parameter>();
method.setParameters(parameters);
}
parameters.add(parameter);
} | java | public static void addParameter(MethodDeclaration method, Parameter parameter) {
List<Parameter> parameters = method.getParameters();
if (parameters == null) {
parameters = new ArrayList<Parameter>();
method.setParameters(parameters);
}
parameters.add(parameter);
} | [
"public",
"static",
"void",
"addParameter",
"(",
"MethodDeclaration",
"method",
",",
"Parameter",
"parameter",
")",
"{",
"List",
"<",
"Parameter",
">",
"parameters",
"=",
"method",
".",
"getParameters",
"(",
")",
";",
"if",
"(",
"parameters",
"==",
"null",
"... | Adds the given parameter to the method. The list of parameters will be
initialized if it is <code>null</code>.
@param method
method
@param parameter
parameter | [
"Adds",
"the",
"given",
"parameter",
"to",
"the",
"method",
".",
"The",
"list",
"of",
"parameters",
"will",
"be",
"initialized",
"if",
"it",
"is",
"<code",
">",
"null<",
"/",
"code",
">",
"."
] | train | https://github.com/antlrjavaparser/antlr-java-parser/blob/077160deb44d952c40c442800abd91af7e6fe006/src/main/java/com/github/antlrjavaparser/ASTHelper.java#L166-L173 |
mapbox/mapbox-plugins-android | plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java | OfflinePlugin.errorDownload | void errorDownload(OfflineDownloadOptions offlineDownload, String error, String errorMessage) {
stateChangeDispatcher.onError(offlineDownload, error, errorMessage);
offlineDownloads.remove(offlineDownload);
} | java | void errorDownload(OfflineDownloadOptions offlineDownload, String error, String errorMessage) {
stateChangeDispatcher.onError(offlineDownload, error, errorMessage);
offlineDownloads.remove(offlineDownload);
} | [
"void",
"errorDownload",
"(",
"OfflineDownloadOptions",
"offlineDownload",
",",
"String",
"error",
",",
"String",
"errorMessage",
")",
"{",
"stateChangeDispatcher",
".",
"onError",
"(",
"offlineDownload",
",",
"error",
",",
"errorMessage",
")",
";",
"offlineDownloads"... | Called when the OfflineDownloadService produced an error while downloading
@param offlineDownload the offline download that produced an error
@param error short description of the error
@param errorMessage full description of the error
@since 0.1.0 | [
"Called",
"when",
"the",
"OfflineDownloadService",
"produced",
"an",
"error",
"while",
"downloading"
] | train | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java#L186-L189 |
eurekaclinical/eurekaclinical-common | src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java | EurekaClinicalClient.doPostCreate | protected URI doPostCreate(String path, Object o) throws ClientException {
return doPostCreate(path, o, null);
} | java | protected URI doPostCreate(String path, Object o) throws ClientException {
return doPostCreate(path, o, null);
} | [
"protected",
"URI",
"doPostCreate",
"(",
"String",
"path",
",",
"Object",
"o",
")",
"throws",
"ClientException",
"{",
"return",
"doPostCreate",
"(",
"path",
",",
"o",
",",
"null",
")",
";",
"}"
] | Creates a resource specified as a JSON object. Adds appropriate Accepts
and Content Type headers.
@param path the the API to call.
@param o the object that will be converted to JSON for sending. Must
either be a Java bean or be recognized by the object mapper.
@return the URI representing the created resource, for use in subsequent
operations on the resource.
@throws ClientException if a status code other than 201 (Created) is
returned. | [
"Creates",
"a",
"resource",
"specified",
"as",
"a",
"JSON",
"object",
".",
"Adds",
"appropriate",
"Accepts",
"and",
"Content",
"Type",
"headers",
"."
] | train | https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L737-L739 |
CrawlScript/WebCollector | src/main/java/cn/edu/hfut/dmic/webcollector/crawler/Crawler.java | Crawler.addSeed | public void addSeed(Iterable<String> links, String type, boolean force) {
addSeedAndReturn(links, force).type(type);
} | java | public void addSeed(Iterable<String> links, String type, boolean force) {
addSeedAndReturn(links, force).type(type);
} | [
"public",
"void",
"addSeed",
"(",
"Iterable",
"<",
"String",
">",
"links",
",",
"String",
"type",
",",
"boolean",
"force",
")",
"{",
"addSeedAndReturn",
"(",
"links",
",",
"force",
")",
".",
"type",
"(",
"type",
")",
";",
"}"
] | 与addSeed(CrawlDatums datums, boolean force) 类似
@param links 种子URL集合
@param type 种子的type标识信息
@param force 是否强制注入 | [
"与addSeed",
"(",
"CrawlDatums",
"datums",
"boolean",
"force",
")",
"类似"
] | train | https://github.com/CrawlScript/WebCollector/blob/4ca71ec0e69d354feaf64319d76e64663159902d/src/main/java/cn/edu/hfut/dmic/webcollector/crawler/Crawler.java#L210-L212 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/xmlhelpers/ContextXmlReader.java | ContextXmlReader.readContextPassword | private String readContextPassword(XMLEventReader reader)
throws JournalException, XMLStreamException {
XMLEvent startTag = readStartTag(reader, QNAME_TAG_PASSWORD);
passwordType =
getOptionalAttributeValue(startTag.asStartElement(),
QNAME_ATTR_PASSWORD_TYPE);
return readCharactersUntilEndTag(reader, QNAME_TAG_PASSWORD);
} | java | private String readContextPassword(XMLEventReader reader)
throws JournalException, XMLStreamException {
XMLEvent startTag = readStartTag(reader, QNAME_TAG_PASSWORD);
passwordType =
getOptionalAttributeValue(startTag.asStartElement(),
QNAME_ATTR_PASSWORD_TYPE);
return readCharactersUntilEndTag(reader, QNAME_TAG_PASSWORD);
} | [
"private",
"String",
"readContextPassword",
"(",
"XMLEventReader",
"reader",
")",
"throws",
"JournalException",
",",
"XMLStreamException",
"{",
"XMLEvent",
"startTag",
"=",
"readStartTag",
"(",
"reader",
",",
"QNAME_TAG_PASSWORD",
")",
";",
"passwordType",
"=",
"getOp... | Read the context password from XML. Note: While doing this, fetch the
password type, and store it to use when deciphering the password. Not the
cleanest structure, perhaps, but it will serve for now. | [
"Read",
"the",
"context",
"password",
"from",
"XML",
".",
"Note",
":",
"While",
"doing",
"this",
"fetch",
"the",
"password",
"type",
"and",
"store",
"it",
"to",
"use",
"when",
"deciphering",
"the",
"password",
".",
"Not",
"the",
"cleanest",
"structure",
"p... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/xmlhelpers/ContextXmlReader.java#L78-L85 |
joniles/mpxj | src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java | MapFileGenerator.processProperties | private void processProperties(XMLStreamWriter writer, Set<Method> methodSet, Class<?> aClass) throws IntrospectionException, XMLStreamException
{
BeanInfo beanInfo = Introspector.getBeanInfo(aClass, aClass.getSuperclass());
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (int i = 0; i < propertyDescriptors.length; i++)
{
PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
if (propertyDescriptor.getPropertyType() != null)
{
String name = propertyDescriptor.getName();
Method readMethod = propertyDescriptor.getReadMethod();
Method writeMethod = propertyDescriptor.getWriteMethod();
String readMethodName = readMethod == null ? null : readMethod.getName();
String writeMethodName = writeMethod == null ? null : writeMethod.getName();
addProperty(writer, name, propertyDescriptor.getPropertyType(), readMethodName, writeMethodName);
if (readMethod != null)
{
methodSet.add(readMethod);
}
if (writeMethod != null)
{
methodSet.add(writeMethod);
}
}
else
{
processAmbiguousProperty(writer, methodSet, aClass, propertyDescriptor);
}
}
} | java | private void processProperties(XMLStreamWriter writer, Set<Method> methodSet, Class<?> aClass) throws IntrospectionException, XMLStreamException
{
BeanInfo beanInfo = Introspector.getBeanInfo(aClass, aClass.getSuperclass());
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (int i = 0; i < propertyDescriptors.length; i++)
{
PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
if (propertyDescriptor.getPropertyType() != null)
{
String name = propertyDescriptor.getName();
Method readMethod = propertyDescriptor.getReadMethod();
Method writeMethod = propertyDescriptor.getWriteMethod();
String readMethodName = readMethod == null ? null : readMethod.getName();
String writeMethodName = writeMethod == null ? null : writeMethod.getName();
addProperty(writer, name, propertyDescriptor.getPropertyType(), readMethodName, writeMethodName);
if (readMethod != null)
{
methodSet.add(readMethod);
}
if (writeMethod != null)
{
methodSet.add(writeMethod);
}
}
else
{
processAmbiguousProperty(writer, methodSet, aClass, propertyDescriptor);
}
}
} | [
"private",
"void",
"processProperties",
"(",
"XMLStreamWriter",
"writer",
",",
"Set",
"<",
"Method",
">",
"methodSet",
",",
"Class",
"<",
"?",
">",
"aClass",
")",
"throws",
"IntrospectionException",
",",
"XMLStreamException",
"{",
"BeanInfo",
"beanInfo",
"=",
"I... | Process class properties.
@param writer output stream
@param methodSet set of methods processed
@param aClass class being processed
@throws IntrospectionException
@throws XMLStreamException | [
"Process",
"class",
"properties",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L205-L238 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/AbstractOverlayFormComponentInterceptor.java | AbstractOverlayFormComponentInterceptor.processComponent | @Override
public final void processComponent(String propertyName, final JComponent component) {
final AbstractOverlayHandler overlayHandler = this.createOverlayHandler(propertyName, component);
// Wait until has parent and overlay is correctly installed
final PropertyChangeListener wait4ParentListener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
final JComponent targetComponent = overlayHandler.getTargetComponent();
final JComponent overlay = overlayHandler.getOverlay();
// Install overlay
final int position = AbstractOverlayFormComponentInterceptor.this.getPosition();
final Boolean success = AbstractOverlayFormComponentInterceptor.this.//
getOverlayService().installOverlay(targetComponent, overlay, position, null);
if (success) {
targetComponent.removePropertyChangeListener(//
AbstractOverlayFormComponentInterceptor.ANCESTOR_PROPERTY, this);
}
}
};
component.addPropertyChangeListener(//
AbstractOverlayFormComponentInterceptor.ANCESTOR_PROPERTY, wait4ParentListener);
} | java | @Override
public final void processComponent(String propertyName, final JComponent component) {
final AbstractOverlayHandler overlayHandler = this.createOverlayHandler(propertyName, component);
// Wait until has parent and overlay is correctly installed
final PropertyChangeListener wait4ParentListener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
final JComponent targetComponent = overlayHandler.getTargetComponent();
final JComponent overlay = overlayHandler.getOverlay();
// Install overlay
final int position = AbstractOverlayFormComponentInterceptor.this.getPosition();
final Boolean success = AbstractOverlayFormComponentInterceptor.this.//
getOverlayService().installOverlay(targetComponent, overlay, position, null);
if (success) {
targetComponent.removePropertyChangeListener(//
AbstractOverlayFormComponentInterceptor.ANCESTOR_PROPERTY, this);
}
}
};
component.addPropertyChangeListener(//
AbstractOverlayFormComponentInterceptor.ANCESTOR_PROPERTY, wait4ParentListener);
} | [
"@",
"Override",
"public",
"final",
"void",
"processComponent",
"(",
"String",
"propertyName",
",",
"final",
"JComponent",
"component",
")",
"{",
"final",
"AbstractOverlayHandler",
"overlayHandler",
"=",
"this",
".",
"createOverlayHandler",
"(",
"propertyName",
",",
... | Creates an overlay handler for the given property name and component and installs the overlay.
@param propertyName
the property name.
@param component
the component.
@see OverlayService#installOverlay(JComponent, JComponent) | [
"Creates",
"an",
"overlay",
"handler",
"for",
"the",
"given",
"property",
"name",
"and",
"component",
"and",
"installs",
"the",
"overlay",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/AbstractOverlayFormComponentInterceptor.java#L89-L116 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CProductPersistenceImpl.java | CProductPersistenceImpl.findByUUID_G | @Override
public CProduct findByUUID_G(String uuid, long groupId)
throws NoSuchCProductException {
CProduct cProduct = fetchByUUID_G(uuid, groupId);
if (cProduct == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCProductException(msg.toString());
}
return cProduct;
} | java | @Override
public CProduct findByUUID_G(String uuid, long groupId)
throws NoSuchCProductException {
CProduct cProduct = fetchByUUID_G(uuid, groupId);
if (cProduct == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCProductException(msg.toString());
}
return cProduct;
} | [
"@",
"Override",
"public",
"CProduct",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchCProductException",
"{",
"CProduct",
"cProduct",
"=",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
")",
";",
"if",
"(",
"cProduct",
"==... | Returns the c product where uuid = ? and groupId = ? or throws a {@link NoSuchCProductException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching c product
@throws NoSuchCProductException if a matching c product could not be found | [
"Returns",
"the",
"c",
"product",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchCProductException",
"}",
"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/CProductPersistenceImpl.java#L658-L684 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java | SegmentsUtil.getByte | public static byte getByte(MemorySegment[] segments, int offset) {
if (inFirstSegment(segments, offset, 1)) {
return segments[0].get(offset);
} else {
return getByteMultiSegments(segments, offset);
}
} | java | public static byte getByte(MemorySegment[] segments, int offset) {
if (inFirstSegment(segments, offset, 1)) {
return segments[0].get(offset);
} else {
return getByteMultiSegments(segments, offset);
}
} | [
"public",
"static",
"byte",
"getByte",
"(",
"MemorySegment",
"[",
"]",
"segments",
",",
"int",
"offset",
")",
"{",
"if",
"(",
"inFirstSegment",
"(",
"segments",
",",
"offset",
",",
"1",
")",
")",
"{",
"return",
"segments",
"[",
"0",
"]",
".",
"get",
... | get byte from segments.
@param segments target segments.
@param offset value offset. | [
"get",
"byte",
"from",
"segments",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L576-L582 |
EvidentSolutions/dalesbred | dalesbred/src/main/java/org/dalesbred/Database.java | Database.findTable | public @NotNull ResultTable findTable(@NotNull @SQL String sql, Object... args) {
return findTable(SqlQuery.query(sql, args));
} | java | public @NotNull ResultTable findTable(@NotNull @SQL String sql, Object... args) {
return findTable(SqlQuery.query(sql, args));
} | [
"public",
"@",
"NotNull",
"ResultTable",
"findTable",
"(",
"@",
"NotNull",
"@",
"SQL",
"String",
"sql",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"findTable",
"(",
"SqlQuery",
".",
"query",
"(",
"sql",
",",
"args",
")",
")",
";",
"}"
] | Executes a query and creates a {@link ResultTable} from the results. | [
"Executes",
"a",
"query",
"and",
"creates",
"a",
"{"
] | train | https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L592-L594 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java | ModelSerializer.writeModel | public static void writeModel(@NonNull Model model, @NonNull File file, boolean saveUpdater) throws IOException {
writeModel(model,file,saveUpdater,null);
} | java | public static void writeModel(@NonNull Model model, @NonNull File file, boolean saveUpdater) throws IOException {
writeModel(model,file,saveUpdater,null);
} | [
"public",
"static",
"void",
"writeModel",
"(",
"@",
"NonNull",
"Model",
"model",
",",
"@",
"NonNull",
"File",
"file",
",",
"boolean",
"saveUpdater",
")",
"throws",
"IOException",
"{",
"writeModel",
"(",
"model",
",",
"file",
",",
"saveUpdater",
",",
"null",
... | Write a model to a file
@param model the model to write
@param file the file to write to
@param saveUpdater whether to save the updater or not
@throws IOException | [
"Write",
"a",
"model",
"to",
"a",
"file"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java#L75-L77 |
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.createOrUpdate | public ExpressRouteConnectionInner createOrUpdate(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters).toBlocking().last().body();
} | java | public ExpressRouteConnectionInner createOrUpdate(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters).toBlocking().last().body();
} | [
"public",
"ExpressRouteConnectionInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRouteGatewayName",
",",
"String",
"connectionName",
",",
"ExpressRouteConnectionInner",
"putExpressRouteConnectionParameters",
")",
"{",
"return",
"createOrUpdate... | Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param connectionName The name of the connection subresource.
@param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ExpressRouteConnectionInner object if successful. | [
"Creates",
"a",
"connection",
"between",
"an",
"ExpressRoute",
"gateway",
"and",
"an",
"ExpressRoute",
"circuit",
"."
] | 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#L96-L98 |
javajazz/jazz | src/main/lombok/de/scravy/jazz/Jazz.java | Jazz.animate | public static <M> Window animate(final String title, final int width,
final int height,
final M model, final Renderer<M> renderer,
final UpdateHandler<M> updateHandler) {
return animate(title, width, height, new Animation() {
@Override
public void update(final double time, final double delta) {
updateHandler.update(model, time, delta);
}
@Override
public Picture getPicture() {
return renderer.render(model);
}
});
} | java | public static <M> Window animate(final String title, final int width,
final int height,
final M model, final Renderer<M> renderer,
final UpdateHandler<M> updateHandler) {
return animate(title, width, height, new Animation() {
@Override
public void update(final double time, final double delta) {
updateHandler.update(model, time, delta);
}
@Override
public Picture getPicture() {
return renderer.render(model);
}
});
} | [
"public",
"static",
"<",
"M",
">",
"Window",
"animate",
"(",
"final",
"String",
"title",
",",
"final",
"int",
"width",
",",
"final",
"int",
"height",
",",
"final",
"M",
"model",
",",
"final",
"Renderer",
"<",
"M",
">",
"renderer",
",",
"final",
"Update... | Displays an animation in a single window.
You can open multiple windows using this method.
@see Renderer
@since 1.0.0
@param title
The title of the displayed window.
@param width
The width of the displayed window.
@param height
The height of the displayed window.
@param model
The model (a data object that describes your world).
@param renderer
The renderer that derives a picture from the model.
@param updateHandler
The update handler that updates the model.
@return A reference to the newly created window. | [
"Displays",
"an",
"animation",
"in",
"a",
"single",
"window",
"."
] | train | https://github.com/javajazz/jazz/blob/f4a1a601700442b8ec6a947f5772a96dbf5dc44b/src/main/lombok/de/scravy/jazz/Jazz.java#L280-L296 |
davidmoten/rxjava-extras | src/main/java/com/github/davidmoten/rx/internal/operators/FileBasedSPSCQueueMemoryMappedReaderWriter.java | FileBasedSPSCQueueMemoryMappedReaderWriter.offer | public boolean offer(T t) {
// the current position will be just past the length bytes for this
// item (length bytes will be 0 at the moment)
int serializedLength = serializer.size();
if (serializedLength == UNKNOWN_LENGTH) {
return offerUnknownLength(t);
} else {
return offerKnownLength(t, serializedLength);
}
} | java | public boolean offer(T t) {
// the current position will be just past the length bytes for this
// item (length bytes will be 0 at the moment)
int serializedLength = serializer.size();
if (serializedLength == UNKNOWN_LENGTH) {
return offerUnknownLength(t);
} else {
return offerKnownLength(t, serializedLength);
}
} | [
"public",
"boolean",
"offer",
"(",
"T",
"t",
")",
"{",
"// the current position will be just past the length bytes for this",
"// item (length bytes will be 0 at the moment)",
"int",
"serializedLength",
"=",
"serializer",
".",
"size",
"(",
")",
";",
"if",
"(",
"serializedLe... | Returns true if value written to file or false if not enough space
(writes and end-of-file marker in the fixed-length memory mapped file).
@param t
value to write to the serialized queue
@return true if written, false if not enough space | [
"Returns",
"true",
"if",
"value",
"written",
"to",
"file",
"or",
"false",
"if",
"not",
"enough",
"space",
"(",
"writes",
"and",
"end",
"-",
"of",
"-",
"file",
"marker",
"in",
"the",
"fixed",
"-",
"length",
"memory",
"mapped",
"file",
")",
"."
] | train | https://github.com/davidmoten/rxjava-extras/blob/a91d2ba7d454843250e0b0fce36084f9fb02a551/src/main/java/com/github/davidmoten/rx/internal/operators/FileBasedSPSCQueueMemoryMappedReaderWriter.java#L259-L268 |
dkpro/dkpro-argumentation | dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java | JCasUtil2.hasAny | public static <T extends TOP> boolean hasAny(final Class<T> type, final JCas aJCas)
{
return count(type, aJCas) != 0;
} | java | public static <T extends TOP> boolean hasAny(final Class<T> type, final JCas aJCas)
{
return count(type, aJCas) != 0;
} | [
"public",
"static",
"<",
"T",
"extends",
"TOP",
">",
"boolean",
"hasAny",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"final",
"JCas",
"aJCas",
")",
"{",
"return",
"count",
"(",
"type",
",",
"aJCas",
")",
"!=",
"0",
";",
"}"
] | Returns whether there is any feature structure of the given type
@param type the type
@param aJCas the JCas
@return whether there is any feature structure of the given type | [
"Returns",
"whether",
"there",
"is",
"any",
"feature",
"structure",
"of",
"the",
"given",
"type"
] | train | https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java#L66-L69 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java | CouchDatabaseBase.getAttachment | private InputStream getAttachment(URI uri) {
HttpConnection connection = Http.GET(uri);
couchDbClient.execute(connection);
try {
return connection.responseAsInputStream();
} catch (IOException e) {
throw new CouchDbException("Error retrieving response input stream.", e);
}
} | java | private InputStream getAttachment(URI uri) {
HttpConnection connection = Http.GET(uri);
couchDbClient.execute(connection);
try {
return connection.responseAsInputStream();
} catch (IOException e) {
throw new CouchDbException("Error retrieving response input stream.", e);
}
} | [
"private",
"InputStream",
"getAttachment",
"(",
"URI",
"uri",
")",
"{",
"HttpConnection",
"connection",
"=",
"Http",
".",
"GET",
"(",
"uri",
")",
";",
"couchDbClient",
".",
"execute",
"(",
"connection",
")",
";",
"try",
"{",
"return",
"connection",
".",
"r... | Reads an attachment from the database.
The stream must be closed after usage, otherwise http connection leaks will occur.
@param uri the attachment URI
@return the attachment in the form of an {@code InputStream}. | [
"Reads",
"an",
"attachment",
"from",
"the",
"database",
"."
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java#L323-L331 |
iipc/webarchive-commons | src/main/java/org/archive/net/PublicSuffixes.java | PublicSuffixes.surtPrefixRegexFromTrie | private static String surtPrefixRegexFromTrie(Node trie) {
StringBuilder regex = new StringBuilder();
regex.append("(?ix)^\n");
trie.addBranch("*,"); // for new/unknown TLDs
buildRegex(trie, regex);
regex.append("\n([-\\w]+,)");
return regex.toString();
} | java | private static String surtPrefixRegexFromTrie(Node trie) {
StringBuilder regex = new StringBuilder();
regex.append("(?ix)^\n");
trie.addBranch("*,"); // for new/unknown TLDs
buildRegex(trie, regex);
regex.append("\n([-\\w]+,)");
return regex.toString();
} | [
"private",
"static",
"String",
"surtPrefixRegexFromTrie",
"(",
"Node",
"trie",
")",
"{",
"StringBuilder",
"regex",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"regex",
".",
"append",
"(",
"\"(?ix)^\\n\"",
")",
";",
"trie",
".",
"addBranch",
"(",
"\"*,\"",
")... | Converts SURT-ordered list of public prefixes into a Java regex which
matches the public-portion "plus one" segment, giving the domain on which
cookies can be set or other policy grouping should occur. Also adds to
regex a fallback matcher that for any new/unknown TLDs assumes the
second-level domain is assignable. (Eg: 'zzz,example,').
@param list
@return | [
"Converts",
"SURT",
"-",
"ordered",
"list",
"of",
"public",
"prefixes",
"into",
"a",
"Java",
"regex",
"which",
"matches",
"the",
"public",
"-",
"portion",
"plus",
"one",
"segment",
"giving",
"the",
"domain",
"on",
"which",
"cookies",
"can",
"be",
"set",
"o... | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/net/PublicSuffixes.java#L302-L309 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/LongStream.java | LongStream.mapToInt | @NotNull
public IntStream mapToInt(@NotNull final LongToIntFunction mapper) {
return new IntStream(params, new LongMapToInt(iterator, mapper));
} | java | @NotNull
public IntStream mapToInt(@NotNull final LongToIntFunction mapper) {
return new IntStream(params, new LongMapToInt(iterator, mapper));
} | [
"@",
"NotNull",
"public",
"IntStream",
"mapToInt",
"(",
"@",
"NotNull",
"final",
"LongToIntFunction",
"mapper",
")",
"{",
"return",
"new",
"IntStream",
"(",
"params",
",",
"new",
"LongMapToInt",
"(",
"iterator",
",",
"mapper",
")",
")",
";",
"}"
] | Returns an {@code IntStream} consisting of the results of applying the given
function to the elements of this stream.
<p> This is an intermediate operation.
@param mapper the mapper function used to apply to each element
@return the new {@code IntStream} | [
"Returns",
"an",
"{",
"@code",
"IntStream",
"}",
"consisting",
"of",
"the",
"results",
"of",
"applying",
"the",
"given",
"function",
"to",
"the",
"elements",
"of",
"this",
"stream",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/LongStream.java#L526-L529 |
MKLab-ITI/multimedia-indexing | src/main/java/gr/iti/mklab/visual/vectorization/ImageVectorizer.java | ImageVectorizer.submitImageVectorizationTask | public void submitImageVectorizationTask(String imageFolder, String imageName) {
Callable<ImageVectorizationResult> call = new ImageVectorization(imageFolder, imageName,
targetVectorLength, maxImageSizeInPixels);
pool.submit(call);
numPendingTasks++;
} | java | public void submitImageVectorizationTask(String imageFolder, String imageName) {
Callable<ImageVectorizationResult> call = new ImageVectorization(imageFolder, imageName,
targetVectorLength, maxImageSizeInPixels);
pool.submit(call);
numPendingTasks++;
} | [
"public",
"void",
"submitImageVectorizationTask",
"(",
"String",
"imageFolder",
",",
"String",
"imageName",
")",
"{",
"Callable",
"<",
"ImageVectorizationResult",
">",
"call",
"=",
"new",
"ImageVectorization",
"(",
"imageFolder",
",",
"imageName",
",",
"targetVectorLe... | Submits a new image vectorization task for an image that is stored in the disk and has not yet been
read into a BufferedImage object.
@param imageFolder
The folder where the image resides.
@param imageName
The name of the image. | [
"Submits",
"a",
"new",
"image",
"vectorization",
"task",
"for",
"an",
"image",
"that",
"is",
"stored",
"in",
"the",
"disk",
"and",
"has",
"not",
"yet",
"been",
"read",
"into",
"a",
"BufferedImage",
"object",
"."
] | train | https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/vectorization/ImageVectorizer.java#L138-L143 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/SldUtilities.java | SldUtilities.getStyleFromFile | public static Style getStyleFromFile( File file ) {
Style style = null;
try {
String name = file.getName();
if (!name.endsWith("sld")) {
String nameWithoutExtention = FileUtilities.getNameWithoutExtention(file);
File sldFile = new File(file.getParentFile(), nameWithoutExtention + ".sld");
if (sldFile.exists()) {
file = sldFile;
} else {
// no style file here
return null;
}
}
SLDHandler h = new SLDHandler();
StyledLayerDescriptor sld = h.parse(file, null, null, null);
// SLDParser stylereader = new SLDParser(sf, file);
// StyledLayerDescriptor sld = stylereader.parseSLD();
style = getDefaultStyle(sld);
return style;
} catch (Exception e) {
e.printStackTrace();
return null;
}
} | java | public static Style getStyleFromFile( File file ) {
Style style = null;
try {
String name = file.getName();
if (!name.endsWith("sld")) {
String nameWithoutExtention = FileUtilities.getNameWithoutExtention(file);
File sldFile = new File(file.getParentFile(), nameWithoutExtention + ".sld");
if (sldFile.exists()) {
file = sldFile;
} else {
// no style file here
return null;
}
}
SLDHandler h = new SLDHandler();
StyledLayerDescriptor sld = h.parse(file, null, null, null);
// SLDParser stylereader = new SLDParser(sf, file);
// StyledLayerDescriptor sld = stylereader.parseSLD();
style = getDefaultStyle(sld);
return style;
} catch (Exception e) {
e.printStackTrace();
return null;
}
} | [
"public",
"static",
"Style",
"getStyleFromFile",
"(",
"File",
"file",
")",
"{",
"Style",
"style",
"=",
"null",
";",
"try",
"{",
"String",
"name",
"=",
"file",
".",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"name",
".",
"endsWith",
"(",
"\"sld\"",
")"... | Get the style from an sld file.
@param file the SLD file or a companion file.
@return the {@link Style} object.
@throws IOException | [
"Get",
"the",
"style",
"from",
"an",
"sld",
"file",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/SldUtilities.java#L86-L111 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleAssetCategoryRelPersistenceImpl.java | CPRuleAssetCategoryRelPersistenceImpl.findAll | @Override
public List<CPRuleAssetCategoryRel> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CPRuleAssetCategoryRel> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPRuleAssetCategoryRel",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the cp rule asset category rels.
@return the cp rule asset category rels | [
"Returns",
"all",
"the",
"cp",
"rule",
"asset",
"category",
"rels",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleAssetCategoryRelPersistenceImpl.java#L1666-L1669 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/NetworkSecurityGroupsInner.java | NetworkSecurityGroupsInner.beginCreateOrUpdate | public NetworkSecurityGroupInner beginCreateOrUpdate(String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, parameters).toBlocking().single().body();
} | java | public NetworkSecurityGroupInner beginCreateOrUpdate(String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, parameters).toBlocking().single().body();
} | [
"public",
"NetworkSecurityGroupInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkSecurityGroupName",
",",
"NetworkSecurityGroupInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Creates or updates a network security group in the specified resource group.
@param resourceGroupName The name of the resource group.
@param networkSecurityGroupName The name of the network security group.
@param parameters Parameters supplied to the create or update network security group operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the NetworkSecurityGroupInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"network",
"security",
"group",
"in",
"the",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/NetworkSecurityGroupsInner.java#L519-L521 |
umeding/fuzzer | src/main/java/com/uwemeding/fuzzer/java/JavaOutputType.java | JavaOutputType.addReasoningMethod | private void addReasoningMethod(Java.CLASS clazz, Program program) throws FuzzerException {
// reasoning strategy
Java.METHOD rs = clazz.addMETHOD("private", "Number", "rs");
rs.setComment("Reasoning strategy is " + program.getReasoningStrategy().getName());
rs.setReturnComment("the reasoned value");
rs.addArg("Number", "a", "strength value");
rs.addArg("Number", "b", "mapped value");
switch (program.getReasoningStrategy()) {
case MAXDOT:
rs.addRETURN("a.doubleValue() * b.doubleValue()");
break;
case MAXMIN:
rs.addRETURN("a.doubleValue() < b.doubleValue() ? a : b");
break;
default:
throw new FuzzerException(program.getReasoningStrategy() + ": not implemented");
}
} | java | private void addReasoningMethod(Java.CLASS clazz, Program program) throws FuzzerException {
// reasoning strategy
Java.METHOD rs = clazz.addMETHOD("private", "Number", "rs");
rs.setComment("Reasoning strategy is " + program.getReasoningStrategy().getName());
rs.setReturnComment("the reasoned value");
rs.addArg("Number", "a", "strength value");
rs.addArg("Number", "b", "mapped value");
switch (program.getReasoningStrategy()) {
case MAXDOT:
rs.addRETURN("a.doubleValue() * b.doubleValue()");
break;
case MAXMIN:
rs.addRETURN("a.doubleValue() < b.doubleValue() ? a : b");
break;
default:
throw new FuzzerException(program.getReasoningStrategy() + ": not implemented");
}
} | [
"private",
"void",
"addReasoningMethod",
"(",
"Java",
".",
"CLASS",
"clazz",
",",
"Program",
"program",
")",
"throws",
"FuzzerException",
"{",
"// reasoning strategy",
"Java",
".",
"METHOD",
"rs",
"=",
"clazz",
".",
"addMETHOD",
"(",
"\"private\"",
",",
"\"Numbe... | Add the reasoning method to the generated code.
<p>
@param clazz the class wrapper
@param program the fuzzy program
@throws FuzzerException | [
"Add",
"the",
"reasoning",
"method",
"to",
"the",
"generated",
"code",
".",
"<p",
">"
] | train | https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/java/JavaOutputType.java#L210-L227 |
Azure/azure-sdk-for-java | batchai/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/implementation/JobsInner.java | JobsInner.beginTerminate | public void beginTerminate(String resourceGroupName, String jobName) {
beginTerminateWithServiceResponseAsync(resourceGroupName, jobName).toBlocking().single().body();
} | java | public void beginTerminate(String resourceGroupName, String jobName) {
beginTerminateWithServiceResponseAsync(resourceGroupName, jobName).toBlocking().single().body();
} | [
"public",
"void",
"beginTerminate",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
")",
"{",
"beginTerminateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"jobName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
... | Terminates a job.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param jobName The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Terminates",
"a",
"job",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/implementation/JobsInner.java#L747-L749 |
infinispan/infinispan | object-filter/src/main/java/org/infinispan/objectfilter/impl/syntax/parser/QueryRendererDelegateImpl.java | QueryRendererDelegateImpl.sortSpecification | @Override
public void sortSpecification(String collateName, boolean isAscending) {
// collationName is ignored for now
PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath);
checkAnalyzed(property, false); //todo [anistor] cannot sort on analyzed field?
if (sortFields == null) {
sortFields = new ArrayList<>(ARRAY_INITIAL_LENGTH);
}
sortFields.add(new IckleParsingResult.SortFieldImpl<>(property, isAscending));
} | java | @Override
public void sortSpecification(String collateName, boolean isAscending) {
// collationName is ignored for now
PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath);
checkAnalyzed(property, false); //todo [anistor] cannot sort on analyzed field?
if (sortFields == null) {
sortFields = new ArrayList<>(ARRAY_INITIAL_LENGTH);
}
sortFields.add(new IckleParsingResult.SortFieldImpl<>(property, isAscending));
} | [
"@",
"Override",
"public",
"void",
"sortSpecification",
"(",
"String",
"collateName",
",",
"boolean",
"isAscending",
")",
"{",
"// collationName is ignored for now",
"PropertyPath",
"<",
"TypeDescriptor",
"<",
"TypeMetadata",
">>",
"property",
"=",
"resolveAlias",
"(",
... | Add field sort criteria.
@param collateName optional collation name
@param isAscending sort direction | [
"Add",
"field",
"sort",
"criteria",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/object-filter/src/main/java/org/infinispan/objectfilter/impl/syntax/parser/QueryRendererDelegateImpl.java#L529-L539 |
mozilla/rhino | src/org/mozilla/javascript/Context.java | Context.javaToJS | public static Object javaToJS(Object value, Scriptable scope)
{
if (value instanceof String || value instanceof Number
|| value instanceof Boolean || value instanceof Scriptable)
{
return value;
} else if (value instanceof Character) {
return String.valueOf(((Character)value).charValue());
} else {
Context cx = Context.getContext();
return cx.getWrapFactory().wrap(cx, scope, value, null);
}
} | java | public static Object javaToJS(Object value, Scriptable scope)
{
if (value instanceof String || value instanceof Number
|| value instanceof Boolean || value instanceof Scriptable)
{
return value;
} else if (value instanceof Character) {
return String.valueOf(((Character)value).charValue());
} else {
Context cx = Context.getContext();
return cx.getWrapFactory().wrap(cx, scope, value, null);
}
} | [
"public",
"static",
"Object",
"javaToJS",
"(",
"Object",
"value",
",",
"Scriptable",
"scope",
")",
"{",
"if",
"(",
"value",
"instanceof",
"String",
"||",
"value",
"instanceof",
"Number",
"||",
"value",
"instanceof",
"Boolean",
"||",
"value",
"instanceof",
"Scr... | Convenient method to convert java value to its closest representation
in JavaScript.
<p>
If value is an instance of String, Number, Boolean, Function or
Scriptable, it is returned as it and will be treated as the corresponding
JavaScript type of string, number, boolean, function and object.
<p>
Note that for Number instances during any arithmetic operation in
JavaScript the engine will always use the result of
<tt>Number.doubleValue()</tt> resulting in a precision loss if
the number can not fit into double.
<p>
If value is an instance of Character, it will be converted to string of
length 1 and its JavaScript type will be string.
<p>
The rest of values will be wrapped as LiveConnect objects
by calling {@link WrapFactory#wrap(Context cx, Scriptable scope,
Object obj, Class staticType)} as in:
<pre>
Context cx = Context.getCurrentContext();
return cx.getWrapFactory().wrap(cx, scope, value, null);
</pre>
@param value any Java object
@param scope top scope object
@return value suitable to pass to any API that takes JavaScript values. | [
"Convenient",
"method",
"to",
"convert",
"java",
"value",
"to",
"its",
"closest",
"representation",
"in",
"JavaScript",
".",
"<p",
">",
"If",
"value",
"is",
"an",
"instance",
"of",
"String",
"Number",
"Boolean",
"Function",
"or",
"Scriptable",
"it",
"is",
"r... | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Context.java#L1849-L1861 |
CodeNarc/CodeNarc | src/main/java/org/codenarc/rule/AbstractMethodVisitor.java | AbstractMethodVisitor.addViolation | protected void addViolation(ClassNode node, String message) {
addViolation((ASTNode) node, String.format(
"Violation in class %s. %s", node.getNameWithoutPackage(), message
));
} | java | protected void addViolation(ClassNode node, String message) {
addViolation((ASTNode) node, String.format(
"Violation in class %s. %s", node.getNameWithoutPackage(), message
));
} | [
"protected",
"void",
"addViolation",
"(",
"ClassNode",
"node",
",",
"String",
"message",
")",
"{",
"addViolation",
"(",
"(",
"ASTNode",
")",
"node",
",",
"String",
".",
"format",
"(",
"\"Violation in class %s. %s\"",
",",
"node",
".",
"getNameWithoutPackage",
"(... | Add a new Violation to the list of violations found by this visitor.
Only add the violation if the node lineNumber >= 0.
@param node - the Groovy AST Node
@param message - the message for the violation; defaults to null | [
"Add",
"a",
"new",
"Violation",
"to",
"the",
"list",
"of",
"violations",
"found",
"by",
"this",
"visitor",
".",
"Only",
"add",
"the",
"violation",
"if",
"the",
"node",
"lineNumber",
">",
"=",
"0",
"."
] | train | https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/rule/AbstractMethodVisitor.java#L89-L93 |
schallee/alib4j | core/src/main/java/net/darkmist/alib/res/PkgRes.java | PkgRes.appendResourcePathPrefixFor | protected static StringBuilder appendResourcePathPrefixFor(StringBuilder sb, Class<?> cls)
{
if(cls == null)
throw new NullPointerException("cls is null");
return appendResourcePathPrefixFor(sb, getPackageName(cls));
} | java | protected static StringBuilder appendResourcePathPrefixFor(StringBuilder sb, Class<?> cls)
{
if(cls == null)
throw new NullPointerException("cls is null");
return appendResourcePathPrefixFor(sb, getPackageName(cls));
} | [
"protected",
"static",
"StringBuilder",
"appendResourcePathPrefixFor",
"(",
"StringBuilder",
"sb",
",",
"Class",
"<",
"?",
">",
"cls",
")",
"{",
"if",
"(",
"cls",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"cls is null\"",
")",
";",
"ret... | Apend a package name converted to a resource path prefix.
@param sb what to append to. If this is null, a new
StringBuilder is created.
@param cls The class to get the package name from.
@return Path, starting and ending with a slash, for resources
prefixed by the package name.
@throws NullPointerException if cls is null. | [
"Apend",
"a",
"package",
"name",
"converted",
"to",
"a",
"resource",
"path",
"prefix",
"."
] | train | https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/core/src/main/java/net/darkmist/alib/res/PkgRes.java#L156-L161 |
hypfvieh/java-utils | src/main/java/com/github/hypfvieh/util/CompareUtil.java | CompareUtil.startsWithAny | public static boolean startsWithAny(String _str, String... _startStrings) {
if (_str == null || _startStrings == null || _startStrings.length == 0) {
return false;
}
for (String start : _startStrings) {
if (_str.startsWith(start)) {
return true;
}
}
return false;
} | java | public static boolean startsWithAny(String _str, String... _startStrings) {
if (_str == null || _startStrings == null || _startStrings.length == 0) {
return false;
}
for (String start : _startStrings) {
if (_str.startsWith(start)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"startsWithAny",
"(",
"String",
"_str",
",",
"String",
"...",
"_startStrings",
")",
"{",
"if",
"(",
"_str",
"==",
"null",
"||",
"_startStrings",
"==",
"null",
"||",
"_startStrings",
".",
"length",
"==",
"0",
")",
"{",
"return... | Checks if given String starts with any of the other given parameters.
@param _str string to check
@param _startStrings start strings to compare
@return true if any match, false otherwise | [
"Checks",
"if",
"given",
"String",
"starts",
"with",
"any",
"of",
"the",
"other",
"given",
"parameters",
"."
] | train | https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/CompareUtil.java#L135-L147 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Retryer.java | Retryer.randomWait | public Retryer<R> randomWait(long maximum, TimeUnit timeUnit) {
return randomWait(0L, checkNotNull(timeUnit).toMillis(maximum));
} | java | public Retryer<R> randomWait(long maximum, TimeUnit timeUnit) {
return randomWait(0L, checkNotNull(timeUnit).toMillis(maximum));
} | [
"public",
"Retryer",
"<",
"R",
">",
"randomWait",
"(",
"long",
"maximum",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"return",
"randomWait",
"(",
"0L",
",",
"checkNotNull",
"(",
"timeUnit",
")",
".",
"toMillis",
"(",
"maximum",
")",
")",
";",
"}"
] | Sets the strategy that sleeps a random amount of time before retrying
@param maximum
@param timeUnit
@return | [
"Sets",
"the",
"strategy",
"that",
"sleeps",
"a",
"random",
"amount",
"of",
"time",
"before",
"retrying"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Retryer.java#L390-L392 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Times.java | Times.isSameWeek | public static boolean isSameWeek(final Date date1, final Date date2) {
final Calendar cal1 = Calendar.getInstance();
cal1.setFirstDayOfWeek(Calendar.MONDAY);
cal1.setTime(date1);
final Calendar cal2 = Calendar.getInstance();
cal2.setFirstDayOfWeek(Calendar.MONDAY);
cal2.setTime(date2);
return cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA)
&& cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)
&& cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR);
} | java | public static boolean isSameWeek(final Date date1, final Date date2) {
final Calendar cal1 = Calendar.getInstance();
cal1.setFirstDayOfWeek(Calendar.MONDAY);
cal1.setTime(date1);
final Calendar cal2 = Calendar.getInstance();
cal2.setFirstDayOfWeek(Calendar.MONDAY);
cal2.setTime(date2);
return cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA)
&& cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)
&& cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR);
} | [
"public",
"static",
"boolean",
"isSameWeek",
"(",
"final",
"Date",
"date1",
",",
"final",
"Date",
"date2",
")",
"{",
"final",
"Calendar",
"cal1",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal1",
".",
"setFirstDayOfWeek",
"(",
"Calendar",
".",
"M... | Determines whether the specified date1 is the same week with the specified date2.
@param date1 the specified date1
@param date2 the specified date2
@return {@code true} if it is the same week, returns {@code false} otherwise | [
"Determines",
"whether",
"the",
"specified",
"date1",
"is",
"the",
"same",
"week",
"with",
"the",
"specified",
"date2",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Times.java#L142-L154 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_addressMove_eligibility_POST | public OvhAsyncTask<OvhEligibility> packName_addressMove_eligibility_POST(String packName, OvhAddress address, String lineNumber) throws IOException {
String qPath = "/pack/xdsl/{packName}/addressMove/eligibility";
StringBuilder sb = path(qPath, packName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "address", address);
addBody(o, "lineNumber", lineNumber);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, t6);
} | java | public OvhAsyncTask<OvhEligibility> packName_addressMove_eligibility_POST(String packName, OvhAddress address, String lineNumber) throws IOException {
String qPath = "/pack/xdsl/{packName}/addressMove/eligibility";
StringBuilder sb = path(qPath, packName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "address", address);
addBody(o, "lineNumber", lineNumber);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, t6);
} | [
"public",
"OvhAsyncTask",
"<",
"OvhEligibility",
">",
"packName_addressMove_eligibility_POST",
"(",
"String",
"packName",
",",
"OvhAddress",
"address",
",",
"String",
"lineNumber",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xdsl/{packName}/address... | Eligibility to move the access
REST: POST /pack/xdsl/{packName}/addressMove/eligibility
@param address [required] The address to test, if no lineNumber
@param lineNumber [required] The line number to test, if no address
@param packName [required] The internal name of your pack | [
"Eligibility",
"to",
"move",
"the",
"access"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L341-L349 |
SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java | System2.setProperty | public System2 setProperty(String key, String value) {
System.setProperty(key, value);
return this;
} | java | public System2 setProperty(String key, String value) {
System.setProperty(key, value);
return this;
} | [
"public",
"System2",
"setProperty",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"System",
".",
"setProperty",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Shortcut for {@code System{@link #setProperty(String, String)}}
@since 6.4 | [
"Shortcut",
"for",
"{"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java#L103-L106 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/NetUtil.java | NetUtil.createHttpURLConnection | public static HttpURLConnection createHttpURLConnection(URL pURL, Properties pProperties, boolean pFollowRedirects, int pTimeout)
throws IOException {
// Open the connection, and get the stream
HttpURLConnection conn;
if (pTimeout > 0) {
// Supports timeout
conn = new com.twelvemonkeys.net.HttpURLConnection(pURL, pTimeout);
}
else {
// Faster, more compatible
conn = (HttpURLConnection) pURL.openConnection();
}
// Set user agent
if ((pProperties == null) || !pProperties.containsKey("User-Agent")) {
conn.setRequestProperty("User-Agent",
VERSION_ID
+ " (" + System.getProperty("os.name") + "/" + System.getProperty("os.version") + "; "
+ System.getProperty("os.arch") + "; "
+ System.getProperty("java.vm.name") + "/" + System.getProperty("java.vm.version") + ")");
}
// Set request properties
if (pProperties != null) {
for (Map.Entry<Object, Object> entry : pProperties.entrySet()) {
// Properties key/values can be safely cast to strings
conn.setRequestProperty((String) entry.getKey(), entry.getValue().toString());
}
}
try {
// Breaks with JRE1.2?
conn.setInstanceFollowRedirects(pFollowRedirects);
}
catch (LinkageError le) {
// This is the best we can do...
HttpURLConnection.setFollowRedirects(pFollowRedirects);
System.err.println("You are using an old Java Spec, consider upgrading.");
System.err.println("java.net.HttpURLConnection.setInstanceFollowRedirects(" + pFollowRedirects + ") failed.");
//le.printStackTrace(System.err);
}
conn.setDoInput(true);
conn.setDoOutput(true);
//conn.setUseCaches(true);
return conn;
} | java | public static HttpURLConnection createHttpURLConnection(URL pURL, Properties pProperties, boolean pFollowRedirects, int pTimeout)
throws IOException {
// Open the connection, and get the stream
HttpURLConnection conn;
if (pTimeout > 0) {
// Supports timeout
conn = new com.twelvemonkeys.net.HttpURLConnection(pURL, pTimeout);
}
else {
// Faster, more compatible
conn = (HttpURLConnection) pURL.openConnection();
}
// Set user agent
if ((pProperties == null) || !pProperties.containsKey("User-Agent")) {
conn.setRequestProperty("User-Agent",
VERSION_ID
+ " (" + System.getProperty("os.name") + "/" + System.getProperty("os.version") + "; "
+ System.getProperty("os.arch") + "; "
+ System.getProperty("java.vm.name") + "/" + System.getProperty("java.vm.version") + ")");
}
// Set request properties
if (pProperties != null) {
for (Map.Entry<Object, Object> entry : pProperties.entrySet()) {
// Properties key/values can be safely cast to strings
conn.setRequestProperty((String) entry.getKey(), entry.getValue().toString());
}
}
try {
// Breaks with JRE1.2?
conn.setInstanceFollowRedirects(pFollowRedirects);
}
catch (LinkageError le) {
// This is the best we can do...
HttpURLConnection.setFollowRedirects(pFollowRedirects);
System.err.println("You are using an old Java Spec, consider upgrading.");
System.err.println("java.net.HttpURLConnection.setInstanceFollowRedirects(" + pFollowRedirects + ") failed.");
//le.printStackTrace(System.err);
}
conn.setDoInput(true);
conn.setDoOutput(true);
//conn.setUseCaches(true);
return conn;
} | [
"public",
"static",
"HttpURLConnection",
"createHttpURLConnection",
"(",
"URL",
"pURL",
",",
"Properties",
"pProperties",
",",
"boolean",
"pFollowRedirects",
",",
"int",
"pTimeout",
")",
"throws",
"IOException",
"{",
"// Open the connection, and get the stream",
"HttpURLCon... | Creates a HTTP connection to the given URL.
@param pURL the URL to get.
@param pProperties connection properties.
@param pFollowRedirects specifies whether we should follow redirects.
@param pTimeout the specified timeout, in milliseconds.
@return a HttpURLConnection
@throws UnknownHostException if the hostname in the URL cannot be found.
@throws IOException if an I/O exception occurs. | [
"Creates",
"a",
"HTTP",
"connection",
"to",
"the",
"given",
"URL",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/NetUtil.java#L869-L919 |
LAW-Unimi/BUbiNG | src/it/unimi/di/law/bubing/frontier/WorkbenchVirtualizer.java | WorkbenchVirtualizer.collectIf | public void collectIf(final double threshold, final double targetRatio) throws IOException {
if (byteArrayDiskQueues.ratio() < threshold) {
LOGGER.info("Starting collection...");
byteArrayDiskQueues.collect(targetRatio);
LOGGER.info("Completed collection.");
}
} | java | public void collectIf(final double threshold, final double targetRatio) throws IOException {
if (byteArrayDiskQueues.ratio() < threshold) {
LOGGER.info("Starting collection...");
byteArrayDiskQueues.collect(targetRatio);
LOGGER.info("Completed collection.");
}
} | [
"public",
"void",
"collectIf",
"(",
"final",
"double",
"threshold",
",",
"final",
"double",
"targetRatio",
")",
"throws",
"IOException",
"{",
"if",
"(",
"byteArrayDiskQueues",
".",
"ratio",
"(",
")",
"<",
"threshold",
")",
"{",
"LOGGER",
".",
"info",
"(",
... | Performs a garbage collection if the space used is below a given threshold, reaching a given target ratio.
@param threshold if {@link ByteArrayDiskQueues#ratio()} is below this value, a garbage collection will be performed.
@param targetRatio passed to {@link ByteArrayDiskQueues#count(Object)}. | [
"Performs",
"a",
"garbage",
"collection",
"if",
"the",
"space",
"used",
"is",
"below",
"a",
"given",
"threshold",
"reaching",
"a",
"given",
"target",
"ratio",
"."
] | train | https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/WorkbenchVirtualizer.java#L137-L143 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java | SqlGeneratorDefaultImpl.getPreparedUpdateStatement | public SqlStatement getPreparedUpdateStatement(ClassDescriptor cld)
{
SqlForClass sfc = getSqlForClass(cld);
SqlStatement result = sfc.getUpdateSql();
if(result == null)
{
ProcedureDescriptor pd = cld.getUpdateProcedure();
if(pd == null)
{
result = new SqlUpdateStatement(cld, logger);
}
else
{
result = new SqlProcedureStatement(pd, logger);
}
// set the sql string
sfc.setUpdateSql(result);
if(logger.isDebugEnabled())
{
logger.debug("SQL:" + result.getStatement());
}
}
return result;
} | java | public SqlStatement getPreparedUpdateStatement(ClassDescriptor cld)
{
SqlForClass sfc = getSqlForClass(cld);
SqlStatement result = sfc.getUpdateSql();
if(result == null)
{
ProcedureDescriptor pd = cld.getUpdateProcedure();
if(pd == null)
{
result = new SqlUpdateStatement(cld, logger);
}
else
{
result = new SqlProcedureStatement(pd, logger);
}
// set the sql string
sfc.setUpdateSql(result);
if(logger.isDebugEnabled())
{
logger.debug("SQL:" + result.getStatement());
}
}
return result;
} | [
"public",
"SqlStatement",
"getPreparedUpdateStatement",
"(",
"ClassDescriptor",
"cld",
")",
"{",
"SqlForClass",
"sfc",
"=",
"getSqlForClass",
"(",
"cld",
")",
";",
"SqlStatement",
"result",
"=",
"sfc",
".",
"getUpdateSql",
"(",
")",
";",
"if",
"(",
"result",
"... | generate a prepared UPDATE-Statement for the Class
described by cld
@param cld the ClassDescriptor | [
"generate",
"a",
"prepared",
"UPDATE",
"-",
"Statement",
"for",
"the",
"Class",
"described",
"by",
"cld"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java#L201-L226 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/vpn/vpn_stats.java | vpn_stats.get_nitro_response | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
vpn_stats[] resources = new vpn_stats[1];
vpn_response result = (vpn_response) service.get_payload_formatter().string_to_resource(vpn_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.vpn;
return resources;
} | java | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
vpn_stats[] resources = new vpn_stats[1];
vpn_response result = (vpn_response) service.get_payload_formatter().string_to_resource(vpn_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.vpn;
return resources;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"vpn_stats",
"[",
"]",
"resources",
"=",
"new",
"vpn_stats",
"[",
"1",
"]",
";",
"vpn_response",
"result",
... | <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/vpn/vpn_stats.java#L677-L696 |
gturri/aXMLRPC | src/main/java/de/timroes/axmlrpc/ResponseParser.java | ResponseParser.getReturnValueFromElement | private Object getReturnValueFromElement(SerializerHandler serializerHandler, Element element) throws XMLRPCException {
Element childElement = XMLUtil.getOnlyChildElement(element.getChildNodes());
return serializerHandler.deserialize(childElement);
} | java | private Object getReturnValueFromElement(SerializerHandler serializerHandler, Element element) throws XMLRPCException {
Element childElement = XMLUtil.getOnlyChildElement(element.getChildNodes());
return serializerHandler.deserialize(childElement);
} | [
"private",
"Object",
"getReturnValueFromElement",
"(",
"SerializerHandler",
"serializerHandler",
",",
"Element",
"element",
")",
"throws",
"XMLRPCException",
"{",
"Element",
"childElement",
"=",
"XMLUtil",
".",
"getOnlyChildElement",
"(",
"element",
".",
"getChildNodes",
... | This method takes an element (must be a param or fault element) and
returns the deserialized object of this param tag.
@param element An param element.
@return The deserialized object within the given param element.
@throws XMLRPCException Will be thrown when the structure of the document
doesn't match the XML-RPC specification. | [
"This",
"method",
"takes",
"an",
"element",
"(",
"must",
"be",
"a",
"param",
"or",
"fault",
"element",
")",
"and",
"returns",
"the",
"deserialized",
"object",
"of",
"this",
"param",
"tag",
"."
] | train | https://github.com/gturri/aXMLRPC/blob/8ca6f95f7eb3a28efaef3569d53adddeb32b6bda/src/main/java/de/timroes/axmlrpc/ResponseParser.java#L114-L119 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java | HttpOutboundServiceContextImpl.callErrorCallback | void callErrorCallback(VirtualConnection inVC, IOException ioe) {
// otherwise pass the error along to the channel above us, or close
// the connection if nobody is above
setPersistent(false);
if (this.bEarlyReads && null != getAppReadCallback()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Early read failure calling error() on appside");
}
getAppReadCallback().error(inVC, ioe);
} else if (null != getAppWriteCallback()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling write.error() on appside");
}
getAppWriteCallback().error(inVC, ioe);
} else {
// nobody above us, just close the connection
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No appside, closing connection");
}
getLink().getDeviceLink().close(inVC, ioe);
}
} | java | void callErrorCallback(VirtualConnection inVC, IOException ioe) {
// otherwise pass the error along to the channel above us, or close
// the connection if nobody is above
setPersistent(false);
if (this.bEarlyReads && null != getAppReadCallback()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Early read failure calling error() on appside");
}
getAppReadCallback().error(inVC, ioe);
} else if (null != getAppWriteCallback()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling write.error() on appside");
}
getAppWriteCallback().error(inVC, ioe);
} else {
// nobody above us, just close the connection
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No appside, closing connection");
}
getLink().getDeviceLink().close(inVC, ioe);
}
} | [
"void",
"callErrorCallback",
"(",
"VirtualConnection",
"inVC",
",",
"IOException",
"ioe",
")",
"{",
"// otherwise pass the error along to the channel above us, or close",
"// the connection if nobody is above",
"setPersistent",
"(",
"false",
")",
";",
"if",
"(",
"this",
".",
... | Call the error callback of the app above.
@param inVC
@param ioe | [
"Call",
"the",
"error",
"callback",
"of",
"the",
"app",
"above",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L234-L255 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ClassUtils.java | ClassUtils.getSimpleName | public static String getSimpleName(final Object object, final String valueIfNull) {
return object == null ? valueIfNull : object.getClass().getSimpleName();
} | java | public static String getSimpleName(final Object object, final String valueIfNull) {
return object == null ? valueIfNull : object.getClass().getSimpleName();
} | [
"public",
"static",
"String",
"getSimpleName",
"(",
"final",
"Object",
"object",
",",
"final",
"String",
"valueIfNull",
")",
"{",
"return",
"object",
"==",
"null",
"?",
"valueIfNull",
":",
"object",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
... | <p>Null-safe version of <code>aClass.getSimpleName()</code></p>
@param object the object for which to get the simple class name; may be null
@param valueIfNull the value to return if <code>object</code> is <code>null</code>
@return the simple class name or {@code valueIfNull}
@since 3.0
@see Class#getSimpleName() | [
"<p",
">",
"Null",
"-",
"safe",
"version",
"of",
"<code",
">",
"aClass",
".",
"getSimpleName",
"()",
"<",
"/",
"code",
">",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassUtils.java#L291-L293 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.deleteStorageAccountAsync | public Observable<DeletedStorageBundle> deleteStorageAccountAsync(String vaultBaseUrl, String storageAccountName) {
return deleteStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).map(new Func1<ServiceResponse<DeletedStorageBundle>, DeletedStorageBundle>() {
@Override
public DeletedStorageBundle call(ServiceResponse<DeletedStorageBundle> response) {
return response.body();
}
});
} | java | public Observable<DeletedStorageBundle> deleteStorageAccountAsync(String vaultBaseUrl, String storageAccountName) {
return deleteStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).map(new Func1<ServiceResponse<DeletedStorageBundle>, DeletedStorageBundle>() {
@Override
public DeletedStorageBundle call(ServiceResponse<DeletedStorageBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DeletedStorageBundle",
">",
"deleteStorageAccountAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
")",
"{",
"return",
"deleteStorageAccountWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"storageAccountName",
")",
... | Deletes a storage account. This operation requires the storage/delete permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DeletedStorageBundle object | [
"Deletes",
"a",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"delete",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L9722-L9729 |
carewebframework/carewebframework-core | org.carewebframework.plugin-parent/org.carewebframework.plugin.chat/src/main/java/org/carewebframework/plugin/chat/SessionService.java | SessionService.sendMessage | public ChatMessage sendMessage(String text) {
if (text != null && !text.isEmpty()) {
ChatMessage message = new ChatMessage(self, text);
eventManager.fireRemoteEvent(sendEvent, message);
return message;
}
return null;
} | java | public ChatMessage sendMessage(String text) {
if (text != null && !text.isEmpty()) {
ChatMessage message = new ChatMessage(self, text);
eventManager.fireRemoteEvent(sendEvent, message);
return message;
}
return null;
} | [
"public",
"ChatMessage",
"sendMessage",
"(",
"String",
"text",
")",
"{",
"if",
"(",
"text",
"!=",
"null",
"&&",
"!",
"text",
".",
"isEmpty",
"(",
")",
")",
"{",
"ChatMessage",
"message",
"=",
"new",
"ChatMessage",
"(",
"self",
",",
"text",
")",
";",
... | Sends a message to a chat session.
@param text The message text.
@return The message that was sent (may be null if no text). | [
"Sends",
"a",
"message",
"to",
"a",
"chat",
"session",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.chat/src/main/java/org/carewebframework/plugin/chat/SessionService.java#L107-L115 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java | ServerKeysInner.createOrUpdateAsync | public ServiceFuture<ServerKeyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, final ServiceCallback<ServerKeyInner> serviceCallback) {
return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters), serviceCallback);
} | java | public ServiceFuture<ServerKeyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, final ServiceCallback<ServerKeyInner> serviceCallback) {
return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"ServerKeyInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"keyName",
",",
"ServerKeyInner",
"parameters",
",",
"final",
"ServiceCallback",
"<",
"ServerKeyInner",
">",
"... | Creates or updates a server key.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901
@param parameters The requested server key resource state.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Creates",
"or",
"updates",
"a",
"server",
"key",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java#L337-L339 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/PrintDirectives.java | PrintDirectives.applyStreamingEscapingDirectives | static AppendableAndOptions applyStreamingEscapingDirectives(
List<SoyPrintDirective> directives,
Expression appendable,
JbcSrcPluginContext context,
TemplateVariableManager variables) {
List<DirectiveWithArgs> directivesToApply = new ArrayList<>();
for (SoyPrintDirective directive : directives) {
directivesToApply.add(
DirectiveWithArgs.create((SoyJbcSrcPrintDirective.Streamable) directive));
}
return applyStreamingPrintDirectivesTo(directivesToApply, appendable, context, variables);
} | java | static AppendableAndOptions applyStreamingEscapingDirectives(
List<SoyPrintDirective> directives,
Expression appendable,
JbcSrcPluginContext context,
TemplateVariableManager variables) {
List<DirectiveWithArgs> directivesToApply = new ArrayList<>();
for (SoyPrintDirective directive : directives) {
directivesToApply.add(
DirectiveWithArgs.create((SoyJbcSrcPrintDirective.Streamable) directive));
}
return applyStreamingPrintDirectivesTo(directivesToApply, appendable, context, variables);
} | [
"static",
"AppendableAndOptions",
"applyStreamingEscapingDirectives",
"(",
"List",
"<",
"SoyPrintDirective",
">",
"directives",
",",
"Expression",
"appendable",
",",
"JbcSrcPluginContext",
"context",
",",
"TemplateVariableManager",
"variables",
")",
"{",
"List",
"<",
"Dir... | Applies all the streaming print directives to the appendable.
@param directives The directives. All are required to be {@link
com.google.template.soy.jbcsrc.restricted.SoyJbcSrcPrintDirective.Streamable streamable}
@param appendable The appendable to wrap
@param context The render context for the plugins
@param variables The local variable manager
@return The wrapped appendable | [
"Applies",
"all",
"the",
"streaming",
"print",
"directives",
"to",
"the",
"appendable",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/PrintDirectives.java#L92-L103 |
sdl/odata | odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java | EntityDataModelUtil.getAndCheckEntityType | public static EntityType getAndCheckEntityType(EntityDataModel entityDataModel, String typeName) {
return checkIsEntityType(getAndCheckType(entityDataModel, typeName));
} | java | public static EntityType getAndCheckEntityType(EntityDataModel entityDataModel, String typeName) {
return checkIsEntityType(getAndCheckType(entityDataModel, typeName));
} | [
"public",
"static",
"EntityType",
"getAndCheckEntityType",
"(",
"EntityDataModel",
"entityDataModel",
",",
"String",
"typeName",
")",
"{",
"return",
"checkIsEntityType",
"(",
"getAndCheckType",
"(",
"entityDataModel",
",",
"typeName",
")",
")",
";",
"}"
] | Gets the OData type with a specified name and checks if the OData type is an entity type; throws an exception
if the OData type is not an entity type.
@param entityDataModel The entity data model.
@param typeName The type name.
@return The OData entity type with the specified name.
@throws ODataSystemException If there is no OData type with the specified name or if the OData type is not
an entity type. | [
"Gets",
"the",
"OData",
"type",
"with",
"a",
"specified",
"name",
"and",
"checks",
"if",
"the",
"OData",
"type",
"is",
"an",
"entity",
"type",
";",
"throws",
"an",
"exception",
"if",
"the",
"OData",
"type",
"is",
"not",
"an",
"entity",
"type",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L222-L224 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularTools_F32.java | EquirectangularTools_F32.equiToLatLon | public void equiToLatLon(float x , float y , GeoLL_F32 geo ) {
geo.lon = (x/width - 0.5f)*GrlConstants.F_PI2;
geo.lat = (y/(height-1) - 0.5f)*GrlConstants.F_PI;
} | java | public void equiToLatLon(float x , float y , GeoLL_F32 geo ) {
geo.lon = (x/width - 0.5f)*GrlConstants.F_PI2;
geo.lat = (y/(height-1) - 0.5f)*GrlConstants.F_PI;
} | [
"public",
"void",
"equiToLatLon",
"(",
"float",
"x",
",",
"float",
"y",
",",
"GeoLL_F32",
"geo",
")",
"{",
"geo",
".",
"lon",
"=",
"(",
"x",
"/",
"width",
"-",
"0.5f",
")",
"*",
"GrlConstants",
".",
"F_PI2",
";",
"geo",
".",
"lat",
"=",
"(",
"y",... | Converts the equirectangular coordinate into a latitude and longitude
@param x pixel coordinate in equirectangular image
@param y pixel coordinate in equirectangular image
@param geo (output) | [
"Converts",
"the",
"equirectangular",
"coordinate",
"into",
"a",
"latitude",
"and",
"longitude"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularTools_F32.java#L118-L121 |
victims/victims-lib-java | src/main/java/com/redhat/victims/fingerprint/JarFile.java | JarFile.addContent | protected synchronized void addContent(Artifact record, String filename) {
if (record != null) {
if (filename.endsWith(".jar")) {
// this is an embedded archive
embedded.add(record);
} else {
contents.add(record);
}
}
} | java | protected synchronized void addContent(Artifact record, String filename) {
if (record != null) {
if (filename.endsWith(".jar")) {
// this is an embedded archive
embedded.add(record);
} else {
contents.add(record);
}
}
} | [
"protected",
"synchronized",
"void",
"addContent",
"(",
"Artifact",
"record",
",",
"String",
"filename",
")",
"{",
"if",
"(",
"record",
"!=",
"null",
")",
"{",
"if",
"(",
"filename",
".",
"endsWith",
"(",
"\".jar\"",
")",
")",
"{",
"// this is an embedded ar... | Synchronized method for adding a new conent
@param record
@param filename | [
"Synchronized",
"method",
"for",
"adding",
"a",
"new",
"conent"
] | train | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/fingerprint/JarFile.java#L74-L83 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLDiscriminatorState.java | SSLDiscriminatorState.updateState | public void updateState(SSLContext context, SSLEngine engine, SSLEngineResult result, WsByteBuffer decNetBuf, int position, int limit) {
this.sslContext = context;
this.sslEngine = engine;
this.sslEngineResult = result;
this.decryptedNetBuffer = decNetBuf;
this.netBufferPosition = position;
this.netBufferLimit = limit;
} | java | public void updateState(SSLContext context, SSLEngine engine, SSLEngineResult result, WsByteBuffer decNetBuf, int position, int limit) {
this.sslContext = context;
this.sslEngine = engine;
this.sslEngineResult = result;
this.decryptedNetBuffer = decNetBuf;
this.netBufferPosition = position;
this.netBufferLimit = limit;
} | [
"public",
"void",
"updateState",
"(",
"SSLContext",
"context",
",",
"SSLEngine",
"engine",
",",
"SSLEngineResult",
"result",
",",
"WsByteBuffer",
"decNetBuf",
",",
"int",
"position",
",",
"int",
"limit",
")",
"{",
"this",
".",
"sslContext",
"=",
"context",
";"... | Update this state object with current information. This is called when a
YES response comes from the discriminator. The position and limit must be
saved here so the ready method can adjust them right away.
@param context
@param engine
@param result
@param decNetBuf
@param position
@param limit | [
"Update",
"this",
"state",
"object",
"with",
"current",
"information",
".",
"This",
"is",
"called",
"when",
"a",
"YES",
"response",
"comes",
"from",
"the",
"discriminator",
".",
"The",
"position",
"and",
"limit",
"must",
"be",
"saved",
"here",
"so",
"the",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLDiscriminatorState.java#L59-L66 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwxmlschema.java | appfwxmlschema.get | public static appfwxmlschema get(nitro_service service, String name) throws Exception{
appfwxmlschema obj = new appfwxmlschema();
obj.set_name(name);
appfwxmlschema response = (appfwxmlschema) obj.get_resource(service);
return response;
} | java | public static appfwxmlschema get(nitro_service service, String name) throws Exception{
appfwxmlschema obj = new appfwxmlschema();
obj.set_name(name);
appfwxmlschema response = (appfwxmlschema) obj.get_resource(service);
return response;
} | [
"public",
"static",
"appfwxmlschema",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"appfwxmlschema",
"obj",
"=",
"new",
"appfwxmlschema",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"appfwx... | Use this API to fetch appfwxmlschema resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"appfwxmlschema",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwxmlschema.java#L125-L130 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.multAddTransAB | public static void multAddTransAB(double alpha , DMatrix1Row a , DMatrix1Row b , DMatrix1Row c )
{
// TODO add a matrix vectory multiply here
if( a.numCols >= EjmlParameters.MULT_TRANAB_COLUMN_SWITCH ) {
MatrixMatrixMult_DDRM.multAddTransAB_aux(alpha, a, b, c, null);
} else {
MatrixMatrixMult_DDRM.multAddTransAB(alpha, a, b, c);
}
} | java | public static void multAddTransAB(double alpha , DMatrix1Row a , DMatrix1Row b , DMatrix1Row c )
{
// TODO add a matrix vectory multiply here
if( a.numCols >= EjmlParameters.MULT_TRANAB_COLUMN_SWITCH ) {
MatrixMatrixMult_DDRM.multAddTransAB_aux(alpha, a, b, c, null);
} else {
MatrixMatrixMult_DDRM.multAddTransAB(alpha, a, b, c);
}
} | [
"public",
"static",
"void",
"multAddTransAB",
"(",
"double",
"alpha",
",",
"DMatrix1Row",
"a",
",",
"DMatrix1Row",
"b",
",",
"DMatrix1Row",
"c",
")",
"{",
"// TODO add a matrix vectory multiply here",
"if",
"(",
"a",
".",
"numCols",
">=",
"EjmlParameters",
".",
... | <p>
Performs the following operation:<br>
<br>
c = c + α * a<sup>T</sup> * b<sup>T</sup><br>
c<sub>ij</sub> = c<sub>ij</sub> + α * ∑<sub>k=1:n</sub> { a<sub>ki</sub> * b<sub>jk</sub>}
</p>
@param alpha Scaling factor.
@param a The left matrix in the multiplication operation. Not Modified.
@param b The right matrix in the multiplication operation. Not Modified.
@param c Where the results of the operation are stored. Modified. | [
"<p",
">",
"Performs",
"the",
"following",
"operation",
":",
"<br",
">",
"<br",
">",
"c",
"=",
"c",
"+",
"&alpha",
";",
"*",
"a<sup",
">",
"T<",
"/",
"sup",
">",
"*",
"b<sup",
">",
"T<",
"/",
"sup",
">",
"<br",
">",
"c<sub",
">",
"ij<",
"/",
... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L500-L508 |
openengsb/openengsb | api/ekb/src/main/java/org/openengsb/core/ekb/api/transformation/TransformationDescription.java | TransformationDescription.substringField | public void substringField(String sourceField, String targetField, String from, String to) {
TransformationStep step = new TransformationStep();
step.setTargetField(targetField);
step.setSourceFields(sourceField);
step.setOperationParameter(TransformationConstants.SUBSTRING_FROM_PARAM, from);
step.setOperationParameter(TransformationConstants.SUBSTRING_TO_PARAM, to);
step.setOperationName("substring");
steps.add(step);
} | java | public void substringField(String sourceField, String targetField, String from, String to) {
TransformationStep step = new TransformationStep();
step.setTargetField(targetField);
step.setSourceFields(sourceField);
step.setOperationParameter(TransformationConstants.SUBSTRING_FROM_PARAM, from);
step.setOperationParameter(TransformationConstants.SUBSTRING_TO_PARAM, to);
step.setOperationName("substring");
steps.add(step);
} | [
"public",
"void",
"substringField",
"(",
"String",
"sourceField",
",",
"String",
"targetField",
",",
"String",
"from",
",",
"String",
"to",
")",
"{",
"TransformationStep",
"step",
"=",
"new",
"TransformationStep",
"(",
")",
";",
"step",
".",
"setTargetField",
... | Adds a substring step to the transformation description. The value of the source field is taken and it is tried
to build the substring from the given index from to the given index to. From and to must be Integers written as
String, the value of the source field must also be a String. | [
"Adds",
"a",
"substring",
"step",
"to",
"the",
"transformation",
"description",
".",
"The",
"value",
"of",
"the",
"source",
"field",
"is",
"taken",
"and",
"it",
"is",
"tried",
"to",
"build",
"the",
"substring",
"from",
"the",
"given",
"index",
"from",
"to"... | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/api/ekb/src/main/java/org/openengsb/core/ekb/api/transformation/TransformationDescription.java#L139-L147 |
wcm-io/wcm-io-handler | commons/src/main/java/io/wcm/handler/commons/dom/AbstractHtmlElementFactory.java | AbstractHtmlElementFactory.createAnchor | public Anchor createAnchor(String href, String target) {
return this.add(new Anchor(href, target));
} | java | public Anchor createAnchor(String href, String target) {
return this.add(new Anchor(href, target));
} | [
"public",
"Anchor",
"createAnchor",
"(",
"String",
"href",
",",
"String",
"target",
")",
"{",
"return",
"this",
".",
"add",
"(",
"new",
"Anchor",
"(",
"href",
",",
"target",
")",
")",
";",
"}"
] | Creates and adds anchor (a) element.
@param href Html "href" attribute.
@param target Html "target" attribute.
@return Html element. | [
"Creates",
"and",
"adds",
"anchor",
"(",
"a",
")",
"element",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/commons/src/main/java/io/wcm/handler/commons/dom/AbstractHtmlElementFactory.java#L110-L112 |
hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/RunResultRecorder.java | RunResultRecorder.createHtmlReport | @SuppressWarnings("squid:S134")
private void createHtmlReport(FilePath reportFolder,
String testFolderPath,
File artifactsDir,
List<String> reportNames,
TestResult testResult) throws IOException, InterruptedException {
String archiveTestResultMode =
_resultsPublisherModel.getArchiveTestResultsMode();
boolean createReport = archiveTestResultMode.equals(ResultsPublisherModel.CreateHtmlReportResults.getValue());
if (createReport) {
File testFolderPathFile = new File(testFolderPath);
FilePath srcDirectoryFilePath = new FilePath(reportFolder, HTML_REPORT_FOLDER);
if (srcDirectoryFilePath.exists()) {
FilePath srcFilePath = new FilePath(srcDirectoryFilePath, IE_REPORT_FOLDER);
if (srcFilePath.exists()) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
srcFilePath.zip(baos);
File reportDirectory = new File(artifactsDir.getParent(), PERFORMANCE_REPORT_FOLDER);
if (!reportDirectory.exists()) {
reportDirectory.mkdir();
}
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
FilePath reportDirectoryFilePath = new FilePath(reportDirectory);
FilePath tmpZipFile = new FilePath(reportDirectoryFilePath, "tmp.zip");
tmpZipFile.copyFrom(bais);
bais.close();
baos.close();
tmpZipFile.unzip(reportDirectoryFilePath);
String newFolderName = org.apache.commons.io.FilenameUtils.getName(testFolderPathFile.getPath());
FileUtils.moveDirectory(new File(reportDirectory, IE_REPORT_FOLDER),
new File(reportDirectory, newFolderName));
tmpZipFile.delete();
outputReportFiles(reportNames, reportDirectory, testResult, false);
}
}
}
} | java | @SuppressWarnings("squid:S134")
private void createHtmlReport(FilePath reportFolder,
String testFolderPath,
File artifactsDir,
List<String> reportNames,
TestResult testResult) throws IOException, InterruptedException {
String archiveTestResultMode =
_resultsPublisherModel.getArchiveTestResultsMode();
boolean createReport = archiveTestResultMode.equals(ResultsPublisherModel.CreateHtmlReportResults.getValue());
if (createReport) {
File testFolderPathFile = new File(testFolderPath);
FilePath srcDirectoryFilePath = new FilePath(reportFolder, HTML_REPORT_FOLDER);
if (srcDirectoryFilePath.exists()) {
FilePath srcFilePath = new FilePath(srcDirectoryFilePath, IE_REPORT_FOLDER);
if (srcFilePath.exists()) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
srcFilePath.zip(baos);
File reportDirectory = new File(artifactsDir.getParent(), PERFORMANCE_REPORT_FOLDER);
if (!reportDirectory.exists()) {
reportDirectory.mkdir();
}
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
FilePath reportDirectoryFilePath = new FilePath(reportDirectory);
FilePath tmpZipFile = new FilePath(reportDirectoryFilePath, "tmp.zip");
tmpZipFile.copyFrom(bais);
bais.close();
baos.close();
tmpZipFile.unzip(reportDirectoryFilePath);
String newFolderName = org.apache.commons.io.FilenameUtils.getName(testFolderPathFile.getPath());
FileUtils.moveDirectory(new File(reportDirectory, IE_REPORT_FOLDER),
new File(reportDirectory, newFolderName));
tmpZipFile.delete();
outputReportFiles(reportNames, reportDirectory, testResult, false);
}
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"squid:S134\"",
")",
"private",
"void",
"createHtmlReport",
"(",
"FilePath",
"reportFolder",
",",
"String",
"testFolderPath",
",",
"File",
"artifactsDir",
",",
"List",
"<",
"String",
">",
"reportNames",
",",
"TestResult",
"testResult"... | Copy Summary Html reports created by LoadRunner
@param reportFolder
@param testFolderPath
@param artifactsDir
@param reportNames
@param testResult
@throws IOException
@throws InterruptedException | [
"Copy",
"Summary",
"Html",
"reports",
"created",
"by",
"LoadRunner"
] | train | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/RunResultRecorder.java#L749-L787 |
Netflix/dyno | dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/lb/HttpEndpointBasedTokenMapSupplier.java | HttpEndpointBasedTokenMapSupplier.getTopologyJsonPayload | @Override
public String getTopologyJsonPayload(Set<Host> activeHosts) {
int count = NUM_RETRIER_ACROSS_NODES;
String response;
Exception lastEx = null;
do {
try {
response = getTopologyFromRandomNodeWithRetry(activeHosts);
if (response != null) {
return response;
}
} catch (Exception e) {
lastEx = e;
} finally {
count--;
}
} while ((count > 0));
if (lastEx != null) {
if (lastEx instanceof ConnectTimeoutException) {
throw new TimeoutException("Unable to obtain topology", lastEx);
}
throw new DynoException(lastEx);
} else {
throw new DynoException("Could not contact dynomite for token map");
}
} | java | @Override
public String getTopologyJsonPayload(Set<Host> activeHosts) {
int count = NUM_RETRIER_ACROSS_NODES;
String response;
Exception lastEx = null;
do {
try {
response = getTopologyFromRandomNodeWithRetry(activeHosts);
if (response != null) {
return response;
}
} catch (Exception e) {
lastEx = e;
} finally {
count--;
}
} while ((count > 0));
if (lastEx != null) {
if (lastEx instanceof ConnectTimeoutException) {
throw new TimeoutException("Unable to obtain topology", lastEx);
}
throw new DynoException(lastEx);
} else {
throw new DynoException("Could not contact dynomite for token map");
}
} | [
"@",
"Override",
"public",
"String",
"getTopologyJsonPayload",
"(",
"Set",
"<",
"Host",
">",
"activeHosts",
")",
"{",
"int",
"count",
"=",
"NUM_RETRIER_ACROSS_NODES",
";",
"String",
"response",
";",
"Exception",
"lastEx",
"=",
"null",
";",
"do",
"{",
"try",
... | Tries to get topology information by randomly trying across nodes. | [
"Tries",
"to",
"get",
"topology",
"information",
"by",
"randomly",
"trying",
"across",
"nodes",
"."
] | train | https://github.com/Netflix/dyno/blob/158f807083ea8e9b09c8089cb07f98e954ad5b23/dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/lb/HttpEndpointBasedTokenMapSupplier.java#L82-L110 |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java | HealthStatusHttpMapper.addStatusMapping | public void addStatusMapping(Status status, Integer httpStatus) {
Assert.notNull(status, "Status must not be null");
Assert.notNull(httpStatus, "HttpStatus must not be null");
addStatusMapping(status.getCode(), httpStatus);
} | java | public void addStatusMapping(Status status, Integer httpStatus) {
Assert.notNull(status, "Status must not be null");
Assert.notNull(httpStatus, "HttpStatus must not be null");
addStatusMapping(status.getCode(), httpStatus);
} | [
"public",
"void",
"addStatusMapping",
"(",
"Status",
"status",
",",
"Integer",
"httpStatus",
")",
"{",
"Assert",
".",
"notNull",
"(",
"status",
",",
"\"Status must not be null\"",
")",
";",
"Assert",
".",
"notNull",
"(",
"httpStatus",
",",
"\"HttpStatus must not b... | Add a status mapping to the existing set.
@param status the status to map
@param httpStatus the http status | [
"Add",
"a",
"status",
"mapping",
"to",
"the",
"existing",
"set",
"."
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java#L72-L76 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.assign | public SDVariable assign(SDVariable in, Number value) {
return assign(null, in, value);
} | java | public SDVariable assign(SDVariable in, Number value) {
return assign(null, in, value);
} | [
"public",
"SDVariable",
"assign",
"(",
"SDVariable",
"in",
",",
"Number",
"value",
")",
"{",
"return",
"assign",
"(",
"null",
",",
"in",
",",
"value",
")",
";",
"}"
] | Return an array with equal shape to the input, but all elements set to 'value'
@param in Input variable
@param value Value to set
@return Output variable | [
"Return",
"an",
"array",
"with",
"equal",
"shape",
"to",
"the",
"input",
"but",
"all",
"elements",
"set",
"to",
"value"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L192-L194 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlCompiler.java | SarlCompiler._toJavaStatement | @SuppressWarnings("static-method")
protected void _toJavaStatement(SarlBreakExpression breakExpression, ITreeAppendable appendable, boolean isReferenced) {
appendable.newLine().append("break;"); //$NON-NLS-1$
} | java | @SuppressWarnings("static-method")
protected void _toJavaStatement(SarlBreakExpression breakExpression, ITreeAppendable appendable, boolean isReferenced) {
appendable.newLine().append("break;"); //$NON-NLS-1$
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"void",
"_toJavaStatement",
"(",
"SarlBreakExpression",
"breakExpression",
",",
"ITreeAppendable",
"appendable",
",",
"boolean",
"isReferenced",
")",
"{",
"appendable",
".",
"newLine",
"(",
")",
".",... | Generate the Java code related to the preparation statements for the break keyword.
@param breakExpression the expression.
@param appendable the output.
@param isReferenced indicates if the expression is referenced. | [
"Generate",
"the",
"Java",
"code",
"related",
"to",
"the",
"preparation",
"statements",
"for",
"the",
"break",
"keyword",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlCompiler.java#L528-L531 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java | PersistenceBrokerImpl.commitTransaction | public synchronized void commitTransaction() throws TransactionNotInProgressException, TransactionAbortedException
{
if (!isInTransaction())
{
throw new TransactionNotInProgressException("PersistenceBroker is NOT in transaction, can't commit");
}
fireBrokerEvent(BEFORE_COMMIT_EVENT);
setInTransaction(false);
clearRegistrationLists();
referencesBroker.removePrefetchingListeners();
/*
arminw:
In managed environments it should be possible to close a used connection before
the tx was commited, thus it will be possible that the PB instance is in PB-tx, but
the connection is already closed. To avoid problems check if CM is in local tx before
do the CM.commit call
*/
if(connectionManager.isInLocalTransaction())
{
this.connectionManager.localCommit();
}
fireBrokerEvent(AFTER_COMMIT_EVENT);
} | java | public synchronized void commitTransaction() throws TransactionNotInProgressException, TransactionAbortedException
{
if (!isInTransaction())
{
throw new TransactionNotInProgressException("PersistenceBroker is NOT in transaction, can't commit");
}
fireBrokerEvent(BEFORE_COMMIT_EVENT);
setInTransaction(false);
clearRegistrationLists();
referencesBroker.removePrefetchingListeners();
/*
arminw:
In managed environments it should be possible to close a used connection before
the tx was commited, thus it will be possible that the PB instance is in PB-tx, but
the connection is already closed. To avoid problems check if CM is in local tx before
do the CM.commit call
*/
if(connectionManager.isInLocalTransaction())
{
this.connectionManager.localCommit();
}
fireBrokerEvent(AFTER_COMMIT_EVENT);
} | [
"public",
"synchronized",
"void",
"commitTransaction",
"(",
")",
"throws",
"TransactionNotInProgressException",
",",
"TransactionAbortedException",
"{",
"if",
"(",
"!",
"isInTransaction",
"(",
")",
")",
"{",
"throw",
"new",
"TransactionNotInProgressException",
"(",
"\"P... | Commit and close the transaction.
Calling <code>commit</code> commits to the database all
UPDATE, INSERT and DELETE statements called within the transaction and
releases any locks held by the transaction.
If beginTransaction() has not been called before a
TransactionNotInProgressException exception is thrown.
If the transaction cannot be commited a TransactionAbortedException exception is thrown. | [
"Commit",
"and",
"close",
"the",
"transaction",
".",
"Calling",
"<code",
">",
"commit<",
"/",
"code",
">",
"commits",
"to",
"the",
"database",
"all",
"UPDATE",
"INSERT",
"and",
"DELETE",
"statements",
"called",
"within",
"the",
"transaction",
"and",
"releases"... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L455-L477 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/stats/StatsInterface.java | StatsInterface.getPhotosetStats | public Stats getPhotosetStats(String photosetId, Date date) throws FlickrException {
return getStats(METHOD_GET_PHOTOSET_STATS, "photoset_id", photosetId, date);
} | java | public Stats getPhotosetStats(String photosetId, Date date) throws FlickrException {
return getStats(METHOD_GET_PHOTOSET_STATS, "photoset_id", photosetId, date);
} | [
"public",
"Stats",
"getPhotosetStats",
"(",
"String",
"photosetId",
",",
"Date",
"date",
")",
"throws",
"FlickrException",
"{",
"return",
"getStats",
"(",
"METHOD_GET_PHOTOSET_STATS",
",",
"\"photoset_id\"",
",",
"photosetId",
",",
"date",
")",
";",
"}"
] | Get the number of views, comments and favorites on a photoset for a given date.
@param date
(Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will
automatically be rounded down to the start of the day.
@param photosetId
(Required) The id of the photoset to get stats for.
@see "http://www.flickr.com/services/api/flickr.stats.getPhotosetStats.htm" | [
"Get",
"the",
"number",
"of",
"views",
"comments",
"and",
"favorites",
"on",
"a",
"photoset",
"for",
"a",
"given",
"date",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L254-L256 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java | Memoizer.launderException | private RuntimeException launderException(final Throwable throwable) {
if (throwable instanceof RuntimeException) {
return (RuntimeException) throwable;
} else if (throwable instanceof Error) {
throw (Error) throwable;
} else {
throw new IllegalStateException("Unchecked exception", throwable);
}
} | java | private RuntimeException launderException(final Throwable throwable) {
if (throwable instanceof RuntimeException) {
return (RuntimeException) throwable;
} else if (throwable instanceof Error) {
throw (Error) throwable;
} else {
throw new IllegalStateException("Unchecked exception", throwable);
}
} | [
"private",
"RuntimeException",
"launderException",
"(",
"final",
"Throwable",
"throwable",
")",
"{",
"if",
"(",
"throwable",
"instanceof",
"RuntimeException",
")",
"{",
"return",
"(",
"RuntimeException",
")",
"throwable",
";",
"}",
"else",
"if",
"(",
"throwable",
... | <p>
This method launders a Throwable to either a RuntimeException, Error or
any other Exception wrapped in an IllegalStateException.
</p>
@param throwable
the throwable to laundered
@return a RuntimeException, Error or an IllegalStateException | [
"<p",
">",
"This",
"method",
"launders",
"a",
"Throwable",
"to",
"either",
"a",
"RuntimeException",
"Error",
"or",
"any",
"other",
"Exception",
"wrapped",
"in",
"an",
"IllegalStateException",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java#L159-L167 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java | JobOperations.disableJob | public void disableJob(String jobId, DisableJobOption disableJobOption, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobDisableOptions options = new JobDisableOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().jobs().disable(jobId, disableJobOption, options);
} | java | public void disableJob(String jobId, DisableJobOption disableJobOption, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobDisableOptions options = new JobDisableOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().jobs().disable(jobId, disableJobOption, options);
} | [
"public",
"void",
"disableJob",
"(",
"String",
"jobId",
",",
"DisableJobOption",
"disableJobOption",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"JobDisableOptions",
"options",
"... | Disables the specified job. Disabled jobs do not run new tasks, but may be re-enabled later.
@param jobId The ID of the job.
@param disableJobOption Specifies what to do with running tasks associated with the job.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Disables",
"the",
"specified",
"job",
".",
"Disabled",
"jobs",
"do",
"not",
"run",
"new",
"tasks",
"but",
"may",
"be",
"re",
"-",
"enabled",
"later",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java#L439-L445 |
wcm-io-caravan/caravan-commons | httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/BeanUtil.java | BeanUtil.getMaskedBeanProperties | public static SortedMap<String, Object> getMaskedBeanProperties(Object beanObject, String[] maskProperties) {
try {
SortedMap<String, Object> configProperties = new TreeMap<String, Object>(BeanUtils.describe(beanObject));
// always ignore "class" properties which is added by BeanUtils.describe by default
configProperties.remove("class");
// Mask some properties with confidential information (if set to any value)
if (maskProperties != null) {
for (String propertyName : maskProperties) {
if (configProperties.containsKey(propertyName) && configProperties.get(propertyName) != null) {
configProperties.put(propertyName, "***");
}
}
}
return configProperties;
}
catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) {
throw new IllegalArgumentException("Unable to get properties from: " + beanObject, ex);
}
} | java | public static SortedMap<String, Object> getMaskedBeanProperties(Object beanObject, String[] maskProperties) {
try {
SortedMap<String, Object> configProperties = new TreeMap<String, Object>(BeanUtils.describe(beanObject));
// always ignore "class" properties which is added by BeanUtils.describe by default
configProperties.remove("class");
// Mask some properties with confidential information (if set to any value)
if (maskProperties != null) {
for (String propertyName : maskProperties) {
if (configProperties.containsKey(propertyName) && configProperties.get(propertyName) != null) {
configProperties.put(propertyName, "***");
}
}
}
return configProperties;
}
catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) {
throw new IllegalArgumentException("Unable to get properties from: " + beanObject, ex);
}
} | [
"public",
"static",
"SortedMap",
"<",
"String",
",",
"Object",
">",
"getMaskedBeanProperties",
"(",
"Object",
"beanObject",
",",
"String",
"[",
"]",
"maskProperties",
")",
"{",
"try",
"{",
"SortedMap",
"<",
"String",
",",
"Object",
">",
"configProperties",
"="... | Get map with key/value pairs for properties of a java bean (using {@link BeanUtils#describe(Object)}).
An array of property names can be passed that should be masked with "***" because they contain sensitive
information.
@param beanObject Bean object
@param maskProperties List of property names
@return Map with masked key/value pairs | [
"Get",
"map",
"with",
"key",
"/",
"value",
"pairs",
"for",
"properties",
"of",
"a",
"java",
"bean",
"(",
"using",
"{"
] | train | https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/BeanUtil.java#L45-L66 |
killbill/killbill | invoice/src/main/java/org/killbill/billing/invoice/tree/ItemsInterval.java | ItemsInterval.createNewItem | private Item createNewItem(@Nullable final LocalDate startDate, @Nullable final LocalDate endDate, @Nullable final UUID targetInvoiceId, final boolean mergeMode) {
// Find the ADD (build phase) or CANCEL (merge phase) item of this interval
final Item item = getResultingItem(mergeMode);
if (item == null || startDate == null || endDate == null || targetInvoiceId == null) {
return item;
}
// Prorate (build phase) or repair (merge phase) this item, as needed
final InvoiceItem proratedInvoiceItem = item.toProratedInvoiceItem(startDate, endDate);
if (proratedInvoiceItem == null) {
return null;
} else {
// Keep track of the repaired amount for this item
item.incrementCurrentRepairedAmount(proratedInvoiceItem.getAmount().abs());
return new Item(proratedInvoiceItem, targetInvoiceId, item.getAction());
}
} | java | private Item createNewItem(@Nullable final LocalDate startDate, @Nullable final LocalDate endDate, @Nullable final UUID targetInvoiceId, final boolean mergeMode) {
// Find the ADD (build phase) or CANCEL (merge phase) item of this interval
final Item item = getResultingItem(mergeMode);
if (item == null || startDate == null || endDate == null || targetInvoiceId == null) {
return item;
}
// Prorate (build phase) or repair (merge phase) this item, as needed
final InvoiceItem proratedInvoiceItem = item.toProratedInvoiceItem(startDate, endDate);
if (proratedInvoiceItem == null) {
return null;
} else {
// Keep track of the repaired amount for this item
item.incrementCurrentRepairedAmount(proratedInvoiceItem.getAmount().abs());
return new Item(proratedInvoiceItem, targetInvoiceId, item.getAction());
}
} | [
"private",
"Item",
"createNewItem",
"(",
"@",
"Nullable",
"final",
"LocalDate",
"startDate",
",",
"@",
"Nullable",
"final",
"LocalDate",
"endDate",
",",
"@",
"Nullable",
"final",
"UUID",
"targetInvoiceId",
",",
"final",
"boolean",
"mergeMode",
")",
"{",
"// Find... | Create a new item based on the existing items and new service period
<p/>
<ul>
<li>During the build phase, we only consider ADD items. This happens when for instance an existing item was partially repaired
and there is a need to create a new item which represents the part left -- that was not repaired.
<li>During the merge phase, we create new items that are the missing repaired items (CANCEL).
</ul>
@param startDate start date of the new item to create
@param endDate end date of the new item to create
@param mergeMode mode to consider.
@return new item for this service period or null | [
"Create",
"a",
"new",
"item",
"based",
"on",
"the",
"existing",
"items",
"and",
"new",
"service",
"period",
"<p",
"/",
">",
"<ul",
">",
"<li",
">",
"During",
"the",
"build",
"phase",
"we",
"only",
"consider",
"ADD",
"items",
".",
"This",
"happens",
"wh... | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/tree/ItemsInterval.java#L178-L194 |
hawkular/hawkular-apm | api/src/main/java/org/hawkular/apm/api/services/Criteria.java | Criteria.addProperty | public Criteria addProperty(String name, String value, Operator operator) {
properties.add(new PropertyCriteria(name, value, operator));
return this;
} | java | public Criteria addProperty(String name, String value, Operator operator) {
properties.add(new PropertyCriteria(name, value, operator));
return this;
} | [
"public",
"Criteria",
"addProperty",
"(",
"String",
"name",
",",
"String",
"value",
",",
"Operator",
"operator",
")",
"{",
"properties",
".",
"add",
"(",
"new",
"PropertyCriteria",
"(",
"name",
",",
"value",
",",
"operator",
")",
")",
";",
"return",
"this"... | This method adds a new property criteria.
@param name The property name
@param value The property value
@param operator The property operator
@return The criteria | [
"This",
"method",
"adds",
"a",
"new",
"property",
"criteria",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/api/src/main/java/org/hawkular/apm/api/services/Criteria.java#L196-L199 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/InitOnceFieldHandler.java | InitOnceFieldHandler.syncClonedListener | public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled)
{
bInitCalled = super.syncClonedListener(field, listener, bInitCalled);
((InitOnceFieldHandler)listener).setFirstTime(m_bFirstTime);
return bInitCalled;
} | java | public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled)
{
bInitCalled = super.syncClonedListener(field, listener, bInitCalled);
((InitOnceFieldHandler)listener).setFirstTime(m_bFirstTime);
return bInitCalled;
} | [
"public",
"boolean",
"syncClonedListener",
"(",
"BaseField",
"field",
",",
"FieldListener",
"listener",
",",
"boolean",
"bInitCalled",
")",
"{",
"bInitCalled",
"=",
"super",
".",
"syncClonedListener",
"(",
"field",
",",
"listener",
",",
"bInitCalled",
")",
";",
... | Set this cloned listener to the same state at this listener.
@param field The field this new listener will be added to.
@param The new listener to sync to this.
@param Has the init method been called?
@return True if I called init. | [
"Set",
"this",
"cloned",
"listener",
"to",
"the",
"same",
"state",
"at",
"this",
"listener",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/InitOnceFieldHandler.java#L80-L85 |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java | CheckArg.isLessThan | public static void isLessThan( int argument,
int lessThanValue,
String name ) {
if (argument >= lessThanValue) {
throw new IllegalArgumentException(CommonI18n.argumentMustBeLessThan.text(name, argument, lessThanValue));
}
} | java | public static void isLessThan( int argument,
int lessThanValue,
String name ) {
if (argument >= lessThanValue) {
throw new IllegalArgumentException(CommonI18n.argumentMustBeLessThan.text(name, argument, lessThanValue));
}
} | [
"public",
"static",
"void",
"isLessThan",
"(",
"int",
"argument",
",",
"int",
"lessThanValue",
",",
"String",
"name",
")",
"{",
"if",
"(",
"argument",
">=",
"lessThanValue",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"CommonI18n",
".",
"argumen... | Check that the argument is less than the supplied value
@param argument The argument
@param lessThanValue the value that is to be used to check the value
@param name The name of the argument
@throws IllegalArgumentException If argument is not less than the supplied value | [
"Check",
"that",
"the",
"argument",
"is",
"less",
"than",
"the",
"supplied",
"value"
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java#L105-L111 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.