repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
di2e/Argo | CommonUtils/src/main/java/ws/argo/common/config/ResolvingXMLConfiguration.java | ResolvingXMLConfiguration.ipAddressFromURL | private String ipAddressFromURL(String url, String name) {
"""
Resolve the IP address from a URL.
@param url and URL that will return an IP address
@param name the name of the variable
@return the result from the HTTP GET operations or null of an error
"""
String ipAddr = null;
if (_urlValidator.isValid(url)) {
WebTarget resolver = ClientBuilder.newClient().target(url);
try {
ipAddr = resolver.request().get(String.class);
} catch (Exception e) {
warn("URL Cannot Resolve for resolveIP named [" + name + "]. The requested URL is invalid [" + url + "].");
}
} else {
warn("The requested URL for resolveIP named [" + name + "] is invalid [" + url + "].");
}
return ipAddr;
} | java | private String ipAddressFromURL(String url, String name) {
String ipAddr = null;
if (_urlValidator.isValid(url)) {
WebTarget resolver = ClientBuilder.newClient().target(url);
try {
ipAddr = resolver.request().get(String.class);
} catch (Exception e) {
warn("URL Cannot Resolve for resolveIP named [" + name + "]. The requested URL is invalid [" + url + "].");
}
} else {
warn("The requested URL for resolveIP named [" + name + "] is invalid [" + url + "].");
}
return ipAddr;
} | [
"private",
"String",
"ipAddressFromURL",
"(",
"String",
"url",
",",
"String",
"name",
")",
"{",
"String",
"ipAddr",
"=",
"null",
";",
"if",
"(",
"_urlValidator",
".",
"isValid",
"(",
"url",
")",
")",
"{",
"WebTarget",
"resolver",
"=",
"ClientBuilder",
".",
"newClient",
"(",
")",
".",
"target",
"(",
"url",
")",
";",
"try",
"{",
"ipAddr",
"=",
"resolver",
".",
"request",
"(",
")",
".",
"get",
"(",
"String",
".",
"class",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"warn",
"(",
"\"URL Cannot Resolve for resolveIP named [\"",
"+",
"name",
"+",
"\"]. The requested URL is invalid [\"",
"+",
"url",
"+",
"\"].\"",
")",
";",
"}",
"}",
"else",
"{",
"warn",
"(",
"\"The requested URL for resolveIP named [\"",
"+",
"name",
"+",
"\"] is invalid [\"",
"+",
"url",
"+",
"\"].\"",
")",
";",
"}",
"return",
"ipAddr",
";",
"}"
] | Resolve the IP address from a URL.
@param url and URL that will return an IP address
@param name the name of the variable
@return the result from the HTTP GET operations or null of an error | [
"Resolve",
"the",
"IP",
"address",
"from",
"a",
"URL",
"."
] | train | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CommonUtils/src/main/java/ws/argo/common/config/ResolvingXMLConfiguration.java#L145-L159 |
intellimate/Izou | src/main/java/org/intellimate/izou/output/OutputManager.java | OutputManager.generateAllOutputExtensions | public <T, X> List<CompletableFuture<X>> generateAllOutputExtensions(OutputPluginModel<T, X> outputPlugin,
T t, EventModel event) {
"""
Starts every associated OutputExtension
@param outputPlugin the OutputPlugin to generate the Data for
@param t the argument or null
@param event the Event to generate for
@param <T> the type of the argument
@param <X> the return type
@return a List of Future-Objects
"""
IdentifiableSet<OutputExtensionModel<?, ?>> extensions = outputExtensions.get(outputPlugin.getID());
if (extensions == null)
return new ArrayList<>();
return filterType(extensions, outputPlugin).stream()
.map(extension -> {
try {
//noinspection unchecked
return (OutputExtensionModel<X, T>) extension;
} catch (ClassCastException e) {
return null;
}
})
.filter(Objects::nonNull)
.filter(outputExtension -> outputExtension.canRun(event))
.map(extension -> submit(() -> extension.generate(event, t)))
.collect(Collectors.toList());
} | java | public <T, X> List<CompletableFuture<X>> generateAllOutputExtensions(OutputPluginModel<T, X> outputPlugin,
T t, EventModel event) {
IdentifiableSet<OutputExtensionModel<?, ?>> extensions = outputExtensions.get(outputPlugin.getID());
if (extensions == null)
return new ArrayList<>();
return filterType(extensions, outputPlugin).stream()
.map(extension -> {
try {
//noinspection unchecked
return (OutputExtensionModel<X, T>) extension;
} catch (ClassCastException e) {
return null;
}
})
.filter(Objects::nonNull)
.filter(outputExtension -> outputExtension.canRun(event))
.map(extension -> submit(() -> extension.generate(event, t)))
.collect(Collectors.toList());
} | [
"public",
"<",
"T",
",",
"X",
">",
"List",
"<",
"CompletableFuture",
"<",
"X",
">",
">",
"generateAllOutputExtensions",
"(",
"OutputPluginModel",
"<",
"T",
",",
"X",
">",
"outputPlugin",
",",
"T",
"t",
",",
"EventModel",
"event",
")",
"{",
"IdentifiableSet",
"<",
"OutputExtensionModel",
"<",
"?",
",",
"?",
">",
">",
"extensions",
"=",
"outputExtensions",
".",
"get",
"(",
"outputPlugin",
".",
"getID",
"(",
")",
")",
";",
"if",
"(",
"extensions",
"==",
"null",
")",
"return",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"return",
"filterType",
"(",
"extensions",
",",
"outputPlugin",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"extension",
"->",
"{",
"try",
"{",
"//noinspection unchecked",
"return",
"(",
"OutputExtensionModel",
"<",
"X",
",",
"T",
">",
")",
"extension",
";",
"}",
"catch",
"(",
"ClassCastException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
")",
".",
"filter",
"(",
"Objects",
"::",
"nonNull",
")",
".",
"filter",
"(",
"outputExtension",
"->",
"outputExtension",
".",
"canRun",
"(",
"event",
")",
")",
".",
"map",
"(",
"extension",
"->",
"submit",
"(",
"(",
")",
"->",
"extension",
".",
"generate",
"(",
"event",
",",
"t",
")",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"}"
] | Starts every associated OutputExtension
@param outputPlugin the OutputPlugin to generate the Data for
@param t the argument or null
@param event the Event to generate for
@param <T> the type of the argument
@param <X> the return type
@return a List of Future-Objects | [
"Starts",
"every",
"associated",
"OutputExtension"
] | train | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/output/OutputManager.java#L258-L276 |
Alluxio/alluxio | core/server/common/src/main/java/alluxio/cli/validation/Utils.java | Utils.isAddressReachable | public static boolean isAddressReachable(String hostname, int port) {
"""
Validates whether a network address is reachable.
@param hostname host name of the network address
@param port port of the network address
@return whether the network address is reachable
"""
try (Socket socket = new Socket(hostname, port)) {
return true;
} catch (IOException e) {
return false;
}
} | java | public static boolean isAddressReachable(String hostname, int port) {
try (Socket socket = new Socket(hostname, port)) {
return true;
} catch (IOException e) {
return false;
}
} | [
"public",
"static",
"boolean",
"isAddressReachable",
"(",
"String",
"hostname",
",",
"int",
"port",
")",
"{",
"try",
"(",
"Socket",
"socket",
"=",
"new",
"Socket",
"(",
"hostname",
",",
"port",
")",
")",
"{",
"return",
"true",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
] | Validates whether a network address is reachable.
@param hostname host name of the network address
@param port port of the network address
@return whether the network address is reachable | [
"Validates",
"whether",
"a",
"network",
"address",
"is",
"reachable",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/cli/validation/Utils.java#L46-L52 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/AbstractGpxParserDefault.java | AbstractGpxParserDefault.startElement | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
"""
Fires whenever an XML start markup is encountered. It takes general
information about the document. It change the ContentHandler to parse
specific informations when <wpt>, <rte> or <trk> markup are found.
@param uri URI of the local element
@param localName Name of the local element (without prefix)
@param qName qName of the local element (with prefix)
@param attributes Attributes of the local element (contained in the
markup)
@throws SAXException Any SAX exception, possibly wrapping another
exception
"""
if (localName.compareToIgnoreCase(GPXTags.GPX) == 0) {
version = attributes.getValue(GPXTags.VERSION);
creator = attributes.getValue(GPXTags.CREATOR);
} else if (localName.compareToIgnoreCase(GPXTags.BOUNDS) == 0) {
minLat = Double.parseDouble(attributes.getValue(GPXTags.MINLAT));
maxLat = Double.parseDouble(attributes.getValue(GPXTags.MAXLAT));
minLon = Double.parseDouble(attributes.getValue(GPXTags.MINLON));
maxLon = Double.parseDouble(attributes.getValue(GPXTags.MAXLON));
}
// Clear content buffer
getContentBuffer()
.delete(0, getContentBuffer().length());
// Store name of current element in stack
getElementNames()
.push(qName);
} | java | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (localName.compareToIgnoreCase(GPXTags.GPX) == 0) {
version = attributes.getValue(GPXTags.VERSION);
creator = attributes.getValue(GPXTags.CREATOR);
} else if (localName.compareToIgnoreCase(GPXTags.BOUNDS) == 0) {
minLat = Double.parseDouble(attributes.getValue(GPXTags.MINLAT));
maxLat = Double.parseDouble(attributes.getValue(GPXTags.MAXLAT));
minLon = Double.parseDouble(attributes.getValue(GPXTags.MINLON));
maxLon = Double.parseDouble(attributes.getValue(GPXTags.MAXLON));
}
// Clear content buffer
getContentBuffer()
.delete(0, getContentBuffer().length());
// Store name of current element in stack
getElementNames()
.push(qName);
} | [
"@",
"Override",
"public",
"void",
"startElement",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"qName",
",",
"Attributes",
"attributes",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"localName",
".",
"compareToIgnoreCase",
"(",
"GPXTags",
".",
"GPX",
")",
"==",
"0",
")",
"{",
"version",
"=",
"attributes",
".",
"getValue",
"(",
"GPXTags",
".",
"VERSION",
")",
";",
"creator",
"=",
"attributes",
".",
"getValue",
"(",
"GPXTags",
".",
"CREATOR",
")",
";",
"}",
"else",
"if",
"(",
"localName",
".",
"compareToIgnoreCase",
"(",
"GPXTags",
".",
"BOUNDS",
")",
"==",
"0",
")",
"{",
"minLat",
"=",
"Double",
".",
"parseDouble",
"(",
"attributes",
".",
"getValue",
"(",
"GPXTags",
".",
"MINLAT",
")",
")",
";",
"maxLat",
"=",
"Double",
".",
"parseDouble",
"(",
"attributes",
".",
"getValue",
"(",
"GPXTags",
".",
"MAXLAT",
")",
")",
";",
"minLon",
"=",
"Double",
".",
"parseDouble",
"(",
"attributes",
".",
"getValue",
"(",
"GPXTags",
".",
"MINLON",
")",
")",
";",
"maxLon",
"=",
"Double",
".",
"parseDouble",
"(",
"attributes",
".",
"getValue",
"(",
"GPXTags",
".",
"MAXLON",
")",
")",
";",
"}",
"// Clear content buffer",
"getContentBuffer",
"(",
")",
".",
"delete",
"(",
"0",
",",
"getContentBuffer",
"(",
")",
".",
"length",
"(",
")",
")",
";",
"// Store name of current element in stack",
"getElementNames",
"(",
")",
".",
"push",
"(",
"qName",
")",
";",
"}"
] | Fires whenever an XML start markup is encountered. It takes general
information about the document. It change the ContentHandler to parse
specific informations when <wpt>, <rte> or <trk> markup are found.
@param uri URI of the local element
@param localName Name of the local element (without prefix)
@param qName qName of the local element (with prefix)
@param attributes Attributes of the local element (contained in the
markup)
@throws SAXException Any SAX exception, possibly wrapping another
exception | [
"Fires",
"whenever",
"an",
"XML",
"start",
"markup",
"is",
"encountered",
".",
"It",
"takes",
"general",
"information",
"about",
"the",
"document",
".",
"It",
"change",
"the",
"ContentHandler",
"to",
"parse",
"specific",
"informations",
"when",
"<wpt",
">",
"<rte",
">",
"or",
"<trk",
">",
"markup",
"are",
"found",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/AbstractGpxParserDefault.java#L231-L249 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java | BaseXmlParser.findTag | protected Element findTag(String tagName, Element element) {
"""
Find the child element whose tag matches the specified tag name.
@param tagName Tag name to locate.
@param element Parent element whose children are to be searched.
@return The matching node (first occurrence only) or null if not found.
"""
Node result = element.getFirstChild();
while (result != null) {
if (result instanceof Element
&& (tagName.equals(((Element) result).getNodeName()) || tagName
.equals(((Element) result).getLocalName()))) {
break;
}
result = result.getNextSibling();
}
return (Element) result;
} | java | protected Element findTag(String tagName, Element element) {
Node result = element.getFirstChild();
while (result != null) {
if (result instanceof Element
&& (tagName.equals(((Element) result).getNodeName()) || tagName
.equals(((Element) result).getLocalName()))) {
break;
}
result = result.getNextSibling();
}
return (Element) result;
} | [
"protected",
"Element",
"findTag",
"(",
"String",
"tagName",
",",
"Element",
"element",
")",
"{",
"Node",
"result",
"=",
"element",
".",
"getFirstChild",
"(",
")",
";",
"while",
"(",
"result",
"!=",
"null",
")",
"{",
"if",
"(",
"result",
"instanceof",
"Element",
"&&",
"(",
"tagName",
".",
"equals",
"(",
"(",
"(",
"Element",
")",
"result",
")",
".",
"getNodeName",
"(",
")",
")",
"||",
"tagName",
".",
"equals",
"(",
"(",
"(",
"Element",
")",
"result",
")",
".",
"getLocalName",
"(",
")",
")",
")",
")",
"{",
"break",
";",
"}",
"result",
"=",
"result",
".",
"getNextSibling",
"(",
")",
";",
"}",
"return",
"(",
"Element",
")",
"result",
";",
"}"
] | Find the child element whose tag matches the specified tag name.
@param tagName Tag name to locate.
@param element Parent element whose children are to be searched.
@return The matching node (first occurrence only) or null if not found. | [
"Find",
"the",
"child",
"element",
"whose",
"tag",
"matches",
"the",
"specified",
"tag",
"name",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java#L60-L73 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java | BoxApiBookmark.getAddCommentRequest | public BoxRequestsBookmark.AddCommentToBookmark getAddCommentRequest(String bookmarkId, String message) {
"""
Gets a request that adds a comment to a bookmark
@param bookmarkId id of the bookmark to add the comment to
@param message message for the comment that will be added
@return request to add a comment to a bookmark
"""
BoxRequestsBookmark.AddCommentToBookmark request = new BoxRequestsBookmark.AddCommentToBookmark(bookmarkId, message, getCommentUrl(), mSession);
return request;
} | java | public BoxRequestsBookmark.AddCommentToBookmark getAddCommentRequest(String bookmarkId, String message) {
BoxRequestsBookmark.AddCommentToBookmark request = new BoxRequestsBookmark.AddCommentToBookmark(bookmarkId, message, getCommentUrl(), mSession);
return request;
} | [
"public",
"BoxRequestsBookmark",
".",
"AddCommentToBookmark",
"getAddCommentRequest",
"(",
"String",
"bookmarkId",
",",
"String",
"message",
")",
"{",
"BoxRequestsBookmark",
".",
"AddCommentToBookmark",
"request",
"=",
"new",
"BoxRequestsBookmark",
".",
"AddCommentToBookmark",
"(",
"bookmarkId",
",",
"message",
",",
"getCommentUrl",
"(",
")",
",",
"mSession",
")",
";",
"return",
"request",
";",
"}"
] | Gets a request that adds a comment to a bookmark
@param bookmarkId id of the bookmark to add the comment to
@param message message for the comment that will be added
@return request to add a comment to a bookmark | [
"Gets",
"a",
"request",
"that",
"adds",
"a",
"comment",
"to",
"a",
"bookmark"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java#L181-L184 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java | IntInterval.fromTo | public static IntInterval fromTo(int from, int to) {
"""
Returns an IntInterval starting from the value from to the specified value to with a step value of 1.
"""
if (from <= to)
{
return IntInterval.fromToBy(from, to, 1);
}
return IntInterval.fromToBy(from, to, -1);
} | java | public static IntInterval fromTo(int from, int to)
{
if (from <= to)
{
return IntInterval.fromToBy(from, to, 1);
}
return IntInterval.fromToBy(from, to, -1);
} | [
"public",
"static",
"IntInterval",
"fromTo",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"if",
"(",
"from",
"<=",
"to",
")",
"{",
"return",
"IntInterval",
".",
"fromToBy",
"(",
"from",
",",
"to",
",",
"1",
")",
";",
"}",
"return",
"IntInterval",
".",
"fromToBy",
"(",
"from",
",",
"to",
",",
"-",
"1",
")",
";",
"}"
] | Returns an IntInterval starting from the value from to the specified value to with a step value of 1. | [
"Returns",
"an",
"IntInterval",
"starting",
"from",
"the",
"value",
"from",
"to",
"the",
"specified",
"value",
"to",
"with",
"a",
"step",
"value",
"of",
"1",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java#L165-L172 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/PathMetadataFactory.java | PathMetadataFactory.forMapAccess | public static <KT> PathMetadata forMapAccess(Path<?> parent, KT key) {
"""
Create a new PathMetadata instance for for key based map access
@param parent parent path
@param key key for map access
@return map access path
"""
return new PathMetadata(parent, key, PathType.MAPVALUE_CONSTANT);
} | java | public static <KT> PathMetadata forMapAccess(Path<?> parent, KT key) {
return new PathMetadata(parent, key, PathType.MAPVALUE_CONSTANT);
} | [
"public",
"static",
"<",
"KT",
">",
"PathMetadata",
"forMapAccess",
"(",
"Path",
"<",
"?",
">",
"parent",
",",
"KT",
"key",
")",
"{",
"return",
"new",
"PathMetadata",
"(",
"parent",
",",
"key",
",",
"PathType",
".",
"MAPVALUE_CONSTANT",
")",
";",
"}"
] | Create a new PathMetadata instance for for key based map access
@param parent parent path
@param key key for map access
@return map access path | [
"Create",
"a",
"new",
"PathMetadata",
"instance",
"for",
"for",
"key",
"based",
"map",
"access"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/PathMetadataFactory.java#L108-L110 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableSession.java | BigtableSession.getClusterName | public synchronized BigtableClusterName getClusterName() throws IOException {
"""
Snapshot operations need various aspects of a {@link BigtableClusterName}. This method gets a
clusterId from either a lookup (projectId and instanceId translate to a single clusterId when
an instance has only one cluster).
"""
if (this.clusterName == null) {
try (BigtableClusterUtilities util = new BigtableClusterUtilities(options)) {
ListClustersResponse clusters = util.getClusters();
Preconditions.checkState(clusters.getClustersCount() == 1,
String.format(
"Project '%s' / Instance '%s' has %d clusters. There must be exactly 1 for this operation to work.",
options.getProjectId(), options.getInstanceId(), clusters.getClustersCount()));
clusterName = new BigtableClusterName(clusters.getClusters(0).getName());
} catch (GeneralSecurityException e) {
throw new IOException("Could not get cluster Id.", e);
}
}
return clusterName;
} | java | public synchronized BigtableClusterName getClusterName() throws IOException {
if (this.clusterName == null) {
try (BigtableClusterUtilities util = new BigtableClusterUtilities(options)) {
ListClustersResponse clusters = util.getClusters();
Preconditions.checkState(clusters.getClustersCount() == 1,
String.format(
"Project '%s' / Instance '%s' has %d clusters. There must be exactly 1 for this operation to work.",
options.getProjectId(), options.getInstanceId(), clusters.getClustersCount()));
clusterName = new BigtableClusterName(clusters.getClusters(0).getName());
} catch (GeneralSecurityException e) {
throw new IOException("Could not get cluster Id.", e);
}
}
return clusterName;
} | [
"public",
"synchronized",
"BigtableClusterName",
"getClusterName",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"clusterName",
"==",
"null",
")",
"{",
"try",
"(",
"BigtableClusterUtilities",
"util",
"=",
"new",
"BigtableClusterUtilities",
"(",
"options",
")",
")",
"{",
"ListClustersResponse",
"clusters",
"=",
"util",
".",
"getClusters",
"(",
")",
";",
"Preconditions",
".",
"checkState",
"(",
"clusters",
".",
"getClustersCount",
"(",
")",
"==",
"1",
",",
"String",
".",
"format",
"(",
"\"Project '%s' / Instance '%s' has %d clusters. There must be exactly 1 for this operation to work.\"",
",",
"options",
".",
"getProjectId",
"(",
")",
",",
"options",
".",
"getInstanceId",
"(",
")",
",",
"clusters",
".",
"getClustersCount",
"(",
")",
")",
")",
";",
"clusterName",
"=",
"new",
"BigtableClusterName",
"(",
"clusters",
".",
"getClusters",
"(",
"0",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"catch",
"(",
"GeneralSecurityException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Could not get cluster Id.\"",
",",
"e",
")",
";",
"}",
"}",
"return",
"clusterName",
";",
"}"
] | Snapshot operations need various aspects of a {@link BigtableClusterName}. This method gets a
clusterId from either a lookup (projectId and instanceId translate to a single clusterId when
an instance has only one cluster). | [
"Snapshot",
"operations",
"need",
"various",
"aspects",
"of",
"a",
"{"
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableSession.java#L354-L368 |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Function.java | Function.extendUserRole | public Result<Void> extendUserRole(AuthzTrans trans, UserRoleDAO.Data urData, boolean checkForExist) {
"""
Extend User Role.
extend the Expiration data, according to Organization rules.
@param trans
@param org
@param urData
@return
"""
// Check if record still exists
if (checkForExist && q.userRoleDAO.read(trans, urData).notOKorIsEmpty()) {
return Result.err(Status.ERR_UserRoleNotFound,
"User Role does not exist");
}
if (q.roleDAO.read(trans, urData.ns, urData.rname).notOKorIsEmpty()) {
return Result.err(Status.ERR_RoleNotFound,
"Role [%s.%s] does not exist", urData.ns,urData.rname);
}
// Special case for "Admin" roles. Issue brought forward with Prod
// problem 9/26
urData.expires = trans.org().expiration(null, Expiration.UserInRole).getTime(); // get
// Full
// time
// starting
// today
return q.userRoleDAO.update(trans, urData);
} | java | public Result<Void> extendUserRole(AuthzTrans trans, UserRoleDAO.Data urData, boolean checkForExist) {
// Check if record still exists
if (checkForExist && q.userRoleDAO.read(trans, urData).notOKorIsEmpty()) {
return Result.err(Status.ERR_UserRoleNotFound,
"User Role does not exist");
}
if (q.roleDAO.read(trans, urData.ns, urData.rname).notOKorIsEmpty()) {
return Result.err(Status.ERR_RoleNotFound,
"Role [%s.%s] does not exist", urData.ns,urData.rname);
}
// Special case for "Admin" roles. Issue brought forward with Prod
// problem 9/26
urData.expires = trans.org().expiration(null, Expiration.UserInRole).getTime(); // get
// Full
// time
// starting
// today
return q.userRoleDAO.update(trans, urData);
} | [
"public",
"Result",
"<",
"Void",
">",
"extendUserRole",
"(",
"AuthzTrans",
"trans",
",",
"UserRoleDAO",
".",
"Data",
"urData",
",",
"boolean",
"checkForExist",
")",
"{",
"// Check if record still exists",
"if",
"(",
"checkForExist",
"&&",
"q",
".",
"userRoleDAO",
".",
"read",
"(",
"trans",
",",
"urData",
")",
".",
"notOKorIsEmpty",
"(",
")",
")",
"{",
"return",
"Result",
".",
"err",
"(",
"Status",
".",
"ERR_UserRoleNotFound",
",",
"\"User Role does not exist\"",
")",
";",
"}",
"if",
"(",
"q",
".",
"roleDAO",
".",
"read",
"(",
"trans",
",",
"urData",
".",
"ns",
",",
"urData",
".",
"rname",
")",
".",
"notOKorIsEmpty",
"(",
")",
")",
"{",
"return",
"Result",
".",
"err",
"(",
"Status",
".",
"ERR_RoleNotFound",
",",
"\"Role [%s.%s] does not exist\"",
",",
"urData",
".",
"ns",
",",
"urData",
".",
"rname",
")",
";",
"}",
"// Special case for \"Admin\" roles. Issue brought forward with Prod",
"// problem 9/26",
"urData",
".",
"expires",
"=",
"trans",
".",
"org",
"(",
")",
".",
"expiration",
"(",
"null",
",",
"Expiration",
".",
"UserInRole",
")",
".",
"getTime",
"(",
")",
";",
"// get",
"// Full",
"// time",
"// starting",
"// today",
"return",
"q",
".",
"userRoleDAO",
".",
"update",
"(",
"trans",
",",
"urData",
")",
";",
"}"
] | Extend User Role.
extend the Expiration data, according to Organization rules.
@param trans
@param org
@param urData
@return | [
"Extend",
"User",
"Role",
"."
] | train | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Function.java#L1299-L1318 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/StringUtils.java | StringUtils.endsWithIgnoreCase | public static boolean endsWithIgnoreCase(final String source, final String target) {
"""
Returns true if given source string end with target string ignore case
sensitive; false otherwise.
@param source string to be tested.
@param target string to be tested.
@return true if given source string end with target string ignore case
sensitive; false otherwise.
"""
if (source.endsWith(target)) {
return true;
}
if (source.length() < target.length()) {
return false;
}
return source.substring(source.length() - target.length()).equalsIgnoreCase(target);
} | java | public static boolean endsWithIgnoreCase(final String source, final String target) {
if (source.endsWith(target)) {
return true;
}
if (source.length() < target.length()) {
return false;
}
return source.substring(source.length() - target.length()).equalsIgnoreCase(target);
} | [
"public",
"static",
"boolean",
"endsWithIgnoreCase",
"(",
"final",
"String",
"source",
",",
"final",
"String",
"target",
")",
"{",
"if",
"(",
"source",
".",
"endsWith",
"(",
"target",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"source",
".",
"length",
"(",
")",
"<",
"target",
".",
"length",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"source",
".",
"substring",
"(",
"source",
".",
"length",
"(",
")",
"-",
"target",
".",
"length",
"(",
")",
")",
".",
"equalsIgnoreCase",
"(",
"target",
")",
";",
"}"
] | Returns true if given source string end with target string ignore case
sensitive; false otherwise.
@param source string to be tested.
@param target string to be tested.
@return true if given source string end with target string ignore case
sensitive; false otherwise. | [
"Returns",
"true",
"if",
"given",
"source",
"string",
"end",
"with",
"target",
"string",
"ignore",
"case",
"sensitive",
";",
"false",
"otherwise",
"."
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/StringUtils.java#L331-L340 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/GeoPackageExtensions.java | GeoPackageExtensions.deleteSchema | public static void deleteSchema(GeoPackageCore geoPackage, String table) {
"""
Delete the Schema extensions for the table
@param geoPackage
GeoPackage
@param table
table name
@since 3.2.0
"""
DataColumnsDao dataColumnsDao = geoPackage.getDataColumnsDao();
try {
if (dataColumnsDao.isTableExists()) {
dataColumnsDao.deleteByTableName(table);
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to delete Schema extension. GeoPackage: "
+ geoPackage.getName() + ", Table: " + table, e);
}
} | java | public static void deleteSchema(GeoPackageCore geoPackage, String table) {
DataColumnsDao dataColumnsDao = geoPackage.getDataColumnsDao();
try {
if (dataColumnsDao.isTableExists()) {
dataColumnsDao.deleteByTableName(table);
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to delete Schema extension. GeoPackage: "
+ geoPackage.getName() + ", Table: " + table, e);
}
} | [
"public",
"static",
"void",
"deleteSchema",
"(",
"GeoPackageCore",
"geoPackage",
",",
"String",
"table",
")",
"{",
"DataColumnsDao",
"dataColumnsDao",
"=",
"geoPackage",
".",
"getDataColumnsDao",
"(",
")",
";",
"try",
"{",
"if",
"(",
"dataColumnsDao",
".",
"isTableExists",
"(",
")",
")",
"{",
"dataColumnsDao",
".",
"deleteByTableName",
"(",
"table",
")",
";",
"}",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"throw",
"new",
"GeoPackageException",
"(",
"\"Failed to delete Schema extension. GeoPackage: \"",
"+",
"geoPackage",
".",
"getName",
"(",
")",
"+",
"\", Table: \"",
"+",
"table",
",",
"e",
")",
";",
"}",
"}"
] | Delete the Schema extensions for the table
@param geoPackage
GeoPackage
@param table
table name
@since 3.2.0 | [
"Delete",
"the",
"Schema",
"extensions",
"for",
"the",
"table"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/GeoPackageExtensions.java#L318-L331 |
apache/incubator-gobblin | gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/Instrumented.java | Instrumented.markMeter | public static void markMeter(Optional<Meter> meter, final long value) {
"""
Marks a meter only if it is defined.
@param meter an Optional<{@link com.codahale.metrics.Meter}>
@param value value to mark
"""
meter.transform(new Function<Meter, Meter>() {
@Override
public Meter apply(@Nonnull Meter input) {
input.mark(value);
return input;
}
});
} | java | public static void markMeter(Optional<Meter> meter, final long value) {
meter.transform(new Function<Meter, Meter>() {
@Override
public Meter apply(@Nonnull Meter input) {
input.mark(value);
return input;
}
});
} | [
"public",
"static",
"void",
"markMeter",
"(",
"Optional",
"<",
"Meter",
">",
"meter",
",",
"final",
"long",
"value",
")",
"{",
"meter",
".",
"transform",
"(",
"new",
"Function",
"<",
"Meter",
",",
"Meter",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Meter",
"apply",
"(",
"@",
"Nonnull",
"Meter",
"input",
")",
"{",
"input",
".",
"mark",
"(",
"value",
")",
";",
"return",
"input",
";",
"}",
"}",
")",
";",
"}"
] | Marks a meter only if it is defined.
@param meter an Optional<{@link com.codahale.metrics.Meter}>
@param value value to mark | [
"Marks",
"a",
"meter",
"only",
"if",
"it",
"is",
"defined",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/Instrumented.java#L263-L271 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/las/core/Las.java | Las.getReader | public static ALasReader getReader( File lasFile, CoordinateReferenceSystem crs ) throws Exception {
"""
Get a las reader.
<p>If available, a native reader is created.
@param lasFile the file to read.
@param crs the {@link CoordinateReferenceSystem} or <code>null</code> if the file has one.
@return the las reader.
@throws Exception if something goes wrong.
"""
if (supportsNative()) {
return new LiblasReader(lasFile, crs);
} else {
return new LasReaderBuffered(lasFile, crs);
}
} | java | public static ALasReader getReader( File lasFile, CoordinateReferenceSystem crs ) throws Exception {
if (supportsNative()) {
return new LiblasReader(lasFile, crs);
} else {
return new LasReaderBuffered(lasFile, crs);
}
} | [
"public",
"static",
"ALasReader",
"getReader",
"(",
"File",
"lasFile",
",",
"CoordinateReferenceSystem",
"crs",
")",
"throws",
"Exception",
"{",
"if",
"(",
"supportsNative",
"(",
")",
")",
"{",
"return",
"new",
"LiblasReader",
"(",
"lasFile",
",",
"crs",
")",
";",
"}",
"else",
"{",
"return",
"new",
"LasReaderBuffered",
"(",
"lasFile",
",",
"crs",
")",
";",
"}",
"}"
] | Get a las reader.
<p>If available, a native reader is created.
@param lasFile the file to read.
@param crs the {@link CoordinateReferenceSystem} or <code>null</code> if the file has one.
@return the las reader.
@throws Exception if something goes wrong. | [
"Get",
"a",
"las",
"reader",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/las/core/Las.java#L84-L90 |
jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBaseGridScreen.java | HBaseGridScreen.printStartGridScreenData | public int printStartGridScreenData(PrintWriter out, int iPrintOptions) {
"""
Display the start grid in input format.
@return true if default params were found for this form.
@param out The http output stream.
@exception DBException File exception.
"""
if ((iPrintOptions & HtmlConstants.HTML_ADD_DESC_COLUMN) != 0)
out.println("<td></td>"); // No description needed for a table
if ((iPrintOptions & HtmlConstants.HTML_IN_TABLE_ROW) != 0)
out.println("<td>");
iPrintOptions = iPrintOptions & (~HtmlConstants.HTML_IN_TABLE_ROW); // sub-controls not in a table row
iPrintOptions = iPrintOptions & (~HtmlConstants.HTML_ADD_DESC_COLUMN); // Sub-controls - don't add desc.
return iPrintOptions;
} | java | public int printStartGridScreenData(PrintWriter out, int iPrintOptions)
{
if ((iPrintOptions & HtmlConstants.HTML_ADD_DESC_COLUMN) != 0)
out.println("<td></td>"); // No description needed for a table
if ((iPrintOptions & HtmlConstants.HTML_IN_TABLE_ROW) != 0)
out.println("<td>");
iPrintOptions = iPrintOptions & (~HtmlConstants.HTML_IN_TABLE_ROW); // sub-controls not in a table row
iPrintOptions = iPrintOptions & (~HtmlConstants.HTML_ADD_DESC_COLUMN); // Sub-controls - don't add desc.
return iPrintOptions;
} | [
"public",
"int",
"printStartGridScreenData",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
")",
"{",
"if",
"(",
"(",
"iPrintOptions",
"&",
"HtmlConstants",
".",
"HTML_ADD_DESC_COLUMN",
")",
"!=",
"0",
")",
"out",
".",
"println",
"(",
"\"<td></td>\"",
")",
";",
"// No description needed for a table",
"if",
"(",
"(",
"iPrintOptions",
"&",
"HtmlConstants",
".",
"HTML_IN_TABLE_ROW",
")",
"!=",
"0",
")",
"out",
".",
"println",
"(",
"\"<td>\"",
")",
";",
"iPrintOptions",
"=",
"iPrintOptions",
"&",
"(",
"~",
"HtmlConstants",
".",
"HTML_IN_TABLE_ROW",
")",
";",
"// sub-controls not in a table row",
"iPrintOptions",
"=",
"iPrintOptions",
"&",
"(",
"~",
"HtmlConstants",
".",
"HTML_ADD_DESC_COLUMN",
")",
";",
"// Sub-controls - don't add desc.",
"return",
"iPrintOptions",
";",
"}"
] | Display the start grid in input format.
@return true if default params were found for this form.
@param out The http output stream.
@exception DBException File exception. | [
"Display",
"the",
"start",
"grid",
"in",
"input",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBaseGridScreen.java#L134-L143 |
qsardb/qsardb | model/src/main/java/org/qsardb/model/Cargo.java | Cargo.loadString | public String loadString(String encoding) throws IOException {
"""
Loads the string in the user specified character encoding.
However, when the underlying byte array begins with a known Unicode byte order mark (BOM),
then the BOM specified character encoding takes precedence over the user specified character encoding.
@param encoding The user specified character encoding.
@see ByteOrderMask
"""
byte[] bytes = loadByteArray();
ByteOrderMask bom = ByteOrderMask.valueOf(bytes);
if(bom != null){
int offset = (bom.getBytes()).length;
return new String(bytes, offset, bytes.length - offset, bom.getEncoding());
}
return new String(bytes, encoding);
} | java | public String loadString(String encoding) throws IOException {
byte[] bytes = loadByteArray();
ByteOrderMask bom = ByteOrderMask.valueOf(bytes);
if(bom != null){
int offset = (bom.getBytes()).length;
return new String(bytes, offset, bytes.length - offset, bom.getEncoding());
}
return new String(bytes, encoding);
} | [
"public",
"String",
"loadString",
"(",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"loadByteArray",
"(",
")",
";",
"ByteOrderMask",
"bom",
"=",
"ByteOrderMask",
".",
"valueOf",
"(",
"bytes",
")",
";",
"if",
"(",
"bom",
"!=",
"null",
")",
"{",
"int",
"offset",
"=",
"(",
"bom",
".",
"getBytes",
"(",
")",
")",
".",
"length",
";",
"return",
"new",
"String",
"(",
"bytes",
",",
"offset",
",",
"bytes",
".",
"length",
"-",
"offset",
",",
"bom",
".",
"getEncoding",
"(",
")",
")",
";",
"}",
"return",
"new",
"String",
"(",
"bytes",
",",
"encoding",
")",
";",
"}"
] | Loads the string in the user specified character encoding.
However, when the underlying byte array begins with a known Unicode byte order mark (BOM),
then the BOM specified character encoding takes precedence over the user specified character encoding.
@param encoding The user specified character encoding.
@see ByteOrderMask | [
"Loads",
"the",
"string",
"in",
"the",
"user",
"specified",
"character",
"encoding",
"."
] | train | https://github.com/qsardb/qsardb/blob/9798f524abd973878b9040927aed8131885127fa/model/src/main/java/org/qsardb/model/Cargo.java#L272-L283 |
maddingo/sojo | src/main/java/net/sf/sojo/core/reflect/ReflectionMethodHelper.java | ReflectionMethodHelper.getAllMethodsByClass | public static Method[] getAllMethodsByClass (Class<?> pvClass) {
"""
Get all set/get methods from a Class. With methods from all super classes.
@param pvClass Analyse Class.
@return All methods found.
"""
return getAllMethodsByClassIntern(pvClass, new HashSet<Method>()).toArray(new Method [0]);
} | java | public static Method[] getAllMethodsByClass (Class<?> pvClass) {
return getAllMethodsByClassIntern(pvClass, new HashSet<Method>()).toArray(new Method [0]);
} | [
"public",
"static",
"Method",
"[",
"]",
"getAllMethodsByClass",
"(",
"Class",
"<",
"?",
">",
"pvClass",
")",
"{",
"return",
"getAllMethodsByClassIntern",
"(",
"pvClass",
",",
"new",
"HashSet",
"<",
"Method",
">",
"(",
")",
")",
".",
"toArray",
"(",
"new",
"Method",
"[",
"0",
"]",
")",
";",
"}"
] | Get all set/get methods from a Class. With methods from all super classes.
@param pvClass Analyse Class.
@return All methods found. | [
"Get",
"all",
"set",
"/",
"get",
"methods",
"from",
"a",
"Class",
".",
"With",
"methods",
"from",
"all",
"super",
"classes",
"."
] | train | https://github.com/maddingo/sojo/blob/99e9e0a146b502deb7f507fe0623227402ed675b/src/main/java/net/sf/sojo/core/reflect/ReflectionMethodHelper.java#L127-L129 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.createKeyAsync | public Observable<KeyBundle> createKeyAsync(String vaultBaseUrl, String keyName, JsonWebKeyType kty) {
"""
Creates a new key, stores it, then returns key parameters and attributes to the client.
The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the keys/create permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name for the new key. The system will generate the version name for the new key.
@param kty The type of key to create. For valid values, see JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct'
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the KeyBundle object
"""
return createKeyWithServiceResponseAsync(vaultBaseUrl, keyName, kty).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() {
@Override
public KeyBundle call(ServiceResponse<KeyBundle> response) {
return response.body();
}
});
} | java | public Observable<KeyBundle> createKeyAsync(String vaultBaseUrl, String keyName, JsonWebKeyType kty) {
return createKeyWithServiceResponseAsync(vaultBaseUrl, keyName, kty).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() {
@Override
public KeyBundle call(ServiceResponse<KeyBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"KeyBundle",
">",
"createKeyAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
",",
"JsonWebKeyType",
"kty",
")",
"{",
"return",
"createKeyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"keyName",
",",
"kty",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"KeyBundle",
">",
",",
"KeyBundle",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"KeyBundle",
"call",
"(",
"ServiceResponse",
"<",
"KeyBundle",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Creates a new key, stores it, then returns key parameters and attributes to the client.
The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the keys/create permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name for the new key. The system will generate the version name for the new key.
@param kty The type of key to create. For valid values, see JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct'
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the KeyBundle object | [
"Creates",
"a",
"new",
"key",
"stores",
"it",
"then",
"returns",
"key",
"parameters",
"and",
"attributes",
"to",
"the",
"client",
".",
"The",
"create",
"key",
"operation",
"can",
"be",
"used",
"to",
"create",
"any",
"key",
"type",
"in",
"Azure",
"Key",
"Vault",
".",
"If",
"the",
"named",
"key",
"already",
"exists",
"Azure",
"Key",
"Vault",
"creates",
"a",
"new",
"version",
"of",
"the",
"key",
".",
"It",
"requires",
"the",
"keys",
"/",
"create",
"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#L680-L687 |
IBM/ibm-cos-sdk-java | ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/AsperaTransferManager.java | AsperaTransferManager.excludeSubdirectories | public void excludeSubdirectories(File directory, TransferSpecs transferSpecs) {
"""
List all files within the folder to exclude all subdirectories & modify the transfer spec to
pass onto Aspera SDK
@param directory
@param transferSpecs
"""
if ( directory == null || !directory.exists() || !directory.isDirectory() ) {
throw new IllegalArgumentException("Must provide a directory to upload");
}
List<File> files = new LinkedList<File>();
listFiles(directory, files);
for(TransferSpec transferSpec : transferSpecs.transfer_specs) {
Vector<NodePath> paths = new Vector<NodePath>();
for (File f : files) {
NodePath path = new NodePath();
path.setDestination(f.getName());
path.setSource(f.getAbsolutePath());
paths.add(path);
}
transferSpec.setPaths(paths);
}
} | java | public void excludeSubdirectories(File directory, TransferSpecs transferSpecs) {
if ( directory == null || !directory.exists() || !directory.isDirectory() ) {
throw new IllegalArgumentException("Must provide a directory to upload");
}
List<File> files = new LinkedList<File>();
listFiles(directory, files);
for(TransferSpec transferSpec : transferSpecs.transfer_specs) {
Vector<NodePath> paths = new Vector<NodePath>();
for (File f : files) {
NodePath path = new NodePath();
path.setDestination(f.getName());
path.setSource(f.getAbsolutePath());
paths.add(path);
}
transferSpec.setPaths(paths);
}
} | [
"public",
"void",
"excludeSubdirectories",
"(",
"File",
"directory",
",",
"TransferSpecs",
"transferSpecs",
")",
"{",
"if",
"(",
"directory",
"==",
"null",
"||",
"!",
"directory",
".",
"exists",
"(",
")",
"||",
"!",
"directory",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Must provide a directory to upload\"",
")",
";",
"}",
"List",
"<",
"File",
">",
"files",
"=",
"new",
"LinkedList",
"<",
"File",
">",
"(",
")",
";",
"listFiles",
"(",
"directory",
",",
"files",
")",
";",
"for",
"(",
"TransferSpec",
"transferSpec",
":",
"transferSpecs",
".",
"transfer_specs",
")",
"{",
"Vector",
"<",
"NodePath",
">",
"paths",
"=",
"new",
"Vector",
"<",
"NodePath",
">",
"(",
")",
";",
"for",
"(",
"File",
"f",
":",
"files",
")",
"{",
"NodePath",
"path",
"=",
"new",
"NodePath",
"(",
")",
";",
"path",
".",
"setDestination",
"(",
"f",
".",
"getName",
"(",
")",
")",
";",
"path",
".",
"setSource",
"(",
"f",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"paths",
".",
"add",
"(",
"path",
")",
";",
"}",
"transferSpec",
".",
"setPaths",
"(",
"paths",
")",
";",
"}",
"}"
] | List all files within the folder to exclude all subdirectories & modify the transfer spec to
pass onto Aspera SDK
@param directory
@param transferSpecs | [
"List",
"all",
"files",
"within",
"the",
"folder",
"to",
"exclude",
"all",
"subdirectories",
"&",
"modify",
"the",
"transfer",
"spec",
"to",
"pass",
"onto",
"Aspera",
"SDK"
] | train | https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/AsperaTransferManager.java#L524-L545 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.getPrintWriter | public static PrintWriter getPrintWriter(File file, String charset, boolean isAppend) throws IORuntimeException {
"""
获得一个打印写入对象,可以有print
@param file 文件
@param charset 字符集
@param isAppend 是否追加
@return 打印对象
@throws IORuntimeException IO异常
"""
return new PrintWriter(getWriter(file, charset, isAppend));
} | java | public static PrintWriter getPrintWriter(File file, String charset, boolean isAppend) throws IORuntimeException {
return new PrintWriter(getWriter(file, charset, isAppend));
} | [
"public",
"static",
"PrintWriter",
"getPrintWriter",
"(",
"File",
"file",
",",
"String",
"charset",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"new",
"PrintWriter",
"(",
"getWriter",
"(",
"file",
",",
"charset",
",",
"isAppend",
")",
")",
";",
"}"
] | 获得一个打印写入对象,可以有print
@param file 文件
@param charset 字符集
@param isAppend 是否追加
@return 打印对象
@throws IORuntimeException IO异常 | [
"获得一个打印写入对象,可以有print"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2664-L2666 |
samskivert/samskivert | src/main/java/com/samskivert/util/Config.java | Config.getValue | public float getValue (String name, float defval) {
"""
Fetches and returns the value for the specified configuration property. If the value is not
specified in the associated properties file, the supplied default value is returned instead.
If the property specified in the file is poorly formatted (not and integer, not in proper
array specification), a warning message will be logged and the default value will be
returned.
@param name name of the property.
@param defval the value to return if the property is not specified in the config file.
@return the value of the requested property.
"""
String val = _props.getProperty(name);
if (val != null) {
try {
defval = Float.parseFloat(val);
} catch (NumberFormatException nfe) {
log.warning("Malformed float property", "name", name, "value", val);
}
}
return defval;
} | java | public float getValue (String name, float defval)
{
String val = _props.getProperty(name);
if (val != null) {
try {
defval = Float.parseFloat(val);
} catch (NumberFormatException nfe) {
log.warning("Malformed float property", "name", name, "value", val);
}
}
return defval;
} | [
"public",
"float",
"getValue",
"(",
"String",
"name",
",",
"float",
"defval",
")",
"{",
"String",
"val",
"=",
"_props",
".",
"getProperty",
"(",
"name",
")",
";",
"if",
"(",
"val",
"!=",
"null",
")",
"{",
"try",
"{",
"defval",
"=",
"Float",
".",
"parseFloat",
"(",
"val",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"log",
".",
"warning",
"(",
"\"Malformed float property\"",
",",
"\"name\"",
",",
"name",
",",
"\"value\"",
",",
"val",
")",
";",
"}",
"}",
"return",
"defval",
";",
"}"
] | Fetches and returns the value for the specified configuration property. If the value is not
specified in the associated properties file, the supplied default value is returned instead.
If the property specified in the file is poorly formatted (not and integer, not in proper
array specification), a warning message will be logged and the default value will be
returned.
@param name name of the property.
@param defval the value to return if the property is not specified in the config file.
@return the value of the requested property. | [
"Fetches",
"and",
"returns",
"the",
"value",
"for",
"the",
"specified",
"configuration",
"property",
".",
"If",
"the",
"value",
"is",
"not",
"specified",
"in",
"the",
"associated",
"properties",
"file",
"the",
"supplied",
"default",
"value",
"is",
"returned",
"instead",
".",
"If",
"the",
"property",
"specified",
"in",
"the",
"file",
"is",
"poorly",
"formatted",
"(",
"not",
"and",
"integer",
"not",
"in",
"proper",
"array",
"specification",
")",
"a",
"warning",
"message",
"will",
"be",
"logged",
"and",
"the",
"default",
"value",
"will",
"be",
"returned",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Config.java#L160-L171 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java | CollectionLiteralsTypeComputer.createMapTypeReference | protected LightweightTypeReference createMapTypeReference(JvmGenericType mapType, LightweightTypeReference pairType, LightweightTypeReference expectation, ITypeReferenceOwner owner) {
"""
Creates a map type reference that comes as close as possible / necessary to its expected type.
"""
List<LightweightTypeReference> leftAndRight = pairType.getTypeArguments();
LightweightTypeReference left = leftAndRight.get(0).getInvariantBoundSubstitute();
LightweightTypeReference right = leftAndRight.get(1).getInvariantBoundSubstitute();
LightweightTypeReference mapExpectation = getMapExpectation(expectation);
if (mapExpectation != null) {
List<LightweightTypeReference> typeArguments = expectation.getTypeArguments();
left = doNormalizeElementType(left, typeArguments.get(0));
right = doNormalizeElementType(right, typeArguments.get(1));
}
ParameterizedTypeReference result = owner.newParameterizedTypeReference(mapType);
result.addTypeArgument(left.copyInto(owner));
result.addTypeArgument(right.copyInto(owner));
if (mapExpectation != null && !expectation.isAssignableFrom(result)) {
// expectation does not match the computed type, but looks good according to the element types:
// use expected type
if (matchesExpectation(left, mapExpectation.getTypeArguments().get(0)) && matchesExpectation(right, mapExpectation.getTypeArguments().get(1))) {
return expectation;
}
}
return result;
} | java | protected LightweightTypeReference createMapTypeReference(JvmGenericType mapType, LightweightTypeReference pairType, LightweightTypeReference expectation, ITypeReferenceOwner owner) {
List<LightweightTypeReference> leftAndRight = pairType.getTypeArguments();
LightweightTypeReference left = leftAndRight.get(0).getInvariantBoundSubstitute();
LightweightTypeReference right = leftAndRight.get(1).getInvariantBoundSubstitute();
LightweightTypeReference mapExpectation = getMapExpectation(expectation);
if (mapExpectation != null) {
List<LightweightTypeReference> typeArguments = expectation.getTypeArguments();
left = doNormalizeElementType(left, typeArguments.get(0));
right = doNormalizeElementType(right, typeArguments.get(1));
}
ParameterizedTypeReference result = owner.newParameterizedTypeReference(mapType);
result.addTypeArgument(left.copyInto(owner));
result.addTypeArgument(right.copyInto(owner));
if (mapExpectation != null && !expectation.isAssignableFrom(result)) {
// expectation does not match the computed type, but looks good according to the element types:
// use expected type
if (matchesExpectation(left, mapExpectation.getTypeArguments().get(0)) && matchesExpectation(right, mapExpectation.getTypeArguments().get(1))) {
return expectation;
}
}
return result;
} | [
"protected",
"LightweightTypeReference",
"createMapTypeReference",
"(",
"JvmGenericType",
"mapType",
",",
"LightweightTypeReference",
"pairType",
",",
"LightweightTypeReference",
"expectation",
",",
"ITypeReferenceOwner",
"owner",
")",
"{",
"List",
"<",
"LightweightTypeReference",
">",
"leftAndRight",
"=",
"pairType",
".",
"getTypeArguments",
"(",
")",
";",
"LightweightTypeReference",
"left",
"=",
"leftAndRight",
".",
"get",
"(",
"0",
")",
".",
"getInvariantBoundSubstitute",
"(",
")",
";",
"LightweightTypeReference",
"right",
"=",
"leftAndRight",
".",
"get",
"(",
"1",
")",
".",
"getInvariantBoundSubstitute",
"(",
")",
";",
"LightweightTypeReference",
"mapExpectation",
"=",
"getMapExpectation",
"(",
"expectation",
")",
";",
"if",
"(",
"mapExpectation",
"!=",
"null",
")",
"{",
"List",
"<",
"LightweightTypeReference",
">",
"typeArguments",
"=",
"expectation",
".",
"getTypeArguments",
"(",
")",
";",
"left",
"=",
"doNormalizeElementType",
"(",
"left",
",",
"typeArguments",
".",
"get",
"(",
"0",
")",
")",
";",
"right",
"=",
"doNormalizeElementType",
"(",
"right",
",",
"typeArguments",
".",
"get",
"(",
"1",
")",
")",
";",
"}",
"ParameterizedTypeReference",
"result",
"=",
"owner",
".",
"newParameterizedTypeReference",
"(",
"mapType",
")",
";",
"result",
".",
"addTypeArgument",
"(",
"left",
".",
"copyInto",
"(",
"owner",
")",
")",
";",
"result",
".",
"addTypeArgument",
"(",
"right",
".",
"copyInto",
"(",
"owner",
")",
")",
";",
"if",
"(",
"mapExpectation",
"!=",
"null",
"&&",
"!",
"expectation",
".",
"isAssignableFrom",
"(",
"result",
")",
")",
"{",
"// expectation does not match the computed type, but looks good according to the element types:",
"// use expected type",
"if",
"(",
"matchesExpectation",
"(",
"left",
",",
"mapExpectation",
".",
"getTypeArguments",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
"&&",
"matchesExpectation",
"(",
"right",
",",
"mapExpectation",
".",
"getTypeArguments",
"(",
")",
".",
"get",
"(",
"1",
")",
")",
")",
"{",
"return",
"expectation",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Creates a map type reference that comes as close as possible / necessary to its expected type. | [
"Creates",
"a",
"map",
"type",
"reference",
"that",
"comes",
"as",
"close",
"as",
"possible",
"/",
"necessary",
"to",
"its",
"expected",
"type",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java#L261-L284 |
mijecu25/dsa | src/main/java/com/mijecu25/dsa/algorithms/sort/linearlogarithmic/Quicksort.java | Quicksort.partitionDescending | private static <E extends Comparable<E>> int partitionDescending(E[] array, int start, int end) {
"""
Routine that arranges the elements in descending order around a pivot. This routine
runs in O(n) time.
@param <E> the type of elements in this array.
@param array array that we want to sort
@param start index of the starting point to sort
@param end index of the end point to sort
@return an integer that represent the index of the pivot
"""
E pivot = array[end];
int index = start - 1;
for(int j = start; j < end; j++) {
if(array[j].compareTo(pivot) >= 0) {
index++;
TrivialSwap.swap(array, index, j);
}
}
TrivialSwap.swap(array, index + 1, end);
return index + 1;
} | java | private static <E extends Comparable<E>> int partitionDescending(E[] array, int start, int end) {
E pivot = array[end];
int index = start - 1;
for(int j = start; j < end; j++) {
if(array[j].compareTo(pivot) >= 0) {
index++;
TrivialSwap.swap(array, index, j);
}
}
TrivialSwap.swap(array, index + 1, end);
return index + 1;
} | [
"private",
"static",
"<",
"E",
"extends",
"Comparable",
"<",
"E",
">",
">",
"int",
"partitionDescending",
"(",
"E",
"[",
"]",
"array",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"E",
"pivot",
"=",
"array",
"[",
"end",
"]",
";",
"int",
"index",
"=",
"start",
"-",
"1",
";",
"for",
"(",
"int",
"j",
"=",
"start",
";",
"j",
"<",
"end",
";",
"j",
"++",
")",
"{",
"if",
"(",
"array",
"[",
"j",
"]",
".",
"compareTo",
"(",
"pivot",
")",
">=",
"0",
")",
"{",
"index",
"++",
";",
"TrivialSwap",
".",
"swap",
"(",
"array",
",",
"index",
",",
"j",
")",
";",
"}",
"}",
"TrivialSwap",
".",
"swap",
"(",
"array",
",",
"index",
"+",
"1",
",",
"end",
")",
";",
"return",
"index",
"+",
"1",
";",
"}"
] | Routine that arranges the elements in descending order around a pivot. This routine
runs in O(n) time.
@param <E> the type of elements in this array.
@param array array that we want to sort
@param start index of the starting point to sort
@param end index of the end point to sort
@return an integer that represent the index of the pivot | [
"Routine",
"that",
"arranges",
"the",
"elements",
"in",
"descending",
"order",
"around",
"a",
"pivot",
".",
"This",
"routine",
"runs",
"in",
"O",
"(",
"n",
")",
"time",
"."
] | train | https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/linearlogarithmic/Quicksort.java#L840-L854 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java | TreeScanner.visitAssignment | @Override
public R visitAssignment(AssignmentTree node, P p) {
"""
{@inheritDoc} This implementation scans the children in left to right order.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of scanning
"""
R r = scan(node.getVariable(), p);
r = scanAndReduce(node.getExpression(), p, r);
return r;
} | java | @Override
public R visitAssignment(AssignmentTree node, P p) {
R r = scan(node.getVariable(), p);
r = scanAndReduce(node.getExpression(), p, r);
return r;
} | [
"@",
"Override",
"public",
"R",
"visitAssignment",
"(",
"AssignmentTree",
"node",
",",
"P",
"p",
")",
"{",
"R",
"r",
"=",
"scan",
"(",
"node",
".",
"getVariable",
"(",
")",
",",
"p",
")",
";",
"r",
"=",
"scanAndReduce",
"(",
"node",
".",
"getExpression",
"(",
")",
",",
"p",
",",
"r",
")",
";",
"return",
"r",
";",
"}"
] | {@inheritDoc} This implementation scans the children in left to right order.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of scanning | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"scans",
"the",
"children",
"in",
"left",
"to",
"right",
"order",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java#L582-L587 |
alkacon/opencms-core | src/org/opencms/ui/CmsVaadinUtils.java | CmsVaadinUtils.filterUtf8ResourceStream | public static InputStream filterUtf8ResourceStream(InputStream stream, Function<String, String> transformation) {
"""
Reads the content of an input stream into a string (using UTF-8 encoding), performs a function on the string, and returns the result
again as an input stream.<p>
@param stream the stream producing the input data
@param transformation the function to apply to the input
@return the stream producing the transformed input data
"""
try {
byte[] streamData = CmsFileUtil.readFully(stream);
String dataAsString = new String(streamData, "UTF-8");
byte[] transformedData = transformation.apply(dataAsString).getBytes("UTF-8");
return new ByteArrayInputStream(transformedData);
} catch (UnsupportedEncodingException e) {
LOG.error(e.getLocalizedMessage(), e);
return null;
} catch (IOException e) {
LOG.error(e.getLocalizedMessage(), e);
throw new RuntimeException(e);
}
} | java | public static InputStream filterUtf8ResourceStream(InputStream stream, Function<String, String> transformation) {
try {
byte[] streamData = CmsFileUtil.readFully(stream);
String dataAsString = new String(streamData, "UTF-8");
byte[] transformedData = transformation.apply(dataAsString).getBytes("UTF-8");
return new ByteArrayInputStream(transformedData);
} catch (UnsupportedEncodingException e) {
LOG.error(e.getLocalizedMessage(), e);
return null;
} catch (IOException e) {
LOG.error(e.getLocalizedMessage(), e);
throw new RuntimeException(e);
}
} | [
"public",
"static",
"InputStream",
"filterUtf8ResourceStream",
"(",
"InputStream",
"stream",
",",
"Function",
"<",
"String",
",",
"String",
">",
"transformation",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"streamData",
"=",
"CmsFileUtil",
".",
"readFully",
"(",
"stream",
")",
";",
"String",
"dataAsString",
"=",
"new",
"String",
"(",
"streamData",
",",
"\"UTF-8\"",
")",
";",
"byte",
"[",
"]",
"transformedData",
"=",
"transformation",
".",
"apply",
"(",
"dataAsString",
")",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
";",
"return",
"new",
"ByteArrayInputStream",
"(",
"transformedData",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"return",
"null",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] | Reads the content of an input stream into a string (using UTF-8 encoding), performs a function on the string, and returns the result
again as an input stream.<p>
@param stream the stream producing the input data
@param transformation the function to apply to the input
@return the stream producing the transformed input data | [
"Reads",
"the",
"content",
"of",
"an",
"input",
"stream",
"into",
"a",
"string",
"(",
"using",
"UTF",
"-",
"8",
"encoding",
")",
"performs",
"a",
"function",
"on",
"the",
"string",
"and",
"returns",
"the",
"result",
"again",
"as",
"an",
"input",
"stream",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L361-L375 |
rundeck/rundeck | rundeck-storage/rundeck-storage-data/src/main/java/org/rundeck/storage/data/DataUtil.java | DataUtil.withText | public static <T extends ContentMeta> T withText(String text, Map<String, String> meta, ContentFactory<T> factory) {
"""
Returns a read-only FileMeta from the input source
@param text text data
@param meta meta data
@param factory factory
@param <T> resource type
@return content
"""
return factory.create(lazyStream(new ByteArrayInputStream(text.getBytes())), meta);
} | java | public static <T extends ContentMeta> T withText(String text, Map<String, String> meta, ContentFactory<T> factory) {
return factory.create(lazyStream(new ByteArrayInputStream(text.getBytes())), meta);
} | [
"public",
"static",
"<",
"T",
"extends",
"ContentMeta",
">",
"T",
"withText",
"(",
"String",
"text",
",",
"Map",
"<",
"String",
",",
"String",
">",
"meta",
",",
"ContentFactory",
"<",
"T",
">",
"factory",
")",
"{",
"return",
"factory",
".",
"create",
"(",
"lazyStream",
"(",
"new",
"ByteArrayInputStream",
"(",
"text",
".",
"getBytes",
"(",
")",
")",
")",
",",
"meta",
")",
";",
"}"
] | Returns a read-only FileMeta from the input source
@param text text data
@param meta meta data
@param factory factory
@param <T> resource type
@return content | [
"Returns",
"a",
"read",
"-",
"only",
"FileMeta",
"from",
"the",
"input",
"source"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeck-storage/rundeck-storage-data/src/main/java/org/rundeck/storage/data/DataUtil.java#L53-L55 |
uaihebert/uaiMockServer | src/main/java/com/uaihebert/uaimockserver/log/backend/Log.java | Log.infoFormatted | public static void infoFormatted(final String text, final Object... parameterArray) {
"""
Wil log a text with the INFO level. The text with be formatted using the String.format(...)
"""
final String formattedText = String.format(text, parameterArray);
logWriterInstance.info(formattedText);
UaiWebSocketLogManager.addLogText("[INFO] " + formattedText);
} | java | public static void infoFormatted(final String text, final Object... parameterArray) {
final String formattedText = String.format(text, parameterArray);
logWriterInstance.info(formattedText);
UaiWebSocketLogManager.addLogText("[INFO] " + formattedText);
} | [
"public",
"static",
"void",
"infoFormatted",
"(",
"final",
"String",
"text",
",",
"final",
"Object",
"...",
"parameterArray",
")",
"{",
"final",
"String",
"formattedText",
"=",
"String",
".",
"format",
"(",
"text",
",",
"parameterArray",
")",
";",
"logWriterInstance",
".",
"info",
"(",
"formattedText",
")",
";",
"UaiWebSocketLogManager",
".",
"addLogText",
"(",
"\"[INFO] \"",
"+",
"formattedText",
")",
";",
"}"
] | Wil log a text with the INFO level. The text with be formatted using the String.format(...) | [
"Wil",
"log",
"a",
"text",
"with",
"the",
"INFO",
"level",
".",
"The",
"text",
"with",
"be",
"formatted",
"using",
"the",
"String",
".",
"format",
"(",
"...",
")"
] | train | https://github.com/uaihebert/uaiMockServer/blob/8b0090d4018c2f430cfbbb3ae249347652802f2b/src/main/java/com/uaihebert/uaimockserver/log/backend/Log.java#L52-L58 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/math/Fraction.java | Fraction.getFraction | public static Fraction getFraction(int numerator, int denominator) {
"""
<p>Creates a <code>Fraction</code> instance with the 2 parts
of a fraction Y/Z.</p>
<p>Any negative signs are resolved to be on the numerator.</p>
@param numerator the numerator, for example the three in 'three sevenths'
@param denominator the denominator, for example the seven in 'three sevenths'
@return a new fraction instance
@throws ArithmeticException if the denominator is <code>zero</code>
or the denominator is {@code negative} and the numerator is {@code Integer#MIN_VALUE}
"""
if (denominator == 0) {
throw new ArithmeticException("The denominator must not be zero");
}
if (denominator < 0) {
if (numerator == Integer.MIN_VALUE || denominator == Integer.MIN_VALUE) {
throw new ArithmeticException("overflow: can't negate");
}
numerator = -numerator;
denominator = -denominator;
}
return new Fraction(numerator, denominator);
} | java | public static Fraction getFraction(int numerator, int denominator) {
if (denominator == 0) {
throw new ArithmeticException("The denominator must not be zero");
}
if (denominator < 0) {
if (numerator == Integer.MIN_VALUE || denominator == Integer.MIN_VALUE) {
throw new ArithmeticException("overflow: can't negate");
}
numerator = -numerator;
denominator = -denominator;
}
return new Fraction(numerator, denominator);
} | [
"public",
"static",
"Fraction",
"getFraction",
"(",
"int",
"numerator",
",",
"int",
"denominator",
")",
"{",
"if",
"(",
"denominator",
"==",
"0",
")",
"{",
"throw",
"new",
"ArithmeticException",
"(",
"\"The denominator must not be zero\"",
")",
";",
"}",
"if",
"(",
"denominator",
"<",
"0",
")",
"{",
"if",
"(",
"numerator",
"==",
"Integer",
".",
"MIN_VALUE",
"||",
"denominator",
"==",
"Integer",
".",
"MIN_VALUE",
")",
"{",
"throw",
"new",
"ArithmeticException",
"(",
"\"overflow: can't negate\"",
")",
";",
"}",
"numerator",
"=",
"-",
"numerator",
";",
"denominator",
"=",
"-",
"denominator",
";",
"}",
"return",
"new",
"Fraction",
"(",
"numerator",
",",
"denominator",
")",
";",
"}"
] | <p>Creates a <code>Fraction</code> instance with the 2 parts
of a fraction Y/Z.</p>
<p>Any negative signs are resolved to be on the numerator.</p>
@param numerator the numerator, for example the three in 'three sevenths'
@param denominator the denominator, for example the seven in 'three sevenths'
@return a new fraction instance
@throws ArithmeticException if the denominator is <code>zero</code>
or the denominator is {@code negative} and the numerator is {@code Integer#MIN_VALUE} | [
"<p",
">",
"Creates",
"a",
"<code",
">",
"Fraction<",
"/",
"code",
">",
"instance",
"with",
"the",
"2",
"parts",
"of",
"a",
"fraction",
"Y",
"/",
"Z",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/math/Fraction.java#L142-L154 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/processor/ExecutionStats.java | ExecutionStats.addMapStats | public synchronized void addMapStats(
final MapfishMapContext mapContext, final MapAttribute.MapAttributeValues mapValues) {
"""
Add statistics about a created map.
@param mapContext the
@param mapValues the
"""
this.mapStats.add(new MapStats(mapContext, mapValues));
} | java | public synchronized void addMapStats(
final MapfishMapContext mapContext, final MapAttribute.MapAttributeValues mapValues) {
this.mapStats.add(new MapStats(mapContext, mapValues));
} | [
"public",
"synchronized",
"void",
"addMapStats",
"(",
"final",
"MapfishMapContext",
"mapContext",
",",
"final",
"MapAttribute",
".",
"MapAttributeValues",
"mapValues",
")",
"{",
"this",
".",
"mapStats",
".",
"add",
"(",
"new",
"MapStats",
"(",
"mapContext",
",",
"mapValues",
")",
")",
";",
"}"
] | Add statistics about a created map.
@param mapContext the
@param mapValues the | [
"Add",
"statistics",
"about",
"a",
"created",
"map",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/ExecutionStats.java#L30-L33 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.formatTextData | static private StringBuilder formatTextData(StringBuilder buffer, byte[] data, int inOffset) {
"""
Format the next 16 bytes of the input data starting from the input offset
as ASCII characters. Non-ASCII bytes will be printed as a period symbol.
@param buffer
@param data
@param inOffset
@return StringBuilder
"""
int offset = inOffset;
int end = offset + 16;
for (; offset < end; offset++) {
if (offset >= data.length) {
buffer.append(" ");
continue;
}
if (Character.isLetterOrDigit(data[offset])) {
buffer.append((char) data[offset]);
} else {
buffer.append('.');
}
}
return buffer;
} | java | static private StringBuilder formatTextData(StringBuilder buffer, byte[] data, int inOffset) {
int offset = inOffset;
int end = offset + 16;
for (; offset < end; offset++) {
if (offset >= data.length) {
buffer.append(" ");
continue;
}
if (Character.isLetterOrDigit(data[offset])) {
buffer.append((char) data[offset]);
} else {
buffer.append('.');
}
}
return buffer;
} | [
"static",
"private",
"StringBuilder",
"formatTextData",
"(",
"StringBuilder",
"buffer",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"inOffset",
")",
"{",
"int",
"offset",
"=",
"inOffset",
";",
"int",
"end",
"=",
"offset",
"+",
"16",
";",
"for",
"(",
";",
"offset",
"<",
"end",
";",
"offset",
"++",
")",
"{",
"if",
"(",
"offset",
">=",
"data",
".",
"length",
")",
"{",
"buffer",
".",
"append",
"(",
"\" \"",
")",
";",
"continue",
";",
"}",
"if",
"(",
"Character",
".",
"isLetterOrDigit",
"(",
"data",
"[",
"offset",
"]",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"(",
"char",
")",
"data",
"[",
"offset",
"]",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"}",
"return",
"buffer",
";",
"}"
] | Format the next 16 bytes of the input data starting from the input offset
as ASCII characters. Non-ASCII bytes will be printed as a period symbol.
@param buffer
@param data
@param inOffset
@return StringBuilder | [
"Format",
"the",
"next",
"16",
"bytes",
"of",
"the",
"input",
"data",
"starting",
"from",
"the",
"input",
"offset",
"as",
"ASCII",
"characters",
".",
"Non",
"-",
"ASCII",
"bytes",
"will",
"be",
"printed",
"as",
"a",
"period",
"symbol",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L989-L1004 |
carrotsearch/hppc | hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayDeque.java | KTypeArrayDeque.forEach | private void forEach(KTypeProcedure<? super KType> procedure, int fromIndex, final int toIndex) {
"""
Applies <code>procedure</code> to a slice of the deque,
<code>fromIndex</code>, inclusive, to <code>toIndex</code>, exclusive.
"""
final KType[] buffer = Intrinsics.<KType[]> cast(this.buffer);
for (int i = fromIndex; i != toIndex; i = oneRight(i, buffer.length)) {
procedure.apply(buffer[i]);
}
} | java | private void forEach(KTypeProcedure<? super KType> procedure, int fromIndex, final int toIndex) {
final KType[] buffer = Intrinsics.<KType[]> cast(this.buffer);
for (int i = fromIndex; i != toIndex; i = oneRight(i, buffer.length)) {
procedure.apply(buffer[i]);
}
} | [
"private",
"void",
"forEach",
"(",
"KTypeProcedure",
"<",
"?",
"super",
"KType",
">",
"procedure",
",",
"int",
"fromIndex",
",",
"final",
"int",
"toIndex",
")",
"{",
"final",
"KType",
"[",
"]",
"buffer",
"=",
"Intrinsics",
".",
"<",
"KType",
"[",
"]",
">",
"cast",
"(",
"this",
".",
"buffer",
")",
";",
"for",
"(",
"int",
"i",
"=",
"fromIndex",
";",
"i",
"!=",
"toIndex",
";",
"i",
"=",
"oneRight",
"(",
"i",
",",
"buffer",
".",
"length",
")",
")",
"{",
"procedure",
".",
"apply",
"(",
"buffer",
"[",
"i",
"]",
")",
";",
"}",
"}"
] | Applies <code>procedure</code> to a slice of the deque,
<code>fromIndex</code>, inclusive, to <code>toIndex</code>, exclusive. | [
"Applies",
"<code",
">",
"procedure<",
"/",
"code",
">",
"to",
"a",
"slice",
"of",
"the",
"deque",
"<code",
">",
"fromIndex<",
"/",
"code",
">",
"inclusive",
"to",
"<code",
">",
"toIndex<",
"/",
"code",
">",
"exclusive",
"."
] | train | https://github.com/carrotsearch/hppc/blob/e359e9da358e846fcbffc64a765611df954ba3f6/hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayDeque.java#L682-L687 |
buschmais/jqa-core-framework | report/src/main/java/com/buschmais/jqassistant/core/report/impl/XmlReportPlugin.java | XmlReportPlugin.writeColumn | private void writeColumn(String columnName, Object value) throws XMLStreamException {
"""
Determines the language and language element of a descriptor from a result
column.
@param columnName
The name of the column.
@param value
The value.
@throws XMLStreamException
If a problem occurs.
"""
xmlStreamWriter.writeStartElement("column");
xmlStreamWriter.writeAttribute("name", columnName);
String stringValue = null;
if (value instanceof CompositeObject) {
CompositeObject descriptor = (CompositeObject) value;
LanguageElement elementValue = LanguageHelper.getLanguageElement(descriptor);
if (elementValue != null) {
xmlStreamWriter.writeStartElement("element");
xmlStreamWriter.writeAttribute("language", elementValue.getLanguage());
xmlStreamWriter.writeCharacters(elementValue.name());
xmlStreamWriter.writeEndElement(); // element
SourceProvider sourceProvider = elementValue.getSourceProvider();
stringValue = sourceProvider.getName(descriptor);
String sourceFile = sourceProvider.getSourceFile(descriptor);
Integer lineNumber = sourceProvider.getLineNumber(descriptor);
if (sourceFile != null) {
xmlStreamWriter.writeStartElement("source");
xmlStreamWriter.writeAttribute("name", sourceFile);
if (lineNumber != null) {
xmlStreamWriter.writeAttribute("line", lineNumber.toString());
}
xmlStreamWriter.writeEndElement(); // sourceFile
}
}
} else if (value != null) {
stringValue = ReportHelper.getLabel(value);
}
xmlStreamWriter.writeStartElement("value");
xmlStreamWriter.writeCharacters(stringValue);
xmlStreamWriter.writeEndElement(); // value
xmlStreamWriter.writeEndElement(); // column
} | java | private void writeColumn(String columnName, Object value) throws XMLStreamException {
xmlStreamWriter.writeStartElement("column");
xmlStreamWriter.writeAttribute("name", columnName);
String stringValue = null;
if (value instanceof CompositeObject) {
CompositeObject descriptor = (CompositeObject) value;
LanguageElement elementValue = LanguageHelper.getLanguageElement(descriptor);
if (elementValue != null) {
xmlStreamWriter.writeStartElement("element");
xmlStreamWriter.writeAttribute("language", elementValue.getLanguage());
xmlStreamWriter.writeCharacters(elementValue.name());
xmlStreamWriter.writeEndElement(); // element
SourceProvider sourceProvider = elementValue.getSourceProvider();
stringValue = sourceProvider.getName(descriptor);
String sourceFile = sourceProvider.getSourceFile(descriptor);
Integer lineNumber = sourceProvider.getLineNumber(descriptor);
if (sourceFile != null) {
xmlStreamWriter.writeStartElement("source");
xmlStreamWriter.writeAttribute("name", sourceFile);
if (lineNumber != null) {
xmlStreamWriter.writeAttribute("line", lineNumber.toString());
}
xmlStreamWriter.writeEndElement(); // sourceFile
}
}
} else if (value != null) {
stringValue = ReportHelper.getLabel(value);
}
xmlStreamWriter.writeStartElement("value");
xmlStreamWriter.writeCharacters(stringValue);
xmlStreamWriter.writeEndElement(); // value
xmlStreamWriter.writeEndElement(); // column
} | [
"private",
"void",
"writeColumn",
"(",
"String",
"columnName",
",",
"Object",
"value",
")",
"throws",
"XMLStreamException",
"{",
"xmlStreamWriter",
".",
"writeStartElement",
"(",
"\"column\"",
")",
";",
"xmlStreamWriter",
".",
"writeAttribute",
"(",
"\"name\"",
",",
"columnName",
")",
";",
"String",
"stringValue",
"=",
"null",
";",
"if",
"(",
"value",
"instanceof",
"CompositeObject",
")",
"{",
"CompositeObject",
"descriptor",
"=",
"(",
"CompositeObject",
")",
"value",
";",
"LanguageElement",
"elementValue",
"=",
"LanguageHelper",
".",
"getLanguageElement",
"(",
"descriptor",
")",
";",
"if",
"(",
"elementValue",
"!=",
"null",
")",
"{",
"xmlStreamWriter",
".",
"writeStartElement",
"(",
"\"element\"",
")",
";",
"xmlStreamWriter",
".",
"writeAttribute",
"(",
"\"language\"",
",",
"elementValue",
".",
"getLanguage",
"(",
")",
")",
";",
"xmlStreamWriter",
".",
"writeCharacters",
"(",
"elementValue",
".",
"name",
"(",
")",
")",
";",
"xmlStreamWriter",
".",
"writeEndElement",
"(",
")",
";",
"// element",
"SourceProvider",
"sourceProvider",
"=",
"elementValue",
".",
"getSourceProvider",
"(",
")",
";",
"stringValue",
"=",
"sourceProvider",
".",
"getName",
"(",
"descriptor",
")",
";",
"String",
"sourceFile",
"=",
"sourceProvider",
".",
"getSourceFile",
"(",
"descriptor",
")",
";",
"Integer",
"lineNumber",
"=",
"sourceProvider",
".",
"getLineNumber",
"(",
"descriptor",
")",
";",
"if",
"(",
"sourceFile",
"!=",
"null",
")",
"{",
"xmlStreamWriter",
".",
"writeStartElement",
"(",
"\"source\"",
")",
";",
"xmlStreamWriter",
".",
"writeAttribute",
"(",
"\"name\"",
",",
"sourceFile",
")",
";",
"if",
"(",
"lineNumber",
"!=",
"null",
")",
"{",
"xmlStreamWriter",
".",
"writeAttribute",
"(",
"\"line\"",
",",
"lineNumber",
".",
"toString",
"(",
")",
")",
";",
"}",
"xmlStreamWriter",
".",
"writeEndElement",
"(",
")",
";",
"// sourceFile",
"}",
"}",
"}",
"else",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"stringValue",
"=",
"ReportHelper",
".",
"getLabel",
"(",
"value",
")",
";",
"}",
"xmlStreamWriter",
".",
"writeStartElement",
"(",
"\"value\"",
")",
";",
"xmlStreamWriter",
".",
"writeCharacters",
"(",
"stringValue",
")",
";",
"xmlStreamWriter",
".",
"writeEndElement",
"(",
")",
";",
"// value",
"xmlStreamWriter",
".",
"writeEndElement",
"(",
")",
";",
"// column",
"}"
] | Determines the language and language element of a descriptor from a result
column.
@param columnName
The name of the column.
@param value
The value.
@throws XMLStreamException
If a problem occurs. | [
"Determines",
"the",
"language",
"and",
"language",
"element",
"of",
"a",
"descriptor",
"from",
"a",
"result",
"column",
"."
] | train | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/report/src/main/java/com/buschmais/jqassistant/core/report/impl/XmlReportPlugin.java#L243-L275 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.lt | public SDVariable lt(SDVariable x, SDVariable y) {
"""
Less than operation: elementwise x < y<br>
If x and y arrays have equal shape, the output shape is the same as these inputs.<br>
Note: supports broadcasting if x and y have different shapes and are broadcastable.<br>
Returns an array with values 1 where condition is satisfied, or value 0 otherwise.
@param x Input 1
@param y Input 2
@return Output SDVariable with values 0 and 1 based on where the condition is satisfied
"""
return lt(null, x, y);
} | java | public SDVariable lt(SDVariable x, SDVariable y) {
return lt(null, x, y);
} | [
"public",
"SDVariable",
"lt",
"(",
"SDVariable",
"x",
",",
"SDVariable",
"y",
")",
"{",
"return",
"lt",
"(",
"null",
",",
"x",
",",
"y",
")",
";",
"}"
] | Less than operation: elementwise x < y<br>
If x and y arrays have equal shape, the output shape is the same as these inputs.<br>
Note: supports broadcasting if x and y have different shapes and are broadcastable.<br>
Returns an array with values 1 where condition is satisfied, or value 0 otherwise.
@param x Input 1
@param y Input 2
@return Output SDVariable with values 0 and 1 based on where the condition is satisfied | [
"Less",
"than",
"operation",
":",
"elementwise",
"x",
"<",
"y<br",
">",
"If",
"x",
"and",
"y",
"arrays",
"have",
"equal",
"shape",
"the",
"output",
"shape",
"is",
"the",
"same",
"as",
"these",
"inputs",
".",
"<br",
">",
"Note",
":",
"supports",
"broadcasting",
"if",
"x",
"and",
"y",
"have",
"different",
"shapes",
"and",
"are",
"broadcastable",
".",
"<br",
">",
"Returns",
"an",
"array",
"with",
"values",
"1",
"where",
"condition",
"is",
"satisfied",
"or",
"value",
"0",
"otherwise",
"."
] | 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#L886-L888 |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.getLong | @PublicEvolving
public long getLong(ConfigOption<Long> configOption) {
"""
Returns the value associated with the given config option as a long integer.
@param configOption The configuration option
@return the (default) value associated with the given config option
"""
Object o = getValueOrDefaultFromOption(configOption);
return convertToLong(o, configOption.defaultValue());
} | java | @PublicEvolving
public long getLong(ConfigOption<Long> configOption) {
Object o = getValueOrDefaultFromOption(configOption);
return convertToLong(o, configOption.defaultValue());
} | [
"@",
"PublicEvolving",
"public",
"long",
"getLong",
"(",
"ConfigOption",
"<",
"Long",
">",
"configOption",
")",
"{",
"Object",
"o",
"=",
"getValueOrDefaultFromOption",
"(",
"configOption",
")",
";",
"return",
"convertToLong",
"(",
"o",
",",
"configOption",
".",
"defaultValue",
"(",
")",
")",
";",
"}"
] | Returns the value associated with the given config option as a long integer.
@param configOption The configuration option
@return the (default) value associated with the given config option | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"config",
"option",
"as",
"a",
"long",
"integer",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L293-L297 |
zxing/zxing | android/src/com/google/zxing/client/android/CaptureActivity.java | CaptureActivity.handleDecode | public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
"""
A valid barcode has been found, so give an indication of success and show the results.
@param rawResult The contents of the barcode.
@param scaleFactor amount by which thumbnail was scaled
@param barcode A greyscale bitmap of the camera data which was decoded.
"""
inactivityTimer.onActivity();
lastResult = rawResult;
ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
boolean fromLiveScan = barcode != null;
if (fromLiveScan) {
historyManager.addHistoryItem(rawResult, resultHandler);
// Then not from history, so beep/vibrate and we have an image to draw on
beepManager.playBeepSoundAndVibrate();
drawResultPoints(barcode, scaleFactor, rawResult);
}
switch (source) {
case NATIVE_APP_INTENT:
case PRODUCT_SEARCH_LINK:
handleDecodeExternally(rawResult, resultHandler, barcode);
break;
case ZXING_LINK:
if (scanFromWebPageManager == null || !scanFromWebPageManager.isScanFromWebPage()) {
handleDecodeInternally(rawResult, resultHandler, barcode);
} else {
handleDecodeExternally(rawResult, resultHandler, barcode);
}
break;
case NONE:
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (fromLiveScan && prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
Toast.makeText(getApplicationContext(),
getResources().getString(R.string.msg_bulk_mode_scanned) + " (" + rawResult.getText() + ')',
Toast.LENGTH_SHORT).show();
maybeSetClipboard(resultHandler);
// Wait a moment or else it will scan the same barcode continuously about 3 times
restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);
} else {
handleDecodeInternally(rawResult, resultHandler, barcode);
}
break;
}
} | java | public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
inactivityTimer.onActivity();
lastResult = rawResult;
ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
boolean fromLiveScan = barcode != null;
if (fromLiveScan) {
historyManager.addHistoryItem(rawResult, resultHandler);
// Then not from history, so beep/vibrate and we have an image to draw on
beepManager.playBeepSoundAndVibrate();
drawResultPoints(barcode, scaleFactor, rawResult);
}
switch (source) {
case NATIVE_APP_INTENT:
case PRODUCT_SEARCH_LINK:
handleDecodeExternally(rawResult, resultHandler, barcode);
break;
case ZXING_LINK:
if (scanFromWebPageManager == null || !scanFromWebPageManager.isScanFromWebPage()) {
handleDecodeInternally(rawResult, resultHandler, barcode);
} else {
handleDecodeExternally(rawResult, resultHandler, barcode);
}
break;
case NONE:
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (fromLiveScan && prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
Toast.makeText(getApplicationContext(),
getResources().getString(R.string.msg_bulk_mode_scanned) + " (" + rawResult.getText() + ')',
Toast.LENGTH_SHORT).show();
maybeSetClipboard(resultHandler);
// Wait a moment or else it will scan the same barcode continuously about 3 times
restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);
} else {
handleDecodeInternally(rawResult, resultHandler, barcode);
}
break;
}
} | [
"public",
"void",
"handleDecode",
"(",
"Result",
"rawResult",
",",
"Bitmap",
"barcode",
",",
"float",
"scaleFactor",
")",
"{",
"inactivityTimer",
".",
"onActivity",
"(",
")",
";",
"lastResult",
"=",
"rawResult",
";",
"ResultHandler",
"resultHandler",
"=",
"ResultHandlerFactory",
".",
"makeResultHandler",
"(",
"this",
",",
"rawResult",
")",
";",
"boolean",
"fromLiveScan",
"=",
"barcode",
"!=",
"null",
";",
"if",
"(",
"fromLiveScan",
")",
"{",
"historyManager",
".",
"addHistoryItem",
"(",
"rawResult",
",",
"resultHandler",
")",
";",
"// Then not from history, so beep/vibrate and we have an image to draw on",
"beepManager",
".",
"playBeepSoundAndVibrate",
"(",
")",
";",
"drawResultPoints",
"(",
"barcode",
",",
"scaleFactor",
",",
"rawResult",
")",
";",
"}",
"switch",
"(",
"source",
")",
"{",
"case",
"NATIVE_APP_INTENT",
":",
"case",
"PRODUCT_SEARCH_LINK",
":",
"handleDecodeExternally",
"(",
"rawResult",
",",
"resultHandler",
",",
"barcode",
")",
";",
"break",
";",
"case",
"ZXING_LINK",
":",
"if",
"(",
"scanFromWebPageManager",
"==",
"null",
"||",
"!",
"scanFromWebPageManager",
".",
"isScanFromWebPage",
"(",
")",
")",
"{",
"handleDecodeInternally",
"(",
"rawResult",
",",
"resultHandler",
",",
"barcode",
")",
";",
"}",
"else",
"{",
"handleDecodeExternally",
"(",
"rawResult",
",",
"resultHandler",
",",
"barcode",
")",
";",
"}",
"break",
";",
"case",
"NONE",
":",
"SharedPreferences",
"prefs",
"=",
"PreferenceManager",
".",
"getDefaultSharedPreferences",
"(",
"this",
")",
";",
"if",
"(",
"fromLiveScan",
"&&",
"prefs",
".",
"getBoolean",
"(",
"PreferencesActivity",
".",
"KEY_BULK_MODE",
",",
"false",
")",
")",
"{",
"Toast",
".",
"makeText",
"(",
"getApplicationContext",
"(",
")",
",",
"getResources",
"(",
")",
".",
"getString",
"(",
"R",
".",
"string",
".",
"msg_bulk_mode_scanned",
")",
"+",
"\" (\"",
"+",
"rawResult",
".",
"getText",
"(",
")",
"+",
"'",
"'",
",",
"Toast",
".",
"LENGTH_SHORT",
")",
".",
"show",
"(",
")",
";",
"maybeSetClipboard",
"(",
"resultHandler",
")",
";",
"// Wait a moment or else it will scan the same barcode continuously about 3 times",
"restartPreviewAfterDelay",
"(",
"BULK_MODE_SCAN_DELAY_MS",
")",
";",
"}",
"else",
"{",
"handleDecodeInternally",
"(",
"rawResult",
",",
"resultHandler",
",",
"barcode",
")",
";",
"}",
"break",
";",
"}",
"}"
] | A valid barcode has been found, so give an indication of success and show the results.
@param rawResult The contents of the barcode.
@param scaleFactor amount by which thumbnail was scaled
@param barcode A greyscale bitmap of the camera data which was decoded. | [
"A",
"valid",
"barcode",
"has",
"been",
"found",
"so",
"give",
"an",
"indication",
"of",
"success",
"and",
"show",
"the",
"results",
"."
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/CaptureActivity.java#L443-L482 |
groupon/monsoon | history/src/main/java/com/groupon/lex/metrics/history/v1/xdr/ToXdr.java | ToXdr.metricName_index | private int metricName_index(dictionary_delta dict_delta, MetricName metric) {
"""
Lookup the index for the argument, or if it isn't present, create one.
"""
final BiMap<MetricName, Integer> dict = from_.getMetricDict().inverse();
final Integer resolved = dict.get(metric);
if (resolved != null) return resolved;
final int allocated = allocate_index_(dict);
dict.put(metric, allocated);
// Create new pdd for serialization.
path_dictionary_delta mdd = new path_dictionary_delta();
mdd.id = allocated;
mdd.value = new_path_(metric.getPath());
// Append new entry to array.
dict_delta.mdd = Stream.concat(Arrays.stream(dict_delta.mdd), Stream.of(mdd))
.toArray(path_dictionary_delta[]::new);
LOG.log(Level.FINE, "dict_delta.mdd: {0} items (added {1})", new Object[]{dict_delta.mdd.length, metric});
return allocated;
} | java | private int metricName_index(dictionary_delta dict_delta, MetricName metric) {
final BiMap<MetricName, Integer> dict = from_.getMetricDict().inverse();
final Integer resolved = dict.get(metric);
if (resolved != null) return resolved;
final int allocated = allocate_index_(dict);
dict.put(metric, allocated);
// Create new pdd for serialization.
path_dictionary_delta mdd = new path_dictionary_delta();
mdd.id = allocated;
mdd.value = new_path_(metric.getPath());
// Append new entry to array.
dict_delta.mdd = Stream.concat(Arrays.stream(dict_delta.mdd), Stream.of(mdd))
.toArray(path_dictionary_delta[]::new);
LOG.log(Level.FINE, "dict_delta.mdd: {0} items (added {1})", new Object[]{dict_delta.mdd.length, metric});
return allocated;
} | [
"private",
"int",
"metricName_index",
"(",
"dictionary_delta",
"dict_delta",
",",
"MetricName",
"metric",
")",
"{",
"final",
"BiMap",
"<",
"MetricName",
",",
"Integer",
">",
"dict",
"=",
"from_",
".",
"getMetricDict",
"(",
")",
".",
"inverse",
"(",
")",
";",
"final",
"Integer",
"resolved",
"=",
"dict",
".",
"get",
"(",
"metric",
")",
";",
"if",
"(",
"resolved",
"!=",
"null",
")",
"return",
"resolved",
";",
"final",
"int",
"allocated",
"=",
"allocate_index_",
"(",
"dict",
")",
";",
"dict",
".",
"put",
"(",
"metric",
",",
"allocated",
")",
";",
"// Create new pdd for serialization.",
"path_dictionary_delta",
"mdd",
"=",
"new",
"path_dictionary_delta",
"(",
")",
";",
"mdd",
".",
"id",
"=",
"allocated",
";",
"mdd",
".",
"value",
"=",
"new_path_",
"(",
"metric",
".",
"getPath",
"(",
")",
")",
";",
"// Append new entry to array.",
"dict_delta",
".",
"mdd",
"=",
"Stream",
".",
"concat",
"(",
"Arrays",
".",
"stream",
"(",
"dict_delta",
".",
"mdd",
")",
",",
"Stream",
".",
"of",
"(",
"mdd",
")",
")",
".",
"toArray",
"(",
"path_dictionary_delta",
"[",
"]",
"::",
"new",
")",
";",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"dict_delta.mdd: {0} items (added {1})\"",
",",
"new",
"Object",
"[",
"]",
"{",
"dict_delta",
".",
"mdd",
".",
"length",
",",
"metric",
"}",
")",
";",
"return",
"allocated",
";",
"}"
] | Lookup the index for the argument, or if it isn't present, create one. | [
"Lookup",
"the",
"index",
"for",
"the",
"argument",
"or",
"if",
"it",
"isn",
"t",
"present",
"create",
"one",
"."
] | train | https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/history/src/main/java/com/groupon/lex/metrics/history/v1/xdr/ToXdr.java#L135-L153 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.onSetCaching | private void onSetCaching(CfDef cfDef, Properties cfProperties, StringBuilder builder) {
"""
On set caching.
@param cfDef
the cf def
@param cfProperties
the cf properties
@param builder
the builder
"""
String caching = cfProperties.getProperty(CassandraConstants.CACHING);
if (caching != null)
{
if (builder != null)
{
appendPropertyToBuilder(builder, caching, CassandraConstants.CACHING);
}
else
{
cfDef.setCaching(caching);
}
}
} | java | private void onSetCaching(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
String caching = cfProperties.getProperty(CassandraConstants.CACHING);
if (caching != null)
{
if (builder != null)
{
appendPropertyToBuilder(builder, caching, CassandraConstants.CACHING);
}
else
{
cfDef.setCaching(caching);
}
}
} | [
"private",
"void",
"onSetCaching",
"(",
"CfDef",
"cfDef",
",",
"Properties",
"cfProperties",
",",
"StringBuilder",
"builder",
")",
"{",
"String",
"caching",
"=",
"cfProperties",
".",
"getProperty",
"(",
"CassandraConstants",
".",
"CACHING",
")",
";",
"if",
"(",
"caching",
"!=",
"null",
")",
"{",
"if",
"(",
"builder",
"!=",
"null",
")",
"{",
"appendPropertyToBuilder",
"(",
"builder",
",",
"caching",
",",
"CassandraConstants",
".",
"CACHING",
")",
";",
"}",
"else",
"{",
"cfDef",
".",
"setCaching",
"(",
"caching",
")",
";",
"}",
"}",
"}"
] | On set caching.
@param cfDef
the cf def
@param cfProperties
the cf properties
@param builder
the builder | [
"On",
"set",
"caching",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L2470-L2484 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/client/ApiClient.java | ApiClient.setAccessToken | public void setAccessToken(final String accessToken, final Long expiresIn) {
"""
Helper method to preset the OAuth access token of the first OAuth found in the apiAuthorizations (there should be only one)
@param accessToken OAuth access token
@param expiresIn Validity period of the access token in seconds
"""
for (Authentication auth : authentications.values()) {
if (auth instanceof OAuth) {
((OAuth) auth).setAccessToken(accessToken, expiresIn);
return;
}
}
OAuth oAuth = new OAuth(null, null, null) {
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
headerParams.put("Authorization", "Bearer " + accessToken);
}
};
oAuth.setAccessToken(accessToken, expiresIn);
addAuthorization("docusignAccessCode", oAuth);
// throw new RuntimeException("No OAuth2 authentication configured!");
} | java | public void setAccessToken(final String accessToken, final Long expiresIn) {
for (Authentication auth : authentications.values()) {
if (auth instanceof OAuth) {
((OAuth) auth).setAccessToken(accessToken, expiresIn);
return;
}
}
OAuth oAuth = new OAuth(null, null, null) {
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
headerParams.put("Authorization", "Bearer " + accessToken);
}
};
oAuth.setAccessToken(accessToken, expiresIn);
addAuthorization("docusignAccessCode", oAuth);
// throw new RuntimeException("No OAuth2 authentication configured!");
} | [
"public",
"void",
"setAccessToken",
"(",
"final",
"String",
"accessToken",
",",
"final",
"Long",
"expiresIn",
")",
"{",
"for",
"(",
"Authentication",
"auth",
":",
"authentications",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"auth",
"instanceof",
"OAuth",
")",
"{",
"(",
"(",
"OAuth",
")",
"auth",
")",
".",
"setAccessToken",
"(",
"accessToken",
",",
"expiresIn",
")",
";",
"return",
";",
"}",
"}",
"OAuth",
"oAuth",
"=",
"new",
"OAuth",
"(",
"null",
",",
"null",
",",
"null",
")",
"{",
"@",
"Override",
"public",
"void",
"applyToParams",
"(",
"List",
"<",
"Pair",
">",
"queryParams",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headerParams",
")",
"{",
"headerParams",
".",
"put",
"(",
"\"Authorization\"",
",",
"\"Bearer \"",
"+",
"accessToken",
")",
";",
"}",
"}",
";",
"oAuth",
".",
"setAccessToken",
"(",
"accessToken",
",",
"expiresIn",
")",
";",
"addAuthorization",
"(",
"\"docusignAccessCode\"",
",",
"oAuth",
")",
";",
"// throw new RuntimeException(\"No OAuth2 authentication configured!\");",
"}"
] | Helper method to preset the OAuth access token of the first OAuth found in the apiAuthorizations (there should be only one)
@param accessToken OAuth access token
@param expiresIn Validity period of the access token in seconds | [
"Helper",
"method",
"to",
"preset",
"the",
"OAuth",
"access",
"token",
"of",
"the",
"first",
"OAuth",
"found",
"in",
"the",
"apiAuthorizations",
"(",
"there",
"should",
"be",
"only",
"one",
")"
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/client/ApiClient.java#L303-L319 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/vocab/OWLFacet_CustomFieldSerializer.java | OWLFacet_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLFacet instance) throws SerializationException {
"""
Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful
"""
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLFacet instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLFacet",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamReader",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/vocab/OWLFacet_CustomFieldSerializer.java#L89-L92 |
apiman/apiman | manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java | EsMarshalling.unmarshallClientVersion | public static ClientVersionBean unmarshallClientVersion(Map<String, Object> source) {
"""
Unmarshals the given map source into a bean.
@param source the source
@return the client version
"""
if (source == null) {
return null;
}
ClientVersionBean bean = new ClientVersionBean();
bean.setVersion(asString(source.get("version")));
bean.setApikey(asString(source.get("apikey")));
bean.setStatus(asEnum(source.get("status"), ClientStatus.class));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
bean.setModifiedBy(asString(source.get("modifiedBy")));
bean.setModifiedOn(asDate(source.get("modifiedOn")));
bean.setPublishedOn(asDate(source.get("publishedOn")));
bean.setRetiredOn(asDate(source.get("retiredOn")));
postMarshall(bean);
return bean;
} | java | public static ClientVersionBean unmarshallClientVersion(Map<String, Object> source) {
if (source == null) {
return null;
}
ClientVersionBean bean = new ClientVersionBean();
bean.setVersion(asString(source.get("version")));
bean.setApikey(asString(source.get("apikey")));
bean.setStatus(asEnum(source.get("status"), ClientStatus.class));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
bean.setModifiedBy(asString(source.get("modifiedBy")));
bean.setModifiedOn(asDate(source.get("modifiedOn")));
bean.setPublishedOn(asDate(source.get("publishedOn")));
bean.setRetiredOn(asDate(source.get("retiredOn")));
postMarshall(bean);
return bean;
} | [
"public",
"static",
"ClientVersionBean",
"unmarshallClientVersion",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ClientVersionBean",
"bean",
"=",
"new",
"ClientVersionBean",
"(",
")",
";",
"bean",
".",
"setVersion",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"version\"",
")",
")",
")",
";",
"bean",
".",
"setApikey",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"apikey\"",
")",
")",
")",
";",
"bean",
".",
"setStatus",
"(",
"asEnum",
"(",
"source",
".",
"get",
"(",
"\"status\"",
")",
",",
"ClientStatus",
".",
"class",
")",
")",
";",
"bean",
".",
"setCreatedBy",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"createdBy\"",
")",
")",
")",
";",
"bean",
".",
"setCreatedOn",
"(",
"asDate",
"(",
"source",
".",
"get",
"(",
"\"createdOn\"",
")",
")",
")",
";",
"bean",
".",
"setModifiedBy",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"modifiedBy\"",
")",
")",
")",
";",
"bean",
".",
"setModifiedOn",
"(",
"asDate",
"(",
"source",
".",
"get",
"(",
"\"modifiedOn\"",
")",
")",
")",
";",
"bean",
".",
"setPublishedOn",
"(",
"asDate",
"(",
"source",
".",
"get",
"(",
"\"publishedOn\"",
")",
")",
")",
";",
"bean",
".",
"setRetiredOn",
"(",
"asDate",
"(",
"source",
".",
"get",
"(",
"\"retiredOn\"",
")",
")",
")",
";",
"postMarshall",
"(",
"bean",
")",
";",
"return",
"bean",
";",
"}"
] | Unmarshals the given map source into a bean.
@param source the source
@return the client version | [
"Unmarshals",
"the",
"given",
"map",
"source",
"into",
"a",
"bean",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L1061-L1077 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Matth.java | Matth.powExact | public static int powExact(int b, int k) {
"""
Returns the {@code b} to the {@code k}th power, provided it does not overflow.
<p>{@link #pow} may be faster, but does not check for overflow.
@throws ArithmeticException if {@code b} to the {@code k}th power overflows in signed
{@code int} arithmetic
"""
checkNonNegative("exponent", k);
switch (b) {
case 0:
return (k == 0) ? 1 : 0;
case 1:
return 1;
case (-1):
return ((k & 1) == 0) ? 1 : -1;
case 2:
checkNoOverflow(k < Integer.SIZE - 1);
return 1 << k;
case (-2):
checkNoOverflow(k < Integer.SIZE);
return ((k & 1) == 0) ? 1 << k : -1 << k;
default:
// continue below to handle the general case
}
int accum = 1;
while (true) {
switch (k) {
case 0:
return accum;
case 1:
return multiplyExact(accum, b);
default:
if ((k & 1) != 0) {
accum = multiplyExact(accum, b);
}
k >>= 1;
if (k > 0) {
checkNoOverflow(-FLOOR_SQRT_MAX_INT <= b & b <= FLOOR_SQRT_MAX_INT);
b *= b;
}
}
}
} | java | public static int powExact(int b, int k) {
checkNonNegative("exponent", k);
switch (b) {
case 0:
return (k == 0) ? 1 : 0;
case 1:
return 1;
case (-1):
return ((k & 1) == 0) ? 1 : -1;
case 2:
checkNoOverflow(k < Integer.SIZE - 1);
return 1 << k;
case (-2):
checkNoOverflow(k < Integer.SIZE);
return ((k & 1) == 0) ? 1 << k : -1 << k;
default:
// continue below to handle the general case
}
int accum = 1;
while (true) {
switch (k) {
case 0:
return accum;
case 1:
return multiplyExact(accum, b);
default:
if ((k & 1) != 0) {
accum = multiplyExact(accum, b);
}
k >>= 1;
if (k > 0) {
checkNoOverflow(-FLOOR_SQRT_MAX_INT <= b & b <= FLOOR_SQRT_MAX_INT);
b *= b;
}
}
}
} | [
"public",
"static",
"int",
"powExact",
"(",
"int",
"b",
",",
"int",
"k",
")",
"{",
"checkNonNegative",
"(",
"\"exponent\"",
",",
"k",
")",
";",
"switch",
"(",
"b",
")",
"{",
"case",
"0",
":",
"return",
"(",
"k",
"==",
"0",
")",
"?",
"1",
":",
"0",
";",
"case",
"1",
":",
"return",
"1",
";",
"case",
"(",
"-",
"1",
")",
":",
"return",
"(",
"(",
"k",
"&",
"1",
")",
"==",
"0",
")",
"?",
"1",
":",
"-",
"1",
";",
"case",
"2",
":",
"checkNoOverflow",
"(",
"k",
"<",
"Integer",
".",
"SIZE",
"-",
"1",
")",
";",
"return",
"1",
"<<",
"k",
";",
"case",
"(",
"-",
"2",
")",
":",
"checkNoOverflow",
"(",
"k",
"<",
"Integer",
".",
"SIZE",
")",
";",
"return",
"(",
"(",
"k",
"&",
"1",
")",
"==",
"0",
")",
"?",
"1",
"<<",
"k",
":",
"-",
"1",
"<<",
"k",
";",
"default",
":",
"// continue below to handle the general case\r",
"}",
"int",
"accum",
"=",
"1",
";",
"while",
"(",
"true",
")",
"{",
"switch",
"(",
"k",
")",
"{",
"case",
"0",
":",
"return",
"accum",
";",
"case",
"1",
":",
"return",
"multiplyExact",
"(",
"accum",
",",
"b",
")",
";",
"default",
":",
"if",
"(",
"(",
"k",
"&",
"1",
")",
"!=",
"0",
")",
"{",
"accum",
"=",
"multiplyExact",
"(",
"accum",
",",
"b",
")",
";",
"}",
"k",
">>=",
"1",
";",
"if",
"(",
"k",
">",
"0",
")",
"{",
"checkNoOverflow",
"(",
"-",
"FLOOR_SQRT_MAX_INT",
"<=",
"b",
"&",
"b",
"<=",
"FLOOR_SQRT_MAX_INT",
")",
";",
"b",
"*=",
"b",
";",
"}",
"}",
"}",
"}"
] | Returns the {@code b} to the {@code k}th power, provided it does not overflow.
<p>{@link #pow} may be faster, but does not check for overflow.
@throws ArithmeticException if {@code b} to the {@code k}th power overflows in signed
{@code int} arithmetic | [
"Returns",
"the",
"{",
"@code",
"b",
"}",
"to",
"the",
"{",
"@code",
"k",
"}",
"th",
"power",
"provided",
"it",
"does",
"not",
"overflow",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Matth.java#L1457-L1493 |
WolfgangFahl/Mediawiki-Japi | src/main/java/com/bitplan/mediawiki/japi/user/WikiUser.java | WikiUser.getPropertyFile | public static File getPropertyFile(String wikiId, String user) {
"""
get the property file for the given wikiId and user
@param wikiId - the wiki to get the data for
@param user - the user
@return the property File
"""
String userPropertiesFileName = System.getProperty("user.home")
+ "/.mediawiki-japi/" + user + "_" + wikiId + ".ini";
File propFile = new File(userPropertiesFileName);
return propFile;
} | java | public static File getPropertyFile(String wikiId, String user) {
String userPropertiesFileName = System.getProperty("user.home")
+ "/.mediawiki-japi/" + user + "_" + wikiId + ".ini";
File propFile = new File(userPropertiesFileName);
return propFile;
} | [
"public",
"static",
"File",
"getPropertyFile",
"(",
"String",
"wikiId",
",",
"String",
"user",
")",
"{",
"String",
"userPropertiesFileName",
"=",
"System",
".",
"getProperty",
"(",
"\"user.home\"",
")",
"+",
"\"/.mediawiki-japi/\"",
"+",
"user",
"+",
"\"_\"",
"+",
"wikiId",
"+",
"\".ini\"",
";",
"File",
"propFile",
"=",
"new",
"File",
"(",
"userPropertiesFileName",
")",
";",
"return",
"propFile",
";",
"}"
] | get the property file for the given wikiId and user
@param wikiId - the wiki to get the data for
@param user - the user
@return the property File | [
"get",
"the",
"property",
"file",
"for",
"the",
"given",
"wikiId",
"and",
"user"
] | train | https://github.com/WolfgangFahl/Mediawiki-Japi/blob/78d0177ebfe02eb05da5550839727861f1e888a5/src/main/java/com/bitplan/mediawiki/japi/user/WikiUser.java#L92-L97 |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlUtils.java | PostgreSqlUtils.getPostgreSqlValue | static Object getPostgreSqlValue(Entity entity, Attribute attr) {
"""
Returns the PostgreSQL value for the given entity attribute
@param entity entity
@param attr attribute
@return PostgreSQL value
"""
String attrName = attr.getName();
AttributeType attrType = attr.getDataType();
switch (attrType) {
case BOOL:
return entity.getBoolean(attrName);
case CATEGORICAL:
case XREF:
Entity xrefEntity = entity.getEntity(attrName);
return xrefEntity != null
? getPostgreSqlValue(xrefEntity, xrefEntity.getEntityType().getIdAttribute())
: null;
case CATEGORICAL_MREF:
case MREF:
case ONE_TO_MANY:
Iterable<Entity> entities = entity.getEntities(attrName);
return stream(entities)
.map(
mrefEntity ->
getPostgreSqlValue(mrefEntity, mrefEntity.getEntityType().getIdAttribute()))
.collect(toList());
case DATE:
return entity.getLocalDate(attrName);
case DATE_TIME:
// As a workaround for #5674, we don't store milliseconds
Instant instant = entity.getInstant(attrName);
return instant != null ? instant.truncatedTo(ChronoUnit.SECONDS).atOffset(UTC) : null;
case DECIMAL:
return entity.getDouble(attrName);
case EMAIL:
case ENUM:
case HTML:
case HYPERLINK:
case SCRIPT:
case STRING:
case TEXT:
return entity.getString(attrName);
case FILE:
FileMeta fileEntity = entity.getEntity(attrName, FileMeta.class);
return fileEntity != null
? getPostgreSqlValue(fileEntity, fileEntity.getEntityType().getIdAttribute())
: null;
case INT:
return entity.getInt(attrName);
case LONG:
return entity.getLong(attrName);
case COMPOUND:
throw new IllegalAttributeTypeException(attrType);
default:
throw new UnexpectedEnumException(attrType);
}
} | java | static Object getPostgreSqlValue(Entity entity, Attribute attr) {
String attrName = attr.getName();
AttributeType attrType = attr.getDataType();
switch (attrType) {
case BOOL:
return entity.getBoolean(attrName);
case CATEGORICAL:
case XREF:
Entity xrefEntity = entity.getEntity(attrName);
return xrefEntity != null
? getPostgreSqlValue(xrefEntity, xrefEntity.getEntityType().getIdAttribute())
: null;
case CATEGORICAL_MREF:
case MREF:
case ONE_TO_MANY:
Iterable<Entity> entities = entity.getEntities(attrName);
return stream(entities)
.map(
mrefEntity ->
getPostgreSqlValue(mrefEntity, mrefEntity.getEntityType().getIdAttribute()))
.collect(toList());
case DATE:
return entity.getLocalDate(attrName);
case DATE_TIME:
// As a workaround for #5674, we don't store milliseconds
Instant instant = entity.getInstant(attrName);
return instant != null ? instant.truncatedTo(ChronoUnit.SECONDS).atOffset(UTC) : null;
case DECIMAL:
return entity.getDouble(attrName);
case EMAIL:
case ENUM:
case HTML:
case HYPERLINK:
case SCRIPT:
case STRING:
case TEXT:
return entity.getString(attrName);
case FILE:
FileMeta fileEntity = entity.getEntity(attrName, FileMeta.class);
return fileEntity != null
? getPostgreSqlValue(fileEntity, fileEntity.getEntityType().getIdAttribute())
: null;
case INT:
return entity.getInt(attrName);
case LONG:
return entity.getLong(attrName);
case COMPOUND:
throw new IllegalAttributeTypeException(attrType);
default:
throw new UnexpectedEnumException(attrType);
}
} | [
"static",
"Object",
"getPostgreSqlValue",
"(",
"Entity",
"entity",
",",
"Attribute",
"attr",
")",
"{",
"String",
"attrName",
"=",
"attr",
".",
"getName",
"(",
")",
";",
"AttributeType",
"attrType",
"=",
"attr",
".",
"getDataType",
"(",
")",
";",
"switch",
"(",
"attrType",
")",
"{",
"case",
"BOOL",
":",
"return",
"entity",
".",
"getBoolean",
"(",
"attrName",
")",
";",
"case",
"CATEGORICAL",
":",
"case",
"XREF",
":",
"Entity",
"xrefEntity",
"=",
"entity",
".",
"getEntity",
"(",
"attrName",
")",
";",
"return",
"xrefEntity",
"!=",
"null",
"?",
"getPostgreSqlValue",
"(",
"xrefEntity",
",",
"xrefEntity",
".",
"getEntityType",
"(",
")",
".",
"getIdAttribute",
"(",
")",
")",
":",
"null",
";",
"case",
"CATEGORICAL_MREF",
":",
"case",
"MREF",
":",
"case",
"ONE_TO_MANY",
":",
"Iterable",
"<",
"Entity",
">",
"entities",
"=",
"entity",
".",
"getEntities",
"(",
"attrName",
")",
";",
"return",
"stream",
"(",
"entities",
")",
".",
"map",
"(",
"mrefEntity",
"->",
"getPostgreSqlValue",
"(",
"mrefEntity",
",",
"mrefEntity",
".",
"getEntityType",
"(",
")",
".",
"getIdAttribute",
"(",
")",
")",
")",
".",
"collect",
"(",
"toList",
"(",
")",
")",
";",
"case",
"DATE",
":",
"return",
"entity",
".",
"getLocalDate",
"(",
"attrName",
")",
";",
"case",
"DATE_TIME",
":",
"// As a workaround for #5674, we don't store milliseconds",
"Instant",
"instant",
"=",
"entity",
".",
"getInstant",
"(",
"attrName",
")",
";",
"return",
"instant",
"!=",
"null",
"?",
"instant",
".",
"truncatedTo",
"(",
"ChronoUnit",
".",
"SECONDS",
")",
".",
"atOffset",
"(",
"UTC",
")",
":",
"null",
";",
"case",
"DECIMAL",
":",
"return",
"entity",
".",
"getDouble",
"(",
"attrName",
")",
";",
"case",
"EMAIL",
":",
"case",
"ENUM",
":",
"case",
"HTML",
":",
"case",
"HYPERLINK",
":",
"case",
"SCRIPT",
":",
"case",
"STRING",
":",
"case",
"TEXT",
":",
"return",
"entity",
".",
"getString",
"(",
"attrName",
")",
";",
"case",
"FILE",
":",
"FileMeta",
"fileEntity",
"=",
"entity",
".",
"getEntity",
"(",
"attrName",
",",
"FileMeta",
".",
"class",
")",
";",
"return",
"fileEntity",
"!=",
"null",
"?",
"getPostgreSqlValue",
"(",
"fileEntity",
",",
"fileEntity",
".",
"getEntityType",
"(",
")",
".",
"getIdAttribute",
"(",
")",
")",
":",
"null",
";",
"case",
"INT",
":",
"return",
"entity",
".",
"getInt",
"(",
"attrName",
")",
";",
"case",
"LONG",
":",
"return",
"entity",
".",
"getLong",
"(",
"attrName",
")",
";",
"case",
"COMPOUND",
":",
"throw",
"new",
"IllegalAttributeTypeException",
"(",
"attrType",
")",
";",
"default",
":",
"throw",
"new",
"UnexpectedEnumException",
"(",
"attrType",
")",
";",
"}",
"}"
] | Returns the PostgreSQL value for the given entity attribute
@param entity entity
@param attr attribute
@return PostgreSQL value | [
"Returns",
"the",
"PostgreSQL",
"value",
"for",
"the",
"given",
"entity",
"attribute"
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlUtils.java#L30-L82 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/protocol/file/FileURLConnection.java | FileURLConnection.getPermission | public Permission getPermission() throws IOException {
"""
/* since getOutputStream isn't supported, only read permission is
relevant
"""
if (permission == null) {
String decodedPath = ParseUtil.decode(url.getPath());
if (File.separatorChar == '/') {
permission = new FilePermission(decodedPath, "read");
} else {
permission = new FilePermission(
decodedPath.replace('/',File.separatorChar), "read");
}
}
return permission;
} | java | public Permission getPermission() throws IOException {
if (permission == null) {
String decodedPath = ParseUtil.decode(url.getPath());
if (File.separatorChar == '/') {
permission = new FilePermission(decodedPath, "read");
} else {
permission = new FilePermission(
decodedPath.replace('/',File.separatorChar), "read");
}
}
return permission;
} | [
"public",
"Permission",
"getPermission",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"permission",
"==",
"null",
")",
"{",
"String",
"decodedPath",
"=",
"ParseUtil",
".",
"decode",
"(",
"url",
".",
"getPath",
"(",
")",
")",
";",
"if",
"(",
"File",
".",
"separatorChar",
"==",
"'",
"'",
")",
"{",
"permission",
"=",
"new",
"FilePermission",
"(",
"decodedPath",
",",
"\"read\"",
")",
";",
"}",
"else",
"{",
"permission",
"=",
"new",
"FilePermission",
"(",
"decodedPath",
".",
"replace",
"(",
"'",
"'",
",",
"File",
".",
"separatorChar",
")",
",",
"\"read\"",
")",
";",
"}",
"}",
"return",
"permission",
";",
"}"
] | /* since getOutputStream isn't supported, only read permission is
relevant | [
"/",
"*",
"since",
"getOutputStream",
"isn",
"t",
"supported",
"only",
"read",
"permission",
"is",
"relevant"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/protocol/file/FileURLConnection.java#L222-L233 |
magik6k/JWWF | src/main/java/net/magik6k/jwwf/widgets/basic/panel/generic/LinePanel.java | LinePanel.put | public int put(Iterable<? extends Widget> widgets, int startIndex) throws IndexOutOfBoundsException {
"""
Adds all widgets from given iterable
@param widgets Iterable object containing widgets
@param startIndex index at wich adding will start
@return Index of last added element
@throws IndexOutOfBoundsException when specified startIndex is negative or there is no more space
"""
int index = startIndex;
for (Widget widget : widgets) {
put(widget, index);
++index;
}
return index;
} | java | public int put(Iterable<? extends Widget> widgets, int startIndex) throws IndexOutOfBoundsException {
int index = startIndex;
for (Widget widget : widgets) {
put(widget, index);
++index;
}
return index;
} | [
"public",
"int",
"put",
"(",
"Iterable",
"<",
"?",
"extends",
"Widget",
">",
"widgets",
",",
"int",
"startIndex",
")",
"throws",
"IndexOutOfBoundsException",
"{",
"int",
"index",
"=",
"startIndex",
";",
"for",
"(",
"Widget",
"widget",
":",
"widgets",
")",
"{",
"put",
"(",
"widget",
",",
"index",
")",
";",
"++",
"index",
";",
"}",
"return",
"index",
";",
"}"
] | Adds all widgets from given iterable
@param widgets Iterable object containing widgets
@param startIndex index at wich adding will start
@return Index of last added element
@throws IndexOutOfBoundsException when specified startIndex is negative or there is no more space | [
"Adds",
"all",
"widgets",
"from",
"given",
"iterable"
] | train | https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/widgets/basic/panel/generic/LinePanel.java#L42-L49 |
googlegenomics/utils-java | src/main/java/com/google/cloud/genomics/utils/GenomicsUtils.java | GenomicsUtils.getReferenceSetId | public static String getReferenceSetId(String readGroupSetId, OfflineAuth auth)
throws IOException {
"""
Gets the ReferenceSetId for a given readGroupSetId using the Genomics API.
@param readGroupSetId The id of the readGroupSet to query.
@param auth The OfflineAuth for the API request.
@return The referenceSetId for the redGroupSet (which may be null).
@throws IOException
"""
Genomics genomics = GenomicsFactory.builder().build().fromOfflineAuth(auth);
ReadGroupSet readGroupSet = genomics.readgroupsets().get(readGroupSetId)
.setFields("referenceSetId").execute();
return readGroupSet.getReferenceSetId();
} | java | public static String getReferenceSetId(String readGroupSetId, OfflineAuth auth)
throws IOException {
Genomics genomics = GenomicsFactory.builder().build().fromOfflineAuth(auth);
ReadGroupSet readGroupSet = genomics.readgroupsets().get(readGroupSetId)
.setFields("referenceSetId").execute();
return readGroupSet.getReferenceSetId();
} | [
"public",
"static",
"String",
"getReferenceSetId",
"(",
"String",
"readGroupSetId",
",",
"OfflineAuth",
"auth",
")",
"throws",
"IOException",
"{",
"Genomics",
"genomics",
"=",
"GenomicsFactory",
".",
"builder",
"(",
")",
".",
"build",
"(",
")",
".",
"fromOfflineAuth",
"(",
"auth",
")",
";",
"ReadGroupSet",
"readGroupSet",
"=",
"genomics",
".",
"readgroupsets",
"(",
")",
".",
"get",
"(",
"readGroupSetId",
")",
".",
"setFields",
"(",
"\"referenceSetId\"",
")",
".",
"execute",
"(",
")",
";",
"return",
"readGroupSet",
".",
"getReferenceSetId",
"(",
")",
";",
"}"
] | Gets the ReferenceSetId for a given readGroupSetId using the Genomics API.
@param readGroupSetId The id of the readGroupSet to query.
@param auth The OfflineAuth for the API request.
@return The referenceSetId for the redGroupSet (which may be null).
@throws IOException | [
"Gets",
"the",
"ReferenceSetId",
"for",
"a",
"given",
"readGroupSetId",
"using",
"the",
"Genomics",
"API",
"."
] | train | https://github.com/googlegenomics/utils-java/blob/7205d5b4e4f61fc6b93acb4bdd76b93df5b5f612/src/main/java/com/google/cloud/genomics/utils/GenomicsUtils.java#L70-L76 |
phax/ph-oton | ph-oton-core/src/main/java/com/helger/photon/core/systemmsg/SystemMessageData.java | SystemMessageData.setSystemMessage | @Nonnull
public EChange setSystemMessage (@Nonnull final ESystemMessageType eMessageType, @Nullable final String sMessage) {
"""
Set the system message type and text, and update the last modification
date.
@param eMessageType
Message type. May not be <code>null</code>.
@param sMessage
The message text. May be <code>null</code>.
@return {@link EChange}
"""
ValueEnforcer.notNull (eMessageType, "MessageType");
if (m_eMessageType.equals (eMessageType) && EqualsHelper.equals (m_sMessage, sMessage))
return EChange.UNCHANGED;
internalSetMessageType (eMessageType);
internalSetMessage (sMessage);
setLastUpdate (PDTFactory.getCurrentLocalDateTime ());
return EChange.CHANGED;
} | java | @Nonnull
public EChange setSystemMessage (@Nonnull final ESystemMessageType eMessageType, @Nullable final String sMessage)
{
ValueEnforcer.notNull (eMessageType, "MessageType");
if (m_eMessageType.equals (eMessageType) && EqualsHelper.equals (m_sMessage, sMessage))
return EChange.UNCHANGED;
internalSetMessageType (eMessageType);
internalSetMessage (sMessage);
setLastUpdate (PDTFactory.getCurrentLocalDateTime ());
return EChange.CHANGED;
} | [
"@",
"Nonnull",
"public",
"EChange",
"setSystemMessage",
"(",
"@",
"Nonnull",
"final",
"ESystemMessageType",
"eMessageType",
",",
"@",
"Nullable",
"final",
"String",
"sMessage",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"eMessageType",
",",
"\"MessageType\"",
")",
";",
"if",
"(",
"m_eMessageType",
".",
"equals",
"(",
"eMessageType",
")",
"&&",
"EqualsHelper",
".",
"equals",
"(",
"m_sMessage",
",",
"sMessage",
")",
")",
"return",
"EChange",
".",
"UNCHANGED",
";",
"internalSetMessageType",
"(",
"eMessageType",
")",
";",
"internalSetMessage",
"(",
"sMessage",
")",
";",
"setLastUpdate",
"(",
"PDTFactory",
".",
"getCurrentLocalDateTime",
"(",
")",
")",
";",
"return",
"EChange",
".",
"CHANGED",
";",
"}"
] | Set the system message type and text, and update the last modification
date.
@param eMessageType
Message type. May not be <code>null</code>.
@param sMessage
The message text. May be <code>null</code>.
@return {@link EChange} | [
"Set",
"the",
"system",
"message",
"type",
"and",
"text",
"and",
"update",
"the",
"last",
"modification",
"date",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/systemmsg/SystemMessageData.java#L105-L118 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/util/Data.java | Data.mapOf | public static Map<String, Object> mapOf(Object data) {
"""
Returns the map to use for the given data that is treated as a map from string key to some
value.
<p>If the input is {@code null}, it returns an empty map. If the input is a map, it simply
returns the input. Otherwise, it will create a map view using reflection that is backed by the
object, so that any changes to the map will be reflected on the object. The map keys of that
map view are based on the {@link Key} annotation, and null is not a possible map value,
although the magic null instance is possible (see {@link #nullOf(Class)} and {@link
#isNull(Object)}). Iteration order of the data keys is based on the sorted (ascending) key
names of the declared fields. Note that since the map view is backed by the object, and that
the object may change, many methods in the map view must recompute the field values using
reflection, for example {@link Map#size()} must check the number of non-null fields.
@param data any key value data, represented by an object or a map, or {@code null}
@return key/value map to use
"""
if (data == null || isNull(data)) {
return Collections.emptyMap();
}
if (data instanceof Map<?, ?>) {
@SuppressWarnings("unchecked")
Map<String, Object> result = (Map<String, Object>) data;
return result;
}
Map<String, Object> result = new DataMap(data, false);
return result;
} | java | public static Map<String, Object> mapOf(Object data) {
if (data == null || isNull(data)) {
return Collections.emptyMap();
}
if (data instanceof Map<?, ?>) {
@SuppressWarnings("unchecked")
Map<String, Object> result = (Map<String, Object>) data;
return result;
}
Map<String, Object> result = new DataMap(data, false);
return result;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"mapOf",
"(",
"Object",
"data",
")",
"{",
"if",
"(",
"data",
"==",
"null",
"||",
"isNull",
"(",
"data",
")",
")",
"{",
"return",
"Collections",
".",
"emptyMap",
"(",
")",
";",
"}",
"if",
"(",
"data",
"instanceof",
"Map",
"<",
"?",
",",
"?",
">",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
"=",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"data",
";",
"return",
"result",
";",
"}",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
"=",
"new",
"DataMap",
"(",
"data",
",",
"false",
")",
";",
"return",
"result",
";",
"}"
] | Returns the map to use for the given data that is treated as a map from string key to some
value.
<p>If the input is {@code null}, it returns an empty map. If the input is a map, it simply
returns the input. Otherwise, it will create a map view using reflection that is backed by the
object, so that any changes to the map will be reflected on the object. The map keys of that
map view are based on the {@link Key} annotation, and null is not a possible map value,
although the magic null instance is possible (see {@link #nullOf(Class)} and {@link
#isNull(Object)}). Iteration order of the data keys is based on the sorted (ascending) key
names of the declared fields. Note that since the map view is backed by the object, and that
the object may change, many methods in the map view must recompute the field values using
reflection, for example {@link Map#size()} must check the number of non-null fields.
@param data any key value data, represented by an object or a map, or {@code null}
@return key/value map to use | [
"Returns",
"the",
"map",
"to",
"use",
"for",
"the",
"given",
"data",
"that",
"is",
"treated",
"as",
"a",
"map",
"from",
"string",
"key",
"to",
"some",
"value",
"."
] | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/Data.java#L176-L187 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.parser/src/main/java/de/tudarmstadt/ukp/wikipedia/parser/mediawiki/SpanManager.java | SpanManager.removeManagedList | public void removeManagedList( List<Span> spans ) {
"""
Removes a List of Spans (not the Spans in the List), which shouldn�t be managed anymore.
@param spans
"""
final Span listIdentifer = new Span(Integer.MAX_VALUE, Integer.MIN_VALUE);
spans.add( listIdentifer );
managedLists.remove( spans );
spans.remove( listIdentifer );
} | java | public void removeManagedList( List<Span> spans ){
final Span listIdentifer = new Span(Integer.MAX_VALUE, Integer.MIN_VALUE);
spans.add( listIdentifer );
managedLists.remove( spans );
spans.remove( listIdentifer );
} | [
"public",
"void",
"removeManagedList",
"(",
"List",
"<",
"Span",
">",
"spans",
")",
"{",
"final",
"Span",
"listIdentifer",
"=",
"new",
"Span",
"(",
"Integer",
".",
"MAX_VALUE",
",",
"Integer",
".",
"MIN_VALUE",
")",
";",
"spans",
".",
"add",
"(",
"listIdentifer",
")",
";",
"managedLists",
".",
"remove",
"(",
"spans",
")",
";",
"spans",
".",
"remove",
"(",
"listIdentifer",
")",
";",
"}"
] | Removes a List of Spans (not the Spans in the List), which shouldn�t be managed anymore.
@param spans | [
"Removes",
"a",
"List",
"of",
"Spans",
"(",
"not",
"the",
"Spans",
"in",
"the",
"List",
")",
"which",
"shouldn�t",
"be",
"managed",
"anymore",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.parser/src/main/java/de/tudarmstadt/ukp/wikipedia/parser/mediawiki/SpanManager.java#L88-L93 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java | RunsInner.getLogSasUrlAsync | public Observable<RunGetLogResultInner> getLogSasUrlAsync(String resourceGroupName, String registryName, String runId) {
"""
Gets a link to download the run logs.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param runId The run ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RunGetLogResultInner object
"""
return getLogSasUrlWithServiceResponseAsync(resourceGroupName, registryName, runId).map(new Func1<ServiceResponse<RunGetLogResultInner>, RunGetLogResultInner>() {
@Override
public RunGetLogResultInner call(ServiceResponse<RunGetLogResultInner> response) {
return response.body();
}
});
} | java | public Observable<RunGetLogResultInner> getLogSasUrlAsync(String resourceGroupName, String registryName, String runId) {
return getLogSasUrlWithServiceResponseAsync(resourceGroupName, registryName, runId).map(new Func1<ServiceResponse<RunGetLogResultInner>, RunGetLogResultInner>() {
@Override
public RunGetLogResultInner call(ServiceResponse<RunGetLogResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RunGetLogResultInner",
">",
"getLogSasUrlAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"runId",
")",
"{",
"return",
"getLogSasUrlWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"runId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"RunGetLogResultInner",
">",
",",
"RunGetLogResultInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"RunGetLogResultInner",
"call",
"(",
"ServiceResponse",
"<",
"RunGetLogResultInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets a link to download the run logs.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param runId The run ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RunGetLogResultInner object | [
"Gets",
"a",
"link",
"to",
"download",
"the",
"run",
"logs",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java#L815-L822 |
cdk/cdk | descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/ChiIndexUtils.java | ChiIndexUtils.evalSimpleIndex | public static double evalSimpleIndex(IAtomContainer atomContainer, List<List<Integer>> fragLists) {
"""
Evaluates the simple chi index for a set of fragments.
@param atomContainer The target <code>AtomContainer</code>
@param fragLists A list of fragments
@return The simple chi index
"""
double sum = 0;
for (List<Integer> fragList : fragLists) {
double prod = 1.0;
for (Integer atomSerial : fragList) {
IAtom atom = atomContainer.getAtom(atomSerial);
int nconnected = atomContainer.getConnectedBondsCount(atom);
prod = prod * nconnected;
}
if (prod != 0) sum += 1.0 / Math.sqrt(prod);
}
return sum;
} | java | public static double evalSimpleIndex(IAtomContainer atomContainer, List<List<Integer>> fragLists) {
double sum = 0;
for (List<Integer> fragList : fragLists) {
double prod = 1.0;
for (Integer atomSerial : fragList) {
IAtom atom = atomContainer.getAtom(atomSerial);
int nconnected = atomContainer.getConnectedBondsCount(atom);
prod = prod * nconnected;
}
if (prod != 0) sum += 1.0 / Math.sqrt(prod);
}
return sum;
} | [
"public",
"static",
"double",
"evalSimpleIndex",
"(",
"IAtomContainer",
"atomContainer",
",",
"List",
"<",
"List",
"<",
"Integer",
">",
">",
"fragLists",
")",
"{",
"double",
"sum",
"=",
"0",
";",
"for",
"(",
"List",
"<",
"Integer",
">",
"fragList",
":",
"fragLists",
")",
"{",
"double",
"prod",
"=",
"1.0",
";",
"for",
"(",
"Integer",
"atomSerial",
":",
"fragList",
")",
"{",
"IAtom",
"atom",
"=",
"atomContainer",
".",
"getAtom",
"(",
"atomSerial",
")",
";",
"int",
"nconnected",
"=",
"atomContainer",
".",
"getConnectedBondsCount",
"(",
"atom",
")",
";",
"prod",
"=",
"prod",
"*",
"nconnected",
";",
"}",
"if",
"(",
"prod",
"!=",
"0",
")",
"sum",
"+=",
"1.0",
"/",
"Math",
".",
"sqrt",
"(",
"prod",
")",
";",
"}",
"return",
"sum",
";",
"}"
] | Evaluates the simple chi index for a set of fragments.
@param atomContainer The target <code>AtomContainer</code>
@param fragLists A list of fragments
@return The simple chi index | [
"Evaluates",
"the",
"simple",
"chi",
"index",
"for",
"a",
"set",
"of",
"fragments",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/ChiIndexUtils.java#L107-L119 |
alkacon/opencms-core | src/org/opencms/acacia/shared/CmsEntity.java | CmsEntity.insertAttributeValue | public void insertAttributeValue(String attributeName, String value, int index) {
"""
Inserts a new attribute value at the given index.<p>
@param attributeName the attribute name
@param value the attribute value
@param index the value index
"""
if (m_simpleAttributes.containsKey(attributeName)) {
m_simpleAttributes.get(attributeName).add(index, value);
} else {
setAttributeValue(attributeName, value);
}
fireChange();
} | java | public void insertAttributeValue(String attributeName, String value, int index) {
if (m_simpleAttributes.containsKey(attributeName)) {
m_simpleAttributes.get(attributeName).add(index, value);
} else {
setAttributeValue(attributeName, value);
}
fireChange();
} | [
"public",
"void",
"insertAttributeValue",
"(",
"String",
"attributeName",
",",
"String",
"value",
",",
"int",
"index",
")",
"{",
"if",
"(",
"m_simpleAttributes",
".",
"containsKey",
"(",
"attributeName",
")",
")",
"{",
"m_simpleAttributes",
".",
"get",
"(",
"attributeName",
")",
".",
"add",
"(",
"index",
",",
"value",
")",
";",
"}",
"else",
"{",
"setAttributeValue",
"(",
"attributeName",
",",
"value",
")",
";",
"}",
"fireChange",
"(",
")",
";",
"}"
] | Inserts a new attribute value at the given index.<p>
@param attributeName the attribute name
@param value the attribute value
@param index the value index | [
"Inserts",
"a",
"new",
"attribute",
"value",
"at",
"the",
"given",
"index",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/CmsEntity.java#L509-L517 |
facebook/fresco | fbcore/src/main/java/com/facebook/common/internal/Files.java | Files.toByteArray | public static byte[] toByteArray(File file) throws IOException {
"""
Reads all bytes from a file into a byte array.
@param file the file to read from
@return a byte array containing all the bytes from file
@throws IllegalArgumentException if the file is bigger than the largest
possible byte array (2^31 - 1)
@throws IOException if an I/O error occurs
"""
FileInputStream in = null;
try {
in = new FileInputStream(file);
return readFile(in, in.getChannel().size());
} finally {
if (in != null) {
in.close();
}
}
} | java | public static byte[] toByteArray(File file) throws IOException {
FileInputStream in = null;
try {
in = new FileInputStream(file);
return readFile(in, in.getChannel().size());
} finally {
if (in != null) {
in.close();
}
}
} | [
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"FileInputStream",
"in",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"return",
"readFile",
"(",
"in",
",",
"in",
".",
"getChannel",
"(",
")",
".",
"size",
"(",
")",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"in",
"!=",
"null",
")",
"{",
"in",
".",
"close",
"(",
")",
";",
"}",
"}",
"}"
] | Reads all bytes from a file into a byte array.
@param file the file to read from
@return a byte array containing all the bytes from file
@throws IllegalArgumentException if the file is bigger than the largest
possible byte array (2^31 - 1)
@throws IOException if an I/O error occurs | [
"Reads",
"all",
"bytes",
"from",
"a",
"file",
"into",
"a",
"byte",
"array",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/internal/Files.java#L64-L74 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java | SerializerBase.subPartMatch | private static final boolean subPartMatch(String p, String t) {
"""
Tell if two strings are equal, without worry if the first string is null.
@param p String reference, which may be null.
@param t String reference, which may be null.
@return true if strings are equal.
"""
return (p == t) || ((null != p) && (p.equals(t)));
} | java | private static final boolean subPartMatch(String p, String t)
{
return (p == t) || ((null != p) && (p.equals(t)));
} | [
"private",
"static",
"final",
"boolean",
"subPartMatch",
"(",
"String",
"p",
",",
"String",
"t",
")",
"{",
"return",
"(",
"p",
"==",
"t",
")",
"||",
"(",
"(",
"null",
"!=",
"p",
")",
"&&",
"(",
"p",
".",
"equals",
"(",
"t",
")",
")",
")",
";",
"}"
] | Tell if two strings are equal, without worry if the first string is null.
@param p String reference, which may be null.
@param t String reference, which may be null.
@return true if strings are equal. | [
"Tell",
"if",
"two",
"strings",
"are",
"equal",
"without",
"worry",
"if",
"the",
"first",
"string",
"is",
"null",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L805-L808 |
tomgibara/bits | src/main/java/com/tomgibara/bits/Bits.java | Bits.readerFrom | public static BitReader readerFrom(int[] ints, long size) {
"""
A {@link BitReader} that sources its bits from an array of ints. Bits are
read from the int array starting at index zero. Within each int, the most
significant bits are read first.
@param ints
the source ints
@param size
the number of bits that may be read, not negative and no
greater than the number of bits supplied by the array
@return a bit reader over the ints
"""
if (ints == null) throw new IllegalArgumentException("null ints");
checkSize(size, ((long) ints.length) << 5);
return new IntArrayBitReader(ints, size);
} | java | public static BitReader readerFrom(int[] ints, long size) {
if (ints == null) throw new IllegalArgumentException("null ints");
checkSize(size, ((long) ints.length) << 5);
return new IntArrayBitReader(ints, size);
} | [
"public",
"static",
"BitReader",
"readerFrom",
"(",
"int",
"[",
"]",
"ints",
",",
"long",
"size",
")",
"{",
"if",
"(",
"ints",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"null ints\"",
")",
";",
"checkSize",
"(",
"size",
",",
"(",
"(",
"long",
")",
"ints",
".",
"length",
")",
"<<",
"5",
")",
";",
"return",
"new",
"IntArrayBitReader",
"(",
"ints",
",",
"size",
")",
";",
"}"
] | A {@link BitReader} that sources its bits from an array of ints. Bits are
read from the int array starting at index zero. Within each int, the most
significant bits are read first.
@param ints
the source ints
@param size
the number of bits that may be read, not negative and no
greater than the number of bits supplied by the array
@return a bit reader over the ints | [
"A",
"{",
"@link",
"BitReader",
"}",
"that",
"sources",
"its",
"bits",
"from",
"an",
"array",
"of",
"ints",
".",
"Bits",
"are",
"read",
"from",
"the",
"int",
"array",
"starting",
"at",
"index",
"zero",
".",
"Within",
"each",
"int",
"the",
"most",
"significant",
"bits",
"are",
"read",
"first",
"."
] | train | https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L760-L764 |
logic-ng/LogicNG | src/main/java/org/logicng/backbones/BackboneGeneration.java | BackboneGeneration.computePositive | public static Backbone computePositive(final Collection<Formula> formulas, final Collection<Variable> variables) {
"""
Computes the positive backbone variables for a given collection of formulas w.r.t. a collection of variables.
@param formulas the given collection of formulas
@param variables the given collection of relevant variables for the backbone computation
@return the positive backbone or {@code null} if the formula is UNSAT
"""
return compute(formulas, variables, BackboneType.ONLY_POSITIVE);
} | java | public static Backbone computePositive(final Collection<Formula> formulas, final Collection<Variable> variables) {
return compute(formulas, variables, BackboneType.ONLY_POSITIVE);
} | [
"public",
"static",
"Backbone",
"computePositive",
"(",
"final",
"Collection",
"<",
"Formula",
">",
"formulas",
",",
"final",
"Collection",
"<",
"Variable",
">",
"variables",
")",
"{",
"return",
"compute",
"(",
"formulas",
",",
"variables",
",",
"BackboneType",
".",
"ONLY_POSITIVE",
")",
";",
"}"
] | Computes the positive backbone variables for a given collection of formulas w.r.t. a collection of variables.
@param formulas the given collection of formulas
@param variables the given collection of relevant variables for the backbone computation
@return the positive backbone or {@code null} if the formula is UNSAT | [
"Computes",
"the",
"positive",
"backbone",
"variables",
"for",
"a",
"given",
"collection",
"of",
"formulas",
"w",
".",
"r",
".",
"t",
".",
"a",
"collection",
"of",
"variables",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/BackboneGeneration.java#L164-L166 |
jbundle/jbundle | thin/base/thread/src/main/java/org/jbundle/thin/base/thread/TaskScheduler.java | TaskScheduler.addTask | public void addTask(Object objJobDef) {
"""
Add a job to the queue.
@param objJobDef Can be a AutoTask object or a string describing the job to run (in the overriding class).
"""
synchronized (this)
{
gvJobs.addElement(objJobDef); // Vector is thread safe.
if (giCurrentThreads >= giMaxThreads)
return; // The max threads are running... let the scheduler process them in order
giCurrentThreads++; // I'm going to start another thread
}
TaskScheduler js = this.makeNewTaskScheduler(0);
// This should be done more efficiently... having the threads waiting in a pool to be awakened when needed.
Thread thread = new Thread(js, "TaskSchedulerThread");
thread.start();
} | java | public void addTask(Object objJobDef)
{
synchronized (this)
{
gvJobs.addElement(objJobDef); // Vector is thread safe.
if (giCurrentThreads >= giMaxThreads)
return; // The max threads are running... let the scheduler process them in order
giCurrentThreads++; // I'm going to start another thread
}
TaskScheduler js = this.makeNewTaskScheduler(0);
// This should be done more efficiently... having the threads waiting in a pool to be awakened when needed.
Thread thread = new Thread(js, "TaskSchedulerThread");
thread.start();
} | [
"public",
"void",
"addTask",
"(",
"Object",
"objJobDef",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"gvJobs",
".",
"addElement",
"(",
"objJobDef",
")",
";",
"// Vector is thread safe.",
"if",
"(",
"giCurrentThreads",
">=",
"giMaxThreads",
")",
"return",
";",
"// The max threads are running... let the scheduler process them in order",
"giCurrentThreads",
"++",
";",
"// I'm going to start another thread",
"}",
"TaskScheduler",
"js",
"=",
"this",
".",
"makeNewTaskScheduler",
"(",
"0",
")",
";",
"// This should be done more efficiently... having the threads waiting in a pool to be awakened when needed.",
"Thread",
"thread",
"=",
"new",
"Thread",
"(",
"js",
",",
"\"TaskSchedulerThread\"",
")",
";",
"thread",
".",
"start",
"(",
")",
";",
"}"
] | Add a job to the queue.
@param objJobDef Can be a AutoTask object or a string describing the job to run (in the overriding class). | [
"Add",
"a",
"job",
"to",
"the",
"queue",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/thread/src/main/java/org/jbundle/thin/base/thread/TaskScheduler.java#L100-L113 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java | GeneratedDFactoryDaoImpl.queryByBaseUrl | public Iterable<DFactory> queryByBaseUrl(java.lang.String baseUrl) {
"""
query-by method for field baseUrl
@param baseUrl the specified attribute
@return an Iterable of DFactorys for the specified baseUrl
"""
return queryByField(null, DFactoryMapper.Field.BASEURL.getFieldName(), baseUrl);
} | java | public Iterable<DFactory> queryByBaseUrl(java.lang.String baseUrl) {
return queryByField(null, DFactoryMapper.Field.BASEURL.getFieldName(), baseUrl);
} | [
"public",
"Iterable",
"<",
"DFactory",
">",
"queryByBaseUrl",
"(",
"java",
".",
"lang",
".",
"String",
"baseUrl",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DFactoryMapper",
".",
"Field",
".",
"BASEURL",
".",
"getFieldName",
"(",
")",
",",
"baseUrl",
")",
";",
"}"
] | query-by method for field baseUrl
@param baseUrl the specified attribute
@return an Iterable of DFactorys for the specified baseUrl | [
"query",
"-",
"by",
"method",
"for",
"field",
"baseUrl"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java#L70-L72 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_reverse_ipReverse_DELETE | public void ip_reverse_ipReverse_DELETE(String ip, String ipReverse) throws IOException {
"""
Delete a reverse on one IP
REST: DELETE /ip/{ip}/reverse/{ipReverse}
@param ip [required]
@param ipReverse [required]
"""
String qPath = "/ip/{ip}/reverse/{ipReverse}";
StringBuilder sb = path(qPath, ip, ipReverse);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void ip_reverse_ipReverse_DELETE(String ip, String ipReverse) throws IOException {
String qPath = "/ip/{ip}/reverse/{ipReverse}";
StringBuilder sb = path(qPath, ip, ipReverse);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"ip_reverse_ipReverse_DELETE",
"(",
"String",
"ip",
",",
"String",
"ipReverse",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/reverse/{ipReverse}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"ip",
",",
"ipReverse",
")",
";",
"exec",
"(",
"qPath",
",",
"\"DELETE\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"}"
] | Delete a reverse on one IP
REST: DELETE /ip/{ip}/reverse/{ipReverse}
@param ip [required]
@param ipReverse [required] | [
"Delete",
"a",
"reverse",
"on",
"one",
"IP"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L446-L450 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/slim/SlimFixtureWithMap.java | SlimFixtureWithMap.setValueFor | public void setValueFor(Object value, String name) {
"""
Stores value.
@param value value to be stored.
@param name name to use this value for.
"""
getMapHelper().setValueForIn(value, name, getCurrentValues());
} | java | public void setValueFor(Object value, String name) {
getMapHelper().setValueForIn(value, name, getCurrentValues());
} | [
"public",
"void",
"setValueFor",
"(",
"Object",
"value",
",",
"String",
"name",
")",
"{",
"getMapHelper",
"(",
")",
".",
"setValueForIn",
"(",
"value",
",",
"name",
",",
"getCurrentValues",
"(",
")",
")",
";",
"}"
] | Stores value.
@param value value to be stored.
@param name name to use this value for. | [
"Stores",
"value",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/SlimFixtureWithMap.java#L63-L65 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiUser.java | BoxApiUser.getCreateEnterpriseUserRequest | public BoxRequestsUser.CreateEnterpriseUser getCreateEnterpriseUserRequest(String login, String name) {
"""
Gets a request that creates an enterprise user
The session provided must be associated with an enterprise admin user
@param login the login (email) of the user to create
@param name name of the user to create
@return request to create an enterprise user
"""
BoxRequestsUser.CreateEnterpriseUser request = new BoxRequestsUser.CreateEnterpriseUser(getUsersUrl(), mSession, login, name);
return request;
} | java | public BoxRequestsUser.CreateEnterpriseUser getCreateEnterpriseUserRequest(String login, String name) {
BoxRequestsUser.CreateEnterpriseUser request = new BoxRequestsUser.CreateEnterpriseUser(getUsersUrl(), mSession, login, name);
return request;
} | [
"public",
"BoxRequestsUser",
".",
"CreateEnterpriseUser",
"getCreateEnterpriseUserRequest",
"(",
"String",
"login",
",",
"String",
"name",
")",
"{",
"BoxRequestsUser",
".",
"CreateEnterpriseUser",
"request",
"=",
"new",
"BoxRequestsUser",
".",
"CreateEnterpriseUser",
"(",
"getUsersUrl",
"(",
")",
",",
"mSession",
",",
"login",
",",
"name",
")",
";",
"return",
"request",
";",
"}"
] | Gets a request that creates an enterprise user
The session provided must be associated with an enterprise admin user
@param login the login (email) of the user to create
@param name name of the user to create
@return request to create an enterprise user | [
"Gets",
"a",
"request",
"that",
"creates",
"an",
"enterprise",
"user",
"The",
"session",
"provided",
"must",
"be",
"associated",
"with",
"an",
"enterprise",
"admin",
"user"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiUser.java#L92-L95 |
spring-projects/spring-credhub | spring-credhub-core/src/main/java/org/springframework/credhub/configuration/CredHubTemplateFactory.java | CredHubTemplateFactory.credHubTemplate | public CredHubTemplate credHubTemplate(CredHubProperties credHubProperties,
ClientOptions clientOptions,
ClientRegistrationRepository clientRegistrationRepository,
OAuth2AuthorizedClientService authorizedClientService) {
"""
Create a {@link CredHubTemplate} for interaction with a CredHub server
using OAuth2 for authentication.
@param credHubProperties connection properties
@param clientOptions connection options
@param clientRegistrationRepository a repository of OAuth2 client registrations
@param authorizedClientService a repository of authorized OAuth2 clients
@return a {@code CredHubTemplate}
"""
return new CredHubTemplate(credHubProperties, clientHttpRequestFactory(clientOptions),
clientRegistrationRepository, authorizedClientService);
} | java | public CredHubTemplate credHubTemplate(CredHubProperties credHubProperties,
ClientOptions clientOptions,
ClientRegistrationRepository clientRegistrationRepository,
OAuth2AuthorizedClientService authorizedClientService) {
return new CredHubTemplate(credHubProperties, clientHttpRequestFactory(clientOptions),
clientRegistrationRepository, authorizedClientService);
} | [
"public",
"CredHubTemplate",
"credHubTemplate",
"(",
"CredHubProperties",
"credHubProperties",
",",
"ClientOptions",
"clientOptions",
",",
"ClientRegistrationRepository",
"clientRegistrationRepository",
",",
"OAuth2AuthorizedClientService",
"authorizedClientService",
")",
"{",
"return",
"new",
"CredHubTemplate",
"(",
"credHubProperties",
",",
"clientHttpRequestFactory",
"(",
"clientOptions",
")",
",",
"clientRegistrationRepository",
",",
"authorizedClientService",
")",
";",
"}"
] | Create a {@link CredHubTemplate} for interaction with a CredHub server
using OAuth2 for authentication.
@param credHubProperties connection properties
@param clientOptions connection options
@param clientRegistrationRepository a repository of OAuth2 client registrations
@param authorizedClientService a repository of authorized OAuth2 clients
@return a {@code CredHubTemplate} | [
"Create",
"a",
"{",
"@link",
"CredHubTemplate",
"}",
"for",
"interaction",
"with",
"a",
"CredHub",
"server",
"using",
"OAuth2",
"for",
"authentication",
"."
] | train | https://github.com/spring-projects/spring-credhub/blob/4d82cfa60d6c04e707ff32d78bc5d80cff4e132e/spring-credhub-core/src/main/java/org/springframework/credhub/configuration/CredHubTemplateFactory.java#L61-L67 |
cdk/cdk | tool/group/src/main/java/org/openscience/cdk/group/Partition.java | Partition.addToCell | public void addToCell(int index, int element) {
"""
Add an element to a particular cell.
@param index the index of the cell to add to
@param element the element to add
"""
if (cells.size() < index + 1) {
addSingletonCell(element);
} else {
cells.get(index).add(element);
}
} | java | public void addToCell(int index, int element) {
if (cells.size() < index + 1) {
addSingletonCell(element);
} else {
cells.get(index).add(element);
}
} | [
"public",
"void",
"addToCell",
"(",
"int",
"index",
",",
"int",
"element",
")",
"{",
"if",
"(",
"cells",
".",
"size",
"(",
")",
"<",
"index",
"+",
"1",
")",
"{",
"addSingletonCell",
"(",
"element",
")",
";",
"}",
"else",
"{",
"cells",
".",
"get",
"(",
"index",
")",
".",
"add",
"(",
"element",
")",
";",
"}",
"}"
] | Add an element to a particular cell.
@param index the index of the cell to add to
@param element the element to add | [
"Add",
"an",
"element",
"to",
"a",
"particular",
"cell",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/group/src/main/java/org/openscience/cdk/group/Partition.java#L358-L364 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Media.java | Media.saveMediaDataToFile | public static void saveMediaDataToFile(byte[] mediaData, String fileName)
throws FileNotFoundException, IOException {
"""
Saves media data downloaded from an API in {@code byte[]} format into a
file on the file system.
@param mediaData the media data {@code byte[]} to store on the file system
@param fileName the name of the file on the file system to save the media
data into
@throws FileNotFoundException if the file exists but is a directory, does
not exist but cannot be created, or cannot be opened for any reason
@throws IOException if the file cannot be written to
"""
saveMediaDataToFile(mediaData, new File(fileName));
} | java | public static void saveMediaDataToFile(byte[] mediaData, String fileName)
throws FileNotFoundException, IOException {
saveMediaDataToFile(mediaData, new File(fileName));
} | [
"public",
"static",
"void",
"saveMediaDataToFile",
"(",
"byte",
"[",
"]",
"mediaData",
",",
"String",
"fileName",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"saveMediaDataToFile",
"(",
"mediaData",
",",
"new",
"File",
"(",
"fileName",
")",
")",
";",
"}"
] | Saves media data downloaded from an API in {@code byte[]} format into a
file on the file system.
@param mediaData the media data {@code byte[]} to store on the file system
@param fileName the name of the file on the file system to save the media
data into
@throws FileNotFoundException if the file exists but is a directory, does
not exist but cannot be created, or cannot be opened for any reason
@throws IOException if the file cannot be written to | [
"Saves",
"media",
"data",
"downloaded",
"from",
"an",
"API",
"in",
"{",
"@code",
"byte",
"[]",
"}",
"format",
"into",
"a",
"file",
"on",
"the",
"file",
"system",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Media.java#L114-L117 |
enioka/jqm | jqm-all/jqm-admin/src/main/java/com/enioka/admin/MetaService.java | MetaService.deleteAllMeta | public static void deleteAllMeta(DbConn cnx, boolean force) {
"""
Empty the database. <br>
No commit performed.
@param cnx
database session to use. Not committed.
@param force
set to true if you want to delete metadata even if there is still transactional data depending on it.
"""
if (force)
{
deleteAllTransac(cnx);
}
cnx.runUpdate("globalprm_delete_all");
cnx.runUpdate("dp_delete_all");
cnx.runUpdate("sjprm_delete_all");
cnx.runUpdate("sj_delete_all");
cnx.runUpdate("jdprm_delete_all");
cnx.runUpdate("node_delete_all");
cnx.runUpdate("jd_delete_all");
cnx.runUpdate("q_delete_all");
cnx.runUpdate("jndiprm_delete_all");
cnx.runUpdate("jndi_delete_all");
cnx.runUpdate("pki_delete_all"); // No corresponding DTO.
cnx.runUpdate("perm_delete_all");
cnx.runUpdate("role_delete_all");
cnx.runUpdate("user_delete_all");
} | java | public static void deleteAllMeta(DbConn cnx, boolean force)
{
if (force)
{
deleteAllTransac(cnx);
}
cnx.runUpdate("globalprm_delete_all");
cnx.runUpdate("dp_delete_all");
cnx.runUpdate("sjprm_delete_all");
cnx.runUpdate("sj_delete_all");
cnx.runUpdate("jdprm_delete_all");
cnx.runUpdate("node_delete_all");
cnx.runUpdate("jd_delete_all");
cnx.runUpdate("q_delete_all");
cnx.runUpdate("jndiprm_delete_all");
cnx.runUpdate("jndi_delete_all");
cnx.runUpdate("pki_delete_all"); // No corresponding DTO.
cnx.runUpdate("perm_delete_all");
cnx.runUpdate("role_delete_all");
cnx.runUpdate("user_delete_all");
} | [
"public",
"static",
"void",
"deleteAllMeta",
"(",
"DbConn",
"cnx",
",",
"boolean",
"force",
")",
"{",
"if",
"(",
"force",
")",
"{",
"deleteAllTransac",
"(",
"cnx",
")",
";",
"}",
"cnx",
".",
"runUpdate",
"(",
"\"globalprm_delete_all\"",
")",
";",
"cnx",
".",
"runUpdate",
"(",
"\"dp_delete_all\"",
")",
";",
"cnx",
".",
"runUpdate",
"(",
"\"sjprm_delete_all\"",
")",
";",
"cnx",
".",
"runUpdate",
"(",
"\"sj_delete_all\"",
")",
";",
"cnx",
".",
"runUpdate",
"(",
"\"jdprm_delete_all\"",
")",
";",
"cnx",
".",
"runUpdate",
"(",
"\"node_delete_all\"",
")",
";",
"cnx",
".",
"runUpdate",
"(",
"\"jd_delete_all\"",
")",
";",
"cnx",
".",
"runUpdate",
"(",
"\"q_delete_all\"",
")",
";",
"cnx",
".",
"runUpdate",
"(",
"\"jndiprm_delete_all\"",
")",
";",
"cnx",
".",
"runUpdate",
"(",
"\"jndi_delete_all\"",
")",
";",
"cnx",
".",
"runUpdate",
"(",
"\"pki_delete_all\"",
")",
";",
"// No corresponding DTO.",
"cnx",
".",
"runUpdate",
"(",
"\"perm_delete_all\"",
")",
";",
"cnx",
".",
"runUpdate",
"(",
"\"role_delete_all\"",
")",
";",
"cnx",
".",
"runUpdate",
"(",
"\"user_delete_all\"",
")",
";",
"}"
] | Empty the database. <br>
No commit performed.
@param cnx
database session to use. Not committed.
@param force
set to true if you want to delete metadata even if there is still transactional data depending on it. | [
"Empty",
"the",
"database",
".",
"<br",
">",
"No",
"commit",
"performed",
"."
] | train | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-admin/src/main/java/com/enioka/admin/MetaService.java#L60-L81 |
bramp/ffmpeg-cli-wrapper | src/main/java/net/bramp/ffmpeg/nut/NutReader.java | NutReader.readFileId | protected void readFileId() throws IOException {
"""
Read the magic at the beginning of the file.
@throws IOException If a I/O error occurs
"""
byte[] b = new byte[HEADER.length];
in.readFully(b);
if (!Arrays.equals(b, HEADER)) {
throw new IOException(
"file_id_string does not match. got: " + new String(b, Charsets.ISO_8859_1));
}
} | java | protected void readFileId() throws IOException {
byte[] b = new byte[HEADER.length];
in.readFully(b);
if (!Arrays.equals(b, HEADER)) {
throw new IOException(
"file_id_string does not match. got: " + new String(b, Charsets.ISO_8859_1));
}
} | [
"protected",
"void",
"readFileId",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"HEADER",
".",
"length",
"]",
";",
"in",
".",
"readFully",
"(",
"b",
")",
";",
"if",
"(",
"!",
"Arrays",
".",
"equals",
"(",
"b",
",",
"HEADER",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"file_id_string does not match. got: \"",
"+",
"new",
"String",
"(",
"b",
",",
"Charsets",
".",
"ISO_8859_1",
")",
")",
";",
"}",
"}"
] | Read the magic at the beginning of the file.
@throws IOException If a I/O error occurs | [
"Read",
"the",
"magic",
"at",
"the",
"beginning",
"of",
"the",
"file",
"."
] | train | https://github.com/bramp/ffmpeg-cli-wrapper/blob/3819b155edf9132acc75bb6af66dcef1b98c64b2/src/main/java/net/bramp/ffmpeg/nut/NutReader.java#L52-L60 |
DaGeRe/KoPeMe | kopeme-analysis/src/main/java/de/dagere/kopeme/instrumentation/KoPeMeClassFileTransformater.java | KoPeMeClassFileTransformater.around | private void around(final CtMethod m, final String before, final String after, final List<VarDeclarationData> declarations) throws CannotCompileException, NotFoundException {
"""
Method introducing code before and after a given javassist method.
@param m
@param before
@param after
@throws CannotCompileException
@throws NotFoundException
"""
String signature = Modifier.toString(m.getModifiers()) + " " + m.getReturnType().getName() + " " + m.getLongName();
LOG.info("--- Instrumenting " + signature);
for (VarDeclarationData declaration : declarations) {
m.addLocalVariable(declaration.getName(), pool.get(declaration.getType()));
}
m.insertBefore(before);
m.insertAfter(after);
} | java | private void around(final CtMethod m, final String before, final String after, final List<VarDeclarationData> declarations) throws CannotCompileException, NotFoundException {
String signature = Modifier.toString(m.getModifiers()) + " " + m.getReturnType().getName() + " " + m.getLongName();
LOG.info("--- Instrumenting " + signature);
for (VarDeclarationData declaration : declarations) {
m.addLocalVariable(declaration.getName(), pool.get(declaration.getType()));
}
m.insertBefore(before);
m.insertAfter(after);
} | [
"private",
"void",
"around",
"(",
"final",
"CtMethod",
"m",
",",
"final",
"String",
"before",
",",
"final",
"String",
"after",
",",
"final",
"List",
"<",
"VarDeclarationData",
">",
"declarations",
")",
"throws",
"CannotCompileException",
",",
"NotFoundException",
"{",
"String",
"signature",
"=",
"Modifier",
".",
"toString",
"(",
"m",
".",
"getModifiers",
"(",
")",
")",
"+",
"\" \"",
"+",
"m",
".",
"getReturnType",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\" \"",
"+",
"m",
".",
"getLongName",
"(",
")",
";",
"LOG",
".",
"info",
"(",
"\"--- Instrumenting \"",
"+",
"signature",
")",
";",
"for",
"(",
"VarDeclarationData",
"declaration",
":",
"declarations",
")",
"{",
"m",
".",
"addLocalVariable",
"(",
"declaration",
".",
"getName",
"(",
")",
",",
"pool",
".",
"get",
"(",
"declaration",
".",
"getType",
"(",
")",
")",
")",
";",
"}",
"m",
".",
"insertBefore",
"(",
"before",
")",
";",
"m",
".",
"insertAfter",
"(",
"after",
")",
";",
"}"
] | Method introducing code before and after a given javassist method.
@param m
@param before
@param after
@throws CannotCompileException
@throws NotFoundException | [
"Method",
"introducing",
"code",
"before",
"and",
"after",
"a",
"given",
"javassist",
"method",
"."
] | train | https://github.com/DaGeRe/KoPeMe/blob/a4939113cba73cb20a2c7d6dc8d34d0139a3e340/kopeme-analysis/src/main/java/de/dagere/kopeme/instrumentation/KoPeMeClassFileTransformater.java#L82-L90 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java | VersionsImpl.importMethod | public String importMethod(UUID appId, LuisApp luisApp, ImportMethodVersionsOptionalParameter importMethodOptionalParameter) {
"""
Imports a new version into a LUIS application.
@param appId The application ID.
@param luisApp A LUIS application structure.
@param importMethodOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the String object if successful.
"""
return importMethodWithServiceResponseAsync(appId, luisApp, importMethodOptionalParameter).toBlocking().single().body();
} | java | public String importMethod(UUID appId, LuisApp luisApp, ImportMethodVersionsOptionalParameter importMethodOptionalParameter) {
return importMethodWithServiceResponseAsync(appId, luisApp, importMethodOptionalParameter).toBlocking().single().body();
} | [
"public",
"String",
"importMethod",
"(",
"UUID",
"appId",
",",
"LuisApp",
"luisApp",
",",
"ImportMethodVersionsOptionalParameter",
"importMethodOptionalParameter",
")",
"{",
"return",
"importMethodWithServiceResponseAsync",
"(",
"appId",
",",
"luisApp",
",",
"importMethodOptionalParameter",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Imports a new version into a LUIS application.
@param appId The application ID.
@param luisApp A LUIS application structure.
@param importMethodOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the String object if successful. | [
"Imports",
"a",
"new",
"version",
"into",
"a",
"LUIS",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java#L874-L876 |
h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/ast/prims/mungers/AstGroup.java | AstGroup.countNumberOfAggregates | private int countNumberOfAggregates(Frame fr, int numberOfColumns, AstRoot asts[]) {
"""
Count of aggregates; knock off the first 4 ASTs (GB data [group-by] [order-by]...), then count by triples.
"""
int validGroupByCols = 0;
for (int idx=3; idx < asts.length; idx+=3) { // initial loop to count operations on valid columns, ignore String columns
AstNumList col = check(numberOfColumns, asts[idx + 1]);
if (col.cnt() != 1) throw new IllegalArgumentException("Group-By functions take only a single column");
int agg_col = (int) col.min(); // Aggregate column
if (fr.vec(agg_col).isString()) {
Log.warn("Column "+fr._names[agg_col]+" is a string column. Groupby operations will be skipped for this column.");
} else
validGroupByCols++;
}
return validGroupByCols;
} | java | private int countNumberOfAggregates(Frame fr, int numberOfColumns, AstRoot asts[]) {
int validGroupByCols = 0;
for (int idx=3; idx < asts.length; idx+=3) { // initial loop to count operations on valid columns, ignore String columns
AstNumList col = check(numberOfColumns, asts[idx + 1]);
if (col.cnt() != 1) throw new IllegalArgumentException("Group-By functions take only a single column");
int agg_col = (int) col.min(); // Aggregate column
if (fr.vec(agg_col).isString()) {
Log.warn("Column "+fr._names[agg_col]+" is a string column. Groupby operations will be skipped for this column.");
} else
validGroupByCols++;
}
return validGroupByCols;
} | [
"private",
"int",
"countNumberOfAggregates",
"(",
"Frame",
"fr",
",",
"int",
"numberOfColumns",
",",
"AstRoot",
"asts",
"[",
"]",
")",
"{",
"int",
"validGroupByCols",
"=",
"0",
";",
"for",
"(",
"int",
"idx",
"=",
"3",
";",
"idx",
"<",
"asts",
".",
"length",
";",
"idx",
"+=",
"3",
")",
"{",
"// initial loop to count operations on valid columns, ignore String columns",
"AstNumList",
"col",
"=",
"check",
"(",
"numberOfColumns",
",",
"asts",
"[",
"idx",
"+",
"1",
"]",
")",
";",
"if",
"(",
"col",
".",
"cnt",
"(",
")",
"!=",
"1",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Group-By functions take only a single column\"",
")",
";",
"int",
"agg_col",
"=",
"(",
"int",
")",
"col",
".",
"min",
"(",
")",
";",
"// Aggregate column",
"if",
"(",
"fr",
".",
"vec",
"(",
"agg_col",
")",
".",
"isString",
"(",
")",
")",
"{",
"Log",
".",
"warn",
"(",
"\"Column \"",
"+",
"fr",
".",
"_names",
"[",
"agg_col",
"]",
"+",
"\" is a string column. Groupby operations will be skipped for this column.\"",
")",
";",
"}",
"else",
"validGroupByCols",
"++",
";",
"}",
"return",
"validGroupByCols",
";",
"}"
] | Count of aggregates; knock off the first 4 ASTs (GB data [group-by] [order-by]...), then count by triples. | [
"Count",
"of",
"aggregates",
";",
"knock",
"off",
"the",
"first",
"4",
"ASTs",
"(",
"GB",
"data",
"[",
"group",
"-",
"by",
"]",
"[",
"order",
"-",
"by",
"]",
"...",
")",
"then",
"count",
"by",
"triples",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/ast/prims/mungers/AstGroup.java#L339-L351 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.toStringFormChangedPropertiesMap | private String toStringFormChangedPropertiesMap(Map<String, String> delta) {
"""
Format the map of config change attributes for the audit function. The output format would be the
same as original WebAppSecurityConfig.getChangedProperties method.
@return String in the format of "name=value, name=value, ..." encapsulating the
properties that are different between this WebAppSecurityConfig and the specified one
"""
if (delta == null || delta.isEmpty()) {
return "";
}
StringBuffer sb = new StringBuffer();
for (Map.Entry<String, String> entry : delta.entrySet()) {
if (sb.length() > 0) {
sb.append(",");
}
sb.append(entry.getKey()).append("=").append(entry.getValue());
}
return sb.toString();
} | java | private String toStringFormChangedPropertiesMap(Map<String, String> delta) {
if (delta == null || delta.isEmpty()) {
return "";
}
StringBuffer sb = new StringBuffer();
for (Map.Entry<String, String> entry : delta.entrySet()) {
if (sb.length() > 0) {
sb.append(",");
}
sb.append(entry.getKey()).append("=").append(entry.getValue());
}
return sb.toString();
} | [
"private",
"String",
"toStringFormChangedPropertiesMap",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"delta",
")",
"{",
"if",
"(",
"delta",
"==",
"null",
"||",
"delta",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"delta",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"sb",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"\",\"",
")",
";",
"}",
"sb",
".",
"append",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
".",
"append",
"(",
"\"=\"",
")",
".",
"append",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | Format the map of config change attributes for the audit function. The output format would be the
same as original WebAppSecurityConfig.getChangedProperties method.
@return String in the format of "name=value, name=value, ..." encapsulating the
properties that are different between this WebAppSecurityConfig and the specified one | [
"Format",
"the",
"map",
"of",
"config",
"change",
"attributes",
"for",
"the",
"audit",
"function",
".",
"The",
"output",
"format",
"would",
"be",
"the",
"same",
"as",
"original",
"WebAppSecurityConfig",
".",
"getChangedProperties",
"method",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L1673-L1685 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java | Utils.compareVersions | public static int compareVersions(String v1, String v2) {
"""
Compare the two strings as they are version numbers.
@param v1 - first version to compare.
@param v2 - second version to compare.
@return Negative integer of <code>v1</code> is lower than <code>v2</code>;
positive integer of <code>v1</code> is greater than <code>v2</code>;
{@code 0} if they are strictly equal.
"""
// Remove the SNAPSHOT version.
//final String fixedv1 = v1.replaceFirst("-SNAPSHOT$", ""); //$NON-NLS-1$ //$NON-NLS-2$
//final String fixedv2 = v2.replaceFirst("-SNAPSHOT$", ""); //$NON-NLS-1$ //$NON-NLS-2$
//final Version vobject1 = Version.parseVersion(fixedv1);
//final Version vobject2 = Version.parseVersion(fixedv2);
final Version vobject1 = Version.parseVersion(v1);
final Version vobject2 = Version.parseVersion(v2);
return vobject1.compareTo(vobject2);
} | java | public static int compareVersions(String v1, String v2) {
// Remove the SNAPSHOT version.
//final String fixedv1 = v1.replaceFirst("-SNAPSHOT$", ""); //$NON-NLS-1$ //$NON-NLS-2$
//final String fixedv2 = v2.replaceFirst("-SNAPSHOT$", ""); //$NON-NLS-1$ //$NON-NLS-2$
//final Version vobject1 = Version.parseVersion(fixedv1);
//final Version vobject2 = Version.parseVersion(fixedv2);
final Version vobject1 = Version.parseVersion(v1);
final Version vobject2 = Version.parseVersion(v2);
return vobject1.compareTo(vobject2);
} | [
"public",
"static",
"int",
"compareVersions",
"(",
"String",
"v1",
",",
"String",
"v2",
")",
"{",
"// Remove the SNAPSHOT version.",
"//final String fixedv1 = v1.replaceFirst(\"-SNAPSHOT$\", \"\"); //$NON-NLS-1$ //$NON-NLS-2$",
"//final String fixedv2 = v2.replaceFirst(\"-SNAPSHOT$\", \"\"); //$NON-NLS-1$ //$NON-NLS-2$",
"//final Version vobject1 = Version.parseVersion(fixedv1);",
"//final Version vobject2 = Version.parseVersion(fixedv2);",
"final",
"Version",
"vobject1",
"=",
"Version",
".",
"parseVersion",
"(",
"v1",
")",
";",
"final",
"Version",
"vobject2",
"=",
"Version",
".",
"parseVersion",
"(",
"v2",
")",
";",
"return",
"vobject1",
".",
"compareTo",
"(",
"vobject2",
")",
";",
"}"
] | Compare the two strings as they are version numbers.
@param v1 - first version to compare.
@param v2 - second version to compare.
@return Negative integer of <code>v1</code> is lower than <code>v2</code>;
positive integer of <code>v1</code> is greater than <code>v2</code>;
{@code 0} if they are strictly equal. | [
"Compare",
"the",
"two",
"strings",
"as",
"they",
"are",
"version",
"numbers",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java#L662-L671 |
apache/groovy | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.executeInsert | public List<List<Object>> executeInsert(String sql, Object[] params) throws SQLException {
"""
Executes the given SQL statement (typically an INSERT statement).
<p>
An Object array variant of {@link #executeInsert(String, List)}.
<p>
This method supports named and named ordinal parameters by supplying such
parameters in the <code>params</code> array. See the class Javadoc for more details.
@param sql The SQL statement to execute
@param params The parameter values that will be substituted
into the SQL statement's parameter slots
@return A list of the auto-generated column values for each
inserted row (typically auto-generated keys)
@throws SQLException if a database access error occurs
"""
return executeInsert(sql, Arrays.asList(params));
} | java | public List<List<Object>> executeInsert(String sql, Object[] params) throws SQLException {
return executeInsert(sql, Arrays.asList(params));
} | [
"public",
"List",
"<",
"List",
"<",
"Object",
">",
">",
"executeInsert",
"(",
"String",
"sql",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"SQLException",
"{",
"return",
"executeInsert",
"(",
"sql",
",",
"Arrays",
".",
"asList",
"(",
"params",
")",
")",
";",
"}"
] | Executes the given SQL statement (typically an INSERT statement).
<p>
An Object array variant of {@link #executeInsert(String, List)}.
<p>
This method supports named and named ordinal parameters by supplying such
parameters in the <code>params</code> array. See the class Javadoc for more details.
@param sql The SQL statement to execute
@param params The parameter values that will be substituted
into the SQL statement's parameter slots
@return A list of the auto-generated column values for each
inserted row (typically auto-generated keys)
@throws SQLException if a database access error occurs | [
"Executes",
"the",
"given",
"SQL",
"statement",
"(",
"typically",
"an",
"INSERT",
"statement",
")",
".",
"<p",
">",
"An",
"Object",
"array",
"variant",
"of",
"{",
"@link",
"#executeInsert",
"(",
"String",
"List",
")",
"}",
".",
"<p",
">",
"This",
"method",
"supports",
"named",
"and",
"named",
"ordinal",
"parameters",
"by",
"supplying",
"such",
"parameters",
"in",
"the",
"<code",
">",
"params<",
"/",
"code",
">",
"array",
".",
"See",
"the",
"class",
"Javadoc",
"for",
"more",
"details",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L2755-L2757 |
juebanlin/util4j | util4j/src/main/java/net/jueb/util4j/bytesStream/bytes/HexUtil.java | HexUtil.prettyHexDump | public static String prettyHexDump(byte[] buffer, int offset, int length) {
"""
<pre>
格式化为如下样式
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 4d 49 47 66 4d 41 30 47 43 53 71 47 53 49 62 33 |MIGfMA0GCSqGSIb3|
|00000010| 44 51 45 42 41 51 55 41 41 34 47 4e 41 44 43 42 |DQEBAQUAA4GNADCB|
|00000020| 69 51 4b 42 67 51 43 39 32 55 54 4f 61 51 48 55 |iQKBgQC92UTOaQHU|
|00000030| 6d 4c 4f 2f 31 2b 73 43 6b 70 66 76 52 47 68 6d |mLO/1+sCkpfvRGhm|
|00000040| 71 38 70 30 66 33 5a 79 42 71 6b 41 72 69 4d 6b |q8p0f3ZyBqkAriMk|
|000000d0| 31 51 49 44 41 51 41 42 |1QIDAQAB |
+--------+-------------------------------------------------+----------------+
</pre>
@param buffer
@param offset
@param length
@return
"""
if (length < 0) {
throw new IllegalArgumentException("length: " + length);
}
if (length == 0) {
return EMPTY_STRING;
} else {
int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4;
StringBuilder buf = new StringBuilder(rows * 80);
appendPrettyHexDump(buf, buffer, offset, length);
return buf.toString();
}
} | java | public static String prettyHexDump(byte[] buffer, int offset, int length) {
if (length < 0) {
throw new IllegalArgumentException("length: " + length);
}
if (length == 0) {
return EMPTY_STRING;
} else {
int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4;
StringBuilder buf = new StringBuilder(rows * 80);
appendPrettyHexDump(buf, buffer, offset, length);
return buf.toString();
}
} | [
"public",
"static",
"String",
"prettyHexDump",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"if",
"(",
"length",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"length: \"",
"+",
"length",
")",
";",
"}",
"if",
"(",
"length",
"==",
"0",
")",
"{",
"return",
"EMPTY_STRING",
";",
"}",
"else",
"{",
"int",
"rows",
"=",
"length",
"/",
"16",
"+",
"(",
"length",
"%",
"15",
"==",
"0",
"?",
"0",
":",
"1",
")",
"+",
"4",
";",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
"rows",
"*",
"80",
")",
";",
"appendPrettyHexDump",
"(",
"buf",
",",
"buffer",
",",
"offset",
",",
"length",
")",
";",
"return",
"buf",
".",
"toString",
"(",
")",
";",
"}",
"}"
] | <pre>
格式化为如下样式
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 4d 49 47 66 4d 41 30 47 43 53 71 47 53 49 62 33 |MIGfMA0GCSqGSIb3|
|00000010| 44 51 45 42 41 51 55 41 41 34 47 4e 41 44 43 42 |DQEBAQUAA4GNADCB|
|00000020| 69 51 4b 42 67 51 43 39 32 55 54 4f 61 51 48 55 |iQKBgQC92UTOaQHU|
|00000030| 6d 4c 4f 2f 31 2b 73 43 6b 70 66 76 52 47 68 6d |mLO/1+sCkpfvRGhm|
|00000040| 71 38 70 30 66 33 5a 79 42 71 6b 41 72 69 4d 6b |q8p0f3ZyBqkAriMk|
|000000d0| 31 51 49 44 41 51 41 42 |1QIDAQAB |
+--------+-------------------------------------------------+----------------+
</pre>
@param buffer
@param offset
@param length
@return | [
"<pre",
">",
"格式化为如下样式",
"+",
"-------------------------------------------------",
"+",
"|",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"a",
"b",
"c",
"d",
"e",
"f",
"|",
"+",
"--------",
"+",
"-------------------------------------------------",
"+",
"----------------",
"+",
"|00000000|",
"4d",
"49",
"47",
"66",
"4d",
"41",
"30",
"47",
"43",
"53",
"71",
"47",
"53",
"49",
"62",
"33",
"|MIGfMA0GCSqGSIb3|",
"|00000010|",
"44",
"51",
"45",
"42",
"41",
"51",
"55",
"41",
"41",
"34",
"47",
"4e",
"41",
"44",
"43",
"42",
"|DQEBAQUAA4GNADCB|",
"|00000020|",
"69",
"51",
"4b",
"42",
"67",
"51",
"43",
"39",
"32",
"55",
"54",
"4f",
"61",
"51",
"48",
"55",
"|iQKBgQC92UTOaQHU|",
"|00000030|",
"6d",
"4c",
"4f",
"2f",
"31",
"2b",
"73",
"43",
"6b",
"70",
"66",
"76",
"52",
"47",
"68",
"6d",
"|mLO",
"/",
"1",
"+",
"sCkpfvRGhm|",
"|00000040|",
"71",
"38",
"70",
"30",
"66",
"33",
"5a",
"79",
"42",
"71",
"6b",
"41",
"72",
"69",
"4d",
"6b",
"|q8p0f3ZyBqkAriMk|",
"|000000d0|",
"31",
"51",
"49",
"44",
"41",
"51",
"41",
"42",
"|1QIDAQAB",
"|",
"+",
"--------",
"+",
"-------------------------------------------------",
"+",
"----------------",
"+",
"<",
"/",
"pre",
">"
] | train | https://github.com/juebanlin/util4j/blob/c404b2dbdedf7a8890533b351257fa8af4f1439f/util4j/src/main/java/net/jueb/util4j/bytesStream/bytes/HexUtil.java#L188-L200 |
google/closure-compiler | src/com/google/javascript/jscomp/Linter.java | Linter.fixRepeatedly | void fixRepeatedly(String filename, ImmutableSet<DiagnosticType> unfixableErrors)
throws IOException {
"""
Keep applying fixes to the given file until no more fixes can be found, or until fixes have
been applied {@code MAX_FIXES} times.
"""
for (int i = 0; i < MAX_FIXES; i++) {
if (!fix(filename, unfixableErrors)) {
break;
}
}
} | java | void fixRepeatedly(String filename, ImmutableSet<DiagnosticType> unfixableErrors)
throws IOException {
for (int i = 0; i < MAX_FIXES; i++) {
if (!fix(filename, unfixableErrors)) {
break;
}
}
} | [
"void",
"fixRepeatedly",
"(",
"String",
"filename",
",",
"ImmutableSet",
"<",
"DiagnosticType",
">",
"unfixableErrors",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"MAX_FIXES",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"fix",
"(",
"filename",
",",
"unfixableErrors",
")",
")",
"{",
"break",
";",
"}",
"}",
"}"
] | Keep applying fixes to the given file until no more fixes can be found, or until fixes have
been applied {@code MAX_FIXES} times. | [
"Keep",
"applying",
"fixes",
"to",
"the",
"given",
"file",
"until",
"no",
"more",
"fixes",
"can",
"be",
"found",
"or",
"until",
"fixes",
"have",
"been",
"applied",
"{"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Linter.java#L143-L150 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/stats/impl/IntervalNameParser.java | IntervalNameParser.guessLengthFromName | static final int guessLengthFromName(String aName) {
"""
This method parses the given Interval name and returns the length of such an Interval in
seconds.
@param aName the name of the Interval
@return the appropriate length
@throws UnknownIntervalLengthException if the name could not be parsed
"""
if (aName.startsWith(Constants.PREFIX_SNAPSHOT_INTERVAL))
return -1;
int unitFactor;
int value;
try {
value = Integer.parseInt(aName.substring(0, aName.length() - 1));
} catch (NumberFormatException e) {
throw new UnknownIntervalLengthException("Unsupported Interval name format: " + aName);
}
char lastChar = aName.charAt(aName.length() - 1);
TimeUnit unit = lookupMap.get(Character.toLowerCase(lastChar));
if (unit==null)
throw new UnknownIntervalLengthException(aName + ", " + lastChar + " is not a supported unit.");
unitFactor = unit.getFactor();
if (value == 0)
throw new UnknownIntervalLengthException(aName + ", zero duration is not allowed.");
return value * unitFactor;
} | java | static final int guessLengthFromName(String aName) {
if (aName.startsWith(Constants.PREFIX_SNAPSHOT_INTERVAL))
return -1;
int unitFactor;
int value;
try {
value = Integer.parseInt(aName.substring(0, aName.length() - 1));
} catch (NumberFormatException e) {
throw new UnknownIntervalLengthException("Unsupported Interval name format: " + aName);
}
char lastChar = aName.charAt(aName.length() - 1);
TimeUnit unit = lookupMap.get(Character.toLowerCase(lastChar));
if (unit==null)
throw new UnknownIntervalLengthException(aName + ", " + lastChar + " is not a supported unit.");
unitFactor = unit.getFactor();
if (value == 0)
throw new UnknownIntervalLengthException(aName + ", zero duration is not allowed.");
return value * unitFactor;
} | [
"static",
"final",
"int",
"guessLengthFromName",
"(",
"String",
"aName",
")",
"{",
"if",
"(",
"aName",
".",
"startsWith",
"(",
"Constants",
".",
"PREFIX_SNAPSHOT_INTERVAL",
")",
")",
"return",
"-",
"1",
";",
"int",
"unitFactor",
";",
"int",
"value",
";",
"try",
"{",
"value",
"=",
"Integer",
".",
"parseInt",
"(",
"aName",
".",
"substring",
"(",
"0",
",",
"aName",
".",
"length",
"(",
")",
"-",
"1",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"throw",
"new",
"UnknownIntervalLengthException",
"(",
"\"Unsupported Interval name format: \"",
"+",
"aName",
")",
";",
"}",
"char",
"lastChar",
"=",
"aName",
".",
"charAt",
"(",
"aName",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"TimeUnit",
"unit",
"=",
"lookupMap",
".",
"get",
"(",
"Character",
".",
"toLowerCase",
"(",
"lastChar",
")",
")",
";",
"if",
"(",
"unit",
"==",
"null",
")",
"throw",
"new",
"UnknownIntervalLengthException",
"(",
"aName",
"+",
"\", \"",
"+",
"lastChar",
"+",
"\" is not a supported unit.\"",
")",
";",
"unitFactor",
"=",
"unit",
".",
"getFactor",
"(",
")",
";",
"if",
"(",
"value",
"==",
"0",
")",
"throw",
"new",
"UnknownIntervalLengthException",
"(",
"aName",
"+",
"\", zero duration is not allowed.\"",
")",
";",
"return",
"value",
"*",
"unitFactor",
";",
"}"
] | This method parses the given Interval name and returns the length of such an Interval in
seconds.
@param aName the name of the Interval
@return the appropriate length
@throws UnknownIntervalLengthException if the name could not be parsed | [
"This",
"method",
"parses",
"the",
"given",
"Interval",
"name",
"and",
"returns",
"the",
"length",
"of",
"such",
"an",
"Interval",
"in",
"seconds",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/stats/impl/IntervalNameParser.java#L118-L144 |
baratine/baratine | framework/src/main/java/com/caucho/v5/reflect/ReflectUtil.java | ReflectUtil.findMethod | public static Method findMethod(Collection<Method> methods, Method testMethod) {
"""
Finds any method matching the method name and parameter types.
"""
for (Method method : methods) {
if (isMatch(method, testMethod))
return method;
}
return null;
} | java | public static Method findMethod(Collection<Method> methods, Method testMethod)
{
for (Method method : methods) {
if (isMatch(method, testMethod))
return method;
}
return null;
} | [
"public",
"static",
"Method",
"findMethod",
"(",
"Collection",
"<",
"Method",
">",
"methods",
",",
"Method",
"testMethod",
")",
"{",
"for",
"(",
"Method",
"method",
":",
"methods",
")",
"{",
"if",
"(",
"isMatch",
"(",
"method",
",",
"testMethod",
")",
")",
"return",
"method",
";",
"}",
"return",
"null",
";",
"}"
] | Finds any method matching the method name and parameter types. | [
"Finds",
"any",
"method",
"matching",
"the",
"method",
"name",
"and",
"parameter",
"types",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/reflect/ReflectUtil.java#L84-L92 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker_snmpmanager.java | br_broker_snmpmanager.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception {
"""
<pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre>
"""
br_broker_snmpmanager_responses result = (br_broker_snmpmanager_responses) service.get_payload_formatter().string_to_resource(br_broker_snmpmanager_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_broker_snmpmanager_response_array);
}
br_broker_snmpmanager[] result_br_broker_snmpmanager = new br_broker_snmpmanager[result.br_broker_snmpmanager_response_array.length];
for(int i = 0; i < result.br_broker_snmpmanager_response_array.length; i++)
{
result_br_broker_snmpmanager[i] = result.br_broker_snmpmanager_response_array[i].br_broker_snmpmanager[0];
}
return result_br_broker_snmpmanager;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_broker_snmpmanager_responses result = (br_broker_snmpmanager_responses) service.get_payload_formatter().string_to_resource(br_broker_snmpmanager_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_broker_snmpmanager_response_array);
}
br_broker_snmpmanager[] result_br_broker_snmpmanager = new br_broker_snmpmanager[result.br_broker_snmpmanager_response_array.length];
for(int i = 0; i < result.br_broker_snmpmanager_response_array.length; i++)
{
result_br_broker_snmpmanager[i] = result.br_broker_snmpmanager_response_array[i].br_broker_snmpmanager[0];
}
return result_br_broker_snmpmanager;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"br_broker_snmpmanager_responses",
"result",
"=",
"(",
"br_broker_snmpmanager_responses",
")",
"service",
".",
"get_payload_formatter",
"(",
")",
".",
"string_to_resource",
"(",
"br_broker_snmpmanager_responses",
".",
"class",
",",
"response",
")",
";",
"if",
"(",
"result",
".",
"errorcode",
"!=",
"0",
")",
"{",
"if",
"(",
"result",
".",
"errorcode",
"==",
"SESSION_NOT_EXISTS",
")",
"service",
".",
"clear_session",
"(",
")",
";",
"throw",
"new",
"nitro_exception",
"(",
"result",
".",
"message",
",",
"result",
".",
"errorcode",
",",
"(",
"base_response",
"[",
"]",
")",
"result",
".",
"br_broker_snmpmanager_response_array",
")",
";",
"}",
"br_broker_snmpmanager",
"[",
"]",
"result_br_broker_snmpmanager",
"=",
"new",
"br_broker_snmpmanager",
"[",
"result",
".",
"br_broker_snmpmanager_response_array",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"result",
".",
"br_broker_snmpmanager_response_array",
".",
"length",
";",
"i",
"++",
")",
"{",
"result_br_broker_snmpmanager",
"[",
"i",
"]",
"=",
"result",
".",
"br_broker_snmpmanager_response_array",
"[",
"i",
"]",
".",
"br_broker_snmpmanager",
"[",
"0",
"]",
";",
"}",
"return",
"result_br_broker_snmpmanager",
";",
"}"
] | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker_snmpmanager.java#L199-L216 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountAssembliesInner.java | IntegrationAccountAssembliesInner.listAsync | public Observable<List<AssemblyDefinitionInner>> listAsync(String resourceGroupName, String integrationAccountName) {
"""
List the assemblies for an integration account.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<AssemblyDefinitionInner> object
"""
return listWithServiceResponseAsync(resourceGroupName, integrationAccountName).map(new Func1<ServiceResponse<List<AssemblyDefinitionInner>>, List<AssemblyDefinitionInner>>() {
@Override
public List<AssemblyDefinitionInner> call(ServiceResponse<List<AssemblyDefinitionInner>> response) {
return response.body();
}
});
} | java | public Observable<List<AssemblyDefinitionInner>> listAsync(String resourceGroupName, String integrationAccountName) {
return listWithServiceResponseAsync(resourceGroupName, integrationAccountName).map(new Func1<ServiceResponse<List<AssemblyDefinitionInner>>, List<AssemblyDefinitionInner>>() {
@Override
public List<AssemblyDefinitionInner> call(ServiceResponse<List<AssemblyDefinitionInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"AssemblyDefinitionInner",
">",
">",
"listAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"integrationAccountName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"List",
"<",
"AssemblyDefinitionInner",
">",
">",
",",
"List",
"<",
"AssemblyDefinitionInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"List",
"<",
"AssemblyDefinitionInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"List",
"<",
"AssemblyDefinitionInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | List the assemblies for an integration account.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<AssemblyDefinitionInner> object | [
"List",
"the",
"assemblies",
"for",
"an",
"integration",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountAssembliesInner.java#L117-L124 |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/api/option/UpdatePullRequestParams.java | UpdatePullRequestParams.notifiedUserIds | public UpdatePullRequestParams notifiedUserIds(List<Long> notifiedUserIds) {
"""
Sets the pull request notified users.
@param notifiedUserIds notified user identifiers
@return UpdatePullRequestParams instance
"""
for (Long notifiedUserId : notifiedUserIds) {
parameters.add(new NameValuePair("notifiedUserId[]", notifiedUserId.toString()));
}
return this;
} | java | public UpdatePullRequestParams notifiedUserIds(List<Long> notifiedUserIds) {
for (Long notifiedUserId : notifiedUserIds) {
parameters.add(new NameValuePair("notifiedUserId[]", notifiedUserId.toString()));
}
return this;
} | [
"public",
"UpdatePullRequestParams",
"notifiedUserIds",
"(",
"List",
"<",
"Long",
">",
"notifiedUserIds",
")",
"{",
"for",
"(",
"Long",
"notifiedUserId",
":",
"notifiedUserIds",
")",
"{",
"parameters",
".",
"add",
"(",
"new",
"NameValuePair",
"(",
"\"notifiedUserId[]\"",
",",
"notifiedUserId",
".",
"toString",
"(",
")",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Sets the pull request notified users.
@param notifiedUserIds notified user identifiers
@return UpdatePullRequestParams instance | [
"Sets",
"the",
"pull",
"request",
"notified",
"users",
"."
] | train | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/UpdatePullRequestParams.java#L116-L122 |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java | EntityType.addSequenceNumber | static void addSequenceNumber(Attribute attr, Iterable<Attribute> attrs) {
"""
Add a sequence number to the attribute. If the sequence number exists add it ot the attribute.
If the sequence number does not exists then find the highest sequence number. If Entity has not
attributes with sequence numbers put 0.
@param attr the attribute to add
@param attrs existing attributes
"""
Integer sequenceNumber = attr.getSequenceNumber();
if (null == sequenceNumber) {
int i =
stream(attrs)
.filter(a -> null != a.getSequenceNumber())
.mapToInt(Attribute::getSequenceNumber)
.max()
.orElse(-1);
if (i == -1) attr.setSequenceNumber(0);
else attr.setSequenceNumber(++i);
}
} | java | static void addSequenceNumber(Attribute attr, Iterable<Attribute> attrs) {
Integer sequenceNumber = attr.getSequenceNumber();
if (null == sequenceNumber) {
int i =
stream(attrs)
.filter(a -> null != a.getSequenceNumber())
.mapToInt(Attribute::getSequenceNumber)
.max()
.orElse(-1);
if (i == -1) attr.setSequenceNumber(0);
else attr.setSequenceNumber(++i);
}
} | [
"static",
"void",
"addSequenceNumber",
"(",
"Attribute",
"attr",
",",
"Iterable",
"<",
"Attribute",
">",
"attrs",
")",
"{",
"Integer",
"sequenceNumber",
"=",
"attr",
".",
"getSequenceNumber",
"(",
")",
";",
"if",
"(",
"null",
"==",
"sequenceNumber",
")",
"{",
"int",
"i",
"=",
"stream",
"(",
"attrs",
")",
".",
"filter",
"(",
"a",
"->",
"null",
"!=",
"a",
".",
"getSequenceNumber",
"(",
")",
")",
".",
"mapToInt",
"(",
"Attribute",
"::",
"getSequenceNumber",
")",
".",
"max",
"(",
")",
".",
"orElse",
"(",
"-",
"1",
")",
";",
"if",
"(",
"i",
"==",
"-",
"1",
")",
"attr",
".",
"setSequenceNumber",
"(",
"0",
")",
";",
"else",
"attr",
".",
"setSequenceNumber",
"(",
"++",
"i",
")",
";",
"}",
"}"
] | Add a sequence number to the attribute. If the sequence number exists add it ot the attribute.
If the sequence number does not exists then find the highest sequence number. If Entity has not
attributes with sequence numbers put 0.
@param attr the attribute to add
@param attrs existing attributes | [
"Add",
"a",
"sequence",
"number",
"to",
"the",
"attribute",
".",
"If",
"the",
"sequence",
"number",
"exists",
"add",
"it",
"ot",
"the",
"attribute",
".",
"If",
"the",
"sequence",
"number",
"does",
"not",
"exists",
"then",
"find",
"the",
"highest",
"sequence",
"number",
".",
"If",
"Entity",
"has",
"not",
"attributes",
"with",
"sequence",
"numbers",
"put",
"0",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java#L554-L566 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.getAt | @SuppressWarnings("unchecked")
public static List<Byte> getAt(byte[] array, Range range) {
"""
Support the subscript operator with a range for a byte array
@param array a byte array
@param range a range indicating the indices for the items to retrieve
@return list of the retrieved bytes
@since 1.0
"""
return primitiveArrayGet(array, range);
} | java | @SuppressWarnings("unchecked")
public static List<Byte> getAt(byte[] array, Range range) {
return primitiveArrayGet(array, range);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Byte",
">",
"getAt",
"(",
"byte",
"[",
"]",
"array",
",",
"Range",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] | Support the subscript operator with a range for a byte array
@param array a byte array
@param range a range indicating the indices for the items to retrieve
@return list of the retrieved bytes
@since 1.0 | [
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"range",
"for",
"a",
"byte",
"array"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13610-L13613 |
mozilla/rhino | src/org/mozilla/javascript/ScriptableObject.java | ScriptableObject.put | @Override
public void put(int index, Scriptable start, Object value) {
"""
Sets the value of the indexed property, creating it if need be.
@param index the numeric index for the property
@param start the object whose property is being set
@param value value to set the property to
"""
if (externalData != null) {
if (index < externalData.getArrayLength()) {
externalData.setArrayElement(index, value);
} else {
throw new JavaScriptException(
ScriptRuntime.newNativeError(Context.getCurrentContext(), this,
TopLevel.NativeErrors.RangeError,
new Object[] { "External array index out of bounds " }),
null, 0);
}
return;
}
if (putImpl(null, index, start, value))
return;
if (start == this) throw Kit.codeBug();
start.put(index, start, value);
} | java | @Override
public void put(int index, Scriptable start, Object value)
{
if (externalData != null) {
if (index < externalData.getArrayLength()) {
externalData.setArrayElement(index, value);
} else {
throw new JavaScriptException(
ScriptRuntime.newNativeError(Context.getCurrentContext(), this,
TopLevel.NativeErrors.RangeError,
new Object[] { "External array index out of bounds " }),
null, 0);
}
return;
}
if (putImpl(null, index, start, value))
return;
if (start == this) throw Kit.codeBug();
start.put(index, start, value);
} | [
"@",
"Override",
"public",
"void",
"put",
"(",
"int",
"index",
",",
"Scriptable",
"start",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"externalData",
"!=",
"null",
")",
"{",
"if",
"(",
"index",
"<",
"externalData",
".",
"getArrayLength",
"(",
")",
")",
"{",
"externalData",
".",
"setArrayElement",
"(",
"index",
",",
"value",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"JavaScriptException",
"(",
"ScriptRuntime",
".",
"newNativeError",
"(",
"Context",
".",
"getCurrentContext",
"(",
")",
",",
"this",
",",
"TopLevel",
".",
"NativeErrors",
".",
"RangeError",
",",
"new",
"Object",
"[",
"]",
"{",
"\"External array index out of bounds \"",
"}",
")",
",",
"null",
",",
"0",
")",
";",
"}",
"return",
";",
"}",
"if",
"(",
"putImpl",
"(",
"null",
",",
"index",
",",
"start",
",",
"value",
")",
")",
"return",
";",
"if",
"(",
"start",
"==",
"this",
")",
"throw",
"Kit",
".",
"codeBug",
"(",
")",
";",
"start",
".",
"put",
"(",
"index",
",",
"start",
",",
"value",
")",
";",
"}"
] | Sets the value of the indexed property, creating it if need be.
@param index the numeric index for the property
@param start the object whose property is being set
@param value value to set the property to | [
"Sets",
"the",
"value",
"of",
"the",
"indexed",
"property",
"creating",
"it",
"if",
"need",
"be",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L535-L556 |
instacount/appengine-counter | src/main/java/io/instacount/appengine/counter/service/ShardedCounterServiceImpl.java | ShardedCounterServiceImpl.assertCounterDetailsMutatable | @VisibleForTesting
protected void assertCounterDetailsMutatable(final String counterName, final CounterStatus counterStatus) {
"""
Helper method to determine if a counter's incrementAmount can be mutated (incremented or decremented). In order
for that to happen, the counter's status must be {@link CounterStatus#AVAILABLE}.
@param counterName The name of the counter.
@param counterStatus The {@link CounterStatus} of a counter that is currently stored in the Datastore.
@return
"""
Preconditions.checkNotNull(counterName);
Preconditions.checkNotNull(counterStatus);
if (counterStatus != CounterStatus.AVAILABLE && counterStatus != CounterStatus.READ_ONLY_COUNT)
{
final String msg = String.format("Can't mutate with status %s. Counter must be in in the %s or %s state!",
counterStatus, CounterStatus.AVAILABLE, CounterStatus.READ_ONLY_COUNT);
throw new CounterNotMutableException(counterName, msg);
}
} | java | @VisibleForTesting
protected void assertCounterDetailsMutatable(final String counterName, final CounterStatus counterStatus)
{
Preconditions.checkNotNull(counterName);
Preconditions.checkNotNull(counterStatus);
if (counterStatus != CounterStatus.AVAILABLE && counterStatus != CounterStatus.READ_ONLY_COUNT)
{
final String msg = String.format("Can't mutate with status %s. Counter must be in in the %s or %s state!",
counterStatus, CounterStatus.AVAILABLE, CounterStatus.READ_ONLY_COUNT);
throw new CounterNotMutableException(counterName, msg);
}
} | [
"@",
"VisibleForTesting",
"protected",
"void",
"assertCounterDetailsMutatable",
"(",
"final",
"String",
"counterName",
",",
"final",
"CounterStatus",
"counterStatus",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"counterName",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"counterStatus",
")",
";",
"if",
"(",
"counterStatus",
"!=",
"CounterStatus",
".",
"AVAILABLE",
"&&",
"counterStatus",
"!=",
"CounterStatus",
".",
"READ_ONLY_COUNT",
")",
"{",
"final",
"String",
"msg",
"=",
"String",
".",
"format",
"(",
"\"Can't mutate with status %s. Counter must be in in the %s or %s state!\"",
",",
"counterStatus",
",",
"CounterStatus",
".",
"AVAILABLE",
",",
"CounterStatus",
".",
"READ_ONLY_COUNT",
")",
";",
"throw",
"new",
"CounterNotMutableException",
"(",
"counterName",
",",
"msg",
")",
";",
"}",
"}"
] | Helper method to determine if a counter's incrementAmount can be mutated (incremented or decremented). In order
for that to happen, the counter's status must be {@link CounterStatus#AVAILABLE}.
@param counterName The name of the counter.
@param counterStatus The {@link CounterStatus} of a counter that is currently stored in the Datastore.
@return | [
"Helper",
"method",
"to",
"determine",
"if",
"a",
"counter",
"s",
"incrementAmount",
"can",
"be",
"mutated",
"(",
"incremented",
"or",
"decremented",
")",
".",
"In",
"order",
"for",
"that",
"to",
"happen",
"the",
"counter",
"s",
"status",
"must",
"be",
"{",
"@link",
"CounterStatus#AVAILABLE",
"}",
"."
] | train | https://github.com/instacount/appengine-counter/blob/60aa86ab28f173ec1642539926b69924b8bda238/src/main/java/io/instacount/appengine/counter/service/ShardedCounterServiceImpl.java#L1448-L1460 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/crypto/PEMHelper.java | PEMHelper.loadCertificates | public static KeyStore loadCertificates(final File pemFile) {
"""
Load one or more X.509 Certificates from a PEM file
@param pemFile
A PKCS8 PEM file containing only <code>CERTIFICATE</code> / <code>X.509 CERTIFICATE</code> blocks
@return a JKS KeyStore with the certificate aliases "cert<code>index</code>" where index is the 0-based index of the
certificate in the PEM
@throws RuntimeException
if a problem occurs
"""
try (final PemReader pem = new PemReader(new FileReader(pemFile)))
{
final KeyStore ks = createEmptyKeyStore();
int certIndex = 0;
Object obj;
while ((obj = parse(pem.readPemObject())) != null)
{
if (obj instanceof Certificate)
{
final Certificate cert = (Certificate) obj;
ks.setCertificateEntry("cert" + Integer.toString(certIndex++), cert);
}
else
{
throw new RuntimeException("Unknown PEM contents: " + obj + ". Expected a Certificate");
}
}
return ks;
}
catch (Exception e)
{
throw new RuntimeException("Error parsing PEM " + pemFile, e);
}
} | java | public static KeyStore loadCertificates(final File pemFile)
{
try (final PemReader pem = new PemReader(new FileReader(pemFile)))
{
final KeyStore ks = createEmptyKeyStore();
int certIndex = 0;
Object obj;
while ((obj = parse(pem.readPemObject())) != null)
{
if (obj instanceof Certificate)
{
final Certificate cert = (Certificate) obj;
ks.setCertificateEntry("cert" + Integer.toString(certIndex++), cert);
}
else
{
throw new RuntimeException("Unknown PEM contents: " + obj + ". Expected a Certificate");
}
}
return ks;
}
catch (Exception e)
{
throw new RuntimeException("Error parsing PEM " + pemFile, e);
}
} | [
"public",
"static",
"KeyStore",
"loadCertificates",
"(",
"final",
"File",
"pemFile",
")",
"{",
"try",
"(",
"final",
"PemReader",
"pem",
"=",
"new",
"PemReader",
"(",
"new",
"FileReader",
"(",
"pemFile",
")",
")",
")",
"{",
"final",
"KeyStore",
"ks",
"=",
"createEmptyKeyStore",
"(",
")",
";",
"int",
"certIndex",
"=",
"0",
";",
"Object",
"obj",
";",
"while",
"(",
"(",
"obj",
"=",
"parse",
"(",
"pem",
".",
"readPemObject",
"(",
")",
")",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"Certificate",
")",
"{",
"final",
"Certificate",
"cert",
"=",
"(",
"Certificate",
")",
"obj",
";",
"ks",
".",
"setCertificateEntry",
"(",
"\"cert\"",
"+",
"Integer",
".",
"toString",
"(",
"certIndex",
"++",
")",
",",
"cert",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Unknown PEM contents: \"",
"+",
"obj",
"+",
"\". Expected a Certificate\"",
")",
";",
"}",
"}",
"return",
"ks",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Error parsing PEM \"",
"+",
"pemFile",
",",
"e",
")",
";",
"}",
"}"
] | Load one or more X.509 Certificates from a PEM file
@param pemFile
A PKCS8 PEM file containing only <code>CERTIFICATE</code> / <code>X.509 CERTIFICATE</code> blocks
@return a JKS KeyStore with the certificate aliases "cert<code>index</code>" where index is the 0-based index of the
certificate in the PEM
@throws RuntimeException
if a problem occurs | [
"Load",
"one",
"or",
"more",
"X",
".",
"509",
"Certificates",
"from",
"a",
"PEM",
"file"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/crypto/PEMHelper.java#L40-L68 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/SelectOnUpdateHandler.java | SelectOnUpdateHandler.init | public void init(Record record, Record recordToSync, boolean bUpdateOnSelect) {
"""
SelectOnUpdateHandler - Constructor.
@param recordToSync The record to synchronize with this one.
@param bUpdateOnSelect If true, update or add a record in progress before syncing this record.
"""
super.init(record, null, recordToSync, bUpdateOnSelect, DBConstants.SELECT_TYPE);
} | java | public void init(Record record, Record recordToSync, boolean bUpdateOnSelect)
{
super.init(record, null, recordToSync, bUpdateOnSelect, DBConstants.SELECT_TYPE);
} | [
"public",
"void",
"init",
"(",
"Record",
"record",
",",
"Record",
"recordToSync",
",",
"boolean",
"bUpdateOnSelect",
")",
"{",
"super",
".",
"init",
"(",
"record",
",",
"null",
",",
"recordToSync",
",",
"bUpdateOnSelect",
",",
"DBConstants",
".",
"SELECT_TYPE",
")",
";",
"}"
] | SelectOnUpdateHandler - Constructor.
@param recordToSync The record to synchronize with this one.
@param bUpdateOnSelect If true, update or add a record in progress before syncing this record. | [
"SelectOnUpdateHandler",
"-",
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SelectOnUpdateHandler.java#L50-L53 |
jcuda/jcurand | JCurandJava/src/main/java/jcuda/jcurand/JCurand.java | JCurand.curandGeneratePoisson | public static int curandGeneratePoisson(curandGenerator generator, Pointer outputPtr, long n, double lambda) {
"""
<pre>
Generate Poisson-distributed unsigned ints.
Use generator to generate n unsigned int results into device memory at
outputPtr. The device memory must have been previously allocated and must be
large enough to hold all the results. Launches are done with the stream
set using ::curandSetStream(), or the null stream if no stream has been set.
Results are 32-bit unsigned int point values with Poisson distribution,
with lambda lambda.
@param generator - Generator to use
@param outputPtr - Pointer to device memory to store CUDA-generated results, or
Pointer to host memory to store CPU-generated results
@param n - Number of unsigned ints to generate
@param lambda - lambda for the Poisson distribution
@return
- CURAND_STATUS_NOT_INITIALIZED if the generator was never created
- CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from
a previous kernel launch
- CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason
- CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is
not a multiple of the quasirandom dimension
- CURAND_STATUS_DOUBLE_PRECISION_REQUIRED if the GPU or sm does not support double precision
- CURAND_STATUS_OUT_OF_RANGE if lambda is non-positive or greater than 400,000
- CURAND_STATUS_SUCCESS if the results were generated successfully
</pre>
"""
return checkResult(curandGeneratePoissonNative(generator, outputPtr, n, lambda));
} | java | public static int curandGeneratePoisson(curandGenerator generator, Pointer outputPtr, long n, double lambda)
{
return checkResult(curandGeneratePoissonNative(generator, outputPtr, n, lambda));
} | [
"public",
"static",
"int",
"curandGeneratePoisson",
"(",
"curandGenerator",
"generator",
",",
"Pointer",
"outputPtr",
",",
"long",
"n",
",",
"double",
"lambda",
")",
"{",
"return",
"checkResult",
"(",
"curandGeneratePoissonNative",
"(",
"generator",
",",
"outputPtr",
",",
"n",
",",
"lambda",
")",
")",
";",
"}"
] | <pre>
Generate Poisson-distributed unsigned ints.
Use generator to generate n unsigned int results into device memory at
outputPtr. The device memory must have been previously allocated and must be
large enough to hold all the results. Launches are done with the stream
set using ::curandSetStream(), or the null stream if no stream has been set.
Results are 32-bit unsigned int point values with Poisson distribution,
with lambda lambda.
@param generator - Generator to use
@param outputPtr - Pointer to device memory to store CUDA-generated results, or
Pointer to host memory to store CPU-generated results
@param n - Number of unsigned ints to generate
@param lambda - lambda for the Poisson distribution
@return
- CURAND_STATUS_NOT_INITIALIZED if the generator was never created
- CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from
a previous kernel launch
- CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason
- CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is
not a multiple of the quasirandom dimension
- CURAND_STATUS_DOUBLE_PRECISION_REQUIRED if the GPU or sm does not support double precision
- CURAND_STATUS_OUT_OF_RANGE if lambda is non-positive or greater than 400,000
- CURAND_STATUS_SUCCESS if the results were generated successfully
</pre> | [
"<pre",
">",
"Generate",
"Poisson",
"-",
"distributed",
"unsigned",
"ints",
"."
] | train | https://github.com/jcuda/jcurand/blob/0f463d2bb72cd93b3988f7ce148cdb6069ba4fd9/JCurandJava/src/main/java/jcuda/jcurand/JCurand.java#L929-L932 |
vorburger/xtendbeans | ch.vorburger.xtendbeans/src/main/java/ch/vorburger/xtendbeans/AssertBeans.java | AssertBeans.assertEqualBeans | public static void assertEqualBeans(Object expected, Object actual) throws ComparisonFailure {
"""
Asserts that two JavaBean or immutable Value Objects are equal. If they are not, throws an
{@link ComparisonFailure} with highly readable textual representations of the objects' properties.
@param expected
expected value
@param actual
the value to check against <code>expected</code>
"""
// Do *NOT* rely on expected/actual java.lang.Object.equals(Object);
// and obviously neither e.g. java.util.Objects.equals(Object, Object) based on. it
final String expectedAsText = generator.getExpression(expected);
assertEqualByText(expectedAsText, actual);
} | java | public static void assertEqualBeans(Object expected, Object actual) throws ComparisonFailure {
// Do *NOT* rely on expected/actual java.lang.Object.equals(Object);
// and obviously neither e.g. java.util.Objects.equals(Object, Object) based on. it
final String expectedAsText = generator.getExpression(expected);
assertEqualByText(expectedAsText, actual);
} | [
"public",
"static",
"void",
"assertEqualBeans",
"(",
"Object",
"expected",
",",
"Object",
"actual",
")",
"throws",
"ComparisonFailure",
"{",
"// Do *NOT* rely on expected/actual java.lang.Object.equals(Object);",
"// and obviously neither e.g. java.util.Objects.equals(Object, Object) based on. it",
"final",
"String",
"expectedAsText",
"=",
"generator",
".",
"getExpression",
"(",
"expected",
")",
";",
"assertEqualByText",
"(",
"expectedAsText",
",",
"actual",
")",
";",
"}"
] | Asserts that two JavaBean or immutable Value Objects are equal. If they are not, throws an
{@link ComparisonFailure} with highly readable textual representations of the objects' properties.
@param expected
expected value
@param actual
the value to check against <code>expected</code> | [
"Asserts",
"that",
"two",
"JavaBean",
"or",
"immutable",
"Value",
"Objects",
"are",
"equal",
".",
"If",
"they",
"are",
"not",
"throws",
"an",
"{",
"@link",
"ComparisonFailure",
"}",
"with",
"highly",
"readable",
"textual",
"representations",
"of",
"the",
"objects",
"properties",
"."
] | train | https://github.com/vorburger/xtendbeans/blob/0442f7e0ee5ff16653c6ad89bbdf29d9b83f993d/ch.vorburger.xtendbeans/src/main/java/ch/vorburger/xtendbeans/AssertBeans.java#L56-L61 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/RepositoryFileApi.java | RepositoryFileApi.createForm | protected Form createForm(RepositoryFile file, String branchName, String commitMessage) {
"""
Gets the query params based on the API version.
@param file the RepositoryFile instance with the info for the query params
@param branchName the branch name
@param commitMessage the commit message
@return a Form instance with the correct query params.
"""
Form form = new Form();
if (isApiVersion(ApiVersion.V3)) {
addFormParam(form, "file_path", file.getFilePath(), true);
addFormParam(form, "branch_name", branchName, true);
} else {
addFormParam(form, "branch", branchName, true);
}
addFormParam(form, "encoding", file.getEncoding(), false);
// Cannot use addFormParam() as it does not accept an empty or whitespace only string
String content = file.getContent();
if (content == null) {
throw new IllegalArgumentException("content cannot be null");
}
form.param("content", content);
addFormParam(form, "commit_message", commitMessage, true);
return (form);
} | java | protected Form createForm(RepositoryFile file, String branchName, String commitMessage) {
Form form = new Form();
if (isApiVersion(ApiVersion.V3)) {
addFormParam(form, "file_path", file.getFilePath(), true);
addFormParam(form, "branch_name", branchName, true);
} else {
addFormParam(form, "branch", branchName, true);
}
addFormParam(form, "encoding", file.getEncoding(), false);
// Cannot use addFormParam() as it does not accept an empty or whitespace only string
String content = file.getContent();
if (content == null) {
throw new IllegalArgumentException("content cannot be null");
}
form.param("content", content);
addFormParam(form, "commit_message", commitMessage, true);
return (form);
} | [
"protected",
"Form",
"createForm",
"(",
"RepositoryFile",
"file",
",",
"String",
"branchName",
",",
"String",
"commitMessage",
")",
"{",
"Form",
"form",
"=",
"new",
"Form",
"(",
")",
";",
"if",
"(",
"isApiVersion",
"(",
"ApiVersion",
".",
"V3",
")",
")",
"{",
"addFormParam",
"(",
"form",
",",
"\"file_path\"",
",",
"file",
".",
"getFilePath",
"(",
")",
",",
"true",
")",
";",
"addFormParam",
"(",
"form",
",",
"\"branch_name\"",
",",
"branchName",
",",
"true",
")",
";",
"}",
"else",
"{",
"addFormParam",
"(",
"form",
",",
"\"branch\"",
",",
"branchName",
",",
"true",
")",
";",
"}",
"addFormParam",
"(",
"form",
",",
"\"encoding\"",
",",
"file",
".",
"getEncoding",
"(",
")",
",",
"false",
")",
";",
"// Cannot use addFormParam() as it does not accept an empty or whitespace only string",
"String",
"content",
"=",
"file",
".",
"getContent",
"(",
")",
";",
"if",
"(",
"content",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"content cannot be null\"",
")",
";",
"}",
"form",
".",
"param",
"(",
"\"content\"",
",",
"content",
")",
";",
"addFormParam",
"(",
"form",
",",
"\"commit_message\"",
",",
"commitMessage",
",",
"true",
")",
";",
"return",
"(",
"form",
")",
";",
"}"
] | Gets the query params based on the API version.
@param file the RepositoryFile instance with the info for the query params
@param branchName the branch name
@param commitMessage the commit message
@return a Form instance with the correct query params. | [
"Gets",
"the",
"query",
"params",
"based",
"on",
"the",
"API",
"version",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryFileApi.java#L438-L459 |
mgormley/prim | src/main/java/edu/jhu/prim/util/math/FastMath.java | FastMath.logAdd | public static double logAdd(double x, double y) {
"""
Adds two probabilities that are stored as log probabilities.
@param x log(p)
@param y log(q)
@return log(p + q) = log(exp(x) + exp(y))
"""
if (FastMath.useLogAddTable) {
return SmoothedLogAddTable.logAdd(x,y);
} else {
return FastMath.logAddExact(x,y);
}
} | java | public static double logAdd(double x, double y) {
if (FastMath.useLogAddTable) {
return SmoothedLogAddTable.logAdd(x,y);
} else {
return FastMath.logAddExact(x,y);
}
} | [
"public",
"static",
"double",
"logAdd",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"if",
"(",
"FastMath",
".",
"useLogAddTable",
")",
"{",
"return",
"SmoothedLogAddTable",
".",
"logAdd",
"(",
"x",
",",
"y",
")",
";",
"}",
"else",
"{",
"return",
"FastMath",
".",
"logAddExact",
"(",
"x",
",",
"y",
")",
";",
"}",
"}"
] | Adds two probabilities that are stored as log probabilities.
@param x log(p)
@param y log(q)
@return log(p + q) = log(exp(x) + exp(y)) | [
"Adds",
"two",
"probabilities",
"that",
"are",
"stored",
"as",
"log",
"probabilities",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/util/math/FastMath.java#L27-L33 |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java | JanusConfig.getSystemPropertyAsFloat | public static float getSystemPropertyAsFloat(String name, float defaultValue) {
"""
Replies the value of the single precision floating point value system property.
@param name
- name of the property.
@param defaultValue
- value to reply if the these is no property found
@return the value, or defaultValue.
"""
final String value = getSystemProperty(name, null);
if (value != null) {
try {
return Float.parseFloat(value);
} catch (Throwable exception) {
//
}
}
return defaultValue;
} | java | public static float getSystemPropertyAsFloat(String name, float defaultValue) {
final String value = getSystemProperty(name, null);
if (value != null) {
try {
return Float.parseFloat(value);
} catch (Throwable exception) {
//
}
}
return defaultValue;
} | [
"public",
"static",
"float",
"getSystemPropertyAsFloat",
"(",
"String",
"name",
",",
"float",
"defaultValue",
")",
"{",
"final",
"String",
"value",
"=",
"getSystemProperty",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"Float",
".",
"parseFloat",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"Throwable",
"exception",
")",
"{",
"//",
"}",
"}",
"return",
"defaultValue",
";",
"}"
] | Replies the value of the single precision floating point value system property.
@param name
- name of the property.
@param defaultValue
- value to reply if the these is no property found
@return the value, or defaultValue. | [
"Replies",
"the",
"value",
"of",
"the",
"single",
"precision",
"floating",
"point",
"value",
"system",
"property",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java#L417-L427 |
looly/hutool | hutool-captcha/src/main/java/cn/hutool/captcha/CaptchaUtil.java | CaptchaUtil.createLineCaptcha | public static LineCaptcha createLineCaptcha(int width, int height, int codeCount, int lineCount) {
"""
创建线干扰的验证码
@param width 图片宽
@param height 图片高
@param codeCount 字符个数
@param lineCount 干扰线条数
@return {@link LineCaptcha}
"""
return new LineCaptcha(width, height, codeCount, lineCount);
} | java | public static LineCaptcha createLineCaptcha(int width, int height, int codeCount, int lineCount) {
return new LineCaptcha(width, height, codeCount, lineCount);
} | [
"public",
"static",
"LineCaptcha",
"createLineCaptcha",
"(",
"int",
"width",
",",
"int",
"height",
",",
"int",
"codeCount",
",",
"int",
"lineCount",
")",
"{",
"return",
"new",
"LineCaptcha",
"(",
"width",
",",
"height",
",",
"codeCount",
",",
"lineCount",
")",
";",
"}"
] | 创建线干扰的验证码
@param width 图片宽
@param height 图片高
@param codeCount 字符个数
@param lineCount 干扰线条数
@return {@link LineCaptcha} | [
"创建线干扰的验证码"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-captcha/src/main/java/cn/hutool/captcha/CaptchaUtil.java#L31-L33 |
powermock/powermock | powermock-core/src/main/java/org/powermock/core/ClassReplicaCreator.java | ClassReplicaCreator.addDelegatorField | private <T> void addDelegatorField(T delegator, final CtClass replicaClass) throws CannotCompileException {
"""
Add a field to the replica class that holds the instance delegator. I.e.
if we're creating a instance replica of {@code java.lang.Long} this
methods adds a new field of type {@code delegator.getClass()} to the
replica class.
"""
CtField f = CtField.make(String.format("private %s %s = null;", delegator.getClass().getName(),
POWERMOCK_INSTANCE_DELEGATOR_FIELD_NAME), replicaClass);
replicaClass.addField(f);
} | java | private <T> void addDelegatorField(T delegator, final CtClass replicaClass) throws CannotCompileException {
CtField f = CtField.make(String.format("private %s %s = null;", delegator.getClass().getName(),
POWERMOCK_INSTANCE_DELEGATOR_FIELD_NAME), replicaClass);
replicaClass.addField(f);
} | [
"private",
"<",
"T",
">",
"void",
"addDelegatorField",
"(",
"T",
"delegator",
",",
"final",
"CtClass",
"replicaClass",
")",
"throws",
"CannotCompileException",
"{",
"CtField",
"f",
"=",
"CtField",
".",
"make",
"(",
"String",
".",
"format",
"(",
"\"private %s %s = null;\"",
",",
"delegator",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"POWERMOCK_INSTANCE_DELEGATOR_FIELD_NAME",
")",
",",
"replicaClass",
")",
";",
"replicaClass",
".",
"addField",
"(",
"f",
")",
";",
"}"
] | Add a field to the replica class that holds the instance delegator. I.e.
if we're creating a instance replica of {@code java.lang.Long} this
methods adds a new field of type {@code delegator.getClass()} to the
replica class. | [
"Add",
"a",
"field",
"to",
"the",
"replica",
"class",
"that",
"holds",
"the",
"instance",
"delegator",
".",
"I",
".",
"e",
".",
"if",
"we",
"re",
"creating",
"a",
"instance",
"replica",
"of",
"{"
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-core/src/main/java/org/powermock/core/ClassReplicaCreator.java#L120-L124 |
knowm/XChart | xchart/src/main/java/org/knowm/xchart/BubbleChart.java | BubbleChart.addSeries | public BubbleSeries addSeries(
String seriesName, double[] xData, double[] yData, double[] bubbleData) {
"""
Add a series for a Bubble type chart using using Lists
@param seriesName
@param xData the X-Axis data
@param xData the Y-Axis data
@param bubbleData the bubble data
@return
"""
// Sanity checks
sanityCheck(seriesName, xData, yData, bubbleData);
BubbleSeries series;
if (xData != null) {
// Sanity check
if (xData.length != yData.length) {
throw new IllegalArgumentException("X and Y-Axis sizes are not the same!!!");
}
series = new BubbleSeries(seriesName, xData, yData, bubbleData);
} else { // generate xData
series =
new BubbleSeries(
seriesName, Utils.getGeneratedDataAsArray(yData.length), yData, bubbleData);
}
seriesMap.put(seriesName, series);
return series;
} | java | public BubbleSeries addSeries(
String seriesName, double[] xData, double[] yData, double[] bubbleData) {
// Sanity checks
sanityCheck(seriesName, xData, yData, bubbleData);
BubbleSeries series;
if (xData != null) {
// Sanity check
if (xData.length != yData.length) {
throw new IllegalArgumentException("X and Y-Axis sizes are not the same!!!");
}
series = new BubbleSeries(seriesName, xData, yData, bubbleData);
} else { // generate xData
series =
new BubbleSeries(
seriesName, Utils.getGeneratedDataAsArray(yData.length), yData, bubbleData);
}
seriesMap.put(seriesName, series);
return series;
} | [
"public",
"BubbleSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"double",
"[",
"]",
"xData",
",",
"double",
"[",
"]",
"yData",
",",
"double",
"[",
"]",
"bubbleData",
")",
"{",
"// Sanity checks",
"sanityCheck",
"(",
"seriesName",
",",
"xData",
",",
"yData",
",",
"bubbleData",
")",
";",
"BubbleSeries",
"series",
";",
"if",
"(",
"xData",
"!=",
"null",
")",
"{",
"// Sanity check",
"if",
"(",
"xData",
".",
"length",
"!=",
"yData",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"X and Y-Axis sizes are not the same!!!\"",
")",
";",
"}",
"series",
"=",
"new",
"BubbleSeries",
"(",
"seriesName",
",",
"xData",
",",
"yData",
",",
"bubbleData",
")",
";",
"}",
"else",
"{",
"// generate xData",
"series",
"=",
"new",
"BubbleSeries",
"(",
"seriesName",
",",
"Utils",
".",
"getGeneratedDataAsArray",
"(",
"yData",
".",
"length",
")",
",",
"yData",
",",
"bubbleData",
")",
";",
"}",
"seriesMap",
".",
"put",
"(",
"seriesName",
",",
"series",
")",
";",
"return",
"series",
";",
"}"
] | Add a series for a Bubble type chart using using Lists
@param seriesName
@param xData the X-Axis data
@param xData the Y-Axis data
@param bubbleData the bubble data
@return | [
"Add",
"a",
"series",
"for",
"a",
"Bubble",
"type",
"chart",
"using",
"using",
"Lists"
] | train | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/BubbleChart.java#L103-L127 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerAgentUtils.java | DockerAgentUtils.updateImageParent | private static boolean updateImageParent(JenkinsBuildInfoLog log, String imageTag, String host, int buildInfoId) throws IOException {
"""
Adds the docker image parent (the base image) as property on the docker image.
This property will be later added to the generated build-info deployed to Artifactory.
@param log
@param imageTag
@param host
@param buildInfoId
@return
@throws IOException
"""
boolean parentUpdated = false;
for (DockerImage image : getImagesByBuildId(buildInfoId)) {
if (image.getImageTag().equals(imageTag)) {
String parentId = DockerUtils.getParentId(image.getImageId(), host);
if (StringUtils.isNotEmpty(parentId)) {
Properties properties = new Properties();
properties.setProperty("docker.image.parent", DockerUtils.getShaValue(parentId));
image.addBuildInfoModuleProps(properties);
}
log.info("Docker build-info captured on '" + image.getAgentName() + "' agent.");
parentUpdated = true;
}
}
return parentUpdated;
} | java | private static boolean updateImageParent(JenkinsBuildInfoLog log, String imageTag, String host, int buildInfoId) throws IOException {
boolean parentUpdated = false;
for (DockerImage image : getImagesByBuildId(buildInfoId)) {
if (image.getImageTag().equals(imageTag)) {
String parentId = DockerUtils.getParentId(image.getImageId(), host);
if (StringUtils.isNotEmpty(parentId)) {
Properties properties = new Properties();
properties.setProperty("docker.image.parent", DockerUtils.getShaValue(parentId));
image.addBuildInfoModuleProps(properties);
}
log.info("Docker build-info captured on '" + image.getAgentName() + "' agent.");
parentUpdated = true;
}
}
return parentUpdated;
} | [
"private",
"static",
"boolean",
"updateImageParent",
"(",
"JenkinsBuildInfoLog",
"log",
",",
"String",
"imageTag",
",",
"String",
"host",
",",
"int",
"buildInfoId",
")",
"throws",
"IOException",
"{",
"boolean",
"parentUpdated",
"=",
"false",
";",
"for",
"(",
"DockerImage",
"image",
":",
"getImagesByBuildId",
"(",
"buildInfoId",
")",
")",
"{",
"if",
"(",
"image",
".",
"getImageTag",
"(",
")",
".",
"equals",
"(",
"imageTag",
")",
")",
"{",
"String",
"parentId",
"=",
"DockerUtils",
".",
"getParentId",
"(",
"image",
".",
"getImageId",
"(",
")",
",",
"host",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"parentId",
")",
")",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"properties",
".",
"setProperty",
"(",
"\"docker.image.parent\"",
",",
"DockerUtils",
".",
"getShaValue",
"(",
"parentId",
")",
")",
";",
"image",
".",
"addBuildInfoModuleProps",
"(",
"properties",
")",
";",
"}",
"log",
".",
"info",
"(",
"\"Docker build-info captured on '\"",
"+",
"image",
".",
"getAgentName",
"(",
")",
"+",
"\"' agent.\"",
")",
";",
"parentUpdated",
"=",
"true",
";",
"}",
"}",
"return",
"parentUpdated",
";",
"}"
] | Adds the docker image parent (the base image) as property on the docker image.
This property will be later added to the generated build-info deployed to Artifactory.
@param log
@param imageTag
@param host
@param buildInfoId
@return
@throws IOException | [
"Adds",
"the",
"docker",
"image",
"parent",
"(",
"the",
"base",
"image",
")",
"as",
"property",
"on",
"the",
"docker",
"image",
".",
"This",
"property",
"will",
"be",
"later",
"added",
"to",
"the",
"generated",
"build",
"-",
"info",
"deployed",
"to",
"Artifactory",
"."
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerAgentUtils.java#L255-L270 |
pierre/eventtracker | common/src/main/java/com/ning/metrics/eventtracker/DiskSpoolEventWriterProvider.java | DiskSpoolEventWriterProvider.get | @Override
public DiskSpoolEventWriter get() {
"""
Provides an instance of a DiskSpoolEventWriter, which forwards local buffered events (in files) to the collector,
via an EventSender.
@return instance of a DiskSpoolEventWriter
"""
return new DiskSpoolEventWriter(new EventHandler()
{
@Override
public void handle(final File file, final CallbackHandler handler)
{
eventSender.send(file, handler);
}
}, config.getSpoolDirectoryName(), config.isFlushEnabled(), config.getFlushIntervalInSeconds(), executor,
SyncType.valueOf(config.getSyncType()), config.getSyncBatchSize(), new NoCompressionCodec(), serializer);
} | java | @Override
public DiskSpoolEventWriter get()
{
return new DiskSpoolEventWriter(new EventHandler()
{
@Override
public void handle(final File file, final CallbackHandler handler)
{
eventSender.send(file, handler);
}
}, config.getSpoolDirectoryName(), config.isFlushEnabled(), config.getFlushIntervalInSeconds(), executor,
SyncType.valueOf(config.getSyncType()), config.getSyncBatchSize(), new NoCompressionCodec(), serializer);
} | [
"@",
"Override",
"public",
"DiskSpoolEventWriter",
"get",
"(",
")",
"{",
"return",
"new",
"DiskSpoolEventWriter",
"(",
"new",
"EventHandler",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"handle",
"(",
"final",
"File",
"file",
",",
"final",
"CallbackHandler",
"handler",
")",
"{",
"eventSender",
".",
"send",
"(",
"file",
",",
"handler",
")",
";",
"}",
"}",
",",
"config",
".",
"getSpoolDirectoryName",
"(",
")",
",",
"config",
".",
"isFlushEnabled",
"(",
")",
",",
"config",
".",
"getFlushIntervalInSeconds",
"(",
")",
",",
"executor",
",",
"SyncType",
".",
"valueOf",
"(",
"config",
".",
"getSyncType",
"(",
")",
")",
",",
"config",
".",
"getSyncBatchSize",
"(",
")",
",",
"new",
"NoCompressionCodec",
"(",
")",
",",
"serializer",
")",
";",
"}"
] | Provides an instance of a DiskSpoolEventWriter, which forwards local buffered events (in files) to the collector,
via an EventSender.
@return instance of a DiskSpoolEventWriter | [
"Provides",
"an",
"instance",
"of",
"a",
"DiskSpoolEventWriter",
"which",
"forwards",
"local",
"buffered",
"events",
"(",
"in",
"files",
")",
"to",
"the",
"collector",
"via",
"an",
"EventSender",
"."
] | train | https://github.com/pierre/eventtracker/blob/d47e74f11b05500fc31eeb43448aa6316a1318f6/common/src/main/java/com/ning/metrics/eventtracker/DiskSpoolEventWriterProvider.java#L58-L70 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java | DatabaseAccountsInner.beginFailoverPriorityChange | public void beginFailoverPriorityChange(String resourceGroupName, String accountName, List<FailoverPolicy> failoverPolicies) {
"""
Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param failoverPolicies List of failover policies.
@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
"""
beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).toBlocking().single().body();
} | java | public void beginFailoverPriorityChange(String resourceGroupName, String accountName, List<FailoverPolicy> failoverPolicies) {
beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).toBlocking().single().body();
} | [
"public",
"void",
"beginFailoverPriorityChange",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"List",
"<",
"FailoverPolicy",
">",
"failoverPolicies",
")",
"{",
"beginFailoverPriorityChangeWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"failoverPolicies",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param failoverPolicies List of failover policies.
@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 | [
"Changes",
"the",
"failover",
"priority",
"for",
"the",
"Azure",
"Cosmos",
"DB",
"database",
"account",
".",
"A",
"failover",
"priority",
"of",
"0",
"indicates",
"a",
"write",
"region",
".",
"The",
"maximum",
"value",
"for",
"a",
"failover",
"priority",
"=",
"(",
"total",
"number",
"of",
"regions",
"-",
"1",
")",
".",
"Failover",
"priority",
"values",
"must",
"be",
"unique",
"for",
"each",
"of",
"the",
"regions",
"in",
"which",
"the",
"database",
"account",
"exists",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L847-L849 |
JavaMoney/jsr354-api | src/main/java/javax/money/Monetary.java | Monetary.getCurrencies | public static Set<CurrencyUnit> getCurrencies(Locale locale, String... providers) {
"""
Access a new instance based on the {@link Locale}. Currencies are
available as provided by {@link CurrencyProviderSpi} instances registered
with the {@link javax.money.spi.Bootstrap}.
@param locale the target {@link Locale}, typically representing an ISO
country, not {@code null}.
@param providers the (optional) specification of providers to consider.
@return the corresponding {@link CurrencyUnit} instance.
@throws UnknownCurrencyException if no such currency exists.
"""
return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
() -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
.getCurrencies(locale, providers);
} | java | public static Set<CurrencyUnit> getCurrencies(Locale locale, String... providers) {
return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
() -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
.getCurrencies(locale, providers);
} | [
"public",
"static",
"Set",
"<",
"CurrencyUnit",
">",
"getCurrencies",
"(",
"Locale",
"locale",
",",
"String",
"...",
"providers",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"MONETARY_CURRENCIES_SINGLETON_SPI",
"(",
")",
")",
".",
"orElseThrow",
"(",
"(",
")",
"->",
"new",
"MonetaryException",
"(",
"\"No MonetaryCurrenciesSingletonSpi loaded, check your system setup.\"",
")",
")",
".",
"getCurrencies",
"(",
"locale",
",",
"providers",
")",
";",
"}"
] | Access a new instance based on the {@link Locale}. Currencies are
available as provided by {@link CurrencyProviderSpi} instances registered
with the {@link javax.money.spi.Bootstrap}.
@param locale the target {@link Locale}, typically representing an ISO
country, not {@code null}.
@param providers the (optional) specification of providers to consider.
@return the corresponding {@link CurrencyUnit} instance.
@throws UnknownCurrencyException if no such currency exists. | [
"Access",
"a",
"new",
"instance",
"based",
"on",
"the",
"{",
"@link",
"Locale",
"}",
".",
"Currencies",
"are",
"available",
"as",
"provided",
"by",
"{",
"@link",
"CurrencyProviderSpi",
"}",
"instances",
"registered",
"with",
"the",
"{",
"@link",
"javax",
".",
"money",
".",
"spi",
".",
"Bootstrap",
"}",
"."
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L420-L424 |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Utils.java | Utils.appendDecEntity | public final static void appendDecEntity(final StringBuilder out, final char value) {
"""
Append the given char as a decimal HTML entity.
@param out
The StringBuilder to write to.
@param value
The character.
"""
out.append("&#");
out.append((int)value);
out.append(';');
} | java | public final static void appendDecEntity(final StringBuilder out, final char value)
{
out.append("&#");
out.append((int)value);
out.append(';');
} | [
"public",
"final",
"static",
"void",
"appendDecEntity",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"char",
"value",
")",
"{",
"out",
".",
"append",
"(",
"\"&#\"",
")",
";",
"out",
".",
"append",
"(",
"(",
"int",
")",
"value",
")",
";",
"out",
".",
"append",
"(",
"'",
"'",
")",
";",
"}"
] | Append the given char as a decimal HTML entity.
@param out
The StringBuilder to write to.
@param value
The character. | [
"Append",
"the",
"given",
"char",
"as",
"a",
"decimal",
"HTML",
"entity",
"."
] | train | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L522-L527 |
gs2io/gs2-java-sdk-core | src/main/java/io/gs2/AbstractGs2Client.java | AbstractGs2Client.createHttpDelete | protected HttpDelete createHttpDelete(String url, IGs2Credential credential, String service, String module, String function) {
"""
DELETEリクエストを生成
@param url アクセス先URL
@param credential 認証情報
@param service アクセス先サービス
@param module アクセス先モジュール
@param function アクセス先ファンクション
@return リクエストオブジェクト
"""
Long timestamp = System.currentTimeMillis()/1000;
url = StringUtils.replace(url, "{service}", service);
url = StringUtils.replace(url, "{region}", region.getName());
HttpDelete delete = new HttpDelete(url);
delete.setHeader("Content-Type", "application/json");
credential.authorized(delete, service, module, function, timestamp);
return delete;
} | java | protected HttpDelete createHttpDelete(String url, IGs2Credential credential, String service, String module, String function) {
Long timestamp = System.currentTimeMillis()/1000;
url = StringUtils.replace(url, "{service}", service);
url = StringUtils.replace(url, "{region}", region.getName());
HttpDelete delete = new HttpDelete(url);
delete.setHeader("Content-Type", "application/json");
credential.authorized(delete, service, module, function, timestamp);
return delete;
} | [
"protected",
"HttpDelete",
"createHttpDelete",
"(",
"String",
"url",
",",
"IGs2Credential",
"credential",
",",
"String",
"service",
",",
"String",
"module",
",",
"String",
"function",
")",
"{",
"Long",
"timestamp",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"/",
"1000",
";",
"url",
"=",
"StringUtils",
".",
"replace",
"(",
"url",
",",
"\"{service}\"",
",",
"service",
")",
";",
"url",
"=",
"StringUtils",
".",
"replace",
"(",
"url",
",",
"\"{region}\"",
",",
"region",
".",
"getName",
"(",
")",
")",
";",
"HttpDelete",
"delete",
"=",
"new",
"HttpDelete",
"(",
"url",
")",
";",
"delete",
".",
"setHeader",
"(",
"\"Content-Type\"",
",",
"\"application/json\"",
")",
";",
"credential",
".",
"authorized",
"(",
"delete",
",",
"service",
",",
"module",
",",
"function",
",",
"timestamp",
")",
";",
"return",
"delete",
";",
"}"
] | DELETEリクエストを生成
@param url アクセス先URL
@param credential 認証情報
@param service アクセス先サービス
@param module アクセス先モジュール
@param function アクセス先ファンクション
@return リクエストオブジェクト | [
"DELETEリクエストを生成"
] | train | https://github.com/gs2io/gs2-java-sdk-core/blob/fe66ee4e374664b101b07c41221a3b32c844127d/src/main/java/io/gs2/AbstractGs2Client.java#L178-L186 |
redbox-mint/redbox | plugins/transformer/vital-fedora2/src/main/java/com/googlecode/fascinator/redbox/VitalTransformer.java | VitalTransformer.fedoraLogEntry | private String fedoraLogEntry(DigitalObject object, String pid) {
"""
Build a Log entry to use in Fedora. Replace all the template placeholders
@param object The Object being submitted
@param pid The PID in our system
"""
String message = fedoraMessageTemplate.replace("[[PID]]", pid);
return message.replace("[[OID]]", object.getId());
} | java | private String fedoraLogEntry(DigitalObject object, String pid) {
String message = fedoraMessageTemplate.replace("[[PID]]", pid);
return message.replace("[[OID]]", object.getId());
} | [
"private",
"String",
"fedoraLogEntry",
"(",
"DigitalObject",
"object",
",",
"String",
"pid",
")",
"{",
"String",
"message",
"=",
"fedoraMessageTemplate",
".",
"replace",
"(",
"\"[[PID]]\"",
",",
"pid",
")",
";",
"return",
"message",
".",
"replace",
"(",
"\"[[OID]]\"",
",",
"object",
".",
"getId",
"(",
")",
")",
";",
"}"
] | Build a Log entry to use in Fedora. Replace all the template placeholders
@param object The Object being submitted
@param pid The PID in our system | [
"Build",
"a",
"Log",
"entry",
"to",
"use",
"in",
"Fedora",
".",
"Replace",
"all",
"the",
"template",
"placeholders"
] | train | https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transformer/vital-fedora2/src/main/java/com/googlecode/fascinator/redbox/VitalTransformer.java#L1260-L1263 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.