repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
dita-ot/dita-ot | src/main/java/org/dita/dost/reader/SubjectSchemeReader.java | SubjectSchemeReader.writeMapToXML | public static void writeMapToXML(final Map<URI, Set<URI>> m, final File outputFile) throws IOException {
if (m == null) {
return;
}
final Properties prop = new Properties();
for (final Map.Entry<URI, Set<URI>> entry: m.entrySet()) {
final URI key = entry.getKey();
final String value = StringUtils.join(entry.getValue(), COMMA);
prop.setProperty(key.getPath(), value);
}
try (OutputStream os = new FileOutputStream(outputFile)) {
prop.storeToXML(os, null);
} catch (final IOException e) {
throw new IOException("Failed to write subject scheme graph: " + e.getMessage(), e);
}
} | java | public static void writeMapToXML(final Map<URI, Set<URI>> m, final File outputFile) throws IOException {
if (m == null) {
return;
}
final Properties prop = new Properties();
for (final Map.Entry<URI, Set<URI>> entry: m.entrySet()) {
final URI key = entry.getKey();
final String value = StringUtils.join(entry.getValue(), COMMA);
prop.setProperty(key.getPath(), value);
}
try (OutputStream os = new FileOutputStream(outputFile)) {
prop.storeToXML(os, null);
} catch (final IOException e) {
throw new IOException("Failed to write subject scheme graph: " + e.getMessage(), e);
}
} | [
"public",
"static",
"void",
"writeMapToXML",
"(",
"final",
"Map",
"<",
"URI",
",",
"Set",
"<",
"URI",
">",
">",
"m",
",",
"final",
"File",
"outputFile",
")",
"throws",
"IOException",
"{",
"if",
"(",
"m",
"==",
"null",
")",
"{",
"return",
";",
"}",
... | Write map of sets to a file.
<p>The serialization format is XML properties format where values are comma
separated lists.</p>
@param m map to serialize
@param outputFile output filename, relative to temporary directory | [
"Write",
"map",
"of",
"sets",
"to",
"a",
"file",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/SubjectSchemeReader.java#L142-L157 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/dialog/DialogButton.java | DialogButton.setIcons | public DialogButton setIcons(UiIcon primary, UiIcon secondary)
{
options.put("icons", new ButtonIcon(primary, secondary));
return this;
} | java | public DialogButton setIcons(UiIcon primary, UiIcon secondary)
{
options.put("icons", new ButtonIcon(primary, secondary));
return this;
} | [
"public",
"DialogButton",
"setIcons",
"(",
"UiIcon",
"primary",
",",
"UiIcon",
"secondary",
")",
"{",
"options",
".",
"put",
"(",
"\"icons\"",
",",
"new",
"ButtonIcon",
"(",
"primary",
",",
"secondary",
")",
")",
";",
"return",
"this",
";",
"}"
] | * Icons to display, with or without text (see text option). The primary icon is
displayed on the left of the label text, the secondary on the right. Value for the
primary and secondary properties must be a classname (String), eg. "ui-icon-gear".
For using only a primary icon: icons: {primary:'ui-icon-locked'}. For using both
primary and secondary icon: icons:
{primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'}
@param primary
The primary icon (should be non-null)
@param secondary
The secondary icon (might be null).
@return the button | [
"*",
"Icons",
"to",
"display",
"with",
"or",
"without",
"text",
"(",
"see",
"text",
"option",
")",
".",
"The",
"primary",
"icon",
"is",
"displayed",
"on",
"the",
"left",
"of",
"the",
"label",
"text",
"the",
"secondary",
"on",
"the",
"right",
".",
"Valu... | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/dialog/DialogButton.java#L186-L190 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.withObjectInputStream | public static <T> T withObjectInputStream(File file, @ClosureParams(value = SimpleType.class, options = "java.io.ObjectInputStream") Closure<T> closure) throws IOException {
return IOGroovyMethods.withStream(newObjectInputStream(file), closure);
} | java | public static <T> T withObjectInputStream(File file, @ClosureParams(value = SimpleType.class, options = "java.io.ObjectInputStream") Closure<T> closure) throws IOException {
return IOGroovyMethods.withStream(newObjectInputStream(file), closure);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"withObjectInputStream",
"(",
"File",
"file",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.io.ObjectInputStream\"",
")",
"Closure",
"<",
"T",
">",
"closure",
")... | Create a new ObjectInputStream for this file and pass it to the closure.
This method ensures the stream is closed after the closure returns.
@param file a File
@param closure a closure
@return the value returned by the closure
@throws IOException if an IOException occurs.
@see IOGroovyMethods#withStream(java.io.InputStream, groovy.lang.Closure)
@since 1.5.2 | [
"Create",
"a",
"new",
"ObjectInputStream",
"for",
"this",
"file",
"and",
"pass",
"it",
"to",
"the",
"closure",
".",
"This",
"method",
"ensures",
"the",
"stream",
"is",
"closed",
"after",
"the",
"closure",
"returns",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L203-L205 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/appflow/appflowcollector.java | appflowcollector.get | public static appflowcollector get(nitro_service service, String name) throws Exception{
appflowcollector obj = new appflowcollector();
obj.set_name(name);
appflowcollector response = (appflowcollector) obj.get_resource(service);
return response;
} | java | public static appflowcollector get(nitro_service service, String name) throws Exception{
appflowcollector obj = new appflowcollector();
obj.set_name(name);
appflowcollector response = (appflowcollector) obj.get_resource(service);
return response;
} | [
"public",
"static",
"appflowcollector",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"appflowcollector",
"obj",
"=",
"new",
"appflowcollector",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"... | Use this API to fetch appflowcollector resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"appflowcollector",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appflow/appflowcollector.java#L311-L316 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/CFFFontSubset.java | CFFFontSubset.CalcSubrOffsetSize | int CalcSubrOffsetSize(int Offset,int Size)
{
// Set the size to 0
int OffsetSize = 0;
// Go to the beginning of the private dict
seek(Offset);
// Go until the end of the private dict
while (getPosition() < Offset+Size)
{
int p1 = getPosition();
getDictItem();
int p2 = getPosition();
// When reached to the subrs offset
if (key=="Subrs") {
// The Offsize (minus the subrs key)
OffsetSize = p2-p1-1;
}
// All other keys are ignored
}
// return the size
return OffsetSize;
} | java | int CalcSubrOffsetSize(int Offset,int Size)
{
// Set the size to 0
int OffsetSize = 0;
// Go to the beginning of the private dict
seek(Offset);
// Go until the end of the private dict
while (getPosition() < Offset+Size)
{
int p1 = getPosition();
getDictItem();
int p2 = getPosition();
// When reached to the subrs offset
if (key=="Subrs") {
// The Offsize (minus the subrs key)
OffsetSize = p2-p1-1;
}
// All other keys are ignored
}
// return the size
return OffsetSize;
} | [
"int",
"CalcSubrOffsetSize",
"(",
"int",
"Offset",
",",
"int",
"Size",
")",
"{",
"// Set the size to 0",
"int",
"OffsetSize",
"=",
"0",
";",
"// Go to the beginning of the private dict",
"seek",
"(",
"Offset",
")",
";",
"// Go until the end of the private dict ",
"while... | Calculates how many byte it took to write the offset for the subrs in a specific
private dict.
@param Offset The Offset for the private dict
@param Size The size of the private dict
@return The size of the offset of the subrs in the private dict | [
"Calculates",
"how",
"many",
"byte",
"it",
"took",
"to",
"write",
"the",
"offset",
"for",
"the",
"subrs",
"in",
"a",
"specific",
"private",
"dict",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/CFFFontSubset.java#L1555-L1576 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java | CPInstancePersistenceImpl.removeByUuid_C | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPInstance cpInstance : findByUuid_C(uuid, companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpInstance);
}
} | java | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPInstance cpInstance : findByUuid_C(uuid, companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpInstance);
}
} | [
"@",
"Override",
"public",
"void",
"removeByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"for",
"(",
"CPInstance",
"cpInstance",
":",
"findByUuid_C",
"(",
"uuid",
",",
"companyId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".... | Removes all the cp instances where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID | [
"Removes",
"all",
"the",
"cp",
"instances",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L1397-L1403 |
liyiorg/weixin-popular | src/main/java/weixin/popular/util/SignatureUtil.java | SignatureUtil.generateEventMessageSignature | public static String generateEventMessageSignature(String token, String timestamp,String nonce) {
String[] array = new String[]{token,timestamp,nonce};
Arrays.sort(array);
String s = StringUtils.arrayToDelimitedString(array, "");
return DigestUtils.shaHex(s);
} | java | public static String generateEventMessageSignature(String token, String timestamp,String nonce) {
String[] array = new String[]{token,timestamp,nonce};
Arrays.sort(array);
String s = StringUtils.arrayToDelimitedString(array, "");
return DigestUtils.shaHex(s);
} | [
"public",
"static",
"String",
"generateEventMessageSignature",
"(",
"String",
"token",
",",
"String",
"timestamp",
",",
"String",
"nonce",
")",
"{",
"String",
"[",
"]",
"array",
"=",
"new",
"String",
"[",
"]",
"{",
"token",
",",
"timestamp",
",",
"nonce",
... | 生成事件消息接收签名
@param token token
@param timestamp timestamp
@param nonce nonce
@return str | [
"生成事件消息接收签名"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/SignatureUtil.java#L66-L71 |
Labs64/swid-generator | src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java | DefaultSwidProcessor.setProductTitle | public DefaultSwidProcessor setProductTitle(final String productTitle) {
swidTag.setProductTitle(
new Token(productTitle, idGenerator.nextId()));
return this;
} | java | public DefaultSwidProcessor setProductTitle(final String productTitle) {
swidTag.setProductTitle(
new Token(productTitle, idGenerator.nextId()));
return this;
} | [
"public",
"DefaultSwidProcessor",
"setProductTitle",
"(",
"final",
"String",
"productTitle",
")",
"{",
"swidTag",
".",
"setProductTitle",
"(",
"new",
"Token",
"(",
"productTitle",
",",
"idGenerator",
".",
"nextId",
"(",
")",
")",
")",
";",
"return",
"this",
";... | <p>
Accurately identifies the product (tag: product_title).
</p>
@param productTitle
product title
@return a reference to this object. | [
"<p",
">",
"Accurately",
"identifies",
"the",
"product",
"(",
"tag",
":",
"product_title",
")",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java#L90-L94 |
fcrepo3/fcrepo | fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/decorator/PolicyIndexInvocationHandler.java | PolicyIndexInvocationHandler.deletePolicy | private void deletePolicy(String pid) throws GeneralException {
LOG.debug("Deleting policy " + pid);
try {
// in case the policy doesn't exist (corrupt policy index, failed to add because invalid, etc)
m_policyIndex.deletePolicy(pid);
} catch (PolicyIndexException e) {
throw new GeneralException("Error deleting policy " + pid + " from policy index: " + e.getMessage(), e);
}
} | java | private void deletePolicy(String pid) throws GeneralException {
LOG.debug("Deleting policy " + pid);
try {
// in case the policy doesn't exist (corrupt policy index, failed to add because invalid, etc)
m_policyIndex.deletePolicy(pid);
} catch (PolicyIndexException e) {
throw new GeneralException("Error deleting policy " + pid + " from policy index: " + e.getMessage(), e);
}
} | [
"private",
"void",
"deletePolicy",
"(",
"String",
"pid",
")",
"throws",
"GeneralException",
"{",
"LOG",
".",
"debug",
"(",
"\"Deleting policy \"",
"+",
"pid",
")",
";",
"try",
"{",
"// in case the policy doesn't exist (corrupt policy index, failed to add because invalid, et... | Remove the specified policy from the cache
@param pid
@throws PolicyIndexException | [
"Remove",
"the",
"specified",
"policy",
"from",
"the",
"cache"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/decorator/PolicyIndexInvocationHandler.java#L366-L375 |
banq/jdonframework | src/main/java/com/jdon/util/MultiHashMap.java | MultiHashMap.put | public Object put(Object key,Object subKey,Object value){
HashMap a = (HashMap)super.get(key);
if(a==null){
a = new HashMap();
super.put(key,a);
}
return a.put(subKey,value);
} | java | public Object put(Object key,Object subKey,Object value){
HashMap a = (HashMap)super.get(key);
if(a==null){
a = new HashMap();
super.put(key,a);
}
return a.put(subKey,value);
} | [
"public",
"Object",
"put",
"(",
"Object",
"key",
",",
"Object",
"subKey",
",",
"Object",
"value",
")",
"{",
"HashMap",
"a",
"=",
"(",
"HashMap",
")",
"super",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"a",
"==",
"null",
")",
"{",
"a",
"=",
"... | Associates the specified value with the specified key and subKey in this map.
If the map previously contained a mapping for this key and subKey , the old value is replaced.
@param key Is a Primary key.
@param subKey with which the specified value is to be associated.
@param value to be associated with the specified key and subKey
@return previous value associated with specified key and subKey, or null if there was no mapping for key and subKey.
A null return can also indicate that the HashMap previously associated null with the specified key and subKey. | [
"Associates",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"and",
"subKey",
"in",
"this",
"map",
".",
"If",
"the",
"map",
"previously",
"contained",
"a",
"mapping",
"for",
"this",
"key",
"and",
"subKey",
"the",
"old",
"value",
"is",
"rep... | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/MultiHashMap.java#L33-L40 |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery._whereEndsWith | public void _whereEndsWith(String fieldName, Object value, boolean exact) {
WhereParams whereParams = new WhereParams();
whereParams.setFieldName(fieldName);
whereParams.setValue(value);
whereParams.setAllowWildcards(true);
Object transformToEqualValue = transformValue(whereParams);
List<QueryToken> tokens = getCurrentWhereTokens();
appendOperatorIfNeeded(tokens);
whereParams.setFieldName(ensureValidFieldName(whereParams.getFieldName(), whereParams.isNestedPath()));
negateIfNeeded(tokens, whereParams.getFieldName());
WhereToken whereToken = WhereToken.create(WhereOperator.ENDS_WITH, whereParams.getFieldName(), addQueryParameter(transformToEqualValue), new WhereToken.WhereOptions(exact));
tokens.add(whereToken);
} | java | public void _whereEndsWith(String fieldName, Object value, boolean exact) {
WhereParams whereParams = new WhereParams();
whereParams.setFieldName(fieldName);
whereParams.setValue(value);
whereParams.setAllowWildcards(true);
Object transformToEqualValue = transformValue(whereParams);
List<QueryToken> tokens = getCurrentWhereTokens();
appendOperatorIfNeeded(tokens);
whereParams.setFieldName(ensureValidFieldName(whereParams.getFieldName(), whereParams.isNestedPath()));
negateIfNeeded(tokens, whereParams.getFieldName());
WhereToken whereToken = WhereToken.create(WhereOperator.ENDS_WITH, whereParams.getFieldName(), addQueryParameter(transformToEqualValue), new WhereToken.WhereOptions(exact));
tokens.add(whereToken);
} | [
"public",
"void",
"_whereEndsWith",
"(",
"String",
"fieldName",
",",
"Object",
"value",
",",
"boolean",
"exact",
")",
"{",
"WhereParams",
"whereParams",
"=",
"new",
"WhereParams",
"(",
")",
";",
"whereParams",
".",
"setFieldName",
"(",
"fieldName",
")",
";",
... | Matches fields which ends with the specified value.
@param fieldName Field name to use
@param value Values to find | [
"Matches",
"fields",
"which",
"ends",
"with",
"the",
"specified",
"value",
"."
] | train | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L631-L647 |
landawn/AbacusUtil | src/com/landawn/abacus/util/DoubleList.java | DoubleList.allMatch | public <E extends Exception> boolean allMatch(Try.DoublePredicate<E> filter) throws E {
return allMatch(0, size(), filter);
} | java | public <E extends Exception> boolean allMatch(Try.DoublePredicate<E> filter) throws E {
return allMatch(0, size(), filter);
} | [
"public",
"<",
"E",
"extends",
"Exception",
">",
"boolean",
"allMatch",
"(",
"Try",
".",
"DoublePredicate",
"<",
"E",
">",
"filter",
")",
"throws",
"E",
"{",
"return",
"allMatch",
"(",
"0",
",",
"size",
"(",
")",
",",
"filter",
")",
";",
"}"
] | Returns whether all elements of this List match the provided predicate.
@param filter
@return | [
"Returns",
"whether",
"all",
"elements",
"of",
"this",
"List",
"match",
"the",
"provided",
"predicate",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DoubleList.java#L903-L905 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/Tick.java | Tick.elapsedTime | public boolean elapsedTime(int rate, long milli)
{
if (started && rate > 0)
{
final double frameTime = ONE_SECOND_IN_MILLI / rate;
return Double.compare(milli, StrictMath.floor(currentTicks * frameTime)) <= 0;
}
return false;
} | java | public boolean elapsedTime(int rate, long milli)
{
if (started && rate > 0)
{
final double frameTime = ONE_SECOND_IN_MILLI / rate;
return Double.compare(milli, StrictMath.floor(currentTicks * frameTime)) <= 0;
}
return false;
} | [
"public",
"boolean",
"elapsedTime",
"(",
"int",
"rate",
",",
"long",
"milli",
")",
"{",
"if",
"(",
"started",
"&&",
"rate",
">",
"0",
")",
"{",
"final",
"double",
"frameTime",
"=",
"ONE_SECOND_IN_MILLI",
"/",
"rate",
";",
"return",
"Double",
".",
"compar... | Check if specific time has been elapsed (in tick referential).
@param rate The rate reference.
@param milli The milliseconds to check (based on frame time).
@return <code>true</code> if time elapsed, <code>false</code> else.
@throws LionEngineException If invalid argument. | [
"Check",
"if",
"specific",
"time",
"has",
"been",
"elapsed",
"(",
"in",
"tick",
"referential",
")",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/Tick.java#L140-L148 |
qiujiayu/AutoLoadCache | src/main/java/com/jarvis/cache/script/AbstractScriptParser.java | AbstractScriptParser.isCacheable | public boolean isCacheable(ExCache cache, Object target, Object[] arguments, Object result) throws Exception {
if (null == cache || cache.expire() < 0 || cache.key().length() == 0) {
return false;
}
boolean rv = true;
if (null != cache.condition() && cache.condition().length() > 0) {
rv = this.getElValue(cache.condition(), target, arguments, result, true, Boolean.class);
}
return rv;
} | java | public boolean isCacheable(ExCache cache, Object target, Object[] arguments, Object result) throws Exception {
if (null == cache || cache.expire() < 0 || cache.key().length() == 0) {
return false;
}
boolean rv = true;
if (null != cache.condition() && cache.condition().length() > 0) {
rv = this.getElValue(cache.condition(), target, arguments, result, true, Boolean.class);
}
return rv;
} | [
"public",
"boolean",
"isCacheable",
"(",
"ExCache",
"cache",
",",
"Object",
"target",
",",
"Object",
"[",
"]",
"arguments",
",",
"Object",
"result",
")",
"throws",
"Exception",
"{",
"if",
"(",
"null",
"==",
"cache",
"||",
"cache",
".",
"expire",
"(",
")"... | 是否可以缓存
@param cache ExCache
@param target AOP 拦截到的实例
@param arguments 参数
@param result 执行结果
@return cacheAble 是否可以进行缓存
@throws Exception 异常 | [
"是否可以缓存"
] | train | https://github.com/qiujiayu/AutoLoadCache/blob/8121c146f1a420fa6d6832e849acadb547c13622/src/main/java/com/jarvis/cache/script/AbstractScriptParser.java#L127-L136 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/converter/json/ArrayExtractor.java | ArrayExtractor.extractObject | public Object extractObject(ObjectToJsonConverter pConverter, Object pValue, Stack<String> pPathParts,boolean jsonify) throws AttributeNotFoundException {
int length = pConverter.getCollectionLength(Array.getLength(pValue));
String pathPart = pPathParts.isEmpty() ? null : pPathParts.pop();
if (pathPart != null) {
return extractWithPath(pConverter, pValue, pPathParts, jsonify, pathPart);
} else {
return jsonify ? extractArray(pConverter, pValue, pPathParts, jsonify, length) : pValue;
}
} | java | public Object extractObject(ObjectToJsonConverter pConverter, Object pValue, Stack<String> pPathParts,boolean jsonify) throws AttributeNotFoundException {
int length = pConverter.getCollectionLength(Array.getLength(pValue));
String pathPart = pPathParts.isEmpty() ? null : pPathParts.pop();
if (pathPart != null) {
return extractWithPath(pConverter, pValue, pPathParts, jsonify, pathPart);
} else {
return jsonify ? extractArray(pConverter, pValue, pPathParts, jsonify, length) : pValue;
}
} | [
"public",
"Object",
"extractObject",
"(",
"ObjectToJsonConverter",
"pConverter",
",",
"Object",
"pValue",
",",
"Stack",
"<",
"String",
">",
"pPathParts",
",",
"boolean",
"jsonify",
")",
"throws",
"AttributeNotFoundException",
"{",
"int",
"length",
"=",
"pConverter",... | Extract an array and, if to be jsonified, put it into an {@link JSONArray}. An index can be used (on top of
the extra args stack) in order to specify a single value within the array.
@param pConverter the global converter in order to be able do dispatch for
serializing inner data types
@param pValue the value to convert (must be an aary)
@param pPathParts extra arguments stack, which is popped to get an index for extracting a single element
of the array
@param jsonify whether to convert to a JSON object/list or whether the plain object
should be returned. The later is required for writing an inner value
@return the extracted object
@throws AttributeNotFoundException
@throws IndexOutOfBoundsException if an index is used which points outside the given list | [
"Extract",
"an",
"array",
"and",
"if",
"to",
"be",
"jsonified",
"put",
"it",
"into",
"an",
"{",
"@link",
"JSONArray",
"}",
".",
"An",
"index",
"can",
"be",
"used",
"(",
"on",
"top",
"of",
"the",
"extra",
"args",
"stack",
")",
"in",
"order",
"to",
"... | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/converter/json/ArrayExtractor.java#L59-L67 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java | ControlBar.addControl | public Widget addControl(String name, int resId, Widget.OnTouchListener listener) {
return addControl(name, resId, null, listener, -1);
} | java | public Widget addControl(String name, int resId, Widget.OnTouchListener listener) {
return addControl(name, resId, null, listener, -1);
} | [
"public",
"Widget",
"addControl",
"(",
"String",
"name",
",",
"int",
"resId",
",",
"Widget",
".",
"OnTouchListener",
"listener",
")",
"{",
"return",
"addControl",
"(",
"name",
",",
"resId",
",",
"null",
",",
"listener",
",",
"-",
"1",
")",
";",
"}"
] | Add new control at the end of control bar with specified touch listener and resource.
Size of control bar is updated based on new number of controls.
@param name name of the control to remove
@param resId the control face
@param listener touch listener | [
"Add",
"new",
"control",
"at",
"the",
"end",
"of",
"control",
"bar",
"with",
"specified",
"touch",
"listener",
"and",
"resource",
".",
"Size",
"of",
"control",
"bar",
"is",
"updated",
"based",
"on",
"new",
"number",
"of",
"controls",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L170-L172 |
lucee/Lucee | core/src/main/java/lucee/runtime/net/rpc/ref/WSClientReflector.java | WSClientReflector.callWithNamedValues | @Override
public Object callWithNamedValues(Config config, Key methodName, Struct arguments) throws PageException {
try {
if (callWithNamedValues == null) callWithNamedValues = clazz.getMethod("callWithNamedValues", new Class[] { Config.class, Key.class, Struct.class });
return callWithNamedValues.invoke(obj, new Object[] { config, methodName, arguments });
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} | java | @Override
public Object callWithNamedValues(Config config, Key methodName, Struct arguments) throws PageException {
try {
if (callWithNamedValues == null) callWithNamedValues = clazz.getMethod("callWithNamedValues", new Class[] { Config.class, Key.class, Struct.class });
return callWithNamedValues.invoke(obj, new Object[] { config, methodName, arguments });
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} | [
"@",
"Override",
"public",
"Object",
"callWithNamedValues",
"(",
"Config",
"config",
",",
"Key",
"methodName",
",",
"Struct",
"arguments",
")",
"throws",
"PageException",
"{",
"try",
"{",
"if",
"(",
"callWithNamedValues",
"==",
"null",
")",
"callWithNamedValues",
... | /*
@Override public Call getLastCall() throws PageException { try { if(getLastCall==null)
getLastCall=clazz.getMethod("getLastCall", WSHandlerReflector.EMPTY_CLASS); return (Call)
getLastCall.invoke(obj,WSHandlerReflector.EMPTY_OBJECT); } catch(Exception e) { throw
Caster.toPageException(e); } } | [
"/",
"*"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/rpc/ref/WSClientReflector.java#L179-L188 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/Popups.java | Popups.makeDraggable | public static void makeDraggable (HasAllMouseHandlers dragHandle, PopupPanel target)
{
DragHandler dragger = new DragHandler(target);
dragHandle.addMouseDownHandler(dragger);
dragHandle.addMouseUpHandler(dragger);
dragHandle.addMouseMoveHandler(dragger);
} | java | public static void makeDraggable (HasAllMouseHandlers dragHandle, PopupPanel target)
{
DragHandler dragger = new DragHandler(target);
dragHandle.addMouseDownHandler(dragger);
dragHandle.addMouseUpHandler(dragger);
dragHandle.addMouseMoveHandler(dragger);
} | [
"public",
"static",
"void",
"makeDraggable",
"(",
"HasAllMouseHandlers",
"dragHandle",
",",
"PopupPanel",
"target",
")",
"{",
"DragHandler",
"dragger",
"=",
"new",
"DragHandler",
"(",
"target",
")",
";",
"dragHandle",
".",
"addMouseDownHandler",
"(",
"dragger",
")... | Adds mouse handlers to the specified drag handle that cause the supplied target popup to be
dragged around the display. The drag handle is assumed to be a child of the popup. | [
"Adds",
"mouse",
"handlers",
"to",
"the",
"specified",
"drag",
"handle",
"that",
"cause",
"the",
"supplied",
"target",
"popup",
"to",
"be",
"dragged",
"around",
"the",
"display",
".",
"The",
"drag",
"handle",
"is",
"assumed",
"to",
"be",
"a",
"child",
"of"... | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Popups.java#L392-L398 |
zxing/zxing | android/src/com/google/zxing/client/android/camera/CameraManager.java | CameraManager.startPreview | public synchronized void startPreview() {
OpenCamera theCamera = camera;
if (theCamera != null && !previewing) {
theCamera.getCamera().startPreview();
previewing = true;
autoFocusManager = new AutoFocusManager(context, theCamera.getCamera());
}
} | java | public synchronized void startPreview() {
OpenCamera theCamera = camera;
if (theCamera != null && !previewing) {
theCamera.getCamera().startPreview();
previewing = true;
autoFocusManager = new AutoFocusManager(context, theCamera.getCamera());
}
} | [
"public",
"synchronized",
"void",
"startPreview",
"(",
")",
"{",
"OpenCamera",
"theCamera",
"=",
"camera",
";",
"if",
"(",
"theCamera",
"!=",
"null",
"&&",
"!",
"previewing",
")",
"{",
"theCamera",
".",
"getCamera",
"(",
")",
".",
"startPreview",
"(",
")",... | Asks the camera hardware to begin drawing preview frames to the screen. | [
"Asks",
"the",
"camera",
"hardware",
"to",
"begin",
"drawing",
"preview",
"frames",
"to",
"the",
"screen",
"."
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/camera/CameraManager.java#L145-L152 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermListsImpl.java | ListManagementTermListsImpl.updateAsync | public Observable<TermList> updateAsync(String listId, String contentType, BodyModel bodyParameter) {
return updateWithServiceResponseAsync(listId, contentType, bodyParameter).map(new Func1<ServiceResponse<TermList>, TermList>() {
@Override
public TermList call(ServiceResponse<TermList> response) {
return response.body();
}
});
} | java | public Observable<TermList> updateAsync(String listId, String contentType, BodyModel bodyParameter) {
return updateWithServiceResponseAsync(listId, contentType, bodyParameter).map(new Func1<ServiceResponse<TermList>, TermList>() {
@Override
public TermList call(ServiceResponse<TermList> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"TermList",
">",
"updateAsync",
"(",
"String",
"listId",
",",
"String",
"contentType",
",",
"BodyModel",
"bodyParameter",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"listId",
",",
"contentType",
",",
"bodyParameter",
")",... | Updates an Term List.
@param listId List Id of the image list.
@param contentType The content type.
@param bodyParameter Schema of the body.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the TermList object | [
"Updates",
"an",
"Term",
"List",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermListsImpl.java#L283-L290 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/vod/VodClient.java | VodClient.generateMediaDeliveryInfo | public GenerateMediaDeliveryInfoResponse generateMediaDeliveryInfo(String mediaId, String transcodingPresetName) {
GenerateMediaDeliveryInfoRequest request = new GenerateMediaDeliveryInfoRequest()
.withMediaId(mediaId)
.withTranscodingPresetName(transcodingPresetName);
return generateMediaDeliveryInfo(request);
} | java | public GenerateMediaDeliveryInfoResponse generateMediaDeliveryInfo(String mediaId, String transcodingPresetName) {
GenerateMediaDeliveryInfoRequest request = new GenerateMediaDeliveryInfoRequest()
.withMediaId(mediaId)
.withTranscodingPresetName(transcodingPresetName);
return generateMediaDeliveryInfo(request);
} | [
"public",
"GenerateMediaDeliveryInfoResponse",
"generateMediaDeliveryInfo",
"(",
"String",
"mediaId",
",",
"String",
"transcodingPresetName",
")",
"{",
"GenerateMediaDeliveryInfoRequest",
"request",
"=",
"new",
"GenerateMediaDeliveryInfoRequest",
"(",
")",
".",
"withMediaId",
... | Generate media delivery info by media ID.
<p>
The caller <i>must</i> authenticate with a valid BCE Access Key / Private Key pair.
@param mediaId The unique ID for each media resource
@return media delivery info | [
"Generate",
"media",
"delivery",
"info",
"by",
"media",
"ID",
".",
"<p",
">",
"The",
"caller",
"<i",
">",
"must<",
"/",
"i",
">",
"authenticate",
"with",
"a",
"valid",
"BCE",
"Access",
"Key",
"/",
"Private",
"Key",
"pair",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L755-L760 |
samskivert/pythagoras | src/main/java/pythagoras/f/Quaternion.java | Quaternion.fromAnglesXY | public Quaternion fromAnglesXY (float x, float y) {
float hx = x * 0.5f, hy = y * 0.5f;
float sx = FloatMath.sin(hx), cx = FloatMath.cos(hx);
float sy = FloatMath.sin(hy), cy = FloatMath.cos(hy);
return set(cy*sx, sy*cx, -sy*sx, cy*cx);
} | java | public Quaternion fromAnglesXY (float x, float y) {
float hx = x * 0.5f, hy = y * 0.5f;
float sx = FloatMath.sin(hx), cx = FloatMath.cos(hx);
float sy = FloatMath.sin(hy), cy = FloatMath.cos(hy);
return set(cy*sx, sy*cx, -sy*sx, cy*cx);
} | [
"public",
"Quaternion",
"fromAnglesXY",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"float",
"hx",
"=",
"x",
"*",
"0.5f",
",",
"hy",
"=",
"y",
"*",
"0.5f",
";",
"float",
"sx",
"=",
"FloatMath",
".",
"sin",
"(",
"hx",
")",
",",
"cx",
"=",
"F... | Sets this quaternion to one that first rotates about x by the specified number of radians,
then rotates about y by the specified number of radians. | [
"Sets",
"this",
"quaternion",
"to",
"one",
"that",
"first",
"rotates",
"about",
"x",
"by",
"the",
"specified",
"number",
"of",
"radians",
"then",
"rotates",
"about",
"y",
"by",
"the",
"specified",
"number",
"of",
"radians",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Quaternion.java#L195-L200 |
gosu-lang/gosu-lang | gosu-ant-tools/src/main/java/gosu/tools/ant/Gosuc.java | Gosuc.scanDir | protected void scanDir(File srcDir, File destDir, String[] files) {
GlobPatternMapper m = new GlobPatternMapper();
SourceFileScanner sfs = new SourceFileScanner(this);
List<File> newFiles;
if(!isForce()) {
log.warn("Relying on ant's SourceFileScanner, which only looks at timestamps. If broken references result, try setting option 'force' to true.");
}
for (String extension : getScriptExtensions()) {
m.setFrom("*." + extension);
m.setTo("*.class");
log.debug("Scanning for *." + extension + " files...");
if(isForce()) {
newFiles = asFiles(srcDir, files, m);
} else {
newFiles = Arrays.asList(sfs.restrictAsFiles(files, srcDir, destDir, m));
}
log.debug("Found these files:");
for(File newFile : newFiles) {
log.debug('\t' + newFile.getAbsolutePath());
}
compileList.addAll(newFiles);
}
} | java | protected void scanDir(File srcDir, File destDir, String[] files) {
GlobPatternMapper m = new GlobPatternMapper();
SourceFileScanner sfs = new SourceFileScanner(this);
List<File> newFiles;
if(!isForce()) {
log.warn("Relying on ant's SourceFileScanner, which only looks at timestamps. If broken references result, try setting option 'force' to true.");
}
for (String extension : getScriptExtensions()) {
m.setFrom("*." + extension);
m.setTo("*.class");
log.debug("Scanning for *." + extension + " files...");
if(isForce()) {
newFiles = asFiles(srcDir, files, m);
} else {
newFiles = Arrays.asList(sfs.restrictAsFiles(files, srcDir, destDir, m));
}
log.debug("Found these files:");
for(File newFile : newFiles) {
log.debug('\t' + newFile.getAbsolutePath());
}
compileList.addAll(newFiles);
}
} | [
"protected",
"void",
"scanDir",
"(",
"File",
"srcDir",
",",
"File",
"destDir",
",",
"String",
"[",
"]",
"files",
")",
"{",
"GlobPatternMapper",
"m",
"=",
"new",
"GlobPatternMapper",
"(",
")",
";",
"SourceFileScanner",
"sfs",
"=",
"new",
"SourceFileScanner",
... | Scans the directory looking for source files to be compiled.
The results are returned in the class variable compileList
@param srcDir The source directory
@param destDir The destination directory
@param files An array of filenames | [
"Scans",
"the",
"directory",
"looking",
"for",
"source",
"files",
"to",
"be",
"compiled",
".",
"The",
"results",
"are",
"returned",
"in",
"the",
"class",
"variable",
"compileList"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-ant-tools/src/main/java/gosu/tools/ant/Gosuc.java#L211-L234 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java | MariaDbDatabaseMetaData.getImportedKeysUsingInformationSchema | public ResultSet getImportedKeysUsingInformationSchema(String catalog, String table)
throws SQLException {
if (table == null) {
throw new SQLException("'table' parameter in getImportedKeys cannot be null");
}
String sql =
"SELECT KCU.REFERENCED_TABLE_SCHEMA PKTABLE_CAT, NULL PKTABLE_SCHEM, KCU.REFERENCED_TABLE_NAME PKTABLE_NAME,"
+ " KCU.REFERENCED_COLUMN_NAME PKCOLUMN_NAME, KCU.TABLE_SCHEMA FKTABLE_CAT, NULL FKTABLE_SCHEM, "
+ " KCU.TABLE_NAME FKTABLE_NAME, KCU.COLUMN_NAME FKCOLUMN_NAME, KCU.POSITION_IN_UNIQUE_CONSTRAINT KEY_SEQ,"
+ " CASE update_rule "
+ " WHEN 'RESTRICT' THEN 1"
+ " WHEN 'NO ACTION' THEN 3"
+ " WHEN 'CASCADE' THEN 0"
+ " WHEN 'SET NULL' THEN 2"
+ " WHEN 'SET DEFAULT' THEN 4"
+ " END UPDATE_RULE,"
+ " CASE DELETE_RULE"
+ " WHEN 'RESTRICT' THEN 1"
+ " WHEN 'NO ACTION' THEN 3"
+ " WHEN 'CASCADE' THEN 0"
+ " WHEN 'SET NULL' THEN 2"
+ " WHEN 'SET DEFAULT' THEN 4"
+ " END DELETE_RULE,"
+ " RC.CONSTRAINT_NAME FK_NAME,"
+ " NULL PK_NAME,"
+ importedKeyNotDeferrable + " DEFERRABILITY"
+ " FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU"
+ " INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC"
+ " ON KCU.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA"
+ " AND KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME"
+ " WHERE "
+ catalogCond("KCU.TABLE_SCHEMA", catalog)
+ " AND "
+ " KCU.TABLE_NAME = " + escapeQuote(table)
+ " ORDER BY PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, KEY_SEQ";
return executeQuery(sql);
} | java | public ResultSet getImportedKeysUsingInformationSchema(String catalog, String table)
throws SQLException {
if (table == null) {
throw new SQLException("'table' parameter in getImportedKeys cannot be null");
}
String sql =
"SELECT KCU.REFERENCED_TABLE_SCHEMA PKTABLE_CAT, NULL PKTABLE_SCHEM, KCU.REFERENCED_TABLE_NAME PKTABLE_NAME,"
+ " KCU.REFERENCED_COLUMN_NAME PKCOLUMN_NAME, KCU.TABLE_SCHEMA FKTABLE_CAT, NULL FKTABLE_SCHEM, "
+ " KCU.TABLE_NAME FKTABLE_NAME, KCU.COLUMN_NAME FKCOLUMN_NAME, KCU.POSITION_IN_UNIQUE_CONSTRAINT KEY_SEQ,"
+ " CASE update_rule "
+ " WHEN 'RESTRICT' THEN 1"
+ " WHEN 'NO ACTION' THEN 3"
+ " WHEN 'CASCADE' THEN 0"
+ " WHEN 'SET NULL' THEN 2"
+ " WHEN 'SET DEFAULT' THEN 4"
+ " END UPDATE_RULE,"
+ " CASE DELETE_RULE"
+ " WHEN 'RESTRICT' THEN 1"
+ " WHEN 'NO ACTION' THEN 3"
+ " WHEN 'CASCADE' THEN 0"
+ " WHEN 'SET NULL' THEN 2"
+ " WHEN 'SET DEFAULT' THEN 4"
+ " END DELETE_RULE,"
+ " RC.CONSTRAINT_NAME FK_NAME,"
+ " NULL PK_NAME,"
+ importedKeyNotDeferrable + " DEFERRABILITY"
+ " FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU"
+ " INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC"
+ " ON KCU.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA"
+ " AND KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME"
+ " WHERE "
+ catalogCond("KCU.TABLE_SCHEMA", catalog)
+ " AND "
+ " KCU.TABLE_NAME = " + escapeQuote(table)
+ " ORDER BY PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, KEY_SEQ";
return executeQuery(sql);
} | [
"public",
"ResultSet",
"getImportedKeysUsingInformationSchema",
"(",
"String",
"catalog",
",",
"String",
"table",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"table",
"==",
"null",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"\"'table' parameter in getImportedKe... | GetImportedKeysUsingInformationSchema.
@param catalog catalog
@param table table
@return resultset
@throws SQLException exception | [
"GetImportedKeysUsingInformationSchema",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java#L893-L930 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.getTopologyAsync | public Observable<TopologyInner> getTopologyAsync(String resourceGroupName, String networkWatcherName, TopologyParameters parameters) {
return getTopologyWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<TopologyInner>, TopologyInner>() {
@Override
public TopologyInner call(ServiceResponse<TopologyInner> response) {
return response.body();
}
});
} | java | public Observable<TopologyInner> getTopologyAsync(String resourceGroupName, String networkWatcherName, TopologyParameters parameters) {
return getTopologyWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<TopologyInner>, TopologyInner>() {
@Override
public TopologyInner call(ServiceResponse<TopologyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"TopologyInner",
">",
"getTopologyAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"TopologyParameters",
"parameters",
")",
"{",
"return",
"getTopologyWithServiceResponseAsync",
"(",
"resourceGroupName",
",",... | Gets the current network topology by resource group.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the network watcher.
@param parameters Parameters that define the representation of topology.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the TopologyInner object | [
"Gets",
"the",
"current",
"network",
"topology",
"by",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L893-L900 |
Appendium/objectlabkit | fxcalc/src/main/java/net/objectlab/kit/fxcalc/CrossRateCalculator.java | CrossRateCalculator.calculateCross | public static FxRate calculateCross(final CurrencyPair targetPair, final FxRate fx1, final FxRate fx2, final int precision,
final int precisionForInverseFxRate, final MajorCurrencyRanking ranking, final int bidRounding, final int askRounding,
CurrencyProvider currencyProvider) {
final Optional<String> crossCcy = fx1.getCurrencyPair().findCommonCcy(fx2.getCurrencyPair());
final String xCcy = crossCcy.orElseThrow(
() -> new IllegalArgumentException("The 2 FXRates do not share a ccy " + fx1.getCurrencyPair() + " " + fx2.getCurrencyPair()));
if (crossCcy.isPresent() && targetPair.containsCcy(crossCcy.get())) {
throw new IllegalArgumentException("The target currency pair " + targetPair + " contains the common ccy " + crossCcy.get());
}
final String fx1Ccy1 = fx1.getCurrencyPair().getCcy1();
final String fx2Ccy1 = fx2.getCurrencyPair().getCcy1();
final String fx1Ccy2 = fx1.getCurrencyPair().getCcy2();
final String fx2Ccy2 = fx2.getCurrencyPair().getCcy2();
// what if it is both ccy2?
final boolean shouldDivide = fx1Ccy1.equals(xCcy) && fx2Ccy1.equals(xCcy) || fx1Ccy2.equals(xCcy) && fx2Ccy2.equals(xCcy);
FxRateImpl crossRate = null;
if (shouldDivide) {
final FxRate numeratorFx = targetPair.getCcy1().equals(fx2Ccy2) || targetPair.getCcy1().equals(fx1Ccy1) ? fx1 : fx2;
final FxRate denominatorFx = numeratorFx == fx1 ? fx2 : fx1;
LOG.debug("CALC {} / {}", numeratorFx, denominatorFx);
BigDecimal bid = BigDecimalUtil.divide(precision, numeratorFx.getBid(), denominatorFx.getAsk(), bidRounding);
BigDecimal ask = BigDecimalUtil.divide(precision, numeratorFx.getAsk(), denominatorFx.getBid(), askRounding);
crossRate = new FxRateImpl(targetPair, xCcy, ranking.isMarketConvention(targetPair), bid, ask, currencyProvider);
} else {
crossRate = calculateWithDivide(targetPair, fx1, fx2, precision, precisionForInverseFxRate, ranking, bidRounding, askRounding,
currencyProvider, xCcy, fx1Ccy2, fx2Ccy2);
}
LOG.debug("X RATE {}", crossRate);
LOG.debug(crossRate.getDescription());
return crossRate;
} | java | public static FxRate calculateCross(final CurrencyPair targetPair, final FxRate fx1, final FxRate fx2, final int precision,
final int precisionForInverseFxRate, final MajorCurrencyRanking ranking, final int bidRounding, final int askRounding,
CurrencyProvider currencyProvider) {
final Optional<String> crossCcy = fx1.getCurrencyPair().findCommonCcy(fx2.getCurrencyPair());
final String xCcy = crossCcy.orElseThrow(
() -> new IllegalArgumentException("The 2 FXRates do not share a ccy " + fx1.getCurrencyPair() + " " + fx2.getCurrencyPair()));
if (crossCcy.isPresent() && targetPair.containsCcy(crossCcy.get())) {
throw new IllegalArgumentException("The target currency pair " + targetPair + " contains the common ccy " + crossCcy.get());
}
final String fx1Ccy1 = fx1.getCurrencyPair().getCcy1();
final String fx2Ccy1 = fx2.getCurrencyPair().getCcy1();
final String fx1Ccy2 = fx1.getCurrencyPair().getCcy2();
final String fx2Ccy2 = fx2.getCurrencyPair().getCcy2();
// what if it is both ccy2?
final boolean shouldDivide = fx1Ccy1.equals(xCcy) && fx2Ccy1.equals(xCcy) || fx1Ccy2.equals(xCcy) && fx2Ccy2.equals(xCcy);
FxRateImpl crossRate = null;
if (shouldDivide) {
final FxRate numeratorFx = targetPair.getCcy1().equals(fx2Ccy2) || targetPair.getCcy1().equals(fx1Ccy1) ? fx1 : fx2;
final FxRate denominatorFx = numeratorFx == fx1 ? fx2 : fx1;
LOG.debug("CALC {} / {}", numeratorFx, denominatorFx);
BigDecimal bid = BigDecimalUtil.divide(precision, numeratorFx.getBid(), denominatorFx.getAsk(), bidRounding);
BigDecimal ask = BigDecimalUtil.divide(precision, numeratorFx.getAsk(), denominatorFx.getBid(), askRounding);
crossRate = new FxRateImpl(targetPair, xCcy, ranking.isMarketConvention(targetPair), bid, ask, currencyProvider);
} else {
crossRate = calculateWithDivide(targetPair, fx1, fx2, precision, precisionForInverseFxRate, ranking, bidRounding, askRounding,
currencyProvider, xCcy, fx1Ccy2, fx2Ccy2);
}
LOG.debug("X RATE {}", crossRate);
LOG.debug(crossRate.getDescription());
return crossRate;
} | [
"public",
"static",
"FxRate",
"calculateCross",
"(",
"final",
"CurrencyPair",
"targetPair",
",",
"final",
"FxRate",
"fx1",
",",
"final",
"FxRate",
"fx2",
",",
"final",
"int",
"precision",
",",
"final",
"int",
"precisionForInverseFxRate",
",",
"final",
"MajorCurren... | Calculate the cross rate, use this only if required.
@param targetPair the currency pair we want Bid/Ask for
@param fx1 one rate involving either targetPair.ccy1 or targetPair.ccy2
@param fx2 one rate involving either targetPair.ccy1 or targetPair.ccy2
@param precision required in case we need to divide rates
@param ranking link to algorithm to determine if the targetPair will be market convention or not
@return a new instance of FxRate
@throws IllegalArgumentException if the 2 fx1 and fx2 do not share a common cross currency or either currencies in the targetPair | [
"Calculate",
"the",
"cross",
"rate",
"use",
"this",
"only",
"if",
"required",
"."
] | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/fxcalc/src/main/java/net/objectlab/kit/fxcalc/CrossRateCalculator.java#L33-L68 |
redbox-mint/redbox | plugins/transformer/vital-fedora2/src/main/java/com/googlecode/fascinator/redbox/VitalTransformer.java | VitalTransformer.getTempFile | private File getTempFile(DigitalObject object, String pid)
throws Exception {
// Create file in temp space, use OID in path for uniqueness
File directory = new File(tmpDir, object.getId());
File target = new File(directory, pid);
if (!target.exists()) {
target.getParentFile().mkdirs();
target.createNewFile();
}
// These can happily throw exceptions higher
Payload payload = object.getPayload(pid);
InputStream in = payload.open();
FileOutputStream out = null;
// But here, the payload must receive
// a close before throwing the error
try {
out = new FileOutputStream(target);
IOUtils.copyLarge(in, out);
} catch (Exception ex) {
close(out);
target.delete();
payload.close();
throw ex;
}
// We close out here, because the catch statement needed to close
// before it could delete... so it can't be in 'finally'
close(out);
payload.close();
return target;
} | java | private File getTempFile(DigitalObject object, String pid)
throws Exception {
// Create file in temp space, use OID in path for uniqueness
File directory = new File(tmpDir, object.getId());
File target = new File(directory, pid);
if (!target.exists()) {
target.getParentFile().mkdirs();
target.createNewFile();
}
// These can happily throw exceptions higher
Payload payload = object.getPayload(pid);
InputStream in = payload.open();
FileOutputStream out = null;
// But here, the payload must receive
// a close before throwing the error
try {
out = new FileOutputStream(target);
IOUtils.copyLarge(in, out);
} catch (Exception ex) {
close(out);
target.delete();
payload.close();
throw ex;
}
// We close out here, because the catch statement needed to close
// before it could delete... so it can't be in 'finally'
close(out);
payload.close();
return target;
} | [
"private",
"File",
"getTempFile",
"(",
"DigitalObject",
"object",
",",
"String",
"pid",
")",
"throws",
"Exception",
"{",
"// Create file in temp space, use OID in path for uniqueness",
"File",
"directory",
"=",
"new",
"File",
"(",
"tmpDir",
",",
"object",
".",
"getId"... | Stream the data out of storage to our temp directory.
@param object Our digital object.
@param pid The payload ID to retrieve.
@return File The file creating in the temp directory
@throws Exception on any errors | [
"Stream",
"the",
"data",
"out",
"of",
"storage",
"to",
"our",
"temp",
"directory",
"."
] | train | https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transformer/vital-fedora2/src/main/java/com/googlecode/fascinator/redbox/VitalTransformer.java#L1291-L1325 |
Stratio/stratio-cassandra | src/java/com/stratio/cassandra/index/service/RowComparatorSorting.java | RowComparatorSorting.compare | @Override
public int compare(Row row1, Row row2) {
Columns columns1 = rowMapper.columns(row1);
Columns columns2 = rowMapper.columns(row2);
return comparatorChain.compare(columns1, columns2);
} | java | @Override
public int compare(Row row1, Row row2) {
Columns columns1 = rowMapper.columns(row1);
Columns columns2 = rowMapper.columns(row2);
return comparatorChain.compare(columns1, columns2);
} | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"Row",
"row1",
",",
"Row",
"row2",
")",
"{",
"Columns",
"columns1",
"=",
"rowMapper",
".",
"columns",
"(",
"row1",
")",
";",
"Columns",
"columns2",
"=",
"rowMapper",
".",
"columns",
"(",
"row2",
")",
";... | {@inheritDoc}
@param row1 A {@link Row}.
@param row2 A {@link Row}.
@return A negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater
than the second according to a Lucene {@link Sort}. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/service/RowComparatorSorting.java#L58-L63 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SliceOps.java | SliceOps.calcSize | private static long calcSize(long size, long skip, long limit) {
return size >= 0 ? Math.max(-1, Math.min(size - skip, limit)) : -1;
} | java | private static long calcSize(long size, long skip, long limit) {
return size >= 0 ? Math.max(-1, Math.min(size - skip, limit)) : -1;
} | [
"private",
"static",
"long",
"calcSize",
"(",
"long",
"size",
",",
"long",
"skip",
",",
"long",
"limit",
")",
"{",
"return",
"size",
">=",
"0",
"?",
"Math",
".",
"max",
"(",
"-",
"1",
",",
"Math",
".",
"min",
"(",
"size",
"-",
"skip",
",",
"limit... | Calculates the sliced size given the current size, number of elements
skip, and the number of elements to limit.
@param size the current size
@param skip the number of elements to skip, assumed to be >= 0
@param limit the number of elements to limit, assumed to be >= 0, with
a value of {@code Long.MAX_VALUE} if there is no limit
@return the sliced size | [
"Calculates",
"the",
"sliced",
"size",
"given",
"the",
"current",
"size",
"number",
"of",
"elements",
"skip",
"and",
"the",
"number",
"of",
"elements",
"to",
"limit",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SliceOps.java#L52-L54 |
JodaOrg/joda-time | src/main/java/org/joda/time/MutableDateTime.java | MutableDateTime.setRounding | public void setRounding(DateTimeField field, int mode) {
if (field != null && (mode < ROUND_NONE || mode > ROUND_HALF_EVEN)) {
throw new IllegalArgumentException("Illegal rounding mode: " + mode);
}
iRoundingField = (mode == ROUND_NONE ? null : field);
iRoundingMode = (field == null ? ROUND_NONE : mode);
setMillis(getMillis());
} | java | public void setRounding(DateTimeField field, int mode) {
if (field != null && (mode < ROUND_NONE || mode > ROUND_HALF_EVEN)) {
throw new IllegalArgumentException("Illegal rounding mode: " + mode);
}
iRoundingField = (mode == ROUND_NONE ? null : field);
iRoundingMode = (field == null ? ROUND_NONE : mode);
setMillis(getMillis());
} | [
"public",
"void",
"setRounding",
"(",
"DateTimeField",
"field",
",",
"int",
"mode",
")",
"{",
"if",
"(",
"field",
"!=",
"null",
"&&",
"(",
"mode",
"<",
"ROUND_NONE",
"||",
"mode",
">",
"ROUND_HALF_EVEN",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentExcep... | Sets the status of rounding to use the specified field and mode.
A null field or mode of ROUND_NONE will disable rounding.
Once set, the instant is then rounded using the new field and mode.
<p>
Enabling rounding will cause all subsequent calls to {@link #setMillis(long)}
to be rounded. This can be used to control the precision of the instant,
for example by setting a rounding field of minuteOfDay, the seconds and
milliseconds will always be zero.
@param field rounding field or null to disable
@param mode rounding mode or ROUND_NONE to disable
@throws IllegalArgumentException if mode is unknown, no exception if field is null | [
"Sets",
"the",
"status",
"of",
"rounding",
"to",
"use",
"the",
"specified",
"field",
"and",
"mode",
".",
"A",
"null",
"field",
"or",
"mode",
"of",
"ROUND_NONE",
"will",
"disable",
"rounding",
".",
"Once",
"set",
"the",
"instant",
"is",
"then",
"rounded",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/MutableDateTime.java#L434-L441 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.isArrayBind | public static boolean isArrayBind(Map<String, ParameterBindingDTO> bindValues)
{
if (bindValues == null || bindValues.size() == 0)
{
return false;
}
ParameterBindingDTO bindSample = bindValues.values().iterator().next();
return bindSample.getValue() instanceof List;
} | java | public static boolean isArrayBind(Map<String, ParameterBindingDTO> bindValues)
{
if (bindValues == null || bindValues.size() == 0)
{
return false;
}
ParameterBindingDTO bindSample = bindValues.values().iterator().next();
return bindSample.getValue() instanceof List;
} | [
"public",
"static",
"boolean",
"isArrayBind",
"(",
"Map",
"<",
"String",
",",
"ParameterBindingDTO",
">",
"bindValues",
")",
"{",
"if",
"(",
"bindValues",
"==",
"null",
"||",
"bindValues",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"false",
";... | Return whether the bind map uses array binds
@param bindValues the bind map
@return whether the bind map uses array binds | [
"Return",
"whether",
"the",
"bind",
"map",
"uses",
"array",
"binds"
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L588-L596 |
gwtplus/google-gin | src/main/java/com/google/gwt/inject/rebind/resolution/UnresolvedBindingValidator.java | UnresolvedBindingValidator.pruneInvalidOptional | public void pruneInvalidOptional(DependencyExplorerOutput output, InvalidKeys invalidKeys) {
DependencyGraph.GraphPruner prunedGraph = new DependencyGraph.GraphPruner(output.getGraph());
for (Key<?> key : invalidKeys.getInvalidOptionalKeys()) {
prunedGraph.remove(key);
output.removeBinding(key);
}
output.setGraph(prunedGraph.update());
} | java | public void pruneInvalidOptional(DependencyExplorerOutput output, InvalidKeys invalidKeys) {
DependencyGraph.GraphPruner prunedGraph = new DependencyGraph.GraphPruner(output.getGraph());
for (Key<?> key : invalidKeys.getInvalidOptionalKeys()) {
prunedGraph.remove(key);
output.removeBinding(key);
}
output.setGraph(prunedGraph.update());
} | [
"public",
"void",
"pruneInvalidOptional",
"(",
"DependencyExplorerOutput",
"output",
",",
"InvalidKeys",
"invalidKeys",
")",
"{",
"DependencyGraph",
".",
"GraphPruner",
"prunedGraph",
"=",
"new",
"DependencyGraph",
".",
"GraphPruner",
"(",
"output",
".",
"getGraph",
"... | Prune all of the invalid optional keys from the graph. After this method, all of the keys
remaining in the graph are resolvable. | [
"Prune",
"all",
"of",
"the",
"invalid",
"optional",
"keys",
"from",
"the",
"graph",
".",
"After",
"this",
"method",
"all",
"of",
"the",
"keys",
"remaining",
"in",
"the",
"graph",
"are",
"resolvable",
"."
] | train | https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/resolution/UnresolvedBindingValidator.java#L110-L117 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/configuration/OcelotRequestConfigurator.java | OcelotRequestConfigurator.modifyHandshake | @Override
public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
sec.getUserProperties().put(Constants.HANDSHAKEREQUEST, request);
super.modifyHandshake(sec, request, response);
} | java | @Override
public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
sec.getUserProperties().put(Constants.HANDSHAKEREQUEST, request);
super.modifyHandshake(sec, request, response);
} | [
"@",
"Override",
"public",
"void",
"modifyHandshake",
"(",
"ServerEndpointConfig",
"sec",
",",
"HandshakeRequest",
"request",
",",
"HandshakeResponse",
"response",
")",
"{",
"sec",
".",
"getUserProperties",
"(",
")",
".",
"put",
"(",
"Constants",
".",
"HANDSHAKERE... | Set user information from open websocket
@param sec
@param request
@param response | [
"Set",
"user",
"information",
"from",
"open",
"websocket"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/configuration/OcelotRequestConfigurator.java#L29-L33 |
ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/ProcessingContext.java | ProcessingContext.gatherProperties | private void gatherProperties(List<VariableElement> fields, Element element) {
TypeElement typeElement = (TypeElement) element;
TypeMirror superclass = typeElement.getSuperclass();
Element mappedSuper = typeUtils.asElement(superclass);
if (isMappedSuperOrInheritance(mappedSuper)) {
gatherProperties(fields, mappedSuper);
}
List<VariableElement> allFields = ElementFilter.fieldsIn(element.getEnclosedElements());
for (VariableElement field : allFields) {
if (!ignoreField(field)) {
fields.add(field);
}
}
} | java | private void gatherProperties(List<VariableElement> fields, Element element) {
TypeElement typeElement = (TypeElement) element;
TypeMirror superclass = typeElement.getSuperclass();
Element mappedSuper = typeUtils.asElement(superclass);
if (isMappedSuperOrInheritance(mappedSuper)) {
gatherProperties(fields, mappedSuper);
}
List<VariableElement> allFields = ElementFilter.fieldsIn(element.getEnclosedElements());
for (VariableElement field : allFields) {
if (!ignoreField(field)) {
fields.add(field);
}
}
} | [
"private",
"void",
"gatherProperties",
"(",
"List",
"<",
"VariableElement",
">",
"fields",
",",
"Element",
"element",
")",
"{",
"TypeElement",
"typeElement",
"=",
"(",
"TypeElement",
")",
"element",
";",
"TypeMirror",
"superclass",
"=",
"typeElement",
".",
"getS... | Recursively gather all the fields (properties) for the given bean element. | [
"Recursively",
"gather",
"all",
"the",
"fields",
"(",
"properties",
")",
"for",
"the",
"given",
"bean",
"element",
"."
] | train | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/ProcessingContext.java#L77-L92 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.el.3.0/src/javax/el/ELProcessor.java | ELProcessor.defineFunction | public void defineFunction(String prefix, String function, Method method)
throws java.lang.NoSuchMethodException {
if (prefix == null || function == null || method == null) {
throw new NullPointerException(Util.message(
context, "elProcessor.defineFunctionNullParams"));
}
int modifiers = method.getModifiers();
// Check for public method as well as being static
if (!Modifier.isStatic(modifiers) || !Modifier.isPublic(modifiers)) {
throw new NoSuchMethodException(Util.message(context,
"elProcessor.defineFunctionInvalidMethod", method.getName(),
method.getDeclaringClass().getName()));
}
manager.mapFunction(prefix, function, method);
} | java | public void defineFunction(String prefix, String function, Method method)
throws java.lang.NoSuchMethodException {
if (prefix == null || function == null || method == null) {
throw new NullPointerException(Util.message(
context, "elProcessor.defineFunctionNullParams"));
}
int modifiers = method.getModifiers();
// Check for public method as well as being static
if (!Modifier.isStatic(modifiers) || !Modifier.isPublic(modifiers)) {
throw new NoSuchMethodException(Util.message(context,
"elProcessor.defineFunctionInvalidMethod", method.getName(),
method.getDeclaringClass().getName()));
}
manager.mapFunction(prefix, function, method);
} | [
"public",
"void",
"defineFunction",
"(",
"String",
"prefix",
",",
"String",
"function",
",",
"Method",
"method",
")",
"throws",
"java",
".",
"lang",
".",
"NoSuchMethodException",
"{",
"if",
"(",
"prefix",
"==",
"null",
"||",
"function",
"==",
"null",
"||",
... | Map a method to a function name.
@param prefix Function prefix
@param function Function name
@param method Method
@throws NullPointerException
If any of the arguments are null
@throws NoSuchMethodException
If the method is not static | [
"Map",
"a",
"method",
"to",
"a",
"function",
"name",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.el.3.0/src/javax/el/ELProcessor.java#L178-L196 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java | LambdaToMethod.makeNewClass | JCNewClass makeNewClass(Type ctype, List<JCExpression> args) {
return makeNewClass(ctype, args,
rs.resolveConstructor(null, attrEnv, ctype, TreeInfo.types(args), List.nil()));
} | java | JCNewClass makeNewClass(Type ctype, List<JCExpression> args) {
return makeNewClass(ctype, args,
rs.resolveConstructor(null, attrEnv, ctype, TreeInfo.types(args), List.nil()));
} | [
"JCNewClass",
"makeNewClass",
"(",
"Type",
"ctype",
",",
"List",
"<",
"JCExpression",
">",
"args",
")",
"{",
"return",
"makeNewClass",
"(",
"ctype",
",",
"args",
",",
"rs",
".",
"resolveConstructor",
"(",
"null",
",",
"attrEnv",
",",
"ctype",
",",
"TreeInf... | Make an attributed class instance creation expression.
@param ctype The class type.
@param args The constructor arguments. | [
"Make",
"an",
"attributed",
"class",
"instance",
"creation",
"expression",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java#L676-L679 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/DefaultInputResolver.java | DefaultInputResolver.resolveEntity | public static WstxInputSource resolveEntity
(WstxInputSource parent, URL pathCtxt, String entityName,
String publicId, String systemId,
XMLResolver customResolver, ReaderConfig cfg, int xmlVersion)
throws IOException, XMLStreamException
{
if (pathCtxt == null) {
pathCtxt = parent.getSource();
if (pathCtxt == null) {
pathCtxt = URLUtil.urlFromCurrentDir();
}
}
// Do we have a custom resolver that may be able to resolve it?
if (customResolver != null) {
Object source = customResolver.resolveEntity(publicId, systemId, pathCtxt.toExternalForm(), entityName);
if (source != null) {
return sourceFrom(parent, cfg, entityName, xmlVersion, source);
}
}
// Have to have a system id, then...
if (systemId == null) {
throw new XMLStreamException("Can not resolve "
+((entityName == null) ? "[External DTD subset]" : ("entity '"+entityName+"'"))+" without a system id (public id '"
+publicId+"')");
}
URL url = URLUtil.urlFromSystemId(systemId, pathCtxt);
return sourceFromURL(parent, cfg, entityName, xmlVersion, url, publicId);
} | java | public static WstxInputSource resolveEntity
(WstxInputSource parent, URL pathCtxt, String entityName,
String publicId, String systemId,
XMLResolver customResolver, ReaderConfig cfg, int xmlVersion)
throws IOException, XMLStreamException
{
if (pathCtxt == null) {
pathCtxt = parent.getSource();
if (pathCtxt == null) {
pathCtxt = URLUtil.urlFromCurrentDir();
}
}
// Do we have a custom resolver that may be able to resolve it?
if (customResolver != null) {
Object source = customResolver.resolveEntity(publicId, systemId, pathCtxt.toExternalForm(), entityName);
if (source != null) {
return sourceFrom(parent, cfg, entityName, xmlVersion, source);
}
}
// Have to have a system id, then...
if (systemId == null) {
throw new XMLStreamException("Can not resolve "
+((entityName == null) ? "[External DTD subset]" : ("entity '"+entityName+"'"))+" without a system id (public id '"
+publicId+"')");
}
URL url = URLUtil.urlFromSystemId(systemId, pathCtxt);
return sourceFromURL(parent, cfg, entityName, xmlVersion, url, publicId);
} | [
"public",
"static",
"WstxInputSource",
"resolveEntity",
"(",
"WstxInputSource",
"parent",
",",
"URL",
"pathCtxt",
",",
"String",
"entityName",
",",
"String",
"publicId",
",",
"String",
"systemId",
",",
"XMLResolver",
"customResolver",
",",
"ReaderConfig",
"cfg",
","... | Basic external resource resolver implementation; usable both with
DTD and entity resolution.
@param parent Input source that contains reference to be expanded.
@param pathCtxt Reference context to use for resolving path, if
known. If null, reference context of the parent will
be used; and if that is null (which is possible), the
current working directory will be assumed.
@param entityName Name/id of the entity being expanded, if this is an
entity expansion; null otherwise (for example, when resolving external
subset).
@param publicId Public identifier of the resource, if known; null/empty
otherwise. Default implementation just ignores the identifier.
@param systemId System identifier of the resource. Although interface
allows null/empty, default implementation considers this an error.
@param xmlVersion Xml version as declared by the main parsed
document. Currently only relevant for checking that XML 1.0 document
does not include XML 1.1 external parsed entities.
If XML_V_UNKNOWN, no checks will be done.
@param customResolver Custom resolver to use first for resolution,
if any (may be null).
@param cfg Reader configuration object used by the parser that is
resolving the entity
@return Input source, if entity could be resolved; null if it could
not be resolved. In latter case processor may use its own default
resolution mechanism. | [
"Basic",
"external",
"resource",
"resolver",
"implementation",
";",
"usable",
"both",
"with",
"DTD",
"and",
"entity",
"resolution",
"."
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/DefaultInputResolver.java#L64-L93 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/CertificatesInner.java | CertificatesInner.createOrUpdate | public CertificateDescriptionInner createOrUpdate(String resourceGroupName, String resourceName, String certificateName) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, certificateName).toBlocking().single().body();
} | java | public CertificateDescriptionInner createOrUpdate(String resourceGroupName, String resourceName, String certificateName) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, certificateName).toBlocking().single().body();
} | [
"public",
"CertificateDescriptionInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"certificateName",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
",",
... | Upload the certificate to the IoT hub.
Adds new or replaces existing certificate.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@param certificateName The name of the certificate
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorDetailsException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the CertificateDescriptionInner object if successful. | [
"Upload",
"the",
"certificate",
"to",
"the",
"IoT",
"hub",
".",
"Adds",
"new",
"or",
"replaces",
"existing",
"certificate",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/CertificatesInner.java#L285-L287 |
jkrasnay/sqlbuilder | src/main/java/ca/krasnay/sqlbuilder/AbstractSqlBuilder.java | AbstractSqlBuilder.appendList | protected void appendList(StringBuilder sql, List<?> list, String init, String sep) {
boolean first = true;
for (Object s : list) {
if (first) {
sql.append(init);
} else {
sql.append(sep);
}
sql.append(s);
first = false;
}
} | java | protected void appendList(StringBuilder sql, List<?> list, String init, String sep) {
boolean first = true;
for (Object s : list) {
if (first) {
sql.append(init);
} else {
sql.append(sep);
}
sql.append(s);
first = false;
}
} | [
"protected",
"void",
"appendList",
"(",
"StringBuilder",
"sql",
",",
"List",
"<",
"?",
">",
"list",
",",
"String",
"init",
",",
"String",
"sep",
")",
"{",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"Object",
"s",
":",
"list",
")",
"{",
"if",
... | Constructs a list of items with given separators.
@param sql
StringBuilder to which the constructed string will be
appended.
@param list
List of objects (usually strings) to join.
@param init
String to be added to the start of the list, before any of the
items.
@param sep
Separator string to be added between items in the list. | [
"Constructs",
"a",
"list",
"of",
"items",
"with",
"given",
"separators",
"."
] | train | https://github.com/jkrasnay/sqlbuilder/blob/8e6acedc51cfad0527263376af51e1ef052f7147/src/main/java/ca/krasnay/sqlbuilder/AbstractSqlBuilder.java#L26-L39 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java | TheMovieDbApi.createList | public String createList(String sessionId, String name, String description) throws MovieDbException {
return tmdbList.createList(sessionId, name, description);
} | java | public String createList(String sessionId, String name, String description) throws MovieDbException {
return tmdbList.createList(sessionId, name, description);
} | [
"public",
"String",
"createList",
"(",
"String",
"sessionId",
",",
"String",
"name",
",",
"String",
"description",
")",
"throws",
"MovieDbException",
"{",
"return",
"tmdbList",
".",
"createList",
"(",
"sessionId",
",",
"name",
",",
"description",
")",
";",
"}"... | This method lets users create a new list. A valid session id is required.
@param sessionId sessionId
@param name name
@param description description
@return The list id
@throws MovieDbException exception | [
"This",
"method",
"lets",
"users",
"create",
"a",
"new",
"list",
".",
"A",
"valid",
"session",
"id",
"is",
"required",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L775-L777 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/trees/TreePruner.java | TreePruner.prune | public static void prune(TreeNodeVisitor root, PruningMethod method, ClassificationDataSet testSet)
{
//TODO add vargs for extra arguments that may be used by pruning methods
if(method == PruningMethod.NONE )
return;
else if(method == PruningMethod.REDUCED_ERROR)
pruneReduceError(null, -1, root, testSet);
else if(method == PruningMethod.ERROR_BASED)
pruneErrorBased(null, -1, root, testSet, 0.25);
else
throw new RuntimeException("BUG: please report");
} | java | public static void prune(TreeNodeVisitor root, PruningMethod method, ClassificationDataSet testSet)
{
//TODO add vargs for extra arguments that may be used by pruning methods
if(method == PruningMethod.NONE )
return;
else if(method == PruningMethod.REDUCED_ERROR)
pruneReduceError(null, -1, root, testSet);
else if(method == PruningMethod.ERROR_BASED)
pruneErrorBased(null, -1, root, testSet, 0.25);
else
throw new RuntimeException("BUG: please report");
} | [
"public",
"static",
"void",
"prune",
"(",
"TreeNodeVisitor",
"root",
",",
"PruningMethod",
"method",
",",
"ClassificationDataSet",
"testSet",
")",
"{",
"//TODO add vargs for extra arguments that may be used by pruning methods",
"if",
"(",
"method",
"==",
"PruningMethod",
".... | Performs pruning starting from the root node of a tree
@param root the root node of a decision tree
@param method the pruning method to use
@param testSet the test set of data points to use for pruning | [
"Performs",
"pruning",
"starting",
"from",
"the",
"root",
"node",
"of",
"a",
"tree"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/TreePruner.java#L66-L77 |
liferay/com-liferay-commerce | commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountRulePersistenceImpl.java | CommerceDiscountRulePersistenceImpl.findByCommerceDiscountId | @Override
public List<CommerceDiscountRule> findByCommerceDiscountId(
long commerceDiscountId, int start, int end) {
return findByCommerceDiscountId(commerceDiscountId, start, end, null);
} | java | @Override
public List<CommerceDiscountRule> findByCommerceDiscountId(
long commerceDiscountId, int start, int end) {
return findByCommerceDiscountId(commerceDiscountId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceDiscountRule",
">",
"findByCommerceDiscountId",
"(",
"long",
"commerceDiscountId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCommerceDiscountId",
"(",
"commerceDiscountId",
",",
"start",
",",
... | Returns a range of all the commerce discount rules where commerceDiscountId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceDiscountRuleModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param commerceDiscountId the commerce discount ID
@param start the lower bound of the range of commerce discount rules
@param end the upper bound of the range of commerce discount rules (not inclusive)
@return the range of matching commerce discount rules | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"discount",
"rules",
"where",
"commerceDiscountId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountRulePersistenceImpl.java#L144-L148 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDatatypeImpl_CustomFieldSerializer.java | OWLDatatypeImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLDatatypeImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLDatatypeImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLDatatypeImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
] | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDatatypeImpl_CustomFieldSerializer.java#L63-L66 |
Ellzord/JALSE | src/main/java/jalse/tags/Tags.java | Tags.setOriginContainer | public static void setOriginContainer(final Set<Tag> tags, final EntityContainer container) {
final UUID id = Identifiable.getID(container);
if (id != null) {
tags.add(new OriginContainer(id));
}
} | java | public static void setOriginContainer(final Set<Tag> tags, final EntityContainer container) {
final UUID id = Identifiable.getID(container);
if (id != null) {
tags.add(new OriginContainer(id));
}
} | [
"public",
"static",
"void",
"setOriginContainer",
"(",
"final",
"Set",
"<",
"Tag",
">",
"tags",
",",
"final",
"EntityContainer",
"container",
")",
"{",
"final",
"UUID",
"id",
"=",
"Identifiable",
".",
"getID",
"(",
"container",
")",
";",
"if",
"(",
"id",
... | Sets the origin container to the provided container (if {@link Identifiable}).
@param tags
Tag set.
@param container
Possible origin container. | [
"Sets",
"the",
"origin",
"container",
"to",
"the",
"provided",
"container",
"(",
"if",
"{",
"@link",
"Identifiable",
"}",
")",
"."
] | train | https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/tags/Tags.java#L161-L166 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java | Apptentive.sendAttachmentFile | public static void sendAttachmentFile(final InputStream is, final String mimeType) {
dispatchConversationTask(new ConversationDispatchTask() {
@Override
protected boolean execute(Conversation conversation) {
if (is == null) {
return false; // TODO: add error message
}
CompoundMessage message = new CompoundMessage();
// No body, just attachment
message.setBody(null);
message.setRead(true);
message.setHidden(true);
message.setSenderId(conversation.getPerson().getId());
ArrayList<StoredFile> attachmentStoredFiles = new ArrayList<StoredFile>();
String localFilePath = Util.generateCacheFilePathFromNonceOrPrefix(ApptentiveInternal.getInstance().getApplicationContext(), message.getNonce(), null);
String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);
if (!TextUtils.isEmpty(extension)) {
localFilePath += "." + extension;
}
// When created from InputStream, there is no source file uri or path, thus just use the cache file path
StoredFile storedFile = Util.createLocalStoredFile(is, localFilePath, localFilePath, mimeType);
if (storedFile == null) {
return false; // TODO: add error message
}
storedFile.setId(message.getNonce());
attachmentStoredFiles.add(storedFile);
message.setAssociatedFiles(attachmentStoredFiles);
conversation.getMessageManager().sendMessage(message);
return true;
}
}, "add unread message listener");
} | java | public static void sendAttachmentFile(final InputStream is, final String mimeType) {
dispatchConversationTask(new ConversationDispatchTask() {
@Override
protected boolean execute(Conversation conversation) {
if (is == null) {
return false; // TODO: add error message
}
CompoundMessage message = new CompoundMessage();
// No body, just attachment
message.setBody(null);
message.setRead(true);
message.setHidden(true);
message.setSenderId(conversation.getPerson().getId());
ArrayList<StoredFile> attachmentStoredFiles = new ArrayList<StoredFile>();
String localFilePath = Util.generateCacheFilePathFromNonceOrPrefix(ApptentiveInternal.getInstance().getApplicationContext(), message.getNonce(), null);
String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);
if (!TextUtils.isEmpty(extension)) {
localFilePath += "." + extension;
}
// When created from InputStream, there is no source file uri or path, thus just use the cache file path
StoredFile storedFile = Util.createLocalStoredFile(is, localFilePath, localFilePath, mimeType);
if (storedFile == null) {
return false; // TODO: add error message
}
storedFile.setId(message.getNonce());
attachmentStoredFiles.add(storedFile);
message.setAssociatedFiles(attachmentStoredFiles);
conversation.getMessageManager().sendMessage(message);
return true;
}
}, "add unread message listener");
} | [
"public",
"static",
"void",
"sendAttachmentFile",
"(",
"final",
"InputStream",
"is",
",",
"final",
"String",
"mimeType",
")",
"{",
"dispatchConversationTask",
"(",
"new",
"ConversationDispatchTask",
"(",
")",
"{",
"@",
"Override",
"protected",
"boolean",
"execute",
... | Sends a file to the server. This file will be visible in the conversation view on the server, but will not be shown
in the client's Message Center. A local copy of this file will be made until the message is transmitted, at which
point the temporary file will be deleted.
@param is An InputStream from the desired file.
@param mimeType The mime type of the file. | [
"Sends",
"a",
"file",
"to",
"the",
"server",
".",
"This",
"file",
"will",
"be",
"visible",
"in",
"the",
"conversation",
"view",
"on",
"the",
"server",
"but",
"will",
"not",
"be",
"shown",
"in",
"the",
"client",
"s",
"Message",
"Center",
".",
"A",
"loca... | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L1146-L1180 |
lz4/lz4-java | src/java/net/jpountz/xxhash/StreamingXXHash32.java | StreamingXXHash32.asChecksum | public final Checksum asChecksum() {
return new Checksum() {
@Override
public long getValue() {
return StreamingXXHash32.this.getValue() & 0xFFFFFFFL;
}
@Override
public void reset() {
StreamingXXHash32.this.reset();
}
@Override
public void update(int b) {
StreamingXXHash32.this.update(new byte[] {(byte) b}, 0, 1);
}
@Override
public void update(byte[] b, int off, int len) {
StreamingXXHash32.this.update(b, off, len);
}
@Override
public String toString() {
return StreamingXXHash32.this.toString();
}
};
} | java | public final Checksum asChecksum() {
return new Checksum() {
@Override
public long getValue() {
return StreamingXXHash32.this.getValue() & 0xFFFFFFFL;
}
@Override
public void reset() {
StreamingXXHash32.this.reset();
}
@Override
public void update(int b) {
StreamingXXHash32.this.update(new byte[] {(byte) b}, 0, 1);
}
@Override
public void update(byte[] b, int off, int len) {
StreamingXXHash32.this.update(b, off, len);
}
@Override
public String toString() {
return StreamingXXHash32.this.toString();
}
};
} | [
"public",
"final",
"Checksum",
"asChecksum",
"(",
")",
"{",
"return",
"new",
"Checksum",
"(",
")",
"{",
"@",
"Override",
"public",
"long",
"getValue",
"(",
")",
"{",
"return",
"StreamingXXHash32",
".",
"this",
".",
"getValue",
"(",
")",
"&",
"0xFFFFFFF",
... | Returns a {@link Checksum} view of this instance. Modifications to the view
will modify this instance too and vice-versa.
@return the {@link Checksum} object representing this instance | [
"Returns",
"a",
"{",
"@link",
"Checksum",
"}",
"view",
"of",
"this",
"instance",
".",
"Modifications",
"to",
"the",
"view",
"will",
"modify",
"this",
"instance",
"too",
"and",
"vice",
"-",
"versa",
"."
] | train | https://github.com/lz4/lz4-java/blob/c5ae694a3aa8b33ef87fd0486727a7d1e8f71367/src/java/net/jpountz/xxhash/StreamingXXHash32.java#L88-L117 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java | GlobalizationPreferences.getCollator | public Collator getCollator() {
if (collator == null) {
return guessCollator();
}
try {
return (Collator) collator.clone(); // clone for safety
} catch (CloneNotSupportedException e) {
throw new ICUCloneNotSupportedException("Error in cloning collator", e);
}
} | java | public Collator getCollator() {
if (collator == null) {
return guessCollator();
}
try {
return (Collator) collator.clone(); // clone for safety
} catch (CloneNotSupportedException e) {
throw new ICUCloneNotSupportedException("Error in cloning collator", e);
}
} | [
"public",
"Collator",
"getCollator",
"(",
")",
"{",
"if",
"(",
"collator",
"==",
"null",
")",
"{",
"return",
"guessCollator",
"(",
")",
";",
"}",
"try",
"{",
"return",
"(",
"Collator",
")",
"collator",
".",
"clone",
"(",
")",
";",
"// clone for safety",
... | Get a copy of the collator according to the settings.
@return collator explicit or implicit.
@hide draft / provisional / internal are hidden on Android | [
"Get",
"a",
"copy",
"of",
"the",
"collator",
"according",
"to",
"the",
"settings",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L459-L468 |
JavaMoney/jsr354-api | src/main/java/javax/money/AbstractContext.java | AbstractContext.get | public <T> T get(String key, Class<T> type) {
Object value = this.data.get(key);
if (value != null && type.isAssignableFrom(value.getClass())) {
return (T) value;
}
return null;
} | java | public <T> T get(String key, Class<T> type) {
Object value = this.data.get(key);
if (value != null && type.isAssignableFrom(value.getClass())) {
return (T) value;
}
return null;
} | [
"public",
"<",
"T",
">",
"T",
"get",
"(",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"Object",
"value",
"=",
"this",
".",
"data",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"!=",
"null",
"&&",
"type",
".",
"isA... | Access an attribute.
@param type the attribute's type, not {@code null}
@param key the attribute's key, not {@code null}
@return the attribute value, or {@code null}. | [
"Access",
"an",
"attribute",
"."
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/AbstractContext.java#L87-L93 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.randn | @Override
public INDArray randn(long rows, long columns, org.nd4j.linalg.api.rng.Random r) {
return randn(new long[] {rows, columns}, r);
} | java | @Override
public INDArray randn(long rows, long columns, org.nd4j.linalg.api.rng.Random r) {
return randn(new long[] {rows, columns}, r);
} | [
"@",
"Override",
"public",
"INDArray",
"randn",
"(",
"long",
"rows",
",",
"long",
"columns",
",",
"org",
".",
"nd4j",
".",
"linalg",
".",
"api",
".",
"rng",
".",
"Random",
"r",
")",
"{",
"return",
"randn",
"(",
"new",
"long",
"[",
"]",
"{",
"rows",... | Random normal using the given rng
@param rows the number of rows in the matrix
@param columns the number of columns in the matrix
@param r the random generator to use
@return | [
"Random",
"normal",
"using",
"the",
"given",
"rng"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L498-L501 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/FrameAndRootPainter.java | FrameAndRootPainter.getFrameInteriorPaint | public Paint getFrameInteriorPaint(Shape s, int titleHeight, int topToolBarHeight, int bottomToolBarHeight) {
return createFrameGradient(s, titleHeight, topToolBarHeight, bottomToolBarHeight, getFrameInteriorColors());
} | java | public Paint getFrameInteriorPaint(Shape s, int titleHeight, int topToolBarHeight, int bottomToolBarHeight) {
return createFrameGradient(s, titleHeight, topToolBarHeight, bottomToolBarHeight, getFrameInteriorColors());
} | [
"public",
"Paint",
"getFrameInteriorPaint",
"(",
"Shape",
"s",
",",
"int",
"titleHeight",
",",
"int",
"topToolBarHeight",
",",
"int",
"bottomToolBarHeight",
")",
"{",
"return",
"createFrameGradient",
"(",
"s",
",",
"titleHeight",
",",
"topToolBarHeight",
",",
"bot... | Get the paint for the frame interior.
@param s the frame interior shape.
@param titleHeight the height of the title portion.
@param topToolBarHeight the height of the top toolbar, or 0 if none.
@param bottomToolBarHeight the height of the bottom toolbar, or 0 if
none.
@return the paint. | [
"Get",
"the",
"paint",
"for",
"the",
"frame",
"interior",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/FrameAndRootPainter.java#L234-L236 |
apache/incubator-gobblin | gobblin-restli/gobblin-throttling-service/gobblin-throttling-service-server/src/main/java/org/apache/gobblin/restli/throttling/TokenBucket.java | TokenBucket.getTokens | public boolean getTokens(long tokens, long timeout, TimeUnit timeoutUnit) throws InterruptedException {
long timeoutMillis = timeoutUnit.toMillis(timeout);
long wait = tryReserveTokens(tokens, timeoutMillis);
if (wait < 0) {
return false;
}
if (wait == 0) {
return true;
}
Thread.sleep(wait);
return true;
} | java | public boolean getTokens(long tokens, long timeout, TimeUnit timeoutUnit) throws InterruptedException {
long timeoutMillis = timeoutUnit.toMillis(timeout);
long wait = tryReserveTokens(tokens, timeoutMillis);
if (wait < 0) {
return false;
}
if (wait == 0) {
return true;
}
Thread.sleep(wait);
return true;
} | [
"public",
"boolean",
"getTokens",
"(",
"long",
"tokens",
",",
"long",
"timeout",
",",
"TimeUnit",
"timeoutUnit",
")",
"throws",
"InterruptedException",
"{",
"long",
"timeoutMillis",
"=",
"timeoutUnit",
".",
"toMillis",
"(",
"timeout",
")",
";",
"long",
"wait",
... | Attempt to get the specified amount of tokens within the specified timeout. If the tokens cannot be retrieved in the
specified timeout, the call will return false immediately, otherwise, the call will block until the tokens are available.
@return true if the tokens are granted.
@throws InterruptedException | [
"Attempt",
"to",
"get",
"the",
"specified",
"amount",
"of",
"tokens",
"within",
"the",
"specified",
"timeout",
".",
"If",
"the",
"tokens",
"cannot",
"be",
"retrieved",
"in",
"the",
"specified",
"timeout",
"the",
"call",
"will",
"return",
"false",
"immediately"... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-restli/gobblin-throttling-service/gobblin-throttling-service-server/src/main/java/org/apache/gobblin/restli/throttling/TokenBucket.java#L69-L82 |
yavijava/yavijava | src/main/java/com/vmware/vim/cf/CacheInstance.java | CacheInstance.getCopy | public Object getCopy(ManagedObject mo, String propName)
{
Object obj = get(mo.getMOR(), propName);
try
{
obj = DeepCopier.deepCopy(obj);
} catch(Exception e)
{
throw new RuntimeException(e);
}
return obj;
} | java | public Object getCopy(ManagedObject mo, String propName)
{
Object obj = get(mo.getMOR(), propName);
try
{
obj = DeepCopier.deepCopy(obj);
} catch(Exception e)
{
throw new RuntimeException(e);
}
return obj;
} | [
"public",
"Object",
"getCopy",
"(",
"ManagedObject",
"mo",
",",
"String",
"propName",
")",
"{",
"Object",
"obj",
"=",
"get",
"(",
"mo",
".",
"getMOR",
"(",
")",
",",
"propName",
")",
";",
"try",
"{",
"obj",
"=",
"DeepCopier",
".",
"deepCopy",
"(",
"o... | Get a copy of the cached property. You can change the returned
object as you like
@param mo Managed object
@param propName property name
@return the data object identified by the propName.
NullObject.NULL if the data object is really null | [
"Get",
"a",
"copy",
"of",
"the",
"cached",
"property",
".",
"You",
"can",
"change",
"the",
"returned",
"object",
"as",
"you",
"like"
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim/cf/CacheInstance.java#L85-L96 |
liferay/com-liferay-commerce | commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java | CommerceAccountPersistenceImpl.findByCompanyId | @Override
public List<CommerceAccount> findByCompanyId(long companyId, int start,
int end) {
return findByCompanyId(companyId, start, end, null);
} | java | @Override
public List<CommerceAccount> findByCompanyId(long companyId, int start,
int end) {
return findByCompanyId(companyId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceAccount",
">",
"findByCompanyId",
"(",
"long",
"companyId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCompanyId",
"(",
"companyId",
",",
"start",
",",
"end",
",",
"null",
")",
";",
... | Returns a range of all the commerce accounts where companyId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceAccountModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param companyId the company ID
@param start the lower bound of the range of commerce accounts
@param end the upper bound of the range of commerce accounts (not inclusive)
@return the range of matching commerce accounts | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"accounts",
"where",
"companyId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java#L147-L151 |
algolia/instantsearch-android | ui/src/main/java/com/algolia/instantsearch/ui/views/filters/OneValueToggle.java | OneValueToggle.setValue | public void setValue(String newValue, @Nullable String newName) {
if (isChecked()) {
searcher.updateFacetRefinement(this.attribute, value, false)
.updateFacetRefinement(newName != null ? newName : attribute, newValue, true)
.search();
}
this.value = newValue;
applyEventualNewAttribute(newName);
} | java | public void setValue(String newValue, @Nullable String newName) {
if (isChecked()) {
searcher.updateFacetRefinement(this.attribute, value, false)
.updateFacetRefinement(newName != null ? newName : attribute, newValue, true)
.search();
}
this.value = newValue;
applyEventualNewAttribute(newName);
} | [
"public",
"void",
"setValue",
"(",
"String",
"newValue",
",",
"@",
"Nullable",
"String",
"newName",
")",
"{",
"if",
"(",
"isChecked",
"(",
")",
")",
"{",
"searcher",
".",
"updateFacetRefinement",
"(",
"this",
".",
"attribute",
",",
"value",
",",
"false",
... | Changes the OneValueToggle's value, updating facet refinements accordingly.
@param newValue the new value to refine with.
@param newName an eventual new attribute name. | [
"Changes",
"the",
"OneValueToggle",
"s",
"value",
"updating",
"facet",
"refinements",
"accordingly",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/views/filters/OneValueToggle.java#L48-L56 |
beihaifeiwu/dolphin | dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/i18n/Resources.java | Resources.getFormatted | public String getFormatted(String key, String argument) {
return MessageFormat.format(resource.getString(key), new Object[] {argument});
} | java | public String getFormatted(String key, String argument) {
return MessageFormat.format(resource.getString(key), new Object[] {argument});
} | [
"public",
"String",
"getFormatted",
"(",
"String",
"key",
",",
"String",
"argument",
")",
"{",
"return",
"MessageFormat",
".",
"format",
"(",
"resource",
".",
"getString",
"(",
"key",
")",
",",
"new",
"Object",
"[",
"]",
"{",
"argument",
"}",
")",
";",
... | /*
Gets a resource string formatted with MessageFormat.
@param key the key
@param argument the argument
@return Formatted stirng. | [
"/",
"*",
"Gets",
"a",
"resource",
"string",
"formatted",
"with",
"MessageFormat",
"."
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/i18n/Resources.java#L146-L148 |
lightbend/config | config/src/main/java/com/typesafe/config/ConfigFactory.java | ConfigFactory.parseResources | public static Config parseResources(String resource, ConfigParseOptions options) {
ConfigParseOptions withLoader = ensureClassLoader(options, "parseResources");
return Parseable.newResources(resource, withLoader).parse().toConfig();
} | java | public static Config parseResources(String resource, ConfigParseOptions options) {
ConfigParseOptions withLoader = ensureClassLoader(options, "parseResources");
return Parseable.newResources(resource, withLoader).parse().toConfig();
} | [
"public",
"static",
"Config",
"parseResources",
"(",
"String",
"resource",
",",
"ConfigParseOptions",
"options",
")",
"{",
"ConfigParseOptions",
"withLoader",
"=",
"ensureClassLoader",
"(",
"options",
",",
"\"parseResources\"",
")",
";",
"return",
"Parseable",
".",
... | Like {@link #parseResources(ClassLoader,String,ConfigParseOptions)} but
uses thread's current context class loader if none is set in the
ConfigParseOptions.
@param resource the resource name
@param options parse options
@return the parsed configuration | [
"Like",
"{"
] | train | https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/ConfigFactory.java#L1005-L1008 |
Netflix/conductor | core/src/main/java/com/netflix/conductor/core/execution/mapper/DynamicTaskMapper.java | DynamicTaskMapper.getDynamicTaskName | @VisibleForTesting
String getDynamicTaskName(Map<String, Object> taskInput, String taskNameParam) throws TerminateWorkflowException {
return Optional.ofNullable(taskInput.get(taskNameParam))
.map(String::valueOf)
.orElseThrow(() -> {
String reason = String.format("Cannot map a dynamic task based on the parameter and input. " +
"Parameter= %s, input= %s", taskNameParam, taskInput);
return new TerminateWorkflowException(reason);
});
} | java | @VisibleForTesting
String getDynamicTaskName(Map<String, Object> taskInput, String taskNameParam) throws TerminateWorkflowException {
return Optional.ofNullable(taskInput.get(taskNameParam))
.map(String::valueOf)
.orElseThrow(() -> {
String reason = String.format("Cannot map a dynamic task based on the parameter and input. " +
"Parameter= %s, input= %s", taskNameParam, taskInput);
return new TerminateWorkflowException(reason);
});
} | [
"@",
"VisibleForTesting",
"String",
"getDynamicTaskName",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"taskInput",
",",
"String",
"taskNameParam",
")",
"throws",
"TerminateWorkflowException",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"taskInput",
".",
... | Helper method that looks into the input params and returns the dynamic task name
@param taskInput: a map which contains different input parameters and
also contains the mapping between the dynamic task name param and the actual name representing the dynamic task
@param taskNameParam: the key that is used to look up the dynamic task name.
@return The name of the dynamic task
@throws TerminateWorkflowException : In case is there is no value dynamic task name in the input parameters. | [
"Helper",
"method",
"that",
"looks",
"into",
"the",
"input",
"params",
"and",
"returns",
"the",
"dynamic",
"task",
"name"
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/core/execution/mapper/DynamicTaskMapper.java#L106-L115 |
btrplace/scheduler | json/src/main/java/org/btrplace/json/JSONs.java | JSONs.optInt | public static int optInt(JSONObject o, String id, int def) throws JSONConverterException {
if (o.containsKey(id)) {
try {
return (Integer) o.get(id);
} catch (ClassCastException e) {
throw new JSONConverterException("Unable to read a int from string '" + id + "'", e);
}
}
return def;
} | java | public static int optInt(JSONObject o, String id, int def) throws JSONConverterException {
if (o.containsKey(id)) {
try {
return (Integer) o.get(id);
} catch (ClassCastException e) {
throw new JSONConverterException("Unable to read a int from string '" + id + "'", e);
}
}
return def;
} | [
"public",
"static",
"int",
"optInt",
"(",
"JSONObject",
"o",
",",
"String",
"id",
",",
"int",
"def",
")",
"throws",
"JSONConverterException",
"{",
"if",
"(",
"o",
".",
"containsKey",
"(",
"id",
")",
")",
"{",
"try",
"{",
"return",
"(",
"Integer",
")",
... | Read an optional integer.
@param o the object to parse
@param id the key in the map that points to an integer
@param def the default integer value if the key is absent
@return the resulting integer
@throws JSONConverterException if the key does not point to a int | [
"Read",
"an",
"optional",
"integer",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L110-L119 |
alkacon/opencms-core | src-setup/org/opencms/setup/CmsSetupDb.java | CmsSetupDb.executeSql | private void executeSql(String databaseKey, String sqlScript, Map<String, String> replacers, boolean abortOnError) {
String filename = null;
try {
filename = m_basePath
+ CmsSetupBean.FOLDER_SETUP
+ "database"
+ File.separator
+ databaseKey
+ File.separator
+ sqlScript;
executeSql(new FileReader(filename), replacers, abortOnError);
} catch (FileNotFoundException e) {
if (m_errorLogging) {
m_errors.add("Database setup SQL script not found: " + filename);
m_errors.add(CmsException.getStackTraceAsString(e));
}
}
} | java | private void executeSql(String databaseKey, String sqlScript, Map<String, String> replacers, boolean abortOnError) {
String filename = null;
try {
filename = m_basePath
+ CmsSetupBean.FOLDER_SETUP
+ "database"
+ File.separator
+ databaseKey
+ File.separator
+ sqlScript;
executeSql(new FileReader(filename), replacers, abortOnError);
} catch (FileNotFoundException e) {
if (m_errorLogging) {
m_errors.add("Database setup SQL script not found: " + filename);
m_errors.add(CmsException.getStackTraceAsString(e));
}
}
} | [
"private",
"void",
"executeSql",
"(",
"String",
"databaseKey",
",",
"String",
"sqlScript",
",",
"Map",
"<",
"String",
",",
"String",
">",
"replacers",
",",
"boolean",
"abortOnError",
")",
"{",
"String",
"filename",
"=",
"null",
";",
"try",
"{",
"filename",
... | Internal method to parse and execute a setup script.<p>
@param databaseKey the database variant of the script
@param sqlScript the name of the script
@param replacers the replacements to perform in the script
@param abortOnError if a error occurs this flag indicates if to continue or to abort | [
"Internal",
"method",
"to",
"parse",
"and",
"execute",
"a",
"setup",
"script",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupDb.java#L726-L744 |
apache/incubator-druid | benchmarks/src/main/java/org/apache/druid/benchmark/query/SelectBenchmark.java | SelectBenchmark.incrementQueryPagination | private SelectQuery incrementQueryPagination(SelectQuery query, SelectResultValue prevResult)
{
Map<String, Integer> pagingIdentifiers = prevResult.getPagingIdentifiers();
Map<String, Integer> newPagingIdentifers = new HashMap<>();
for (String segmentId : pagingIdentifiers.keySet()) {
int newOffset = pagingIdentifiers.get(segmentId) + 1;
newPagingIdentifers.put(segmentId, newOffset);
}
return query.withPagingSpec(new PagingSpec(newPagingIdentifers, pagingThreshold));
} | java | private SelectQuery incrementQueryPagination(SelectQuery query, SelectResultValue prevResult)
{
Map<String, Integer> pagingIdentifiers = prevResult.getPagingIdentifiers();
Map<String, Integer> newPagingIdentifers = new HashMap<>();
for (String segmentId : pagingIdentifiers.keySet()) {
int newOffset = pagingIdentifiers.get(segmentId) + 1;
newPagingIdentifers.put(segmentId, newOffset);
}
return query.withPagingSpec(new PagingSpec(newPagingIdentifers, pagingThreshold));
} | [
"private",
"SelectQuery",
"incrementQueryPagination",
"(",
"SelectQuery",
"query",
",",
"SelectResultValue",
"prevResult",
")",
"{",
"Map",
"<",
"String",
",",
"Integer",
">",
"pagingIdentifiers",
"=",
"prevResult",
".",
"getPagingIdentifiers",
"(",
")",
";",
"Map",... | Don't run this benchmark with a query that doesn't use {@link Granularities#ALL},
this pagination function probably doesn't work correctly in that case. | [
"Don",
"t",
"run",
"this",
"benchmark",
"with",
"a",
"query",
"that",
"doesn",
"t",
"use",
"{"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/benchmarks/src/main/java/org/apache/druid/benchmark/query/SelectBenchmark.java#L276-L287 |
cryptomator/cryptolib | src/main/java/org/cryptomator/cryptolib/common/ByteBuffers.java | ByteBuffers.copy | public static int copy(ByteBuffer source, ByteBuffer destination) {
final int numBytes = Math.min(source.remaining(), destination.remaining());
final ByteBuffer tmp = source.asReadOnlyBuffer();
tmp.limit(tmp.position() + numBytes);
destination.put(tmp);
source.position(tmp.position()); // until now only tmp pos has been incremented, so we need to adjust the position
return numBytes;
} | java | public static int copy(ByteBuffer source, ByteBuffer destination) {
final int numBytes = Math.min(source.remaining(), destination.remaining());
final ByteBuffer tmp = source.asReadOnlyBuffer();
tmp.limit(tmp.position() + numBytes);
destination.put(tmp);
source.position(tmp.position()); // until now only tmp pos has been incremented, so we need to adjust the position
return numBytes;
} | [
"public",
"static",
"int",
"copy",
"(",
"ByteBuffer",
"source",
",",
"ByteBuffer",
"destination",
")",
"{",
"final",
"int",
"numBytes",
"=",
"Math",
".",
"min",
"(",
"source",
".",
"remaining",
"(",
")",
",",
"destination",
".",
"remaining",
"(",
")",
")... | Copies as many bytes as possible from the given source to the destination buffer.
The position of both buffers will be incremented by as many bytes as have been copied.
@param source ByteBuffer from which bytes are read
@param destination ByteBuffer into which bytes are written
@return number of bytes copied, i.e. {@link ByteBuffer#remaining() source.remaining()} or {@link ByteBuffer#remaining() destination.remaining()}, whatever is less. | [
"Copies",
"as",
"many",
"bytes",
"as",
"possible",
"from",
"the",
"given",
"source",
"to",
"the",
"destination",
"buffer",
".",
"The",
"position",
"of",
"both",
"buffers",
"will",
"be",
"incremented",
"by",
"as",
"many",
"bytes",
"as",
"have",
"been",
"cop... | train | https://github.com/cryptomator/cryptolib/blob/33bc881f6ee7d4924043ea6309efd2c063ec3638/src/main/java/org/cryptomator/cryptolib/common/ByteBuffers.java#L23-L30 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java | HpelCBEFormatter.createExtendedElement | private void createExtendedElement(StringBuilder sb, RepositoryLogRecord record, String extensionID){
String edeValue = record.getExtension(extensionID);
if (edeValue != null && !edeValue.isEmpty()){
createExtendedElement(sb, extensionID, "string", edeValue);
}
} | java | private void createExtendedElement(StringBuilder sb, RepositoryLogRecord record, String extensionID){
String edeValue = record.getExtension(extensionID);
if (edeValue != null && !edeValue.isEmpty()){
createExtendedElement(sb, extensionID, "string", edeValue);
}
} | [
"private",
"void",
"createExtendedElement",
"(",
"StringBuilder",
"sb",
",",
"RepositoryLogRecord",
"record",
",",
"String",
"extensionID",
")",
"{",
"String",
"edeValue",
"=",
"record",
".",
"getExtension",
"(",
"extensionID",
")",
";",
"if",
"(",
"edeValue",
"... | Appends the CBE Extended Data Element of a record's extension to a String buffer
@param sb the string buffer the element will be added to
@param record the record that represents the common base event
@param extensionId the extension ID field from the record to use | [
"Appends",
"the",
"CBE",
"Extended",
"Data",
"Element",
"of",
"a",
"record",
"s",
"extension",
"to",
"a",
"String",
"buffer"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L264-L269 |
yegor256/takes | src/main/java/org/takes/misc/Href.java | Href.with | public Href with(final Object key, final Object value) {
final SortedMap<String, List<String>> map = new TreeMap<>(this.params);
if (!map.containsKey(key.toString())) {
map.put(key.toString(), new LinkedList<>());
}
map.get(key.toString()).add(value.toString());
return new Href(this.uri, map, this.fragment);
} | java | public Href with(final Object key, final Object value) {
final SortedMap<String, List<String>> map = new TreeMap<>(this.params);
if (!map.containsKey(key.toString())) {
map.put(key.toString(), new LinkedList<>());
}
map.get(key.toString()).add(value.toString());
return new Href(this.uri, map, this.fragment);
} | [
"public",
"Href",
"with",
"(",
"final",
"Object",
"key",
",",
"final",
"Object",
"value",
")",
"{",
"final",
"SortedMap",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"map",
"=",
"new",
"TreeMap",
"<>",
"(",
"this",
".",
"params",
")",
";",
... | Add this extra param.
@param key Key of the param
@param value The value
@return New HREF | [
"Add",
"this",
"extra",
"param",
"."
] | train | https://github.com/yegor256/takes/blob/a4f4d939c8f8e0af190025716ad7f22b7de40e70/src/main/java/org/takes/misc/Href.java#L236-L243 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/comp/TransTypes.java | TransTypes.translateTopLevelClass | public JCTree translateTopLevelClass(JCTree cdef, TreeMaker make) {
// note that this method does NOT support recursion.
this.make = make;
pt = null;
return translate(cdef, null);
} | java | public JCTree translateTopLevelClass(JCTree cdef, TreeMaker make) {
// note that this method does NOT support recursion.
this.make = make;
pt = null;
return translate(cdef, null);
} | [
"public",
"JCTree",
"translateTopLevelClass",
"(",
"JCTree",
"cdef",
",",
"TreeMaker",
"make",
")",
"{",
"// note that this method does NOT support recursion.",
"this",
".",
"make",
"=",
"make",
";",
"pt",
"=",
"null",
";",
"return",
"translate",
"(",
"cdef",
",",... | Translate a toplevel class definition.
@param cdef The definition to be translated. | [
"Translate",
"a",
"toplevel",
"class",
"definition",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/TransTypes.java#L1031-L1036 |
shrinkwrap/shrinkwrap | api/src/main/java/org/jboss/shrinkwrap/api/asset/FileAsset.java | FileAsset.openStream | @Override
public InputStream openStream() {
try {
return new BufferedInputStream(new FileInputStream(file), 8192);
} catch (FileNotFoundException e) {
throw new RuntimeException("Could not open file " + file, e);
}
} | java | @Override
public InputStream openStream() {
try {
return new BufferedInputStream(new FileInputStream(file), 8192);
} catch (FileNotFoundException e) {
throw new RuntimeException("Could not open file " + file, e);
}
} | [
"@",
"Override",
"public",
"InputStream",
"openStream",
"(",
")",
"{",
"try",
"{",
"return",
"new",
"BufferedInputStream",
"(",
"new",
"FileInputStream",
"(",
"file",
")",
",",
"8192",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"t... | Opens a new FileInputStream for the given File.
Can throw a Runtime exception if the file has been deleted in between the FileResource was created and the stream
is opened.
@throws RuntimeException
If the file is not found. | [
"Opens",
"a",
"new",
"FileInputStream",
"for",
"the",
"given",
"File",
"."
] | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/api/src/main/java/org/jboss/shrinkwrap/api/asset/FileAsset.java#L63-L70 |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java | MetadataService.perTokenPermissionPointer | private static JsonPointer perTokenPermissionPointer(String repoName, String appId) {
return JsonPointer.compile("/repos" + encodeSegment(repoName) +
"/perTokenPermissions" + encodeSegment(appId));
} | java | private static JsonPointer perTokenPermissionPointer(String repoName, String appId) {
return JsonPointer.compile("/repos" + encodeSegment(repoName) +
"/perTokenPermissions" + encodeSegment(appId));
} | [
"private",
"static",
"JsonPointer",
"perTokenPermissionPointer",
"(",
"String",
"repoName",
",",
"String",
"appId",
")",
"{",
"return",
"JsonPointer",
".",
"compile",
"(",
"\"/repos\"",
"+",
"encodeSegment",
"(",
"repoName",
")",
"+",
"\"/perTokenPermissions\"",
"+"... | Generates the path of {@link JsonPointer} of permission of the specified token {@code appId}
in the specified {@code repoName}. | [
"Generates",
"the",
"path",
"of",
"{"
] | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java#L892-L895 |
aerospike/aerospike-helper | java/src/main/java/com/aerospike/helper/collections/LargeList.java | LargeList.findFrom | public List<?> findFrom(Value begin, int count) throws AerospikeException {
List<byte[]> digestList = getDigestList();
Key beginKey = makeSubKey(begin);
int start = digestList.indexOf(beginKey.digest);
int stop = start + count;
return get(digestList, start, stop);
} | java | public List<?> findFrom(Value begin, int count) throws AerospikeException {
List<byte[]> digestList = getDigestList();
Key beginKey = makeSubKey(begin);
int start = digestList.indexOf(beginKey.digest);
int stop = start + count;
return get(digestList, start, stop);
} | [
"public",
"List",
"<",
"?",
">",
"findFrom",
"(",
"Value",
"begin",
",",
"int",
"count",
")",
"throws",
"AerospikeException",
"{",
"List",
"<",
"byte",
"[",
"]",
">",
"digestList",
"=",
"getDigestList",
"(",
")",
";",
"Key",
"beginKey",
"=",
"makeSubKey"... | Select values from the begin key up to a maximum count.
<p>
@param begin start value (inclusive)
@param count maximum number of values to return
@return list of entries selected | [
"Select",
"values",
"from",
"the",
"begin",
"key",
"up",
"to",
"a",
"maximum",
"count",
".",
"<p",
">"
] | train | https://github.com/aerospike/aerospike-helper/blob/eeb4a1464bc8d9c6716c014d250c8166b5caa82d/java/src/main/java/com/aerospike/helper/collections/LargeList.java#L388-L394 |
square/okhttp | okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.java | Http2Connection.newStream | public Http2Stream newStream(List<Header> requestHeaders, boolean out) throws IOException {
return newStream(0, requestHeaders, out);
} | java | public Http2Stream newStream(List<Header> requestHeaders, boolean out) throws IOException {
return newStream(0, requestHeaders, out);
} | [
"public",
"Http2Stream",
"newStream",
"(",
"List",
"<",
"Header",
">",
"requestHeaders",
",",
"boolean",
"out",
")",
"throws",
"IOException",
"{",
"return",
"newStream",
"(",
"0",
",",
"requestHeaders",
",",
"out",
")",
";",
"}"
] | Returns a new locally-initiated stream.
@param out true to create an output stream that we can use to send data to the remote peer.
Corresponds to {@code FLAG_FIN}. | [
"Returns",
"a",
"new",
"locally",
"-",
"initiated",
"stream",
"."
] | train | https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.java#L225-L227 |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java | JSONObject.optInt | public int optInt(String name, int fallback) {
Object object = opt(name);
Integer result = JSON.toInteger(object);
return result != null ? result : fallback;
} | java | public int optInt(String name, int fallback) {
Object object = opt(name);
Integer result = JSON.toInteger(object);
return result != null ? result : fallback;
} | [
"public",
"int",
"optInt",
"(",
"String",
"name",
",",
"int",
"fallback",
")",
"{",
"Object",
"object",
"=",
"opt",
"(",
"name",
")",
";",
"Integer",
"result",
"=",
"JSON",
".",
"toInteger",
"(",
"object",
")",
";",
"return",
"result",
"!=",
"null",
... | Returns the value mapped by {@code name} if it exists and is an int or can be
coerced to an int. Returns {@code fallback} otherwise.
@param name the name of the property
@param fallback a fallback value
@return the value or {@code fallback} | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L504-L508 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.div | public static double div(float v1, float v2, int scale, RoundingMode roundingMode) {
return div(Float.toString(v1), Float.toString(v2), scale, roundingMode).doubleValue();
} | java | public static double div(float v1, float v2, int scale, RoundingMode roundingMode) {
return div(Float.toString(v1), Float.toString(v2), scale, roundingMode).doubleValue();
} | [
"public",
"static",
"double",
"div",
"(",
"float",
"v1",
",",
"float",
"v2",
",",
"int",
"scale",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"div",
"(",
"Float",
".",
"toString",
"(",
"v1",
")",
",",
"Float",
".",
"toString",
"(",
"v2",
... | 提供(相对)精确的除法运算,当发生除不尽的情况时,由scale指定精确度
@param v1 被除数
@param v2 除数
@param scale 精确度,如果为负值,取绝对值
@param roundingMode 保留小数的模式 {@link RoundingMode}
@return 两个参数的商 | [
"提供",
"(",
"相对",
")",
"精确的除法运算",
"当发生除不尽的情况时",
"由scale指定精确度"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L648-L650 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.updateBlob | public void updateBlob(int columnIndex, java.sql.Blob b) throws SQLException {
try {
rsetImpl.updateBlob(columnIndex, b);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateBlob", "4038", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public void updateBlob(int columnIndex, java.sql.Blob b) throws SQLException {
try {
rsetImpl.updateBlob(columnIndex, b);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateBlob", "4038", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"void",
"updateBlob",
"(",
"int",
"columnIndex",
",",
"java",
".",
"sql",
".",
"Blob",
"b",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"rsetImpl",
".",
"updateBlob",
"(",
"columnIndex",
",",
"b",
")",
";",
"}",
"catch",
"(",
"SQLException"... | <p>Updates the designated column with a java.sql.Blob value. The updater methods
are used to update column values in the current row or the insert row. The updater
methods do not update the underlying database; instead the updateRow or insertRow
methods are called to update the database.</p>
@param columnIndex the first column is 1, the second is 2, ...
@param b the new column value
@exception SQLException If a database access error occurs | [
"<p",
">",
"Updates",
"the",
"designated",
"column",
"with",
"a",
"java",
".",
"sql",
".",
"Blob",
"value",
".",
"The",
"updater",
"methods",
"are",
"used",
"to",
"update",
"column",
"values",
"in",
"the",
"current",
"row",
"or",
"the",
"insert",
"row",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L4615-L4626 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java | HtmlTree.SPAN | public static HtmlTree SPAN(String id, HtmlStyle styleClass, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body));
htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
if (styleClass != null)
htmltree.addStyle(styleClass);
return htmltree;
} | java | public static HtmlTree SPAN(String id, HtmlStyle styleClass, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body));
htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
if (styleClass != null)
htmltree.addStyle(styleClass);
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"SPAN",
"(",
"String",
"id",
",",
"HtmlStyle",
"styleClass",
",",
"Content",
"body",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"SPAN",
",",
"nullCheck",
"(",
"body",
")",
")",
";",
"htm... | Generates a SPAN tag with id and style class attributes. It also encloses
a content.
@param id the id for the tag
@param styleClass stylesheet class for the tag
@param body content for the tag
@return an HtmlTree object for the SPAN tag | [
"Generates",
"a",
"SPAN",
"tag",
"with",
"id",
"and",
"style",
"class",
"attributes",
".",
"It",
"also",
"encloses",
"a",
"content",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L735-L741 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java | PyExpressionGenerator._generate | @SuppressWarnings("checkstyle:cyclomaticcomplexity")
protected XExpression _generate(XBinaryOperation operation, IAppendable it, IExtraLanguageGeneratorContext context) {
appendReturnIfExpectedReturnedExpression(it, context);
final String operator = getOperatorSymbol(operation);
if (operator != null) {
it.append("("); //$NON-NLS-1$
generate(operation.getLeftOperand(), it, context);
switch (operator) {
case "-": //$NON-NLS-1$
case "+": //$NON-NLS-1$
case "*": //$NON-NLS-1$
case "/": //$NON-NLS-1$
case "%": //$NON-NLS-1$
case "-=": //$NON-NLS-1$
case "+=": //$NON-NLS-1$
case "*=": //$NON-NLS-1$
case "/=": //$NON-NLS-1$
case "%=": //$NON-NLS-1$
case "<": //$NON-NLS-1$
case ">": //$NON-NLS-1$
case "<=": //$NON-NLS-1$
case ">=": //$NON-NLS-1$
case "==": //$NON-NLS-1$
case "!=": //$NON-NLS-1$
case "<<": //$NON-NLS-1$
case ">>": //$NON-NLS-1$
it.append(" ").append(operator).append(" "); //$NON-NLS-1$ //$NON-NLS-2$
break;
case "&&": //$NON-NLS-1$
it.append(" and "); //$NON-NLS-1$
break;
case "||": //$NON-NLS-1$
it.append(" or "); //$NON-NLS-1$
break;
case "===": //$NON-NLS-1$
it.append(" is "); //$NON-NLS-1$
break;
case "!==": //$NON-NLS-1$
it.append(" is not "); //$NON-NLS-1$
break;
default:
throw new IllegalArgumentException(MessageFormat.format(Messages.PyExpressionGenerator_0, operator));
}
generate(operation.getRightOperand(), it, context);
it.append(")"); //$NON-NLS-1$
}
return operation;
} | java | @SuppressWarnings("checkstyle:cyclomaticcomplexity")
protected XExpression _generate(XBinaryOperation operation, IAppendable it, IExtraLanguageGeneratorContext context) {
appendReturnIfExpectedReturnedExpression(it, context);
final String operator = getOperatorSymbol(operation);
if (operator != null) {
it.append("("); //$NON-NLS-1$
generate(operation.getLeftOperand(), it, context);
switch (operator) {
case "-": //$NON-NLS-1$
case "+": //$NON-NLS-1$
case "*": //$NON-NLS-1$
case "/": //$NON-NLS-1$
case "%": //$NON-NLS-1$
case "-=": //$NON-NLS-1$
case "+=": //$NON-NLS-1$
case "*=": //$NON-NLS-1$
case "/=": //$NON-NLS-1$
case "%=": //$NON-NLS-1$
case "<": //$NON-NLS-1$
case ">": //$NON-NLS-1$
case "<=": //$NON-NLS-1$
case ">=": //$NON-NLS-1$
case "==": //$NON-NLS-1$
case "!=": //$NON-NLS-1$
case "<<": //$NON-NLS-1$
case ">>": //$NON-NLS-1$
it.append(" ").append(operator).append(" "); //$NON-NLS-1$ //$NON-NLS-2$
break;
case "&&": //$NON-NLS-1$
it.append(" and "); //$NON-NLS-1$
break;
case "||": //$NON-NLS-1$
it.append(" or "); //$NON-NLS-1$
break;
case "===": //$NON-NLS-1$
it.append(" is "); //$NON-NLS-1$
break;
case "!==": //$NON-NLS-1$
it.append(" is not "); //$NON-NLS-1$
break;
default:
throw new IllegalArgumentException(MessageFormat.format(Messages.PyExpressionGenerator_0, operator));
}
generate(operation.getRightOperand(), it, context);
it.append(")"); //$NON-NLS-1$
}
return operation;
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:cyclomaticcomplexity\"",
")",
"protected",
"XExpression",
"_generate",
"(",
"XBinaryOperation",
"operation",
",",
"IAppendable",
"it",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"appendReturnIfExpectedReturnedExpressi... | Generate the given object.
@param operation the binary operation.
@param it the target for the generated content.
@param context the context.
@return the operation. | [
"Generate",
"the",
"given",
"object",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L441-L488 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_happly.java | Scs_happly.cs_happly | public static boolean cs_happly(Scs V, int i, float beta, float[] x) {
int p, Vp[], Vi[];
float Vx[], tau = 0;
if (!Scs_util.CS_CSC(V) || x == null)
return (false); /* check inputs */
Vp = V.p;
Vi = V.i;
Vx = V.x;
for (p = Vp[i]; p < Vp[i + 1]; p++) /* tau = v'*x */
{
tau += Vx[p] * x[Vi[p]];
}
tau *= beta; /* tau = beta*(v'*x) */
for (p = Vp[i]; p < Vp[i + 1]; p++) /* x = x - v*tau */
{
x[Vi[p]] -= Vx[p] * tau;
}
return (true);
} | java | public static boolean cs_happly(Scs V, int i, float beta, float[] x) {
int p, Vp[], Vi[];
float Vx[], tau = 0;
if (!Scs_util.CS_CSC(V) || x == null)
return (false); /* check inputs */
Vp = V.p;
Vi = V.i;
Vx = V.x;
for (p = Vp[i]; p < Vp[i + 1]; p++) /* tau = v'*x */
{
tau += Vx[p] * x[Vi[p]];
}
tau *= beta; /* tau = beta*(v'*x) */
for (p = Vp[i]; p < Vp[i + 1]; p++) /* x = x - v*tau */
{
x[Vi[p]] -= Vx[p] * tau;
}
return (true);
} | [
"public",
"static",
"boolean",
"cs_happly",
"(",
"Scs",
"V",
",",
"int",
"i",
",",
"float",
"beta",
",",
"float",
"[",
"]",
"x",
")",
"{",
"int",
"p",
",",
"Vp",
"[",
"]",
",",
"Vi",
"[",
"]",
";",
"float",
"Vx",
"[",
"]",
",",
"tau",
"=",
... | Applies a Householder reflection to a dense vector, x = (I -
beta*v*v')*x.
@param V
column-compressed matrix of Householder vectors
@param i
v = V(:,i), the ith column of V
@param beta
scalar beta
@param x
vector x of size m
@return true if successful, false on error | [
"Applies",
"a",
"Householder",
"reflection",
"to",
"a",
"dense",
"vector",
"x",
"=",
"(",
"I",
"-",
"beta",
"*",
"v",
"*",
"v",
")",
"*",
"x",
"."
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_happly.java#L51-L69 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/chrono/Chronology.java | Chronology.ensureChronoLocalDateTime | <D extends ChronoLocalDate> ChronoLocalDateTimeImpl<D> ensureChronoLocalDateTime(Temporal temporal) {
@SuppressWarnings("unchecked")
ChronoLocalDateTimeImpl<D> other = (ChronoLocalDateTimeImpl<D>) temporal;
if (this.equals(other.toLocalDate().getChronology()) == false) {
throw new ClassCastException("Chrono mismatch, required: " + getId()
+ ", supplied: " + other.toLocalDate().getChronology().getId());
}
return other;
} | java | <D extends ChronoLocalDate> ChronoLocalDateTimeImpl<D> ensureChronoLocalDateTime(Temporal temporal) {
@SuppressWarnings("unchecked")
ChronoLocalDateTimeImpl<D> other = (ChronoLocalDateTimeImpl<D>) temporal;
if (this.equals(other.toLocalDate().getChronology()) == false) {
throw new ClassCastException("Chrono mismatch, required: " + getId()
+ ", supplied: " + other.toLocalDate().getChronology().getId());
}
return other;
} | [
"<",
"D",
"extends",
"ChronoLocalDate",
">",
"ChronoLocalDateTimeImpl",
"<",
"D",
">",
"ensureChronoLocalDateTime",
"(",
"Temporal",
"temporal",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"ChronoLocalDateTimeImpl",
"<",
"D",
">",
"other",
"=",
"... | Casts the {@code Temporal} to {@code ChronoLocalDateTime} with the same chronology.
@param temporal a date-time to cast, not null
@return the date-time checked and cast to {@code ChronoLocalDateTime}, not null
@throws ClassCastException if the date-time cannot be cast to ChronoLocalDateTimeImpl
or the chronology is not equal this Chrono | [
"Casts",
"the",
"{",
"@code",
"Temporal",
"}",
"to",
"{",
"@code",
"ChronoLocalDateTime",
"}",
"with",
"the",
"same",
"chronology",
"."
] | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/chrono/Chronology.java#L374-L382 |
phax/ph-commons | ph-security/src/main/java/com/helger/security/certificate/CertificateHelper.java | CertificateHelper.getRFC1421CompliantString | @Nullable
public static String getRFC1421CompliantString (@Nullable final String sCertificate, final boolean bIncludePEMHeader)
{
return getRFC1421CompliantString (sCertificate, bIncludePEMHeader, CRLF);
} | java | @Nullable
public static String getRFC1421CompliantString (@Nullable final String sCertificate, final boolean bIncludePEMHeader)
{
return getRFC1421CompliantString (sCertificate, bIncludePEMHeader, CRLF);
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getRFC1421CompliantString",
"(",
"@",
"Nullable",
"final",
"String",
"sCertificate",
",",
"final",
"boolean",
"bIncludePEMHeader",
")",
"{",
"return",
"getRFC1421CompliantString",
"(",
"sCertificate",
",",
"bIncludePEMHead... | The certificate string needs to be emitted in portions of 64 characters. If
characters are left, than <CR><LF> ("\r\n") must be added to
the string so that the next characters start on a new line. After the last
part, no <CR><LF> is needed. Respective RFC parts are 1421
4.3.2.2 and 4.3.2.4
@param sCertificate
Original certificate string as stored in the DB
@param bIncludePEMHeader
<code>true</code> to include {@link #BEGIN_CERTIFICATE} header and
{@link #END_CERTIFICATE} footer.
@return The RFC 1421 compliant string. May be <code>null</code> if the
original string is <code>null</code> or empty. | [
"The",
"certificate",
"string",
"needs",
"to",
"be",
"emitted",
"in",
"portions",
"of",
"64",
"characters",
".",
"If",
"characters",
"are",
"left",
"than",
"<",
";",
"CR>",
";",
"<",
";",
"LF>",
";",
"(",
"\\",
"r",
"\\",
"n",
")",
"must",
"b... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-security/src/main/java/com/helger/security/certificate/CertificateHelper.java#L138-L142 |
amaembo/streamex | src/main/java/one/util/streamex/IntStreamEx.java | IntStreamEx.zip | public static IntStreamEx zip(int[] first, int[] second, IntBinaryOperator mapper) {
return of(new RangeBasedSpliterator.ZipInt(0, checkLength(first.length, second.length), mapper, first, second));
} | java | public static IntStreamEx zip(int[] first, int[] second, IntBinaryOperator mapper) {
return of(new RangeBasedSpliterator.ZipInt(0, checkLength(first.length, second.length), mapper, first, second));
} | [
"public",
"static",
"IntStreamEx",
"zip",
"(",
"int",
"[",
"]",
"first",
",",
"int",
"[",
"]",
"second",
",",
"IntBinaryOperator",
"mapper",
")",
"{",
"return",
"of",
"(",
"new",
"RangeBasedSpliterator",
".",
"ZipInt",
"(",
"0",
",",
"checkLength",
"(",
... | Returns a sequential {@code IntStreamEx} containing the results of
applying the given function to the corresponding pairs of values in given
two arrays.
@param first the first array
@param second the second array
@param mapper a non-interfering, stateless function to apply to each pair
of the corresponding array elements.
@return a new {@code IntStreamEx}
@throws IllegalArgumentException if length of the arrays differs.
@since 0.2.1 | [
"Returns",
"a",
"sequential",
"{",
"@code",
"IntStreamEx",
"}",
"containing",
"the",
"results",
"of",
"applying",
"the",
"given",
"function",
"to",
"the",
"corresponding",
"pairs",
"of",
"values",
"in",
"given",
"two",
"arrays",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L2623-L2625 |
FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/MultiChangeBuilder.java | MultiChangeBuilder.deleteTextAbsolutely | public MultiChangeBuilder<PS, SEG, S> deleteTextAbsolutely(int start, int end) {
return replaceTextAbsolutely(start, end, "");
} | java | public MultiChangeBuilder<PS, SEG, S> deleteTextAbsolutely(int start, int end) {
return replaceTextAbsolutely(start, end, "");
} | [
"public",
"MultiChangeBuilder",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"deleteTextAbsolutely",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"replaceTextAbsolutely",
"(",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}"
] | Removes a range of text.
It must hold {@code 0 <= start <= end <= getLength()}.
@param start Start position of the range to remove
@param end End position of the range to remove | [
"Removes",
"a",
"range",
"of",
"text",
"."
] | train | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/MultiChangeBuilder.java#L274-L276 |
ops4j/org.ops4j.base | ops4j-base-net/src/main/java/org/ops4j/net/URLUtils.java | URLUtils.prepareForSSL | public static URLConnection prepareForSSL( final URLConnection connection )
{
NullArgumentException.validateNotNull( connection, "url connection cannot be null" );
URLConnection conn = connection;
if( conn instanceof JarURLConnection )
{
try
{
conn = ( (JarURLConnection) connection ).getJarFileURL().openConnection();
conn.connect();
}
catch( IOException e )
{
throw new RuntimeException( "Could not prepare connection for HTTPS.", e );
}
}
if( conn instanceof HttpsURLConnection )
{
try
{
SSLContext ctx = SSLContext.getInstance( "SSLv3" );
ctx.init( null, new TrustManager[]{ new AllCertificatesTrustManager() }, null );
( (HttpsURLConnection) conn ).setSSLSocketFactory( ctx.getSocketFactory() );
}
catch( KeyManagementException e )
{
throw new RuntimeException( "Could not prepare connection for HTTPS.", e );
}
catch( NoSuchAlgorithmException e )
{
throw new RuntimeException( "Could not prepare connection for HTTPS.", e );
}
}
return connection;
} | java | public static URLConnection prepareForSSL( final URLConnection connection )
{
NullArgumentException.validateNotNull( connection, "url connection cannot be null" );
URLConnection conn = connection;
if( conn instanceof JarURLConnection )
{
try
{
conn = ( (JarURLConnection) connection ).getJarFileURL().openConnection();
conn.connect();
}
catch( IOException e )
{
throw new RuntimeException( "Could not prepare connection for HTTPS.", e );
}
}
if( conn instanceof HttpsURLConnection )
{
try
{
SSLContext ctx = SSLContext.getInstance( "SSLv3" );
ctx.init( null, new TrustManager[]{ new AllCertificatesTrustManager() }, null );
( (HttpsURLConnection) conn ).setSSLSocketFactory( ctx.getSocketFactory() );
}
catch( KeyManagementException e )
{
throw new RuntimeException( "Could not prepare connection for HTTPS.", e );
}
catch( NoSuchAlgorithmException e )
{
throw new RuntimeException( "Could not prepare connection for HTTPS.", e );
}
}
return connection;
} | [
"public",
"static",
"URLConnection",
"prepareForSSL",
"(",
"final",
"URLConnection",
"connection",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"connection",
",",
"\"url connection cannot be null\"",
")",
";",
"URLConnection",
"conn",
"=",
"connection",... | Prepares an url connection for authentication if necessary.
@param connection the connection to be prepared
@return the prepared conection | [
"Prepares",
"an",
"url",
"connection",
"for",
"authentication",
"if",
"necessary",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-net/src/main/java/org/ops4j/net/URLUtils.java#L123-L158 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/http/HttpRequestHandler.java | HttpRequestHandler.handleThrowable | public JSONObject handleThrowable(Throwable pThrowable) {
if (pThrowable instanceof IllegalArgumentException) {
return getErrorJSON(400,pThrowable, null);
} else if (pThrowable instanceof SecurityException) {
// Wipe out stacktrace
return getErrorJSON(403,new Exception(pThrowable.getMessage()), null);
} else {
return getErrorJSON(500,pThrowable, null);
}
} | java | public JSONObject handleThrowable(Throwable pThrowable) {
if (pThrowable instanceof IllegalArgumentException) {
return getErrorJSON(400,pThrowable, null);
} else if (pThrowable instanceof SecurityException) {
// Wipe out stacktrace
return getErrorJSON(403,new Exception(pThrowable.getMessage()), null);
} else {
return getErrorJSON(500,pThrowable, null);
}
} | [
"public",
"JSONObject",
"handleThrowable",
"(",
"Throwable",
"pThrowable",
")",
"{",
"if",
"(",
"pThrowable",
"instanceof",
"IllegalArgumentException",
")",
"{",
"return",
"getErrorJSON",
"(",
"400",
",",
"pThrowable",
",",
"null",
")",
";",
"}",
"else",
"if",
... | Utility method for handling single runtime exceptions and errors. This method is called
in addition to and after {@link #executeRequest(JmxRequest)} to catch additional errors.
They are two different methods because of bulk requests, where each individual request can
lead to an error. So, each individual request is wrapped with the error handling of
{@link #executeRequest(JmxRequest)}
whereas the overall handling is wrapped with this method. It is hence more coarse grained,
leading typically to an status code of 500.
Summary: This method should be used as last security belt is some exception should escape
from a single request processing in {@link #executeRequest(JmxRequest)}.
@param pThrowable exception to handle
@return its JSON representation | [
"Utility",
"method",
"for",
"handling",
"single",
"runtime",
"exceptions",
"and",
"errors",
".",
"This",
"method",
"is",
"called",
"in",
"addition",
"to",
"and",
"after",
"{",
"@link",
"#executeRequest",
"(",
"JmxRequest",
")",
"}",
"to",
"catch",
"additional"... | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/http/HttpRequestHandler.java#L237-L246 |
JavaMoney/jsr354-api | src/main/java/javax/money/Monetary.java | Monetary.getRoundings | public static Collection<MonetaryRounding> getRoundings(RoundingQuery roundingQuery) {
return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available."))
.getRoundings(roundingQuery);
} | java | public static Collection<MonetaryRounding> getRoundings(RoundingQuery roundingQuery) {
return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available."))
.getRoundings(roundingQuery);
} | [
"public",
"static",
"Collection",
"<",
"MonetaryRounding",
">",
"getRoundings",
"(",
"RoundingQuery",
"roundingQuery",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"monetaryRoundingsSingletonSpi",
"(",
")",
")",
".",
"orElseThrow",
"(",
"(",
")",
"->",
... | Access multiple {@link MonetaryRounding} instances using a possibly complex query
@param roundingQuery The {@link javax.money.RoundingQuery} that may contains arbitrary parameters to be
evaluated.
@return all {@link javax.money.MonetaryRounding} instances matching the query, never {@code null}. | [
"Access",
"multiple",
"{",
"@link",
"MonetaryRounding",
"}",
"instances",
"using",
"a",
"possibly",
"complex",
"query"
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L248-L252 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/execution/ExecArgList.java | ExecArgList.fromStrings | public static ExecArgList fromStrings(List<String> strings, boolean quoted) {
return builder().args(strings, quoted).build();
} | java | public static ExecArgList fromStrings(List<String> strings, boolean quoted) {
return builder().args(strings, quoted).build();
} | [
"public",
"static",
"ExecArgList",
"fromStrings",
"(",
"List",
"<",
"String",
">",
"strings",
",",
"boolean",
"quoted",
")",
"{",
"return",
"builder",
"(",
")",
".",
"args",
"(",
"strings",
",",
"quoted",
")",
".",
"build",
"(",
")",
";",
"}"
] | @return Create an ExecArgList from a list of strings
@param strings the strings
@param quoted whether they are each quoted | [
"@return",
"Create",
"an",
"ExecArgList",
"from",
"a",
"list",
"of",
"strings"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/ExecArgList.java#L76-L78 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java | ControlBean.getSuperEventSets | private void getSuperEventSets(Class eventSet, List<Class> superEventSets)
{
Class[] superInterfaces = eventSet.getInterfaces();
if (superInterfaces != null)
{
for (int i=0; i < superInterfaces.length; i++)
{
Class superInterface = superInterfaces[i];
if (superInterface.isAnnotationPresent(EventSet.class))
{
superEventSets.add(superInterface);
// Continue traversing up the EventSet inheritance hierarchy
getSuperEventSets(superInterface, superEventSets);
}
}
}
} | java | private void getSuperEventSets(Class eventSet, List<Class> superEventSets)
{
Class[] superInterfaces = eventSet.getInterfaces();
if (superInterfaces != null)
{
for (int i=0; i < superInterfaces.length; i++)
{
Class superInterface = superInterfaces[i];
if (superInterface.isAnnotationPresent(EventSet.class))
{
superEventSets.add(superInterface);
// Continue traversing up the EventSet inheritance hierarchy
getSuperEventSets(superInterface, superEventSets);
}
}
}
} | [
"private",
"void",
"getSuperEventSets",
"(",
"Class",
"eventSet",
",",
"List",
"<",
"Class",
">",
"superEventSets",
")",
"{",
"Class",
"[",
"]",
"superInterfaces",
"=",
"eventSet",
".",
"getInterfaces",
"(",
")",
";",
"if",
"(",
"superInterfaces",
"!=",
"nul... | Finds all of the EventSets extended by the input EventSet, and adds them to
the provided list.
@param eventSet
@param superEventSets | [
"Finds",
"all",
"of",
"the",
"EventSets",
"extended",
"by",
"the",
"input",
"EventSet",
"and",
"adds",
"them",
"to",
"the",
"provided",
"list",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java#L524-L541 |
jlinn/quartz-redis-jobstore | src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java | AbstractRedisStorage.releaseAcquiredTrigger | public void releaseAcquiredTrigger(OperableTrigger trigger, T jedis) throws JobPersistenceException {
final String triggerHashKey = redisSchema.triggerHashKey(trigger.getKey());
if(jedis.zscore(redisSchema.triggerStateKey(RedisTriggerState.ACQUIRED), triggerHashKey) != null){
if(trigger.getNextFireTime() != null){
setTriggerState(RedisTriggerState.WAITING, (double) trigger.getNextFireTime().getTime(), triggerHashKey, jedis);
}
else{
unsetTriggerState(triggerHashKey, jedis);
}
}
} | java | public void releaseAcquiredTrigger(OperableTrigger trigger, T jedis) throws JobPersistenceException {
final String triggerHashKey = redisSchema.triggerHashKey(trigger.getKey());
if(jedis.zscore(redisSchema.triggerStateKey(RedisTriggerState.ACQUIRED), triggerHashKey) != null){
if(trigger.getNextFireTime() != null){
setTriggerState(RedisTriggerState.WAITING, (double) trigger.getNextFireTime().getTime(), triggerHashKey, jedis);
}
else{
unsetTriggerState(triggerHashKey, jedis);
}
}
} | [
"public",
"void",
"releaseAcquiredTrigger",
"(",
"OperableTrigger",
"trigger",
",",
"T",
"jedis",
")",
"throws",
"JobPersistenceException",
"{",
"final",
"String",
"triggerHashKey",
"=",
"redisSchema",
".",
"triggerHashKey",
"(",
"trigger",
".",
"getKey",
"(",
")",
... | Inform the <code>JobStore</code> that the scheduler no longer plans to
fire the given <code>Trigger</code>, that it had previously acquired
(reserved).
@param trigger the trigger to be released
@param jedis a thread-safe Redis connection | [
"Inform",
"the",
"<code",
">",
"JobStore<",
"/",
"code",
">",
"that",
"the",
"scheduler",
"no",
"longer",
"plans",
"to",
"fire",
"the",
"given",
"<code",
">",
"Trigger<",
"/",
"code",
">",
"that",
"it",
"had",
"previously",
"acquired",
"(",
"reserved",
"... | train | https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java#L870-L880 |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/contract/Checks.java | Checks.checkMatches | @Beta
public static void checkMatches(String reference, Pattern pattern) {
checkMatches(reference, pattern, "Expected %s to match '%s'", reference, pattern == null ? "null" : pattern.pattern());
} | java | @Beta
public static void checkMatches(String reference, Pattern pattern) {
checkMatches(reference, pattern, "Expected %s to match '%s'", reference, pattern == null ? "null" : pattern.pattern());
} | [
"@",
"Beta",
"public",
"static",
"void",
"checkMatches",
"(",
"String",
"reference",
",",
"Pattern",
"pattern",
")",
"{",
"checkMatches",
"(",
"reference",
",",
"pattern",
",",
"\"Expected %s to match '%s'\"",
",",
"reference",
",",
"pattern",
"==",
"null",
"?",... | Performs check with the regular expression pattern.
@param reference reference to check
@param pattern the regular expression pattern
@throws IllegalArgumentException if the {@code reference} doesn't match provided regular expression
@see Checks#checkMatches(String, java.util.regex.Pattern, String, Object...) | [
"Performs",
"check",
"with",
"the",
"regular",
"expression",
"pattern",
"."
] | train | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/contract/Checks.java#L360-L363 |
phax/ph-css | ph-css/src/main/java/com/helger/css/reader/CSSReader.java | CSSReader.isValidCSS | public static boolean isValidCSS (@Nonnull @WillClose final InputStream aIS,
@Nonnull final Charset aFallbackCharset,
@Nonnull final ECSSVersion eVersion)
{
ValueEnforcer.notNull (aIS, "InputStream");
ValueEnforcer.notNull (aFallbackCharset, "FallbackCharset");
return isValidCSS (StreamHelper.createReader (aIS, aFallbackCharset), eVersion);
} | java | public static boolean isValidCSS (@Nonnull @WillClose final InputStream aIS,
@Nonnull final Charset aFallbackCharset,
@Nonnull final ECSSVersion eVersion)
{
ValueEnforcer.notNull (aIS, "InputStream");
ValueEnforcer.notNull (aFallbackCharset, "FallbackCharset");
return isValidCSS (StreamHelper.createReader (aIS, aFallbackCharset), eVersion);
} | [
"public",
"static",
"boolean",
"isValidCSS",
"(",
"@",
"Nonnull",
"@",
"WillClose",
"final",
"InputStream",
"aIS",
",",
"@",
"Nonnull",
"final",
"Charset",
"aFallbackCharset",
",",
"@",
"Nonnull",
"final",
"ECSSVersion",
"eVersion",
")",
"{",
"ValueEnforcer",
".... | Check if the passed input stream can be resembled to valid CSS content.
This is accomplished by fully parsing the CSS file each time the method is
called. This is similar to calling
{@link #readFromStream(IHasInputStream,Charset, ECSSVersion)} and checking
for a non-<code>null</code> result.
@param aIS
The input stream to use. Is automatically closed. May not be
<code>null</code>.
@param aFallbackCharset
The charset to be used in case neither a <code>@charset</code> rule
nor a BOM is present. May not be <code>null</code>.
@param eVersion
The CSS version to use. May not be <code>null</code>.
@return <code>true</code> if the CSS is valid according to the version,
<code>false</code> if not | [
"Check",
"if",
"the",
"passed",
"input",
"stream",
"can",
"be",
"resembled",
"to",
"valid",
"CSS",
"content",
".",
"This",
"is",
"accomplished",
"by",
"fully",
"parsing",
"the",
"CSS",
"file",
"each",
"time",
"the",
"method",
"is",
"called",
".",
"This",
... | train | https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/reader/CSSReader.java#L307-L315 |
scireum/s3ninja | src/main/java/ninja/S3Dispatcher.java | S3Dispatcher.startMultipartUpload | private void startMultipartUpload(WebContext ctx, Bucket bucket, String id) {
Response response = ctx.respondWith();
Map<String, String> properties = Maps.newTreeMap();
for (String name : ctx.getRequest().headers().names()) {
String nameLower = name.toLowerCase();
if (nameLower.startsWith("x-amz-meta-") || "content-md5".equals(nameLower) || "content-type".equals(
nameLower) || "x-amz-acl".equals(nameLower)) {
properties.put(name, ctx.getHeader(name));
response.addHeader(name, ctx.getHeader(name));
}
}
response.setHeader(HTTP_HEADER_NAME_CONTENT_TYPE, CONTENT_TYPE_XML);
String uploadId = String.valueOf(uploadIdCounter.inc());
multipartUploads.add(uploadId);
getUploadDir(uploadId).mkdirs();
XMLStructuredOutput out = response.xml();
out.beginOutput("InitiateMultipartUploadResult");
out.property(RESPONSE_BUCKET, bucket.getName());
out.property("Key", id);
out.property("UploadId", uploadId);
out.endOutput();
} | java | private void startMultipartUpload(WebContext ctx, Bucket bucket, String id) {
Response response = ctx.respondWith();
Map<String, String> properties = Maps.newTreeMap();
for (String name : ctx.getRequest().headers().names()) {
String nameLower = name.toLowerCase();
if (nameLower.startsWith("x-amz-meta-") || "content-md5".equals(nameLower) || "content-type".equals(
nameLower) || "x-amz-acl".equals(nameLower)) {
properties.put(name, ctx.getHeader(name));
response.addHeader(name, ctx.getHeader(name));
}
}
response.setHeader(HTTP_HEADER_NAME_CONTENT_TYPE, CONTENT_TYPE_XML);
String uploadId = String.valueOf(uploadIdCounter.inc());
multipartUploads.add(uploadId);
getUploadDir(uploadId).mkdirs();
XMLStructuredOutput out = response.xml();
out.beginOutput("InitiateMultipartUploadResult");
out.property(RESPONSE_BUCKET, bucket.getName());
out.property("Key", id);
out.property("UploadId", uploadId);
out.endOutput();
} | [
"private",
"void",
"startMultipartUpload",
"(",
"WebContext",
"ctx",
",",
"Bucket",
"bucket",
",",
"String",
"id",
")",
"{",
"Response",
"response",
"=",
"ctx",
".",
"respondWith",
"(",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
"=",... | Handles POST /bucket/id?uploads
@param ctx the context describing the current request
@param bucket the bucket containing the object to upload
@param id name of the object to upload | [
"Handles",
"POST",
"/",
"bucket",
"/",
"id?uploads"
] | train | https://github.com/scireum/s3ninja/blob/445eec55c91780267a7f987818b3fedecae009c5/src/main/java/ninja/S3Dispatcher.java#L634-L659 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwprofile_binding.java | appfwprofile_binding.get | public static appfwprofile_binding get(nitro_service service, String name) throws Exception{
appfwprofile_binding obj = new appfwprofile_binding();
obj.set_name(name);
appfwprofile_binding response = (appfwprofile_binding) obj.get_resource(service);
return response;
} | java | public static appfwprofile_binding get(nitro_service service, String name) throws Exception{
appfwprofile_binding obj = new appfwprofile_binding();
obj.set_name(name);
appfwprofile_binding response = (appfwprofile_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"appfwprofile_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"appfwprofile_binding",
"obj",
"=",
"new",
"appfwprofile_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")"... | Use this API to fetch appfwprofile_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"appfwprofile_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwprofile_binding.java#L290-L295 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.serviceName_requestTotalDeconsolidation_POST | public OvhTask serviceName_requestTotalDeconsolidation_POST(String serviceName, Boolean noPortability, String rio) throws IOException {
String qPath = "/xdsl/{serviceName}/requestTotalDeconsolidation";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "noPortability", noPortability);
addBody(o, "rio", rio);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_requestTotalDeconsolidation_POST(String serviceName, Boolean noPortability, String rio) throws IOException {
String qPath = "/xdsl/{serviceName}/requestTotalDeconsolidation";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "noPortability", noPortability);
addBody(o, "rio", rio);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_requestTotalDeconsolidation_POST",
"(",
"String",
"serviceName",
",",
"Boolean",
"noPortability",
",",
"String",
"rio",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/xdsl/{serviceName}/requestTotalDeconsolidation\"",
";",
"... | Switch this access to total deconsolidation
REST: POST /xdsl/{serviceName}/requestTotalDeconsolidation
@param noPortability [required] Do not port the number
@param rio [required] A token to prove the ownership of the line number, needed to port the number
@param serviceName [required] The internal name of your XDSL offer | [
"Switch",
"this",
"access",
"to",
"total",
"deconsolidation"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1730-L1738 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/MethodAnnotation.java | MethodAnnotation.fromCalledMethod | public static MethodAnnotation fromCalledMethod(DismantleBytecode visitor) {
String className = visitor.getDottedClassConstantOperand();
String methodName = visitor.getNameConstantOperand();
String methodSig = visitor.getSigConstantOperand();
if (visitor instanceof OpcodeStackDetector && visitor.getOpcode() != Const.INVOKESTATIC) {
int params = PreorderVisitor.getNumberArguments(methodSig);
OpcodeStackDetector oVisitor = (OpcodeStackDetector) visitor;
if (!oVisitor.getStack().isTop() && oVisitor.getStack().getStackDepth() > params) {
OpcodeStack.Item item = oVisitor.getStack().getStackItem(params);
String cName = ClassName.fromFieldSignature(item.getSignature());
if (cName != null) {
className = cName;
}
}
}
return fromCalledMethod(className, methodName, methodSig, visitor.getOpcode() == Const.INVOKESTATIC);
} | java | public static MethodAnnotation fromCalledMethod(DismantleBytecode visitor) {
String className = visitor.getDottedClassConstantOperand();
String methodName = visitor.getNameConstantOperand();
String methodSig = visitor.getSigConstantOperand();
if (visitor instanceof OpcodeStackDetector && visitor.getOpcode() != Const.INVOKESTATIC) {
int params = PreorderVisitor.getNumberArguments(methodSig);
OpcodeStackDetector oVisitor = (OpcodeStackDetector) visitor;
if (!oVisitor.getStack().isTop() && oVisitor.getStack().getStackDepth() > params) {
OpcodeStack.Item item = oVisitor.getStack().getStackItem(params);
String cName = ClassName.fromFieldSignature(item.getSignature());
if (cName != null) {
className = cName;
}
}
}
return fromCalledMethod(className, methodName, methodSig, visitor.getOpcode() == Const.INVOKESTATIC);
} | [
"public",
"static",
"MethodAnnotation",
"fromCalledMethod",
"(",
"DismantleBytecode",
"visitor",
")",
"{",
"String",
"className",
"=",
"visitor",
".",
"getDottedClassConstantOperand",
"(",
")",
";",
"String",
"methodName",
"=",
"visitor",
".",
"getNameConstantOperand",
... | Factory method to create a MethodAnnotation from a method called by the
instruction the given visitor is currently visiting.
@param visitor
the visitor
@return the MethodAnnotation representing the called method | [
"Factory",
"method",
"to",
"create",
"a",
"MethodAnnotation",
"from",
"a",
"method",
"called",
"by",
"the",
"instruction",
"the",
"given",
"visitor",
"is",
"currently",
"visiting",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/MethodAnnotation.java#L144-L164 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/StringUtils.java | StringUtils.stringToProperties | public static Properties stringToProperties(String str) {
Properties result = new Properties();
return stringToProperties(str, result);
} | java | public static Properties stringToProperties(String str) {
Properties result = new Properties();
return stringToProperties(str, result);
} | [
"public",
"static",
"Properties",
"stringToProperties",
"(",
"String",
"str",
")",
"{",
"Properties",
"result",
"=",
"new",
"Properties",
"(",
")",
";",
"return",
"stringToProperties",
"(",
"str",
",",
"result",
")",
";",
"}"
] | This method converts a comma-separated String (with whitespace
optionally allowed after the comma) representing properties
to a Properties object. Each property is "property=value". The value
for properties without an explicitly given value is set to "true". This can be used for a 2nd level
of properties, for example, when you have a commandline argument like "-outputOptions style=xml,tags". | [
"This",
"method",
"converts",
"a",
"comma",
"-",
"separated",
"String",
"(",
"with",
"whitespace",
"optionally",
"allowed",
"after",
"the",
"comma",
")",
"representing",
"properties",
"to",
"a",
"Properties",
"object",
".",
"Each",
"property",
"is",
"property",
... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/StringUtils.java#L827-L830 |
google/Accessibility-Test-Framework-for-Android | src/main/java/com/googlecode/eyesfree/utils/AccessibilityNodeInfoUtils.java | AccessibilityNodeInfoUtils.isLongClickable | public static boolean isLongClickable(AccessibilityNodeInfoCompat node) {
if (node == null) {
return false;
}
if (node.isLongClickable()) {
return true;
}
return supportsAnyAction(node, AccessibilityNodeInfoCompat.ACTION_LONG_CLICK);
} | java | public static boolean isLongClickable(AccessibilityNodeInfoCompat node) {
if (node == null) {
return false;
}
if (node.isLongClickable()) {
return true;
}
return supportsAnyAction(node, AccessibilityNodeInfoCompat.ACTION_LONG_CLICK);
} | [
"public",
"static",
"boolean",
"isLongClickable",
"(",
"AccessibilityNodeInfoCompat",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"node",
".",
"isLongClickable",
"(",
")",
")",
"{",
"return",
"true",... | Returns whether a node is long clickable. That is, the node supports at least one of the
following:
<ul>
<li>{@link AccessibilityNodeInfoCompat#isLongClickable()}</li>
<li>{@link AccessibilityNodeInfoCompat#ACTION_LONG_CLICK}</li>
</ul>
@param node The node to examine.
@return {@code true} if node is long clickable. | [
"Returns",
"whether",
"a",
"node",
"is",
"long",
"clickable",
".",
"That",
"is",
"the",
"node",
"supports",
"at",
"least",
"one",
"of",
"the",
"following",
":",
"<ul",
">",
"<li",
">",
"{",
"@link",
"AccessibilityNodeInfoCompat#isLongClickable",
"()",
"}",
"... | train | https://github.com/google/Accessibility-Test-Framework-for-Android/blob/a6117fe0059c82dd764fa628d3817d724570f69e/src/main/java/com/googlecode/eyesfree/utils/AccessibilityNodeInfoUtils.java#L387-L397 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/DescriptorFactory.java | DescriptorFactory.getFieldDescriptor | public FieldDescriptor getFieldDescriptor(@SlashedClassName String className, String name, String signature, boolean isStatic) {
FieldDescriptor fieldDescriptor = new FieldDescriptor(className, name, signature, isStatic);
FieldDescriptor existing = fieldDescriptorMap.get(fieldDescriptor);
if (existing == null) {
fieldDescriptorMap.put(fieldDescriptor, fieldDescriptor);
existing = fieldDescriptor;
}
return existing;
} | java | public FieldDescriptor getFieldDescriptor(@SlashedClassName String className, String name, String signature, boolean isStatic) {
FieldDescriptor fieldDescriptor = new FieldDescriptor(className, name, signature, isStatic);
FieldDescriptor existing = fieldDescriptorMap.get(fieldDescriptor);
if (existing == null) {
fieldDescriptorMap.put(fieldDescriptor, fieldDescriptor);
existing = fieldDescriptor;
}
return existing;
} | [
"public",
"FieldDescriptor",
"getFieldDescriptor",
"(",
"@",
"SlashedClassName",
"String",
"className",
",",
"String",
"name",
",",
"String",
"signature",
",",
"boolean",
"isStatic",
")",
"{",
"FieldDescriptor",
"fieldDescriptor",
"=",
"new",
"FieldDescriptor",
"(",
... | Get a FieldDescriptor.
@param className
the name of the class the field belongs to, in VM format
(e.g., "java/lang/String")
@param name
the name of the field
@param signature
the field signature (type)
@param isStatic
true if field is static, false if not
@return FieldDescriptor | [
"Get",
"a",
"FieldDescriptor",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/DescriptorFactory.java#L239-L247 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/collection/impl/txnqueue/TransactionalQueueProxySupport.java | TransactionalQueueProxySupport.offerInternal | boolean offerInternal(Data data, long timeout) {
TxnReserveOfferOperation operation
= new TxnReserveOfferOperation(name, timeout, offeredQueue.size(), tx.getTxnId());
operation.setCallerUuid(tx.getOwnerUuid());
try {
Future<Long> future = invoke(operation);
Long itemId = future.get();
if (itemId != null) {
if (!itemIdSet.add(itemId)) {
throw new TransactionException("Duplicate itemId: " + itemId);
}
offeredQueue.offer(new QueueItem(null, itemId, data));
TxnOfferOperation txnOfferOperation = new TxnOfferOperation(name, itemId, data);
putToRecord(txnOfferOperation);
return true;
}
} catch (Throwable t) {
throw ExceptionUtil.rethrow(t);
}
return false;
} | java | boolean offerInternal(Data data, long timeout) {
TxnReserveOfferOperation operation
= new TxnReserveOfferOperation(name, timeout, offeredQueue.size(), tx.getTxnId());
operation.setCallerUuid(tx.getOwnerUuid());
try {
Future<Long> future = invoke(operation);
Long itemId = future.get();
if (itemId != null) {
if (!itemIdSet.add(itemId)) {
throw new TransactionException("Duplicate itemId: " + itemId);
}
offeredQueue.offer(new QueueItem(null, itemId, data));
TxnOfferOperation txnOfferOperation = new TxnOfferOperation(name, itemId, data);
putToRecord(txnOfferOperation);
return true;
}
} catch (Throwable t) {
throw ExceptionUtil.rethrow(t);
}
return false;
} | [
"boolean",
"offerInternal",
"(",
"Data",
"data",
",",
"long",
"timeout",
")",
"{",
"TxnReserveOfferOperation",
"operation",
"=",
"new",
"TxnReserveOfferOperation",
"(",
"name",
",",
"timeout",
",",
"offeredQueue",
".",
"size",
"(",
")",
",",
"tx",
".",
"getTxn... | Tries to accomodate one more item in the queue in addition to the
already offered items. If it succeeds by getting an item ID, it will
add the item to the
Makes a reservation for a {@link TransactionalQueue#offer} operation
and adds the commit operation to the transaction log.
@param data the serialised item being offered
@param timeout the wait timeout in milliseconds for the offer reservation
@return {@code true} if the item reservation was made
@see TxnReserveOfferOperation
@see TxnOfferOperation | [
"Tries",
"to",
"accomodate",
"one",
"more",
"item",
"in",
"the",
"queue",
"in",
"addition",
"to",
"the",
"already",
"offered",
"items",
".",
"If",
"it",
"succeeds",
"by",
"getting",
"an",
"item",
"ID",
"it",
"will",
"add",
"the",
"item",
"to",
"the",
"... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/collection/impl/txnqueue/TransactionalQueueProxySupport.java#L111-L131 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/xtend-gen/org/eclipse/xtext/xbase/compiler/LoopExtensions.java | LoopExtensions.forEachWithShortcut | public <T extends Object> void forEachWithShortcut(final ITreeAppendable appendable, final Iterable<T> elements, final Procedure1<? super T> procedure) {
int _size = IterableExtensions.size(elements);
boolean _equals = (_size == 1);
if (_equals) {
T _head = IterableExtensions.<T>head(elements);
ObjectExtensions.<T>operator_doubleArrow(_head, procedure);
} else {
appendable.append("{");
final Procedure1<LoopParams> _function = (LoopParams it) -> {
it.setPrefix(" ");
it.setSeparator(", ");
it.setSuffix(" ");
};
this.<T>forEach(appendable, elements, _function, procedure);
appendable.append("}");
}
} | java | public <T extends Object> void forEachWithShortcut(final ITreeAppendable appendable, final Iterable<T> elements, final Procedure1<? super T> procedure) {
int _size = IterableExtensions.size(elements);
boolean _equals = (_size == 1);
if (_equals) {
T _head = IterableExtensions.<T>head(elements);
ObjectExtensions.<T>operator_doubleArrow(_head, procedure);
} else {
appendable.append("{");
final Procedure1<LoopParams> _function = (LoopParams it) -> {
it.setPrefix(" ");
it.setSeparator(", ");
it.setSuffix(" ");
};
this.<T>forEach(appendable, elements, _function, procedure);
appendable.append("}");
}
} | [
"public",
"<",
"T",
"extends",
"Object",
">",
"void",
"forEachWithShortcut",
"(",
"final",
"ITreeAppendable",
"appendable",
",",
"final",
"Iterable",
"<",
"T",
">",
"elements",
",",
"final",
"Procedure1",
"<",
"?",
"super",
"T",
">",
"procedure",
")",
"{",
... | Uses curly braces and comma as delimiters. Doesn't use them for single valued iterables. | [
"Uses",
"curly",
"braces",
"and",
"comma",
"as",
"delimiters",
".",
"Doesn",
"t",
"use",
"them",
"for",
"single",
"valued",
"iterables",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/xtend-gen/org/eclipse/xtext/xbase/compiler/LoopExtensions.java#L47-L63 |
the-fascinator/plugin-authentication-internal | src/main/java/com/googlecode/fascinator/authentication/internal/InternalAuthentication.java | InternalAuthentication.deleteUser | @Override
public void deleteUser(String username) throws AuthenticationException {
String user = file_store.getProperty(username);
if (user == null) {
throw new AuthenticationException("User '" + username
+ "' not found.");
}
file_store.remove(username);
try {
saveUsers();
} catch (IOException e) {
throw new AuthenticationException("Error deleting user: ", e);
}
} | java | @Override
public void deleteUser(String username) throws AuthenticationException {
String user = file_store.getProperty(username);
if (user == null) {
throw new AuthenticationException("User '" + username
+ "' not found.");
}
file_store.remove(username);
try {
saveUsers();
} catch (IOException e) {
throw new AuthenticationException("Error deleting user: ", e);
}
} | [
"@",
"Override",
"public",
"void",
"deleteUser",
"(",
"String",
"username",
")",
"throws",
"AuthenticationException",
"{",
"String",
"user",
"=",
"file_store",
".",
"getProperty",
"(",
"username",
")",
";",
"if",
"(",
"user",
"==",
"null",
")",
"{",
"throw",... | Delete a user.
@param username The username of the user to delete.
@throws AuthenticationException if there was an error during deletion. | [
"Delete",
"a",
"user",
"."
] | train | https://github.com/the-fascinator/plugin-authentication-internal/blob/a2b9a0eda9b43bf20583036a406c83c938be3042/src/main/java/com/googlecode/fascinator/authentication/internal/InternalAuthentication.java#L345-L358 |
tdunning/t-digest | core/src/main/java/com/tdunning/math/stats/Comparison.java | Comparison.compareChi2 | @SuppressWarnings("WeakerAccess")
public static double compareChi2(Histogram dist1, Histogram dist2) {
if (!dist1.getClass().equals(dist2.getClass())) {
throw new IllegalArgumentException(String.format("Must have same class arguments, got %s and %s",
dist1.getClass(), dist2.getClass()));
}
long[] k1 = dist1.getCounts();
long[] k2 = dist2.getCounts();
int n1 = k1.length;
if (n1 != k2.length ||
dist1.lowerBound(0) != dist2.lowerBound(0) ||
dist1.lowerBound(n1 - 1) != dist2.lowerBound(n1 - 1)) {
throw new IllegalArgumentException("Incompatible histograms in terms of size or bounds");
}
double[][] count = new double[2][n1];
for (int i = 0; i < n1; i++) {
count[0][i] = k1[i];
count[1][i] = k2[i];
}
return llr(count);
} | java | @SuppressWarnings("WeakerAccess")
public static double compareChi2(Histogram dist1, Histogram dist2) {
if (!dist1.getClass().equals(dist2.getClass())) {
throw new IllegalArgumentException(String.format("Must have same class arguments, got %s and %s",
dist1.getClass(), dist2.getClass()));
}
long[] k1 = dist1.getCounts();
long[] k2 = dist2.getCounts();
int n1 = k1.length;
if (n1 != k2.length ||
dist1.lowerBound(0) != dist2.lowerBound(0) ||
dist1.lowerBound(n1 - 1) != dist2.lowerBound(n1 - 1)) {
throw new IllegalArgumentException("Incompatible histograms in terms of size or bounds");
}
double[][] count = new double[2][n1];
for (int i = 0; i < n1; i++) {
count[0][i] = k1[i];
count[1][i] = k2[i];
}
return llr(count);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"static",
"double",
"compareChi2",
"(",
"Histogram",
"dist1",
",",
"Histogram",
"dist2",
")",
"{",
"if",
"(",
"!",
"dist1",
".",
"getClass",
"(",
")",
".",
"equals",
"(",
"dist2",
".",
"getCl... | Use a log-likelihood ratio test to compare two distributions.
With non-linear histograms that have compatible bin boundaries,
all that we have to do is compare two count vectors using a
chi^2 test (actually a log-likelihood ratio version called a G-test).
@param dist1 First distribution (usually the reference)
@param dist2 Second distribution to compare (usually the test case)
@return A score that is big when dist1 and dist2 are discernibly different.
A small score does not mean similarity. Instead, it could just mean insufficient
data. | [
"Use",
"a",
"log",
"-",
"likelihood",
"ratio",
"test",
"to",
"compare",
"two",
"distributions",
".",
"With",
"non",
"-",
"linear",
"histograms",
"that",
"have",
"compatible",
"bin",
"boundaries",
"all",
"that",
"we",
"have",
"to",
"do",
"is",
"compare",
"t... | train | https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/Comparison.java#L89-L112 |
mbrade/prefixedproperties | pp-spring/src/main/java/net/sf/prefixedproperties/spring/PrefixedPropertiesPersister.java | PrefixedPropertiesPersister.loadFromJson | public void loadFromJson(final Properties props, final Reader rd) throws IOException {
try {
((PrefixedProperties) props).loadFromJSON(rd);
} catch (final NoSuchMethodError err) {
throw new IOException(
"Cannot load properties JSON file - not using PrefixedProperties: " + err.getMessage());
}
} | java | public void loadFromJson(final Properties props, final Reader rd) throws IOException {
try {
((PrefixedProperties) props).loadFromJSON(rd);
} catch (final NoSuchMethodError err) {
throw new IOException(
"Cannot load properties JSON file - not using PrefixedProperties: " + err.getMessage());
}
} | [
"public",
"void",
"loadFromJson",
"(",
"final",
"Properties",
"props",
",",
"final",
"Reader",
"rd",
")",
"throws",
"IOException",
"{",
"try",
"{",
"(",
"(",
"PrefixedProperties",
")",
"props",
")",
".",
"loadFromJSON",
"(",
"rd",
")",
";",
"}",
"catch",
... | Load from json.
@param props
the props
@param rd
the rd
@throws IOException
Signals that an I/O exception has occurred. | [
"Load",
"from",
"json",
"."
] | train | https://github.com/mbrade/prefixedproperties/blob/ac430409ea37e244158002b3cf1504417835a0b2/pp-spring/src/main/java/net/sf/prefixedproperties/spring/PrefixedPropertiesPersister.java#L72-L79 |
julienledem/brennus | brennus-builder/src/main/java/brennus/ClassBuilder.java | ClassBuilder.startStaticMethod | public MethodDeclarationBuilder startStaticMethod(Protection protection, Type returnType, String methodName) {
return startMethod(protection, returnType, methodName, true);
} | java | public MethodDeclarationBuilder startStaticMethod(Protection protection, Type returnType, String methodName) {
return startMethod(protection, returnType, methodName, true);
} | [
"public",
"MethodDeclarationBuilder",
"startStaticMethod",
"(",
"Protection",
"protection",
",",
"Type",
"returnType",
",",
"String",
"methodName",
")",
"{",
"return",
"startMethod",
"(",
"protection",
",",
"returnType",
",",
"methodName",
",",
"true",
")",
";",
"... | .startStaticMethod(protection, return, name){statements}.endMethod()
@param protection public/package/protected/private
@param returnType
@param methodName
@return a MethodDeclarationBuilder | [
".",
"startStaticMethod",
"(",
"protection",
"return",
"name",
")",
"{",
"statements",
"}",
".",
"endMethod",
"()"
] | train | https://github.com/julienledem/brennus/blob/0798fb565d95af19ddc5accd084e58c4e882dbd0/brennus-builder/src/main/java/brennus/ClassBuilder.java#L104-L106 |
spring-projects/spring-social-twitter | spring-social-twitter/src/main/java/org/springframework/social/twitter/api/AbstractStreamParameters.java | AbstractStreamParameters.addLocation | public AbstractStreamParameters addLocation(float west, float south, float east, float north) {
if (locations.length() > 0) {
locations.append(',');
}
locations.append(west).append(',').append(south).append(',');
locations.append(east).append(',').append(north).append(',');
return this;
} | java | public AbstractStreamParameters addLocation(float west, float south, float east, float north) {
if (locations.length() > 0) {
locations.append(',');
}
locations.append(west).append(',').append(south).append(',');
locations.append(east).append(',').append(north).append(',');
return this;
} | [
"public",
"AbstractStreamParameters",
"addLocation",
"(",
"float",
"west",
",",
"float",
"south",
",",
"float",
"east",
",",
"float",
"north",
")",
"{",
"if",
"(",
"locations",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"locations",
".",
"append",
"(",... | Add a location to the filter
Does not replace any existing locations in the filter.
@param west the longitude of the western side of the location's bounding box.
@param south the latitude of the southern side of the location's bounding box.
@param east the longitude of the eastern side of the location's bounding box.
@param north the latitude of the northern side of the location's bounding box.
@return this StreamFilter for building up filter parameters. | [
"Add",
"a",
"location",
"to",
"the",
"filter",
"Does",
"not",
"replace",
"any",
"existing",
"locations",
"in",
"the",
"filter",
"."
] | train | https://github.com/spring-projects/spring-social-twitter/blob/5df7b3556d7bdbe7db8d833f30141336b5552178/spring-social-twitter/src/main/java/org/springframework/social/twitter/api/AbstractStreamParameters.java#L61-L68 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.