repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
listlengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
listlengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
versionone/VersionOne.SDK.Java.ObjectModel
|
src/main/java/com/versionone/om/V1InstanceGetter.java
|
V1InstanceGetter.expressions
|
public Collection<Expression> expressions(ExpressionFilter filter) {
"""
Get Expression filtered by the criteria specified in the passed filter.
@param filter Limit the items returned. If null, then all items returned.
@return ICollection of the items as specified in the filter.
"""
return get(Expression.class, (filter != null) ? filter : new ExpressionFilter());
}
|
java
|
public Collection<Expression> expressions(ExpressionFilter filter) {
return get(Expression.class, (filter != null) ? filter : new ExpressionFilter());
}
|
[
"public",
"Collection",
"<",
"Expression",
">",
"expressions",
"(",
"ExpressionFilter",
"filter",
")",
"{",
"return",
"get",
"(",
"Expression",
".",
"class",
",",
"(",
"filter",
"!=",
"null",
")",
"?",
"filter",
":",
"new",
"ExpressionFilter",
"(",
")",
")",
";",
"}"
] |
Get Expression filtered by the criteria specified in the passed filter.
@param filter Limit the items returned. If null, then all items returned.
@return ICollection of the items as specified in the filter.
|
[
"Get",
"Expression",
"filtered",
"by",
"the",
"criteria",
"specified",
"in",
"the",
"passed",
"filter",
"."
] |
train
|
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L346-L348
|
phax/ph-bdve
|
ph-bdve-ubl/src/main/java/com/helger/bdve/ubl/UBLValidation.java
|
UBLValidation.initUBL22
|
public static void initUBL22 (@Nonnull final ValidationExecutorSetRegistry aRegistry) {
"""
Register all standard UBL 2.2 validation execution sets to the provided
registry.
@param aRegistry
The registry to add the artefacts. May not be <code>null</code>.
"""
ValueEnforcer.notNull (aRegistry, "Registry");
// For better error messages
LocationBeautifierSPI.addMappings (UBL22NamespaceContext.getInstance ());
final boolean bNotDeprecated = false;
for (final EUBL22DocumentType e : EUBL22DocumentType.values ())
{
final String sName = e.getLocalName ();
final VESID aVESID = new VESID (GROUP_ID, sName.toLowerCase (Locale.US), VERSION_22);
// No Schematrons here
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (aVESID,
"UBL " + sName + " " + VERSION_22,
bNotDeprecated,
ValidationExecutorXSD.create (e)));
}
}
|
java
|
public static void initUBL22 (@Nonnull final ValidationExecutorSetRegistry aRegistry)
{
ValueEnforcer.notNull (aRegistry, "Registry");
// For better error messages
LocationBeautifierSPI.addMappings (UBL22NamespaceContext.getInstance ());
final boolean bNotDeprecated = false;
for (final EUBL22DocumentType e : EUBL22DocumentType.values ())
{
final String sName = e.getLocalName ();
final VESID aVESID = new VESID (GROUP_ID, sName.toLowerCase (Locale.US), VERSION_22);
// No Schematrons here
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (aVESID,
"UBL " + sName + " " + VERSION_22,
bNotDeprecated,
ValidationExecutorXSD.create (e)));
}
}
|
[
"public",
"static",
"void",
"initUBL22",
"(",
"@",
"Nonnull",
"final",
"ValidationExecutorSetRegistry",
"aRegistry",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aRegistry",
",",
"\"Registry\"",
")",
";",
"// For better error messages",
"LocationBeautifierSPI",
".",
"addMappings",
"(",
"UBL22NamespaceContext",
".",
"getInstance",
"(",
")",
")",
";",
"final",
"boolean",
"bNotDeprecated",
"=",
"false",
";",
"for",
"(",
"final",
"EUBL22DocumentType",
"e",
":",
"EUBL22DocumentType",
".",
"values",
"(",
")",
")",
"{",
"final",
"String",
"sName",
"=",
"e",
".",
"getLocalName",
"(",
")",
";",
"final",
"VESID",
"aVESID",
"=",
"new",
"VESID",
"(",
"GROUP_ID",
",",
"sName",
".",
"toLowerCase",
"(",
"Locale",
".",
"US",
")",
",",
"VERSION_22",
")",
";",
"// No Schematrons here",
"aRegistry",
".",
"registerValidationExecutorSet",
"(",
"ValidationExecutorSet",
".",
"create",
"(",
"aVESID",
",",
"\"UBL \"",
"+",
"sName",
"+",
"\" \"",
"+",
"VERSION_22",
",",
"bNotDeprecated",
",",
"ValidationExecutorXSD",
".",
"create",
"(",
"e",
")",
")",
")",
";",
"}",
"}"
] |
Register all standard UBL 2.2 validation execution sets to the provided
registry.
@param aRegistry
The registry to add the artefacts. May not be <code>null</code>.
|
[
"Register",
"all",
"standard",
"UBL",
"2",
".",
"2",
"validation",
"execution",
"sets",
"to",
"the",
"provided",
"registry",
"."
] |
train
|
https://github.com/phax/ph-bdve/blob/2438f491174cd8989567fcdf129b273bd217e89f/ph-bdve-ubl/src/main/java/com/helger/bdve/ubl/UBLValidation.java#L398-L417
|
raydac/java-binary-block-parser
|
jbbp-plugins/jbbp-plugin-common/src/main/java/com/igormaznitsa/jbbp/plugin/common/utils/CommonUtils.java
|
CommonUtils.scriptFileToJavaFile
|
@Nonnull
public static File scriptFileToJavaFile(@Nullable final File targetDir, @Nullable final String classPackage, @Nonnull final File scriptFile) {
"""
Convert script file into path to Java class file.
@param targetDir the target dir for generated sources, it can be null
@param classPackage class package to override extracted one from script name, it can be null
@param scriptFile the script file, must not be null
@return java source file for the script file
"""
final String rawFileName = FilenameUtils.getBaseName(scriptFile.getName());
final String className = CommonUtils.extractClassName(rawFileName);
final String packageName = classPackage == null ? CommonUtils.extractPackageName(rawFileName) : classPackage;
String fullClassName = packageName.isEmpty() ? className : packageName + '.' + className;
fullClassName = fullClassName.replace('.', File.separatorChar) + ".java";
return new File(targetDir, fullClassName);
}
|
java
|
@Nonnull
public static File scriptFileToJavaFile(@Nullable final File targetDir, @Nullable final String classPackage, @Nonnull final File scriptFile) {
final String rawFileName = FilenameUtils.getBaseName(scriptFile.getName());
final String className = CommonUtils.extractClassName(rawFileName);
final String packageName = classPackage == null ? CommonUtils.extractPackageName(rawFileName) : classPackage;
String fullClassName = packageName.isEmpty() ? className : packageName + '.' + className;
fullClassName = fullClassName.replace('.', File.separatorChar) + ".java";
return new File(targetDir, fullClassName);
}
|
[
"@",
"Nonnull",
"public",
"static",
"File",
"scriptFileToJavaFile",
"(",
"@",
"Nullable",
"final",
"File",
"targetDir",
",",
"@",
"Nullable",
"final",
"String",
"classPackage",
",",
"@",
"Nonnull",
"final",
"File",
"scriptFile",
")",
"{",
"final",
"String",
"rawFileName",
"=",
"FilenameUtils",
".",
"getBaseName",
"(",
"scriptFile",
".",
"getName",
"(",
")",
")",
";",
"final",
"String",
"className",
"=",
"CommonUtils",
".",
"extractClassName",
"(",
"rawFileName",
")",
";",
"final",
"String",
"packageName",
"=",
"classPackage",
"==",
"null",
"?",
"CommonUtils",
".",
"extractPackageName",
"(",
"rawFileName",
")",
":",
"classPackage",
";",
"String",
"fullClassName",
"=",
"packageName",
".",
"isEmpty",
"(",
")",
"?",
"className",
":",
"packageName",
"+",
"'",
"'",
"+",
"className",
";",
"fullClassName",
"=",
"fullClassName",
".",
"replace",
"(",
"'",
"'",
",",
"File",
".",
"separatorChar",
")",
"+",
"\".java\"",
";",
"return",
"new",
"File",
"(",
"targetDir",
",",
"fullClassName",
")",
";",
"}"
] |
Convert script file into path to Java class file.
@param targetDir the target dir for generated sources, it can be null
@param classPackage class package to override extracted one from script name, it can be null
@param scriptFile the script file, must not be null
@return java source file for the script file
|
[
"Convert",
"script",
"file",
"into",
"path",
"to",
"Java",
"class",
"file",
"."
] |
train
|
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp-plugins/jbbp-plugin-common/src/main/java/com/igormaznitsa/jbbp/plugin/common/utils/CommonUtils.java#L91-L101
|
leancloud/java-sdk-all
|
realtime/src/main/java/cn/leancloud/im/v2/AVIMClient.java
|
AVIMClient.getConversation
|
public AVIMConversation getConversation(String conversationId, boolean isTransient, boolean isTemporary) {
"""
get an existed conversation
@param conversationId
@param isTransient
@param isTemporary
@return
"""
return this.getConversation(conversationId, isTransient, isTemporary,false);
}
|
java
|
public AVIMConversation getConversation(String conversationId, boolean isTransient, boolean isTemporary) {
return this.getConversation(conversationId, isTransient, isTemporary,false);
}
|
[
"public",
"AVIMConversation",
"getConversation",
"(",
"String",
"conversationId",
",",
"boolean",
"isTransient",
",",
"boolean",
"isTemporary",
")",
"{",
"return",
"this",
".",
"getConversation",
"(",
"conversationId",
",",
"isTransient",
",",
"isTemporary",
",",
"false",
")",
";",
"}"
] |
get an existed conversation
@param conversationId
@param isTransient
@param isTemporary
@return
|
[
"get",
"an",
"existed",
"conversation"
] |
train
|
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/im/v2/AVIMClient.java#L429-L431
|
ironjacamar/ironjacamar
|
codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java
|
BaseProfile.generateRaXml
|
void generateRaXml(Definition def, String outputDir) {
"""
generate ra.xml
@param def Definition
@param outputDir output directory
"""
if (!def.isUseAnnotation())
{
try
{
outputDir = outputDir + File.separatorChar + "src" + File.separatorChar +
"main" + File.separatorChar + "resources";
FileWriter rafw = Utils.createFile("ra.xml", outputDir + File.separatorChar + "META-INF");
RaXmlGen raGen = getRaXmlGen(def);
raGen.generate(def, rafw);
rafw.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}
}
|
java
|
void generateRaXml(Definition def, String outputDir)
{
if (!def.isUseAnnotation())
{
try
{
outputDir = outputDir + File.separatorChar + "src" + File.separatorChar +
"main" + File.separatorChar + "resources";
FileWriter rafw = Utils.createFile("ra.xml", outputDir + File.separatorChar + "META-INF");
RaXmlGen raGen = getRaXmlGen(def);
raGen.generate(def, rafw);
rafw.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}
}
|
[
"void",
"generateRaXml",
"(",
"Definition",
"def",
",",
"String",
"outputDir",
")",
"{",
"if",
"(",
"!",
"def",
".",
"isUseAnnotation",
"(",
")",
")",
"{",
"try",
"{",
"outputDir",
"=",
"outputDir",
"+",
"File",
".",
"separatorChar",
"+",
"\"src\"",
"+",
"File",
".",
"separatorChar",
"+",
"\"main\"",
"+",
"File",
".",
"separatorChar",
"+",
"\"resources\"",
";",
"FileWriter",
"rafw",
"=",
"Utils",
".",
"createFile",
"(",
"\"ra.xml\"",
",",
"outputDir",
"+",
"File",
".",
"separatorChar",
"+",
"\"META-INF\"",
")",
";",
"RaXmlGen",
"raGen",
"=",
"getRaXmlGen",
"(",
"def",
")",
";",
"raGen",
".",
"generate",
"(",
"def",
",",
"rafw",
")",
";",
"rafw",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"ioe",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}"
] |
generate ra.xml
@param def Definition
@param outputDir output directory
|
[
"generate",
"ra",
".",
"xml"
] |
train
|
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java#L431-L449
|
jferard/fastods
|
fastods/src/main/java/com/github/jferard/fastods/odselement/StylesContainer.java
|
StylesContainer.writePageLayoutStyles
|
public void writePageLayoutStyles(final XMLUtil util, final Appendable appendable)
throws IOException {
"""
Write the page layout styles. The page layout will always belong to to styles
.xml/automatic-styles, since
it's an automatic style (see 16.5) and it is not "used in a document" (3.1.3.2)
@param util an util
@param appendable the destination
@throws IOException if an I/O error occurs
"""
for (final PageLayoutStyle ps : this.pageLayoutStylesContainer.getValues()) {
assert ps.isHidden();
ps.appendXMLToAutomaticStyle(util, appendable);
}
}
|
java
|
public void writePageLayoutStyles(final XMLUtil util, final Appendable appendable)
throws IOException {
for (final PageLayoutStyle ps : this.pageLayoutStylesContainer.getValues()) {
assert ps.isHidden();
ps.appendXMLToAutomaticStyle(util, appendable);
}
}
|
[
"public",
"void",
"writePageLayoutStyles",
"(",
"final",
"XMLUtil",
"util",
",",
"final",
"Appendable",
"appendable",
")",
"throws",
"IOException",
"{",
"for",
"(",
"final",
"PageLayoutStyle",
"ps",
":",
"this",
".",
"pageLayoutStylesContainer",
".",
"getValues",
"(",
")",
")",
"{",
"assert",
"ps",
".",
"isHidden",
"(",
")",
";",
"ps",
".",
"appendXMLToAutomaticStyle",
"(",
"util",
",",
"appendable",
")",
";",
"}",
"}"
] |
Write the page layout styles. The page layout will always belong to to styles
.xml/automatic-styles, since
it's an automatic style (see 16.5) and it is not "used in a document" (3.1.3.2)
@param util an util
@param appendable the destination
@throws IOException if an I/O error occurs
|
[
"Write",
"the",
"page",
"layout",
"styles",
".",
"The",
"page",
"layout",
"will",
"always",
"belong",
"to",
"to",
"styles",
".",
"xml",
"/",
"automatic",
"-",
"styles",
"since",
"it",
"s",
"an",
"automatic",
"style",
"(",
"see",
"16",
".",
"5",
")",
"and",
"it",
"is",
"not",
"used",
"in",
"a",
"document",
"(",
"3",
".",
"1",
".",
"3",
".",
"2",
")"
] |
train
|
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/StylesContainer.java#L397-L403
|
powermock/powermock
|
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
|
PowerMock.createPartialMockForAllMethodsExcept
|
public static synchronized <T> T createPartialMockForAllMethodsExcept(Class<T> type, String... methodNames) {
"""
A utility method that may be used to specify several methods that should
<i>not</i> be mocked in an easy manner (by just passing in the method
names of the method you wish <i>not</i> to mock). Note that you cannot
uniquely specify a method to exclude using this method if there are
several methods with the same name in {@code type}. This method will
mock ALL methods that doesn't match the supplied name(s) regardless of
parameter types and signature. If this is not the case you should
fall-back on using the {@link #createMock(Class, Method...)} method
instead.
@param <T> The type of the mock.
@param type The type that'll be used to create a mock instance.
@param methodNames The names of the methods that should be mocked. If
{@code null}, then this method will have the same effect
as just calling {@link #createMock(Class, Method...)} with the
second parameter as {@code new Method[0]} (i.e. all
methods in that class will be mocked).
@return A mock object of type <T>.
"""
if (methodNames != null && methodNames.length == 0) {
return createMock(type);
}
return createMock(type, WhiteboxImpl.getAllMethodExcept(type, methodNames));
}
|
java
|
public static synchronized <T> T createPartialMockForAllMethodsExcept(Class<T> type, String... methodNames) {
if (methodNames != null && methodNames.length == 0) {
return createMock(type);
}
return createMock(type, WhiteboxImpl.getAllMethodExcept(type, methodNames));
}
|
[
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"createPartialMockForAllMethodsExcept",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"...",
"methodNames",
")",
"{",
"if",
"(",
"methodNames",
"!=",
"null",
"&&",
"methodNames",
".",
"length",
"==",
"0",
")",
"{",
"return",
"createMock",
"(",
"type",
")",
";",
"}",
"return",
"createMock",
"(",
"type",
",",
"WhiteboxImpl",
".",
"getAllMethodExcept",
"(",
"type",
",",
"methodNames",
")",
")",
";",
"}"
] |
A utility method that may be used to specify several methods that should
<i>not</i> be mocked in an easy manner (by just passing in the method
names of the method you wish <i>not</i> to mock). Note that you cannot
uniquely specify a method to exclude using this method if there are
several methods with the same name in {@code type}. This method will
mock ALL methods that doesn't match the supplied name(s) regardless of
parameter types and signature. If this is not the case you should
fall-back on using the {@link #createMock(Class, Method...)} method
instead.
@param <T> The type of the mock.
@param type The type that'll be used to create a mock instance.
@param methodNames The names of the methods that should be mocked. If
{@code null}, then this method will have the same effect
as just calling {@link #createMock(Class, Method...)} with the
second parameter as {@code new Method[0]} (i.e. all
methods in that class will be mocked).
@return A mock object of type <T>.
|
[
"A",
"utility",
"method",
"that",
"may",
"be",
"used",
"to",
"specify",
"several",
"methods",
"that",
"should",
"<i",
">",
"not<",
"/",
"i",
">",
"be",
"mocked",
"in",
"an",
"easy",
"manner",
"(",
"by",
"just",
"passing",
"in",
"the",
"method",
"names",
"of",
"the",
"method",
"you",
"wish",
"<i",
">",
"not<",
"/",
"i",
">",
"to",
"mock",
")",
".",
"Note",
"that",
"you",
"cannot",
"uniquely",
"specify",
"a",
"method",
"to",
"exclude",
"using",
"this",
"method",
"if",
"there",
"are",
"several",
"methods",
"with",
"the",
"same",
"name",
"in",
"{",
"@code",
"type",
"}",
".",
"This",
"method",
"will",
"mock",
"ALL",
"methods",
"that",
"doesn",
"t",
"match",
"the",
"supplied",
"name",
"(",
"s",
")",
"regardless",
"of",
"parameter",
"types",
"and",
"signature",
".",
"If",
"this",
"is",
"not",
"the",
"case",
"you",
"should",
"fall",
"-",
"back",
"on",
"using",
"the",
"{",
"@link",
"#createMock",
"(",
"Class",
"Method",
"...",
")",
"}",
"method",
"instead",
"."
] |
train
|
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L320-L326
|
ThreeTen/threetenbp
|
src/main/java/org/threeten/bp/format/DateTimeFormatter.java
|
DateTimeFormatter.parseToBuilder
|
private DateTimeBuilder parseToBuilder(final CharSequence text, final ParsePosition position) {
"""
Parses the text to a builder.
<p>
This parses to a {@code DateTimeBuilder} ensuring that the text is fully parsed.
This method throws {@link DateTimeParseException} if unable to parse, or
some other {@code DateTimeException} if another date/time problem occurs.
@param text the text to parse, not null
@param position the position to parse from, updated with length parsed
and the index of any error, null if parsing whole string
@return the engine representing the result of the parse, not null
@throws DateTimeParseException if the parse fails
"""
ParsePosition pos = (position != null ? position : new ParsePosition(0));
Parsed result = parseUnresolved0(text, pos);
if (result == null || pos.getErrorIndex() >= 0 || (position == null && pos.getIndex() < text.length())) {
String abbr = "";
if (text.length() > 64) {
abbr = text.subSequence(0, 64).toString() + "...";
} else {
abbr = text.toString();
}
if (pos.getErrorIndex() >= 0) {
throw new DateTimeParseException("Text '" + abbr + "' could not be parsed at index " +
pos.getErrorIndex(), text, pos.getErrorIndex());
} else {
throw new DateTimeParseException("Text '" + abbr + "' could not be parsed, unparsed text found at index " +
pos.getIndex(), text, pos.getIndex());
}
}
return result.toBuilder();
}
|
java
|
private DateTimeBuilder parseToBuilder(final CharSequence text, final ParsePosition position) {
ParsePosition pos = (position != null ? position : new ParsePosition(0));
Parsed result = parseUnresolved0(text, pos);
if (result == null || pos.getErrorIndex() >= 0 || (position == null && pos.getIndex() < text.length())) {
String abbr = "";
if (text.length() > 64) {
abbr = text.subSequence(0, 64).toString() + "...";
} else {
abbr = text.toString();
}
if (pos.getErrorIndex() >= 0) {
throw new DateTimeParseException("Text '" + abbr + "' could not be parsed at index " +
pos.getErrorIndex(), text, pos.getErrorIndex());
} else {
throw new DateTimeParseException("Text '" + abbr + "' could not be parsed, unparsed text found at index " +
pos.getIndex(), text, pos.getIndex());
}
}
return result.toBuilder();
}
|
[
"private",
"DateTimeBuilder",
"parseToBuilder",
"(",
"final",
"CharSequence",
"text",
",",
"final",
"ParsePosition",
"position",
")",
"{",
"ParsePosition",
"pos",
"=",
"(",
"position",
"!=",
"null",
"?",
"position",
":",
"new",
"ParsePosition",
"(",
"0",
")",
")",
";",
"Parsed",
"result",
"=",
"parseUnresolved0",
"(",
"text",
",",
"pos",
")",
";",
"if",
"(",
"result",
"==",
"null",
"||",
"pos",
".",
"getErrorIndex",
"(",
")",
">=",
"0",
"||",
"(",
"position",
"==",
"null",
"&&",
"pos",
".",
"getIndex",
"(",
")",
"<",
"text",
".",
"length",
"(",
")",
")",
")",
"{",
"String",
"abbr",
"=",
"\"\"",
";",
"if",
"(",
"text",
".",
"length",
"(",
")",
">",
"64",
")",
"{",
"abbr",
"=",
"text",
".",
"subSequence",
"(",
"0",
",",
"64",
")",
".",
"toString",
"(",
")",
"+",
"\"...\"",
";",
"}",
"else",
"{",
"abbr",
"=",
"text",
".",
"toString",
"(",
")",
";",
"}",
"if",
"(",
"pos",
".",
"getErrorIndex",
"(",
")",
">=",
"0",
")",
"{",
"throw",
"new",
"DateTimeParseException",
"(",
"\"Text '\"",
"+",
"abbr",
"+",
"\"' could not be parsed at index \"",
"+",
"pos",
".",
"getErrorIndex",
"(",
")",
",",
"text",
",",
"pos",
".",
"getErrorIndex",
"(",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"DateTimeParseException",
"(",
"\"Text '\"",
"+",
"abbr",
"+",
"\"' could not be parsed, unparsed text found at index \"",
"+",
"pos",
".",
"getIndex",
"(",
")",
",",
"text",
",",
"pos",
".",
"getIndex",
"(",
")",
")",
";",
"}",
"}",
"return",
"result",
".",
"toBuilder",
"(",
")",
";",
"}"
] |
Parses the text to a builder.
<p>
This parses to a {@code DateTimeBuilder} ensuring that the text is fully parsed.
This method throws {@link DateTimeParseException} if unable to parse, or
some other {@code DateTimeException} if another date/time problem occurs.
@param text the text to parse, not null
@param position the position to parse from, updated with length parsed
and the index of any error, null if parsing whole string
@return the engine representing the result of the parse, not null
@throws DateTimeParseException if the parse fails
|
[
"Parses",
"the",
"text",
"to",
"a",
"builder",
".",
"<p",
">",
"This",
"parses",
"to",
"a",
"{",
"@code",
"DateTimeBuilder",
"}",
"ensuring",
"that",
"the",
"text",
"is",
"fully",
"parsed",
".",
"This",
"method",
"throws",
"{",
"@link",
"DateTimeParseException",
"}",
"if",
"unable",
"to",
"parse",
"or",
"some",
"other",
"{",
"@code",
"DateTimeException",
"}",
"if",
"another",
"date",
"/",
"time",
"problem",
"occurs",
"."
] |
train
|
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/format/DateTimeFormatter.java#L1576-L1595
|
maxirosson/jdroid-android
|
jdroid-android-core/src/main/java/com/jdroid/android/utils/LocalizationUtils.java
|
LocalizationUtils.getString
|
public static String getString(int resId, Object... args) {
"""
Returns a formatted string, using the localized resource as format and the supplied arguments
@param resId The resource id to obtain the format
@param args arguments to replace format specifiers
@return The localized and formatted string
"""
return AbstractApplication.get().getString(resId, args);
}
|
java
|
public static String getString(int resId, Object... args) {
return AbstractApplication.get().getString(resId, args);
}
|
[
"public",
"static",
"String",
"getString",
"(",
"int",
"resId",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"AbstractApplication",
".",
"get",
"(",
")",
".",
"getString",
"(",
"resId",
",",
"args",
")",
";",
"}"
] |
Returns a formatted string, using the localized resource as format and the supplied arguments
@param resId The resource id to obtain the format
@param args arguments to replace format specifiers
@return The localized and formatted string
|
[
"Returns",
"a",
"formatted",
"string",
"using",
"the",
"localized",
"resource",
"as",
"format",
"and",
"the",
"supplied",
"arguments"
] |
train
|
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-core/src/main/java/com/jdroid/android/utils/LocalizationUtils.java#L15-L17
|
GoogleCloudPlatform/bigdata-interop
|
gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java
|
GoogleHadoopFileSystemBase.copyIfNotPresent
|
private static void copyIfNotPresent(Configuration config, String deprecatedKey, String newKey) {
"""
Copy the value of the deprecated key to the new key if a value is present for the deprecated
key, but not the new key.
"""
String deprecatedValue = config.get(deprecatedKey);
if (config.get(newKey) == null && deprecatedValue != null) {
logger.atWarning().log(
"Key %s is deprecated. Copying the value of key %s to new key %s",
deprecatedKey, deprecatedKey, newKey);
config.set(newKey, deprecatedValue);
}
}
|
java
|
private static void copyIfNotPresent(Configuration config, String deprecatedKey, String newKey) {
String deprecatedValue = config.get(deprecatedKey);
if (config.get(newKey) == null && deprecatedValue != null) {
logger.atWarning().log(
"Key %s is deprecated. Copying the value of key %s to new key %s",
deprecatedKey, deprecatedKey, newKey);
config.set(newKey, deprecatedValue);
}
}
|
[
"private",
"static",
"void",
"copyIfNotPresent",
"(",
"Configuration",
"config",
",",
"String",
"deprecatedKey",
",",
"String",
"newKey",
")",
"{",
"String",
"deprecatedValue",
"=",
"config",
".",
"get",
"(",
"deprecatedKey",
")",
";",
"if",
"(",
"config",
".",
"get",
"(",
"newKey",
")",
"==",
"null",
"&&",
"deprecatedValue",
"!=",
"null",
")",
"{",
"logger",
".",
"atWarning",
"(",
")",
".",
"log",
"(",
"\"Key %s is deprecated. Copying the value of key %s to new key %s\"",
",",
"deprecatedKey",
",",
"deprecatedKey",
",",
"newKey",
")",
";",
"config",
".",
"set",
"(",
"newKey",
",",
"deprecatedValue",
")",
";",
"}",
"}"
] |
Copy the value of the deprecated key to the new key if a value is present for the deprecated
key, but not the new key.
|
[
"Copy",
"the",
"value",
"of",
"the",
"deprecated",
"key",
"to",
"the",
"new",
"key",
"if",
"a",
"value",
"is",
"present",
"for",
"the",
"deprecated",
"key",
"but",
"not",
"the",
"new",
"key",
"."
] |
train
|
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L1483-L1491
|
Stratio/deep-spark
|
deep-commons/src/main/java/com/stratio/deep/commons/utils/Utils.java
|
Utils.findSetter
|
@SuppressWarnings("unchecked")
public static Method findSetter(String propertyName, Class entityClass, Class valueType) {
"""
Resolves the setter name for the property whose name is 'propertyName' whose type is 'valueType'
in the entity bean whose class is 'entityClass'.
If we don't find a setter following Java's naming conventions, before throwing an exception we try to
resolve the setter following Scala's naming conventions.
@param propertyName the field name of the property whose setter we want to resolve.
@param entityClass the bean class object in which we want to search for the setter.
@param valueType the class type of the object that we want to pass to the setter.
@return the resolved setter.
"""
Method setter;
String setterName = "set" + propertyName.substring(0, 1).toUpperCase() +
propertyName.substring(1);
try {
setter = entityClass.getMethod(setterName, valueType);
} catch (NoSuchMethodException e) {
// let's try with scala setter name
try {
setter = entityClass.getMethod(propertyName + "_$eq", valueType);
} catch (NoSuchMethodException e1) {
throw new DeepIOException(e1);
}
}
return setter;
}
|
java
|
@SuppressWarnings("unchecked")
public static Method findSetter(String propertyName, Class entityClass, Class valueType) {
Method setter;
String setterName = "set" + propertyName.substring(0, 1).toUpperCase() +
propertyName.substring(1);
try {
setter = entityClass.getMethod(setterName, valueType);
} catch (NoSuchMethodException e) {
// let's try with scala setter name
try {
setter = entityClass.getMethod(propertyName + "_$eq", valueType);
} catch (NoSuchMethodException e1) {
throw new DeepIOException(e1);
}
}
return setter;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Method",
"findSetter",
"(",
"String",
"propertyName",
",",
"Class",
"entityClass",
",",
"Class",
"valueType",
")",
"{",
"Method",
"setter",
";",
"String",
"setterName",
"=",
"\"set\"",
"+",
"propertyName",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
")",
"+",
"propertyName",
".",
"substring",
"(",
"1",
")",
";",
"try",
"{",
"setter",
"=",
"entityClass",
".",
"getMethod",
"(",
"setterName",
",",
"valueType",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"// let's try with scala setter name",
"try",
"{",
"setter",
"=",
"entityClass",
".",
"getMethod",
"(",
"propertyName",
"+",
"\"_$eq\"",
",",
"valueType",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e1",
")",
"{",
"throw",
"new",
"DeepIOException",
"(",
"e1",
")",
";",
"}",
"}",
"return",
"setter",
";",
"}"
] |
Resolves the setter name for the property whose name is 'propertyName' whose type is 'valueType'
in the entity bean whose class is 'entityClass'.
If we don't find a setter following Java's naming conventions, before throwing an exception we try to
resolve the setter following Scala's naming conventions.
@param propertyName the field name of the property whose setter we want to resolve.
@param entityClass the bean class object in which we want to search for the setter.
@param valueType the class type of the object that we want to pass to the setter.
@return the resolved setter.
|
[
"Resolves",
"the",
"setter",
"name",
"for",
"the",
"property",
"whose",
"name",
"is",
"propertyName",
"whose",
"type",
"is",
"valueType",
"in",
"the",
"entity",
"bean",
"whose",
"class",
"is",
"entityClass",
".",
"If",
"we",
"don",
"t",
"find",
"a",
"setter",
"following",
"Java",
"s",
"naming",
"conventions",
"before",
"throwing",
"an",
"exception",
"we",
"try",
"to",
"resolve",
"the",
"setter",
"following",
"Scala",
"s",
"naming",
"conventions",
"."
] |
train
|
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/utils/Utils.java#L214-L232
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
|
ConceptDrawProjectReader.readTasks
|
private void readTasks(Document cdp) {
"""
Read the projects from a ConceptDraw PROJECT file as top level tasks.
@param cdp ConceptDraw PROJECT file
"""
//
// Sort the projects into the correct order
//
List<Project> projects = new ArrayList<Project>(cdp.getProjects().getProject());
final AlphanumComparator comparator = new AlphanumComparator();
Collections.sort(projects, new Comparator<Project>()
{
@Override public int compare(Project o1, Project o2)
{
return comparator.compare(o1.getOutlineNumber(), o2.getOutlineNumber());
}
});
for (Project project : cdp.getProjects().getProject())
{
readProject(project);
}
}
|
java
|
private void readTasks(Document cdp)
{
//
// Sort the projects into the correct order
//
List<Project> projects = new ArrayList<Project>(cdp.getProjects().getProject());
final AlphanumComparator comparator = new AlphanumComparator();
Collections.sort(projects, new Comparator<Project>()
{
@Override public int compare(Project o1, Project o2)
{
return comparator.compare(o1.getOutlineNumber(), o2.getOutlineNumber());
}
});
for (Project project : cdp.getProjects().getProject())
{
readProject(project);
}
}
|
[
"private",
"void",
"readTasks",
"(",
"Document",
"cdp",
")",
"{",
"//",
"// Sort the projects into the correct order",
"//",
"List",
"<",
"Project",
">",
"projects",
"=",
"new",
"ArrayList",
"<",
"Project",
">",
"(",
"cdp",
".",
"getProjects",
"(",
")",
".",
"getProject",
"(",
")",
")",
";",
"final",
"AlphanumComparator",
"comparator",
"=",
"new",
"AlphanumComparator",
"(",
")",
";",
"Collections",
".",
"sort",
"(",
"projects",
",",
"new",
"Comparator",
"<",
"Project",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"Project",
"o1",
",",
"Project",
"o2",
")",
"{",
"return",
"comparator",
".",
"compare",
"(",
"o1",
".",
"getOutlineNumber",
"(",
")",
",",
"o2",
".",
"getOutlineNumber",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"for",
"(",
"Project",
"project",
":",
"cdp",
".",
"getProjects",
"(",
")",
".",
"getProject",
"(",
")",
")",
"{",
"readProject",
"(",
"project",
")",
";",
"}",
"}"
] |
Read the projects from a ConceptDraw PROJECT file as top level tasks.
@param cdp ConceptDraw PROJECT file
|
[
"Read",
"the",
"projects",
"from",
"a",
"ConceptDraw",
"PROJECT",
"file",
"as",
"top",
"level",
"tasks",
"."
] |
train
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L323-L343
|
qiujiayu/AutoLoadCache
|
src/main/java/com/jarvis/cache/script/AbstractScriptParser.java
|
AbstractScriptParser.isCanDelete
|
public boolean isCanDelete(CacheDeleteKey cacheDeleteKey, Object[] arguments, Object retVal) throws Exception {
"""
是否可以删除缓存
@param cacheDeleteKey CacheDeleteKey注解
@param arguments 参数
@param retVal 结果值
@return Can Delete
@throws Exception 异常
"""
boolean rv = true;
if (null != arguments && arguments.length > 0 && null != cacheDeleteKey.condition()
&& cacheDeleteKey.condition().length() > 0) {
rv = this.getElValue(cacheDeleteKey.condition(), null, arguments, retVal, true, Boolean.class);
}
return rv;
}
|
java
|
public boolean isCanDelete(CacheDeleteKey cacheDeleteKey, Object[] arguments, Object retVal) throws Exception {
boolean rv = true;
if (null != arguments && arguments.length > 0 && null != cacheDeleteKey.condition()
&& cacheDeleteKey.condition().length() > 0) {
rv = this.getElValue(cacheDeleteKey.condition(), null, arguments, retVal, true, Boolean.class);
}
return rv;
}
|
[
"public",
"boolean",
"isCanDelete",
"(",
"CacheDeleteKey",
"cacheDeleteKey",
",",
"Object",
"[",
"]",
"arguments",
",",
"Object",
"retVal",
")",
"throws",
"Exception",
"{",
"boolean",
"rv",
"=",
"true",
";",
"if",
"(",
"null",
"!=",
"arguments",
"&&",
"arguments",
".",
"length",
">",
"0",
"&&",
"null",
"!=",
"cacheDeleteKey",
".",
"condition",
"(",
")",
"&&",
"cacheDeleteKey",
".",
"condition",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"rv",
"=",
"this",
".",
"getElValue",
"(",
"cacheDeleteKey",
".",
"condition",
"(",
")",
",",
"null",
",",
"arguments",
",",
"retVal",
",",
"true",
",",
"Boolean",
".",
"class",
")",
";",
"}",
"return",
"rv",
";",
"}"
] |
是否可以删除缓存
@param cacheDeleteKey CacheDeleteKey注解
@param arguments 参数
@param retVal 结果值
@return Can Delete
@throws Exception 异常
|
[
"是否可以删除缓存"
] |
train
|
https://github.com/qiujiayu/AutoLoadCache/blob/8121c146f1a420fa6d6832e849acadb547c13622/src/main/java/com/jarvis/cache/script/AbstractScriptParser.java#L169-L176
|
micwin/ticino
|
events/src/main/java/net/micwin/ticino/events/EventScope.java
|
EventScope.collectReceiver
|
private void collectReceiver(final Class<?> eventClass, final Collection<ReceiverDescriptor> receiverCollection) {
"""
collects receiver descriptors of super classes and interfaces.
@param eventClass
@param receiverCollection
the collection receivers are put in.
"""
if (this.receiverMap.get(eventClass) != null) {
receiverCollection.addAll(this.receiverMap.get(eventClass));
}
if (!eventClass.isInterface() && eventClass.getSuperclass() != Object.class) {
this.collectReceiver(eventClass.getSuperclass(), receiverCollection);
}
for (final Class interfaceClass : eventClass.getInterfaces()) {
this.collectReceiver(interfaceClass, receiverCollection);
}
}
|
java
|
private void collectReceiver(final Class<?> eventClass, final Collection<ReceiverDescriptor> receiverCollection) {
if (this.receiverMap.get(eventClass) != null) {
receiverCollection.addAll(this.receiverMap.get(eventClass));
}
if (!eventClass.isInterface() && eventClass.getSuperclass() != Object.class) {
this.collectReceiver(eventClass.getSuperclass(), receiverCollection);
}
for (final Class interfaceClass : eventClass.getInterfaces()) {
this.collectReceiver(interfaceClass, receiverCollection);
}
}
|
[
"private",
"void",
"collectReceiver",
"(",
"final",
"Class",
"<",
"?",
">",
"eventClass",
",",
"final",
"Collection",
"<",
"ReceiverDescriptor",
">",
"receiverCollection",
")",
"{",
"if",
"(",
"this",
".",
"receiverMap",
".",
"get",
"(",
"eventClass",
")",
"!=",
"null",
")",
"{",
"receiverCollection",
".",
"addAll",
"(",
"this",
".",
"receiverMap",
".",
"get",
"(",
"eventClass",
")",
")",
";",
"}",
"if",
"(",
"!",
"eventClass",
".",
"isInterface",
"(",
")",
"&&",
"eventClass",
".",
"getSuperclass",
"(",
")",
"!=",
"Object",
".",
"class",
")",
"{",
"this",
".",
"collectReceiver",
"(",
"eventClass",
".",
"getSuperclass",
"(",
")",
",",
"receiverCollection",
")",
";",
"}",
"for",
"(",
"final",
"Class",
"interfaceClass",
":",
"eventClass",
".",
"getInterfaces",
"(",
")",
")",
"{",
"this",
".",
"collectReceiver",
"(",
"interfaceClass",
",",
"receiverCollection",
")",
";",
"}",
"}"
] |
collects receiver descriptors of super classes and interfaces.
@param eventClass
@param receiverCollection
the collection receivers are put in.
|
[
"collects",
"receiver",
"descriptors",
"of",
"super",
"classes",
"and",
"interfaces",
"."
] |
train
|
https://github.com/micwin/ticino/blob/4d143093500cd2fb9767ebe8cd05ddda23e35613/events/src/main/java/net/micwin/ticino/events/EventScope.java#L421-L432
|
ReactiveX/RxJavaAsyncUtil
|
src/main/java/rx/util/async/Async.java
|
Async.fromCallable
|
public static <R> Observable<R> fromCallable(Callable<? extends R> callable) {
"""
Return an Observable that calls the given Callable and emits its result or Exception when an Observer
subscribes.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/fromCallable.png" alt="">
<p>
The Callable is called on the default thread pool for computation.
@param <R> the return type
@param callable the callable to call on each subscription
@return an Observable that calls the given Callable and emits its result or Exception when an Observer
subscribes
@see #start(rx.functions.Func0)
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-fromcallable">RxJava Wiki: fromCallable()</a>
"""
return fromCallable(callable, Schedulers.computation());
}
|
java
|
public static <R> Observable<R> fromCallable(Callable<? extends R> callable) {
return fromCallable(callable, Schedulers.computation());
}
|
[
"public",
"static",
"<",
"R",
">",
"Observable",
"<",
"R",
">",
"fromCallable",
"(",
"Callable",
"<",
"?",
"extends",
"R",
">",
"callable",
")",
"{",
"return",
"fromCallable",
"(",
"callable",
",",
"Schedulers",
".",
"computation",
"(",
")",
")",
";",
"}"
] |
Return an Observable that calls the given Callable and emits its result or Exception when an Observer
subscribes.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/fromCallable.png" alt="">
<p>
The Callable is called on the default thread pool for computation.
@param <R> the return type
@param callable the callable to call on each subscription
@return an Observable that calls the given Callable and emits its result or Exception when an Observer
subscribes
@see #start(rx.functions.Func0)
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-fromcallable">RxJava Wiki: fromCallable()</a>
|
[
"Return",
"an",
"Observable",
"that",
"calls",
"the",
"given",
"Callable",
"and",
"emits",
"its",
"result",
"or",
"Exception",
"when",
"an",
"Observer",
"subscribes",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
"/",
"ReactiveX",
"/",
"RxJava",
"/",
"images",
"/",
"rx",
"-",
"operators",
"/",
"fromCallable",
".",
"png",
"alt",
"=",
">",
"<p",
">",
"The",
"Callable",
"is",
"called",
"on",
"the",
"default",
"thread",
"pool",
"for",
"computation",
"."
] |
train
|
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L2006-L2008
|
openbase/jul
|
communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java
|
AbstractRemoteClient.applyDataUpdate
|
private void applyDataUpdate(final M data) {
"""
Method is used to internally update the data object.
@param data
"""
this.data = data;
CompletableFutureLite<M> currentSyncFuture = null;
Future<M> currentSyncTask = null;
// Check if sync is in process.
synchronized (syncMonitor) {
if (syncFuture != null) {
currentSyncFuture = syncFuture;
currentSyncTask = syncTask;
syncFuture = null;
syncTask = null;
}
}
if (currentSyncFuture != null) {
currentSyncFuture.complete(data);
}
if (currentSyncTask != null && !currentSyncTask.isDone()) {
currentSyncTask.cancel(false);
}
setConnectionState(CONNECTED);
// Notify data update
try {
notifyPrioritizedObservers(data);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify data update!", ex), logger);
}
try {
dataObservable.notifyObservers(data);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify data update to all observer!", ex), logger);
}
}
|
java
|
private void applyDataUpdate(final M data) {
this.data = data;
CompletableFutureLite<M> currentSyncFuture = null;
Future<M> currentSyncTask = null;
// Check if sync is in process.
synchronized (syncMonitor) {
if (syncFuture != null) {
currentSyncFuture = syncFuture;
currentSyncTask = syncTask;
syncFuture = null;
syncTask = null;
}
}
if (currentSyncFuture != null) {
currentSyncFuture.complete(data);
}
if (currentSyncTask != null && !currentSyncTask.isDone()) {
currentSyncTask.cancel(false);
}
setConnectionState(CONNECTED);
// Notify data update
try {
notifyPrioritizedObservers(data);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify data update!", ex), logger);
}
try {
dataObservable.notifyObservers(data);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify data update to all observer!", ex), logger);
}
}
|
[
"private",
"void",
"applyDataUpdate",
"(",
"final",
"M",
"data",
")",
"{",
"this",
".",
"data",
"=",
"data",
";",
"CompletableFutureLite",
"<",
"M",
">",
"currentSyncFuture",
"=",
"null",
";",
"Future",
"<",
"M",
">",
"currentSyncTask",
"=",
"null",
";",
"// Check if sync is in process.",
"synchronized",
"(",
"syncMonitor",
")",
"{",
"if",
"(",
"syncFuture",
"!=",
"null",
")",
"{",
"currentSyncFuture",
"=",
"syncFuture",
";",
"currentSyncTask",
"=",
"syncTask",
";",
"syncFuture",
"=",
"null",
";",
"syncTask",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"currentSyncFuture",
"!=",
"null",
")",
"{",
"currentSyncFuture",
".",
"complete",
"(",
"data",
")",
";",
"}",
"if",
"(",
"currentSyncTask",
"!=",
"null",
"&&",
"!",
"currentSyncTask",
".",
"isDone",
"(",
")",
")",
"{",
"currentSyncTask",
".",
"cancel",
"(",
"false",
")",
";",
"}",
"setConnectionState",
"(",
"CONNECTED",
")",
";",
"// Notify data update",
"try",
"{",
"notifyPrioritizedObservers",
"(",
"data",
")",
";",
"}",
"catch",
"(",
"CouldNotPerformException",
"ex",
")",
"{",
"ExceptionPrinter",
".",
"printHistory",
"(",
"new",
"CouldNotPerformException",
"(",
"\"Could not notify data update!\"",
",",
"ex",
")",
",",
"logger",
")",
";",
"}",
"try",
"{",
"dataObservable",
".",
"notifyObservers",
"(",
"data",
")",
";",
"}",
"catch",
"(",
"CouldNotPerformException",
"ex",
")",
"{",
"ExceptionPrinter",
".",
"printHistory",
"(",
"new",
"CouldNotPerformException",
"(",
"\"Could not notify data update to all observer!\"",
",",
"ex",
")",
",",
"logger",
")",
";",
"}",
"}"
] |
Method is used to internally update the data object.
@param data
|
[
"Method",
"is",
"used",
"to",
"internally",
"update",
"the",
"data",
"object",
"."
] |
train
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java#L1410-L1447
|
jpush/jmessage-api-java-client
|
src/main/java/cn/jmessage/api/user/UserClient.java
|
UserClient.forbidUser
|
public ResponseWrapper forbidUser(String username, boolean disable)
throws APIConnectionException, APIRequestException {
"""
Forbid or activate user
@param username username
@param disable true means forbid, false means activate
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception
"""
StringUtils.checkUsername(username);
return _httpClient.sendPut(_baseUrl + userPath + "/" + username + "/forbidden?disable=" + disable, null);
}
|
java
|
public ResponseWrapper forbidUser(String username, boolean disable)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
return _httpClient.sendPut(_baseUrl + userPath + "/" + username + "/forbidden?disable=" + disable, null);
}
|
[
"public",
"ResponseWrapper",
"forbidUser",
"(",
"String",
"username",
",",
"boolean",
"disable",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"StringUtils",
".",
"checkUsername",
"(",
"username",
")",
";",
"return",
"_httpClient",
".",
"sendPut",
"(",
"_baseUrl",
"+",
"userPath",
"+",
"\"/\"",
"+",
"username",
"+",
"\"/forbidden?disable=\"",
"+",
"disable",
",",
"null",
")",
";",
"}"
] |
Forbid or activate user
@param username username
@param disable true means forbid, false means activate
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception
|
[
"Forbid",
"or",
"activate",
"user"
] |
train
|
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/user/UserClient.java#L376-L380
|
networknt/light-4j
|
mask/src/main/java/com/networknt/mask/Mask.java
|
Mask.maskRegex
|
public static String maskRegex(String input, String key, String name) {
"""
Replace a string input with a pattern found in regex section with key as index. Usually,
it is used to replace header, query parameter, uri parameter to same length of stars(*)
@param input String The source of the string that needs to be masked
@param key String The key maps to a list of name to pattern pair
@param name String The name of the pattern in the key list
@return String Masked result
"""
Map<String, Object> regexConfig = (Map<String, Object>) config.get(MASK_TYPE_REGEX);
if (regexConfig != null) {
Map<String, Object> keyConfig = (Map<String, Object>) regexConfig.get(key);
if (keyConfig != null) {
String regex = (String) keyConfig.get(name);
if (regex != null && regex.length() > 0) {
return replaceWithMask(input, MASK_REPLACEMENT_CHAR.charAt(0), regex);
}
}
}
return input;
}
|
java
|
public static String maskRegex(String input, String key, String name) {
Map<String, Object> regexConfig = (Map<String, Object>) config.get(MASK_TYPE_REGEX);
if (regexConfig != null) {
Map<String, Object> keyConfig = (Map<String, Object>) regexConfig.get(key);
if (keyConfig != null) {
String regex = (String) keyConfig.get(name);
if (regex != null && regex.length() > 0) {
return replaceWithMask(input, MASK_REPLACEMENT_CHAR.charAt(0), regex);
}
}
}
return input;
}
|
[
"public",
"static",
"String",
"maskRegex",
"(",
"String",
"input",
",",
"String",
"key",
",",
"String",
"name",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"regexConfig",
"=",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"config",
".",
"get",
"(",
"MASK_TYPE_REGEX",
")",
";",
"if",
"(",
"regexConfig",
"!=",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"keyConfig",
"=",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"regexConfig",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"keyConfig",
"!=",
"null",
")",
"{",
"String",
"regex",
"=",
"(",
"String",
")",
"keyConfig",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"regex",
"!=",
"null",
"&&",
"regex",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"return",
"replaceWithMask",
"(",
"input",
",",
"MASK_REPLACEMENT_CHAR",
".",
"charAt",
"(",
"0",
")",
",",
"regex",
")",
";",
"}",
"}",
"}",
"return",
"input",
";",
"}"
] |
Replace a string input with a pattern found in regex section with key as index. Usually,
it is used to replace header, query parameter, uri parameter to same length of stars(*)
@param input String The source of the string that needs to be masked
@param key String The key maps to a list of name to pattern pair
@param name String The name of the pattern in the key list
@return String Masked result
|
[
"Replace",
"a",
"string",
"input",
"with",
"a",
"pattern",
"found",
"in",
"regex",
"section",
"with",
"key",
"as",
"index",
".",
"Usually",
"it",
"is",
"used",
"to",
"replace",
"header",
"query",
"parameter",
"uri",
"parameter",
"to",
"same",
"length",
"of",
"stars",
"(",
"*",
")"
] |
train
|
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/mask/src/main/java/com/networknt/mask/Mask.java#L89-L101
|
looly/hutool
|
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
|
CollUtil.sortEntryToList
|
public static <K, V> List<Entry<K, V>> sortEntryToList(Collection<Entry<K, V>> collection) {
"""
将Set排序(根据Entry的值)
@param <K> 键类型
@param <V> 值类型
@param collection 被排序的{@link Collection}
@return 排序后的Set
"""
List<Entry<K, V>> list = new LinkedList<>(collection);
Collections.sort(list, new Comparator<Entry<K, V>>() {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public int compare(Entry<K, V> o1, Entry<K, V> o2) {
V v1 = o1.getValue();
V v2 = o2.getValue();
if (v1 instanceof Comparable) {
return ((Comparable) v1).compareTo(v2);
} else {
return v1.toString().compareTo(v2.toString());
}
}
});
return list;
}
|
java
|
public static <K, V> List<Entry<K, V>> sortEntryToList(Collection<Entry<K, V>> collection) {
List<Entry<K, V>> list = new LinkedList<>(collection);
Collections.sort(list, new Comparator<Entry<K, V>>() {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public int compare(Entry<K, V> o1, Entry<K, V> o2) {
V v1 = o1.getValue();
V v2 = o2.getValue();
if (v1 instanceof Comparable) {
return ((Comparable) v1).compareTo(v2);
} else {
return v1.toString().compareTo(v2.toString());
}
}
});
return list;
}
|
[
"public",
"static",
"<",
"K",
",",
"V",
">",
"List",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"sortEntryToList",
"(",
"Collection",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"collection",
")",
"{",
"List",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"list",
"=",
"new",
"LinkedList",
"<>",
"(",
"collection",
")",
";",
"Collections",
".",
"sort",
"(",
"list",
",",
"new",
"Comparator",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"(",
")",
"{",
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"@",
"Override",
"public",
"int",
"compare",
"(",
"Entry",
"<",
"K",
",",
"V",
">",
"o1",
",",
"Entry",
"<",
"K",
",",
"V",
">",
"o2",
")",
"{",
"V",
"v1",
"=",
"o1",
".",
"getValue",
"(",
")",
";",
"V",
"v2",
"=",
"o2",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"v1",
"instanceof",
"Comparable",
")",
"{",
"return",
"(",
"(",
"Comparable",
")",
"v1",
")",
".",
"compareTo",
"(",
"v2",
")",
";",
"}",
"else",
"{",
"return",
"v1",
".",
"toString",
"(",
")",
".",
"compareTo",
"(",
"v2",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}",
")",
";",
"return",
"list",
";",
"}"
] |
将Set排序(根据Entry的值)
@param <K> 键类型
@param <V> 值类型
@param collection 被排序的{@link Collection}
@return 排序后的Set
|
[
"将Set排序(根据Entry的值)"
] |
train
|
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2210-L2228
|
FXMisc/WellBehavedFX
|
src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java
|
InputMapTemplate.uninstall
|
public static <S extends Node, E extends Event> void uninstall(InputMapTemplate<S, E> imt, S node) {
"""
Removes the input map template's instance from the given node.
"""
Nodes.removeInputMap(node, imt.instantiate(node));
}
|
java
|
public static <S extends Node, E extends Event> void uninstall(InputMapTemplate<S, E> imt, S node) {
Nodes.removeInputMap(node, imt.instantiate(node));
}
|
[
"public",
"static",
"<",
"S",
"extends",
"Node",
",",
"E",
"extends",
"Event",
">",
"void",
"uninstall",
"(",
"InputMapTemplate",
"<",
"S",
",",
"E",
">",
"imt",
",",
"S",
"node",
")",
"{",
"Nodes",
".",
"removeInputMap",
"(",
"node",
",",
"imt",
".",
"instantiate",
"(",
"node",
")",
")",
";",
"}"
] |
Removes the input map template's instance from the given node.
|
[
"Removes",
"the",
"input",
"map",
"template",
"s",
"instance",
"from",
"the",
"given",
"node",
"."
] |
train
|
https://github.com/FXMisc/WellBehavedFX/blob/ca889734481f5439655ca8deb6f742964b5654b0/src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java#L399-L401
|
zaproxy/zaproxy
|
src/org/parosproxy/paros/model/SiteMap.java
|
SiteMap.handleEvent
|
private void handleEvent(SiteNode parent, SiteNode node, EventType eventType) {
"""
Handles the publishing of the add or remove event. Node events are always published.
Site events are only published when the parent of the node is the root of the tree.
@param parent relevant parent node
@param node the site node the action is being carried out for
@param eventType the type of event occurring (ADD or REMOVE)
@see EventType
@since 2.5.0
"""
switch (eventType) {
case ADD:
publishEvent(SiteMapEventPublisher.SITE_NODE_ADDED_EVENT, node);
if (parent == getRoot()) {
publishEvent(SiteMapEventPublisher.SITE_ADDED_EVENT, node);
}
break;
case REMOVE:
publishEvent(SiteMapEventPublisher.SITE_NODE_REMOVED_EVENT, node);
if(parent == getRoot()) {
publishEvent(SiteMapEventPublisher.SITE_REMOVED_EVENT, node);
}
}
}
|
java
|
private void handleEvent(SiteNode parent, SiteNode node, EventType eventType) {
switch (eventType) {
case ADD:
publishEvent(SiteMapEventPublisher.SITE_NODE_ADDED_EVENT, node);
if (parent == getRoot()) {
publishEvent(SiteMapEventPublisher.SITE_ADDED_EVENT, node);
}
break;
case REMOVE:
publishEvent(SiteMapEventPublisher.SITE_NODE_REMOVED_EVENT, node);
if(parent == getRoot()) {
publishEvent(SiteMapEventPublisher.SITE_REMOVED_EVENT, node);
}
}
}
|
[
"private",
"void",
"handleEvent",
"(",
"SiteNode",
"parent",
",",
"SiteNode",
"node",
",",
"EventType",
"eventType",
")",
"{",
"switch",
"(",
"eventType",
")",
"{",
"case",
"ADD",
":",
"publishEvent",
"(",
"SiteMapEventPublisher",
".",
"SITE_NODE_ADDED_EVENT",
",",
"node",
")",
";",
"if",
"(",
"parent",
"==",
"getRoot",
"(",
")",
")",
"{",
"publishEvent",
"(",
"SiteMapEventPublisher",
".",
"SITE_ADDED_EVENT",
",",
"node",
")",
";",
"}",
"break",
";",
"case",
"REMOVE",
":",
"publishEvent",
"(",
"SiteMapEventPublisher",
".",
"SITE_NODE_REMOVED_EVENT",
",",
"node",
")",
";",
"if",
"(",
"parent",
"==",
"getRoot",
"(",
")",
")",
"{",
"publishEvent",
"(",
"SiteMapEventPublisher",
".",
"SITE_REMOVED_EVENT",
",",
"node",
")",
";",
"}",
"}",
"}"
] |
Handles the publishing of the add or remove event. Node events are always published.
Site events are only published when the parent of the node is the root of the tree.
@param parent relevant parent node
@param node the site node the action is being carried out for
@param eventType the type of event occurring (ADD or REMOVE)
@see EventType
@since 2.5.0
|
[
"Handles",
"the",
"publishing",
"of",
"the",
"add",
"or",
"remove",
"event",
".",
"Node",
"events",
"are",
"always",
"published",
".",
"Site",
"events",
"are",
"only",
"published",
"when",
"the",
"parent",
"of",
"the",
"node",
"is",
"the",
"root",
"of",
"the",
"tree",
"."
] |
train
|
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/model/SiteMap.java#L812-L826
|
datacleaner/DataCleaner
|
desktop/api/src/main/java/org/datacleaner/widgets/properties/FormPanel.java
|
FormPanel.addFormEntry
|
public void addFormEntry(String mainLabelText, final String minorLabelText, final JComponent component) {
"""
Adds a form entry to the panel
@param mainLabelText
@param minorLabelText
@param component
"""
if (!mainLabelText.endsWith(":")) {
mainLabelText += ":";
}
final DCLabel mainLabel = DCLabel.dark(mainLabelText);
mainLabel.setFont(WidgetUtils.FONT_NORMAL);
mainLabel.setBorder(new EmptyBorder(6, 0, 0, 0));
final JXLabel minorLabel;
if (StringUtils.isNullOrEmpty(minorLabelText)) {
minorLabel = null;
} else {
mainLabel.setToolTipText(minorLabelText);
minorLabel = new JXLabel(minorLabelText);
minorLabel.setLineWrap(true);
minorLabel.setFont(WidgetUtils.FONT_SMALL);
minorLabel.setBorder(new EmptyBorder(0, 4, 0, 0));
minorLabel.setVerticalAlignment(JXLabel.TOP);
minorLabel.setPreferredSize(new Dimension(FIELD_LABEL_WIDTH - 4, 0));
}
addFormEntry(mainLabel, minorLabel, component);
}
|
java
|
public void addFormEntry(String mainLabelText, final String minorLabelText, final JComponent component) {
if (!mainLabelText.endsWith(":")) {
mainLabelText += ":";
}
final DCLabel mainLabel = DCLabel.dark(mainLabelText);
mainLabel.setFont(WidgetUtils.FONT_NORMAL);
mainLabel.setBorder(new EmptyBorder(6, 0, 0, 0));
final JXLabel minorLabel;
if (StringUtils.isNullOrEmpty(minorLabelText)) {
minorLabel = null;
} else {
mainLabel.setToolTipText(minorLabelText);
minorLabel = new JXLabel(minorLabelText);
minorLabel.setLineWrap(true);
minorLabel.setFont(WidgetUtils.FONT_SMALL);
minorLabel.setBorder(new EmptyBorder(0, 4, 0, 0));
minorLabel.setVerticalAlignment(JXLabel.TOP);
minorLabel.setPreferredSize(new Dimension(FIELD_LABEL_WIDTH - 4, 0));
}
addFormEntry(mainLabel, minorLabel, component);
}
|
[
"public",
"void",
"addFormEntry",
"(",
"String",
"mainLabelText",
",",
"final",
"String",
"minorLabelText",
",",
"final",
"JComponent",
"component",
")",
"{",
"if",
"(",
"!",
"mainLabelText",
".",
"endsWith",
"(",
"\":\"",
")",
")",
"{",
"mainLabelText",
"+=",
"\":\"",
";",
"}",
"final",
"DCLabel",
"mainLabel",
"=",
"DCLabel",
".",
"dark",
"(",
"mainLabelText",
")",
";",
"mainLabel",
".",
"setFont",
"(",
"WidgetUtils",
".",
"FONT_NORMAL",
")",
";",
"mainLabel",
".",
"setBorder",
"(",
"new",
"EmptyBorder",
"(",
"6",
",",
"0",
",",
"0",
",",
"0",
")",
")",
";",
"final",
"JXLabel",
"minorLabel",
";",
"if",
"(",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"minorLabelText",
")",
")",
"{",
"minorLabel",
"=",
"null",
";",
"}",
"else",
"{",
"mainLabel",
".",
"setToolTipText",
"(",
"minorLabelText",
")",
";",
"minorLabel",
"=",
"new",
"JXLabel",
"(",
"minorLabelText",
")",
";",
"minorLabel",
".",
"setLineWrap",
"(",
"true",
")",
";",
"minorLabel",
".",
"setFont",
"(",
"WidgetUtils",
".",
"FONT_SMALL",
")",
";",
"minorLabel",
".",
"setBorder",
"(",
"new",
"EmptyBorder",
"(",
"0",
",",
"4",
",",
"0",
",",
"0",
")",
")",
";",
"minorLabel",
".",
"setVerticalAlignment",
"(",
"JXLabel",
".",
"TOP",
")",
";",
"minorLabel",
".",
"setPreferredSize",
"(",
"new",
"Dimension",
"(",
"FIELD_LABEL_WIDTH",
"-",
"4",
",",
"0",
")",
")",
";",
"}",
"addFormEntry",
"(",
"mainLabel",
",",
"minorLabel",
",",
"component",
")",
";",
"}"
] |
Adds a form entry to the panel
@param mainLabelText
@param minorLabelText
@param component
|
[
"Adds",
"a",
"form",
"entry",
"to",
"the",
"panel"
] |
train
|
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/widgets/properties/FormPanel.java#L67-L91
|
xiancloud/xian
|
xian-message/src/main/java/info/xiancloud/message/short_msg/yunpian/JavaSmsApi.java
|
JavaSmsApi.tplSendSms
|
public static Single<String> tplSendSms(String apikey, long tpl_id, String tpl_value, String mobile) {
"""
通过模板发送短信(不推荐)
@param apikey apikey
@param tpl_id 模板id
@param tpl_value 模板变量值
@param mobile 接受的手机号
@return json格式字符串
"""
Map<String, String> params = new HashMap<>();
params.put("apikey", apikey);
params.put("tpl_id", String.valueOf(tpl_id));
params.put("tpl_value", tpl_value);
params.put("mobile", mobile);
return post(URI_TPL_SEND_SMS, params);
}
|
java
|
public static Single<String> tplSendSms(String apikey, long tpl_id, String tpl_value, String mobile) {
Map<String, String> params = new HashMap<>();
params.put("apikey", apikey);
params.put("tpl_id", String.valueOf(tpl_id));
params.put("tpl_value", tpl_value);
params.put("mobile", mobile);
return post(URI_TPL_SEND_SMS, params);
}
|
[
"public",
"static",
"Single",
"<",
"String",
">",
"tplSendSms",
"(",
"String",
"apikey",
",",
"long",
"tpl_id",
",",
"String",
"tpl_value",
",",
"String",
"mobile",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"apikey\"",
",",
"apikey",
")",
";",
"params",
".",
"put",
"(",
"\"tpl_id\"",
",",
"String",
".",
"valueOf",
"(",
"tpl_id",
")",
")",
";",
"params",
".",
"put",
"(",
"\"tpl_value\"",
",",
"tpl_value",
")",
";",
"params",
".",
"put",
"(",
"\"mobile\"",
",",
"mobile",
")",
";",
"return",
"post",
"(",
"URI_TPL_SEND_SMS",
",",
"params",
")",
";",
"}"
] |
通过模板发送短信(不推荐)
@param apikey apikey
@param tpl_id 模板id
@param tpl_value 模板变量值
@param mobile 接受的手机号
@return json格式字符串
|
[
"通过模板发送短信",
"(",
"不推荐",
")"
] |
train
|
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-message/src/main/java/info/xiancloud/message/short_msg/yunpian/JavaSmsApi.java#L108-L115
|
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.listWorkerPoolInstanceMetricDefinitionsAsync
|
public Observable<Page<ResourceMetricDefinitionInner>> listWorkerPoolInstanceMetricDefinitionsAsync(final String resourceGroupName, final String name, final String workerPoolName, final String instance) {
"""
Get metric definitions for a specific instance of a worker pool of an App Service Environment.
Get metric definitions for a specific instance of a worker pool of an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param workerPoolName Name of the worker pool.
@param instance Name of the instance in the worker pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ResourceMetricDefinitionInner> object
"""
return listWorkerPoolInstanceMetricDefinitionsWithServiceResponseAsync(resourceGroupName, name, workerPoolName, instance)
.map(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Page<ResourceMetricDefinitionInner>>() {
@Override
public Page<ResourceMetricDefinitionInner> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> response) {
return response.body();
}
});
}
|
java
|
public Observable<Page<ResourceMetricDefinitionInner>> listWorkerPoolInstanceMetricDefinitionsAsync(final String resourceGroupName, final String name, final String workerPoolName, final String instance) {
return listWorkerPoolInstanceMetricDefinitionsWithServiceResponseAsync(resourceGroupName, name, workerPoolName, instance)
.map(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Page<ResourceMetricDefinitionInner>>() {
@Override
public Page<ResourceMetricDefinitionInner> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> response) {
return response.body();
}
});
}
|
[
"public",
"Observable",
"<",
"Page",
"<",
"ResourceMetricDefinitionInner",
">",
">",
"listWorkerPoolInstanceMetricDefinitionsAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
",",
"final",
"String",
"workerPoolName",
",",
"final",
"String",
"instance",
")",
"{",
"return",
"listWorkerPoolInstanceMetricDefinitionsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"workerPoolName",
",",
"instance",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"ResourceMetricDefinitionInner",
">",
">",
",",
"Page",
"<",
"ResourceMetricDefinitionInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"ResourceMetricDefinitionInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"ResourceMetricDefinitionInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Get metric definitions for a specific instance of a worker pool of an App Service Environment.
Get metric definitions for a specific instance of a worker pool of an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param workerPoolName Name of the worker pool.
@param instance Name of the instance in the worker pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ResourceMetricDefinitionInner> object
|
[
"Get",
"metric",
"definitions",
"for",
"a",
"specific",
"instance",
"of",
"a",
"worker",
"pool",
"of",
"an",
"App",
"Service",
"Environment",
".",
"Get",
"metric",
"definitions",
"for",
"a",
"specific",
"instance",
"of",
"a",
"worker",
"pool",
"of",
"an",
"App",
"Service",
"Environment",
"."
] |
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#L5541-L5549
|
RestComm/sipunit
|
src/main/java/org/cafesip/sipunit/SipSession.java
|
SipSession.sendUnidirectionalRequest
|
public boolean sendUnidirectionalRequest(Request request, boolean viaProxy) {
"""
This sendUnidirectionalRequest() method sends out a request message with no response expected.
The Request object passed in must be a fully formed Request with all required content, ready to
be sent.
@param request The request to be sent out.
@param viaProxy If true, send the message to the proxy. In this case a Route header is added by
this method. Else send the message as is. In this case, for an INVITE request, a route
header must have been added by the caller for the request routing to complete.
@return true if the message was successfully sent, false otherwise.
"""
initErrorInfo();
if (viaProxy == true) {
if (addProxy(request) == false) {
return false;
}
}
try {
parent.getSipProvider().sendRequest(request);
return true;
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(EXCEPTION_ENCOUNTERED);
return false;
}
}
|
java
|
public boolean sendUnidirectionalRequest(Request request, boolean viaProxy) {
initErrorInfo();
if (viaProxy == true) {
if (addProxy(request) == false) {
return false;
}
}
try {
parent.getSipProvider().sendRequest(request);
return true;
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(EXCEPTION_ENCOUNTERED);
return false;
}
}
|
[
"public",
"boolean",
"sendUnidirectionalRequest",
"(",
"Request",
"request",
",",
"boolean",
"viaProxy",
")",
"{",
"initErrorInfo",
"(",
")",
";",
"if",
"(",
"viaProxy",
"==",
"true",
")",
"{",
"if",
"(",
"addProxy",
"(",
"request",
")",
"==",
"false",
")",
"{",
"return",
"false",
";",
"}",
"}",
"try",
"{",
"parent",
".",
"getSipProvider",
"(",
")",
".",
"sendRequest",
"(",
"request",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"setException",
"(",
"ex",
")",
";",
"setErrorMessage",
"(",
"\"Exception: \"",
"+",
"ex",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\": \"",
"+",
"ex",
".",
"getMessage",
"(",
")",
")",
";",
"setReturnCode",
"(",
"EXCEPTION_ENCOUNTERED",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
This sendUnidirectionalRequest() method sends out a request message with no response expected.
The Request object passed in must be a fully formed Request with all required content, ready to
be sent.
@param request The request to be sent out.
@param viaProxy If true, send the message to the proxy. In this case a Route header is added by
this method. Else send the message as is. In this case, for an INVITE request, a route
header must have been added by the caller for the request routing to complete.
@return true if the message was successfully sent, false otherwise.
|
[
"This",
"sendUnidirectionalRequest",
"()",
"method",
"sends",
"out",
"a",
"request",
"message",
"with",
"no",
"response",
"expected",
".",
"The",
"Request",
"object",
"passed",
"in",
"must",
"be",
"a",
"fully",
"formed",
"Request",
"with",
"all",
"required",
"content",
"ready",
"to",
"be",
"sent",
"."
] |
train
|
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipSession.java#L745-L763
|
ThreeTen/threeten-extra
|
src/main/java/org/threeten/extra/chrono/DiscordianChronology.java
|
DiscordianChronology.dateYearDay
|
@Override
public DiscordianDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {
"""
Obtains a local date in Discordian calendar system from the
era, year-of-era and day-of-year fields.
@param era the Discordian era, not null
@param yearOfEra the year-of-era
@param dayOfYear the day-of-year
@return the Discordian local date, not null
@throws DateTimeException if unable to create the date
@throws ClassCastException if the {@code era} is not a {@code DiscordianEra}
"""
return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);
}
|
java
|
@Override
public DiscordianDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {
return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);
}
|
[
"@",
"Override",
"public",
"DiscordianDate",
"dateYearDay",
"(",
"Era",
"era",
",",
"int",
"yearOfEra",
",",
"int",
"dayOfYear",
")",
"{",
"return",
"dateYearDay",
"(",
"prolepticYear",
"(",
"era",
",",
"yearOfEra",
")",
",",
"dayOfYear",
")",
";",
"}"
] |
Obtains a local date in Discordian calendar system from the
era, year-of-era and day-of-year fields.
@param era the Discordian era, not null
@param yearOfEra the year-of-era
@param dayOfYear the day-of-year
@return the Discordian local date, not null
@throws DateTimeException if unable to create the date
@throws ClassCastException if the {@code era} is not a {@code DiscordianEra}
|
[
"Obtains",
"a",
"local",
"date",
"in",
"Discordian",
"calendar",
"system",
"from",
"the",
"era",
"year",
"-",
"of",
"-",
"era",
"and",
"day",
"-",
"of",
"-",
"year",
"fields",
"."
] |
train
|
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/DiscordianChronology.java#L245-L248
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java
|
JsonUtil.getObject
|
public static JsonObject getObject(JsonObject object, String field, JsonObject defaultValue) {
"""
Returns a field in a Json object as an object.
@param object the Json object
@param field the field in the Json object to return
@param defaultValue a default value for the field if the field value is null
@return the Json field value as a Json object
"""
final JsonValue value = object.get(field);
if (value == null || value.isNull()) {
return defaultValue;
} else {
return value.asObject();
}
}
|
java
|
public static JsonObject getObject(JsonObject object, String field, JsonObject defaultValue) {
final JsonValue value = object.get(field);
if (value == null || value.isNull()) {
return defaultValue;
} else {
return value.asObject();
}
}
|
[
"public",
"static",
"JsonObject",
"getObject",
"(",
"JsonObject",
"object",
",",
"String",
"field",
",",
"JsonObject",
"defaultValue",
")",
"{",
"final",
"JsonValue",
"value",
"=",
"object",
".",
"get",
"(",
"field",
")",
";",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"isNull",
"(",
")",
")",
"{",
"return",
"defaultValue",
";",
"}",
"else",
"{",
"return",
"value",
".",
"asObject",
"(",
")",
";",
"}",
"}"
] |
Returns a field in a Json object as an object.
@param object the Json object
@param field the field in the Json object to return
@param defaultValue a default value for the field if the field value is null
@return the Json field value as a Json object
|
[
"Returns",
"a",
"field",
"in",
"a",
"Json",
"object",
"as",
"an",
"object",
"."
] |
train
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java#L275-L282
|
apache/flink
|
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBKeyedStateBackend.java
|
RocksDBKeyedStateBackend.tryRegisterKvStateInformation
|
private <N, S extends State, SV, SEV> Tuple2<ColumnFamilyHandle, RegisteredKeyValueStateBackendMetaInfo<N, SV>> tryRegisterKvStateInformation(
StateDescriptor<S, SV> stateDesc,
TypeSerializer<N> namespaceSerializer,
@Nonnull StateSnapshotTransformFactory<SEV> snapshotTransformFactory) throws Exception {
"""
Registers a k/v state information, which includes its state id, type, RocksDB column family handle, and serializers.
<p>When restoring from a snapshot, we don’t restore the individual k/v states, just the global RocksDB database and
the list of k/v state information. When a k/v state is first requested we check here whether we
already have a registered entry for that and return it (after some necessary state compatibility checks)
or create a new one if it does not exist.
"""
RocksDbKvStateInfo oldStateInfo = kvStateInformation.get(stateDesc.getName());
TypeSerializer<SV> stateSerializer = stateDesc.getSerializer();
RocksDbKvStateInfo newRocksStateInfo;
RegisteredKeyValueStateBackendMetaInfo<N, SV> newMetaInfo;
if (oldStateInfo != null) {
@SuppressWarnings("unchecked")
RegisteredKeyValueStateBackendMetaInfo<N, SV> castedMetaInfo =
(RegisteredKeyValueStateBackendMetaInfo<N, SV>) oldStateInfo.metaInfo;
newMetaInfo = updateRestoredStateMetaInfo(
Tuple2.of(oldStateInfo.columnFamilyHandle, castedMetaInfo),
stateDesc,
namespaceSerializer,
stateSerializer);
newRocksStateInfo = new RocksDbKvStateInfo(oldStateInfo.columnFamilyHandle, newMetaInfo);
kvStateInformation.put(stateDesc.getName(), newRocksStateInfo);
} else {
newMetaInfo = new RegisteredKeyValueStateBackendMetaInfo<>(
stateDesc.getType(),
stateDesc.getName(),
namespaceSerializer,
stateSerializer,
StateSnapshotTransformFactory.noTransform());
newRocksStateInfo = RocksDBOperationUtils.createStateInfo(
newMetaInfo, db, columnFamilyOptionsFactory, ttlCompactFiltersManager);
RocksDBOperationUtils.registerKvStateInformation(this.kvStateInformation, this.nativeMetricMonitor,
stateDesc.getName(), newRocksStateInfo);
}
StateSnapshotTransformFactory<SV> wrappedSnapshotTransformFactory = wrapStateSnapshotTransformFactory(
stateDesc, snapshotTransformFactory, newMetaInfo.getStateSerializer());
newMetaInfo.updateSnapshotTransformFactory(wrappedSnapshotTransformFactory);
ttlCompactFiltersManager.configCompactFilter(stateDesc, newMetaInfo.getStateSerializer());
return Tuple2.of(newRocksStateInfo.columnFamilyHandle, newMetaInfo);
}
|
java
|
private <N, S extends State, SV, SEV> Tuple2<ColumnFamilyHandle, RegisteredKeyValueStateBackendMetaInfo<N, SV>> tryRegisterKvStateInformation(
StateDescriptor<S, SV> stateDesc,
TypeSerializer<N> namespaceSerializer,
@Nonnull StateSnapshotTransformFactory<SEV> snapshotTransformFactory) throws Exception {
RocksDbKvStateInfo oldStateInfo = kvStateInformation.get(stateDesc.getName());
TypeSerializer<SV> stateSerializer = stateDesc.getSerializer();
RocksDbKvStateInfo newRocksStateInfo;
RegisteredKeyValueStateBackendMetaInfo<N, SV> newMetaInfo;
if (oldStateInfo != null) {
@SuppressWarnings("unchecked")
RegisteredKeyValueStateBackendMetaInfo<N, SV> castedMetaInfo =
(RegisteredKeyValueStateBackendMetaInfo<N, SV>) oldStateInfo.metaInfo;
newMetaInfo = updateRestoredStateMetaInfo(
Tuple2.of(oldStateInfo.columnFamilyHandle, castedMetaInfo),
stateDesc,
namespaceSerializer,
stateSerializer);
newRocksStateInfo = new RocksDbKvStateInfo(oldStateInfo.columnFamilyHandle, newMetaInfo);
kvStateInformation.put(stateDesc.getName(), newRocksStateInfo);
} else {
newMetaInfo = new RegisteredKeyValueStateBackendMetaInfo<>(
stateDesc.getType(),
stateDesc.getName(),
namespaceSerializer,
stateSerializer,
StateSnapshotTransformFactory.noTransform());
newRocksStateInfo = RocksDBOperationUtils.createStateInfo(
newMetaInfo, db, columnFamilyOptionsFactory, ttlCompactFiltersManager);
RocksDBOperationUtils.registerKvStateInformation(this.kvStateInformation, this.nativeMetricMonitor,
stateDesc.getName(), newRocksStateInfo);
}
StateSnapshotTransformFactory<SV> wrappedSnapshotTransformFactory = wrapStateSnapshotTransformFactory(
stateDesc, snapshotTransformFactory, newMetaInfo.getStateSerializer());
newMetaInfo.updateSnapshotTransformFactory(wrappedSnapshotTransformFactory);
ttlCompactFiltersManager.configCompactFilter(stateDesc, newMetaInfo.getStateSerializer());
return Tuple2.of(newRocksStateInfo.columnFamilyHandle, newMetaInfo);
}
|
[
"private",
"<",
"N",
",",
"S",
"extends",
"State",
",",
"SV",
",",
"SEV",
">",
"Tuple2",
"<",
"ColumnFamilyHandle",
",",
"RegisteredKeyValueStateBackendMetaInfo",
"<",
"N",
",",
"SV",
">",
">",
"tryRegisterKvStateInformation",
"(",
"StateDescriptor",
"<",
"S",
",",
"SV",
">",
"stateDesc",
",",
"TypeSerializer",
"<",
"N",
">",
"namespaceSerializer",
",",
"@",
"Nonnull",
"StateSnapshotTransformFactory",
"<",
"SEV",
">",
"snapshotTransformFactory",
")",
"throws",
"Exception",
"{",
"RocksDbKvStateInfo",
"oldStateInfo",
"=",
"kvStateInformation",
".",
"get",
"(",
"stateDesc",
".",
"getName",
"(",
")",
")",
";",
"TypeSerializer",
"<",
"SV",
">",
"stateSerializer",
"=",
"stateDesc",
".",
"getSerializer",
"(",
")",
";",
"RocksDbKvStateInfo",
"newRocksStateInfo",
";",
"RegisteredKeyValueStateBackendMetaInfo",
"<",
"N",
",",
"SV",
">",
"newMetaInfo",
";",
"if",
"(",
"oldStateInfo",
"!=",
"null",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"RegisteredKeyValueStateBackendMetaInfo",
"<",
"N",
",",
"SV",
">",
"castedMetaInfo",
"=",
"(",
"RegisteredKeyValueStateBackendMetaInfo",
"<",
"N",
",",
"SV",
">",
")",
"oldStateInfo",
".",
"metaInfo",
";",
"newMetaInfo",
"=",
"updateRestoredStateMetaInfo",
"(",
"Tuple2",
".",
"of",
"(",
"oldStateInfo",
".",
"columnFamilyHandle",
",",
"castedMetaInfo",
")",
",",
"stateDesc",
",",
"namespaceSerializer",
",",
"stateSerializer",
")",
";",
"newRocksStateInfo",
"=",
"new",
"RocksDbKvStateInfo",
"(",
"oldStateInfo",
".",
"columnFamilyHandle",
",",
"newMetaInfo",
")",
";",
"kvStateInformation",
".",
"put",
"(",
"stateDesc",
".",
"getName",
"(",
")",
",",
"newRocksStateInfo",
")",
";",
"}",
"else",
"{",
"newMetaInfo",
"=",
"new",
"RegisteredKeyValueStateBackendMetaInfo",
"<>",
"(",
"stateDesc",
".",
"getType",
"(",
")",
",",
"stateDesc",
".",
"getName",
"(",
")",
",",
"namespaceSerializer",
",",
"stateSerializer",
",",
"StateSnapshotTransformFactory",
".",
"noTransform",
"(",
")",
")",
";",
"newRocksStateInfo",
"=",
"RocksDBOperationUtils",
".",
"createStateInfo",
"(",
"newMetaInfo",
",",
"db",
",",
"columnFamilyOptionsFactory",
",",
"ttlCompactFiltersManager",
")",
";",
"RocksDBOperationUtils",
".",
"registerKvStateInformation",
"(",
"this",
".",
"kvStateInformation",
",",
"this",
".",
"nativeMetricMonitor",
",",
"stateDesc",
".",
"getName",
"(",
")",
",",
"newRocksStateInfo",
")",
";",
"}",
"StateSnapshotTransformFactory",
"<",
"SV",
">",
"wrappedSnapshotTransformFactory",
"=",
"wrapStateSnapshotTransformFactory",
"(",
"stateDesc",
",",
"snapshotTransformFactory",
",",
"newMetaInfo",
".",
"getStateSerializer",
"(",
")",
")",
";",
"newMetaInfo",
".",
"updateSnapshotTransformFactory",
"(",
"wrappedSnapshotTransformFactory",
")",
";",
"ttlCompactFiltersManager",
".",
"configCompactFilter",
"(",
"stateDesc",
",",
"newMetaInfo",
".",
"getStateSerializer",
"(",
")",
")",
";",
"return",
"Tuple2",
".",
"of",
"(",
"newRocksStateInfo",
".",
"columnFamilyHandle",
",",
"newMetaInfo",
")",
";",
"}"
] |
Registers a k/v state information, which includes its state id, type, RocksDB column family handle, and serializers.
<p>When restoring from a snapshot, we don’t restore the individual k/v states, just the global RocksDB database and
the list of k/v state information. When a k/v state is first requested we check here whether we
already have a registered entry for that and return it (after some necessary state compatibility checks)
or create a new one if it does not exist.
|
[
"Registers",
"a",
"k",
"/",
"v",
"state",
"information",
"which",
"includes",
"its",
"state",
"id",
"type",
"RocksDB",
"column",
"family",
"handle",
"and",
"serializers",
"."
] |
train
|
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBKeyedStateBackend.java#L462-L507
|
OpenLiberty/open-liberty
|
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java
|
JavaScriptUtils.getJavaScriptHtmlCookieString
|
public String getJavaScriptHtmlCookieString(String name, String value, Map<String, String> cookieProperties) {
"""
Creates and returns a JavaScript line that sets a cookie with the specified name, value, and cookie properties. For
example, a cookie name of "test", value of "123", and properties "HttpOnly" and "path=/" would return
{@code document.cookie="test=123; HttpOnly; path=/;";}. Note: The name, value, and properties will be HTML-encoded.
"""
return createJavaScriptHtmlCookieString(name, value, cookieProperties, true);
}
|
java
|
public String getJavaScriptHtmlCookieString(String name, String value, Map<String, String> cookieProperties) {
return createJavaScriptHtmlCookieString(name, value, cookieProperties, true);
}
|
[
"public",
"String",
"getJavaScriptHtmlCookieString",
"(",
"String",
"name",
",",
"String",
"value",
",",
"Map",
"<",
"String",
",",
"String",
">",
"cookieProperties",
")",
"{",
"return",
"createJavaScriptHtmlCookieString",
"(",
"name",
",",
"value",
",",
"cookieProperties",
",",
"true",
")",
";",
"}"
] |
Creates and returns a JavaScript line that sets a cookie with the specified name, value, and cookie properties. For
example, a cookie name of "test", value of "123", and properties "HttpOnly" and "path=/" would return
{@code document.cookie="test=123; HttpOnly; path=/;";}. Note: The name, value, and properties will be HTML-encoded.
|
[
"Creates",
"and",
"returns",
"a",
"JavaScript",
"line",
"that",
"sets",
"a",
"cookie",
"with",
"the",
"specified",
"name",
"value",
"and",
"cookie",
"properties",
".",
"For",
"example",
"a",
"cookie",
"name",
"of",
"test",
"value",
"of",
"123",
"and",
"properties",
"HttpOnly",
"and",
"path",
"=",
"/",
"would",
"return",
"{"
] |
train
|
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java#L48-L50
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/datatypes/scancollection/impl/ScanCollectionDefault.java
|
ScanCollectionDefault.getPrevScanAtMsLevel
|
@Override
public IScan getPrevScanAtMsLevel(int scanNum, int msLevel) {
"""
Finds the next scan at the same MS level, as the scan with scanNum. If the scan number provided
is not in the map, this method will find the next existing one.
@param scanNum Scan number
@param msLevel MS Level at which to search for that scan number
@return either next Scan, or null, if there are no further scans at this level. If MS level is
incorrect, also returns null.
"""
TreeMap<Integer, IScan> msLevelMap = getMapMsLevel2index().get(msLevel).getNum2scan();
if (msLevelMap == null) {
return null;
}
Map.Entry<Integer, IScan> entry = msLevelMap.floorEntry(scanNum - 1);
if (entry != null) {
return entry.getValue();
}
return null;
}
|
java
|
@Override
public IScan getPrevScanAtMsLevel(int scanNum, int msLevel) {
TreeMap<Integer, IScan> msLevelMap = getMapMsLevel2index().get(msLevel).getNum2scan();
if (msLevelMap == null) {
return null;
}
Map.Entry<Integer, IScan> entry = msLevelMap.floorEntry(scanNum - 1);
if (entry != null) {
return entry.getValue();
}
return null;
}
|
[
"@",
"Override",
"public",
"IScan",
"getPrevScanAtMsLevel",
"(",
"int",
"scanNum",
",",
"int",
"msLevel",
")",
"{",
"TreeMap",
"<",
"Integer",
",",
"IScan",
">",
"msLevelMap",
"=",
"getMapMsLevel2index",
"(",
")",
".",
"get",
"(",
"msLevel",
")",
".",
"getNum2scan",
"(",
")",
";",
"if",
"(",
"msLevelMap",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"IScan",
">",
"entry",
"=",
"msLevelMap",
".",
"floorEntry",
"(",
"scanNum",
"-",
"1",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"return",
"entry",
".",
"getValue",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Finds the next scan at the same MS level, as the scan with scanNum. If the scan number provided
is not in the map, this method will find the next existing one.
@param scanNum Scan number
@param msLevel MS Level at which to search for that scan number
@return either next Scan, or null, if there are no further scans at this level. If MS level is
incorrect, also returns null.
|
[
"Finds",
"the",
"next",
"scan",
"at",
"the",
"same",
"MS",
"level",
"as",
"the",
"scan",
"with",
"scanNum",
".",
"If",
"the",
"scan",
"number",
"provided",
"is",
"not",
"in",
"the",
"map",
"this",
"method",
"will",
"find",
"the",
"next",
"existing",
"one",
"."
] |
train
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/datatypes/scancollection/impl/ScanCollectionDefault.java#L662-L673
|
JodaOrg/joda-time
|
src/main/java/org/joda/time/Period.java
|
Period.withDays
|
public Period withDays(int days) {
"""
Returns a new period with the specified number of days.
<p>
This period instance is immutable and unaffected by this method call.
@param days the amount of days to add, may be negative
@return the new period with the increased days
@throws UnsupportedOperationException if the field is not supported
"""
int[] values = getValues(); // cloned
getPeriodType().setIndexedField(this, PeriodType.DAY_INDEX, values, days);
return new Period(values, getPeriodType());
}
|
java
|
public Period withDays(int days) {
int[] values = getValues(); // cloned
getPeriodType().setIndexedField(this, PeriodType.DAY_INDEX, values, days);
return new Period(values, getPeriodType());
}
|
[
"public",
"Period",
"withDays",
"(",
"int",
"days",
")",
"{",
"int",
"[",
"]",
"values",
"=",
"getValues",
"(",
")",
";",
"// cloned",
"getPeriodType",
"(",
")",
".",
"setIndexedField",
"(",
"this",
",",
"PeriodType",
".",
"DAY_INDEX",
",",
"values",
",",
"days",
")",
";",
"return",
"new",
"Period",
"(",
"values",
",",
"getPeriodType",
"(",
")",
")",
";",
"}"
] |
Returns a new period with the specified number of days.
<p>
This period instance is immutable and unaffected by this method call.
@param days the amount of days to add, may be negative
@return the new period with the increased days
@throws UnsupportedOperationException if the field is not supported
|
[
"Returns",
"a",
"new",
"period",
"with",
"the",
"specified",
"number",
"of",
"days",
".",
"<p",
">",
"This",
"period",
"instance",
"is",
"immutable",
"and",
"unaffected",
"by",
"this",
"method",
"call",
"."
] |
train
|
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L959-L963
|
UrielCh/ovh-java-sdk
|
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
|
ApiOvhIp.loadBalancing_serviceName_stickiness_POST
|
public OvhLoadBalancingTask loadBalancing_serviceName_stickiness_POST(String serviceName, OvhLoadBalancingStickinessEnum stickiness) throws IOException {
"""
Set Stickiness type. 'ipSource' will stick clients to a backend by their source ip, 'cookie' will stick them by inserting a cookie, 'none' is to set no stickiness
REST: POST /ip/loadBalancing/{serviceName}/stickiness
@param stickiness [required] The stickiness you want on your IP LoadBalancing
@param serviceName [required] The internal name of your IP load balancing
"""
String qPath = "/ip/loadBalancing/{serviceName}/stickiness";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "stickiness", stickiness);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhLoadBalancingTask.class);
}
|
java
|
public OvhLoadBalancingTask loadBalancing_serviceName_stickiness_POST(String serviceName, OvhLoadBalancingStickinessEnum stickiness) throws IOException {
String qPath = "/ip/loadBalancing/{serviceName}/stickiness";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "stickiness", stickiness);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhLoadBalancingTask.class);
}
|
[
"public",
"OvhLoadBalancingTask",
"loadBalancing_serviceName_stickiness_POST",
"(",
"String",
"serviceName",
",",
"OvhLoadBalancingStickinessEnum",
"stickiness",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/loadBalancing/{serviceName}/stickiness\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"stickiness\"",
",",
"stickiness",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhLoadBalancingTask",
".",
"class",
")",
";",
"}"
] |
Set Stickiness type. 'ipSource' will stick clients to a backend by their source ip, 'cookie' will stick them by inserting a cookie, 'none' is to set no stickiness
REST: POST /ip/loadBalancing/{serviceName}/stickiness
@param stickiness [required] The stickiness you want on your IP LoadBalancing
@param serviceName [required] The internal name of your IP load balancing
|
[
"Set",
"Stickiness",
"type",
".",
"ipSource",
"will",
"stick",
"clients",
"to",
"a",
"backend",
"by",
"their",
"source",
"ip",
"cookie",
"will",
"stick",
"them",
"by",
"inserting",
"a",
"cookie",
"none",
"is",
"to",
"set",
"no",
"stickiness"
] |
train
|
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1568-L1575
|
Azure/azure-sdk-for-java
|
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java
|
JobExecutionsInner.listByAgentWithServiceResponseAsync
|
public Observable<ServiceResponse<Page<JobExecutionInner>>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) {
"""
Lists all executions in a job agent.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent.
@param createTimeMin If specified, only job executions created at or after the specified time are included.
@param createTimeMax If specified, only job executions created before the specified time are included.
@param endTimeMin If specified, only job executions completed at or after the specified time are included.
@param endTimeMax If specified, only job executions completed before the specified time are included.
@param isActive If specified, only active or only completed job executions are included.
@param skip The number of elements in the collection to skip.
@param top The number of elements to return from the collection.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<JobExecutionInner> object
"""
return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top)
.concatMap(new Func1<ServiceResponse<Page<JobExecutionInner>>, Observable<ServiceResponse<Page<JobExecutionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<JobExecutionInner>>> call(ServiceResponse<Page<JobExecutionInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByAgentNextWithServiceResponseAsync(nextPageLink));
}
});
}
|
java
|
public Observable<ServiceResponse<Page<JobExecutionInner>>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) {
return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top)
.concatMap(new Func1<ServiceResponse<Page<JobExecutionInner>>, Observable<ServiceResponse<Page<JobExecutionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<JobExecutionInner>>> call(ServiceResponse<Page<JobExecutionInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByAgentNextWithServiceResponseAsync(nextPageLink));
}
});
}
|
[
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"JobExecutionInner",
">",
">",
">",
"listByAgentWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"serverName",
",",
"final",
"String",
"jobAgentName",
",",
"final",
"DateTime",
"createTimeMin",
",",
"final",
"DateTime",
"createTimeMax",
",",
"final",
"DateTime",
"endTimeMin",
",",
"final",
"DateTime",
"endTimeMax",
",",
"final",
"Boolean",
"isActive",
",",
"final",
"Integer",
"skip",
",",
"final",
"Integer",
"top",
")",
"{",
"return",
"listByAgentSinglePageAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"jobAgentName",
",",
"createTimeMin",
",",
"createTimeMax",
",",
"endTimeMin",
",",
"endTimeMax",
",",
"isActive",
",",
"skip",
",",
"top",
")",
".",
"concatMap",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"JobExecutionInner",
">",
">",
",",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"JobExecutionInner",
">",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"JobExecutionInner",
">",
">",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"JobExecutionInner",
">",
">",
"page",
")",
"{",
"String",
"nextPageLink",
"=",
"page",
".",
"body",
"(",
")",
".",
"nextPageLink",
"(",
")",
";",
"if",
"(",
"nextPageLink",
"==",
"null",
")",
"{",
"return",
"Observable",
".",
"just",
"(",
"page",
")",
";",
"}",
"return",
"Observable",
".",
"just",
"(",
"page",
")",
".",
"concatWith",
"(",
"listByAgentNextWithServiceResponseAsync",
"(",
"nextPageLink",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Lists all executions in a job agent.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent.
@param createTimeMin If specified, only job executions created at or after the specified time are included.
@param createTimeMax If specified, only job executions created before the specified time are included.
@param endTimeMin If specified, only job executions completed at or after the specified time are included.
@param endTimeMax If specified, only job executions completed before the specified time are included.
@param isActive If specified, only active or only completed job executions are included.
@param skip The number of elements in the collection to skip.
@param top The number of elements to return from the collection.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<JobExecutionInner> object
|
[
"Lists",
"all",
"executions",
"in",
"a",
"job",
"agent",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java#L336-L348
|
OpenLiberty/open-liberty
|
dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/TopicBasedCache.java
|
TopicBasedCache.getTopicData
|
TopicData getTopicData(Topic topic, String topicName) {
"""
Get the cached information about the specified topic. The cached data
will allow us to avoid the expense of finding various and sundry data
associated with a specific topic and topic hierarchies.
@param topic
the topic associated with an event
@param topicName
the topic name associated with an event
@return the cached information
"""
TopicData topicData = null;
if (topic != null) {
topicData = topic.getTopicData();
}
if (topicData == null) {
topicData = topicDataCache.get(topicName);
if (topic != null && topicData != null) {
topic.setTopicDataReference(topicData.getReference());
}
}
if (topicData == null) {
synchronized (this) {
topicData = buildTopicData(topicName);
if (topic != null) {
topic.setTopicDataReference(topicData.getReference());
}
}
}
return topicData;
}
|
java
|
TopicData getTopicData(Topic topic, String topicName) {
TopicData topicData = null;
if (topic != null) {
topicData = topic.getTopicData();
}
if (topicData == null) {
topicData = topicDataCache.get(topicName);
if (topic != null && topicData != null) {
topic.setTopicDataReference(topicData.getReference());
}
}
if (topicData == null) {
synchronized (this) {
topicData = buildTopicData(topicName);
if (topic != null) {
topic.setTopicDataReference(topicData.getReference());
}
}
}
return topicData;
}
|
[
"TopicData",
"getTopicData",
"(",
"Topic",
"topic",
",",
"String",
"topicName",
")",
"{",
"TopicData",
"topicData",
"=",
"null",
";",
"if",
"(",
"topic",
"!=",
"null",
")",
"{",
"topicData",
"=",
"topic",
".",
"getTopicData",
"(",
")",
";",
"}",
"if",
"(",
"topicData",
"==",
"null",
")",
"{",
"topicData",
"=",
"topicDataCache",
".",
"get",
"(",
"topicName",
")",
";",
"if",
"(",
"topic",
"!=",
"null",
"&&",
"topicData",
"!=",
"null",
")",
"{",
"topic",
".",
"setTopicDataReference",
"(",
"topicData",
".",
"getReference",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"topicData",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"topicData",
"=",
"buildTopicData",
"(",
"topicName",
")",
";",
"if",
"(",
"topic",
"!=",
"null",
")",
"{",
"topic",
".",
"setTopicDataReference",
"(",
"topicData",
".",
"getReference",
"(",
")",
")",
";",
"}",
"}",
"}",
"return",
"topicData",
";",
"}"
] |
Get the cached information about the specified topic. The cached data
will allow us to avoid the expense of finding various and sundry data
associated with a specific topic and topic hierarchies.
@param topic
the topic associated with an event
@param topicName
the topic name associated with an event
@return the cached information
|
[
"Get",
"the",
"cached",
"information",
"about",
"the",
"specified",
"topic",
".",
"The",
"cached",
"data",
"will",
"allow",
"us",
"to",
"avoid",
"the",
"expense",
"of",
"finding",
"various",
"and",
"sundry",
"data",
"associated",
"with",
"a",
"specific",
"topic",
"and",
"topic",
"hierarchies",
"."
] |
train
|
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/TopicBasedCache.java#L233-L257
|
protostuff/protostuff
|
protostuff-parser/src/main/java/io/protostuff/parser/DefaultProtoLoader.java
|
DefaultProtoLoader.searchFromProtoPathAndClasspath
|
protected Proto searchFromProtoPathAndClasspath(String path, Proto importer)
throws Exception {
"""
Search from proto_path and classpath (in that order).
<p>
<pre>
Enable via:
-Dproto_path=$path -Dproto_search_strategy=2
</pre>
"""
// proto_path
File protoFile;
for (File dir : __protoLoadDirs)
{
if ((protoFile = new File(dir, path)).exists())
return loadFrom(protoFile, importer);
}
// classpath
Proto protoFromOtherResource = loadFromOtherResource(path, importer);
if (protoFromOtherResource == null)
{
throw new IllegalStateException("Imported proto " + path +
" not found. (" + importer.getSourcePath() + ")");
}
return protoFromOtherResource;
}
|
java
|
protected Proto searchFromProtoPathAndClasspath(String path, Proto importer)
throws Exception
{
// proto_path
File protoFile;
for (File dir : __protoLoadDirs)
{
if ((protoFile = new File(dir, path)).exists())
return loadFrom(protoFile, importer);
}
// classpath
Proto protoFromOtherResource = loadFromOtherResource(path, importer);
if (protoFromOtherResource == null)
{
throw new IllegalStateException("Imported proto " + path +
" not found. (" + importer.getSourcePath() + ")");
}
return protoFromOtherResource;
}
|
[
"protected",
"Proto",
"searchFromProtoPathAndClasspath",
"(",
"String",
"path",
",",
"Proto",
"importer",
")",
"throws",
"Exception",
"{",
"// proto_path\r",
"File",
"protoFile",
";",
"for",
"(",
"File",
"dir",
":",
"__protoLoadDirs",
")",
"{",
"if",
"(",
"(",
"protoFile",
"=",
"new",
"File",
"(",
"dir",
",",
"path",
")",
")",
".",
"exists",
"(",
")",
")",
"return",
"loadFrom",
"(",
"protoFile",
",",
"importer",
")",
";",
"}",
"// classpath\r",
"Proto",
"protoFromOtherResource",
"=",
"loadFromOtherResource",
"(",
"path",
",",
"importer",
")",
";",
"if",
"(",
"protoFromOtherResource",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Imported proto \"",
"+",
"path",
"+",
"\" not found. (\"",
"+",
"importer",
".",
"getSourcePath",
"(",
")",
"+",
"\")\"",
")",
";",
"}",
"return",
"protoFromOtherResource",
";",
"}"
] |
Search from proto_path and classpath (in that order).
<p>
<pre>
Enable via:
-Dproto_path=$path -Dproto_search_strategy=2
</pre>
|
[
"Search",
"from",
"proto_path",
"and",
"classpath",
"(",
"in",
"that",
"order",
")",
".",
"<p",
">"
] |
train
|
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-parser/src/main/java/io/protostuff/parser/DefaultProtoLoader.java#L150-L170
|
mapsforge/mapsforge
|
sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java
|
DatabaseUtils.queryNumEntries
|
public static long queryNumEntries(SQLiteDatabase db, String table, String selection) {
"""
Query the table for the number of rows in the table.
@param db the database the table is in
@param table the name of the table to query
@param selection A filter declaring which rows to return,
formatted as an SQL WHERE clause (excluding the WHERE itself).
Passing null will count all rows for the given table
@return the number of rows in the table filtered by the selection
"""
return queryNumEntries(db, table, selection, null);
}
|
java
|
public static long queryNumEntries(SQLiteDatabase db, String table, String selection) {
return queryNumEntries(db, table, selection, null);
}
|
[
"public",
"static",
"long",
"queryNumEntries",
"(",
"SQLiteDatabase",
"db",
",",
"String",
"table",
",",
"String",
"selection",
")",
"{",
"return",
"queryNumEntries",
"(",
"db",
",",
"table",
",",
"selection",
",",
"null",
")",
";",
"}"
] |
Query the table for the number of rows in the table.
@param db the database the table is in
@param table the name of the table to query
@param selection A filter declaring which rows to return,
formatted as an SQL WHERE clause (excluding the WHERE itself).
Passing null will count all rows for the given table
@return the number of rows in the table filtered by the selection
|
[
"Query",
"the",
"table",
"for",
"the",
"number",
"of",
"rows",
"in",
"the",
"table",
"."
] |
train
|
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L792-L794
|
couchbase/couchbase-lite-java
|
src/main/java/com/couchbase/lite/ArrayExpression.java
|
ArrayExpression.anyAndEvery
|
@NonNull
public static ArrayExpressionIn anyAndEvery(@NonNull VariableExpression variable) {
"""
Creates an ANY AND EVERY Quantified operator (ANY AND EVERY <variable name> IN <expr>
SATISFIES <expr>) with the given variable name. The method returns an IN clause object
that is used for specifying an array object or an expression evaluated as an array object,
each of which will be evaluated against the satisfies expression.
The ANY AND EVERY operator returns TRUE if the array is NOT empty, and at least one of
the items in the array satisfies the given satisfies expression.
@param variable The variable expression.
@return An In object.
"""
if (variable == null) {
throw new IllegalArgumentException("variable cannot be null.");
}
return new ArrayExpressionIn(QuantifiesType.ANY_AND_EVERY, variable);
}
|
java
|
@NonNull
public static ArrayExpressionIn anyAndEvery(@NonNull VariableExpression variable) {
if (variable == null) {
throw new IllegalArgumentException("variable cannot be null.");
}
return new ArrayExpressionIn(QuantifiesType.ANY_AND_EVERY, variable);
}
|
[
"@",
"NonNull",
"public",
"static",
"ArrayExpressionIn",
"anyAndEvery",
"(",
"@",
"NonNull",
"VariableExpression",
"variable",
")",
"{",
"if",
"(",
"variable",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"variable cannot be null.\"",
")",
";",
"}",
"return",
"new",
"ArrayExpressionIn",
"(",
"QuantifiesType",
".",
"ANY_AND_EVERY",
",",
"variable",
")",
";",
"}"
] |
Creates an ANY AND EVERY Quantified operator (ANY AND EVERY <variable name> IN <expr>
SATISFIES <expr>) with the given variable name. The method returns an IN clause object
that is used for specifying an array object or an expression evaluated as an array object,
each of which will be evaluated against the satisfies expression.
The ANY AND EVERY operator returns TRUE if the array is NOT empty, and at least one of
the items in the array satisfies the given satisfies expression.
@param variable The variable expression.
@return An In object.
|
[
"Creates",
"an",
"ANY",
"AND",
"EVERY",
"Quantified",
"operator",
"(",
"ANY",
"AND",
"EVERY",
"<variable",
"name",
">",
"IN",
"<expr",
">",
"SATISFIES",
"<expr",
">",
")",
"with",
"the",
"given",
"variable",
"name",
".",
"The",
"method",
"returns",
"an",
"IN",
"clause",
"object",
"that",
"is",
"used",
"for",
"specifying",
"an",
"array",
"object",
"or",
"an",
"expression",
"evaluated",
"as",
"an",
"array",
"object",
"each",
"of",
"which",
"will",
"be",
"evaluated",
"against",
"the",
"satisfies",
"expression",
".",
"The",
"ANY",
"AND",
"EVERY",
"operator",
"returns",
"TRUE",
"if",
"the",
"array",
"is",
"NOT",
"empty",
"and",
"at",
"least",
"one",
"of",
"the",
"items",
"in",
"the",
"array",
"satisfies",
"the",
"given",
"satisfies",
"expression",
"."
] |
train
|
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/ArrayExpression.java#L82-L88
|
ManfredTremmel/gwt-bean-validators
|
gwt-bean-validators/src/main/java/de/knightsoftnet/validators/client/impl/ConstraintValidatorContextImpl.java
|
ConstraintValidatorContextImpl.getMessageAndPaths
|
public Set<MessageAndPath> getMessageAndPaths() {
"""
getter for message and path.
@return set which includes message and path
"""
if (!this.disableDefault) {
this.messages
.add(new MessageAndPath(this.basePath, this.getDefaultConstraintMessageTemplate()));
}
return this.messages;
}
|
java
|
public Set<MessageAndPath> getMessageAndPaths() {
if (!this.disableDefault) {
this.messages
.add(new MessageAndPath(this.basePath, this.getDefaultConstraintMessageTemplate()));
}
return this.messages;
}
|
[
"public",
"Set",
"<",
"MessageAndPath",
">",
"getMessageAndPaths",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"disableDefault",
")",
"{",
"this",
".",
"messages",
".",
"add",
"(",
"new",
"MessageAndPath",
"(",
"this",
".",
"basePath",
",",
"this",
".",
"getDefaultConstraintMessageTemplate",
"(",
")",
")",
")",
";",
"}",
"return",
"this",
".",
"messages",
";",
"}"
] |
getter for message and path.
@return set which includes message and path
|
[
"getter",
"for",
"message",
"and",
"path",
"."
] |
train
|
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/java/de/knightsoftnet/validators/client/impl/ConstraintValidatorContextImpl.java#L346-L352
|
sahan/RoboZombie
|
robozombie/src/main/java/com/lonepulse/robozombie/executor/BasicExecutionHandler.java
|
BasicExecutionHandler.onFailure
|
@Override
public void onFailure(InvocationContext context, HttpResponse response) {
"""
<p>Throws a {@link InvocationException} with the {@link InvocationContext} and {@link HttpResponse}.</p>
<p>See {@link ExecutionHandler#onFailure(InvocationContext, HttpResponse)}</p>
@param context
the {@link InvocationContext} with information on the proxy invocation
<br><br>
@param response
the resulting {@link HttpResponse} with a failed status code
<br><br>
@since 1.3.0
"""
throw InvocationException.newInstance(context, response);
}
|
java
|
@Override
public void onFailure(InvocationContext context, HttpResponse response) {
throw InvocationException.newInstance(context, response);
}
|
[
"@",
"Override",
"public",
"void",
"onFailure",
"(",
"InvocationContext",
"context",
",",
"HttpResponse",
"response",
")",
"{",
"throw",
"InvocationException",
".",
"newInstance",
"(",
"context",
",",
"response",
")",
";",
"}"
] |
<p>Throws a {@link InvocationException} with the {@link InvocationContext} and {@link HttpResponse}.</p>
<p>See {@link ExecutionHandler#onFailure(InvocationContext, HttpResponse)}</p>
@param context
the {@link InvocationContext} with information on the proxy invocation
<br><br>
@param response
the resulting {@link HttpResponse} with a failed status code
<br><br>
@since 1.3.0
|
[
"<p",
">",
"Throws",
"a",
"{",
"@link",
"InvocationException",
"}",
"with",
"the",
"{",
"@link",
"InvocationContext",
"}",
"and",
"{",
"@link",
"HttpResponse",
"}",
".",
"<",
"/",
"p",
">"
] |
train
|
https://github.com/sahan/RoboZombie/blob/2e02f0d41647612e9d89360c5c48811ea86b33c8/robozombie/src/main/java/com/lonepulse/robozombie/executor/BasicExecutionHandler.java#L63-L67
|
greatman/craftconomy3
|
src/main/java/com/greatmancode/craftconomy3/converter/converters/Iconomy6.java
|
Iconomy6.importFlatFile
|
private boolean importFlatFile(String sender) {
"""
Import accounts from a flatfile.
@param sender The command sender so we can send back messages.
@return True if the convert is done. Else false.
"""
boolean result = false;
try {
List<String> file = new ArrayList<>();
String str;
while ((str = flatFileReader.readLine()) != null) {
file.add(str);
}
flatFileReader.close();
List<User> userList = new ArrayList<>();
for (String aFile : file) {
String[] info = aFile.split(" ");
try {
double balance = Double.parseDouble(info[1].split(":")[1]);
userList.add(new User(info[0], balance));
} catch (NumberFormatException e) {
Common.getInstance().sendConsoleMessage(Level.SEVERE, "User " + info[0] + " have a invalid balance" + info[1]);
} catch (ArrayIndexOutOfBoundsException e) {
Common.getInstance().sendConsoleMessage(Level.WARNING, "Line not formatted correctly. I read:" + Arrays.toString(info));
}
}
addAccountToString(sender, userList);
result = true;
} catch (IOException e) {
Common.getInstance().getLogger().severe("A error occured while reading the iConomy database file! Message: " + e.getMessage());
}
return result;
}
|
java
|
private boolean importFlatFile(String sender) {
boolean result = false;
try {
List<String> file = new ArrayList<>();
String str;
while ((str = flatFileReader.readLine()) != null) {
file.add(str);
}
flatFileReader.close();
List<User> userList = new ArrayList<>();
for (String aFile : file) {
String[] info = aFile.split(" ");
try {
double balance = Double.parseDouble(info[1].split(":")[1]);
userList.add(new User(info[0], balance));
} catch (NumberFormatException e) {
Common.getInstance().sendConsoleMessage(Level.SEVERE, "User " + info[0] + " have a invalid balance" + info[1]);
} catch (ArrayIndexOutOfBoundsException e) {
Common.getInstance().sendConsoleMessage(Level.WARNING, "Line not formatted correctly. I read:" + Arrays.toString(info));
}
}
addAccountToString(sender, userList);
result = true;
} catch (IOException e) {
Common.getInstance().getLogger().severe("A error occured while reading the iConomy database file! Message: " + e.getMessage());
}
return result;
}
|
[
"private",
"boolean",
"importFlatFile",
"(",
"String",
"sender",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"try",
"{",
"List",
"<",
"String",
">",
"file",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"String",
"str",
";",
"while",
"(",
"(",
"str",
"=",
"flatFileReader",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"file",
".",
"add",
"(",
"str",
")",
";",
"}",
"flatFileReader",
".",
"close",
"(",
")",
";",
"List",
"<",
"User",
">",
"userList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"aFile",
":",
"file",
")",
"{",
"String",
"[",
"]",
"info",
"=",
"aFile",
".",
"split",
"(",
"\" \"",
")",
";",
"try",
"{",
"double",
"balance",
"=",
"Double",
".",
"parseDouble",
"(",
"info",
"[",
"1",
"]",
".",
"split",
"(",
"\":\"",
")",
"[",
"1",
"]",
")",
";",
"userList",
".",
"add",
"(",
"new",
"User",
"(",
"info",
"[",
"0",
"]",
",",
"balance",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"Common",
".",
"getInstance",
"(",
")",
".",
"sendConsoleMessage",
"(",
"Level",
".",
"SEVERE",
",",
"\"User \"",
"+",
"info",
"[",
"0",
"]",
"+",
"\" have a invalid balance\"",
"+",
"info",
"[",
"1",
"]",
")",
";",
"}",
"catch",
"(",
"ArrayIndexOutOfBoundsException",
"e",
")",
"{",
"Common",
".",
"getInstance",
"(",
")",
".",
"sendConsoleMessage",
"(",
"Level",
".",
"WARNING",
",",
"\"Line not formatted correctly. I read:\"",
"+",
"Arrays",
".",
"toString",
"(",
"info",
")",
")",
";",
"}",
"}",
"addAccountToString",
"(",
"sender",
",",
"userList",
")",
";",
"result",
"=",
"true",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Common",
".",
"getInstance",
"(",
")",
".",
"getLogger",
"(",
")",
".",
"severe",
"(",
"\"A error occured while reading the iConomy database file! Message: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Import accounts from a flatfile.
@param sender The command sender so we can send back messages.
@return True if the convert is done. Else false.
|
[
"Import",
"accounts",
"from",
"a",
"flatfile",
"."
] |
train
|
https://github.com/greatman/craftconomy3/blob/51b1b3de7d039e20c7418d1e70b8c4b02b8cf840/src/main/java/com/greatmancode/craftconomy3/converter/converters/Iconomy6.java#L167-L195
|
jayantk/jklol
|
src/com/jayantkrish/jklol/models/DiscreteVariable.java
|
DiscreteVariable.sequence
|
public static DiscreteVariable sequence(String name, int size) {
"""
Creates a discrete variable whose values are {@code 0} to
{@code size - 1}.
@param maxNum
@return
"""
List<Integer> values = null;
if (sequenceCache.containsKey(size)) {
values = sequenceCache.get(size);
} else {
values = Lists.newArrayList();
for (int i = 0; i < size; i++) {
values.add(i);
}
values = ImmutableList.copyOf(values);
sequenceCache.put(size, values);
}
return new DiscreteVariable(name, values);
}
|
java
|
public static DiscreteVariable sequence(String name, int size) {
List<Integer> values = null;
if (sequenceCache.containsKey(size)) {
values = sequenceCache.get(size);
} else {
values = Lists.newArrayList();
for (int i = 0; i < size; i++) {
values.add(i);
}
values = ImmutableList.copyOf(values);
sequenceCache.put(size, values);
}
return new DiscreteVariable(name, values);
}
|
[
"public",
"static",
"DiscreteVariable",
"sequence",
"(",
"String",
"name",
",",
"int",
"size",
")",
"{",
"List",
"<",
"Integer",
">",
"values",
"=",
"null",
";",
"if",
"(",
"sequenceCache",
".",
"containsKey",
"(",
"size",
")",
")",
"{",
"values",
"=",
"sequenceCache",
".",
"get",
"(",
"size",
")",
";",
"}",
"else",
"{",
"values",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"values",
".",
"add",
"(",
"i",
")",
";",
"}",
"values",
"=",
"ImmutableList",
".",
"copyOf",
"(",
"values",
")",
";",
"sequenceCache",
".",
"put",
"(",
"size",
",",
"values",
")",
";",
"}",
"return",
"new",
"DiscreteVariable",
"(",
"name",
",",
"values",
")",
";",
"}"
] |
Creates a discrete variable whose values are {@code 0} to
{@code size - 1}.
@param maxNum
@return
|
[
"Creates",
"a",
"discrete",
"variable",
"whose",
"values",
"are",
"{",
"@code",
"0",
"}",
"to",
"{",
"@code",
"size",
"-",
"1",
"}",
"."
] |
train
|
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/DiscreteVariable.java#L42-L56
|
wcm-io/wcm-io-sling
|
commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java
|
RequestParam.getInt
|
public static int getInt(@NotNull ServletRequest request, @NotNull String param, int defaultValue) {
"""
Returns a request parameter as integer.
@param request Request.
@param param Parameter name.
@param defaultValue Default value.
@return Parameter value or default value if it does not exist or is not a number.
"""
String value = request.getParameter(param);
return NumberUtils.toInt(value, defaultValue);
}
|
java
|
public static int getInt(@NotNull ServletRequest request, @NotNull String param, int defaultValue) {
String value = request.getParameter(param);
return NumberUtils.toInt(value, defaultValue);
}
|
[
"public",
"static",
"int",
"getInt",
"(",
"@",
"NotNull",
"ServletRequest",
"request",
",",
"@",
"NotNull",
"String",
"param",
",",
"int",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"request",
".",
"getParameter",
"(",
"param",
")",
";",
"return",
"NumberUtils",
".",
"toInt",
"(",
"value",
",",
"defaultValue",
")",
";",
"}"
] |
Returns a request parameter as integer.
@param request Request.
@param param Parameter name.
@param defaultValue Default value.
@return Parameter value or default value if it does not exist or is not a number.
|
[
"Returns",
"a",
"request",
"parameter",
"as",
"integer",
"."
] |
train
|
https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java#L156-L159
|
netty/netty
|
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java
|
Http2ConnectionHandler.goAway
|
private ChannelFuture goAway(ChannelHandlerContext ctx, Http2Exception cause, ChannelPromise promise) {
"""
Close the remote endpoint with with a {@code GO_AWAY} frame. Does <strong>not</strong> flush
immediately, this is the responsibility of the caller.
"""
long errorCode = cause != null ? cause.error().code() : NO_ERROR.code();
int lastKnownStream = connection().remote().lastStreamCreated();
return goAway(ctx, lastKnownStream, errorCode, Http2CodecUtil.toByteBuf(ctx, cause), promise);
}
|
java
|
private ChannelFuture goAway(ChannelHandlerContext ctx, Http2Exception cause, ChannelPromise promise) {
long errorCode = cause != null ? cause.error().code() : NO_ERROR.code();
int lastKnownStream = connection().remote().lastStreamCreated();
return goAway(ctx, lastKnownStream, errorCode, Http2CodecUtil.toByteBuf(ctx, cause), promise);
}
|
[
"private",
"ChannelFuture",
"goAway",
"(",
"ChannelHandlerContext",
"ctx",
",",
"Http2Exception",
"cause",
",",
"ChannelPromise",
"promise",
")",
"{",
"long",
"errorCode",
"=",
"cause",
"!=",
"null",
"?",
"cause",
".",
"error",
"(",
")",
".",
"code",
"(",
")",
":",
"NO_ERROR",
".",
"code",
"(",
")",
";",
"int",
"lastKnownStream",
"=",
"connection",
"(",
")",
".",
"remote",
"(",
")",
".",
"lastStreamCreated",
"(",
")",
";",
"return",
"goAway",
"(",
"ctx",
",",
"lastKnownStream",
",",
"errorCode",
",",
"Http2CodecUtil",
".",
"toByteBuf",
"(",
"ctx",
",",
"cause",
")",
",",
"promise",
")",
";",
"}"
] |
Close the remote endpoint with with a {@code GO_AWAY} frame. Does <strong>not</strong> flush
immediately, this is the responsibility of the caller.
|
[
"Close",
"the",
"remote",
"endpoint",
"with",
"with",
"a",
"{"
] |
train
|
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L873-L877
|
attribyte/wpdb
|
src/main/java/org/attribyte/wp/db/DB.java
|
DB.addPostTerm
|
public boolean addPostTerm(final long postId, final TaxonomyTerm taxonomyTerm) throws SQLException {
"""
Adds a term at the end of the current terms if it does not already exist.
@param postId The post id.
@param taxonomyTerm The taxonomy term to add.
@return Was the term added?
@throws SQLException on database error.
"""
List<TaxonomyTerm> currTerms = selectPostTerms(postId, taxonomyTerm.taxonomy);
for(TaxonomyTerm currTerm : currTerms) {
if(currTerm.term.name.equals(taxonomyTerm.term.name)) {
return false;
}
}
Connection conn = null;
PreparedStatement stmt = null;
Timer.Context ctx = metrics.postTermsSetTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(insertPostTermSQL);
stmt.setLong(1, postId);
stmt.setLong(2, taxonomyTerm.id);
stmt.setInt(3, currTerms.size()); //Add at the last position...
return stmt.executeUpdate() > 0;
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt);
}
}
|
java
|
public boolean addPostTerm(final long postId, final TaxonomyTerm taxonomyTerm) throws SQLException {
List<TaxonomyTerm> currTerms = selectPostTerms(postId, taxonomyTerm.taxonomy);
for(TaxonomyTerm currTerm : currTerms) {
if(currTerm.term.name.equals(taxonomyTerm.term.name)) {
return false;
}
}
Connection conn = null;
PreparedStatement stmt = null;
Timer.Context ctx = metrics.postTermsSetTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(insertPostTermSQL);
stmt.setLong(1, postId);
stmt.setLong(2, taxonomyTerm.id);
stmt.setInt(3, currTerms.size()); //Add at the last position...
return stmt.executeUpdate() > 0;
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt);
}
}
|
[
"public",
"boolean",
"addPostTerm",
"(",
"final",
"long",
"postId",
",",
"final",
"TaxonomyTerm",
"taxonomyTerm",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"TaxonomyTerm",
">",
"currTerms",
"=",
"selectPostTerms",
"(",
"postId",
",",
"taxonomyTerm",
".",
"taxonomy",
")",
";",
"for",
"(",
"TaxonomyTerm",
"currTerm",
":",
"currTerms",
")",
"{",
"if",
"(",
"currTerm",
".",
"term",
".",
"name",
".",
"equals",
"(",
"taxonomyTerm",
".",
"term",
".",
"name",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"Connection",
"conn",
"=",
"null",
";",
"PreparedStatement",
"stmt",
"=",
"null",
";",
"Timer",
".",
"Context",
"ctx",
"=",
"metrics",
".",
"postTermsSetTimer",
".",
"time",
"(",
")",
";",
"try",
"{",
"conn",
"=",
"connectionSupplier",
".",
"getConnection",
"(",
")",
";",
"stmt",
"=",
"conn",
".",
"prepareStatement",
"(",
"insertPostTermSQL",
")",
";",
"stmt",
".",
"setLong",
"(",
"1",
",",
"postId",
")",
";",
"stmt",
".",
"setLong",
"(",
"2",
",",
"taxonomyTerm",
".",
"id",
")",
";",
"stmt",
".",
"setInt",
"(",
"3",
",",
"currTerms",
".",
"size",
"(",
")",
")",
";",
"//Add at the last position...",
"return",
"stmt",
".",
"executeUpdate",
"(",
")",
">",
"0",
";",
"}",
"finally",
"{",
"ctx",
".",
"stop",
"(",
")",
";",
"SQLUtil",
".",
"closeQuietly",
"(",
"conn",
",",
"stmt",
")",
";",
"}",
"}"
] |
Adds a term at the end of the current terms if it does not already exist.
@param postId The post id.
@param taxonomyTerm The taxonomy term to add.
@return Was the term added?
@throws SQLException on database error.
|
[
"Adds",
"a",
"term",
"at",
"the",
"end",
"of",
"the",
"current",
"terms",
"if",
"it",
"does",
"not",
"already",
"exist",
"."
] |
train
|
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L2529-L2552
|
geomajas/geomajas-project-client-gwt2
|
impl/src/main/java/org/geomajas/gwt2/client/gfx/VectorTileObject.java
|
VectorTileObject.createElementNS
|
public static Element createElementNS(String ns, String tag) {
"""
<p>
Creates a new DOM element in the given name-space. If the name-space is HTML, a normal element will be created.
</p>
<p>
There is an exception when using Internet Explorer! For Internet Explorer a new element will be created of type
"namespace:tag".
</p>
@param ns
The name-space to be used in the element creation.
@param tag
The tag-name to be used in the element creation.
@return Returns a newly created DOM element in the given name-space.
"""
if (ns.equals(Dom.NS_HTML)) {
return Dom.createElement(tag);
} else {
if (Dom.isIE()) {
return Dom.createElement(ns + ":" + tag);
} else {
return createNameSpaceElement(ns, tag);
}
}
}
|
java
|
public static Element createElementNS(String ns, String tag) {
if (ns.equals(Dom.NS_HTML)) {
return Dom.createElement(tag);
} else {
if (Dom.isIE()) {
return Dom.createElement(ns + ":" + tag);
} else {
return createNameSpaceElement(ns, tag);
}
}
}
|
[
"public",
"static",
"Element",
"createElementNS",
"(",
"String",
"ns",
",",
"String",
"tag",
")",
"{",
"if",
"(",
"ns",
".",
"equals",
"(",
"Dom",
".",
"NS_HTML",
")",
")",
"{",
"return",
"Dom",
".",
"createElement",
"(",
"tag",
")",
";",
"}",
"else",
"{",
"if",
"(",
"Dom",
".",
"isIE",
"(",
")",
")",
"{",
"return",
"Dom",
".",
"createElement",
"(",
"ns",
"+",
"\":\"",
"+",
"tag",
")",
";",
"}",
"else",
"{",
"return",
"createNameSpaceElement",
"(",
"ns",
",",
"tag",
")",
";",
"}",
"}",
"}"
] |
<p>
Creates a new DOM element in the given name-space. If the name-space is HTML, a normal element will be created.
</p>
<p>
There is an exception when using Internet Explorer! For Internet Explorer a new element will be created of type
"namespace:tag".
</p>
@param ns
The name-space to be used in the element creation.
@param tag
The tag-name to be used in the element creation.
@return Returns a newly created DOM element in the given name-space.
|
[
"<p",
">",
"Creates",
"a",
"new",
"DOM",
"element",
"in",
"the",
"given",
"name",
"-",
"space",
".",
"If",
"the",
"name",
"-",
"space",
"is",
"HTML",
"a",
"normal",
"element",
"will",
"be",
"created",
".",
"<",
"/",
"p",
">",
"<p",
">",
"There",
"is",
"an",
"exception",
"when",
"using",
"Internet",
"Explorer!",
"For",
"Internet",
"Explorer",
"a",
"new",
"element",
"will",
"be",
"created",
"of",
"type",
"namespace",
":",
"tag",
".",
"<",
"/",
"p",
">"
] |
train
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/gfx/VectorTileObject.java#L134-L144
|
jmapper-framework/jmapper-core
|
JMapper Framework/src/main/java/com/googlecode/jmapper/cache/JMapperCache.java
|
JMapperCache.getRelationalMapper
|
public static <T> IRelationalJMapper<T> getRelationalMapper(final Class<T> configuredClass) {
"""
Returns an instance of RelationalJMapper from cache if exists, in alternative a new instance.
<br>Takes in input only the annotated Class
@param configuredClass configured class
@param <T> Mapped class type
@return the mapper instance
"""
return getRelationalMapper(configuredClass, undefinedXML());
}
|
java
|
public static <T> IRelationalJMapper<T> getRelationalMapper(final Class<T> configuredClass){
return getRelationalMapper(configuredClass, undefinedXML());
}
|
[
"public",
"static",
"<",
"T",
">",
"IRelationalJMapper",
"<",
"T",
">",
"getRelationalMapper",
"(",
"final",
"Class",
"<",
"T",
">",
"configuredClass",
")",
"{",
"return",
"getRelationalMapper",
"(",
"configuredClass",
",",
"undefinedXML",
"(",
")",
")",
";",
"}"
] |
Returns an instance of RelationalJMapper from cache if exists, in alternative a new instance.
<br>Takes in input only the annotated Class
@param configuredClass configured class
@param <T> Mapped class type
@return the mapper instance
|
[
"Returns",
"an",
"instance",
"of",
"RelationalJMapper",
"from",
"cache",
"if",
"exists",
"in",
"alternative",
"a",
"new",
"instance",
".",
"<br",
">",
"Takes",
"in",
"input",
"only",
"the",
"annotated",
"Class"
] |
train
|
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/cache/JMapperCache.java#L154-L156
|
line/armeria
|
core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java
|
DocServiceBuilder.exampleHttpHeaders
|
public DocServiceBuilder exampleHttpHeaders(String serviceName, String methodName,
Iterable<? extends HttpHeaders> exampleHttpHeaders) {
"""
Adds the example {@link HttpHeaders} for the method with the specified service and method name.
"""
requireNonNull(serviceName, "serviceName");
checkArgument(!serviceName.isEmpty(), "serviceName is empty.");
requireNonNull(methodName, "methodName");
checkArgument(!methodName.isEmpty(), "methodName is empty.");
requireNonNull(exampleHttpHeaders, "exampleHttpHeaders");
return exampleHttpHeaders0(serviceName, methodName, exampleHttpHeaders);
}
|
java
|
public DocServiceBuilder exampleHttpHeaders(String serviceName, String methodName,
Iterable<? extends HttpHeaders> exampleHttpHeaders) {
requireNonNull(serviceName, "serviceName");
checkArgument(!serviceName.isEmpty(), "serviceName is empty.");
requireNonNull(methodName, "methodName");
checkArgument(!methodName.isEmpty(), "methodName is empty.");
requireNonNull(exampleHttpHeaders, "exampleHttpHeaders");
return exampleHttpHeaders0(serviceName, methodName, exampleHttpHeaders);
}
|
[
"public",
"DocServiceBuilder",
"exampleHttpHeaders",
"(",
"String",
"serviceName",
",",
"String",
"methodName",
",",
"Iterable",
"<",
"?",
"extends",
"HttpHeaders",
">",
"exampleHttpHeaders",
")",
"{",
"requireNonNull",
"(",
"serviceName",
",",
"\"serviceName\"",
")",
";",
"checkArgument",
"(",
"!",
"serviceName",
".",
"isEmpty",
"(",
")",
",",
"\"serviceName is empty.\"",
")",
";",
"requireNonNull",
"(",
"methodName",
",",
"\"methodName\"",
")",
";",
"checkArgument",
"(",
"!",
"methodName",
".",
"isEmpty",
"(",
")",
",",
"\"methodName is empty.\"",
")",
";",
"requireNonNull",
"(",
"exampleHttpHeaders",
",",
"\"exampleHttpHeaders\"",
")",
";",
"return",
"exampleHttpHeaders0",
"(",
"serviceName",
",",
"methodName",
",",
"exampleHttpHeaders",
")",
";",
"}"
] |
Adds the example {@link HttpHeaders} for the method with the specified service and method name.
|
[
"Adds",
"the",
"example",
"{"
] |
train
|
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java#L159-L167
|
wigforss/Ka-Commons-Reflection
|
src/main/java/org/kasource/commons/reflection/annotation/cglib/AnnotationMethodInterceptor.java
|
AnnotationMethodInterceptor.attributeEquals
|
private boolean attributeEquals(Object value, Object otherValue) {
"""
Returns true if two attributes are equal.
@param value First attribute value
@param otherValue Second attribute value
@return true if two attributes are equal.
"""
if (value == null && otherValue == null) {
return true;
} else if (value == null || otherValue == null) {
return false;
} else {
if (value.getClass().isArray()) {
return Arrays.equals((Object[]) value, (Object[]) otherValue);
} else {
return value.equals(otherValue);
}
}
}
|
java
|
private boolean attributeEquals(Object value, Object otherValue) {
if (value == null && otherValue == null) {
return true;
} else if (value == null || otherValue == null) {
return false;
} else {
if (value.getClass().isArray()) {
return Arrays.equals((Object[]) value, (Object[]) otherValue);
} else {
return value.equals(otherValue);
}
}
}
|
[
"private",
"boolean",
"attributeEquals",
"(",
"Object",
"value",
",",
"Object",
"otherValue",
")",
"{",
"if",
"(",
"value",
"==",
"null",
"&&",
"otherValue",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"value",
"==",
"null",
"||",
"otherValue",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"if",
"(",
"value",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"Arrays",
".",
"equals",
"(",
"(",
"Object",
"[",
"]",
")",
"value",
",",
"(",
"Object",
"[",
"]",
")",
"otherValue",
")",
";",
"}",
"else",
"{",
"return",
"value",
".",
"equals",
"(",
"otherValue",
")",
";",
"}",
"}",
"}"
] |
Returns true if two attributes are equal.
@param value First attribute value
@param otherValue Second attribute value
@return true if two attributes are equal.
|
[
"Returns",
"true",
"if",
"two",
"attributes",
"are",
"equal",
"."
] |
train
|
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/annotation/cglib/AnnotationMethodInterceptor.java#L98-L111
|
schallee/alib4j
|
osgi/core/src/main/java/net/darkmist/alib/osgi/MiscUtil.java
|
MiscUtil.contains
|
public static <T> boolean contains(T needle, T...hayStack) {
"""
Does an array contain a value.
@param needle The value to look for. This can be null.
@param hayStack The array to look for the value in.
@return true if the value was found in the array. false if it was not or hayStack was null.
"""
if(needle == null)
return containsNull(hayStack);
if(hayStack == null)
return false;
for(T hay : hayStack)
if(needle.equals(hay))
return true;
return false;
}
|
java
|
public static <T> boolean contains(T needle, T...hayStack)
{
if(needle == null)
return containsNull(hayStack);
if(hayStack == null)
return false;
for(T hay : hayStack)
if(needle.equals(hay))
return true;
return false;
}
|
[
"public",
"static",
"<",
"T",
">",
"boolean",
"contains",
"(",
"T",
"needle",
",",
"T",
"...",
"hayStack",
")",
"{",
"if",
"(",
"needle",
"==",
"null",
")",
"return",
"containsNull",
"(",
"hayStack",
")",
";",
"if",
"(",
"hayStack",
"==",
"null",
")",
"return",
"false",
";",
"for",
"(",
"T",
"hay",
":",
"hayStack",
")",
"if",
"(",
"needle",
".",
"equals",
"(",
"hay",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] |
Does an array contain a value.
@param needle The value to look for. This can be null.
@param hayStack The array to look for the value in.
@return true if the value was found in the array. false if it was not or hayStack was null.
|
[
"Does",
"an",
"array",
"contain",
"a",
"value",
"."
] |
train
|
https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/osgi/core/src/main/java/net/darkmist/alib/osgi/MiscUtil.java#L39-L49
|
OpenLiberty/open-liberty
|
dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/main/LibertyTracePreprocessInstrumentation.java
|
LibertyTracePreprocessInstrumentation.getClassNode
|
private ClassNode getClassNode(InputStream inputStream, int flags) {
"""
Read an input stream to populate a {@code ClassNode}.
@param inputStream the input stream containing the byte code
@param flags flags to pass to the class reader
@return the {@code ClassNode} or {@code null} if an error ocurred
"""
ClassNode cn = new ClassNode();
try {
ClassReader reader = new ClassReader(inputStream);
reader.accept(cn, flags);
inputStream.close();
} catch (IOException e) {
cn = null;
}
return cn;
}
|
java
|
private ClassNode getClassNode(InputStream inputStream, int flags) {
ClassNode cn = new ClassNode();
try {
ClassReader reader = new ClassReader(inputStream);
reader.accept(cn, flags);
inputStream.close();
} catch (IOException e) {
cn = null;
}
return cn;
}
|
[
"private",
"ClassNode",
"getClassNode",
"(",
"InputStream",
"inputStream",
",",
"int",
"flags",
")",
"{",
"ClassNode",
"cn",
"=",
"new",
"ClassNode",
"(",
")",
";",
"try",
"{",
"ClassReader",
"reader",
"=",
"new",
"ClassReader",
"(",
"inputStream",
")",
";",
"reader",
".",
"accept",
"(",
"cn",
",",
"flags",
")",
";",
"inputStream",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"cn",
"=",
"null",
";",
"}",
"return",
"cn",
";",
"}"
] |
Read an input stream to populate a {@code ClassNode}.
@param inputStream the input stream containing the byte code
@param flags flags to pass to the class reader
@return the {@code ClassNode} or {@code null} if an error ocurred
|
[
"Read",
"an",
"input",
"stream",
"to",
"populate",
"a",
"{",
"@code",
"ClassNode",
"}",
"."
] |
train
|
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/main/LibertyTracePreprocessInstrumentation.java#L593-L603
|
greatman/craftconomy3
|
src/main/java/com/greatmancode/craftconomy3/currency/Currency.java
|
Currency.setExchangeRate
|
public void setExchangeRate(Currency otherCurrency, double amount) {
"""
Set the exchange rate between 2 currency
@param otherCurrency The other currency
@param amount THe exchange rate.
"""
Common.getInstance().getStorageHandler().getStorageEngine().setExchangeRate(this, otherCurrency, amount);
}
|
java
|
public void setExchangeRate(Currency otherCurrency, double amount) {
Common.getInstance().getStorageHandler().getStorageEngine().setExchangeRate(this, otherCurrency, amount);
}
|
[
"public",
"void",
"setExchangeRate",
"(",
"Currency",
"otherCurrency",
",",
"double",
"amount",
")",
"{",
"Common",
".",
"getInstance",
"(",
")",
".",
"getStorageHandler",
"(",
")",
".",
"getStorageEngine",
"(",
")",
".",
"setExchangeRate",
"(",
"this",
",",
"otherCurrency",
",",
"amount",
")",
";",
"}"
] |
Set the exchange rate between 2 currency
@param otherCurrency The other currency
@param amount THe exchange rate.
|
[
"Set",
"the",
"exchange",
"rate",
"between",
"2",
"currency"
] |
train
|
https://github.com/greatman/craftconomy3/blob/51b1b3de7d039e20c7418d1e70b8c4b02b8cf840/src/main/java/com/greatmancode/craftconomy3/currency/Currency.java#L176-L178
|
jcuda/jcusparse
|
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
|
JCusparse.cusparseSaxpyi
|
public static int cusparseSaxpyi(
cusparseHandle handle,
int nnz,
Pointer alpha,
Pointer xVal,
Pointer xInd,
Pointer y,
int idxBase) {
"""
Description: Addition of a scalar multiple of a sparse vector x
and a dense vector y.
"""
return checkResult(cusparseSaxpyiNative(handle, nnz, alpha, xVal, xInd, y, idxBase));
}
|
java
|
public static int cusparseSaxpyi(
cusparseHandle handle,
int nnz,
Pointer alpha,
Pointer xVal,
Pointer xInd,
Pointer y,
int idxBase)
{
return checkResult(cusparseSaxpyiNative(handle, nnz, alpha, xVal, xInd, y, idxBase));
}
|
[
"public",
"static",
"int",
"cusparseSaxpyi",
"(",
"cusparseHandle",
"handle",
",",
"int",
"nnz",
",",
"Pointer",
"alpha",
",",
"Pointer",
"xVal",
",",
"Pointer",
"xInd",
",",
"Pointer",
"y",
",",
"int",
"idxBase",
")",
"{",
"return",
"checkResult",
"(",
"cusparseSaxpyiNative",
"(",
"handle",
",",
"nnz",
",",
"alpha",
",",
"xVal",
",",
"xInd",
",",
"y",
",",
"idxBase",
")",
")",
";",
"}"
] |
Description: Addition of a scalar multiple of a sparse vector x
and a dense vector y.
|
[
"Description",
":",
"Addition",
"of",
"a",
"scalar",
"multiple",
"of",
"a",
"sparse",
"vector",
"x",
"and",
"a",
"dense",
"vector",
"y",
"."
] |
train
|
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L641-L651
|
h2oai/h2o-3
|
h2o-parsers/h2o-parquet-parser/src/main/java/water/parser/parquet/ParquetParser.java
|
ParquetParser.correctTypeConversions
|
public static byte[] correctTypeConversions(ByteVec vec, byte[] requestedTypes) {
"""
Overrides unsupported type conversions/mappings specified by the user.
@param vec byte vec holding bin\ary parquet data
@param requestedTypes user-specified target types
@return corrected types
"""
byte[] metadataBytes = VecParquetReader.readFooterAsBytes(vec);
ParquetMetadata metadata = VecParquetReader.readFooter(metadataBytes, ParquetMetadataConverter.NO_FILTER);
byte[] roughTypes = roughGuessTypes(metadata.getFileMetaData().getSchema());
return correctTypeConversions(roughTypes, requestedTypes);
}
|
java
|
public static byte[] correctTypeConversions(ByteVec vec, byte[] requestedTypes) {
byte[] metadataBytes = VecParquetReader.readFooterAsBytes(vec);
ParquetMetadata metadata = VecParquetReader.readFooter(metadataBytes, ParquetMetadataConverter.NO_FILTER);
byte[] roughTypes = roughGuessTypes(metadata.getFileMetaData().getSchema());
return correctTypeConversions(roughTypes, requestedTypes);
}
|
[
"public",
"static",
"byte",
"[",
"]",
"correctTypeConversions",
"(",
"ByteVec",
"vec",
",",
"byte",
"[",
"]",
"requestedTypes",
")",
"{",
"byte",
"[",
"]",
"metadataBytes",
"=",
"VecParquetReader",
".",
"readFooterAsBytes",
"(",
"vec",
")",
";",
"ParquetMetadata",
"metadata",
"=",
"VecParquetReader",
".",
"readFooter",
"(",
"metadataBytes",
",",
"ParquetMetadataConverter",
".",
"NO_FILTER",
")",
";",
"byte",
"[",
"]",
"roughTypes",
"=",
"roughGuessTypes",
"(",
"metadata",
".",
"getFileMetaData",
"(",
")",
".",
"getSchema",
"(",
")",
")",
";",
"return",
"correctTypeConversions",
"(",
"roughTypes",
",",
"requestedTypes",
")",
";",
"}"
] |
Overrides unsupported type conversions/mappings specified by the user.
@param vec byte vec holding bin\ary parquet data
@param requestedTypes user-specified target types
@return corrected types
|
[
"Overrides",
"unsupported",
"type",
"conversions",
"/",
"mappings",
"specified",
"by",
"the",
"user",
"."
] |
train
|
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-parsers/h2o-parquet-parser/src/main/java/water/parser/parquet/ParquetParser.java#L145-L150
|
raydac/java-binary-block-parser
|
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java
|
JBBPDslBuilder.ShortArray
|
public JBBPDslBuilder ShortArray(final String name, final String sizeExpression) {
"""
Add named fixed signed short array which size calculated through expression.
@param name name of the field, if null then anonymous
@param sizeExpression expression to be used to calculate size, must not be null
@return the builder instance, must not be null
"""
final Item item = new Item(BinType.SHORT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
}
|
java
|
public JBBPDslBuilder ShortArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.SHORT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
}
|
[
"public",
"JBBPDslBuilder",
"ShortArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"SHORT_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] |
Add named fixed signed short array which size calculated through expression.
@param name name of the field, if null then anonymous
@param sizeExpression expression to be used to calculate size, must not be null
@return the builder instance, must not be null
|
[
"Add",
"named",
"fixed",
"signed",
"short",
"array",
"which",
"size",
"calculated",
"through",
"expression",
"."
] |
train
|
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1003-L1008
|
line/armeria
|
core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java
|
ServerBuilder.annotatedService
|
public ServerBuilder annotatedService(String pathPrefix, Object service,
Object... exceptionHandlersAndConverters) {
"""
Binds the specified annotated service object under the specified path prefix.
@param exceptionHandlersAndConverters instances of {@link ExceptionHandlerFunction},
{@link RequestConverterFunction} and/or
{@link ResponseConverterFunction}
"""
return annotatedService(pathPrefix, service, Function.identity(),
ImmutableList.copyOf(requireNonNull(exceptionHandlersAndConverters,
"exceptionHandlersAndConverters")));
}
|
java
|
public ServerBuilder annotatedService(String pathPrefix, Object service,
Object... exceptionHandlersAndConverters) {
return annotatedService(pathPrefix, service, Function.identity(),
ImmutableList.copyOf(requireNonNull(exceptionHandlersAndConverters,
"exceptionHandlersAndConverters")));
}
|
[
"public",
"ServerBuilder",
"annotatedService",
"(",
"String",
"pathPrefix",
",",
"Object",
"service",
",",
"Object",
"...",
"exceptionHandlersAndConverters",
")",
"{",
"return",
"annotatedService",
"(",
"pathPrefix",
",",
"service",
",",
"Function",
".",
"identity",
"(",
")",
",",
"ImmutableList",
".",
"copyOf",
"(",
"requireNonNull",
"(",
"exceptionHandlersAndConverters",
",",
"\"exceptionHandlersAndConverters\"",
")",
")",
")",
";",
"}"
] |
Binds the specified annotated service object under the specified path prefix.
@param exceptionHandlersAndConverters instances of {@link ExceptionHandlerFunction},
{@link RequestConverterFunction} and/or
{@link ResponseConverterFunction}
|
[
"Binds",
"the",
"specified",
"annotated",
"service",
"object",
"under",
"the",
"specified",
"path",
"prefix",
"."
] |
train
|
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java#L1036-L1041
|
apache/incubator-gobblin
|
gobblin-utility/src/main/java/org/apache/gobblin/util/TimeRangeChecker.java
|
TimeRangeChecker.isTimeInRange
|
public static boolean isTimeInRange(List<String> days, String startTimeStr, String endTimeStr, DateTime currentTime) {
"""
Checks if a specified time is on a day that is specified the a given {@link List} of acceptable days, and that the
hours + minutes of the specified time fall into a range defined by startTimeStr and endTimeStr.
@param days is a {@link List} of days, if the specified {@link DateTime} does not have a day that falls is in this
{@link List} then this method will return false.
@param startTimeStr defines the start range that the currentTime can fall into. This {@link String} should be of
the pattern defined by {@link #HOUR_MINUTE_FORMAT}.
@param endTimeStr defines the start range that the currentTime can fall into. This {@link String} should be of
the pattern defined by {@link #HOUR_MINUTE_FORMAT}.
@param currentTime is a {@link DateTime} for which this method will check if it is in the given {@link List} of
days and falls into the time range defined by startTimeStr and endTimeStr.
@return true if the given time is in the defined range, false otherwise.
"""
if (!Iterables.any(days, new AreDaysEqual(DAYS_OF_WEEK.get(currentTime.getDayOfWeek())))) {
return false;
}
DateTime startTime = null;
DateTime endTime = null;
try {
startTime = HOUR_MINUTE_FORMATTER.withZone(DATE_TIME_ZONE).parseDateTime(startTimeStr);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("startTimeStr format is invalid, must be of format " + HOUR_MINUTE_FORMAT, e);
}
try {
endTime = HOUR_MINUTE_FORMATTER.withZone(DATE_TIME_ZONE).parseDateTime(endTimeStr);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("endTimeStr format is invalid, must be of format " + HOUR_MINUTE_FORMAT, e);
}
startTime = startTime.withDate(currentTime.getYear(), currentTime.getMonthOfYear(), currentTime.getDayOfMonth());
endTime = endTime.withDate(currentTime.getYear(), currentTime.getMonthOfYear(), currentTime.getDayOfMonth());
Interval interval = new Interval(startTime.getMillis(), endTime.getMillis(), DATE_TIME_ZONE);
return interval.contains(currentTime.getMillis());
}
|
java
|
public static boolean isTimeInRange(List<String> days, String startTimeStr, String endTimeStr, DateTime currentTime) {
if (!Iterables.any(days, new AreDaysEqual(DAYS_OF_WEEK.get(currentTime.getDayOfWeek())))) {
return false;
}
DateTime startTime = null;
DateTime endTime = null;
try {
startTime = HOUR_MINUTE_FORMATTER.withZone(DATE_TIME_ZONE).parseDateTime(startTimeStr);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("startTimeStr format is invalid, must be of format " + HOUR_MINUTE_FORMAT, e);
}
try {
endTime = HOUR_MINUTE_FORMATTER.withZone(DATE_TIME_ZONE).parseDateTime(endTimeStr);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("endTimeStr format is invalid, must be of format " + HOUR_MINUTE_FORMAT, e);
}
startTime = startTime.withDate(currentTime.getYear(), currentTime.getMonthOfYear(), currentTime.getDayOfMonth());
endTime = endTime.withDate(currentTime.getYear(), currentTime.getMonthOfYear(), currentTime.getDayOfMonth());
Interval interval = new Interval(startTime.getMillis(), endTime.getMillis(), DATE_TIME_ZONE);
return interval.contains(currentTime.getMillis());
}
|
[
"public",
"static",
"boolean",
"isTimeInRange",
"(",
"List",
"<",
"String",
">",
"days",
",",
"String",
"startTimeStr",
",",
"String",
"endTimeStr",
",",
"DateTime",
"currentTime",
")",
"{",
"if",
"(",
"!",
"Iterables",
".",
"any",
"(",
"days",
",",
"new",
"AreDaysEqual",
"(",
"DAYS_OF_WEEK",
".",
"get",
"(",
"currentTime",
".",
"getDayOfWeek",
"(",
")",
")",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"DateTime",
"startTime",
"=",
"null",
";",
"DateTime",
"endTime",
"=",
"null",
";",
"try",
"{",
"startTime",
"=",
"HOUR_MINUTE_FORMATTER",
".",
"withZone",
"(",
"DATE_TIME_ZONE",
")",
".",
"parseDateTime",
"(",
"startTimeStr",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"startTimeStr format is invalid, must be of format \"",
"+",
"HOUR_MINUTE_FORMAT",
",",
"e",
")",
";",
"}",
"try",
"{",
"endTime",
"=",
"HOUR_MINUTE_FORMATTER",
".",
"withZone",
"(",
"DATE_TIME_ZONE",
")",
".",
"parseDateTime",
"(",
"endTimeStr",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"endTimeStr format is invalid, must be of format \"",
"+",
"HOUR_MINUTE_FORMAT",
",",
"e",
")",
";",
"}",
"startTime",
"=",
"startTime",
".",
"withDate",
"(",
"currentTime",
".",
"getYear",
"(",
")",
",",
"currentTime",
".",
"getMonthOfYear",
"(",
")",
",",
"currentTime",
".",
"getDayOfMonth",
"(",
")",
")",
";",
"endTime",
"=",
"endTime",
".",
"withDate",
"(",
"currentTime",
".",
"getYear",
"(",
")",
",",
"currentTime",
".",
"getMonthOfYear",
"(",
")",
",",
"currentTime",
".",
"getDayOfMonth",
"(",
")",
")",
";",
"Interval",
"interval",
"=",
"new",
"Interval",
"(",
"startTime",
".",
"getMillis",
"(",
")",
",",
"endTime",
".",
"getMillis",
"(",
")",
",",
"DATE_TIME_ZONE",
")",
";",
"return",
"interval",
".",
"contains",
"(",
"currentTime",
".",
"getMillis",
"(",
")",
")",
";",
"}"
] |
Checks if a specified time is on a day that is specified the a given {@link List} of acceptable days, and that the
hours + minutes of the specified time fall into a range defined by startTimeStr and endTimeStr.
@param days is a {@link List} of days, if the specified {@link DateTime} does not have a day that falls is in this
{@link List} then this method will return false.
@param startTimeStr defines the start range that the currentTime can fall into. This {@link String} should be of
the pattern defined by {@link #HOUR_MINUTE_FORMAT}.
@param endTimeStr defines the start range that the currentTime can fall into. This {@link String} should be of
the pattern defined by {@link #HOUR_MINUTE_FORMAT}.
@param currentTime is a {@link DateTime} for which this method will check if it is in the given {@link List} of
days and falls into the time range defined by startTimeStr and endTimeStr.
@return true if the given time is in the defined range, false otherwise.
|
[
"Checks",
"if",
"a",
"specified",
"time",
"is",
"on",
"a",
"day",
"that",
"is",
"specified",
"the",
"a",
"given",
"{",
"@link",
"List",
"}",
"of",
"acceptable",
"days",
"and",
"that",
"the",
"hours",
"+",
"minutes",
"of",
"the",
"specified",
"time",
"fall",
"into",
"a",
"range",
"defined",
"by",
"startTimeStr",
"and",
"endTimeStr",
"."
] |
train
|
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/TimeRangeChecker.java#L70-L96
|
vigna/Sux4J
|
src/it/unimi/dsi/sux4j/mph/HypergraphSorter.java
|
HypergraphSorter.generateAndSort
|
public boolean generateAndSort(final Iterator<? extends T> iterator, final TransformationStrategy<? super T> transform, final long seed) {
"""
Generates a random 3-hypergraph and tries to sort its edges.
@param iterator an iterator returning {@link #numEdges} keys.
@param transform a transformation from keys to bit vectors.
@param seed a 64-bit random seed.
@return true if the sorting procedure succeeded.
"""
// We cache all variables for faster access
final int[] d = this.d;
final int[] e = new int[3];
cleanUpIfNecessary();
/* We build the XOR'd edge list and compute the degree of each vertex. */
for(int k = 0; k < numEdges; k++) {
bitVectorToEdge(transform.toBitVector(iterator.next()), seed, numVertices, partSize, e);
xorEdge(k, e[0], e[1], e[2], false);
d[e[0]]++;
d[e[1]]++;
d[e[2]]++;
}
if (iterator.hasNext()) throw new IllegalStateException("This " + HypergraphSorter.class.getSimpleName() + " has " + numEdges + " edges, but the provided iterator returns more");
return sort();
}
|
java
|
public boolean generateAndSort(final Iterator<? extends T> iterator, final TransformationStrategy<? super T> transform, final long seed) {
// We cache all variables for faster access
final int[] d = this.d;
final int[] e = new int[3];
cleanUpIfNecessary();
/* We build the XOR'd edge list and compute the degree of each vertex. */
for(int k = 0; k < numEdges; k++) {
bitVectorToEdge(transform.toBitVector(iterator.next()), seed, numVertices, partSize, e);
xorEdge(k, e[0], e[1], e[2], false);
d[e[0]]++;
d[e[1]]++;
d[e[2]]++;
}
if (iterator.hasNext()) throw new IllegalStateException("This " + HypergraphSorter.class.getSimpleName() + " has " + numEdges + " edges, but the provided iterator returns more");
return sort();
}
|
[
"public",
"boolean",
"generateAndSort",
"(",
"final",
"Iterator",
"<",
"?",
"extends",
"T",
">",
"iterator",
",",
"final",
"TransformationStrategy",
"<",
"?",
"super",
"T",
">",
"transform",
",",
"final",
"long",
"seed",
")",
"{",
"// We cache all variables for faster access",
"final",
"int",
"[",
"]",
"d",
"=",
"this",
".",
"d",
";",
"final",
"int",
"[",
"]",
"e",
"=",
"new",
"int",
"[",
"3",
"]",
";",
"cleanUpIfNecessary",
"(",
")",
";",
"/* We build the XOR'd edge list and compute the degree of each vertex. */",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"numEdges",
";",
"k",
"++",
")",
"{",
"bitVectorToEdge",
"(",
"transform",
".",
"toBitVector",
"(",
"iterator",
".",
"next",
"(",
")",
")",
",",
"seed",
",",
"numVertices",
",",
"partSize",
",",
"e",
")",
";",
"xorEdge",
"(",
"k",
",",
"e",
"[",
"0",
"]",
",",
"e",
"[",
"1",
"]",
",",
"e",
"[",
"2",
"]",
",",
"false",
")",
";",
"d",
"[",
"e",
"[",
"0",
"]",
"]",
"++",
";",
"d",
"[",
"e",
"[",
"1",
"]",
"]",
"++",
";",
"d",
"[",
"e",
"[",
"2",
"]",
"]",
"++",
";",
"}",
"if",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"This \"",
"+",
"HypergraphSorter",
".",
"class",
".",
"getSimpleName",
"(",
")",
"+",
"\" has \"",
"+",
"numEdges",
"+",
"\" edges, but the provided iterator returns more\"",
")",
";",
"return",
"sort",
"(",
")",
";",
"}"
] |
Generates a random 3-hypergraph and tries to sort its edges.
@param iterator an iterator returning {@link #numEdges} keys.
@param transform a transformation from keys to bit vectors.
@param seed a 64-bit random seed.
@return true if the sorting procedure succeeded.
|
[
"Generates",
"a",
"random",
"3",
"-",
"hypergraph",
"and",
"tries",
"to",
"sort",
"its",
"edges",
"."
] |
train
|
https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/HypergraphSorter.java#L312-L330
|
gallandarakhneorg/afc
|
advanced/gis/gisroadfx/src/main/java/org/arakhne/afc/gis/road/ui/drawers/RoadPolylineDrawer.java
|
RoadPolylineDrawer.setupRoadInterior
|
protected void setupRoadInterior(ZoomableGraphicsContext gc, RoadPolyline element) {
"""
Setup for drawing the road interior.
@param gc the graphics context.
@param element the element to draw.
"""
final Color color;
if (isSelected(element)) {
color = gc.rgb(SELECTED_ROAD_COLOR);
} else {
color = gc.rgb(ROAD_COLOR);
}
gc.setStroke(color);
if (element.isWidePolyline()) {
gc.setLineWidthInMeters(element.getWidth());
} else {
gc.setLineWidthInPixels(1);
}
}
|
java
|
protected void setupRoadInterior(ZoomableGraphicsContext gc, RoadPolyline element) {
final Color color;
if (isSelected(element)) {
color = gc.rgb(SELECTED_ROAD_COLOR);
} else {
color = gc.rgb(ROAD_COLOR);
}
gc.setStroke(color);
if (element.isWidePolyline()) {
gc.setLineWidthInMeters(element.getWidth());
} else {
gc.setLineWidthInPixels(1);
}
}
|
[
"protected",
"void",
"setupRoadInterior",
"(",
"ZoomableGraphicsContext",
"gc",
",",
"RoadPolyline",
"element",
")",
"{",
"final",
"Color",
"color",
";",
"if",
"(",
"isSelected",
"(",
"element",
")",
")",
"{",
"color",
"=",
"gc",
".",
"rgb",
"(",
"SELECTED_ROAD_COLOR",
")",
";",
"}",
"else",
"{",
"color",
"=",
"gc",
".",
"rgb",
"(",
"ROAD_COLOR",
")",
";",
"}",
"gc",
".",
"setStroke",
"(",
"color",
")",
";",
"if",
"(",
"element",
".",
"isWidePolyline",
"(",
")",
")",
"{",
"gc",
".",
"setLineWidthInMeters",
"(",
"element",
".",
"getWidth",
"(",
")",
")",
";",
"}",
"else",
"{",
"gc",
".",
"setLineWidthInPixels",
"(",
"1",
")",
";",
"}",
"}"
] |
Setup for drawing the road interior.
@param gc the graphics context.
@param element the element to draw.
|
[
"Setup",
"for",
"drawing",
"the",
"road",
"interior",
"."
] |
train
|
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroadfx/src/main/java/org/arakhne/afc/gis/road/ui/drawers/RoadPolylineDrawer.java#L103-L116
|
looly/hutool
|
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
|
FileUtil.writeMap
|
public static File writeMap(Map<?, ?> map, File file, Charset charset, String kvSeparator, boolean isAppend) throws IORuntimeException {
"""
将Map写入文件,每个键值对为一行,一行中键与值之间使用kvSeparator分隔
@param map Map
@param file 文件
@param charset 字符集编码
@param kvSeparator 键和值之间的分隔符,如果传入null使用默认分隔符" = "
@param isAppend 是否追加
@return 目标文件
@throws IORuntimeException IO异常
@since 4.0.5
"""
return FileWriter.create(file, charset).writeMap(map, kvSeparator, isAppend);
}
|
java
|
public static File writeMap(Map<?, ?> map, File file, Charset charset, String kvSeparator, boolean isAppend) throws IORuntimeException {
return FileWriter.create(file, charset).writeMap(map, kvSeparator, isAppend);
}
|
[
"public",
"static",
"File",
"writeMap",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"File",
"file",
",",
"Charset",
"charset",
",",
"String",
"kvSeparator",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileWriter",
".",
"create",
"(",
"file",
",",
"charset",
")",
".",
"writeMap",
"(",
"map",
",",
"kvSeparator",
",",
"isAppend",
")",
";",
"}"
] |
将Map写入文件,每个键值对为一行,一行中键与值之间使用kvSeparator分隔
@param map Map
@param file 文件
@param charset 字符集编码
@param kvSeparator 键和值之间的分隔符,如果传入null使用默认分隔符" = "
@param isAppend 是否追加
@return 目标文件
@throws IORuntimeException IO异常
@since 4.0.5
|
[
"将Map写入文件,每个键值对为一行,一行中键与值之间使用kvSeparator分隔"
] |
train
|
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3102-L3104
|
querydsl/querydsl
|
querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java
|
Expressions.timeTemplate
|
@Deprecated
public static <T extends Comparable<?>> TimeTemplate<T> timeTemplate(Class<? extends T> cl,
String template, ImmutableList<?> args) {
"""
Create a new Template expression
@deprecated Use {@link #timeTemplate(Class, String, List)} instead.
@param cl type of expression
@param template template
@param args template parameters
@return template expression
"""
return timeTemplate(cl, createTemplate(template), args);
}
|
java
|
@Deprecated
public static <T extends Comparable<?>> TimeTemplate<T> timeTemplate(Class<? extends T> cl,
String template, ImmutableList<?> args) {
return timeTemplate(cl, createTemplate(template), args);
}
|
[
"@",
"Deprecated",
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
">",
">",
"TimeTemplate",
"<",
"T",
">",
"timeTemplate",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"cl",
",",
"String",
"template",
",",
"ImmutableList",
"<",
"?",
">",
"args",
")",
"{",
"return",
"timeTemplate",
"(",
"cl",
",",
"createTemplate",
"(",
"template",
")",
",",
"args",
")",
";",
"}"
] |
Create a new Template expression
@deprecated Use {@link #timeTemplate(Class, String, List)} instead.
@param cl type of expression
@param template template
@param args template parameters
@return template expression
|
[
"Create",
"a",
"new",
"Template",
"expression"
] |
train
|
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L658-L662
|
wildfly/wildfly-core
|
deployment-repository/src/main/java/org/jboss/as/repository/HashUtil.java
|
HashUtil.hashPath
|
public static byte[] hashPath(MessageDigest messageDigest, Path path) throws IOException {
"""
Hashes a path, if the path points to a directory then hashes the contents recursively.
@param messageDigest the digest used to hash.
@param path the file/directory we want to hash.
@return the resulting hash.
@throws IOException
"""
try (InputStream in = getRecursiveContentStream(path)) {
return hashContent(messageDigest, in);
}
}
|
java
|
public static byte[] hashPath(MessageDigest messageDigest, Path path) throws IOException {
try (InputStream in = getRecursiveContentStream(path)) {
return hashContent(messageDigest, in);
}
}
|
[
"public",
"static",
"byte",
"[",
"]",
"hashPath",
"(",
"MessageDigest",
"messageDigest",
",",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputStream",
"in",
"=",
"getRecursiveContentStream",
"(",
"path",
")",
")",
"{",
"return",
"hashContent",
"(",
"messageDigest",
",",
"in",
")",
";",
"}",
"}"
] |
Hashes a path, if the path points to a directory then hashes the contents recursively.
@param messageDigest the digest used to hash.
@param path the file/directory we want to hash.
@return the resulting hash.
@throws IOException
|
[
"Hashes",
"a",
"path",
"if",
"the",
"path",
"points",
"to",
"a",
"directory",
"then",
"hashes",
"the",
"contents",
"recursively",
"."
] |
train
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-repository/src/main/java/org/jboss/as/repository/HashUtil.java#L111-L115
|
jayantk/jklol
|
src/com/jayantkrish/jklol/ccg/LexiconEntry.java
|
LexiconEntry.parseLexiconEntry
|
public static LexiconEntry parseLexiconEntry(String lexiconLine) {
"""
Parses a line of a CCG lexicon into a lexicon entry. The expected format is
a comma separated tuple:
<code>
(space delimited word list),(syntactic type),(list of variable assignments and unfilled semantic dependencies)
</code>
The final two components of the list represent the CCG category. Examples:
<code>
baseball player,N{0},0 baseball_player
in,((N{1}\N{1}){0}/N{2}){0},0 concept:locatedIn,concept:locatedIn 1 1,concept:locatedIn 2 2
</code>
@param lexiconLine
@return
"""
String[] parts = getCsvParser().parseLine(lexiconLine);
// Add the lexicon word sequence to the lexicon.
String wordPart = parts[0];
List<String> words = Lists.newArrayList();
String[] wordArray = wordPart.split(" ");
for (int i = 0; i < wordArray.length; i++) {
words.add(wordArray[i].intern());
}
CcgCategory category = CcgCategory.parseFrom(ArrayUtils.copyOfRange(parts, 1, parts.length));
return new LexiconEntry(words, category);
}
|
java
|
public static LexiconEntry parseLexiconEntry(String lexiconLine) {
String[] parts = getCsvParser().parseLine(lexiconLine);
// Add the lexicon word sequence to the lexicon.
String wordPart = parts[0];
List<String> words = Lists.newArrayList();
String[] wordArray = wordPart.split(" ");
for (int i = 0; i < wordArray.length; i++) {
words.add(wordArray[i].intern());
}
CcgCategory category = CcgCategory.parseFrom(ArrayUtils.copyOfRange(parts, 1, parts.length));
return new LexiconEntry(words, category);
}
|
[
"public",
"static",
"LexiconEntry",
"parseLexiconEntry",
"(",
"String",
"lexiconLine",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"getCsvParser",
"(",
")",
".",
"parseLine",
"(",
"lexiconLine",
")",
";",
"// Add the lexicon word sequence to the lexicon.",
"String",
"wordPart",
"=",
"parts",
"[",
"0",
"]",
";",
"List",
"<",
"String",
">",
"words",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"String",
"[",
"]",
"wordArray",
"=",
"wordPart",
".",
"split",
"(",
"\" \"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"wordArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"words",
".",
"add",
"(",
"wordArray",
"[",
"i",
"]",
".",
"intern",
"(",
")",
")",
";",
"}",
"CcgCategory",
"category",
"=",
"CcgCategory",
".",
"parseFrom",
"(",
"ArrayUtils",
".",
"copyOfRange",
"(",
"parts",
",",
"1",
",",
"parts",
".",
"length",
")",
")",
";",
"return",
"new",
"LexiconEntry",
"(",
"words",
",",
"category",
")",
";",
"}"
] |
Parses a line of a CCG lexicon into a lexicon entry. The expected format is
a comma separated tuple:
<code>
(space delimited word list),(syntactic type),(list of variable assignments and unfilled semantic dependencies)
</code>
The final two components of the list represent the CCG category. Examples:
<code>
baseball player,N{0},0 baseball_player
in,((N{1}\N{1}){0}/N{2}){0},0 concept:locatedIn,concept:locatedIn 1 1,concept:locatedIn 2 2
</code>
@param lexiconLine
@return
|
[
"Parses",
"a",
"line",
"of",
"a",
"CCG",
"lexicon",
"into",
"a",
"lexicon",
"entry",
".",
"The",
"expected",
"format",
"is",
"a",
"comma",
"separated",
"tuple",
":",
"<code",
">",
"(",
"space",
"delimited",
"word",
"list",
")",
"(",
"syntactic",
"type",
")",
"(",
"list",
"of",
"variable",
"assignments",
"and",
"unfilled",
"semantic",
"dependencies",
")",
"<",
"/",
"code",
">",
"The",
"final",
"two",
"components",
"of",
"the",
"list",
"represent",
"the",
"CCG",
"category",
".",
"Examples",
":",
"<code",
">",
"baseball",
"player",
"N",
"{",
"0",
"}",
"0",
"baseball_player",
"in",
"((",
"N",
"{",
"1",
"}",
"\\",
"N",
"{",
"1",
"}",
")",
"{",
"0",
"}",
"/",
"N",
"{",
"2",
"}",
")",
"{",
"0",
"}",
"0",
"concept",
":",
"locatedIn",
"concept",
":",
"locatedIn",
"1",
"1",
"concept",
":",
"locatedIn",
"2",
"2",
"<",
"/",
"code",
">"
] |
train
|
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/LexiconEntry.java#L54-L67
|
UrielCh/ovh-java-sdk
|
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
|
ApiOvhCloud.project_serviceName_quota_GET
|
public ArrayList<OvhQuotas> project_serviceName_quota_GET(String serviceName) throws IOException {
"""
Get project quotas
REST: GET /cloud/project/{serviceName}/quota
@param serviceName [required] Project id
"""
String qPath = "/cloud/project/{serviceName}/quota";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t16);
}
|
java
|
public ArrayList<OvhQuotas> project_serviceName_quota_GET(String serviceName) throws IOException {
String qPath = "/cloud/project/{serviceName}/quota";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t16);
}
|
[
"public",
"ArrayList",
"<",
"OvhQuotas",
">",
"project_serviceName_quota_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/quota\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t16",
")",
";",
"}"
] |
Get project quotas
REST: GET /cloud/project/{serviceName}/quota
@param serviceName [required] Project id
|
[
"Get",
"project",
"quotas"
] |
train
|
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1411-L1416
|
nguyenq/tess4j
|
src/main/java/net/sourceforge/tess4j/util/ImageIOHelper.java
|
ImageIOHelper.getIIOImageList
|
public static List<IIOImage> getIIOImageList(BufferedImage bi) throws IOException {
"""
Gets a list of <code>IIOImage</code> objects for a
<code>BufferedImage</code>.
@param bi input image
@return a list of <code>IIOImage</code> objects
@throws IOException
"""
List<IIOImage> iioImageList = new ArrayList<IIOImage>();
IIOImage oimage = new IIOImage(bi, null, null);
iioImageList.add(oimage);
return iioImageList;
}
|
java
|
public static List<IIOImage> getIIOImageList(BufferedImage bi) throws IOException {
List<IIOImage> iioImageList = new ArrayList<IIOImage>();
IIOImage oimage = new IIOImage(bi, null, null);
iioImageList.add(oimage);
return iioImageList;
}
|
[
"public",
"static",
"List",
"<",
"IIOImage",
">",
"getIIOImageList",
"(",
"BufferedImage",
"bi",
")",
"throws",
"IOException",
"{",
"List",
"<",
"IIOImage",
">",
"iioImageList",
"=",
"new",
"ArrayList",
"<",
"IIOImage",
">",
"(",
")",
";",
"IIOImage",
"oimage",
"=",
"new",
"IIOImage",
"(",
"bi",
",",
"null",
",",
"null",
")",
";",
"iioImageList",
".",
"add",
"(",
"oimage",
")",
";",
"return",
"iioImageList",
";",
"}"
] |
Gets a list of <code>IIOImage</code> objects for a
<code>BufferedImage</code>.
@param bi input image
@return a list of <code>IIOImage</code> objects
@throws IOException
|
[
"Gets",
"a",
"list",
"of",
"<code",
">",
"IIOImage<",
"/",
"code",
">",
"objects",
"for",
"a",
"<code",
">",
"BufferedImage<",
"/",
"code",
">",
"."
] |
train
|
https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/ImageIOHelper.java#L431-L436
|
facebookarchive/hadoop-20
|
src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyRaid.java
|
BlockPlacementPolicyRaid.getParityFile
|
private NameWithINode getParityFile(Codec codec, String src)
throws IOException {
"""
Get path for the parity file. Returns null if it does not exists
@param codec the codec of the parity file.
@return the toUri path of the parity file
"""
String parity;
if (codec.isDirRaid) {
String parent = getParentPath(src);
parity = codec.parityDirectory + parent;
} else {
parity = codec.parityDirectory + src;
}
byte[][] components = INodeDirectory.getPathComponents(parity);
INode parityInode = namesystem.dir.getINode(components);
if (parityInode == null)
return null;
return new NameWithINode(parity, parityInode);
}
|
java
|
private NameWithINode getParityFile(Codec codec, String src)
throws IOException {
String parity;
if (codec.isDirRaid) {
String parent = getParentPath(src);
parity = codec.parityDirectory + parent;
} else {
parity = codec.parityDirectory + src;
}
byte[][] components = INodeDirectory.getPathComponents(parity);
INode parityInode = namesystem.dir.getINode(components);
if (parityInode == null)
return null;
return new NameWithINode(parity, parityInode);
}
|
[
"private",
"NameWithINode",
"getParityFile",
"(",
"Codec",
"codec",
",",
"String",
"src",
")",
"throws",
"IOException",
"{",
"String",
"parity",
";",
"if",
"(",
"codec",
".",
"isDirRaid",
")",
"{",
"String",
"parent",
"=",
"getParentPath",
"(",
"src",
")",
";",
"parity",
"=",
"codec",
".",
"parityDirectory",
"+",
"parent",
";",
"}",
"else",
"{",
"parity",
"=",
"codec",
".",
"parityDirectory",
"+",
"src",
";",
"}",
"byte",
"[",
"]",
"[",
"]",
"components",
"=",
"INodeDirectory",
".",
"getPathComponents",
"(",
"parity",
")",
";",
"INode",
"parityInode",
"=",
"namesystem",
".",
"dir",
".",
"getINode",
"(",
"components",
")",
";",
"if",
"(",
"parityInode",
"==",
"null",
")",
"return",
"null",
";",
"return",
"new",
"NameWithINode",
"(",
"parity",
",",
"parityInode",
")",
";",
"}"
] |
Get path for the parity file. Returns null if it does not exists
@param codec the codec of the parity file.
@return the toUri path of the parity file
|
[
"Get",
"path",
"for",
"the",
"parity",
"file",
".",
"Returns",
"null",
"if",
"it",
"does",
"not",
"exists"
] |
train
|
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyRaid.java#L800-L814
|
Azure/azure-sdk-for-java
|
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkManagementClientImpl.java
|
NetworkManagementClientImpl.checkDnsNameAvailability
|
public DnsNameAvailabilityResultInner checkDnsNameAvailability(String location, String domainNameLabel) {
"""
Checks whether a domain name in the cloudapp.azure.com zone is available for use.
@param location The location of the domain name.
@param domainNameLabel The domain name to be verified. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DnsNameAvailabilityResultInner object if successful.
"""
return checkDnsNameAvailabilityWithServiceResponseAsync(location, domainNameLabel).toBlocking().single().body();
}
|
java
|
public DnsNameAvailabilityResultInner checkDnsNameAvailability(String location, String domainNameLabel) {
return checkDnsNameAvailabilityWithServiceResponseAsync(location, domainNameLabel).toBlocking().single().body();
}
|
[
"public",
"DnsNameAvailabilityResultInner",
"checkDnsNameAvailability",
"(",
"String",
"location",
",",
"String",
"domainNameLabel",
")",
"{",
"return",
"checkDnsNameAvailabilityWithServiceResponseAsync",
"(",
"location",
",",
"domainNameLabel",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Checks whether a domain name in the cloudapp.azure.com zone is available for use.
@param location The location of the domain name.
@param domainNameLabel The domain name to be verified. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DnsNameAvailabilityResultInner object if successful.
|
[
"Checks",
"whether",
"a",
"domain",
"name",
"in",
"the",
"cloudapp",
".",
"azure",
".",
"com",
"zone",
"is",
"available",
"for",
"use",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkManagementClientImpl.java#L1156-L1158
|
lessthanoptimal/BoofCV
|
main/boofcv-ip/src/main/java/boofcv/alg/interpolate/ImageLineIntegral.java
|
ImageLineIntegral.isInside
|
public boolean isInside( double x, double y ) {
"""
<p>
Return true if the coordinate is inside the image or false if not.<br>
0 ≤ x ≤ width<br>
0 ≤ y ≤ height
</p>
<p>Note: while the image is defined up to width and height, including coordinates up to that point contribute
nothing towards the line integral since they are infinitesimally small.</p>
@param x x-coordinate in pixel coordinates
@param y y-coordinate in pixel coordinates
@return true if inside or false if outside
"""
return x >= 0 && y >= 0 && x <= image.getWidth() && y <= image.getHeight();
}
|
java
|
public boolean isInside( double x, double y ) {
return x >= 0 && y >= 0 && x <= image.getWidth() && y <= image.getHeight();
}
|
[
"public",
"boolean",
"isInside",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"return",
"x",
">=",
"0",
"&&",
"y",
">=",
"0",
"&&",
"x",
"<=",
"image",
".",
"getWidth",
"(",
")",
"&&",
"y",
"<=",
"image",
".",
"getHeight",
"(",
")",
";",
"}"
] |
<p>
Return true if the coordinate is inside the image or false if not.<br>
0 ≤ x ≤ width<br>
0 ≤ y ≤ height
</p>
<p>Note: while the image is defined up to width and height, including coordinates up to that point contribute
nothing towards the line integral since they are infinitesimally small.</p>
@param x x-coordinate in pixel coordinates
@param y y-coordinate in pixel coordinates
@return true if inside or false if outside
|
[
"<p",
">",
"Return",
"true",
"if",
"the",
"coordinate",
"is",
"inside",
"the",
"image",
"or",
"false",
"if",
"not",
".",
"<br",
">",
"0",
"&le",
";",
"x",
"&le",
";",
"width<br",
">",
"0",
"&le",
";",
"y",
"&le",
";",
"height",
"<",
"/",
"p",
">",
"<p",
">",
"Note",
":",
"while",
"the",
"image",
"is",
"defined",
"up",
"to",
"width",
"and",
"height",
"including",
"coordinates",
"up",
"to",
"that",
"point",
"contribute",
"nothing",
"towards",
"the",
"line",
"integral",
"since",
"they",
"are",
"infinitesimally",
"small",
".",
"<",
"/",
"p",
">"
] |
train
|
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/interpolate/ImageLineIntegral.java#L185-L187
|
mapsforge/mapsforge
|
sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java
|
DatabaseUtils.getHexCollationKey
|
public static String getHexCollationKey(String name) {
"""
return the collation key in hex format
@param name
@return the collation key in hex format
"""
byte[] arr = getCollationKeyInBytes(name);
char[] keys = encodeHex(arr);
return new String(keys, 0, getKeyLen(arr) * 2);
}
|
java
|
public static String getHexCollationKey(String name) {
byte[] arr = getCollationKeyInBytes(name);
char[] keys = encodeHex(arr);
return new String(keys, 0, getKeyLen(arr) * 2);
}
|
[
"public",
"static",
"String",
"getHexCollationKey",
"(",
"String",
"name",
")",
"{",
"byte",
"[",
"]",
"arr",
"=",
"getCollationKeyInBytes",
"(",
"name",
")",
";",
"char",
"[",
"]",
"keys",
"=",
"encodeHex",
"(",
"arr",
")",
";",
"return",
"new",
"String",
"(",
"keys",
",",
"0",
",",
"getKeyLen",
"(",
"arr",
")",
"*",
"2",
")",
";",
"}"
] |
return the collation key in hex format
@param name
@return the collation key in hex format
|
[
"return",
"the",
"collation",
"key",
"in",
"hex",
"format"
] |
train
|
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L421-L425
|
Jasig/uPortal
|
uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java
|
AuthorizationImpl.getPermissionsForPrincipal
|
@Override
@RequestCache
public IPermission[] getPermissionsForPrincipal(
IAuthorizationPrincipal principal, String owner, String activity, String target)
throws AuthorizationException {
"""
Returns the <code>IPermissions</code> owner has granted this <code>Principal</code> for the
specified activity and target. Null parameters will be ignored, that is, all <code>
IPermissions</code> matching the non-null parameters are retrieved. So, <code>
getPermissions(principal,null, null, null)</code> should retrieve all <code>IPermissions
</code> for a <code>Principal</code>.
@return org.apereo.portal.security.IPermission[]
@param principal IAuthorizationPrincipal
@param owner java.lang.String
@param activity java.lang.String
@param target java.lang.String
@exception AuthorizationException indicates authorization information could not be retrieved.
"""
return primGetPermissionsForPrincipal(principal, owner, activity, target);
}
|
java
|
@Override
@RequestCache
public IPermission[] getPermissionsForPrincipal(
IAuthorizationPrincipal principal, String owner, String activity, String target)
throws AuthorizationException {
return primGetPermissionsForPrincipal(principal, owner, activity, target);
}
|
[
"@",
"Override",
"@",
"RequestCache",
"public",
"IPermission",
"[",
"]",
"getPermissionsForPrincipal",
"(",
"IAuthorizationPrincipal",
"principal",
",",
"String",
"owner",
",",
"String",
"activity",
",",
"String",
"target",
")",
"throws",
"AuthorizationException",
"{",
"return",
"primGetPermissionsForPrincipal",
"(",
"principal",
",",
"owner",
",",
"activity",
",",
"target",
")",
";",
"}"
] |
Returns the <code>IPermissions</code> owner has granted this <code>Principal</code> for the
specified activity and target. Null parameters will be ignored, that is, all <code>
IPermissions</code> matching the non-null parameters are retrieved. So, <code>
getPermissions(principal,null, null, null)</code> should retrieve all <code>IPermissions
</code> for a <code>Principal</code>.
@return org.apereo.portal.security.IPermission[]
@param principal IAuthorizationPrincipal
@param owner java.lang.String
@param activity java.lang.String
@param target java.lang.String
@exception AuthorizationException indicates authorization information could not be retrieved.
|
[
"Returns",
"the",
"<code",
">",
"IPermissions<",
"/",
"code",
">",
"owner",
"has",
"granted",
"this",
"<code",
">",
"Principal<",
"/",
"code",
">",
"for",
"the",
"specified",
"activity",
"and",
"target",
".",
"Null",
"parameters",
"will",
"be",
"ignored",
"that",
"is",
"all",
"<code",
">",
"IPermissions<",
"/",
"code",
">",
"matching",
"the",
"non",
"-",
"null",
"parameters",
"are",
"retrieved",
".",
"So",
"<code",
">",
"getPermissions",
"(",
"principal",
"null",
"null",
"null",
")",
"<",
"/",
"code",
">",
"should",
"retrieve",
"all",
"<code",
">",
"IPermissions",
"<",
"/",
"code",
">",
"for",
"a",
"<code",
">",
"Principal<",
"/",
"code",
">",
"."
] |
train
|
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java#L794-L800
|
UrielCh/ovh-java-sdk
|
ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java
|
ApiOvhVps.serviceName_openConsoleAccess_POST
|
public OvhVnc serviceName_openConsoleAccess_POST(String serviceName, OvhVncProtocolEnum protocol) throws IOException {
"""
Return the necessary informations to open a VNC connection to your VPS
REST: POST /vps/{serviceName}/openConsoleAccess
@param protocol [required] The console protocol you want
@param serviceName [required] The internal name of your VPS offer
"""
String qPath = "/vps/{serviceName}/openConsoleAccess";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "protocol", protocol);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhVnc.class);
}
|
java
|
public OvhVnc serviceName_openConsoleAccess_POST(String serviceName, OvhVncProtocolEnum protocol) throws IOException {
String qPath = "/vps/{serviceName}/openConsoleAccess";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "protocol", protocol);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhVnc.class);
}
|
[
"public",
"OvhVnc",
"serviceName_openConsoleAccess_POST",
"(",
"String",
"serviceName",
",",
"OvhVncProtocolEnum",
"protocol",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/vps/{serviceName}/openConsoleAccess\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"protocol\"",
",",
"protocol",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhVnc",
".",
"class",
")",
";",
"}"
] |
Return the necessary informations to open a VNC connection to your VPS
REST: POST /vps/{serviceName}/openConsoleAccess
@param protocol [required] The console protocol you want
@param serviceName [required] The internal name of your VPS offer
|
[
"Return",
"the",
"necessary",
"informations",
"to",
"open",
"a",
"VNC",
"connection",
"to",
"your",
"VPS"
] |
train
|
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L341-L348
|
deeplearning4j/deeplearning4j
|
datavec/datavec-spark/src/main/java/org/datavec/spark/util/DataVecSparkUtil.java
|
DataVecSparkUtil.combineFilesForSequenceFile
|
public static JavaPairRDD<Text, BytesPairWritable> combineFilesForSequenceFile(JavaSparkContext sc, String path1,
String path2, PathToKeyConverter converter) {
"""
Same as {@link #combineFilesForSequenceFile(JavaSparkContext, String, String, PathToKeyConverter, PathToKeyConverter)}
but with the PathToKeyConverter used for both file sources
"""
return combineFilesForSequenceFile(sc, path1, path2, converter, converter);
}
|
java
|
public static JavaPairRDD<Text, BytesPairWritable> combineFilesForSequenceFile(JavaSparkContext sc, String path1,
String path2, PathToKeyConverter converter) {
return combineFilesForSequenceFile(sc, path1, path2, converter, converter);
}
|
[
"public",
"static",
"JavaPairRDD",
"<",
"Text",
",",
"BytesPairWritable",
">",
"combineFilesForSequenceFile",
"(",
"JavaSparkContext",
"sc",
",",
"String",
"path1",
",",
"String",
"path2",
",",
"PathToKeyConverter",
"converter",
")",
"{",
"return",
"combineFilesForSequenceFile",
"(",
"sc",
",",
"path1",
",",
"path2",
",",
"converter",
",",
"converter",
")",
";",
"}"
] |
Same as {@link #combineFilesForSequenceFile(JavaSparkContext, String, String, PathToKeyConverter, PathToKeyConverter)}
but with the PathToKeyConverter used for both file sources
|
[
"Same",
"as",
"{"
] |
train
|
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/util/DataVecSparkUtil.java#L37-L40
|
ngageoint/geopackage-android-map
|
geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java
|
StyleCache.setFeatureStyle
|
public boolean setFeatureStyle(MarkerOptions markerOptions, FeatureRow featureRow) {
"""
Set the feature row style (icon or style) into the marker options
@param markerOptions marker options
@param featureRow feature row
@return true if icon or style was set into the marker options
"""
return StyleUtils.setFeatureStyle(markerOptions, featureStyleExtension, featureRow, density, iconCache);
}
|
java
|
public boolean setFeatureStyle(MarkerOptions markerOptions, FeatureRow featureRow) {
return StyleUtils.setFeatureStyle(markerOptions, featureStyleExtension, featureRow, density, iconCache);
}
|
[
"public",
"boolean",
"setFeatureStyle",
"(",
"MarkerOptions",
"markerOptions",
",",
"FeatureRow",
"featureRow",
")",
"{",
"return",
"StyleUtils",
".",
"setFeatureStyle",
"(",
"markerOptions",
",",
"featureStyleExtension",
",",
"featureRow",
",",
"density",
",",
"iconCache",
")",
";",
"}"
] |
Set the feature row style (icon or style) into the marker options
@param markerOptions marker options
@param featureRow feature row
@return true if icon or style was set into the marker options
|
[
"Set",
"the",
"feature",
"row",
"style",
"(",
"icon",
"or",
"style",
")",
"into",
"the",
"marker",
"options"
] |
train
|
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java#L135-L137
|
pippo-java/pippo
|
pippo-core/src/main/java/ro/pippo/core/PippoSettings.java
|
PippoSettings.overrideSetting
|
public void overrideSetting(String name, char value) {
"""
Override the setting at runtime with the specified value.
This change does not persist.
@param name
@param value
"""
overrides.put(name, Character.toString(value));
}
|
java
|
public void overrideSetting(String name, char value) {
overrides.put(name, Character.toString(value));
}
|
[
"public",
"void",
"overrideSetting",
"(",
"String",
"name",
",",
"char",
"value",
")",
"{",
"overrides",
".",
"put",
"(",
"name",
",",
"Character",
".",
"toString",
"(",
"value",
")",
")",
";",
"}"
] |
Override the setting at runtime with the specified value.
This change does not persist.
@param name
@param value
|
[
"Override",
"the",
"setting",
"at",
"runtime",
"with",
"the",
"specified",
"value",
".",
"This",
"change",
"does",
"not",
"persist",
"."
] |
train
|
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L1034-L1036
|
UrielCh/ovh-java-sdk
|
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
|
ApiOvhXdsl.serviceName_modem_portMappings_name_PUT
|
public void serviceName_modem_portMappings_name_PUT(String serviceName, String name, OvhPortMapping body) throws IOException {
"""
Alter this object properties
REST: PUT /xdsl/{serviceName}/modem/portMappings/{name}
@param body [required] New object properties
@param serviceName [required] The internal name of your XDSL offer
@param name [required] Name of the port mapping entry
"""
String qPath = "/xdsl/{serviceName}/modem/portMappings/{name}";
StringBuilder sb = path(qPath, serviceName, name);
exec(qPath, "PUT", sb.toString(), body);
}
|
java
|
public void serviceName_modem_portMappings_name_PUT(String serviceName, String name, OvhPortMapping body) throws IOException {
String qPath = "/xdsl/{serviceName}/modem/portMappings/{name}";
StringBuilder sb = path(qPath, serviceName, name);
exec(qPath, "PUT", sb.toString(), body);
}
|
[
"public",
"void",
"serviceName_modem_portMappings_name_PUT",
"(",
"String",
"serviceName",
",",
"String",
"name",
",",
"OvhPortMapping",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/xdsl/{serviceName}/modem/portMappings/{name}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"name",
")",
";",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"body",
")",
";",
"}"
] |
Alter this object properties
REST: PUT /xdsl/{serviceName}/modem/portMappings/{name}
@param body [required] New object properties
@param serviceName [required] The internal name of your XDSL offer
@param name [required] Name of the port mapping entry
|
[
"Alter",
"this",
"object",
"properties"
] |
train
|
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1288-L1292
|
apache/incubator-gobblin
|
gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/avro/HiveAvroSerDeManager.java
|
HiveAvroSerDeManager.addSchemaFromAvroFile
|
protected void addSchemaFromAvroFile(Schema schema, Path schemaFile, HiveRegistrationUnit hiveUnit)
throws IOException {
"""
Add a {@link Schema} obtained from an Avro data file to the given {@link HiveRegistrationUnit}.
<p>
If the length of the schema is less than {@link #SCHEMA_LITERAL_LENGTH_LIMIT}, it will be added via
{@link #SCHEMA_LITERAL}. Otherwise, the schema will be written to {@link #SCHEMA_FILE_NAME} and added
via {@link #SCHEMA_URL}.
</p>
"""
Preconditions.checkNotNull(schema);
String schemaStr = schema.toString();
if (schemaStr.length() <= this.schemaLiteralLengthLimit) {
hiveUnit.setSerDeProp(SCHEMA_LITERAL, schema.toString());
} else {
Path schemaTempFile = null;
if (useSchemaTempFile) {
schemaTempFile = new Path(schemaFile.getParent(), this.schemaTempFileName);
}
AvroUtils.writeSchemaToFile(schema, schemaFile, schemaTempFile, this.fs, true);
log.info("Using schema file " + schemaFile.toString());
hiveUnit.setSerDeProp(SCHEMA_URL, schemaFile.toString());
}
}
|
java
|
protected void addSchemaFromAvroFile(Schema schema, Path schemaFile, HiveRegistrationUnit hiveUnit)
throws IOException {
Preconditions.checkNotNull(schema);
String schemaStr = schema.toString();
if (schemaStr.length() <= this.schemaLiteralLengthLimit) {
hiveUnit.setSerDeProp(SCHEMA_LITERAL, schema.toString());
} else {
Path schemaTempFile = null;
if (useSchemaTempFile) {
schemaTempFile = new Path(schemaFile.getParent(), this.schemaTempFileName);
}
AvroUtils.writeSchemaToFile(schema, schemaFile, schemaTempFile, this.fs, true);
log.info("Using schema file " + schemaFile.toString());
hiveUnit.setSerDeProp(SCHEMA_URL, schemaFile.toString());
}
}
|
[
"protected",
"void",
"addSchemaFromAvroFile",
"(",
"Schema",
"schema",
",",
"Path",
"schemaFile",
",",
"HiveRegistrationUnit",
"hiveUnit",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"schema",
")",
";",
"String",
"schemaStr",
"=",
"schema",
".",
"toString",
"(",
")",
";",
"if",
"(",
"schemaStr",
".",
"length",
"(",
")",
"<=",
"this",
".",
"schemaLiteralLengthLimit",
")",
"{",
"hiveUnit",
".",
"setSerDeProp",
"(",
"SCHEMA_LITERAL",
",",
"schema",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"Path",
"schemaTempFile",
"=",
"null",
";",
"if",
"(",
"useSchemaTempFile",
")",
"{",
"schemaTempFile",
"=",
"new",
"Path",
"(",
"schemaFile",
".",
"getParent",
"(",
")",
",",
"this",
".",
"schemaTempFileName",
")",
";",
"}",
"AvroUtils",
".",
"writeSchemaToFile",
"(",
"schema",
",",
"schemaFile",
",",
"schemaTempFile",
",",
"this",
".",
"fs",
",",
"true",
")",
";",
"log",
".",
"info",
"(",
"\"Using schema file \"",
"+",
"schemaFile",
".",
"toString",
"(",
")",
")",
";",
"hiveUnit",
".",
"setSerDeProp",
"(",
"SCHEMA_URL",
",",
"schemaFile",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] |
Add a {@link Schema} obtained from an Avro data file to the given {@link HiveRegistrationUnit}.
<p>
If the length of the schema is less than {@link #SCHEMA_LITERAL_LENGTH_LIMIT}, it will be added via
{@link #SCHEMA_LITERAL}. Otherwise, the schema will be written to {@link #SCHEMA_FILE_NAME} and added
via {@link #SCHEMA_URL}.
</p>
|
[
"Add",
"a",
"{",
"@link",
"Schema",
"}",
"obtained",
"from",
"an",
"Avro",
"data",
"file",
"to",
"the",
"given",
"{",
"@link",
"HiveRegistrationUnit",
"}",
"."
] |
train
|
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/avro/HiveAvroSerDeManager.java#L175-L193
|
netscaler/nitro
|
src/main/java/com/citrix/netscaler/nitro/resource/stat/aaa/aaa_stats.java
|
aaa_stats.get_nitro_response
|
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
"""
<pre>
converts nitro response into object and returns the object array in case of get request.
</pre>
"""
aaa_stats[] resources = new aaa_stats[1];
aaa_response result = (aaa_response) service.get_payload_formatter().string_to_resource(aaa_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
resources[0] = result.aaa;
return resources;
}
|
java
|
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
aaa_stats[] resources = new aaa_stats[1];
aaa_response result = (aaa_response) service.get_payload_formatter().string_to_resource(aaa_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
resources[0] = result.aaa;
return resources;
}
|
[
"protected",
"base_resource",
"[",
"]",
"get_nitro_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"aaa_stats",
"[",
"]",
"resources",
"=",
"new",
"aaa_stats",
"[",
"1",
"]",
";",
"aaa_response",
"result",
"=",
"(",
"aaa_response",
")",
"service",
".",
"get_payload_formatter",
"(",
")",
".",
"string_to_resource",
"(",
"aaa_response",
".",
"class",
",",
"response",
")",
";",
"if",
"(",
"result",
".",
"errorcode",
"!=",
"0",
")",
"{",
"if",
"(",
"result",
".",
"errorcode",
"==",
"444",
")",
"{",
"service",
".",
"clear_session",
"(",
")",
";",
"}",
"if",
"(",
"result",
".",
"severity",
"!=",
"null",
")",
"{",
"if",
"(",
"result",
".",
"severity",
".",
"equals",
"(",
"\"ERROR\"",
")",
")",
"throw",
"new",
"nitro_exception",
"(",
"result",
".",
"message",
",",
"result",
".",
"errorcode",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"nitro_exception",
"(",
"result",
".",
"message",
",",
"result",
".",
"errorcode",
")",
";",
"}",
"}",
"resources",
"[",
"0",
"]",
"=",
"result",
".",
"aaa",
";",
"return",
"resources",
";",
"}"
] |
<pre>
converts nitro response into object and returns the object array in case of get request.
</pre>
|
[
"<pre",
">",
"converts",
"nitro",
"response",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] |
train
|
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/aaa/aaa_stats.java#L297-L316
|
aloha-app/thrift-client-pool-java
|
src/main/java/com/wealoha/thrift/ThriftClientPool.java
|
ThriftClientPool.getClient
|
public ThriftClient<T> getClient() throws ThriftException {
"""
get a client from pool
@return
@throws ThriftException
@throws NoBackendServiceException if
{@link PoolConfig#setFailover(boolean)} is set and no
service can connect to
@throws ConnectionFailException if
{@link PoolConfig#setFailover(boolean)} not set and
connection fail
"""
try {
return pool.borrowObject();
} catch (Exception e) {
if (e instanceof ThriftException) {
throw (ThriftException) e;
}
throw new ThriftException("Get client from pool failed.", e);
}
}
|
java
|
public ThriftClient<T> getClient() throws ThriftException {
try {
return pool.borrowObject();
} catch (Exception e) {
if (e instanceof ThriftException) {
throw (ThriftException) e;
}
throw new ThriftException("Get client from pool failed.", e);
}
}
|
[
"public",
"ThriftClient",
"<",
"T",
">",
"getClient",
"(",
")",
"throws",
"ThriftException",
"{",
"try",
"{",
"return",
"pool",
".",
"borrowObject",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"e",
"instanceof",
"ThriftException",
")",
"{",
"throw",
"(",
"ThriftException",
")",
"e",
";",
"}",
"throw",
"new",
"ThriftException",
"(",
"\"Get client from pool failed.\"",
",",
"e",
")",
";",
"}",
"}"
] |
get a client from pool
@return
@throws ThriftException
@throws NoBackendServiceException if
{@link PoolConfig#setFailover(boolean)} is set and no
service can connect to
@throws ConnectionFailException if
{@link PoolConfig#setFailover(boolean)} not set and
connection fail
|
[
"get",
"a",
"client",
"from",
"pool"
] |
train
|
https://github.com/aloha-app/thrift-client-pool-java/blob/7781fc18f81ced14ea7b03d3ffd070c411c33a17/src/main/java/com/wealoha/thrift/ThriftClientPool.java#L232-L241
|
phax/ph-commons
|
ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java
|
EnumHelper.getFromIDOrNull
|
@Nullable
public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasIntID> ENUMTYPE getFromIDOrNull (@Nonnull final Class <ENUMTYPE> aClass,
final int nID) {
"""
Get the enum value with the passed ID
@param <ENUMTYPE>
The enum type
@param aClass
The enum class
@param nID
The ID to search
@return <code>null</code> if no enum item with the given ID is present.
"""
return getFromIDOrDefault (aClass, nID, null);
}
|
java
|
@Nullable
public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasIntID> ENUMTYPE getFromIDOrNull (@Nonnull final Class <ENUMTYPE> aClass,
final int nID)
{
return getFromIDOrDefault (aClass, nID, null);
}
|
[
"@",
"Nullable",
"public",
"static",
"<",
"ENUMTYPE",
"extends",
"Enum",
"<",
"ENUMTYPE",
">",
"&",
"IHasIntID",
">",
"ENUMTYPE",
"getFromIDOrNull",
"(",
"@",
"Nonnull",
"final",
"Class",
"<",
"ENUMTYPE",
">",
"aClass",
",",
"final",
"int",
"nID",
")",
"{",
"return",
"getFromIDOrDefault",
"(",
"aClass",
",",
"nID",
",",
"null",
")",
";",
"}"
] |
Get the enum value with the passed ID
@param <ENUMTYPE>
The enum type
@param aClass
The enum class
@param nID
The ID to search
@return <code>null</code> if no enum item with the given ID is present.
|
[
"Get",
"the",
"enum",
"value",
"with",
"the",
"passed",
"ID"
] |
train
|
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java#L239-L244
|
gallandarakhneorg/afc
|
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/maplayer/MultiMapLayer.java
|
MultiMapLayer.fireLayerRemovedEvent
|
protected void fireLayerRemovedEvent(MapLayer layer, int oldChildIndex) {
"""
Fire the event that indicates a layer was removed.
@param layer is the removed layer.
@param oldChildIndex the old child index.
"""
fireLayerHierarchyChangedEvent(new MapLayerHierarchyEvent(
this, layer, Type.REMOVE_CHILD, oldChildIndex, layer.isTemporaryLayer()));
}
|
java
|
protected void fireLayerRemovedEvent(MapLayer layer, int oldChildIndex) {
fireLayerHierarchyChangedEvent(new MapLayerHierarchyEvent(
this, layer, Type.REMOVE_CHILD, oldChildIndex, layer.isTemporaryLayer()));
}
|
[
"protected",
"void",
"fireLayerRemovedEvent",
"(",
"MapLayer",
"layer",
",",
"int",
"oldChildIndex",
")",
"{",
"fireLayerHierarchyChangedEvent",
"(",
"new",
"MapLayerHierarchyEvent",
"(",
"this",
",",
"layer",
",",
"Type",
".",
"REMOVE_CHILD",
",",
"oldChildIndex",
",",
"layer",
".",
"isTemporaryLayer",
"(",
")",
")",
")",
";",
"}"
] |
Fire the event that indicates a layer was removed.
@param layer is the removed layer.
@param oldChildIndex the old child index.
|
[
"Fire",
"the",
"event",
"that",
"indicates",
"a",
"layer",
"was",
"removed",
"."
] |
train
|
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/maplayer/MultiMapLayer.java#L452-L455
|
SG-O/miIO
|
src/main/java/de/sg_o/app/miio/base/Device.java
|
Device.sendToObject
|
public JSONObject sendToObject(String method, Object params) throws CommandExecutionException {
"""
Send a command to a device. If no IP has been specified, this will try do discover a device on the network.
@param method The method to execute on the device.
@param params The command to execute on the device. Must be a JSONArray or JSONObject.
@return The response from the device as a JSONObject.
@throws CommandExecutionException When there has been a error during the communication or the response was invalid.
"""
Response resp = send(method, params);
if (resp == null) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_RESPONSE);
if (resp.getParams() == null) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_RESPONSE);
if (resp.getParams().getClass() != JSONObject.class) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_RESPONSE);
return (JSONObject)resp.getParams();
}
|
java
|
public JSONObject sendToObject(String method, Object params) throws CommandExecutionException {
Response resp = send(method, params);
if (resp == null) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_RESPONSE);
if (resp.getParams() == null) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_RESPONSE);
if (resp.getParams().getClass() != JSONObject.class) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_RESPONSE);
return (JSONObject)resp.getParams();
}
|
[
"public",
"JSONObject",
"sendToObject",
"(",
"String",
"method",
",",
"Object",
"params",
")",
"throws",
"CommandExecutionException",
"{",
"Response",
"resp",
"=",
"send",
"(",
"method",
",",
"params",
")",
";",
"if",
"(",
"resp",
"==",
"null",
")",
"throw",
"new",
"CommandExecutionException",
"(",
"CommandExecutionException",
".",
"Error",
".",
"INVALID_RESPONSE",
")",
";",
"if",
"(",
"resp",
".",
"getParams",
"(",
")",
"==",
"null",
")",
"throw",
"new",
"CommandExecutionException",
"(",
"CommandExecutionException",
".",
"Error",
".",
"INVALID_RESPONSE",
")",
";",
"if",
"(",
"resp",
".",
"getParams",
"(",
")",
".",
"getClass",
"(",
")",
"!=",
"JSONObject",
".",
"class",
")",
"throw",
"new",
"CommandExecutionException",
"(",
"CommandExecutionException",
".",
"Error",
".",
"INVALID_RESPONSE",
")",
";",
"return",
"(",
"JSONObject",
")",
"resp",
".",
"getParams",
"(",
")",
";",
"}"
] |
Send a command to a device. If no IP has been specified, this will try do discover a device on the network.
@param method The method to execute on the device.
@param params The command to execute on the device. Must be a JSONArray or JSONObject.
@return The response from the device as a JSONObject.
@throws CommandExecutionException When there has been a error during the communication or the response was invalid.
|
[
"Send",
"a",
"command",
"to",
"a",
"device",
".",
"If",
"no",
"IP",
"has",
"been",
"specified",
"this",
"will",
"try",
"do",
"discover",
"a",
"device",
"on",
"the",
"network",
"."
] |
train
|
https://github.com/SG-O/miIO/blob/f352dbd2a699d2cdb1b412ca5e6cbb0c38ca779b/src/main/java/de/sg_o/app/miio/base/Device.java#L352-L358
|
mapfish/mapfish-print
|
core/src/main/java/org/mapfish/print/servlet/job/impl/hibernate/PrintJobDao.java
|
PrintJobDao.updateLastCheckTime
|
public final void updateLastCheckTime(final String id, final long lastCheckTime) {
"""
Update the lastCheckTime of the given record.
@param id the id
@param lastCheckTime the new value
"""
final CriteriaBuilder builder = getSession().getCriteriaBuilder();
final CriteriaUpdate<PrintJobStatusExtImpl> update =
builder.createCriteriaUpdate(PrintJobStatusExtImpl.class);
final Root<PrintJobStatusExtImpl> root = update.from(PrintJobStatusExtImpl.class);
update.where(builder.equal(root.get("referenceId"), id));
update.set(root.get("lastCheckTime"), lastCheckTime);
getSession().createQuery(update).executeUpdate();
}
|
java
|
public final void updateLastCheckTime(final String id, final long lastCheckTime) {
final CriteriaBuilder builder = getSession().getCriteriaBuilder();
final CriteriaUpdate<PrintJobStatusExtImpl> update =
builder.createCriteriaUpdate(PrintJobStatusExtImpl.class);
final Root<PrintJobStatusExtImpl> root = update.from(PrintJobStatusExtImpl.class);
update.where(builder.equal(root.get("referenceId"), id));
update.set(root.get("lastCheckTime"), lastCheckTime);
getSession().createQuery(update).executeUpdate();
}
|
[
"public",
"final",
"void",
"updateLastCheckTime",
"(",
"final",
"String",
"id",
",",
"final",
"long",
"lastCheckTime",
")",
"{",
"final",
"CriteriaBuilder",
"builder",
"=",
"getSession",
"(",
")",
".",
"getCriteriaBuilder",
"(",
")",
";",
"final",
"CriteriaUpdate",
"<",
"PrintJobStatusExtImpl",
">",
"update",
"=",
"builder",
".",
"createCriteriaUpdate",
"(",
"PrintJobStatusExtImpl",
".",
"class",
")",
";",
"final",
"Root",
"<",
"PrintJobStatusExtImpl",
">",
"root",
"=",
"update",
".",
"from",
"(",
"PrintJobStatusExtImpl",
".",
"class",
")",
";",
"update",
".",
"where",
"(",
"builder",
".",
"equal",
"(",
"root",
".",
"get",
"(",
"\"referenceId\"",
")",
",",
"id",
")",
")",
";",
"update",
".",
"set",
"(",
"root",
".",
"get",
"(",
"\"lastCheckTime\"",
")",
",",
"lastCheckTime",
")",
";",
"getSession",
"(",
")",
".",
"createQuery",
"(",
"update",
")",
".",
"executeUpdate",
"(",
")",
";",
"}"
] |
Update the lastCheckTime of the given record.
@param id the id
@param lastCheckTime the new value
|
[
"Update",
"the",
"lastCheckTime",
"of",
"the",
"given",
"record",
"."
] |
train
|
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/servlet/job/impl/hibernate/PrintJobDao.java#L189-L197
|
gitblit/fathom
|
fathom-security/src/main/java/fathom/realm/Account.java
|
Account.checkPermissions
|
public void checkPermissions(String... permissions) throws AuthorizationException {
"""
Ensures this Account
{@link fathom.authz.Permission#implies(fathom.authz.Permission) implies} all of the
specified permission strings.
<p>
If this Account's existing associated permissions do not
{@link fathom.authz.Permission#implies(fathom.authz.Permission) imply} all of the given permissions,
an {@link fathom.authz.AuthorizationException} will be thrown.
<p>
This is an overloaded method for the corresponding type-safe {@link fathom.authz.Permission Permission} variant.
Please see the class-level JavaDoc for more information on these String-based permission methods.
@param permissions the string representations of Permissions to check.
@throws AuthorizationException if this Account does not have all of the given permissions.
"""
if (!isPermittedAll(permissions)) {
throw new AuthorizationException("'{}' does not have the permissions {}", toString(), Arrays.toString(permissions));
}
}
|
java
|
public void checkPermissions(String... permissions) throws AuthorizationException {
if (!isPermittedAll(permissions)) {
throw new AuthorizationException("'{}' does not have the permissions {}", toString(), Arrays.toString(permissions));
}
}
|
[
"public",
"void",
"checkPermissions",
"(",
"String",
"...",
"permissions",
")",
"throws",
"AuthorizationException",
"{",
"if",
"(",
"!",
"isPermittedAll",
"(",
"permissions",
")",
")",
"{",
"throw",
"new",
"AuthorizationException",
"(",
"\"'{}' does not have the permissions {}\"",
",",
"toString",
"(",
")",
",",
"Arrays",
".",
"toString",
"(",
"permissions",
")",
")",
";",
"}",
"}"
] |
Ensures this Account
{@link fathom.authz.Permission#implies(fathom.authz.Permission) implies} all of the
specified permission strings.
<p>
If this Account's existing associated permissions do not
{@link fathom.authz.Permission#implies(fathom.authz.Permission) imply} all of the given permissions,
an {@link fathom.authz.AuthorizationException} will be thrown.
<p>
This is an overloaded method for the corresponding type-safe {@link fathom.authz.Permission Permission} variant.
Please see the class-level JavaDoc for more information on these String-based permission methods.
@param permissions the string representations of Permissions to check.
@throws AuthorizationException if this Account does not have all of the given permissions.
|
[
"Ensures",
"this",
"Account",
"{",
"@link",
"fathom",
".",
"authz",
".",
"Permission#implies",
"(",
"fathom",
".",
"authz",
".",
"Permission",
")",
"implies",
"}",
"all",
"of",
"the",
"specified",
"permission",
"strings",
".",
"<p",
">",
"If",
"this",
"Account",
"s",
"existing",
"associated",
"permissions",
"do",
"not",
"{",
"@link",
"fathom",
".",
"authz",
".",
"Permission#implies",
"(",
"fathom",
".",
"authz",
".",
"Permission",
")",
"imply",
"}",
"all",
"of",
"the",
"given",
"permissions",
"an",
"{",
"@link",
"fathom",
".",
"authz",
".",
"AuthorizationException",
"}",
"will",
"be",
"thrown",
".",
"<p",
">",
"This",
"is",
"an",
"overloaded",
"method",
"for",
"the",
"corresponding",
"type",
"-",
"safe",
"{",
"@link",
"fathom",
".",
"authz",
".",
"Permission",
"Permission",
"}",
"variant",
".",
"Please",
"see",
"the",
"class",
"-",
"level",
"JavaDoc",
"for",
"more",
"information",
"on",
"these",
"String",
"-",
"based",
"permission",
"methods",
"."
] |
train
|
https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-security/src/main/java/fathom/realm/Account.java#L329-L333
|
elki-project/elki
|
elki/src/main/java/de/lmu/ifi/dbs/elki/persistent/PersistentPageFile.java
|
PersistentPageFile.writePage
|
@Override
public void writePage(int pageID, P page) {
"""
This method is called by the cache if the <code>page</code> is not longer
stored in the cache and has to be written to disk.
@param page the page which has to be written to disk
"""
try {
countWrite();
byte[] array = pageToByteArray(page);
long offset = ((long) (header.getReservedPages() + pageID)) * (long) pageSize;
assert offset >= 0 : header.getReservedPages() + " " + pageID + " " + pageSize + " " + offset;
file.seek(offset);
file.write(array);
page.setDirty(false);
}
catch(IOException e) {
throw new RuntimeException("Error writing to page file.", e);
}
}
|
java
|
@Override
public void writePage(int pageID, P page) {
try {
countWrite();
byte[] array = pageToByteArray(page);
long offset = ((long) (header.getReservedPages() + pageID)) * (long) pageSize;
assert offset >= 0 : header.getReservedPages() + " " + pageID + " " + pageSize + " " + offset;
file.seek(offset);
file.write(array);
page.setDirty(false);
}
catch(IOException e) {
throw new RuntimeException("Error writing to page file.", e);
}
}
|
[
"@",
"Override",
"public",
"void",
"writePage",
"(",
"int",
"pageID",
",",
"P",
"page",
")",
"{",
"try",
"{",
"countWrite",
"(",
")",
";",
"byte",
"[",
"]",
"array",
"=",
"pageToByteArray",
"(",
"page",
")",
";",
"long",
"offset",
"=",
"(",
"(",
"long",
")",
"(",
"header",
".",
"getReservedPages",
"(",
")",
"+",
"pageID",
")",
")",
"*",
"(",
"long",
")",
"pageSize",
";",
"assert",
"offset",
">=",
"0",
":",
"header",
".",
"getReservedPages",
"(",
")",
"+",
"\" \"",
"+",
"pageID",
"+",
"\" \"",
"+",
"pageSize",
"+",
"\" \"",
"+",
"offset",
";",
"file",
".",
"seek",
"(",
"offset",
")",
";",
"file",
".",
"write",
"(",
"array",
")",
";",
"page",
".",
"setDirty",
"(",
"false",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Error writing to page file.\"",
",",
"e",
")",
";",
"}",
"}"
] |
This method is called by the cache if the <code>page</code> is not longer
stored in the cache and has to be written to disk.
@param page the page which has to be written to disk
|
[
"This",
"method",
"is",
"called",
"by",
"the",
"cache",
"if",
"the",
"<code",
">",
"page<",
"/",
"code",
">",
"is",
"not",
"longer",
"stored",
"in",
"the",
"cache",
"and",
"has",
"to",
"be",
"written",
"to",
"disk",
"."
] |
train
|
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/persistent/PersistentPageFile.java#L156-L170
|
sebastiangraf/perfidix
|
src/main/java/org/perfidix/element/BenchmarkExecutor.java
|
BenchmarkExecutor.checkAndExecuteBeforeAfters
|
private void checkAndExecuteBeforeAfters(final Object obj, final Class<? extends Annotation> anno, final Method... meths) {
"""
Checking and executing several before/after methods.
@param obj on which the execution should take place
@param meths to be executed
@param anno the related annotation
"""
final PerfidixMethodCheckException checkExc = checkMethod(obj, anno, meths);
if (checkExc == null) {
for (Method m : meths) {
final PerfidixMethodInvocationException invoExc = invokeMethod(obj, anno, m);
if (invoExc != null) {
BENCHRES.addException(invoExc);
}
}
} else {
BENCHRES.addException(checkExc);
}
}
|
java
|
private void checkAndExecuteBeforeAfters(final Object obj, final Class<? extends Annotation> anno, final Method... meths) {
final PerfidixMethodCheckException checkExc = checkMethod(obj, anno, meths);
if (checkExc == null) {
for (Method m : meths) {
final PerfidixMethodInvocationException invoExc = invokeMethod(obj, anno, m);
if (invoExc != null) {
BENCHRES.addException(invoExc);
}
}
} else {
BENCHRES.addException(checkExc);
}
}
|
[
"private",
"void",
"checkAndExecuteBeforeAfters",
"(",
"final",
"Object",
"obj",
",",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"anno",
",",
"final",
"Method",
"...",
"meths",
")",
"{",
"final",
"PerfidixMethodCheckException",
"checkExc",
"=",
"checkMethod",
"(",
"obj",
",",
"anno",
",",
"meths",
")",
";",
"if",
"(",
"checkExc",
"==",
"null",
")",
"{",
"for",
"(",
"Method",
"m",
":",
"meths",
")",
"{",
"final",
"PerfidixMethodInvocationException",
"invoExc",
"=",
"invokeMethod",
"(",
"obj",
",",
"anno",
",",
"m",
")",
";",
"if",
"(",
"invoExc",
"!=",
"null",
")",
"{",
"BENCHRES",
".",
"addException",
"(",
"invoExc",
")",
";",
"}",
"}",
"}",
"else",
"{",
"BENCHRES",
".",
"addException",
"(",
"checkExc",
")",
";",
"}",
"}"
] |
Checking and executing several before/after methods.
@param obj on which the execution should take place
@param meths to be executed
@param anno the related annotation
|
[
"Checking",
"and",
"executing",
"several",
"before",
"/",
"after",
"methods",
"."
] |
train
|
https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/element/BenchmarkExecutor.java#L305-L317
|
alkacon/opencms-core
|
src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java
|
CmsSitemapController.openPropertyDialogForVaadin
|
public void openPropertyDialogForVaadin(final CmsUUID structureId, final CmsUUID rootId) {
"""
Opens the property dialog for the locale comparison mode.<p>
@param structureId the structure id of the sitemap entry to edit
@param rootId the structure id of the resource comparing to the tree root in sitemap compare mode
"""
CmsRpcAction<CmsLocaleComparePropertyData> action = new CmsRpcAction<CmsLocaleComparePropertyData>() {
@SuppressWarnings("synthetic-access")
@Override
public void execute() {
start(0, false);
m_service.loadPropertyDataForLocaleCompareView(structureId, rootId, this);
}
@Override
protected void onResponse(CmsLocaleComparePropertyData result) {
stop(false);
CmsSitemapController.editPropertiesForLocaleCompareMode(
result,
structureId,
result.getDefaultFileId(),
null);
}
};
action.execute();
}
|
java
|
public void openPropertyDialogForVaadin(final CmsUUID structureId, final CmsUUID rootId) {
CmsRpcAction<CmsLocaleComparePropertyData> action = new CmsRpcAction<CmsLocaleComparePropertyData>() {
@SuppressWarnings("synthetic-access")
@Override
public void execute() {
start(0, false);
m_service.loadPropertyDataForLocaleCompareView(structureId, rootId, this);
}
@Override
protected void onResponse(CmsLocaleComparePropertyData result) {
stop(false);
CmsSitemapController.editPropertiesForLocaleCompareMode(
result,
structureId,
result.getDefaultFileId(),
null);
}
};
action.execute();
}
|
[
"public",
"void",
"openPropertyDialogForVaadin",
"(",
"final",
"CmsUUID",
"structureId",
",",
"final",
"CmsUUID",
"rootId",
")",
"{",
"CmsRpcAction",
"<",
"CmsLocaleComparePropertyData",
">",
"action",
"=",
"new",
"CmsRpcAction",
"<",
"CmsLocaleComparePropertyData",
">",
"(",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"synthetic-access\"",
")",
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"{",
"start",
"(",
"0",
",",
"false",
")",
";",
"m_service",
".",
"loadPropertyDataForLocaleCompareView",
"(",
"structureId",
",",
"rootId",
",",
"this",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"onResponse",
"(",
"CmsLocaleComparePropertyData",
"result",
")",
"{",
"stop",
"(",
"false",
")",
";",
"CmsSitemapController",
".",
"editPropertiesForLocaleCompareMode",
"(",
"result",
",",
"structureId",
",",
"result",
".",
"getDefaultFileId",
"(",
")",
",",
"null",
")",
";",
"}",
"}",
";",
"action",
".",
"execute",
"(",
")",
";",
"}"
] |
Opens the property dialog for the locale comparison mode.<p>
@param structureId the structure id of the sitemap entry to edit
@param rootId the structure id of the resource comparing to the tree root in sitemap compare mode
|
[
"Opens",
"the",
"property",
"dialog",
"for",
"the",
"locale",
"comparison",
"mode",
".",
"<p",
">"
] |
train
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L1711-L1736
|
Mozu/mozu-java
|
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/checkouts/OrderItemUrl.java
|
OrderItemUrl.deleteCheckoutItemUrl
|
public static MozuUrl deleteCheckoutItemUrl(String checkoutId, String itemId) {
"""
Get Resource Url for DeleteCheckoutItem
@param checkoutId The unique identifier of the checkout.
@param itemId The unique identifier of the item.
@return String Resource Url
"""
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/items/{itemId}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("itemId", itemId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
}
|
java
|
public static MozuUrl deleteCheckoutItemUrl(String checkoutId, String itemId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/items/{itemId}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("itemId", itemId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
}
|
[
"public",
"static",
"MozuUrl",
"deleteCheckoutItemUrl",
"(",
"String",
"checkoutId",
",",
"String",
"itemId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/checkouts/{checkoutId}/items/{itemId}\"",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"checkoutId\"",
",",
"checkoutId",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"itemId\"",
",",
"itemId",
")",
";",
"return",
"new",
"MozuUrl",
"(",
"formatter",
".",
"getResourceUrl",
"(",
")",
",",
"MozuUrl",
".",
"UrlLocation",
".",
"TENANT_POD",
")",
";",
"}"
] |
Get Resource Url for DeleteCheckoutItem
@param checkoutId The unique identifier of the checkout.
@param itemId The unique identifier of the item.
@return String Resource Url
|
[
"Get",
"Resource",
"Url",
"for",
"DeleteCheckoutItem"
] |
train
|
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/checkouts/OrderItemUrl.java#L86-L92
|
SeaCloudsEU/SeaCloudsPlatform
|
sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/SeacloudsRest.java
|
SeacloudsRest.getSlaUrl
|
private String getSlaUrl(String envSlaUrl, UriInfo uriInfo) {
"""
Returns base url of the sla core.
If the SLA_URL env var is set, returns that value. Else, get the base url from the
context of the current REST call. This second value may be wrong because this base url must
be the value that the MonitoringPlatform needs to use to connect to the SLA Core.
"""
String baseUrl = uriInfo.getBaseUri().toString();
if (envSlaUrl == null) {
envSlaUrl = "";
}
String result = ("".equals(envSlaUrl))? baseUrl : envSlaUrl;
logger.debug("getSlaUrl(env={}, supplied={}) = {}", envSlaUrl, baseUrl, result);
return result;
}
|
java
|
private String getSlaUrl(String envSlaUrl, UriInfo uriInfo) {
String baseUrl = uriInfo.getBaseUri().toString();
if (envSlaUrl == null) {
envSlaUrl = "";
}
String result = ("".equals(envSlaUrl))? baseUrl : envSlaUrl;
logger.debug("getSlaUrl(env={}, supplied={}) = {}", envSlaUrl, baseUrl, result);
return result;
}
|
[
"private",
"String",
"getSlaUrl",
"(",
"String",
"envSlaUrl",
",",
"UriInfo",
"uriInfo",
")",
"{",
"String",
"baseUrl",
"=",
"uriInfo",
".",
"getBaseUri",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"envSlaUrl",
"==",
"null",
")",
"{",
"envSlaUrl",
"=",
"\"\"",
";",
"}",
"String",
"result",
"=",
"(",
"\"\"",
".",
"equals",
"(",
"envSlaUrl",
")",
")",
"?",
"baseUrl",
":",
"envSlaUrl",
";",
"logger",
".",
"debug",
"(",
"\"getSlaUrl(env={}, supplied={}) = {}\"",
",",
"envSlaUrl",
",",
"baseUrl",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Returns base url of the sla core.
If the SLA_URL env var is set, returns that value. Else, get the base url from the
context of the current REST call. This second value may be wrong because this base url must
be the value that the MonitoringPlatform needs to use to connect to the SLA Core.
|
[
"Returns",
"base",
"url",
"of",
"the",
"sla",
"core",
"."
] |
train
|
https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/SeacloudsRest.java#L372-L382
|
iig-uni-freiburg/SEWOL
|
ext/org/deckfour/xes/extension/std/XCostExtension.java
|
XCostExtension.assignTotalPrivate
|
private void assignTotalPrivate(XAttributable element, Double total) {
"""
/*
Assigns any element its total costs, as defined by this extension's total
attribute.
@param element Element to assign total costs to.
@param total The total costs to be assigned.
"""
if (total != null && total > 0.0) {
XAttributeContinuous attr = (XAttributeContinuous) ATTR_TOTAL
.clone();
attr.setValue(total);
element.getAttributes().put(KEY_TOTAL, attr);
}
}
|
java
|
private void assignTotalPrivate(XAttributable element, Double total) {
if (total != null && total > 0.0) {
XAttributeContinuous attr = (XAttributeContinuous) ATTR_TOTAL
.clone();
attr.setValue(total);
element.getAttributes().put(KEY_TOTAL, attr);
}
}
|
[
"private",
"void",
"assignTotalPrivate",
"(",
"XAttributable",
"element",
",",
"Double",
"total",
")",
"{",
"if",
"(",
"total",
"!=",
"null",
"&&",
"total",
">",
"0.0",
")",
"{",
"XAttributeContinuous",
"attr",
"=",
"(",
"XAttributeContinuous",
")",
"ATTR_TOTAL",
".",
"clone",
"(",
")",
";",
"attr",
".",
"setValue",
"(",
"total",
")",
";",
"element",
".",
"getAttributes",
"(",
")",
".",
"put",
"(",
"KEY_TOTAL",
",",
"attr",
")",
";",
"}",
"}"
] |
/*
Assigns any element its total costs, as defined by this extension's total
attribute.
@param element Element to assign total costs to.
@param total The total costs to be assigned.
|
[
"/",
"*",
"Assigns",
"any",
"element",
"its",
"total",
"costs",
"as",
"defined",
"by",
"this",
"extension",
"s",
"total",
"attribute",
"."
] |
train
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XCostExtension.java#L241-L248
|
VoltDB/voltdb
|
src/frontend/org/voltdb/compiler/StatementCompiler.java
|
StatementCompiler.addStatementDependence
|
private static void addStatementDependence(Function function, Statement catalogStmt) {
"""
Add a dependence of a statement to a function. The statement's
dependence string is altered with this function.
@param function The function to add as dependee.
@param catalogStmt The statement to add as depender.
"""
String fnDeps = catalogStmt.getFunctiondependees();
Set<String> fnSet = new TreeSet<>();
for (String fnName : fnDeps.split(",")) {
if (! fnName.isEmpty()) {
fnSet.add(fnName);
}
}
String functionName = function.getTypeName();
if (fnSet.contains(functionName)) {
return;
}
fnSet.add(functionName);
StringBuilder sb = new StringBuilder();
sb.append(",");
for (String fnName : fnSet) {
sb.append(fnName + ",");
}
catalogStmt.setFunctiondependees(sb.toString());
}
|
java
|
private static void addStatementDependence(Function function, Statement catalogStmt) {
String fnDeps = catalogStmt.getFunctiondependees();
Set<String> fnSet = new TreeSet<>();
for (String fnName : fnDeps.split(",")) {
if (! fnName.isEmpty()) {
fnSet.add(fnName);
}
}
String functionName = function.getTypeName();
if (fnSet.contains(functionName)) {
return;
}
fnSet.add(functionName);
StringBuilder sb = new StringBuilder();
sb.append(",");
for (String fnName : fnSet) {
sb.append(fnName + ",");
}
catalogStmt.setFunctiondependees(sb.toString());
}
|
[
"private",
"static",
"void",
"addStatementDependence",
"(",
"Function",
"function",
",",
"Statement",
"catalogStmt",
")",
"{",
"String",
"fnDeps",
"=",
"catalogStmt",
".",
"getFunctiondependees",
"(",
")",
";",
"Set",
"<",
"String",
">",
"fnSet",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"fnName",
":",
"fnDeps",
".",
"split",
"(",
"\",\"",
")",
")",
"{",
"if",
"(",
"!",
"fnName",
".",
"isEmpty",
"(",
")",
")",
"{",
"fnSet",
".",
"add",
"(",
"fnName",
")",
";",
"}",
"}",
"String",
"functionName",
"=",
"function",
".",
"getTypeName",
"(",
")",
";",
"if",
"(",
"fnSet",
".",
"contains",
"(",
"functionName",
")",
")",
"{",
"return",
";",
"}",
"fnSet",
".",
"add",
"(",
"functionName",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\",\"",
")",
";",
"for",
"(",
"String",
"fnName",
":",
"fnSet",
")",
"{",
"sb",
".",
"append",
"(",
"fnName",
"+",
"\",\"",
")",
";",
"}",
"catalogStmt",
".",
"setFunctiondependees",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
Add a dependence of a statement to a function. The statement's
dependence string is altered with this function.
@param function The function to add as dependee.
@param catalogStmt The statement to add as depender.
|
[
"Add",
"a",
"dependence",
"of",
"a",
"statement",
"to",
"a",
"function",
".",
"The",
"statement",
"s",
"dependence",
"string",
"is",
"altered",
"with",
"this",
"function",
"."
] |
train
|
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/StatementCompiler.java#L427-L449
|
OpenLiberty/open-liberty
|
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgObject.java
|
JsMsgObject.encodeIds
|
private final int encodeIds(byte[] buffer, int offset) {
"""
Encode the JMF version and schema ids into a byte array buffer.
The buffer will be used when transmitting over the wire, hardening
into a database and for any other need for 'serialization'
@param buffer The buffer to write the Ids into.
@param offset The offset in the buffer at which to start writing the Ids.
@return the number of bytes written to the buffer.
@exception MessageEncodeFailedException is thrown if the ids could not be written.
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "encodeIds");
int idOffset = offset;
// Write the JMF version number and Schema id for the header
ArrayUtil.writeShort(buffer, idOffset, ((JMFMessage)headerPart.jmfPart).getJMFEncodingVersion());
idOffset += ArrayUtil.SHORT_SIZE;
ArrayUtil.writeLong(buffer, idOffset, headerPart.jmfPart.getEncodingSchema().getID());
idOffset += ArrayUtil.LONG_SIZE;
// Write the JMF version number and Schema id for the payload, if there is one
if (payloadPart != null) {
ArrayUtil.writeShort(buffer, idOffset, ((JMFMessage)payloadPart.jmfPart).getJMFEncodingVersion());
idOffset += ArrayUtil.SHORT_SIZE;
ArrayUtil.writeLong(buffer, idOffset, payloadPart.jmfPart.getEncodingSchema().getID());
idOffset += ArrayUtil.LONG_SIZE;
}
// Otherwise we just write zeros to fill up the same space
else {
ArrayUtil.writeShort(buffer, idOffset, (short)0);
idOffset += ArrayUtil.SHORT_SIZE;
ArrayUtil.writeLong(buffer, idOffset, 0L);
idOffset += ArrayUtil.LONG_SIZE;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "encodeIds", Integer.valueOf(idOffset - offset));
return idOffset - offset;
}
|
java
|
private final int encodeIds(byte[] buffer, int offset) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "encodeIds");
int idOffset = offset;
// Write the JMF version number and Schema id for the header
ArrayUtil.writeShort(buffer, idOffset, ((JMFMessage)headerPart.jmfPart).getJMFEncodingVersion());
idOffset += ArrayUtil.SHORT_SIZE;
ArrayUtil.writeLong(buffer, idOffset, headerPart.jmfPart.getEncodingSchema().getID());
idOffset += ArrayUtil.LONG_SIZE;
// Write the JMF version number and Schema id for the payload, if there is one
if (payloadPart != null) {
ArrayUtil.writeShort(buffer, idOffset, ((JMFMessage)payloadPart.jmfPart).getJMFEncodingVersion());
idOffset += ArrayUtil.SHORT_SIZE;
ArrayUtil.writeLong(buffer, idOffset, payloadPart.jmfPart.getEncodingSchema().getID());
idOffset += ArrayUtil.LONG_SIZE;
}
// Otherwise we just write zeros to fill up the same space
else {
ArrayUtil.writeShort(buffer, idOffset, (short)0);
idOffset += ArrayUtil.SHORT_SIZE;
ArrayUtil.writeLong(buffer, idOffset, 0L);
idOffset += ArrayUtil.LONG_SIZE;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "encodeIds", Integer.valueOf(idOffset - offset));
return idOffset - offset;
}
|
[
"private",
"final",
"int",
"encodeIds",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"encodeIds\"",
")",
";",
"int",
"idOffset",
"=",
"offset",
";",
"// Write the JMF version number and Schema id for the header",
"ArrayUtil",
".",
"writeShort",
"(",
"buffer",
",",
"idOffset",
",",
"(",
"(",
"JMFMessage",
")",
"headerPart",
".",
"jmfPart",
")",
".",
"getJMFEncodingVersion",
"(",
")",
")",
";",
"idOffset",
"+=",
"ArrayUtil",
".",
"SHORT_SIZE",
";",
"ArrayUtil",
".",
"writeLong",
"(",
"buffer",
",",
"idOffset",
",",
"headerPart",
".",
"jmfPart",
".",
"getEncodingSchema",
"(",
")",
".",
"getID",
"(",
")",
")",
";",
"idOffset",
"+=",
"ArrayUtil",
".",
"LONG_SIZE",
";",
"// Write the JMF version number and Schema id for the payload, if there is one",
"if",
"(",
"payloadPart",
"!=",
"null",
")",
"{",
"ArrayUtil",
".",
"writeShort",
"(",
"buffer",
",",
"idOffset",
",",
"(",
"(",
"JMFMessage",
")",
"payloadPart",
".",
"jmfPart",
")",
".",
"getJMFEncodingVersion",
"(",
")",
")",
";",
"idOffset",
"+=",
"ArrayUtil",
".",
"SHORT_SIZE",
";",
"ArrayUtil",
".",
"writeLong",
"(",
"buffer",
",",
"idOffset",
",",
"payloadPart",
".",
"jmfPart",
".",
"getEncodingSchema",
"(",
")",
".",
"getID",
"(",
")",
")",
";",
"idOffset",
"+=",
"ArrayUtil",
".",
"LONG_SIZE",
";",
"}",
"// Otherwise we just write zeros to fill up the same space",
"else",
"{",
"ArrayUtil",
".",
"writeShort",
"(",
"buffer",
",",
"idOffset",
",",
"(",
"short",
")",
"0",
")",
";",
"idOffset",
"+=",
"ArrayUtil",
".",
"SHORT_SIZE",
";",
"ArrayUtil",
".",
"writeLong",
"(",
"buffer",
",",
"idOffset",
",",
"0L",
")",
";",
"idOffset",
"+=",
"ArrayUtil",
".",
"LONG_SIZE",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"encodeIds\"",
",",
"Integer",
".",
"valueOf",
"(",
"idOffset",
"-",
"offset",
")",
")",
";",
"return",
"idOffset",
"-",
"offset",
";",
"}"
] |
Encode the JMF version and schema ids into a byte array buffer.
The buffer will be used when transmitting over the wire, hardening
into a database and for any other need for 'serialization'
@param buffer The buffer to write the Ids into.
@param offset The offset in the buffer at which to start writing the Ids.
@return the number of bytes written to the buffer.
@exception MessageEncodeFailedException is thrown if the ids could not be written.
|
[
"Encode",
"the",
"JMF",
"version",
"and",
"schema",
"ids",
"into",
"a",
"byte",
"array",
"buffer",
".",
"The",
"buffer",
"will",
"be",
"used",
"when",
"transmitting",
"over",
"the",
"wire",
"hardening",
"into",
"a",
"database",
"and",
"for",
"any",
"other",
"need",
"for",
"serialization"
] |
train
|
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgObject.java#L1039-L1070
|
phax/ph-pdf-layout
|
src/main/java/com/helger/pdflayout4/spec/FontSpec.java
|
FontSpec.getCloneWithDifferentColor
|
@Nonnull
public FontSpec getCloneWithDifferentColor (@Nonnull final Color aNewColor) {
"""
Return a clone of this object but with a different color.
@param aNewColor
The new color to use. May not be <code>null</code>.
@return this if the colors are equal - a new object otherwise.
"""
ValueEnforcer.notNull (aNewColor, "NewColor");
if (aNewColor.equals (m_aColor))
return this;
return new FontSpec (m_aPreloadFont, m_fFontSize, aNewColor);
}
|
java
|
@Nonnull
public FontSpec getCloneWithDifferentColor (@Nonnull final Color aNewColor)
{
ValueEnforcer.notNull (aNewColor, "NewColor");
if (aNewColor.equals (m_aColor))
return this;
return new FontSpec (m_aPreloadFont, m_fFontSize, aNewColor);
}
|
[
"@",
"Nonnull",
"public",
"FontSpec",
"getCloneWithDifferentColor",
"(",
"@",
"Nonnull",
"final",
"Color",
"aNewColor",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aNewColor",
",",
"\"NewColor\"",
")",
";",
"if",
"(",
"aNewColor",
".",
"equals",
"(",
"m_aColor",
")",
")",
"return",
"this",
";",
"return",
"new",
"FontSpec",
"(",
"m_aPreloadFont",
",",
"m_fFontSize",
",",
"aNewColor",
")",
";",
"}"
] |
Return a clone of this object but with a different color.
@param aNewColor
The new color to use. May not be <code>null</code>.
@return this if the colors are equal - a new object otherwise.
|
[
"Return",
"a",
"clone",
"of",
"this",
"object",
"but",
"with",
"a",
"different",
"color",
"."
] |
train
|
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/spec/FontSpec.java#L145-L152
|
google/j2objc
|
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/AbstractSequentialList.java
|
AbstractSequentialList.addAll
|
public boolean addAll(int index, Collection<? extends E> c) {
"""
Inserts all of the elements in the specified collection into this
list at the specified position (optional operation). Shifts the
element currently at that position (if any) and any subsequent
elements to the right (increases their indices). The new elements
will appear in this list in the order that they are returned by the
specified collection's iterator. The behavior of this operation is
undefined if the specified collection is modified while the
operation is in progress. (Note that this will occur if the specified
collection is this list, and it's nonempty.)
<p>This implementation gets an iterator over the specified collection and
a list iterator over this list pointing to the indexed element (with
<tt>listIterator(index)</tt>). Then, it iterates over the specified
collection, inserting the elements obtained from the iterator into this
list, one at a time, using <tt>ListIterator.add</tt> followed by
<tt>ListIterator.next</tt> (to skip over the added element).
<p>Note that this implementation will throw an
<tt>UnsupportedOperationException</tt> if the list iterator returned by
the <tt>listIterator</tt> method does not implement the <tt>add</tt>
operation.
@throws UnsupportedOperationException {@inheritDoc}
@throws ClassCastException {@inheritDoc}
@throws NullPointerException {@inheritDoc}
@throws IllegalArgumentException {@inheritDoc}
@throws IndexOutOfBoundsException {@inheritDoc}
"""
try {
boolean modified = false;
ListIterator<E> e1 = listIterator(index);
Iterator<? extends E> e2 = c.iterator();
while (e2.hasNext()) {
e1.add(e2.next());
modified = true;
}
return modified;
} catch (NoSuchElementException exc) {
throw new IndexOutOfBoundsException("Index: "+index);
}
}
|
java
|
public boolean addAll(int index, Collection<? extends E> c) {
try {
boolean modified = false;
ListIterator<E> e1 = listIterator(index);
Iterator<? extends E> e2 = c.iterator();
while (e2.hasNext()) {
e1.add(e2.next());
modified = true;
}
return modified;
} catch (NoSuchElementException exc) {
throw new IndexOutOfBoundsException("Index: "+index);
}
}
|
[
"public",
"boolean",
"addAll",
"(",
"int",
"index",
",",
"Collection",
"<",
"?",
"extends",
"E",
">",
"c",
")",
"{",
"try",
"{",
"boolean",
"modified",
"=",
"false",
";",
"ListIterator",
"<",
"E",
">",
"e1",
"=",
"listIterator",
"(",
"index",
")",
";",
"Iterator",
"<",
"?",
"extends",
"E",
">",
"e2",
"=",
"c",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"e2",
".",
"hasNext",
"(",
")",
")",
"{",
"e1",
".",
"add",
"(",
"e2",
".",
"next",
"(",
")",
")",
";",
"modified",
"=",
"true",
";",
"}",
"return",
"modified",
";",
"}",
"catch",
"(",
"NoSuchElementException",
"exc",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Index: \"",
"+",
"index",
")",
";",
"}",
"}"
] |
Inserts all of the elements in the specified collection into this
list at the specified position (optional operation). Shifts the
element currently at that position (if any) and any subsequent
elements to the right (increases their indices). The new elements
will appear in this list in the order that they are returned by the
specified collection's iterator. The behavior of this operation is
undefined if the specified collection is modified while the
operation is in progress. (Note that this will occur if the specified
collection is this list, and it's nonempty.)
<p>This implementation gets an iterator over the specified collection and
a list iterator over this list pointing to the indexed element (with
<tt>listIterator(index)</tt>). Then, it iterates over the specified
collection, inserting the elements obtained from the iterator into this
list, one at a time, using <tt>ListIterator.add</tt> followed by
<tt>ListIterator.next</tt> (to skip over the added element).
<p>Note that this implementation will throw an
<tt>UnsupportedOperationException</tt> if the list iterator returned by
the <tt>listIterator</tt> method does not implement the <tt>add</tt>
operation.
@throws UnsupportedOperationException {@inheritDoc}
@throws ClassCastException {@inheritDoc}
@throws NullPointerException {@inheritDoc}
@throws IllegalArgumentException {@inheritDoc}
@throws IndexOutOfBoundsException {@inheritDoc}
|
[
"Inserts",
"all",
"of",
"the",
"elements",
"in",
"the",
"specified",
"collection",
"into",
"this",
"list",
"at",
"the",
"specified",
"position",
"(",
"optional",
"operation",
")",
".",
"Shifts",
"the",
"element",
"currently",
"at",
"that",
"position",
"(",
"if",
"any",
")",
"and",
"any",
"subsequent",
"elements",
"to",
"the",
"right",
"(",
"increases",
"their",
"indices",
")",
".",
"The",
"new",
"elements",
"will",
"appear",
"in",
"this",
"list",
"in",
"the",
"order",
"that",
"they",
"are",
"returned",
"by",
"the",
"specified",
"collection",
"s",
"iterator",
".",
"The",
"behavior",
"of",
"this",
"operation",
"is",
"undefined",
"if",
"the",
"specified",
"collection",
"is",
"modified",
"while",
"the",
"operation",
"is",
"in",
"progress",
".",
"(",
"Note",
"that",
"this",
"will",
"occur",
"if",
"the",
"specified",
"collection",
"is",
"this",
"list",
"and",
"it",
"s",
"nonempty",
".",
")"
] |
train
|
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/AbstractSequentialList.java#L212-L225
|
lessthanoptimal/BoofCV
|
main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernel.java
|
FactoryKernel.random2D_F64
|
public static Kernel2D_F64 random2D_F64(int width , int offset, double min, double max, Random rand) {
"""
Creates a random 2D kernel drawn from a uniform distribution.
@param width Kernel's width.
@param offset Offset for element zero in the kernel
@param min minimum value.
@param max maximum value.
@param rand Random number generator.
@return Randomized kernel.
"""
Kernel2D_F64 ret = new Kernel2D_F64(width,offset);
double range = max - min;
for (int i = 0; i < ret.data.length; i++) {
ret.data[i] = rand.nextDouble() * range + min;
}
return ret;
}
|
java
|
public static Kernel2D_F64 random2D_F64(int width , int offset, double min, double max, Random rand) {
Kernel2D_F64 ret = new Kernel2D_F64(width,offset);
double range = max - min;
for (int i = 0; i < ret.data.length; i++) {
ret.data[i] = rand.nextDouble() * range + min;
}
return ret;
}
|
[
"public",
"static",
"Kernel2D_F64",
"random2D_F64",
"(",
"int",
"width",
",",
"int",
"offset",
",",
"double",
"min",
",",
"double",
"max",
",",
"Random",
"rand",
")",
"{",
"Kernel2D_F64",
"ret",
"=",
"new",
"Kernel2D_F64",
"(",
"width",
",",
"offset",
")",
";",
"double",
"range",
"=",
"max",
"-",
"min",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ret",
".",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"ret",
".",
"data",
"[",
"i",
"]",
"=",
"rand",
".",
"nextDouble",
"(",
")",
"*",
"range",
"+",
"min",
";",
"}",
"return",
"ret",
";",
"}"
] |
Creates a random 2D kernel drawn from a uniform distribution.
@param width Kernel's width.
@param offset Offset for element zero in the kernel
@param min minimum value.
@param max maximum value.
@param rand Random number generator.
@return Randomized kernel.
|
[
"Creates",
"a",
"random",
"2D",
"kernel",
"drawn",
"from",
"a",
"uniform",
"distribution",
"."
] |
train
|
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernel.java#L319-L328
|
UrielCh/ovh-java-sdk
|
ovh-java-sdk-newAccount/src/main/java/net/minidev/ovh/api/ApiOvhNewAccount.java
|
ApiOvhNewAccount.contracts_GET
|
public ArrayList<OvhContract> contracts_GET(OvhOvhCompanyEnum company, OvhOvhSubsidiaryEnum subsidiary) throws IOException {
"""
Returns the contracts that governs the creation of an OVH identifier
REST: GET /newAccount/contracts
@param subsidiary [required]
@param company [required]
"""
String qPath = "/newAccount/contracts";
StringBuilder sb = path(qPath);
query(sb, "company", company);
query(sb, "subsidiary", subsidiary);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
}
|
java
|
public ArrayList<OvhContract> contracts_GET(OvhOvhCompanyEnum company, OvhOvhSubsidiaryEnum subsidiary) throws IOException {
String qPath = "/newAccount/contracts";
StringBuilder sb = path(qPath);
query(sb, "company", company);
query(sb, "subsidiary", subsidiary);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
}
|
[
"public",
"ArrayList",
"<",
"OvhContract",
">",
"contracts_GET",
"(",
"OvhOvhCompanyEnum",
"company",
",",
"OvhOvhSubsidiaryEnum",
"subsidiary",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/newAccount/contracts\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"query",
"(",
"sb",
",",
"\"company\"",
",",
"company",
")",
";",
"query",
"(",
"sb",
",",
"\"subsidiary\"",
",",
"subsidiary",
")",
";",
"String",
"resp",
"=",
"execN",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t3",
")",
";",
"}"
] |
Returns the contracts that governs the creation of an OVH identifier
REST: GET /newAccount/contracts
@param subsidiary [required]
@param company [required]
|
[
"Returns",
"the",
"contracts",
"that",
"governs",
"the",
"creation",
"of",
"an",
"OVH",
"identifier"
] |
train
|
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-newAccount/src/main/java/net/minidev/ovh/api/ApiOvhNewAccount.java#L70-L77
|
jmeetsma/Iglu-Http
|
src/main/java/org/ijsberg/iglu/server/http/filter/WebAppEntryPoint.java
|
WebAppEntryPoint.handleException
|
public void handleException(ServletRequest request, ServletResponse response, Throwable cause) throws IOException, ServletException {
"""
Is invoked in case an exception or error occurred in a servlet that was not handled by
the implementating code
<p/>
An attempt is made to redirect the request to an URL defined in the configuration
at section "SERVLET_EXCEPTION_REDIRECTS", key "unhandled_error"
<p/>
Override this method to implement your own error / exception handling
@param request
@param response
@param cause
"""
List messageStack = new ArrayList();
messageStack.add("Request: " + request);
messageStack.add("Remote address: " + request.getRemoteAddr());
messageStack.add("Remote host: " + request.getRemoteHost());
//unwrap exception
while(/*cause instanceof ServletException && */cause.getCause() != null)
{
messageStack.add("Exception with message: " + cause.getMessage());
messageStack.add(cause.getStackTrace()[0].toString());
cause = cause.getCause();
}
//all servlets are responsible for handling all possible situations
//so an exception handled here is a critical one
if(cause instanceof ServletRequestAlreadyRedirectedException)
{
return;
}
//print error to screen
if(this.printUnhandledExceptions)
{
if(!response.isCommitted())
{
System.out.println(new LogEntry(Level.CRITICAL, "exception handled in http-filter " + filterName, cause));
ServletSupport.printException(response, "An exception occurred for which no exception page is defined.\n" +
"Make sure you do so if your application is in a production environment.\n" +
"(in section [" + exceptionPagesSectionId + "])" +
"\n\n" + CollectionSupport.format(messageStack, "\n"), cause);
}
else
{
System.out.println(new LogEntry(Level.CRITICAL, "exception handled in http-filter " + filterName + " can not be printed: response already committed", cause));
}
}
}
|
java
|
public void handleException(ServletRequest request, ServletResponse response, Throwable cause) throws IOException, ServletException
{
List messageStack = new ArrayList();
messageStack.add("Request: " + request);
messageStack.add("Remote address: " + request.getRemoteAddr());
messageStack.add("Remote host: " + request.getRemoteHost());
//unwrap exception
while(/*cause instanceof ServletException && */cause.getCause() != null)
{
messageStack.add("Exception with message: " + cause.getMessage());
messageStack.add(cause.getStackTrace()[0].toString());
cause = cause.getCause();
}
//all servlets are responsible for handling all possible situations
//so an exception handled here is a critical one
if(cause instanceof ServletRequestAlreadyRedirectedException)
{
return;
}
//print error to screen
if(this.printUnhandledExceptions)
{
if(!response.isCommitted())
{
System.out.println(new LogEntry(Level.CRITICAL, "exception handled in http-filter " + filterName, cause));
ServletSupport.printException(response, "An exception occurred for which no exception page is defined.\n" +
"Make sure you do so if your application is in a production environment.\n" +
"(in section [" + exceptionPagesSectionId + "])" +
"\n\n" + CollectionSupport.format(messageStack, "\n"), cause);
}
else
{
System.out.println(new LogEntry(Level.CRITICAL, "exception handled in http-filter " + filterName + " can not be printed: response already committed", cause));
}
}
}
|
[
"public",
"void",
"handleException",
"(",
"ServletRequest",
"request",
",",
"ServletResponse",
"response",
",",
"Throwable",
"cause",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"List",
"messageStack",
"=",
"new",
"ArrayList",
"(",
")",
";",
"messageStack",
".",
"add",
"(",
"\"Request: \"",
"+",
"request",
")",
";",
"messageStack",
".",
"add",
"(",
"\"Remote address: \"",
"+",
"request",
".",
"getRemoteAddr",
"(",
")",
")",
";",
"messageStack",
".",
"add",
"(",
"\"Remote host: \"",
"+",
"request",
".",
"getRemoteHost",
"(",
")",
")",
";",
"//unwrap exception",
"while",
"(",
"/*cause instanceof ServletException && */",
"cause",
".",
"getCause",
"(",
")",
"!=",
"null",
")",
"{",
"messageStack",
".",
"add",
"(",
"\"Exception with message: \"",
"+",
"cause",
".",
"getMessage",
"(",
")",
")",
";",
"messageStack",
".",
"add",
"(",
"cause",
".",
"getStackTrace",
"(",
")",
"[",
"0",
"]",
".",
"toString",
"(",
")",
")",
";",
"cause",
"=",
"cause",
".",
"getCause",
"(",
")",
";",
"}",
"//all servlets are responsible for handling all possible situations",
"//so an exception handled here is a critical one",
"if",
"(",
"cause",
"instanceof",
"ServletRequestAlreadyRedirectedException",
")",
"{",
"return",
";",
"}",
"//print error to screen",
"if",
"(",
"this",
".",
"printUnhandledExceptions",
")",
"{",
"if",
"(",
"!",
"response",
".",
"isCommitted",
"(",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"new",
"LogEntry",
"(",
"Level",
".",
"CRITICAL",
",",
"\"exception handled in http-filter \"",
"+",
"filterName",
",",
"cause",
")",
")",
";",
"ServletSupport",
".",
"printException",
"(",
"response",
",",
"\"An exception occurred for which no exception page is defined.\\n\"",
"+",
"\"Make sure you do so if your application is in a production environment.\\n\"",
"+",
"\"(in section [\"",
"+",
"exceptionPagesSectionId",
"+",
"\"])\"",
"+",
"\"\\n\\n\"",
"+",
"CollectionSupport",
".",
"format",
"(",
"messageStack",
",",
"\"\\n\"",
")",
",",
"cause",
")",
";",
"}",
"else",
"{",
"System",
".",
"out",
".",
"println",
"(",
"new",
"LogEntry",
"(",
"Level",
".",
"CRITICAL",
",",
"\"exception handled in http-filter \"",
"+",
"filterName",
"+",
"\" can not be printed: response already committed\"",
",",
"cause",
")",
")",
";",
"}",
"}",
"}"
] |
Is invoked in case an exception or error occurred in a servlet that was not handled by
the implementating code
<p/>
An attempt is made to redirect the request to an URL defined in the configuration
at section "SERVLET_EXCEPTION_REDIRECTS", key "unhandled_error"
<p/>
Override this method to implement your own error / exception handling
@param request
@param response
@param cause
|
[
"Is",
"invoked",
"in",
"case",
"an",
"exception",
"or",
"error",
"occurred",
"in",
"a",
"servlet",
"that",
"was",
"not",
"handled",
"by",
"the",
"implementating",
"code",
"<p",
"/",
">",
"An",
"attempt",
"is",
"made",
"to",
"redirect",
"the",
"request",
"to",
"an",
"URL",
"defined",
"in",
"the",
"configuration",
"at",
"section",
"SERVLET_EXCEPTION_REDIRECTS",
"key",
"unhandled_error",
"<p",
"/",
">",
"Override",
"this",
"method",
"to",
"implement",
"your",
"own",
"error",
"/",
"exception",
"handling"
] |
train
|
https://github.com/jmeetsma/Iglu-Http/blob/5b5ed3b417285dc79b7aa013bf2340bb5ba1ffbe/src/main/java/org/ijsberg/iglu/server/http/filter/WebAppEntryPoint.java#L461-L499
|
OpenLiberty/open-liberty
|
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java
|
JavaScriptUtils.getHtmlCookieString
|
public String getHtmlCookieString(String name, String value) {
"""
Creates and returns a JavaScript line for setting a cookie with the specified name and value. Note: The name and value will
be HTML-encoded.
"""
return getHtmlCookieString(name, value, null);
}
|
java
|
public String getHtmlCookieString(String name, String value) {
return getHtmlCookieString(name, value, null);
}
|
[
"public",
"String",
"getHtmlCookieString",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"return",
"getHtmlCookieString",
"(",
"name",
",",
"value",
",",
"null",
")",
";",
"}"
] |
Creates and returns a JavaScript line for setting a cookie with the specified name and value. Note: The name and value will
be HTML-encoded.
|
[
"Creates",
"and",
"returns",
"a",
"JavaScript",
"line",
"for",
"setting",
"a",
"cookie",
"with",
"the",
"specified",
"name",
"and",
"value",
".",
"Note",
":",
"The",
"name",
"and",
"value",
"will",
"be",
"HTML",
"-",
"encoded",
"."
] |
train
|
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java#L75-L77
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/ScriptBytecodeAdapter.java
|
ScriptBytecodeAdapter.castToType
|
public static Object castToType(Object object, Class type) throws Throwable {
"""
Provides a hook for type casting of the given object to the required type
@param type of object to convert the given object to
@param object the object to be converted
@return the original object or a new converted value
@throws Throwable if the type casting fails
"""
return DefaultTypeTransformation.castToType(object, type);
}
|
java
|
public static Object castToType(Object object, Class type) throws Throwable {
return DefaultTypeTransformation.castToType(object, type);
}
|
[
"public",
"static",
"Object",
"castToType",
"(",
"Object",
"object",
",",
"Class",
"type",
")",
"throws",
"Throwable",
"{",
"return",
"DefaultTypeTransformation",
".",
"castToType",
"(",
"object",
",",
"type",
")",
";",
"}"
] |
Provides a hook for type casting of the given object to the required type
@param type of object to convert the given object to
@param object the object to be converted
@return the original object or a new converted value
@throws Throwable if the type casting fails
|
[
"Provides",
"a",
"hook",
"for",
"type",
"casting",
"of",
"the",
"given",
"object",
"to",
"the",
"required",
"type"
] |
train
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ScriptBytecodeAdapter.java#L614-L616
|
soulgalore/crawler
|
src/main/java/com/soulgalore/crawler/core/impl/HTTPClientResponseFetcher.java
|
HTTPClientResponseFetcher.getBody
|
protected String getBody(HttpEntity entity, String enc) throws IOException {
"""
Get the body.
@param entity the http entity from the response
@param enc the encoding
@return the body as a String
@throws IOException if the body couldn't be fetched
"""
final StringBuilder body = new StringBuilder();
String buffer = "";
if (entity != null) {
final BufferedReader reader =
new BufferedReader(new InputStreamReader(entity.getContent(), enc));
while ((buffer = reader.readLine()) != null) {
body.append(buffer);
}
reader.close();
}
return body.toString();
}
|
java
|
protected String getBody(HttpEntity entity, String enc) throws IOException {
final StringBuilder body = new StringBuilder();
String buffer = "";
if (entity != null) {
final BufferedReader reader =
new BufferedReader(new InputStreamReader(entity.getContent(), enc));
while ((buffer = reader.readLine()) != null) {
body.append(buffer);
}
reader.close();
}
return body.toString();
}
|
[
"protected",
"String",
"getBody",
"(",
"HttpEntity",
"entity",
",",
"String",
"enc",
")",
"throws",
"IOException",
"{",
"final",
"StringBuilder",
"body",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"buffer",
"=",
"\"\"",
";",
"if",
"(",
"entity",
"!=",
"null",
")",
"{",
"final",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"entity",
".",
"getContent",
"(",
")",
",",
"enc",
")",
")",
";",
"while",
"(",
"(",
"buffer",
"=",
"reader",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"body",
".",
"append",
"(",
"buffer",
")",
";",
"}",
"reader",
".",
"close",
"(",
")",
";",
"}",
"return",
"body",
".",
"toString",
"(",
")",
";",
"}"
] |
Get the body.
@param entity the http entity from the response
@param enc the encoding
@return the body as a String
@throws IOException if the body couldn't be fetched
|
[
"Get",
"the",
"body",
"."
] |
train
|
https://github.com/soulgalore/crawler/blob/715ee7f1454eec14bebcb6d12563dfc32d9bbf48/src/main/java/com/soulgalore/crawler/core/impl/HTTPClientResponseFetcher.java#L178-L191
|
google/closure-templates
|
java/src/com/google/template/soy/soytree/SoyTreeUtils.java
|
SoyTreeUtils.getAllNodesOfType
|
public static <T extends Node> ImmutableList<T> getAllNodesOfType(
Node rootSoyNode, final Class<T> classObject) {
"""
Retrieves all nodes in a tree that are an instance of a particular class.
@param <T> The type of node to retrieve.
@param rootSoyNode The parse tree to search.
@param classObject The class whose instances to search for, including subclasses.
@return The nodes in the order they appear.
"""
return getAllMatchingNodesOfType(rootSoyNode, classObject, arg -> true);
}
|
java
|
public static <T extends Node> ImmutableList<T> getAllNodesOfType(
Node rootSoyNode, final Class<T> classObject) {
return getAllMatchingNodesOfType(rootSoyNode, classObject, arg -> true);
}
|
[
"public",
"static",
"<",
"T",
"extends",
"Node",
">",
"ImmutableList",
"<",
"T",
">",
"getAllNodesOfType",
"(",
"Node",
"rootSoyNode",
",",
"final",
"Class",
"<",
"T",
">",
"classObject",
")",
"{",
"return",
"getAllMatchingNodesOfType",
"(",
"rootSoyNode",
",",
"classObject",
",",
"arg",
"->",
"true",
")",
";",
"}"
] |
Retrieves all nodes in a tree that are an instance of a particular class.
@param <T> The type of node to retrieve.
@param rootSoyNode The parse tree to search.
@param classObject The class whose instances to search for, including subclasses.
@return The nodes in the order they appear.
|
[
"Retrieves",
"all",
"nodes",
"in",
"a",
"tree",
"that",
"are",
"an",
"instance",
"of",
"a",
"particular",
"class",
"."
] |
train
|
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/SoyTreeUtils.java#L136-L139
|
apache/groovy
|
src/main/groovy/groovy/lang/ProxyMetaClass.java
|
ProxyMetaClass.invokeConstructor
|
public Object invokeConstructor(final Object[] arguments) {
"""
Call invokeConstructor on adaptee with logic like in MetaClass unless we have an Interceptor.
With Interceptor the call is nested in its beforeInvoke and afterInvoke methods.
The method call is suppressed if Interceptor.doInvoke() returns false.
See Interceptor for details.
"""
return doCall(theClass, "ctor", arguments, interceptor, new Callable() {
public Object call() {
return adaptee.invokeConstructor(arguments);
}
});
}
|
java
|
public Object invokeConstructor(final Object[] arguments) {
return doCall(theClass, "ctor", arguments, interceptor, new Callable() {
public Object call() {
return adaptee.invokeConstructor(arguments);
}
});
}
|
[
"public",
"Object",
"invokeConstructor",
"(",
"final",
"Object",
"[",
"]",
"arguments",
")",
"{",
"return",
"doCall",
"(",
"theClass",
",",
"\"ctor\"",
",",
"arguments",
",",
"interceptor",
",",
"new",
"Callable",
"(",
")",
"{",
"public",
"Object",
"call",
"(",
")",
"{",
"return",
"adaptee",
".",
"invokeConstructor",
"(",
"arguments",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Call invokeConstructor on adaptee with logic like in MetaClass unless we have an Interceptor.
With Interceptor the call is nested in its beforeInvoke and afterInvoke methods.
The method call is suppressed if Interceptor.doInvoke() returns false.
See Interceptor for details.
|
[
"Call",
"invokeConstructor",
"on",
"adaptee",
"with",
"logic",
"like",
"in",
"MetaClass",
"unless",
"we",
"have",
"an",
"Interceptor",
".",
"With",
"Interceptor",
"the",
"call",
"is",
"nested",
"in",
"its",
"beforeInvoke",
"and",
"afterInvoke",
"methods",
".",
"The",
"method",
"call",
"is",
"suppressed",
"if",
"Interceptor",
".",
"doInvoke",
"()",
"returns",
"false",
".",
"See",
"Interceptor",
"for",
"details",
"."
] |
train
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/ProxyMetaClass.java#L160-L166
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.