repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
op4j/op4j | src/main/java/org/op4j/functions/Call.java | Call.shr | public static Function<Object,Short> shr(final String methodName, final Object... optionalParameters) {
"""
<p>
Abbreviation for {{@link #methodForShort(String, Object...)}.
</p>
@since 1.1
@param methodName the name of the method
@param optionalParameters the (optional) parameters of the method.
@return the result of the method execution
"""
return methodForShort(methodName, optionalParameters);
} | java | public static Function<Object,Short> shr(final String methodName, final Object... optionalParameters) {
return methodForShort(methodName, optionalParameters);
} | [
"public",
"static",
"Function",
"<",
"Object",
",",
"Short",
">",
"shr",
"(",
"final",
"String",
"methodName",
",",
"final",
"Object",
"...",
"optionalParameters",
")",
"{",
"return",
"methodForShort",
"(",
"methodName",
",",
"optionalParameters",
")",
";",
"}"
] | <p>
Abbreviation for {{@link #methodForShort(String, Object...)}.
</p>
@since 1.1
@param methodName the name of the method
@param optionalParameters the (optional) parameters of the method.
@return the result of the method execution | [
"<p",
">",
"Abbreviation",
"for",
"{{",
"@link",
"#methodForShort",
"(",
"String",
"Object",
"...",
")",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/Call.java#L488-L490 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/TrustedIdProvidersInner.java | TrustedIdProvidersInner.createOrUpdateAsync | public Observable<TrustedIdProviderInner> createOrUpdateAsync(String resourceGroupName, String accountName, String trustedIdProviderName, CreateOrUpdateTrustedIdProviderParameters parameters) {
"""
Creates or updates the specified trusted identity provider. During update, the trusted identity provider with the specified name will be replaced with this new provider.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@param trustedIdProviderName The name of the trusted identity provider. This is used for differentiation of providers in the account.
@param parameters Parameters supplied to create or replace the trusted identity provider.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the TrustedIdProviderInner object
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, trustedIdProviderName, parameters).map(new Func1<ServiceResponse<TrustedIdProviderInner>, TrustedIdProviderInner>() {
@Override
public TrustedIdProviderInner call(ServiceResponse<TrustedIdProviderInner> response) {
return response.body();
}
});
} | java | public Observable<TrustedIdProviderInner> createOrUpdateAsync(String resourceGroupName, String accountName, String trustedIdProviderName, CreateOrUpdateTrustedIdProviderParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, trustedIdProviderName, parameters).map(new Func1<ServiceResponse<TrustedIdProviderInner>, TrustedIdProviderInner>() {
@Override
public TrustedIdProviderInner call(ServiceResponse<TrustedIdProviderInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"TrustedIdProviderInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"trustedIdProviderName",
",",
"CreateOrUpdateTrustedIdProviderParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"trustedIdProviderName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"TrustedIdProviderInner",
">",
",",
"TrustedIdProviderInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"TrustedIdProviderInner",
"call",
"(",
"ServiceResponse",
"<",
"TrustedIdProviderInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Creates or updates the specified trusted identity provider. During update, the trusted identity provider with the specified name will be replaced with this new provider.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@param trustedIdProviderName The name of the trusted identity provider. This is used for differentiation of providers in the account.
@param parameters Parameters supplied to create or replace the trusted identity provider.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the TrustedIdProviderInner object | [
"Creates",
"or",
"updates",
"the",
"specified",
"trusted",
"identity",
"provider",
".",
"During",
"update",
"the",
"trusted",
"identity",
"provider",
"with",
"the",
"specified",
"name",
"will",
"be",
"replaced",
"with",
"this",
"new",
"provider",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/TrustedIdProvidersInner.java#L257-L264 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cdnwebstorage/src/main/java/net/minidev/ovh/api/ApiOvhCdnwebstorage.java | ApiOvhCdnwebstorage.serviceName_statistics_GET | public ArrayList<OvhStatsDataType> serviceName_statistics_GET(String serviceName, OvhStatsPeriodEnum period, OvhStatsTypeEnum type) throws IOException {
"""
Return stats about bandwidth consumption
REST: GET /cdn/webstorage/{serviceName}/statistics
@param type [required]
@param period [required]
@param serviceName [required] The internal name of your CDN Static offer
"""
String qPath = "/cdn/webstorage/{serviceName}/statistics";
StringBuilder sb = path(qPath, serviceName);
query(sb, "period", period);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<OvhStatsDataType> serviceName_statistics_GET(String serviceName, OvhStatsPeriodEnum period, OvhStatsTypeEnum type) throws IOException {
String qPath = "/cdn/webstorage/{serviceName}/statistics";
StringBuilder sb = path(qPath, serviceName);
query(sb, "period", period);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"OvhStatsDataType",
">",
"serviceName_statistics_GET",
"(",
"String",
"serviceName",
",",
"OvhStatsPeriodEnum",
"period",
",",
"OvhStatsTypeEnum",
"type",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cdn/webstorage/{serviceName}/statistics\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"query",
"(",
"sb",
",",
"\"period\"",
",",
"period",
")",
";",
"query",
"(",
"sb",
",",
"\"type\"",
",",
"type",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t1",
")",
";",
"}"
] | Return stats about bandwidth consumption
REST: GET /cdn/webstorage/{serviceName}/statistics
@param type [required]
@param period [required]
@param serviceName [required] The internal name of your CDN Static offer | [
"Return",
"stats",
"about",
"bandwidth",
"consumption"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cdnwebstorage/src/main/java/net/minidev/ovh/api/ApiOvhCdnwebstorage.java#L85-L92 |
spotbugs/spotbugs | spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/MainFrameComponentFactory.java | MainFrameComponentFactory.bugSummaryComponent | public Component bugSummaryComponent(String str, BugInstance bug) {
"""
Creates bug summary component. If obj is a string will create a JLabel
with that string as it's text and return it. If obj is an annotation will
return a JLabel with the annotation's toString(). If that annotation is a
SourceLineAnnotation or has a SourceLineAnnotation connected to it and
the source file is available will attach a listener to the label.
"""
JLabel label = new JLabel();
label.setFont(label.getFont().deriveFont(Driver.getFontSize()));
label.setFont(label.getFont().deriveFont(Font.PLAIN));
label.setForeground(Color.BLACK);
label.setText(str);
SourceLineAnnotation link = bug.getPrimarySourceLineAnnotation();
if (link != null) {
label.addMouseListener(new BugSummaryMouseListener(bug, label, link));
}
return label;
} | java | public Component bugSummaryComponent(String str, BugInstance bug) {
JLabel label = new JLabel();
label.setFont(label.getFont().deriveFont(Driver.getFontSize()));
label.setFont(label.getFont().deriveFont(Font.PLAIN));
label.setForeground(Color.BLACK);
label.setText(str);
SourceLineAnnotation link = bug.getPrimarySourceLineAnnotation();
if (link != null) {
label.addMouseListener(new BugSummaryMouseListener(bug, label, link));
}
return label;
} | [
"public",
"Component",
"bugSummaryComponent",
"(",
"String",
"str",
",",
"BugInstance",
"bug",
")",
"{",
"JLabel",
"label",
"=",
"new",
"JLabel",
"(",
")",
";",
"label",
".",
"setFont",
"(",
"label",
".",
"getFont",
"(",
")",
".",
"deriveFont",
"(",
"Driver",
".",
"getFontSize",
"(",
")",
")",
")",
";",
"label",
".",
"setFont",
"(",
"label",
".",
"getFont",
"(",
")",
".",
"deriveFont",
"(",
"Font",
".",
"PLAIN",
")",
")",
";",
"label",
".",
"setForeground",
"(",
"Color",
".",
"BLACK",
")",
";",
"label",
".",
"setText",
"(",
"str",
")",
";",
"SourceLineAnnotation",
"link",
"=",
"bug",
".",
"getPrimarySourceLineAnnotation",
"(",
")",
";",
"if",
"(",
"link",
"!=",
"null",
")",
"{",
"label",
".",
"addMouseListener",
"(",
"new",
"BugSummaryMouseListener",
"(",
"bug",
",",
"label",
",",
"link",
")",
")",
";",
"}",
"return",
"label",
";",
"}"
] | Creates bug summary component. If obj is a string will create a JLabel
with that string as it's text and return it. If obj is an annotation will
return a JLabel with the annotation's toString(). If that annotation is a
SourceLineAnnotation or has a SourceLineAnnotation connected to it and
the source file is available will attach a listener to the label. | [
"Creates",
"bug",
"summary",
"component",
".",
"If",
"obj",
"is",
"a",
"string",
"will",
"create",
"a",
"JLabel",
"with",
"that",
"string",
"as",
"it",
"s",
"text",
"and",
"return",
"it",
".",
"If",
"obj",
"is",
"an",
"annotation",
"will",
"return",
"a",
"JLabel",
"with",
"the",
"annotation",
"s",
"toString",
"()",
".",
"If",
"that",
"annotation",
"is",
"a",
"SourceLineAnnotation",
"or",
"has",
"a",
"SourceLineAnnotation",
"connected",
"to",
"it",
"and",
"the",
"source",
"file",
"is",
"available",
"will",
"attach",
"a",
"listener",
"to",
"the",
"label",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/MainFrameComponentFactory.java#L293-L307 |
jenkinsci/jenkins | core/src/main/java/jenkins/util/xml/XMLUtils.java | XMLUtils.getValue | public static @Nonnull String getValue(@Nonnull String xpath, @Nonnull File file, @Nonnull String fileDataEncoding) throws IOException, SAXException, XPathExpressionException {
"""
The a "value" from an XML file using XPath.
@param xpath The XPath expression to select the value.
@param file The file to read.
@param fileDataEncoding The file data format.
@return The data value. An empty {@link String} is returned when the expression does not evaluate
to anything in the document.
@throws IOException Error reading from the file.
@throws SAXException Error parsing the XML file data e.g. badly formed XML.
@throws XPathExpressionException Invalid XPath expression.
@since 2.0
"""
Document document = parse(file, fileDataEncoding);
return getValue(xpath, document);
} | java | public static @Nonnull String getValue(@Nonnull String xpath, @Nonnull File file, @Nonnull String fileDataEncoding) throws IOException, SAXException, XPathExpressionException {
Document document = parse(file, fileDataEncoding);
return getValue(xpath, document);
} | [
"public",
"static",
"@",
"Nonnull",
"String",
"getValue",
"(",
"@",
"Nonnull",
"String",
"xpath",
",",
"@",
"Nonnull",
"File",
"file",
",",
"@",
"Nonnull",
"String",
"fileDataEncoding",
")",
"throws",
"IOException",
",",
"SAXException",
",",
"XPathExpressionException",
"{",
"Document",
"document",
"=",
"parse",
"(",
"file",
",",
"fileDataEncoding",
")",
";",
"return",
"getValue",
"(",
"xpath",
",",
"document",
")",
";",
"}"
] | The a "value" from an XML file using XPath.
@param xpath The XPath expression to select the value.
@param file The file to read.
@param fileDataEncoding The file data format.
@return The data value. An empty {@link String} is returned when the expression does not evaluate
to anything in the document.
@throws IOException Error reading from the file.
@throws SAXException Error parsing the XML file data e.g. badly formed XML.
@throws XPathExpressionException Invalid XPath expression.
@since 2.0 | [
"The",
"a",
"value",
"from",
"an",
"XML",
"file",
"using",
"XPath",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/util/xml/XMLUtils.java#L179-L182 |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java | BasicFileServlet.calculateRangeLength | public static Long calculateRangeLength(FileRequestContext context, Range range) {
"""
Calculates the length of a given range.
@param context
@param range
@return
"""
if(range.start == -1) range.start = 0;
if(range.end == -1) range.end = context.file.length() - 1;
range.length = range.end - range.start + 1;
return range.length;
} | java | public static Long calculateRangeLength(FileRequestContext context, Range range) {
if(range.start == -1) range.start = 0;
if(range.end == -1) range.end = context.file.length() - 1;
range.length = range.end - range.start + 1;
return range.length;
} | [
"public",
"static",
"Long",
"calculateRangeLength",
"(",
"FileRequestContext",
"context",
",",
"Range",
"range",
")",
"{",
"if",
"(",
"range",
".",
"start",
"==",
"-",
"1",
")",
"range",
".",
"start",
"=",
"0",
";",
"if",
"(",
"range",
".",
"end",
"==",
"-",
"1",
")",
"range",
".",
"end",
"=",
"context",
".",
"file",
".",
"length",
"(",
")",
"-",
"1",
";",
"range",
".",
"length",
"=",
"range",
".",
"end",
"-",
"range",
".",
"start",
"+",
"1",
";",
"return",
"range",
".",
"length",
";",
"}"
] | Calculates the length of a given range.
@param context
@param range
@return | [
"Calculates",
"the",
"length",
"of",
"a",
"given",
"range",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java#L236-L241 |
jmxtrans/jmxtrans | jmxtrans-output/jmxtrans-output-jrobin/src/main/java/com/googlecode/jmxtrans/model/output/RRDToolWriter.java | RRDToolWriter.checkErrorStream | private void checkErrorStream(Process process) throws Exception {
"""
Check to see if there was an error processing an rrdtool command
"""
// rrdtool should use platform encoding (unless you did something
// very strange with your installation of rrdtool). So let's be
// explicit and use the presumed correct encoding to read errors.
try (
InputStream is = process.getErrorStream();
InputStreamReader isr = new InputStreamReader(is, Charset.defaultCharset());
BufferedReader br = new BufferedReader(isr)
) {
StringBuilder sb = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
sb.append(line);
}
if (sb.length() > 0) {
throw new RuntimeException(sb.toString());
}
}
} | java | private void checkErrorStream(Process process) throws Exception {
// rrdtool should use platform encoding (unless you did something
// very strange with your installation of rrdtool). So let's be
// explicit and use the presumed correct encoding to read errors.
try (
InputStream is = process.getErrorStream();
InputStreamReader isr = new InputStreamReader(is, Charset.defaultCharset());
BufferedReader br = new BufferedReader(isr)
) {
StringBuilder sb = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
sb.append(line);
}
if (sb.length() > 0) {
throw new RuntimeException(sb.toString());
}
}
} | [
"private",
"void",
"checkErrorStream",
"(",
"Process",
"process",
")",
"throws",
"Exception",
"{",
"// rrdtool should use platform encoding (unless you did something",
"// very strange with your installation of rrdtool). So let's be",
"// explicit and use the presumed correct encoding to read errors.",
"try",
"(",
"InputStream",
"is",
"=",
"process",
".",
"getErrorStream",
"(",
")",
";",
"InputStreamReader",
"isr",
"=",
"new",
"InputStreamReader",
"(",
"is",
",",
"Charset",
".",
"defaultCharset",
"(",
")",
")",
";",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
"(",
"isr",
")",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"line",
";",
"while",
"(",
"(",
"line",
"=",
"br",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"line",
")",
";",
"}",
"if",
"(",
"sb",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Check to see if there was an error processing an rrdtool command | [
"Check",
"to",
"see",
"if",
"there",
"was",
"an",
"error",
"processing",
"an",
"rrdtool",
"command"
] | train | https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-output/jmxtrans-output-jrobin/src/main/java/com/googlecode/jmxtrans/model/output/RRDToolWriter.java#L249-L267 |
alkacon/opencms-core | src/org/opencms/i18n/CmsMessages.java | CmsMessages.keyDefault | public String keyDefault(String keyName, String defaultValue) {
"""
Returns the localized resource string for a given message key.<p>
If the key was not found in the bundle, the provided default value
is returned.<p>
@param keyName the key for the desired string
@param defaultValue the default value in case the key does not exist in the bundle
@return the resource string for the given key it it exists, or the given default if not
"""
String result = key(keyName, true);
return (result == null) ? defaultValue : result;
} | java | public String keyDefault(String keyName, String defaultValue) {
String result = key(keyName, true);
return (result == null) ? defaultValue : result;
} | [
"public",
"String",
"keyDefault",
"(",
"String",
"keyName",
",",
"String",
"defaultValue",
")",
"{",
"String",
"result",
"=",
"key",
"(",
"keyName",
",",
"true",
")",
";",
"return",
"(",
"result",
"==",
"null",
")",
"?",
"defaultValue",
":",
"result",
";",
"}"
] | Returns the localized resource string for a given message key.<p>
If the key was not found in the bundle, the provided default value
is returned.<p>
@param keyName the key for the desired string
@param defaultValue the default value in case the key does not exist in the bundle
@return the resource string for the given key it it exists, or the given default if not | [
"Returns",
"the",
"localized",
"resource",
"string",
"for",
"a",
"given",
"message",
"key",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsMessages.java#L504-L508 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/terminal/IOSafeTerminalAdapter.java | IOSafeTerminalAdapter.createRuntimeExceptionConvertingAdapter | public static IOSafeTerminal createRuntimeExceptionConvertingAdapter(Terminal terminal) {
"""
Creates a wrapper around a Terminal that exposes it as a IOSafeTerminal. If any IOExceptions occur, they will be
wrapped by a RuntimeException and re-thrown.
@param terminal Terminal to wrap
@return IOSafeTerminal wrapping the supplied terminal
"""
if (terminal instanceof ExtendedTerminal) { // also handle Runtime-type:
return createRuntimeExceptionConvertingAdapter((ExtendedTerminal)terminal);
} else {
return new IOSafeTerminalAdapter(terminal, new ConvertToRuntimeException());
}
} | java | public static IOSafeTerminal createRuntimeExceptionConvertingAdapter(Terminal terminal) {
if (terminal instanceof ExtendedTerminal) { // also handle Runtime-type:
return createRuntimeExceptionConvertingAdapter((ExtendedTerminal)terminal);
} else {
return new IOSafeTerminalAdapter(terminal, new ConvertToRuntimeException());
}
} | [
"public",
"static",
"IOSafeTerminal",
"createRuntimeExceptionConvertingAdapter",
"(",
"Terminal",
"terminal",
")",
"{",
"if",
"(",
"terminal",
"instanceof",
"ExtendedTerminal",
")",
"{",
"// also handle Runtime-type:",
"return",
"createRuntimeExceptionConvertingAdapter",
"(",
"(",
"ExtendedTerminal",
")",
"terminal",
")",
";",
"}",
"else",
"{",
"return",
"new",
"IOSafeTerminalAdapter",
"(",
"terminal",
",",
"new",
"ConvertToRuntimeException",
"(",
")",
")",
";",
"}",
"}"
] | Creates a wrapper around a Terminal that exposes it as a IOSafeTerminal. If any IOExceptions occur, they will be
wrapped by a RuntimeException and re-thrown.
@param terminal Terminal to wrap
@return IOSafeTerminal wrapping the supplied terminal | [
"Creates",
"a",
"wrapper",
"around",
"a",
"Terminal",
"that",
"exposes",
"it",
"as",
"a",
"IOSafeTerminal",
".",
"If",
"any",
"IOExceptions",
"occur",
"they",
"will",
"be",
"wrapped",
"by",
"a",
"RuntimeException",
"and",
"re",
"-",
"thrown",
"."
] | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/terminal/IOSafeTerminalAdapter.java#L59-L65 |
aws/aws-cloudtrail-processing-library | src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/configuration/PropertiesFileConfiguration.java | PropertiesFileConfiguration.getBooleanProperty | private Boolean getBooleanProperty(Properties prop, String name) {
"""
Convert a string representation of a property to a boolean type.
@param prop the {@link Properties} needs conversion.
@param name a name to evaluate in the property file.
@return a boolean representation of the value associated with the property name.
"""
String propertyValue = prop.getProperty(name);
return Boolean.parseBoolean(propertyValue);
} | java | private Boolean getBooleanProperty(Properties prop, String name) {
String propertyValue = prop.getProperty(name);
return Boolean.parseBoolean(propertyValue);
} | [
"private",
"Boolean",
"getBooleanProperty",
"(",
"Properties",
"prop",
",",
"String",
"name",
")",
"{",
"String",
"propertyValue",
"=",
"prop",
".",
"getProperty",
"(",
"name",
")",
";",
"return",
"Boolean",
".",
"parseBoolean",
"(",
"propertyValue",
")",
";",
"}"
] | Convert a string representation of a property to a boolean type.
@param prop the {@link Properties} needs conversion.
@param name a name to evaluate in the property file.
@return a boolean representation of the value associated with the property name. | [
"Convert",
"a",
"string",
"representation",
"of",
"a",
"property",
"to",
"a",
"boolean",
"type",
"."
] | train | https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/configuration/PropertiesFileConfiguration.java#L292-L295 |
santhosh-tekuri/jlibs | core/src/main/java/jlibs/core/lang/ArrayUtil.java | ArrayUtil.concat | public static Object[] concat(Object array1[], Object array2[]) {
"""
Returns new array which has all values from array1 and array2 in order.
The componentType for the new array is determined by the componentTypes of
two arrays.
"""
Class<?> class1 = array1.getClass().getComponentType();
Class<?> class2 = array2.getClass().getComponentType();
Class<?> commonClass = class1.isAssignableFrom(class2)
? class1
: (class2.isAssignableFrom(class1) ? class2 : Object.class);
return concat(array1, array2, commonClass);
} | java | public static Object[] concat(Object array1[], Object array2[]){
Class<?> class1 = array1.getClass().getComponentType();
Class<?> class2 = array2.getClass().getComponentType();
Class<?> commonClass = class1.isAssignableFrom(class2)
? class1
: (class2.isAssignableFrom(class1) ? class2 : Object.class);
return concat(array1, array2, commonClass);
} | [
"public",
"static",
"Object",
"[",
"]",
"concat",
"(",
"Object",
"array1",
"[",
"]",
",",
"Object",
"array2",
"[",
"]",
")",
"{",
"Class",
"<",
"?",
">",
"class1",
"=",
"array1",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
";",
"Class",
"<",
"?",
">",
"class2",
"=",
"array2",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
";",
"Class",
"<",
"?",
">",
"commonClass",
"=",
"class1",
".",
"isAssignableFrom",
"(",
"class2",
")",
"?",
"class1",
":",
"(",
"class2",
".",
"isAssignableFrom",
"(",
"class1",
")",
"?",
"class2",
":",
"Object",
".",
"class",
")",
";",
"return",
"concat",
"(",
"array1",
",",
"array2",
",",
"commonClass",
")",
";",
"}"
] | Returns new array which has all values from array1 and array2 in order.
The componentType for the new array is determined by the componentTypes of
two arrays. | [
"Returns",
"new",
"array",
"which",
"has",
"all",
"values",
"from",
"array1",
"and",
"array2",
"in",
"order",
".",
"The",
"componentType",
"for",
"the",
"new",
"array",
"is",
"determined",
"by",
"the",
"componentTypes",
"of",
"two",
"arrays",
"."
] | train | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/ArrayUtil.java#L195-L202 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/view/ApptentiveNestedScrollView.java | ApptentiveNestedScrollView.pageScroll | public boolean pageScroll(int direction) {
"""
<p>Handles scrolling in response to a "page up/down" shortcut press. This
method will scroll the view by one page up or down and give the focus
to the topmost/bottommost component in the new visible area. If no
component is a good candidate for focus, this scrollview reclaims the
focus.</p>
@param direction the scroll direction: {@link android.view.View#FOCUS_UP}
to go one page up or
{@link android.view.View#FOCUS_DOWN} to go one page down
@return true if the key event is consumed by this method, false otherwise
"""
boolean down = direction == View.FOCUS_DOWN;
int height = getHeight();
if (down) {
mTempRect.top = getScrollY() + height;
int count = getChildCount();
if (count > 0) {
View view = getChildAt(count - 1);
if (mTempRect.top + height > view.getBottom()) {
mTempRect.top = view.getBottom() - height;
}
}
} else {
mTempRect.top = getScrollY() - height;
if (mTempRect.top < 0) {
mTempRect.top = 0;
}
}
mTempRect.bottom = mTempRect.top + height;
return scrollAndFocus(direction, mTempRect.top, mTempRect.bottom);
} | java | public boolean pageScroll(int direction) {
boolean down = direction == View.FOCUS_DOWN;
int height = getHeight();
if (down) {
mTempRect.top = getScrollY() + height;
int count = getChildCount();
if (count > 0) {
View view = getChildAt(count - 1);
if (mTempRect.top + height > view.getBottom()) {
mTempRect.top = view.getBottom() - height;
}
}
} else {
mTempRect.top = getScrollY() - height;
if (mTempRect.top < 0) {
mTempRect.top = 0;
}
}
mTempRect.bottom = mTempRect.top + height;
return scrollAndFocus(direction, mTempRect.top, mTempRect.bottom);
} | [
"public",
"boolean",
"pageScroll",
"(",
"int",
"direction",
")",
"{",
"boolean",
"down",
"=",
"direction",
"==",
"View",
".",
"FOCUS_DOWN",
";",
"int",
"height",
"=",
"getHeight",
"(",
")",
";",
"if",
"(",
"down",
")",
"{",
"mTempRect",
".",
"top",
"=",
"getScrollY",
"(",
")",
"+",
"height",
";",
"int",
"count",
"=",
"getChildCount",
"(",
")",
";",
"if",
"(",
"count",
">",
"0",
")",
"{",
"View",
"view",
"=",
"getChildAt",
"(",
"count",
"-",
"1",
")",
";",
"if",
"(",
"mTempRect",
".",
"top",
"+",
"height",
">",
"view",
".",
"getBottom",
"(",
")",
")",
"{",
"mTempRect",
".",
"top",
"=",
"view",
".",
"getBottom",
"(",
")",
"-",
"height",
";",
"}",
"}",
"}",
"else",
"{",
"mTempRect",
".",
"top",
"=",
"getScrollY",
"(",
")",
"-",
"height",
";",
"if",
"(",
"mTempRect",
".",
"top",
"<",
"0",
")",
"{",
"mTempRect",
".",
"top",
"=",
"0",
";",
"}",
"}",
"mTempRect",
".",
"bottom",
"=",
"mTempRect",
".",
"top",
"+",
"height",
";",
"return",
"scrollAndFocus",
"(",
"direction",
",",
"mTempRect",
".",
"top",
",",
"mTempRect",
".",
"bottom",
")",
";",
"}"
] | <p>Handles scrolling in response to a "page up/down" shortcut press. This
method will scroll the view by one page up or down and give the focus
to the topmost/bottommost component in the new visible area. If no
component is a good candidate for focus, this scrollview reclaims the
focus.</p>
@param direction the scroll direction: {@link android.view.View#FOCUS_UP}
to go one page up or
{@link android.view.View#FOCUS_DOWN} to go one page down
@return true if the key event is consumed by this method, false otherwise | [
"<p",
">",
"Handles",
"scrolling",
"in",
"response",
"to",
"a",
"page",
"up",
"/",
"down",
"shortcut",
"press",
".",
"This",
"method",
"will",
"scroll",
"the",
"view",
"by",
"one",
"page",
"up",
"or",
"down",
"and",
"give",
"the",
"focus",
"to",
"the",
"topmost",
"/",
"bottommost",
"component",
"in",
"the",
"new",
"visible",
"area",
".",
"If",
"no",
"component",
"is",
"a",
"good",
"candidate",
"for",
"focus",
"this",
"scrollview",
"reclaims",
"the",
"focus",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/view/ApptentiveNestedScrollView.java#L1112-L1134 |
wkgcass/Style | src/main/java/net/cassite/style/aggregation/MapFuncSup.java | MapFuncSup.forThose | public <R> R forThose(RFunc2<Boolean, K, V> predicate, def<R> func) {
"""
define a function to deal with each element in the map
@param predicate a function takes in each element from map and returns
true or false(or null)
@param func a function returns 'last loop result'
@return return 'last loop value'.<br>
check
<a href="https://github.com/wkgcass/Style/">tutorial</a> for
more info about 'last loop value'
@see IteratorInfo
"""
Iterator<K> it = map.keySet().iterator();
IteratorInfo<R> info = new IteratorInfo<>();
ptr<Integer> i = Style.ptr(0);
return Style.While(it::hasNext, (loopInfo) -> {
K k = it.next();
V v = map.get(k);
try {
return If(predicate.apply(k, v), () -> {
return func.apply(k, v, info.setValues(i.item - 1, i.item + 1, i.item != 0, it.hasNext(),
loopInfo.currentIndex, loopInfo.effectiveIndex, loopInfo.lastRes));
}).Else(() -> null);
} catch (Throwable err) {
StyleRuntimeException sErr = Style.$(err);
Throwable t = sErr.origin();
if (t instanceof Remove) {
it.remove();
} else {
throw sErr;
}
} finally {
i.item += 1;
}
return null;
} | java | public <R> R forThose(RFunc2<Boolean, K, V> predicate, def<R> func) {
Iterator<K> it = map.keySet().iterator();
IteratorInfo<R> info = new IteratorInfo<>();
ptr<Integer> i = Style.ptr(0);
return Style.While(it::hasNext, (loopInfo) -> {
K k = it.next();
V v = map.get(k);
try {
return If(predicate.apply(k, v), () -> {
return func.apply(k, v, info.setValues(i.item - 1, i.item + 1, i.item != 0, it.hasNext(),
loopInfo.currentIndex, loopInfo.effectiveIndex, loopInfo.lastRes));
}).Else(() -> null);
} catch (Throwable err) {
StyleRuntimeException sErr = Style.$(err);
Throwable t = sErr.origin();
if (t instanceof Remove) {
it.remove();
} else {
throw sErr;
}
} finally {
i.item += 1;
}
return null;
} | [
"public",
"<",
"R",
">",
"R",
"forThose",
"(",
"RFunc2",
"<",
"Boolean",
",",
"K",
",",
"V",
">",
"predicate",
",",
"def",
"<",
"R",
">",
"func",
")",
"{",
"Iterator",
"<",
"K",
">",
"it",
"=",
"map",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"IteratorInfo",
"<",
"R",
">",
"info",
"=",
"new",
"IteratorInfo",
"<>",
"(",
")",
";",
"ptr",
"<",
"Integer",
">",
"i",
"=",
"Style",
".",
"ptr",
"(",
"0",
")",
";",
"return",
"Style",
".",
"While",
"(",
"it",
"::",
"hasNext",
",",
"(",
"loopInfo",
")",
"-",
">",
"{",
"K",
"k",
"=",
"it",
".",
"next",
"(",
")",
"",
";",
"V",
"v",
"=",
"map",
".",
"get",
"(",
"k",
")",
";",
"try",
"{",
"return",
"If",
"(",
"predicate",
".",
"apply",
"(",
"k",
",",
"v",
")",
",",
"(",
")",
"->",
"{",
"return",
"func",
".",
"apply",
"(",
"k",
",",
"v",
",",
"info",
".",
"setValues",
"(",
"i",
".",
"item",
"-",
"1",
",",
"i",
".",
"item",
"+",
"1",
",",
"i",
".",
"item",
"!=",
"0",
",",
"it",
".",
"hasNext",
"(",
")",
",",
"loopInfo",
".",
"currentIndex",
",",
"loopInfo",
".",
"effectiveIndex",
",",
"loopInfo",
".",
"lastRes",
")",
")",
";",
"}",
")",
".",
"Else",
"(",
"(",
")",
"->",
"null",
")",
";",
"}",
"catch",
"(",
"Throwable",
"err",
")",
"{",
"StyleRuntimeException",
"sErr",
"=",
"Style",
".",
"$",
"(",
"err",
")",
";",
"Throwable",
"t",
"=",
"sErr",
".",
"origin",
"(",
")",
";",
"if",
"(",
"t",
"instanceof",
"Remove",
")",
"{",
"it",
".",
"remove",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"sErr",
";",
"}",
"}",
"finally",
"{",
"i",
".",
"item",
"+=",
"1",
";",
"}",
"return",
"null",
";",
"}"
] | define a function to deal with each element in the map
@param predicate a function takes in each element from map and returns
true or false(or null)
@param func a function returns 'last loop result'
@return return 'last loop value'.<br>
check
<a href="https://github.com/wkgcass/Style/">tutorial</a> for
more info about 'last loop value'
@see IteratorInfo | [
"define",
"a",
"function",
"to",
"deal",
"with",
"each",
"element",
"in",
"the",
"map"
] | train | https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/aggregation/MapFuncSup.java#L180-L204 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/util/LayoutUtils.java | LayoutUtils.moveBandsElemnts | public static void moveBandsElemnts(int yOffset, JRDesignBand band) {
"""
Moves the elements contained in "band" in the Y axis "yOffset"
@param yOffset
@param band
"""
if (band == null)
return;
for (JRChild jrChild : band.getChildren()) {
JRDesignElement elem = (JRDesignElement) jrChild;
elem.setY(elem.getY() + yOffset);
}
} | java | public static void moveBandsElemnts(int yOffset, JRDesignBand band) {
if (band == null)
return;
for (JRChild jrChild : band.getChildren()) {
JRDesignElement elem = (JRDesignElement) jrChild;
elem.setY(elem.getY() + yOffset);
}
} | [
"public",
"static",
"void",
"moveBandsElemnts",
"(",
"int",
"yOffset",
",",
"JRDesignBand",
"band",
")",
"{",
"if",
"(",
"band",
"==",
"null",
")",
"return",
";",
"for",
"(",
"JRChild",
"jrChild",
":",
"band",
".",
"getChildren",
"(",
")",
")",
"{",
"JRDesignElement",
"elem",
"=",
"(",
"JRDesignElement",
")",
"jrChild",
";",
"elem",
".",
"setY",
"(",
"elem",
".",
"getY",
"(",
")",
"+",
"yOffset",
")",
";",
"}",
"}"
] | Moves the elements contained in "band" in the Y axis "yOffset"
@param yOffset
@param band | [
"Moves",
"the",
"elements",
"contained",
"in",
"band",
"in",
"the",
"Y",
"axis",
"yOffset"
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/util/LayoutUtils.java#L89-L97 |
geomajas/geomajas-project-client-gwt2 | plugin/editing/common/src/main/java/org/geomajas/plugin/editing/client/operation/InsertVertexOperation.java | InsertVertexOperation.insertAfterEdge | private void insertAfterEdge(Geometry geom, GeometryIndex index, Coordinate coordinate)
throws GeometryIndexNotFoundException {
"""
Insert a point into a given edge. There can be only edges if there are at least 2 points in a LineString
geometry.
"""
// First we check the geometry type:
if (!Geometry.LINE_STRING.equals(geom.getGeometryType())
&& !Geometry.LINEAR_RING.equals(geom.getGeometryType())) {
throw new GeometryIndexNotFoundException("Could not match index with given geometry.");
}
if (index.getValue() < 0) {
throw new GeometryIndexNotFoundException("Cannot insert in a negative index.");
}
// Then we check if the edge exists:
if (geom.getCoordinates() != null && geom.getCoordinates().length > index.getValue() + 1) {
// Inserting on edges allows only to insert on existing edges. No adding at the end:
Coordinate[] result = new Coordinate[geom.getCoordinates().length + 1];
int count = 0;
for (int i = 0; i < geom.getCoordinates().length; i++) {
if (i == (index.getValue() + 1)) {
result[i] = coordinate;
count++;
}
result[i + count] = geom.getCoordinates()[i];
}
geom.setCoordinates(result);
} else {
throw new GeometryIndexNotFoundException("Cannot insert a vertex into an edge that does not exist.");
}
} | java | private void insertAfterEdge(Geometry geom, GeometryIndex index, Coordinate coordinate)
throws GeometryIndexNotFoundException {
// First we check the geometry type:
if (!Geometry.LINE_STRING.equals(geom.getGeometryType())
&& !Geometry.LINEAR_RING.equals(geom.getGeometryType())) {
throw new GeometryIndexNotFoundException("Could not match index with given geometry.");
}
if (index.getValue() < 0) {
throw new GeometryIndexNotFoundException("Cannot insert in a negative index.");
}
// Then we check if the edge exists:
if (geom.getCoordinates() != null && geom.getCoordinates().length > index.getValue() + 1) {
// Inserting on edges allows only to insert on existing edges. No adding at the end:
Coordinate[] result = new Coordinate[geom.getCoordinates().length + 1];
int count = 0;
for (int i = 0; i < geom.getCoordinates().length; i++) {
if (i == (index.getValue() + 1)) {
result[i] = coordinate;
count++;
}
result[i + count] = geom.getCoordinates()[i];
}
geom.setCoordinates(result);
} else {
throw new GeometryIndexNotFoundException("Cannot insert a vertex into an edge that does not exist.");
}
} | [
"private",
"void",
"insertAfterEdge",
"(",
"Geometry",
"geom",
",",
"GeometryIndex",
"index",
",",
"Coordinate",
"coordinate",
")",
"throws",
"GeometryIndexNotFoundException",
"{",
"// First we check the geometry type:",
"if",
"(",
"!",
"Geometry",
".",
"LINE_STRING",
".",
"equals",
"(",
"geom",
".",
"getGeometryType",
"(",
")",
")",
"&&",
"!",
"Geometry",
".",
"LINEAR_RING",
".",
"equals",
"(",
"geom",
".",
"getGeometryType",
"(",
")",
")",
")",
"{",
"throw",
"new",
"GeometryIndexNotFoundException",
"(",
"\"Could not match index with given geometry.\"",
")",
";",
"}",
"if",
"(",
"index",
".",
"getValue",
"(",
")",
"<",
"0",
")",
"{",
"throw",
"new",
"GeometryIndexNotFoundException",
"(",
"\"Cannot insert in a negative index.\"",
")",
";",
"}",
"// Then we check if the edge exists:",
"if",
"(",
"geom",
".",
"getCoordinates",
"(",
")",
"!=",
"null",
"&&",
"geom",
".",
"getCoordinates",
"(",
")",
".",
"length",
">",
"index",
".",
"getValue",
"(",
")",
"+",
"1",
")",
"{",
"// Inserting on edges allows only to insert on existing edges. No adding at the end:",
"Coordinate",
"[",
"]",
"result",
"=",
"new",
"Coordinate",
"[",
"geom",
".",
"getCoordinates",
"(",
")",
".",
"length",
"+",
"1",
"]",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"geom",
".",
"getCoordinates",
"(",
")",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"==",
"(",
"index",
".",
"getValue",
"(",
")",
"+",
"1",
")",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"coordinate",
";",
"count",
"++",
";",
"}",
"result",
"[",
"i",
"+",
"count",
"]",
"=",
"geom",
".",
"getCoordinates",
"(",
")",
"[",
"i",
"]",
";",
"}",
"geom",
".",
"setCoordinates",
"(",
"result",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"GeometryIndexNotFoundException",
"(",
"\"Cannot insert a vertex into an edge that does not exist.\"",
")",
";",
"}",
"}"
] | Insert a point into a given edge. There can be only edges if there are at least 2 points in a LineString
geometry. | [
"Insert",
"a",
"point",
"into",
"a",
"given",
"edge",
".",
"There",
"can",
"be",
"only",
"edges",
"if",
"there",
"are",
"at",
"least",
"2",
"points",
"in",
"a",
"LineString",
"geometry",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/editing/common/src/main/java/org/geomajas/plugin/editing/client/operation/InsertVertexOperation.java#L111-L138 |
reactor/reactor-netty | src/main/java/reactor/netty/http/server/ConnectionInfo.java | ConnectionInfo.newForwardedConnectionInfo | static ConnectionInfo newForwardedConnectionInfo(HttpRequest request, Channel channel) {
"""
Retrieve the connection information from the {@code "Forwarded"}/{@code "X-Forwarded-*"}
HTTP request headers, or from the current connection directly if none are found.
@param request the current server request
@param channel the current channel
@return the connection information
"""
if (request.headers().contains(FORWARDED_HEADER)) {
return parseForwardedInfo(request, (SocketChannel)channel);
}
else {
return parseXForwardedInfo(request, (SocketChannel)channel);
}
} | java | static ConnectionInfo newForwardedConnectionInfo(HttpRequest request, Channel channel) {
if (request.headers().contains(FORWARDED_HEADER)) {
return parseForwardedInfo(request, (SocketChannel)channel);
}
else {
return parseXForwardedInfo(request, (SocketChannel)channel);
}
} | [
"static",
"ConnectionInfo",
"newForwardedConnectionInfo",
"(",
"HttpRequest",
"request",
",",
"Channel",
"channel",
")",
"{",
"if",
"(",
"request",
".",
"headers",
"(",
")",
".",
"contains",
"(",
"FORWARDED_HEADER",
")",
")",
"{",
"return",
"parseForwardedInfo",
"(",
"request",
",",
"(",
"SocketChannel",
")",
"channel",
")",
";",
"}",
"else",
"{",
"return",
"parseXForwardedInfo",
"(",
"request",
",",
"(",
"SocketChannel",
")",
"channel",
")",
";",
"}",
"}"
] | Retrieve the connection information from the {@code "Forwarded"}/{@code "X-Forwarded-*"}
HTTP request headers, or from the current connection directly if none are found.
@param request the current server request
@param channel the current channel
@return the connection information | [
"Retrieve",
"the",
"connection",
"information",
"from",
"the",
"{"
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/http/server/ConnectionInfo.java#L92-L99 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermListsImpl.java | ListManagementTermListsImpl.refreshIndexMethod | public RefreshIndex refreshIndexMethod(String listId, String language) {
"""
Refreshes the index of the list with list Id equal to list ID passed.
@param listId List Id of the image list.
@param language Language of the terms.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RefreshIndex object if successful.
"""
return refreshIndexMethodWithServiceResponseAsync(listId, language).toBlocking().single().body();
} | java | public RefreshIndex refreshIndexMethod(String listId, String language) {
return refreshIndexMethodWithServiceResponseAsync(listId, language).toBlocking().single().body();
} | [
"public",
"RefreshIndex",
"refreshIndexMethod",
"(",
"String",
"listId",
",",
"String",
"language",
")",
"{",
"return",
"refreshIndexMethodWithServiceResponseAsync",
"(",
"listId",
",",
"language",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Refreshes the index of the list with list Id equal to list ID passed.
@param listId List Id of the image list.
@param language Language of the terms.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RefreshIndex object if successful. | [
"Refreshes",
"the",
"index",
"of",
"the",
"list",
"with",
"list",
"Id",
"equal",
"to",
"list",
"ID",
"passed",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermListsImpl.java#L502-L504 |
threerings/nenya | core/src/main/java/com/threerings/miso/client/MisoScenePanel.java | MisoScenePanel.appendDirtySprite | protected void appendDirtySprite (DirtyItemList list, Sprite sprite) {
"""
Computes the tile coordinates of the supplied sprite and appends it to the supplied dirty
item list.
"""
MisoUtil.screenToTile(_metrics, sprite.getX(), sprite.getY(), _tcoords);
list.appendDirtySprite(sprite, _tcoords.x, _tcoords.y);
} | java | protected void appendDirtySprite (DirtyItemList list, Sprite sprite)
{
MisoUtil.screenToTile(_metrics, sprite.getX(), sprite.getY(), _tcoords);
list.appendDirtySprite(sprite, _tcoords.x, _tcoords.y);
} | [
"protected",
"void",
"appendDirtySprite",
"(",
"DirtyItemList",
"list",
",",
"Sprite",
"sprite",
")",
"{",
"MisoUtil",
".",
"screenToTile",
"(",
"_metrics",
",",
"sprite",
".",
"getX",
"(",
")",
",",
"sprite",
".",
"getY",
"(",
")",
",",
"_tcoords",
")",
";",
"list",
".",
"appendDirtySprite",
"(",
"sprite",
",",
"_tcoords",
".",
"x",
",",
"_tcoords",
".",
"y",
")",
";",
"}"
] | Computes the tile coordinates of the supplied sprite and appends it to the supplied dirty
item list. | [
"Computes",
"the",
"tile",
"coordinates",
"of",
"the",
"supplied",
"sprite",
"and",
"appends",
"it",
"to",
"the",
"supplied",
"dirty",
"item",
"list",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L756-L760 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/util/PropertyPlaceholderHelper.java | PropertyPlaceholderHelper.replacePlaceholders | public String replacePlaceholders(String value, PlaceholderResolver placeholderResolver) {
"""
Replaces all placeholders of format {@code ${name}} with the value returned
from the supplied {@link PlaceholderResolver}.
@param value the value containing the placeholders to be replaced
@param placeholderResolver the {@code PlaceholderResolver} to use for replacement
@return the supplied value with placeholders replaced inline
"""
Assert.notNull(value, "'value' must not be null");
return parseStringValue(value, placeholderResolver, new HashSet<String>());
} | java | public String replacePlaceholders(String value, PlaceholderResolver placeholderResolver) {
Assert.notNull(value, "'value' must not be null");
return parseStringValue(value, placeholderResolver, new HashSet<String>());
} | [
"public",
"String",
"replacePlaceholders",
"(",
"String",
"value",
",",
"PlaceholderResolver",
"placeholderResolver",
")",
"{",
"Assert",
".",
"notNull",
"(",
"value",
",",
"\"'value' must not be null\"",
")",
";",
"return",
"parseStringValue",
"(",
"value",
",",
"placeholderResolver",
",",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
")",
";",
"}"
] | Replaces all placeholders of format {@code ${name}} with the value returned
from the supplied {@link PlaceholderResolver}.
@param value the value containing the placeholders to be replaced
@param placeholderResolver the {@code PlaceholderResolver} to use for replacement
@return the supplied value with placeholders replaced inline | [
"Replaces",
"all",
"placeholders",
"of",
"format",
"{"
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/util/PropertyPlaceholderHelper.java#L124-L127 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java | Math.addExact | public static int addExact(int x, int y) {
"""
Returns the sum of its arguments,
throwing an exception if the result overflows an {@code int}.
@param x the first value
@param y the second value
@return the result
@throws ArithmeticException if the result overflows an int
@since 1.8
"""
int r = x + y;
// HD 2-12 Overflow iff both arguments have the opposite sign of the result
if (((x ^ r) & (y ^ r)) < 0) {
throw new ArithmeticException("integer overflow");
}
return r;
} | java | public static int addExact(int x, int y) {
int r = x + y;
// HD 2-12 Overflow iff both arguments have the opposite sign of the result
if (((x ^ r) & (y ^ r)) < 0) {
throw new ArithmeticException("integer overflow");
}
return r;
} | [
"public",
"static",
"int",
"addExact",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"r",
"=",
"x",
"+",
"y",
";",
"// HD 2-12 Overflow iff both arguments have the opposite sign of the result",
"if",
"(",
"(",
"(",
"x",
"^",
"r",
")",
"&",
"(",
"y",
"^",
"r",
")",
")",
"<",
"0",
")",
"{",
"throw",
"new",
"ArithmeticException",
"(",
"\"integer overflow\"",
")",
";",
"}",
"return",
"r",
";",
"}"
] | Returns the sum of its arguments,
throwing an exception if the result overflows an {@code int}.
@param x the first value
@param y the second value
@return the result
@throws ArithmeticException if the result overflows an int
@since 1.8 | [
"Returns",
"the",
"sum",
"of",
"its",
"arguments",
"throwing",
"an",
"exception",
"if",
"the",
"result",
"overflows",
"an",
"{",
"@code",
"int",
"}",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java#L791-L798 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsAreaSelectPanel.java | CmsAreaSelectPanel.getYForX | private int getYForX(int newX, int newY) {
"""
Calculates the matching Y (top/height) value in case of a fixed height/width ratio.<p>
@param newX the cursor X offset to the selection area
@param newY the cursor Y offset to the selection area
@return the matching Y value
"""
int height = (int)Math.floor((newX - m_firstX) * m_heightToWidth);
int result = m_firstY + height;
if (((m_firstY - newY) * (m_firstY - result)) < 0) {
result = m_firstY - height;
}
return result;
} | java | private int getYForX(int newX, int newY) {
int height = (int)Math.floor((newX - m_firstX) * m_heightToWidth);
int result = m_firstY + height;
if (((m_firstY - newY) * (m_firstY - result)) < 0) {
result = m_firstY - height;
}
return result;
} | [
"private",
"int",
"getYForX",
"(",
"int",
"newX",
",",
"int",
"newY",
")",
"{",
"int",
"height",
"=",
"(",
"int",
")",
"Math",
".",
"floor",
"(",
"(",
"newX",
"-",
"m_firstX",
")",
"*",
"m_heightToWidth",
")",
";",
"int",
"result",
"=",
"m_firstY",
"+",
"height",
";",
"if",
"(",
"(",
"(",
"m_firstY",
"-",
"newY",
")",
"*",
"(",
"m_firstY",
"-",
"result",
")",
")",
"<",
"0",
")",
"{",
"result",
"=",
"m_firstY",
"-",
"height",
";",
"}",
"return",
"result",
";",
"}"
] | Calculates the matching Y (top/height) value in case of a fixed height/width ratio.<p>
@param newX the cursor X offset to the selection area
@param newY the cursor Y offset to the selection area
@return the matching Y value | [
"Calculates",
"the",
"matching",
"Y",
"(",
"top",
"/",
"height",
")",
"value",
"in",
"case",
"of",
"a",
"fixed",
"height",
"/",
"width",
"ratio",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsAreaSelectPanel.java#L673-L681 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java | ApiOvhHostingprivateDatabase.serviceName_database_databaseName_GET | public OvhDatabase serviceName_database_databaseName_GET(String serviceName, String databaseName) throws IOException {
"""
Get this object properties
REST: GET /hosting/privateDatabase/{serviceName}/database/{databaseName}
@param serviceName [required] The internal name of your private database
@param databaseName [required] Database name
"""
String qPath = "/hosting/privateDatabase/{serviceName}/database/{databaseName}";
StringBuilder sb = path(qPath, serviceName, databaseName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDatabase.class);
} | java | public OvhDatabase serviceName_database_databaseName_GET(String serviceName, String databaseName) throws IOException {
String qPath = "/hosting/privateDatabase/{serviceName}/database/{databaseName}";
StringBuilder sb = path(qPath, serviceName, databaseName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDatabase.class);
} | [
"public",
"OvhDatabase",
"serviceName_database_databaseName_GET",
"(",
"String",
"serviceName",
",",
"String",
"databaseName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/privateDatabase/{serviceName}/database/{databaseName}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"databaseName",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhDatabase",
".",
"class",
")",
";",
"}"
] | Get this object properties
REST: GET /hosting/privateDatabase/{serviceName}/database/{databaseName}
@param serviceName [required] The internal name of your private database
@param databaseName [required] Database name | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java#L578-L583 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java | HtmlDocWriter.getHyperLink | public Content getHyperLink(SectionName sectionName, String where,
Content label) {
"""
Get Html Hyper Link Content.
@param sectionName The section name combined with where to which the link
will be created.
@param where The fragment combined with sectionName to which the link
will be created.
@param label Tag for the link.
@return a content tree for the hyper link
"""
return getHyperLink(getDocLink(sectionName, where), label, "", "");
} | java | public Content getHyperLink(SectionName sectionName, String where,
Content label) {
return getHyperLink(getDocLink(sectionName, where), label, "", "");
} | [
"public",
"Content",
"getHyperLink",
"(",
"SectionName",
"sectionName",
",",
"String",
"where",
",",
"Content",
"label",
")",
"{",
"return",
"getHyperLink",
"(",
"getDocLink",
"(",
"sectionName",
",",
"where",
")",
",",
"label",
",",
"\"\"",
",",
"\"\"",
")",
";",
"}"
] | Get Html Hyper Link Content.
@param sectionName The section name combined with where to which the link
will be created.
@param where The fragment combined with sectionName to which the link
will be created.
@param label Tag for the link.
@return a content tree for the hyper link | [
"Get",
"Html",
"Hyper",
"Link",
"Content",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java#L121-L124 |
undertow-io/undertow | core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/NodePingUtil.java | NodePingUtil.internalPingNode | static void internalPingNode(Node node, PingCallback callback, NodeHealthChecker healthChecker, XnioIoThread ioThread, ByteBufferPool bufferPool, UndertowClient client, XnioSsl xnioSsl, OptionMap options) {
"""
Internally ping a node. This should probably use the connections from the nodes pool, if there are any available.
@param node the node
@param callback the ping callback
@param ioThread the xnio i/o thread
@param bufferPool the xnio buffer pool
@param client the undertow client
@param xnioSsl the ssl setup
@param options the options
"""
final URI uri = node.getNodeConfig().getConnectionURI();
final long timeout = node.getNodeConfig().getPing();
final RequestExchangeListener exchangeListener = new RequestExchangeListener(callback, healthChecker, true);
final HttpClientPingTask r = new HttpClientPingTask(uri, exchangeListener, ioThread, client, xnioSsl, bufferPool, options);
// Schedule timeout task
scheduleCancelTask(ioThread, exchangeListener, timeout, TimeUnit.SECONDS);
ioThread.execute(r);
} | java | static void internalPingNode(Node node, PingCallback callback, NodeHealthChecker healthChecker, XnioIoThread ioThread, ByteBufferPool bufferPool, UndertowClient client, XnioSsl xnioSsl, OptionMap options) {
final URI uri = node.getNodeConfig().getConnectionURI();
final long timeout = node.getNodeConfig().getPing();
final RequestExchangeListener exchangeListener = new RequestExchangeListener(callback, healthChecker, true);
final HttpClientPingTask r = new HttpClientPingTask(uri, exchangeListener, ioThread, client, xnioSsl, bufferPool, options);
// Schedule timeout task
scheduleCancelTask(ioThread, exchangeListener, timeout, TimeUnit.SECONDS);
ioThread.execute(r);
} | [
"static",
"void",
"internalPingNode",
"(",
"Node",
"node",
",",
"PingCallback",
"callback",
",",
"NodeHealthChecker",
"healthChecker",
",",
"XnioIoThread",
"ioThread",
",",
"ByteBufferPool",
"bufferPool",
",",
"UndertowClient",
"client",
",",
"XnioSsl",
"xnioSsl",
",",
"OptionMap",
"options",
")",
"{",
"final",
"URI",
"uri",
"=",
"node",
".",
"getNodeConfig",
"(",
")",
".",
"getConnectionURI",
"(",
")",
";",
"final",
"long",
"timeout",
"=",
"node",
".",
"getNodeConfig",
"(",
")",
".",
"getPing",
"(",
")",
";",
"final",
"RequestExchangeListener",
"exchangeListener",
"=",
"new",
"RequestExchangeListener",
"(",
"callback",
",",
"healthChecker",
",",
"true",
")",
";",
"final",
"HttpClientPingTask",
"r",
"=",
"new",
"HttpClientPingTask",
"(",
"uri",
",",
"exchangeListener",
",",
"ioThread",
",",
"client",
",",
"xnioSsl",
",",
"bufferPool",
",",
"options",
")",
";",
"// Schedule timeout task",
"scheduleCancelTask",
"(",
"ioThread",
",",
"exchangeListener",
",",
"timeout",
",",
"TimeUnit",
".",
"SECONDS",
")",
";",
"ioThread",
".",
"execute",
"(",
"r",
")",
";",
"}"
] | Internally ping a node. This should probably use the connections from the nodes pool, if there are any available.
@param node the node
@param callback the ping callback
@param ioThread the xnio i/o thread
@param bufferPool the xnio buffer pool
@param client the undertow client
@param xnioSsl the ssl setup
@param options the options | [
"Internally",
"ping",
"a",
"node",
".",
"This",
"should",
"probably",
"use",
"the",
"connections",
"from",
"the",
"nodes",
"pool",
"if",
"there",
"are",
"any",
"available",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/NodePingUtil.java#L170-L179 |
xwiki/xwiki-rendering | xwiki-rendering-transformations/xwiki-rendering-transformation-macro/src/main/java/org/xwiki/rendering/internal/transformation/macro/MacroErrorManager.java | MacroErrorManager.generateError | public void generateError(MacroBlock macroToReplace, String message, Throwable throwable) {
"""
Generates Blocks to signify that the passed Macro Block has failed to execute.
@param macroToReplace the block for the macro that failed to execute and that we'll replace with Block
showing to the user that macro has failed
@param message the message to display to the user in place of the macro result
@param throwable the exception for the failed macro execution to display to the user in place of the macro result
"""
List<Block> errorBlocks =
this.errorBlockGenerator.generateErrorBlocks(message, throwable, macroToReplace.isInline());
macroToReplace.getParent().replaceChild(wrapInMacroMarker(macroToReplace, errorBlocks), macroToReplace);
} | java | public void generateError(MacroBlock macroToReplace, String message, Throwable throwable)
{
List<Block> errorBlocks =
this.errorBlockGenerator.generateErrorBlocks(message, throwable, macroToReplace.isInline());
macroToReplace.getParent().replaceChild(wrapInMacroMarker(macroToReplace, errorBlocks), macroToReplace);
} | [
"public",
"void",
"generateError",
"(",
"MacroBlock",
"macroToReplace",
",",
"String",
"message",
",",
"Throwable",
"throwable",
")",
"{",
"List",
"<",
"Block",
">",
"errorBlocks",
"=",
"this",
".",
"errorBlockGenerator",
".",
"generateErrorBlocks",
"(",
"message",
",",
"throwable",
",",
"macroToReplace",
".",
"isInline",
"(",
")",
")",
";",
"macroToReplace",
".",
"getParent",
"(",
")",
".",
"replaceChild",
"(",
"wrapInMacroMarker",
"(",
"macroToReplace",
",",
"errorBlocks",
")",
",",
"macroToReplace",
")",
";",
"}"
] | Generates Blocks to signify that the passed Macro Block has failed to execute.
@param macroToReplace the block for the macro that failed to execute and that we'll replace with Block
showing to the user that macro has failed
@param message the message to display to the user in place of the macro result
@param throwable the exception for the failed macro execution to display to the user in place of the macro result | [
"Generates",
"Blocks",
"to",
"signify",
"that",
"the",
"passed",
"Macro",
"Block",
"has",
"failed",
"to",
"execute",
"."
] | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-transformations/xwiki-rendering-transformation-macro/src/main/java/org/xwiki/rendering/internal/transformation/macro/MacroErrorManager.java#L75-L80 |
lucee/Lucee | core/src/main/java/lucee/runtime/config/ConfigWebUtil.java | ConfigWebUtil.hasAccess | public static boolean hasAccess(Config config, int type) {
"""
has access checks if config object has access to given type
@param config
@param type
@return has access
"""
boolean has = true;
if (config instanceof ConfigWeb) {
has = ((ConfigWeb) config).getSecurityManager().getAccess(type) != SecurityManager.VALUE_NO;
}
return has;
} | java | public static boolean hasAccess(Config config, int type) {
boolean has = true;
if (config instanceof ConfigWeb) {
has = ((ConfigWeb) config).getSecurityManager().getAccess(type) != SecurityManager.VALUE_NO;
}
return has;
} | [
"public",
"static",
"boolean",
"hasAccess",
"(",
"Config",
"config",
",",
"int",
"type",
")",
"{",
"boolean",
"has",
"=",
"true",
";",
"if",
"(",
"config",
"instanceof",
"ConfigWeb",
")",
"{",
"has",
"=",
"(",
"(",
"ConfigWeb",
")",
"config",
")",
".",
"getSecurityManager",
"(",
")",
".",
"getAccess",
"(",
"type",
")",
"!=",
"SecurityManager",
".",
"VALUE_NO",
";",
"}",
"return",
"has",
";",
"}"
] | has access checks if config object has access to given type
@param config
@param type
@return has access | [
"has",
"access",
"checks",
"if",
"config",
"object",
"has",
"access",
"to",
"given",
"type"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigWebUtil.java#L427-L434 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.rotateTowards | public Matrix4f rotateTowards(float dirX, float dirY, float dirZ, float upX, float upY, float upZ, Matrix4f dest) {
"""
Apply a model transformation to this matrix for a right-handed coordinate system,
that aligns the local <code>+Z</code> axis with <code>(dirX, dirY, dirZ)</code>
and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookat matrix,
then the new matrix will be <code>M * L</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * L * v</code>,
the lookat transformation will be applied first!
<p>
In order to set the matrix to a rotation transformation without post-multiplying it,
use {@link #rotationTowards(float, float, float, float, float, float) rotationTowards()}.
<p>
This method is equivalent to calling: <code>mulAffine(new Matrix4f().lookAt(0, 0, 0, -dirX, -dirY, -dirZ, upX, upY, upZ).invertAffine(), dest)</code>
@see #rotateTowards(Vector3fc, Vector3fc)
@see #rotationTowards(float, float, float, float, float, float)
@param dirX
the x-coordinate of the direction to rotate towards
@param dirY
the y-coordinate of the direction to rotate towards
@param dirZ
the z-coordinate of the direction to rotate towards
@param upX
the x-coordinate of the up vector
@param upY
the y-coordinate of the up vector
@param upZ
the z-coordinate of the up vector
@param dest
will hold the result
@return dest
"""
// Normalize direction
float invDirLength = 1.0f / (float) Math.sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ);
float ndirX = dirX * invDirLength;
float ndirY = dirY * invDirLength;
float ndirZ = dirZ * invDirLength;
// left = up x direction
float leftX, leftY, leftZ;
leftX = upY * ndirZ - upZ * ndirY;
leftY = upZ * ndirX - upX * ndirZ;
leftZ = upX * ndirY - upY * ndirX;
// normalize left
float invLeftLength = 1.0f / (float) Math.sqrt(leftX * leftX + leftY * leftY + leftZ * leftZ);
leftX *= invLeftLength;
leftY *= invLeftLength;
leftZ *= invLeftLength;
// up = direction x left
float upnX = ndirY * leftZ - ndirZ * leftY;
float upnY = ndirZ * leftX - ndirX * leftZ;
float upnZ = ndirX * leftY - ndirY * leftX;
float rm00 = leftX;
float rm01 = leftY;
float rm02 = leftZ;
float rm10 = upnX;
float rm11 = upnY;
float rm12 = upnZ;
float rm20 = ndirX;
float rm21 = ndirY;
float rm22 = ndirZ;
dest._m30(m30);
dest._m31(m31);
dest._m32(m32);
dest._m33(m33);
float nm00 = m00 * rm00 + m10 * rm01 + m20 * rm02;
float nm01 = m01 * rm00 + m11 * rm01 + m21 * rm02;
float nm02 = m02 * rm00 + m12 * rm01 + m22 * rm02;
float nm03 = m03 * rm00 + m13 * rm01 + m23 * rm02;
float nm10 = m00 * rm10 + m10 * rm11 + m20 * rm12;
float nm11 = m01 * rm10 + m11 * rm11 + m21 * rm12;
float nm12 = m02 * rm10 + m12 * rm11 + m22 * rm12;
float nm13 = m03 * rm10 + m13 * rm11 + m23 * rm12;
dest._m20(m00 * rm20 + m10 * rm21 + m20 * rm22);
dest._m21(m01 * rm20 + m11 * rm21 + m21 * rm22);
dest._m22(m02 * rm20 + m12 * rm21 + m22 * rm22);
dest._m23(m03 * rm20 + m13 * rm21 + m23 * rm22);
dest._m00(nm00);
dest._m01(nm01);
dest._m02(nm02);
dest._m03(nm03);
dest._m10(nm10);
dest._m11(nm11);
dest._m12(nm12);
dest._m13(nm13);
dest._properties(properties & ~(PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION));
return dest;
} | java | public Matrix4f rotateTowards(float dirX, float dirY, float dirZ, float upX, float upY, float upZ, Matrix4f dest) {
// Normalize direction
float invDirLength = 1.0f / (float) Math.sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ);
float ndirX = dirX * invDirLength;
float ndirY = dirY * invDirLength;
float ndirZ = dirZ * invDirLength;
// left = up x direction
float leftX, leftY, leftZ;
leftX = upY * ndirZ - upZ * ndirY;
leftY = upZ * ndirX - upX * ndirZ;
leftZ = upX * ndirY - upY * ndirX;
// normalize left
float invLeftLength = 1.0f / (float) Math.sqrt(leftX * leftX + leftY * leftY + leftZ * leftZ);
leftX *= invLeftLength;
leftY *= invLeftLength;
leftZ *= invLeftLength;
// up = direction x left
float upnX = ndirY * leftZ - ndirZ * leftY;
float upnY = ndirZ * leftX - ndirX * leftZ;
float upnZ = ndirX * leftY - ndirY * leftX;
float rm00 = leftX;
float rm01 = leftY;
float rm02 = leftZ;
float rm10 = upnX;
float rm11 = upnY;
float rm12 = upnZ;
float rm20 = ndirX;
float rm21 = ndirY;
float rm22 = ndirZ;
dest._m30(m30);
dest._m31(m31);
dest._m32(m32);
dest._m33(m33);
float nm00 = m00 * rm00 + m10 * rm01 + m20 * rm02;
float nm01 = m01 * rm00 + m11 * rm01 + m21 * rm02;
float nm02 = m02 * rm00 + m12 * rm01 + m22 * rm02;
float nm03 = m03 * rm00 + m13 * rm01 + m23 * rm02;
float nm10 = m00 * rm10 + m10 * rm11 + m20 * rm12;
float nm11 = m01 * rm10 + m11 * rm11 + m21 * rm12;
float nm12 = m02 * rm10 + m12 * rm11 + m22 * rm12;
float nm13 = m03 * rm10 + m13 * rm11 + m23 * rm12;
dest._m20(m00 * rm20 + m10 * rm21 + m20 * rm22);
dest._m21(m01 * rm20 + m11 * rm21 + m21 * rm22);
dest._m22(m02 * rm20 + m12 * rm21 + m22 * rm22);
dest._m23(m03 * rm20 + m13 * rm21 + m23 * rm22);
dest._m00(nm00);
dest._m01(nm01);
dest._m02(nm02);
dest._m03(nm03);
dest._m10(nm10);
dest._m11(nm11);
dest._m12(nm12);
dest._m13(nm13);
dest._properties(properties & ~(PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION));
return dest;
} | [
"public",
"Matrix4f",
"rotateTowards",
"(",
"float",
"dirX",
",",
"float",
"dirY",
",",
"float",
"dirZ",
",",
"float",
"upX",
",",
"float",
"upY",
",",
"float",
"upZ",
",",
"Matrix4f",
"dest",
")",
"{",
"// Normalize direction",
"float",
"invDirLength",
"=",
"1.0f",
"/",
"(",
"float",
")",
"Math",
".",
"sqrt",
"(",
"dirX",
"*",
"dirX",
"+",
"dirY",
"*",
"dirY",
"+",
"dirZ",
"*",
"dirZ",
")",
";",
"float",
"ndirX",
"=",
"dirX",
"*",
"invDirLength",
";",
"float",
"ndirY",
"=",
"dirY",
"*",
"invDirLength",
";",
"float",
"ndirZ",
"=",
"dirZ",
"*",
"invDirLength",
";",
"// left = up x direction",
"float",
"leftX",
",",
"leftY",
",",
"leftZ",
";",
"leftX",
"=",
"upY",
"*",
"ndirZ",
"-",
"upZ",
"*",
"ndirY",
";",
"leftY",
"=",
"upZ",
"*",
"ndirX",
"-",
"upX",
"*",
"ndirZ",
";",
"leftZ",
"=",
"upX",
"*",
"ndirY",
"-",
"upY",
"*",
"ndirX",
";",
"// normalize left",
"float",
"invLeftLength",
"=",
"1.0f",
"/",
"(",
"float",
")",
"Math",
".",
"sqrt",
"(",
"leftX",
"*",
"leftX",
"+",
"leftY",
"*",
"leftY",
"+",
"leftZ",
"*",
"leftZ",
")",
";",
"leftX",
"*=",
"invLeftLength",
";",
"leftY",
"*=",
"invLeftLength",
";",
"leftZ",
"*=",
"invLeftLength",
";",
"// up = direction x left",
"float",
"upnX",
"=",
"ndirY",
"*",
"leftZ",
"-",
"ndirZ",
"*",
"leftY",
";",
"float",
"upnY",
"=",
"ndirZ",
"*",
"leftX",
"-",
"ndirX",
"*",
"leftZ",
";",
"float",
"upnZ",
"=",
"ndirX",
"*",
"leftY",
"-",
"ndirY",
"*",
"leftX",
";",
"float",
"rm00",
"=",
"leftX",
";",
"float",
"rm01",
"=",
"leftY",
";",
"float",
"rm02",
"=",
"leftZ",
";",
"float",
"rm10",
"=",
"upnX",
";",
"float",
"rm11",
"=",
"upnY",
";",
"float",
"rm12",
"=",
"upnZ",
";",
"float",
"rm20",
"=",
"ndirX",
";",
"float",
"rm21",
"=",
"ndirY",
";",
"float",
"rm22",
"=",
"ndirZ",
";",
"dest",
".",
"_m30",
"(",
"m30",
")",
";",
"dest",
".",
"_m31",
"(",
"m31",
")",
";",
"dest",
".",
"_m32",
"(",
"m32",
")",
";",
"dest",
".",
"_m33",
"(",
"m33",
")",
";",
"float",
"nm00",
"=",
"m00",
"*",
"rm00",
"+",
"m10",
"*",
"rm01",
"+",
"m20",
"*",
"rm02",
";",
"float",
"nm01",
"=",
"m01",
"*",
"rm00",
"+",
"m11",
"*",
"rm01",
"+",
"m21",
"*",
"rm02",
";",
"float",
"nm02",
"=",
"m02",
"*",
"rm00",
"+",
"m12",
"*",
"rm01",
"+",
"m22",
"*",
"rm02",
";",
"float",
"nm03",
"=",
"m03",
"*",
"rm00",
"+",
"m13",
"*",
"rm01",
"+",
"m23",
"*",
"rm02",
";",
"float",
"nm10",
"=",
"m00",
"*",
"rm10",
"+",
"m10",
"*",
"rm11",
"+",
"m20",
"*",
"rm12",
";",
"float",
"nm11",
"=",
"m01",
"*",
"rm10",
"+",
"m11",
"*",
"rm11",
"+",
"m21",
"*",
"rm12",
";",
"float",
"nm12",
"=",
"m02",
"*",
"rm10",
"+",
"m12",
"*",
"rm11",
"+",
"m22",
"*",
"rm12",
";",
"float",
"nm13",
"=",
"m03",
"*",
"rm10",
"+",
"m13",
"*",
"rm11",
"+",
"m23",
"*",
"rm12",
";",
"dest",
".",
"_m20",
"(",
"m00",
"*",
"rm20",
"+",
"m10",
"*",
"rm21",
"+",
"m20",
"*",
"rm22",
")",
";",
"dest",
".",
"_m21",
"(",
"m01",
"*",
"rm20",
"+",
"m11",
"*",
"rm21",
"+",
"m21",
"*",
"rm22",
")",
";",
"dest",
".",
"_m22",
"(",
"m02",
"*",
"rm20",
"+",
"m12",
"*",
"rm21",
"+",
"m22",
"*",
"rm22",
")",
";",
"dest",
".",
"_m23",
"(",
"m03",
"*",
"rm20",
"+",
"m13",
"*",
"rm21",
"+",
"m23",
"*",
"rm22",
")",
";",
"dest",
".",
"_m00",
"(",
"nm00",
")",
";",
"dest",
".",
"_m01",
"(",
"nm01",
")",
";",
"dest",
".",
"_m02",
"(",
"nm02",
")",
";",
"dest",
".",
"_m03",
"(",
"nm03",
")",
";",
"dest",
".",
"_m10",
"(",
"nm10",
")",
";",
"dest",
".",
"_m11",
"(",
"nm11",
")",
";",
"dest",
".",
"_m12",
"(",
"nm12",
")",
";",
"dest",
".",
"_m13",
"(",
"nm13",
")",
";",
"dest",
".",
"_properties",
"(",
"properties",
"&",
"~",
"(",
"PROPERTY_PERSPECTIVE",
"|",
"PROPERTY_IDENTITY",
"|",
"PROPERTY_TRANSLATION",
")",
")",
";",
"return",
"dest",
";",
"}"
] | Apply a model transformation to this matrix for a right-handed coordinate system,
that aligns the local <code>+Z</code> axis with <code>(dirX, dirY, dirZ)</code>
and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookat matrix,
then the new matrix will be <code>M * L</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * L * v</code>,
the lookat transformation will be applied first!
<p>
In order to set the matrix to a rotation transformation without post-multiplying it,
use {@link #rotationTowards(float, float, float, float, float, float) rotationTowards()}.
<p>
This method is equivalent to calling: <code>mulAffine(new Matrix4f().lookAt(0, 0, 0, -dirX, -dirY, -dirZ, upX, upY, upZ).invertAffine(), dest)</code>
@see #rotateTowards(Vector3fc, Vector3fc)
@see #rotationTowards(float, float, float, float, float, float)
@param dirX
the x-coordinate of the direction to rotate towards
@param dirY
the y-coordinate of the direction to rotate towards
@param dirZ
the z-coordinate of the direction to rotate towards
@param upX
the x-coordinate of the up vector
@param upY
the y-coordinate of the up vector
@param upZ
the z-coordinate of the up vector
@param dest
will hold the result
@return dest | [
"Apply",
"a",
"model",
"transformation",
"to",
"this",
"matrix",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"that",
"aligns",
"the",
"local",
"<code",
">",
"+",
"Z<",
"/",
"code",
">",
"axis",
"with",
"<code",
">",
"(",
"dirX",
"dirY",
"dirZ",
")",
"<",
"/",
"code",
">",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",
"code",
">",
".",
"<p",
">",
"If",
"<code",
">",
"M<",
"/",
"code",
">",
"is",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"and",
"<code",
">",
"L<",
"/",
"code",
">",
"the",
"lookat",
"matrix",
"then",
"the",
"new",
"matrix",
"will",
"be",
"<code",
">",
"M",
"*",
"L<",
"/",
"code",
">",
".",
"So",
"when",
"transforming",
"a",
"vector",
"<code",
">",
"v<",
"/",
"code",
">",
"with",
"the",
"new",
"matrix",
"by",
"using",
"<code",
">",
"M",
"*",
"L",
"*",
"v<",
"/",
"code",
">",
"the",
"lookat",
"transformation",
"will",
"be",
"applied",
"first!",
"<p",
">",
"In",
"order",
"to",
"set",
"the",
"matrix",
"to",
"a",
"rotation",
"transformation",
"without",
"post",
"-",
"multiplying",
"it",
"use",
"{",
"@link",
"#rotationTowards",
"(",
"float",
"float",
"float",
"float",
"float",
"float",
")",
"rotationTowards",
"()",
"}",
".",
"<p",
">",
"This",
"method",
"is",
"equivalent",
"to",
"calling",
":",
"<code",
">",
"mulAffine",
"(",
"new",
"Matrix4f",
"()",
".",
"lookAt",
"(",
"0",
"0",
"0",
"-",
"dirX",
"-",
"dirY",
"-",
"dirZ",
"upX",
"upY",
"upZ",
")",
".",
"invertAffine",
"()",
"dest",
")",
"<",
"/",
"code",
">"
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L14231-L14286 |
phax/ph-css | ph-css/src/main/java/com/helger/css/utils/CSSRectHelper.java | CSSRectHelper.getAsRect | @Nullable
public static CSSRect getAsRect (@Nullable final String sCSSValue) {
"""
Interpret the passed value as a CSS rectangle and convert it to a
{@link CSSRect}.
@param sCSSValue
The CSS values to check. May be <code>null</code>.
@return <code>null</code> if the passed String is not a CSS rectangle.
"""
final String [] aValues = getRectValues (sCSSValue);
return aValues == null ? null : new CSSRect (aValues[0], aValues[1], aValues[2], aValues[3]);
} | java | @Nullable
public static CSSRect getAsRect (@Nullable final String sCSSValue)
{
final String [] aValues = getRectValues (sCSSValue);
return aValues == null ? null : new CSSRect (aValues[0], aValues[1], aValues[2], aValues[3]);
} | [
"@",
"Nullable",
"public",
"static",
"CSSRect",
"getAsRect",
"(",
"@",
"Nullable",
"final",
"String",
"sCSSValue",
")",
"{",
"final",
"String",
"[",
"]",
"aValues",
"=",
"getRectValues",
"(",
"sCSSValue",
")",
";",
"return",
"aValues",
"==",
"null",
"?",
"null",
":",
"new",
"CSSRect",
"(",
"aValues",
"[",
"0",
"]",
",",
"aValues",
"[",
"1",
"]",
",",
"aValues",
"[",
"2",
"]",
",",
"aValues",
"[",
"3",
"]",
")",
";",
"}"
] | Interpret the passed value as a CSS rectangle and convert it to a
{@link CSSRect}.
@param sCSSValue
The CSS values to check. May be <code>null</code>.
@return <code>null</code> if the passed String is not a CSS rectangle. | [
"Interpret",
"the",
"passed",
"value",
"as",
"a",
"CSS",
"rectangle",
"and",
"convert",
"it",
"to",
"a",
"{",
"@link",
"CSSRect",
"}",
"."
] | train | https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/utils/CSSRectHelper.java#L129-L134 |
primefaces/primefaces | src/main/java/org/primefaces/util/ComponentUtils.java | ComponentUtils.createContentDisposition | public static String createContentDisposition(String value, String filename) {
"""
Creates an RFC 6266 Content-Dispostion header following all UTF-8 conventions.
<p>
@param value e.g. "attachment"
@param filename the name of the file
@return a valid Content-Disposition header in UTF-8 format
"""
try {
return String.format("%s;filename=\"%2$s\"; filename*=UTF-8''%2$s", value, encodeURI(filename));
}
catch (UnsupportedEncodingException e) {
throw new FacesException(e);
}
} | java | public static String createContentDisposition(String value, String filename) {
try {
return String.format("%s;filename=\"%2$s\"; filename*=UTF-8''%2$s", value, encodeURI(filename));
}
catch (UnsupportedEncodingException e) {
throw new FacesException(e);
}
} | [
"public",
"static",
"String",
"createContentDisposition",
"(",
"String",
"value",
",",
"String",
"filename",
")",
"{",
"try",
"{",
"return",
"String",
".",
"format",
"(",
"\"%s;filename=\\\"%2$s\\\"; filename*=UTF-8''%2$s\"",
",",
"value",
",",
"encodeURI",
"(",
"filename",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"FacesException",
"(",
"e",
")",
";",
"}",
"}"
] | Creates an RFC 6266 Content-Dispostion header following all UTF-8 conventions.
<p>
@param value e.g. "attachment"
@param filename the name of the file
@return a valid Content-Disposition header in UTF-8 format | [
"Creates",
"an",
"RFC",
"6266",
"Content",
"-",
"Dispostion",
"header",
"following",
"all",
"UTF",
"-",
"8",
"conventions",
".",
"<p",
">"
] | train | https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/util/ComponentUtils.java#L510-L517 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/BrokerHelper.java | BrokerHelper.getKeyValues | public ValueContainer[] getKeyValues(ClassDescriptor cld, Identity oid) throws PersistenceBrokerException {
"""
Return primary key values of given Identity object.
@param cld
@param oid
@return Object[]
@throws PersistenceBrokerException
"""
return getKeyValues(cld, oid, true);
} | java | public ValueContainer[] getKeyValues(ClassDescriptor cld, Identity oid) throws PersistenceBrokerException
{
return getKeyValues(cld, oid, true);
} | [
"public",
"ValueContainer",
"[",
"]",
"getKeyValues",
"(",
"ClassDescriptor",
"cld",
",",
"Identity",
"oid",
")",
"throws",
"PersistenceBrokerException",
"{",
"return",
"getKeyValues",
"(",
"cld",
",",
"oid",
",",
"true",
")",
";",
"}"
] | Return primary key values of given Identity object.
@param cld
@param oid
@return Object[]
@throws PersistenceBrokerException | [
"Return",
"primary",
"key",
"values",
"of",
"given",
"Identity",
"object",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/BrokerHelper.java#L190-L193 |
carewebframework/carewebframework-vista | org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java | Request.addParameter | public void addParameter(String name, String sub, Object data) {
"""
Adds a subscripted parameter to the request.
@param name Parameter name.
@param sub Subscript(s).
@param data Parameter value.
"""
pack(name);
pack(sub);
pack(BrokerUtil.toString(data));
} | java | public void addParameter(String name, String sub, Object data) {
pack(name);
pack(sub);
pack(BrokerUtil.toString(data));
} | [
"public",
"void",
"addParameter",
"(",
"String",
"name",
",",
"String",
"sub",
",",
"Object",
"data",
")",
"{",
"pack",
"(",
"name",
")",
";",
"pack",
"(",
"sub",
")",
";",
"pack",
"(",
"BrokerUtil",
".",
"toString",
"(",
"data",
")",
")",
";",
"}"
] | Adds a subscripted parameter to the request.
@param name Parameter name.
@param sub Subscript(s).
@param data Parameter value. | [
"Adds",
"a",
"subscripted",
"parameter",
"to",
"the",
"request",
"."
] | train | https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java#L154-L158 |
CloudBees-community/syslog-java-client | src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java | LogManagerHelper.getLevelProperty | @Nullable
public static Level getLevelProperty(@Nonnull LogManager manager, @Nonnull String name, @Nullable Level defaultValue) {
"""
Visible version of {@link java.util.logging.LogManager#getLevelProperty(String, java.util.logging.Level)}.
If the property is not defined or cannot be parsed we return the given default value.
"""
if (name == null) {
return defaultValue;
}
String val = manager.getProperty(name);
if (val == null) {
return defaultValue;
}
Level l = LevelHelper.findLevel(val.trim());
return l != null ? l : defaultValue;
} | java | @Nullable
public static Level getLevelProperty(@Nonnull LogManager manager, @Nonnull String name, @Nullable Level defaultValue) {
if (name == null) {
return defaultValue;
}
String val = manager.getProperty(name);
if (val == null) {
return defaultValue;
}
Level l = LevelHelper.findLevel(val.trim());
return l != null ? l : defaultValue;
} | [
"@",
"Nullable",
"public",
"static",
"Level",
"getLevelProperty",
"(",
"@",
"Nonnull",
"LogManager",
"manager",
",",
"@",
"Nonnull",
"String",
"name",
",",
"@",
"Nullable",
"Level",
"defaultValue",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"String",
"val",
"=",
"manager",
".",
"getProperty",
"(",
"name",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"Level",
"l",
"=",
"LevelHelper",
".",
"findLevel",
"(",
"val",
".",
"trim",
"(",
")",
")",
";",
"return",
"l",
"!=",
"null",
"?",
"l",
":",
"defaultValue",
";",
"}"
] | Visible version of {@link java.util.logging.LogManager#getLevelProperty(String, java.util.logging.Level)}.
If the property is not defined or cannot be parsed we return the given default value. | [
"Visible",
"version",
"of",
"{",
"@link",
"java",
".",
"util",
".",
"logging",
".",
"LogManager#getLevelProperty",
"(",
"String",
"java",
".",
"util",
".",
"logging",
".",
"Level",
")",
"}",
"."
] | train | https://github.com/CloudBees-community/syslog-java-client/blob/41e01206e4ce17c6d225ffb443bf19792a3f3c3a/src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java#L43-L54 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/bcel/BCELUtil.java | BCELUtil.getMethodDescriptor | public static MethodDescriptor getMethodDescriptor(JavaClass jclass, Method method) {
"""
Construct a MethodDescriptor from JavaClass and method.
@param jclass
a JavaClass
@param method
a Method belonging to the JavaClass
@return a MethodDescriptor identifying the method
"""
return DescriptorFactory.instance().getMethodDescriptor(jclass.getClassName().replace('.', '/'), method.getName(),
method.getSignature(), method.isStatic());
} | java | public static MethodDescriptor getMethodDescriptor(JavaClass jclass, Method method) {
return DescriptorFactory.instance().getMethodDescriptor(jclass.getClassName().replace('.', '/'), method.getName(),
method.getSignature(), method.isStatic());
} | [
"public",
"static",
"MethodDescriptor",
"getMethodDescriptor",
"(",
"JavaClass",
"jclass",
",",
"Method",
"method",
")",
"{",
"return",
"DescriptorFactory",
".",
"instance",
"(",
")",
".",
"getMethodDescriptor",
"(",
"jclass",
".",
"getClassName",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"method",
".",
"getName",
"(",
")",
",",
"method",
".",
"getSignature",
"(",
")",
",",
"method",
".",
"isStatic",
"(",
")",
")",
";",
"}"
] | Construct a MethodDescriptor from JavaClass and method.
@param jclass
a JavaClass
@param method
a Method belonging to the JavaClass
@return a MethodDescriptor identifying the method | [
"Construct",
"a",
"MethodDescriptor",
"from",
"JavaClass",
"and",
"method",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/bcel/BCELUtil.java#L52-L55 |
mapsforge/mapsforge | mapsforge-map/src/main/java/org/mapsforge/map/layer/labels/TileBasedLabelStore.java | TileBasedLabelStore.storeMapItems | public synchronized void storeMapItems(Tile tile, List<MapElementContainer> mapItems) {
"""
Stores a list of MapElements against a tile.
@param tile tile on which the mapItems reside.
@param mapItems the map elements.
"""
this.put(tile, LayerUtil.collisionFreeOrdered(mapItems));
this.version += 1;
} | java | public synchronized void storeMapItems(Tile tile, List<MapElementContainer> mapItems) {
this.put(tile, LayerUtil.collisionFreeOrdered(mapItems));
this.version += 1;
} | [
"public",
"synchronized",
"void",
"storeMapItems",
"(",
"Tile",
"tile",
",",
"List",
"<",
"MapElementContainer",
">",
"mapItems",
")",
"{",
"this",
".",
"put",
"(",
"tile",
",",
"LayerUtil",
".",
"collisionFreeOrdered",
"(",
"mapItems",
")",
")",
";",
"this",
".",
"version",
"+=",
"1",
";",
"}"
] | Stores a list of MapElements against a tile.
@param tile tile on which the mapItems reside.
@param mapItems the map elements. | [
"Stores",
"a",
"list",
"of",
"MapElements",
"against",
"a",
"tile",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/layer/labels/TileBasedLabelStore.java#L53-L56 |
OpenCompare/OpenCompare | org.opencompare/pcmdata-importers/src/main/java/data_off/OFFDumpRetriever.java | OFFDumpRetriever.unGzip | private File unGzip(final File inputFile, final File outputDir) throws FileNotFoundException, IOException {
"""
Ungzip an input file into an output file.
<p>
The output file is created in the output folder, having the same name
as the input file, minus the '.gz' extension.
@param inputFile the input .gz file
@param outputDir the output directory file.
@throws IOException
@throws FileNotFoundException
@return The {@File} with the ungzipped content.
"""
_log.info(String.format("Ungzipping %s to dir %s.", inputFile.getAbsolutePath(), outputDir.getAbsolutePath()));
//final File outputFile = new File(outputDir, inputFile.getName().substring(0, inputFile.getName().length() - 3));
final GZIPInputStream in = new GZIPInputStream(new FileInputStream(inputFile));
final FileOutputStream out = new FileOutputStream(outputDir);
IOUtils.copy(in, out);
in.close();
out.close();
return outputDir;
} | java | private File unGzip(final File inputFile, final File outputDir) throws FileNotFoundException, IOException {
_log.info(String.format("Ungzipping %s to dir %s.", inputFile.getAbsolutePath(), outputDir.getAbsolutePath()));
//final File outputFile = new File(outputDir, inputFile.getName().substring(0, inputFile.getName().length() - 3));
final GZIPInputStream in = new GZIPInputStream(new FileInputStream(inputFile));
final FileOutputStream out = new FileOutputStream(outputDir);
IOUtils.copy(in, out);
in.close();
out.close();
return outputDir;
} | [
"private",
"File",
"unGzip",
"(",
"final",
"File",
"inputFile",
",",
"final",
"File",
"outputDir",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"_log",
".",
"info",
"(",
"String",
".",
"format",
"(",
"\"Ungzipping %s to dir %s.\"",
",",
"inputFile",
".",
"getAbsolutePath",
"(",
")",
",",
"outputDir",
".",
"getAbsolutePath",
"(",
")",
")",
")",
";",
"//final File outputFile = new File(outputDir, inputFile.getName().substring(0, inputFile.getName().length() - 3));",
"final",
"GZIPInputStream",
"in",
"=",
"new",
"GZIPInputStream",
"(",
"new",
"FileInputStream",
"(",
"inputFile",
")",
")",
";",
"final",
"FileOutputStream",
"out",
"=",
"new",
"FileOutputStream",
"(",
"outputDir",
")",
";",
"IOUtils",
".",
"copy",
"(",
"in",
",",
"out",
")",
";",
"in",
".",
"close",
"(",
")",
";",
"out",
".",
"close",
"(",
")",
";",
"return",
"outputDir",
";",
"}"
] | Ungzip an input file into an output file.
<p>
The output file is created in the output folder, having the same name
as the input file, minus the '.gz' extension.
@param inputFile the input .gz file
@param outputDir the output directory file.
@throws IOException
@throws FileNotFoundException
@return The {@File} with the ungzipped content. | [
"Ungzip",
"an",
"input",
"file",
"into",
"an",
"output",
"file",
".",
"<p",
">",
"The",
"output",
"file",
"is",
"created",
"in",
"the",
"output",
"folder",
"having",
"the",
"same",
"name",
"as",
"the",
"input",
"file",
"minus",
"the",
".",
"gz",
"extension",
"."
] | train | https://github.com/OpenCompare/OpenCompare/blob/6cd776466b375cb8ecca08fcd94e573d65e20b14/org.opencompare/pcmdata-importers/src/main/java/data_off/OFFDumpRetriever.java#L100-L115 |
astrapi69/jaulp-wicket | jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketImageExtensions.java | WicketImageExtensions.getImage | public static Image getImage(final String wicketId, final String contentType, final Byte[] data) {
"""
Gets the image.
@param wicketId
the id from the image for the html template.
@param contentType
the content type
@param data
the data
@return the image
"""
final byte[] byteArrayData = ArrayUtils.toPrimitive(data);
return getImage(wicketId, contentType, byteArrayData);
} | java | public static Image getImage(final String wicketId, final String contentType, final Byte[] data)
{
final byte[] byteArrayData = ArrayUtils.toPrimitive(data);
return getImage(wicketId, contentType, byteArrayData);
} | [
"public",
"static",
"Image",
"getImage",
"(",
"final",
"String",
"wicketId",
",",
"final",
"String",
"contentType",
",",
"final",
"Byte",
"[",
"]",
"data",
")",
"{",
"final",
"byte",
"[",
"]",
"byteArrayData",
"=",
"ArrayUtils",
".",
"toPrimitive",
"(",
"data",
")",
";",
"return",
"getImage",
"(",
"wicketId",
",",
"contentType",
",",
"byteArrayData",
")",
";",
"}"
] | Gets the image.
@param wicketId
the id from the image for the html template.
@param contentType
the content type
@param data
the data
@return the image | [
"Gets",
"the",
"image",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketImageExtensions.java#L58-L62 |
alkacon/opencms-core | src/org/opencms/util/CmsStringUtil.java | CmsStringUtil.getCommonPrefixPath | public static String getCommonPrefixPath(String first, String second) {
"""
Returns the common parent path of two paths.<p>
<b>Directly exposed for JSP EL</b>, not through {@link org.opencms.jsp.util.CmsJspElFunctions}.<p>
@param first the first path
@param second the second path
@return the common prefix path
"""
List<String> firstComponents = getPathComponents(first);
List<String> secondComponents = getPathComponents(second);
int minSize = Math.min(firstComponents.size(), secondComponents.size());
StringBuffer resultBuffer = new StringBuffer();
for (int i = 0; i < minSize; i++) {
if (firstComponents.get(i).equals(secondComponents.get(i))) {
resultBuffer.append("/");
resultBuffer.append(firstComponents.get(i));
} else {
break;
}
}
String result = resultBuffer.toString();
if (result.length() == 0) {
result = "/";
}
return result;
} | java | public static String getCommonPrefixPath(String first, String second) {
List<String> firstComponents = getPathComponents(first);
List<String> secondComponents = getPathComponents(second);
int minSize = Math.min(firstComponents.size(), secondComponents.size());
StringBuffer resultBuffer = new StringBuffer();
for (int i = 0; i < minSize; i++) {
if (firstComponents.get(i).equals(secondComponents.get(i))) {
resultBuffer.append("/");
resultBuffer.append(firstComponents.get(i));
} else {
break;
}
}
String result = resultBuffer.toString();
if (result.length() == 0) {
result = "/";
}
return result;
} | [
"public",
"static",
"String",
"getCommonPrefixPath",
"(",
"String",
"first",
",",
"String",
"second",
")",
"{",
"List",
"<",
"String",
">",
"firstComponents",
"=",
"getPathComponents",
"(",
"first",
")",
";",
"List",
"<",
"String",
">",
"secondComponents",
"=",
"getPathComponents",
"(",
"second",
")",
";",
"int",
"minSize",
"=",
"Math",
".",
"min",
"(",
"firstComponents",
".",
"size",
"(",
")",
",",
"secondComponents",
".",
"size",
"(",
")",
")",
";",
"StringBuffer",
"resultBuffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"minSize",
";",
"i",
"++",
")",
"{",
"if",
"(",
"firstComponents",
".",
"get",
"(",
"i",
")",
".",
"equals",
"(",
"secondComponents",
".",
"get",
"(",
"i",
")",
")",
")",
"{",
"resultBuffer",
".",
"append",
"(",
"\"/\"",
")",
";",
"resultBuffer",
".",
"append",
"(",
"firstComponents",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"String",
"result",
"=",
"resultBuffer",
".",
"toString",
"(",
")",
";",
"if",
"(",
"result",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"result",
"=",
"\"/\"",
";",
"}",
"return",
"result",
";",
"}"
] | Returns the common parent path of two paths.<p>
<b>Directly exposed for JSP EL</b>, not through {@link org.opencms.jsp.util.CmsJspElFunctions}.<p>
@param first the first path
@param second the second path
@return the common prefix path | [
"Returns",
"the",
"common",
"parent",
"path",
"of",
"two",
"paths",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L745-L764 |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ADStarNodeExpander.java | ADStarNodeExpander.updateConsistent | private boolean updateConsistent(N node, N parent, Transition<A, S> transition) {
"""
Updates a node in consistent state (V > G) updating the path
and the cost if the parent node and the transition improves the current cost of the node.
@param node {@link es.usc.citius.hipster.algorithm.ADStarForward} node to update, in consistent state
@param parent previous {@link es.usc.citius.hipster.algorithm.ADStarForward} of the node
@param transition {@link es.usc.citius.hipster.model.Transition} between the parent and the node
@return true if the node has changed its {@link es.usc.citius.hipster.model.impl.ADStarNodeImpl.Key}
"""
// parent.getG().add(this.costFunction.evaluate(transition));
C accumulatedCost = add.apply(parent.getG(), costFunction.evaluate(transition));
if (node.getG().compareTo(accumulatedCost) > 0) {
node.setPreviousNode(parent);
// node.previousNode = parent;
node.setG(accumulatedCost);
node.setState(transition.getState());
node.setAction(transition.getAction());
// node.state = transition;
node.setKey(new es.usc.citius.hipster.model.ADStarNode.Key<C>(node.getG(), node.getV(),
heuristicFunction.estimate(transition.getState()), epsilon, add, scale));
return true;
}
return false;
} | java | private boolean updateConsistent(N node, N parent, Transition<A, S> transition) {
// parent.getG().add(this.costFunction.evaluate(transition));
C accumulatedCost = add.apply(parent.getG(), costFunction.evaluate(transition));
if (node.getG().compareTo(accumulatedCost) > 0) {
node.setPreviousNode(parent);
// node.previousNode = parent;
node.setG(accumulatedCost);
node.setState(transition.getState());
node.setAction(transition.getAction());
// node.state = transition;
node.setKey(new es.usc.citius.hipster.model.ADStarNode.Key<C>(node.getG(), node.getV(),
heuristicFunction.estimate(transition.getState()), epsilon, add, scale));
return true;
}
return false;
} | [
"private",
"boolean",
"updateConsistent",
"(",
"N",
"node",
",",
"N",
"parent",
",",
"Transition",
"<",
"A",
",",
"S",
">",
"transition",
")",
"{",
"// parent.getG().add(this.costFunction.evaluate(transition));",
"C",
"accumulatedCost",
"=",
"add",
".",
"apply",
"(",
"parent",
".",
"getG",
"(",
")",
",",
"costFunction",
".",
"evaluate",
"(",
"transition",
")",
")",
";",
"if",
"(",
"node",
".",
"getG",
"(",
")",
".",
"compareTo",
"(",
"accumulatedCost",
")",
">",
"0",
")",
"{",
"node",
".",
"setPreviousNode",
"(",
"parent",
")",
";",
"// node.previousNode = parent;",
"node",
".",
"setG",
"(",
"accumulatedCost",
")",
";",
"node",
".",
"setState",
"(",
"transition",
".",
"getState",
"(",
")",
")",
";",
"node",
".",
"setAction",
"(",
"transition",
".",
"getAction",
"(",
")",
")",
";",
"// node.state = transition;",
"node",
".",
"setKey",
"(",
"new",
"es",
".",
"usc",
".",
"citius",
".",
"hipster",
".",
"model",
".",
"ADStarNode",
".",
"Key",
"<",
"C",
">",
"(",
"node",
".",
"getG",
"(",
")",
",",
"node",
".",
"getV",
"(",
")",
",",
"heuristicFunction",
".",
"estimate",
"(",
"transition",
".",
"getState",
"(",
")",
")",
",",
"epsilon",
",",
"add",
",",
"scale",
")",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Updates a node in consistent state (V > G) updating the path
and the cost if the parent node and the transition improves the current cost of the node.
@param node {@link es.usc.citius.hipster.algorithm.ADStarForward} node to update, in consistent state
@param parent previous {@link es.usc.citius.hipster.algorithm.ADStarForward} of the node
@param transition {@link es.usc.citius.hipster.model.Transition} between the parent and the node
@return true if the node has changed its {@link es.usc.citius.hipster.model.impl.ADStarNodeImpl.Key} | [
"Updates",
"a",
"node",
"in",
"consistent",
"state",
"(",
"V",
">",
"G",
")",
"updating",
"the",
"path",
"and",
"the",
"cost",
"if",
"the",
"parent",
"node",
"and",
"the",
"transition",
"improves",
"the",
"current",
"cost",
"of",
"the",
"node",
"."
] | train | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ADStarNodeExpander.java#L165-L180 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java | PoolOperations.deletePool | public void deletePool(String poolId, Iterable<BatchClientBehavior> additionalBehaviors)
throws BatchErrorException, IOException {
"""
Deletes the specified pool.
@param poolId
The ID of the pool to delete.
@param additionalBehaviors
A collection of {@link BatchClientBehavior} instances that are
applied to the Batch service request.
@throws BatchErrorException
Exception thrown when an error response is received from the
Batch service.
@throws IOException
Exception thrown when there is an error in
serialization/deserialization of data sent to/received from the
Batch service.
"""
PoolDeleteOptions options = new PoolDeleteOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().pools().delete(poolId, options);
} | java | public void deletePool(String poolId, Iterable<BatchClientBehavior> additionalBehaviors)
throws BatchErrorException, IOException {
PoolDeleteOptions options = new PoolDeleteOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().pools().delete(poolId, options);
} | [
"public",
"void",
"deletePool",
"(",
"String",
"poolId",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"PoolDeleteOptions",
"options",
"=",
"new",
"PoolDeleteOptions",
"(",
")",
";",
"BehaviorManager",
"bhMgr",
"=",
"new",
"BehaviorManager",
"(",
"this",
".",
"customBehaviors",
"(",
")",
",",
"additionalBehaviors",
")",
";",
"bhMgr",
".",
"applyRequestBehaviors",
"(",
"options",
")",
";",
"this",
".",
"parentBatchClient",
".",
"protocolLayer",
"(",
")",
".",
"pools",
"(",
")",
".",
"delete",
"(",
"poolId",
",",
"options",
")",
";",
"}"
] | Deletes the specified pool.
@param poolId
The ID of the pool to delete.
@param additionalBehaviors
A collection of {@link BatchClientBehavior} instances that are
applied to the Batch service request.
@throws BatchErrorException
Exception thrown when an error response is received from the
Batch service.
@throws IOException
Exception thrown when there is an error in
serialization/deserialization of data sent to/received from the
Batch service. | [
"Deletes",
"the",
"specified",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java#L258-L265 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/service/monitoring/FlowStatusGenerator.java | FlowStatusGenerator.isFlowRunning | public boolean isFlowRunning(String flowName, String flowGroup) {
"""
Return true if another instance of a flow is running. A flow is determined to be in the RUNNING state, if any of the
jobs in the flow are in the RUNNING state.
@param flowName
@param flowGroup
@return true, if any jobs of the flow are RUNNING.
"""
List<FlowStatus> flowStatusList = getLatestFlowStatus(flowName, flowGroup, 1);
if (flowStatusList == null || flowStatusList.isEmpty()) {
return false;
} else {
FlowStatus flowStatus = flowStatusList.get(0);
Iterator<JobStatus> jobStatusIterator = flowStatus.getJobStatusIterator();
while (jobStatusIterator.hasNext()) {
JobStatus jobStatus = jobStatusIterator.next();
if (isJobRunning(jobStatus)) {
return true;
}
}
return false;
}
} | java | public boolean isFlowRunning(String flowName, String flowGroup) {
List<FlowStatus> flowStatusList = getLatestFlowStatus(flowName, flowGroup, 1);
if (flowStatusList == null || flowStatusList.isEmpty()) {
return false;
} else {
FlowStatus flowStatus = flowStatusList.get(0);
Iterator<JobStatus> jobStatusIterator = flowStatus.getJobStatusIterator();
while (jobStatusIterator.hasNext()) {
JobStatus jobStatus = jobStatusIterator.next();
if (isJobRunning(jobStatus)) {
return true;
}
}
return false;
}
} | [
"public",
"boolean",
"isFlowRunning",
"(",
"String",
"flowName",
",",
"String",
"flowGroup",
")",
"{",
"List",
"<",
"FlowStatus",
">",
"flowStatusList",
"=",
"getLatestFlowStatus",
"(",
"flowName",
",",
"flowGroup",
",",
"1",
")",
";",
"if",
"(",
"flowStatusList",
"==",
"null",
"||",
"flowStatusList",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"FlowStatus",
"flowStatus",
"=",
"flowStatusList",
".",
"get",
"(",
"0",
")",
";",
"Iterator",
"<",
"JobStatus",
">",
"jobStatusIterator",
"=",
"flowStatus",
".",
"getJobStatusIterator",
"(",
")",
";",
"while",
"(",
"jobStatusIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"JobStatus",
"jobStatus",
"=",
"jobStatusIterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"isJobRunning",
"(",
"jobStatus",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"}"
] | Return true if another instance of a flow is running. A flow is determined to be in the RUNNING state, if any of the
jobs in the flow are in the RUNNING state.
@param flowName
@param flowGroup
@return true, if any jobs of the flow are RUNNING. | [
"Return",
"true",
"if",
"another",
"instance",
"of",
"a",
"flow",
"is",
"running",
".",
"A",
"flow",
"is",
"determined",
"to",
"be",
"in",
"the",
"RUNNING",
"state",
"if",
"any",
"of",
"the",
"jobs",
"in",
"the",
"flow",
"are",
"in",
"the",
"RUNNING",
"state",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/service/monitoring/FlowStatusGenerator.java#L87-L103 |
dlemmermann/CalendarFX | CalendarFXView/src/main/java/com/calendarfx/view/DateControl.java | DateControl.setDateDetailsCallback | public final void setDateDetailsCallback(Callback<DateDetailsParameter, Boolean> callback) {
"""
Sets the value of {@link #dateDetailsCallbackProperty()}.
@param callback the date details callback
"""
requireNonNull(callback);
dateDetailsCallbackProperty().set(callback);
} | java | public final void setDateDetailsCallback(Callback<DateDetailsParameter, Boolean> callback) {
requireNonNull(callback);
dateDetailsCallbackProperty().set(callback);
} | [
"public",
"final",
"void",
"setDateDetailsCallback",
"(",
"Callback",
"<",
"DateDetailsParameter",
",",
"Boolean",
">",
"callback",
")",
"{",
"requireNonNull",
"(",
"callback",
")",
";",
"dateDetailsCallbackProperty",
"(",
")",
".",
"set",
"(",
"callback",
")",
";",
"}"
] | Sets the value of {@link #dateDetailsCallbackProperty()}.
@param callback the date details callback | [
"Sets",
"the",
"value",
"of",
"{",
"@link",
"#dateDetailsCallbackProperty",
"()",
"}",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/view/DateControl.java#L1597-L1600 |
mgm-tp/jfunk | jfunk-core/src/main/java/com/mgmtp/jfunk/core/config/ModulesLoader.java | ModulesLoader.loadModulesFromProperties | public static Module loadModulesFromProperties(final Module jFunkModule, final String propertiesFile)
throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException {
"""
Loads Guice modules whose class names are specified as properties. All properties starting
with "module." are considered to have a fully qualified class name representing a Guice
module. The modules are combined and override thespecified jFunkModule.
@param propertiesFile
The properties file
@return the combined module
"""
final List<Module> modules = Lists.newArrayList();
LOG.debug("Using jfunk.props.file=" + propertiesFile);
Properties props = loadProperties(propertiesFile);
for (final Enumeration<?> en = props.propertyNames(); en.hasMoreElements();) {
String name = (String) en.nextElement();
if (name.startsWith("module.")) {
String className = props.getProperty(name);
LOG.info("Loading " + name + "=" + className);
Class<? extends Module> moduleClass = Class.forName(className).asSubclass(Module.class);
Module module = moduleClass.newInstance();
modules.add(module);
}
}
return Modules.override(jFunkModule).with(modules);
} | java | public static Module loadModulesFromProperties(final Module jFunkModule, final String propertiesFile)
throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException {
final List<Module> modules = Lists.newArrayList();
LOG.debug("Using jfunk.props.file=" + propertiesFile);
Properties props = loadProperties(propertiesFile);
for (final Enumeration<?> en = props.propertyNames(); en.hasMoreElements();) {
String name = (String) en.nextElement();
if (name.startsWith("module.")) {
String className = props.getProperty(name);
LOG.info("Loading " + name + "=" + className);
Class<? extends Module> moduleClass = Class.forName(className).asSubclass(Module.class);
Module module = moduleClass.newInstance();
modules.add(module);
}
}
return Modules.override(jFunkModule).with(modules);
} | [
"public",
"static",
"Module",
"loadModulesFromProperties",
"(",
"final",
"Module",
"jFunkModule",
",",
"final",
"String",
"propertiesFile",
")",
"throws",
"ClassNotFoundException",
",",
"InstantiationException",
",",
"IllegalAccessException",
",",
"IOException",
"{",
"final",
"List",
"<",
"Module",
">",
"modules",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"LOG",
".",
"debug",
"(",
"\"Using jfunk.props.file=\"",
"+",
"propertiesFile",
")",
";",
"Properties",
"props",
"=",
"loadProperties",
"(",
"propertiesFile",
")",
";",
"for",
"(",
"final",
"Enumeration",
"<",
"?",
">",
"en",
"=",
"props",
".",
"propertyNames",
"(",
")",
";",
"en",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"String",
"name",
"=",
"(",
"String",
")",
"en",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"name",
".",
"startsWith",
"(",
"\"module.\"",
")",
")",
"{",
"String",
"className",
"=",
"props",
".",
"getProperty",
"(",
"name",
")",
";",
"LOG",
".",
"info",
"(",
"\"Loading \"",
"+",
"name",
"+",
"\"=\"",
"+",
"className",
")",
";",
"Class",
"<",
"?",
"extends",
"Module",
">",
"moduleClass",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
".",
"asSubclass",
"(",
"Module",
".",
"class",
")",
";",
"Module",
"module",
"=",
"moduleClass",
".",
"newInstance",
"(",
")",
";",
"modules",
".",
"add",
"(",
"module",
")",
";",
"}",
"}",
"return",
"Modules",
".",
"override",
"(",
"jFunkModule",
")",
".",
"with",
"(",
"modules",
")",
";",
"}"
] | Loads Guice modules whose class names are specified as properties. All properties starting
with "module." are considered to have a fully qualified class name representing a Guice
module. The modules are combined and override thespecified jFunkModule.
@param propertiesFile
The properties file
@return the combined module | [
"Loads",
"Guice",
"modules",
"whose",
"class",
"names",
"are",
"specified",
"as",
"properties",
".",
"All",
"properties",
"starting",
"with",
"module",
".",
"are",
"considered",
"to",
"have",
"a",
"fully",
"qualified",
"class",
"name",
"representing",
"a",
"Guice",
"module",
".",
"The",
"modules",
"are",
"combined",
"and",
"override",
"thespecified",
"jFunkModule",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/config/ModulesLoader.java#L60-L78 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/BizwifiAPI.java | BizwifiAPI.shopList | public static ShopListResult shopList(String accessToken, ShopList shopList) {
"""
Wi-Fi门店管理-获取Wi-Fi门店列表
通过此接口获取WiFi的门店列表,该列表包括公众平台的门店信息、以及添加设备后的WiFi相关信息。
注:微信连Wi-Fi下的所有接口中的shop_id,必需先通过此接口获取。
@param accessToken accessToken
@param shopList shopList
@return ShopListResult
"""
return shopList(accessToken, JsonUtil.toJSONString(shopList));
} | java | public static ShopListResult shopList(String accessToken, ShopList shopList) {
return shopList(accessToken, JsonUtil.toJSONString(shopList));
} | [
"public",
"static",
"ShopListResult",
"shopList",
"(",
"String",
"accessToken",
",",
"ShopList",
"shopList",
")",
"{",
"return",
"shopList",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"shopList",
")",
")",
";",
"}"
] | Wi-Fi门店管理-获取Wi-Fi门店列表
通过此接口获取WiFi的门店列表,该列表包括公众平台的门店信息、以及添加设备后的WiFi相关信息。
注:微信连Wi-Fi下的所有接口中的shop_id,必需先通过此接口获取。
@param accessToken accessToken
@param shopList shopList
@return ShopListResult | [
"Wi",
"-",
"Fi门店管理",
"-",
"获取Wi",
"-",
"Fi门店列表",
"通过此接口获取WiFi的门店列表,该列表包括公众平台的门店信息、以及添加设备后的WiFi相关信息。",
"注:微信连Wi",
"-",
"Fi下的所有接口中的shop_id,必需先通过此接口获取。"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L221-L223 |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/parsers/SoapParser.java | SoapParser.parseSoap12Fault | private void parseSoap12Fault(Document soapMessage, PrintWriter logger)
throws Exception {
"""
A method to parse a SOAP 1.2 fault message.
@param soapMessage
the SOAP 1.2 fault message to parse
@param logger
the PrintWriter to log all results to
@return void
@author Simone Gianfranceschi
"""
Element envelope = soapMessage.getDocumentElement();
Element code = DomUtils.getElementByTagNameNS(envelope,
SOAP_12_NAMESPACE, "Code");
String value = DomUtils.getElementByTagNameNS(code, SOAP_12_NAMESPACE,
"Value").getTextContent();
String msg = "SOAP Fault received - [code:" + value + "]";
Element subCode = DomUtils.getElementByTagNameNS(code,
SOAP_12_NAMESPACE, "Subcode");
if (subCode != null) {
value = DomUtils.getElementByTagNameNS(subCode, SOAP_12_NAMESPACE,
"Value").getTextContent();
msg += "[subcode:" + value + "]";
}
Element reason = DomUtils.getElementByTagNameNS(envelope,
SOAP_12_NAMESPACE, "Reason");
Element text = DomUtils.getElementByTagNameNS(reason,
SOAP_12_NAMESPACE, "Text");
if (text != null) {
value = text.getTextContent();
msg += "[reason:" + value + "]";
}
logger.println(msg);
} | java | private void parseSoap12Fault(Document soapMessage, PrintWriter logger)
throws Exception {
Element envelope = soapMessage.getDocumentElement();
Element code = DomUtils.getElementByTagNameNS(envelope,
SOAP_12_NAMESPACE, "Code");
String value = DomUtils.getElementByTagNameNS(code, SOAP_12_NAMESPACE,
"Value").getTextContent();
String msg = "SOAP Fault received - [code:" + value + "]";
Element subCode = DomUtils.getElementByTagNameNS(code,
SOAP_12_NAMESPACE, "Subcode");
if (subCode != null) {
value = DomUtils.getElementByTagNameNS(subCode, SOAP_12_NAMESPACE,
"Value").getTextContent();
msg += "[subcode:" + value + "]";
}
Element reason = DomUtils.getElementByTagNameNS(envelope,
SOAP_12_NAMESPACE, "Reason");
Element text = DomUtils.getElementByTagNameNS(reason,
SOAP_12_NAMESPACE, "Text");
if (text != null) {
value = text.getTextContent();
msg += "[reason:" + value + "]";
}
logger.println(msg);
} | [
"private",
"void",
"parseSoap12Fault",
"(",
"Document",
"soapMessage",
",",
"PrintWriter",
"logger",
")",
"throws",
"Exception",
"{",
"Element",
"envelope",
"=",
"soapMessage",
".",
"getDocumentElement",
"(",
")",
";",
"Element",
"code",
"=",
"DomUtils",
".",
"getElementByTagNameNS",
"(",
"envelope",
",",
"SOAP_12_NAMESPACE",
",",
"\"Code\"",
")",
";",
"String",
"value",
"=",
"DomUtils",
".",
"getElementByTagNameNS",
"(",
"code",
",",
"SOAP_12_NAMESPACE",
",",
"\"Value\"",
")",
".",
"getTextContent",
"(",
")",
";",
"String",
"msg",
"=",
"\"SOAP Fault received - [code:\"",
"+",
"value",
"+",
"\"]\"",
";",
"Element",
"subCode",
"=",
"DomUtils",
".",
"getElementByTagNameNS",
"(",
"code",
",",
"SOAP_12_NAMESPACE",
",",
"\"Subcode\"",
")",
";",
"if",
"(",
"subCode",
"!=",
"null",
")",
"{",
"value",
"=",
"DomUtils",
".",
"getElementByTagNameNS",
"(",
"subCode",
",",
"SOAP_12_NAMESPACE",
",",
"\"Value\"",
")",
".",
"getTextContent",
"(",
")",
";",
"msg",
"+=",
"\"[subcode:\"",
"+",
"value",
"+",
"\"]\"",
";",
"}",
"Element",
"reason",
"=",
"DomUtils",
".",
"getElementByTagNameNS",
"(",
"envelope",
",",
"SOAP_12_NAMESPACE",
",",
"\"Reason\"",
")",
";",
"Element",
"text",
"=",
"DomUtils",
".",
"getElementByTagNameNS",
"(",
"reason",
",",
"SOAP_12_NAMESPACE",
",",
"\"Text\"",
")",
";",
"if",
"(",
"text",
"!=",
"null",
")",
"{",
"value",
"=",
"text",
".",
"getTextContent",
"(",
")",
";",
"msg",
"+=",
"\"[reason:\"",
"+",
"value",
"+",
"\"]\"",
";",
"}",
"logger",
".",
"println",
"(",
"msg",
")",
";",
"}"
] | A method to parse a SOAP 1.2 fault message.
@param soapMessage
the SOAP 1.2 fault message to parse
@param logger
the PrintWriter to log all results to
@return void
@author Simone Gianfranceschi | [
"A",
"method",
"to",
"parse",
"a",
"SOAP",
"1",
".",
"2",
"fault",
"message",
"."
] | train | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/parsers/SoapParser.java#L318-L343 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplace.java | CmsWorkplace.getWorkplaceExplorerLink | public static String getWorkplaceExplorerLink(final CmsJspActionElement jsp, final String explorerRootPath) {
"""
Creates a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the
site of the given explorerRootPath and show the folder given in the explorerRootPath.
<p>
@param jsp
needed for link functionality.
@param explorerRootPath
a root relative folder link (has to end with '/').
@return a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the
site of the given explorerRootPath and show the folder given in the explorerRootPath.
"""
return getWorkplaceExplorerLink(jsp.getCmsObject(), explorerRootPath);
} | java | public static String getWorkplaceExplorerLink(final CmsJspActionElement jsp, final String explorerRootPath) {
return getWorkplaceExplorerLink(jsp.getCmsObject(), explorerRootPath);
} | [
"public",
"static",
"String",
"getWorkplaceExplorerLink",
"(",
"final",
"CmsJspActionElement",
"jsp",
",",
"final",
"String",
"explorerRootPath",
")",
"{",
"return",
"getWorkplaceExplorerLink",
"(",
"jsp",
".",
"getCmsObject",
"(",
")",
",",
"explorerRootPath",
")",
";",
"}"
] | Creates a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the
site of the given explorerRootPath and show the folder given in the explorerRootPath.
<p>
@param jsp
needed for link functionality.
@param explorerRootPath
a root relative folder link (has to end with '/').
@return a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the
site of the given explorerRootPath and show the folder given in the explorerRootPath. | [
"Creates",
"a",
"link",
"for",
"the",
"OpenCms",
"workplace",
"that",
"will",
"reload",
"the",
"whole",
"workplace",
"switch",
"to",
"the",
"explorer",
"view",
"the",
"site",
"of",
"the",
"given",
"explorerRootPath",
"and",
"show",
"the",
"folder",
"given",
"in",
"the",
"explorerRootPath",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L753-L757 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java | JFAPCommunicator.invalidateConnection | protected void invalidateConnection(boolean notifyPeer, Throwable throwable, String debugReason) {
"""
Utility method to invalidate Connection. Parameters passed to ConnectionInterface.invalidate
@param notifyPeer
@param throwable
@param debugReason
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "invalidateConnection", new Object[]{new Boolean(notifyPeer),
throwable,
debugReason});
if (con != null)
{
ConnectionInterface connection = con.getConnectionReference();
if (connection != null)
{
connection.invalidate(notifyPeer, throwable, debugReason);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "invalidateConnection");
} | java | protected void invalidateConnection(boolean notifyPeer, Throwable throwable, String debugReason)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "invalidateConnection", new Object[]{new Boolean(notifyPeer),
throwable,
debugReason});
if (con != null)
{
ConnectionInterface connection = con.getConnectionReference();
if (connection != null)
{
connection.invalidate(notifyPeer, throwable, debugReason);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "invalidateConnection");
} | [
"protected",
"void",
"invalidateConnection",
"(",
"boolean",
"notifyPeer",
",",
"Throwable",
"throwable",
",",
"String",
"debugReason",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"invalidateConnection\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Boolean",
"(",
"notifyPeer",
")",
",",
"throwable",
",",
"debugReason",
"}",
")",
";",
"if",
"(",
"con",
"!=",
"null",
")",
"{",
"ConnectionInterface",
"connection",
"=",
"con",
".",
"getConnectionReference",
"(",
")",
";",
"if",
"(",
"connection",
"!=",
"null",
")",
"{",
"connection",
".",
"invalidate",
"(",
"notifyPeer",
",",
"throwable",
",",
"debugReason",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"invalidateConnection\"",
")",
";",
"}"
] | Utility method to invalidate Connection. Parameters passed to ConnectionInterface.invalidate
@param notifyPeer
@param throwable
@param debugReason | [
"Utility",
"method",
"to",
"invalidate",
"Connection",
".",
"Parameters",
"passed",
"to",
"ConnectionInterface",
".",
"invalidate"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java#L1430-L1444 |
brettwooldridge/HikariCP | src/main/java/com/zaxxer/hikari/pool/HikariPool.java | HikariPool.softEvictConnection | private boolean softEvictConnection(final PoolEntry poolEntry, final String reason, final boolean owner) {
"""
"Soft" evict a Connection (/PoolEntry) from the pool. If this method is being called by the user directly
through {@link com.zaxxer.hikari.HikariDataSource#evictConnection(Connection)} then {@code owner} is {@code true}.
If the caller is the owner, or if the Connection is idle (i.e. can be "reserved" in the {@link ConcurrentBag}),
then we can close the connection immediately. Otherwise, we leave it "marked" for eviction so that it is evicted
the next time someone tries to acquire it from the pool.
@param poolEntry the PoolEntry (/Connection) to "soft" evict from the pool
@param reason the reason that the connection is being evicted
@param owner true if the caller is the owner of the connection, false otherwise
@return true if the connection was evicted (closed), false if it was merely marked for eviction
"""
poolEntry.markEvicted();
if (owner || connectionBag.reserve(poolEntry)) {
closeConnection(poolEntry, reason);
return true;
}
return false;
} | java | private boolean softEvictConnection(final PoolEntry poolEntry, final String reason, final boolean owner)
{
poolEntry.markEvicted();
if (owner || connectionBag.reserve(poolEntry)) {
closeConnection(poolEntry, reason);
return true;
}
return false;
} | [
"private",
"boolean",
"softEvictConnection",
"(",
"final",
"PoolEntry",
"poolEntry",
",",
"final",
"String",
"reason",
",",
"final",
"boolean",
"owner",
")",
"{",
"poolEntry",
".",
"markEvicted",
"(",
")",
";",
"if",
"(",
"owner",
"||",
"connectionBag",
".",
"reserve",
"(",
"poolEntry",
")",
")",
"{",
"closeConnection",
"(",
"poolEntry",
",",
"reason",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | "Soft" evict a Connection (/PoolEntry) from the pool. If this method is being called by the user directly
through {@link com.zaxxer.hikari.HikariDataSource#evictConnection(Connection)} then {@code owner} is {@code true}.
If the caller is the owner, or if the Connection is idle (i.e. can be "reserved" in the {@link ConcurrentBag}),
then we can close the connection immediately. Otherwise, we leave it "marked" for eviction so that it is evicted
the next time someone tries to acquire it from the pool.
@param poolEntry the PoolEntry (/Connection) to "soft" evict from the pool
@param reason the reason that the connection is being evicted
@param owner true if the caller is the owner of the connection, false otherwise
@return true if the connection was evicted (closed), false if it was merely marked for eviction | [
"Soft",
"evict",
"a",
"Connection",
"(",
"/",
"PoolEntry",
")",
"from",
"the",
"pool",
".",
"If",
"this",
"method",
"is",
"being",
"called",
"by",
"the",
"user",
"directly",
"through",
"{",
"@link",
"com",
".",
"zaxxer",
".",
"hikari",
".",
"HikariDataSource#evictConnection",
"(",
"Connection",
")",
"}",
"then",
"{",
"@code",
"owner",
"}",
"is",
"{",
"@code",
"true",
"}",
"."
] | train | https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L613-L622 |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/WebJarPackager.java | WebJarPackager.fileCreated | @Override
public boolean fileCreated(File file) throws WatchingException {
"""
Notifies the watcher that a new file is created.
@param file is the file.
@return {@literal false} if the pipeline processing must be interrupted for this event. Most watchers should
return {@literal true} to let other watchers be notified.
@throws org.wisdom.maven.WatchingException if the watcher failed to process the given file.
"""
try {
File output = process();
if (deployWebJarToWisdom) {
// Copy the webjar to the right location
copyToDestination(output);
}
} catch (Exception e) {
throw new WatchingException("Failure while building the webjar", e);
}
return true;
} | java | @Override
public boolean fileCreated(File file) throws WatchingException {
try {
File output = process();
if (deployWebJarToWisdom) {
// Copy the webjar to the right location
copyToDestination(output);
}
} catch (Exception e) {
throw new WatchingException("Failure while building the webjar", e);
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"fileCreated",
"(",
"File",
"file",
")",
"throws",
"WatchingException",
"{",
"try",
"{",
"File",
"output",
"=",
"process",
"(",
")",
";",
"if",
"(",
"deployWebJarToWisdom",
")",
"{",
"// Copy the webjar to the right location",
"copyToDestination",
"(",
"output",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"WatchingException",
"(",
"\"Failure while building the webjar\"",
",",
"e",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Notifies the watcher that a new file is created.
@param file is the file.
@return {@literal false} if the pipeline processing must be interrupted for this event. Most watchers should
return {@literal true} to let other watchers be notified.
@throws org.wisdom.maven.WatchingException if the watcher failed to process the given file. | [
"Notifies",
"the",
"watcher",
"that",
"a",
"new",
"file",
"is",
"created",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/WebJarPackager.java#L205-L217 |
Javacord/Javacord | javacord-api/src/main/java/org/javacord/api/entity/message/embed/EmbedBuilder.java | EmbedBuilder.updateFields | public EmbedBuilder updateFields(Predicate<EmbedField> predicate, Consumer<EditableEmbedField> updater) {
"""
Updates all fields of the embed that satisfy the given predicate using the given updater.
@param predicate The predicate that fields have to satisfy to get updated.
@param updater The updater for the fields; the {@code EditableEmbedField} is only valid during the run of the
updater; any try to save it in a variable and reuse it later after this method call will fail
with exceptions.
@return The current instance in order to chain call methods.
"""
delegate.updateFields(predicate, updater);
return this;
} | java | public EmbedBuilder updateFields(Predicate<EmbedField> predicate, Consumer<EditableEmbedField> updater) {
delegate.updateFields(predicate, updater);
return this;
} | [
"public",
"EmbedBuilder",
"updateFields",
"(",
"Predicate",
"<",
"EmbedField",
">",
"predicate",
",",
"Consumer",
"<",
"EditableEmbedField",
">",
"updater",
")",
"{",
"delegate",
".",
"updateFields",
"(",
"predicate",
",",
"updater",
")",
";",
"return",
"this",
";",
"}"
] | Updates all fields of the embed that satisfy the given predicate using the given updater.
@param predicate The predicate that fields have to satisfy to get updated.
@param updater The updater for the fields; the {@code EditableEmbedField} is only valid during the run of the
updater; any try to save it in a variable and reuse it later after this method call will fail
with exceptions.
@return The current instance in order to chain call methods. | [
"Updates",
"all",
"fields",
"of",
"the",
"embed",
"that",
"satisfy",
"the",
"given",
"predicate",
"using",
"the",
"given",
"updater",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/message/embed/EmbedBuilder.java#L638-L641 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/GroupApi.java | GroupApi.addLdapGroupLink | public void addLdapGroupLink(Object groupIdOrPath, String cn, Integer groupAccess, String provider) throws GitLabApiException {
"""
Adds an LDAP group link.
<pre><code>GitLab Endpoint: POST /groups/:id/ldap_group_links</code></pre>
@param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
@param cn the CN of a LDAP group
@param groupAccess the minimum access level for members of the LDAP group
@param provider the LDAP provider for the LDAP group
@throws GitLabApiException if any exception occurs
"""
GitLabApiForm formData = new GitLabApiForm()
.withParam("cn", cn, true)
.withParam("group_access", groupAccess, true)
.withParam("provider", provider, true);
post(Response.Status.CREATED, formData, "groups", getGroupIdOrPath(groupIdOrPath), "ldap_group_links");
} | java | public void addLdapGroupLink(Object groupIdOrPath, String cn, Integer groupAccess, String provider) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("cn", cn, true)
.withParam("group_access", groupAccess, true)
.withParam("provider", provider, true);
post(Response.Status.CREATED, formData, "groups", getGroupIdOrPath(groupIdOrPath), "ldap_group_links");
} | [
"public",
"void",
"addLdapGroupLink",
"(",
"Object",
"groupIdOrPath",
",",
"String",
"cn",
",",
"Integer",
"groupAccess",
",",
"String",
"provider",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\"cn\"",
",",
"cn",
",",
"true",
")",
".",
"withParam",
"(",
"\"group_access\"",
",",
"groupAccess",
",",
"true",
")",
".",
"withParam",
"(",
"\"provider\"",
",",
"provider",
",",
"true",
")",
";",
"post",
"(",
"Response",
".",
"Status",
".",
"CREATED",
",",
"formData",
",",
"\"groups\"",
",",
"getGroupIdOrPath",
"(",
"groupIdOrPath",
")",
",",
"\"ldap_group_links\"",
")",
";",
"}"
] | Adds an LDAP group link.
<pre><code>GitLab Endpoint: POST /groups/:id/ldap_group_links</code></pre>
@param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
@param cn the CN of a LDAP group
@param groupAccess the minimum access level for members of the LDAP group
@param provider the LDAP provider for the LDAP group
@throws GitLabApiException if any exception occurs | [
"Adds",
"an",
"LDAP",
"group",
"link",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GroupApi.java#L944-L950 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/http/HTTPFaxClientSpi.java | HTTPFaxClientSpi.submitHTTPRequestImpl | protected HTTPResponse submitHTTPRequestImpl(HTTPRequest httpRequest,HTTPMethod httpMethod) {
"""
Submits the HTTP request and returns the HTTP response.
@param httpRequest
The HTTP request to send
@param httpMethod
The HTTP method to use
@return The HTTP response
"""
return this.httpClient.submitHTTPRequest(httpRequest,this.httpClientConfiguration,httpMethod);
} | java | protected HTTPResponse submitHTTPRequestImpl(HTTPRequest httpRequest,HTTPMethod httpMethod)
{
return this.httpClient.submitHTTPRequest(httpRequest,this.httpClientConfiguration,httpMethod);
} | [
"protected",
"HTTPResponse",
"submitHTTPRequestImpl",
"(",
"HTTPRequest",
"httpRequest",
",",
"HTTPMethod",
"httpMethod",
")",
"{",
"return",
"this",
".",
"httpClient",
".",
"submitHTTPRequest",
"(",
"httpRequest",
",",
"this",
".",
"httpClientConfiguration",
",",
"httpMethod",
")",
";",
"}"
] | Submits the HTTP request and returns the HTTP response.
@param httpRequest
The HTTP request to send
@param httpMethod
The HTTP method to use
@return The HTTP response | [
"Submits",
"the",
"HTTP",
"request",
"and",
"returns",
"the",
"HTTP",
"response",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/HTTPFaxClientSpi.java#L626-L629 |
lukin0110/poeditor-java | src/main/java/be/lukin/poeditor/POEditorClient.java | POEditorClient.addAdministrator | public boolean addAdministrator(String projectId, String name, String email) {
"""
Create a new admin for a project
@param projectId id of the project
@param name name of the admin
@param email email of the admin
@return boolean if the administrator has been created
"""
ResponseWrapper wrapper = service.addProjectMember(Action.ADD_CONTRIBUTOR, apiKey, projectId, name, email, null, 1);
return "200".equals(wrapper.response.code);
} | java | public boolean addAdministrator(String projectId, String name, String email){
ResponseWrapper wrapper = service.addProjectMember(Action.ADD_CONTRIBUTOR, apiKey, projectId, name, email, null, 1);
return "200".equals(wrapper.response.code);
} | [
"public",
"boolean",
"addAdministrator",
"(",
"String",
"projectId",
",",
"String",
"name",
",",
"String",
"email",
")",
"{",
"ResponseWrapper",
"wrapper",
"=",
"service",
".",
"addProjectMember",
"(",
"Action",
".",
"ADD_CONTRIBUTOR",
",",
"apiKey",
",",
"projectId",
",",
"name",
",",
"email",
",",
"null",
",",
"1",
")",
";",
"return",
"\"200\"",
".",
"equals",
"(",
"wrapper",
".",
"response",
".",
"code",
")",
";",
"}"
] | Create a new admin for a project
@param projectId id of the project
@param name name of the admin
@param email email of the admin
@return boolean if the administrator has been created | [
"Create",
"a",
"new",
"admin",
"for",
"a",
"project"
] | train | https://github.com/lukin0110/poeditor-java/blob/42a2cd3136da1276b29a57a483c94050cc7d1d01/src/main/java/be/lukin/poeditor/POEditorClient.java#L183-L186 |
telly/groundy | library/src/main/java/com/telly/groundy/Groundy.java | Groundy.arg | public Groundy arg(String key, CharSequence value) {
"""
Inserts a CharSequence 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 CharSequence, or null
"""
mArgs.putCharSequence(key, value);
return this;
} | java | public Groundy arg(String key, CharSequence value) {
mArgs.putCharSequence(key, value);
return this;
} | [
"public",
"Groundy",
"arg",
"(",
"String",
"key",
",",
"CharSequence",
"value",
")",
"{",
"mArgs",
".",
"putCharSequence",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a CharSequence 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 CharSequence, or null | [
"Inserts",
"a",
"CharSequence",
"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/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/Groundy.java#L524-L527 |
apache/incubator-druid | extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java | ApproximateHistogram.shiftLeft | protected void shiftLeft(int start, int end) {
"""
Shifts the given range of histogram bins one slot to the left
@param start index of the leftmost empty bin to shift into
@param end index of the last bin to shift left
"""
for (int i = start; i < end; ++i) {
positions[i] = positions[i + 1];
bins[i] = bins[i + 1];
}
} | java | protected void shiftLeft(int start, int end)
{
for (int i = start; i < end; ++i) {
positions[i] = positions[i + 1];
bins[i] = bins[i + 1];
}
} | [
"protected",
"void",
"shiftLeft",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";",
"++",
"i",
")",
"{",
"positions",
"[",
"i",
"]",
"=",
"positions",
"[",
"i",
"+",
"1",
"]",
";",
"bins",
"[",
"i",
"]",
"=",
"bins",
"[",
"i",
"+",
"1",
"]",
";",
"}",
"}"
] | Shifts the given range of histogram bins one slot to the left
@param start index of the leftmost empty bin to shift into
@param end index of the last bin to shift left | [
"Shifts",
"the",
"given",
"range",
"of",
"histogram",
"bins",
"one",
"slot",
"to",
"the",
"left"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L465-L471 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br/br_vm_template.java | br_vm_template.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception {
"""
<pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre>
"""
br_vm_template_responses result = (br_vm_template_responses) service.get_payload_formatter().string_to_resource(br_vm_template_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_vm_template_response_array);
}
br_vm_template[] result_br_vm_template = new br_vm_template[result.br_vm_template_response_array.length];
for(int i = 0; i < result.br_vm_template_response_array.length; i++)
{
result_br_vm_template[i] = result.br_vm_template_response_array[i].br_vm_template[0];
}
return result_br_vm_template;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_vm_template_responses result = (br_vm_template_responses) service.get_payload_formatter().string_to_resource(br_vm_template_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_vm_template_response_array);
}
br_vm_template[] result_br_vm_template = new br_vm_template[result.br_vm_template_response_array.length];
for(int i = 0; i < result.br_vm_template_response_array.length; i++)
{
result_br_vm_template[i] = result.br_vm_template_response_array[i].br_vm_template[0];
}
return result_br_vm_template;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"br_vm_template_responses",
"result",
"=",
"(",
"br_vm_template_responses",
")",
"service",
".",
"get_payload_formatter",
"(",
")",
".",
"string_to_resource",
"(",
"br_vm_template_responses",
".",
"class",
",",
"response",
")",
";",
"if",
"(",
"result",
".",
"errorcode",
"!=",
"0",
")",
"{",
"if",
"(",
"result",
".",
"errorcode",
"==",
"SESSION_NOT_EXISTS",
")",
"service",
".",
"clear_session",
"(",
")",
";",
"throw",
"new",
"nitro_exception",
"(",
"result",
".",
"message",
",",
"result",
".",
"errorcode",
",",
"(",
"base_response",
"[",
"]",
")",
"result",
".",
"br_vm_template_response_array",
")",
";",
"}",
"br_vm_template",
"[",
"]",
"result_br_vm_template",
"=",
"new",
"br_vm_template",
"[",
"result",
".",
"br_vm_template_response_array",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"result",
".",
"br_vm_template_response_array",
".",
"length",
";",
"i",
"++",
")",
"{",
"result_br_vm_template",
"[",
"i",
"]",
"=",
"result",
".",
"br_vm_template_response_array",
"[",
"i",
"]",
".",
"br_vm_template",
"[",
"0",
"]",
";",
"}",
"return",
"result_br_vm_template",
";",
"}"
] | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_vm_template.java#L173-L190 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.newHashSet | public static <T> HashSet<T> newHashSet(boolean isSorted, Iterator<T> iter) {
"""
新建一个HashSet
@param <T> 集合元素类型
@param isSorted 是否有序,有序返回 {@link LinkedHashSet},否则返回{@link HashSet}
@param iter {@link Iterator}
@return HashSet对象
@since 3.0.8
"""
if (null == iter) {
return newHashSet(isSorted, (T[]) null);
}
final HashSet<T> set = isSorted ? new LinkedHashSet<T>() : new HashSet<T>();
while (iter.hasNext()) {
set.add(iter.next());
}
return set;
} | java | public static <T> HashSet<T> newHashSet(boolean isSorted, Iterator<T> iter) {
if (null == iter) {
return newHashSet(isSorted, (T[]) null);
}
final HashSet<T> set = isSorted ? new LinkedHashSet<T>() : new HashSet<T>();
while (iter.hasNext()) {
set.add(iter.next());
}
return set;
} | [
"public",
"static",
"<",
"T",
">",
"HashSet",
"<",
"T",
">",
"newHashSet",
"(",
"boolean",
"isSorted",
",",
"Iterator",
"<",
"T",
">",
"iter",
")",
"{",
"if",
"(",
"null",
"==",
"iter",
")",
"{",
"return",
"newHashSet",
"(",
"isSorted",
",",
"(",
"T",
"[",
"]",
")",
"null",
")",
";",
"}",
"final",
"HashSet",
"<",
"T",
">",
"set",
"=",
"isSorted",
"?",
"new",
"LinkedHashSet",
"<",
"T",
">",
"(",
")",
":",
"new",
"HashSet",
"<",
"T",
">",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"set",
".",
"add",
"(",
"iter",
".",
"next",
"(",
")",
")",
";",
"}",
"return",
"set",
";",
"}"
] | 新建一个HashSet
@param <T> 集合元素类型
@param isSorted 是否有序,有序返回 {@link LinkedHashSet},否则返回{@link HashSet}
@param iter {@link Iterator}
@return HashSet对象
@since 3.0.8 | [
"新建一个HashSet"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L472-L481 |
greenmail-mail-test/greenmail | greenmail-core/src/main/java/com/icegreen/greenmail/imap/commands/CommandParser.java | CommandParser.consumeChar | protected void consumeChar(ImapRequestLineReader request, char expected)
throws ProtocolException {
"""
Consumes the next character in the request, checking that it matches the
expected one. This method should be used when the
"""
char consumed = request.consume();
if (consumed != expected) {
throw new ProtocolException("Expected:'" + expected + "' found:'" + consumed + '\'');
}
} | java | protected void consumeChar(ImapRequestLineReader request, char expected)
throws ProtocolException {
char consumed = request.consume();
if (consumed != expected) {
throw new ProtocolException("Expected:'" + expected + "' found:'" + consumed + '\'');
}
} | [
"protected",
"void",
"consumeChar",
"(",
"ImapRequestLineReader",
"request",
",",
"char",
"expected",
")",
"throws",
"ProtocolException",
"{",
"char",
"consumed",
"=",
"request",
".",
"consume",
"(",
")",
";",
"if",
"(",
"consumed",
"!=",
"expected",
")",
"{",
"throw",
"new",
"ProtocolException",
"(",
"\"Expected:'\"",
"+",
"expected",
"+",
"\"' found:'\"",
"+",
"consumed",
"+",
"'",
"'",
")",
";",
"}",
"}"
] | Consumes the next character in the request, checking that it matches the
expected one. This method should be used when the | [
"Consumes",
"the",
"next",
"character",
"in",
"the",
"request",
"checking",
"that",
"it",
"matches",
"the",
"expected",
"one",
".",
"This",
"method",
"should",
"be",
"used",
"when",
"the"
] | train | https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/imap/commands/CommandParser.java#L237-L243 |
apache/groovy | src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java | GenericsUtils.findParameterizedTypeFromCache | public static ClassNode findParameterizedTypeFromCache(final ClassNode genericsClass, final ClassNode actualType, boolean tryToFindExactType) {
"""
Try to get the parameterized type from the cache.
If no cached item found, cache and return the result of {@link #findParameterizedType(ClassNode, ClassNode, boolean)}
"""
if (!PARAMETERIZED_TYPE_CACHE_ENABLED) {
return findParameterizedType(genericsClass, actualType, tryToFindExactType);
}
SoftReference<ClassNode> sr = PARAMETERIZED_TYPE_CACHE.getAndPut(new ParameterizedTypeCacheKey(genericsClass, actualType), key -> new SoftReference<>(findParameterizedType(key.getGenericsClass(), key.getActualType(), tryToFindExactType)));
return null == sr ? null : sr.get();
} | java | public static ClassNode findParameterizedTypeFromCache(final ClassNode genericsClass, final ClassNode actualType, boolean tryToFindExactType) {
if (!PARAMETERIZED_TYPE_CACHE_ENABLED) {
return findParameterizedType(genericsClass, actualType, tryToFindExactType);
}
SoftReference<ClassNode> sr = PARAMETERIZED_TYPE_CACHE.getAndPut(new ParameterizedTypeCacheKey(genericsClass, actualType), key -> new SoftReference<>(findParameterizedType(key.getGenericsClass(), key.getActualType(), tryToFindExactType)));
return null == sr ? null : sr.get();
} | [
"public",
"static",
"ClassNode",
"findParameterizedTypeFromCache",
"(",
"final",
"ClassNode",
"genericsClass",
",",
"final",
"ClassNode",
"actualType",
",",
"boolean",
"tryToFindExactType",
")",
"{",
"if",
"(",
"!",
"PARAMETERIZED_TYPE_CACHE_ENABLED",
")",
"{",
"return",
"findParameterizedType",
"(",
"genericsClass",
",",
"actualType",
",",
"tryToFindExactType",
")",
";",
"}",
"SoftReference",
"<",
"ClassNode",
">",
"sr",
"=",
"PARAMETERIZED_TYPE_CACHE",
".",
"getAndPut",
"(",
"new",
"ParameterizedTypeCacheKey",
"(",
"genericsClass",
",",
"actualType",
")",
",",
"key",
"->",
"new",
"SoftReference",
"<>",
"(",
"findParameterizedType",
"(",
"key",
".",
"getGenericsClass",
"(",
")",
",",
"key",
".",
"getActualType",
"(",
")",
",",
"tryToFindExactType",
")",
")",
")",
";",
"return",
"null",
"==",
"sr",
"?",
"null",
":",
"sr",
".",
"get",
"(",
")",
";",
"}"
] | Try to get the parameterized type from the cache.
If no cached item found, cache and return the result of {@link #findParameterizedType(ClassNode, ClassNode, boolean)} | [
"Try",
"to",
"get",
"the",
"parameterized",
"type",
"from",
"the",
"cache",
".",
"If",
"no",
"cached",
"item",
"found",
"cache",
"and",
"return",
"the",
"result",
"of",
"{"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java#L694-L702 |
apache/flink | flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/util/HadoopUtils.java | HadoopUtils.isMinHadoopVersion | public static boolean isMinHadoopVersion(int major, int minor) throws FlinkRuntimeException {
"""
Checks if the Hadoop dependency is at least of the given version.
"""
String versionString = VersionInfo.getVersion();
String[] versionParts = versionString.split("\\.");
if (versionParts.length < 2) {
throw new FlinkRuntimeException(
"Cannot determine version of Hadoop, unexpected version string: " + versionString);
}
int maj = Integer.parseInt(versionParts[0]);
int min = Integer.parseInt(versionParts[1]);
return maj > major || (maj == major && min >= minor);
} | java | public static boolean isMinHadoopVersion(int major, int minor) throws FlinkRuntimeException {
String versionString = VersionInfo.getVersion();
String[] versionParts = versionString.split("\\.");
if (versionParts.length < 2) {
throw new FlinkRuntimeException(
"Cannot determine version of Hadoop, unexpected version string: " + versionString);
}
int maj = Integer.parseInt(versionParts[0]);
int min = Integer.parseInt(versionParts[1]);
return maj > major || (maj == major && min >= minor);
} | [
"public",
"static",
"boolean",
"isMinHadoopVersion",
"(",
"int",
"major",
",",
"int",
"minor",
")",
"throws",
"FlinkRuntimeException",
"{",
"String",
"versionString",
"=",
"VersionInfo",
".",
"getVersion",
"(",
")",
";",
"String",
"[",
"]",
"versionParts",
"=",
"versionString",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"if",
"(",
"versionParts",
".",
"length",
"<",
"2",
")",
"{",
"throw",
"new",
"FlinkRuntimeException",
"(",
"\"Cannot determine version of Hadoop, unexpected version string: \"",
"+",
"versionString",
")",
";",
"}",
"int",
"maj",
"=",
"Integer",
".",
"parseInt",
"(",
"versionParts",
"[",
"0",
"]",
")",
";",
"int",
"min",
"=",
"Integer",
".",
"parseInt",
"(",
"versionParts",
"[",
"1",
"]",
")",
";",
"return",
"maj",
">",
"major",
"||",
"(",
"maj",
"==",
"major",
"&&",
"min",
">=",
"minor",
")",
";",
"}"
] | Checks if the Hadoop dependency is at least of the given version. | [
"Checks",
"if",
"the",
"Hadoop",
"dependency",
"is",
"at",
"least",
"of",
"the",
"given",
"version",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/util/HadoopUtils.java#L132-L145 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Console.java | Console.printProgress | public static void printProgress(char showChar, int totalLen, double rate) {
"""
打印进度条
@param showChar 进度条提示字符,例如“#”
@param totalLen 总长度
@param rate 总长度所占比取值0~1
@since 4.5.6
"""
Assert.isTrue(rate >= 0 && rate <= 1, "Rate must between 0 and 1 (both include)");
printProgress(showChar, (int) (totalLen * rate));
} | java | public static void printProgress(char showChar, int totalLen, double rate) {
Assert.isTrue(rate >= 0 && rate <= 1, "Rate must between 0 and 1 (both include)");
printProgress(showChar, (int) (totalLen * rate));
} | [
"public",
"static",
"void",
"printProgress",
"(",
"char",
"showChar",
",",
"int",
"totalLen",
",",
"double",
"rate",
")",
"{",
"Assert",
".",
"isTrue",
"(",
"rate",
">=",
"0",
"&&",
"rate",
"<=",
"1",
",",
"\"Rate must between 0 and 1 (both include)\"",
")",
";",
"printProgress",
"(",
"showChar",
",",
"(",
"int",
")",
"(",
"totalLen",
"*",
"rate",
")",
")",
";",
"}"
] | 打印进度条
@param showChar 进度条提示字符,例如“#”
@param totalLen 总长度
@param rate 总长度所占比取值0~1
@since 4.5.6 | [
"打印进度条"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Console.java#L74-L77 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/LinearClassifier.java | LinearClassifier.probabilityOf | public Counter<L> probabilityOf(Datum<L, F> example) {
"""
Returns a counter mapping from each class name to the probability of
that class for a certain example.
Looking at the the sum of each count v, should be 1.0.
"""
if(example instanceof RVFDatum<?, ?>)return probabilityOfRVFDatum((RVFDatum<L,F>)example);
Counter<L> scores = logProbabilityOf(example);
for (L label : scores.keySet()) {
scores.setCount(label, Math.exp(scores.getCount(label)));
}
return scores;
} | java | public Counter<L> probabilityOf(Datum<L, F> example) {
if(example instanceof RVFDatum<?, ?>)return probabilityOfRVFDatum((RVFDatum<L,F>)example);
Counter<L> scores = logProbabilityOf(example);
for (L label : scores.keySet()) {
scores.setCount(label, Math.exp(scores.getCount(label)));
}
return scores;
} | [
"public",
"Counter",
"<",
"L",
">",
"probabilityOf",
"(",
"Datum",
"<",
"L",
",",
"F",
">",
"example",
")",
"{",
"if",
"(",
"example",
"instanceof",
"RVFDatum",
"<",
"?",
",",
"?",
">",
")",
"return",
"probabilityOfRVFDatum",
"(",
"(",
"RVFDatum",
"<",
"L",
",",
"F",
">",
")",
"example",
")",
";",
"Counter",
"<",
"L",
">",
"scores",
"=",
"logProbabilityOf",
"(",
"example",
")",
";",
"for",
"(",
"L",
"label",
":",
"scores",
".",
"keySet",
"(",
")",
")",
"{",
"scores",
".",
"setCount",
"(",
"label",
",",
"Math",
".",
"exp",
"(",
"scores",
".",
"getCount",
"(",
"label",
")",
")",
")",
";",
"}",
"return",
"scores",
";",
"}"
] | Returns a counter mapping from each class name to the probability of
that class for a certain example.
Looking at the the sum of each count v, should be 1.0. | [
"Returns",
"a",
"counter",
"mapping",
"from",
"each",
"class",
"name",
"to",
"the",
"probability",
"of",
"that",
"class",
"for",
"a",
"certain",
"example",
".",
"Looking",
"at",
"the",
"the",
"sum",
"of",
"each",
"count",
"v",
"should",
"be",
"1",
".",
"0",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifier.java#L249-L256 |
jenkinsci/jenkins | core/src/main/java/hudson/FilePath.java | FilePath.createZipArchive | @Deprecated
public void createZipArchive(OutputStream os, final String glob) throws IOException, InterruptedException {
"""
Creates a zip file from this directory by only including the files that match the given glob.
@param glob
Ant style glob, like "**/*.xml". If empty or null, this method
works like {@link #createZipArchive(OutputStream)}
@since 1.129
@deprecated as of 1.315
Use {@link #zip(OutputStream,String)} that has more consistent name.
"""
archive(ArchiverFactory.ZIP,os,glob);
} | java | @Deprecated
public void createZipArchive(OutputStream os, final String glob) throws IOException, InterruptedException {
archive(ArchiverFactory.ZIP,os,glob);
} | [
"@",
"Deprecated",
"public",
"void",
"createZipArchive",
"(",
"OutputStream",
"os",
",",
"final",
"String",
"glob",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"archive",
"(",
"ArchiverFactory",
".",
"ZIP",
",",
"os",
",",
"glob",
")",
";",
"}"
] | Creates a zip file from this directory by only including the files that match the given glob.
@param glob
Ant style glob, like "**/*.xml". If empty or null, this method
works like {@link #createZipArchive(OutputStream)}
@since 1.129
@deprecated as of 1.315
Use {@link #zip(OutputStream,String)} that has more consistent name. | [
"Creates",
"a",
"zip",
"file",
"from",
"this",
"directory",
"by",
"only",
"including",
"the",
"files",
"that",
"match",
"the",
"given",
"glob",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/FilePath.java#L448-L451 |
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.updateMultiRolePoolAsync | public Observable<WorkerPoolResourceInner> updateMultiRolePoolAsync(String resourceGroupName, String name, WorkerPoolResourceInner multiRolePoolEnvelope) {
"""
Create or update a multi-role pool.
Create or update a multi-role pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param multiRolePoolEnvelope Properties of the multi-role pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkerPoolResourceInner object
"""
return updateMultiRolePoolWithServiceResponseAsync(resourceGroupName, name, multiRolePoolEnvelope).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() {
@Override
public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) {
return response.body();
}
});
} | java | public Observable<WorkerPoolResourceInner> updateMultiRolePoolAsync(String resourceGroupName, String name, WorkerPoolResourceInner multiRolePoolEnvelope) {
return updateMultiRolePoolWithServiceResponseAsync(resourceGroupName, name, multiRolePoolEnvelope).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() {
@Override
public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkerPoolResourceInner",
">",
"updateMultiRolePoolAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"WorkerPoolResourceInner",
"multiRolePoolEnvelope",
")",
"{",
"return",
"updateMultiRolePoolWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"multiRolePoolEnvelope",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"WorkerPoolResourceInner",
">",
",",
"WorkerPoolResourceInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"WorkerPoolResourceInner",
"call",
"(",
"ServiceResponse",
"<",
"WorkerPoolResourceInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Create or update a multi-role pool.
Create or update a multi-role pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param multiRolePoolEnvelope Properties of the multi-role pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkerPoolResourceInner object | [
"Create",
"or",
"update",
"a",
"multi",
"-",
"role",
"pool",
".",
"Create",
"or",
"update",
"a",
"multi",
"-",
"role",
"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#L2485-L2492 |
Chorus-bdd/Chorus | interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/SpringContextSupport.java | SpringContextSupport.injectSpringResources | void injectSpringResources(Object handler, FeatureToken featureToken) throws Exception {
"""
Will load a Spring context from the named @ContextConfiguration resource. Will then inject the beans
into fields annotated with @Resource where the name of the bean matches the name of the field.
@param handler an instance of the handler class that will be used for testing
"""
log.trace("Looking for SpringContext annotation on handler " + handler);
Class<?> handlerClass = handler.getClass();
Annotation[] annotations = handlerClass.getAnnotations();
String contextFileName = findSpringContextFileName(handler, annotations);
if (contextFileName != null) {
log.debug("Found SpringContext annotation with value " + contextFileName + " will inject spring context");
springInjector.injectSpringContext(handler, featureToken, contextFileName);
}
} | java | void injectSpringResources(Object handler, FeatureToken featureToken) throws Exception {
log.trace("Looking for SpringContext annotation on handler " + handler);
Class<?> handlerClass = handler.getClass();
Annotation[] annotations = handlerClass.getAnnotations();
String contextFileName = findSpringContextFileName(handler, annotations);
if (contextFileName != null) {
log.debug("Found SpringContext annotation with value " + contextFileName + " will inject spring context");
springInjector.injectSpringContext(handler, featureToken, contextFileName);
}
} | [
"void",
"injectSpringResources",
"(",
"Object",
"handler",
",",
"FeatureToken",
"featureToken",
")",
"throws",
"Exception",
"{",
"log",
".",
"trace",
"(",
"\"Looking for SpringContext annotation on handler \"",
"+",
"handler",
")",
";",
"Class",
"<",
"?",
">",
"handlerClass",
"=",
"handler",
".",
"getClass",
"(",
")",
";",
"Annotation",
"[",
"]",
"annotations",
"=",
"handlerClass",
".",
"getAnnotations",
"(",
")",
";",
"String",
"contextFileName",
"=",
"findSpringContextFileName",
"(",
"handler",
",",
"annotations",
")",
";",
"if",
"(",
"contextFileName",
"!=",
"null",
")",
"{",
"log",
".",
"debug",
"(",
"\"Found SpringContext annotation with value \"",
"+",
"contextFileName",
"+",
"\" will inject spring context\"",
")",
";",
"springInjector",
".",
"injectSpringContext",
"(",
"handler",
",",
"featureToken",
",",
"contextFileName",
")",
";",
"}",
"}"
] | Will load a Spring context from the named @ContextConfiguration resource. Will then inject the beans
into fields annotated with @Resource where the name of the bean matches the name of the field.
@param handler an instance of the handler class that will be used for testing | [
"Will",
"load",
"a",
"Spring",
"context",
"from",
"the",
"named",
"@ContextConfiguration",
"resource",
".",
"Will",
"then",
"inject",
"the",
"beans",
"into",
"fields",
"annotated",
"with",
"@Resource",
"where",
"the",
"name",
"of",
"the",
"bean",
"matches",
"the",
"name",
"of",
"the",
"field",
"."
] | train | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/SpringContextSupport.java#L92-L101 |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/metadata/security/OUser.java | OUser.checkIfAllowed | public ORole checkIfAllowed(final String iResource, final int iOperation) {
"""
Checks if the user has the permission to access to the requested resource for the requested operation.
@param iResource
Requested resource
@param iOperation
Requested operation
@return The role that has granted the permission if any, otherwise null
"""
for (ORole r : roles)
if (r.allow(iResource, iOperation))
return r;
return null;
} | java | public ORole checkIfAllowed(final String iResource, final int iOperation) {
for (ORole r : roles)
if (r.allow(iResource, iOperation))
return r;
return null;
} | [
"public",
"ORole",
"checkIfAllowed",
"(",
"final",
"String",
"iResource",
",",
"final",
"int",
"iOperation",
")",
"{",
"for",
"(",
"ORole",
"r",
":",
"roles",
")",
"if",
"(",
"r",
".",
"allow",
"(",
"iResource",
",",
"iOperation",
")",
")",
"return",
"r",
";",
"return",
"null",
";",
"}"
] | Checks if the user has the permission to access to the requested resource for the requested operation.
@param iResource
Requested resource
@param iOperation
Requested operation
@return The role that has granted the permission if any, otherwise null | [
"Checks",
"if",
"the",
"user",
"has",
"the",
"permission",
"to",
"access",
"to",
"the",
"requested",
"resource",
"for",
"the",
"requested",
"operation",
"."
] | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OUser.java#L122-L128 |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ConcurrentReferenceHashMap.java | ConcurrentReferenceHashMap.calculateShift | protected static int calculateShift(int minimumValue, int maximumValue) {
"""
Calculate a shift value that can be used to create a power-of-two value between
the specified maximum and minimum values.
@param minimumValue the minimum value
@param maximumValue the maximum value
@return the calculated shift (use {@code 1 << shift} to obtain a value)
"""
int shift = 0;
int value = 1;
while (value < minimumValue && value < maximumValue) {
value <<= 1;
shift++;
}
return shift;
} | java | protected static int calculateShift(int minimumValue, int maximumValue) {
int shift = 0;
int value = 1;
while (value < minimumValue && value < maximumValue) {
value <<= 1;
shift++;
}
return shift;
} | [
"protected",
"static",
"int",
"calculateShift",
"(",
"int",
"minimumValue",
",",
"int",
"maximumValue",
")",
"{",
"int",
"shift",
"=",
"0",
";",
"int",
"value",
"=",
"1",
";",
"while",
"(",
"value",
"<",
"minimumValue",
"&&",
"value",
"<",
"maximumValue",
")",
"{",
"value",
"<<=",
"1",
";",
"shift",
"++",
";",
"}",
"return",
"shift",
";",
"}"
] | Calculate a shift value that can be used to create a power-of-two value between
the specified maximum and minimum values.
@param minimumValue the minimum value
@param maximumValue the maximum value
@return the calculated shift (use {@code 1 << shift} to obtain a value) | [
"Calculate",
"a",
"shift",
"value",
"that",
"can",
"be",
"used",
"to",
"create",
"a",
"power",
"-",
"of",
"-",
"two",
"value",
"between",
"the",
"specified",
"maximum",
"and",
"minimum",
"values",
"."
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ConcurrentReferenceHashMap.java#L383-L391 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/URLEncodedUtils.java | URLEncodedUtils.format | public static String format(
final List <? extends NameValuePair> parameters,
final String charset) {
"""
Returns a String that is suitable for use as an {@code application/x-www-form-urlencoded}
list of parameters in an HTTP PUT or HTTP POST.
@param parameters The parameters to include.
@param charset The encoding to use.
@return An {@code application/x-www-form-urlencoded} string
"""
return format(parameters, QP_SEP_A, charset);
} | java | public static String format(
final List <? extends NameValuePair> parameters,
final String charset) {
return format(parameters, QP_SEP_A, charset);
} | [
"public",
"static",
"String",
"format",
"(",
"final",
"List",
"<",
"?",
"extends",
"NameValuePair",
">",
"parameters",
",",
"final",
"String",
"charset",
")",
"{",
"return",
"format",
"(",
"parameters",
",",
"QP_SEP_A",
",",
"charset",
")",
";",
"}"
] | Returns a String that is suitable for use as an {@code application/x-www-form-urlencoded}
list of parameters in an HTTP PUT or HTTP POST.
@param parameters The parameters to include.
@param charset The encoding to use.
@return An {@code application/x-www-form-urlencoded} string | [
"Returns",
"a",
"String",
"that",
"is",
"suitable",
"for",
"use",
"as",
"an",
"{",
"@code",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"}",
"list",
"of",
"parameters",
"in",
"an",
"HTTP",
"PUT",
"or",
"HTTP",
"POST",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/URLEncodedUtils.java#L56-L60 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlDataSourceTag.java | HtmlDataSourceTag.nameHtmlControl | protected void nameHtmlControl(AbstractHtmlControlState state, ByRef javaScript)
throws JspException {
"""
This method will create the name of the form element (HTML Control) that has a name. The
<b>name</b> attribute represent the "control name" for the control. This name is scoped
into the form element. In addition, a control may have a <b>id</b> attribute which is
specified by setting the <b>tagId</b>. These two value are set in this routine. The name
is always the expression mapping the data to it's backing element and is conotrolled
by the optional naming chain provided by the tag. The <b>tagId</b> specifies the <b>id</b>
attribute. If this is present then we write out a JavaScript that allows mapping
the tagId set on the tag to both the real <b>id</b> value and also the <b>name</b> value.
The <b>id</b> is formed by passing the <b>tagId</b> to the URL rewritter service.
@param state The tag state structure. This contains both the name and id attributes. The
id attribute should be set with the initial value from the tagId.
@param javaScript A ByRef element that will contain any JavaScript that should be written out
by the calling tag. A value is returned only if tagId is set and there is not IScriptReporter
found.
@throws JspException Pass through the exception from applyNamingChain.
"""
assert (javaScript != null) : "paramater 'javaScript' may not be null";
assert (state != null) : "parameter 'state' may not be null";
assert (_dataSource != null) : "dataSource is Null";
// create the expression (name)
String datasource = "{" + _dataSource + "}";
state.name = applyNamingChain(datasource);
Form parentForm = getNearestForm();
String idScript = renderNameAndId((HttpServletRequest) pageContext.getRequest(), state, parentForm);
if (idScript != null)
javaScript.setRef(idScript);
} | java | protected void nameHtmlControl(AbstractHtmlControlState state, ByRef javaScript)
throws JspException
{
assert (javaScript != null) : "paramater 'javaScript' may not be null";
assert (state != null) : "parameter 'state' may not be null";
assert (_dataSource != null) : "dataSource is Null";
// create the expression (name)
String datasource = "{" + _dataSource + "}";
state.name = applyNamingChain(datasource);
Form parentForm = getNearestForm();
String idScript = renderNameAndId((HttpServletRequest) pageContext.getRequest(), state, parentForm);
if (idScript != null)
javaScript.setRef(idScript);
} | [
"protected",
"void",
"nameHtmlControl",
"(",
"AbstractHtmlControlState",
"state",
",",
"ByRef",
"javaScript",
")",
"throws",
"JspException",
"{",
"assert",
"(",
"javaScript",
"!=",
"null",
")",
":",
"\"paramater 'javaScript' may not be null\"",
";",
"assert",
"(",
"state",
"!=",
"null",
")",
":",
"\"parameter 'state' may not be null\"",
";",
"assert",
"(",
"_dataSource",
"!=",
"null",
")",
":",
"\"dataSource is Null\"",
";",
"// create the expression (name)",
"String",
"datasource",
"=",
"\"{\"",
"+",
"_dataSource",
"+",
"\"}\"",
";",
"state",
".",
"name",
"=",
"applyNamingChain",
"(",
"datasource",
")",
";",
"Form",
"parentForm",
"=",
"getNearestForm",
"(",
")",
";",
"String",
"idScript",
"=",
"renderNameAndId",
"(",
"(",
"HttpServletRequest",
")",
"pageContext",
".",
"getRequest",
"(",
")",
",",
"state",
",",
"parentForm",
")",
";",
"if",
"(",
"idScript",
"!=",
"null",
")",
"javaScript",
".",
"setRef",
"(",
"idScript",
")",
";",
"}"
] | This method will create the name of the form element (HTML Control) that has a name. The
<b>name</b> attribute represent the "control name" for the control. This name is scoped
into the form element. In addition, a control may have a <b>id</b> attribute which is
specified by setting the <b>tagId</b>. These two value are set in this routine. The name
is always the expression mapping the data to it's backing element and is conotrolled
by the optional naming chain provided by the tag. The <b>tagId</b> specifies the <b>id</b>
attribute. If this is present then we write out a JavaScript that allows mapping
the tagId set on the tag to both the real <b>id</b> value and also the <b>name</b> value.
The <b>id</b> is formed by passing the <b>tagId</b> to the URL rewritter service.
@param state The tag state structure. This contains both the name and id attributes. The
id attribute should be set with the initial value from the tagId.
@param javaScript A ByRef element that will contain any JavaScript that should be written out
by the calling tag. A value is returned only if tagId is set and there is not IScriptReporter
found.
@throws JspException Pass through the exception from applyNamingChain. | [
"This",
"method",
"will",
"create",
"the",
"name",
"of",
"the",
"form",
"element",
"(",
"HTML",
"Control",
")",
"that",
"has",
"a",
"name",
".",
"The",
"<b",
">",
"name<",
"/",
"b",
">",
"attribute",
"represent",
"the",
"control",
"name",
"for",
"the",
"control",
".",
"This",
"name",
"is",
"scoped",
"into",
"the",
"form",
"element",
".",
"In",
"addition",
"a",
"control",
"may",
"have",
"a",
"<b",
">",
"id<",
"/",
"b",
">",
"attribute",
"which",
"is",
"specified",
"by",
"setting",
"the",
"<b",
">",
"tagId<",
"/",
"b",
">",
".",
"These",
"two",
"value",
"are",
"set",
"in",
"this",
"routine",
".",
"The",
"name",
"is",
"always",
"the",
"expression",
"mapping",
"the",
"data",
"to",
"it",
"s",
"backing",
"element",
"and",
"is",
"conotrolled",
"by",
"the",
"optional",
"naming",
"chain",
"provided",
"by",
"the",
"tag",
".",
"The",
"<b",
">",
"tagId<",
"/",
"b",
">",
"specifies",
"the",
"<b",
">",
"id<",
"/",
"b",
">",
"attribute",
".",
"If",
"this",
"is",
"present",
"then",
"we",
"write",
"out",
"a",
"JavaScript",
"that",
"allows",
"mapping",
"the",
"tagId",
"set",
"on",
"the",
"tag",
"to",
"both",
"the",
"real",
"<b",
">",
"id<",
"/",
"b",
">",
"value",
"and",
"also",
"the",
"<b",
">",
"name<",
"/",
"b",
">",
"value",
".",
"The",
"<b",
">",
"id<",
"/",
"b",
">",
"is",
"formed",
"by",
"passing",
"the",
"<b",
">",
"tagId<",
"/",
"b",
">",
"to",
"the",
"URL",
"rewritter",
"service",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlDataSourceTag.java#L131-L146 |
unbescape/unbescape | src/main/java/org/unbescape/uri/UriEscape.java | UriEscape.escapeUriFragmentId | public static void escapeUriFragmentId(final Reader reader, final Writer writer)
throws IOException {
"""
<p>
Perform am URI fragment identifier <strong>escape</strong> operation
on a <tt>Reader</tt> input using <tt>UTF-8</tt> as encoding,
writing results to a <tt>Writer</tt>.
</p>
<p>
The following are the only allowed chars in an URI fragment identifier (will not be escaped):
</p>
<ul>
<li><tt>A-Z a-z 0-9</tt></li>
<li><tt>- . _ ~</tt></li>
<li><tt>! $ & ' ( ) * + , ; =</tt></li>
<li><tt>: @</tt></li>
<li><tt>/ ?</tt></li>
</ul>
<p>
All other chars will be escaped by converting them to the sequence of bytes that
represents them in the <tt>UTF-8</tt> and then representing each byte
in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2
"""
escapeUriFragmentId(reader, writer, DEFAULT_ENCODING);
} | java | public static void escapeUriFragmentId(final Reader reader, final Writer writer)
throws IOException {
escapeUriFragmentId(reader, writer, DEFAULT_ENCODING);
} | [
"public",
"static",
"void",
"escapeUriFragmentId",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapeUriFragmentId",
"(",
"reader",
",",
"writer",
",",
"DEFAULT_ENCODING",
")",
";",
"}"
] | <p>
Perform am URI fragment identifier <strong>escape</strong> operation
on a <tt>Reader</tt> input using <tt>UTF-8</tt> as encoding,
writing results to a <tt>Writer</tt>.
</p>
<p>
The following are the only allowed chars in an URI fragment identifier (will not be escaped):
</p>
<ul>
<li><tt>A-Z a-z 0-9</tt></li>
<li><tt>- . _ ~</tt></li>
<li><tt>! $ & ' ( ) * + , ; =</tt></li>
<li><tt>: @</tt></li>
<li><tt>/ ?</tt></li>
</ul>
<p>
All other chars will be escaped by converting them to the sequence of bytes that
represents them in the <tt>UTF-8</tt> and then representing each byte
in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"am",
"URI",
"fragment",
"identifier",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"Reader<",
"/",
"tt",
">",
"input",
"using",
"<tt",
">",
"UTF",
"-",
"8<",
"/",
"tt",
">",
"as",
"encoding",
"writing",
"results",
"to",
"a",
"<tt",
">",
"Writer<",
"/",
"tt",
">",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"following",
"are",
"the",
"only",
"allowed",
"chars",
"in",
"an",
"URI",
"fragment",
"identifier",
"(",
"will",
"not",
"be",
"escaped",
")",
":",
"<",
"/",
"p",
">",
"<ul",
">",
"<li",
">",
"<tt",
">",
"A",
"-",
"Z",
"a",
"-",
"z",
"0",
"-",
"9<",
"/",
"tt",
">",
"<",
"/",
"li",
">",
"<li",
">",
"<tt",
">",
"-",
".",
"_",
"~<",
"/",
"tt",
">",
"<",
"/",
"li",
">",
"<li",
">",
"<tt",
">",
"!",
"$",
"&",
";",
"(",
")",
"*",
"+",
";",
"=",
"<",
"/",
"tt",
">",
"<",
"/",
"li",
">",
"<li",
">",
"<tt",
">",
":",
"@<",
"/",
"tt",
">",
"<",
"/",
"li",
">",
"<li",
">",
"<tt",
">",
"/",
"?<",
"/",
"tt",
">",
"<",
"/",
"li",
">",
"<",
"/",
"ul",
">",
"<p",
">",
"All",
"other",
"chars",
"will",
"be",
"escaped",
"by",
"converting",
"them",
"to",
"the",
"sequence",
"of",
"bytes",
"that",
"represents",
"them",
"in",
"the",
"<tt",
">",
"UTF",
"-",
"8<",
"/",
"tt",
">",
"and",
"then",
"representing",
"each",
"byte",
"in",
"<tt",
">",
"%HH<",
"/",
"tt",
">",
"syntax",
"being",
"<tt",
">",
"HH<",
"/",
"tt",
">",
"the",
"hexadecimal",
"representation",
"of",
"the",
"byte",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"method",
"is",
"<strong",
">",
"thread",
"-",
"safe<",
"/",
"strong",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L1056-L1059 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJLineChartBuilder.java | DJLineChartBuilder.addSerie | public DJLineChartBuilder addSerie(AbstractColumn column, StringExpression labelExpression) {
"""
Adds the specified serie column to the dataset with custom label.
@param column the serie column
"""
getDataset().addSerie(column, labelExpression);
return this;
} | java | public DJLineChartBuilder addSerie(AbstractColumn column, StringExpression labelExpression) {
getDataset().addSerie(column, labelExpression);
return this;
} | [
"public",
"DJLineChartBuilder",
"addSerie",
"(",
"AbstractColumn",
"column",
",",
"StringExpression",
"labelExpression",
")",
"{",
"getDataset",
"(",
")",
".",
"addSerie",
"(",
"column",
",",
"labelExpression",
")",
";",
"return",
"this",
";",
"}"
] | Adds the specified serie column to the dataset with custom label.
@param column the serie column | [
"Adds",
"the",
"specified",
"serie",
"column",
"to",
"the",
"dataset",
"with",
"custom",
"label",
"."
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJLineChartBuilder.java#L376-L379 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/DistanceStatisticsWithClasses.java | DistanceStatisticsWithClasses.shrinkHeap | private static void shrinkHeap(TreeSet<DoubleDBIDPair> hotset, int k) {
"""
Shrink the heap of "hot" (extreme) items.
@param hotset Set of hot items
@param k target size
"""
// drop duplicates
ModifiableDBIDs seenids = DBIDUtil.newHashSet(2 * k);
int cnt = 0;
for(Iterator<DoubleDBIDPair> i = hotset.iterator(); i.hasNext();) {
DoubleDBIDPair p = i.next();
if(cnt > k || seenids.contains(p)) {
i.remove();
}
else {
seenids.add(p);
cnt++;
}
}
} | java | private static void shrinkHeap(TreeSet<DoubleDBIDPair> hotset, int k) {
// drop duplicates
ModifiableDBIDs seenids = DBIDUtil.newHashSet(2 * k);
int cnt = 0;
for(Iterator<DoubleDBIDPair> i = hotset.iterator(); i.hasNext();) {
DoubleDBIDPair p = i.next();
if(cnt > k || seenids.contains(p)) {
i.remove();
}
else {
seenids.add(p);
cnt++;
}
}
} | [
"private",
"static",
"void",
"shrinkHeap",
"(",
"TreeSet",
"<",
"DoubleDBIDPair",
">",
"hotset",
",",
"int",
"k",
")",
"{",
"// drop duplicates",
"ModifiableDBIDs",
"seenids",
"=",
"DBIDUtil",
".",
"newHashSet",
"(",
"2",
"*",
"k",
")",
";",
"int",
"cnt",
"=",
"0",
";",
"for",
"(",
"Iterator",
"<",
"DoubleDBIDPair",
">",
"i",
"=",
"hotset",
".",
"iterator",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"DoubleDBIDPair",
"p",
"=",
"i",
".",
"next",
"(",
")",
";",
"if",
"(",
"cnt",
">",
"k",
"||",
"seenids",
".",
"contains",
"(",
"p",
")",
")",
"{",
"i",
".",
"remove",
"(",
")",
";",
"}",
"else",
"{",
"seenids",
".",
"add",
"(",
"p",
")",
";",
"cnt",
"++",
";",
"}",
"}",
"}"
] | Shrink the heap of "hot" (extreme) items.
@param hotset Set of hot items
@param k target size | [
"Shrink",
"the",
"heap",
"of",
"hot",
"(",
"extreme",
")",
"items",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/DistanceStatisticsWithClasses.java#L382-L396 |
jtrfp/jfdt | src/main/java/org/jtrfp/jfdt/Parser.java | Parser.writeBean | public void writeBean(ThirdPartyParseable bean, EndianAwareDataOutputStream os) {
"""
Write ThirdPartyParseable bean to the given EndianAwareDataOutputStream.
@param bean
@param os
@since Sep 17, 2012
"""
if(bean==null)throw new NullPointerException();
ensureContextInstantiatedForWriting(os,bean);
try{bean.describeFormat(this);}
catch(UnrecognizedFormatException e){e.printStackTrace();}//Shouldn't happen.
popBean();
} | java | public void writeBean(ThirdPartyParseable bean, EndianAwareDataOutputStream os){
if(bean==null)throw new NullPointerException();
ensureContextInstantiatedForWriting(os,bean);
try{bean.describeFormat(this);}
catch(UnrecognizedFormatException e){e.printStackTrace();}//Shouldn't happen.
popBean();
} | [
"public",
"void",
"writeBean",
"(",
"ThirdPartyParseable",
"bean",
",",
"EndianAwareDataOutputStream",
"os",
")",
"{",
"if",
"(",
"bean",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"ensureContextInstantiatedForWriting",
"(",
"os",
",",
"bean",
")",
";",
"try",
"{",
"bean",
".",
"describeFormat",
"(",
"this",
")",
";",
"}",
"catch",
"(",
"UnrecognizedFormatException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"//Shouldn't happen.",
"popBean",
"(",
")",
";",
"}"
] | Write ThirdPartyParseable bean to the given EndianAwareDataOutputStream.
@param bean
@param os
@since Sep 17, 2012 | [
"Write",
"ThirdPartyParseable",
"bean",
"to",
"the",
"given",
"EndianAwareDataOutputStream",
"."
] | train | https://github.com/jtrfp/jfdt/blob/64e665669b5fcbfe96736346b4e7893e466dd8a0/src/main/java/org/jtrfp/jfdt/Parser.java#L185-L191 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java | JacksonUtils.getValue | public static JsonNode getValue(JsonNode node, String dPath) {
"""
Extract a value from the target {@link JsonNode} using DPath expression.
@param node
@param dPath
@see DPathUtils
"""
return DPathUtils.getValue(node, dPath);
} | java | public static JsonNode getValue(JsonNode node, String dPath) {
return DPathUtils.getValue(node, dPath);
} | [
"public",
"static",
"JsonNode",
"getValue",
"(",
"JsonNode",
"node",
",",
"String",
"dPath",
")",
"{",
"return",
"DPathUtils",
".",
"getValue",
"(",
"node",
",",
"dPath",
")",
";",
"}"
] | Extract a value from the target {@link JsonNode} using DPath expression.
@param node
@param dPath
@see DPathUtils | [
"Extract",
"a",
"value",
"from",
"the",
"target",
"{",
"@link",
"JsonNode",
"}",
"using",
"DPath",
"expression",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java#L260-L262 |
coursera/courier | generator-api/src/main/java/org/coursera/courier/api/CourierTemplateSpecGenerator.java | CourierTemplateSpecGenerator.nullTypeNotAllowed | private static IllegalArgumentException nullTypeNotAllowed(ClassTemplateSpec enclosingClass, String memberName) {
"""
/*
Return exception for trying to use null type outside of a union.
"""
return new IllegalArgumentException("The null type can only be used in unions, null found" + enclosingClassAndMemberNameToString(enclosingClass, memberName));
} | java | private static IllegalArgumentException nullTypeNotAllowed(ClassTemplateSpec enclosingClass, String memberName)
{
return new IllegalArgumentException("The null type can only be used in unions, null found" + enclosingClassAndMemberNameToString(enclosingClass, memberName));
} | [
"private",
"static",
"IllegalArgumentException",
"nullTypeNotAllowed",
"(",
"ClassTemplateSpec",
"enclosingClass",
",",
"String",
"memberName",
")",
"{",
"return",
"new",
"IllegalArgumentException",
"(",
"\"The null type can only be used in unions, null found\"",
"+",
"enclosingClassAndMemberNameToString",
"(",
"enclosingClass",
",",
"memberName",
")",
")",
";",
"}"
] | /*
Return exception for trying to use null type outside of a union. | [
"/",
"*",
"Return",
"exception",
"for",
"trying",
"to",
"use",
"null",
"type",
"outside",
"of",
"a",
"union",
"."
] | train | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/api/CourierTemplateSpecGenerator.java#L251-L254 |
MutabilityDetector/MutabilityDetector | src/main/java/org/mutabilitydetector/checkers/settermethod/AliasFinder.java | AliasFinder.newInstance | public static AliasFinder newInstance(final String variableName, final ControlFlowBlock controlFlowBlockToExamine) {
"""
Creates a new instance of this class.
@param variableName
name of the instance variable to search aliases for. Must
neither be {@code null} nor empty.
@param controlFlowBlockToExamine
a {@link ControlFlowBlock} which possibly contains the setup
of an alias for a lazy variable. This method thereby examines
predecessors of {@code block}, too. This parameter must not be
{@code null}.
@return a new instance of this class.
"""
checkArgument(!variableName.isEmpty());
return new AliasFinder(variableName, checkNotNull(controlFlowBlockToExamine));
} | java | public static AliasFinder newInstance(final String variableName, final ControlFlowBlock controlFlowBlockToExamine) {
checkArgument(!variableName.isEmpty());
return new AliasFinder(variableName, checkNotNull(controlFlowBlockToExamine));
} | [
"public",
"static",
"AliasFinder",
"newInstance",
"(",
"final",
"String",
"variableName",
",",
"final",
"ControlFlowBlock",
"controlFlowBlockToExamine",
")",
"{",
"checkArgument",
"(",
"!",
"variableName",
".",
"isEmpty",
"(",
")",
")",
";",
"return",
"new",
"AliasFinder",
"(",
"variableName",
",",
"checkNotNull",
"(",
"controlFlowBlockToExamine",
")",
")",
";",
"}"
] | Creates a new instance of this class.
@param variableName
name of the instance variable to search aliases for. Must
neither be {@code null} nor empty.
@param controlFlowBlockToExamine
a {@link ControlFlowBlock} which possibly contains the setup
of an alias for a lazy variable. This method thereby examines
predecessors of {@code block}, too. This parameter must not be
{@code null}.
@return a new instance of this class. | [
"Creates",
"a",
"new",
"instance",
"of",
"this",
"class",
"."
] | train | https://github.com/MutabilityDetector/MutabilityDetector/blob/36014d2f9e45cf0cc6d67b81395942cd39c4f6ae/src/main/java/org/mutabilitydetector/checkers/settermethod/AliasFinder.java#L74-L77 |
nats-io/java-nats | src/main/java/io/nats/client/impl/FileAuthHandler.java | FileAuthHandler.getID | public char[] getID() {
"""
getID should return a public key associated with a client key known to the server.
If the server is not in nonce-mode, this array can be empty.
@return the public key as a char array
"""
try {
char[] keyChars = this.readKeyChars();
NKey nkey = NKey.fromSeed(keyChars);
char[] pubKey = nkey.getPublicKey();
nkey.clear();
return pubKey;
} catch (Exception exp) {
throw new IllegalStateException("problem getting public key", exp);
}
} | java | public char[] getID() {
try {
char[] keyChars = this.readKeyChars();
NKey nkey = NKey.fromSeed(keyChars);
char[] pubKey = nkey.getPublicKey();
nkey.clear();
return pubKey;
} catch (Exception exp) {
throw new IllegalStateException("problem getting public key", exp);
}
} | [
"public",
"char",
"[",
"]",
"getID",
"(",
")",
"{",
"try",
"{",
"char",
"[",
"]",
"keyChars",
"=",
"this",
".",
"readKeyChars",
"(",
")",
";",
"NKey",
"nkey",
"=",
"NKey",
".",
"fromSeed",
"(",
"keyChars",
")",
";",
"char",
"[",
"]",
"pubKey",
"=",
"nkey",
".",
"getPublicKey",
"(",
")",
";",
"nkey",
".",
"clear",
"(",
")",
";",
"return",
"pubKey",
";",
"}",
"catch",
"(",
"Exception",
"exp",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"problem getting public key\"",
",",
"exp",
")",
";",
"}",
"}"
] | getID should return a public key associated with a client key known to the server.
If the server is not in nonce-mode, this array can be empty.
@return the public key as a char array | [
"getID",
"should",
"return",
"a",
"public",
"key",
"associated",
"with",
"a",
"client",
"key",
"known",
"to",
"the",
"server",
".",
"If",
"the",
"server",
"is",
"not",
"in",
"nonce",
"-",
"mode",
"this",
"array",
"can",
"be",
"empty",
"."
] | train | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/impl/FileAuthHandler.java#L170-L180 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipAssert.java | SipAssert.assertHeaderNotPresent | public static void assertHeaderNotPresent(String msg, SipMessage sipMessage, String header) {
"""
Asserts that the given SIP message contains no occurrence of the specified header. Assertion
failure output includes the given message text.
@param msg message text to output if the assertion fails.
@param sipMessage the SIP message.
@param header the string identifying the header as specified in RFC-3261.
"""
assertNotNull("Null assert object passed in", sipMessage);
assertFalse(msg, sipMessage.getHeaders(header).hasNext());
} | java | public static void assertHeaderNotPresent(String msg, SipMessage sipMessage, String header) {
assertNotNull("Null assert object passed in", sipMessage);
assertFalse(msg, sipMessage.getHeaders(header).hasNext());
} | [
"public",
"static",
"void",
"assertHeaderNotPresent",
"(",
"String",
"msg",
",",
"SipMessage",
"sipMessage",
",",
"String",
"header",
")",
"{",
"assertNotNull",
"(",
"\"Null assert object passed in\"",
",",
"sipMessage",
")",
";",
"assertFalse",
"(",
"msg",
",",
"sipMessage",
".",
"getHeaders",
"(",
"header",
")",
".",
"hasNext",
"(",
")",
")",
";",
"}"
] | Asserts that the given SIP message contains no occurrence of the specified header. Assertion
failure output includes the given message text.
@param msg message text to output if the assertion fails.
@param sipMessage the SIP message.
@param header the string identifying the header as specified in RFC-3261. | [
"Asserts",
"that",
"the",
"given",
"SIP",
"message",
"contains",
"no",
"occurrence",
"of",
"the",
"specified",
"header",
".",
"Assertion",
"failure",
"output",
"includes",
"the",
"given",
"message",
"text",
"."
] | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipAssert.java#L146-L149 |
dwdyer/watchmaker | swing/src/java/main/org/uncommons/watchmaker/swing/evolutionmonitor/PopulationFitnessView.java | PopulationFitnessView.createControls | private JComponent createControls(boolean islands) {
"""
Creates the GUI controls for toggling graph display options.
@return A component that can be added to the main panel.
"""
JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));
allDataButton.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent ev)
{
updateDomainAxisRange();
}
});
String text = "Last " + SHOW_FIXED_GENERATIONS + (islands ? " Epochs" : " Generations");
JRadioButton recentDataButton = new JRadioButton(text, true);
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(allDataButton);
buttonGroup.add(recentDataButton);
controls.add(allDataButton);
controls.add(recentDataButton);
final JCheckBox meanCheckBox = new JCheckBox("Show Mean", true);
meanCheckBox.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent itemEvent)
{
if (itemEvent.getStateChange() == ItemEvent.SELECTED)
{
dataSet.addSeries(meanSeries);
}
else
{
dataSet.removeSeries(meanSeries);
}
}
});
controls.add(meanCheckBox);
invertCheckBox.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent itemEvent)
{
rangeAxis.setInverted(invertCheckBox.isSelected());
}
});
controls.add(invertCheckBox);
return controls;
} | java | private JComponent createControls(boolean islands)
{
JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));
allDataButton.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent ev)
{
updateDomainAxisRange();
}
});
String text = "Last " + SHOW_FIXED_GENERATIONS + (islands ? " Epochs" : " Generations");
JRadioButton recentDataButton = new JRadioButton(text, true);
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(allDataButton);
buttonGroup.add(recentDataButton);
controls.add(allDataButton);
controls.add(recentDataButton);
final JCheckBox meanCheckBox = new JCheckBox("Show Mean", true);
meanCheckBox.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent itemEvent)
{
if (itemEvent.getStateChange() == ItemEvent.SELECTED)
{
dataSet.addSeries(meanSeries);
}
else
{
dataSet.removeSeries(meanSeries);
}
}
});
controls.add(meanCheckBox);
invertCheckBox.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent itemEvent)
{
rangeAxis.setInverted(invertCheckBox.isSelected());
}
});
controls.add(invertCheckBox);
return controls;
} | [
"private",
"JComponent",
"createControls",
"(",
"boolean",
"islands",
")",
"{",
"JPanel",
"controls",
"=",
"new",
"JPanel",
"(",
"new",
"FlowLayout",
"(",
"FlowLayout",
".",
"RIGHT",
")",
")",
";",
"allDataButton",
".",
"addItemListener",
"(",
"new",
"ItemListener",
"(",
")",
"{",
"public",
"void",
"itemStateChanged",
"(",
"ItemEvent",
"ev",
")",
"{",
"updateDomainAxisRange",
"(",
")",
";",
"}",
"}",
")",
";",
"String",
"text",
"=",
"\"Last \"",
"+",
"SHOW_FIXED_GENERATIONS",
"+",
"(",
"islands",
"?",
"\" Epochs\"",
":",
"\" Generations\"",
")",
";",
"JRadioButton",
"recentDataButton",
"=",
"new",
"JRadioButton",
"(",
"text",
",",
"true",
")",
";",
"ButtonGroup",
"buttonGroup",
"=",
"new",
"ButtonGroup",
"(",
")",
";",
"buttonGroup",
".",
"add",
"(",
"allDataButton",
")",
";",
"buttonGroup",
".",
"add",
"(",
"recentDataButton",
")",
";",
"controls",
".",
"add",
"(",
"allDataButton",
")",
";",
"controls",
".",
"add",
"(",
"recentDataButton",
")",
";",
"final",
"JCheckBox",
"meanCheckBox",
"=",
"new",
"JCheckBox",
"(",
"\"Show Mean\"",
",",
"true",
")",
";",
"meanCheckBox",
".",
"addItemListener",
"(",
"new",
"ItemListener",
"(",
")",
"{",
"public",
"void",
"itemStateChanged",
"(",
"ItemEvent",
"itemEvent",
")",
"{",
"if",
"(",
"itemEvent",
".",
"getStateChange",
"(",
")",
"==",
"ItemEvent",
".",
"SELECTED",
")",
"{",
"dataSet",
".",
"addSeries",
"(",
"meanSeries",
")",
";",
"}",
"else",
"{",
"dataSet",
".",
"removeSeries",
"(",
"meanSeries",
")",
";",
"}",
"}",
"}",
")",
";",
"controls",
".",
"add",
"(",
"meanCheckBox",
")",
";",
"invertCheckBox",
".",
"addItemListener",
"(",
"new",
"ItemListener",
"(",
")",
"{",
"public",
"void",
"itemStateChanged",
"(",
"ItemEvent",
"itemEvent",
")",
"{",
"rangeAxis",
".",
"setInverted",
"(",
"invertCheckBox",
".",
"isSelected",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"controls",
".",
"add",
"(",
"invertCheckBox",
")",
";",
"return",
"controls",
";",
"}"
] | Creates the GUI controls for toggling graph display options.
@return A component that can be added to the main panel. | [
"Creates",
"the",
"GUI",
"controls",
"for",
"toggling",
"graph",
"display",
"options",
"."
] | train | https://github.com/dwdyer/watchmaker/blob/33d942350e6bf7d9a17b9262a4f898158530247e/swing/src/java/main/org/uncommons/watchmaker/swing/evolutionmonitor/PopulationFitnessView.java#L105-L152 |
olivergondza/dumpling | cli/src/main/java/com/github/olivergondza/dumpling/groovy/InterpretterConfig.java | InterpretterConfig.getDefaultBinding | public Binding getDefaultBinding(@Nonnull ProcessStream stream, @Nonnull List<String> args, @Nullable ProcessRuntime<?, ?, ?> runtime) {
"""
Default binding to be used in groovy interpreters.
Dumpling exposed API is available via <tt>D</tt> property.
"""
Binding binding = new Binding();
binding.setProperty("out", stream.out());
binding.setProperty("err", stream.err());
binding.setProperty("D", new GroovyApiEntryPoint(args, runtime, "D"));
return binding;
} | java | public Binding getDefaultBinding(@Nonnull ProcessStream stream, @Nonnull List<String> args, @Nullable ProcessRuntime<?, ?, ?> runtime) {
Binding binding = new Binding();
binding.setProperty("out", stream.out());
binding.setProperty("err", stream.err());
binding.setProperty("D", new GroovyApiEntryPoint(args, runtime, "D"));
return binding;
} | [
"public",
"Binding",
"getDefaultBinding",
"(",
"@",
"Nonnull",
"ProcessStream",
"stream",
",",
"@",
"Nonnull",
"List",
"<",
"String",
">",
"args",
",",
"@",
"Nullable",
"ProcessRuntime",
"<",
"?",
",",
"?",
",",
"?",
">",
"runtime",
")",
"{",
"Binding",
"binding",
"=",
"new",
"Binding",
"(",
")",
";",
"binding",
".",
"setProperty",
"(",
"\"out\"",
",",
"stream",
".",
"out",
"(",
")",
")",
";",
"binding",
".",
"setProperty",
"(",
"\"err\"",
",",
"stream",
".",
"err",
"(",
")",
")",
";",
"binding",
".",
"setProperty",
"(",
"\"D\"",
",",
"new",
"GroovyApiEntryPoint",
"(",
"args",
",",
"runtime",
",",
"\"D\"",
")",
")",
";",
"return",
"binding",
";",
"}"
] | Default binding to be used in groovy interpreters.
Dumpling exposed API is available via <tt>D</tt> property. | [
"Default",
"binding",
"to",
"be",
"used",
"in",
"groovy",
"interpreters",
"."
] | train | https://github.com/olivergondza/dumpling/blob/ac698735fcc7c023db0c1637cc1f522cb3576c7f/cli/src/main/java/com/github/olivergondza/dumpling/groovy/InterpretterConfig.java#L48-L56 |
spotify/helios | helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java | ZooKeeperMasterModel.registerHost | @Override
public void registerHost(final String host, final String id) {
"""
Registers a host into ZooKeeper. The {@code id} is initially generated randomly by the Agent
and persisted on disk. This way, in the event that you have two agents attempting to register
with the same value of @{code host}, the first one will win.
"""
final ZooKeeperClient client = provider.get("registerHost");
try {
ZooKeeperRegistrarUtil.registerHost(client, Paths.configHostId(host), host, id);
} catch (Exception e) {
throw new HeliosRuntimeException("registering host " + host + " failed", e);
}
} | java | @Override
public void registerHost(final String host, final String id) {
final ZooKeeperClient client = provider.get("registerHost");
try {
ZooKeeperRegistrarUtil.registerHost(client, Paths.configHostId(host), host, id);
} catch (Exception e) {
throw new HeliosRuntimeException("registering host " + host + " failed", e);
}
} | [
"@",
"Override",
"public",
"void",
"registerHost",
"(",
"final",
"String",
"host",
",",
"final",
"String",
"id",
")",
"{",
"final",
"ZooKeeperClient",
"client",
"=",
"provider",
".",
"get",
"(",
"\"registerHost\"",
")",
";",
"try",
"{",
"ZooKeeperRegistrarUtil",
".",
"registerHost",
"(",
"client",
",",
"Paths",
".",
"configHostId",
"(",
"host",
")",
",",
"host",
",",
"id",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"HeliosRuntimeException",
"(",
"\"registering host \"",
"+",
"host",
"+",
"\" failed\"",
",",
"e",
")",
";",
"}",
"}"
] | Registers a host into ZooKeeper. The {@code id} is initially generated randomly by the Agent
and persisted on disk. This way, in the event that you have two agents attempting to register
with the same value of @{code host}, the first one will win. | [
"Registers",
"a",
"host",
"into",
"ZooKeeper",
".",
"The",
"{"
] | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L181-L189 |
amlinv/registry-utils | src/main/java/com/amlinv/registry/util/ConcurrentRegistry.java | ConcurrentRegistry.putIfAbsent | public V putIfAbsent (K putKey, V putValue) {
"""
Add the given entry into the registry under the specified key, but only if the key is not already registered.
@param putKey key identifying the entry in the registry to add, if it does not already exist.
@param putValue value to add to the registry.
@return existing value in the registry if already defined; null if the new value is added to the registry.
"""
V existingValue = this.store.putIfAbsent(putKey, putValue);
if ( existingValue == null ) {
this.notificationExecutor.firePutNotification(this.listeners.iterator(), putKey, putValue);
}
return existingValue;
} | java | public V putIfAbsent (K putKey, V putValue) {
V existingValue = this.store.putIfAbsent(putKey, putValue);
if ( existingValue == null ) {
this.notificationExecutor.firePutNotification(this.listeners.iterator(), putKey, putValue);
}
return existingValue;
} | [
"public",
"V",
"putIfAbsent",
"(",
"K",
"putKey",
",",
"V",
"putValue",
")",
"{",
"V",
"existingValue",
"=",
"this",
".",
"store",
".",
"putIfAbsent",
"(",
"putKey",
",",
"putValue",
")",
";",
"if",
"(",
"existingValue",
"==",
"null",
")",
"{",
"this",
".",
"notificationExecutor",
".",
"firePutNotification",
"(",
"this",
".",
"listeners",
".",
"iterator",
"(",
")",
",",
"putKey",
",",
"putValue",
")",
";",
"}",
"return",
"existingValue",
";",
"}"
] | Add the given entry into the registry under the specified key, but only if the key is not already registered.
@param putKey key identifying the entry in the registry to add, if it does not already exist.
@param putValue value to add to the registry.
@return existing value in the registry if already defined; null if the new value is added to the registry. | [
"Add",
"the",
"given",
"entry",
"into",
"the",
"registry",
"under",
"the",
"specified",
"key",
"but",
"only",
"if",
"the",
"key",
"is",
"not",
"already",
"registered",
"."
] | train | https://github.com/amlinv/registry-utils/blob/784c455be38acb0df3a35c38afe60a516b8e4f32/src/main/java/com/amlinv/registry/util/ConcurrentRegistry.java#L153-L161 |
liyiorg/weixin-popular | src/main/java/weixin/popular/util/XMLConverUtil.java | XMLConverUtil.convertToObject | public static <T> T convertToObject(Class<T> clazz, String xml) {
"""
XML to Object
@param <T>
T
@param clazz
clazz
@param xml
xml
@return T
"""
return convertToObject(clazz, new StringReader(xml));
} | java | public static <T> T convertToObject(Class<T> clazz, String xml) {
return convertToObject(clazz, new StringReader(xml));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"convertToObject",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"xml",
")",
"{",
"return",
"convertToObject",
"(",
"clazz",
",",
"new",
"StringReader",
"(",
"xml",
")",
")",
";",
"}"
] | XML to Object
@param <T>
T
@param clazz
clazz
@param xml
xml
@return T | [
"XML",
"to",
"Object"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/XMLConverUtil.java#L62-L64 |
teatrove/teatrove | tea/src/main/java/org/teatrove/tea/compiler/Compiler.java | Compiler.createSourceReader | protected SourceReader createSourceReader(CompilationUnit unit)
throws IOException {
"""
Default implementation returns a SourceReader that uses "<%" and "%>"
as code delimiters.
"""
Reader r = new BufferedReader(unit.getReader());
return new SourceReader(r, "<%", "%>");
} | java | protected SourceReader createSourceReader(CompilationUnit unit)
throws IOException {
Reader r = new BufferedReader(unit.getReader());
return new SourceReader(r, "<%", "%>");
} | [
"protected",
"SourceReader",
"createSourceReader",
"(",
"CompilationUnit",
"unit",
")",
"throws",
"IOException",
"{",
"Reader",
"r",
"=",
"new",
"BufferedReader",
"(",
"unit",
".",
"getReader",
"(",
")",
")",
";",
"return",
"new",
"SourceReader",
"(",
"r",
",",
"\"<%\"",
",",
"\"%>\"",
")",
";",
"}"
] | Default implementation returns a SourceReader that uses "<%" and "%>"
as code delimiters. | [
"Default",
"implementation",
"returns",
"a",
"SourceReader",
"that",
"uses",
"<%",
"and",
"%",
">",
"as",
"code",
"delimiters",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/Compiler.java#L859-L864 |
sahan/IckleBot | icklebot/src/main/java/com/lonepulse/icklebot/fragment/EventFragment.java | EventFragment.onViewCreated | @Override
public void onViewCreated(View view, Bundle savedInstanceState) {
"""
<p>Performs <b>event listener linking</b> by invoking {@link EventUtils#link()}.</p>
"""
super.onViewCreated(view, savedInstanceState);
EventUtils.link(EVENT_CONFIGURATION);
} | java | @Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
EventUtils.link(EVENT_CONFIGURATION);
} | [
"@",
"Override",
"public",
"void",
"onViewCreated",
"(",
"View",
"view",
",",
"Bundle",
"savedInstanceState",
")",
"{",
"super",
".",
"onViewCreated",
"(",
"view",
",",
"savedInstanceState",
")",
";",
"EventUtils",
".",
"link",
"(",
"EVENT_CONFIGURATION",
")",
";",
"}"
] | <p>Performs <b>event listener linking</b> by invoking {@link EventUtils#link()}.</p> | [
"<p",
">",
"Performs",
"<b",
">",
"event",
"listener",
"linking<",
"/",
"b",
">",
"by",
"invoking",
"{"
] | train | https://github.com/sahan/IckleBot/blob/a19003ceb3ad7c7ee508dc23a8cb31b5676aa499/icklebot/src/main/java/com/lonepulse/icklebot/fragment/EventFragment.java#L65-L70 |
eurekaclinical/aiw-i2b2-etl | src/main/java/edu/emory/cci/aiw/i2b2etl/dest/metadata/conceptid/PropDefConceptId.java | PropDefConceptId.getInstance | public static PropDefConceptId getInstance(String propId,
String propertyName, Value value, Metadata metadata) {
"""
Returns a concept propId with the given proposition propId, property name and
value.
@param propId a proposition propId {@link String}. Cannot be
<code>null</code>.
@param propertyName a property name {@link String}.
@param value a {@link Value}.
@return a {@link PropDefConceptId}.
"""
List<Object> key = new ArrayList<>(4);
key.add(propId);
key.add(propertyName);
key.add(value);
key.add(Boolean.TRUE); //distinguishes these from properties represented as a modifier.
PropDefConceptId conceptId = (PropDefConceptId) metadata.getFromConceptIdCache(key);
if (conceptId == null) {
conceptId = new PropDefConceptId(propId, propertyName, value, metadata);
metadata.putInConceptIdCache(key, conceptId);
}
return conceptId;
} | java | public static PropDefConceptId getInstance(String propId,
String propertyName, Value value, Metadata metadata) {
List<Object> key = new ArrayList<>(4);
key.add(propId);
key.add(propertyName);
key.add(value);
key.add(Boolean.TRUE); //distinguishes these from properties represented as a modifier.
PropDefConceptId conceptId = (PropDefConceptId) metadata.getFromConceptIdCache(key);
if (conceptId == null) {
conceptId = new PropDefConceptId(propId, propertyName, value, metadata);
metadata.putInConceptIdCache(key, conceptId);
}
return conceptId;
} | [
"public",
"static",
"PropDefConceptId",
"getInstance",
"(",
"String",
"propId",
",",
"String",
"propertyName",
",",
"Value",
"value",
",",
"Metadata",
"metadata",
")",
"{",
"List",
"<",
"Object",
">",
"key",
"=",
"new",
"ArrayList",
"<>",
"(",
"4",
")",
";",
"key",
".",
"add",
"(",
"propId",
")",
";",
"key",
".",
"add",
"(",
"propertyName",
")",
";",
"key",
".",
"add",
"(",
"value",
")",
";",
"key",
".",
"add",
"(",
"Boolean",
".",
"TRUE",
")",
";",
"//distinguishes these from properties represented as a modifier.",
"PropDefConceptId",
"conceptId",
"=",
"(",
"PropDefConceptId",
")",
"metadata",
".",
"getFromConceptIdCache",
"(",
"key",
")",
";",
"if",
"(",
"conceptId",
"==",
"null",
")",
"{",
"conceptId",
"=",
"new",
"PropDefConceptId",
"(",
"propId",
",",
"propertyName",
",",
"value",
",",
"metadata",
")",
";",
"metadata",
".",
"putInConceptIdCache",
"(",
"key",
",",
"conceptId",
")",
";",
"}",
"return",
"conceptId",
";",
"}"
] | Returns a concept propId with the given proposition propId, property name and
value.
@param propId a proposition propId {@link String}. Cannot be
<code>null</code>.
@param propertyName a property name {@link String}.
@param value a {@link Value}.
@return a {@link PropDefConceptId}. | [
"Returns",
"a",
"concept",
"propId",
"with",
"the",
"given",
"proposition",
"propId",
"property",
"name",
"and",
"value",
"."
] | train | https://github.com/eurekaclinical/aiw-i2b2-etl/blob/3eed6bda7755919cb9466d2930723a0f4748341a/src/main/java/edu/emory/cci/aiw/i2b2etl/dest/metadata/conceptid/PropDefConceptId.java#L67-L80 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java | AbstractAsymmetricCrypto.encryptBcd | public String encryptBcd(String data, KeyType keyType) {
"""
分组加密
@param data 数据
@param keyType 密钥类型
@return 加密后的密文
@throws CryptoException 加密异常
@since 4.1.0
"""
return encryptBcd(data, keyType, CharsetUtil.CHARSET_UTF_8);
} | java | public String encryptBcd(String data, KeyType keyType) {
return encryptBcd(data, keyType, CharsetUtil.CHARSET_UTF_8);
} | [
"public",
"String",
"encryptBcd",
"(",
"String",
"data",
",",
"KeyType",
"keyType",
")",
"{",
"return",
"encryptBcd",
"(",
"data",
",",
"keyType",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
")",
";",
"}"
] | 分组加密
@param data 数据
@param keyType 密钥类型
@return 加密后的密文
@throws CryptoException 加密异常
@since 4.1.0 | [
"分组加密"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L198-L200 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java | SegmentAggregator.reconcileAppendOperation | private CompletableFuture<WriterFlushResult> reconcileAppendOperation(AggregatedAppendOperation op, SegmentProperties storageInfo, TimeoutTimer timer) {
"""
Attempts to reconcile data and attributes for the given AggregatedAppendOperation. Since Append Operations can be partially
flushed, reconciliation may be for the full operation or for a part of it.
@param op The AggregatedAppendOperation to reconcile.
@param storageInfo The current state of the Segment in Storage.
@param timer Timer for the operation.
@return A CompletableFuture containing a FlushResult with the number of bytes reconciled, or failed with a ReconciliationFailureException,
if the operation cannot be reconciled, based on the in-memory metadata or the current state of the Segment in Storage.
"""
CompletableFuture<Boolean> reconcileResult;
WriterFlushResult flushResult = new WriterFlushResult();
if (op.getLength() > 0) {
// This operation has data. Reconcile that first.
reconcileResult = reconcileData(op, storageInfo, timer)
.thenApply(reconciledBytes -> {
flushResult.withFlushedBytes(reconciledBytes);
return reconciledBytes >= op.getLength() && op.getLastStreamSegmentOffset() <= storageInfo.getLength();
});
} else {
// No data to reconcile, so we consider this part done.
reconcileResult = CompletableFuture.completedFuture(true);
}
if (!op.attributes.isEmpty()) {
// This operation has Attributes. Reconcile them, but only if the data reconciliation succeeded for the whole operation.
reconcileResult = reconcileResult.thenComposeAsync(fullyReconciledData -> {
if (fullyReconciledData) {
return reconcileAttributes(op, timer)
.thenApply(v -> {
flushResult.withFlushedAttributes(op.attributes.size());
return fullyReconciledData;
});
} else {
return CompletableFuture.completedFuture(fullyReconciledData);
}
}, this.executor);
}
return reconcileResult.thenApplyAsync(fullyReconciled -> {
if (fullyReconciled) {
// Operation has been completely validated; pop it off the list.
StorageOperation removedOp = this.operations.removeFirst();
assert op == removedOp : "Reconciled operation is not the same as removed operation";
}
return flushResult;
});
} | java | private CompletableFuture<WriterFlushResult> reconcileAppendOperation(AggregatedAppendOperation op, SegmentProperties storageInfo, TimeoutTimer timer) {
CompletableFuture<Boolean> reconcileResult;
WriterFlushResult flushResult = new WriterFlushResult();
if (op.getLength() > 0) {
// This operation has data. Reconcile that first.
reconcileResult = reconcileData(op, storageInfo, timer)
.thenApply(reconciledBytes -> {
flushResult.withFlushedBytes(reconciledBytes);
return reconciledBytes >= op.getLength() && op.getLastStreamSegmentOffset() <= storageInfo.getLength();
});
} else {
// No data to reconcile, so we consider this part done.
reconcileResult = CompletableFuture.completedFuture(true);
}
if (!op.attributes.isEmpty()) {
// This operation has Attributes. Reconcile them, but only if the data reconciliation succeeded for the whole operation.
reconcileResult = reconcileResult.thenComposeAsync(fullyReconciledData -> {
if (fullyReconciledData) {
return reconcileAttributes(op, timer)
.thenApply(v -> {
flushResult.withFlushedAttributes(op.attributes.size());
return fullyReconciledData;
});
} else {
return CompletableFuture.completedFuture(fullyReconciledData);
}
}, this.executor);
}
return reconcileResult.thenApplyAsync(fullyReconciled -> {
if (fullyReconciled) {
// Operation has been completely validated; pop it off the list.
StorageOperation removedOp = this.operations.removeFirst();
assert op == removedOp : "Reconciled operation is not the same as removed operation";
}
return flushResult;
});
} | [
"private",
"CompletableFuture",
"<",
"WriterFlushResult",
">",
"reconcileAppendOperation",
"(",
"AggregatedAppendOperation",
"op",
",",
"SegmentProperties",
"storageInfo",
",",
"TimeoutTimer",
"timer",
")",
"{",
"CompletableFuture",
"<",
"Boolean",
">",
"reconcileResult",
";",
"WriterFlushResult",
"flushResult",
"=",
"new",
"WriterFlushResult",
"(",
")",
";",
"if",
"(",
"op",
".",
"getLength",
"(",
")",
">",
"0",
")",
"{",
"// This operation has data. Reconcile that first.",
"reconcileResult",
"=",
"reconcileData",
"(",
"op",
",",
"storageInfo",
",",
"timer",
")",
".",
"thenApply",
"(",
"reconciledBytes",
"->",
"{",
"flushResult",
".",
"withFlushedBytes",
"(",
"reconciledBytes",
")",
";",
"return",
"reconciledBytes",
">=",
"op",
".",
"getLength",
"(",
")",
"&&",
"op",
".",
"getLastStreamSegmentOffset",
"(",
")",
"<=",
"storageInfo",
".",
"getLength",
"(",
")",
";",
"}",
")",
";",
"}",
"else",
"{",
"// No data to reconcile, so we consider this part done.",
"reconcileResult",
"=",
"CompletableFuture",
".",
"completedFuture",
"(",
"true",
")",
";",
"}",
"if",
"(",
"!",
"op",
".",
"attributes",
".",
"isEmpty",
"(",
")",
")",
"{",
"// This operation has Attributes. Reconcile them, but only if the data reconciliation succeeded for the whole operation.",
"reconcileResult",
"=",
"reconcileResult",
".",
"thenComposeAsync",
"(",
"fullyReconciledData",
"->",
"{",
"if",
"(",
"fullyReconciledData",
")",
"{",
"return",
"reconcileAttributes",
"(",
"op",
",",
"timer",
")",
".",
"thenApply",
"(",
"v",
"->",
"{",
"flushResult",
".",
"withFlushedAttributes",
"(",
"op",
".",
"attributes",
".",
"size",
"(",
")",
")",
";",
"return",
"fullyReconciledData",
";",
"}",
")",
";",
"}",
"else",
"{",
"return",
"CompletableFuture",
".",
"completedFuture",
"(",
"fullyReconciledData",
")",
";",
"}",
"}",
",",
"this",
".",
"executor",
")",
";",
"}",
"return",
"reconcileResult",
".",
"thenApplyAsync",
"(",
"fullyReconciled",
"->",
"{",
"if",
"(",
"fullyReconciled",
")",
"{",
"// Operation has been completely validated; pop it off the list.",
"StorageOperation",
"removedOp",
"=",
"this",
".",
"operations",
".",
"removeFirst",
"(",
")",
";",
"assert",
"op",
"==",
"removedOp",
":",
"\"Reconciled operation is not the same as removed operation\"",
";",
"}",
"return",
"flushResult",
";",
"}",
")",
";",
"}"
] | Attempts to reconcile data and attributes for the given AggregatedAppendOperation. Since Append Operations can be partially
flushed, reconciliation may be for the full operation or for a part of it.
@param op The AggregatedAppendOperation to reconcile.
@param storageInfo The current state of the Segment in Storage.
@param timer Timer for the operation.
@return A CompletableFuture containing a FlushResult with the number of bytes reconciled, or failed with a ReconciliationFailureException,
if the operation cannot be reconciled, based on the in-memory metadata or the current state of the Segment in Storage. | [
"Attempts",
"to",
"reconcile",
"data",
"and",
"attributes",
"for",
"the",
"given",
"AggregatedAppendOperation",
".",
"Since",
"Append",
"Operations",
"can",
"be",
"partially",
"flushed",
"reconciliation",
"may",
"be",
"for",
"the",
"full",
"operation",
"or",
"for",
"a",
"part",
"of",
"it",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java#L1306-L1344 |
rvs-fluid-it/mvn-fluid-cd | mvn-ext-freeze/src/main/java/be/fluid_it/mvn/cd/x/freeze/replace/FreezeHandler.java | FreezeHandler.processingInstruction | public void processingInstruction(String target, String data)
throws SAXException {
"""
Overrides <code>processingInstruction(String <i>target</i>,
String <i>data</i>)</code> in
<code>org.xml.sax.helpers.DefaultHandler</code>,
which in turn implements <code>org.xml.sax.ContentHandler</code>.
Called whenever a processing instruction (PI) is encountered.
"""
write(nl + " <?" + target + " " + data + "?>");
} | java | public void processingInstruction(String target, String data)
throws SAXException {
write(nl + " <?" + target + " " + data + "?>");
} | [
"public",
"void",
"processingInstruction",
"(",
"String",
"target",
",",
"String",
"data",
")",
"throws",
"SAXException",
"{",
"write",
"(",
"nl",
"+",
"\" <?\"",
"+",
"target",
"+",
"\" \"",
"+",
"data",
"+",
"\"?>\"",
")",
";",
"}"
] | Overrides <code>processingInstruction(String <i>target</i>,
String <i>data</i>)</code> in
<code>org.xml.sax.helpers.DefaultHandler</code>,
which in turn implements <code>org.xml.sax.ContentHandler</code>.
Called whenever a processing instruction (PI) is encountered. | [
"Overrides",
"<code",
">",
"processingInstruction",
"(",
"String",
"<i",
">",
"target<",
"/",
"i",
">",
"String",
"<i",
">",
"data<",
"/",
"i",
">",
")",
"<",
"/",
"code",
">",
"in",
"<code",
">",
"org",
".",
"xml",
".",
"sax",
".",
"helpers",
".",
"DefaultHandler<",
"/",
"code",
">",
"which",
"in",
"turn",
"implements",
"<code",
">",
"org",
".",
"xml",
".",
"sax",
".",
"ContentHandler<",
"/",
"code",
">",
".",
"Called",
"whenever",
"a",
"processing",
"instruction",
"(",
"PI",
")",
"is",
"encountered",
"."
] | train | https://github.com/rvs-fluid-it/mvn-fluid-cd/blob/2aad8ed1cb40f94bd24bad7e6a127956cc277077/mvn-ext-freeze/src/main/java/be/fluid_it/mvn/cd/x/freeze/replace/FreezeHandler.java#L64-L67 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.writeSymbolToFileMap | public static void writeSymbolToFileMap(Map<Symbol, File> symbolToFileMap, CharSink sink) throws IOException {
"""
Writes a map from symbols to file absolute paths to a file. Each line has a mapping with the key and value
separated by a single tab. The file will have a trailing newline.
"""
writeSymbolToFileEntries(symbolToFileMap.entrySet(), sink);
} | java | public static void writeSymbolToFileMap(Map<Symbol, File> symbolToFileMap, CharSink sink) throws IOException {
writeSymbolToFileEntries(symbolToFileMap.entrySet(), sink);
} | [
"public",
"static",
"void",
"writeSymbolToFileMap",
"(",
"Map",
"<",
"Symbol",
",",
"File",
">",
"symbolToFileMap",
",",
"CharSink",
"sink",
")",
"throws",
"IOException",
"{",
"writeSymbolToFileEntries",
"(",
"symbolToFileMap",
".",
"entrySet",
"(",
")",
",",
"sink",
")",
";",
"}"
] | Writes a map from symbols to file absolute paths to a file. Each line has a mapping with the key and value
separated by a single tab. The file will have a trailing newline. | [
"Writes",
"a",
"map",
"from",
"symbols",
"to",
"file",
"absolute",
"paths",
"to",
"a",
"file",
".",
"Each",
"line",
"has",
"a",
"mapping",
"with",
"the",
"key",
"and",
"value",
"separated",
"by",
"a",
"single",
"tab",
".",
"The",
"file",
"will",
"have",
"a",
"trailing",
"newline",
"."
] | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L243-L245 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/URI.java | URI.setPort | public void setPort(int p_port) throws MalformedURIException {
"""
Set the port for this URI. -1 is used to indicate that the port is
not specified, otherwise valid port numbers are between 0 and 65535.
If a valid port number is passed in and the host field is null,
an exception is thrown.
@param p_port the port number for this URI
@throws MalformedURIException if p_port is not -1 and not a
valid port number
"""
if (p_port >= 0 && p_port <= 65535)
{
if (m_host == null)
{
throw new MalformedURIException(
XMLMessages.createXMLMessage(XMLErrorResources.ER_PORT_WHEN_HOST_NULL, null)); //"Port cannot be set when host is null!");
}
}
else if (p_port != -1)
{
throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_INVALID_PORT, null)); //"Invalid port number!");
}
m_port = p_port;
} | java | public void setPort(int p_port) throws MalformedURIException
{
if (p_port >= 0 && p_port <= 65535)
{
if (m_host == null)
{
throw new MalformedURIException(
XMLMessages.createXMLMessage(XMLErrorResources.ER_PORT_WHEN_HOST_NULL, null)); //"Port cannot be set when host is null!");
}
}
else if (p_port != -1)
{
throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_INVALID_PORT, null)); //"Invalid port number!");
}
m_port = p_port;
} | [
"public",
"void",
"setPort",
"(",
"int",
"p_port",
")",
"throws",
"MalformedURIException",
"{",
"if",
"(",
"p_port",
">=",
"0",
"&&",
"p_port",
"<=",
"65535",
")",
"{",
"if",
"(",
"m_host",
"==",
"null",
")",
"{",
"throw",
"new",
"MalformedURIException",
"(",
"XMLMessages",
".",
"createXMLMessage",
"(",
"XMLErrorResources",
".",
"ER_PORT_WHEN_HOST_NULL",
",",
"null",
")",
")",
";",
"//\"Port cannot be set when host is null!\");",
"}",
"}",
"else",
"if",
"(",
"p_port",
"!=",
"-",
"1",
")",
"{",
"throw",
"new",
"MalformedURIException",
"(",
"XMLMessages",
".",
"createXMLMessage",
"(",
"XMLErrorResources",
".",
"ER_INVALID_PORT",
",",
"null",
")",
")",
";",
"//\"Invalid port number!\");",
"}",
"m_port",
"=",
"p_port",
";",
"}"
] | Set the port for this URI. -1 is used to indicate that the port is
not specified, otherwise valid port numbers are between 0 and 65535.
If a valid port number is passed in and the host field is null,
an exception is thrown.
@param p_port the port number for this URI
@throws MalformedURIException if p_port is not -1 and not a
valid port number | [
"Set",
"the",
"port",
"for",
"this",
"URI",
".",
"-",
"1",
"is",
"used",
"to",
"indicate",
"that",
"the",
"port",
"is",
"not",
"specified",
"otherwise",
"valid",
"port",
"numbers",
"are",
"between",
"0",
"and",
"65535",
".",
"If",
"a",
"valid",
"port",
"number",
"is",
"passed",
"in",
"and",
"the",
"host",
"field",
"is",
"null",
"an",
"exception",
"is",
"thrown",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/URI.java#L1146-L1163 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/time/DateUtils.java | DateUtils.getFragmentInMilliseconds | @GwtIncompatible("incompatible method")
public static long getFragmentInMilliseconds(final Date date, final int fragment) {
"""
<p>Returns the number of milliseconds within the
fragment. All datefields greater than the fragment will be ignored.</p>
<p>Asking the milliseconds of any date will only return the number of milliseconds
of the current second (resulting in a number between 0 and 999). This
method will retrieve the number of milliseconds for any fragment.
For example, if you want to calculate the number of milliseconds past today,
your fragment is Calendar.DATE or Calendar.DAY_OF_YEAR. The result will
be all milliseconds of the past hour(s), minutes(s) and second(s).</p>
<p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
A fragment less than or equal to a SECOND field will return 0.</p>
<ul>
<li>January 1, 2008 7:15:10.538 with Calendar.SECOND as fragment will return 538</li>
<li>January 6, 2008 7:15:10.538 with Calendar.SECOND as fragment will return 538</li>
<li>January 6, 2008 7:15:10.538 with Calendar.MINUTE as fragment will return 10538 (10*1000 + 538)</li>
<li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0
(a millisecond cannot be split in milliseconds)</li>
</ul>
@param date the date to work with, not null
@param fragment the {@code Calendar} field part of date to calculate
@return number of milliseconds within the fragment of date
@throws IllegalArgumentException if the date is <code>null</code> or
fragment is not supported
@since 2.4
"""
return getFragment(date, fragment, TimeUnit.MILLISECONDS);
} | java | @GwtIncompatible("incompatible method")
public static long getFragmentInMilliseconds(final Date date, final int fragment) {
return getFragment(date, fragment, TimeUnit.MILLISECONDS);
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"long",
"getFragmentInMilliseconds",
"(",
"final",
"Date",
"date",
",",
"final",
"int",
"fragment",
")",
"{",
"return",
"getFragment",
"(",
"date",
",",
"fragment",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}"
] | <p>Returns the number of milliseconds within the
fragment. All datefields greater than the fragment will be ignored.</p>
<p>Asking the milliseconds of any date will only return the number of milliseconds
of the current second (resulting in a number between 0 and 999). This
method will retrieve the number of milliseconds for any fragment.
For example, if you want to calculate the number of milliseconds past today,
your fragment is Calendar.DATE or Calendar.DAY_OF_YEAR. The result will
be all milliseconds of the past hour(s), minutes(s) and second(s).</p>
<p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
A fragment less than or equal to a SECOND field will return 0.</p>
<ul>
<li>January 1, 2008 7:15:10.538 with Calendar.SECOND as fragment will return 538</li>
<li>January 6, 2008 7:15:10.538 with Calendar.SECOND as fragment will return 538</li>
<li>January 6, 2008 7:15:10.538 with Calendar.MINUTE as fragment will return 10538 (10*1000 + 538)</li>
<li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0
(a millisecond cannot be split in milliseconds)</li>
</ul>
@param date the date to work with, not null
@param fragment the {@code Calendar} field part of date to calculate
@return number of milliseconds within the fragment of date
@throws IllegalArgumentException if the date is <code>null</code> or
fragment is not supported
@since 2.4 | [
"<p",
">",
"Returns",
"the",
"number",
"of",
"milliseconds",
"within",
"the",
"fragment",
".",
"All",
"datefields",
"greater",
"than",
"the",
"fragment",
"will",
"be",
"ignored",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L1296-L1299 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java | SM2Engine.init | public void init(boolean forEncryption, CipherParameters param) {
"""
初始化引擎
@param forEncryption 是否为加密模式
@param param {@link CipherParameters},此处应为{@link ParametersWithRandom}(加密时)或{@link ECKeyParameters}(解密时)
"""
this.forEncryption = forEncryption;
if (param instanceof ParametersWithRandom) {
final ParametersWithRandom rParam = (ParametersWithRandom) param;
this.ecKey = (ECKeyParameters) rParam.getParameters();
this.random = rParam.getRandom();
} else {
this.ecKey = (ECKeyParameters) param;
}
this.ecParams = this.ecKey.getParameters();
if (forEncryption) {
// 检查曲线点
final ECPoint ecPoint = ((ECPublicKeyParameters) ecKey).getQ().multiply(ecParams.getH());
if (ecPoint.isInfinity()) {
throw new IllegalArgumentException("invalid key: [h]Q at infinity");
}
// 检查随机参数
if (null == this.random) {
this.random = CryptoServicesRegistrar.getSecureRandom();
}
}
// 曲线位长度
this.curveLength = (this.ecParams.getCurve().getFieldSize() + 7) / 8;
} | java | public void init(boolean forEncryption, CipherParameters param) {
this.forEncryption = forEncryption;
if (param instanceof ParametersWithRandom) {
final ParametersWithRandom rParam = (ParametersWithRandom) param;
this.ecKey = (ECKeyParameters) rParam.getParameters();
this.random = rParam.getRandom();
} else {
this.ecKey = (ECKeyParameters) param;
}
this.ecParams = this.ecKey.getParameters();
if (forEncryption) {
// 检查曲线点
final ECPoint ecPoint = ((ECPublicKeyParameters) ecKey).getQ().multiply(ecParams.getH());
if (ecPoint.isInfinity()) {
throw new IllegalArgumentException("invalid key: [h]Q at infinity");
}
// 检查随机参数
if (null == this.random) {
this.random = CryptoServicesRegistrar.getSecureRandom();
}
}
// 曲线位长度
this.curveLength = (this.ecParams.getCurve().getFieldSize() + 7) / 8;
} | [
"public",
"void",
"init",
"(",
"boolean",
"forEncryption",
",",
"CipherParameters",
"param",
")",
"{",
"this",
".",
"forEncryption",
"=",
"forEncryption",
";",
"if",
"(",
"param",
"instanceof",
"ParametersWithRandom",
")",
"{",
"final",
"ParametersWithRandom",
"rParam",
"=",
"(",
"ParametersWithRandom",
")",
"param",
";",
"this",
".",
"ecKey",
"=",
"(",
"ECKeyParameters",
")",
"rParam",
".",
"getParameters",
"(",
")",
";",
"this",
".",
"random",
"=",
"rParam",
".",
"getRandom",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"ecKey",
"=",
"(",
"ECKeyParameters",
")",
"param",
";",
"}",
"this",
".",
"ecParams",
"=",
"this",
".",
"ecKey",
".",
"getParameters",
"(",
")",
";",
"if",
"(",
"forEncryption",
")",
"{",
"// 检查曲线点\r",
"final",
"ECPoint",
"ecPoint",
"=",
"(",
"(",
"ECPublicKeyParameters",
")",
"ecKey",
")",
".",
"getQ",
"(",
")",
".",
"multiply",
"(",
"ecParams",
".",
"getH",
"(",
")",
")",
";",
"if",
"(",
"ecPoint",
".",
"isInfinity",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"invalid key: [h]Q at infinity\"",
")",
";",
"}",
"// 检查随机参数\r",
"if",
"(",
"null",
"==",
"this",
".",
"random",
")",
"{",
"this",
".",
"random",
"=",
"CryptoServicesRegistrar",
".",
"getSecureRandom",
"(",
")",
";",
"}",
"}",
"// 曲线位长度\r",
"this",
".",
"curveLength",
"=",
"(",
"this",
".",
"ecParams",
".",
"getCurve",
"(",
")",
".",
"getFieldSize",
"(",
")",
"+",
"7",
")",
"/",
"8",
";",
"}"
] | 初始化引擎
@param forEncryption 是否为加密模式
@param param {@link CipherParameters},此处应为{@link ParametersWithRandom}(加密时)或{@link ECKeyParameters}(解密时) | [
"初始化引擎"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java#L94-L121 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/StreamUtil.java | StreamUtil.copy | public static void copy(Reader reader, OutputStream out) throws IOException {
"""
Copies the content of a reader to an output stream.
@param reader the reader to read
@param out the output stream to write
@throws java.io.IOException if an I/O error occurs
"""
copy(reader, getOutputStreamWriter(out));
out.flush();
} | java | public static void copy(Reader reader, OutputStream out) throws IOException {
copy(reader, getOutputStreamWriter(out));
out.flush();
} | [
"public",
"static",
"void",
"copy",
"(",
"Reader",
"reader",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"copy",
"(",
"reader",
",",
"getOutputStreamWriter",
"(",
"out",
")",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"}"
] | Copies the content of a reader to an output stream.
@param reader the reader to read
@param out the output stream to write
@throws java.io.IOException if an I/O error occurs | [
"Copies",
"the",
"content",
"of",
"a",
"reader",
"to",
"an",
"output",
"stream",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/StreamUtil.java#L220-L223 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/resizable/ResizableContainment.java | ResizableContainment.setParam | private void setParam(ElementEnum elementEnumParam, String objectParam, LiteralOption selector) {
"""
Method setting the right parameter
@param elementEnumParam
elementEnum parameter
@param objectParam
object parameter
@param selector
Selector
"""
this.elementEnumParam = elementEnumParam;
this.objectParam = objectParam;
this.selector = selector;
} | java | private void setParam(ElementEnum elementEnumParam, String objectParam, LiteralOption selector)
{
this.elementEnumParam = elementEnumParam;
this.objectParam = objectParam;
this.selector = selector;
} | [
"private",
"void",
"setParam",
"(",
"ElementEnum",
"elementEnumParam",
",",
"String",
"objectParam",
",",
"LiteralOption",
"selector",
")",
"{",
"this",
".",
"elementEnumParam",
"=",
"elementEnumParam",
";",
"this",
".",
"objectParam",
"=",
"objectParam",
";",
"this",
".",
"selector",
"=",
"selector",
";",
"}"
] | Method setting the right parameter
@param elementEnumParam
elementEnum parameter
@param objectParam
object parameter
@param selector
Selector | [
"Method",
"setting",
"the",
"right",
"parameter"
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/resizable/ResizableContainment.java#L222-L227 |
Metatavu/edelphi | rest/src/main/java/fi/metatavu/edelphi/users/UserController.java | UserController.getUserKeycloakId | public UUID getUserKeycloakId(User user) {
"""
Returns Keycloak id for an user
@param user user
@return Keycloak id or null if id could not be resolved
"""
AuthSource authSource = authSourceDAO.findByStrategy(KEYCLOAK_AUTH_SOURCE);
if (authSource == null) {
logger.error("Could not find Keycloak auth source");
}
List<UserIdentification> userIdentifications = userIdentificationDAO.listByUserAndAuthSource(user, authSource);
if (userIdentifications.size() == 1) {
return UUID.fromString(userIdentifications.get(0).getExternalId());
}
if (userIdentifications.size() > 1) {
logger.warn("User {} has more than one identity", user.getId());
}
return new UUID(0L, 0L);
} | java | public UUID getUserKeycloakId(User user) {
AuthSource authSource = authSourceDAO.findByStrategy(KEYCLOAK_AUTH_SOURCE);
if (authSource == null) {
logger.error("Could not find Keycloak auth source");
}
List<UserIdentification> userIdentifications = userIdentificationDAO.listByUserAndAuthSource(user, authSource);
if (userIdentifications.size() == 1) {
return UUID.fromString(userIdentifications.get(0).getExternalId());
}
if (userIdentifications.size() > 1) {
logger.warn("User {} has more than one identity", user.getId());
}
return new UUID(0L, 0L);
} | [
"public",
"UUID",
"getUserKeycloakId",
"(",
"User",
"user",
")",
"{",
"AuthSource",
"authSource",
"=",
"authSourceDAO",
".",
"findByStrategy",
"(",
"KEYCLOAK_AUTH_SOURCE",
")",
";",
"if",
"(",
"authSource",
"==",
"null",
")",
"{",
"logger",
".",
"error",
"(",
"\"Could not find Keycloak auth source\"",
")",
";",
"}",
"List",
"<",
"UserIdentification",
">",
"userIdentifications",
"=",
"userIdentificationDAO",
".",
"listByUserAndAuthSource",
"(",
"user",
",",
"authSource",
")",
";",
"if",
"(",
"userIdentifications",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"return",
"UUID",
".",
"fromString",
"(",
"userIdentifications",
".",
"get",
"(",
"0",
")",
".",
"getExternalId",
"(",
")",
")",
";",
"}",
"if",
"(",
"userIdentifications",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"logger",
".",
"warn",
"(",
"\"User {} has more than one identity\",",
" ",
"ser.",
"g",
"etId(",
")",
")",
";",
"",
"}",
"return",
"new",
"UUID",
"(",
"0L",
",",
"0L",
")",
";",
"}"
] | Returns Keycloak id for an user
@param user user
@return Keycloak id or null if id could not be resolved | [
"Returns",
"Keycloak",
"id",
"for",
"an",
"user"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/rest/src/main/java/fi/metatavu/edelphi/users/UserController.java#L62-L78 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java | TileSystem.PixelXYToLatLong | @Deprecated
public GeoPoint PixelXYToLatLong(
final int pixelX, final int pixelY, final int levelOfDetail, final GeoPoint reuse) {
"""
Use {@link TileSystem#getGeoFromMercator(long, long, double, GeoPoint, boolean, boolean)} instead
"""
return getGeoFromMercator(pixelX, pixelY, MapSize(levelOfDetail), reuse, true, true);
} | java | @Deprecated
public GeoPoint PixelXYToLatLong(
final int pixelX, final int pixelY, final int levelOfDetail, final GeoPoint reuse) {
return getGeoFromMercator(pixelX, pixelY, MapSize(levelOfDetail), reuse, true, true);
} | [
"@",
"Deprecated",
"public",
"GeoPoint",
"PixelXYToLatLong",
"(",
"final",
"int",
"pixelX",
",",
"final",
"int",
"pixelY",
",",
"final",
"int",
"levelOfDetail",
",",
"final",
"GeoPoint",
"reuse",
")",
"{",
"return",
"getGeoFromMercator",
"(",
"pixelX",
",",
"pixelY",
",",
"MapSize",
"(",
"levelOfDetail",
")",
",",
"reuse",
",",
"true",
",",
"true",
")",
";",
"}"
] | Use {@link TileSystem#getGeoFromMercator(long, long, double, GeoPoint, boolean, boolean)} instead | [
"Use",
"{"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java#L185-L189 |
davidcarboni/cryptolite-java | src/main/java/com/github/davidcarboni/cryptolite/Keys.java | Keys.newKeyPair | public static KeyPair newKeyPair() {
"""
Generates a new public-private (or asymmetric) key pair for use with {@value #ASYMMETRIC_ALGORITHM}.
<p>
The key size will be {@value #ASYMMETRIC_KEY_SIZE} bits.
<p>
BouncyCastle will automatically generate a "Chinese Remainder Theorem" or CRT key, which
makes using a symmetric encryption significantly faster.
@return A new, randomly generated asymmetric key pair.
"""
// Construct a key generator
KeyPairGenerator keyPairGenerator;
try {
keyPairGenerator = KeyPairGenerator.getInstance(ASYMMETRIC_ALGORITHM);
keyPairGenerator.initialize(ASYMMETRIC_KEY_SIZE);
} catch (NoSuchAlgorithmException e) {
if (SecurityProvider.addProvider()) {
return newKeyPair();
} else {
throw new IllegalStateException("Algorithm unavailable: " + ASYMMETRIC_ALGORITHM, e);
}
}
// Generate a key:
KeyPair result = keyPairGenerator.generateKeyPair();
return result;
} | java | public static KeyPair newKeyPair() {
// Construct a key generator
KeyPairGenerator keyPairGenerator;
try {
keyPairGenerator = KeyPairGenerator.getInstance(ASYMMETRIC_ALGORITHM);
keyPairGenerator.initialize(ASYMMETRIC_KEY_SIZE);
} catch (NoSuchAlgorithmException e) {
if (SecurityProvider.addProvider()) {
return newKeyPair();
} else {
throw new IllegalStateException("Algorithm unavailable: " + ASYMMETRIC_ALGORITHM, e);
}
}
// Generate a key:
KeyPair result = keyPairGenerator.generateKeyPair();
return result;
} | [
"public",
"static",
"KeyPair",
"newKeyPair",
"(",
")",
"{",
"// Construct a key generator\r",
"KeyPairGenerator",
"keyPairGenerator",
";",
"try",
"{",
"keyPairGenerator",
"=",
"KeyPairGenerator",
".",
"getInstance",
"(",
"ASYMMETRIC_ALGORITHM",
")",
";",
"keyPairGenerator",
".",
"initialize",
"(",
"ASYMMETRIC_KEY_SIZE",
")",
";",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"e",
")",
"{",
"if",
"(",
"SecurityProvider",
".",
"addProvider",
"(",
")",
")",
"{",
"return",
"newKeyPair",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Algorithm unavailable: \"",
"+",
"ASYMMETRIC_ALGORITHM",
",",
"e",
")",
";",
"}",
"}",
"// Generate a key:\r",
"KeyPair",
"result",
"=",
"keyPairGenerator",
".",
"generateKeyPair",
"(",
")",
";",
"return",
"result",
";",
"}"
] | Generates a new public-private (or asymmetric) key pair for use with {@value #ASYMMETRIC_ALGORITHM}.
<p>
The key size will be {@value #ASYMMETRIC_KEY_SIZE} bits.
<p>
BouncyCastle will automatically generate a "Chinese Remainder Theorem" or CRT key, which
makes using a symmetric encryption significantly faster.
@return A new, randomly generated asymmetric key pair. | [
"Generates",
"a",
"new",
"public",
"-",
"private",
"(",
"or",
"asymmetric",
")",
"key",
"pair",
"for",
"use",
"with",
"{",
"@value",
"#ASYMMETRIC_ALGORITHM",
"}",
".",
"<p",
">",
"The",
"key",
"size",
"will",
"be",
"{",
"@value",
"#ASYMMETRIC_KEY_SIZE",
"}",
"bits",
".",
"<p",
">",
"BouncyCastle",
"will",
"automatically",
"generate",
"a",
"Chinese",
"Remainder",
"Theorem",
"or",
"CRT",
"key",
"which",
"makes",
"using",
"a",
"symmetric",
"encryption",
"significantly",
"faster",
"."
] | train | https://github.com/davidcarboni/cryptolite-java/blob/e67954181a04ffc9beb1d9abca1421195fcf9764/src/main/java/com/github/davidcarboni/cryptolite/Keys.java#L227-L246 |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java | StandardRoadConnection.removeConnectedSegment | int removeConnectedSegment(RoadSegment segment, boolean attachToStartPoint) {
"""
Remove a connection with a segment.
@param segment is the segment to remove.
@param attachToStartPoint indicates if the segment is attached by
its start point (if value is <code>true</code>) or by its end point
@return the index of the removed segment, or {@code -1} if none was found
"""
if (segment == null) {
return -1;
}
final int idx = indexOf(segment, attachToStartPoint);
if (idx != -1) {
this.connectedSegments.remove(idx);
fireIteratorUpdate();
}
return idx;
} | java | int removeConnectedSegment(RoadSegment segment, boolean attachToStartPoint) {
if (segment == null) {
return -1;
}
final int idx = indexOf(segment, attachToStartPoint);
if (idx != -1) {
this.connectedSegments.remove(idx);
fireIteratorUpdate();
}
return idx;
} | [
"int",
"removeConnectedSegment",
"(",
"RoadSegment",
"segment",
",",
"boolean",
"attachToStartPoint",
")",
"{",
"if",
"(",
"segment",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"final",
"int",
"idx",
"=",
"indexOf",
"(",
"segment",
",",
"attachToStartPoint",
")",
";",
"if",
"(",
"idx",
"!=",
"-",
"1",
")",
"{",
"this",
".",
"connectedSegments",
".",
"remove",
"(",
"idx",
")",
";",
"fireIteratorUpdate",
"(",
")",
";",
"}",
"return",
"idx",
";",
"}"
] | Remove a connection with a segment.
@param segment is the segment to remove.
@param attachToStartPoint indicates if the segment is attached by
its start point (if value is <code>true</code>) or by its end point
@return the index of the removed segment, or {@code -1} if none was found | [
"Remove",
"a",
"connection",
"with",
"a",
"segment",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java#L414-L424 |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java | HealthStatusHttpMapper.addStatusMapping | public void addStatusMapping(Map<String, Integer> statusMapping) {
"""
Add specific status mappings to the existing set.
@param statusMapping a map of health status code to HTTP status code
"""
Assert.notNull(statusMapping, "StatusMapping must not be null");
this.statusMapping.putAll(statusMapping);
} | java | public void addStatusMapping(Map<String, Integer> statusMapping) {
Assert.notNull(statusMapping, "StatusMapping must not be null");
this.statusMapping.putAll(statusMapping);
} | [
"public",
"void",
"addStatusMapping",
"(",
"Map",
"<",
"String",
",",
"Integer",
">",
"statusMapping",
")",
"{",
"Assert",
".",
"notNull",
"(",
"statusMapping",
",",
"\"StatusMapping must not be null\"",
")",
";",
"this",
".",
"statusMapping",
".",
"putAll",
"(",
"statusMapping",
")",
";",
"}"
] | Add specific status mappings to the existing set.
@param statusMapping a map of health status code to HTTP status code | [
"Add",
"specific",
"status",
"mappings",
"to",
"the",
"existing",
"set",
"."
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java#L62-L65 |
Erudika/para | para-server/src/main/java/com/erudika/para/security/filters/TwitterAuthFilter.java | TwitterAuthFilter.attemptAuthentication | @Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
throws IOException {
"""
Handles an authentication request.
@param request HTTP request
@param response HTTP response
@return an authentication object that contains the principal object if successful.
@throws IOException ex
"""
final String requestURI = request.getRequestURI();
UserAuthentication userAuth = null;
if (requestURI.endsWith(TWITTER_ACTION)) {
String verifier = request.getParameter("oauth_verifier");
String appid = SecurityUtils.getAppidFromAuthRequest(request);
String denied = request.getParameter("denied");
String redirectURI = SecurityUtils.getRedirectUrl(request) + (appid == null ? "" : "?appid=" + appid);
App app = Para.getDAO().read(App.id(appid == null ? Config.getRootAppIdentifier() : appid));
String[] keys = SecurityUtils.getOAuthKeysForApp(app, Config.TWITTER_PREFIX);
if (denied != null) {
throw new BadCredentialsException("Cancelled.");
}
if (verifier == null && stepOne(response, redirectURI, keys)) {
return null;
} else {
userAuth = stepTwo(request, verifier, keys, app);
}
}
return SecurityUtils.checkIfActive(userAuth, SecurityUtils.getAuthenticatedUser(userAuth), true);
} | java | @Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
throws IOException {
final String requestURI = request.getRequestURI();
UserAuthentication userAuth = null;
if (requestURI.endsWith(TWITTER_ACTION)) {
String verifier = request.getParameter("oauth_verifier");
String appid = SecurityUtils.getAppidFromAuthRequest(request);
String denied = request.getParameter("denied");
String redirectURI = SecurityUtils.getRedirectUrl(request) + (appid == null ? "" : "?appid=" + appid);
App app = Para.getDAO().read(App.id(appid == null ? Config.getRootAppIdentifier() : appid));
String[] keys = SecurityUtils.getOAuthKeysForApp(app, Config.TWITTER_PREFIX);
if (denied != null) {
throw new BadCredentialsException("Cancelled.");
}
if (verifier == null && stepOne(response, redirectURI, keys)) {
return null;
} else {
userAuth = stepTwo(request, verifier, keys, app);
}
}
return SecurityUtils.checkIfActive(userAuth, SecurityUtils.getAuthenticatedUser(userAuth), true);
} | [
"@",
"Override",
"public",
"Authentication",
"attemptAuthentication",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"final",
"String",
"requestURI",
"=",
"request",
".",
"getRequestURI",
"(",
")",
";",
"UserAuthentication",
"userAuth",
"=",
"null",
";",
"if",
"(",
"requestURI",
".",
"endsWith",
"(",
"TWITTER_ACTION",
")",
")",
"{",
"String",
"verifier",
"=",
"request",
".",
"getParameter",
"(",
"\"oauth_verifier\"",
")",
";",
"String",
"appid",
"=",
"SecurityUtils",
".",
"getAppidFromAuthRequest",
"(",
"request",
")",
";",
"String",
"denied",
"=",
"request",
".",
"getParameter",
"(",
"\"denied\"",
")",
";",
"String",
"redirectURI",
"=",
"SecurityUtils",
".",
"getRedirectUrl",
"(",
"request",
")",
"+",
"(",
"appid",
"==",
"null",
"?",
"\"\"",
":",
"\"?appid=\"",
"+",
"appid",
")",
";",
"App",
"app",
"=",
"Para",
".",
"getDAO",
"(",
")",
".",
"read",
"(",
"App",
".",
"id",
"(",
"appid",
"==",
"null",
"?",
"Config",
".",
"getRootAppIdentifier",
"(",
")",
":",
"appid",
")",
")",
";",
"String",
"[",
"]",
"keys",
"=",
"SecurityUtils",
".",
"getOAuthKeysForApp",
"(",
"app",
",",
"Config",
".",
"TWITTER_PREFIX",
")",
";",
"if",
"(",
"denied",
"!=",
"null",
")",
"{",
"throw",
"new",
"BadCredentialsException",
"(",
"\"Cancelled.\"",
")",
";",
"}",
"if",
"(",
"verifier",
"==",
"null",
"&&",
"stepOne",
"(",
"response",
",",
"redirectURI",
",",
"keys",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"userAuth",
"=",
"stepTwo",
"(",
"request",
",",
"verifier",
",",
"keys",
",",
"app",
")",
";",
"}",
"}",
"return",
"SecurityUtils",
".",
"checkIfActive",
"(",
"userAuth",
",",
"SecurityUtils",
".",
"getAuthenticatedUser",
"(",
"userAuth",
")",
",",
"true",
")",
";",
"}"
] | Handles an authentication request.
@param request HTTP request
@param response HTTP response
@return an authentication object that contains the principal object if successful.
@throws IOException ex | [
"Handles",
"an",
"authentication",
"request",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/filters/TwitterAuthFilter.java#L99-L124 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.