repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
listlengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
listlengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
apache/spark
|
common/network-common/src/main/java/org/apache/spark/network/server/OneForOneStreamManager.java
|
OneForOneStreamManager.registerStream
|
public long registerStream(String appId, Iterator<ManagedBuffer> buffers, Channel channel) {
"""
Registers a stream of ManagedBuffers which are served as individual chunks one at a time to
callers. Each ManagedBuffer will be release()'d after it is transferred on the wire. If a
client connection is closed before the iterator is fully drained, then the remaining buffers
will all be release()'d.
If an app ID is provided, only callers who've authenticated with the given app ID will be
allowed to fetch from this stream.
This method also associates the stream with a single client connection, which is guaranteed
to be the only reader of the stream. Once the connection is closed, the stream will never
be used again, enabling cleanup by `connectionTerminated`.
"""
long myStreamId = nextStreamId.getAndIncrement();
streams.put(myStreamId, new StreamState(appId, buffers, channel));
return myStreamId;
}
|
java
|
public long registerStream(String appId, Iterator<ManagedBuffer> buffers, Channel channel) {
long myStreamId = nextStreamId.getAndIncrement();
streams.put(myStreamId, new StreamState(appId, buffers, channel));
return myStreamId;
}
|
[
"public",
"long",
"registerStream",
"(",
"String",
"appId",
",",
"Iterator",
"<",
"ManagedBuffer",
">",
"buffers",
",",
"Channel",
"channel",
")",
"{",
"long",
"myStreamId",
"=",
"nextStreamId",
".",
"getAndIncrement",
"(",
")",
";",
"streams",
".",
"put",
"(",
"myStreamId",
",",
"new",
"StreamState",
"(",
"appId",
",",
"buffers",
",",
"channel",
")",
")",
";",
"return",
"myStreamId",
";",
"}"
] |
Registers a stream of ManagedBuffers which are served as individual chunks one at a time to
callers. Each ManagedBuffer will be release()'d after it is transferred on the wire. If a
client connection is closed before the iterator is fully drained, then the remaining buffers
will all be release()'d.
If an app ID is provided, only callers who've authenticated with the given app ID will be
allowed to fetch from this stream.
This method also associates the stream with a single client connection, which is guaranteed
to be the only reader of the stream. Once the connection is closed, the stream will never
be used again, enabling cleanup by `connectionTerminated`.
|
[
"Registers",
"a",
"stream",
"of",
"ManagedBuffers",
"which",
"are",
"served",
"as",
"individual",
"chunks",
"one",
"at",
"a",
"time",
"to",
"callers",
".",
"Each",
"ManagedBuffer",
"will",
"be",
"release",
"()",
"d",
"after",
"it",
"is",
"transferred",
"on",
"the",
"wire",
".",
"If",
"a",
"client",
"connection",
"is",
"closed",
"before",
"the",
"iterator",
"is",
"fully",
"drained",
"then",
"the",
"remaining",
"buffers",
"will",
"all",
"be",
"release",
"()",
"d",
"."
] |
train
|
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/server/OneForOneStreamManager.java#L198-L202
|
algolia/algoliasearch-client-java
|
src/main/java/com/algolia/search/saas/APIClient.java
|
APIClient.getLogs
|
public JSONObject getLogs(int offset, int length, LogType logType) throws AlgoliaException {
"""
Return last logs entries.
@param offset Specify the first entry to retrieve (0-based, 0 is the most recent log entry).
@param length Specify the maximum number of entries to retrieve starting at offset. Maximum allowed value: 1000.
@param logType Specify the type of log to retrieve
"""
return this.getLogs(offset, length, logType, RequestOptions.empty);
}
|
java
|
public JSONObject getLogs(int offset, int length, LogType logType) throws AlgoliaException {
return this.getLogs(offset, length, logType, RequestOptions.empty);
}
|
[
"public",
"JSONObject",
"getLogs",
"(",
"int",
"offset",
",",
"int",
"length",
",",
"LogType",
"logType",
")",
"throws",
"AlgoliaException",
"{",
"return",
"this",
".",
"getLogs",
"(",
"offset",
",",
"length",
",",
"logType",
",",
"RequestOptions",
".",
"empty",
")",
";",
"}"
] |
Return last logs entries.
@param offset Specify the first entry to retrieve (0-based, 0 is the most recent log entry).
@param length Specify the maximum number of entries to retrieve starting at offset. Maximum allowed value: 1000.
@param logType Specify the type of log to retrieve
|
[
"Return",
"last",
"logs",
"entries",
"."
] |
train
|
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L472-L474
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/GroupBuilder.java
|
GroupBuilder.setAllowSplitting
|
public GroupBuilder setAllowSplitting(boolean headerSplit, boolean footerSplit) {
"""
*
pass-through property to setup group header and footer bands "allowSplit" property.
When FALSE, if the content reaches end of the page, the whole band gets pushed
to the next page.
@param headerSplit
@param footerSplit
@return
"""
group.setAllowHeaederSplit(headerSplit);
group.setAllowFooterSplit(footerSplit);
return this;
}
|
java
|
public GroupBuilder setAllowSplitting(boolean headerSplit, boolean footerSplit) {
group.setAllowHeaederSplit(headerSplit);
group.setAllowFooterSplit(footerSplit);
return this;
}
|
[
"public",
"GroupBuilder",
"setAllowSplitting",
"(",
"boolean",
"headerSplit",
",",
"boolean",
"footerSplit",
")",
"{",
"group",
".",
"setAllowHeaederSplit",
"(",
"headerSplit",
")",
";",
"group",
".",
"setAllowFooterSplit",
"(",
"footerSplit",
")",
";",
"return",
"this",
";",
"}"
] |
*
pass-through property to setup group header and footer bands "allowSplit" property.
When FALSE, if the content reaches end of the page, the whole band gets pushed
to the next page.
@param headerSplit
@param footerSplit
@return
|
[
"*",
"pass",
"-",
"through",
"property",
"to",
"setup",
"group",
"header",
"and",
"footer",
"bands",
"allowSplit",
"property",
".",
"When",
"FALSE",
"if",
"the",
"content",
"reaches",
"end",
"of",
"the",
"page",
"the",
"whole",
"band",
"gets",
"pushed",
"to",
"the",
"next",
"page",
"."
] |
train
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/GroupBuilder.java#L334-L338
|
elki-project/elki
|
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/CLIQUE.java
|
CLIQUE.updateMinMax
|
private void updateMinMax(NumberVector featureVector, double[] minima, double[] maxima) {
"""
Updates the minima and maxima array according to the specified feature
vector.
@param featureVector the feature vector
@param minima the array of minima
@param maxima the array of maxima
"""
assert (minima.length == featureVector.getDimensionality());
for(int d = 0; d < featureVector.getDimensionality(); d++) {
double v = featureVector.doubleValue(d);
if(v == v) { // Avoid NaN.
maxima[d] = MathUtil.max(v, maxima[d]);
minima[d] = MathUtil.min(v, minima[d]);
}
}
}
|
java
|
private void updateMinMax(NumberVector featureVector, double[] minima, double[] maxima) {
assert (minima.length == featureVector.getDimensionality());
for(int d = 0; d < featureVector.getDimensionality(); d++) {
double v = featureVector.doubleValue(d);
if(v == v) { // Avoid NaN.
maxima[d] = MathUtil.max(v, maxima[d]);
minima[d] = MathUtil.min(v, minima[d]);
}
}
}
|
[
"private",
"void",
"updateMinMax",
"(",
"NumberVector",
"featureVector",
",",
"double",
"[",
"]",
"minima",
",",
"double",
"[",
"]",
"maxima",
")",
"{",
"assert",
"(",
"minima",
".",
"length",
"==",
"featureVector",
".",
"getDimensionality",
"(",
")",
")",
";",
"for",
"(",
"int",
"d",
"=",
"0",
";",
"d",
"<",
"featureVector",
".",
"getDimensionality",
"(",
")",
";",
"d",
"++",
")",
"{",
"double",
"v",
"=",
"featureVector",
".",
"doubleValue",
"(",
"d",
")",
";",
"if",
"(",
"v",
"==",
"v",
")",
"{",
"// Avoid NaN.",
"maxima",
"[",
"d",
"]",
"=",
"MathUtil",
".",
"max",
"(",
"v",
",",
"maxima",
"[",
"d",
"]",
")",
";",
"minima",
"[",
"d",
"]",
"=",
"MathUtil",
".",
"min",
"(",
"v",
",",
"minima",
"[",
"d",
"]",
")",
";",
"}",
"}",
"}"
] |
Updates the minima and maxima array according to the specified feature
vector.
@param featureVector the feature vector
@param minima the array of minima
@param maxima the array of maxima
|
[
"Updates",
"the",
"minima",
"and",
"maxima",
"array",
"according",
"to",
"the",
"specified",
"feature",
"vector",
"."
] |
train
|
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/CLIQUE.java#L304-L313
|
elki-project/elki
|
elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java
|
DBIDUtil.randomSample
|
public static DBIDVar randomSample(DBIDs ids, RandomFactory random) {
"""
Draw a single random sample.
@param ids IDs to draw from
@param random Random value
@return Random ID
"""
return randomSample(ids, random.getSingleThreadedRandom());
}
|
java
|
public static DBIDVar randomSample(DBIDs ids, RandomFactory random) {
return randomSample(ids, random.getSingleThreadedRandom());
}
|
[
"public",
"static",
"DBIDVar",
"randomSample",
"(",
"DBIDs",
"ids",
",",
"RandomFactory",
"random",
")",
"{",
"return",
"randomSample",
"(",
"ids",
",",
"random",
".",
"getSingleThreadedRandom",
"(",
")",
")",
";",
"}"
] |
Draw a single random sample.
@param ids IDs to draw from
@param random Random value
@return Random ID
|
[
"Draw",
"a",
"single",
"random",
"sample",
"."
] |
train
|
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java#L725-L727
|
alkacon/opencms-core
|
src/org/opencms/xml/containerpage/CmsXmlContainerPage.java
|
CmsXmlContainerPage.createContainerPageXml
|
public byte[] createContainerPageXml(CmsObject cms, CmsContainerPageBean cntPage) throws CmsException {
"""
Saves a container page bean to the in-memory XML structure and returns the changed content.<p>
@param cms the current CMS context
@param cntPage the container page bean
@return the new content for the container page
@throws CmsException if something goes wrong
"""
// make sure all links are validated
writeContainerPage(cms, cntPage);
checkLinkConcistency(cms);
return marshal();
}
|
java
|
public byte[] createContainerPageXml(CmsObject cms, CmsContainerPageBean cntPage) throws CmsException {
// make sure all links are validated
writeContainerPage(cms, cntPage);
checkLinkConcistency(cms);
return marshal();
}
|
[
"public",
"byte",
"[",
"]",
"createContainerPageXml",
"(",
"CmsObject",
"cms",
",",
"CmsContainerPageBean",
"cntPage",
")",
"throws",
"CmsException",
"{",
"// make sure all links are validated",
"writeContainerPage",
"(",
"cms",
",",
"cntPage",
")",
";",
"checkLinkConcistency",
"(",
"cms",
")",
";",
"return",
"marshal",
"(",
")",
";",
"}"
] |
Saves a container page bean to the in-memory XML structure and returns the changed content.<p>
@param cms the current CMS context
@param cntPage the container page bean
@return the new content for the container page
@throws CmsException if something goes wrong
|
[
"Saves",
"a",
"container",
"page",
"bean",
"to",
"the",
"in",
"-",
"memory",
"XML",
"structure",
"and",
"returns",
"the",
"changed",
"content",
".",
"<p",
">"
] |
train
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsXmlContainerPage.java#L225-L232
|
OpenLiberty/open-liberty
|
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/provisioning/ContentBasedLocalBundleRepository.java
|
ContentBasedLocalBundleRepository.selectBaseBundle
|
public File selectBaseBundle(String baseLocation, final String symbolicName, final VersionRange versionRange) {
"""
This method can be used to obtain the 'base' bundle for a given 'selected' bundle.
The {@link ContentBasedLocalBundleRepository#selectBundle} Will select a Bundle, which may or
may not be an ifix.
When the selectedBundle is an ifix, this method will return the corresponding bundle that has been 'ifixed'.
If the selectedBundle is not an ifix, this method will return the selected bundle.
@param baseLocation The base location.
@param symbolicName The desired symbolic name.
@param versionRange The range of versions that can be selected.
@return The file representing the chosen bundle.
"""
readCache();
return selectResource(baseLocation, symbolicName, versionRange,
true, //performURICheck=true
true //selectBaseBundle=true
);
}
|
java
|
public File selectBaseBundle(String baseLocation, final String symbolicName, final VersionRange versionRange) {
readCache();
return selectResource(baseLocation, symbolicName, versionRange,
true, //performURICheck=true
true //selectBaseBundle=true
);
}
|
[
"public",
"File",
"selectBaseBundle",
"(",
"String",
"baseLocation",
",",
"final",
"String",
"symbolicName",
",",
"final",
"VersionRange",
"versionRange",
")",
"{",
"readCache",
"(",
")",
";",
"return",
"selectResource",
"(",
"baseLocation",
",",
"symbolicName",
",",
"versionRange",
",",
"true",
",",
"//performURICheck=true",
"true",
"//selectBaseBundle=true",
")",
";",
"}"
] |
This method can be used to obtain the 'base' bundle for a given 'selected' bundle.
The {@link ContentBasedLocalBundleRepository#selectBundle} Will select a Bundle, which may or
may not be an ifix.
When the selectedBundle is an ifix, this method will return the corresponding bundle that has been 'ifixed'.
If the selectedBundle is not an ifix, this method will return the selected bundle.
@param baseLocation The base location.
@param symbolicName The desired symbolic name.
@param versionRange The range of versions that can be selected.
@return The file representing the chosen bundle.
|
[
"This",
"method",
"can",
"be",
"used",
"to",
"obtain",
"the",
"base",
"bundle",
"for",
"a",
"given",
"selected",
"bundle",
".",
"The",
"{",
"@link",
"ContentBasedLocalBundleRepository#selectBundle",
"}",
"Will",
"select",
"a",
"Bundle",
"which",
"may",
"or",
"may",
"not",
"be",
"an",
"ifix",
".",
"When",
"the",
"selectedBundle",
"is",
"an",
"ifix",
"this",
"method",
"will",
"return",
"the",
"corresponding",
"bundle",
"that",
"has",
"been",
"ifixed",
".",
"If",
"the",
"selectedBundle",
"is",
"not",
"an",
"ifix",
"this",
"method",
"will",
"return",
"the",
"selected",
"bundle",
"."
] |
train
|
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/provisioning/ContentBasedLocalBundleRepository.java#L343-L349
|
ModeShape/modeshape
|
modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java
|
CheckArg.isInstanceOf
|
public static void isInstanceOf( Object argument,
Class<?> expectedClass,
String name ) {
"""
Check that the object is an instance of the specified Class
@param argument Value
@param expectedClass Class
@param name The name of the argument
@throws IllegalArgumentException If value is null
"""
isNotNull(argument, name);
if (!expectedClass.isInstance(argument)) {
throw new IllegalArgumentException(CommonI18n.argumentMustBeInstanceOf.text(name, argument.getClass(),
expectedClass.getName()));
}
}
|
java
|
public static void isInstanceOf( Object argument,
Class<?> expectedClass,
String name ) {
isNotNull(argument, name);
if (!expectedClass.isInstance(argument)) {
throw new IllegalArgumentException(CommonI18n.argumentMustBeInstanceOf.text(name, argument.getClass(),
expectedClass.getName()));
}
}
|
[
"public",
"static",
"void",
"isInstanceOf",
"(",
"Object",
"argument",
",",
"Class",
"<",
"?",
">",
"expectedClass",
",",
"String",
"name",
")",
"{",
"isNotNull",
"(",
"argument",
",",
"name",
")",
";",
"if",
"(",
"!",
"expectedClass",
".",
"isInstance",
"(",
"argument",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"CommonI18n",
".",
"argumentMustBeInstanceOf",
".",
"text",
"(",
"name",
",",
"argument",
".",
"getClass",
"(",
")",
",",
"expectedClass",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"}"
] |
Check that the object is an instance of the specified Class
@param argument Value
@param expectedClass Class
@param name The name of the argument
@throws IllegalArgumentException If value is null
|
[
"Check",
"that",
"the",
"object",
"is",
"an",
"instance",
"of",
"the",
"specified",
"Class"
] |
train
|
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java#L432-L440
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
|
DomHelper.deleteElement
|
public void deleteElement(Object parent, String name) {
"""
Delete this element from the graphics DOM structure.
@param parent
parent group object
@param name
The element's name.
"""
Element element = getElement(parent, name);
if (element != null) {
Element group = (Element) element.getParentElement();
if (group != null) {
deleteRecursively(group, element);
}
}
}
|
java
|
public void deleteElement(Object parent, String name) {
Element element = getElement(parent, name);
if (element != null) {
Element group = (Element) element.getParentElement();
if (group != null) {
deleteRecursively(group, element);
}
}
}
|
[
"public",
"void",
"deleteElement",
"(",
"Object",
"parent",
",",
"String",
"name",
")",
"{",
"Element",
"element",
"=",
"getElement",
"(",
"parent",
",",
"name",
")",
";",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"Element",
"group",
"=",
"(",
"Element",
")",
"element",
".",
"getParentElement",
"(",
")",
";",
"if",
"(",
"group",
"!=",
"null",
")",
"{",
"deleteRecursively",
"(",
"group",
",",
"element",
")",
";",
"}",
"}",
"}"
] |
Delete this element from the graphics DOM structure.
@param parent
parent group object
@param name
The element's name.
|
[
"Delete",
"this",
"element",
"from",
"the",
"graphics",
"DOM",
"structure",
"."
] |
train
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L917-L925
|
drinkjava2/jBeanBox
|
jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/commons/SerialVersionUIDAdder.java
|
SerialVersionUIDAdder.visitField
|
@Override
public FieldVisitor visitField(final int access, final String name,
final String desc, final String signature, final Object value) {
"""
/*
Gets class field information for step 4 of the algorithm. Also determines
if the class already has a SVUID.
"""
if (computeSVUID) {
if ("serialVersionUID".equals(name)) {
// since the class already has SVUID, we won't be computing it.
computeSVUID = false;
hasSVUID = true;
}
/*
* Remember field for SVUID computation For field modifiers, only
* the ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC,
* ACC_FINAL, ACC_VOLATILE, and ACC_TRANSIENT flags are used when
* computing serialVersionUID values.
*/
if ((access & Opcodes.ACC_PRIVATE) == 0
|| (access & (Opcodes.ACC_STATIC | Opcodes.ACC_TRANSIENT)) == 0) {
int mods = access
& (Opcodes.ACC_PUBLIC | Opcodes.ACC_PRIVATE
| Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC
| Opcodes.ACC_FINAL | Opcodes.ACC_VOLATILE | Opcodes.ACC_TRANSIENT);
svuidFields.add(new Item(name, mods, desc));
}
}
return super.visitField(access, name, desc, signature, value);
}
|
java
|
@Override
public FieldVisitor visitField(final int access, final String name,
final String desc, final String signature, final Object value) {
if (computeSVUID) {
if ("serialVersionUID".equals(name)) {
// since the class already has SVUID, we won't be computing it.
computeSVUID = false;
hasSVUID = true;
}
/*
* Remember field for SVUID computation For field modifiers, only
* the ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC,
* ACC_FINAL, ACC_VOLATILE, and ACC_TRANSIENT flags are used when
* computing serialVersionUID values.
*/
if ((access & Opcodes.ACC_PRIVATE) == 0
|| (access & (Opcodes.ACC_STATIC | Opcodes.ACC_TRANSIENT)) == 0) {
int mods = access
& (Opcodes.ACC_PUBLIC | Opcodes.ACC_PRIVATE
| Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC
| Opcodes.ACC_FINAL | Opcodes.ACC_VOLATILE | Opcodes.ACC_TRANSIENT);
svuidFields.add(new Item(name, mods, desc));
}
}
return super.visitField(access, name, desc, signature, value);
}
|
[
"@",
"Override",
"public",
"FieldVisitor",
"visitField",
"(",
"final",
"int",
"access",
",",
"final",
"String",
"name",
",",
"final",
"String",
"desc",
",",
"final",
"String",
"signature",
",",
"final",
"Object",
"value",
")",
"{",
"if",
"(",
"computeSVUID",
")",
"{",
"if",
"(",
"\"serialVersionUID\"",
".",
"equals",
"(",
"name",
")",
")",
"{",
"// since the class already has SVUID, we won't be computing it.",
"computeSVUID",
"=",
"false",
";",
"hasSVUID",
"=",
"true",
";",
"}",
"/*\n * Remember field for SVUID computation For field modifiers, only\n * the ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC,\n * ACC_FINAL, ACC_VOLATILE, and ACC_TRANSIENT flags are used when\n * computing serialVersionUID values.\n */",
"if",
"(",
"(",
"access",
"&",
"Opcodes",
".",
"ACC_PRIVATE",
")",
"==",
"0",
"||",
"(",
"access",
"&",
"(",
"Opcodes",
".",
"ACC_STATIC",
"|",
"Opcodes",
".",
"ACC_TRANSIENT",
")",
")",
"==",
"0",
")",
"{",
"int",
"mods",
"=",
"access",
"&",
"(",
"Opcodes",
".",
"ACC_PUBLIC",
"|",
"Opcodes",
".",
"ACC_PRIVATE",
"|",
"Opcodes",
".",
"ACC_PROTECTED",
"|",
"Opcodes",
".",
"ACC_STATIC",
"|",
"Opcodes",
".",
"ACC_FINAL",
"|",
"Opcodes",
".",
"ACC_VOLATILE",
"|",
"Opcodes",
".",
"ACC_TRANSIENT",
")",
";",
"svuidFields",
".",
"add",
"(",
"new",
"Item",
"(",
"name",
",",
"mods",
",",
"desc",
")",
")",
";",
"}",
"}",
"return",
"super",
".",
"visitField",
"(",
"access",
",",
"name",
",",
"desc",
",",
"signature",
",",
"value",
")",
";",
"}"
] |
/*
Gets class field information for step 4 of the algorithm. Also determines
if the class already has a SVUID.
|
[
"/",
"*",
"Gets",
"class",
"field",
"information",
"for",
"step",
"4",
"of",
"the",
"algorithm",
".",
"Also",
"determines",
"if",
"the",
"class",
"already",
"has",
"a",
"SVUID",
"."
] |
train
|
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/commons/SerialVersionUIDAdder.java#L262-L288
|
b3dgs/lionengine
|
lionengine-network/src/main/java/com/b3dgs/lionengine/network/message/NetworkMessageEntity.java
|
NetworkMessageEntity.addAction
|
public void addAction(M element, boolean value) {
"""
Add an action.
@param element The action type.
@param value The action value.
"""
actions.put(element, Boolean.valueOf(value));
}
|
java
|
public void addAction(M element, boolean value)
{
actions.put(element, Boolean.valueOf(value));
}
|
[
"public",
"void",
"addAction",
"(",
"M",
"element",
",",
"boolean",
"value",
")",
"{",
"actions",
".",
"put",
"(",
"element",
",",
"Boolean",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"}"
] |
Add an action.
@param element The action type.
@param value The action value.
|
[
"Add",
"an",
"action",
"."
] |
train
|
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-network/src/main/java/com/b3dgs/lionengine/network/message/NetworkMessageEntity.java#L111-L114
|
puniverse/capsule
|
capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java
|
Jar.getListAttribute
|
public List<String> getListAttribute(String section, String name) {
"""
Returns an attribute's list value from a non-main section of this JAR's manifest.
The attributes string value will be split on whitespace into the returned list.
The returned list may be safely modified.
@param section the manifest's section
@param name the attribute's name
"""
return split(getAttribute(section, name));
}
|
java
|
public List<String> getListAttribute(String section, String name) {
return split(getAttribute(section, name));
}
|
[
"public",
"List",
"<",
"String",
">",
"getListAttribute",
"(",
"String",
"section",
",",
"String",
"name",
")",
"{",
"return",
"split",
"(",
"getAttribute",
"(",
"section",
",",
"name",
")",
")",
";",
"}"
] |
Returns an attribute's list value from a non-main section of this JAR's manifest.
The attributes string value will be split on whitespace into the returned list.
The returned list may be safely modified.
@param section the manifest's section
@param name the attribute's name
|
[
"Returns",
"an",
"attribute",
"s",
"list",
"value",
"from",
"a",
"non",
"-",
"main",
"section",
"of",
"this",
"JAR",
"s",
"manifest",
".",
"The",
"attributes",
"string",
"value",
"will",
"be",
"split",
"on",
"whitespace",
"into",
"the",
"returned",
"list",
".",
"The",
"returned",
"list",
"may",
"be",
"safely",
"modified",
"."
] |
train
|
https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L258-L260
|
dbflute-session/tomcat-boot
|
src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java
|
BotmReflectionUtil.getPublicMethodFlexibly
|
public static Method getPublicMethodFlexibly(Class<?> clazz, String methodName, Class<?>[] argTypes) {
"""
Get the public method. <br>
And it has the flexibly searching so you can specify types of sub-class to argTypes. <br>
But if overload methods exist, it returns the first-found method. <br>
And no cache so you should cache it yourself if you call several times. <br>
@param clazz The type of class that defines the method. (NotNull)
@param methodName The name of method. (NotNull)
@param argTypes The type of argument. (NotNull)
@return The instance of method. (NullAllowed: if null, not found)
"""
assertObjectNotNull("clazz", clazz);
assertStringNotNullAndNotTrimmedEmpty("methodName", methodName);
return findMethod(clazz, methodName, argTypes, VisibilityType.PUBLIC, true);
}
|
java
|
public static Method getPublicMethodFlexibly(Class<?> clazz, String methodName, Class<?>[] argTypes) {
assertObjectNotNull("clazz", clazz);
assertStringNotNullAndNotTrimmedEmpty("methodName", methodName);
return findMethod(clazz, methodName, argTypes, VisibilityType.PUBLIC, true);
}
|
[
"public",
"static",
"Method",
"getPublicMethodFlexibly",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"argTypes",
")",
"{",
"assertObjectNotNull",
"(",
"\"clazz\"",
",",
"clazz",
")",
";",
"assertStringNotNullAndNotTrimmedEmpty",
"(",
"\"methodName\"",
",",
"methodName",
")",
";",
"return",
"findMethod",
"(",
"clazz",
",",
"methodName",
",",
"argTypes",
",",
"VisibilityType",
".",
"PUBLIC",
",",
"true",
")",
";",
"}"
] |
Get the public method. <br>
And it has the flexibly searching so you can specify types of sub-class to argTypes. <br>
But if overload methods exist, it returns the first-found method. <br>
And no cache so you should cache it yourself if you call several times. <br>
@param clazz The type of class that defines the method. (NotNull)
@param methodName The name of method. (NotNull)
@param argTypes The type of argument. (NotNull)
@return The instance of method. (NullAllowed: if null, not found)
|
[
"Get",
"the",
"public",
"method",
".",
"<br",
">",
"And",
"it",
"has",
"the",
"flexibly",
"searching",
"so",
"you",
"can",
"specify",
"types",
"of",
"sub",
"-",
"class",
"to",
"argTypes",
".",
"<br",
">",
"But",
"if",
"overload",
"methods",
"exist",
"it",
"returns",
"the",
"first",
"-",
"found",
"method",
".",
"<br",
">",
"And",
"no",
"cache",
"so",
"you",
"should",
"cache",
"it",
"yourself",
"if",
"you",
"call",
"several",
"times",
".",
"<br",
">"
] |
train
|
https://github.com/dbflute-session/tomcat-boot/blob/fe941f88b6be083781873126f5b12d4c16bb9073/src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java#L384-L388
|
googleads/googleads-java-lib
|
modules/ads_lib_axis/src/main/java/com/google/api/ads/common/lib/soap/axis/AxisHandler.java
|
AxisHandler.setCompression
|
@Override
public void setCompression(Stub soapClient, boolean compress) {
"""
Set whether SOAP requests should use compression.
@param soapClient the client to set compression settings for
@param compress whether or not to use compression
"""
soapClient._setProperty(HTTPConstants.MC_ACCEPT_GZIP, compress);
soapClient._setProperty(HTTPConstants.MC_GZIP_REQUEST, compress);
}
|
java
|
@Override
public void setCompression(Stub soapClient, boolean compress) {
soapClient._setProperty(HTTPConstants.MC_ACCEPT_GZIP, compress);
soapClient._setProperty(HTTPConstants.MC_GZIP_REQUEST, compress);
}
|
[
"@",
"Override",
"public",
"void",
"setCompression",
"(",
"Stub",
"soapClient",
",",
"boolean",
"compress",
")",
"{",
"soapClient",
".",
"_setProperty",
"(",
"HTTPConstants",
".",
"MC_ACCEPT_GZIP",
",",
"compress",
")",
";",
"soapClient",
".",
"_setProperty",
"(",
"HTTPConstants",
".",
"MC_GZIP_REQUEST",
",",
"compress",
")",
";",
"}"
] |
Set whether SOAP requests should use compression.
@param soapClient the client to set compression settings for
@param compress whether or not to use compression
|
[
"Set",
"whether",
"SOAP",
"requests",
"should",
"use",
"compression",
"."
] |
train
|
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib_axis/src/main/java/com/google/api/ads/common/lib/soap/axis/AxisHandler.java#L175-L179
|
threerings/nenya
|
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
|
SubtitleChatOverlay.displayMessage
|
protected void displayMessage (ChatMessage message, Graphics2D gfx) {
"""
Display the specified message now, unless we are to ignore it.
"""
// get the non-history message type...
int type = getType(message, false);
if (type != ChatLogic.IGNORECHAT) {
// display it now
displayMessage(message, type, gfx);
}
}
|
java
|
protected void displayMessage (ChatMessage message, Graphics2D gfx)
{
// get the non-history message type...
int type = getType(message, false);
if (type != ChatLogic.IGNORECHAT) {
// display it now
displayMessage(message, type, gfx);
}
}
|
[
"protected",
"void",
"displayMessage",
"(",
"ChatMessage",
"message",
",",
"Graphics2D",
"gfx",
")",
"{",
"// get the non-history message type...",
"int",
"type",
"=",
"getType",
"(",
"message",
",",
"false",
")",
";",
"if",
"(",
"type",
"!=",
"ChatLogic",
".",
"IGNORECHAT",
")",
"{",
"// display it now",
"displayMessage",
"(",
"message",
",",
"type",
",",
"gfx",
")",
";",
"}",
"}"
] |
Display the specified message now, unless we are to ignore it.
|
[
"Display",
"the",
"specified",
"message",
"now",
"unless",
"we",
"are",
"to",
"ignore",
"it",
"."
] |
train
|
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L559-L567
|
kuali/ojb-1.0.4
|
src/java/org/apache/ojb/odmg/TransactionImpl.java
|
TransactionImpl.setCascadingDelete
|
public void setCascadingDelete(Class target, boolean doCascade) {
"""
Allows to change the <em>cascading delete</em> behavior of all references of the
specified class while this transaction is in use - if the specified class is an
interface, abstract class or class with "extent" classes the cascading flag will
be propagated.
@param target The class to change cascading delete behavior of all references.
@param doCascade If <em>true</em> cascading delete is enabled, <em>false</em> disabled.
"""
ClassDescriptor cld = getBroker().getClassDescriptor(target);
List extents = cld.getExtentClasses();
Boolean result = doCascade ? Boolean.TRUE : Boolean.FALSE;
setCascadingDelete(cld, result);
if(extents != null && extents.size() > 0)
{
for(int i = 0; i < extents.size(); i++)
{
Class extent = (Class) extents.get(i);
ClassDescriptor tmp = getBroker().getClassDescriptor(extent);
setCascadingDelete(tmp, result);
}
}
}
|
java
|
public void setCascadingDelete(Class target, boolean doCascade)
{
ClassDescriptor cld = getBroker().getClassDescriptor(target);
List extents = cld.getExtentClasses();
Boolean result = doCascade ? Boolean.TRUE : Boolean.FALSE;
setCascadingDelete(cld, result);
if(extents != null && extents.size() > 0)
{
for(int i = 0; i < extents.size(); i++)
{
Class extent = (Class) extents.get(i);
ClassDescriptor tmp = getBroker().getClassDescriptor(extent);
setCascadingDelete(tmp, result);
}
}
}
|
[
"public",
"void",
"setCascadingDelete",
"(",
"Class",
"target",
",",
"boolean",
"doCascade",
")",
"{",
"ClassDescriptor",
"cld",
"=",
"getBroker",
"(",
")",
".",
"getClassDescriptor",
"(",
"target",
")",
";",
"List",
"extents",
"=",
"cld",
".",
"getExtentClasses",
"(",
")",
";",
"Boolean",
"result",
"=",
"doCascade",
"?",
"Boolean",
".",
"TRUE",
":",
"Boolean",
".",
"FALSE",
";",
"setCascadingDelete",
"(",
"cld",
",",
"result",
")",
";",
"if",
"(",
"extents",
"!=",
"null",
"&&",
"extents",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"extents",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Class",
"extent",
"=",
"(",
"Class",
")",
"extents",
".",
"get",
"(",
"i",
")",
";",
"ClassDescriptor",
"tmp",
"=",
"getBroker",
"(",
")",
".",
"getClassDescriptor",
"(",
"extent",
")",
";",
"setCascadingDelete",
"(",
"tmp",
",",
"result",
")",
";",
"}",
"}",
"}"
] |
Allows to change the <em>cascading delete</em> behavior of all references of the
specified class while this transaction is in use - if the specified class is an
interface, abstract class or class with "extent" classes the cascading flag will
be propagated.
@param target The class to change cascading delete behavior of all references.
@param doCascade If <em>true</em> cascading delete is enabled, <em>false</em> disabled.
|
[
"Allows",
"to",
"change",
"the",
"<em",
">",
"cascading",
"delete<",
"/",
"em",
">",
"behavior",
"of",
"all",
"references",
"of",
"the",
"specified",
"class",
"while",
"this",
"transaction",
"is",
"in",
"use",
"-",
"if",
"the",
"specified",
"class",
"is",
"an",
"interface",
"abstract",
"class",
"or",
"class",
"with",
"extent",
"classes",
"the",
"cascading",
"flag",
"will",
"be",
"propagated",
"."
] |
train
|
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/TransactionImpl.java#L1420-L1435
|
samskivert/samskivert
|
src/main/java/com/samskivert/servlet/util/CookieUtil.java
|
CookieUtil.getCookieValue
|
public static String getCookieValue (HttpServletRequest req, String name) {
"""
Get the value of the cookie for the cookie of the specified name, or null if not found.
"""
Cookie c = getCookie(req, name);
return (c == null) ? null : c.getValue();
}
|
java
|
public static String getCookieValue (HttpServletRequest req, String name)
{
Cookie c = getCookie(req, name);
return (c == null) ? null : c.getValue();
}
|
[
"public",
"static",
"String",
"getCookieValue",
"(",
"HttpServletRequest",
"req",
",",
"String",
"name",
")",
"{",
"Cookie",
"c",
"=",
"getCookie",
"(",
"req",
",",
"name",
")",
";",
"return",
"(",
"c",
"==",
"null",
")",
"?",
"null",
":",
"c",
".",
"getValue",
"(",
")",
";",
"}"
] |
Get the value of the cookie for the cookie of the specified name, or null if not found.
|
[
"Get",
"the",
"value",
"of",
"the",
"cookie",
"for",
"the",
"cookie",
"of",
"the",
"specified",
"name",
"or",
"null",
"if",
"not",
"found",
"."
] |
train
|
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/util/CookieUtil.java#L37-L41
|
Azure/azure-sdk-for-java
|
mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/MixedRealityClientImpl.java
|
MixedRealityClientImpl.checkNameAvailabilityLocal
|
public CheckNameAvailabilityResponseInner checkNameAvailabilityLocal(String location, CheckNameAvailabilityRequest checkNameAvailability) {
"""
Check Name Availability for global uniqueness.
@param location The location in which uniqueness will be verified.
@param checkNameAvailability Check Name Availability Request.
@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 CheckNameAvailabilityResponseInner object if successful.
"""
return checkNameAvailabilityLocalWithServiceResponseAsync(location, checkNameAvailability).toBlocking().single().body();
}
|
java
|
public CheckNameAvailabilityResponseInner checkNameAvailabilityLocal(String location, CheckNameAvailabilityRequest checkNameAvailability) {
return checkNameAvailabilityLocalWithServiceResponseAsync(location, checkNameAvailability).toBlocking().single().body();
}
|
[
"public",
"CheckNameAvailabilityResponseInner",
"checkNameAvailabilityLocal",
"(",
"String",
"location",
",",
"CheckNameAvailabilityRequest",
"checkNameAvailability",
")",
"{",
"return",
"checkNameAvailabilityLocalWithServiceResponseAsync",
"(",
"location",
",",
"checkNameAvailability",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Check Name Availability for global uniqueness.
@param location The location in which uniqueness will be verified.
@param checkNameAvailability Check Name Availability Request.
@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 CheckNameAvailabilityResponseInner object if successful.
|
[
"Check",
"Name",
"Availability",
"for",
"global",
"uniqueness",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/MixedRealityClientImpl.java#L257-L259
|
jcuda/jcuda
|
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
|
JCuda.cudaBindTextureToMipmappedArray
|
public static int cudaBindTextureToMipmappedArray(textureReference texref, cudaMipmappedArray mipmappedArray, cudaChannelFormatDesc desc) {
"""
[C++ API] Binds a mipmapped array to a texture
<pre>
template < class T, int dim, enum cudaTextureReadMode readMode >
cudaError_t cudaBindTextureToMipmappedArray (
const texture < T,
dim,
readMode > & tex,
cudaMipmappedArray_const_t mipmappedArray,
const cudaChannelFormatDesc& desc ) [inline]
</pre>
<div>
<p>[C++ API] Binds a mipmapped array to a
texture Binds the CUDA mipmapped array <tt>mipmappedArray</tt> to
the texture reference <tt>tex</tt>. <tt>desc</tt> describes how the
memory is interpreted when fetching values from the texture. Any CUDA
mipmapped array previously bound
to <tt>tex</tt> is unbound.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param texref Texture to bind
@param mipmappedArray Memory mipmapped array on device
@param desc Channel format
@param tex Texture to bind
@param mipmappedArray Memory mipmapped array on device
@param tex Texture to bind
@param mipmappedArray Memory mipmapped array on device
@param desc Channel format
@return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer,
cudaErrorInvalidTexture
@see JCuda#cudaCreateChannelDesc
@see JCuda#cudaGetChannelDesc
@see JCuda#cudaGetTextureReference
@see JCuda#cudaBindTexture
@see JCuda#cudaBindTexture
@see JCuda#cudaBindTexture2D
@see JCuda#cudaBindTexture2D
@see JCuda#cudaBindTextureToArray
@see JCuda#cudaBindTextureToArray
@see JCuda#cudaUnbindTexture
@see JCuda#cudaGetTextureAlignmentOffset
"""
return checkResult(cudaBindTextureToMipmappedArrayNative(texref, mipmappedArray, desc));
}
|
java
|
public static int cudaBindTextureToMipmappedArray(textureReference texref, cudaMipmappedArray mipmappedArray, cudaChannelFormatDesc desc)
{
return checkResult(cudaBindTextureToMipmappedArrayNative(texref, mipmappedArray, desc));
}
|
[
"public",
"static",
"int",
"cudaBindTextureToMipmappedArray",
"(",
"textureReference",
"texref",
",",
"cudaMipmappedArray",
"mipmappedArray",
",",
"cudaChannelFormatDesc",
"desc",
")",
"{",
"return",
"checkResult",
"(",
"cudaBindTextureToMipmappedArrayNative",
"(",
"texref",
",",
"mipmappedArray",
",",
"desc",
")",
")",
";",
"}"
] |
[C++ API] Binds a mipmapped array to a texture
<pre>
template < class T, int dim, enum cudaTextureReadMode readMode >
cudaError_t cudaBindTextureToMipmappedArray (
const texture < T,
dim,
readMode > & tex,
cudaMipmappedArray_const_t mipmappedArray,
const cudaChannelFormatDesc& desc ) [inline]
</pre>
<div>
<p>[C++ API] Binds a mipmapped array to a
texture Binds the CUDA mipmapped array <tt>mipmappedArray</tt> to
the texture reference <tt>tex</tt>. <tt>desc</tt> describes how the
memory is interpreted when fetching values from the texture. Any CUDA
mipmapped array previously bound
to <tt>tex</tt> is unbound.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param texref Texture to bind
@param mipmappedArray Memory mipmapped array on device
@param desc Channel format
@param tex Texture to bind
@param mipmappedArray Memory mipmapped array on device
@param tex Texture to bind
@param mipmappedArray Memory mipmapped array on device
@param desc Channel format
@return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer,
cudaErrorInvalidTexture
@see JCuda#cudaCreateChannelDesc
@see JCuda#cudaGetChannelDesc
@see JCuda#cudaGetTextureReference
@see JCuda#cudaBindTexture
@see JCuda#cudaBindTexture
@see JCuda#cudaBindTexture2D
@see JCuda#cudaBindTexture2D
@see JCuda#cudaBindTextureToArray
@see JCuda#cudaBindTextureToArray
@see JCuda#cudaUnbindTexture
@see JCuda#cudaGetTextureAlignmentOffset
|
[
"[",
"C",
"++",
"API",
"]",
"Binds",
"a",
"mipmapped",
"array",
"to",
"a",
"texture"
] |
train
|
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L9273-L9276
|
phax/ph-commons
|
ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java
|
ByteBufferOutputStream.writeTo
|
public void writeTo (@Nonnull final byte [] aBuf, final boolean bCompactBuffer) {
"""
Writes the current content to the passed buffer. The copied elements are
removed from this streams buffer.
@param aBuf
The buffer to be filled. May not be <code>null</code>.
@param bCompactBuffer
<code>true</code> to compact the buffer afterwards,
<code>false</code> otherwise.
"""
ValueEnforcer.notNull (aBuf, "Buffer");
writeTo (aBuf, 0, aBuf.length, bCompactBuffer);
}
|
java
|
public void writeTo (@Nonnull final byte [] aBuf, final boolean bCompactBuffer)
{
ValueEnforcer.notNull (aBuf, "Buffer");
writeTo (aBuf, 0, aBuf.length, bCompactBuffer);
}
|
[
"public",
"void",
"writeTo",
"(",
"@",
"Nonnull",
"final",
"byte",
"[",
"]",
"aBuf",
",",
"final",
"boolean",
"bCompactBuffer",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aBuf",
",",
"\"Buffer\"",
")",
";",
"writeTo",
"(",
"aBuf",
",",
"0",
",",
"aBuf",
".",
"length",
",",
"bCompactBuffer",
")",
";",
"}"
] |
Writes the current content to the passed buffer. The copied elements are
removed from this streams buffer.
@param aBuf
The buffer to be filled. May not be <code>null</code>.
@param bCompactBuffer
<code>true</code> to compact the buffer afterwards,
<code>false</code> otherwise.
|
[
"Writes",
"the",
"current",
"content",
"to",
"the",
"passed",
"buffer",
".",
"The",
"copied",
"elements",
"are",
"removed",
"from",
"this",
"streams",
"buffer",
"."
] |
train
|
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java#L263-L268
|
Stratio/stratio-cassandra
|
src/java/org/apache/cassandra/cli/CliClient.java
|
CliClient.columnValueAsBytes
|
private ByteBuffer columnValueAsBytes(ByteBuffer columnName, String columnFamilyName, String columnValue) {
"""
Converts column value into byte[] according to validation class
@param columnName - column name to which value belongs
@param columnFamilyName - column family name
@param columnValue - actual column value
@return value in byte array representation
"""
CfDef columnFamilyDef = getCfDef(columnFamilyName);
AbstractType<?> defaultValidator = getFormatType(columnFamilyDef.default_validation_class);
for (ColumnDef columnDefinition : columnFamilyDef.getColumn_metadata())
{
byte[] currentColumnName = columnDefinition.getName();
if (ByteBufferUtil.compare(currentColumnName, columnName) == 0)
{
try
{
String validationClass = columnDefinition.getValidation_class();
return getBytesAccordingToType(columnValue, getFormatType(validationClass));
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
}
return defaultValidator.fromString(columnValue);
}
|
java
|
private ByteBuffer columnValueAsBytes(ByteBuffer columnName, String columnFamilyName, String columnValue)
{
CfDef columnFamilyDef = getCfDef(columnFamilyName);
AbstractType<?> defaultValidator = getFormatType(columnFamilyDef.default_validation_class);
for (ColumnDef columnDefinition : columnFamilyDef.getColumn_metadata())
{
byte[] currentColumnName = columnDefinition.getName();
if (ByteBufferUtil.compare(currentColumnName, columnName) == 0)
{
try
{
String validationClass = columnDefinition.getValidation_class();
return getBytesAccordingToType(columnValue, getFormatType(validationClass));
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
}
return defaultValidator.fromString(columnValue);
}
|
[
"private",
"ByteBuffer",
"columnValueAsBytes",
"(",
"ByteBuffer",
"columnName",
",",
"String",
"columnFamilyName",
",",
"String",
"columnValue",
")",
"{",
"CfDef",
"columnFamilyDef",
"=",
"getCfDef",
"(",
"columnFamilyName",
")",
";",
"AbstractType",
"<",
"?",
">",
"defaultValidator",
"=",
"getFormatType",
"(",
"columnFamilyDef",
".",
"default_validation_class",
")",
";",
"for",
"(",
"ColumnDef",
"columnDefinition",
":",
"columnFamilyDef",
".",
"getColumn_metadata",
"(",
")",
")",
"{",
"byte",
"[",
"]",
"currentColumnName",
"=",
"columnDefinition",
".",
"getName",
"(",
")",
";",
"if",
"(",
"ByteBufferUtil",
".",
"compare",
"(",
"currentColumnName",
",",
"columnName",
")",
"==",
"0",
")",
"{",
"try",
"{",
"String",
"validationClass",
"=",
"columnDefinition",
".",
"getValidation_class",
"(",
")",
";",
"return",
"getBytesAccordingToType",
"(",
"columnValue",
",",
"getFormatType",
"(",
"validationClass",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"}",
"return",
"defaultValidator",
".",
"fromString",
"(",
"columnValue",
")",
";",
"}"
] |
Converts column value into byte[] according to validation class
@param columnName - column name to which value belongs
@param columnFamilyName - column family name
@param columnValue - actual column value
@return value in byte array representation
|
[
"Converts",
"column",
"value",
"into",
"byte",
"[]",
"according",
"to",
"validation",
"class"
] |
train
|
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cli/CliClient.java#L2660-L2684
|
google/j2objc
|
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDateTime.java
|
LocalDateTime.plusDays
|
public LocalDateTime plusDays(long days) {
"""
Returns a copy of this {@code LocalDateTime} with the specified number of days added.
<p>
This method adds the specified amount to the days field incrementing the
month and year fields as necessary to ensure the result remains valid.
The result is only invalid if the maximum/minimum year is exceeded.
<p>
For example, 2008-12-31 plus one day would result in 2009-01-01.
<p>
This instance is immutable and unaffected by this method call.
@param days the days to add, may be negative
@return a {@code LocalDateTime} based on this date-time with the days added, not null
@throws DateTimeException if the result exceeds the supported date range
"""
LocalDate newDate = date.plusDays(days);
return with(newDate, time);
}
|
java
|
public LocalDateTime plusDays(long days) {
LocalDate newDate = date.plusDays(days);
return with(newDate, time);
}
|
[
"public",
"LocalDateTime",
"plusDays",
"(",
"long",
"days",
")",
"{",
"LocalDate",
"newDate",
"=",
"date",
".",
"plusDays",
"(",
"days",
")",
";",
"return",
"with",
"(",
"newDate",
",",
"time",
")",
";",
"}"
] |
Returns a copy of this {@code LocalDateTime} with the specified number of days added.
<p>
This method adds the specified amount to the days field incrementing the
month and year fields as necessary to ensure the result remains valid.
The result is only invalid if the maximum/minimum year is exceeded.
<p>
For example, 2008-12-31 plus one day would result in 2009-01-01.
<p>
This instance is immutable and unaffected by this method call.
@param days the days to add, may be negative
@return a {@code LocalDateTime} based on this date-time with the days added, not null
@throws DateTimeException if the result exceeds the supported date range
|
[
"Returns",
"a",
"copy",
"of",
"this",
"{",
"@code",
"LocalDateTime",
"}",
"with",
"the",
"specified",
"number",
"of",
"days",
"added",
".",
"<p",
">",
"This",
"method",
"adds",
"the",
"specified",
"amount",
"to",
"the",
"days",
"field",
"incrementing",
"the",
"month",
"and",
"year",
"fields",
"as",
"necessary",
"to",
"ensure",
"the",
"result",
"remains",
"valid",
".",
"The",
"result",
"is",
"only",
"invalid",
"if",
"the",
"maximum",
"/",
"minimum",
"year",
"is",
"exceeded",
".",
"<p",
">",
"For",
"example",
"2008",
"-",
"12",
"-",
"31",
"plus",
"one",
"day",
"would",
"result",
"in",
"2009",
"-",
"01",
"-",
"01",
".",
"<p",
">",
"This",
"instance",
"is",
"immutable",
"and",
"unaffected",
"by",
"this",
"method",
"call",
"."
] |
train
|
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDateTime.java#L1279-L1282
|
Azure/azure-sdk-for-java
|
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
|
ModelsImpl.getClosedListEntityRoles
|
public List<EntityRole> getClosedListEntityRoles(UUID appId, String versionId, UUID entityId) {
"""
Get All Entity Roles for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId entity Id
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<EntityRole> object if successful.
"""
return getClosedListEntityRolesWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body();
}
|
java
|
public List<EntityRole> getClosedListEntityRoles(UUID appId, String versionId, UUID entityId) {
return getClosedListEntityRolesWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body();
}
|
[
"public",
"List",
"<",
"EntityRole",
">",
"getClosedListEntityRoles",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
")",
"{",
"return",
"getClosedListEntityRolesWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"entityId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Get All Entity Roles for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId entity Id
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<EntityRole> object if successful.
|
[
"Get",
"All",
"Entity",
"Roles",
"for",
"a",
"given",
"entity",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L8219-L8221
|
apache/flink
|
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/PatternStream.java
|
PatternStream.flatSelect
|
public <R> SingleOutputStreamOperator<R> flatSelect(
final PatternFlatSelectFunction<T, R> patternFlatSelectFunction,
final TypeInformation<R> outTypeInfo) {
"""
Applies a flat select function to the detected pattern sequence. For each pattern sequence
the provided {@link PatternFlatSelectFunction} is called. The pattern flat select function
can produce an arbitrary number of resulting elements.
@param patternFlatSelectFunction The pattern flat select function which is called for each
detected pattern sequence.
@param <R> Type of the resulting elements
@param outTypeInfo Explicit specification of output type.
@return {@link DataStream} which contains the resulting elements from the pattern flat select
function.
"""
final PatternProcessFunction<T, R> processFunction =
fromFlatSelect(builder.clean(patternFlatSelectFunction))
.build();
return process(processFunction, outTypeInfo);
}
|
java
|
public <R> SingleOutputStreamOperator<R> flatSelect(
final PatternFlatSelectFunction<T, R> patternFlatSelectFunction,
final TypeInformation<R> outTypeInfo) {
final PatternProcessFunction<T, R> processFunction =
fromFlatSelect(builder.clean(patternFlatSelectFunction))
.build();
return process(processFunction, outTypeInfo);
}
|
[
"public",
"<",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"flatSelect",
"(",
"final",
"PatternFlatSelectFunction",
"<",
"T",
",",
"R",
">",
"patternFlatSelectFunction",
",",
"final",
"TypeInformation",
"<",
"R",
">",
"outTypeInfo",
")",
"{",
"final",
"PatternProcessFunction",
"<",
"T",
",",
"R",
">",
"processFunction",
"=",
"fromFlatSelect",
"(",
"builder",
".",
"clean",
"(",
"patternFlatSelectFunction",
")",
")",
".",
"build",
"(",
")",
";",
"return",
"process",
"(",
"processFunction",
",",
"outTypeInfo",
")",
";",
"}"
] |
Applies a flat select function to the detected pattern sequence. For each pattern sequence
the provided {@link PatternFlatSelectFunction} is called. The pattern flat select function
can produce an arbitrary number of resulting elements.
@param patternFlatSelectFunction The pattern flat select function which is called for each
detected pattern sequence.
@param <R> Type of the resulting elements
@param outTypeInfo Explicit specification of output type.
@return {@link DataStream} which contains the resulting elements from the pattern flat select
function.
|
[
"Applies",
"a",
"flat",
"select",
"function",
"to",
"the",
"detected",
"pattern",
"sequence",
".",
"For",
"each",
"pattern",
"sequence",
"the",
"provided",
"{",
"@link",
"PatternFlatSelectFunction",
"}",
"is",
"called",
".",
"The",
"pattern",
"flat",
"select",
"function",
"can",
"produce",
"an",
"arbitrary",
"number",
"of",
"resulting",
"elements",
"."
] |
train
|
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/PatternStream.java#L358-L367
|
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java
|
IdentityPatchRunner.prepareTasks
|
static void prepareTasks(final IdentityPatchContext.PatchEntry entry, final IdentityPatchContext context, final List<PreparedTask> tasks, final List<ContentItem> conflicts) throws PatchingException {
"""
Prepare all tasks.
@param entry the patch entry
@param context the patch context
@param tasks a list for prepared tasks
@param conflicts a list for conflicting content items
@throws PatchingException
"""
for (final PatchingTasks.ContentTaskDefinition definition : entry.getTaskDefinitions()) {
final PatchingTask task = createTask(definition, context, entry);
if(!task.isRelevant(entry)) {
continue;
}
try {
// backup and validate content
if (!task.prepare(entry) || definition.hasConflicts()) {
// Unless it a content item was manually ignored (or excluded)
final ContentItem item = task.getContentItem();
if (!context.isIgnored(item)) {
conflicts.add(item);
}
}
tasks.add(new PreparedTask(task, entry));
} catch (IOException e) {
throw new PatchingException(e);
}
}
}
|
java
|
static void prepareTasks(final IdentityPatchContext.PatchEntry entry, final IdentityPatchContext context, final List<PreparedTask> tasks, final List<ContentItem> conflicts) throws PatchingException {
for (final PatchingTasks.ContentTaskDefinition definition : entry.getTaskDefinitions()) {
final PatchingTask task = createTask(definition, context, entry);
if(!task.isRelevant(entry)) {
continue;
}
try {
// backup and validate content
if (!task.prepare(entry) || definition.hasConflicts()) {
// Unless it a content item was manually ignored (or excluded)
final ContentItem item = task.getContentItem();
if (!context.isIgnored(item)) {
conflicts.add(item);
}
}
tasks.add(new PreparedTask(task, entry));
} catch (IOException e) {
throw new PatchingException(e);
}
}
}
|
[
"static",
"void",
"prepareTasks",
"(",
"final",
"IdentityPatchContext",
".",
"PatchEntry",
"entry",
",",
"final",
"IdentityPatchContext",
"context",
",",
"final",
"List",
"<",
"PreparedTask",
">",
"tasks",
",",
"final",
"List",
"<",
"ContentItem",
">",
"conflicts",
")",
"throws",
"PatchingException",
"{",
"for",
"(",
"final",
"PatchingTasks",
".",
"ContentTaskDefinition",
"definition",
":",
"entry",
".",
"getTaskDefinitions",
"(",
")",
")",
"{",
"final",
"PatchingTask",
"task",
"=",
"createTask",
"(",
"definition",
",",
"context",
",",
"entry",
")",
";",
"if",
"(",
"!",
"task",
".",
"isRelevant",
"(",
"entry",
")",
")",
"{",
"continue",
";",
"}",
"try",
"{",
"// backup and validate content",
"if",
"(",
"!",
"task",
".",
"prepare",
"(",
"entry",
")",
"||",
"definition",
".",
"hasConflicts",
"(",
")",
")",
"{",
"// Unless it a content item was manually ignored (or excluded)",
"final",
"ContentItem",
"item",
"=",
"task",
".",
"getContentItem",
"(",
")",
";",
"if",
"(",
"!",
"context",
".",
"isIgnored",
"(",
"item",
")",
")",
"{",
"conflicts",
".",
"add",
"(",
"item",
")",
";",
"}",
"}",
"tasks",
".",
"add",
"(",
"new",
"PreparedTask",
"(",
"task",
",",
"entry",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"PatchingException",
"(",
"e",
")",
";",
"}",
"}",
"}"
] |
Prepare all tasks.
@param entry the patch entry
@param context the patch context
@param tasks a list for prepared tasks
@param conflicts a list for conflicting content items
@throws PatchingException
|
[
"Prepare",
"all",
"tasks",
"."
] |
train
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java#L669-L689
|
orbisgis/h2gis
|
h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLWriterDriver.java
|
KMLWriterDriver.writeExtendedData
|
public void writeExtendedData(XMLStreamWriter xmlOut, ResultSet rs) throws XMLStreamException, SQLException {
"""
The ExtendedData element offers three techniques for adding custom data
to a KML Feature (NetworkLink, Placemark, GroundOverlay, PhotoOverlay,
ScreenOverlay, Document, Folder). These techniques are
Adding untyped data/value pairs using the <Data> element (basic)
Declaring new typed fields using the <Schema> element and then instancing
them using the <SchemaData> element (advanced) Referring to XML elements
defined in other namespaces by referencing the external namespace within
the KML file (basic)
These techniques can be combined within a single KML file or Feature for
different pieces of data.
Syntax :
<ExtendedData>
<Data name="string">
<displayName>...</displayName> <!-- string -->
<value>...</value> <!-- string -->
</Data>
<SchemaData schemaUrl="anyURI">
<SimpleData name=""> ... </SimpleData> <!-- string -->
</SchemaData>
<namespace_prefix:other>...</namespace_prefix:other>
</ExtendedData>
@param xmlOut
"""
xmlOut.writeStartElement("ExtendedData");
xmlOut.writeStartElement("SchemaData");
xmlOut.writeAttribute("schemaUrl", "#" + tableName);
for (Map.Entry<Integer, String> entry : kmlFields.entrySet()) {
Integer fieldIndex = entry.getKey();
String fieldName = entry.getValue();
writeSimpleData(xmlOut, fieldName, rs.getString(fieldIndex));
}
xmlOut.writeEndElement();//Write SchemaData
xmlOut.writeEndElement();//Write ExtendedData
}
|
java
|
public void writeExtendedData(XMLStreamWriter xmlOut, ResultSet rs) throws XMLStreamException, SQLException {
xmlOut.writeStartElement("ExtendedData");
xmlOut.writeStartElement("SchemaData");
xmlOut.writeAttribute("schemaUrl", "#" + tableName);
for (Map.Entry<Integer, String> entry : kmlFields.entrySet()) {
Integer fieldIndex = entry.getKey();
String fieldName = entry.getValue();
writeSimpleData(xmlOut, fieldName, rs.getString(fieldIndex));
}
xmlOut.writeEndElement();//Write SchemaData
xmlOut.writeEndElement();//Write ExtendedData
}
|
[
"public",
"void",
"writeExtendedData",
"(",
"XMLStreamWriter",
"xmlOut",
",",
"ResultSet",
"rs",
")",
"throws",
"XMLStreamException",
",",
"SQLException",
"{",
"xmlOut",
".",
"writeStartElement",
"(",
"\"ExtendedData\"",
")",
";",
"xmlOut",
".",
"writeStartElement",
"(",
"\"SchemaData\"",
")",
";",
"xmlOut",
".",
"writeAttribute",
"(",
"\"schemaUrl\"",
",",
"\"#\"",
"+",
"tableName",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"String",
">",
"entry",
":",
"kmlFields",
".",
"entrySet",
"(",
")",
")",
"{",
"Integer",
"fieldIndex",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"String",
"fieldName",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"writeSimpleData",
"(",
"xmlOut",
",",
"fieldName",
",",
"rs",
".",
"getString",
"(",
"fieldIndex",
")",
")",
";",
"}",
"xmlOut",
".",
"writeEndElement",
"(",
")",
";",
"//Write SchemaData",
"xmlOut",
".",
"writeEndElement",
"(",
")",
";",
"//Write ExtendedData",
"}"
] |
The ExtendedData element offers three techniques for adding custom data
to a KML Feature (NetworkLink, Placemark, GroundOverlay, PhotoOverlay,
ScreenOverlay, Document, Folder). These techniques are
Adding untyped data/value pairs using the <Data> element (basic)
Declaring new typed fields using the <Schema> element and then instancing
them using the <SchemaData> element (advanced) Referring to XML elements
defined in other namespaces by referencing the external namespace within
the KML file (basic)
These techniques can be combined within a single KML file or Feature for
different pieces of data.
Syntax :
<ExtendedData>
<Data name="string">
<displayName>...</displayName> <!-- string -->
<value>...</value> <!-- string -->
</Data>
<SchemaData schemaUrl="anyURI">
<SimpleData name=""> ... </SimpleData> <!-- string -->
</SchemaData>
<namespace_prefix:other>...</namespace_prefix:other>
</ExtendedData>
@param xmlOut
|
[
"The",
"ExtendedData",
"element",
"offers",
"three",
"techniques",
"for",
"adding",
"custom",
"data",
"to",
"a",
"KML",
"Feature",
"(",
"NetworkLink",
"Placemark",
"GroundOverlay",
"PhotoOverlay",
"ScreenOverlay",
"Document",
"Folder",
")",
".",
"These",
"techniques",
"are"
] |
train
|
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLWriterDriver.java#L344-L356
|
deeplearning4j/deeplearning4j
|
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseSparseNDArrayCOO.java
|
BaseSparseNDArrayCOO.indexesBinarySearch
|
public int indexesBinarySearch(int lowerBound, int upperBound, int[] idx) {
"""
Return the position of the idx array into the indexes buffer between the lower and upper bound.
@param idx a set of coordinates
@param lowerBound the lower bound of the position
@param upperBound the upper bound of the position
@return the position of the idx array into the indexes buffers, which corresponds to the position of
the corresponding value in the values data.
"""
int min = lowerBound;
int max = upperBound;
int mid = (max + min) / 2;
int[] midIdx = getUnderlyingIndicesOf(mid).asInt();
if (Arrays.equals(idx, midIdx)) {
return mid;
}
if (ArrayUtil.lessThan(idx, midIdx)) {
max = mid;
}
if (ArrayUtil.greaterThan(idx, midIdx)) {
min = mid;
}
if (min == max) {
return -1;
}
return indexesBinarySearch(min, max, idx);
}
|
java
|
public int indexesBinarySearch(int lowerBound, int upperBound, int[] idx) {
int min = lowerBound;
int max = upperBound;
int mid = (max + min) / 2;
int[] midIdx = getUnderlyingIndicesOf(mid).asInt();
if (Arrays.equals(idx, midIdx)) {
return mid;
}
if (ArrayUtil.lessThan(idx, midIdx)) {
max = mid;
}
if (ArrayUtil.greaterThan(idx, midIdx)) {
min = mid;
}
if (min == max) {
return -1;
}
return indexesBinarySearch(min, max, idx);
}
|
[
"public",
"int",
"indexesBinarySearch",
"(",
"int",
"lowerBound",
",",
"int",
"upperBound",
",",
"int",
"[",
"]",
"idx",
")",
"{",
"int",
"min",
"=",
"lowerBound",
";",
"int",
"max",
"=",
"upperBound",
";",
"int",
"mid",
"=",
"(",
"max",
"+",
"min",
")",
"/",
"2",
";",
"int",
"[",
"]",
"midIdx",
"=",
"getUnderlyingIndicesOf",
"(",
"mid",
")",
".",
"asInt",
"(",
")",
";",
"if",
"(",
"Arrays",
".",
"equals",
"(",
"idx",
",",
"midIdx",
")",
")",
"{",
"return",
"mid",
";",
"}",
"if",
"(",
"ArrayUtil",
".",
"lessThan",
"(",
"idx",
",",
"midIdx",
")",
")",
"{",
"max",
"=",
"mid",
";",
"}",
"if",
"(",
"ArrayUtil",
".",
"greaterThan",
"(",
"idx",
",",
"midIdx",
")",
")",
"{",
"min",
"=",
"mid",
";",
"}",
"if",
"(",
"min",
"==",
"max",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"indexesBinarySearch",
"(",
"min",
",",
"max",
",",
"idx",
")",
";",
"}"
] |
Return the position of the idx array into the indexes buffer between the lower and upper bound.
@param idx a set of coordinates
@param lowerBound the lower bound of the position
@param upperBound the upper bound of the position
@return the position of the idx array into the indexes buffers, which corresponds to the position of
the corresponding value in the values data.
|
[
"Return",
"the",
"position",
"of",
"the",
"idx",
"array",
"into",
"the",
"indexes",
"buffer",
"between",
"the",
"lower",
"and",
"upper",
"bound",
"."
] |
train
|
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseSparseNDArrayCOO.java#L631-L650
|
telly/groundy
|
library/src/main/java/com/telly/groundy/TaskResult.java
|
TaskResult.add
|
public TaskResult add(String key, SparseArray<? extends Parcelable> value) {
"""
Inserts a SparseArray of Parcelable values into the mapping of this Bundle, replacing any
existing value for the given key. Either key or value may be null.
@param key a String, or null
@param value a SparseArray of Parcelable objects, or null
"""
mBundle.putSparseParcelableArray(key, value);
return this;
}
|
java
|
public TaskResult add(String key, SparseArray<? extends Parcelable> value) {
mBundle.putSparseParcelableArray(key, value);
return this;
}
|
[
"public",
"TaskResult",
"add",
"(",
"String",
"key",
",",
"SparseArray",
"<",
"?",
"extends",
"Parcelable",
">",
"value",
")",
"{",
"mBundle",
".",
"putSparseParcelableArray",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] |
Inserts a SparseArray of Parcelable values into the mapping of this Bundle, replacing any
existing value for the given key. Either key or value may be null.
@param key a String, or null
@param value a SparseArray of Parcelable objects, or null
|
[
"Inserts",
"a",
"SparseArray",
"of",
"Parcelable",
"values",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] |
train
|
https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/TaskResult.java#L215-L218
|
RestComm/Restcomm-Connect
|
restcomm/restcomm.application/src/main/java/org/restcomm/connect/application/Bootstrapper.java
|
Bootstrapper.generateDefaultDomainName
|
private boolean generateDefaultDomainName(final Configuration configuration, final DaoManager storage, final SipURI sipUriHostAsFallbackDomain) {
"""
generateDefaultDomainName based on RC hostname
https://github.com/RestComm/Restcomm-Connect/issues/2085
@param configuration
@param storage
@param sipUriHostAsFallbackDomain - if hostname is not provided in restcomm.xml then provided sipuri host will be used as domain.
"""
try {
final Sid defaultOrganization = new Sid("ORafbe225ad37541eba518a74248f0ac4c");
String hostname = configuration.getString("hostname");
if (hostname != null && !hostname.trim().equals("")) {
if (logger.isInfoEnabled())
logger.info("Generate Default Domain Name based on RC hostname: " + hostname);
} else {
if (sipUriHostAsFallbackDomain != null) {
logger.warn("Hostname property is null in restcomm.xml, will assign this host as domain: " + sipUriHostAsFallbackDomain.getHost());
hostname = sipUriHostAsFallbackDomain.getHost();
} else {
logger.error("Hostname property is null in restcomm.xml, As well restcomm outbound sipuri is NULL.");
return false;
}
}
Organization organization = storage.getOrganizationsDao().getOrganization(defaultOrganization);
if (organization == null) {
storage.getOrganizationsDao().addOrganization(new Organization(defaultOrganization, hostname, DateTime.now(), DateTime.now(), Organization.Status.ACTIVE));
} else {
organization = organization.setDomainName(hostname);
storage.getOrganizationsDao().updateOrganization(organization);
}
} catch (Exception e) {
logger.error("Unable to generateDefaultDomainName {}", e);
return false;
}
return true;
}
|
java
|
private boolean generateDefaultDomainName(final Configuration configuration, final DaoManager storage, final SipURI sipUriHostAsFallbackDomain) {
try {
final Sid defaultOrganization = new Sid("ORafbe225ad37541eba518a74248f0ac4c");
String hostname = configuration.getString("hostname");
if (hostname != null && !hostname.trim().equals("")) {
if (logger.isInfoEnabled())
logger.info("Generate Default Domain Name based on RC hostname: " + hostname);
} else {
if (sipUriHostAsFallbackDomain != null) {
logger.warn("Hostname property is null in restcomm.xml, will assign this host as domain: " + sipUriHostAsFallbackDomain.getHost());
hostname = sipUriHostAsFallbackDomain.getHost();
} else {
logger.error("Hostname property is null in restcomm.xml, As well restcomm outbound sipuri is NULL.");
return false;
}
}
Organization organization = storage.getOrganizationsDao().getOrganization(defaultOrganization);
if (organization == null) {
storage.getOrganizationsDao().addOrganization(new Organization(defaultOrganization, hostname, DateTime.now(), DateTime.now(), Organization.Status.ACTIVE));
} else {
organization = organization.setDomainName(hostname);
storage.getOrganizationsDao().updateOrganization(organization);
}
} catch (Exception e) {
logger.error("Unable to generateDefaultDomainName {}", e);
return false;
}
return true;
}
|
[
"private",
"boolean",
"generateDefaultDomainName",
"(",
"final",
"Configuration",
"configuration",
",",
"final",
"DaoManager",
"storage",
",",
"final",
"SipURI",
"sipUriHostAsFallbackDomain",
")",
"{",
"try",
"{",
"final",
"Sid",
"defaultOrganization",
"=",
"new",
"Sid",
"(",
"\"ORafbe225ad37541eba518a74248f0ac4c\"",
")",
";",
"String",
"hostname",
"=",
"configuration",
".",
"getString",
"(",
"\"hostname\"",
")",
";",
"if",
"(",
"hostname",
"!=",
"null",
"&&",
"!",
"hostname",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"if",
"(",
"logger",
".",
"isInfoEnabled",
"(",
")",
")",
"logger",
".",
"info",
"(",
"\"Generate Default Domain Name based on RC hostname: \"",
"+",
"hostname",
")",
";",
"}",
"else",
"{",
"if",
"(",
"sipUriHostAsFallbackDomain",
"!=",
"null",
")",
"{",
"logger",
".",
"warn",
"(",
"\"Hostname property is null in restcomm.xml, will assign this host as domain: \"",
"+",
"sipUriHostAsFallbackDomain",
".",
"getHost",
"(",
")",
")",
";",
"hostname",
"=",
"sipUriHostAsFallbackDomain",
".",
"getHost",
"(",
")",
";",
"}",
"else",
"{",
"logger",
".",
"error",
"(",
"\"Hostname property is null in restcomm.xml, As well restcomm outbound sipuri is NULL.\"",
")",
";",
"return",
"false",
";",
"}",
"}",
"Organization",
"organization",
"=",
"storage",
".",
"getOrganizationsDao",
"(",
")",
".",
"getOrganization",
"(",
"defaultOrganization",
")",
";",
"if",
"(",
"organization",
"==",
"null",
")",
"{",
"storage",
".",
"getOrganizationsDao",
"(",
")",
".",
"addOrganization",
"(",
"new",
"Organization",
"(",
"defaultOrganization",
",",
"hostname",
",",
"DateTime",
".",
"now",
"(",
")",
",",
"DateTime",
".",
"now",
"(",
")",
",",
"Organization",
".",
"Status",
".",
"ACTIVE",
")",
")",
";",
"}",
"else",
"{",
"organization",
"=",
"organization",
".",
"setDomainName",
"(",
"hostname",
")",
";",
"storage",
".",
"getOrganizationsDao",
"(",
")",
".",
"updateOrganization",
"(",
"organization",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"Unable to generateDefaultDomainName {}\"",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
generateDefaultDomainName based on RC hostname
https://github.com/RestComm/Restcomm-Connect/issues/2085
@param configuration
@param storage
@param sipUriHostAsFallbackDomain - if hostname is not provided in restcomm.xml then provided sipuri host will be used as domain.
|
[
"generateDefaultDomainName",
"based",
"on",
"RC",
"hostname",
"https",
":",
"//",
"github",
".",
"com",
"/",
"RestComm",
"/",
"Restcomm",
"-",
"Connect",
"/",
"issues",
"/",
"2085"
] |
train
|
https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.application/src/main/java/org/restcomm/connect/application/Bootstrapper.java#L286-L316
|
threerings/gwt-utils
|
src/main/java/com/threerings/gwt/ui/Widgets.java
|
Widgets.newTextBox
|
public static TextBox newTextBox (String text, int maxLength, int visibleLength) {
"""
Creates a text box with all of the configuration that you're bound to want to do.
"""
return initTextBox(new TextBox(), text, maxLength, visibleLength);
}
|
java
|
public static TextBox newTextBox (String text, int maxLength, int visibleLength)
{
return initTextBox(new TextBox(), text, maxLength, visibleLength);
}
|
[
"public",
"static",
"TextBox",
"newTextBox",
"(",
"String",
"text",
",",
"int",
"maxLength",
",",
"int",
"visibleLength",
")",
"{",
"return",
"initTextBox",
"(",
"new",
"TextBox",
"(",
")",
",",
"text",
",",
"maxLength",
",",
"visibleLength",
")",
";",
"}"
] |
Creates a text box with all of the configuration that you're bound to want to do.
|
[
"Creates",
"a",
"text",
"box",
"with",
"all",
"of",
"the",
"configuration",
"that",
"you",
"re",
"bound",
"to",
"want",
"to",
"do",
"."
] |
train
|
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Widgets.java#L324-L327
|
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
|
Resolve.findGlobalType
|
Symbol findGlobalType(Env<AttrContext> env, Scope scope, Name name, RecoveryLoadClass recoveryLoadClass) {
"""
Find a global type in given scope and load corresponding class.
@param env The current environment.
@param scope The scope in which to look for the type.
@param name The type's name.
"""
Symbol bestSoFar = typeNotFound;
for (Symbol s : scope.getSymbolsByName(name)) {
Symbol sym = loadClass(env, s.flatName(), recoveryLoadClass);
if (bestSoFar.kind == TYP && sym.kind == TYP &&
bestSoFar != sym)
return new AmbiguityError(bestSoFar, sym);
else
bestSoFar = bestOf(bestSoFar, sym);
}
return bestSoFar;
}
|
java
|
Symbol findGlobalType(Env<AttrContext> env, Scope scope, Name name, RecoveryLoadClass recoveryLoadClass) {
Symbol bestSoFar = typeNotFound;
for (Symbol s : scope.getSymbolsByName(name)) {
Symbol sym = loadClass(env, s.flatName(), recoveryLoadClass);
if (bestSoFar.kind == TYP && sym.kind == TYP &&
bestSoFar != sym)
return new AmbiguityError(bestSoFar, sym);
else
bestSoFar = bestOf(bestSoFar, sym);
}
return bestSoFar;
}
|
[
"Symbol",
"findGlobalType",
"(",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"Scope",
"scope",
",",
"Name",
"name",
",",
"RecoveryLoadClass",
"recoveryLoadClass",
")",
"{",
"Symbol",
"bestSoFar",
"=",
"typeNotFound",
";",
"for",
"(",
"Symbol",
"s",
":",
"scope",
".",
"getSymbolsByName",
"(",
"name",
")",
")",
"{",
"Symbol",
"sym",
"=",
"loadClass",
"(",
"env",
",",
"s",
".",
"flatName",
"(",
")",
",",
"recoveryLoadClass",
")",
";",
"if",
"(",
"bestSoFar",
".",
"kind",
"==",
"TYP",
"&&",
"sym",
".",
"kind",
"==",
"TYP",
"&&",
"bestSoFar",
"!=",
"sym",
")",
"return",
"new",
"AmbiguityError",
"(",
"bestSoFar",
",",
"sym",
")",
";",
"else",
"bestSoFar",
"=",
"bestOf",
"(",
"bestSoFar",
",",
"sym",
")",
";",
"}",
"return",
"bestSoFar",
";",
"}"
] |
Find a global type in given scope and load corresponding class.
@param env The current environment.
@param scope The scope in which to look for the type.
@param name The type's name.
|
[
"Find",
"a",
"global",
"type",
"in",
"given",
"scope",
"and",
"load",
"corresponding",
"class",
"."
] |
train
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2239-L2250
|
cdk/cdk
|
base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ChemModelManipulator.java
|
ChemModelManipulator.getRelevantAtomContainer
|
public static IAtomContainer getRelevantAtomContainer(IChemModel chemModel, IAtom atom) {
"""
This badly named methods tries to determine which AtomContainer in the
ChemModel is best suited to contain added Atom's and Bond's.
"""
IAtomContainer result = null;
if (chemModel.getMoleculeSet() != null) {
IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
result = MoleculeSetManipulator.getRelevantAtomContainer(moleculeSet, atom);
if (result != null) {
return result;
}
}
if (chemModel.getReactionSet() != null) {
IReactionSet reactionSet = chemModel.getReactionSet();
return ReactionSetManipulator.getRelevantAtomContainer(reactionSet, atom);
}
if (chemModel.getCrystal() != null && chemModel.getCrystal().contains(atom)) {
return chemModel.getCrystal();
}
if (chemModel.getRingSet() != null) {
return AtomContainerSetManipulator.getRelevantAtomContainer(chemModel.getRingSet(), atom);
}
throw new IllegalArgumentException("The provided atom is not part of this IChemModel.");
}
|
java
|
public static IAtomContainer getRelevantAtomContainer(IChemModel chemModel, IAtom atom) {
IAtomContainer result = null;
if (chemModel.getMoleculeSet() != null) {
IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
result = MoleculeSetManipulator.getRelevantAtomContainer(moleculeSet, atom);
if (result != null) {
return result;
}
}
if (chemModel.getReactionSet() != null) {
IReactionSet reactionSet = chemModel.getReactionSet();
return ReactionSetManipulator.getRelevantAtomContainer(reactionSet, atom);
}
if (chemModel.getCrystal() != null && chemModel.getCrystal().contains(atom)) {
return chemModel.getCrystal();
}
if (chemModel.getRingSet() != null) {
return AtomContainerSetManipulator.getRelevantAtomContainer(chemModel.getRingSet(), atom);
}
throw new IllegalArgumentException("The provided atom is not part of this IChemModel.");
}
|
[
"public",
"static",
"IAtomContainer",
"getRelevantAtomContainer",
"(",
"IChemModel",
"chemModel",
",",
"IAtom",
"atom",
")",
"{",
"IAtomContainer",
"result",
"=",
"null",
";",
"if",
"(",
"chemModel",
".",
"getMoleculeSet",
"(",
")",
"!=",
"null",
")",
"{",
"IAtomContainerSet",
"moleculeSet",
"=",
"chemModel",
".",
"getMoleculeSet",
"(",
")",
";",
"result",
"=",
"MoleculeSetManipulator",
".",
"getRelevantAtomContainer",
"(",
"moleculeSet",
",",
"atom",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"return",
"result",
";",
"}",
"}",
"if",
"(",
"chemModel",
".",
"getReactionSet",
"(",
")",
"!=",
"null",
")",
"{",
"IReactionSet",
"reactionSet",
"=",
"chemModel",
".",
"getReactionSet",
"(",
")",
";",
"return",
"ReactionSetManipulator",
".",
"getRelevantAtomContainer",
"(",
"reactionSet",
",",
"atom",
")",
";",
"}",
"if",
"(",
"chemModel",
".",
"getCrystal",
"(",
")",
"!=",
"null",
"&&",
"chemModel",
".",
"getCrystal",
"(",
")",
".",
"contains",
"(",
"atom",
")",
")",
"{",
"return",
"chemModel",
".",
"getCrystal",
"(",
")",
";",
"}",
"if",
"(",
"chemModel",
".",
"getRingSet",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"AtomContainerSetManipulator",
".",
"getRelevantAtomContainer",
"(",
"chemModel",
".",
"getRingSet",
"(",
")",
",",
"atom",
")",
";",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The provided atom is not part of this IChemModel.\"",
")",
";",
"}"
] |
This badly named methods tries to determine which AtomContainer in the
ChemModel is best suited to contain added Atom's and Bond's.
|
[
"This",
"badly",
"named",
"methods",
"tries",
"to",
"determine",
"which",
"AtomContainer",
"in",
"the",
"ChemModel",
"is",
"best",
"suited",
"to",
"contain",
"added",
"Atom",
"s",
"and",
"Bond",
"s",
"."
] |
train
|
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ChemModelManipulator.java#L200-L220
|
marklogic/java-client-api
|
marklogic-client-api/src/main/java/com/marklogic/client/query/AggregateResult.java
|
AggregateResult.get
|
public <T> T get(String type, Class<T> as) {
"""
Returns the value cast to the specified type.
This method converts the value according to the supplied type and then casts it
to the specified class.
<p>The following types are supported:
<code>xs:anySimpleType</code>,
<code>xs:base64Binary</code>, <code>xs:boolean</code>,
<code>xs:byte</code>, <code>xs:date</code>,
<code>xs:dateTime</code>, <code>xs:dayTimeDuration</code>,
<code>xs:decimal</code>, <code>xs:double</code>,
<code>xs:duration</code>, <code>xs:float</code>,
<code>xs:int</code>, <code>xs:integer</code>,
<code>xs:long</code>, <code>xs:short</code>,
<code>xs:string</code>, <code>xs:time</code>,
<code>xs:unsignedInt</code>, <code>xs:unsignedLong</code>,
<code>xs:unsignedShort</code>, and
<code>xs:yearMonthDuration</code>.</p>
@see com.marklogic.client.impl.ValueConverter#convertToJava(String,String) label
@param type The name of the XSD type to use for conversion.
@param as The class parameter
@param <T> The class to cast to
@return The value, cast to the specified type or
"""
return ValueConverter.convertToJava(type, value, as);
}
|
java
|
public <T> T get(String type, Class<T> as) {
return ValueConverter.convertToJava(type, value, as);
}
|
[
"public",
"<",
"T",
">",
"T",
"get",
"(",
"String",
"type",
",",
"Class",
"<",
"T",
">",
"as",
")",
"{",
"return",
"ValueConverter",
".",
"convertToJava",
"(",
"type",
",",
"value",
",",
"as",
")",
";",
"}"
] |
Returns the value cast to the specified type.
This method converts the value according to the supplied type and then casts it
to the specified class.
<p>The following types are supported:
<code>xs:anySimpleType</code>,
<code>xs:base64Binary</code>, <code>xs:boolean</code>,
<code>xs:byte</code>, <code>xs:date</code>,
<code>xs:dateTime</code>, <code>xs:dayTimeDuration</code>,
<code>xs:decimal</code>, <code>xs:double</code>,
<code>xs:duration</code>, <code>xs:float</code>,
<code>xs:int</code>, <code>xs:integer</code>,
<code>xs:long</code>, <code>xs:short</code>,
<code>xs:string</code>, <code>xs:time</code>,
<code>xs:unsignedInt</code>, <code>xs:unsignedLong</code>,
<code>xs:unsignedShort</code>, and
<code>xs:yearMonthDuration</code>.</p>
@see com.marklogic.client.impl.ValueConverter#convertToJava(String,String) label
@param type The name of the XSD type to use for conversion.
@param as The class parameter
@param <T> The class to cast to
@return The value, cast to the specified type or
|
[
"Returns",
"the",
"value",
"cast",
"to",
"the",
"specified",
"type",
"."
] |
train
|
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/AggregateResult.java#L78-L80
|
deeplearning4j/deeplearning4j
|
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java
|
ComputationGraph.pretrainLayer
|
public void pretrainLayer(String layerName, MultiDataSetIterator iter) {
"""
Pretrain a specified layer with the given MultiDataSetIterator
@param layerName Layer name
@param iter Training data
"""
try{
pretrainLayerHelper(layerName, iter, 1);
} catch (OutOfMemoryError e){
CrashReportingUtil.writeMemoryCrashDump(this, e);
throw e;
}
}
|
java
|
public void pretrainLayer(String layerName, MultiDataSetIterator iter) {
try{
pretrainLayerHelper(layerName, iter, 1);
} catch (OutOfMemoryError e){
CrashReportingUtil.writeMemoryCrashDump(this, e);
throw e;
}
}
|
[
"public",
"void",
"pretrainLayer",
"(",
"String",
"layerName",
",",
"MultiDataSetIterator",
"iter",
")",
"{",
"try",
"{",
"pretrainLayerHelper",
"(",
"layerName",
",",
"iter",
",",
"1",
")",
";",
"}",
"catch",
"(",
"OutOfMemoryError",
"e",
")",
"{",
"CrashReportingUtil",
".",
"writeMemoryCrashDump",
"(",
"this",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"}"
] |
Pretrain a specified layer with the given MultiDataSetIterator
@param layerName Layer name
@param iter Training data
|
[
"Pretrain",
"a",
"specified",
"layer",
"with",
"the",
"given",
"MultiDataSetIterator"
] |
train
|
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L894-L901
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/RecurringData.java
|
RecurringData.setWeeklyDaysFromBitmap
|
public void setWeeklyDaysFromBitmap(Integer days, int[] masks) {
"""
Converts from a bitmap to individual day flags for a weekly recurrence,
using the array of masks.
@param days bitmap
@param masks array of mask values
"""
if (days != null)
{
int value = days.intValue();
for (Day day : Day.values())
{
setWeeklyDay(day, ((value & masks[day.getValue()]) != 0));
}
}
}
|
java
|
public void setWeeklyDaysFromBitmap(Integer days, int[] masks)
{
if (days != null)
{
int value = days.intValue();
for (Day day : Day.values())
{
setWeeklyDay(day, ((value & masks[day.getValue()]) != 0));
}
}
}
|
[
"public",
"void",
"setWeeklyDaysFromBitmap",
"(",
"Integer",
"days",
",",
"int",
"[",
"]",
"masks",
")",
"{",
"if",
"(",
"days",
"!=",
"null",
")",
"{",
"int",
"value",
"=",
"days",
".",
"intValue",
"(",
")",
";",
"for",
"(",
"Day",
"day",
":",
"Day",
".",
"values",
"(",
")",
")",
"{",
"setWeeklyDay",
"(",
"day",
",",
"(",
"(",
"value",
"&",
"masks",
"[",
"day",
".",
"getValue",
"(",
")",
"]",
")",
"!=",
"0",
")",
")",
";",
"}",
"}",
"}"
] |
Converts from a bitmap to individual day flags for a weekly recurrence,
using the array of masks.
@param days bitmap
@param masks array of mask values
|
[
"Converts",
"from",
"a",
"bitmap",
"to",
"individual",
"day",
"flags",
"for",
"a",
"weekly",
"recurrence",
"using",
"the",
"array",
"of",
"masks",
"."
] |
train
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L199-L209
|
citiususc/hipster
|
hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/MazeSearch.java
|
MazeSearch.getMazeStringSolution
|
public static String getMazeStringSolution(Maze2D maze, Collection<Point> explored, Collection<Point> path) {
"""
Returns the maze passed as parameter but replacing some characters to print the path found in the
current iteration.
@param maze used to search
@param explored collection of the points of the maze explored by the iterator
@param path current path found by the iterator
@return maze with the characters of the explored points and the current path replaced, to print the results in the console
"""
List<Map<Point, Character>> replacements = new ArrayList<Map<Point, Character>>();
Map<Point, Character> replacement = new HashMap<Point, Character>();
for (Point p : explored) {
replacement.put(p, '.');
}
replacements.add(replacement);
replacement = new HashMap<Point, Character>();
for (Point p : path) {
replacement.put(p, '*');
}
replacements.add(replacement);
return maze.getReplacedMazeString(replacements);
}
|
java
|
public static String getMazeStringSolution(Maze2D maze, Collection<Point> explored, Collection<Point> path) {
List<Map<Point, Character>> replacements = new ArrayList<Map<Point, Character>>();
Map<Point, Character> replacement = new HashMap<Point, Character>();
for (Point p : explored) {
replacement.put(p, '.');
}
replacements.add(replacement);
replacement = new HashMap<Point, Character>();
for (Point p : path) {
replacement.put(p, '*');
}
replacements.add(replacement);
return maze.getReplacedMazeString(replacements);
}
|
[
"public",
"static",
"String",
"getMazeStringSolution",
"(",
"Maze2D",
"maze",
",",
"Collection",
"<",
"Point",
">",
"explored",
",",
"Collection",
"<",
"Point",
">",
"path",
")",
"{",
"List",
"<",
"Map",
"<",
"Point",
",",
"Character",
">",
">",
"replacements",
"=",
"new",
"ArrayList",
"<",
"Map",
"<",
"Point",
",",
"Character",
">",
">",
"(",
")",
";",
"Map",
"<",
"Point",
",",
"Character",
">",
"replacement",
"=",
"new",
"HashMap",
"<",
"Point",
",",
"Character",
">",
"(",
")",
";",
"for",
"(",
"Point",
"p",
":",
"explored",
")",
"{",
"replacement",
".",
"put",
"(",
"p",
",",
"'",
"'",
")",
";",
"}",
"replacements",
".",
"add",
"(",
"replacement",
")",
";",
"replacement",
"=",
"new",
"HashMap",
"<",
"Point",
",",
"Character",
">",
"(",
")",
";",
"for",
"(",
"Point",
"p",
":",
"path",
")",
"{",
"replacement",
".",
"put",
"(",
"p",
",",
"'",
"'",
")",
";",
"}",
"replacements",
".",
"add",
"(",
"replacement",
")",
";",
"return",
"maze",
".",
"getReplacedMazeString",
"(",
"replacements",
")",
";",
"}"
] |
Returns the maze passed as parameter but replacing some characters to print the path found in the
current iteration.
@param maze used to search
@param explored collection of the points of the maze explored by the iterator
@param path current path found by the iterator
@return maze with the characters of the explored points and the current path replaced, to print the results in the console
|
[
"Returns",
"the",
"maze",
"passed",
"as",
"parameter",
"but",
"replacing",
"some",
"characters",
"to",
"print",
"the",
"path",
"found",
"in",
"the",
"current",
"iteration",
"."
] |
train
|
https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/MazeSearch.java#L134-L147
|
lkwg82/enforcer-rules
|
src/main/java/org/apache/maven/plugins/enforcer/RequireActiveProfile.java
|
RequireActiveProfile.isProfileActive
|
protected boolean isProfileActive( MavenProject project, String profileName ) {
"""
Checks if profile is active.
@param project the project
@param profileName the profile name
@return <code>true</code> if profile is active, otherwise <code>false</code>
"""
@SuppressWarnings( "unchecked" )
List<Profile> activeProfiles = project.getActiveProfiles();
if ( activeProfiles != null && !activeProfiles.isEmpty() )
{
for ( Profile profile : activeProfiles )
{
if ( profile.getId().equals( profileName ) )
{
return true;
}
}
}
return false;
}
|
java
|
protected boolean isProfileActive( MavenProject project, String profileName )
{
@SuppressWarnings( "unchecked" )
List<Profile> activeProfiles = project.getActiveProfiles();
if ( activeProfiles != null && !activeProfiles.isEmpty() )
{
for ( Profile profile : activeProfiles )
{
if ( profile.getId().equals( profileName ) )
{
return true;
}
}
}
return false;
}
|
[
"protected",
"boolean",
"isProfileActive",
"(",
"MavenProject",
"project",
",",
"String",
"profileName",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"List",
"<",
"Profile",
">",
"activeProfiles",
"=",
"project",
".",
"getActiveProfiles",
"(",
")",
";",
"if",
"(",
"activeProfiles",
"!=",
"null",
"&&",
"!",
"activeProfiles",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"Profile",
"profile",
":",
"activeProfiles",
")",
"{",
"if",
"(",
"profile",
".",
"getId",
"(",
")",
".",
"equals",
"(",
"profileName",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
Checks if profile is active.
@param project the project
@param profileName the profile name
@return <code>true</code> if profile is active, otherwise <code>false</code>
|
[
"Checks",
"if",
"profile",
"is",
"active",
"."
] |
train
|
https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/RequireActiveProfile.java#L151-L167
|
ngageoint/geopackage-android-map
|
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
|
FeatureShapes.removeShapesWithExclusions
|
public int removeShapesWithExclusions(String database, Set<GoogleMapShapeType> excludedTypes) {
"""
Remove all map shapes in the database from the map, excluding shapes with the excluded types
@param database GeoPackage database
@param excludedTypes Google Map Shape Types to exclude from map removal
@return count of removed features
@since 3.2.0
"""
int count = 0;
Map<String, Map<Long, FeatureShape>> tables = getTables(database);
if (tables != null) {
Iterator<String> iterator = tables.keySet().iterator();
while (iterator.hasNext()) {
String table = iterator.next();
count += removeShapesWithExclusions(database, table, excludedTypes);
if (getFeatureIdsCount(database, table) <= 0) {
iterator.remove();
}
}
}
return count;
}
|
java
|
public int removeShapesWithExclusions(String database, Set<GoogleMapShapeType> excludedTypes) {
int count = 0;
Map<String, Map<Long, FeatureShape>> tables = getTables(database);
if (tables != null) {
Iterator<String> iterator = tables.keySet().iterator();
while (iterator.hasNext()) {
String table = iterator.next();
count += removeShapesWithExclusions(database, table, excludedTypes);
if (getFeatureIdsCount(database, table) <= 0) {
iterator.remove();
}
}
}
return count;
}
|
[
"public",
"int",
"removeShapesWithExclusions",
"(",
"String",
"database",
",",
"Set",
"<",
"GoogleMapShapeType",
">",
"excludedTypes",
")",
"{",
"int",
"count",
"=",
"0",
";",
"Map",
"<",
"String",
",",
"Map",
"<",
"Long",
",",
"FeatureShape",
">",
">",
"tables",
"=",
"getTables",
"(",
"database",
")",
";",
"if",
"(",
"tables",
"!=",
"null",
")",
"{",
"Iterator",
"<",
"String",
">",
"iterator",
"=",
"tables",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"table",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"count",
"+=",
"removeShapesWithExclusions",
"(",
"database",
",",
"table",
",",
"excludedTypes",
")",
";",
"if",
"(",
"getFeatureIdsCount",
"(",
"database",
",",
"table",
")",
"<=",
"0",
")",
"{",
"iterator",
".",
"remove",
"(",
")",
";",
"}",
"}",
"}",
"return",
"count",
";",
"}"
] |
Remove all map shapes in the database from the map, excluding shapes with the excluded types
@param database GeoPackage database
@param excludedTypes Google Map Shape Types to exclude from map removal
@return count of removed features
@since 3.2.0
|
[
"Remove",
"all",
"map",
"shapes",
"in",
"the",
"database",
"from",
"the",
"map",
"excluding",
"shapes",
"with",
"the",
"excluded",
"types"
] |
train
|
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L329-L351
|
google/j2objc
|
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java
|
DecimalFormat.compareAffix
|
private int compareAffix(String text, int pos, boolean isNegative, boolean isPrefix,
String affixPat, boolean complexCurrencyParsing, int type, Currency[] currency) {
"""
Returns the length matched by the given affix, or -1 if none. Runs of white space
in the affix, match runs of white space in the input. Pattern white space and input
white space are determined differently; see code.
@param text input text
@param pos offset into input at which to begin matching
@param isNegative
@param isPrefix
@param affixPat affix pattern used for currency affix comparison
@param complexCurrencyParsing whether it is currency parsing or not
@param type compare against currency type, LONG_NAME only or not.
@param currency return value for parsed currency, for generic currency parsing
mode, or null for normal parsing. In generic currency parsing mode, any currency
is parsed, not just the currency that this formatter is set to.
@return length of input that matches, or -1 if match failure
"""
if (currency != null || currencyChoice != null || (currencySignCount != CURRENCY_SIGN_COUNT_ZERO && complexCurrencyParsing)) {
return compareComplexAffix(affixPat, text, pos, type, currency);
}
if (isPrefix) {
return compareSimpleAffix(isNegative ? negativePrefix : positivePrefix, text, pos);
} else {
return compareSimpleAffix(isNegative ? negativeSuffix : positiveSuffix, text, pos);
}
}
|
java
|
private int compareAffix(String text, int pos, boolean isNegative, boolean isPrefix,
String affixPat, boolean complexCurrencyParsing, int type, Currency[] currency) {
if (currency != null || currencyChoice != null || (currencySignCount != CURRENCY_SIGN_COUNT_ZERO && complexCurrencyParsing)) {
return compareComplexAffix(affixPat, text, pos, type, currency);
}
if (isPrefix) {
return compareSimpleAffix(isNegative ? negativePrefix : positivePrefix, text, pos);
} else {
return compareSimpleAffix(isNegative ? negativeSuffix : positiveSuffix, text, pos);
}
}
|
[
"private",
"int",
"compareAffix",
"(",
"String",
"text",
",",
"int",
"pos",
",",
"boolean",
"isNegative",
",",
"boolean",
"isPrefix",
",",
"String",
"affixPat",
",",
"boolean",
"complexCurrencyParsing",
",",
"int",
"type",
",",
"Currency",
"[",
"]",
"currency",
")",
"{",
"if",
"(",
"currency",
"!=",
"null",
"||",
"currencyChoice",
"!=",
"null",
"||",
"(",
"currencySignCount",
"!=",
"CURRENCY_SIGN_COUNT_ZERO",
"&&",
"complexCurrencyParsing",
")",
")",
"{",
"return",
"compareComplexAffix",
"(",
"affixPat",
",",
"text",
",",
"pos",
",",
"type",
",",
"currency",
")",
";",
"}",
"if",
"(",
"isPrefix",
")",
"{",
"return",
"compareSimpleAffix",
"(",
"isNegative",
"?",
"negativePrefix",
":",
"positivePrefix",
",",
"text",
",",
"pos",
")",
";",
"}",
"else",
"{",
"return",
"compareSimpleAffix",
"(",
"isNegative",
"?",
"negativeSuffix",
":",
"positiveSuffix",
",",
"text",
",",
"pos",
")",
";",
"}",
"}"
] |
Returns the length matched by the given affix, or -1 if none. Runs of white space
in the affix, match runs of white space in the input. Pattern white space and input
white space are determined differently; see code.
@param text input text
@param pos offset into input at which to begin matching
@param isNegative
@param isPrefix
@param affixPat affix pattern used for currency affix comparison
@param complexCurrencyParsing whether it is currency parsing or not
@param type compare against currency type, LONG_NAME only or not.
@param currency return value for parsed currency, for generic currency parsing
mode, or null for normal parsing. In generic currency parsing mode, any currency
is parsed, not just the currency that this formatter is set to.
@return length of input that matches, or -1 if match failure
|
[
"Returns",
"the",
"length",
"matched",
"by",
"the",
"given",
"affix",
"or",
"-",
"1",
"if",
"none",
".",
"Runs",
"of",
"white",
"space",
"in",
"the",
"affix",
"match",
"runs",
"of",
"white",
"space",
"in",
"the",
"input",
".",
"Pattern",
"white",
"space",
"and",
"input",
"white",
"space",
"are",
"determined",
"differently",
";",
"see",
"code",
"."
] |
train
|
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java#L2871-L2882
|
spotbugs/spotbugs
|
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java
|
TypeQualifierApplications.getDirectApplications
|
public static void getDirectApplications(Set<TypeQualifierAnnotation> result, XMethod o, int parameter) {
"""
Populate a Set of TypeQualifierAnnotations representing directly-applied
type qualifier annotations on given method parameter.
@param result
Set of TypeQualifierAnnotations
@param o
a method
@param parameter
a parameter (0 == first parameter)
"""
Collection<AnnotationValue> values = getDirectAnnotation(o, parameter);
for (AnnotationValue v : values) {
constructTypeQualifierAnnotation(result, v);
}
}
|
java
|
public static void getDirectApplications(Set<TypeQualifierAnnotation> result, XMethod o, int parameter) {
Collection<AnnotationValue> values = getDirectAnnotation(o, parameter);
for (AnnotationValue v : values) {
constructTypeQualifierAnnotation(result, v);
}
}
|
[
"public",
"static",
"void",
"getDirectApplications",
"(",
"Set",
"<",
"TypeQualifierAnnotation",
">",
"result",
",",
"XMethod",
"o",
",",
"int",
"parameter",
")",
"{",
"Collection",
"<",
"AnnotationValue",
">",
"values",
"=",
"getDirectAnnotation",
"(",
"o",
",",
"parameter",
")",
";",
"for",
"(",
"AnnotationValue",
"v",
":",
"values",
")",
"{",
"constructTypeQualifierAnnotation",
"(",
"result",
",",
"v",
")",
";",
"}",
"}"
] |
Populate a Set of TypeQualifierAnnotations representing directly-applied
type qualifier annotations on given method parameter.
@param result
Set of TypeQualifierAnnotations
@param o
a method
@param parameter
a parameter (0 == first parameter)
|
[
"Populate",
"a",
"Set",
"of",
"TypeQualifierAnnotations",
"representing",
"directly",
"-",
"applied",
"type",
"qualifier",
"annotations",
"on",
"given",
"method",
"parameter",
"."
] |
train
|
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java#L214-L220
|
google/closure-compiler
|
src/com/google/javascript/jscomp/NodeUtil.java
|
NodeUtil.nodeTypeMayHaveSideEffects
|
static boolean nodeTypeMayHaveSideEffects(Node n, AbstractCompiler compiler) {
"""
Returns true if the current node's type implies side effects.
<p>This is a non-recursive version of the may have side effects
check; used to check wherever the current node's type is one of
the reasons why a subtree has side effects.
"""
if (isAssignmentOp(n)) {
return true;
}
switch (n.getToken()) {
case DELPROP:
case DEC:
case INC:
case YIELD:
case THROW:
case AWAIT:
case FOR_IN: // assigns to a loop LHS
case FOR_OF: // assigns to a loop LHS, runs an iterator
case FOR_AWAIT_OF: // assigns to a loop LHS, runs an iterator, async operations.
return true;
case CALL:
case TAGGED_TEMPLATELIT:
return NodeUtil.functionCallHasSideEffects(n, compiler);
case NEW:
return NodeUtil.constructorCallHasSideEffects(n);
case NAME:
// A variable definition.
// TODO(b/129564961): Consider EXPORT declarations.
return n.hasChildren();
case REST:
case SPREAD:
return NodeUtil.iteratesImpureIterable(n);
default:
break;
}
return false;
}
|
java
|
static boolean nodeTypeMayHaveSideEffects(Node n, AbstractCompiler compiler) {
if (isAssignmentOp(n)) {
return true;
}
switch (n.getToken()) {
case DELPROP:
case DEC:
case INC:
case YIELD:
case THROW:
case AWAIT:
case FOR_IN: // assigns to a loop LHS
case FOR_OF: // assigns to a loop LHS, runs an iterator
case FOR_AWAIT_OF: // assigns to a loop LHS, runs an iterator, async operations.
return true;
case CALL:
case TAGGED_TEMPLATELIT:
return NodeUtil.functionCallHasSideEffects(n, compiler);
case NEW:
return NodeUtil.constructorCallHasSideEffects(n);
case NAME:
// A variable definition.
// TODO(b/129564961): Consider EXPORT declarations.
return n.hasChildren();
case REST:
case SPREAD:
return NodeUtil.iteratesImpureIterable(n);
default:
break;
}
return false;
}
|
[
"static",
"boolean",
"nodeTypeMayHaveSideEffects",
"(",
"Node",
"n",
",",
"AbstractCompiler",
"compiler",
")",
"{",
"if",
"(",
"isAssignmentOp",
"(",
"n",
")",
")",
"{",
"return",
"true",
";",
"}",
"switch",
"(",
"n",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"DELPROP",
":",
"case",
"DEC",
":",
"case",
"INC",
":",
"case",
"YIELD",
":",
"case",
"THROW",
":",
"case",
"AWAIT",
":",
"case",
"FOR_IN",
":",
"// assigns to a loop LHS",
"case",
"FOR_OF",
":",
"// assigns to a loop LHS, runs an iterator",
"case",
"FOR_AWAIT_OF",
":",
"// assigns to a loop LHS, runs an iterator, async operations.",
"return",
"true",
";",
"case",
"CALL",
":",
"case",
"TAGGED_TEMPLATELIT",
":",
"return",
"NodeUtil",
".",
"functionCallHasSideEffects",
"(",
"n",
",",
"compiler",
")",
";",
"case",
"NEW",
":",
"return",
"NodeUtil",
".",
"constructorCallHasSideEffects",
"(",
"n",
")",
";",
"case",
"NAME",
":",
"// A variable definition.",
"// TODO(b/129564961): Consider EXPORT declarations.",
"return",
"n",
".",
"hasChildren",
"(",
")",
";",
"case",
"REST",
":",
"case",
"SPREAD",
":",
"return",
"NodeUtil",
".",
"iteratesImpureIterable",
"(",
"n",
")",
";",
"default",
":",
"break",
";",
"}",
"return",
"false",
";",
"}"
] |
Returns true if the current node's type implies side effects.
<p>This is a non-recursive version of the may have side effects
check; used to check wherever the current node's type is one of
the reasons why a subtree has side effects.
|
[
"Returns",
"true",
"if",
"the",
"current",
"node",
"s",
"type",
"implies",
"side",
"effects",
"."
] |
train
|
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L1549-L1582
|
nguillaumin/slick2d-maven
|
slick2d-core/src/main/java/org/newdawn/slick/Image.java
|
Image.drawEmbedded
|
public void drawEmbedded(float x, float y, float x2, float y2, float srcx, float srcy, float srcx2, float srcy2, Color filter) {
"""
Draw a section of this image at a particular location and scale on the screen, while this
is image is "in use", i.e. between calls to startUse and endUse.
@param x The x position to draw the image
@param y The y position to draw the image
@param x2 The x position of the bottom right corner of the drawn image
@param y2 The y position of the bottom right corner of the drawn image
@param srcx The x position of the rectangle to draw from this image (i.e. relative to this image)
@param srcy The y position of the rectangle to draw from this image (i.e. relative to this image)
@param srcx2 The x position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image)
@param srcy2 The t position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image)
@param filter The colour filter to apply when drawing
"""
if (filter != null) {
filter.bind();
}
float mywidth = x2 - x;
float myheight = y2 - y;
float texwidth = srcx2 - srcx;
float texheight = srcy2 - srcy;
float newTextureOffsetX = (((srcx) / (width)) * textureWidth)
+ textureOffsetX;
float newTextureOffsetY = (((srcy) / (height)) * textureHeight)
+ textureOffsetY;
float newTextureWidth = ((texwidth) / (width))
* textureWidth;
float newTextureHeight = ((texheight) / (height))
* textureHeight;
GL.glTexCoord2f(newTextureOffsetX, newTextureOffsetY);
GL.glVertex3f(x,y, 0.0f);
GL.glTexCoord2f(newTextureOffsetX, newTextureOffsetY
+ newTextureHeight);
GL.glVertex3f(x,(y + myheight), 0.0f);
GL.glTexCoord2f(newTextureOffsetX + newTextureWidth,
newTextureOffsetY + newTextureHeight);
GL.glVertex3f((x + mywidth),(y + myheight), 0.0f);
GL.glTexCoord2f(newTextureOffsetX + newTextureWidth,
newTextureOffsetY);
GL.glVertex3f((x + mywidth),y, 0.0f);
}
|
java
|
public void drawEmbedded(float x, float y, float x2, float y2, float srcx, float srcy, float srcx2, float srcy2, Color filter) {
if (filter != null) {
filter.bind();
}
float mywidth = x2 - x;
float myheight = y2 - y;
float texwidth = srcx2 - srcx;
float texheight = srcy2 - srcy;
float newTextureOffsetX = (((srcx) / (width)) * textureWidth)
+ textureOffsetX;
float newTextureOffsetY = (((srcy) / (height)) * textureHeight)
+ textureOffsetY;
float newTextureWidth = ((texwidth) / (width))
* textureWidth;
float newTextureHeight = ((texheight) / (height))
* textureHeight;
GL.glTexCoord2f(newTextureOffsetX, newTextureOffsetY);
GL.glVertex3f(x,y, 0.0f);
GL.glTexCoord2f(newTextureOffsetX, newTextureOffsetY
+ newTextureHeight);
GL.glVertex3f(x,(y + myheight), 0.0f);
GL.glTexCoord2f(newTextureOffsetX + newTextureWidth,
newTextureOffsetY + newTextureHeight);
GL.glVertex3f((x + mywidth),(y + myheight), 0.0f);
GL.glTexCoord2f(newTextureOffsetX + newTextureWidth,
newTextureOffsetY);
GL.glVertex3f((x + mywidth),y, 0.0f);
}
|
[
"public",
"void",
"drawEmbedded",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"x2",
",",
"float",
"y2",
",",
"float",
"srcx",
",",
"float",
"srcy",
",",
"float",
"srcx2",
",",
"float",
"srcy2",
",",
"Color",
"filter",
")",
"{",
"if",
"(",
"filter",
"!=",
"null",
")",
"{",
"filter",
".",
"bind",
"(",
")",
";",
"}",
"float",
"mywidth",
"=",
"x2",
"-",
"x",
";",
"float",
"myheight",
"=",
"y2",
"-",
"y",
";",
"float",
"texwidth",
"=",
"srcx2",
"-",
"srcx",
";",
"float",
"texheight",
"=",
"srcy2",
"-",
"srcy",
";",
"float",
"newTextureOffsetX",
"=",
"(",
"(",
"(",
"srcx",
")",
"/",
"(",
"width",
")",
")",
"*",
"textureWidth",
")",
"+",
"textureOffsetX",
";",
"float",
"newTextureOffsetY",
"=",
"(",
"(",
"(",
"srcy",
")",
"/",
"(",
"height",
")",
")",
"*",
"textureHeight",
")",
"+",
"textureOffsetY",
";",
"float",
"newTextureWidth",
"=",
"(",
"(",
"texwidth",
")",
"/",
"(",
"width",
")",
")",
"*",
"textureWidth",
";",
"float",
"newTextureHeight",
"=",
"(",
"(",
"texheight",
")",
"/",
"(",
"height",
")",
")",
"*",
"textureHeight",
";",
"GL",
".",
"glTexCoord2f",
"(",
"newTextureOffsetX",
",",
"newTextureOffsetY",
")",
";",
"GL",
".",
"glVertex3f",
"(",
"x",
",",
"y",
",",
"0.0f",
")",
";",
"GL",
".",
"glTexCoord2f",
"(",
"newTextureOffsetX",
",",
"newTextureOffsetY",
"+",
"newTextureHeight",
")",
";",
"GL",
".",
"glVertex3f",
"(",
"x",
",",
"(",
"y",
"+",
"myheight",
")",
",",
"0.0f",
")",
";",
"GL",
".",
"glTexCoord2f",
"(",
"newTextureOffsetX",
"+",
"newTextureWidth",
",",
"newTextureOffsetY",
"+",
"newTextureHeight",
")",
";",
"GL",
".",
"glVertex3f",
"(",
"(",
"x",
"+",
"mywidth",
")",
",",
"(",
"y",
"+",
"myheight",
")",
",",
"0.0f",
")",
";",
"GL",
".",
"glTexCoord2f",
"(",
"newTextureOffsetX",
"+",
"newTextureWidth",
",",
"newTextureOffsetY",
")",
";",
"GL",
".",
"glVertex3f",
"(",
"(",
"x",
"+",
"mywidth",
")",
",",
"y",
",",
"0.0f",
")",
";",
"}"
] |
Draw a section of this image at a particular location and scale on the screen, while this
is image is "in use", i.e. between calls to startUse and endUse.
@param x The x position to draw the image
@param y The y position to draw the image
@param x2 The x position of the bottom right corner of the drawn image
@param y2 The y position of the bottom right corner of the drawn image
@param srcx The x position of the rectangle to draw from this image (i.e. relative to this image)
@param srcy The y position of the rectangle to draw from this image (i.e. relative to this image)
@param srcx2 The x position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image)
@param srcy2 The t position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image)
@param filter The colour filter to apply when drawing
|
[
"Draw",
"a",
"section",
"of",
"this",
"image",
"at",
"a",
"particular",
"location",
"and",
"scale",
"on",
"the",
"screen",
"while",
"this",
"is",
"image",
"is",
"in",
"use",
"i",
".",
"e",
".",
"between",
"calls",
"to",
"startUse",
"and",
"endUse",
"."
] |
train
|
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L1094-L1124
|
alkacon/opencms-core
|
src/org/opencms/workplace/editors/directedit/CmsDirectEditJQueryProvider.java
|
CmsDirectEditJQueryProvider.appendDirectEditData
|
private String appendDirectEditData(CmsDirectEditParams params, boolean disabled) {
"""
Appends the data for the direct edit buttons, which are dynamically created with jQuery.<p>
Generates the following code:<p>
<pre>
<script type="text/javascript" >
ocms_de_data['key']= {
id: key,
resource: res,
...
};
</script >
</pre>
@param params the direct edit parameters
@param disabled if the buttons are disabled or not
@return the data needed for the direct edit buttons
"""
StringBuffer result = new StringBuffer(512);
String editId = getNextDirectEditId();
result.append("\n<script type=\"text/javascript\">\n");
result.append("ocms_de_data['").append(editId).append("']= {\n");
result.append("\t").append("id: '").append(editId).append("',\n");
result.append("\t").append("deDisabled: ").append(disabled).append(",\n");
result.append("\t").append("hasEdit: ").append(params.getButtonSelection().isShowEdit()).append(",\n");
result.append("\t").append("hasDelete: ").append(params.getButtonSelection().isShowDelete()).append(",\n");
result.append("\t").append("hasNew: ").append(params.getButtonSelection().isShowNew()).append(",\n");
result.append("\t").append("resource: '").append(params.getResourceName()).append("',\n");
result.append("\t").append("editLink: '").append(getLink(params.getLinkForEdit())).append("',\n");
result.append("\t").append("language: '").append(m_cms.getRequestContext().getLocale().toString());
result.append("',\n");
result.append("\t").append("element: '").append(params.getElement()).append("',\n");
result.append("\t").append("backlink: '").append(m_cms.getRequestContext().getUri()).append("',\n");
result.append("\t").append("newlink: '").append(CmsEncoder.encode(params.getLinkForNew())).append("',\n");
result.append("\t").append("closelink: '").append(m_closeLink).append("',\n");
result.append("\t").append("deletelink: '").append(getLink(params.getLinkForDelete())).append("',\n");
if (!disabled) {
result.append("\t").append("button_edit: '");
result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_EDIT_0)).append("',\n");
result.append("\t").append("button_delete: '");
result.append(m_messages.key(Messages.GUI_BUTTON_DELETE_0)).append("',\n");
result.append("\t").append("button_new: '");
result.append(m_messages.key(Messages.GUI_BUTTON_NEW_0)).append("',\n");
} else {
result.append("\t").append("button_edit: '");
result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0)).append("',\n");
result.append("\t").append("button_delete: '");
result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0)).append("',\n");
result.append("\t").append("button_new: '");
result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0)).append("',\n");
}
result.append("\t").append("editortitle: '").append(m_messages.key(Messages.GUI_EDITOR_TITLE_NEW_0));
result.append("'\n");
result.append("};\n");
result.append("</script>\n");
result.append("<div id=\"").append(editId).append("\" class=\"ocms_de_norm\">");
return result.toString();
}
|
java
|
private String appendDirectEditData(CmsDirectEditParams params, boolean disabled) {
StringBuffer result = new StringBuffer(512);
String editId = getNextDirectEditId();
result.append("\n<script type=\"text/javascript\">\n");
result.append("ocms_de_data['").append(editId).append("']= {\n");
result.append("\t").append("id: '").append(editId).append("',\n");
result.append("\t").append("deDisabled: ").append(disabled).append(",\n");
result.append("\t").append("hasEdit: ").append(params.getButtonSelection().isShowEdit()).append(",\n");
result.append("\t").append("hasDelete: ").append(params.getButtonSelection().isShowDelete()).append(",\n");
result.append("\t").append("hasNew: ").append(params.getButtonSelection().isShowNew()).append(",\n");
result.append("\t").append("resource: '").append(params.getResourceName()).append("',\n");
result.append("\t").append("editLink: '").append(getLink(params.getLinkForEdit())).append("',\n");
result.append("\t").append("language: '").append(m_cms.getRequestContext().getLocale().toString());
result.append("',\n");
result.append("\t").append("element: '").append(params.getElement()).append("',\n");
result.append("\t").append("backlink: '").append(m_cms.getRequestContext().getUri()).append("',\n");
result.append("\t").append("newlink: '").append(CmsEncoder.encode(params.getLinkForNew())).append("',\n");
result.append("\t").append("closelink: '").append(m_closeLink).append("',\n");
result.append("\t").append("deletelink: '").append(getLink(params.getLinkForDelete())).append("',\n");
if (!disabled) {
result.append("\t").append("button_edit: '");
result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_EDIT_0)).append("',\n");
result.append("\t").append("button_delete: '");
result.append(m_messages.key(Messages.GUI_BUTTON_DELETE_0)).append("',\n");
result.append("\t").append("button_new: '");
result.append(m_messages.key(Messages.GUI_BUTTON_NEW_0)).append("',\n");
} else {
result.append("\t").append("button_edit: '");
result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0)).append("',\n");
result.append("\t").append("button_delete: '");
result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0)).append("',\n");
result.append("\t").append("button_new: '");
result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0)).append("',\n");
}
result.append("\t").append("editortitle: '").append(m_messages.key(Messages.GUI_EDITOR_TITLE_NEW_0));
result.append("'\n");
result.append("};\n");
result.append("</script>\n");
result.append("<div id=\"").append(editId).append("\" class=\"ocms_de_norm\">");
return result.toString();
}
|
[
"private",
"String",
"appendDirectEditData",
"(",
"CmsDirectEditParams",
"params",
",",
"boolean",
"disabled",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"512",
")",
";",
"String",
"editId",
"=",
"getNextDirectEditId",
"(",
")",
";",
"result",
".",
"append",
"(",
"\"\\n<script type=\\\"text/javascript\\\">\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"ocms_de_data['\"",
")",
".",
"append",
"(",
"editId",
")",
".",
"append",
"(",
"\"']= {\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"id: '\"",
")",
".",
"append",
"(",
"editId",
")",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"deDisabled: \"",
")",
".",
"append",
"(",
"disabled",
")",
".",
"append",
"(",
"\",\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"hasEdit: \"",
")",
".",
"append",
"(",
"params",
".",
"getButtonSelection",
"(",
")",
".",
"isShowEdit",
"(",
")",
")",
".",
"append",
"(",
"\",\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"hasDelete: \"",
")",
".",
"append",
"(",
"params",
".",
"getButtonSelection",
"(",
")",
".",
"isShowDelete",
"(",
")",
")",
".",
"append",
"(",
"\",\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"hasNew: \"",
")",
".",
"append",
"(",
"params",
".",
"getButtonSelection",
"(",
")",
".",
"isShowNew",
"(",
")",
")",
".",
"append",
"(",
"\",\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"resource: '\"",
")",
".",
"append",
"(",
"params",
".",
"getResourceName",
"(",
")",
")",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"editLink: '\"",
")",
".",
"append",
"(",
"getLink",
"(",
"params",
".",
"getLinkForEdit",
"(",
")",
")",
")",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"language: '\"",
")",
".",
"append",
"(",
"m_cms",
".",
"getRequestContext",
"(",
")",
".",
"getLocale",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"result",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"element: '\"",
")",
".",
"append",
"(",
"params",
".",
"getElement",
"(",
")",
")",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"backlink: '\"",
")",
".",
"append",
"(",
"m_cms",
".",
"getRequestContext",
"(",
")",
".",
"getUri",
"(",
")",
")",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"newlink: '\"",
")",
".",
"append",
"(",
"CmsEncoder",
".",
"encode",
"(",
"params",
".",
"getLinkForNew",
"(",
")",
")",
")",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"closelink: '\"",
")",
".",
"append",
"(",
"m_closeLink",
")",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"deletelink: '\"",
")",
".",
"append",
"(",
"getLink",
"(",
"params",
".",
"getLinkForDelete",
"(",
")",
")",
")",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"if",
"(",
"!",
"disabled",
")",
"{",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"button_edit: '\"",
")",
";",
"result",
".",
"append",
"(",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"GUI_EDITOR_FRONTEND_BUTTON_EDIT_0",
")",
")",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"button_delete: '\"",
")",
";",
"result",
".",
"append",
"(",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"GUI_BUTTON_DELETE_0",
")",
")",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"button_new: '\"",
")",
";",
"result",
".",
"append",
"(",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"GUI_BUTTON_NEW_0",
")",
")",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"}",
"else",
"{",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"button_edit: '\"",
")",
";",
"result",
".",
"append",
"(",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0",
")",
")",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"button_delete: '\"",
")",
";",
"result",
".",
"append",
"(",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0",
")",
")",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"button_new: '\"",
")",
";",
"result",
".",
"append",
"(",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0",
")",
")",
".",
"append",
"(",
"\"',\\n\"",
")",
";",
"}",
"result",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"\"editortitle: '\"",
")",
".",
"append",
"(",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"GUI_EDITOR_TITLE_NEW_0",
")",
")",
";",
"result",
".",
"append",
"(",
"\"'\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"};\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"</script>\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"<div id=\\\"\"",
")",
".",
"append",
"(",
"editId",
")",
".",
"append",
"(",
"\"\\\" class=\\\"ocms_de_norm\\\">\"",
")",
";",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] |
Appends the data for the direct edit buttons, which are dynamically created with jQuery.<p>
Generates the following code:<p>
<pre>
<script type="text/javascript" >
ocms_de_data['key']= {
id: key,
resource: res,
...
};
</script >
</pre>
@param params the direct edit parameters
@param disabled if the buttons are disabled or not
@return the data needed for the direct edit buttons
|
[
"Appends",
"the",
"data",
"for",
"the",
"direct",
"edit",
"buttons",
"which",
"are",
"dynamically",
"created",
"with",
"jQuery",
".",
"<p",
">"
] |
train
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/directedit/CmsDirectEditJQueryProvider.java#L144-L189
|
structurizr/java
|
structurizr-core/src/com/structurizr/model/Model.java
|
Model.modifyRelationship
|
public void modifyRelationship(Relationship relationship, String description, String technology) {
"""
Provides a way for the description and technology to be modified on an existing relationship.
@param relationship a Relationship instance
@param description the new description
@param technology the new technology
"""
if (relationship == null) {
throw new IllegalArgumentException("A relationship must be specified.");
}
Relationship newRelationship = new Relationship(relationship.getSource(), relationship.getDestination(), description, technology, relationship.getInteractionStyle());
if (!relationship.getSource().has(newRelationship)) {
relationship.setDescription(description);
relationship.setTechnology(technology);
} else {
throw new IllegalArgumentException("This relationship exists already: " + newRelationship);
}
}
|
java
|
public void modifyRelationship(Relationship relationship, String description, String technology) {
if (relationship == null) {
throw new IllegalArgumentException("A relationship must be specified.");
}
Relationship newRelationship = new Relationship(relationship.getSource(), relationship.getDestination(), description, technology, relationship.getInteractionStyle());
if (!relationship.getSource().has(newRelationship)) {
relationship.setDescription(description);
relationship.setTechnology(technology);
} else {
throw new IllegalArgumentException("This relationship exists already: " + newRelationship);
}
}
|
[
"public",
"void",
"modifyRelationship",
"(",
"Relationship",
"relationship",
",",
"String",
"description",
",",
"String",
"technology",
")",
"{",
"if",
"(",
"relationship",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A relationship must be specified.\"",
")",
";",
"}",
"Relationship",
"newRelationship",
"=",
"new",
"Relationship",
"(",
"relationship",
".",
"getSource",
"(",
")",
",",
"relationship",
".",
"getDestination",
"(",
")",
",",
"description",
",",
"technology",
",",
"relationship",
".",
"getInteractionStyle",
"(",
")",
")",
";",
"if",
"(",
"!",
"relationship",
".",
"getSource",
"(",
")",
".",
"has",
"(",
"newRelationship",
")",
")",
"{",
"relationship",
".",
"setDescription",
"(",
"description",
")",
";",
"relationship",
".",
"setTechnology",
"(",
"technology",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"This relationship exists already: \"",
"+",
"newRelationship",
")",
";",
"}",
"}"
] |
Provides a way for the description and technology to be modified on an existing relationship.
@param relationship a Relationship instance
@param description the new description
@param technology the new technology
|
[
"Provides",
"a",
"way",
"for",
"the",
"description",
"and",
"technology",
"to",
"be",
"modified",
"on",
"an",
"existing",
"relationship",
"."
] |
train
|
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Model.java#L795-L807
|
NoraUi/NoraUi
|
src/main/java/com/github/noraui/utils/Utilities.java
|
Utilities.setProperty
|
public static String setProperty(String value, String defValue) {
"""
Set value to a variable (null is forbiden, so set default value).
@param value
is value setted if value is not null.
@param defValue
is value setted if value is null.
@return a {link java.lang.String} with the value not null.
"""
if (value != null && !"".equals(value)) {
return value;
}
return defValue;
}
|
java
|
public static String setProperty(String value, String defValue) {
if (value != null && !"".equals(value)) {
return value;
}
return defValue;
}
|
[
"public",
"static",
"String",
"setProperty",
"(",
"String",
"value",
",",
"String",
"defValue",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"value",
")",
")",
"{",
"return",
"value",
";",
"}",
"return",
"defValue",
";",
"}"
] |
Set value to a variable (null is forbiden, so set default value).
@param value
is value setted if value is not null.
@param defValue
is value setted if value is null.
@return a {link java.lang.String} with the value not null.
|
[
"Set",
"value",
"to",
"a",
"variable",
"(",
"null",
"is",
"forbiden",
"so",
"set",
"default",
"value",
")",
"."
] |
train
|
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/utils/Utilities.java#L206-L211
|
samskivert/pythagoras
|
src/main/java/pythagoras/d/Rectangles.java
|
Rectangles.pointRectDistance
|
public static double pointRectDistance (IRectangle r, IPoint p) {
"""
Returns the Euclidean distance between the given point and the nearest point inside the
bounds of the given rectangle. If the supplied point is inside the rectangle, the distance
will be zero.
"""
return Math.sqrt(pointRectDistanceSq(r, p));
}
|
java
|
public static double pointRectDistance (IRectangle r, IPoint p) {
return Math.sqrt(pointRectDistanceSq(r, p));
}
|
[
"public",
"static",
"double",
"pointRectDistance",
"(",
"IRectangle",
"r",
",",
"IPoint",
"p",
")",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"pointRectDistanceSq",
"(",
"r",
",",
"p",
")",
")",
";",
"}"
] |
Returns the Euclidean distance between the given point and the nearest point inside the
bounds of the given rectangle. If the supplied point is inside the rectangle, the distance
will be zero.
|
[
"Returns",
"the",
"Euclidean",
"distance",
"between",
"the",
"given",
"point",
"and",
"the",
"nearest",
"point",
"inside",
"the",
"bounds",
"of",
"the",
"given",
"rectangle",
".",
"If",
"the",
"supplied",
"point",
"is",
"inside",
"the",
"rectangle",
"the",
"distance",
"will",
"be",
"zero",
"."
] |
train
|
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Rectangles.java#L68-L70
|
linkedin/linkedin-zookeeper
|
org.linkedin.zookeeper-impl/src/main/java/org/linkedin/zookeeper/client/AbstractZKClient.java
|
AbstractZKClient.createOrSetWithParents
|
@Override
public Stat createOrSetWithParents(String path, String data, List<ACL> acl, CreateMode createMode)
throws InterruptedException, KeeperException {
"""
Tries to create first and if the node exists, then does a setData.
@return <code>null</code> if create worked, otherwise the result of setData
"""
if(exists(path) != null)
return setData(path, data);
try
{
createWithParents(path, data, acl, createMode);
return null;
}
catch(KeeperException.NodeExistsException e)
{
// this should not happen very often (race condition)
return setData(path, data);
}
}
|
java
|
@Override
public Stat createOrSetWithParents(String path, String data, List<ACL> acl, CreateMode createMode)
throws InterruptedException, KeeperException
{
if(exists(path) != null)
return setData(path, data);
try
{
createWithParents(path, data, acl, createMode);
return null;
}
catch(KeeperException.NodeExistsException e)
{
// this should not happen very often (race condition)
return setData(path, data);
}
}
|
[
"@",
"Override",
"public",
"Stat",
"createOrSetWithParents",
"(",
"String",
"path",
",",
"String",
"data",
",",
"List",
"<",
"ACL",
">",
"acl",
",",
"CreateMode",
"createMode",
")",
"throws",
"InterruptedException",
",",
"KeeperException",
"{",
"if",
"(",
"exists",
"(",
"path",
")",
"!=",
"null",
")",
"return",
"setData",
"(",
"path",
",",
"data",
")",
";",
"try",
"{",
"createWithParents",
"(",
"path",
",",
"data",
",",
"acl",
",",
"createMode",
")",
";",
"return",
"null",
";",
"}",
"catch",
"(",
"KeeperException",
".",
"NodeExistsException",
"e",
")",
"{",
"// this should not happen very often (race condition)",
"return",
"setData",
"(",
"path",
",",
"data",
")",
";",
"}",
"}"
] |
Tries to create first and if the node exists, then does a setData.
@return <code>null</code> if create worked, otherwise the result of setData
|
[
"Tries",
"to",
"create",
"first",
"and",
"if",
"the",
"node",
"exists",
"then",
"does",
"a",
"setData",
"."
] |
train
|
https://github.com/linkedin/linkedin-zookeeper/blob/600b1d01318594ed425ede566bbbdc94b026a53e/org.linkedin.zookeeper-impl/src/main/java/org/linkedin/zookeeper/client/AbstractZKClient.java#L233-L251
|
Netflix/spectator
|
spectator-api/src/main/java/com/netflix/spectator/api/AbstractRegistry.java
|
AbstractRegistry.getOrCreate
|
@SuppressWarnings("unchecked")
protected <T extends Meter> T getOrCreate(Id id, Class<T> cls, T dflt, Function<Id, T> factory) {
"""
Helper used to get or create an instance of a core meter type. This is mostly used
internally to this implementation, but may be useful in rare cases for creating
customizations based on a core type in a sub-class.
@param id
Identifier used to lookup this meter in the registry.
@param cls
Type of the meter.
@param dflt
Default value used if there is a failure during the lookup and it is not configured
to propagate.
@param factory
Function for creating a new instance of the meter type if one is not already available
in the registry.
@return
Instance of the meter.
"""
try {
Preconditions.checkNotNull(id, "id");
Meter m = Utils.computeIfAbsent(meters, id, i -> compute(factory.apply(i), dflt));
if (!cls.isAssignableFrom(m.getClass())) {
logTypeError(id, cls, m.getClass());
m = dflt;
}
return (T) m;
} catch (Exception e) {
propagate(e);
return dflt;
}
}
|
java
|
@SuppressWarnings("unchecked")
protected <T extends Meter> T getOrCreate(Id id, Class<T> cls, T dflt, Function<Id, T> factory) {
try {
Preconditions.checkNotNull(id, "id");
Meter m = Utils.computeIfAbsent(meters, id, i -> compute(factory.apply(i), dflt));
if (!cls.isAssignableFrom(m.getClass())) {
logTypeError(id, cls, m.getClass());
m = dflt;
}
return (T) m;
} catch (Exception e) {
propagate(e);
return dflt;
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"<",
"T",
"extends",
"Meter",
">",
"T",
"getOrCreate",
"(",
"Id",
"id",
",",
"Class",
"<",
"T",
">",
"cls",
",",
"T",
"dflt",
",",
"Function",
"<",
"Id",
",",
"T",
">",
"factory",
")",
"{",
"try",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"id",
",",
"\"id\"",
")",
";",
"Meter",
"m",
"=",
"Utils",
".",
"computeIfAbsent",
"(",
"meters",
",",
"id",
",",
"i",
"->",
"compute",
"(",
"factory",
".",
"apply",
"(",
"i",
")",
",",
"dflt",
")",
")",
";",
"if",
"(",
"!",
"cls",
".",
"isAssignableFrom",
"(",
"m",
".",
"getClass",
"(",
")",
")",
")",
"{",
"logTypeError",
"(",
"id",
",",
"cls",
",",
"m",
".",
"getClass",
"(",
")",
")",
";",
"m",
"=",
"dflt",
";",
"}",
"return",
"(",
"T",
")",
"m",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"propagate",
"(",
"e",
")",
";",
"return",
"dflt",
";",
"}",
"}"
] |
Helper used to get or create an instance of a core meter type. This is mostly used
internally to this implementation, but may be useful in rare cases for creating
customizations based on a core type in a sub-class.
@param id
Identifier used to lookup this meter in the registry.
@param cls
Type of the meter.
@param dflt
Default value used if there is a failure during the lookup and it is not configured
to propagate.
@param factory
Function for creating a new instance of the meter type if one is not already available
in the registry.
@return
Instance of the meter.
|
[
"Helper",
"used",
"to",
"get",
"or",
"create",
"an",
"instance",
"of",
"a",
"core",
"meter",
"type",
".",
"This",
"is",
"mostly",
"used",
"internally",
"to",
"this",
"implementation",
"but",
"may",
"be",
"useful",
"in",
"rare",
"cases",
"for",
"creating",
"customizations",
"based",
"on",
"a",
"core",
"type",
"in",
"a",
"sub",
"-",
"class",
"."
] |
train
|
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/AbstractRegistry.java#L203-L217
|
boncey/Flickr4Java
|
src/main/java/com/flickr4java/flickr/prefs/PrefsInterface.java
|
PrefsInterface.getGeoPerms
|
public int getGeoPerms() throws FlickrException {
"""
Returns the default privacy level for geographic information attached to the user's photos.
@return privacy-level
@throws FlickrException
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_NO_FILTER
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_PUBLIC
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FAMILY
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS_FAMILY
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_PRIVATE
"""
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_GEO_PERMS);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
int perm = -1;
Element personElement = response.getPayload();
String geoPerms = personElement.getAttribute("geoperms");
try {
perm = Integer.parseInt(geoPerms);
} catch (NumberFormatException e) {
throw new FlickrException("0", "Unable to parse geoPermission");
}
return perm;
}
|
java
|
public int getGeoPerms() throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_GEO_PERMS);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
int perm = -1;
Element personElement = response.getPayload();
String geoPerms = personElement.getAttribute("geoperms");
try {
perm = Integer.parseInt(geoPerms);
} catch (NumberFormatException e) {
throw new FlickrException("0", "Unable to parse geoPermission");
}
return perm;
}
|
[
"public",
"int",
"getGeoPerms",
"(",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put",
"(",
"\"method\"",
",",
"METHOD_GET_GEO_PERMS",
")",
";",
"Response",
"response",
"=",
"transportAPI",
".",
"get",
"(",
"transportAPI",
".",
"getPath",
"(",
")",
",",
"parameters",
",",
"apiKey",
",",
"sharedSecret",
")",
";",
"if",
"(",
"response",
".",
"isError",
"(",
")",
")",
"{",
"throw",
"new",
"FlickrException",
"(",
"response",
".",
"getErrorCode",
"(",
")",
",",
"response",
".",
"getErrorMessage",
"(",
")",
")",
";",
"}",
"int",
"perm",
"=",
"-",
"1",
";",
"Element",
"personElement",
"=",
"response",
".",
"getPayload",
"(",
")",
";",
"String",
"geoPerms",
"=",
"personElement",
".",
"getAttribute",
"(",
"\"geoperms\"",
")",
";",
"try",
"{",
"perm",
"=",
"Integer",
".",
"parseInt",
"(",
"geoPerms",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"throw",
"new",
"FlickrException",
"(",
"\"0\"",
",",
"\"Unable to parse geoPermission\"",
")",
";",
"}",
"return",
"perm",
";",
"}"
] |
Returns the default privacy level for geographic information attached to the user's photos.
@return privacy-level
@throws FlickrException
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_NO_FILTER
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_PUBLIC
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FAMILY
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS_FAMILY
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_PRIVATE
|
[
"Returns",
"the",
"default",
"privacy",
"level",
"for",
"geographic",
"information",
"attached",
"to",
"the",
"user",
"s",
"photos",
"."
] |
train
|
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/prefs/PrefsInterface.java#L86-L104
|
js-lib-com/net-client
|
src/main/java/js/net/client/HttpRmiFactory.java
|
HttpRmiFactory.getRemoteInstance
|
@SuppressWarnings("unchecked")
public <I> I getRemoteInstance(String implementationURL, Class<? super I> interfaceClass) {
"""
Create a new Java Proxy instance for a remote class implementing requested interface. In order to create a remote class
instance one should know the URL of the context where the remote class is deployed. Also need to know service provider
interface - see {@link js.net.client} package description, <em>Remote Service Client</em> section.
@param implementationURL the URL of remote implementation,
@param interfaceClass remote class interface.
@param <I> instance type.
@return newly created Java Proxy instance.
@throws IllegalArgumentException if <code>implementationURL</code> is null or empty.
@throws IllegalArgumentException if <code>interfaceClass</code> is null.
"""
Params.notNull(implementationURL, "Implementation URL");
Params.notNull(interfaceClass, "Interface class");
// at this point we know that interface class is a super of returned instance class so is safe to suppress warning
return (I) Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class<?>[] { interfaceClass }, new HttpRmiTransactionHandler(implementationURL));
}
|
java
|
@SuppressWarnings("unchecked")
public <I> I getRemoteInstance(String implementationURL, Class<? super I> interfaceClass) {
Params.notNull(implementationURL, "Implementation URL");
Params.notNull(interfaceClass, "Interface class");
// at this point we know that interface class is a super of returned instance class so is safe to suppress warning
return (I) Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class<?>[] { interfaceClass }, new HttpRmiTransactionHandler(implementationURL));
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"I",
">",
"I",
"getRemoteInstance",
"(",
"String",
"implementationURL",
",",
"Class",
"<",
"?",
"super",
"I",
">",
"interfaceClass",
")",
"{",
"Params",
".",
"notNull",
"(",
"implementationURL",
",",
"\"Implementation URL\"",
")",
";",
"Params",
".",
"notNull",
"(",
"interfaceClass",
",",
"\"Interface class\"",
")",
";",
"// at this point we know that interface class is a super of returned instance class so is safe to suppress warning\r",
"return",
"(",
"I",
")",
"Proxy",
".",
"newProxyInstance",
"(",
"interfaceClass",
".",
"getClassLoader",
"(",
")",
",",
"new",
"Class",
"<",
"?",
">",
"[",
"]",
"{",
"interfaceClass",
"}",
",",
"new",
"HttpRmiTransactionHandler",
"(",
"implementationURL",
")",
")",
";",
"}"
] |
Create a new Java Proxy instance for a remote class implementing requested interface. In order to create a remote class
instance one should know the URL of the context where the remote class is deployed. Also need to know service provider
interface - see {@link js.net.client} package description, <em>Remote Service Client</em> section.
@param implementationURL the URL of remote implementation,
@param interfaceClass remote class interface.
@param <I> instance type.
@return newly created Java Proxy instance.
@throws IllegalArgumentException if <code>implementationURL</code> is null or empty.
@throws IllegalArgumentException if <code>interfaceClass</code> is null.
|
[
"Create",
"a",
"new",
"Java",
"Proxy",
"instance",
"for",
"a",
"remote",
"class",
"implementing",
"requested",
"interface",
".",
"In",
"order",
"to",
"create",
"a",
"remote",
"class",
"instance",
"one",
"should",
"know",
"the",
"URL",
"of",
"the",
"context",
"where",
"the",
"remote",
"class",
"is",
"deployed",
".",
"Also",
"need",
"to",
"know",
"service",
"provider",
"interface",
"-",
"see",
"{",
"@link",
"js",
".",
"net",
".",
"client",
"}",
"package",
"description",
"<em",
">",
"Remote",
"Service",
"Client<",
"/",
"em",
">",
"section",
"."
] |
train
|
https://github.com/js-lib-com/net-client/blob/0489f85d8baa1be1ff115aa79929e0cf05d4c72d/src/main/java/js/net/client/HttpRmiFactory.java#L30-L36
|
aws/aws-sdk-java
|
aws-java-sdk-core/src/main/java/com/amazonaws/event/SDKProgressPublisher.java
|
SDKProgressPublisher.publishProgress
|
public static Future<?> publishProgress(
final ProgressListener listener,
final ProgressEventType type) {
"""
Used to deliver a progress event to the given listener.
@return the future of a submitted task; or null if the delivery is
synchronous with no future task involved. Note a listener should never
block, and therefore returning null is the typical case.
"""
if (listener == ProgressListener.NOOP || listener == null
|| type == null) {
return null;
}
return deliverEvent(listener, new ProgressEvent(type));
}
|
java
|
public static Future<?> publishProgress(
final ProgressListener listener,
final ProgressEventType type) {
if (listener == ProgressListener.NOOP || listener == null
|| type == null) {
return null;
}
return deliverEvent(listener, new ProgressEvent(type));
}
|
[
"public",
"static",
"Future",
"<",
"?",
">",
"publishProgress",
"(",
"final",
"ProgressListener",
"listener",
",",
"final",
"ProgressEventType",
"type",
")",
"{",
"if",
"(",
"listener",
"==",
"ProgressListener",
".",
"NOOP",
"||",
"listener",
"==",
"null",
"||",
"type",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"deliverEvent",
"(",
"listener",
",",
"new",
"ProgressEvent",
"(",
"type",
")",
")",
";",
"}"
] |
Used to deliver a progress event to the given listener.
@return the future of a submitted task; or null if the delivery is
synchronous with no future task involved. Note a listener should never
block, and therefore returning null is the typical case.
|
[
"Used",
"to",
"deliver",
"a",
"progress",
"event",
"to",
"the",
"given",
"listener",
"."
] |
train
|
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/event/SDKProgressPublisher.java#L51-L59
|
MKLab-ITI/multimedia-indexing
|
src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java
|
ImageIOGreyScale.getImageWritersByMIMEType
|
public static Iterator<ImageWriter> getImageWritersByMIMEType(String MIMEType) {
"""
Returns an <code>Iterator</code> containing all currently registered <code>ImageWriter</code>s that
claim to be able to encode files with the given MIME type.
@param MIMEType
a <code>String</code> containing a file suffix (<i>e.g.</i>, "image/jpeg" or "image/x-bmp").
@return an <code>Iterator</code> containing <code>ImageWriter</code>s.
@exception IllegalArgumentException
if <code>MIMEType</code> is <code>null</code>.
@see javax.imageio.spi.ImageWriterSpi#getMIMETypes
"""
if (MIMEType == null) {
throw new IllegalArgumentException("MIMEType == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageWriterSpi.class, new ContainsFilter(writerMIMETypesMethod, MIMEType), true);
} catch (IllegalArgumentException e) {
return new HashSet().iterator();
}
return new ImageWriterIterator(iter);
}
|
java
|
public static Iterator<ImageWriter> getImageWritersByMIMEType(String MIMEType) {
if (MIMEType == null) {
throw new IllegalArgumentException("MIMEType == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageWriterSpi.class, new ContainsFilter(writerMIMETypesMethod, MIMEType), true);
} catch (IllegalArgumentException e) {
return new HashSet().iterator();
}
return new ImageWriterIterator(iter);
}
|
[
"public",
"static",
"Iterator",
"<",
"ImageWriter",
">",
"getImageWritersByMIMEType",
"(",
"String",
"MIMEType",
")",
"{",
"if",
"(",
"MIMEType",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"MIMEType == null!\"",
")",
";",
"}",
"Iterator",
"iter",
";",
"// Ensure category is present\r",
"try",
"{",
"iter",
"=",
"theRegistry",
".",
"getServiceProviders",
"(",
"ImageWriterSpi",
".",
"class",
",",
"new",
"ContainsFilter",
"(",
"writerMIMETypesMethod",
",",
"MIMEType",
")",
",",
"true",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"return",
"new",
"HashSet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"}",
"return",
"new",
"ImageWriterIterator",
"(",
"iter",
")",
";",
"}"
] |
Returns an <code>Iterator</code> containing all currently registered <code>ImageWriter</code>s that
claim to be able to encode files with the given MIME type.
@param MIMEType
a <code>String</code> containing a file suffix (<i>e.g.</i>, "image/jpeg" or "image/x-bmp").
@return an <code>Iterator</code> containing <code>ImageWriter</code>s.
@exception IllegalArgumentException
if <code>MIMEType</code> is <code>null</code>.
@see javax.imageio.spi.ImageWriterSpi#getMIMETypes
|
[
"Returns",
"an",
"<code",
">",
"Iterator<",
"/",
"code",
">",
"containing",
"all",
"currently",
"registered",
"<code",
">",
"ImageWriter<",
"/",
"code",
">",
"s",
"that",
"claim",
"to",
"be",
"able",
"to",
"encode",
"files",
"with",
"the",
"given",
"MIME",
"type",
"."
] |
train
|
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java#L837-L849
|
alkacon/opencms-core
|
src-modules/org/opencms/workplace/tools/searchindex/sourcesearch/CmsSourceSearchCollector.java
|
CmsSourceSearchCollector.getResource
|
@Override
public CmsResource getResource(CmsObject cms, CmsListItem item) {
"""
Returns the resource for the given item.<p>
@param cms the cms object
@param item the item
@return the resource
"""
CmsResource res = null;
CmsUUID id = new CmsUUID(item.getId());
if (!id.isNullUUID()) {
try {
res = cms.readResource(id, CmsResourceFilter.ALL);
} catch (CmsException e) {
// should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e);
}
}
}
return res;
}
|
java
|
@Override
public CmsResource getResource(CmsObject cms, CmsListItem item) {
CmsResource res = null;
CmsUUID id = new CmsUUID(item.getId());
if (!id.isNullUUID()) {
try {
res = cms.readResource(id, CmsResourceFilter.ALL);
} catch (CmsException e) {
// should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e);
}
}
}
return res;
}
|
[
"@",
"Override",
"public",
"CmsResource",
"getResource",
"(",
"CmsObject",
"cms",
",",
"CmsListItem",
"item",
")",
"{",
"CmsResource",
"res",
"=",
"null",
";",
"CmsUUID",
"id",
"=",
"new",
"CmsUUID",
"(",
"item",
".",
"getId",
"(",
")",
")",
";",
"if",
"(",
"!",
"id",
".",
"isNullUUID",
"(",
")",
")",
"{",
"try",
"{",
"res",
"=",
"cms",
".",
"readResource",
"(",
"id",
",",
"CmsResourceFilter",
".",
"ALL",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"// should never happen",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"}",
"return",
"res",
";",
"}"
] |
Returns the resource for the given item.<p>
@param cms the cms object
@param item the item
@return the resource
|
[
"Returns",
"the",
"resource",
"for",
"the",
"given",
"item",
".",
"<p",
">"
] |
train
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/sourcesearch/CmsSourceSearchCollector.java#L92-L110
|
belaban/JGroups
|
src/org/jgroups/blocks/MessageDispatcher.java
|
MessageDispatcher.castMessage
|
public <T> RspList<T> castMessage(Collection<Address> dests, byte[] data, int offset, int length,
RequestOptions opts) throws Exception {
"""
Sends a message to all members and expects responses from members in dests (if non-null).
@param dests A list of group members from which to expect responses (if the call is blocking).
@param data The buffer
@param offset the offset into data
@param length the number of bytes to send
@param opts A set of options that govern the call. See {@link org.jgroups.blocks.RequestOptions} for details
@return RspList A list of Rsp elements, or null if the RPC is asynchronous
@throws Exception If the request cannot be sent
@since 4.0
"""
return castMessage(dests, new Buffer(data, offset, length), opts);
}
|
java
|
public <T> RspList<T> castMessage(Collection<Address> dests, byte[] data, int offset, int length,
RequestOptions opts) throws Exception {
return castMessage(dests, new Buffer(data, offset, length), opts);
}
|
[
"public",
"<",
"T",
">",
"RspList",
"<",
"T",
">",
"castMessage",
"(",
"Collection",
"<",
"Address",
">",
"dests",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
",",
"RequestOptions",
"opts",
")",
"throws",
"Exception",
"{",
"return",
"castMessage",
"(",
"dests",
",",
"new",
"Buffer",
"(",
"data",
",",
"offset",
",",
"length",
")",
",",
"opts",
")",
";",
"}"
] |
Sends a message to all members and expects responses from members in dests (if non-null).
@param dests A list of group members from which to expect responses (if the call is blocking).
@param data The buffer
@param offset the offset into data
@param length the number of bytes to send
@param opts A set of options that govern the call. See {@link org.jgroups.blocks.RequestOptions} for details
@return RspList A list of Rsp elements, or null if the RPC is asynchronous
@throws Exception If the request cannot be sent
@since 4.0
|
[
"Sends",
"a",
"message",
"to",
"all",
"members",
"and",
"expects",
"responses",
"from",
"members",
"in",
"dests",
"(",
"if",
"non",
"-",
"null",
")",
"."
] |
train
|
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/MessageDispatcher.java#L235-L238
|
Alluxio/alluxio
|
core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournal.java
|
UfsJournal.gainPrimacy
|
public synchronized void gainPrimacy() throws IOException {
"""
Transitions the journal from secondary to primary mode. The journal will apply the latest
journal entries to the state machine, then begin to allow writes.
"""
Preconditions.checkState(mWriter == null, "writer must be null in secondary mode");
Preconditions.checkState(mTailerThread != null,
"tailer thread must not be null in secondary mode");
mTailerThread.awaitTermination(true);
long nextSequenceNumber = mTailerThread.getNextSequenceNumber();
mTailerThread = null;
nextSequenceNumber = catchUp(nextSequenceNumber);
mWriter = new UfsJournalLogWriter(this, nextSequenceNumber);
mAsyncWriter = new AsyncJournalWriter(mWriter);
mState = State.PRIMARY;
}
|
java
|
public synchronized void gainPrimacy() throws IOException {
Preconditions.checkState(mWriter == null, "writer must be null in secondary mode");
Preconditions.checkState(mTailerThread != null,
"tailer thread must not be null in secondary mode");
mTailerThread.awaitTermination(true);
long nextSequenceNumber = mTailerThread.getNextSequenceNumber();
mTailerThread = null;
nextSequenceNumber = catchUp(nextSequenceNumber);
mWriter = new UfsJournalLogWriter(this, nextSequenceNumber);
mAsyncWriter = new AsyncJournalWriter(mWriter);
mState = State.PRIMARY;
}
|
[
"public",
"synchronized",
"void",
"gainPrimacy",
"(",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkState",
"(",
"mWriter",
"==",
"null",
",",
"\"writer must be null in secondary mode\"",
")",
";",
"Preconditions",
".",
"checkState",
"(",
"mTailerThread",
"!=",
"null",
",",
"\"tailer thread must not be null in secondary mode\"",
")",
";",
"mTailerThread",
".",
"awaitTermination",
"(",
"true",
")",
";",
"long",
"nextSequenceNumber",
"=",
"mTailerThread",
".",
"getNextSequenceNumber",
"(",
")",
";",
"mTailerThread",
"=",
"null",
";",
"nextSequenceNumber",
"=",
"catchUp",
"(",
"nextSequenceNumber",
")",
";",
"mWriter",
"=",
"new",
"UfsJournalLogWriter",
"(",
"this",
",",
"nextSequenceNumber",
")",
";",
"mAsyncWriter",
"=",
"new",
"AsyncJournalWriter",
"(",
"mWriter",
")",
";",
"mState",
"=",
"State",
".",
"PRIMARY",
";",
"}"
] |
Transitions the journal from secondary to primary mode. The journal will apply the latest
journal entries to the state machine, then begin to allow writes.
|
[
"Transitions",
"the",
"journal",
"from",
"secondary",
"to",
"primary",
"mode",
".",
"The",
"journal",
"will",
"apply",
"the",
"latest",
"journal",
"entries",
"to",
"the",
"state",
"machine",
"then",
"begin",
"to",
"allow",
"writes",
"."
] |
train
|
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournal.java#L203-L214
|
netscaler/nitro
|
src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java
|
base_resource.update_resource
|
protected base_response update_resource(nitro_service service,options option) throws Exception {
"""
Use this method to perform a modify operation on netscaler resource.
@param service nitro_service object.
@param option options class object.
@return status of the operation performed.
@throws Exception
"""
if (!service.isLogin() && !this.get_object_type().equals("login"))
service.login();
String sessionid = service.get_sessionid();
String request = resource_to_string(service, sessionid, option);
return put_data(service,request);
}
|
java
|
protected base_response update_resource(nitro_service service,options option) throws Exception
{
if (!service.isLogin() && !this.get_object_type().equals("login"))
service.login();
String sessionid = service.get_sessionid();
String request = resource_to_string(service, sessionid, option);
return put_data(service,request);
}
|
[
"protected",
"base_response",
"update_resource",
"(",
"nitro_service",
"service",
",",
"options",
"option",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"service",
".",
"isLogin",
"(",
")",
"&&",
"!",
"this",
".",
"get_object_type",
"(",
")",
".",
"equals",
"(",
"\"login\"",
")",
")",
"service",
".",
"login",
"(",
")",
";",
"String",
"sessionid",
"=",
"service",
".",
"get_sessionid",
"(",
")",
";",
"String",
"request",
"=",
"resource_to_string",
"(",
"service",
",",
"sessionid",
",",
"option",
")",
";",
"return",
"put_data",
"(",
"service",
",",
"request",
")",
";",
"}"
] |
Use this method to perform a modify operation on netscaler resource.
@param service nitro_service object.
@param option options class object.
@return status of the operation performed.
@throws Exception
|
[
"Use",
"this",
"method",
"to",
"perform",
"a",
"modify",
"operation",
"on",
"netscaler",
"resource",
"."
] |
train
|
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java#L190-L197
|
openengsb/openengsb
|
api/ekb/src/main/java/org/openengsb/core/ekb/api/transformation/TransformationDescription.java
|
TransformationDescription.concatField
|
public void concatField(String targetField, String concatString, String... sourceFields) {
"""
Adds a concat transformation step to the transformation description. The values of the source fields are
concatenated to the target field with the concat string between the source fields values. All fields need to be
of the type String.
"""
TransformationStep step = new TransformationStep();
step.setTargetField(targetField);
step.setSourceFields(sourceFields);
step.setOperationParameter(TransformationConstants.CONCAT_PARAM, concatString);
step.setOperationName("concat");
steps.add(step);
}
|
java
|
public void concatField(String targetField, String concatString, String... sourceFields) {
TransformationStep step = new TransformationStep();
step.setTargetField(targetField);
step.setSourceFields(sourceFields);
step.setOperationParameter(TransformationConstants.CONCAT_PARAM, concatString);
step.setOperationName("concat");
steps.add(step);
}
|
[
"public",
"void",
"concatField",
"(",
"String",
"targetField",
",",
"String",
"concatString",
",",
"String",
"...",
"sourceFields",
")",
"{",
"TransformationStep",
"step",
"=",
"new",
"TransformationStep",
"(",
")",
";",
"step",
".",
"setTargetField",
"(",
"targetField",
")",
";",
"step",
".",
"setSourceFields",
"(",
"sourceFields",
")",
";",
"step",
".",
"setOperationParameter",
"(",
"TransformationConstants",
".",
"CONCAT_PARAM",
",",
"concatString",
")",
";",
"step",
".",
"setOperationName",
"(",
"\"concat\"",
")",
";",
"steps",
".",
"add",
"(",
"step",
")",
";",
"}"
] |
Adds a concat transformation step to the transformation description. The values of the source fields are
concatenated to the target field with the concat string between the source fields values. All fields need to be
of the type String.
|
[
"Adds",
"a",
"concat",
"transformation",
"step",
"to",
"the",
"transformation",
"description",
".",
"The",
"values",
"of",
"the",
"source",
"fields",
"are",
"concatenated",
"to",
"the",
"target",
"field",
"with",
"the",
"concat",
"string",
"between",
"the",
"source",
"fields",
"values",
".",
"All",
"fields",
"need",
"to",
"be",
"of",
"the",
"type",
"String",
"."
] |
train
|
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/api/ekb/src/main/java/org/openengsb/core/ekb/api/transformation/TransformationDescription.java#L81-L88
|
jqno/equalsverifier
|
src/main/java/nl/jqno/equalsverifier/internal/util/Assert.java
|
Assert.assertEquals
|
public static void assertEquals(Formatter message, Object expected, Object actual) {
"""
Asserts that two Objects are equal to one another. Does nothing if they
are; throws an AssertionException if they're not.
@param message Message to be included in the {@link AssertionException}.
@param expected Expected value.
@param actual Actual value.
@throws AssertionException If {@code expected} and {@code actual} are not
equal.
"""
if (!expected.equals(actual)) {
throw new AssertionException(message);
}
}
|
java
|
public static void assertEquals(Formatter message, Object expected, Object actual) {
if (!expected.equals(actual)) {
throw new AssertionException(message);
}
}
|
[
"public",
"static",
"void",
"assertEquals",
"(",
"Formatter",
"message",
",",
"Object",
"expected",
",",
"Object",
"actual",
")",
"{",
"if",
"(",
"!",
"expected",
".",
"equals",
"(",
"actual",
")",
")",
"{",
"throw",
"new",
"AssertionException",
"(",
"message",
")",
";",
"}",
"}"
] |
Asserts that two Objects are equal to one another. Does nothing if they
are; throws an AssertionException if they're not.
@param message Message to be included in the {@link AssertionException}.
@param expected Expected value.
@param actual Actual value.
@throws AssertionException If {@code expected} and {@code actual} are not
equal.
|
[
"Asserts",
"that",
"two",
"Objects",
"are",
"equal",
"to",
"one",
"another",
".",
"Does",
"nothing",
"if",
"they",
"are",
";",
"throws",
"an",
"AssertionException",
"if",
"they",
"re",
"not",
"."
] |
train
|
https://github.com/jqno/equalsverifier/blob/25d73c9cb801c8b20b257d1d1283ac6e0585ef1d/src/main/java/nl/jqno/equalsverifier/internal/util/Assert.java#L24-L28
|
Javacord/Javacord
|
javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java
|
ServerImpl.setMuted
|
public void setMuted(long userId, boolean muted) {
"""
Sets the muted state of the user with the given id.
@param userId The id of the user.
@param muted Whether the user with the given id is muted or not.
"""
if (muted) {
this.muted.add(userId);
} else {
this.muted.remove(userId);
}
}
|
java
|
public void setMuted(long userId, boolean muted) {
if (muted) {
this.muted.add(userId);
} else {
this.muted.remove(userId);
}
}
|
[
"public",
"void",
"setMuted",
"(",
"long",
"userId",
",",
"boolean",
"muted",
")",
"{",
"if",
"(",
"muted",
")",
"{",
"this",
".",
"muted",
".",
"add",
"(",
"userId",
")",
";",
"}",
"else",
"{",
"this",
".",
"muted",
".",
"remove",
"(",
"userId",
")",
";",
"}",
"}"
] |
Sets the muted state of the user with the given id.
@param userId The id of the user.
@param muted Whether the user with the given id is muted or not.
|
[
"Sets",
"the",
"muted",
"state",
"of",
"the",
"user",
"with",
"the",
"given",
"id",
"."
] |
train
|
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L758-L764
|
deeplearning4j/deeplearning4j
|
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java
|
ModelSerializer.addObjectToFile
|
public static void addObjectToFile(@NonNull File f, @NonNull String key, @NonNull Object o) {
"""
Add an object to the (already existing) model file using Java Object Serialization. Objects can be restored
using {@link #getObjectFromFile(File, String)}
@param f File to add the object to
@param key Key to store the object under
@param o Object to store using Java object serialization
"""
Preconditions.checkState(f.exists(), "File must exist: %s", f);
Preconditions.checkArgument(!(UPDATER_BIN.equalsIgnoreCase(key) || NORMALIZER_BIN.equalsIgnoreCase(key)
|| CONFIGURATION_JSON.equalsIgnoreCase(key) || COEFFICIENTS_BIN.equalsIgnoreCase(key)
|| NO_PARAMS_MARKER.equalsIgnoreCase(key) || PREPROCESSOR_BIN.equalsIgnoreCase(key)),
"Invalid key: Key is reserved for internal use: \"%s\"", key);
File tempFile = null;
try {
// copy existing model to temporary file
tempFile = DL4JFileUtils.createTempFile("dl4jModelSerializerTemp", "bin");
Files.copy(f, tempFile);
f.delete();
try (ZipFile zipFile = new ZipFile(tempFile);
ZipOutputStream writeFile =
new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(f)))) {
// roll over existing files within model, and copy them one by one
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
log.debug("Copying: {}", entry.getName());
InputStream is = zipFile.getInputStream(entry);
ZipEntry wEntry = new ZipEntry(entry.getName());
writeFile.putNextEntry(wEntry);
IOUtils.copy(is, writeFile);
writeFile.closeEntry();
is.close();
}
//Add new object:
ZipEntry entry = new ZipEntry("objects/" + key);
writeFile.putNextEntry(entry);
try(ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos)){
oos.writeObject(o);
byte[] bytes = baos.toByteArray();
writeFile.write(bytes);
}
writeFile.closeEntry();
writeFile.close();
zipFile.close();
}
} catch (Exception ex) {
throw new RuntimeException(ex);
} finally {
if (tempFile != null) {
tempFile.delete();
}
}
}
|
java
|
public static void addObjectToFile(@NonNull File f, @NonNull String key, @NonNull Object o){
Preconditions.checkState(f.exists(), "File must exist: %s", f);
Preconditions.checkArgument(!(UPDATER_BIN.equalsIgnoreCase(key) || NORMALIZER_BIN.equalsIgnoreCase(key)
|| CONFIGURATION_JSON.equalsIgnoreCase(key) || COEFFICIENTS_BIN.equalsIgnoreCase(key)
|| NO_PARAMS_MARKER.equalsIgnoreCase(key) || PREPROCESSOR_BIN.equalsIgnoreCase(key)),
"Invalid key: Key is reserved for internal use: \"%s\"", key);
File tempFile = null;
try {
// copy existing model to temporary file
tempFile = DL4JFileUtils.createTempFile("dl4jModelSerializerTemp", "bin");
Files.copy(f, tempFile);
f.delete();
try (ZipFile zipFile = new ZipFile(tempFile);
ZipOutputStream writeFile =
new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(f)))) {
// roll over existing files within model, and copy them one by one
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
log.debug("Copying: {}", entry.getName());
InputStream is = zipFile.getInputStream(entry);
ZipEntry wEntry = new ZipEntry(entry.getName());
writeFile.putNextEntry(wEntry);
IOUtils.copy(is, writeFile);
writeFile.closeEntry();
is.close();
}
//Add new object:
ZipEntry entry = new ZipEntry("objects/" + key);
writeFile.putNextEntry(entry);
try(ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos)){
oos.writeObject(o);
byte[] bytes = baos.toByteArray();
writeFile.write(bytes);
}
writeFile.closeEntry();
writeFile.close();
zipFile.close();
}
} catch (Exception ex) {
throw new RuntimeException(ex);
} finally {
if (tempFile != null) {
tempFile.delete();
}
}
}
|
[
"public",
"static",
"void",
"addObjectToFile",
"(",
"@",
"NonNull",
"File",
"f",
",",
"@",
"NonNull",
"String",
"key",
",",
"@",
"NonNull",
"Object",
"o",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"f",
".",
"exists",
"(",
")",
",",
"\"File must exist: %s\"",
",",
"f",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"!",
"(",
"UPDATER_BIN",
".",
"equalsIgnoreCase",
"(",
"key",
")",
"||",
"NORMALIZER_BIN",
".",
"equalsIgnoreCase",
"(",
"key",
")",
"||",
"CONFIGURATION_JSON",
".",
"equalsIgnoreCase",
"(",
"key",
")",
"||",
"COEFFICIENTS_BIN",
".",
"equalsIgnoreCase",
"(",
"key",
")",
"||",
"NO_PARAMS_MARKER",
".",
"equalsIgnoreCase",
"(",
"key",
")",
"||",
"PREPROCESSOR_BIN",
".",
"equalsIgnoreCase",
"(",
"key",
")",
")",
",",
"\"Invalid key: Key is reserved for internal use: \\\"%s\\\"\"",
",",
"key",
")",
";",
"File",
"tempFile",
"=",
"null",
";",
"try",
"{",
"// copy existing model to temporary file",
"tempFile",
"=",
"DL4JFileUtils",
".",
"createTempFile",
"(",
"\"dl4jModelSerializerTemp\"",
",",
"\"bin\"",
")",
";",
"Files",
".",
"copy",
"(",
"f",
",",
"tempFile",
")",
";",
"f",
".",
"delete",
"(",
")",
";",
"try",
"(",
"ZipFile",
"zipFile",
"=",
"new",
"ZipFile",
"(",
"tempFile",
")",
";",
"ZipOutputStream",
"writeFile",
"=",
"new",
"ZipOutputStream",
"(",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"f",
")",
")",
")",
")",
"{",
"// roll over existing files within model, and copy them one by one",
"Enumeration",
"<",
"?",
"extends",
"ZipEntry",
">",
"entries",
"=",
"zipFile",
".",
"entries",
"(",
")",
";",
"while",
"(",
"entries",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"ZipEntry",
"entry",
"=",
"entries",
".",
"nextElement",
"(",
")",
";",
"log",
".",
"debug",
"(",
"\"Copying: {}\"",
",",
"entry",
".",
"getName",
"(",
")",
")",
";",
"InputStream",
"is",
"=",
"zipFile",
".",
"getInputStream",
"(",
"entry",
")",
";",
"ZipEntry",
"wEntry",
"=",
"new",
"ZipEntry",
"(",
"entry",
".",
"getName",
"(",
")",
")",
";",
"writeFile",
".",
"putNextEntry",
"(",
"wEntry",
")",
";",
"IOUtils",
".",
"copy",
"(",
"is",
",",
"writeFile",
")",
";",
"writeFile",
".",
"closeEntry",
"(",
")",
";",
"is",
".",
"close",
"(",
")",
";",
"}",
"//Add new object:",
"ZipEntry",
"entry",
"=",
"new",
"ZipEntry",
"(",
"\"objects/\"",
"+",
"key",
")",
";",
"writeFile",
".",
"putNextEntry",
"(",
"entry",
")",
";",
"try",
"(",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ObjectOutputStream",
"oos",
"=",
"new",
"ObjectOutputStream",
"(",
"baos",
")",
")",
"{",
"oos",
".",
"writeObject",
"(",
"o",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"baos",
".",
"toByteArray",
"(",
")",
";",
"writeFile",
".",
"write",
"(",
"bytes",
")",
";",
"}",
"writeFile",
".",
"closeEntry",
"(",
")",
";",
"writeFile",
".",
"close",
"(",
")",
";",
"zipFile",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"ex",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"tempFile",
"!=",
"null",
")",
"{",
"tempFile",
".",
"delete",
"(",
")",
";",
"}",
"}",
"}"
] |
Add an object to the (already existing) model file using Java Object Serialization. Objects can be restored
using {@link #getObjectFromFile(File, String)}
@param f File to add the object to
@param key Key to store the object under
@param o Object to store using Java object serialization
|
[
"Add",
"an",
"object",
"to",
"the",
"(",
"already",
"existing",
")",
"model",
"file",
"using",
"Java",
"Object",
"Serialization",
".",
"Objects",
"can",
"be",
"restored",
"using",
"{"
] |
train
|
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java#L781-L835
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpx/MPXReader.java
|
MPXReader.populateDefaultSettings
|
private void populateDefaultSettings(Record record, ProjectProperties properties) throws MPXJException {
"""
Populates default settings.
@param record MPX record
@param properties project properties
@throws MPXJException
"""
properties.setDefaultDurationUnits(record.getTimeUnit(0));
properties.setDefaultDurationIsFixed(record.getNumericBoolean(1));
properties.setDefaultWorkUnits(record.getTimeUnit(2));
properties.setMinutesPerDay(Double.valueOf(NumberHelper.getDouble(record.getFloat(3)) * 60));
properties.setMinutesPerWeek(Double.valueOf(NumberHelper.getDouble(record.getFloat(4)) * 60));
properties.setDefaultStandardRate(record.getRate(5));
properties.setDefaultOvertimeRate(record.getRate(6));
properties.setUpdatingTaskStatusUpdatesResourceStatus(record.getNumericBoolean(7));
properties.setSplitInProgressTasks(record.getNumericBoolean(8));
}
|
java
|
private void populateDefaultSettings(Record record, ProjectProperties properties) throws MPXJException
{
properties.setDefaultDurationUnits(record.getTimeUnit(0));
properties.setDefaultDurationIsFixed(record.getNumericBoolean(1));
properties.setDefaultWorkUnits(record.getTimeUnit(2));
properties.setMinutesPerDay(Double.valueOf(NumberHelper.getDouble(record.getFloat(3)) * 60));
properties.setMinutesPerWeek(Double.valueOf(NumberHelper.getDouble(record.getFloat(4)) * 60));
properties.setDefaultStandardRate(record.getRate(5));
properties.setDefaultOvertimeRate(record.getRate(6));
properties.setUpdatingTaskStatusUpdatesResourceStatus(record.getNumericBoolean(7));
properties.setSplitInProgressTasks(record.getNumericBoolean(8));
}
|
[
"private",
"void",
"populateDefaultSettings",
"(",
"Record",
"record",
",",
"ProjectProperties",
"properties",
")",
"throws",
"MPXJException",
"{",
"properties",
".",
"setDefaultDurationUnits",
"(",
"record",
".",
"getTimeUnit",
"(",
"0",
")",
")",
";",
"properties",
".",
"setDefaultDurationIsFixed",
"(",
"record",
".",
"getNumericBoolean",
"(",
"1",
")",
")",
";",
"properties",
".",
"setDefaultWorkUnits",
"(",
"record",
".",
"getTimeUnit",
"(",
"2",
")",
")",
";",
"properties",
".",
"setMinutesPerDay",
"(",
"Double",
".",
"valueOf",
"(",
"NumberHelper",
".",
"getDouble",
"(",
"record",
".",
"getFloat",
"(",
"3",
")",
")",
"*",
"60",
")",
")",
";",
"properties",
".",
"setMinutesPerWeek",
"(",
"Double",
".",
"valueOf",
"(",
"NumberHelper",
".",
"getDouble",
"(",
"record",
".",
"getFloat",
"(",
"4",
")",
")",
"*",
"60",
")",
")",
";",
"properties",
".",
"setDefaultStandardRate",
"(",
"record",
".",
"getRate",
"(",
"5",
")",
")",
";",
"properties",
".",
"setDefaultOvertimeRate",
"(",
"record",
".",
"getRate",
"(",
"6",
")",
")",
";",
"properties",
".",
"setUpdatingTaskStatusUpdatesResourceStatus",
"(",
"record",
".",
"getNumericBoolean",
"(",
"7",
")",
")",
";",
"properties",
".",
"setSplitInProgressTasks",
"(",
"record",
".",
"getNumericBoolean",
"(",
"8",
")",
")",
";",
"}"
] |
Populates default settings.
@param record MPX record
@param properties project properties
@throws MPXJException
|
[
"Populates",
"default",
"settings",
"."
] |
train
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L509-L520
|
UrielCh/ovh-java-sdk
|
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
|
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_hunting_agent_agentId_GET
|
public OvhOvhPabxHuntingAgent billingAccount_ovhPabx_serviceName_hunting_agent_agentId_GET(String billingAccount, String serviceName, Long agentId) throws IOException {
"""
Get this object properties
REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param agentId [required]
"""
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, agentId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOvhPabxHuntingAgent.class);
}
|
java
|
public OvhOvhPabxHuntingAgent billingAccount_ovhPabx_serviceName_hunting_agent_agentId_GET(String billingAccount, String serviceName, Long agentId) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, agentId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOvhPabxHuntingAgent.class);
}
|
[
"public",
"OvhOvhPabxHuntingAgent",
"billingAccount_ovhPabx_serviceName_hunting_agent_agentId_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"agentId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"billingAccount",
",",
"serviceName",
",",
"agentId",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhOvhPabxHuntingAgent",
".",
"class",
")",
";",
"}"
] |
Get this object properties
REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param agentId [required]
|
[
"Get",
"this",
"object",
"properties"
] |
train
|
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L6395-L6400
|
lucee/Lucee
|
core/src/main/java/lucee/runtime/type/scope/client/ClientCookie.java
|
ClientCookie.getInstance
|
public static Client getInstance(String name, PageContext pc, Log log) {
"""
load new instance of the class
@param name
@param pc
@param log
@return
"""
if (!StringUtil.isEmpty(name)) name = StringUtil.toUpperCase(StringUtil.toVariableName(name));
String cookieName = "CF_" + TYPE + "_" + name;
return new ClientCookie(pc, cookieName, _loadData(pc, cookieName, SCOPE_CLIENT, "client", log));
}
|
java
|
public static Client getInstance(String name, PageContext pc, Log log) {
if (!StringUtil.isEmpty(name)) name = StringUtil.toUpperCase(StringUtil.toVariableName(name));
String cookieName = "CF_" + TYPE + "_" + name;
return new ClientCookie(pc, cookieName, _loadData(pc, cookieName, SCOPE_CLIENT, "client", log));
}
|
[
"public",
"static",
"Client",
"getInstance",
"(",
"String",
"name",
",",
"PageContext",
"pc",
",",
"Log",
"log",
")",
"{",
"if",
"(",
"!",
"StringUtil",
".",
"isEmpty",
"(",
"name",
")",
")",
"name",
"=",
"StringUtil",
".",
"toUpperCase",
"(",
"StringUtil",
".",
"toVariableName",
"(",
"name",
")",
")",
";",
"String",
"cookieName",
"=",
"\"CF_\"",
"+",
"TYPE",
"+",
"\"_\"",
"+",
"name",
";",
"return",
"new",
"ClientCookie",
"(",
"pc",
",",
"cookieName",
",",
"_loadData",
"(",
"pc",
",",
"cookieName",
",",
"SCOPE_CLIENT",
",",
"\"client\"",
",",
"log",
")",
")",
";",
"}"
] |
load new instance of the class
@param name
@param pc
@param log
@return
|
[
"load",
"new",
"instance",
"of",
"the",
"class"
] |
train
|
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/client/ClientCookie.java#L60-L64
|
threerings/narya
|
core/src/main/java/com/threerings/presents/util/ClassUtil.java
|
ClassUtil.getMethod
|
public static Method getMethod (String name, Object target, Object[] args) {
"""
Looks up the method on the specified object that has a signature that matches the supplied
arguments array. This is very expensive, so you shouldn't be doing this for something that
happens frequently.
@return the best matching method with the specified name that accepts the supplied
arguments, or null if no method could be found.
@see MethodFinder
"""
Class<?> tclass = target.getClass();
Method meth = null;
try {
MethodFinder finder = new MethodFinder(tclass);
meth = finder.findMethod(name, args);
} catch (NoSuchMethodException nsme) {
// nothing to do here but fall through and return null
log.info("No such method", "name", name, "tclass", tclass.getName(), "args", args,
"error", nsme);
} catch (SecurityException se) {
log.warning("Unable to look up method?", "tclass", tclass.getName(), "mname", name);
}
return meth;
}
|
java
|
public static Method getMethod (String name, Object target, Object[] args)
{
Class<?> tclass = target.getClass();
Method meth = null;
try {
MethodFinder finder = new MethodFinder(tclass);
meth = finder.findMethod(name, args);
} catch (NoSuchMethodException nsme) {
// nothing to do here but fall through and return null
log.info("No such method", "name", name, "tclass", tclass.getName(), "args", args,
"error", nsme);
} catch (SecurityException se) {
log.warning("Unable to look up method?", "tclass", tclass.getName(), "mname", name);
}
return meth;
}
|
[
"public",
"static",
"Method",
"getMethod",
"(",
"String",
"name",
",",
"Object",
"target",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"Class",
"<",
"?",
">",
"tclass",
"=",
"target",
".",
"getClass",
"(",
")",
";",
"Method",
"meth",
"=",
"null",
";",
"try",
"{",
"MethodFinder",
"finder",
"=",
"new",
"MethodFinder",
"(",
"tclass",
")",
";",
"meth",
"=",
"finder",
".",
"findMethod",
"(",
"name",
",",
"args",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"nsme",
")",
"{",
"// nothing to do here but fall through and return null",
"log",
".",
"info",
"(",
"\"No such method\"",
",",
"\"name\"",
",",
"name",
",",
"\"tclass\"",
",",
"tclass",
".",
"getName",
"(",
")",
",",
"\"args\"",
",",
"args",
",",
"\"error\"",
",",
"nsme",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"se",
")",
"{",
"log",
".",
"warning",
"(",
"\"Unable to look up method?\"",
",",
"\"tclass\"",
",",
"tclass",
".",
"getName",
"(",
")",
",",
"\"mname\"",
",",
"name",
")",
";",
"}",
"return",
"meth",
";",
"}"
] |
Looks up the method on the specified object that has a signature that matches the supplied
arguments array. This is very expensive, so you shouldn't be doing this for something that
happens frequently.
@return the best matching method with the specified name that accepts the supplied
arguments, or null if no method could be found.
@see MethodFinder
|
[
"Looks",
"up",
"the",
"method",
"on",
"the",
"specified",
"object",
"that",
"has",
"a",
"signature",
"that",
"matches",
"the",
"supplied",
"arguments",
"array",
".",
"This",
"is",
"very",
"expensive",
"so",
"you",
"shouldn",
"t",
"be",
"doing",
"this",
"for",
"something",
"that",
"happens",
"frequently",
"."
] |
train
|
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/util/ClassUtil.java#L72-L91
|
mongodb/stitch-android-sdk
|
core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/internal/CoreRemoteMongoCollectionImpl.java
|
CoreRemoteMongoCollectionImpl.updateMany
|
public RemoteUpdateResult updateMany(final Bson filter, final Bson update) {
"""
Update all documents in the collection according to the specified arguments.
@param filter a document describing the query filter, which may not be null.
@param update a document describing the update, which may not be null. The update to apply
must include only update operators.
@return the result of the update many operation
"""
return updateMany(filter, update, new RemoteUpdateOptions());
}
|
java
|
public RemoteUpdateResult updateMany(final Bson filter, final Bson update) {
return updateMany(filter, update, new RemoteUpdateOptions());
}
|
[
"public",
"RemoteUpdateResult",
"updateMany",
"(",
"final",
"Bson",
"filter",
",",
"final",
"Bson",
"update",
")",
"{",
"return",
"updateMany",
"(",
"filter",
",",
"update",
",",
"new",
"RemoteUpdateOptions",
"(",
")",
")",
";",
"}"
] |
Update all documents in the collection according to the specified arguments.
@param filter a document describing the query filter, which may not be null.
@param update a document describing the update, which may not be null. The update to apply
must include only update operators.
@return the result of the update many operation
|
[
"Update",
"all",
"documents",
"in",
"the",
"collection",
"according",
"to",
"the",
"specified",
"arguments",
"."
] |
train
|
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/internal/CoreRemoteMongoCollectionImpl.java#L425-L427
|
google/j2objc
|
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/MatchPatternIterator.java
|
MatchPatternIterator.acceptNode
|
public short acceptNode(int n, XPathContext xctxt) {
"""
Test whether a specified node is visible in the logical view of a
TreeWalker or NodeIterator. This function will be called by the
implementation of TreeWalker and NodeIterator; it is not intended to
be called directly from user code.
@param n The node to check to see if it passes the filter or not.
@return a constant to determine whether the node is accepted,
rejected, or skipped, as defined above .
"""
try
{
xctxt.pushCurrentNode(n);
xctxt.pushIteratorRoot(m_context);
if(DEBUG)
{
System.out.println("traverser: "+m_traverser);
System.out.print("node: "+n);
System.out.println(", "+m_cdtm.getNodeName(n));
// if(m_cdtm.getNodeName(n).equals("near-east"))
System.out.println("pattern: "+m_pattern.toString());
m_pattern.debugWhatToShow(m_pattern.getWhatToShow());
}
XObject score = m_pattern.execute(xctxt);
if(DEBUG)
{
// System.out.println("analysis: "+Integer.toBinaryString(m_analysis));
System.out.println("score: "+score);
System.out.println("skip: "+(score == NodeTest.SCORE_NONE));
}
// System.out.println("\n::acceptNode - score: "+score.num()+"::");
return (score == NodeTest.SCORE_NONE) ? DTMIterator.FILTER_SKIP
: DTMIterator.FILTER_ACCEPT;
}
catch (javax.xml.transform.TransformerException se)
{
// TODO: Fix this.
throw new RuntimeException(se.getMessage());
}
finally
{
xctxt.popCurrentNode();
xctxt.popIteratorRoot();
}
}
|
java
|
public short acceptNode(int n, XPathContext xctxt)
{
try
{
xctxt.pushCurrentNode(n);
xctxt.pushIteratorRoot(m_context);
if(DEBUG)
{
System.out.println("traverser: "+m_traverser);
System.out.print("node: "+n);
System.out.println(", "+m_cdtm.getNodeName(n));
// if(m_cdtm.getNodeName(n).equals("near-east"))
System.out.println("pattern: "+m_pattern.toString());
m_pattern.debugWhatToShow(m_pattern.getWhatToShow());
}
XObject score = m_pattern.execute(xctxt);
if(DEBUG)
{
// System.out.println("analysis: "+Integer.toBinaryString(m_analysis));
System.out.println("score: "+score);
System.out.println("skip: "+(score == NodeTest.SCORE_NONE));
}
// System.out.println("\n::acceptNode - score: "+score.num()+"::");
return (score == NodeTest.SCORE_NONE) ? DTMIterator.FILTER_SKIP
: DTMIterator.FILTER_ACCEPT;
}
catch (javax.xml.transform.TransformerException se)
{
// TODO: Fix this.
throw new RuntimeException(se.getMessage());
}
finally
{
xctxt.popCurrentNode();
xctxt.popIteratorRoot();
}
}
|
[
"public",
"short",
"acceptNode",
"(",
"int",
"n",
",",
"XPathContext",
"xctxt",
")",
"{",
"try",
"{",
"xctxt",
".",
"pushCurrentNode",
"(",
"n",
")",
";",
"xctxt",
".",
"pushIteratorRoot",
"(",
"m_context",
")",
";",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"traverser: \"",
"+",
"m_traverser",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"node: \"",
"+",
"n",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\", \"",
"+",
"m_cdtm",
".",
"getNodeName",
"(",
"n",
")",
")",
";",
"// if(m_cdtm.getNodeName(n).equals(\"near-east\"))",
"System",
".",
"out",
".",
"println",
"(",
"\"pattern: \"",
"+",
"m_pattern",
".",
"toString",
"(",
")",
")",
";",
"m_pattern",
".",
"debugWhatToShow",
"(",
"m_pattern",
".",
"getWhatToShow",
"(",
")",
")",
";",
"}",
"XObject",
"score",
"=",
"m_pattern",
".",
"execute",
"(",
"xctxt",
")",
";",
"if",
"(",
"DEBUG",
")",
"{",
"// System.out.println(\"analysis: \"+Integer.toBinaryString(m_analysis));",
"System",
".",
"out",
".",
"println",
"(",
"\"score: \"",
"+",
"score",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"skip: \"",
"+",
"(",
"score",
"==",
"NodeTest",
".",
"SCORE_NONE",
")",
")",
";",
"}",
"// System.out.println(\"\\n::acceptNode - score: \"+score.num()+\"::\");",
"return",
"(",
"score",
"==",
"NodeTest",
".",
"SCORE_NONE",
")",
"?",
"DTMIterator",
".",
"FILTER_SKIP",
":",
"DTMIterator",
".",
"FILTER_ACCEPT",
";",
"}",
"catch",
"(",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"se",
")",
"{",
"// TODO: Fix this.",
"throw",
"new",
"RuntimeException",
"(",
"se",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"finally",
"{",
"xctxt",
".",
"popCurrentNode",
"(",
")",
";",
"xctxt",
".",
"popIteratorRoot",
"(",
")",
";",
"}",
"}"
] |
Test whether a specified node is visible in the logical view of a
TreeWalker or NodeIterator. This function will be called by the
implementation of TreeWalker and NodeIterator; it is not intended to
be called directly from user code.
@param n The node to check to see if it passes the filter or not.
@return a constant to determine whether the node is accepted,
rejected, or skipped, as defined above .
|
[
"Test",
"whether",
"a",
"specified",
"node",
"is",
"visible",
"in",
"the",
"logical",
"view",
"of",
"a",
"TreeWalker",
"or",
"NodeIterator",
".",
"This",
"function",
"will",
"be",
"called",
"by",
"the",
"implementation",
"of",
"TreeWalker",
"and",
"NodeIterator",
";",
"it",
"is",
"not",
"intended",
"to",
"be",
"called",
"directly",
"from",
"user",
"code",
"."
] |
train
|
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/MatchPatternIterator.java#L287-L329
|
libgdx/gdx-ai
|
gdx-ai/src/com/badlogic/gdx/ai/msg/MessageDispatcher.java
|
MessageDispatcher.addListener
|
public void addListener (Telegraph listener, int msg) {
"""
Registers a listener for the specified message code. Messages without an explicit receiver are broadcasted to all its
registered listeners.
@param listener the listener to add
@param msg the message code
"""
Array<Telegraph> listeners = msgListeners.get(msg);
if (listeners == null) {
// Associate an empty unordered array with the message code
listeners = new Array<Telegraph>(false, 16);
msgListeners.put(msg, listeners);
}
listeners.add(listener);
// Dispatch messages from registered providers
Array<TelegramProvider> providers = msgProviders.get(msg);
if (providers != null) {
for (int i = 0, n = providers.size; i < n; i++) {
TelegramProvider provider = providers.get(i);
Object info = provider.provideMessageInfo(msg, listener);
if (info != null) {
Telegraph sender = ClassReflection.isInstance(Telegraph.class, provider) ? (Telegraph)provider : null;
dispatchMessage(0, sender, listener, msg, info, false);
}
}
}
}
|
java
|
public void addListener (Telegraph listener, int msg) {
Array<Telegraph> listeners = msgListeners.get(msg);
if (listeners == null) {
// Associate an empty unordered array with the message code
listeners = new Array<Telegraph>(false, 16);
msgListeners.put(msg, listeners);
}
listeners.add(listener);
// Dispatch messages from registered providers
Array<TelegramProvider> providers = msgProviders.get(msg);
if (providers != null) {
for (int i = 0, n = providers.size; i < n; i++) {
TelegramProvider provider = providers.get(i);
Object info = provider.provideMessageInfo(msg, listener);
if (info != null) {
Telegraph sender = ClassReflection.isInstance(Telegraph.class, provider) ? (Telegraph)provider : null;
dispatchMessage(0, sender, listener, msg, info, false);
}
}
}
}
|
[
"public",
"void",
"addListener",
"(",
"Telegraph",
"listener",
",",
"int",
"msg",
")",
"{",
"Array",
"<",
"Telegraph",
">",
"listeners",
"=",
"msgListeners",
".",
"get",
"(",
"msg",
")",
";",
"if",
"(",
"listeners",
"==",
"null",
")",
"{",
"// Associate an empty unordered array with the message code",
"listeners",
"=",
"new",
"Array",
"<",
"Telegraph",
">",
"(",
"false",
",",
"16",
")",
";",
"msgListeners",
".",
"put",
"(",
"msg",
",",
"listeners",
")",
";",
"}",
"listeners",
".",
"add",
"(",
"listener",
")",
";",
"// Dispatch messages from registered providers",
"Array",
"<",
"TelegramProvider",
">",
"providers",
"=",
"msgProviders",
".",
"get",
"(",
"msg",
")",
";",
"if",
"(",
"providers",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"providers",
".",
"size",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"TelegramProvider",
"provider",
"=",
"providers",
".",
"get",
"(",
"i",
")",
";",
"Object",
"info",
"=",
"provider",
".",
"provideMessageInfo",
"(",
"msg",
",",
"listener",
")",
";",
"if",
"(",
"info",
"!=",
"null",
")",
"{",
"Telegraph",
"sender",
"=",
"ClassReflection",
".",
"isInstance",
"(",
"Telegraph",
".",
"class",
",",
"provider",
")",
"?",
"(",
"Telegraph",
")",
"provider",
":",
"null",
";",
"dispatchMessage",
"(",
"0",
",",
"sender",
",",
"listener",
",",
"msg",
",",
"info",
",",
"false",
")",
";",
"}",
"}",
"}",
"}"
] |
Registers a listener for the specified message code. Messages without an explicit receiver are broadcasted to all its
registered listeners.
@param listener the listener to add
@param msg the message code
|
[
"Registers",
"a",
"listener",
"for",
"the",
"specified",
"message",
"code",
".",
"Messages",
"without",
"an",
"explicit",
"receiver",
"are",
"broadcasted",
"to",
"all",
"its",
"registered",
"listeners",
"."
] |
train
|
https://github.com/libgdx/gdx-ai/blob/2d1523a97193a45e18e11a4837c6800d08f177c5/gdx-ai/src/com/badlogic/gdx/ai/msg/MessageDispatcher.java#L69-L90
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/Engraver.java
|
Engraver.setMode
|
public void setMode(int mode, int variation) {
"""
Sets the engraving mode
<ul><li>{@link #NONE} : equal space between each note
<li>{@link #DEFAULT} : smaller space for short note, bigger space for long notes, something that look nice ;)
</ul>
@param mode {@link #DEFAULT} or {@link #NONE}
@param variation, in % negative to reduce, positive
to improve space between notes.
"""
//only reset if needed
if (m_mode == mode && m_variation == variation)
return;
spacesAfter.clear();
m_mode = mode;
//bounds variation %
//variation = Math.max(variation, -50);
m_variation = Math.max(VARIATION_MIN,
Math.min(VARIATION_MAX, variation));
if (m_mode == DEFAULT) {
double factor = 1 + variation/100f;
setSpaceAfter(Note.DOTTED_WHOLE, 30*factor);
setSpaceAfter(Note.WHOLE, 25*factor);
setSpaceAfter(Note.DOTTED_HALF, 20*factor);
setSpaceAfter(Note.HALF, 15*factor);
setSpaceAfter(Note.DOTTED_QUARTER, 12*factor);
setSpaceAfter(Note.QUARTER, 10*factor);
setSpaceAfter(Note.DOTTED_EIGHTH, 7*factor);
setSpaceAfter(Note.EIGHTH, 5*factor);
setSpaceAfter(Note.DOTTED_SIXTEENTH, 2*factor);
//invert factor
factor = 1 - variation/100;
setSpaceAfter(Note.SIXTEENTH, -1*factor);
setSpaceAfter(Note.DOTTED_THIRTY_SECOND, -2*factor);
setSpaceAfter(Note.THIRTY_SECOND, -3*factor);
setSpaceAfter(Note.DOTTED_SIXTY_FOURTH, -4*factor);
setSpaceAfter(Note.SIXTY_FOURTH, -5*factor);
}
// else { //mode==NONE
// //do nothing, will always return 0
// }
}
|
java
|
public void setMode(int mode, int variation) {
//only reset if needed
if (m_mode == mode && m_variation == variation)
return;
spacesAfter.clear();
m_mode = mode;
//bounds variation %
//variation = Math.max(variation, -50);
m_variation = Math.max(VARIATION_MIN,
Math.min(VARIATION_MAX, variation));
if (m_mode == DEFAULT) {
double factor = 1 + variation/100f;
setSpaceAfter(Note.DOTTED_WHOLE, 30*factor);
setSpaceAfter(Note.WHOLE, 25*factor);
setSpaceAfter(Note.DOTTED_HALF, 20*factor);
setSpaceAfter(Note.HALF, 15*factor);
setSpaceAfter(Note.DOTTED_QUARTER, 12*factor);
setSpaceAfter(Note.QUARTER, 10*factor);
setSpaceAfter(Note.DOTTED_EIGHTH, 7*factor);
setSpaceAfter(Note.EIGHTH, 5*factor);
setSpaceAfter(Note.DOTTED_SIXTEENTH, 2*factor);
//invert factor
factor = 1 - variation/100;
setSpaceAfter(Note.SIXTEENTH, -1*factor);
setSpaceAfter(Note.DOTTED_THIRTY_SECOND, -2*factor);
setSpaceAfter(Note.THIRTY_SECOND, -3*factor);
setSpaceAfter(Note.DOTTED_SIXTY_FOURTH, -4*factor);
setSpaceAfter(Note.SIXTY_FOURTH, -5*factor);
}
// else { //mode==NONE
// //do nothing, will always return 0
// }
}
|
[
"public",
"void",
"setMode",
"(",
"int",
"mode",
",",
"int",
"variation",
")",
"{",
"//only reset if needed\r",
"if",
"(",
"m_mode",
"==",
"mode",
"&&",
"m_variation",
"==",
"variation",
")",
"return",
";",
"spacesAfter",
".",
"clear",
"(",
")",
";",
"m_mode",
"=",
"mode",
";",
"//bounds variation %\r",
"//variation = Math.max(variation, -50);\r",
"m_variation",
"=",
"Math",
".",
"max",
"(",
"VARIATION_MIN",
",",
"Math",
".",
"min",
"(",
"VARIATION_MAX",
",",
"variation",
")",
")",
";",
"if",
"(",
"m_mode",
"==",
"DEFAULT",
")",
"{",
"double",
"factor",
"=",
"1",
"+",
"variation",
"/",
"100f",
";",
"setSpaceAfter",
"(",
"Note",
".",
"DOTTED_WHOLE",
",",
"30",
"*",
"factor",
")",
";",
"setSpaceAfter",
"(",
"Note",
".",
"WHOLE",
",",
"25",
"*",
"factor",
")",
";",
"setSpaceAfter",
"(",
"Note",
".",
"DOTTED_HALF",
",",
"20",
"*",
"factor",
")",
";",
"setSpaceAfter",
"(",
"Note",
".",
"HALF",
",",
"15",
"*",
"factor",
")",
";",
"setSpaceAfter",
"(",
"Note",
".",
"DOTTED_QUARTER",
",",
"12",
"*",
"factor",
")",
";",
"setSpaceAfter",
"(",
"Note",
".",
"QUARTER",
",",
"10",
"*",
"factor",
")",
";",
"setSpaceAfter",
"(",
"Note",
".",
"DOTTED_EIGHTH",
",",
"7",
"*",
"factor",
")",
";",
"setSpaceAfter",
"(",
"Note",
".",
"EIGHTH",
",",
"5",
"*",
"factor",
")",
";",
"setSpaceAfter",
"(",
"Note",
".",
"DOTTED_SIXTEENTH",
",",
"2",
"*",
"factor",
")",
";",
"//invert factor\r",
"factor",
"=",
"1",
"-",
"variation",
"/",
"100",
";",
"setSpaceAfter",
"(",
"Note",
".",
"SIXTEENTH",
",",
"-",
"1",
"*",
"factor",
")",
";",
"setSpaceAfter",
"(",
"Note",
".",
"DOTTED_THIRTY_SECOND",
",",
"-",
"2",
"*",
"factor",
")",
";",
"setSpaceAfter",
"(",
"Note",
".",
"THIRTY_SECOND",
",",
"-",
"3",
"*",
"factor",
")",
";",
"setSpaceAfter",
"(",
"Note",
".",
"DOTTED_SIXTY_FOURTH",
",",
"-",
"4",
"*",
"factor",
")",
";",
"setSpaceAfter",
"(",
"Note",
".",
"SIXTY_FOURTH",
",",
"-",
"5",
"*",
"factor",
")",
";",
"}",
"// else { //mode==NONE\r",
"// \t//do nothing, will always return 0\r",
"// }\r",
"}"
] |
Sets the engraving mode
<ul><li>{@link #NONE} : equal space between each note
<li>{@link #DEFAULT} : smaller space for short note, bigger space for long notes, something that look nice ;)
</ul>
@param mode {@link #DEFAULT} or {@link #NONE}
@param variation, in % negative to reduce, positive
to improve space between notes.
|
[
"Sets",
"the",
"engraving",
"mode",
"<ul",
">",
"<li",
">",
"{"
] |
train
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/Engraver.java#L214-L247
|
hawkular/hawkular-apm
|
client/agent-opentracing/src/main/java/org/hawkular/apm/agent/opentracing/OpenTracingManager.java
|
OpenTracingManager.isInstanceOf
|
public boolean isInstanceOf(Object obj, Class<?> clz) {
"""
This method determines whether the supplied object is an
instance of the supplied class/interface.
@param obj The object
@param clz The class
@return Whether the object is an instance of the class
"""
if (obj == null || clz == null) {
if (log.isLoggable(Level.FINEST)) {
log.finest("isInstanceOf error: obj=" + obj + " clz=" + clz);
}
return false;
}
return clz.isInstance(obj);
}
|
java
|
public boolean isInstanceOf(Object obj, Class<?> clz) {
if (obj == null || clz == null) {
if (log.isLoggable(Level.FINEST)) {
log.finest("isInstanceOf error: obj=" + obj + " clz=" + clz);
}
return false;
}
return clz.isInstance(obj);
}
|
[
"public",
"boolean",
"isInstanceOf",
"(",
"Object",
"obj",
",",
"Class",
"<",
"?",
">",
"clz",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
"||",
"clz",
"==",
"null",
")",
"{",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINEST",
")",
")",
"{",
"log",
".",
"finest",
"(",
"\"isInstanceOf error: obj=\"",
"+",
"obj",
"+",
"\" clz=\"",
"+",
"clz",
")",
";",
"}",
"return",
"false",
";",
"}",
"return",
"clz",
".",
"isInstance",
"(",
"obj",
")",
";",
"}"
] |
This method determines whether the supplied object is an
instance of the supplied class/interface.
@param obj The object
@param clz The class
@return Whether the object is an instance of the class
|
[
"This",
"method",
"determines",
"whether",
"the",
"supplied",
"object",
"is",
"an",
"instance",
"of",
"the",
"supplied",
"class",
"/",
"interface",
"."
] |
train
|
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/agent-opentracing/src/main/java/org/hawkular/apm/agent/opentracing/OpenTracingManager.java#L527-L535
|
google/j2objc
|
translator/src/main/java/com/google/devtools/j2objc/javac/JavacJ2ObjCIncompatibleStripper.java
|
JavacJ2ObjCIncompatibleStripper.checkAnnotations
|
private boolean checkAnnotations(List<? extends AnnotationTree> annotations, Tree node) {
"""
Checks for any J2ObjCIncompatible annotations. Returns whether
the caller should to continue scanning this node.
"""
for (AnnotationTree annotation : annotations) {
if (isJ2ObjCIncompatible(annotation)) {
nodesToStrip.add(node);
return false;
}
}
return true;
}
|
java
|
private boolean checkAnnotations(List<? extends AnnotationTree> annotations, Tree node) {
for (AnnotationTree annotation : annotations) {
if (isJ2ObjCIncompatible(annotation)) {
nodesToStrip.add(node);
return false;
}
}
return true;
}
|
[
"private",
"boolean",
"checkAnnotations",
"(",
"List",
"<",
"?",
"extends",
"AnnotationTree",
">",
"annotations",
",",
"Tree",
"node",
")",
"{",
"for",
"(",
"AnnotationTree",
"annotation",
":",
"annotations",
")",
"{",
"if",
"(",
"isJ2ObjCIncompatible",
"(",
"annotation",
")",
")",
"{",
"nodesToStrip",
".",
"add",
"(",
"node",
")",
";",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Checks for any J2ObjCIncompatible annotations. Returns whether
the caller should to continue scanning this node.
|
[
"Checks",
"for",
"any",
"J2ObjCIncompatible",
"annotations",
".",
"Returns",
"whether",
"the",
"caller",
"should",
"to",
"continue",
"scanning",
"this",
"node",
"."
] |
train
|
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavacJ2ObjCIncompatibleStripper.java#L129-L137
|
google/j2objc
|
jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/GenericSignatureParser.java
|
GenericSignatureParser.parseForClass
|
public void parseForClass(GenericDeclaration genericDecl, String signature) {
"""
Parses the generic signature of a class and creates the data structure
representing the signature.
@param genericDecl the GenericDeclaration calling this method
@param signature the generic signature of the class
"""
setInput(genericDecl, signature);
if (!eof) {
parseClassSignature();
} else {
if(genericDecl instanceof Class) {
Class c = (Class) genericDecl;
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
this.superclassType = c.getSuperclass();
Class<?>[] interfaces = c.getInterfaces();
if (interfaces.length == 0) {
this.interfaceTypes = ListOfTypes.EMPTY;
} else {
this.interfaceTypes = new ListOfTypes(interfaces);
}
} else {
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
this.superclassType = Object.class;
this.interfaceTypes = ListOfTypes.EMPTY;
}
}
}
|
java
|
public void parseForClass(GenericDeclaration genericDecl, String signature) {
setInput(genericDecl, signature);
if (!eof) {
parseClassSignature();
} else {
if(genericDecl instanceof Class) {
Class c = (Class) genericDecl;
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
this.superclassType = c.getSuperclass();
Class<?>[] interfaces = c.getInterfaces();
if (interfaces.length == 0) {
this.interfaceTypes = ListOfTypes.EMPTY;
} else {
this.interfaceTypes = new ListOfTypes(interfaces);
}
} else {
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
this.superclassType = Object.class;
this.interfaceTypes = ListOfTypes.EMPTY;
}
}
}
|
[
"public",
"void",
"parseForClass",
"(",
"GenericDeclaration",
"genericDecl",
",",
"String",
"signature",
")",
"{",
"setInput",
"(",
"genericDecl",
",",
"signature",
")",
";",
"if",
"(",
"!",
"eof",
")",
"{",
"parseClassSignature",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"genericDecl",
"instanceof",
"Class",
")",
"{",
"Class",
"c",
"=",
"(",
"Class",
")",
"genericDecl",
";",
"this",
".",
"formalTypeParameters",
"=",
"EmptyArray",
".",
"TYPE_VARIABLE",
";",
"this",
".",
"superclassType",
"=",
"c",
".",
"getSuperclass",
"(",
")",
";",
"Class",
"<",
"?",
">",
"[",
"]",
"interfaces",
"=",
"c",
".",
"getInterfaces",
"(",
")",
";",
"if",
"(",
"interfaces",
".",
"length",
"==",
"0",
")",
"{",
"this",
".",
"interfaceTypes",
"=",
"ListOfTypes",
".",
"EMPTY",
";",
"}",
"else",
"{",
"this",
".",
"interfaceTypes",
"=",
"new",
"ListOfTypes",
"(",
"interfaces",
")",
";",
"}",
"}",
"else",
"{",
"this",
".",
"formalTypeParameters",
"=",
"EmptyArray",
".",
"TYPE_VARIABLE",
";",
"this",
".",
"superclassType",
"=",
"Object",
".",
"class",
";",
"this",
".",
"interfaceTypes",
"=",
"ListOfTypes",
".",
"EMPTY",
";",
"}",
"}",
"}"
] |
Parses the generic signature of a class and creates the data structure
representing the signature.
@param genericDecl the GenericDeclaration calling this method
@param signature the generic signature of the class
|
[
"Parses",
"the",
"generic",
"signature",
"of",
"a",
"class",
"and",
"creates",
"the",
"data",
"structure",
"representing",
"the",
"signature",
"."
] |
train
|
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/GenericSignatureParser.java#L123-L144
|
javalite/activeweb
|
activeweb/src/main/java/org/javalite/activeweb/Router.java
|
Router.getControllerPath
|
protected ControllerPath getControllerPath(String uri) {
"""
Finds a controller path from URI. Controller path includes a package prefix taken from URI, similar to:
<p/>
<code>http://host/context/admin/printers/show/1</code>, where "admin" is a "package_suffix", "printers" is a
"controller_name".
<p/>
for example above, the method will Map with two keys: "package_suffix" and "controller_name"
@param uri this is a URI - the information after context : "controller/action/whatever".
@return map with two keys: "controller_name" and "package_suffix", both of which can be null.
"""
boolean rootPath = uri.equals("/");
boolean useRootController = rootPath && rootControllerName != null;
if (useRootController) {
return new ControllerPath(rootControllerName);
} else if (rootControllerName == null && rootPath) {
LOGGER.warn("URI is: '/', but root controller not set");
return new ControllerPath();
} else {
String controllerPackage;
if ((controllerPackage = findPackageSuffix(uri)) != null) {
String controllerName = findControllerNamePart(controllerPackage, uri);
return new ControllerPath(controllerName, controllerPackage);
} else {
return new ControllerPath(uri.split("/")[1]);//no package suffix
}
}
}
|
java
|
protected ControllerPath getControllerPath(String uri) {
boolean rootPath = uri.equals("/");
boolean useRootController = rootPath && rootControllerName != null;
if (useRootController) {
return new ControllerPath(rootControllerName);
} else if (rootControllerName == null && rootPath) {
LOGGER.warn("URI is: '/', but root controller not set");
return new ControllerPath();
} else {
String controllerPackage;
if ((controllerPackage = findPackageSuffix(uri)) != null) {
String controllerName = findControllerNamePart(controllerPackage, uri);
return new ControllerPath(controllerName, controllerPackage);
} else {
return new ControllerPath(uri.split("/")[1]);//no package suffix
}
}
}
|
[
"protected",
"ControllerPath",
"getControllerPath",
"(",
"String",
"uri",
")",
"{",
"boolean",
"rootPath",
"=",
"uri",
".",
"equals",
"(",
"\"/\"",
")",
";",
"boolean",
"useRootController",
"=",
"rootPath",
"&&",
"rootControllerName",
"!=",
"null",
";",
"if",
"(",
"useRootController",
")",
"{",
"return",
"new",
"ControllerPath",
"(",
"rootControllerName",
")",
";",
"}",
"else",
"if",
"(",
"rootControllerName",
"==",
"null",
"&&",
"rootPath",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"URI is: '/', but root controller not set\"",
")",
";",
"return",
"new",
"ControllerPath",
"(",
")",
";",
"}",
"else",
"{",
"String",
"controllerPackage",
";",
"if",
"(",
"(",
"controllerPackage",
"=",
"findPackageSuffix",
"(",
"uri",
")",
")",
"!=",
"null",
")",
"{",
"String",
"controllerName",
"=",
"findControllerNamePart",
"(",
"controllerPackage",
",",
"uri",
")",
";",
"return",
"new",
"ControllerPath",
"(",
"controllerName",
",",
"controllerPackage",
")",
";",
"}",
"else",
"{",
"return",
"new",
"ControllerPath",
"(",
"uri",
".",
"split",
"(",
"\"/\"",
")",
"[",
"1",
"]",
")",
";",
"//no package suffix",
"}",
"}",
"}"
] |
Finds a controller path from URI. Controller path includes a package prefix taken from URI, similar to:
<p/>
<code>http://host/context/admin/printers/show/1</code>, where "admin" is a "package_suffix", "printers" is a
"controller_name".
<p/>
for example above, the method will Map with two keys: "package_suffix" and "controller_name"
@param uri this is a URI - the information after context : "controller/action/whatever".
@return map with two keys: "controller_name" and "package_suffix", both of which can be null.
|
[
"Finds",
"a",
"controller",
"path",
"from",
"URI",
".",
"Controller",
"path",
"includes",
"a",
"package",
"prefix",
"taken",
"from",
"URI",
"similar",
"to",
":",
"<p",
"/",
">",
"<code",
">",
"http",
":",
"//",
"host",
"/",
"context",
"/",
"admin",
"/",
"printers",
"/",
"show",
"/",
"1<",
"/",
"code",
">",
"where",
"admin",
"is",
"a",
"package_suffix",
"printers",
"is",
"a",
"controller_name",
".",
"<p",
"/",
">",
"for",
"example",
"above",
"the",
"method",
"will",
"Map",
"with",
"two",
"keys",
":",
"package_suffix",
"and",
"controller_name"
] |
train
|
https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/Router.java#L327-L346
|
raydac/java-binary-block-parser
|
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java
|
JBBPTextWriter.SetHR
|
public JBBPTextWriter SetHR(final String prefix, final int length, final char ch) {
"""
Change parameters for horizontal rule.
@param prefix the prefix to be printed before rule, it can be null
@param length the length in symbols.
@param ch symbol to draw
@return the context
"""
this.prefixHR = prefix == null ? "" : prefix;
this.hrChar = ch;
this.hrLength = length;
return this;
}
|
java
|
public JBBPTextWriter SetHR(final String prefix, final int length, final char ch) {
this.prefixHR = prefix == null ? "" : prefix;
this.hrChar = ch;
this.hrLength = length;
return this;
}
|
[
"public",
"JBBPTextWriter",
"SetHR",
"(",
"final",
"String",
"prefix",
",",
"final",
"int",
"length",
",",
"final",
"char",
"ch",
")",
"{",
"this",
".",
"prefixHR",
"=",
"prefix",
"==",
"null",
"?",
"\"\"",
":",
"prefix",
";",
"this",
".",
"hrChar",
"=",
"ch",
";",
"this",
".",
"hrLength",
"=",
"length",
";",
"return",
"this",
";",
"}"
] |
Change parameters for horizontal rule.
@param prefix the prefix to be printed before rule, it can be null
@param length the length in symbols.
@param ch symbol to draw
@return the context
|
[
"Change",
"parameters",
"for",
"horizontal",
"rule",
"."
] |
train
|
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L1188-L1193
|
lessthanoptimal/BoofCV
|
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
|
MultiViewOps.extractEpipoles
|
public static void extractEpipoles( TrifocalTensor tensor , Point3D_F64 e2 , Point3D_F64 e3 ) {
"""
<p>
Computes the epipoles of the first camera in the second and third images. Epipoles are found
in homogeneous coordinates and have a norm of 1.
</p>
<p>
Properties:
<ul>
<li> e2<sup>T</sup>*F12 = 0
<li> e3<sup>T</sup>*F13 = 0
</ul>
where F1i is a fundamental matrix from image 1 to i.
</p>
@see TrifocalExtractGeometries
@param tensor Trifocal tensor. Not Modified
@param e2 Output: Epipole in image 2. Homogeneous coordinates. Modified
@param e3 Output: Epipole in image 3. Homogeneous coordinates. Modified
"""
TrifocalExtractGeometries e = new TrifocalExtractGeometries();
e.setTensor(tensor);
e.extractEpipoles(e2,e3);
}
|
java
|
public static void extractEpipoles( TrifocalTensor tensor , Point3D_F64 e2 , Point3D_F64 e3 ) {
TrifocalExtractGeometries e = new TrifocalExtractGeometries();
e.setTensor(tensor);
e.extractEpipoles(e2,e3);
}
|
[
"public",
"static",
"void",
"extractEpipoles",
"(",
"TrifocalTensor",
"tensor",
",",
"Point3D_F64",
"e2",
",",
"Point3D_F64",
"e3",
")",
"{",
"TrifocalExtractGeometries",
"e",
"=",
"new",
"TrifocalExtractGeometries",
"(",
")",
";",
"e",
".",
"setTensor",
"(",
"tensor",
")",
";",
"e",
".",
"extractEpipoles",
"(",
"e2",
",",
"e3",
")",
";",
"}"
] |
<p>
Computes the epipoles of the first camera in the second and third images. Epipoles are found
in homogeneous coordinates and have a norm of 1.
</p>
<p>
Properties:
<ul>
<li> e2<sup>T</sup>*F12 = 0
<li> e3<sup>T</sup>*F13 = 0
</ul>
where F1i is a fundamental matrix from image 1 to i.
</p>
@see TrifocalExtractGeometries
@param tensor Trifocal tensor. Not Modified
@param e2 Output: Epipole in image 2. Homogeneous coordinates. Modified
@param e3 Output: Epipole in image 3. Homogeneous coordinates. Modified
|
[
"<p",
">",
"Computes",
"the",
"epipoles",
"of",
"the",
"first",
"camera",
"in",
"the",
"second",
"and",
"third",
"images",
".",
"Epipoles",
"are",
"found",
"in",
"homogeneous",
"coordinates",
"and",
"have",
"a",
"norm",
"of",
"1",
".",
"<",
"/",
"p",
">"
] |
train
|
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L603-L607
|
janvanbesien/java-ipv6
|
src/main/java/com/googlecode/ipv6/IPv6Network.java
|
IPv6Network.fromString
|
public static IPv6Network fromString(String string) {
"""
Create an IPv6 network from its String representation. For example "1234:5678:abcd:0:0:0:0:0/64" or "2001::ff/128".
@param string string representation
@return ipv6 network
"""
if (string.indexOf('/') == -1)
{
throw new IllegalArgumentException("Expected format is network-address/prefix-length");
}
final String networkAddressString = parseNetworkAddress(string);
int prefixLength = parsePrefixLength(string);
final IPv6Address networkAddress = IPv6Address.fromString(networkAddressString);
return fromAddressAndMask(networkAddress, new IPv6NetworkMask(prefixLength));
}
|
java
|
public static IPv6Network fromString(String string)
{
if (string.indexOf('/') == -1)
{
throw new IllegalArgumentException("Expected format is network-address/prefix-length");
}
final String networkAddressString = parseNetworkAddress(string);
int prefixLength = parsePrefixLength(string);
final IPv6Address networkAddress = IPv6Address.fromString(networkAddressString);
return fromAddressAndMask(networkAddress, new IPv6NetworkMask(prefixLength));
}
|
[
"public",
"static",
"IPv6Network",
"fromString",
"(",
"String",
"string",
")",
"{",
"if",
"(",
"string",
".",
"indexOf",
"(",
"'",
"'",
")",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Expected format is network-address/prefix-length\"",
")",
";",
"}",
"final",
"String",
"networkAddressString",
"=",
"parseNetworkAddress",
"(",
"string",
")",
";",
"int",
"prefixLength",
"=",
"parsePrefixLength",
"(",
"string",
")",
";",
"final",
"IPv6Address",
"networkAddress",
"=",
"IPv6Address",
".",
"fromString",
"(",
"networkAddressString",
")",
";",
"return",
"fromAddressAndMask",
"(",
"networkAddress",
",",
"new",
"IPv6NetworkMask",
"(",
"prefixLength",
")",
")",
";",
"}"
] |
Create an IPv6 network from its String representation. For example "1234:5678:abcd:0:0:0:0:0/64" or "2001::ff/128".
@param string string representation
@return ipv6 network
|
[
"Create",
"an",
"IPv6",
"network",
"from",
"its",
"String",
"representation",
".",
"For",
"example",
"1234",
":",
"5678",
":",
"abcd",
":",
"0",
":",
"0",
":",
"0",
":",
"0",
":",
"0",
"/",
"64",
"or",
"2001",
"::",
"ff",
"/",
"128",
"."
] |
train
|
https://github.com/janvanbesien/java-ipv6/blob/9af15b4a6c0074f9fa23dfa030027c631b9c2f78/src/main/java/com/googlecode/ipv6/IPv6Network.java#L88-L101
|
looly/hutool
|
hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java
|
BeanUtil.fillBeanWithMap
|
public static <T> T fillBeanWithMap(Map<?, ?> map, T bean, boolean isToCamelCase, CopyOptions copyOptions) {
"""
δ½Ώη¨Mapε‘«ε
Bean对豑
@param <T> Beanη±»ε
@param map Map
@param bean Bean
@param isToCamelCase ζ―ε¦ε°MapδΈηδΈεηΊΏι£ζ Όkey转ζ’δΈΊι©Όε³°ι£ζ Ό
@param copyOptions ε±ζ§ε€εΆιι‘Ή {@link CopyOptions}
@return Bean
@since 3.3.1
"""
if (MapUtil.isEmpty(map)) {
return bean;
}
if (isToCamelCase) {
map = MapUtil.toCamelCaseMap(map);
}
return BeanCopier.create(map, bean, copyOptions).copy();
}
|
java
|
public static <T> T fillBeanWithMap(Map<?, ?> map, T bean, boolean isToCamelCase, CopyOptions copyOptions) {
if (MapUtil.isEmpty(map)) {
return bean;
}
if (isToCamelCase) {
map = MapUtil.toCamelCaseMap(map);
}
return BeanCopier.create(map, bean, copyOptions).copy();
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"fillBeanWithMap",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"T",
"bean",
",",
"boolean",
"isToCamelCase",
",",
"CopyOptions",
"copyOptions",
")",
"{",
"if",
"(",
"MapUtil",
".",
"isEmpty",
"(",
"map",
")",
")",
"{",
"return",
"bean",
";",
"}",
"if",
"(",
"isToCamelCase",
")",
"{",
"map",
"=",
"MapUtil",
".",
"toCamelCaseMap",
"(",
"map",
")",
";",
"}",
"return",
"BeanCopier",
".",
"create",
"(",
"map",
",",
"bean",
",",
"copyOptions",
")",
".",
"copy",
"(",
")",
";",
"}"
] |
δ½Ώη¨Mapε‘«ε
Bean对豑
@param <T> Beanη±»ε
@param map Map
@param bean Bean
@param isToCamelCase ζ―ε¦ε°MapδΈηδΈεηΊΏι£ζ Όkey转ζ’δΈΊι©Όε³°ι£ζ Ό
@param copyOptions ε±ζ§ε€εΆιι‘Ή {@link CopyOptions}
@return Bean
@since 3.3.1
|
[
"δ½Ώη¨Mapε‘«ε
Bean对豑"
] |
train
|
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L423-L431
|
sagiegurari/fax4j
|
src/main/java/org/fax4j/util/AbstractProcessExecutor.java
|
AbstractProcessExecutor.executeProcess
|
public ProcessOutput executeProcess(ConfigurationHolder configurationHolder,String command) throws IOException,InterruptedException {
"""
This function executes the given command and returns the process output.
@param configurationHolder
The configuration holder used when invoking the process
@param command
The command to execute
@return The process output
@throws IOException
Any IO exception
@throws InterruptedException
If thread interrupted during waitFor for the process
"""
//validate command provided
if((command==null)||(command.length()==0))
{
throw new FaxException("Command not provided.");
}
//trim command and validate
String updatedCommand=command.trim();
if(updatedCommand.length()==0)
{
throw new FaxException("Command not provided.");
}
//validate configuration holder provided
if(configurationHolder==null)
{
throw new FaxException("Configuration holder not provided.");
}
this.LOGGER.logDebug(new Object[]{"Invoking command: ",updatedCommand},null);
//execute process
ProcessOutput processOutput=this.executeProcessImpl(configurationHolder,updatedCommand);
int exitCode=processOutput.getExitCode();
String outputText=processOutput.getOutputText();
String errorText=processOutput.getErrorText();
this.LOGGER.logDebug(new Object[]{"Invoked command: ",updatedCommand," Exit Code: ",String.valueOf(exitCode),Logger.SYSTEM_EOL,"Output Text:",Logger.SYSTEM_EOL,outputText,Logger.SYSTEM_EOL,"Error Text:",Logger.SYSTEM_EOL,errorText},null);
return processOutput;
}
|
java
|
public ProcessOutput executeProcess(ConfigurationHolder configurationHolder,String command) throws IOException,InterruptedException
{
//validate command provided
if((command==null)||(command.length()==0))
{
throw new FaxException("Command not provided.");
}
//trim command and validate
String updatedCommand=command.trim();
if(updatedCommand.length()==0)
{
throw new FaxException("Command not provided.");
}
//validate configuration holder provided
if(configurationHolder==null)
{
throw new FaxException("Configuration holder not provided.");
}
this.LOGGER.logDebug(new Object[]{"Invoking command: ",updatedCommand},null);
//execute process
ProcessOutput processOutput=this.executeProcessImpl(configurationHolder,updatedCommand);
int exitCode=processOutput.getExitCode();
String outputText=processOutput.getOutputText();
String errorText=processOutput.getErrorText();
this.LOGGER.logDebug(new Object[]{"Invoked command: ",updatedCommand," Exit Code: ",String.valueOf(exitCode),Logger.SYSTEM_EOL,"Output Text:",Logger.SYSTEM_EOL,outputText,Logger.SYSTEM_EOL,"Error Text:",Logger.SYSTEM_EOL,errorText},null);
return processOutput;
}
|
[
"public",
"ProcessOutput",
"executeProcess",
"(",
"ConfigurationHolder",
"configurationHolder",
",",
"String",
"command",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"//validate command provided",
"if",
"(",
"(",
"command",
"==",
"null",
")",
"||",
"(",
"command",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"throw",
"new",
"FaxException",
"(",
"\"Command not provided.\"",
")",
";",
"}",
"//trim command and validate",
"String",
"updatedCommand",
"=",
"command",
".",
"trim",
"(",
")",
";",
"if",
"(",
"updatedCommand",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"FaxException",
"(",
"\"Command not provided.\"",
")",
";",
"}",
"//validate configuration holder provided",
"if",
"(",
"configurationHolder",
"==",
"null",
")",
"{",
"throw",
"new",
"FaxException",
"(",
"\"Configuration holder not provided.\"",
")",
";",
"}",
"this",
".",
"LOGGER",
".",
"logDebug",
"(",
"new",
"Object",
"[",
"]",
"{",
"\"Invoking command: \"",
",",
"updatedCommand",
"}",
",",
"null",
")",
";",
"//execute process",
"ProcessOutput",
"processOutput",
"=",
"this",
".",
"executeProcessImpl",
"(",
"configurationHolder",
",",
"updatedCommand",
")",
";",
"int",
"exitCode",
"=",
"processOutput",
".",
"getExitCode",
"(",
")",
";",
"String",
"outputText",
"=",
"processOutput",
".",
"getOutputText",
"(",
")",
";",
"String",
"errorText",
"=",
"processOutput",
".",
"getErrorText",
"(",
")",
";",
"this",
".",
"LOGGER",
".",
"logDebug",
"(",
"new",
"Object",
"[",
"]",
"{",
"\"Invoked command: \"",
",",
"updatedCommand",
",",
"\" Exit Code: \"",
",",
"String",
".",
"valueOf",
"(",
"exitCode",
")",
",",
"Logger",
".",
"SYSTEM_EOL",
",",
"\"Output Text:\"",
",",
"Logger",
".",
"SYSTEM_EOL",
",",
"outputText",
",",
"Logger",
".",
"SYSTEM_EOL",
",",
"\"Error Text:\"",
",",
"Logger",
".",
"SYSTEM_EOL",
",",
"errorText",
"}",
",",
"null",
")",
";",
"return",
"processOutput",
";",
"}"
] |
This function executes the given command and returns the process output.
@param configurationHolder
The configuration holder used when invoking the process
@param command
The command to execute
@return The process output
@throws IOException
Any IO exception
@throws InterruptedException
If thread interrupted during waitFor for the process
|
[
"This",
"function",
"executes",
"the",
"given",
"command",
"and",
"returns",
"the",
"process",
"output",
"."
] |
train
|
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/util/AbstractProcessExecutor.java#L49-L82
|
Azure/azure-sdk-for-java
|
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java
|
DiagnosticsInner.executeSiteAnalysis
|
public DiagnosticAnalysisInner executeSiteAnalysis(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName) {
"""
Execute Analysis.
Execute Analysis.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@param diagnosticCategory Category Name
@param analysisName Analysis Resource Name
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DiagnosticAnalysisInner object if successful.
"""
return executeSiteAnalysisWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, analysisName).toBlocking().single().body();
}
|
java
|
public DiagnosticAnalysisInner executeSiteAnalysis(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName) {
return executeSiteAnalysisWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, analysisName).toBlocking().single().body();
}
|
[
"public",
"DiagnosticAnalysisInner",
"executeSiteAnalysis",
"(",
"String",
"resourceGroupName",
",",
"String",
"siteName",
",",
"String",
"diagnosticCategory",
",",
"String",
"analysisName",
")",
"{",
"return",
"executeSiteAnalysisWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"siteName",
",",
"diagnosticCategory",
",",
"analysisName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Execute Analysis.
Execute Analysis.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@param diagnosticCategory Category Name
@param analysisName Analysis Resource Name
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DiagnosticAnalysisInner object if successful.
|
[
"Execute",
"Analysis",
".",
"Execute",
"Analysis",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L638-L640
|
pravega/pravega
|
common/src/main/java/io/pravega/common/util/BitConverter.java
|
BitConverter.readInt
|
public static int readInt(ArrayView source, int position) {
"""
Reads a 32-bit integer from the given ArrayView starting at the given position.
@param source The ArrayView to read from.
@param position The position in the ArrayView to start reading at.
@return The read number.
"""
return (source.get(position) & 0xFF) << 24
| (source.get(position + 1) & 0xFF) << 16
| (source.get(position + 2) & 0xFF) << 8
| (source.get(position + 3) & 0xFF);
}
|
java
|
public static int readInt(ArrayView source, int position) {
return (source.get(position) & 0xFF) << 24
| (source.get(position + 1) & 0xFF) << 16
| (source.get(position + 2) & 0xFF) << 8
| (source.get(position + 3) & 0xFF);
}
|
[
"public",
"static",
"int",
"readInt",
"(",
"ArrayView",
"source",
",",
"int",
"position",
")",
"{",
"return",
"(",
"source",
".",
"get",
"(",
"position",
")",
"&",
"0xFF",
")",
"<<",
"24",
"|",
"(",
"source",
".",
"get",
"(",
"position",
"+",
"1",
")",
"&",
"0xFF",
")",
"<<",
"16",
"|",
"(",
"source",
".",
"get",
"(",
"position",
"+",
"2",
")",
"&",
"0xFF",
")",
"<<",
"8",
"|",
"(",
"source",
".",
"get",
"(",
"position",
"+",
"3",
")",
"&",
"0xFF",
")",
";",
"}"
] |
Reads a 32-bit integer from the given ArrayView starting at the given position.
@param source The ArrayView to read from.
@param position The position in the ArrayView to start reading at.
@return The read number.
|
[
"Reads",
"a",
"32",
"-",
"bit",
"integer",
"from",
"the",
"given",
"ArrayView",
"starting",
"at",
"the",
"given",
"position",
"."
] |
train
|
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L137-L142
|
sothawo/mapjfx
|
src/main/java/com/sothawo/mapjfx/MapView.java
|
JavaConnector.extentSelected
|
public void extentSelected(double latMin, double lonMin, double latMax, double lonMax) {
"""
called when the user selected an extent by dragging the mouse with modifier pressed.
@param latMin
latitude of upper left corner
@param lonMin
longitude of upper left corner
@param latMax
latitude of lower right corner
@param lonMax
longitude of lower right corner
"""
final Extent extent = Extent.forCoordinates(new Coordinate(latMin, lonMin), new Coordinate(latMax, lonMax));
if (logger.isTraceEnabled()) {
logger.trace("JS reports extend selected: {}", extent);
}
fireEvent(new MapViewEvent(MapViewEvent.MAP_EXTENT, extent));
}
|
java
|
public void extentSelected(double latMin, double lonMin, double latMax, double lonMax) {
final Extent extent = Extent.forCoordinates(new Coordinate(latMin, lonMin), new Coordinate(latMax, lonMax));
if (logger.isTraceEnabled()) {
logger.trace("JS reports extend selected: {}", extent);
}
fireEvent(new MapViewEvent(MapViewEvent.MAP_EXTENT, extent));
}
|
[
"public",
"void",
"extentSelected",
"(",
"double",
"latMin",
",",
"double",
"lonMin",
",",
"double",
"latMax",
",",
"double",
"lonMax",
")",
"{",
"final",
"Extent",
"extent",
"=",
"Extent",
".",
"forCoordinates",
"(",
"new",
"Coordinate",
"(",
"latMin",
",",
"lonMin",
")",
",",
"new",
"Coordinate",
"(",
"latMax",
",",
"lonMax",
")",
")",
";",
"if",
"(",
"logger",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"logger",
".",
"trace",
"(",
"\"JS reports extend selected: {}\"",
",",
"extent",
")",
";",
"}",
"fireEvent",
"(",
"new",
"MapViewEvent",
"(",
"MapViewEvent",
".",
"MAP_EXTENT",
",",
"extent",
")",
")",
";",
"}"
] |
called when the user selected an extent by dragging the mouse with modifier pressed.
@param latMin
latitude of upper left corner
@param lonMin
longitude of upper left corner
@param latMax
latitude of lower right corner
@param lonMax
longitude of lower right corner
|
[
"called",
"when",
"the",
"user",
"selected",
"an",
"extent",
"by",
"dragging",
"the",
"mouse",
"with",
"modifier",
"pressed",
"."
] |
train
|
https://github.com/sothawo/mapjfx/blob/202091de492ab7a8b000c77efd833029f7f0ef92/src/main/java/com/sothawo/mapjfx/MapView.java#L1653-L1659
|
lessthanoptimal/BoofCV
|
main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java
|
ConvertBufferedImage.extractBuffered
|
public static BufferedImage extractBuffered(InterleavedU8 img) {
"""
Creates a new BufferedImage that internally uses the same data as the provided
{@link InterleavedU8}. If 3 bands then the image will be of type TYPE_3BYTE_BGR
or if 1 band TYPE_BYTE_GRAY.
@param img Input image who's data will be wrapped by the returned BufferedImage.
@return BufferedImage which shared data with the input image.
"""
if (img.isSubimage())
throw new IllegalArgumentException("Sub-images are not supported for this operation");
final int width = img.width;
final int height = img.height;
final int numBands = img.numBands;
// wrap the byte array
DataBuffer bufferByte = new DataBufferByte(img.data, width * height * numBands, 0);
ColorModel colorModel;
int[] bOffs = null;
if (numBands == 3) {
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
int[] nBits = {8, 8, 8};
bOffs = new int[]{2, 1, 0};
colorModel = new ComponentColorModel(cs, nBits, false, false,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
} else if (numBands == 1) {
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
int[] nBits = {8};
bOffs = new int[]{0};
colorModel = new ComponentColorModel(cs, nBits, false, true,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
} else {
throw new IllegalArgumentException("Only 1 or 3 bands supported");
}
// Create a raster using the sample model and data buffer
WritableRaster raster = Raster.createInterleavedRaster(
bufferByte, width, height, img.stride, numBands, bOffs, new Point(0, 0));
// Combine the color model and raster into a buffered image
return new BufferedImage(colorModel, raster, false, null);
}
|
java
|
public static BufferedImage extractBuffered(InterleavedU8 img) {
if (img.isSubimage())
throw new IllegalArgumentException("Sub-images are not supported for this operation");
final int width = img.width;
final int height = img.height;
final int numBands = img.numBands;
// wrap the byte array
DataBuffer bufferByte = new DataBufferByte(img.data, width * height * numBands, 0);
ColorModel colorModel;
int[] bOffs = null;
if (numBands == 3) {
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
int[] nBits = {8, 8, 8};
bOffs = new int[]{2, 1, 0};
colorModel = new ComponentColorModel(cs, nBits, false, false,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
} else if (numBands == 1) {
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
int[] nBits = {8};
bOffs = new int[]{0};
colorModel = new ComponentColorModel(cs, nBits, false, true,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
} else {
throw new IllegalArgumentException("Only 1 or 3 bands supported");
}
// Create a raster using the sample model and data buffer
WritableRaster raster = Raster.createInterleavedRaster(
bufferByte, width, height, img.stride, numBands, bOffs, new Point(0, 0));
// Combine the color model and raster into a buffered image
return new BufferedImage(colorModel, raster, false, null);
}
|
[
"public",
"static",
"BufferedImage",
"extractBuffered",
"(",
"InterleavedU8",
"img",
")",
"{",
"if",
"(",
"img",
".",
"isSubimage",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Sub-images are not supported for this operation\"",
")",
";",
"final",
"int",
"width",
"=",
"img",
".",
"width",
";",
"final",
"int",
"height",
"=",
"img",
".",
"height",
";",
"final",
"int",
"numBands",
"=",
"img",
".",
"numBands",
";",
"// wrap the byte array",
"DataBuffer",
"bufferByte",
"=",
"new",
"DataBufferByte",
"(",
"img",
".",
"data",
",",
"width",
"*",
"height",
"*",
"numBands",
",",
"0",
")",
";",
"ColorModel",
"colorModel",
";",
"int",
"[",
"]",
"bOffs",
"=",
"null",
";",
"if",
"(",
"numBands",
"==",
"3",
")",
"{",
"ColorSpace",
"cs",
"=",
"ColorSpace",
".",
"getInstance",
"(",
"ColorSpace",
".",
"CS_sRGB",
")",
";",
"int",
"[",
"]",
"nBits",
"=",
"{",
"8",
",",
"8",
",",
"8",
"}",
";",
"bOffs",
"=",
"new",
"int",
"[",
"]",
"{",
"2",
",",
"1",
",",
"0",
"}",
";",
"colorModel",
"=",
"new",
"ComponentColorModel",
"(",
"cs",
",",
"nBits",
",",
"false",
",",
"false",
",",
"Transparency",
".",
"OPAQUE",
",",
"DataBuffer",
".",
"TYPE_BYTE",
")",
";",
"}",
"else",
"if",
"(",
"numBands",
"==",
"1",
")",
"{",
"ColorSpace",
"cs",
"=",
"ColorSpace",
".",
"getInstance",
"(",
"ColorSpace",
".",
"CS_GRAY",
")",
";",
"int",
"[",
"]",
"nBits",
"=",
"{",
"8",
"}",
";",
"bOffs",
"=",
"new",
"int",
"[",
"]",
"{",
"0",
"}",
";",
"colorModel",
"=",
"new",
"ComponentColorModel",
"(",
"cs",
",",
"nBits",
",",
"false",
",",
"true",
",",
"Transparency",
".",
"OPAQUE",
",",
"DataBuffer",
".",
"TYPE_BYTE",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Only 1 or 3 bands supported\"",
")",
";",
"}",
"// Create a raster using the sample model and data buffer",
"WritableRaster",
"raster",
"=",
"Raster",
".",
"createInterleavedRaster",
"(",
"bufferByte",
",",
"width",
",",
"height",
",",
"img",
".",
"stride",
",",
"numBands",
",",
"bOffs",
",",
"new",
"Point",
"(",
"0",
",",
"0",
")",
")",
";",
"// Combine the color model and raster into a buffered image",
"return",
"new",
"BufferedImage",
"(",
"colorModel",
",",
"raster",
",",
"false",
",",
"null",
")",
";",
"}"
] |
Creates a new BufferedImage that internally uses the same data as the provided
{@link InterleavedU8}. If 3 bands then the image will be of type TYPE_3BYTE_BGR
or if 1 band TYPE_BYTE_GRAY.
@param img Input image who's data will be wrapped by the returned BufferedImage.
@return BufferedImage which shared data with the input image.
|
[
"Creates",
"a",
"new",
"BufferedImage",
"that",
"internally",
"uses",
"the",
"same",
"data",
"as",
"the",
"provided",
"{",
"@link",
"InterleavedU8",
"}",
".",
"If",
"3",
"bands",
"then",
"the",
"image",
"will",
"be",
"of",
"type",
"TYPE_3BYTE_BGR",
"or",
"if",
"1",
"band",
"TYPE_BYTE_GRAY",
"."
] |
train
|
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java#L181-L220
|
marklogic/java-client-api
|
marklogic-client-api/src/main/java/com/marklogic/client/example/cookbook/datamovement/BulkLoadFromJdbcRaw.java
|
BulkLoadFromJdbcRaw.populateTitle
|
public void populateTitle(ResultSet row, ObjectNode t) throws SQLException {
"""
take data from a JDBC ResultSet (row) and populate an ObjectNode (JSON) object
"""
t.put("employeeId", row.getInt("emp_no"));
t.put("title", row.getString("title"));
Calendar fromDate = Calendar.getInstance();
fromDate.setTime(row.getDate("from_date"));
t.put("fromDate", dateFormat.format(fromDate.getTime()));
Calendar toDate = Calendar.getInstance();
toDate.setTime(row.getDate("to_date"));
t.put("toDate", dateFormat.format(toDate.getTime()));
}
|
java
|
public void populateTitle(ResultSet row, ObjectNode t) throws SQLException {
t.put("employeeId", row.getInt("emp_no"));
t.put("title", row.getString("title"));
Calendar fromDate = Calendar.getInstance();
fromDate.setTime(row.getDate("from_date"));
t.put("fromDate", dateFormat.format(fromDate.getTime()));
Calendar toDate = Calendar.getInstance();
toDate.setTime(row.getDate("to_date"));
t.put("toDate", dateFormat.format(toDate.getTime()));
}
|
[
"public",
"void",
"populateTitle",
"(",
"ResultSet",
"row",
",",
"ObjectNode",
"t",
")",
"throws",
"SQLException",
"{",
"t",
".",
"put",
"(",
"\"employeeId\"",
",",
"row",
".",
"getInt",
"(",
"\"emp_no\"",
")",
")",
";",
"t",
".",
"put",
"(",
"\"title\"",
",",
"row",
".",
"getString",
"(",
"\"title\"",
")",
")",
";",
"Calendar",
"fromDate",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"fromDate",
".",
"setTime",
"(",
"row",
".",
"getDate",
"(",
"\"from_date\"",
")",
")",
";",
"t",
".",
"put",
"(",
"\"fromDate\"",
",",
"dateFormat",
".",
"format",
"(",
"fromDate",
".",
"getTime",
"(",
")",
")",
")",
";",
"Calendar",
"toDate",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"toDate",
".",
"setTime",
"(",
"row",
".",
"getDate",
"(",
"\"to_date\"",
")",
")",
";",
"t",
".",
"put",
"(",
"\"toDate\"",
",",
"dateFormat",
".",
"format",
"(",
"toDate",
".",
"getTime",
"(",
")",
")",
")",
";",
"}"
] |
take data from a JDBC ResultSet (row) and populate an ObjectNode (JSON) object
|
[
"take",
"data",
"from",
"a",
"JDBC",
"ResultSet",
"(",
"row",
")",
"and",
"populate",
"an",
"ObjectNode",
"(",
"JSON",
")",
"object"
] |
train
|
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/example/cookbook/datamovement/BulkLoadFromJdbcRaw.java#L125-L134
|
google/j2objc
|
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/VariableStack.java
|
VariableStack.getLocalVariable
|
public XObject getLocalVariable(int index, int frame)
throws TransformerException {
"""
Get a local variable or parameter in the current stack frame.
@param index Local variable index relative to the given
frame bottom.
NEEDSDOC @param frame
@return The value of the variable.
@throws TransformerException
"""
index += frame;
XObject val = _stackFrames[index];
return val;
}
|
java
|
public XObject getLocalVariable(int index, int frame)
throws TransformerException
{
index += frame;
XObject val = _stackFrames[index];
return val;
}
|
[
"public",
"XObject",
"getLocalVariable",
"(",
"int",
"index",
",",
"int",
"frame",
")",
"throws",
"TransformerException",
"{",
"index",
"+=",
"frame",
";",
"XObject",
"val",
"=",
"_stackFrames",
"[",
"index",
"]",
";",
"return",
"val",
";",
"}"
] |
Get a local variable or parameter in the current stack frame.
@param index Local variable index relative to the given
frame bottom.
NEEDSDOC @param frame
@return The value of the variable.
@throws TransformerException
|
[
"Get",
"a",
"local",
"variable",
"or",
"parameter",
"in",
"the",
"current",
"stack",
"frame",
"."
] |
train
|
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/VariableStack.java#L336-L345
|
spring-projects/spring-data-solr
|
src/main/java/org/springframework/data/solr/core/QueryParserBase.java
|
QueryParserBase.createQueryStringFromNode
|
public String createQueryStringFromNode(Node node, @Nullable Class<?> domainType) {
"""
Create the plain query string representation of the given node using mapping information derived from the domain
type.
@param node
@param domainType can be {@literal null}.
@return
@since 4.0
"""
return createQueryStringFromNode(node, 0, domainType);
}
|
java
|
public String createQueryStringFromNode(Node node, @Nullable Class<?> domainType) {
return createQueryStringFromNode(node, 0, domainType);
}
|
[
"public",
"String",
"createQueryStringFromNode",
"(",
"Node",
"node",
",",
"@",
"Nullable",
"Class",
"<",
"?",
">",
"domainType",
")",
"{",
"return",
"createQueryStringFromNode",
"(",
"node",
",",
"0",
",",
"domainType",
")",
";",
"}"
] |
Create the plain query string representation of the given node using mapping information derived from the domain
type.
@param node
@param domainType can be {@literal null}.
@return
@since 4.0
|
[
"Create",
"the",
"plain",
"query",
"string",
"representation",
"of",
"the",
"given",
"node",
"using",
"mapping",
"information",
"derived",
"from",
"the",
"domain",
"type",
"."
] |
train
|
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/QueryParserBase.java#L163-L165
|
xcesco/kripton
|
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindDaoFactoryBuilder.java
|
BindDaoFactoryBuilder.buildDaoFactoryInterface
|
public String buildDaoFactoryInterface(Elements elementUtils, Filer filer, SQLiteDatabaseSchema schema) throws Exception {
"""
Build dao factory interface.
@param elementUtils the element utils
@param filer the filer
@param schema the schema
@return schema typeName
@throws Exception the exception
"""
String schemaName = generateDaoFactoryName(schema);
PackageElement pkg = elementUtils.getPackageOf(schema.getElement());
String packageName = pkg.isUnnamed() ? "" : pkg.getQualifiedName().toString();
AnnotationProcessorUtilis.infoOnGeneratedClasses(BindDataSource.class, packageName, schemaName);
classBuilder = buildDaoFactoryInterfaceInternal(elementUtils, filer, schema);
TypeSpec typeSpec = classBuilder.build();
JavaWriterHelper.writeJava2File(filer, packageName, typeSpec);
return schemaName;
}
|
java
|
public String buildDaoFactoryInterface(Elements elementUtils, Filer filer, SQLiteDatabaseSchema schema) throws Exception {
String schemaName = generateDaoFactoryName(schema);
PackageElement pkg = elementUtils.getPackageOf(schema.getElement());
String packageName = pkg.isUnnamed() ? "" : pkg.getQualifiedName().toString();
AnnotationProcessorUtilis.infoOnGeneratedClasses(BindDataSource.class, packageName, schemaName);
classBuilder = buildDaoFactoryInterfaceInternal(elementUtils, filer, schema);
TypeSpec typeSpec = classBuilder.build();
JavaWriterHelper.writeJava2File(filer, packageName, typeSpec);
return schemaName;
}
|
[
"public",
"String",
"buildDaoFactoryInterface",
"(",
"Elements",
"elementUtils",
",",
"Filer",
"filer",
",",
"SQLiteDatabaseSchema",
"schema",
")",
"throws",
"Exception",
"{",
"String",
"schemaName",
"=",
"generateDaoFactoryName",
"(",
"schema",
")",
";",
"PackageElement",
"pkg",
"=",
"elementUtils",
".",
"getPackageOf",
"(",
"schema",
".",
"getElement",
"(",
")",
")",
";",
"String",
"packageName",
"=",
"pkg",
".",
"isUnnamed",
"(",
")",
"?",
"\"\"",
":",
"pkg",
".",
"getQualifiedName",
"(",
")",
".",
"toString",
"(",
")",
";",
"AnnotationProcessorUtilis",
".",
"infoOnGeneratedClasses",
"(",
"BindDataSource",
".",
"class",
",",
"packageName",
",",
"schemaName",
")",
";",
"classBuilder",
"=",
"buildDaoFactoryInterfaceInternal",
"(",
"elementUtils",
",",
"filer",
",",
"schema",
")",
";",
"TypeSpec",
"typeSpec",
"=",
"classBuilder",
".",
"build",
"(",
")",
";",
"JavaWriterHelper",
".",
"writeJava2File",
"(",
"filer",
",",
"packageName",
",",
"typeSpec",
")",
";",
"return",
"schemaName",
";",
"}"
] |
Build dao factory interface.
@param elementUtils the element utils
@param filer the filer
@param schema the schema
@return schema typeName
@throws Exception the exception
|
[
"Build",
"dao",
"factory",
"interface",
"."
] |
train
|
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindDaoFactoryBuilder.java#L95-L107
|
pravega/pravega
|
controller/src/main/java/io/pravega/controller/server/SegmentHelper.java
|
SegmentHelper.readTable
|
public CompletableFuture<List<TableEntry<byte[], byte[]>>> readTable(final String tableName,
final List<TableKey<byte[]>> keys,
String delegationToken,
final long clientRequestId) {
"""
This method sends a WireCommand to read table entries.
@param tableName Qualified table name.
@param keys List of {@link TableKey}s to be read. {@link TableKey#getVersion()} is not used
during this operation and the latest version is read.
@param delegationToken The token to be presented to the segmentstore.
@param clientRequestId Request id.
@return A CompletableFuture that, when completed normally, will contain a list of {@link TableEntry} with
a value corresponding to the latest version. The version will be set to {@link KeyVersion#NOT_EXISTS} if the
key does not exist. If the operation failed, the future will be failed with the causing exception.
"""
final CompletableFuture<List<TableEntry<byte[], byte[]>>> result = new CompletableFuture<>();
final Controller.NodeUri uri = getTableUri(tableName);
final WireCommandType type = WireCommandType.READ_TABLE;
final long requestId = (clientRequestId == RequestTag.NON_EXISTENT_ID) ? idGenerator.get() : clientRequestId;
final FailingReplyProcessor replyProcessor = new FailingReplyProcessor() {
@Override
public void connectionDropped() {
log.warn(requestId, "readTable {} Connection dropped", tableName);
result.completeExceptionally(
new WireCommandFailedException(type, WireCommandFailedException.Reason.ConnectionDropped));
}
@Override
public void wrongHost(WireCommands.WrongHost wrongHost) {
log.warn(requestId, "readTable {} wrong host", tableName);
result.completeExceptionally(new WireCommandFailedException(type, WireCommandFailedException.Reason.UnknownHost));
}
@Override
public void noSuchSegment(WireCommands.NoSuchSegment noSuchSegment) {
log.warn(requestId, "readTable {} NoSuchSegment", tableName);
result.completeExceptionally(new WireCommandFailedException(type, WireCommandFailedException.Reason.SegmentDoesNotExist));
}
@Override
public void tableRead(WireCommands.TableRead tableRead) {
log.debug(requestId, "readTable {} successful.", tableName);
List<TableEntry<byte[], byte[]>> tableEntries = tableRead.getEntries().getEntries().stream()
.map(e -> new TableEntryImpl<>(convertFromWireCommand(e.getKey()), getArray(e.getValue().getData())))
.collect(Collectors.toList());
result.complete(tableEntries);
}
@Override
public void processingFailure(Exception error) {
log.error(requestId, "readTable {} failed", tableName, error);
handleError(error, result, type);
}
@Override
public void authTokenCheckFailed(WireCommands.AuthTokenCheckFailed authTokenCheckFailed) {
result.completeExceptionally(
new WireCommandFailedException(new AuthenticationException(authTokenCheckFailed.toString()),
type, WireCommandFailedException.Reason.AuthFailed));
}
};
List<ByteBuf> buffersToRelease = new ArrayList<>();
// the version is always NO_VERSION as read returns the latest version of value.
List<WireCommands.TableKey> keyList = keys.stream().map(k -> {
ByteBuf buffer = wrappedBuffer(k.getKey());
buffersToRelease.add(buffer);
return new WireCommands.TableKey(buffer, WireCommands.TableKey.NO_VERSION);
}).collect(Collectors.toList());
WireCommands.ReadTable request = new WireCommands.ReadTable(requestId, tableName, delegationToken, keyList);
sendRequestAsync(request, replyProcessor, result, ModelHelper.encode(uri));
return result
.whenComplete((r, e) -> release(buffersToRelease));
}
|
java
|
public CompletableFuture<List<TableEntry<byte[], byte[]>>> readTable(final String tableName,
final List<TableKey<byte[]>> keys,
String delegationToken,
final long clientRequestId) {
final CompletableFuture<List<TableEntry<byte[], byte[]>>> result = new CompletableFuture<>();
final Controller.NodeUri uri = getTableUri(tableName);
final WireCommandType type = WireCommandType.READ_TABLE;
final long requestId = (clientRequestId == RequestTag.NON_EXISTENT_ID) ? idGenerator.get() : clientRequestId;
final FailingReplyProcessor replyProcessor = new FailingReplyProcessor() {
@Override
public void connectionDropped() {
log.warn(requestId, "readTable {} Connection dropped", tableName);
result.completeExceptionally(
new WireCommandFailedException(type, WireCommandFailedException.Reason.ConnectionDropped));
}
@Override
public void wrongHost(WireCommands.WrongHost wrongHost) {
log.warn(requestId, "readTable {} wrong host", tableName);
result.completeExceptionally(new WireCommandFailedException(type, WireCommandFailedException.Reason.UnknownHost));
}
@Override
public void noSuchSegment(WireCommands.NoSuchSegment noSuchSegment) {
log.warn(requestId, "readTable {} NoSuchSegment", tableName);
result.completeExceptionally(new WireCommandFailedException(type, WireCommandFailedException.Reason.SegmentDoesNotExist));
}
@Override
public void tableRead(WireCommands.TableRead tableRead) {
log.debug(requestId, "readTable {} successful.", tableName);
List<TableEntry<byte[], byte[]>> tableEntries = tableRead.getEntries().getEntries().stream()
.map(e -> new TableEntryImpl<>(convertFromWireCommand(e.getKey()), getArray(e.getValue().getData())))
.collect(Collectors.toList());
result.complete(tableEntries);
}
@Override
public void processingFailure(Exception error) {
log.error(requestId, "readTable {} failed", tableName, error);
handleError(error, result, type);
}
@Override
public void authTokenCheckFailed(WireCommands.AuthTokenCheckFailed authTokenCheckFailed) {
result.completeExceptionally(
new WireCommandFailedException(new AuthenticationException(authTokenCheckFailed.toString()),
type, WireCommandFailedException.Reason.AuthFailed));
}
};
List<ByteBuf> buffersToRelease = new ArrayList<>();
// the version is always NO_VERSION as read returns the latest version of value.
List<WireCommands.TableKey> keyList = keys.stream().map(k -> {
ByteBuf buffer = wrappedBuffer(k.getKey());
buffersToRelease.add(buffer);
return new WireCommands.TableKey(buffer, WireCommands.TableKey.NO_VERSION);
}).collect(Collectors.toList());
WireCommands.ReadTable request = new WireCommands.ReadTable(requestId, tableName, delegationToken, keyList);
sendRequestAsync(request, replyProcessor, result, ModelHelper.encode(uri));
return result
.whenComplete((r, e) -> release(buffersToRelease));
}
|
[
"public",
"CompletableFuture",
"<",
"List",
"<",
"TableEntry",
"<",
"byte",
"[",
"]",
",",
"byte",
"[",
"]",
">",
">",
">",
"readTable",
"(",
"final",
"String",
"tableName",
",",
"final",
"List",
"<",
"TableKey",
"<",
"byte",
"[",
"]",
">",
">",
"keys",
",",
"String",
"delegationToken",
",",
"final",
"long",
"clientRequestId",
")",
"{",
"final",
"CompletableFuture",
"<",
"List",
"<",
"TableEntry",
"<",
"byte",
"[",
"]",
",",
"byte",
"[",
"]",
">",
">",
">",
"result",
"=",
"new",
"CompletableFuture",
"<>",
"(",
")",
";",
"final",
"Controller",
".",
"NodeUri",
"uri",
"=",
"getTableUri",
"(",
"tableName",
")",
";",
"final",
"WireCommandType",
"type",
"=",
"WireCommandType",
".",
"READ_TABLE",
";",
"final",
"long",
"requestId",
"=",
"(",
"clientRequestId",
"==",
"RequestTag",
".",
"NON_EXISTENT_ID",
")",
"?",
"idGenerator",
".",
"get",
"(",
")",
":",
"clientRequestId",
";",
"final",
"FailingReplyProcessor",
"replyProcessor",
"=",
"new",
"FailingReplyProcessor",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"connectionDropped",
"(",
")",
"{",
"log",
".",
"warn",
"(",
"requestId",
",",
"\"readTable {} Connection dropped\"",
",",
"tableName",
")",
";",
"result",
".",
"completeExceptionally",
"(",
"new",
"WireCommandFailedException",
"(",
"type",
",",
"WireCommandFailedException",
".",
"Reason",
".",
"ConnectionDropped",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"wrongHost",
"(",
"WireCommands",
".",
"WrongHost",
"wrongHost",
")",
"{",
"log",
".",
"warn",
"(",
"requestId",
",",
"\"readTable {} wrong host\"",
",",
"tableName",
")",
";",
"result",
".",
"completeExceptionally",
"(",
"new",
"WireCommandFailedException",
"(",
"type",
",",
"WireCommandFailedException",
".",
"Reason",
".",
"UnknownHost",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"noSuchSegment",
"(",
"WireCommands",
".",
"NoSuchSegment",
"noSuchSegment",
")",
"{",
"log",
".",
"warn",
"(",
"requestId",
",",
"\"readTable {} NoSuchSegment\"",
",",
"tableName",
")",
";",
"result",
".",
"completeExceptionally",
"(",
"new",
"WireCommandFailedException",
"(",
"type",
",",
"WireCommandFailedException",
".",
"Reason",
".",
"SegmentDoesNotExist",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"tableRead",
"(",
"WireCommands",
".",
"TableRead",
"tableRead",
")",
"{",
"log",
".",
"debug",
"(",
"requestId",
",",
"\"readTable {} successful.\"",
",",
"tableName",
")",
";",
"List",
"<",
"TableEntry",
"<",
"byte",
"[",
"]",
",",
"byte",
"[",
"]",
">",
">",
"tableEntries",
"=",
"tableRead",
".",
"getEntries",
"(",
")",
".",
"getEntries",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"e",
"->",
"new",
"TableEntryImpl",
"<>",
"(",
"convertFromWireCommand",
"(",
"e",
".",
"getKey",
"(",
")",
")",
",",
"getArray",
"(",
"e",
".",
"getValue",
"(",
")",
".",
"getData",
"(",
")",
")",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"result",
".",
"complete",
"(",
"tableEntries",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"processingFailure",
"(",
"Exception",
"error",
")",
"{",
"log",
".",
"error",
"(",
"requestId",
",",
"\"readTable {} failed\"",
",",
"tableName",
",",
"error",
")",
";",
"handleError",
"(",
"error",
",",
"result",
",",
"type",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"authTokenCheckFailed",
"(",
"WireCommands",
".",
"AuthTokenCheckFailed",
"authTokenCheckFailed",
")",
"{",
"result",
".",
"completeExceptionally",
"(",
"new",
"WireCommandFailedException",
"(",
"new",
"AuthenticationException",
"(",
"authTokenCheckFailed",
".",
"toString",
"(",
")",
")",
",",
"type",
",",
"WireCommandFailedException",
".",
"Reason",
".",
"AuthFailed",
")",
")",
";",
"}",
"}",
";",
"List",
"<",
"ByteBuf",
">",
"buffersToRelease",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// the version is always NO_VERSION as read returns the latest version of value.",
"List",
"<",
"WireCommands",
".",
"TableKey",
">",
"keyList",
"=",
"keys",
".",
"stream",
"(",
")",
".",
"map",
"(",
"k",
"->",
"{",
"ByteBuf",
"buffer",
"=",
"wrappedBuffer",
"(",
"k",
".",
"getKey",
"(",
")",
")",
";",
"buffersToRelease",
".",
"add",
"(",
"buffer",
")",
";",
"return",
"new",
"WireCommands",
".",
"TableKey",
"(",
"buffer",
",",
"WireCommands",
".",
"TableKey",
".",
"NO_VERSION",
")",
";",
"}",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"WireCommands",
".",
"ReadTable",
"request",
"=",
"new",
"WireCommands",
".",
"ReadTable",
"(",
"requestId",
",",
"tableName",
",",
"delegationToken",
",",
"keyList",
")",
";",
"sendRequestAsync",
"(",
"request",
",",
"replyProcessor",
",",
"result",
",",
"ModelHelper",
".",
"encode",
"(",
"uri",
")",
")",
";",
"return",
"result",
".",
"whenComplete",
"(",
"(",
"r",
",",
"e",
")",
"->",
"release",
"(",
"buffersToRelease",
")",
")",
";",
"}"
] |
This method sends a WireCommand to read table entries.
@param tableName Qualified table name.
@param keys List of {@link TableKey}s to be read. {@link TableKey#getVersion()} is not used
during this operation and the latest version is read.
@param delegationToken The token to be presented to the segmentstore.
@param clientRequestId Request id.
@return A CompletableFuture that, when completed normally, will contain a list of {@link TableEntry} with
a value corresponding to the latest version. The version will be set to {@link KeyVersion#NOT_EXISTS} if the
key does not exist. If the operation failed, the future will be failed with the causing exception.
|
[
"This",
"method",
"sends",
"a",
"WireCommand",
"to",
"read",
"table",
"entries",
"."
] |
train
|
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/SegmentHelper.java#L946-L1011
|
netplex/json-smart-v2
|
json-smart/src/main/java/net/minidev/json/parser/JSONParser.java
|
JSONParser.parse
|
public <T> T parse(byte[] in, JsonReaderI<T> mapper) throws ParseException {
"""
use to return Primitive Type, or String, Or JsonObject or JsonArray
generated by a ContainerFactory
"""
return getPBytes().parse(in, mapper);
}
|
java
|
public <T> T parse(byte[] in, JsonReaderI<T> mapper) throws ParseException {
return getPBytes().parse(in, mapper);
}
|
[
"public",
"<",
"T",
">",
"T",
"parse",
"(",
"byte",
"[",
"]",
"in",
",",
"JsonReaderI",
"<",
"T",
">",
"mapper",
")",
"throws",
"ParseException",
"{",
"return",
"getPBytes",
"(",
")",
".",
"parse",
"(",
"in",
",",
"mapper",
")",
";",
"}"
] |
use to return Primitive Type, or String, Or JsonObject or JsonArray
generated by a ContainerFactory
|
[
"use",
"to",
"return",
"Primitive",
"Type",
"or",
"String",
"Or",
"JsonObject",
"or",
"JsonArray",
"generated",
"by",
"a",
"ContainerFactory"
] |
train
|
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/parser/JSONParser.java#L197-L199
|
Domo42/saga-lib
|
saga-lib/src/main/java/com/codebullets/sagalib/AbstractSaga.java
|
AbstractSaga.requestTimeout
|
protected TimeoutId requestTimeout(final long delay, final TimeUnit unit, @Nullable final String name) {
"""
Requests a timeout event with a specific name to this saga. The name can
be used to distinguish the timeout if multiple ones have been requested by the saga.
"""
return requestTimeout(delay, unit, name, null);
}
|
java
|
protected TimeoutId requestTimeout(final long delay, final TimeUnit unit, @Nullable final String name) {
return requestTimeout(delay, unit, name, null);
}
|
[
"protected",
"TimeoutId",
"requestTimeout",
"(",
"final",
"long",
"delay",
",",
"final",
"TimeUnit",
"unit",
",",
"@",
"Nullable",
"final",
"String",
"name",
")",
"{",
"return",
"requestTimeout",
"(",
"delay",
",",
"unit",
",",
"name",
",",
"null",
")",
";",
"}"
] |
Requests a timeout event with a specific name to this saga. The name can
be used to distinguish the timeout if multiple ones have been requested by the saga.
|
[
"Requests",
"a",
"timeout",
"event",
"with",
"a",
"specific",
"name",
"to",
"this",
"saga",
".",
"The",
"name",
"can",
"be",
"used",
"to",
"distinguish",
"the",
"timeout",
"if",
"multiple",
"ones",
"have",
"been",
"requested",
"by",
"the",
"saga",
"."
] |
train
|
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/AbstractSaga.java#L94-L96
|
Azure/azure-sdk-for-java
|
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VirtualWANsInner.java
|
VirtualWANsInner.updateTags
|
public VirtualWANInner updateTags(String resourceGroupName, String virtualWANName) {
"""
Updates a VirtualWAN tags.
@param resourceGroupName The resource group name of the VirtualWan.
@param virtualWANName The name of the VirtualWAN being updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VirtualWANInner object if successful.
"""
return updateTagsWithServiceResponseAsync(resourceGroupName, virtualWANName).toBlocking().last().body();
}
|
java
|
public VirtualWANInner updateTags(String resourceGroupName, String virtualWANName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, virtualWANName).toBlocking().last().body();
}
|
[
"public",
"VirtualWANInner",
"updateTags",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualWANName",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualWANName",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Updates a VirtualWAN tags.
@param resourceGroupName The resource group name of the VirtualWan.
@param virtualWANName The name of the VirtualWAN being updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VirtualWANInner object if successful.
|
[
"Updates",
"a",
"VirtualWAN",
"tags",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VirtualWANsInner.java#L378-L380
|
apereo/cas
|
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
|
AbstractCasWebflowConfigurer.createActionState
|
public ActionState createActionState(final Flow flow, final String name, final String action) {
"""
Create action state action state.
@param flow the flow
@param name the name
@param action the action
@return the action state
"""
return createActionState(flow, name, createEvaluateAction(action));
}
|
java
|
public ActionState createActionState(final Flow flow, final String name, final String action) {
return createActionState(flow, name, createEvaluateAction(action));
}
|
[
"public",
"ActionState",
"createActionState",
"(",
"final",
"Flow",
"flow",
",",
"final",
"String",
"name",
",",
"final",
"String",
"action",
")",
"{",
"return",
"createActionState",
"(",
"flow",
",",
"name",
",",
"createEvaluateAction",
"(",
"action",
")",
")",
";",
"}"
] |
Create action state action state.
@param flow the flow
@param name the name
@param action the action
@return the action state
|
[
"Create",
"action",
"state",
"action",
"state",
"."
] |
train
|
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L188-L190
|
cdk/cdk
|
tool/hash/src/main/java/org/openscience/cdk/hash/stereo/GeometricCumulativeDoubleBondFactory.java
|
GeometricCumulativeDoubleBondFactory.axial2DEncoder
|
private static StereoEncoder axial2DEncoder(IAtomContainer container, IAtom start, List<IBond> startBonds,
IAtom end, List<IBond> endBonds) {
"""
Create an encoder for axial 2D stereochemistry for the given start and
end atoms.
@param container the molecule
@param start start of the cumulated system
@param startBonds bonds connected to the start
@param end end of the cumulated system
@param endBonds bonds connected to the end
@return an encoder
"""
Point2d[] ps = new Point2d[4];
int[] es = new int[4];
PermutationParity perm = new CombinedPermutationParity(fill2DCoordinates(container, start, startBonds, ps, es,
0), fill2DCoordinates(container, end, endBonds, ps, es, 2));
GeometricParity geom = new Tetrahedral2DParity(ps, es);
int u = container.indexOf(start);
int v = container.indexOf(end);
return new GeometryEncoder(new int[]{u, v}, perm, geom);
}
|
java
|
private static StereoEncoder axial2DEncoder(IAtomContainer container, IAtom start, List<IBond> startBonds,
IAtom end, List<IBond> endBonds) {
Point2d[] ps = new Point2d[4];
int[] es = new int[4];
PermutationParity perm = new CombinedPermutationParity(fill2DCoordinates(container, start, startBonds, ps, es,
0), fill2DCoordinates(container, end, endBonds, ps, es, 2));
GeometricParity geom = new Tetrahedral2DParity(ps, es);
int u = container.indexOf(start);
int v = container.indexOf(end);
return new GeometryEncoder(new int[]{u, v}, perm, geom);
}
|
[
"private",
"static",
"StereoEncoder",
"axial2DEncoder",
"(",
"IAtomContainer",
"container",
",",
"IAtom",
"start",
",",
"List",
"<",
"IBond",
">",
"startBonds",
",",
"IAtom",
"end",
",",
"List",
"<",
"IBond",
">",
"endBonds",
")",
"{",
"Point2d",
"[",
"]",
"ps",
"=",
"new",
"Point2d",
"[",
"4",
"]",
";",
"int",
"[",
"]",
"es",
"=",
"new",
"int",
"[",
"4",
"]",
";",
"PermutationParity",
"perm",
"=",
"new",
"CombinedPermutationParity",
"(",
"fill2DCoordinates",
"(",
"container",
",",
"start",
",",
"startBonds",
",",
"ps",
",",
"es",
",",
"0",
")",
",",
"fill2DCoordinates",
"(",
"container",
",",
"end",
",",
"endBonds",
",",
"ps",
",",
"es",
",",
"2",
")",
")",
";",
"GeometricParity",
"geom",
"=",
"new",
"Tetrahedral2DParity",
"(",
"ps",
",",
"es",
")",
";",
"int",
"u",
"=",
"container",
".",
"indexOf",
"(",
"start",
")",
";",
"int",
"v",
"=",
"container",
".",
"indexOf",
"(",
"end",
")",
";",
"return",
"new",
"GeometryEncoder",
"(",
"new",
"int",
"[",
"]",
"{",
"u",
",",
"v",
"}",
",",
"perm",
",",
"geom",
")",
";",
"}"
] |
Create an encoder for axial 2D stereochemistry for the given start and
end atoms.
@param container the molecule
@param start start of the cumulated system
@param startBonds bonds connected to the start
@param end end of the cumulated system
@param endBonds bonds connected to the end
@return an encoder
|
[
"Create",
"an",
"encoder",
"for",
"axial",
"2D",
"stereochemistry",
"for",
"the",
"given",
"start",
"and",
"end",
"atoms",
"."
] |
train
|
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/hash/src/main/java/org/openscience/cdk/hash/stereo/GeometricCumulativeDoubleBondFactory.java#L171-L186
|
apache/groovy
|
src/main/java/org/codehaus/groovy/control/ClassNodeResolver.java
|
ClassNodeResolver.tryAsScript
|
private static LookupResult tryAsScript(String name, CompilationUnit compilationUnit, ClassNode oldClass) {
"""
try to find a script using the compilation unit class loader.
"""
LookupResult lr = null;
if (oldClass!=null) {
lr = new LookupResult(null, oldClass);
}
if (name.startsWith("java.")) return lr;
//TODO: don't ignore inner static classes completely
if (name.indexOf('$') != -1) return lr;
// try to find a script from classpath*/
GroovyClassLoader gcl = compilationUnit.getClassLoader();
URL url = null;
try {
url = gcl.getResourceLoader().loadGroovySource(name);
} catch (MalformedURLException e) {
// fall through and let the URL be null
}
if (url != null && ( oldClass==null || isSourceNewer(url, oldClass))) {
SourceUnit su = compilationUnit.addSource(url);
return new LookupResult(su,null);
}
return lr;
}
|
java
|
private static LookupResult tryAsScript(String name, CompilationUnit compilationUnit, ClassNode oldClass) {
LookupResult lr = null;
if (oldClass!=null) {
lr = new LookupResult(null, oldClass);
}
if (name.startsWith("java.")) return lr;
//TODO: don't ignore inner static classes completely
if (name.indexOf('$') != -1) return lr;
// try to find a script from classpath*/
GroovyClassLoader gcl = compilationUnit.getClassLoader();
URL url = null;
try {
url = gcl.getResourceLoader().loadGroovySource(name);
} catch (MalformedURLException e) {
// fall through and let the URL be null
}
if (url != null && ( oldClass==null || isSourceNewer(url, oldClass))) {
SourceUnit su = compilationUnit.addSource(url);
return new LookupResult(su,null);
}
return lr;
}
|
[
"private",
"static",
"LookupResult",
"tryAsScript",
"(",
"String",
"name",
",",
"CompilationUnit",
"compilationUnit",
",",
"ClassNode",
"oldClass",
")",
"{",
"LookupResult",
"lr",
"=",
"null",
";",
"if",
"(",
"oldClass",
"!=",
"null",
")",
"{",
"lr",
"=",
"new",
"LookupResult",
"(",
"null",
",",
"oldClass",
")",
";",
"}",
"if",
"(",
"name",
".",
"startsWith",
"(",
"\"java.\"",
")",
")",
"return",
"lr",
";",
"//TODO: don't ignore inner static classes completely",
"if",
"(",
"name",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"return",
"lr",
";",
"// try to find a script from classpath*/",
"GroovyClassLoader",
"gcl",
"=",
"compilationUnit",
".",
"getClassLoader",
"(",
")",
";",
"URL",
"url",
"=",
"null",
";",
"try",
"{",
"url",
"=",
"gcl",
".",
"getResourceLoader",
"(",
")",
".",
"loadGroovySource",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"// fall through and let the URL be null",
"}",
"if",
"(",
"url",
"!=",
"null",
"&&",
"(",
"oldClass",
"==",
"null",
"||",
"isSourceNewer",
"(",
"url",
",",
"oldClass",
")",
")",
")",
"{",
"SourceUnit",
"su",
"=",
"compilationUnit",
".",
"addSource",
"(",
"url",
")",
";",
"return",
"new",
"LookupResult",
"(",
"su",
",",
"null",
")",
";",
"}",
"return",
"lr",
";",
"}"
] |
try to find a script using the compilation unit class loader.
|
[
"try",
"to",
"find",
"a",
"script",
"using",
"the",
"compilation",
"unit",
"class",
"loader",
"."
] |
train
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/control/ClassNodeResolver.java#L279-L302
|
leancloud/java-sdk-all
|
realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java
|
AVIMConversation.getAllMemberInfo
|
public void getAllMemberInfo(int offset, int limit, final AVIMConversationMemberQueryCallback callback) {
"""
θ·εε½εε―Ήθ―ηζζθ§θ²δΏ‘ζ―
@param offset ζ₯θ―’η»ζηθ΅·ε§ηΉ
@param limit ζ₯θ―’η»ζιδΈι
@param callback η»ζεθ°ε½ζ°
"""
QueryConditions conditions = new QueryConditions();
conditions.addWhereItem("cid", QueryOperation.EQUAL_OP, this.conversationId);
conditions.setSkip(offset);
conditions.setLimit(limit);
queryMemberInfo(conditions, callback);
}
|
java
|
public void getAllMemberInfo(int offset, int limit, final AVIMConversationMemberQueryCallback callback) {
QueryConditions conditions = new QueryConditions();
conditions.addWhereItem("cid", QueryOperation.EQUAL_OP, this.conversationId);
conditions.setSkip(offset);
conditions.setLimit(limit);
queryMemberInfo(conditions, callback);
}
|
[
"public",
"void",
"getAllMemberInfo",
"(",
"int",
"offset",
",",
"int",
"limit",
",",
"final",
"AVIMConversationMemberQueryCallback",
"callback",
")",
"{",
"QueryConditions",
"conditions",
"=",
"new",
"QueryConditions",
"(",
")",
";",
"conditions",
".",
"addWhereItem",
"(",
"\"cid\"",
",",
"QueryOperation",
".",
"EQUAL_OP",
",",
"this",
".",
"conversationId",
")",
";",
"conditions",
".",
"setSkip",
"(",
"offset",
")",
";",
"conditions",
".",
"setLimit",
"(",
"limit",
")",
";",
"queryMemberInfo",
"(",
"conditions",
",",
"callback",
")",
";",
"}"
] |
θ·εε½εε―Ήθ―ηζζθ§θ²δΏ‘ζ―
@param offset ζ₯θ―’η»ζηθ΅·ε§ηΉ
@param limit ζ₯θ―’η»ζιδΈι
@param callback η»ζεθ°ε½ζ°
|
[
"θ·εε½εε―Ήθ―ηζζθ§θ²δΏ‘ζ―"
] |
train
|
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java#L1129-L1135
|
impossibl/stencil
|
engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java
|
StencilOperands.narrowAccept
|
protected boolean narrowAccept(Class<?> narrow, Class<?> source) {
"""
Whether we consider the narrow class as a potential candidate for narrowing
the source.
@param narrow
the target narrow class
@param source
the orginal source class
@return true if attempt to narrow source to target is accepted
"""
return narrow == null || narrow.equals(source);
}
|
java
|
protected boolean narrowAccept(Class<?> narrow, Class<?> source) {
return narrow == null || narrow.equals(source);
}
|
[
"protected",
"boolean",
"narrowAccept",
"(",
"Class",
"<",
"?",
">",
"narrow",
",",
"Class",
"<",
"?",
">",
"source",
")",
"{",
"return",
"narrow",
"==",
"null",
"||",
"narrow",
".",
"equals",
"(",
"source",
")",
";",
"}"
] |
Whether we consider the narrow class as a potential candidate for narrowing
the source.
@param narrow
the target narrow class
@param source
the orginal source class
@return true if attempt to narrow source to target is accepted
|
[
"Whether",
"we",
"consider",
"the",
"narrow",
"class",
"as",
"a",
"potential",
"candidate",
"for",
"narrowing",
"the",
"source",
"."
] |
train
|
https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java#L1197-L1199
|
graphhopper/map-matching
|
matching-core/src/main/java/com/graphhopper/matching/util/HmmProbabilities.java
|
HmmProbabilities.transitionLogProbability
|
public double transitionLogProbability(double routeLength, double linearDistance) {
"""
Returns the logarithmic transition probability density for the given
transition parameters.
@param routeLength Length of the shortest route [m] between two
consecutive map matching candidates.
@param linearDistance Linear distance [m] between two consecutive GPS
measurements.
"""
// Transition metric taken from Newson & Krumm.
Double transitionMetric = Math.abs(linearDistance - routeLength);
return Distributions.logExponentialDistribution(beta, transitionMetric);
}
|
java
|
public double transitionLogProbability(double routeLength, double linearDistance) {
// Transition metric taken from Newson & Krumm.
Double transitionMetric = Math.abs(linearDistance - routeLength);
return Distributions.logExponentialDistribution(beta, transitionMetric);
}
|
[
"public",
"double",
"transitionLogProbability",
"(",
"double",
"routeLength",
",",
"double",
"linearDistance",
")",
"{",
"// Transition metric taken from Newson & Krumm.",
"Double",
"transitionMetric",
"=",
"Math",
".",
"abs",
"(",
"linearDistance",
"-",
"routeLength",
")",
";",
"return",
"Distributions",
".",
"logExponentialDistribution",
"(",
"beta",
",",
"transitionMetric",
")",
";",
"}"
] |
Returns the logarithmic transition probability density for the given
transition parameters.
@param routeLength Length of the shortest route [m] between two
consecutive map matching candidates.
@param linearDistance Linear distance [m] between two consecutive GPS
measurements.
|
[
"Returns",
"the",
"logarithmic",
"transition",
"probability",
"density",
"for",
"the",
"given",
"transition",
"parameters",
"."
] |
train
|
https://github.com/graphhopper/map-matching/blob/32cd83f14cb990c2be83c8781f22dfb59e0dbeb4/matching-core/src/main/java/com/graphhopper/matching/util/HmmProbabilities.java#L59-L64
|
versionone/VersionOne.SDK.Java.ObjectModel
|
src/main/java/com/versionone/om/Workitem.java
|
Workitem.createEffort
|
public Effort createEffort(double value, Map<String, Object> attributes) {
"""
Log an effort record against this workitem.
@param value of the Effort.
@param attributes additional attributes for the Effort record.
@return created Effort.
@throws IllegalStateException Effort Tracking is not enabled.
"""
return createEffort(value, null, null, attributes);
}
|
java
|
public Effort createEffort(double value, Map<String, Object> attributes) {
return createEffort(value, null, null, attributes);
}
|
[
"public",
"Effort",
"createEffort",
"(",
"double",
"value",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
")",
"{",
"return",
"createEffort",
"(",
"value",
",",
"null",
",",
"null",
",",
"attributes",
")",
";",
"}"
] |
Log an effort record against this workitem.
@param value of the Effort.
@param attributes additional attributes for the Effort record.
@return created Effort.
@throws IllegalStateException Effort Tracking is not enabled.
|
[
"Log",
"an",
"effort",
"record",
"against",
"this",
"workitem",
"."
] |
train
|
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Workitem.java#L143-L145
|
msgpack/msgpack-java
|
msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java
|
MessageUnpacker.unpackBoolean
|
public boolean unpackBoolean()
throws IOException {
"""
Reads true or false.
@return the read value
@throws MessageTypeException when value is not MessagePack Boolean type
@throws IOException when underlying input throws IOException
"""
byte b = readByte();
if (b == Code.FALSE) {
return false;
}
else if (b == Code.TRUE) {
return true;
}
throw unexpected("boolean", b);
}
|
java
|
public boolean unpackBoolean()
throws IOException
{
byte b = readByte();
if (b == Code.FALSE) {
return false;
}
else if (b == Code.TRUE) {
return true;
}
throw unexpected("boolean", b);
}
|
[
"public",
"boolean",
"unpackBoolean",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"b",
"=",
"readByte",
"(",
")",
";",
"if",
"(",
"b",
"==",
"Code",
".",
"FALSE",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"b",
"==",
"Code",
".",
"TRUE",
")",
"{",
"return",
"true",
";",
"}",
"throw",
"unexpected",
"(",
"\"boolean\"",
",",
"b",
")",
";",
"}"
] |
Reads true or false.
@return the read value
@throws MessageTypeException when value is not MessagePack Boolean type
@throws IOException when underlying input throws IOException
|
[
"Reads",
"true",
"or",
"false",
"."
] |
train
|
https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L766-L777
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/ImageField.java
|
ImageField.doSetData
|
public int doSetData(Object data, boolean bDisplayOption, int iMoveMode) {
"""
Move this physical binary data to this field.
@param data The physical data to move to this field (must be the correct raw data class).
@param bDisplayOption If true, display after setting the data.
@param iMoveMode The type of move.
@return an error code (0 if success).
"""
if (data instanceof String)
return DBConstants.NORMAL_RETURN; // Special case, button pressed
return super.doSetData(data, bDisplayOption, iMoveMode);
}
|
java
|
public int doSetData(Object data, boolean bDisplayOption, int iMoveMode)
{
if (data instanceof String)
return DBConstants.NORMAL_RETURN; // Special case, button pressed
return super.doSetData(data, bDisplayOption, iMoveMode);
}
|
[
"public",
"int",
"doSetData",
"(",
"Object",
"data",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"if",
"(",
"data",
"instanceof",
"String",
")",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"// Special case, button pressed",
"return",
"super",
".",
"doSetData",
"(",
"data",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"}"
] |
Move this physical binary data to this field.
@param data The physical data to move to this field (must be the correct raw data class).
@param bDisplayOption If true, display after setting the data.
@param iMoveMode The type of move.
@return an error code (0 if success).
|
[
"Move",
"this",
"physical",
"binary",
"data",
"to",
"this",
"field",
"."
] |
train
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ImageField.java#L152-L157
|
roboconf/roboconf-platform
|
core/roboconf-core/src/main/java/net/roboconf/core/dsl/ParsingModelIo.java
|
ParsingModelIo.readConfigurationFile
|
public static FileDefinition readConfigurationFile( File relationsFile, boolean ignoreComments ) {
"""
Reads a definition file.
@param relationsFile the relations file
@param ignoreComments true to ignore comments during parsing
@return an instance of {@link FileDefinition} (never null)
<p>
Parsing errors are stored in the result.<br>
See {@link FileDefinition#getParsingErrors()}.
</p>
"""
FileDefinitionParser parser = new FileDefinitionParser( relationsFile, ignoreComments );
return parser.read();
}
|
java
|
public static FileDefinition readConfigurationFile( File relationsFile, boolean ignoreComments ) {
FileDefinitionParser parser = new FileDefinitionParser( relationsFile, ignoreComments );
return parser.read();
}
|
[
"public",
"static",
"FileDefinition",
"readConfigurationFile",
"(",
"File",
"relationsFile",
",",
"boolean",
"ignoreComments",
")",
"{",
"FileDefinitionParser",
"parser",
"=",
"new",
"FileDefinitionParser",
"(",
"relationsFile",
",",
"ignoreComments",
")",
";",
"return",
"parser",
".",
"read",
"(",
")",
";",
"}"
] |
Reads a definition file.
@param relationsFile the relations file
@param ignoreComments true to ignore comments during parsing
@return an instance of {@link FileDefinition} (never null)
<p>
Parsing errors are stored in the result.<br>
See {@link FileDefinition#getParsingErrors()}.
</p>
|
[
"Reads",
"a",
"definition",
"file",
"."
] |
train
|
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/dsl/ParsingModelIo.java#L62-L65
|
OpenLiberty/open-liberty
|
dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/tsx/db/Query.java
|
Query.main2
|
public static void main2(String args[]) {
"""
This method was created in VisualAge.
@param args java.lang.String[]
"""
String dbDriver = "COM.ibm.db2.jdbc.app.DB2Driver";
String url = "jdbc:db2:sample";
String user = "batra";
String pass = "varunbatra";
String querystring = "Select * from batra.employee";
String fn;
String ln;
String bd;
String sal;
try {
ConnectionProperties cp = new ConnectionProperties(dbDriver, url, user, pass);
Query query = new Query(cp, querystring);
QueryResults qs = query.execute();
System.out.println("Number of rows = " + qs.size());
while (qs.next()) {
fn = qs.getValue("FIRSTNME");
ln = qs.getValue("LASTNAME");
bd = qs.getValue("BIRTHDATE");
sal = qs.getValue("SALARY");
System.out.println(fn + " " + ln + " birthdate " + bd + " salary " + sal);
}
}
catch (Exception e) {
//com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.webcontainer.jsp.tsx.db.Query.main2", "348");
System.out.println("Exception: " + e.getMessage());
}
System.out.println("All is Fine!");
}
|
java
|
public static void main2(String args[]) {
String dbDriver = "COM.ibm.db2.jdbc.app.DB2Driver";
String url = "jdbc:db2:sample";
String user = "batra";
String pass = "varunbatra";
String querystring = "Select * from batra.employee";
String fn;
String ln;
String bd;
String sal;
try {
ConnectionProperties cp = new ConnectionProperties(dbDriver, url, user, pass);
Query query = new Query(cp, querystring);
QueryResults qs = query.execute();
System.out.println("Number of rows = " + qs.size());
while (qs.next()) {
fn = qs.getValue("FIRSTNME");
ln = qs.getValue("LASTNAME");
bd = qs.getValue("BIRTHDATE");
sal = qs.getValue("SALARY");
System.out.println(fn + " " + ln + " birthdate " + bd + " salary " + sal);
}
}
catch (Exception e) {
//com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.webcontainer.jsp.tsx.db.Query.main2", "348");
System.out.println("Exception: " + e.getMessage());
}
System.out.println("All is Fine!");
}
|
[
"public",
"static",
"void",
"main2",
"(",
"String",
"args",
"[",
"]",
")",
"{",
"String",
"dbDriver",
"=",
"\"COM.ibm.db2.jdbc.app.DB2Driver\"",
";",
"String",
"url",
"=",
"\"jdbc:db2:sample\"",
";",
"String",
"user",
"=",
"\"batra\"",
";",
"String",
"pass",
"=",
"\"varunbatra\"",
";",
"String",
"querystring",
"=",
"\"Select * from batra.employee\"",
";",
"String",
"fn",
";",
"String",
"ln",
";",
"String",
"bd",
";",
"String",
"sal",
";",
"try",
"{",
"ConnectionProperties",
"cp",
"=",
"new",
"ConnectionProperties",
"(",
"dbDriver",
",",
"url",
",",
"user",
",",
"pass",
")",
";",
"Query",
"query",
"=",
"new",
"Query",
"(",
"cp",
",",
"querystring",
")",
";",
"QueryResults",
"qs",
"=",
"query",
".",
"execute",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Number of rows = \"",
"+",
"qs",
".",
"size",
"(",
")",
")",
";",
"while",
"(",
"qs",
".",
"next",
"(",
")",
")",
"{",
"fn",
"=",
"qs",
".",
"getValue",
"(",
"\"FIRSTNME\"",
")",
";",
"ln",
"=",
"qs",
".",
"getValue",
"(",
"\"LASTNAME\"",
")",
";",
"bd",
"=",
"qs",
".",
"getValue",
"(",
"\"BIRTHDATE\"",
")",
";",
"sal",
"=",
"qs",
".",
"getValue",
"(",
"\"SALARY\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"fn",
"+",
"\" \"",
"+",
"ln",
"+",
"\" birthdate \"",
"+",
"bd",
"+",
"\" salary \"",
"+",
"sal",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"//com.ibm.ws.ffdc.FFDCFilter.processException(e, \"com.ibm.ws.webcontainer.jsp.tsx.db.Query.main2\", \"348\");",
"System",
".",
"out",
".",
"println",
"(",
"\"Exception: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"All is Fine!\"",
")",
";",
"}"
] |
This method was created in VisualAge.
@param args java.lang.String[]
|
[
"This",
"method",
"was",
"created",
"in",
"VisualAge",
"."
] |
train
|
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/tsx/db/Query.java#L331-L360
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.