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 |
|---|---|---|---|---|---|---|---|---|---|---|
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java | DifferentialFunctionFactory.randomExponential | public SDVariable randomExponential(double lambda, SDVariable shape) {
return new RandomExponential(sameDiff(), shape, lambda).outputVariable();
} | java | public SDVariable randomExponential(double lambda, SDVariable shape) {
return new RandomExponential(sameDiff(), shape, lambda).outputVariable();
} | [
"public",
"SDVariable",
"randomExponential",
"(",
"double",
"lambda",
",",
"SDVariable",
"shape",
")",
"{",
"return",
"new",
"RandomExponential",
"(",
"sameDiff",
"(",
")",
",",
"shape",
",",
"lambda",
")",
".",
"outputVariable",
"(",
")",
";",
"}"
] | Exponential distribution: P(x) = lambda * exp(-lambda * x)
@param lambda Must be > 0
@param shape Shape of the output | [
"Exponential",
"distribution",
":",
"P",
"(",
"x",
")",
"=",
"lambda",
"*",
"exp",
"(",
"-",
"lambda",
"*",
"x",
")"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java#L240-L242 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java | QrCodeUtil.decode | public static String decode(Image image, boolean isTryHarder, boolean isPureBarcode) {
final MultiFormatReader formatReader = new MultiFormatReader();
final LuminanceSource source = new BufferedImageLuminanceSource(ImgUtil.toBufferedImage(image));
final Binarizer binarizer = new HybridBinarizer(source);
final BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer);
final HashMap<DecodeHintType, Object> hints = new HashMap<>();
hints.put(DecodeHintType.CHARACTER_SET, CharsetUtil.UTF_8);
// 优化精度
hints.put(DecodeHintType.TRY_HARDER, Boolean.valueOf(isTryHarder));
// 复杂模式,开启PURE_BARCODE模式
hints.put(DecodeHintType.PURE_BARCODE, Boolean.valueOf(isPureBarcode));
Result result;
try {
result = formatReader.decode(binaryBitmap, hints);
} catch (NotFoundException e) {
// 报错尝试关闭复杂模式
hints.remove(DecodeHintType.PURE_BARCODE);
try {
result = formatReader.decode(binaryBitmap, hints);
} catch (NotFoundException e1) {
throw new QrCodeException(e1);
}
}
return result.getText();
} | java | public static String decode(Image image, boolean isTryHarder, boolean isPureBarcode) {
final MultiFormatReader formatReader = new MultiFormatReader();
final LuminanceSource source = new BufferedImageLuminanceSource(ImgUtil.toBufferedImage(image));
final Binarizer binarizer = new HybridBinarizer(source);
final BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer);
final HashMap<DecodeHintType, Object> hints = new HashMap<>();
hints.put(DecodeHintType.CHARACTER_SET, CharsetUtil.UTF_8);
// 优化精度
hints.put(DecodeHintType.TRY_HARDER, Boolean.valueOf(isTryHarder));
// 复杂模式,开启PURE_BARCODE模式
hints.put(DecodeHintType.PURE_BARCODE, Boolean.valueOf(isPureBarcode));
Result result;
try {
result = formatReader.decode(binaryBitmap, hints);
} catch (NotFoundException e) {
// 报错尝试关闭复杂模式
hints.remove(DecodeHintType.PURE_BARCODE);
try {
result = formatReader.decode(binaryBitmap, hints);
} catch (NotFoundException e1) {
throw new QrCodeException(e1);
}
}
return result.getText();
} | [
"public",
"static",
"String",
"decode",
"(",
"Image",
"image",
",",
"boolean",
"isTryHarder",
",",
"boolean",
"isPureBarcode",
")",
"{",
"final",
"MultiFormatReader",
"formatReader",
"=",
"new",
"MultiFormatReader",
"(",
")",
";",
"final",
"LuminanceSource",
"sour... | 将二维码图片解码为文本
@param image {@link Image} 二维码图片
@param isTryHarder 是否优化精度
@param isPureBarcode 是否使用复杂模式,扫描带logo的二维码设为true
@return 解码后的文本
@since 4.3.1 | [
"将二维码图片解码为文本"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L303-L330 |
openengsb/openengsb | components/weaver/service/src/main/java/org/openengsb/core/weaver/service/internal/model/ManipulationUtils.java | ManipulationUtils.getFieldGetter | private static CtMethod getFieldGetter(CtField field, CtClass clazz, boolean failover) throws NotFoundException {
CtMethod method = new CtMethod(field.getType(), "descCreateMethod", new CtClass[]{}, clazz);
String desc = method.getSignature();
String getter = getPropertyGetter(field, failover);
try {
return clazz.getMethod(getter, desc);
} catch (NotFoundException e) {
// try once again with getXXX instead of isXXX
if (isBooleanType(field)) {
return getFieldGetter(field, clazz, true);
}
LOGGER.debug(String.format("No getter with the name '%s' and the description '%s' found", getter, desc));
return null;
}
} | java | private static CtMethod getFieldGetter(CtField field, CtClass clazz, boolean failover) throws NotFoundException {
CtMethod method = new CtMethod(field.getType(), "descCreateMethod", new CtClass[]{}, clazz);
String desc = method.getSignature();
String getter = getPropertyGetter(field, failover);
try {
return clazz.getMethod(getter, desc);
} catch (NotFoundException e) {
// try once again with getXXX instead of isXXX
if (isBooleanType(field)) {
return getFieldGetter(field, clazz, true);
}
LOGGER.debug(String.format("No getter with the name '%s' and the description '%s' found", getter, desc));
return null;
}
} | [
"private",
"static",
"CtMethod",
"getFieldGetter",
"(",
"CtField",
"field",
",",
"CtClass",
"clazz",
",",
"boolean",
"failover",
")",
"throws",
"NotFoundException",
"{",
"CtMethod",
"method",
"=",
"new",
"CtMethod",
"(",
"field",
".",
"getType",
"(",
")",
",",... | Returns the getter method in case it exists or returns null if this is not the case. The failover parameter is
needed to deal with boolean types, since it should be allowed to allow getters in the form of "isXXX" or
"getXXX". | [
"Returns",
"the",
"getter",
"method",
"in",
"case",
"it",
"exists",
"or",
"returns",
"null",
"if",
"this",
"is",
"not",
"the",
"case",
".",
"The",
"failover",
"parameter",
"is",
"needed",
"to",
"deal",
"with",
"boolean",
"types",
"since",
"it",
"should",
... | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/weaver/service/src/main/java/org/openengsb/core/weaver/service/internal/model/ManipulationUtils.java#L447-L461 |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/SpringContextUtils.java | SpringContextUtils.contextMergedBeans | public static ApplicationContext contextMergedBeans(String xmlPath, Map<String, ?> extraBeans) {
final DefaultListableBeanFactory parentBeanFactory = buildListableBeanFactory(extraBeans);
//loads the xml and add definitions in the context
GenericApplicationContext parentContext = new GenericApplicationContext(parentBeanFactory);
XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(parentContext);
xmlReader.loadBeanDefinitions(xmlPath);
//refreshed the context to create class and make autowires
parentContext.refresh();
//return the created context
return parentContext;
} | java | public static ApplicationContext contextMergedBeans(String xmlPath, Map<String, ?> extraBeans) {
final DefaultListableBeanFactory parentBeanFactory = buildListableBeanFactory(extraBeans);
//loads the xml and add definitions in the context
GenericApplicationContext parentContext = new GenericApplicationContext(parentBeanFactory);
XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(parentContext);
xmlReader.loadBeanDefinitions(xmlPath);
//refreshed the context to create class and make autowires
parentContext.refresh();
//return the created context
return parentContext;
} | [
"public",
"static",
"ApplicationContext",
"contextMergedBeans",
"(",
"String",
"xmlPath",
",",
"Map",
"<",
"String",
",",
"?",
">",
"extraBeans",
")",
"{",
"final",
"DefaultListableBeanFactory",
"parentBeanFactory",
"=",
"buildListableBeanFactory",
"(",
"extraBeans",
... | Loads a context from a XML and inject all objects in the Map
@param xmlPath Path for the xml applicationContext
@param extraBeans Extra beans for being injected
@return ApplicationContext generated | [
"Loads",
"a",
"context",
"from",
"a",
"XML",
"and",
"inject",
"all",
"objects",
"in",
"the",
"Map"
] | train | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/SpringContextUtils.java#L31-L44 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/HttpJsonRpcClient.java | HttpJsonRpcClient.doPost | public RequestResponse doPost(String url, Map<String, Object> headers,
Map<String, Object> urlParams, Object requestData) {
RequestResponse rr = initRequestResponse("POST", url, headers, urlParams, requestData);
Request.Builder requestBuilder = buildRequest(url, headers, urlParams)
.post(buildRequestBody(rr));
return doCall(client, requestBuilder.build(), rr);
} | java | public RequestResponse doPost(String url, Map<String, Object> headers,
Map<String, Object> urlParams, Object requestData) {
RequestResponse rr = initRequestResponse("POST", url, headers, urlParams, requestData);
Request.Builder requestBuilder = buildRequest(url, headers, urlParams)
.post(buildRequestBody(rr));
return doCall(client, requestBuilder.build(), rr);
} | [
"public",
"RequestResponse",
"doPost",
"(",
"String",
"url",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"headers",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"urlParams",
",",
"Object",
"requestData",
")",
"{",
"RequestResponse",
"rr",
"=",
"initRe... | Perform a POST request.
@param url
@param headers
@param urlParams
@param requestData
@return | [
"Perform",
"a",
"POST",
"request",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/HttpJsonRpcClient.java#L214-L220 |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/util/xml/QNameUtilities.java | QNameUtilities.getQualifiedName | public static final String getQualifiedName(String localName, String pfx) {
pfx = pfx == null ? "" : pfx;
return pfx.length() == 0 ? localName
: (pfx + Constants.COLON + localName);
} | java | public static final String getQualifiedName(String localName, String pfx) {
pfx = pfx == null ? "" : pfx;
return pfx.length() == 0 ? localName
: (pfx + Constants.COLON + localName);
} | [
"public",
"static",
"final",
"String",
"getQualifiedName",
"(",
"String",
"localName",
",",
"String",
"pfx",
")",
"{",
"pfx",
"=",
"pfx",
"==",
"null",
"?",
"\"\"",
":",
"pfx",
";",
"return",
"pfx",
".",
"length",
"(",
")",
"==",
"0",
"?",
"localName",... | Returns qualified name as String
<p>
QName ::= PrefixedName | UnprefixedName <br>
PrefixedName ::= Prefix ':' LocalPart <br>
UnprefixedName ::= LocalPart
</p>
@param localName
local-name
@param pfx
prefix
@return <code>String</code> for qname | [
"Returns",
"qualified",
"name",
"as",
"String"
] | train | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/util/xml/QNameUtilities.java#L85-L89 |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/parser/DummyParser.java | DummyParser.parse | @Override
public ParseResult parse(Source source) {
if (!testSrcInfo.equals(source.getSrcInfo())) {
throw new RuntimeException("testSrcInfo and source.getSrcInfo were not equal. testSrcInfo = " + testSrcInfo + ", source.getSrcInfo = " + source.getSrcInfo());
}
try {
BufferedReader reader = source.createReader();
try {
if (!testString.equals(reader.readLine())) {
throw new RuntimeException("testString and reader.readLine() were not equal");
}
final String secondLine = reader.readLine();
if (secondLine != null) {
throw new RuntimeException("got a second line '" + secondLine + "' from the reader");
}
} finally {
reader.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return testResult;
} | java | @Override
public ParseResult parse(Source source) {
if (!testSrcInfo.equals(source.getSrcInfo())) {
throw new RuntimeException("testSrcInfo and source.getSrcInfo were not equal. testSrcInfo = " + testSrcInfo + ", source.getSrcInfo = " + source.getSrcInfo());
}
try {
BufferedReader reader = source.createReader();
try {
if (!testString.equals(reader.readLine())) {
throw new RuntimeException("testString and reader.readLine() were not equal");
}
final String secondLine = reader.readLine();
if (secondLine != null) {
throw new RuntimeException("got a second line '" + secondLine + "' from the reader");
}
} finally {
reader.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return testResult;
} | [
"@",
"Override",
"public",
"ParseResult",
"parse",
"(",
"Source",
"source",
")",
"{",
"if",
"(",
"!",
"testSrcInfo",
".",
"equals",
"(",
"source",
".",
"getSrcInfo",
"(",
")",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"testSrcInfo and source.... | When called this examines the source to make sure the scrcInfo and data are the expected
testSrcInfo and testString. It then produces the testDoc as a result | [
"When",
"called",
"this",
"examines",
"the",
"source",
"to",
"make",
"sure",
"the",
"scrcInfo",
"and",
"data",
"are",
"the",
"expected",
"testSrcInfo",
"and",
"testString",
".",
"It",
"then",
"produces",
"the",
"testDoc",
"as",
"a",
"result"
] | train | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/parser/DummyParser.java#L51-L73 |
Azure/azure-sdk-for-java | eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java | DomainsInner.beginUpdate | public DomainInner beginUpdate(String resourceGroupName, String domainName, Map<String, String> tags) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, domainName, tags).toBlocking().single().body();
} | java | public DomainInner beginUpdate(String resourceGroupName, String domainName, Map<String, String> tags) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, domainName, tags).toBlocking().single().body();
} | [
"public",
"DomainInner",
"beginUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"domainName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"domainName",
",... | Update a domain.
Asynchronously updates a domain with the specified parameters.
@param resourceGroupName The name of the resource group within the user's subscription.
@param domainName Name of the domain
@param tags Tags of the domains resource
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DomainInner object if successful. | [
"Update",
"a",
"domain",
".",
"Asynchronously",
"updates",
"a",
"domain",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java#L799-L801 |
GerdHolz/TOVAL | src/de/invation/code/toval/statistic/ExtendedObservation.java | ExtendedObservation.resetMomentObservation | private void resetMomentObservation() {
if (momentObservation.isEmpty()) {
Observation o;
for (int i : momentDegrees) {
o = new Observation("moment "+i, true);
o.setStandardPrecision(momentPrecision);
momentObservation.put(i, o);
}
} else {
for (Observation o : momentObservation.values())
o.reset();
}
} | java | private void resetMomentObservation() {
if (momentObservation.isEmpty()) {
Observation o;
for (int i : momentDegrees) {
o = new Observation("moment "+i, true);
o.setStandardPrecision(momentPrecision);
momentObservation.put(i, o);
}
} else {
for (Observation o : momentObservation.values())
o.reset();
}
} | [
"private",
"void",
"resetMomentObservation",
"(",
")",
"{",
"if",
"(",
"momentObservation",
".",
"isEmpty",
"(",
")",
")",
"{",
"Observation",
"o",
";",
"for",
"(",
"int",
"i",
":",
"momentDegrees",
")",
"{",
"o",
"=",
"new",
"Observation",
"(",
"\"momen... | Resets the moment observations.<br>
If there are no observations yet, new observations are created and added to the map.<br>
Otherwise existing observations are reset. | [
"Resets",
"the",
"moment",
"observations",
".",
"<br",
">",
"If",
"there",
"are",
"no",
"observations",
"yet",
"new",
"observations",
"are",
"created",
"and",
"added",
"to",
"the",
"map",
".",
"<br",
">",
"Otherwise",
"existing",
"observations",
"are",
"rese... | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/statistic/ExtendedObservation.java#L133-L145 |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.isSameAbsValue | public static boolean isSameAbsValue(final BigDecimal v1, final BigDecimal v2) {
return isSameValue(abs(v1), abs(v2));
} | java | public static boolean isSameAbsValue(final BigDecimal v1, final BigDecimal v2) {
return isSameValue(abs(v1), abs(v2));
} | [
"public",
"static",
"boolean",
"isSameAbsValue",
"(",
"final",
"BigDecimal",
"v1",
",",
"final",
"BigDecimal",
"v2",
")",
"{",
"return",
"isSameValue",
"(",
"abs",
"(",
"v1",
")",
",",
"abs",
"(",
"v2",
")",
")",
";",
"}"
] | Check ABS values of v1 and v2.
@param v1 nullable BigDecimal
@param v2 nullable BigDecimal
@return true if the ABS value match! | [
"Check",
"ABS",
"values",
"of",
"v1",
"and",
"v2",
"."
] | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L347-L349 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.getAttributeDouble | @Pure
public static double getAttributeDouble(Node document, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeDoubleWithDefault(document, true, 0., path);
} | java | @Pure
public static double getAttributeDouble(Node document, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeDoubleWithDefault(document, true, 0., path);
} | [
"@",
"Pure",
"public",
"static",
"double",
"getAttributeDouble",
"(",
"Node",
"document",
",",
"String",
"...",
"path",
")",
"{",
"assert",
"document",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
"0",
")",
";",
"return",
"getAttributeDou... | Replies the double value that corresponds to the specified attribute's path.
<p>The path is an ordered list of tag's names and ended by the name of
the attribute.
Be careful about the fact that the names are case sensitives.
@param document is the XML document to explore.
@param path is the list of and ended by the attribute's name.
@return the double value of the specified attribute or <code>0</code>. | [
"Replies",
"the",
"double",
"value",
"that",
"corresponds",
"to",
"the",
"specified",
"attribute",
"s",
"path",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L592-L596 |
apache/incubator-shardingsphere | sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/BindingTableRule.java | BindingTableRule.getBindingActualTable | public String getBindingActualTable(final String dataSource, final String logicTable, final String otherActualTable) {
int index = -1;
for (TableRule each : tableRules) {
index = each.findActualTableIndex(dataSource, otherActualTable);
if (-1 != index) {
break;
}
}
if (-1 == index) {
throw new ShardingConfigurationException("Actual table [%s].[%s] is not in table config", dataSource, otherActualTable);
}
for (TableRule each : tableRules) {
if (each.getLogicTable().equals(logicTable.toLowerCase())) {
return each.getActualDataNodes().get(index).getTableName().toLowerCase();
}
}
throw new ShardingConfigurationException("Cannot find binding actual table, data source: %s, logic table: %s, other actual table: %s", dataSource, logicTable, otherActualTable);
} | java | public String getBindingActualTable(final String dataSource, final String logicTable, final String otherActualTable) {
int index = -1;
for (TableRule each : tableRules) {
index = each.findActualTableIndex(dataSource, otherActualTable);
if (-1 != index) {
break;
}
}
if (-1 == index) {
throw new ShardingConfigurationException("Actual table [%s].[%s] is not in table config", dataSource, otherActualTable);
}
for (TableRule each : tableRules) {
if (each.getLogicTable().equals(logicTable.toLowerCase())) {
return each.getActualDataNodes().get(index).getTableName().toLowerCase();
}
}
throw new ShardingConfigurationException("Cannot find binding actual table, data source: %s, logic table: %s, other actual table: %s", dataSource, logicTable, otherActualTable);
} | [
"public",
"String",
"getBindingActualTable",
"(",
"final",
"String",
"dataSource",
",",
"final",
"String",
"logicTable",
",",
"final",
"String",
"otherActualTable",
")",
"{",
"int",
"index",
"=",
"-",
"1",
";",
"for",
"(",
"TableRule",
"each",
":",
"tableRules... | Deduce actual table name from other actual table name in same binding table rule.
@param dataSource data source name
@param logicTable logic table name
@param otherActualTable other actual table name in same binding table rule
@return actual table name | [
"Deduce",
"actual",
"table",
"name",
"from",
"other",
"actual",
"table",
"name",
"in",
"same",
"binding",
"table",
"rule",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/BindingTableRule.java#L65-L82 |
foundation-runtime/logging | logging-log4j/src/main/java/com/cisco/oss/foundation/logging/LoggingHelper.java | LoggingHelper.formatConnectionTerminationMessage | public static String formatConnectionTerminationMessage(final String connectionName, final String host, final String connectionReason, final String terminationReason) {
return CON_TERMINATION_FORMAT.format(new Object[] { connectionName, host, connectionReason, terminationReason });
} | java | public static String formatConnectionTerminationMessage(final String connectionName, final String host, final String connectionReason, final String terminationReason) {
return CON_TERMINATION_FORMAT.format(new Object[] { connectionName, host, connectionReason, terminationReason });
} | [
"public",
"static",
"String",
"formatConnectionTerminationMessage",
"(",
"final",
"String",
"connectionName",
",",
"final",
"String",
"host",
",",
"final",
"String",
"connectionReason",
",",
"final",
"String",
"terminationReason",
")",
"{",
"return",
"CON_TERMINATION_FO... | Helper method for formatting connection termination messages.
@param connectionName
The name of the connection
@param host
The remote host
@param connectionReason
The reason for establishing the connection
@param terminationReason
The reason for terminating the connection
@return A formatted message in the format:
"[<connectionName>] remote host[<host>] <connectionReason> - <terminationReason>"
<br/>
e.g. [con1] remote host[123.123.123.123] connection to ECMG -
terminated by remote host. | [
"Helper",
"method",
"for",
"formatting",
"connection",
"termination",
"messages",
"."
] | train | https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/LoggingHelper.java#L486-L488 |
actorapp/actor-platform | actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/actors/ActorRef.java | ActorRef.sendFirst | public void sendFirst(Object message, ActorRef sender) {
endpoint.getMailbox().scheduleFirst(new Envelope(message, endpoint.getScope(), endpoint.getMailbox(), sender));
} | java | public void sendFirst(Object message, ActorRef sender) {
endpoint.getMailbox().scheduleFirst(new Envelope(message, endpoint.getScope(), endpoint.getMailbox(), sender));
} | [
"public",
"void",
"sendFirst",
"(",
"Object",
"message",
",",
"ActorRef",
"sender",
")",
"{",
"endpoint",
".",
"getMailbox",
"(",
")",
".",
"scheduleFirst",
"(",
"new",
"Envelope",
"(",
"message",
",",
"endpoint",
".",
"getScope",
"(",
")",
",",
"endpoint"... | Sending message before all other messages
@param message message
@param sender sender | [
"Sending",
"message",
"before",
"all",
"other",
"messages"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/actors/ActorRef.java#L75-L77 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.getWorkerPoolAsync | public Observable<WorkerPoolResourceInner> getWorkerPoolAsync(String resourceGroupName, String name, String workerPoolName) {
return getWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() {
@Override
public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) {
return response.body();
}
});
} | java | public Observable<WorkerPoolResourceInner> getWorkerPoolAsync(String resourceGroupName, String name, String workerPoolName) {
return getWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() {
@Override
public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkerPoolResourceInner",
">",
"getWorkerPoolAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"String",
"workerPoolName",
")",
"{",
"return",
"getWorkerPoolWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name... | Get properties of a worker pool.
Get properties of a worker pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param workerPoolName Name of the worker pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkerPoolResourceInner object | [
"Get",
"properties",
"of",
"a",
"worker",
"pool",
".",
"Get",
"properties",
"of",
"a",
"worker",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L5121-L5128 |
basho/riak-java-client | src/main/java/com/basho/riak/client/core/query/functions/Function.java | Function.newStoredJsFunction | public static Function newStoredJsFunction(String bucket, String key)
{
return new Builder().withBucket(bucket).withKey(key).build();
} | java | public static Function newStoredJsFunction(String bucket, String key)
{
return new Builder().withBucket(bucket).withKey(key).build();
} | [
"public",
"static",
"Function",
"newStoredJsFunction",
"(",
"String",
"bucket",
",",
"String",
"key",
")",
"{",
"return",
"new",
"Builder",
"(",
")",
".",
"withBucket",
"(",
"bucket",
")",
".",
"withKey",
"(",
"key",
")",
".",
"build",
"(",
")",
";",
"... | Static factory method for Stored Javascript Functions.
@param bucket The bucket where the JS function is stored
@param key the key for the object containing the JS function
@return a Function representing a stored JS function. | [
"Static",
"factory",
"method",
"for",
"Stored",
"Javascript",
"Functions",
"."
] | train | https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/core/query/functions/Function.java#L167-L170 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java | Logger.exiting | public void exiting(String sourceClass, String sourceMethod, Object result) {
if (Level.FINER.intValue() < levelValue) {
return;
}
Object params[] = { result };
logp(Level.FINER, sourceClass, sourceMethod, "RETURN {0}", result);
} | java | public void exiting(String sourceClass, String sourceMethod, Object result) {
if (Level.FINER.intValue() < levelValue) {
return;
}
Object params[] = { result };
logp(Level.FINER, sourceClass, sourceMethod, "RETURN {0}", result);
} | [
"public",
"void",
"exiting",
"(",
"String",
"sourceClass",
",",
"String",
"sourceMethod",
",",
"Object",
"result",
")",
"{",
"if",
"(",
"Level",
".",
"FINER",
".",
"intValue",
"(",
")",
"<",
"levelValue",
")",
"{",
"return",
";",
"}",
"Object",
"params",... | Log a method return, with result object.
<p>
This is a convenience method that can be used to log returning
from a method. A LogRecord with message "RETURN {0}", log level
FINER, and the gives sourceMethod, sourceClass, and result
object is logged.
<p>
@param sourceClass name of class that issued the logging request
@param sourceMethod name of the method
@param result Object that is being returned | [
"Log",
"a",
"method",
"return",
"with",
"result",
"object",
".",
"<p",
">",
"This",
"is",
"a",
"convenience",
"method",
"that",
"can",
"be",
"used",
"to",
"log",
"returning",
"from",
"a",
"method",
".",
"A",
"LogRecord",
"with",
"message",
"RETURN",
"{",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java#L1111-L1117 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cart_cartId_item_itemId_configuration_configurationId_GET | public OvhConfigurationItem cart_cartId_item_itemId_configuration_configurationId_GET(String cartId, Long itemId, Long configurationId) throws IOException {
String qPath = "/order/cart/{cartId}/item/{itemId}/configuration/{configurationId}";
StringBuilder sb = path(qPath, cartId, itemId, configurationId);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhConfigurationItem.class);
} | java | public OvhConfigurationItem cart_cartId_item_itemId_configuration_configurationId_GET(String cartId, Long itemId, Long configurationId) throws IOException {
String qPath = "/order/cart/{cartId}/item/{itemId}/configuration/{configurationId}";
StringBuilder sb = path(qPath, cartId, itemId, configurationId);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhConfigurationItem.class);
} | [
"public",
"OvhConfigurationItem",
"cart_cartId_item_itemId_configuration_configurationId_GET",
"(",
"String",
"cartId",
",",
"Long",
"itemId",
",",
"Long",
"configurationId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cart/{cartId}/item/{itemId}/config... | Retrieve configuration item
REST: GET /order/cart/{cartId}/item/{itemId}/configuration/{configurationId}
@param cartId [required] Cart identifier
@param itemId [required] Product item identifier
@param configurationId [required] Configuration item identifier | [
"Retrieve",
"configuration",
"item"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L8088-L8093 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/MatchingStrategy.java | MatchingStrategy.performMatch | public MatchResponse performMatch(SecurityConstraintCollection securityConstraintCollection, String resourceName, String method) {
MatchResponse currentResponse = null;
ResponseAggregate responseAggregate = createResponseAggregate();
for (SecurityConstraint securityConstraint : securityConstraintCollection.getSecurityConstraints()) {
currentResponse = getMatchResponse(securityConstraint, resourceName, method);
optionallySetAggregateResponseDefault(currentResponse, responseAggregate);
if (isMatch(currentResponse)) {
responseAggregate = currentResponse.aggregateResponse(responseAggregate);
}
}
return responseAggregate.selectMatchResponse();
} | java | public MatchResponse performMatch(SecurityConstraintCollection securityConstraintCollection, String resourceName, String method) {
MatchResponse currentResponse = null;
ResponseAggregate responseAggregate = createResponseAggregate();
for (SecurityConstraint securityConstraint : securityConstraintCollection.getSecurityConstraints()) {
currentResponse = getMatchResponse(securityConstraint, resourceName, method);
optionallySetAggregateResponseDefault(currentResponse, responseAggregate);
if (isMatch(currentResponse)) {
responseAggregate = currentResponse.aggregateResponse(responseAggregate);
}
}
return responseAggregate.selectMatchResponse();
} | [
"public",
"MatchResponse",
"performMatch",
"(",
"SecurityConstraintCollection",
"securityConstraintCollection",
",",
"String",
"resourceName",
",",
"String",
"method",
")",
"{",
"MatchResponse",
"currentResponse",
"=",
"null",
";",
"ResponseAggregate",
"responseAggregate",
... | Common iteration to get the best constraint match response from the security constraints.
<pre>
To get the aggregated match response,
1. For each security constraint,
1a. Ask security constraint for its match response for the resource access.
1b. Optionally set the default match response of the aggregate after receiving a response for a security constraint.
1c. Aggregate the responses. See {@link com.ibm.ws.webcontainer.security.metadata.MatchResponse#aggregateResponse(ResponseAggregate)}.
2. Finally, select from the aggregate the response.
</pre>
@param securityConstraintCollection the security constraints to iterate through.
@param resourceName the resource name.
@param method the HTTP method.
@return the match response. | [
"Common",
"iteration",
"to",
"get",
"the",
"best",
"constraint",
"match",
"response",
"from",
"the",
"security",
"constraints",
".",
"<pre",
">",
"To",
"get",
"the",
"aggregated",
"match",
"response"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/MatchingStrategy.java#L99-L113 |
mapsforge/mapsforge | mapsforge-map/src/main/java/org/mapsforge/map/layer/renderer/TileDependencies.java | TileDependencies.removeTileData | void removeTileData(Tile from, Tile to) {
if (overlapData.containsKey(from)) {
overlapData.get(from).remove(to);
}
} | java | void removeTileData(Tile from, Tile to) {
if (overlapData.containsKey(from)) {
overlapData.get(from).remove(to);
}
} | [
"void",
"removeTileData",
"(",
"Tile",
"from",
",",
"Tile",
"to",
")",
"{",
"if",
"(",
"overlapData",
".",
"containsKey",
"(",
"from",
")",
")",
"{",
"overlapData",
".",
"get",
"(",
"from",
")",
".",
"remove",
"(",
"to",
")",
";",
"}",
"}"
] | Cache maintenance operation to remove data for a tile from the cache. This should be excuted
if a tile is removed from the TileCache and will be drawn again.
@param from | [
"Cache",
"maintenance",
"operation",
"to",
"remove",
"data",
"for",
"a",
"tile",
"from",
"the",
"cache",
".",
"This",
"should",
"be",
"excuted",
"if",
"a",
"tile",
"is",
"removed",
"from",
"the",
"TileCache",
"and",
"will",
"be",
"drawn",
"again",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/layer/renderer/TileDependencies.java#L81-L86 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterInvoker.java | FilterInvoker.buildMethodKey | private String buildMethodKey(String methodName, String key) {
return RpcConstants.HIDE_KEY_PREFIX + methodName + RpcConstants.HIDE_KEY_PREFIX + key;
} | java | private String buildMethodKey(String methodName, String key) {
return RpcConstants.HIDE_KEY_PREFIX + methodName + RpcConstants.HIDE_KEY_PREFIX + key;
} | [
"private",
"String",
"buildMethodKey",
"(",
"String",
"methodName",
",",
"String",
"key",
")",
"{",
"return",
"RpcConstants",
".",
"HIDE_KEY_PREFIX",
"+",
"methodName",
"+",
"RpcConstants",
".",
"HIDE_KEY_PREFIX",
"+",
"key",
";",
"}"
] | Buildmkey string.
@param methodName the method name
@param key the key
@return the string | [
"Buildmkey",
"string",
"."
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterInvoker.java#L217-L219 |
Talend/tesb-rt-se | sam/sam-agent/src/main/java/org/talend/esb/sam/agent/serviceclient/EventMapper.java | EventMapper.convertCustomInfo | private static CustomInfoType convertCustomInfo(Map<String, String> customInfo) {
if (customInfo == null) {
return null;
}
CustomInfoType ciType = new CustomInfoType();
for (Entry<String, String> entry : customInfo.entrySet()) {
CustomInfoType.Item cItem = new CustomInfoType.Item();
cItem.setKey(entry.getKey());
cItem.setValue(entry.getValue());
ciType.getItem().add(cItem);
}
return ciType;
} | java | private static CustomInfoType convertCustomInfo(Map<String, String> customInfo) {
if (customInfo == null) {
return null;
}
CustomInfoType ciType = new CustomInfoType();
for (Entry<String, String> entry : customInfo.entrySet()) {
CustomInfoType.Item cItem = new CustomInfoType.Item();
cItem.setKey(entry.getKey());
cItem.setValue(entry.getValue());
ciType.getItem().add(cItem);
}
return ciType;
} | [
"private",
"static",
"CustomInfoType",
"convertCustomInfo",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"customInfo",
")",
"{",
"if",
"(",
"customInfo",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"CustomInfoType",
"ciType",
"=",
"new",
"CustomInf... | Convert custom info.
@param customInfo the custom info map
@return the custom info type | [
"Convert",
"custom",
"info",
"."
] | train | https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/sam/sam-agent/src/main/java/org/talend/esb/sam/agent/serviceclient/EventMapper.java#L132-L146 |
gtri/bk-tree | src/main/java/edu/gatech/gtri/bktree/Metrics.java | Metrics.charSequenceMetric | public static Metric<CharSequence> charSequenceMetric(final StringMetric stringMetric) {
return new Metric<CharSequence>() {
@Override
public int distance(CharSequence x, CharSequence y) {
return stringMetric.distance(x, y);
}
};
} | java | public static Metric<CharSequence> charSequenceMetric(final StringMetric stringMetric) {
return new Metric<CharSequence>() {
@Override
public int distance(CharSequence x, CharSequence y) {
return stringMetric.distance(x, y);
}
};
} | [
"public",
"static",
"Metric",
"<",
"CharSequence",
">",
"charSequenceMetric",
"(",
"final",
"StringMetric",
"stringMetric",
")",
"{",
"return",
"new",
"Metric",
"<",
"CharSequence",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"distance",
"(",
"CharSe... | Returns a {@link Metric} that delegates to the given {@link StringMetric}. | [
"Returns",
"a",
"{"
] | train | https://github.com/gtri/bk-tree/blob/fed9d01a85d63a8bb548995b5a455e784ed8b28d/src/main/java/edu/gatech/gtri/bktree/Metrics.java#L29-L36 |
google/flogger | api/src/main/java/com/google/common/flogger/backend/SimpleMessageFormatter.java | SimpleMessageFormatter.safeFormatTo | private static void safeFormatTo(Formattable value, StringBuilder out, FormatOptions options) {
// Only care about 3 specific flags for Formattable.
int formatFlags = options.getFlags() & (FLAG_LEFT_ALIGN | FLAG_UPPER_CASE | FLAG_SHOW_ALT_FORM);
if (formatFlags != 0) {
// TODO: Maybe re-order the options flags to make this step easier or use a lookup table.
// Note that reordering flags would require a rethink of how they are parsed.
formatFlags = ((formatFlags & FLAG_LEFT_ALIGN) != 0 ? FormattableFlags.LEFT_JUSTIFY : 0)
| ((formatFlags & FLAG_UPPER_CASE) != 0 ? FormattableFlags.UPPERCASE : 0)
| ((formatFlags & FLAG_SHOW_ALT_FORM) != 0 ? FormattableFlags.ALTERNATE : 0);
}
// We may need to undo an arbitrary amount of appending if there is an error.
int originalLength = out.length();
Formatter formatter = new Formatter(out, FORMAT_LOCALE);
try {
value.formatTo(formatter, formatFlags, options.getWidth(), options.getPrecision());
} catch (RuntimeException e) {
out.setLength(originalLength);
// We only use a StringBuilder to create the Formatter instance.
try {
formatter.out().append(getErrorString(value, e));
} catch (IOException impossible) { }
}
} | java | private static void safeFormatTo(Formattable value, StringBuilder out, FormatOptions options) {
// Only care about 3 specific flags for Formattable.
int formatFlags = options.getFlags() & (FLAG_LEFT_ALIGN | FLAG_UPPER_CASE | FLAG_SHOW_ALT_FORM);
if (formatFlags != 0) {
// TODO: Maybe re-order the options flags to make this step easier or use a lookup table.
// Note that reordering flags would require a rethink of how they are parsed.
formatFlags = ((formatFlags & FLAG_LEFT_ALIGN) != 0 ? FormattableFlags.LEFT_JUSTIFY : 0)
| ((formatFlags & FLAG_UPPER_CASE) != 0 ? FormattableFlags.UPPERCASE : 0)
| ((formatFlags & FLAG_SHOW_ALT_FORM) != 0 ? FormattableFlags.ALTERNATE : 0);
}
// We may need to undo an arbitrary amount of appending if there is an error.
int originalLength = out.length();
Formatter formatter = new Formatter(out, FORMAT_LOCALE);
try {
value.formatTo(formatter, formatFlags, options.getWidth(), options.getPrecision());
} catch (RuntimeException e) {
out.setLength(originalLength);
// We only use a StringBuilder to create the Formatter instance.
try {
formatter.out().append(getErrorString(value, e));
} catch (IOException impossible) { }
}
} | [
"private",
"static",
"void",
"safeFormatTo",
"(",
"Formattable",
"value",
",",
"StringBuilder",
"out",
",",
"FormatOptions",
"options",
")",
"{",
"// Only care about 3 specific flags for Formattable.",
"int",
"formatFlags",
"=",
"options",
".",
"getFlags",
"(",
")",
"... | Returns a string representation of the user supplied formattable, accounting for any possible
runtime exceptions.
@param value the value to be formatted.
@return a best-effort string representation of the given value, even if exceptions were thrown. | [
"Returns",
"a",
"string",
"representation",
"of",
"the",
"user",
"supplied",
"formattable",
"accounting",
"for",
"any",
"possible",
"runtime",
"exceptions",
"."
] | train | https://github.com/google/flogger/blob/a164967a93a9f4ce92f34319fc0cc7c91a57321c/api/src/main/java/com/google/common/flogger/backend/SimpleMessageFormatter.java#L131-L153 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/SerializationUtils.java | SerializationUtils.decodeAndDeserializeObject | @SneakyThrows
public static <T extends Serializable> T decodeAndDeserializeObject(final byte[] object,
final CipherExecutor cipher,
final Class<T> type,
final Object[] parameters) {
val decoded = (byte[]) cipher.decode(object, parameters);
return deserializeAndCheckObject(decoded, type);
} | java | @SneakyThrows
public static <T extends Serializable> T decodeAndDeserializeObject(final byte[] object,
final CipherExecutor cipher,
final Class<T> type,
final Object[] parameters) {
val decoded = (byte[]) cipher.decode(object, parameters);
return deserializeAndCheckObject(decoded, type);
} | [
"@",
"SneakyThrows",
"public",
"static",
"<",
"T",
"extends",
"Serializable",
">",
"T",
"decodeAndDeserializeObject",
"(",
"final",
"byte",
"[",
"]",
"object",
",",
"final",
"CipherExecutor",
"cipher",
",",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"fina... | Decode and serialize object.
@param <T> the type parameter
@param object the object
@param cipher the cipher
@param type the type
@param parameters the parameters
@return the t
@since 4.2 | [
"Decode",
"and",
"serialize",
"object",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/SerializationUtils.java#L132-L139 |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java | WarUtils.removeNodesByTagName | public static void removeNodesByTagName(Element doc, String tagname) {
NodeList nodes = doc.getElementsByTagName(tagname);
for (int i = 0; i < nodes.getLength(); i++) {
Node n = nodes.item(i);
doc.removeChild(n);
}
} | java | public static void removeNodesByTagName(Element doc, String tagname) {
NodeList nodes = doc.getElementsByTagName(tagname);
for (int i = 0; i < nodes.getLength(); i++) {
Node n = nodes.item(i);
doc.removeChild(n);
}
} | [
"public",
"static",
"void",
"removeNodesByTagName",
"(",
"Element",
"doc",
",",
"String",
"tagname",
")",
"{",
"NodeList",
"nodes",
"=",
"doc",
".",
"getElementsByTagName",
"(",
"tagname",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nodes... | Removes elements by a specified tag name from the xml Element passed in.
@param doc The xml Element to remove from.
@param tagname The tag name to remove. | [
"Removes",
"elements",
"by",
"a",
"specified",
"tag",
"name",
"from",
"the",
"xml",
"Element",
"passed",
"in",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L436-L442 |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java | ParameterTool.createPropertiesFile | public void createPropertiesFile(String pathToFile, boolean overwrite) throws IOException {
final File file = new File(pathToFile);
if (file.exists()) {
if (overwrite) {
file.delete();
} else {
throw new RuntimeException("File " + pathToFile + " exists and overwriting is not allowed");
}
}
final Properties defaultProps = new Properties();
defaultProps.putAll(this.defaultData);
try (final OutputStream out = new FileOutputStream(file)) {
defaultProps.store(out, "Default file created by Flink's ParameterUtil.createPropertiesFile()");
}
} | java | public void createPropertiesFile(String pathToFile, boolean overwrite) throws IOException {
final File file = new File(pathToFile);
if (file.exists()) {
if (overwrite) {
file.delete();
} else {
throw new RuntimeException("File " + pathToFile + " exists and overwriting is not allowed");
}
}
final Properties defaultProps = new Properties();
defaultProps.putAll(this.defaultData);
try (final OutputStream out = new FileOutputStream(file)) {
defaultProps.store(out, "Default file created by Flink's ParameterUtil.createPropertiesFile()");
}
} | [
"public",
"void",
"createPropertiesFile",
"(",
"String",
"pathToFile",
",",
"boolean",
"overwrite",
")",
"throws",
"IOException",
"{",
"final",
"File",
"file",
"=",
"new",
"File",
"(",
"pathToFile",
")",
";",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")"... | Create a properties file with all the known parameters (call after the last get*() call).
Set the default value, if overwrite is true.
@param pathToFile Location of the default properties file.
@param overwrite Boolean flag indicating whether or not to overwrite the file
@throws IOException If overwrite is not allowed and the file exists | [
"Create",
"a",
"properties",
"file",
"with",
"all",
"the",
"known",
"parameters",
"(",
"call",
"after",
"the",
"last",
"get",
"*",
"()",
"call",
")",
".",
"Set",
"the",
"default",
"value",
"if",
"overwrite",
"is",
"true",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L523-L537 |
agmip/agmip-common-functions | src/main/java/org/agmip/functions/PTSaxton2006.java | PTSaxton2006.calcSatBulk | public static String calcSatBulk(String slsnd, String slcly, String omPct, String slcf) {
String satMatric = calcSatMatric(slsnd, slcly, omPct);
String slbdm = calcNormalDensity(slsnd, slcly, omPct);
String alpha = divide(slbdm, "2.65");
String ratio = divide(substract("1", slcf), substract("1", slcf, product("-1.5", slcf, alpha)));
String ret = product(satMatric, ratio);
LOG.debug("Calculate result for Saturated conductivity (bulk soil), mm/h is {}", ret);
return ret;
} | java | public static String calcSatBulk(String slsnd, String slcly, String omPct, String slcf) {
String satMatric = calcSatMatric(slsnd, slcly, omPct);
String slbdm = calcNormalDensity(slsnd, slcly, omPct);
String alpha = divide(slbdm, "2.65");
String ratio = divide(substract("1", slcf), substract("1", slcf, product("-1.5", slcf, alpha)));
String ret = product(satMatric, ratio);
LOG.debug("Calculate result for Saturated conductivity (bulk soil), mm/h is {}", ret);
return ret;
} | [
"public",
"static",
"String",
"calcSatBulk",
"(",
"String",
"slsnd",
",",
"String",
"slcly",
",",
"String",
"omPct",
",",
"String",
"slcf",
")",
"{",
"String",
"satMatric",
"=",
"calcSatMatric",
"(",
"slsnd",
",",
"slcly",
",",
"omPct",
")",
";",
"String",... | Equation 22 for calculating Saturated conductivity (bulk soil), mm/h
@param slsnd Sand weight percentage by layer ([0,100]%)
@param slcly Clay weight percentage by layer ([0,100]%)
@param omPct Organic matter weight percentage by layer ([0,100]%), (=
SLOC * 1.72)
@param slcf Grave weight fraction by layer (g/g) | [
"Equation",
"22",
"for",
"calculating",
"Saturated",
"conductivity",
"(",
"bulk",
"soil",
")",
"mm",
"/",
"h"
] | train | https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/PTSaxton2006.java#L377-L387 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.distinctBy | public static <T, E extends Exception> List<T> distinctBy(final T[] a, final Try.Function<? super T, ?, E> keyMapper) throws E {
if (N.isNullOrEmpty(a)) {
return new ArrayList<>();
}
return distinctBy(a, 0, a.length, keyMapper);
} | java | public static <T, E extends Exception> List<T> distinctBy(final T[] a, final Try.Function<? super T, ?, E> keyMapper) throws E {
if (N.isNullOrEmpty(a)) {
return new ArrayList<>();
}
return distinctBy(a, 0, a.length, keyMapper);
} | [
"public",
"static",
"<",
"T",
",",
"E",
"extends",
"Exception",
">",
"List",
"<",
"T",
">",
"distinctBy",
"(",
"final",
"T",
"[",
"]",
"a",
",",
"final",
"Try",
".",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
",",
"E",
">",
"keyMapper",
")",
... | Distinct by the value mapped from <code>keyMapper</code>.
Mostly it's designed for one-step operation to complete the operation in one step.
<code>java.util.stream.Stream</code> is preferred for multiple phases operation.
@param a
@param keyMapper don't change value of the input parameter.
@return | [
"Distinct",
"by",
"the",
"value",
"mapped",
"from",
"<code",
">",
"keyMapper<",
"/",
"code",
">",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L18020-L18026 |
atomix/atomix | protocols/raft/src/main/java/io/atomix/protocols/raft/impl/OperationResult.java | OperationResult.succeeded | public static OperationResult succeeded(long index, long eventIndex, byte[] result) {
return new OperationResult(index, eventIndex, null, result);
} | java | public static OperationResult succeeded(long index, long eventIndex, byte[] result) {
return new OperationResult(index, eventIndex, null, result);
} | [
"public",
"static",
"OperationResult",
"succeeded",
"(",
"long",
"index",
",",
"long",
"eventIndex",
",",
"byte",
"[",
"]",
"result",
")",
"{",
"return",
"new",
"OperationResult",
"(",
"index",
",",
"eventIndex",
",",
"null",
",",
"result",
")",
";",
"}"
] | Returns a successful operation result.
@param index the result index
@param eventIndex the session's last event index
@param result the operation result value
@return the operation result | [
"Returns",
"a",
"successful",
"operation",
"result",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/impl/OperationResult.java#L46-L48 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/Expression.java | Expression.lessThan | @NonNull
public Expression lessThan(@NonNull Expression expression) {
if (expression == null) {
throw new IllegalArgumentException("expression cannot be null.");
}
return new BinaryExpression(this, expression, BinaryExpression.OpType.LessThan);
} | java | @NonNull
public Expression lessThan(@NonNull Expression expression) {
if (expression == null) {
throw new IllegalArgumentException("expression cannot be null.");
}
return new BinaryExpression(this, expression, BinaryExpression.OpType.LessThan);
} | [
"@",
"NonNull",
"public",
"Expression",
"lessThan",
"(",
"@",
"NonNull",
"Expression",
"expression",
")",
"{",
"if",
"(",
"expression",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"expression cannot be null.\"",
")",
";",
"}",
"ret... | Create a less than expression that evaluates whether or not the current expression
is less than the given expression.
@param expression the expression to compare with the current expression.
@return a less than expression. | [
"Create",
"a",
"less",
"than",
"expression",
"that",
"evaluates",
"whether",
"or",
"not",
"the",
"current",
"expression",
"is",
"less",
"than",
"the",
"given",
"expression",
"."
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Expression.java#L615-L621 |
alkacon/opencms-core | src/org/opencms/jsp/search/config/parser/CmsSimpleSearchConfigurationParser.java | CmsSimpleSearchConfigurationParser.createInstanceWithNoJsonConfig | public static CmsSimpleSearchConfigurationParser createInstanceWithNoJsonConfig(
CmsObject cms,
CmsListManager.ListConfigurationBean config) {
try {
return new CmsSimpleSearchConfigurationParser(cms, config, null);
} catch (JSONException e) {
return null;
}
} | java | public static CmsSimpleSearchConfigurationParser createInstanceWithNoJsonConfig(
CmsObject cms,
CmsListManager.ListConfigurationBean config) {
try {
return new CmsSimpleSearchConfigurationParser(cms, config, null);
} catch (JSONException e) {
return null;
}
} | [
"public",
"static",
"CmsSimpleSearchConfigurationParser",
"createInstanceWithNoJsonConfig",
"(",
"CmsObject",
"cms",
",",
"CmsListManager",
".",
"ListConfigurationBean",
"config",
")",
"{",
"try",
"{",
"return",
"new",
"CmsSimpleSearchConfigurationParser",
"(",
"cms",
",",
... | Creates an instance for an empty JSON configuration.<p>
The point of this is that we know that passing an empty configuration makes it impossible
for a JSONException to thrown.
@param cms the current CMS context
@param config the search configuration
@return the search config parser | [
"Creates",
"an",
"instance",
"for",
"an",
"empty",
"JSON",
"configuration",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsSimpleSearchConfigurationParser.java#L210-L220 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java | CoverageDataCore.getSource | private float getSource(float dest, float destMin, float srcMin, float ratio) {
float destDistance = dest - destMin;
float srcDistance = destDistance * ratio;
float ySource = srcMin + srcDistance;
return ySource;
} | java | private float getSource(float dest, float destMin, float srcMin, float ratio) {
float destDistance = dest - destMin;
float srcDistance = destDistance * ratio;
float ySource = srcMin + srcDistance;
return ySource;
} | [
"private",
"float",
"getSource",
"(",
"float",
"dest",
",",
"float",
"destMin",
",",
"float",
"srcMin",
",",
"float",
"ratio",
")",
"{",
"float",
"destDistance",
"=",
"dest",
"-",
"destMin",
";",
"float",
"srcDistance",
"=",
"destDistance",
"*",
"ratio",
"... | Determine the source pixel location
@param dest
destination pixel location
@param destMin
destination minimum most pixel
@param srcMin
source minimum most pixel
@param ratio
source over destination length ratio
@return source pixel | [
"Determine",
"the",
"source",
"pixel",
"location"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java#L842-L849 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ProjectApi.java | ProjectApi.uploadFile | public FileUpload uploadFile(Object projectIdOrPath, File fileToUpload, String mediaType) throws GitLabApiException {
Response response = upload(Response.Status.CREATED, "file", fileToUpload, mediaType, "projects", getProjectIdOrPath(projectIdOrPath), "uploads");
return (response.readEntity(FileUpload.class));
} | java | public FileUpload uploadFile(Object projectIdOrPath, File fileToUpload, String mediaType) throws GitLabApiException {
Response response = upload(Response.Status.CREATED, "file", fileToUpload, mediaType, "projects", getProjectIdOrPath(projectIdOrPath), "uploads");
return (response.readEntity(FileUpload.class));
} | [
"public",
"FileUpload",
"uploadFile",
"(",
"Object",
"projectIdOrPath",
",",
"File",
"fileToUpload",
",",
"String",
"mediaType",
")",
"throws",
"GitLabApiException",
"{",
"Response",
"response",
"=",
"upload",
"(",
"Response",
".",
"Status",
".",
"CREATED",
",",
... | Uploads a file to the specified project to be used in an issue or merge request description, or a comment.
<pre><code>POST /projects/:id/uploads</code></pre>
@param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
@param fileToUpload the File instance of the file to upload, required
@param mediaType the media type of the file to upload, optional
@return a FileUpload instance with information on the just uploaded file
@throws GitLabApiException if any exception occurs | [
"Uploads",
"a",
"file",
"to",
"the",
"specified",
"project",
"to",
"be",
"used",
"in",
"an",
"issue",
"or",
"merge",
"request",
"description",
"or",
"a",
"comment",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L2160-L2163 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java | Encoder.buildCardinality | public void buildCardinality(final MiniSatStyleSolver s, final LNGIntVector lits, int rhs) {
assert this.incrementalStrategy != IncrementalStrategy.NONE;
switch (this.cardinalityEncoding) {
case TOTALIZER:
this.totalizer.build(s, lits, rhs);
break;
default:
throw new IllegalStateException("Cardinality encoding does not support incrementality: " + this.incrementalStrategy);
}
} | java | public void buildCardinality(final MiniSatStyleSolver s, final LNGIntVector lits, int rhs) {
assert this.incrementalStrategy != IncrementalStrategy.NONE;
switch (this.cardinalityEncoding) {
case TOTALIZER:
this.totalizer.build(s, lits, rhs);
break;
default:
throw new IllegalStateException("Cardinality encoding does not support incrementality: " + this.incrementalStrategy);
}
} | [
"public",
"void",
"buildCardinality",
"(",
"final",
"MiniSatStyleSolver",
"s",
",",
"final",
"LNGIntVector",
"lits",
",",
"int",
"rhs",
")",
"{",
"assert",
"this",
".",
"incrementalStrategy",
"!=",
"IncrementalStrategy",
".",
"NONE",
";",
"switch",
"(",
"this",
... | Manages the building of cardinality encodings. Currently is only used for incremental solving.
@param s the solver
@param lits the literals for the constraint
@param rhs the right hand side of the constraint
@throws IllegalStateException if the cardinality encoding does not support incrementality | [
"Manages",
"the",
"building",
"of",
"cardinality",
"encodings",
".",
"Currently",
"is",
"only",
"used",
"for",
"incremental",
"solving",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java#L209-L218 |
buschmais/jqa-maven3-plugin | src/main/java/com/buschmais/jqassistant/plugin/maven3/api/artifact/MavenArtifactHelper.java | MavenArtifactHelper.setId | public static void setId(MavenArtifactDescriptor artifactDescriptor, Coordinates coordinates) {
artifactDescriptor.setFullQualifiedName(MavenArtifactHelper.getId(coordinates));
} | java | public static void setId(MavenArtifactDescriptor artifactDescriptor, Coordinates coordinates) {
artifactDescriptor.setFullQualifiedName(MavenArtifactHelper.getId(coordinates));
} | [
"public",
"static",
"void",
"setId",
"(",
"MavenArtifactDescriptor",
"artifactDescriptor",
",",
"Coordinates",
"coordinates",
")",
"{",
"artifactDescriptor",
".",
"setFullQualifiedName",
"(",
"MavenArtifactHelper",
".",
"getId",
"(",
"coordinates",
")",
")",
";",
"}"
... | Set the fully qualified name of an artifact descriptor.
@param artifactDescriptor
The artifact descriptor.
@param coordinates
The coordinates. | [
"Set",
"the",
"fully",
"qualified",
"name",
"of",
"an",
"artifact",
"descriptor",
"."
] | train | https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/api/artifact/MavenArtifactHelper.java#L45-L47 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/PrefHelper.java | PrefHelper.setBool | public void setBool(String key, Boolean value) {
prefHelper_.prefsEditor_.putBoolean(key, value);
prefHelper_.prefsEditor_.apply();
} | java | public void setBool(String key, Boolean value) {
prefHelper_.prefsEditor_.putBoolean(key, value);
prefHelper_.prefsEditor_.apply();
} | [
"public",
"void",
"setBool",
"(",
"String",
"key",
",",
"Boolean",
"value",
")",
"{",
"prefHelper_",
".",
"prefsEditor_",
".",
"putBoolean",
"(",
"key",
",",
"value",
")",
";",
"prefHelper_",
".",
"prefsEditor_",
".",
"apply",
"(",
")",
";",
"}"
] | <p>Sets the value of the {@link String} key value supplied in preferences.</p>
@param key A {@link String} value containing the key to reference.
@param value A {@link Boolean} value to set the preference record to. | [
"<p",
">",
"Sets",
"the",
"value",
"of",
"the",
"{",
"@link",
"String",
"}",
"key",
"value",
"supplied",
"in",
"preferences",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/PrefHelper.java#L1014-L1017 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/http/PathMap.java | PathMap.pathInfo | public static String pathInfo(String pathSpec, String path)
{
char c = pathSpec.charAt(0);
if (c=='/')
{
if (pathSpec.length()==1)
return null;
if (pathSpec.equals(path))
return null;
if (pathSpec.endsWith("/*") &&
pathSpec.regionMatches(0,path,0,pathSpec.length()-2))
{
if (path.length()==pathSpec.length()-2)
return null;
return path.substring(pathSpec.length()-2);
}
}
return null;
} | java | public static String pathInfo(String pathSpec, String path)
{
char c = pathSpec.charAt(0);
if (c=='/')
{
if (pathSpec.length()==1)
return null;
if (pathSpec.equals(path))
return null;
if (pathSpec.endsWith("/*") &&
pathSpec.regionMatches(0,path,0,pathSpec.length()-2))
{
if (path.length()==pathSpec.length()-2)
return null;
return path.substring(pathSpec.length()-2);
}
}
return null;
} | [
"public",
"static",
"String",
"pathInfo",
"(",
"String",
"pathSpec",
",",
"String",
"path",
")",
"{",
"char",
"c",
"=",
"pathSpec",
".",
"charAt",
"(",
"0",
")",
";",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"if",
"(",
"pathSpec",
".",
"length",
... | Return the portion of a path that is after a path spec.
@return The path info string | [
"Return",
"the",
"portion",
"of",
"a",
"path",
"that",
"is",
"after",
"a",
"path",
"spec",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/PathMap.java#L454-L475 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/extension/ExtensionRegistry.java | ExtensionRegistry.recordSubsystemVersions | public void recordSubsystemVersions(String moduleName, ModelNode subsystems) {
final Map<String, SubsystemInformation> subsystemsInfo = getAvailableSubsystems(moduleName);
if(subsystemsInfo != null && ! subsystemsInfo.isEmpty()) {
for(final Map.Entry<String, SubsystemInformation> entry : subsystemsInfo.entrySet()) {
SubsystemInformation subsystem = entry.getValue();
subsystems.add(entry.getKey(),
subsystem.getManagementInterfaceMajorVersion() + "."
+ subsystem.getManagementInterfaceMinorVersion()
+ "." + subsystem.getManagementInterfaceMicroVersion());
}
}
} | java | public void recordSubsystemVersions(String moduleName, ModelNode subsystems) {
final Map<String, SubsystemInformation> subsystemsInfo = getAvailableSubsystems(moduleName);
if(subsystemsInfo != null && ! subsystemsInfo.isEmpty()) {
for(final Map.Entry<String, SubsystemInformation> entry : subsystemsInfo.entrySet()) {
SubsystemInformation subsystem = entry.getValue();
subsystems.add(entry.getKey(),
subsystem.getManagementInterfaceMajorVersion() + "."
+ subsystem.getManagementInterfaceMinorVersion()
+ "." + subsystem.getManagementInterfaceMicroVersion());
}
}
} | [
"public",
"void",
"recordSubsystemVersions",
"(",
"String",
"moduleName",
",",
"ModelNode",
"subsystems",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"SubsystemInformation",
">",
"subsystemsInfo",
"=",
"getAvailableSubsystems",
"(",
"moduleName",
")",
";",
"if",
... | Records the versions of the subsystems associated with the given {@code moduleName} as properties in the
provided {@link ModelNode}. Each subsystem property key will be the subsystem name and the value will be
a string composed of the subsystem major version dot appended to its minor version.
@param moduleName the name of the extension module
@param subsystems a model node of type {@link org.jboss.dmr.ModelType#UNDEFINED} or type {@link org.jboss.dmr.ModelType#OBJECT} | [
"Records",
"the",
"versions",
"of",
"the",
"subsystems",
"associated",
"with",
"the",
"given",
"{",
"@code",
"moduleName",
"}",
"as",
"properties",
"in",
"the",
"provided",
"{",
"@link",
"ModelNode",
"}",
".",
"Each",
"subsystem",
"property",
"key",
"will",
... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/extension/ExtensionRegistry.java#L400-L411 |
camunda/camunda-bpm-platform | distro/wildfly8/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/service/ServiceNames.java | ServiceNames.forProcessApplicationDeploymentService | public static ServiceName forProcessApplicationDeploymentService(String moduleName, String deploymentName) {
return PROCESS_APPLICATION_MODULE.append(moduleName).append("DEPLOY").append(deploymentName);
} | java | public static ServiceName forProcessApplicationDeploymentService(String moduleName, String deploymentName) {
return PROCESS_APPLICATION_MODULE.append(moduleName).append("DEPLOY").append(deploymentName);
} | [
"public",
"static",
"ServiceName",
"forProcessApplicationDeploymentService",
"(",
"String",
"moduleName",
",",
"String",
"deploymentName",
")",
"{",
"return",
"PROCESS_APPLICATION_MODULE",
".",
"append",
"(",
"moduleName",
")",
".",
"append",
"(",
"\"DEPLOY\"",
")",
"... | <p>Returns the name for a {@link ProcessApplicationDeploymentService} given
the name of the deployment unit and the name of the deployment.</p>
@param processApplicationName
@param deploymentId | [
"<p",
">",
"Returns",
"the",
"name",
"for",
"a",
"{",
"@link",
"ProcessApplicationDeploymentService",
"}",
"given",
"the",
"name",
"of",
"the",
"deployment",
"unit",
"and",
"the",
"name",
"of",
"the",
"deployment",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/distro/wildfly8/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/service/ServiceNames.java#L115-L117 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.removeEntries | public static void removeEntries(File zip, String[] paths, OutputStream destOut) {
if (log.isDebugEnabled()) {
log.debug("Copying '" + zip + "' to an output stream and removing paths " + Arrays.asList(paths) + ".");
}
ZipOutputStream out = null;
try {
out = new ZipOutputStream(destOut);
copyEntries(zip, out, new HashSet<String>(Arrays.asList(paths)));
}
finally {
IOUtils.closeQuietly(out);
}
} | java | public static void removeEntries(File zip, String[] paths, OutputStream destOut) {
if (log.isDebugEnabled()) {
log.debug("Copying '" + zip + "' to an output stream and removing paths " + Arrays.asList(paths) + ".");
}
ZipOutputStream out = null;
try {
out = new ZipOutputStream(destOut);
copyEntries(zip, out, new HashSet<String>(Arrays.asList(paths)));
}
finally {
IOUtils.closeQuietly(out);
}
} | [
"public",
"static",
"void",
"removeEntries",
"(",
"File",
"zip",
",",
"String",
"[",
"]",
"paths",
",",
"OutputStream",
"destOut",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Copying '\"",
"+",
"z... | Copies an existing ZIP file and removes entries with given paths.
@param zip
an existing ZIP file (only read)
@param paths
paths of the entries to remove
@param destOut
new ZIP destination output stream
@since 1.14 | [
"Copies",
"an",
"existing",
"ZIP",
"file",
"and",
"removes",
"entries",
"with",
"given",
"paths",
"."
] | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2332-L2345 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java | TimestampUtils.toLocalTimeBin | public LocalTime toLocalTimeBin(byte[] bytes) throws PSQLException {
if (bytes.length != 8) {
throw new PSQLException(GT.tr("Unsupported binary encoding of {0}.", "time"),
PSQLState.BAD_DATETIME_FORMAT);
}
long micros;
if (usesDouble) {
double seconds = ByteConverter.float8(bytes, 0);
micros = (long) (seconds * 1000000d);
} else {
micros = ByteConverter.int8(bytes, 0);
}
return LocalTime.ofNanoOfDay(micros * 1000);
} | java | public LocalTime toLocalTimeBin(byte[] bytes) throws PSQLException {
if (bytes.length != 8) {
throw new PSQLException(GT.tr("Unsupported binary encoding of {0}.", "time"),
PSQLState.BAD_DATETIME_FORMAT);
}
long micros;
if (usesDouble) {
double seconds = ByteConverter.float8(bytes, 0);
micros = (long) (seconds * 1000000d);
} else {
micros = ByteConverter.int8(bytes, 0);
}
return LocalTime.ofNanoOfDay(micros * 1000);
} | [
"public",
"LocalTime",
"toLocalTimeBin",
"(",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"PSQLException",
"{",
"if",
"(",
"bytes",
".",
"length",
"!=",
"8",
")",
"{",
"throw",
"new",
"PSQLException",
"(",
"GT",
".",
"tr",
"(",
"\"Unsupported binary encoding o... | Returns the SQL Time object matching the given bytes with {@link Oid#TIME}.
@param bytes The binary encoded time value.
@return The parsed time object.
@throws PSQLException If binary format could not be parsed. | [
"Returns",
"the",
"SQL",
"Time",
"object",
"matching",
"the",
"given",
"bytes",
"with",
"{",
"@link",
"Oid#TIME",
"}",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java#L1012-L1030 |
thorinii/lct | src/main/java/me/lachlanap/lct/data/ConstantFieldFactory.java | ConstantFieldFactory.createConstantField | public ConstantField createConstantField(Class<?> container, String field, Constant annot)
throws ConstantException {
Class<?> type;
try {
type = container.getField(field).getType();
} catch (NoSuchFieldException e) {
throw new ConstantException("Cannot find constant " + annot.name()
+ " (" + container.getSimpleName() + "." + field + ")", e);
}
for (ConstantFieldProvider provider : providers) {
if (provider.canProvide(type))
return provider.getField(type, container, field, annot);
}
throw new ConstantException("No provider found for " + annot.name()
+ " of type " + type.getSimpleName());
} | java | public ConstantField createConstantField(Class<?> container, String field, Constant annot)
throws ConstantException {
Class<?> type;
try {
type = container.getField(field).getType();
} catch (NoSuchFieldException e) {
throw new ConstantException("Cannot find constant " + annot.name()
+ " (" + container.getSimpleName() + "." + field + ")", e);
}
for (ConstantFieldProvider provider : providers) {
if (provider.canProvide(type))
return provider.getField(type, container, field, annot);
}
throw new ConstantException("No provider found for " + annot.name()
+ " of type " + type.getSimpleName());
} | [
"public",
"ConstantField",
"createConstantField",
"(",
"Class",
"<",
"?",
">",
"container",
",",
"String",
"field",
",",
"Constant",
"annot",
")",
"throws",
"ConstantException",
"{",
"Class",
"<",
"?",
">",
"type",
";",
"try",
"{",
"type",
"=",
"container",
... | Tries to create a ConstantField from a raw field. Cycles through all the providers
until one is found that can satisfy.
<p/>
@param container the class enclosing the field
@param field the name of the field
@param annot the Constant annotation to extract constraints from
@return the constructed ConstantField
@throws ConstantException when the field cannot be found, or no provider is found | [
"Tries",
"to",
"create",
"a",
"ConstantField",
"from",
"a",
"raw",
"field",
".",
"Cycles",
"through",
"all",
"the",
"providers",
"until",
"one",
"is",
"found",
"that",
"can",
"satisfy",
".",
"<p",
"/",
">"
] | train | https://github.com/thorinii/lct/blob/83d9dd94aac1efec4815b5658faa395a081592dc/src/main/java/me/lachlanap/lct/data/ConstantFieldFactory.java#L42-L60 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/AccountsApi.java | AccountsApi.getPermissionProfile | public PermissionProfile getPermissionProfile(String accountId, String permissionProfileId) throws ApiException {
return getPermissionProfile(accountId, permissionProfileId, null);
} | java | public PermissionProfile getPermissionProfile(String accountId, String permissionProfileId) throws ApiException {
return getPermissionProfile(accountId, permissionProfileId, null);
} | [
"public",
"PermissionProfile",
"getPermissionProfile",
"(",
"String",
"accountId",
",",
"String",
"permissionProfileId",
")",
"throws",
"ApiException",
"{",
"return",
"getPermissionProfile",
"(",
"accountId",
",",
"permissionProfileId",
",",
"null",
")",
";",
"}"
] | Returns a permissions profile in the specified account.
@param accountId The external account number (int) or account ID Guid. (required)
@param permissionProfileId (required)
@return PermissionProfile | [
"Returns",
"a",
"permissions",
"profile",
"in",
"the",
"specified",
"account",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L1631-L1633 |
wisdom-framework/wisdom | core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java | CryptoServiceSingleton.encryptAESWithCBC | @Override
public String encryptAESWithCBC(String value, String privateKey, String salt, String iv) {
SecretKey genKey = generateAESKey(privateKey, salt);
byte[] encrypted = doFinal(Cipher.ENCRYPT_MODE, genKey, iv, value.getBytes(UTF_8));
return encodeBase64(encrypted);
} | java | @Override
public String encryptAESWithCBC(String value, String privateKey, String salt, String iv) {
SecretKey genKey = generateAESKey(privateKey, salt);
byte[] encrypted = doFinal(Cipher.ENCRYPT_MODE, genKey, iv, value.getBytes(UTF_8));
return encodeBase64(encrypted);
} | [
"@",
"Override",
"public",
"String",
"encryptAESWithCBC",
"(",
"String",
"value",
",",
"String",
"privateKey",
",",
"String",
"salt",
",",
"String",
"iv",
")",
"{",
"SecretKey",
"genKey",
"=",
"generateAESKey",
"(",
"privateKey",
",",
"salt",
")",
";",
"byte... | Encrypt a String with the AES encryption advanced using 'AES/CBC/PKCS5Padding'. Unlike the regular
encode/decode AES method using ECB (Electronic Codebook), it uses Cipher-block chaining (CBC). The private key
must have a length of 16 bytes, the salt and initialization vector must be valid hex Strings.
@param value The message to encrypt
@param privateKey The private key
@param salt The salt (hexadecimal String)
@param iv The initialization vector (hexadecimal String)
@return encrypted String encoded using Base64 | [
"Encrypt",
"a",
"String",
"with",
"the",
"AES",
"encryption",
"advanced",
"using",
"AES",
"/",
"CBC",
"/",
"PKCS5Padding",
".",
"Unlike",
"the",
"regular",
"encode",
"/",
"decode",
"AES",
"method",
"using",
"ECB",
"(",
"Electronic",
"Codebook",
")",
"it",
... | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L136-L141 |
icode/ameba | src/main/java/ameba/lib/Fibers.java | Fibers.runInFiberChecked | public static <X extends Exception> void runInFiberChecked(SuspendableRunnable target, Class<X> exceptionType) throws X, InterruptedException {
FiberUtil.runInFiberChecked(target, exceptionType);
} | java | public static <X extends Exception> void runInFiberChecked(SuspendableRunnable target, Class<X> exceptionType) throws X, InterruptedException {
FiberUtil.runInFiberChecked(target, exceptionType);
} | [
"public",
"static",
"<",
"X",
"extends",
"Exception",
">",
"void",
"runInFiberChecked",
"(",
"SuspendableRunnable",
"target",
",",
"Class",
"<",
"X",
">",
"exceptionType",
")",
"throws",
"X",
",",
"InterruptedException",
"{",
"FiberUtil",
".",
"runInFiberChecked",... | Runs an action in a new fiber and awaits the fiber's termination.
Unlike {@link #runInFiber(SuspendableRunnable) runInFiber} this method does not throw {@link ExecutionException}, but wraps
any checked exception thrown by the operation in a {@link RuntimeException}, unless it is of the given {@code exception type}, in
which case the checked exception is thrown as-is.
The new fiber is scheduled by the {@link DefaultFiberScheduler default scheduler}.
@param target the operation
@param exceptionType a checked exception type that will not be wrapped if thrown by the operation, but thrown as-is.
@throws InterruptedException | [
"Runs",
"an",
"action",
"in",
"a",
"new",
"fiber",
"and",
"awaits",
"the",
"fiber",
"s",
"termination",
".",
"Unlike",
"{",
"@link",
"#runInFiber",
"(",
"SuspendableRunnable",
")",
"runInFiber",
"}",
"this",
"method",
"does",
"not",
"throw",
"{",
"@link",
... | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/lib/Fibers.java#L390-L392 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/processor/map/CreateMapProcessor.java | CreateMapProcessor.createSvgGraphics | public static SVGGraphics2D createSvgGraphics(final Dimension size)
throws ParserConfigurationException {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document document = db.getDOMImplementation().createDocument(null, "svg", null);
SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(document);
ctx.setStyleHandler(new OpacityAdjustingStyleHandler());
ctx.setComment("Generated by GeoTools2 with Batik SVG Generator");
SVGGraphics2D g2d = new SVGGraphics2D(ctx, true);
g2d.setSVGCanvasSize(size);
return g2d;
} | java | public static SVGGraphics2D createSvgGraphics(final Dimension size)
throws ParserConfigurationException {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document document = db.getDOMImplementation().createDocument(null, "svg", null);
SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(document);
ctx.setStyleHandler(new OpacityAdjustingStyleHandler());
ctx.setComment("Generated by GeoTools2 with Batik SVG Generator");
SVGGraphics2D g2d = new SVGGraphics2D(ctx, true);
g2d.setSVGCanvasSize(size);
return g2d;
} | [
"public",
"static",
"SVGGraphics2D",
"createSvgGraphics",
"(",
"final",
"Dimension",
"size",
")",
"throws",
"ParserConfigurationException",
"{",
"DocumentBuilderFactory",
"dbf",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"DocumentBuilder",
"db",
"... | Create a SVG graphic with the give dimensions.
@param size The size of the SVG graphic. | [
"Create",
"a",
"SVG",
"graphic",
"with",
"the",
"give",
"dimensions",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/map/CreateMapProcessor.java#L189-L203 |
camunda/camunda-bpm-mockito | src/main/java/org/camunda/bpm/extension/mockito/process/CallActivityMock.java | CallActivityMock.onExecutionAddVariable | public CallActivityMock onExecutionAddVariable(final String key, final Object val){
return this.onExecutionAddVariables(createVariables().putValue(key, val));
} | java | public CallActivityMock onExecutionAddVariable(final String key, final Object val){
return this.onExecutionAddVariables(createVariables().putValue(key, val));
} | [
"public",
"CallActivityMock",
"onExecutionAddVariable",
"(",
"final",
"String",
"key",
",",
"final",
"Object",
"val",
")",
"{",
"return",
"this",
".",
"onExecutionAddVariables",
"(",
"createVariables",
"(",
")",
".",
"putValue",
"(",
"key",
",",
"val",
")",
")... | On execution, the MockProcess will add the given process variable
@param key ... key of the process variable
@param val ... value of the process variable
@return self | [
"On",
"execution",
"the",
"MockProcess",
"will",
"add",
"the",
"given",
"process",
"variable"
] | train | https://github.com/camunda/camunda-bpm-mockito/blob/77b86c9710813f0bfa59b92985e126a9dad66eef/src/main/java/org/camunda/bpm/extension/mockito/process/CallActivityMock.java#L66-L68 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java | JdbcCpoAdapter.processSelectGroup | protected <T> T processSelectGroup(T obj, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException {
Connection c = null;
T result = null;
try {
c = getReadConnection();
result = processSelectGroup(obj, groupName, wheres, orderBy, nativeExpressions, c);
// The select may have a for update clause on it
// Since the connection is cached we need to get rid of this
commitLocalConnection(c);
} catch (Exception e) {
// Any exception has to try to rollback the work;
rollbackLocalConnection(c);
ExceptionHelper.reThrowCpoException(e, "processSelectGroup(Object obj, String groupName) failed");
} finally {
closeLocalConnection(c);
}
return result;
} | java | protected <T> T processSelectGroup(T obj, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException {
Connection c = null;
T result = null;
try {
c = getReadConnection();
result = processSelectGroup(obj, groupName, wheres, orderBy, nativeExpressions, c);
// The select may have a for update clause on it
// Since the connection is cached we need to get rid of this
commitLocalConnection(c);
} catch (Exception e) {
// Any exception has to try to rollback the work;
rollbackLocalConnection(c);
ExceptionHelper.reThrowCpoException(e, "processSelectGroup(Object obj, String groupName) failed");
} finally {
closeLocalConnection(c);
}
return result;
} | [
"protected",
"<",
"T",
">",
"T",
"processSelectGroup",
"(",
"T",
"obj",
",",
"String",
"groupName",
",",
"Collection",
"<",
"CpoWhere",
">",
"wheres",
",",
"Collection",
"<",
"CpoOrderBy",
">",
"orderBy",
",",
"Collection",
"<",
"CpoNativeFunction",
">",
"na... | Retrieves the Object from the datasource.
@param obj This is an object that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. The input object is used to specify the search criteria.
@param groupName The name which identifies which RETRIEVE Function Group to execute to retrieve the object.
@param wheres A collection of CpoWhere objects to be used by the function
@param orderBy A collection of CpoOrderBy objects to be used by the function
@param nativeExpressions A collection of CpoNativeFunction objects to be used by the function
@return A populated object of the same type as the Object passed in as a argument. If no objects match the criteria
a NULL will be returned.
@throws CpoException the retrieve function defined for this objects returns more than one row, an exception will be
thrown. | [
"Retrieves",
"the",
"Object",
"from",
"the",
"datasource",
"."
] | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L2273-L2293 |
banq/jdonframework | src/main/java/com/jdon/util/jdom/XMLProperties.java | XMLProperties.parsePropertyName | private String[] parsePropertyName(String name) {
// Figure out the number of parts of the name (this becomes the size
// of the resulting array).
int size = 1;
for (int i = 0; i < name.length(); i++) {
if (name.charAt(i) == '.') {
size++;
}
}
String[] propName = new String[size];
// Use a StringTokenizer to tokenize the property name.
StringTokenizer tokenizer = new StringTokenizer(name, ".");
int i = 0;
while (tokenizer.hasMoreTokens()) {
propName[i] = tokenizer.nextToken();
i++;
}
return propName;
} | java | private String[] parsePropertyName(String name) {
// Figure out the number of parts of the name (this becomes the size
// of the resulting array).
int size = 1;
for (int i = 0; i < name.length(); i++) {
if (name.charAt(i) == '.') {
size++;
}
}
String[] propName = new String[size];
// Use a StringTokenizer to tokenize the property name.
StringTokenizer tokenizer = new StringTokenizer(name, ".");
int i = 0;
while (tokenizer.hasMoreTokens()) {
propName[i] = tokenizer.nextToken();
i++;
}
return propName;
} | [
"private",
"String",
"[",
"]",
"parsePropertyName",
"(",
"String",
"name",
")",
"{",
"// Figure out the number of parts of the name (this becomes the size\r",
"// of the resulting array).\r",
"int",
"size",
"=",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
... | Returns an array representation of the given Jive property. Jive
properties are always in the format "prop.name.is.this" which would be
represented as an array of four Strings.
@param name
the name of the Jive property.
@return an array representation of the given Jive property. | [
"Returns",
"an",
"array",
"representation",
"of",
"the",
"given",
"Jive",
"property",
".",
"Jive",
"properties",
"are",
"always",
"in",
"the",
"format",
"prop",
".",
"name",
".",
"is",
".",
"this",
"which",
"would",
"be",
"represented",
"as",
"an",
"array"... | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/jdom/XMLProperties.java#L239-L257 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java | SourceLineAnnotation.fromVisitedInstructionRange | public static SourceLineAnnotation fromVisitedInstructionRange(ClassContext classContext, MethodGen methodGen,
String sourceFile, InstructionHandle start, InstructionHandle end) {
LineNumberTable lineNumberTable = methodGen.getLineNumberTable(methodGen.getConstantPool());
String className = methodGen.getClassName();
if (lineNumberTable == null) {
return createUnknown(className, sourceFile, start.getPosition(), end.getPosition());
}
int startLine = lineNumberTable.getSourceLine(start.getPosition());
int endLine = lineNumberTable.getSourceLine(end.getPosition());
return new SourceLineAnnotation(className, sourceFile, startLine, endLine, start.getPosition(), end.getPosition());
} | java | public static SourceLineAnnotation fromVisitedInstructionRange(ClassContext classContext, MethodGen methodGen,
String sourceFile, InstructionHandle start, InstructionHandle end) {
LineNumberTable lineNumberTable = methodGen.getLineNumberTable(methodGen.getConstantPool());
String className = methodGen.getClassName();
if (lineNumberTable == null) {
return createUnknown(className, sourceFile, start.getPosition(), end.getPosition());
}
int startLine = lineNumberTable.getSourceLine(start.getPosition());
int endLine = lineNumberTable.getSourceLine(end.getPosition());
return new SourceLineAnnotation(className, sourceFile, startLine, endLine, start.getPosition(), end.getPosition());
} | [
"public",
"static",
"SourceLineAnnotation",
"fromVisitedInstructionRange",
"(",
"ClassContext",
"classContext",
",",
"MethodGen",
"methodGen",
",",
"String",
"sourceFile",
",",
"InstructionHandle",
"start",
",",
"InstructionHandle",
"end",
")",
"{",
"LineNumberTable",
"li... | Factory method for creating a source line annotation describing the
source line numbers for a range of instruction in a method.
@param classContext
theClassContext
@param methodGen
the method
@param start
the start instruction
@param end
the end instruction (inclusive) | [
"Factory",
"method",
"for",
"creating",
"a",
"source",
"line",
"annotation",
"describing",
"the",
"source",
"line",
"numbers",
"for",
"a",
"range",
"of",
"instruction",
"in",
"a",
"method",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L607-L619 |
cedricbou/simple-xml | src/main/java/foop/simple/xml/SimpleXmlUtils.java | SimpleXmlUtils.tagToQName | public static QName tagToQName(final String tag,
final Map<String, String> nsRegistry) {
final String[] split = tag.split("\\:");
if (split.length <= 1) {
return new QName(split[0]);
} else {
final String namespace = nsRegistry.get(split[0]);
if (namespace != null) {
return new QName(namespace, split[1]);
} else {
return new QName(split[1]);
}
}
} | java | public static QName tagToQName(final String tag,
final Map<String, String> nsRegistry) {
final String[] split = tag.split("\\:");
if (split.length <= 1) {
return new QName(split[0]);
} else {
final String namespace = nsRegistry.get(split[0]);
if (namespace != null) {
return new QName(namespace, split[1]);
} else {
return new QName(split[1]);
}
}
} | [
"public",
"static",
"QName",
"tagToQName",
"(",
"final",
"String",
"tag",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"nsRegistry",
")",
"{",
"final",
"String",
"[",
"]",
"split",
"=",
"tag",
".",
"split",
"(",
"\"\\\\:\"",
")",
";",
"if",
... | Transform a tag, local or prefixed with a namespace alias, to a local or
full QName.
@param tag
The tag to convert, it can be local like <code>azerty</code>
or qualified like <code>ns1:azerty</code>.
@param nsRegistry
The namespaces registry containing for an alias, the full
namespace name.
@return the QName corresponding to the tag, it will be a local QName
except if a prefix was provided and it could be found in the
namespace registry. | [
"Transform",
"a",
"tag",
"local",
"or",
"prefixed",
"with",
"a",
"namespace",
"alias",
"to",
"a",
"local",
"or",
"full",
"QName",
"."
] | train | https://github.com/cedricbou/simple-xml/blob/d7aa63d940c168e00e00716d9b07f99d2fd350f7/src/main/java/foop/simple/xml/SimpleXmlUtils.java#L23-L38 |
sevensource/html-email-service | src/main/java/org/sevensource/commons/email/model/DefaultEmailModel.java | DefaultEmailModel.addCc | public void addCc(String address, String personal) throws AddressException {
if(cc == null) {
cc = new ArrayList<>();
}
cc.add( toInternetAddress(address, personal) );
} | java | public void addCc(String address, String personal) throws AddressException {
if(cc == null) {
cc = new ArrayList<>();
}
cc.add( toInternetAddress(address, personal) );
} | [
"public",
"void",
"addCc",
"(",
"String",
"address",
",",
"String",
"personal",
")",
"throws",
"AddressException",
"{",
"if",
"(",
"cc",
"==",
"null",
")",
"{",
"cc",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"cc",
".",
"add",
"(",
"toIntern... | adds a CC recipient
@param address a valid email address
@param personal the real world name of the sender (can be null)
@throws AddressException in case of an invalid email address | [
"adds",
"a",
"CC",
"recipient"
] | train | https://github.com/sevensource/html-email-service/blob/a55d9ef1a2173917cb5f870854bc24e5aaebd182/src/main/java/org/sevensource/commons/email/model/DefaultEmailModel.java#L107-L112 |
unic/neba | core/src/main/java/io/neba/core/resourcemodels/metadata/MappedFieldMetaData.java | MappedFieldMetaData.getParameterTypeOf | private Type getParameterTypeOf(Type type) {
try {
return getLowerBoundOfSingleTypeParameter(type);
} catch (Exception e) {
throw new IllegalArgumentException("Unable to resolve a generic parameter type of the mapped field " + this.field + ".", e);
}
} | java | private Type getParameterTypeOf(Type type) {
try {
return getLowerBoundOfSingleTypeParameter(type);
} catch (Exception e) {
throw new IllegalArgumentException("Unable to resolve a generic parameter type of the mapped field " + this.field + ".", e);
}
} | [
"private",
"Type",
"getParameterTypeOf",
"(",
"Type",
"type",
")",
"{",
"try",
"{",
"return",
"getLowerBoundOfSingleTypeParameter",
"(",
"type",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unable t... | Wraps {@link io.neba.core.util.ReflectionUtil#getLowerBoundOfSingleTypeParameter(java.lang.reflect.Type)}
in order to provide a field-related error message to signal users which field is affected. | [
"Wraps",
"{"
] | train | https://github.com/unic/neba/blob/4d762e60112a1fcb850926a56a9843d5aa424c4b/core/src/main/java/io/neba/core/resourcemodels/metadata/MappedFieldMetaData.java#L142-L148 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/comp/Resolve.java | Resolve.findGlobalType | Symbol findGlobalType(Env<AttrContext> env, Scope scope, Name name) {
Symbol bestSoFar = typeNotFound;
for (Scope.Entry e = scope.lookup(name); e.scope != null; e = e.next()) {
Symbol sym = loadClass(env, e.sym.flatName());
if (bestSoFar.kind == TYP && sym.kind == TYP &&
bestSoFar != sym)
return new AmbiguityError(bestSoFar, sym);
else if (sym.kind < bestSoFar.kind)
bestSoFar = sym;
}
return bestSoFar;
} | java | Symbol findGlobalType(Env<AttrContext> env, Scope scope, Name name) {
Symbol bestSoFar = typeNotFound;
for (Scope.Entry e = scope.lookup(name); e.scope != null; e = e.next()) {
Symbol sym = loadClass(env, e.sym.flatName());
if (bestSoFar.kind == TYP && sym.kind == TYP &&
bestSoFar != sym)
return new AmbiguityError(bestSoFar, sym);
else if (sym.kind < bestSoFar.kind)
bestSoFar = sym;
}
return bestSoFar;
} | [
"Symbol",
"findGlobalType",
"(",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"Scope",
"scope",
",",
"Name",
"name",
")",
"{",
"Symbol",
"bestSoFar",
"=",
"typeNotFound",
";",
"for",
"(",
"Scope",
".",
"Entry",
"e",
"=",
"scope",
".",
"lookup",
"(",
"na... | Find a global type in given scope and load corresponding class.
@param env The current environment.
@param scope The scope in which to look for the type.
@param name The type's name. | [
"Find",
"a",
"global",
"type",
"in",
"given",
"scope",
"and",
"load",
"corresponding",
"class",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Resolve.java#L2004-L2015 |
Azure/azure-sdk-for-java | notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NamespacesInner.java | NamespacesInner.beginDelete | public void beginDelete(String resourceGroupName, String namespaceName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String namespaceName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"namespaceName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"namespaceName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"b... | Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace.
@param resourceGroupName The name of the resource group.
@param namespaceName The namespace name.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Deletes",
"an",
"existing",
"namespace",
".",
"This",
"operation",
"also",
"removes",
"all",
"associated",
"notificationHubs",
"under",
"the",
"namespace",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NamespacesInner.java#L490-L492 |
jmeetsma/Iglu-Util | src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java | StringSupport.split | public static List<String> split(String input, String punctuationChars, boolean sort) {
return split(input, punctuationChars, sort, false);
} | java | public static List<String> split(String input, String punctuationChars, boolean sort) {
return split(input, punctuationChars, sort, false);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"split",
"(",
"String",
"input",
",",
"String",
"punctuationChars",
",",
"boolean",
"sort",
")",
"{",
"return",
"split",
"(",
"input",
",",
"punctuationChars",
",",
"sort",
",",
"false",
")",
";",
"}"
] | reads all words in a text and converts them to lower case
@param input
@param punctuationChars characters that can not belong to words and are therefore separators
@param sort indicates if result must be sorted alphabetically
@return a collection of uniquely identified words | [
"reads",
"all",
"words",
"in",
"a",
"text",
"and",
"converts",
"them",
"to",
"lower",
"case"
] | train | https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java#L529-L531 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java | GeodesicPosition.toDecimalDegreeMinuteString | @Pure
public static String toDecimalDegreeMinuteString(double lambda, double phi, boolean useSymbolicDirection) {
final StringBuilder b = new StringBuilder();
final SexagesimalLatitudeAxis latitudeAxis = (phi < 0.) ? SexagesimalLatitudeAxis.SOUTH : SexagesimalLatitudeAxis.NORTH;
final SexagesimalLongitudeAxis longitudeAxis = lambda < 0. ? SexagesimalLongitudeAxis.WEST
: SexagesimalLongitudeAxis.EAST;
toDMString(b, phi, useSymbolicDirection ? Locale.getString(latitudeAxis.name()) : EMPTY_STRING);
b.append(" "); //$NON-NLS-1$
toDMString(b, lambda, useSymbolicDirection ? Locale.getString(longitudeAxis.name()) : EMPTY_STRING);
return b.toString();
} | java | @Pure
public static String toDecimalDegreeMinuteString(double lambda, double phi, boolean useSymbolicDirection) {
final StringBuilder b = new StringBuilder();
final SexagesimalLatitudeAxis latitudeAxis = (phi < 0.) ? SexagesimalLatitudeAxis.SOUTH : SexagesimalLatitudeAxis.NORTH;
final SexagesimalLongitudeAxis longitudeAxis = lambda < 0. ? SexagesimalLongitudeAxis.WEST
: SexagesimalLongitudeAxis.EAST;
toDMString(b, phi, useSymbolicDirection ? Locale.getString(latitudeAxis.name()) : EMPTY_STRING);
b.append(" "); //$NON-NLS-1$
toDMString(b, lambda, useSymbolicDirection ? Locale.getString(longitudeAxis.name()) : EMPTY_STRING);
return b.toString();
} | [
"@",
"Pure",
"public",
"static",
"String",
"toDecimalDegreeMinuteString",
"(",
"double",
"lambda",
",",
"double",
"phi",
",",
"boolean",
"useSymbolicDirection",
")",
"{",
"final",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"Sexage... | Replies the string representation of the longitude/latitude coordinates
in the Decimal Degree Minute format: coordinate containing degrees (integer)
and minutes (integer, or real number).
<p>Example: <code>40° 26.7717N 79° 56.93172W</code>
@param lambda is the longitude in degrees.
@param phi is the latitude in degrees.
@param useSymbolicDirection indicates if the directions should be output with there
symbols or if there are represented by the signs of the coordinates.
@return the string representation of the longitude/latitude coordinates. | [
"Replies",
"the",
"string",
"representation",
"of",
"the",
"longitude",
"/",
"latitude",
"coordinates",
"in",
"the",
"Decimal",
"Degree",
"Minute",
"format",
":",
"coordinate",
"containing",
"degrees",
"(",
"integer",
")",
"and",
"minutes",
"(",
"integer",
"or",... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java#L384-L394 |
bbossgroups/bboss-elasticsearch | bboss-elasticsearch-spring-boot-starter/src/main/java/org/frameworkset/elasticsearch/boot/BBossESStarter.java | BBossESStarter.getConfigRestClient | public ClientInterface getConfigRestClient(String elasticsearchName,String configFile){
return ElasticSearchHelper.getConfigRestClientUtil(elasticsearchName,configFile);
} | java | public ClientInterface getConfigRestClient(String elasticsearchName,String configFile){
return ElasticSearchHelper.getConfigRestClientUtil(elasticsearchName,configFile);
} | [
"public",
"ClientInterface",
"getConfigRestClient",
"(",
"String",
"elasticsearchName",
",",
"String",
"configFile",
")",
"{",
"return",
"ElasticSearchHelper",
".",
"getConfigRestClientUtil",
"(",
"elasticsearchName",
",",
"configFile",
")",
";",
"}"
] | Get Special elasticsearch server ConfigFile ClientInterface
@param elasticsearchName elasticsearch server name which defined in bboss spring boot application configfile
@param configFile
@return | [
"Get",
"Special",
"elasticsearch",
"server",
"ConfigFile",
"ClientInterface"
] | train | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-spring-boot-starter/src/main/java/org/frameworkset/elasticsearch/boot/BBossESStarter.java#L77-L81 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/MetamodelImpl.java | MetamodelImpl.assignEmbeddables | public void assignEmbeddables(Map<Class<?>, ManagedType<?>> embeddables)
{
if (this.embeddables == null)
{
this.embeddables = embeddables;
}
else
{
this.embeddables.putAll(embeddables);
}
} | java | public void assignEmbeddables(Map<Class<?>, ManagedType<?>> embeddables)
{
if (this.embeddables == null)
{
this.embeddables = embeddables;
}
else
{
this.embeddables.putAll(embeddables);
}
} | [
"public",
"void",
"assignEmbeddables",
"(",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"ManagedType",
"<",
"?",
">",
">",
"embeddables",
")",
"{",
"if",
"(",
"this",
".",
"embeddables",
"==",
"null",
")",
"{",
"this",
".",
"embeddables",
"=",
"embeddable... | Assign embeddables to embeddables collection.
@param embeddables
the embeddables to set | [
"Assign",
"embeddables",
"to",
"embeddables",
"collection",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/MetamodelImpl.java#L315-L325 |
xmlunit/xmlunit | xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/DifferenceEngine.java | DifferenceEngine.unequal | private boolean unequal(Object expected, Object actual) {
return expected==null ? actual!=null : unequalNotNull(expected, actual);
} | java | private boolean unequal(Object expected, Object actual) {
return expected==null ? actual!=null : unequalNotNull(expected, actual);
} | [
"private",
"boolean",
"unequal",
"(",
"Object",
"expected",
",",
"Object",
"actual",
")",
"{",
"return",
"expected",
"==",
"null",
"?",
"actual",
"!=",
"null",
":",
"unequalNotNull",
"(",
"expected",
",",
"actual",
")",
";",
"}"
] | Test two possibly null values for inequality
@param expected
@param actual
@return TRUE if the values are neither both null, nor equals() equal | [
"Test",
"two",
"possibly",
"null",
"values",
"for",
"inequality"
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/DifferenceEngine.java#L897-L899 |
lucee/Lucee | core/src/main/java/lucee/runtime/type/ref/NativeReference.java | NativeReference.getInstance | public static Reference getInstance(Object o, String key) {
if (o instanceof Reference) {
return new ReferenceReference((Reference) o, key);
}
Collection coll = Caster.toCollection(o, null);
if (coll != null) return new VariableReference(coll, key);
return new NativeReference(o, key);
} | java | public static Reference getInstance(Object o, String key) {
if (o instanceof Reference) {
return new ReferenceReference((Reference) o, key);
}
Collection coll = Caster.toCollection(o, null);
if (coll != null) return new VariableReference(coll, key);
return new NativeReference(o, key);
} | [
"public",
"static",
"Reference",
"getInstance",
"(",
"Object",
"o",
",",
"String",
"key",
")",
"{",
"if",
"(",
"o",
"instanceof",
"Reference",
")",
"{",
"return",
"new",
"ReferenceReference",
"(",
"(",
"Reference",
")",
"o",
",",
"key",
")",
";",
"}",
... | returns a Reference Instance
@param o
@param key
@return Reference Instance | [
"returns",
"a",
"Reference",
"Instance"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/ref/NativeReference.java#L54-L61 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/XmlReader.java | XmlReader.readBoolean | public boolean readBoolean(boolean defaultValue, String attribute)
{
return Boolean.parseBoolean(getValue(String.valueOf(defaultValue), attribute));
} | java | public boolean readBoolean(boolean defaultValue, String attribute)
{
return Boolean.parseBoolean(getValue(String.valueOf(defaultValue), attribute));
} | [
"public",
"boolean",
"readBoolean",
"(",
"boolean",
"defaultValue",
",",
"String",
"attribute",
")",
"{",
"return",
"Boolean",
".",
"parseBoolean",
"(",
"getValue",
"(",
"String",
".",
"valueOf",
"(",
"defaultValue",
")",
",",
"attribute",
")",
")",
";",
"}"... | Read a boolean.
@param defaultValue The value returned if attribute not found.
@param attribute The boolean name (must not be <code>null</code>).
@return The boolean value. | [
"Read",
"a",
"boolean",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/XmlReader.java#L136-L139 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java | SeaGlassLookAndFeel.defineInternalFrameMaximizeButton | private void defineInternalFrameMaximizeButton(UIDefaults d) {
String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.maximizeButton\"";
String c = PAINTER_PREFIX + "TitlePaneMaximizeButtonPainter";
d.put(p + ".WindowNotFocused", new TitlePaneMaximizeButtonWindowNotFocusedState());
d.put(p + ".WindowMaximized", new TitlePaneMaximizeButtonWindowMaximizedState());
d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
// Set the maximize button states.
d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_DISABLED));
d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_ENABLED));
d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MOUSEOVER));
d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_PRESSED));
d.put(p + "[Enabled+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_ENABLED_WINDOWNOTFOCUSED));
d.put(p + "[MouseOver+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED));
d.put(p + "[Pressed+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_PRESSED_WINDOWNOTFOCUSED));
// Set the restore button states.
d.put(p + "[Disabled+WindowMaximized].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_DISABLED));
d.put(p + "[Enabled+WindowMaximized].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_ENABLED));
d.put(p + "[MouseOver+WindowMaximized].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_MOUSEOVER));
d.put(p + "[Pressed+WindowMaximized].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_PRESSED));
d.put(p + "[Enabled+WindowMaximized+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_ENABLED_WINDOWNOTFOCUSED));
d.put(p + "[MouseOver+WindowMaximized+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_MOUSEOVER_WINDOWNOTFOCUSED));
d.put(p + "[Pressed+WindowMaximized+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_PRESSED_WINDOWNOTFOCUSED));
d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 25, 18));
} | java | private void defineInternalFrameMaximizeButton(UIDefaults d) {
String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.maximizeButton\"";
String c = PAINTER_PREFIX + "TitlePaneMaximizeButtonPainter";
d.put(p + ".WindowNotFocused", new TitlePaneMaximizeButtonWindowNotFocusedState());
d.put(p + ".WindowMaximized", new TitlePaneMaximizeButtonWindowMaximizedState());
d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
// Set the maximize button states.
d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_DISABLED));
d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_ENABLED));
d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MOUSEOVER));
d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_PRESSED));
d.put(p + "[Enabled+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_ENABLED_WINDOWNOTFOCUSED));
d.put(p + "[MouseOver+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED));
d.put(p + "[Pressed+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_PRESSED_WINDOWNOTFOCUSED));
// Set the restore button states.
d.put(p + "[Disabled+WindowMaximized].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_DISABLED));
d.put(p + "[Enabled+WindowMaximized].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_ENABLED));
d.put(p + "[MouseOver+WindowMaximized].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_MOUSEOVER));
d.put(p + "[Pressed+WindowMaximized].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_PRESSED));
d.put(p + "[Enabled+WindowMaximized+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_ENABLED_WINDOWNOTFOCUSED));
d.put(p + "[MouseOver+WindowMaximized+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_MOUSEOVER_WINDOWNOTFOCUSED));
d.put(p + "[Pressed+WindowMaximized+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_PRESSED_WINDOWNOTFOCUSED));
d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 25, 18));
} | [
"private",
"void",
"defineInternalFrameMaximizeButton",
"(",
"UIDefaults",
"d",
")",
"{",
"String",
"p",
"=",
"\"InternalFrame:InternalFrameTitlePane:\\\"InternalFrameTitlePane.maximizeButton\\\"\"",
";",
"String",
"c",
"=",
"PAINTER_PREFIX",
"+",
"\"TitlePaneMaximizeButtonPainte... | Initialize the internal frame maximize button settings.
@param d the UI defaults map. | [
"Initialize",
"the",
"internal",
"frame",
"maximize",
"button",
"settings",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1308-L1355 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTree.java | WTree.selectionsEqual | private boolean selectionsEqual(final Set<?> set1, final Set<?> set2) {
// Empty or null lists
if ((set1 == null || set1.isEmpty()) && (set2 == null || set2.isEmpty())) {
return true;
}
// Same size and contain same entries
return set1 != null && set2 != null && set1.size() == set2.size() && set1.
containsAll(set2);
} | java | private boolean selectionsEqual(final Set<?> set1, final Set<?> set2) {
// Empty or null lists
if ((set1 == null || set1.isEmpty()) && (set2 == null || set2.isEmpty())) {
return true;
}
// Same size and contain same entries
return set1 != null && set2 != null && set1.size() == set2.size() && set1.
containsAll(set2);
} | [
"private",
"boolean",
"selectionsEqual",
"(",
"final",
"Set",
"<",
"?",
">",
"set1",
",",
"final",
"Set",
"<",
"?",
">",
"set2",
")",
"{",
"// Empty or null lists",
"if",
"(",
"(",
"set1",
"==",
"null",
"||",
"set1",
".",
"isEmpty",
"(",
")",
")",
"&... | Selection lists are considered equal if they have the same items (order is not important). An empty list is
considered equal to a null list.
@param set1 the first list to check.
@param set2 the second list to check.
@return true if the lists are equal, false otherwise. | [
"Selection",
"lists",
"are",
"considered",
"equal",
"if",
"they",
"have",
"the",
"same",
"items",
"(",
"order",
"is",
"not",
"important",
")",
".",
"An",
"empty",
"list",
"is",
"considered",
"equal",
"to",
"a",
"null",
"list",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTree.java#L851-L860 |
thymeleaf/thymeleaf | src/main/java/org/thymeleaf/util/TextUtils.java | TextUtils.startsWith | public static boolean startsWith(final boolean caseSensitive, final CharSequence text, final char[] prefix) {
return startsWith(caseSensitive, text, 0, text.length(), prefix, 0, prefix.length);
} | java | public static boolean startsWith(final boolean caseSensitive, final CharSequence text, final char[] prefix) {
return startsWith(caseSensitive, text, 0, text.length(), prefix, 0, prefix.length);
} | [
"public",
"static",
"boolean",
"startsWith",
"(",
"final",
"boolean",
"caseSensitive",
",",
"final",
"CharSequence",
"text",
",",
"final",
"char",
"[",
"]",
"prefix",
")",
"{",
"return",
"startsWith",
"(",
"caseSensitive",
",",
"text",
",",
"0",
",",
"text",... | <p>
Checks whether a text starts with a specified prefix.
</p>
@param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way.
@param text the text to be checked for prefixes.
@param prefix the prefix to be searched.
@return whether the text starts with the prefix or not. | [
"<p",
">",
"Checks",
"whether",
"a",
"text",
"starts",
"with",
"a",
"specified",
"prefix",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/util/TextUtils.java#L362-L364 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/font/MalisisFont.java | MalisisFont.clipString | public String clipString(String str, int width, FontOptions options)
{
return clipString(str, width, options, false);
} | java | public String clipString(String str, int width, FontOptions options)
{
return clipString(str, width, options, false);
} | [
"public",
"String",
"clipString",
"(",
"String",
"str",
",",
"int",
"width",
",",
"FontOptions",
"options",
")",
"{",
"return",
"clipString",
"(",
"str",
",",
"width",
",",
"options",
",",
"false",
")",
";",
"}"
] | Clips a string to fit in the specified width.
@param str the str
@param width the width
@param options the options
@return the string | [
"Clips",
"a",
"string",
"to",
"fit",
"in",
"the",
"specified",
"width",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/font/MalisisFont.java#L426-L429 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxFile.java | BoxFile.canUploadVersion | @Deprecated
public void canUploadVersion(String name, long fileSize, String parentID) {
URL url = CONTENT_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());
BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "OPTIONS");
JsonObject parent = new JsonObject();
parent.add("id", parentID);
JsonObject preflightInfo = new JsonObject();
preflightInfo.add("parent", parent);
if (name != null) {
preflightInfo.add("name", name);
}
preflightInfo.add("size", fileSize);
request.setBody(preflightInfo.toString());
BoxAPIResponse response = request.send();
response.disconnect();
} | java | @Deprecated
public void canUploadVersion(String name, long fileSize, String parentID) {
URL url = CONTENT_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());
BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "OPTIONS");
JsonObject parent = new JsonObject();
parent.add("id", parentID);
JsonObject preflightInfo = new JsonObject();
preflightInfo.add("parent", parent);
if (name != null) {
preflightInfo.add("name", name);
}
preflightInfo.add("size", fileSize);
request.setBody(preflightInfo.toString());
BoxAPIResponse response = request.send();
response.disconnect();
} | [
"@",
"Deprecated",
"public",
"void",
"canUploadVersion",
"(",
"String",
"name",
",",
"long",
"fileSize",
",",
"String",
"parentID",
")",
"{",
"URL",
"url",
"=",
"CONTENT_URL_TEMPLATE",
".",
"build",
"(",
"this",
".",
"getAPI",
"(",
")",
".",
"getBaseURL",
... | Checks if the file can be successfully uploaded by using the preflight check.
@param name the name to give the uploaded file or null to use existing name.
@param fileSize the size of the file used for account capacity calculations.
@param parentID the ID of the parent folder that the new version is being uploaded to.
@deprecated This method will be removed in future versions of the SDK; use canUploadVersion(String, long) instead | [
"Checks",
"if",
"the",
"file",
"can",
"be",
"successfully",
"uploaded",
"by",
"using",
"the",
"preflight",
"check",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFile.java#L652-L671 |
brianwhu/xillium | base/src/main/java/org/xillium/base/beans/Strings.java | Strings.toHexString | public static String toHexString(byte[] raw) {
byte[] hex = new byte[2 * raw.length];
int index = 0;
for (byte b : raw) {
int v = b & 0x00ff;
hex[index++] = HEX_CHARS[v >>> 4];
hex[index++] = HEX_CHARS[v & 0xf];
}
try {
return new String(hex, "ASCII");
} catch (java.io.UnsupportedEncodingException x) {
throw new RuntimeException(x.getMessage(), x);
}
} | java | public static String toHexString(byte[] raw) {
byte[] hex = new byte[2 * raw.length];
int index = 0;
for (byte b : raw) {
int v = b & 0x00ff;
hex[index++] = HEX_CHARS[v >>> 4];
hex[index++] = HEX_CHARS[v & 0xf];
}
try {
return new String(hex, "ASCII");
} catch (java.io.UnsupportedEncodingException x) {
throw new RuntimeException(x.getMessage(), x);
}
} | [
"public",
"static",
"String",
"toHexString",
"(",
"byte",
"[",
"]",
"raw",
")",
"{",
"byte",
"[",
"]",
"hex",
"=",
"new",
"byte",
"[",
"2",
"*",
"raw",
".",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"byte",
"b",
":",
"raw",... | Converts an array of bytes into a hexadecimal representation.
This implementation is significantly faster than DatatypeConverter.printHexBinary().
@param raw the byte array to convert to a hexadecimal String
@return a hexadecimal String representing the bytes | [
"Converts",
"an",
"array",
"of",
"bytes",
"into",
"a",
"hexadecimal",
"representation",
"."
] | train | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/beans/Strings.java#L32-L45 |
jamesagnew/hapi-fhir | hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java | RestfulServerUtils.determineResponseEncodingNoDefault | public static ResponseEncoding determineResponseEncodingNoDefault(RequestDetails theReq, EncodingEnum thePrefer) {
return determineResponseEncodingNoDefault(theReq, thePrefer, null);
} | java | public static ResponseEncoding determineResponseEncodingNoDefault(RequestDetails theReq, EncodingEnum thePrefer) {
return determineResponseEncodingNoDefault(theReq, thePrefer, null);
} | [
"public",
"static",
"ResponseEncoding",
"determineResponseEncodingNoDefault",
"(",
"RequestDetails",
"theReq",
",",
"EncodingEnum",
"thePrefer",
")",
"{",
"return",
"determineResponseEncodingNoDefault",
"(",
"theReq",
",",
"thePrefer",
",",
"null",
")",
";",
"}"
] | Returns null if the request doesn't express that it wants FHIR. If it expresses that it wants XML and JSON
equally, returns thePrefer. | [
"Returns",
"null",
"if",
"the",
"request",
"doesn",
"t",
"express",
"that",
"it",
"wants",
"FHIR",
".",
"If",
"it",
"expresses",
"that",
"it",
"wants",
"XML",
"and",
"JSON",
"equally",
"returns",
"thePrefer",
"."
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java#L365-L367 |
apache/predictionio-sdk-java | client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java | EventClient.setItemAsFuture | public FutureAPIResponse setItemAsFuture(String iid, Map<String, Object> properties)
throws IOException {
return setItemAsFuture(iid, properties, new DateTime());
} | java | public FutureAPIResponse setItemAsFuture(String iid, Map<String, Object> properties)
throws IOException {
return setItemAsFuture(iid, properties, new DateTime());
} | [
"public",
"FutureAPIResponse",
"setItemAsFuture",
"(",
"String",
"iid",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"throws",
"IOException",
"{",
"return",
"setItemAsFuture",
"(",
"iid",
",",
"properties",
",",
"new",
"DateTime",
"(",
")"... | Sends a set item properties request. Same as {@link #setItemAsFuture(String, Map, DateTime)
setItemAsFuture(String, Map<String, Object>, DateTime)} except event time is not
specified and recorded as the time when the function is called. | [
"Sends",
"a",
"set",
"item",
"properties",
"request",
".",
"Same",
"as",
"{"
] | train | https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L469-L472 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/Utils.java | Utils.createSocket | public static Socket createSocket(UrlParser urlParser, String host) throws IOException {
return socketHandler.apply(urlParser, host);
} | java | public static Socket createSocket(UrlParser urlParser, String host) throws IOException {
return socketHandler.apply(urlParser, host);
} | [
"public",
"static",
"Socket",
"createSocket",
"(",
"UrlParser",
"urlParser",
",",
"String",
"host",
")",
"throws",
"IOException",
"{",
"return",
"socketHandler",
".",
"apply",
"(",
"urlParser",
",",
"host",
")",
";",
"}"
] | Create socket accordingly to options.
@param urlParser urlParser
@param host hostName ( mandatory only for named pipe)
@return a nex socket
@throws IOException if connection error occur | [
"Create",
"socket",
"accordingly",
"to",
"options",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/Utils.java#L602-L604 |
liferay/com-liferay-commerce | commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java | CPDefinitionGroupedEntryPersistenceImpl.fetchByUUID_G | @Override
public CPDefinitionGroupedEntry fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | java | @Override
public CPDefinitionGroupedEntry fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | [
"@",
"Override",
"public",
"CPDefinitionGroupedEntry",
"fetchByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"{",
"return",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
",",
"true",
")",
";",
"}"
] | Returns the cp definition grouped entry where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching cp definition grouped entry, or <code>null</code> if a matching cp definition grouped entry could not be found | [
"Returns",
"the",
"cp",
"definition",
"grouped",
"entry",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java#L706-L709 |
jfinal/jfinal | src/main/java/com/jfinal/core/Controller.java | Controller.getParaToLong | public Long getParaToLong(String name, Long defaultValue) {
return toLong(request.getParameter(name), defaultValue);
} | java | public Long getParaToLong(String name, Long defaultValue) {
return toLong(request.getParameter(name), defaultValue);
} | [
"public",
"Long",
"getParaToLong",
"(",
"String",
"name",
",",
"Long",
"defaultValue",
")",
"{",
"return",
"toLong",
"(",
"request",
".",
"getParameter",
"(",
"name",
")",
",",
"defaultValue",
")",
";",
"}"
] | Returns the value of a request parameter and convert to Long with a default value if it is null.
@param name a String specifying the name of the parameter
@return a Integer representing the single value of the parameter | [
"Returns",
"the",
"value",
"of",
"a",
"request",
"parameter",
"and",
"convert",
"to",
"Long",
"with",
"a",
"default",
"value",
"if",
"it",
"is",
"null",
"."
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/core/Controller.java#L351-L353 |
FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/ParagraphBox.java | ParagraphBox.hitTextLine | CharacterHit hitTextLine(CaretOffsetX x, int line) {
return text.hitLine(x.value, line);
} | java | CharacterHit hitTextLine(CaretOffsetX x, int line) {
return text.hitLine(x.value, line);
} | [
"CharacterHit",
"hitTextLine",
"(",
"CaretOffsetX",
"x",
",",
"int",
"line",
")",
"{",
"return",
"text",
".",
"hitLine",
"(",
"x",
".",
"value",
",",
"line",
")",
";",
"}"
] | Hits the embedded TextFlow at the given line and x offset.
@param x x coordinate relative to the embedded TextFlow.
@param line index of the line in the embedded TextFlow.
@return hit info for the given line and x coordinate | [
"Hits",
"the",
"embedded",
"TextFlow",
"at",
"the",
"given",
"line",
"and",
"x",
"offset",
"."
] | train | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/ParagraphBox.java#L263-L265 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/shape/Viewport.java | Viewport.viewLocalArea | public final void viewLocalArea(final double x, final double y, final double width, final double height)
{
final Transform t = Transform.createViewportTransform(x, y, width, height, m_wide, m_high);
if (t != null)
{
setTransform(t);
}
} | java | public final void viewLocalArea(final double x, final double y, final double width, final double height)
{
final Transform t = Transform.createViewportTransform(x, y, width, height, m_wide, m_high);
if (t != null)
{
setTransform(t);
}
} | [
"public",
"final",
"void",
"viewLocalArea",
"(",
"final",
"double",
"x",
",",
"final",
"double",
"y",
",",
"final",
"double",
"width",
",",
"final",
"double",
"height",
")",
"{",
"final",
"Transform",
"t",
"=",
"Transform",
".",
"createViewportTransform",
"(... | Change the viewport's transform so that the specified area (in local or world coordinates)
is visible.
@param x
@param y
@param width
@param height | [
"Change",
"the",
"viewport",
"s",
"transform",
"so",
"that",
"the",
"specified",
"area",
"(",
"in",
"local",
"or",
"world",
"coordinates",
")",
"is",
"visible",
"."
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/Viewport.java#L546-L554 |
kevinherron/opc-ua-stack | stack-core/src/main/java/com/digitalpetri/opcua/stack/core/util/CertificateUtil.java | CertificateUtil.decodeCertificate | public static X509Certificate decodeCertificate(InputStream inputStream) throws UaException {
Preconditions.checkNotNull(inputStream, "inputStream cannot be null");
CertificateFactory factory;
try {
factory = CertificateFactory.getInstance("X.509");
} catch (CertificateException e) {
throw new UaException(StatusCodes.Bad_InternalError, e);
}
try {
return (X509Certificate) factory.generateCertificate(inputStream);
} catch (CertificateException | ClassCastException e) {
throw new UaException(StatusCodes.Bad_CertificateInvalid, e);
}
} | java | public static X509Certificate decodeCertificate(InputStream inputStream) throws UaException {
Preconditions.checkNotNull(inputStream, "inputStream cannot be null");
CertificateFactory factory;
try {
factory = CertificateFactory.getInstance("X.509");
} catch (CertificateException e) {
throw new UaException(StatusCodes.Bad_InternalError, e);
}
try {
return (X509Certificate) factory.generateCertificate(inputStream);
} catch (CertificateException | ClassCastException e) {
throw new UaException(StatusCodes.Bad_CertificateInvalid, e);
}
} | [
"public",
"static",
"X509Certificate",
"decodeCertificate",
"(",
"InputStream",
"inputStream",
")",
"throws",
"UaException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"inputStream",
",",
"\"inputStream cannot be null\"",
")",
";",
"CertificateFactory",
"factory",
";... | Decode a DER-encoded X.509 certificate.
@param inputStream {@link InputStream} containing DER-encoded certificate bytes.
@return an {@link X509Certificate}
@throws UaException if decoding the certificate fails. | [
"Decode",
"a",
"DER",
"-",
"encoded",
"X",
".",
"509",
"certificate",
"."
] | train | https://github.com/kevinherron/opc-ua-stack/blob/007f4e5c4ff102814bec17bb7c41f27e2e52f2fd/stack-core/src/main/java/com/digitalpetri/opcua/stack/core/util/CertificateUtil.java#L62-L78 |
spring-projects/spring-data-solr | src/main/java/org/springframework/data/solr/core/query/Criteria.java | Criteria.contains | public Criteria contains(String s) {
assertNoBlankInWildcardedQuery(s, true, true);
predicates.add(new Predicate(OperationKey.CONTAINS, s));
return this;
} | java | public Criteria contains(String s) {
assertNoBlankInWildcardedQuery(s, true, true);
predicates.add(new Predicate(OperationKey.CONTAINS, s));
return this;
} | [
"public",
"Criteria",
"contains",
"(",
"String",
"s",
")",
"{",
"assertNoBlankInWildcardedQuery",
"(",
"s",
",",
"true",
",",
"true",
")",
";",
"predicates",
".",
"add",
"(",
"new",
"Predicate",
"(",
"OperationKey",
".",
"CONTAINS",
",",
"s",
")",
")",
"... | Crates new {@link Predicate} with leading and trailing wildcards <br/>
<strong>NOTE: </strong>mind your schema as leading wildcards may not be supported and/or execution might be slow.
<strong>NOTE: </strong>Strings will not be automatically split on whitespace.
@param s
@return
@throws InvalidDataAccessApiUsageException for strings with whitespace | [
"Crates",
"new",
"{",
"@link",
"Predicate",
"}",
"with",
"leading",
"and",
"trailing",
"wildcards",
"<br",
"/",
">",
"<strong",
">",
"NOTE",
":",
"<",
"/",
"strong",
">",
"mind",
"your",
"schema",
"as",
"leading",
"wildcards",
"may",
"not",
"be",
"suppor... | train | https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L176-L181 |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getMatchHistory | public Future<List<MatchSummary>> getMatchHistory(long playerId, String[] championIds, QueueType... queueTypes) {
return new ApiFuture<>(() -> handler.getMatchHistory(playerId, championIds, queueTypes));
} | java | public Future<List<MatchSummary>> getMatchHistory(long playerId, String[] championIds, QueueType... queueTypes) {
return new ApiFuture<>(() -> handler.getMatchHistory(playerId, championIds, queueTypes));
} | [
"public",
"Future",
"<",
"List",
"<",
"MatchSummary",
">",
">",
"getMatchHistory",
"(",
"long",
"playerId",
",",
"String",
"[",
"]",
"championIds",
",",
"QueueType",
"...",
"queueTypes",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
... | Retrieve a player's match history, filtering out all games not in the specified queues.
@param playerId The id of the player.
@param championIds The championIds to use for retrieval.
@param queueTypes The queue types to retrieve (must be one of RANKED_SOLO_5x5, RANKED_TEAM_3x3 or
RANKED_TEAM_5x5).
@return The match history of the player.
@see <a href="https://developer.riotgames.com/api/methods#!/805/2847">Official API Documentation</a> | [
"Retrieve",
"a",
"player",
"s",
"match",
"history",
"filtering",
"out",
"all",
"games",
"not",
"in",
"the",
"specified",
"queues",
"."
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1014-L1016 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java | SequenceTools.permuteCyclic | public static String permuteCyclic(String string, int n) {
// single letters are char[]; full names are Character[]
Character[] permuted = new Character[string.length()];
char[] c = string.toCharArray();
Character[] charArray = new Character[c.length];
for (int i = 0; i < c.length; i++) {
charArray[i] = c[i];
}
permuteCyclic(charArray, permuted, n);
char[] p = new char[permuted.length];
for (int i = 0; i < p.length; i++) {
p[i] = permuted[i];
}
return String.valueOf(p);
} | java | public static String permuteCyclic(String string, int n) {
// single letters are char[]; full names are Character[]
Character[] permuted = new Character[string.length()];
char[] c = string.toCharArray();
Character[] charArray = new Character[c.length];
for (int i = 0; i < c.length; i++) {
charArray[i] = c[i];
}
permuteCyclic(charArray, permuted, n);
char[] p = new char[permuted.length];
for (int i = 0; i < p.length; i++) {
p[i] = permuted[i];
}
return String.valueOf(p);
} | [
"public",
"static",
"String",
"permuteCyclic",
"(",
"String",
"string",
",",
"int",
"n",
")",
"{",
"// single letters are char[]; full names are Character[]",
"Character",
"[",
"]",
"permuted",
"=",
"new",
"Character",
"[",
"string",
".",
"length",
"(",
")",
"]",
... | Cyclically permute the characters in {@code string} <em>forward</em> by {@code n} elements.
@param string The string to permute
@param n The number of characters to permute by; can be positive or negative; values greater than the length of the array are acceptable | [
"Cyclically",
"permute",
"the",
"characters",
"in",
"{"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java#L37-L51 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkProfilesInner.java | NetworkProfilesInner.updateTags | public NetworkProfileInner updateTags(String resourceGroupName, String networkProfileName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, networkProfileName).toBlocking().last().body();
} | java | public NetworkProfileInner updateTags(String resourceGroupName, String networkProfileName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, networkProfileName).toBlocking().last().body();
} | [
"public",
"NetworkProfileInner",
"updateTags",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkProfileName",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkProfileName",
")",
".",
"toBlocking",
"(",
")",
".",
... | Updates network profile tags.
@param resourceGroupName The name of the resource group.
@param networkProfileName The name of the network profile.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the NetworkProfileInner object if successful. | [
"Updates",
"network",
"profile",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkProfilesInner.java#L421-L423 |
lestard/advanced-bindings | src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java | MathBindings.addExact | public static LongBinding addExact(final ObservableLongValue x, final ObservableLongValue y) {
return createLongBinding(() -> Math.addExact(x.get(), y.get()), x, y);
} | java | public static LongBinding addExact(final ObservableLongValue x, final ObservableLongValue y) {
return createLongBinding(() -> Math.addExact(x.get(), y.get()), x, y);
} | [
"public",
"static",
"LongBinding",
"addExact",
"(",
"final",
"ObservableLongValue",
"x",
",",
"final",
"ObservableLongValue",
"y",
")",
"{",
"return",
"createLongBinding",
"(",
"(",
")",
"->",
"Math",
".",
"addExact",
"(",
"x",
".",
"get",
"(",
")",
",",
"... | Binding for {@link java.lang.Math#addExact(long, long)}
@param x the first value
@param y the second value
@return the result
@throws ArithmeticException if the result overflows a long | [
"Binding",
"for",
"{",
"@link",
"java",
".",
"lang",
".",
"Math#addExact",
"(",
"long",
"long",
")",
"}"
] | train | https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java#L130-L132 |
aws/aws-sdk-java | aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/DockerVolumeConfiguration.java | DockerVolumeConfiguration.withDriverOpts | public DockerVolumeConfiguration withDriverOpts(java.util.Map<String, String> driverOpts) {
setDriverOpts(driverOpts);
return this;
} | java | public DockerVolumeConfiguration withDriverOpts(java.util.Map<String, String> driverOpts) {
setDriverOpts(driverOpts);
return this;
} | [
"public",
"DockerVolumeConfiguration",
"withDriverOpts",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"driverOpts",
")",
"{",
"setDriverOpts",
"(",
"driverOpts",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A map of Docker driver-specific options passed through. This parameter maps to <code>DriverOpts</code> in the <a
href="https://docs.docker.com/engine/api/v1.35/#operation/VolumeCreate">Create a volume</a> section of the <a
href="https://docs.docker.com/engine/api/v1.35/">Docker Remote API</a> and the <code>xxopt</code> option to <a
href="https://docs.docker.com/engine/reference/commandline/volume_create/"> <code>docker volume create</code>
</a>.
</p>
@param driverOpts
A map of Docker driver-specific options passed through. This parameter maps to <code>DriverOpts</code> in
the <a href="https://docs.docker.com/engine/api/v1.35/#operation/VolumeCreate">Create a volume</a> section
of the <a href="https://docs.docker.com/engine/api/v1.35/">Docker Remote API</a> and the
<code>xxopt</code> option to <a
href="https://docs.docker.com/engine/reference/commandline/volume_create/">
<code>docker volume create</code> </a>.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"map",
"of",
"Docker",
"driver",
"-",
"specific",
"options",
"passed",
"through",
".",
"This",
"parameter",
"maps",
"to",
"<code",
">",
"DriverOpts<",
"/",
"code",
">",
"in",
"the",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/DockerVolumeConfiguration.java#L404-L407 |
ogaclejapan/SmartTabLayout | utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java | Bundler.putSize | @TargetApi(21)
public Bundler putSize(String key, Size value) {
bundle.putSize(key, value);
return this;
} | java | @TargetApi(21)
public Bundler putSize(String key, Size value) {
bundle.putSize(key, value);
return this;
} | [
"@",
"TargetApi",
"(",
"21",
")",
"public",
"Bundler",
"putSize",
"(",
"String",
"key",
",",
"Size",
"value",
")",
"{",
"bundle",
".",
"putSize",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a Size value into the mapping of this Bundle, replacing
any existing value for the given key. Either key or value may be null.
@param key a String, or null
@param value a Size object, or null
@return this | [
"Inserts",
"a",
"Size",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | train | https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java#L153-L157 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getCertificatesAsync | public Observable<Page<CertificateItem>> getCertificatesAsync(final String vaultBaseUrl, final Integer maxresults, final Boolean includePending) {
return getCertificatesWithServiceResponseAsync(vaultBaseUrl, maxresults, includePending)
.map(new Func1<ServiceResponse<Page<CertificateItem>>, Page<CertificateItem>>() {
@Override
public Page<CertificateItem> call(ServiceResponse<Page<CertificateItem>> response) {
return response.body();
}
});
} | java | public Observable<Page<CertificateItem>> getCertificatesAsync(final String vaultBaseUrl, final Integer maxresults, final Boolean includePending) {
return getCertificatesWithServiceResponseAsync(vaultBaseUrl, maxresults, includePending)
.map(new Func1<ServiceResponse<Page<CertificateItem>>, Page<CertificateItem>>() {
@Override
public Page<CertificateItem> call(ServiceResponse<Page<CertificateItem>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"CertificateItem",
">",
">",
"getCertificatesAsync",
"(",
"final",
"String",
"vaultBaseUrl",
",",
"final",
"Integer",
"maxresults",
",",
"final",
"Boolean",
"includePending",
")",
"{",
"return",
"getCertificatesWithServiceResp... | List certificates in a specified key vault.
The GetCertificates operation returns the set of certificates resources in the specified key vault. This operation requires the certificates/list permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results.
@param includePending Specifies whether to include certificates which are not completely provisioned.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<CertificateItem> object | [
"List",
"certificates",
"in",
"a",
"specified",
"key",
"vault",
".",
"The",
"GetCertificates",
"operation",
"returns",
"the",
"set",
"of",
"certificates",
"resources",
"in",
"the",
"specified",
"key",
"vault",
".",
"This",
"operation",
"requires",
"the",
"certif... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L5241-L5249 |
apereo/cas | core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java | AbstractCasWebflowConfigurer.prependActionsToActionStateExecutionList | public void prependActionsToActionStateExecutionList(final Flow flow, final String actionStateId, final EvaluateAction... actions) {
addActionsToActionStateExecutionListAt(flow, actionStateId, 0, actions);
} | java | public void prependActionsToActionStateExecutionList(final Flow flow, final String actionStateId, final EvaluateAction... actions) {
addActionsToActionStateExecutionListAt(flow, actionStateId, 0, actions);
} | [
"public",
"void",
"prependActionsToActionStateExecutionList",
"(",
"final",
"Flow",
"flow",
",",
"final",
"String",
"actionStateId",
",",
"final",
"EvaluateAction",
"...",
"actions",
")",
"{",
"addActionsToActionStateExecutionListAt",
"(",
"flow",
",",
"actionStateId",
... | Prepend actions to action state execution list.
@param flow the flow
@param actionStateId the action state id
@param actions the actions | [
"Prepend",
"actions",
"to",
"action",
"state",
"execution",
"list",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L822-L824 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/core/OrganizationHandler.java | OrganizationHandler.removeCorporateGroupId | public void removeCorporateGroupId(final String organizationId, final String corporateGroupId) {
final DbOrganization dbOrganization = getOrganization(organizationId);
if(dbOrganization.getCorporateGroupIdPrefixes().contains(corporateGroupId)){
dbOrganization.getCorporateGroupIdPrefixes().remove(corporateGroupId);
repositoryHandler.store(dbOrganization);
}
repositoryHandler.removeModulesOrganization(corporateGroupId, dbOrganization);
} | java | public void removeCorporateGroupId(final String organizationId, final String corporateGroupId) {
final DbOrganization dbOrganization = getOrganization(organizationId);
if(dbOrganization.getCorporateGroupIdPrefixes().contains(corporateGroupId)){
dbOrganization.getCorporateGroupIdPrefixes().remove(corporateGroupId);
repositoryHandler.store(dbOrganization);
}
repositoryHandler.removeModulesOrganization(corporateGroupId, dbOrganization);
} | [
"public",
"void",
"removeCorporateGroupId",
"(",
"final",
"String",
"organizationId",
",",
"final",
"String",
"corporateGroupId",
")",
"{",
"final",
"DbOrganization",
"dbOrganization",
"=",
"getOrganization",
"(",
"organizationId",
")",
";",
"if",
"(",
"dbOrganization... | Removes a corporate groupId from an Organisation
@param organizationId String
@param corporateGroupId String | [
"Removes",
"a",
"corporate",
"groupId",
"from",
"an",
"Organisation"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/OrganizationHandler.java#L107-L116 |
rnorth/visible-assertions | src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java | VisibleAssertions.assertThat | public static <T> void assertThat(String whatTheObjectIs, T actual, Matcher<? super T> matcher) {
Description description = new StringDescription();
if (matcher.matches(actual)) {
description.appendText(whatTheObjectIs);
description.appendText(" ");
matcher.describeTo(description);
pass(description.toString());
} else {
description.appendText("asserted that it ")
.appendDescriptionOf(matcher)
.appendText(" but ");
matcher.describeMismatch(actual, description);
fail("assertion on " + whatTheObjectIs + " failed", description.toString());
}
} | java | public static <T> void assertThat(String whatTheObjectIs, T actual, Matcher<? super T> matcher) {
Description description = new StringDescription();
if (matcher.matches(actual)) {
description.appendText(whatTheObjectIs);
description.appendText(" ");
matcher.describeTo(description);
pass(description.toString());
} else {
description.appendText("asserted that it ")
.appendDescriptionOf(matcher)
.appendText(" but ");
matcher.describeMismatch(actual, description);
fail("assertion on " + whatTheObjectIs + " failed", description.toString());
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"assertThat",
"(",
"String",
"whatTheObjectIs",
",",
"T",
"actual",
",",
"Matcher",
"<",
"?",
"super",
"T",
">",
"matcher",
")",
"{",
"Description",
"description",
"=",
"new",
"StringDescription",
"(",
")",
";",
... | Assert using a Hamcrest matcher.
@param whatTheObjectIs what is the thing being tested, in a logical sense
@param actual the actual value
@param matcher a matcher to check the actual value against
@param <T> class of the actual value | [
"Assert",
"using",
"a",
"Hamcrest",
"matcher",
"."
] | train | https://github.com/rnorth/visible-assertions/blob/6d7a7724db40ac0e9f87279553f814b790310b3b/src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java#L345-L359 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConfigs.java | RpcConfigs.getIntValue | public static int getIntValue(String primaryKey, String secondaryKey) {
Object val = CFG.get(primaryKey);
if (val == null) {
val = CFG.get(secondaryKey);
if (val == null) {
throw new SofaRpcRuntimeException("Not found key: " + primaryKey + "/" + secondaryKey);
}
}
return Integer.parseInt(val.toString());
} | java | public static int getIntValue(String primaryKey, String secondaryKey) {
Object val = CFG.get(primaryKey);
if (val == null) {
val = CFG.get(secondaryKey);
if (val == null) {
throw new SofaRpcRuntimeException("Not found key: " + primaryKey + "/" + secondaryKey);
}
}
return Integer.parseInt(val.toString());
} | [
"public",
"static",
"int",
"getIntValue",
"(",
"String",
"primaryKey",
",",
"String",
"secondaryKey",
")",
"{",
"Object",
"val",
"=",
"CFG",
".",
"get",
"(",
"primaryKey",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"val",
"=",
"CFG",
".",
"g... | Gets int value.
@param primaryKey the primary key
@param secondaryKey the secondary key
@return the int value | [
"Gets",
"int",
"value",
"."
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConfigs.java#L217-L226 |
depsypher/pngtastic | src/main/java/com/googlecode/pngtastic/core/processing/Base64.java | Base64.decodeToFile | public static void decodeToFile(String dataToDecode, String filename) throws IOException {
Base64.OutputStream bos = null;
try {
bos = new Base64.OutputStream(new FileOutputStream(filename), Base64.DECODE);
bos.write(dataToDecode.getBytes(PREFERRED_ENCODING));
} catch (IOException e) {
throw e; // Catch and throw to execute finally{} block
} finally {
try {
if (bos != null) {
bos.close();
}
} catch(Exception e) {
}
}
} | java | public static void decodeToFile(String dataToDecode, String filename) throws IOException {
Base64.OutputStream bos = null;
try {
bos = new Base64.OutputStream(new FileOutputStream(filename), Base64.DECODE);
bos.write(dataToDecode.getBytes(PREFERRED_ENCODING));
} catch (IOException e) {
throw e; // Catch and throw to execute finally{} block
} finally {
try {
if (bos != null) {
bos.close();
}
} catch(Exception e) {
}
}
} | [
"public",
"static",
"void",
"decodeToFile",
"(",
"String",
"dataToDecode",
",",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"Base64",
".",
"OutputStream",
"bos",
"=",
"null",
";",
"try",
"{",
"bos",
"=",
"new",
"Base64",
".",
"OutputStream",
"("... | Convenience method for decoding data to a file.
<p>As of v 2.3, if there is a error, the method will throw an IOException.
<b>This is new to v2.3!</b> In earlier versions, it just returned false, but
in retrospect that's a pretty poor way to handle it.</p>
@param dataToDecode Base64-encoded data as a string
@param filename Filename for saving decoded data
@throws java.io.IOException if there is an error
@since 2.1 | [
"Convenience",
"method",
"for",
"decoding",
"data",
"to",
"a",
"file",
"."
] | train | https://github.com/depsypher/pngtastic/blob/13fd2a63dd8b2febd7041273889a1bba4f2a6a07/src/main/java/com/googlecode/pngtastic/core/processing/Base64.java#L1321-L1336 |
apereo/cas | core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java | AbstractCasWebflowConfigurer.createExpression | public Expression createExpression(final String expression, final Class expectedType) {
val parserContext = new FluentParserContext().expectResult(expectedType);
return getSpringExpressionParser().parseExpression(expression, parserContext);
} | java | public Expression createExpression(final String expression, final Class expectedType) {
val parserContext = new FluentParserContext().expectResult(expectedType);
return getSpringExpressionParser().parseExpression(expression, parserContext);
} | [
"public",
"Expression",
"createExpression",
"(",
"final",
"String",
"expression",
",",
"final",
"Class",
"expectedType",
")",
"{",
"val",
"parserContext",
"=",
"new",
"FluentParserContext",
"(",
")",
".",
"expectResult",
"(",
"expectedType",
")",
";",
"return",
... | Create expression expression.
@param expression the expression
@param expectedType the expected type
@return the expression | [
"Create",
"expression",
"expression",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L363-L366 |
infinispan/infinispan | core/src/main/java/org/infinispan/commands/AbstractVisitor.java | AbstractVisitor.visitCollection | public void visitCollection(InvocationContext ctx, Collection<? extends VisitableCommand> toVisit) throws Throwable {
for (VisitableCommand command : toVisit) {
command.acceptVisitor(ctx, this);
}
} | java | public void visitCollection(InvocationContext ctx, Collection<? extends VisitableCommand> toVisit) throws Throwable {
for (VisitableCommand command : toVisit) {
command.acceptVisitor(ctx, this);
}
} | [
"public",
"void",
"visitCollection",
"(",
"InvocationContext",
"ctx",
",",
"Collection",
"<",
"?",
"extends",
"VisitableCommand",
">",
"toVisit",
")",
"throws",
"Throwable",
"{",
"for",
"(",
"VisitableCommand",
"command",
":",
"toVisit",
")",
"{",
"command",
"."... | Helper method to visit a collection of VisitableCommands.
@param ctx Invocation context
@param toVisit collection of commands to visit
@throws Throwable in the event of problems | [
"Helper",
"method",
"to",
"visit",
"a",
"collection",
"of",
"VisitableCommands",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/commands/AbstractVisitor.java#L169-L173 |
Hygieia/Hygieia | collectors/feature/jira/src/main/java/com/capitalone/dashboard/collector/FeatureCollectorTask.java | FeatureCollectorTask.refreshValidIssues | private void refreshValidIssues(FeatureCollector collector, List<Team> teams, Set<Scope> scopes) {
long refreshValidIssuesStart = System.currentTimeMillis();
List<String> lookUpIds = Objects.equals(collector.getMode(), JiraMode.Board) ? teams.stream().map(Team::getTeamId).collect(Collectors.toList()) : scopes.stream().map(Scope::getpId).collect(Collectors.toList());
lookUpIds.forEach(l -> {
LOGGER.info("Refreshing issues for " + collector.getMode() + " ID:" + l);
List<String> issueIds = jiraClient.getAllIssueIds(l, collector.getMode());
List<Feature> existingFeatures = Objects.equals(collector.getMode(), JiraMode.Board) ? featureRepository.findAllByCollectorIdAndSTeamID(collector.getId(), l) : featureRepository.findAllByCollectorIdAndSProjectID(collector.getId(), l);
List<Feature> deletedFeatures = existingFeatures.stream().filter(e -> !issueIds.contains(e.getsId())).collect(Collectors.toList());
deletedFeatures.forEach(d -> {
LOGGER.info("Deleting Feature " + d.getsId() + ':' + d.getsName());
featureRepository.delete(d);
});
});
log(collector.getMode() + " Issues Refreshed ", refreshValidIssuesStart);
} | java | private void refreshValidIssues(FeatureCollector collector, List<Team> teams, Set<Scope> scopes) {
long refreshValidIssuesStart = System.currentTimeMillis();
List<String> lookUpIds = Objects.equals(collector.getMode(), JiraMode.Board) ? teams.stream().map(Team::getTeamId).collect(Collectors.toList()) : scopes.stream().map(Scope::getpId).collect(Collectors.toList());
lookUpIds.forEach(l -> {
LOGGER.info("Refreshing issues for " + collector.getMode() + " ID:" + l);
List<String> issueIds = jiraClient.getAllIssueIds(l, collector.getMode());
List<Feature> existingFeatures = Objects.equals(collector.getMode(), JiraMode.Board) ? featureRepository.findAllByCollectorIdAndSTeamID(collector.getId(), l) : featureRepository.findAllByCollectorIdAndSProjectID(collector.getId(), l);
List<Feature> deletedFeatures = existingFeatures.stream().filter(e -> !issueIds.contains(e.getsId())).collect(Collectors.toList());
deletedFeatures.forEach(d -> {
LOGGER.info("Deleting Feature " + d.getsId() + ':' + d.getsName());
featureRepository.delete(d);
});
});
log(collector.getMode() + " Issues Refreshed ", refreshValidIssuesStart);
} | [
"private",
"void",
"refreshValidIssues",
"(",
"FeatureCollector",
"collector",
",",
"List",
"<",
"Team",
">",
"teams",
",",
"Set",
"<",
"Scope",
">",
"scopes",
")",
"{",
"long",
"refreshValidIssuesStart",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",... | Get a list of all issue ids for a given board or project and delete ones that are not in JIRA anymore
@param collector
@param teams
@param scopes | [
"Get",
"a",
"list",
"of",
"all",
"issue",
"ids",
"for",
"a",
"given",
"board",
"or",
"project",
"and",
"delete",
"ones",
"that",
"are",
"not",
"in",
"JIRA",
"anymore"
] | train | https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/feature/jira/src/main/java/com/capitalone/dashboard/collector/FeatureCollectorTask.java#L377-L391 |
alkacon/opencms-core | src/org/opencms/ui/apps/sitemanager/CmsGlobalForm.java | CmsGlobalForm.setServerLayout | private void setServerLayout(final List<CmsSite> sites) {
m_workplaceServerGroup = new CmsEditableGroup(m_serverLayout, new Supplier<Component>() {
public Component get() {
CmsWorkplaceServerWidget row = new CmsWorkplaceServerWidget(sites, null);
return row;
}
}, "Add");
for (String server : OpenCms.getSiteManager().getWorkplaceServers()) {
CmsWorkplaceServerWidget row = new CmsWorkplaceServerWidget(sites, server);
m_workplaceServerGroup.addRow(row);
}
} | java | private void setServerLayout(final List<CmsSite> sites) {
m_workplaceServerGroup = new CmsEditableGroup(m_serverLayout, new Supplier<Component>() {
public Component get() {
CmsWorkplaceServerWidget row = new CmsWorkplaceServerWidget(sites, null);
return row;
}
}, "Add");
for (String server : OpenCms.getSiteManager().getWorkplaceServers()) {
CmsWorkplaceServerWidget row = new CmsWorkplaceServerWidget(sites, server);
m_workplaceServerGroup.addRow(row);
}
} | [
"private",
"void",
"setServerLayout",
"(",
"final",
"List",
"<",
"CmsSite",
">",
"sites",
")",
"{",
"m_workplaceServerGroup",
"=",
"new",
"CmsEditableGroup",
"(",
"m_serverLayout",
",",
"new",
"Supplier",
"<",
"Component",
">",
"(",
")",
"{",
"public",
"Compon... | Fills the layout with combo boxes for all setted workplace servers + one combo box for adding further urls.<p>
@param sites from sitemanager | [
"Fills",
"the",
"layout",
"with",
"combo",
"boxes",
"for",
"all",
"setted",
"workplace",
"servers",
"+",
"one",
"combo",
"box",
"for",
"adding",
"further",
"urls",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sitemanager/CmsGlobalForm.java#L236-L251 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java | NetworkInterfacesInner.beginUpdateTags | public NetworkInterfaceInner beginUpdateTags(String resourceGroupName, String networkInterfaceName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, networkInterfaceName).toBlocking().single().body();
} | java | public NetworkInterfaceInner beginUpdateTags(String resourceGroupName, String networkInterfaceName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, networkInterfaceName).toBlocking().single().body();
} | [
"public",
"NetworkInterfaceInner",
"beginUpdateTags",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkInterfaceName",
")",
"{",
"return",
"beginUpdateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkInterfaceName",
")",
".",
"toBlocking",
"(",
... | Updates a network interface tags.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the NetworkInterfaceInner object if successful. | [
"Updates",
"a",
"network",
"interface",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L803-L805 |
micwin/ticino | events/src/main/java/net/micwin/ticino/events/EventScope.java | EventScope.dispatchAsynchronous | public synchronized <Q extends T> void dispatchAsynchronous(final Q event, final IPostProcessor<Q> pPostProcessor) {
new Thread(new Runnable() {
@Override
public void run() {
try {
// delegate dispatch result
pPostProcessor.done(dispatch(event));
} catch (DispatchException lEx) {
// delegate exception handling as well
pPostProcessor.done(lEx);
}
}
}).start();
} | java | public synchronized <Q extends T> void dispatchAsynchronous(final Q event, final IPostProcessor<Q> pPostProcessor) {
new Thread(new Runnable() {
@Override
public void run() {
try {
// delegate dispatch result
pPostProcessor.done(dispatch(event));
} catch (DispatchException lEx) {
// delegate exception handling as well
pPostProcessor.done(lEx);
}
}
}).start();
} | [
"public",
"synchronized",
"<",
"Q",
"extends",
"T",
">",
"void",
"dispatchAsynchronous",
"(",
"final",
"Q",
"event",
",",
"final",
"IPostProcessor",
"<",
"Q",
">",
"pPostProcessor",
")",
"{",
"new",
"Thread",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"... | Dispatch an event to receivers asynchronously. Does start a thread and
then return immediately.
@param event
The event object to dispatch.
@param pPostProcessor
The postprocessor to call when the event doispatchment
returns. | [
"Dispatch",
"an",
"event",
"to",
"receivers",
"asynchronously",
".",
"Does",
"start",
"a",
"thread",
"and",
"then",
"return",
"immediately",
"."
] | train | https://github.com/micwin/ticino/blob/4d143093500cd2fb9767ebe8cd05ddda23e35613/events/src/main/java/net/micwin/ticino/events/EventScope.java#L391-L412 |
stevespringett/Alpine | alpine/src/main/java/alpine/util/HttpUtil.java | HttpUtil.getSessionAttribute | @SuppressWarnings("unchecked")
public static <T> T getSessionAttribute(final HttpSession session, final String key) {
if (session != null) {
return (T) session.getAttribute(key);
}
return null;
} | java | @SuppressWarnings("unchecked")
public static <T> T getSessionAttribute(final HttpSession session, final String key) {
if (session != null) {
return (T) session.getAttribute(key);
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getSessionAttribute",
"(",
"final",
"HttpSession",
"session",
",",
"final",
"String",
"key",
")",
"{",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
"return",
"(",... | Returns a session attribute as the type of object stored.
@param session session where the attribute is stored
@param key the attributes key
@param <T> the type of object expected
@return the requested object
@since 1.0.0 | [
"Returns",
"a",
"session",
"attribute",
"as",
"the",
"type",
"of",
"object",
"stored",
"."
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/util/HttpUtil.java#L41-L47 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java | PackageSummaryBuilder.buildSummary | public void buildSummary(XMLNode node, Content packageContentTree) {
Content summaryContentTree = packageWriter.getSummaryHeader();
buildChildren(node, summaryContentTree);
packageContentTree.addContent(summaryContentTree);
} | java | public void buildSummary(XMLNode node, Content packageContentTree) {
Content summaryContentTree = packageWriter.getSummaryHeader();
buildChildren(node, summaryContentTree);
packageContentTree.addContent(summaryContentTree);
} | [
"public",
"void",
"buildSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"packageContentTree",
")",
"{",
"Content",
"summaryContentTree",
"=",
"packageWriter",
".",
"getSummaryHeader",
"(",
")",
";",
"buildChildren",
"(",
"node",
",",
"summaryContentTree",
")",
"... | Build the package summary.
@param node the XML element that specifies which components to document
@param packageContentTree the package content tree to which the summaries will
be added | [
"Build",
"the",
"package",
"summary",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java#L151-L155 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.nanIf | public static Expression nanIf(Expression expression1, Expression expression2) {
return x("NANIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | java | public static Expression nanIf(Expression expression1, Expression expression2) {
return x("NANIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | [
"public",
"static",
"Expression",
"nanIf",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
")",
"{",
"return",
"x",
"(",
"\"NANIF(\"",
"+",
"expression1",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"expression2",
".",
"toString",
"(",
... | Returned expression results in NaN if expression1 = expression2, otherwise returns expression1.
Returns MISSING or NULL if either input is MISSING or NULL. | [
"Returned",
"expression",
"results",
"in",
"NaN",
"if",
"expression1",
"=",
"expression2",
"otherwise",
"returns",
"expression1",
".",
"Returns",
"MISSING",
"or",
"NULL",
"if",
"either",
"input",
"is",
"MISSING",
"or",
"NULL",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L124-L126 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Channel.java | Ssh2Channel.channelRequest | protected void channelRequest(String requesttype, boolean wantreply,
byte[] requestdata) throws SshException {
if (wantreply) {
ByteArrayWriter msg = new ByteArrayWriter();
try {
msg.write((byte) SSH_MSG_CHANNEL_FAILURE);
msg.writeInt(remoteid);
connection.sendMessage(msg.toByteArray(), true);
} catch (IOException e) {
throw new SshException(e, SshException.INTERNAL_ERROR);
} finally {
try {
msg.close();
} catch (IOException e) {
}
}
}
} | java | protected void channelRequest(String requesttype, boolean wantreply,
byte[] requestdata) throws SshException {
if (wantreply) {
ByteArrayWriter msg = new ByteArrayWriter();
try {
msg.write((byte) SSH_MSG_CHANNEL_FAILURE);
msg.writeInt(remoteid);
connection.sendMessage(msg.toByteArray(), true);
} catch (IOException e) {
throw new SshException(e, SshException.INTERNAL_ERROR);
} finally {
try {
msg.close();
} catch (IOException e) {
}
}
}
} | [
"protected",
"void",
"channelRequest",
"(",
"String",
"requesttype",
",",
"boolean",
"wantreply",
",",
"byte",
"[",
"]",
"requestdata",
")",
"throws",
"SshException",
"{",
"if",
"(",
"wantreply",
")",
"{",
"ByteArrayWriter",
"msg",
"=",
"new",
"ByteArrayWriter",... | Called when a channel request is received, by default this method sends a
failure message if the remote side requests a reply. Overidden methods
should ALWAYS call this superclass method.
@param requesttype
the name of the request
@param wantreply
specifies whether the remote side requires a success/failure
message
@param requestdata
the request data
@throws IOException | [
"Called",
"when",
"a",
"channel",
"request",
"is",
"received",
"by",
"default",
"this",
"method",
"sends",
"a",
"failure",
"message",
"if",
"the",
"remote",
"side",
"requests",
"a",
"reply",
".",
"Overidden",
"methods",
"should",
"ALWAYS",
"call",
"this",
"s... | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Channel.java#L943-L961 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.