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
|
---|---|---|---|---|---|---|---|---|---|---|
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspContentLoadBean.java | CmsJspContentLoadBean.convertResourceList | public static List<CmsJspContentAccessBean> convertResourceList(
CmsObject cms,
Locale locale,
List<CmsResource> resources) {
"""
Converts a list of {@link CmsResource} objects to a list of {@link CmsJspContentAccessBean} objects,
using the given locale.<p>
@param cms the current OpenCms user context
@param locale the default locale to use when accessing the content
@param resources a list of of {@link CmsResource} objects that should be converted
@return a list of {@link CmsJspContentAccessBean} objects created from the given {@link CmsResource} objects
"""
List<CmsJspContentAccessBean> result = new ArrayList<CmsJspContentAccessBean>(resources.size());
for (int i = 0, size = resources.size(); i < size; i++) {
CmsResource res = resources.get(i);
result.add(new CmsJspContentAccessBean(cms, locale, res));
}
return result;
} | java | public static List<CmsJspContentAccessBean> convertResourceList(
CmsObject cms,
Locale locale,
List<CmsResource> resources) {
List<CmsJspContentAccessBean> result = new ArrayList<CmsJspContentAccessBean>(resources.size());
for (int i = 0, size = resources.size(); i < size; i++) {
CmsResource res = resources.get(i);
result.add(new CmsJspContentAccessBean(cms, locale, res));
}
return result;
} | [
"public",
"static",
"List",
"<",
"CmsJspContentAccessBean",
">",
"convertResourceList",
"(",
"CmsObject",
"cms",
",",
"Locale",
"locale",
",",
"List",
"<",
"CmsResource",
">",
"resources",
")",
"{",
"List",
"<",
"CmsJspContentAccessBean",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"CmsJspContentAccessBean",
">",
"(",
"resources",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"size",
"=",
"resources",
".",
"size",
"(",
")",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"CmsResource",
"res",
"=",
"resources",
".",
"get",
"(",
"i",
")",
";",
"result",
".",
"add",
"(",
"new",
"CmsJspContentAccessBean",
"(",
"cms",
",",
"locale",
",",
"res",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
]
| Converts a list of {@link CmsResource} objects to a list of {@link CmsJspContentAccessBean} objects,
using the given locale.<p>
@param cms the current OpenCms user context
@param locale the default locale to use when accessing the content
@param resources a list of of {@link CmsResource} objects that should be converted
@return a list of {@link CmsJspContentAccessBean} objects created from the given {@link CmsResource} objects | [
"Converts",
"a",
"list",
"of",
"{",
"@link",
"CmsResource",
"}",
"objects",
"to",
"a",
"list",
"of",
"{",
"@link",
"CmsJspContentAccessBean",
"}",
"objects",
"using",
"the",
"given",
"locale",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspContentLoadBean.java#L118-L129 |
jenkinsci/jenkins | core/src/main/java/hudson/model/ParametersAction.java | ParametersAction.merge | @Nonnull
public ParametersAction merge(@CheckForNull ParametersAction overrides) {
"""
/*
Creates a new {@link ParametersAction} that contains all the parameters in this action
with the overrides / new values given as another {@link ParametersAction}.
@return New {@link ParametersAction}. The result may contain null {@link ParameterValue}s
"""
if (overrides == null) {
return new ParametersAction(parameters, this.safeParameters);
}
ParametersAction parametersAction = createUpdated(overrides.parameters);
Set<String> safe = new TreeSet<>();
if (parametersAction.safeParameters != null && this.safeParameters != null) {
safe.addAll(this.safeParameters);
}
if (overrides.safeParameters != null) {
safe.addAll(overrides.safeParameters);
}
parametersAction.safeParameters = safe;
return parametersAction;
} | java | @Nonnull
public ParametersAction merge(@CheckForNull ParametersAction overrides) {
if (overrides == null) {
return new ParametersAction(parameters, this.safeParameters);
}
ParametersAction parametersAction = createUpdated(overrides.parameters);
Set<String> safe = new TreeSet<>();
if (parametersAction.safeParameters != null && this.safeParameters != null) {
safe.addAll(this.safeParameters);
}
if (overrides.safeParameters != null) {
safe.addAll(overrides.safeParameters);
}
parametersAction.safeParameters = safe;
return parametersAction;
} | [
"@",
"Nonnull",
"public",
"ParametersAction",
"merge",
"(",
"@",
"CheckForNull",
"ParametersAction",
"overrides",
")",
"{",
"if",
"(",
"overrides",
"==",
"null",
")",
"{",
"return",
"new",
"ParametersAction",
"(",
"parameters",
",",
"this",
".",
"safeParameters",
")",
";",
"}",
"ParametersAction",
"parametersAction",
"=",
"createUpdated",
"(",
"overrides",
".",
"parameters",
")",
";",
"Set",
"<",
"String",
">",
"safe",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"if",
"(",
"parametersAction",
".",
"safeParameters",
"!=",
"null",
"&&",
"this",
".",
"safeParameters",
"!=",
"null",
")",
"{",
"safe",
".",
"addAll",
"(",
"this",
".",
"safeParameters",
")",
";",
"}",
"if",
"(",
"overrides",
".",
"safeParameters",
"!=",
"null",
")",
"{",
"safe",
".",
"addAll",
"(",
"overrides",
".",
"safeParameters",
")",
";",
"}",
"parametersAction",
".",
"safeParameters",
"=",
"safe",
";",
"return",
"parametersAction",
";",
"}"
]
| /*
Creates a new {@link ParametersAction} that contains all the parameters in this action
with the overrides / new values given as another {@link ParametersAction}.
@return New {@link ParametersAction}. The result may contain null {@link ParameterValue}s | [
"/",
"*",
"Creates",
"a",
"new",
"{"
]
| train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/ParametersAction.java#L268-L283 |
beanshell/beanshell | src/main/java/bsh/org/objectweb/asm/Type.java | Type.getMethodDescriptor | public static String getMethodDescriptor(final Type returnType, final Type... argumentTypes) {
"""
Returns the descriptor corresponding to the given argument and return types.
@param returnType the return type of the method.
@param argumentTypes the argument types of the method.
@return the descriptor corresponding to the given argument and return types.
"""
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append('(');
for (int i = 0; i < argumentTypes.length; ++i) {
argumentTypes[i].appendDescriptor(stringBuilder);
}
stringBuilder.append(')');
returnType.appendDescriptor(stringBuilder);
return stringBuilder.toString();
} | java | public static String getMethodDescriptor(final Type returnType, final Type... argumentTypes) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append('(');
for (int i = 0; i < argumentTypes.length; ++i) {
argumentTypes[i].appendDescriptor(stringBuilder);
}
stringBuilder.append(')');
returnType.appendDescriptor(stringBuilder);
return stringBuilder.toString();
} | [
"public",
"static",
"String",
"getMethodDescriptor",
"(",
"final",
"Type",
"returnType",
",",
"final",
"Type",
"...",
"argumentTypes",
")",
"{",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"stringBuilder",
".",
"append",
"(",
"'",
"'",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"argumentTypes",
".",
"length",
";",
"++",
"i",
")",
"{",
"argumentTypes",
"[",
"i",
"]",
".",
"appendDescriptor",
"(",
"stringBuilder",
")",
";",
"}",
"stringBuilder",
".",
"append",
"(",
"'",
"'",
")",
";",
"returnType",
".",
"appendDescriptor",
"(",
"stringBuilder",
")",
";",
"return",
"stringBuilder",
".",
"toString",
"(",
")",
";",
"}"
]
| Returns the descriptor corresponding to the given argument and return types.
@param returnType the return type of the method.
@param argumentTypes the argument types of the method.
@return the descriptor corresponding to the given argument and return types. | [
"Returns",
"the",
"descriptor",
"corresponding",
"to",
"the",
"given",
"argument",
"and",
"return",
"types",
"."
]
| train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/org/objectweb/asm/Type.java#L600-L609 |
jbundle/jbundle | base/model/src/main/java/org/jbundle/base/model/Utility.java | Utility.transferURLStream | public static String transferURLStream(String strURL, String strFilename) {
"""
Transfer the data stream from this URL to a string or file.
@param strURL The URL to read.
@param strFilename If non-null, create this file and send the URL data here.
@param strFilename If null, return the stream as a string.
@return The stream as a string if filename is null.
"""
return Utility.transferURLStream(strURL, strFilename, null);
} | java | public static String transferURLStream(String strURL, String strFilename)
{
return Utility.transferURLStream(strURL, strFilename, null);
} | [
"public",
"static",
"String",
"transferURLStream",
"(",
"String",
"strURL",
",",
"String",
"strFilename",
")",
"{",
"return",
"Utility",
".",
"transferURLStream",
"(",
"strURL",
",",
"strFilename",
",",
"null",
")",
";",
"}"
]
| Transfer the data stream from this URL to a string or file.
@param strURL The URL to read.
@param strFilename If non-null, create this file and send the URL data here.
@param strFilename If null, return the stream as a string.
@return The stream as a string if filename is null. | [
"Transfer",
"the",
"data",
"stream",
"from",
"this",
"URL",
"to",
"a",
"string",
"or",
"file",
"."
]
| train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L335-L338 |
mapbox/mapbox-navigation-android | libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationLauncher.java | NavigationLauncher.startNavigation | public static void startNavigation(Activity activity, NavigationLauncherOptions options) {
"""
Starts the UI with a {@link DirectionsRoute} already retrieved from
{@link com.mapbox.services.android.navigation.v5.navigation.NavigationRoute}
@param activity must be launched from another {@link Activity}
@param options with fields to customize the navigation view
"""
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor editor = preferences.edit();
storeDirectionsRouteValue(options, editor);
storeConfiguration(options, editor);
storeThemePreferences(options, editor);
storeOfflinePath(options, editor);
storeOfflineVersion(options, editor);
editor.apply();
Intent navigationActivity = new Intent(activity, MapboxNavigationActivity.class);
storeInitialMapPosition(options, navigationActivity);
activity.startActivity(navigationActivity);
} | java | public static void startNavigation(Activity activity, NavigationLauncherOptions options) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor editor = preferences.edit();
storeDirectionsRouteValue(options, editor);
storeConfiguration(options, editor);
storeThemePreferences(options, editor);
storeOfflinePath(options, editor);
storeOfflineVersion(options, editor);
editor.apply();
Intent navigationActivity = new Intent(activity, MapboxNavigationActivity.class);
storeInitialMapPosition(options, navigationActivity);
activity.startActivity(navigationActivity);
} | [
"public",
"static",
"void",
"startNavigation",
"(",
"Activity",
"activity",
",",
"NavigationLauncherOptions",
"options",
")",
"{",
"SharedPreferences",
"preferences",
"=",
"PreferenceManager",
".",
"getDefaultSharedPreferences",
"(",
"activity",
")",
";",
"SharedPreferences",
".",
"Editor",
"editor",
"=",
"preferences",
".",
"edit",
"(",
")",
";",
"storeDirectionsRouteValue",
"(",
"options",
",",
"editor",
")",
";",
"storeConfiguration",
"(",
"options",
",",
"editor",
")",
";",
"storeThemePreferences",
"(",
"options",
",",
"editor",
")",
";",
"storeOfflinePath",
"(",
"options",
",",
"editor",
")",
";",
"storeOfflineVersion",
"(",
"options",
",",
"editor",
")",
";",
"editor",
".",
"apply",
"(",
")",
";",
"Intent",
"navigationActivity",
"=",
"new",
"Intent",
"(",
"activity",
",",
"MapboxNavigationActivity",
".",
"class",
")",
";",
"storeInitialMapPosition",
"(",
"options",
",",
"navigationActivity",
")",
";",
"activity",
".",
"startActivity",
"(",
"navigationActivity",
")",
";",
"}"
]
| Starts the UI with a {@link DirectionsRoute} already retrieved from
{@link com.mapbox.services.android.navigation.v5.navigation.NavigationRoute}
@param activity must be launched from another {@link Activity}
@param options with fields to customize the navigation view | [
"Starts",
"the",
"UI",
"with",
"a",
"{",
"@link",
"DirectionsRoute",
"}",
"already",
"retrieved",
"from",
"{",
"@link",
"com",
".",
"mapbox",
".",
"services",
".",
"android",
".",
"navigation",
".",
"v5",
".",
"navigation",
".",
"NavigationRoute",
"}"
]
| train | https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationLauncher.java#L33-L49 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java | PatternBox.controlsStateChangeThroughDegradation | public static Pattern controlsStateChangeThroughDegradation() {
"""
Finds cases where proteins affect their degradation.
@return the pattern
"""
Pattern p = new Pattern(SequenceEntityReference.class, "upstream ER");
p.add(linkedER(true), "upstream ER", "upstream generic ER");
p.add(erToPE(), "upstream generic ER", "upstream SPE");
p.add(linkToComplex(), "upstream SPE", "upstream PE");
p.add(peToControl(), "upstream PE", "Control");
p.add(controlToConv(), "Control", "Conversion");
p.add(new NOT(participantER()), "Conversion", "upstream ER");
p.add(new Empty(new Participant(RelType.OUTPUT)), "Conversion");
p.add(new Participant(RelType.INPUT), "Conversion", "input PE");
p.add(linkToSpecific(), "input PE", "input SPE");
p.add(peToER(), "input SPE", "downstream generic ER");
p.add(type(SequenceEntityReference.class), "downstream generic ER");
p.add(linkedER(false), "downstream generic ER", "downstream ER");
return p;
} | java | public static Pattern controlsStateChangeThroughDegradation()
{
Pattern p = new Pattern(SequenceEntityReference.class, "upstream ER");
p.add(linkedER(true), "upstream ER", "upstream generic ER");
p.add(erToPE(), "upstream generic ER", "upstream SPE");
p.add(linkToComplex(), "upstream SPE", "upstream PE");
p.add(peToControl(), "upstream PE", "Control");
p.add(controlToConv(), "Control", "Conversion");
p.add(new NOT(participantER()), "Conversion", "upstream ER");
p.add(new Empty(new Participant(RelType.OUTPUT)), "Conversion");
p.add(new Participant(RelType.INPUT), "Conversion", "input PE");
p.add(linkToSpecific(), "input PE", "input SPE");
p.add(peToER(), "input SPE", "downstream generic ER");
p.add(type(SequenceEntityReference.class), "downstream generic ER");
p.add(linkedER(false), "downstream generic ER", "downstream ER");
return p;
} | [
"public",
"static",
"Pattern",
"controlsStateChangeThroughDegradation",
"(",
")",
"{",
"Pattern",
"p",
"=",
"new",
"Pattern",
"(",
"SequenceEntityReference",
".",
"class",
",",
"\"upstream ER\"",
")",
";",
"p",
".",
"add",
"(",
"linkedER",
"(",
"true",
")",
",",
"\"upstream ER\"",
",",
"\"upstream generic ER\"",
")",
";",
"p",
".",
"add",
"(",
"erToPE",
"(",
")",
",",
"\"upstream generic ER\"",
",",
"\"upstream SPE\"",
")",
";",
"p",
".",
"add",
"(",
"linkToComplex",
"(",
")",
",",
"\"upstream SPE\"",
",",
"\"upstream PE\"",
")",
";",
"p",
".",
"add",
"(",
"peToControl",
"(",
")",
",",
"\"upstream PE\"",
",",
"\"Control\"",
")",
";",
"p",
".",
"add",
"(",
"controlToConv",
"(",
")",
",",
"\"Control\"",
",",
"\"Conversion\"",
")",
";",
"p",
".",
"add",
"(",
"new",
"NOT",
"(",
"participantER",
"(",
")",
")",
",",
"\"Conversion\"",
",",
"\"upstream ER\"",
")",
";",
"p",
".",
"add",
"(",
"new",
"Empty",
"(",
"new",
"Participant",
"(",
"RelType",
".",
"OUTPUT",
")",
")",
",",
"\"Conversion\"",
")",
";",
"p",
".",
"add",
"(",
"new",
"Participant",
"(",
"RelType",
".",
"INPUT",
")",
",",
"\"Conversion\"",
",",
"\"input PE\"",
")",
";",
"p",
".",
"add",
"(",
"linkToSpecific",
"(",
")",
",",
"\"input PE\"",
",",
"\"input SPE\"",
")",
";",
"p",
".",
"add",
"(",
"peToER",
"(",
")",
",",
"\"input SPE\"",
",",
"\"downstream generic ER\"",
")",
";",
"p",
".",
"add",
"(",
"type",
"(",
"SequenceEntityReference",
".",
"class",
")",
",",
"\"downstream generic ER\"",
")",
";",
"p",
".",
"add",
"(",
"linkedER",
"(",
"false",
")",
",",
"\"downstream generic ER\"",
",",
"\"downstream ER\"",
")",
";",
"return",
"p",
";",
"}"
]
| Finds cases where proteins affect their degradation.
@return the pattern | [
"Finds",
"cases",
"where",
"proteins",
"affect",
"their",
"degradation",
"."
]
| train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java#L282-L298 |
james-hu/jabb-core | src/main/java/net/sf/jabb/quartz/SchedulerUtility.java | SchedulerUtility.convertDataMapToText | public static String convertDataMapToText(Map<String, Object> dataMap) {
"""
Convert JobDataMap into text in properties file format
@param dataMap the JobDataMap
@return a text in properties file format
"""
StringBuilder sb = new StringBuilder();
for (Entry<String, Object> entry: dataMap.entrySet()){
sb.append(entry.getKey()).append("=").append(entry.getValue());
sb.append('\n');
}
return sb.toString();
} | java | public static String convertDataMapToText(Map<String, Object> dataMap){
StringBuilder sb = new StringBuilder();
for (Entry<String, Object> entry: dataMap.entrySet()){
sb.append(entry.getKey()).append("=").append(entry.getValue());
sb.append('\n');
}
return sb.toString();
} | [
"public",
"static",
"String",
"convertDataMapToText",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"dataMap",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"Object",
">",
"entry",
":",
"dataMap",
".",
"entrySet",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
".",
"append",
"(",
"\"=\"",
")",
".",
"append",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
]
| Convert JobDataMap into text in properties file format
@param dataMap the JobDataMap
@return a text in properties file format | [
"Convert",
"JobDataMap",
"into",
"text",
"in",
"properties",
"file",
"format"
]
| train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/quartz/SchedulerUtility.java#L75-L82 |
jglobus/JGlobus | gridftp/src/main/java/org/globus/ftp/GridFTPClient.java | GridFTPClient.setDataChannelProtection | public void setDataChannelProtection(int protection)
throws IOException, ServerException {
"""
Sets data channel protection level (PROT).
@param protection should be
{@link GridFTPSession#PROTECTION_CLEAR CLEAR},
{@link GridFTPSession#PROTECTION_SAFE SAFE}, or
{@link GridFTPSession#PROTECTION_PRIVATE PRIVATE}, or
{@link GridFTPSession#PROTECTION_CONFIDENTIAL CONFIDENTIAL}.
"""
String protectionStr = null;
switch(protection) {
case GridFTPSession.PROTECTION_CLEAR:
protectionStr = "C"; break;
case GridFTPSession.PROTECTION_SAFE:
protectionStr = "S"; break;
case GridFTPSession.PROTECTION_CONFIDENTIAL:
protectionStr = "E"; break;
case GridFTPSession.PROTECTION_PRIVATE:
protectionStr = "P"; break;
default: throw new IllegalArgumentException("Bad protection: " +
protection);
}
Command cmd = new Command("PROT", protectionStr);
try {
controlChannel.execute(cmd);
} catch (UnexpectedReplyCodeException urce) {
throw ServerException.embedUnexpectedReplyCodeException(urce);
} catch(FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
}
this.gSession.dataChannelProtection = protection;
gLocalServer.setDataChannelProtection(protection);
} | java | public void setDataChannelProtection(int protection)
throws IOException, ServerException {
String protectionStr = null;
switch(protection) {
case GridFTPSession.PROTECTION_CLEAR:
protectionStr = "C"; break;
case GridFTPSession.PROTECTION_SAFE:
protectionStr = "S"; break;
case GridFTPSession.PROTECTION_CONFIDENTIAL:
protectionStr = "E"; break;
case GridFTPSession.PROTECTION_PRIVATE:
protectionStr = "P"; break;
default: throw new IllegalArgumentException("Bad protection: " +
protection);
}
Command cmd = new Command("PROT", protectionStr);
try {
controlChannel.execute(cmd);
} catch (UnexpectedReplyCodeException urce) {
throw ServerException.embedUnexpectedReplyCodeException(urce);
} catch(FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
}
this.gSession.dataChannelProtection = protection;
gLocalServer.setDataChannelProtection(protection);
} | [
"public",
"void",
"setDataChannelProtection",
"(",
"int",
"protection",
")",
"throws",
"IOException",
",",
"ServerException",
"{",
"String",
"protectionStr",
"=",
"null",
";",
"switch",
"(",
"protection",
")",
"{",
"case",
"GridFTPSession",
".",
"PROTECTION_CLEAR",
":",
"protectionStr",
"=",
"\"C\"",
";",
"break",
";",
"case",
"GridFTPSession",
".",
"PROTECTION_SAFE",
":",
"protectionStr",
"=",
"\"S\"",
";",
"break",
";",
"case",
"GridFTPSession",
".",
"PROTECTION_CONFIDENTIAL",
":",
"protectionStr",
"=",
"\"E\"",
";",
"break",
";",
"case",
"GridFTPSession",
".",
"PROTECTION_PRIVATE",
":",
"protectionStr",
"=",
"\"P\"",
";",
"break",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Bad protection: \"",
"+",
"protection",
")",
";",
"}",
"Command",
"cmd",
"=",
"new",
"Command",
"(",
"\"PROT\"",
",",
"protectionStr",
")",
";",
"try",
"{",
"controlChannel",
".",
"execute",
"(",
"cmd",
")",
";",
"}",
"catch",
"(",
"UnexpectedReplyCodeException",
"urce",
")",
"{",
"throw",
"ServerException",
".",
"embedUnexpectedReplyCodeException",
"(",
"urce",
")",
";",
"}",
"catch",
"(",
"FTPReplyParseException",
"rpe",
")",
"{",
"throw",
"ServerException",
".",
"embedFTPReplyParseException",
"(",
"rpe",
")",
";",
"}",
"this",
".",
"gSession",
".",
"dataChannelProtection",
"=",
"protection",
";",
"gLocalServer",
".",
"setDataChannelProtection",
"(",
"protection",
")",
";",
"}"
]
| Sets data channel protection level (PROT).
@param protection should be
{@link GridFTPSession#PROTECTION_CLEAR CLEAR},
{@link GridFTPSession#PROTECTION_SAFE SAFE}, or
{@link GridFTPSession#PROTECTION_PRIVATE PRIVATE}, or
{@link GridFTPSession#PROTECTION_CONFIDENTIAL CONFIDENTIAL}. | [
"Sets",
"data",
"channel",
"protection",
"level",
"(",
"PROT",
")",
"."
]
| train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/GridFTPClient.java#L843-L872 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/model/TableDef.java | TableDef.getForeignkey | public ForeignkeyDef getForeignkey(String name, String tableName) {
"""
Returns the foreignkey to the specified table.
@param name The name of the foreignkey
@param tableName The name of the referenced table
@return The foreignkey def or <code>null</code> if it does not exist
"""
String realName = (name == null ? "" : name);
ForeignkeyDef def = null;
for (Iterator it = getForeignkeys(); it.hasNext();)
{
def = (ForeignkeyDef)it.next();
if (realName.equals(def.getName()) &&
def.getTableName().equals(tableName))
{
return def;
}
}
return null;
} | java | public ForeignkeyDef getForeignkey(String name, String tableName)
{
String realName = (name == null ? "" : name);
ForeignkeyDef def = null;
for (Iterator it = getForeignkeys(); it.hasNext();)
{
def = (ForeignkeyDef)it.next();
if (realName.equals(def.getName()) &&
def.getTableName().equals(tableName))
{
return def;
}
}
return null;
} | [
"public",
"ForeignkeyDef",
"getForeignkey",
"(",
"String",
"name",
",",
"String",
"tableName",
")",
"{",
"String",
"realName",
"=",
"(",
"name",
"==",
"null",
"?",
"\"\"",
":",
"name",
")",
";",
"ForeignkeyDef",
"def",
"=",
"null",
";",
"for",
"(",
"Iterator",
"it",
"=",
"getForeignkeys",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"def",
"=",
"(",
"ForeignkeyDef",
")",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"realName",
".",
"equals",
"(",
"def",
".",
"getName",
"(",
")",
")",
"&&",
"def",
".",
"getTableName",
"(",
")",
".",
"equals",
"(",
"tableName",
")",
")",
"{",
"return",
"def",
";",
"}",
"}",
"return",
"null",
";",
"}"
]
| Returns the foreignkey to the specified table.
@param name The name of the foreignkey
@param tableName The name of the referenced table
@return The foreignkey def or <code>null</code> if it does not exist | [
"Returns",
"the",
"foreignkey",
"to",
"the",
"specified",
"table",
"."
]
| train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/TableDef.java#L184-L199 |
square/javapoet | src/main/java/com/squareup/javapoet/Util.java | Util.stringLiteralWithDoubleQuotes | static String stringLiteralWithDoubleQuotes(String value, String indent) {
"""
Returns the string literal representing {@code value}, including wrapping double quotes.
"""
StringBuilder result = new StringBuilder(value.length() + 2);
result.append('"');
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
// trivial case: single quote must not be escaped
if (c == '\'') {
result.append("'");
continue;
}
// trivial case: double quotes must be escaped
if (c == '\"') {
result.append("\\\"");
continue;
}
// default case: just let character literal do its work
result.append(characterLiteralWithoutSingleQuotes(c));
// need to append indent after linefeed?
if (c == '\n' && i + 1 < value.length()) {
result.append("\"\n").append(indent).append(indent).append("+ \"");
}
}
result.append('"');
return result.toString();
} | java | static String stringLiteralWithDoubleQuotes(String value, String indent) {
StringBuilder result = new StringBuilder(value.length() + 2);
result.append('"');
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
// trivial case: single quote must not be escaped
if (c == '\'') {
result.append("'");
continue;
}
// trivial case: double quotes must be escaped
if (c == '\"') {
result.append("\\\"");
continue;
}
// default case: just let character literal do its work
result.append(characterLiteralWithoutSingleQuotes(c));
// need to append indent after linefeed?
if (c == '\n' && i + 1 < value.length()) {
result.append("\"\n").append(indent).append(indent).append("+ \"");
}
}
result.append('"');
return result.toString();
} | [
"static",
"String",
"stringLiteralWithDoubleQuotes",
"(",
"String",
"value",
",",
"String",
"indent",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
"value",
".",
"length",
"(",
")",
"+",
"2",
")",
";",
"result",
".",
"append",
"(",
"'",
"'",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"value",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"value",
".",
"charAt",
"(",
"i",
")",
";",
"// trivial case: single quote must not be escaped",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"result",
".",
"append",
"(",
"\"'\"",
")",
";",
"continue",
";",
"}",
"// trivial case: double quotes must be escaped",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"result",
".",
"append",
"(",
"\"\\\\\\\"\"",
")",
";",
"continue",
";",
"}",
"// default case: just let character literal do its work",
"result",
".",
"append",
"(",
"characterLiteralWithoutSingleQuotes",
"(",
"c",
")",
")",
";",
"// need to append indent after linefeed?",
"if",
"(",
"c",
"==",
"'",
"'",
"&&",
"i",
"+",
"1",
"<",
"value",
".",
"length",
"(",
")",
")",
"{",
"result",
".",
"append",
"(",
"\"\\\"\\n\"",
")",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"\"+ \\\"\"",
")",
";",
"}",
"}",
"result",
".",
"append",
"(",
"'",
"'",
")",
";",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
]
| Returns the string literal representing {@code value}, including wrapping double quotes. | [
"Returns",
"the",
"string",
"literal",
"representing",
"{"
]
| train | https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/Util.java#L106-L130 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/TypeUtility.java | TypeUtility.isCollectionOfType | public static boolean isCollectionOfType(TypeName typeName, TypeName elementTypeName) {
"""
Checks if is collection and if element type is the one passed as parameter.
@param typeName
the type name
@param elementTypeName
the element type name
@return true, if is collection
"""
return isAssignable(typeName, Collection.class)
&& isEquals(((ParameterizedTypeName) typeName).typeArguments.get(0), elementTypeName);
} | java | public static boolean isCollectionOfType(TypeName typeName, TypeName elementTypeName) {
return isAssignable(typeName, Collection.class)
&& isEquals(((ParameterizedTypeName) typeName).typeArguments.get(0), elementTypeName);
} | [
"public",
"static",
"boolean",
"isCollectionOfType",
"(",
"TypeName",
"typeName",
",",
"TypeName",
"elementTypeName",
")",
"{",
"return",
"isAssignable",
"(",
"typeName",
",",
"Collection",
".",
"class",
")",
"&&",
"isEquals",
"(",
"(",
"(",
"ParameterizedTypeName",
")",
"typeName",
")",
".",
"typeArguments",
".",
"get",
"(",
"0",
")",
",",
"elementTypeName",
")",
";",
"}"
]
| Checks if is collection and if element type is the one passed as parameter.
@param typeName
the type name
@param elementTypeName
the element type name
@return true, if is collection | [
"Checks",
"if",
"is",
"collection",
"and",
"if",
"element",
"type",
"is",
"the",
"one",
"passed",
"as",
"parameter",
"."
]
| train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/TypeUtility.java#L697-L700 |
rzwitserloot/lombok | src/core/lombok/core/handlers/HandlerUtil.java | HandlerUtil.toAllWitherNames | public static List<String> toAllWitherNames(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) {
"""
Returns all names of methods that would represent the wither for a field with the provided name.
For example if {@code isBoolean} is true, then a field named {@code isRunning} would produce:<br />
{@code [withRunning, withIsRunning]}
@param accessors Accessors configuration.
@param fieldName the name of the field.
@param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}.
"""
return toAllAccessorNames(ast, accessors, fieldName, isBoolean, "with", "with", false);
} | java | public static List<String> toAllWitherNames(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) {
return toAllAccessorNames(ast, accessors, fieldName, isBoolean, "with", "with", false);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"toAllWitherNames",
"(",
"AST",
"<",
"?",
",",
"?",
",",
"?",
">",
"ast",
",",
"AnnotationValues",
"<",
"Accessors",
">",
"accessors",
",",
"CharSequence",
"fieldName",
",",
"boolean",
"isBoolean",
")",
"{",
"return",
"toAllAccessorNames",
"(",
"ast",
",",
"accessors",
",",
"fieldName",
",",
"isBoolean",
",",
"\"with\"",
",",
"\"with\"",
",",
"false",
")",
";",
"}"
]
| Returns all names of methods that would represent the wither for a field with the provided name.
For example if {@code isBoolean} is true, then a field named {@code isRunning} would produce:<br />
{@code [withRunning, withIsRunning]}
@param accessors Accessors configuration.
@param fieldName the name of the field.
@param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}. | [
"Returns",
"all",
"names",
"of",
"methods",
"that",
"would",
"represent",
"the",
"wither",
"for",
"a",
"field",
"with",
"the",
"provided",
"name",
"."
]
| train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/handlers/HandlerUtil.java#L590-L592 |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.isRootResource | public boolean isRootResource(final Graph graph, final Node subject) {
"""
Is the subject the repository root resource.
@param graph The graph
@param subject The current subject
@return true if has rdf:type http://fedora.info/definitions/v4/repository#RepositoryRoot
"""
final String rootRes = graph.getPrefixMapping().expandPrefix(FEDORA_REPOSITORY_ROOT);
final Node root = createResource(rootRes).asNode();
return graph.contains(subject, rdfType().asNode(), root);
} | java | public boolean isRootResource(final Graph graph, final Node subject) {
final String rootRes = graph.getPrefixMapping().expandPrefix(FEDORA_REPOSITORY_ROOT);
final Node root = createResource(rootRes).asNode();
return graph.contains(subject, rdfType().asNode(), root);
} | [
"public",
"boolean",
"isRootResource",
"(",
"final",
"Graph",
"graph",
",",
"final",
"Node",
"subject",
")",
"{",
"final",
"String",
"rootRes",
"=",
"graph",
".",
"getPrefixMapping",
"(",
")",
".",
"expandPrefix",
"(",
"FEDORA_REPOSITORY_ROOT",
")",
";",
"final",
"Node",
"root",
"=",
"createResource",
"(",
"rootRes",
")",
".",
"asNode",
"(",
")",
";",
"return",
"graph",
".",
"contains",
"(",
"subject",
",",
"rdfType",
"(",
")",
".",
"asNode",
"(",
")",
",",
"root",
")",
";",
"}"
]
| Is the subject the repository root resource.
@param graph The graph
@param subject The current subject
@return true if has rdf:type http://fedora.info/definitions/v4/repository#RepositoryRoot | [
"Is",
"the",
"subject",
"the",
"repository",
"root",
"resource",
"."
]
| train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L386-L390 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javadoc/TypeMaker.java | TypeMaker.getTypeString | static String getTypeString(DocEnv env, Type t, boolean full) {
"""
Return the string representation of a type use. Bounds of type
variables are not included; bounds of wildcard types are.
Class names are qualified if "full" is true.
"""
// TODO: should annotations be included here?
if (t.isAnnotated()) {
t = t.unannotatedType();
}
switch (t.getTag()) {
case ARRAY:
StringBuilder s = new StringBuilder();
while (t.hasTag(ARRAY)) {
s.append("[]");
t = env.types.elemtype(t);
}
s.insert(0, getTypeString(env, t, full));
return s.toString();
case CLASS:
return ParameterizedTypeImpl.
parameterizedTypeToString(env, (ClassType)t, full);
case WILDCARD:
Type.WildcardType a = (Type.WildcardType)t;
return WildcardTypeImpl.wildcardTypeToString(env, a, full);
default:
return t.tsym.getQualifiedName().toString();
}
} | java | static String getTypeString(DocEnv env, Type t, boolean full) {
// TODO: should annotations be included here?
if (t.isAnnotated()) {
t = t.unannotatedType();
}
switch (t.getTag()) {
case ARRAY:
StringBuilder s = new StringBuilder();
while (t.hasTag(ARRAY)) {
s.append("[]");
t = env.types.elemtype(t);
}
s.insert(0, getTypeString(env, t, full));
return s.toString();
case CLASS:
return ParameterizedTypeImpl.
parameterizedTypeToString(env, (ClassType)t, full);
case WILDCARD:
Type.WildcardType a = (Type.WildcardType)t;
return WildcardTypeImpl.wildcardTypeToString(env, a, full);
default:
return t.tsym.getQualifiedName().toString();
}
} | [
"static",
"String",
"getTypeString",
"(",
"DocEnv",
"env",
",",
"Type",
"t",
",",
"boolean",
"full",
")",
"{",
"// TODO: should annotations be included here?",
"if",
"(",
"t",
".",
"isAnnotated",
"(",
")",
")",
"{",
"t",
"=",
"t",
".",
"unannotatedType",
"(",
")",
";",
"}",
"switch",
"(",
"t",
".",
"getTag",
"(",
")",
")",
"{",
"case",
"ARRAY",
":",
"StringBuilder",
"s",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"while",
"(",
"t",
".",
"hasTag",
"(",
"ARRAY",
")",
")",
"{",
"s",
".",
"append",
"(",
"\"[]\"",
")",
";",
"t",
"=",
"env",
".",
"types",
".",
"elemtype",
"(",
"t",
")",
";",
"}",
"s",
".",
"insert",
"(",
"0",
",",
"getTypeString",
"(",
"env",
",",
"t",
",",
"full",
")",
")",
";",
"return",
"s",
".",
"toString",
"(",
")",
";",
"case",
"CLASS",
":",
"return",
"ParameterizedTypeImpl",
".",
"parameterizedTypeToString",
"(",
"env",
",",
"(",
"ClassType",
")",
"t",
",",
"full",
")",
";",
"case",
"WILDCARD",
":",
"Type",
".",
"WildcardType",
"a",
"=",
"(",
"Type",
".",
"WildcardType",
")",
"t",
";",
"return",
"WildcardTypeImpl",
".",
"wildcardTypeToString",
"(",
"env",
",",
"a",
",",
"full",
")",
";",
"default",
":",
"return",
"t",
".",
"tsym",
".",
"getQualifiedName",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"}"
]
| Return the string representation of a type use. Bounds of type
variables are not included; bounds of wildcard types are.
Class names are qualified if "full" is true. | [
"Return",
"the",
"string",
"representation",
"of",
"a",
"type",
"use",
".",
"Bounds",
"of",
"type",
"variables",
"are",
"not",
"included",
";",
"bounds",
"of",
"wildcard",
"types",
"are",
".",
"Class",
"names",
"are",
"qualified",
"if",
"full",
"is",
"true",
"."
]
| train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javadoc/TypeMaker.java#L155-L178 |
netty/netty | buffer/src/main/java/io/netty/buffer/PoolThreadCache.java | PoolThreadCache.allocateTiny | boolean allocateTiny(PoolArena<?> area, PooledByteBuf<?> buf, int reqCapacity, int normCapacity) {
"""
Try to allocate a tiny buffer out of the cache. Returns {@code true} if successful {@code false} otherwise
"""
return allocate(cacheForTiny(area, normCapacity), buf, reqCapacity);
} | java | boolean allocateTiny(PoolArena<?> area, PooledByteBuf<?> buf, int reqCapacity, int normCapacity) {
return allocate(cacheForTiny(area, normCapacity), buf, reqCapacity);
} | [
"boolean",
"allocateTiny",
"(",
"PoolArena",
"<",
"?",
">",
"area",
",",
"PooledByteBuf",
"<",
"?",
">",
"buf",
",",
"int",
"reqCapacity",
",",
"int",
"normCapacity",
")",
"{",
"return",
"allocate",
"(",
"cacheForTiny",
"(",
"area",
",",
"normCapacity",
")",
",",
"buf",
",",
"reqCapacity",
")",
";",
"}"
]
| Try to allocate a tiny buffer out of the cache. Returns {@code true} if successful {@code false} otherwise | [
"Try",
"to",
"allocate",
"a",
"tiny",
"buffer",
"out",
"of",
"the",
"cache",
".",
"Returns",
"{"
]
| train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/PoolThreadCache.java#L165-L167 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/protocol/PolicyInfo.java | PolicyInfo.addDestPath | public void addDestPath(String in, Properties repl) throws IOException {
"""
Sets the destination path on which this policy has to be applied
"""
Path dPath = new Path(in);
if (!dPath.isAbsolute() || !dPath.toUri().isAbsolute()) {
throw new IOException("Path " + in + " is not absolute.");
}
PathInfo pinfo = new PathInfo(dPath, repl);
if (this.destPath == null) {
this.destPath = new ArrayList<PathInfo>();
}
this.destPath.add(pinfo);
} | java | public void addDestPath(String in, Properties repl) throws IOException {
Path dPath = new Path(in);
if (!dPath.isAbsolute() || !dPath.toUri().isAbsolute()) {
throw new IOException("Path " + in + " is not absolute.");
}
PathInfo pinfo = new PathInfo(dPath, repl);
if (this.destPath == null) {
this.destPath = new ArrayList<PathInfo>();
}
this.destPath.add(pinfo);
} | [
"public",
"void",
"addDestPath",
"(",
"String",
"in",
",",
"Properties",
"repl",
")",
"throws",
"IOException",
"{",
"Path",
"dPath",
"=",
"new",
"Path",
"(",
"in",
")",
";",
"if",
"(",
"!",
"dPath",
".",
"isAbsolute",
"(",
")",
"||",
"!",
"dPath",
".",
"toUri",
"(",
")",
".",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Path \"",
"+",
"in",
"+",
"\" is not absolute.\"",
")",
";",
"}",
"PathInfo",
"pinfo",
"=",
"new",
"PathInfo",
"(",
"dPath",
",",
"repl",
")",
";",
"if",
"(",
"this",
".",
"destPath",
"==",
"null",
")",
"{",
"this",
".",
"destPath",
"=",
"new",
"ArrayList",
"<",
"PathInfo",
">",
"(",
")",
";",
"}",
"this",
".",
"destPath",
".",
"add",
"(",
"pinfo",
")",
";",
"}"
]
| Sets the destination path on which this policy has to be applied | [
"Sets",
"the",
"destination",
"path",
"on",
"which",
"this",
"policy",
"has",
"to",
"be",
"applied"
]
| train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/protocol/PolicyInfo.java#L135-L145 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/dialects/DefaultDialect.java | DefaultDialect.selectStarParametrized | @Override
public String selectStarParametrized(String table, String ... parameters) {
"""
Produces a parametrized AND query.
Example:
<pre>
String sql = dialect.selectStarParametrized("people", "name", "ssn", "dob");
//generates:
//SELECT * FROM people WHERE name = ? AND ssn = ? AND dob = ?
</pre>
@param table name of table
@param parameters list of parameter names
@return something like: "select * from table_name where name = ? and last_name = ? ..."
"""
StringBuilder sql = new StringBuilder().append("SELECT * FROM ").append(table).append(" WHERE ");
join(sql, parameters, " = ? AND ");
sql.append(" = ?");
return sql.toString();
} | java | @Override
public String selectStarParametrized(String table, String ... parameters) {
StringBuilder sql = new StringBuilder().append("SELECT * FROM ").append(table).append(" WHERE ");
join(sql, parameters, " = ? AND ");
sql.append(" = ?");
return sql.toString();
} | [
"@",
"Override",
"public",
"String",
"selectStarParametrized",
"(",
"String",
"table",
",",
"String",
"...",
"parameters",
")",
"{",
"StringBuilder",
"sql",
"=",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"\"SELECT * FROM \"",
")",
".",
"append",
"(",
"table",
")",
".",
"append",
"(",
"\" WHERE \"",
")",
";",
"join",
"(",
"sql",
",",
"parameters",
",",
"\" = ? AND \"",
")",
";",
"sql",
".",
"append",
"(",
"\" = ?\"",
")",
";",
"return",
"sql",
".",
"toString",
"(",
")",
";",
"}"
]
| Produces a parametrized AND query.
Example:
<pre>
String sql = dialect.selectStarParametrized("people", "name", "ssn", "dob");
//generates:
//SELECT * FROM people WHERE name = ? AND ssn = ? AND dob = ?
</pre>
@param table name of table
@param parameters list of parameter names
@return something like: "select * from table_name where name = ? and last_name = ? ..." | [
"Produces",
"a",
"parametrized",
"AND",
"query",
".",
"Example",
":",
"<pre",
">",
"String",
"sql",
"=",
"dialect",
".",
"selectStarParametrized",
"(",
"people",
"name",
"ssn",
"dob",
")",
";",
"//",
"generates",
":",
"//",
"SELECT",
"*",
"FROM",
"people",
"WHERE",
"name",
"=",
"?",
"AND",
"ssn",
"=",
"?",
"AND",
"dob",
"=",
"?",
"<",
"/",
"pre",
">"
]
| train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/dialects/DefaultDialect.java#L71-L77 |
netty/netty | codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttEncoder.java | MqttEncoder.doEncode | static ByteBuf doEncode(ByteBufAllocator byteBufAllocator, MqttMessage message) {
"""
This is the main encoding method.
It's only visible for testing.
@param byteBufAllocator Allocates ByteBuf
@param message MQTT message to encode
@return ByteBuf with encoded bytes
"""
switch (message.fixedHeader().messageType()) {
case CONNECT:
return encodeConnectMessage(byteBufAllocator, (MqttConnectMessage) message);
case CONNACK:
return encodeConnAckMessage(byteBufAllocator, (MqttConnAckMessage) message);
case PUBLISH:
return encodePublishMessage(byteBufAllocator, (MqttPublishMessage) message);
case SUBSCRIBE:
return encodeSubscribeMessage(byteBufAllocator, (MqttSubscribeMessage) message);
case UNSUBSCRIBE:
return encodeUnsubscribeMessage(byteBufAllocator, (MqttUnsubscribeMessage) message);
case SUBACK:
return encodeSubAckMessage(byteBufAllocator, (MqttSubAckMessage) message);
case UNSUBACK:
case PUBACK:
case PUBREC:
case PUBREL:
case PUBCOMP:
return encodeMessageWithOnlySingleByteFixedHeaderAndMessageId(byteBufAllocator, message);
case PINGREQ:
case PINGRESP:
case DISCONNECT:
return encodeMessageWithOnlySingleByteFixedHeader(byteBufAllocator, message);
default:
throw new IllegalArgumentException(
"Unknown message type: " + message.fixedHeader().messageType().value());
}
} | java | static ByteBuf doEncode(ByteBufAllocator byteBufAllocator, MqttMessage message) {
switch (message.fixedHeader().messageType()) {
case CONNECT:
return encodeConnectMessage(byteBufAllocator, (MqttConnectMessage) message);
case CONNACK:
return encodeConnAckMessage(byteBufAllocator, (MqttConnAckMessage) message);
case PUBLISH:
return encodePublishMessage(byteBufAllocator, (MqttPublishMessage) message);
case SUBSCRIBE:
return encodeSubscribeMessage(byteBufAllocator, (MqttSubscribeMessage) message);
case UNSUBSCRIBE:
return encodeUnsubscribeMessage(byteBufAllocator, (MqttUnsubscribeMessage) message);
case SUBACK:
return encodeSubAckMessage(byteBufAllocator, (MqttSubAckMessage) message);
case UNSUBACK:
case PUBACK:
case PUBREC:
case PUBREL:
case PUBCOMP:
return encodeMessageWithOnlySingleByteFixedHeaderAndMessageId(byteBufAllocator, message);
case PINGREQ:
case PINGRESP:
case DISCONNECT:
return encodeMessageWithOnlySingleByteFixedHeader(byteBufAllocator, message);
default:
throw new IllegalArgumentException(
"Unknown message type: " + message.fixedHeader().messageType().value());
}
} | [
"static",
"ByteBuf",
"doEncode",
"(",
"ByteBufAllocator",
"byteBufAllocator",
",",
"MqttMessage",
"message",
")",
"{",
"switch",
"(",
"message",
".",
"fixedHeader",
"(",
")",
".",
"messageType",
"(",
")",
")",
"{",
"case",
"CONNECT",
":",
"return",
"encodeConnectMessage",
"(",
"byteBufAllocator",
",",
"(",
"MqttConnectMessage",
")",
"message",
")",
";",
"case",
"CONNACK",
":",
"return",
"encodeConnAckMessage",
"(",
"byteBufAllocator",
",",
"(",
"MqttConnAckMessage",
")",
"message",
")",
";",
"case",
"PUBLISH",
":",
"return",
"encodePublishMessage",
"(",
"byteBufAllocator",
",",
"(",
"MqttPublishMessage",
")",
"message",
")",
";",
"case",
"SUBSCRIBE",
":",
"return",
"encodeSubscribeMessage",
"(",
"byteBufAllocator",
",",
"(",
"MqttSubscribeMessage",
")",
"message",
")",
";",
"case",
"UNSUBSCRIBE",
":",
"return",
"encodeUnsubscribeMessage",
"(",
"byteBufAllocator",
",",
"(",
"MqttUnsubscribeMessage",
")",
"message",
")",
";",
"case",
"SUBACK",
":",
"return",
"encodeSubAckMessage",
"(",
"byteBufAllocator",
",",
"(",
"MqttSubAckMessage",
")",
"message",
")",
";",
"case",
"UNSUBACK",
":",
"case",
"PUBACK",
":",
"case",
"PUBREC",
":",
"case",
"PUBREL",
":",
"case",
"PUBCOMP",
":",
"return",
"encodeMessageWithOnlySingleByteFixedHeaderAndMessageId",
"(",
"byteBufAllocator",
",",
"message",
")",
";",
"case",
"PINGREQ",
":",
"case",
"PINGRESP",
":",
"case",
"DISCONNECT",
":",
"return",
"encodeMessageWithOnlySingleByteFixedHeader",
"(",
"byteBufAllocator",
",",
"message",
")",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unknown message type: \"",
"+",
"message",
".",
"fixedHeader",
"(",
")",
".",
"messageType",
"(",
")",
".",
"value",
"(",
")",
")",
";",
"}",
"}"
]
| This is the main encoding method.
It's only visible for testing.
@param byteBufAllocator Allocates ByteBuf
@param message MQTT message to encode
@return ByteBuf with encoded bytes | [
"This",
"is",
"the",
"main",
"encoding",
"method",
".",
"It",
"s",
"only",
"visible",
"for",
"testing",
"."
]
| train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttEncoder.java#L56-L93 |
jfinal/jfinal | src/main/java/com/jfinal/template/Engine.java | Engine.getTemplateByString | public Template getTemplateByString(String content, boolean cache) {
"""
Get template by string content
重要:StringSource 中的 cacheKey = HashKit.md5(content),也即 cacheKey
与 content 有紧密的对应关系,当 content 发生变化时 cacheKey 值也相应变化
因此,原先 cacheKey 所对应的 Template 缓存对象已无法被获取,当 getTemplateByString(String)
的 String 参数的数量不确定时会引发内存泄漏
当 getTemplateByString(String, boolean) 中的 String 参数的
数量可控并且确定时,才可对其使用缓存
@param content 模板内容
@param cache true 则缓存 Template,否则不缓存
"""
if (!cache) {
return buildTemplateBySource(new StringSource(content, cache));
}
String cacheKey = HashKit.md5(content);
Template template = templateCache.get(cacheKey);
if (template == null) {
template = buildTemplateBySource(new StringSource(content, cache));
templateCache.put(cacheKey, template);
} else if (devMode) {
if (template.isModified()) {
template = buildTemplateBySource(new StringSource(content, cache));
templateCache.put(cacheKey, template);
}
}
return template;
} | java | public Template getTemplateByString(String content, boolean cache) {
if (!cache) {
return buildTemplateBySource(new StringSource(content, cache));
}
String cacheKey = HashKit.md5(content);
Template template = templateCache.get(cacheKey);
if (template == null) {
template = buildTemplateBySource(new StringSource(content, cache));
templateCache.put(cacheKey, template);
} else if (devMode) {
if (template.isModified()) {
template = buildTemplateBySource(new StringSource(content, cache));
templateCache.put(cacheKey, template);
}
}
return template;
} | [
"public",
"Template",
"getTemplateByString",
"(",
"String",
"content",
",",
"boolean",
"cache",
")",
"{",
"if",
"(",
"!",
"cache",
")",
"{",
"return",
"buildTemplateBySource",
"(",
"new",
"StringSource",
"(",
"content",
",",
"cache",
")",
")",
";",
"}",
"String",
"cacheKey",
"=",
"HashKit",
".",
"md5",
"(",
"content",
")",
";",
"Template",
"template",
"=",
"templateCache",
".",
"get",
"(",
"cacheKey",
")",
";",
"if",
"(",
"template",
"==",
"null",
")",
"{",
"template",
"=",
"buildTemplateBySource",
"(",
"new",
"StringSource",
"(",
"content",
",",
"cache",
")",
")",
";",
"templateCache",
".",
"put",
"(",
"cacheKey",
",",
"template",
")",
";",
"}",
"else",
"if",
"(",
"devMode",
")",
"{",
"if",
"(",
"template",
".",
"isModified",
"(",
")",
")",
"{",
"template",
"=",
"buildTemplateBySource",
"(",
"new",
"StringSource",
"(",
"content",
",",
"cache",
")",
")",
";",
"templateCache",
".",
"put",
"(",
"cacheKey",
",",
"template",
")",
";",
"}",
"}",
"return",
"template",
";",
"}"
]
| Get template by string content
重要:StringSource 中的 cacheKey = HashKit.md5(content),也即 cacheKey
与 content 有紧密的对应关系,当 content 发生变化时 cacheKey 值也相应变化
因此,原先 cacheKey 所对应的 Template 缓存对象已无法被获取,当 getTemplateByString(String)
的 String 参数的数量不确定时会引发内存泄漏
当 getTemplateByString(String, boolean) 中的 String 参数的
数量可控并且确定时,才可对其使用缓存
@param content 模板内容
@param cache true 则缓存 Template,否则不缓存 | [
"Get",
"template",
"by",
"string",
"content"
]
| train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/template/Engine.java#L190-L207 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javadoc/Messager.java | Messager.printError | public void printError(SourcePosition pos, String msg) {
"""
Print error message, increment error count.
Part of DocErrorReporter.
@param pos the position where the error occurs
@param msg message to print
"""
if (diagListener != null) {
report(DiagnosticType.ERROR, pos, msg);
return;
}
if (nerrors < MaxErrors) {
String prefix = (pos == null) ? programName : pos.toString();
errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg);
errWriter.flush();
prompt();
nerrors++;
}
} | java | public void printError(SourcePosition pos, String msg) {
if (diagListener != null) {
report(DiagnosticType.ERROR, pos, msg);
return;
}
if (nerrors < MaxErrors) {
String prefix = (pos == null) ? programName : pos.toString();
errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg);
errWriter.flush();
prompt();
nerrors++;
}
} | [
"public",
"void",
"printError",
"(",
"SourcePosition",
"pos",
",",
"String",
"msg",
")",
"{",
"if",
"(",
"diagListener",
"!=",
"null",
")",
"{",
"report",
"(",
"DiagnosticType",
".",
"ERROR",
",",
"pos",
",",
"msg",
")",
";",
"return",
";",
"}",
"if",
"(",
"nerrors",
"<",
"MaxErrors",
")",
"{",
"String",
"prefix",
"=",
"(",
"pos",
"==",
"null",
")",
"?",
"programName",
":",
"pos",
".",
"toString",
"(",
")",
";",
"errWriter",
".",
"println",
"(",
"prefix",
"+",
"\": \"",
"+",
"getText",
"(",
"\"javadoc.error\"",
")",
"+",
"\" - \"",
"+",
"msg",
")",
";",
"errWriter",
".",
"flush",
"(",
")",
";",
"prompt",
"(",
")",
";",
"nerrors",
"++",
";",
"}",
"}"
]
| Print error message, increment error count.
Part of DocErrorReporter.
@param pos the position where the error occurs
@param msg message to print | [
"Print",
"error",
"message",
"increment",
"error",
"count",
".",
"Part",
"of",
"DocErrorReporter",
"."
]
| train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javadoc/Messager.java#L165-L178 |
alkacon/opencms-core | src/org/opencms/importexport/CmsExport.java | CmsExport.exportGroup | protected void exportGroup(Element parent, CmsGroup group) throws CmsImportExportException, SAXException {
"""
Exports one single group with all it's data.<p>
@param parent the parent node to add the groups to
@param group the group to be exported
@throws CmsImportExportException if something goes wrong
@throws SAXException if something goes wrong processing the manifest.xml
"""
try {
String parentgroup;
if ((group.getParentId() == null) || group.getParentId().isNullUUID()) {
parentgroup = "";
} else {
parentgroup = getCms().getParent(group.getName()).getName();
}
Element e = parent.addElement(CmsImportVersion10.N_GROUP);
e.addElement(CmsImportVersion10.N_NAME).addText(group.getSimpleName());
e.addElement(CmsImportVersion10.N_DESCRIPTION).addCDATA(group.getDescription());
e.addElement(CmsImportVersion10.N_FLAGS).addText(Integer.toString(group.getFlags()));
e.addElement(CmsImportVersion10.N_PARENTGROUP).addText(parentgroup);
// write the XML
digestElement(parent, e);
} catch (CmsException e) {
CmsMessageContainer message = org.opencms.db.Messages.get().container(
org.opencms.db.Messages.ERR_GET_PARENT_GROUP_1,
group.getName());
if (LOG.isDebugEnabled()) {
LOG.debug(message.key(), e);
}
throw new CmsImportExportException(message, e);
}
} | java | protected void exportGroup(Element parent, CmsGroup group) throws CmsImportExportException, SAXException {
try {
String parentgroup;
if ((group.getParentId() == null) || group.getParentId().isNullUUID()) {
parentgroup = "";
} else {
parentgroup = getCms().getParent(group.getName()).getName();
}
Element e = parent.addElement(CmsImportVersion10.N_GROUP);
e.addElement(CmsImportVersion10.N_NAME).addText(group.getSimpleName());
e.addElement(CmsImportVersion10.N_DESCRIPTION).addCDATA(group.getDescription());
e.addElement(CmsImportVersion10.N_FLAGS).addText(Integer.toString(group.getFlags()));
e.addElement(CmsImportVersion10.N_PARENTGROUP).addText(parentgroup);
// write the XML
digestElement(parent, e);
} catch (CmsException e) {
CmsMessageContainer message = org.opencms.db.Messages.get().container(
org.opencms.db.Messages.ERR_GET_PARENT_GROUP_1,
group.getName());
if (LOG.isDebugEnabled()) {
LOG.debug(message.key(), e);
}
throw new CmsImportExportException(message, e);
}
} | [
"protected",
"void",
"exportGroup",
"(",
"Element",
"parent",
",",
"CmsGroup",
"group",
")",
"throws",
"CmsImportExportException",
",",
"SAXException",
"{",
"try",
"{",
"String",
"parentgroup",
";",
"if",
"(",
"(",
"group",
".",
"getParentId",
"(",
")",
"==",
"null",
")",
"||",
"group",
".",
"getParentId",
"(",
")",
".",
"isNullUUID",
"(",
")",
")",
"{",
"parentgroup",
"=",
"\"\"",
";",
"}",
"else",
"{",
"parentgroup",
"=",
"getCms",
"(",
")",
".",
"getParent",
"(",
"group",
".",
"getName",
"(",
")",
")",
".",
"getName",
"(",
")",
";",
"}",
"Element",
"e",
"=",
"parent",
".",
"addElement",
"(",
"CmsImportVersion10",
".",
"N_GROUP",
")",
";",
"e",
".",
"addElement",
"(",
"CmsImportVersion10",
".",
"N_NAME",
")",
".",
"addText",
"(",
"group",
".",
"getSimpleName",
"(",
")",
")",
";",
"e",
".",
"addElement",
"(",
"CmsImportVersion10",
".",
"N_DESCRIPTION",
")",
".",
"addCDATA",
"(",
"group",
".",
"getDescription",
"(",
")",
")",
";",
"e",
".",
"addElement",
"(",
"CmsImportVersion10",
".",
"N_FLAGS",
")",
".",
"addText",
"(",
"Integer",
".",
"toString",
"(",
"group",
".",
"getFlags",
"(",
")",
")",
")",
";",
"e",
".",
"addElement",
"(",
"CmsImportVersion10",
".",
"N_PARENTGROUP",
")",
".",
"addText",
"(",
"parentgroup",
")",
";",
"// write the XML",
"digestElement",
"(",
"parent",
",",
"e",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"CmsMessageContainer",
"message",
"=",
"org",
".",
"opencms",
".",
"db",
".",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"org",
".",
"opencms",
".",
"db",
".",
"Messages",
".",
"ERR_GET_PARENT_GROUP_1",
",",
"group",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"message",
".",
"key",
"(",
")",
",",
"e",
")",
";",
"}",
"throw",
"new",
"CmsImportExportException",
"(",
"message",
",",
"e",
")",
";",
"}",
"}"
]
| Exports one single group with all it's data.<p>
@param parent the parent node to add the groups to
@param group the group to be exported
@throws CmsImportExportException if something goes wrong
@throws SAXException if something goes wrong processing the manifest.xml | [
"Exports",
"one",
"single",
"group",
"with",
"all",
"it",
"s",
"data",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsExport.java#L938-L966 |
gallandarakhneorg/afc | advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/AbstractAttributeCollection.java | AbstractAttributeCollection.fireAttributeChangedEvent | protected synchronized void fireAttributeChangedEvent(String name, AttributeValue oldValue, AttributeValue currentValue) {
"""
Fire the attribute change event.
@param name is the name of the attribute for which the event occured.
@param oldValue is the previous value of the attribute
@param currentValue is the current value of the attribute
"""
if (this.listenerList != null && isEventFirable()) {
final AttributeChangeListener[] list = new AttributeChangeListener[this.listenerList.size()];
this.listenerList.toArray(list);
final AttributeChangeEvent event = new AttributeChangeEvent(
this,
Type.VALUE_UPDATE,
name,
oldValue,
name,
currentValue);
for (final AttributeChangeListener listener : list) {
listener.onAttributeChangeEvent(event);
}
}
} | java | protected synchronized void fireAttributeChangedEvent(String name, AttributeValue oldValue, AttributeValue currentValue) {
if (this.listenerList != null && isEventFirable()) {
final AttributeChangeListener[] list = new AttributeChangeListener[this.listenerList.size()];
this.listenerList.toArray(list);
final AttributeChangeEvent event = new AttributeChangeEvent(
this,
Type.VALUE_UPDATE,
name,
oldValue,
name,
currentValue);
for (final AttributeChangeListener listener : list) {
listener.onAttributeChangeEvent(event);
}
}
} | [
"protected",
"synchronized",
"void",
"fireAttributeChangedEvent",
"(",
"String",
"name",
",",
"AttributeValue",
"oldValue",
",",
"AttributeValue",
"currentValue",
")",
"{",
"if",
"(",
"this",
".",
"listenerList",
"!=",
"null",
"&&",
"isEventFirable",
"(",
")",
")",
"{",
"final",
"AttributeChangeListener",
"[",
"]",
"list",
"=",
"new",
"AttributeChangeListener",
"[",
"this",
".",
"listenerList",
".",
"size",
"(",
")",
"]",
";",
"this",
".",
"listenerList",
".",
"toArray",
"(",
"list",
")",
";",
"final",
"AttributeChangeEvent",
"event",
"=",
"new",
"AttributeChangeEvent",
"(",
"this",
",",
"Type",
".",
"VALUE_UPDATE",
",",
"name",
",",
"oldValue",
",",
"name",
",",
"currentValue",
")",
";",
"for",
"(",
"final",
"AttributeChangeListener",
"listener",
":",
"list",
")",
"{",
"listener",
".",
"onAttributeChangeEvent",
"(",
"event",
")",
";",
"}",
"}",
"}"
]
| Fire the attribute change event.
@param name is the name of the attribute for which the event occured.
@param oldValue is the previous value of the attribute
@param currentValue is the current value of the attribute | [
"Fire",
"the",
"attribute",
"change",
"event",
"."
]
| train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/AbstractAttributeCollection.java#L98-L113 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javah/Gen.java | Gen.writeIfChanged | private void writeIfChanged(byte[] b, FileObject file) throws IOException {
"""
/*
Write the contents of byte[] b to a file named file. Writing
is done if either the file doesn't exist or if the contents are
different.
"""
boolean mustWrite = false;
String event = "[No need to update file ";
if (force) {
mustWrite = true;
event = "[Forcefully writing file ";
} else {
InputStream in;
byte[] a;
try {
// regrettably, there's no API to get the length in bytes
// for a FileObject, so we can't short-circuit reading the
// file here
in = file.openInputStream();
a = readBytes(in);
if (!Arrays.equals(a, b)) {
mustWrite = true;
event = "[Overwriting file ";
}
} catch (FileNotFoundException e) {
mustWrite = true;
event = "[Creating file ";
}
}
if (util.verbose)
util.log(event + file + "]");
if (mustWrite) {
OutputStream out = file.openOutputStream();
out.write(b); /* No buffering, just one big write! */
out.close();
}
} | java | private void writeIfChanged(byte[] b, FileObject file) throws IOException {
boolean mustWrite = false;
String event = "[No need to update file ";
if (force) {
mustWrite = true;
event = "[Forcefully writing file ";
} else {
InputStream in;
byte[] a;
try {
// regrettably, there's no API to get the length in bytes
// for a FileObject, so we can't short-circuit reading the
// file here
in = file.openInputStream();
a = readBytes(in);
if (!Arrays.equals(a, b)) {
mustWrite = true;
event = "[Overwriting file ";
}
} catch (FileNotFoundException e) {
mustWrite = true;
event = "[Creating file ";
}
}
if (util.verbose)
util.log(event + file + "]");
if (mustWrite) {
OutputStream out = file.openOutputStream();
out.write(b); /* No buffering, just one big write! */
out.close();
}
} | [
"private",
"void",
"writeIfChanged",
"(",
"byte",
"[",
"]",
"b",
",",
"FileObject",
"file",
")",
"throws",
"IOException",
"{",
"boolean",
"mustWrite",
"=",
"false",
";",
"String",
"event",
"=",
"\"[No need to update file \"",
";",
"if",
"(",
"force",
")",
"{",
"mustWrite",
"=",
"true",
";",
"event",
"=",
"\"[Forcefully writing file \"",
";",
"}",
"else",
"{",
"InputStream",
"in",
";",
"byte",
"[",
"]",
"a",
";",
"try",
"{",
"// regrettably, there's no API to get the length in bytes",
"// for a FileObject, so we can't short-circuit reading the",
"// file here",
"in",
"=",
"file",
".",
"openInputStream",
"(",
")",
";",
"a",
"=",
"readBytes",
"(",
"in",
")",
";",
"if",
"(",
"!",
"Arrays",
".",
"equals",
"(",
"a",
",",
"b",
")",
")",
"{",
"mustWrite",
"=",
"true",
";",
"event",
"=",
"\"[Overwriting file \"",
";",
"}",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"mustWrite",
"=",
"true",
";",
"event",
"=",
"\"[Creating file \"",
";",
"}",
"}",
"if",
"(",
"util",
".",
"verbose",
")",
"util",
".",
"log",
"(",
"event",
"+",
"file",
"+",
"\"]\"",
")",
";",
"if",
"(",
"mustWrite",
")",
"{",
"OutputStream",
"out",
"=",
"file",
".",
"openOutputStream",
"(",
")",
";",
"out",
".",
"write",
"(",
"b",
")",
";",
"/* No buffering, just one big write! */",
"out",
".",
"close",
"(",
")",
";",
"}",
"}"
]
| /*
Write the contents of byte[] b to a file named file. Writing
is done if either the file doesn't exist or if the contents are
different. | [
"/",
"*",
"Write",
"the",
"contents",
"of",
"byte",
"[]",
"b",
"to",
"a",
"file",
"named",
"file",
".",
"Writing",
"is",
"done",
"if",
"either",
"the",
"file",
"doesn",
"t",
"exist",
"or",
"if",
"the",
"contents",
"are",
"different",
"."
]
| train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javah/Gen.java#L186-L221 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/meta/MetaUtil.java | MetaUtil.getColumnNames | public static String[] getColumnNames(DataSource ds, String tableName) {
"""
获得表的所有列名
@param ds 数据源
@param tableName 表名
@return 列数组
@throws DbRuntimeException SQL执行异常
"""
List<String> columnNames = new ArrayList<String>();
Connection conn = null;
ResultSet rs = null;
try {
conn = ds.getConnection();
final DatabaseMetaData metaData = conn.getMetaData();
rs = metaData.getColumns(conn.getCatalog(), null, tableName, null);
while (rs.next()) {
columnNames.add(rs.getString("COLUMN_NAME"));
}
return columnNames.toArray(new String[columnNames.size()]);
} catch (Exception e) {
throw new DbRuntimeException("Get columns error!", e);
} finally {
DbUtil.close(rs, conn);
}
} | java | public static String[] getColumnNames(DataSource ds, String tableName) {
List<String> columnNames = new ArrayList<String>();
Connection conn = null;
ResultSet rs = null;
try {
conn = ds.getConnection();
final DatabaseMetaData metaData = conn.getMetaData();
rs = metaData.getColumns(conn.getCatalog(), null, tableName, null);
while (rs.next()) {
columnNames.add(rs.getString("COLUMN_NAME"));
}
return columnNames.toArray(new String[columnNames.size()]);
} catch (Exception e) {
throw new DbRuntimeException("Get columns error!", e);
} finally {
DbUtil.close(rs, conn);
}
} | [
"public",
"static",
"String",
"[",
"]",
"getColumnNames",
"(",
"DataSource",
"ds",
",",
"String",
"tableName",
")",
"{",
"List",
"<",
"String",
">",
"columnNames",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"Connection",
"conn",
"=",
"null",
";",
"ResultSet",
"rs",
"=",
"null",
";",
"try",
"{",
"conn",
"=",
"ds",
".",
"getConnection",
"(",
")",
";",
"final",
"DatabaseMetaData",
"metaData",
"=",
"conn",
".",
"getMetaData",
"(",
")",
";",
"rs",
"=",
"metaData",
".",
"getColumns",
"(",
"conn",
".",
"getCatalog",
"(",
")",
",",
"null",
",",
"tableName",
",",
"null",
")",
";",
"while",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"columnNames",
".",
"add",
"(",
"rs",
".",
"getString",
"(",
"\"COLUMN_NAME\"",
")",
")",
";",
"}",
"return",
"columnNames",
".",
"toArray",
"(",
"new",
"String",
"[",
"columnNames",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"DbRuntimeException",
"(",
"\"Get columns error!\"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"DbUtil",
".",
"close",
"(",
"rs",
",",
"conn",
")",
";",
"}",
"}"
]
| 获得表的所有列名
@param ds 数据源
@param tableName 表名
@return 列数组
@throws DbRuntimeException SQL执行异常 | [
"获得表的所有列名"
]
| train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/meta/MetaUtil.java#L125-L142 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java | PolylineSplitMerge.initializeScore | private boolean initializeScore(List<Point2D_I32> contour , boolean loops ) {
"""
Computes the score and potential split for each side
@param contour
@return
"""
// Score each side
Element<Corner> e = list.getHead();
Element<Corner> end = loops ? null : list.getTail();
while( e != end ) {
if (convex && !isSideConvex(contour, e))
return false;
Element<Corner> n = e.next;
double error;
if( n == null ) {
error = computeSideError(contour,e.object.index, list.getHead().object.index);
} else {
error = computeSideError(contour,e.object.index, n.object.index);
}
e.object.sideError = error;
e = n;
}
// Compute what would happen if a side was split
e = list.getHead();
while( e != end ) {
computePotentialSplitScore(contour,e,list.size() < minSides);
e = e.next;
}
return true;
} | java | private boolean initializeScore(List<Point2D_I32> contour , boolean loops ) {
// Score each side
Element<Corner> e = list.getHead();
Element<Corner> end = loops ? null : list.getTail();
while( e != end ) {
if (convex && !isSideConvex(contour, e))
return false;
Element<Corner> n = e.next;
double error;
if( n == null ) {
error = computeSideError(contour,e.object.index, list.getHead().object.index);
} else {
error = computeSideError(contour,e.object.index, n.object.index);
}
e.object.sideError = error;
e = n;
}
// Compute what would happen if a side was split
e = list.getHead();
while( e != end ) {
computePotentialSplitScore(contour,e,list.size() < minSides);
e = e.next;
}
return true;
} | [
"private",
"boolean",
"initializeScore",
"(",
"List",
"<",
"Point2D_I32",
">",
"contour",
",",
"boolean",
"loops",
")",
"{",
"// Score each side",
"Element",
"<",
"Corner",
">",
"e",
"=",
"list",
".",
"getHead",
"(",
")",
";",
"Element",
"<",
"Corner",
">",
"end",
"=",
"loops",
"?",
"null",
":",
"list",
".",
"getTail",
"(",
")",
";",
"while",
"(",
"e",
"!=",
"end",
")",
"{",
"if",
"(",
"convex",
"&&",
"!",
"isSideConvex",
"(",
"contour",
",",
"e",
")",
")",
"return",
"false",
";",
"Element",
"<",
"Corner",
">",
"n",
"=",
"e",
".",
"next",
";",
"double",
"error",
";",
"if",
"(",
"n",
"==",
"null",
")",
"{",
"error",
"=",
"computeSideError",
"(",
"contour",
",",
"e",
".",
"object",
".",
"index",
",",
"list",
".",
"getHead",
"(",
")",
".",
"object",
".",
"index",
")",
";",
"}",
"else",
"{",
"error",
"=",
"computeSideError",
"(",
"contour",
",",
"e",
".",
"object",
".",
"index",
",",
"n",
".",
"object",
".",
"index",
")",
";",
"}",
"e",
".",
"object",
".",
"sideError",
"=",
"error",
";",
"e",
"=",
"n",
";",
"}",
"// Compute what would happen if a side was split",
"e",
"=",
"list",
".",
"getHead",
"(",
")",
";",
"while",
"(",
"e",
"!=",
"end",
")",
"{",
"computePotentialSplitScore",
"(",
"contour",
",",
"e",
",",
"list",
".",
"size",
"(",
")",
"<",
"minSides",
")",
";",
"e",
"=",
"e",
".",
"next",
";",
"}",
"return",
"true",
";",
"}"
]
| Computes the score and potential split for each side
@param contour
@return | [
"Computes",
"the",
"score",
"and",
"potential",
"split",
"for",
"each",
"side"
]
| train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L349-L377 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AlertResources.java | AlertResources.addNotification | @POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/ {
"""
Creates a new notification for a given alert.
@param req The HttpServlet request object. Cannot be null.
@param alertId The alert Id. Cannot be null and must be a positive non-zero number.
@param notificationDto The notification object. Cannot be null.
@return The updated alert object
@throws WebApplicationException The exception with 404 status will be thrown if an alert does not exist.
"""alertId}/notifications")
@Description("Creates new notifications for the given alert ID.")
public List<NotificationDto> addNotification(@Context HttpServletRequest req,
@PathParam("alertId") BigInteger alertId, NotificationDto notificationDto) {
if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (notificationDto == null) {
throw new WebApplicationException("Null notification object cannot be created.", Status.BAD_REQUEST);
}
Alert alert = alertService.findAlertByPrimaryKey(alertId);
if (alert != null) {
validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req));
Notification notification = new Notification(notificationDto.getName(), alert, notificationDto.getNotifierName(),
notificationDto.getSubscriptions(), notificationDto.getCooldownPeriod());
notification.setSRActionable(notificationDto.getSRActionable());
notification.setSeverityLevel(notificationDto.getSeverityLevel());
notification.setCustomText(notificationDto.getCustomText());
// TODO: 14.12.16 validateAuthorizationRequest notification
notification.setMetricsToAnnotate(new ArrayList<>(notificationDto.getMetricsToAnnotate()));
List<Notification> notifications = new ArrayList<Notification>(alert.getNotifications());
notifications.add(notification);
alert.setNotifications(notifications);
alert.setModifiedBy(getRemoteUser(req));
return NotificationDto.transformToDto(alertService.updateAlert(alert).getNotifications());
}
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
} | java | @POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{alertId}/notifications")
@Description("Creates new notifications for the given alert ID.")
public List<NotificationDto> addNotification(@Context HttpServletRequest req,
@PathParam("alertId") BigInteger alertId, NotificationDto notificationDto) {
if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (notificationDto == null) {
throw new WebApplicationException("Null notification object cannot be created.", Status.BAD_REQUEST);
}
Alert alert = alertService.findAlertByPrimaryKey(alertId);
if (alert != null) {
validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req));
Notification notification = new Notification(notificationDto.getName(), alert, notificationDto.getNotifierName(),
notificationDto.getSubscriptions(), notificationDto.getCooldownPeriod());
notification.setSRActionable(notificationDto.getSRActionable());
notification.setSeverityLevel(notificationDto.getSeverityLevel());
notification.setCustomText(notificationDto.getCustomText());
// TODO: 14.12.16 validateAuthorizationRequest notification
notification.setMetricsToAnnotate(new ArrayList<>(notificationDto.getMetricsToAnnotate()));
List<Notification> notifications = new ArrayList<Notification>(alert.getNotifications());
notifications.add(notification);
alert.setNotifications(notifications);
alert.setModifiedBy(getRemoteUser(req));
return NotificationDto.transformToDto(alertService.updateAlert(alert).getNotifications());
}
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
} | [
"@",
"POST",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Path",
"(",
"\"/{alertId}/notifications\"",
")",
"@",
"Description",
"(",
"\"Creates new notifications for the given alert ID.\"",
")",
"public",
"List",
"<",
"NotificationDto",
">",
"addNotification",
"(",
"@",
"Context",
"HttpServletRequest",
"req",
",",
"@",
"PathParam",
"(",
"\"alertId\"",
")",
"BigInteger",
"alertId",
",",
"NotificationDto",
"notificationDto",
")",
"{",
"if",
"(",
"alertId",
"==",
"null",
"||",
"alertId",
".",
"compareTo",
"(",
"BigInteger",
".",
"ZERO",
")",
"<",
"1",
")",
"{",
"throw",
"new",
"WebApplicationException",
"(",
"\"Alert Id cannot be null and must be a positive non-zero number.\"",
",",
"Status",
".",
"BAD_REQUEST",
")",
";",
"}",
"if",
"(",
"notificationDto",
"==",
"null",
")",
"{",
"throw",
"new",
"WebApplicationException",
"(",
"\"Null notification object cannot be created.\"",
",",
"Status",
".",
"BAD_REQUEST",
")",
";",
"}",
"Alert",
"alert",
"=",
"alertService",
".",
"findAlertByPrimaryKey",
"(",
"alertId",
")",
";",
"if",
"(",
"alert",
"!=",
"null",
")",
"{",
"validateResourceAuthorization",
"(",
"req",
",",
"alert",
".",
"getOwner",
"(",
")",
",",
"getRemoteUser",
"(",
"req",
")",
")",
";",
"Notification",
"notification",
"=",
"new",
"Notification",
"(",
"notificationDto",
".",
"getName",
"(",
")",
",",
"alert",
",",
"notificationDto",
".",
"getNotifierName",
"(",
")",
",",
"notificationDto",
".",
"getSubscriptions",
"(",
")",
",",
"notificationDto",
".",
"getCooldownPeriod",
"(",
")",
")",
";",
"notification",
".",
"setSRActionable",
"(",
"notificationDto",
".",
"getSRActionable",
"(",
")",
")",
";",
"notification",
".",
"setSeverityLevel",
"(",
"notificationDto",
".",
"getSeverityLevel",
"(",
")",
")",
";",
"notification",
".",
"setCustomText",
"(",
"notificationDto",
".",
"getCustomText",
"(",
")",
")",
";",
"// TODO: 14.12.16 validateAuthorizationRequest notification",
"notification",
".",
"setMetricsToAnnotate",
"(",
"new",
"ArrayList",
"<>",
"(",
"notificationDto",
".",
"getMetricsToAnnotate",
"(",
")",
")",
")",
";",
"List",
"<",
"Notification",
">",
"notifications",
"=",
"new",
"ArrayList",
"<",
"Notification",
">",
"(",
"alert",
".",
"getNotifications",
"(",
")",
")",
";",
"notifications",
".",
"add",
"(",
"notification",
")",
";",
"alert",
".",
"setNotifications",
"(",
"notifications",
")",
";",
"alert",
".",
"setModifiedBy",
"(",
"getRemoteUser",
"(",
"req",
")",
")",
";",
"return",
"NotificationDto",
".",
"transformToDto",
"(",
"alertService",
".",
"updateAlert",
"(",
"alert",
")",
".",
"getNotifications",
"(",
")",
")",
";",
"}",
"throw",
"new",
"WebApplicationException",
"(",
"Response",
".",
"Status",
".",
"NOT_FOUND",
".",
"getReasonPhrase",
"(",
")",
",",
"Response",
".",
"Status",
".",
"NOT_FOUND",
")",
";",
"}"
]
| Creates a new notification for a given alert.
@param req The HttpServlet request object. Cannot be null.
@param alertId The alert Id. Cannot be null and must be a positive non-zero number.
@param notificationDto The notification object. Cannot be null.
@return The updated alert object
@throws WebApplicationException The exception with 404 status will be thrown if an alert does not exist. | [
"Creates",
"a",
"new",
"notification",
"for",
"a",
"given",
"alert",
"."
]
| train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AlertResources.java#L804-L841 |
aws/aws-sdk-java | aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/CreateProvisioningArtifactResult.java | CreateProvisioningArtifactResult.withInfo | public CreateProvisioningArtifactResult withInfo(java.util.Map<String, String> info) {
"""
<p>
The URL of the CloudFormation template in Amazon S3, in JSON format.
</p>
@param info
The URL of the CloudFormation template in Amazon S3, in JSON format.
@return Returns a reference to this object so that method calls can be chained together.
"""
setInfo(info);
return this;
} | java | public CreateProvisioningArtifactResult withInfo(java.util.Map<String, String> info) {
setInfo(info);
return this;
} | [
"public",
"CreateProvisioningArtifactResult",
"withInfo",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"info",
")",
"{",
"setInfo",
"(",
"info",
")",
";",
"return",
"this",
";",
"}"
]
| <p>
The URL of the CloudFormation template in Amazon S3, in JSON format.
</p>
@param info
The URL of the CloudFormation template in Amazon S3, in JSON format.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"URL",
"of",
"the",
"CloudFormation",
"template",
"in",
"Amazon",
"S3",
"in",
"JSON",
"format",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/CreateProvisioningArtifactResult.java#L120-L123 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java | WTableRenderer.paintSelectionDetails | private void paintSelectionDetails(final WTable table, final XmlStringBuilder xml) {
"""
Paint the row selection aspects of the table.
@param table the WDataTable being rendered
@param xml the string builder in use
"""
boolean multiple = table.getSelectMode() == SelectMode.MULTIPLE;
xml.appendTagOpen("ui:rowselection");
xml.appendOptionalAttribute("multiple", multiple, "true");
boolean toggleSubRows = multiple && table.isToggleSubRowSelection()
&& WTable.ExpandMode.NONE != table.getExpandMode();
xml.appendOptionalAttribute("toggle", toggleSubRows, "true");
if (multiple) {
switch (table.getSelectAllMode()) {
case CONTROL:
xml.appendAttribute("selectAll", "control");
break;
case TEXT:
xml.appendAttribute("selectAll", "text");
break;
case NONE:
break;
default:
throw new SystemException("Unknown select-all mode: " + table.
getSelectAllMode());
}
}
xml.appendEnd();
} | java | private void paintSelectionDetails(final WTable table, final XmlStringBuilder xml) {
boolean multiple = table.getSelectMode() == SelectMode.MULTIPLE;
xml.appendTagOpen("ui:rowselection");
xml.appendOptionalAttribute("multiple", multiple, "true");
boolean toggleSubRows = multiple && table.isToggleSubRowSelection()
&& WTable.ExpandMode.NONE != table.getExpandMode();
xml.appendOptionalAttribute("toggle", toggleSubRows, "true");
if (multiple) {
switch (table.getSelectAllMode()) {
case CONTROL:
xml.appendAttribute("selectAll", "control");
break;
case TEXT:
xml.appendAttribute("selectAll", "text");
break;
case NONE:
break;
default:
throw new SystemException("Unknown select-all mode: " + table.
getSelectAllMode());
}
}
xml.appendEnd();
} | [
"private",
"void",
"paintSelectionDetails",
"(",
"final",
"WTable",
"table",
",",
"final",
"XmlStringBuilder",
"xml",
")",
"{",
"boolean",
"multiple",
"=",
"table",
".",
"getSelectMode",
"(",
")",
"==",
"SelectMode",
".",
"MULTIPLE",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:rowselection\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"multiple\"",
",",
"multiple",
",",
"\"true\"",
")",
";",
"boolean",
"toggleSubRows",
"=",
"multiple",
"&&",
"table",
".",
"isToggleSubRowSelection",
"(",
")",
"&&",
"WTable",
".",
"ExpandMode",
".",
"NONE",
"!=",
"table",
".",
"getExpandMode",
"(",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"toggle\"",
",",
"toggleSubRows",
",",
"\"true\"",
")",
";",
"if",
"(",
"multiple",
")",
"{",
"switch",
"(",
"table",
".",
"getSelectAllMode",
"(",
")",
")",
"{",
"case",
"CONTROL",
":",
"xml",
".",
"appendAttribute",
"(",
"\"selectAll\"",
",",
"\"control\"",
")",
";",
"break",
";",
"case",
"TEXT",
":",
"xml",
".",
"appendAttribute",
"(",
"\"selectAll\"",
",",
"\"text\"",
")",
";",
"break",
";",
"case",
"NONE",
":",
"break",
";",
"default",
":",
"throw",
"new",
"SystemException",
"(",
"\"Unknown select-all mode: \"",
"+",
"table",
".",
"getSelectAllMode",
"(",
")",
")",
";",
"}",
"}",
"xml",
".",
"appendEnd",
"(",
")",
";",
"}"
]
| Paint the row selection aspects of the table.
@param table the WDataTable being rendered
@param xml the string builder in use | [
"Paint",
"the",
"row",
"selection",
"aspects",
"of",
"the",
"table",
"."
]
| train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java#L185-L209 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/client/gui/element/position/Positions.java | Positions.leftOf | public static IntSupplier leftOf(ISized owner, IPositioned other, int spacing) {
"""
Positions the owner to the left of the other.
@param other the other
@param spacing the spacing
@return the int supplier
"""
checkNotNull(other);
return () -> {
return other.position().x() - owner.size().width() - spacing;
};
} | java | public static IntSupplier leftOf(ISized owner, IPositioned other, int spacing)
{
checkNotNull(other);
return () -> {
return other.position().x() - owner.size().width() - spacing;
};
} | [
"public",
"static",
"IntSupplier",
"leftOf",
"(",
"ISized",
"owner",
",",
"IPositioned",
"other",
",",
"int",
"spacing",
")",
"{",
"checkNotNull",
"(",
"other",
")",
";",
"return",
"(",
")",
"->",
"{",
"return",
"other",
".",
"position",
"(",
")",
".",
"x",
"(",
")",
"-",
"owner",
".",
"size",
"(",
")",
".",
"width",
"(",
")",
"-",
"spacing",
";",
"}",
";",
"}"
]
| Positions the owner to the left of the other.
@param other the other
@param spacing the spacing
@return the int supplier | [
"Positions",
"the",
"owner",
"to",
"the",
"left",
"of",
"the",
"other",
"."
]
| train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/element/position/Positions.java#L161-L167 |
alexvasilkov/AndroidCommons | library/src/main/java/com/alexvasilkov/android/commons/state/InstanceStateManager.java | InstanceStateManager.restoreInstanceState | public static <T> void restoreInstanceState(@NonNull T obj, @Nullable Bundle savedState) {
"""
Restoring instance state from given {@code savedState} into the given {@code obj}.
<br/>
Supposed to be called from {@link android.app.Activity#onCreate(android.os.Bundle)} or
{@link android.app.Fragment#onCreate(android.os.Bundle)} before starting using local fields
marked with {@link InstanceState} annotation.
"""
if (savedState != null) {
new InstanceStateManager<>(obj).restoreState(savedState);
}
} | java | public static <T> void restoreInstanceState(@NonNull T obj, @Nullable Bundle savedState) {
if (savedState != null) {
new InstanceStateManager<>(obj).restoreState(savedState);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"restoreInstanceState",
"(",
"@",
"NonNull",
"T",
"obj",
",",
"@",
"Nullable",
"Bundle",
"savedState",
")",
"{",
"if",
"(",
"savedState",
"!=",
"null",
")",
"{",
"new",
"InstanceStateManager",
"<>",
"(",
"obj",
")",
".",
"restoreState",
"(",
"savedState",
")",
";",
"}",
"}"
]
| Restoring instance state from given {@code savedState} into the given {@code obj}.
<br/>
Supposed to be called from {@link android.app.Activity#onCreate(android.os.Bundle)} or
{@link android.app.Fragment#onCreate(android.os.Bundle)} before starting using local fields
marked with {@link InstanceState} annotation. | [
"Restoring",
"instance",
"state",
"from",
"given",
"{"
]
| train | https://github.com/alexvasilkov/AndroidCommons/blob/aca9f6d5acfc6bd3694984b7f89956e1a0146ddb/library/src/main/java/com/alexvasilkov/android/commons/state/InstanceStateManager.java#L60-L64 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java | CustomDictionary.add | public static boolean add(String word) {
"""
往自定义词典中插入一个新词(非覆盖模式)<br>
动态增删不会持久化到词典文件
@param word 新词 如“裸婚”
@return 是否插入成功(失败的原因可能是不覆盖等,可以通过调试模式了解原因)
"""
if (HanLP.Config.Normalization) word = CharTable.convert(word);
if (contains(word)) return false;
return insert(word, null);
} | java | public static boolean add(String word)
{
if (HanLP.Config.Normalization) word = CharTable.convert(word);
if (contains(word)) return false;
return insert(word, null);
} | [
"public",
"static",
"boolean",
"add",
"(",
"String",
"word",
")",
"{",
"if",
"(",
"HanLP",
".",
"Config",
".",
"Normalization",
")",
"word",
"=",
"CharTable",
".",
"convert",
"(",
"word",
")",
";",
"if",
"(",
"contains",
"(",
"word",
")",
")",
"return",
"false",
";",
"return",
"insert",
"(",
"word",
",",
"null",
")",
";",
"}"
]
| 往自定义词典中插入一个新词(非覆盖模式)<br>
动态增删不会持久化到词典文件
@param word 新词 如“裸婚”
@return 是否插入成功(失败的原因可能是不覆盖等,可以通过调试模式了解原因) | [
"往自定义词典中插入一个新词(非覆盖模式)<br",
">",
"动态增删不会持久化到词典文件"
]
| train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java#L278-L283 |
pushtorefresh/storio | storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/Changes.java | Changes.newInstance | @NonNull
public static Changes newInstance(
@NonNull Set<String> affectedTables,
@Nullable Collection<String> affectedTags
) {
"""
Creates new instance of {@link Changes}.
@param affectedTables non-null set of affected tables.
@param affectedTags nullable set of affected tags.
@return new immutable instance of {@link Changes}.
"""
return new Changes(affectedTables, nonNullSet(affectedTags));
} | java | @NonNull
public static Changes newInstance(
@NonNull Set<String> affectedTables,
@Nullable Collection<String> affectedTags
) {
return new Changes(affectedTables, nonNullSet(affectedTags));
} | [
"@",
"NonNull",
"public",
"static",
"Changes",
"newInstance",
"(",
"@",
"NonNull",
"Set",
"<",
"String",
">",
"affectedTables",
",",
"@",
"Nullable",
"Collection",
"<",
"String",
">",
"affectedTags",
")",
"{",
"return",
"new",
"Changes",
"(",
"affectedTables",
",",
"nonNullSet",
"(",
"affectedTags",
")",
")",
";",
"}"
]
| Creates new instance of {@link Changes}.
@param affectedTables non-null set of affected tables.
@param affectedTags nullable set of affected tags.
@return new immutable instance of {@link Changes}. | [
"Creates",
"new",
"instance",
"of",
"{",
"@link",
"Changes",
"}",
"."
]
| train | https://github.com/pushtorefresh/storio/blob/58f53d81bcc7b069c8bb271c46a90e37775abe8d/storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/Changes.java#L57-L63 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java | RepositoryApplicationConfiguration.actionCleanup | @Bean
CleanupTask actionCleanup(final DeploymentManagement deploymentManagement,
final TenantConfigurationManagement configManagement) {
"""
{@link AutoActionCleanup} bean.
@param deploymentManagement
Deployment management service
@param configManagement
Tenant configuration service
@return a new {@link AutoActionCleanup} bean
"""
return new AutoActionCleanup(deploymentManagement, configManagement);
} | java | @Bean
CleanupTask actionCleanup(final DeploymentManagement deploymentManagement,
final TenantConfigurationManagement configManagement) {
return new AutoActionCleanup(deploymentManagement, configManagement);
} | [
"@",
"Bean",
"CleanupTask",
"actionCleanup",
"(",
"final",
"DeploymentManagement",
"deploymentManagement",
",",
"final",
"TenantConfigurationManagement",
"configManagement",
")",
"{",
"return",
"new",
"AutoActionCleanup",
"(",
"deploymentManagement",
",",
"configManagement",
")",
";",
"}"
]
| {@link AutoActionCleanup} bean.
@param deploymentManagement
Deployment management service
@param configManagement
Tenant configuration service
@return a new {@link AutoActionCleanup} bean | [
"{",
"@link",
"AutoActionCleanup",
"}",
"bean",
"."
]
| train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java#L805-L809 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.backupKeyAsync | public Observable<BackupKeyResult> backupKeyAsync(String vaultBaseUrl, String keyName) {
"""
Requests that a backup of the specified key be downloaded to the client.
The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation does NOT return key material in a form that can be used outside the Azure Key Vault system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is to allow a client to GENERATE a key in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. The BACKUP operation may be used to export, in protected form, any key type from Azure Key Vault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed within geographical boundaries only; meaning that a BACKUP from one geographical area cannot be restored to another geographical area. For example, a backup from the US geographical area cannot be restored in an EU geographical area. This operation requires the key/backup permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the BackupKeyResult object
"""
return backupKeyWithServiceResponseAsync(vaultBaseUrl, keyName).map(new Func1<ServiceResponse<BackupKeyResult>, BackupKeyResult>() {
@Override
public BackupKeyResult call(ServiceResponse<BackupKeyResult> response) {
return response.body();
}
});
} | java | public Observable<BackupKeyResult> backupKeyAsync(String vaultBaseUrl, String keyName) {
return backupKeyWithServiceResponseAsync(vaultBaseUrl, keyName).map(new Func1<ServiceResponse<BackupKeyResult>, BackupKeyResult>() {
@Override
public BackupKeyResult call(ServiceResponse<BackupKeyResult> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BackupKeyResult",
">",
"backupKeyAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
")",
"{",
"return",
"backupKeyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"keyName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"BackupKeyResult",
">",
",",
"BackupKeyResult",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"BackupKeyResult",
"call",
"(",
"ServiceResponse",
"<",
"BackupKeyResult",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Requests that a backup of the specified key be downloaded to the client.
The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation does NOT return key material in a form that can be used outside the Azure Key Vault system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is to allow a client to GENERATE a key in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. The BACKUP operation may be used to export, in protected form, any key type from Azure Key Vault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed within geographical boundaries only; meaning that a BACKUP from one geographical area cannot be restored to another geographical area. For example, a backup from the US geographical area cannot be restored in an EU geographical area. This operation requires the key/backup permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the BackupKeyResult object | [
"Requests",
"that",
"a",
"backup",
"of",
"the",
"specified",
"key",
"be",
"downloaded",
"to",
"the",
"client",
".",
"The",
"Key",
"Backup",
"operation",
"exports",
"a",
"key",
"from",
"Azure",
"Key",
"Vault",
"in",
"a",
"protected",
"form",
".",
"Note",
"that",
"this",
"operation",
"does",
"NOT",
"return",
"key",
"material",
"in",
"a",
"form",
"that",
"can",
"be",
"used",
"outside",
"the",
"Azure",
"Key",
"Vault",
"system",
"the",
"returned",
"key",
"material",
"is",
"either",
"protected",
"to",
"a",
"Azure",
"Key",
"Vault",
"HSM",
"or",
"to",
"Azure",
"Key",
"Vault",
"itself",
".",
"The",
"intent",
"of",
"this",
"operation",
"is",
"to",
"allow",
"a",
"client",
"to",
"GENERATE",
"a",
"key",
"in",
"one",
"Azure",
"Key",
"Vault",
"instance",
"BACKUP",
"the",
"key",
"and",
"then",
"RESTORE",
"it",
"into",
"another",
"Azure",
"Key",
"Vault",
"instance",
".",
"The",
"BACKUP",
"operation",
"may",
"be",
"used",
"to",
"export",
"in",
"protected",
"form",
"any",
"key",
"type",
"from",
"Azure",
"Key",
"Vault",
".",
"Individual",
"versions",
"of",
"a",
"key",
"cannot",
"be",
"backed",
"up",
".",
"BACKUP",
"/",
"RESTORE",
"can",
"be",
"performed",
"within",
"geographical",
"boundaries",
"only",
";",
"meaning",
"that",
"a",
"BACKUP",
"from",
"one",
"geographical",
"area",
"cannot",
"be",
"restored",
"to",
"another",
"geographical",
"area",
".",
"For",
"example",
"a",
"backup",
"from",
"the",
"US",
"geographical",
"area",
"cannot",
"be",
"restored",
"in",
"an",
"EU",
"geographical",
"area",
".",
"This",
"operation",
"requires",
"the",
"key",
"/",
"backup",
"permission",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L1992-L1999 |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java | DeclarationTransformerImpl.genericOneIdentOrColor | protected <T extends CSSProperty> boolean genericOneIdentOrColor(
Class<T> type, T colorIdentification, Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
"""
Processes declaration which is supposed to contain one identification
term or one TermColor
@param <T>
Type of CSSProperty
@param type
Class of enum to be stored
@param colorIdentification
Instance of CSSProperty stored into properties to indicate
that additional value of type TermColor is stored in values
@param d
Declaration to be parsed
@param properties
Properties map where to store enum
@param values
@return <code>true</code> in case of success, <code>false</code>
elsewhere
"""
if (d.size() != 1)
return false;
return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(),
properties)
|| genericTermColor(d.get(0), d.getProperty(),
colorIdentification, properties, values);
} | java | protected <T extends CSSProperty> boolean genericOneIdentOrColor(
Class<T> type, T colorIdentification, Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
if (d.size() != 1)
return false;
return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(),
properties)
|| genericTermColor(d.get(0), d.getProperty(),
colorIdentification, properties, values);
} | [
"protected",
"<",
"T",
"extends",
"CSSProperty",
">",
"boolean",
"genericOneIdentOrColor",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"T",
"colorIdentification",
",",
"Declaration",
"d",
",",
"Map",
"<",
"String",
",",
"CSSProperty",
">",
"properties",
",",
"Map",
"<",
"String",
",",
"Term",
"<",
"?",
">",
">",
"values",
")",
"{",
"if",
"(",
"d",
".",
"size",
"(",
")",
"!=",
"1",
")",
"return",
"false",
";",
"return",
"genericTermIdent",
"(",
"type",
",",
"d",
".",
"get",
"(",
"0",
")",
",",
"ALLOW_INH",
",",
"d",
".",
"getProperty",
"(",
")",
",",
"properties",
")",
"||",
"genericTermColor",
"(",
"d",
".",
"get",
"(",
"0",
")",
",",
"d",
".",
"getProperty",
"(",
")",
",",
"colorIdentification",
",",
"properties",
",",
"values",
")",
";",
"}"
]
| Processes declaration which is supposed to contain one identification
term or one TermColor
@param <T>
Type of CSSProperty
@param type
Class of enum to be stored
@param colorIdentification
Instance of CSSProperty stored into properties to indicate
that additional value of type TermColor is stored in values
@param d
Declaration to be parsed
@param properties
Properties map where to store enum
@param values
@return <code>true</code> in case of success, <code>false</code>
elsewhere | [
"Processes",
"declaration",
"which",
"is",
"supposed",
"to",
"contain",
"one",
"identification",
"term",
"or",
"one",
"TermColor"
]
| train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java#L481-L492 |
Azure/azure-sdk-for-java | batchai/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/implementation/JobsInner.java | JobsInner.create | public JobInner create(String resourceGroupName, String jobName, JobCreateParameters parameters) {
"""
Adds a Job that gets executed on a cluster.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param jobName The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param parameters The parameters to provide for job creation.
@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 JobInner object if successful.
"""
return createWithServiceResponseAsync(resourceGroupName, jobName, parameters).toBlocking().last().body();
} | java | public JobInner create(String resourceGroupName, String jobName, JobCreateParameters parameters) {
return createWithServiceResponseAsync(resourceGroupName, jobName, parameters).toBlocking().last().body();
} | [
"public",
"JobInner",
"create",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
",",
"JobCreateParameters",
"parameters",
")",
"{",
"return",
"createWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"jobName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
]
| Adds a Job that gets executed on a cluster.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param jobName The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param parameters The parameters to provide for job creation.
@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 JobInner object if successful. | [
"Adds",
"a",
"Job",
"that",
"gets",
"executed",
"on",
"a",
"cluster",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/implementation/JobsInner.java#L145-L147 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Solo.java | Solo.clickLongOnTextAndPress | public void clickLongOnTextAndPress(String text, int index) {
"""
Long clicks a View displaying the specified text and then selects
an item from the context menu that appears. Will automatically scroll when needed.
@param text the text to click. The parameter will be interpreted as a regular expression
@param index the index of the menu item to press. {@code 0} if only one is available
"""
if(config.commandLogging){
Log.d(config.commandLoggingTag, "clickLongOnTextAndPress(\""+text+"\", "+index+")");
}
clicker.clickLongOnTextAndPress(text, index);
} | java | public void clickLongOnTextAndPress(String text, int index) {
if(config.commandLogging){
Log.d(config.commandLoggingTag, "clickLongOnTextAndPress(\""+text+"\", "+index+")");
}
clicker.clickLongOnTextAndPress(text, index);
} | [
"public",
"void",
"clickLongOnTextAndPress",
"(",
"String",
"text",
",",
"int",
"index",
")",
"{",
"if",
"(",
"config",
".",
"commandLogging",
")",
"{",
"Log",
".",
"d",
"(",
"config",
".",
"commandLoggingTag",
",",
"\"clickLongOnTextAndPress(\\\"\"",
"+",
"text",
"+",
"\"\\\", \"",
"+",
"index",
"+",
"\")\"",
")",
";",
"}",
"clicker",
".",
"clickLongOnTextAndPress",
"(",
"text",
",",
"index",
")",
";",
"}"
]
| Long clicks a View displaying the specified text and then selects
an item from the context menu that appears. Will automatically scroll when needed.
@param text the text to click. The parameter will be interpreted as a regular expression
@param index the index of the menu item to press. {@code 0} if only one is available | [
"Long",
"clicks",
"a",
"View",
"displaying",
"the",
"specified",
"text",
"and",
"then",
"selects",
"an",
"item",
"from",
"the",
"context",
"menu",
"that",
"appears",
".",
"Will",
"automatically",
"scroll",
"when",
"needed",
"."
]
| train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L1619-L1625 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf_download_policy.java | ns_conf_download_policy.do_poll | public static ns_conf_download_policy do_poll(nitro_service client, ns_conf_download_policy resource) throws Exception {
"""
<pre>
Use this operation to poll all ns.conf file from NetScaler and updated the database.
</pre>
"""
return ((ns_conf_download_policy[]) resource.perform_operation(client, "do_poll"))[0];
} | java | public static ns_conf_download_policy do_poll(nitro_service client, ns_conf_download_policy resource) throws Exception
{
return ((ns_conf_download_policy[]) resource.perform_operation(client, "do_poll"))[0];
} | [
"public",
"static",
"ns_conf_download_policy",
"do_poll",
"(",
"nitro_service",
"client",
",",
"ns_conf_download_policy",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"ns_conf_download_policy",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"do_poll\"",
")",
")",
"[",
"0",
"]",
";",
"}"
]
| <pre>
Use this operation to poll all ns.conf file from NetScaler and updated the database.
</pre> | [
"<pre",
">",
"Use",
"this",
"operation",
"to",
"poll",
"all",
"ns",
".",
"conf",
"file",
"from",
"NetScaler",
"and",
"updated",
"the",
"database",
".",
"<",
"/",
"pre",
">"
]
| train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf_download_policy.java#L106-L109 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java | XML.addAttributes | public XML addAttributes(Class<?> aClass,Attribute[] attributes) {
"""
This method adds the attributes to an existing Class.
@param aClass class to which add attributes
@param attributes attributes to add
@return this instance of XML
"""
checksAttributesExistence(aClass,attributes);
for (Attribute attribute : attributes) {
if(attributeExists(aClass,attribute)) Error.xmlAttributeExistent(this.xmlPath,attribute, aClass);
findXmlClass(aClass).attributes.add(Converter.toXmlAttribute(attribute));
}
return this;
} | java | public XML addAttributes(Class<?> aClass,Attribute[] attributes){
checksAttributesExistence(aClass,attributes);
for (Attribute attribute : attributes) {
if(attributeExists(aClass,attribute)) Error.xmlAttributeExistent(this.xmlPath,attribute, aClass);
findXmlClass(aClass).attributes.add(Converter.toXmlAttribute(attribute));
}
return this;
} | [
"public",
"XML",
"addAttributes",
"(",
"Class",
"<",
"?",
">",
"aClass",
",",
"Attribute",
"[",
"]",
"attributes",
")",
"{",
"checksAttributesExistence",
"(",
"aClass",
",",
"attributes",
")",
";",
"for",
"(",
"Attribute",
"attribute",
":",
"attributes",
")",
"{",
"if",
"(",
"attributeExists",
"(",
"aClass",
",",
"attribute",
")",
")",
"Error",
".",
"xmlAttributeExistent",
"(",
"this",
".",
"xmlPath",
",",
"attribute",
",",
"aClass",
")",
";",
"findXmlClass",
"(",
"aClass",
")",
".",
"attributes",
".",
"add",
"(",
"Converter",
".",
"toXmlAttribute",
"(",
"attribute",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
]
| This method adds the attributes to an existing Class.
@param aClass class to which add attributes
@param attributes attributes to add
@return this instance of XML | [
"This",
"method",
"adds",
"the",
"attributes",
"to",
"an",
"existing",
"Class",
"."
]
| train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L333-L341 |
aws/aws-sdk-java | aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateIntegrationResponseRequest.java | CreateIntegrationResponseRequest.withResponseParameters | public CreateIntegrationResponseRequest withResponseParameters(java.util.Map<String, String> responseParameters) {
"""
<p>
A key-value map specifying response parameters that are passed to the method response from the backend. The key
is a method response header parameter name and the mapped value is an integration response header value, a static
value enclosed within a pair of single quotes, or a JSON expression from the integration response body. The
mapping key must match the pattern of method.response.header.{name}, where {name} is a valid and unique header
name. The mapped non-static value must match the pattern of integration.response.header.{name} or
integration.response.body.{JSON-expression}, where {name} is a valid and unique response header name and
{JSON-expression} is a valid JSON expression without the $ prefix.
</p>
@param responseParameters
A key-value map specifying response parameters that are passed to the method response from the backend.
The key is a method response header parameter name and the mapped value is an integration response header
value, a static value enclosed within a pair of single quotes, or a JSON expression from the integration
response body. The mapping key must match the pattern of method.response.header.{name}, where {name} is a
valid and unique header name. The mapped non-static value must match the pattern of
integration.response.header.{name} or integration.response.body.{JSON-expression}, where {name} is a valid
and unique response header name and {JSON-expression} is a valid JSON expression without the $ prefix.
@return Returns a reference to this object so that method calls can be chained together.
"""
setResponseParameters(responseParameters);
return this;
} | java | public CreateIntegrationResponseRequest withResponseParameters(java.util.Map<String, String> responseParameters) {
setResponseParameters(responseParameters);
return this;
} | [
"public",
"CreateIntegrationResponseRequest",
"withResponseParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"responseParameters",
")",
"{",
"setResponseParameters",
"(",
"responseParameters",
")",
";",
"return",
"this",
";",
"}"
]
| <p>
A key-value map specifying response parameters that are passed to the method response from the backend. The key
is a method response header parameter name and the mapped value is an integration response header value, a static
value enclosed within a pair of single quotes, or a JSON expression from the integration response body. The
mapping key must match the pattern of method.response.header.{name}, where {name} is a valid and unique header
name. The mapped non-static value must match the pattern of integration.response.header.{name} or
integration.response.body.{JSON-expression}, where {name} is a valid and unique response header name and
{JSON-expression} is a valid JSON expression without the $ prefix.
</p>
@param responseParameters
A key-value map specifying response parameters that are passed to the method response from the backend.
The key is a method response header parameter name and the mapped value is an integration response header
value, a static value enclosed within a pair of single quotes, or a JSON expression from the integration
response body. The mapping key must match the pattern of method.response.header.{name}, where {name} is a
valid and unique header name. The mapped non-static value must match the pattern of
integration.response.header.{name} or integration.response.body.{JSON-expression}, where {name} is a valid
and unique response header name and {JSON-expression} is a valid JSON expression without the $ prefix.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"key",
"-",
"value",
"map",
"specifying",
"response",
"parameters",
"that",
"are",
"passed",
"to",
"the",
"method",
"response",
"from",
"the",
"backend",
".",
"The",
"key",
"is",
"a",
"method",
"response",
"header",
"parameter",
"name",
"and",
"the",
"mapped",
"value",
"is",
"an",
"integration",
"response",
"header",
"value",
"a",
"static",
"value",
"enclosed",
"within",
"a",
"pair",
"of",
"single",
"quotes",
"or",
"a",
"JSON",
"expression",
"from",
"the",
"integration",
"response",
"body",
".",
"The",
"mapping",
"key",
"must",
"match",
"the",
"pattern",
"of",
"method",
".",
"response",
".",
"header",
".",
"{",
"name",
"}",
"where",
"{",
"name",
"}",
"is",
"a",
"valid",
"and",
"unique",
"header",
"name",
".",
"The",
"mapped",
"non",
"-",
"static",
"value",
"must",
"match",
"the",
"pattern",
"of",
"integration",
".",
"response",
".",
"header",
".",
"{",
"name",
"}",
"or",
"integration",
".",
"response",
".",
"body",
".",
"{",
"JSON",
"-",
"expression",
"}",
"where",
"{",
"name",
"}",
"is",
"a",
"valid",
"and",
"unique",
"response",
"header",
"name",
"and",
"{",
"JSON",
"-",
"expression",
"}",
"is",
"a",
"valid",
"JSON",
"expression",
"without",
"the",
"$",
"prefix",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateIntegrationResponseRequest.java#L424-L427 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java | ObjectArrayList.mergeSortFromTo | public void mergeSortFromTo(int from, int to) {
"""
Sorts the specified range of the receiver into
ascending order, according to the <i>natural ordering</i> of its
elements. All elements in this range must implement the
<tt>Comparable</tt> interface. Furthermore, all elements in this range
must be <i>mutually comparable</i> (that is, <tt>e1.compareTo(e2)</tt>
must not throw a <tt>ClassCastException</tt> for any elements
<tt>e1</tt> and <tt>e2</tt> in the array).<p>
This sort is guaranteed to be <i>stable</i>: equal elements will
not be reordered as a result of the sort.<p>
The sorting algorithm is a modified mergesort (in which the merge is
omitted if the highest element in the low sublist is less than the
lowest element in the high sublist). This algorithm offers guaranteed
n*log(n) performance, and can approach linear performance on nearly
sorted lists.
<p><b>You should never call this method unless you are sure that this particular sorting algorithm is the right one for your data set.</b>
It is generally better to call <tt>sort()</tt> or <tt>sortFromTo(...)</tt> instead, because those methods automatically choose the best sorting algorithm.
@param from the index of the first element (inclusive) to be sorted.
@param to the index of the last element (inclusive) to be sorted.
@exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
"""
if (size==0) return;
checkRangeFromTo(from, to, size);
java.util.Arrays.sort(elements, from, to+1);
} | java | public void mergeSortFromTo(int from, int to) {
if (size==0) return;
checkRangeFromTo(from, to, size);
java.util.Arrays.sort(elements, from, to+1);
} | [
"public",
"void",
"mergeSortFromTo",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"return",
";",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"size",
")",
";",
"java",
".",
"util",
".",
"Arrays",
".",
"sort",
"(",
"elements",
",",
"from",
",",
"to",
"+",
"1",
")",
";",
"}"
]
| Sorts the specified range of the receiver into
ascending order, according to the <i>natural ordering</i> of its
elements. All elements in this range must implement the
<tt>Comparable</tt> interface. Furthermore, all elements in this range
must be <i>mutually comparable</i> (that is, <tt>e1.compareTo(e2)</tt>
must not throw a <tt>ClassCastException</tt> for any elements
<tt>e1</tt> and <tt>e2</tt> in the array).<p>
This sort is guaranteed to be <i>stable</i>: equal elements will
not be reordered as a result of the sort.<p>
The sorting algorithm is a modified mergesort (in which the merge is
omitted if the highest element in the low sublist is less than the
lowest element in the high sublist). This algorithm offers guaranteed
n*log(n) performance, and can approach linear performance on nearly
sorted lists.
<p><b>You should never call this method unless you are sure that this particular sorting algorithm is the right one for your data set.</b>
It is generally better to call <tt>sort()</tt> or <tt>sortFromTo(...)</tt> instead, because those methods automatically choose the best sorting algorithm.
@param from the index of the first element (inclusive) to be sorted.
@param to the index of the last element (inclusive) to be sorted.
@exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>). | [
"Sorts",
"the",
"specified",
"range",
"of",
"the",
"receiver",
"into",
"ascending",
"order",
"according",
"to",
"the",
"<i",
">",
"natural",
"ordering<",
"/",
"i",
">",
"of",
"its",
"elements",
".",
"All",
"elements",
"in",
"this",
"range",
"must",
"implement",
"the",
"<tt",
">",
"Comparable<",
"/",
"tt",
">",
"interface",
".",
"Furthermore",
"all",
"elements",
"in",
"this",
"range",
"must",
"be",
"<i",
">",
"mutually",
"comparable<",
"/",
"i",
">",
"(",
"that",
"is",
"<tt",
">",
"e1",
".",
"compareTo",
"(",
"e2",
")",
"<",
"/",
"tt",
">",
"must",
"not",
"throw",
"a",
"<tt",
">",
"ClassCastException<",
"/",
"tt",
">",
"for",
"any",
"elements",
"<tt",
">",
"e1<",
"/",
"tt",
">",
"and",
"<tt",
">",
"e2<",
"/",
"tt",
">",
"in",
"the",
"array",
")",
".",
"<p",
">"
]
| train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java#L550-L554 |
h2oai/h2o-3 | h2o-core/src/main/java/water/H2ONode.java | H2ONode.openChan | public static ByteChannel openChan(byte tcpType, SocketChannelFactory socketFactory, InetAddress originAddr, int originPort, short nodeTimeStamp) throws IOException {
"""
Returns a new connection of type {@code tcpType}, the type can be either
TCPReceiverThread.TCP_SMALL, TCPReceiverThread.TCP_BIG or
TCPReceiverThread.TCP_EXTERNAL.
In case of TCPReceiverThread.TCP_EXTERNAL, we need to keep in mind that this method is executed in environment
where H2O is not running, but it is just on the classpath so users can establish connection with the external H2O
cluster.
If socket channel factory is set, the communication will considered to be secured - this depends on the
configuration of the {@link SocketChannelFactory}. In case of the factory is null, the communication won't be secured.
@return new socket channel
"""
// This method can't internally use static fields which depends on initialized H2O cluster in case of
//communication to the external H2O cluster
// Must make a fresh socket
SocketChannel sock = SocketChannel.open();
sock.socket().setReuseAddress(true);
sock.socket().setSendBufferSize(AutoBuffer.BBP_BIG._size);
InetSocketAddress isa = new InetSocketAddress(originAddr, originPort);
boolean res = sock.connect(isa); // Can toss IOEx, esp if other node is still booting up
assert res : "Should be already connected, but connection is in non-blocking mode and the connection operation is in progress!";
sock.configureBlocking(true);
assert !sock.isConnectionPending() && sock.isBlocking() && sock.isConnected() && sock.isOpen();
sock.socket().setTcpNoDelay(true);
ByteBuffer bb = ByteBuffer.allocate(6).order(ByteOrder.nativeOrder());
// In Case of tcpType == TCPReceiverThread.TCP_EXTERNAL, H2O.H2O_PORT is 0 as it is undefined, because
// H2O cluster is not running in this case. However,
// it is fine as the receiver of the external backend does not use this value.
bb.put(tcpType).putShort(nodeTimeStamp).putChar((char)H2O.H2O_PORT).put((byte) 0xef).flip();
ByteChannel wrappedSocket = socketFactory.clientChannel(sock, isa.getHostName(), isa.getPort());
while (bb.hasRemaining()) { // Write out magic startup sequence
wrappedSocket.write(bb);
}
return wrappedSocket;
} | java | public static ByteChannel openChan(byte tcpType, SocketChannelFactory socketFactory, InetAddress originAddr, int originPort, short nodeTimeStamp) throws IOException {
// This method can't internally use static fields which depends on initialized H2O cluster in case of
//communication to the external H2O cluster
// Must make a fresh socket
SocketChannel sock = SocketChannel.open();
sock.socket().setReuseAddress(true);
sock.socket().setSendBufferSize(AutoBuffer.BBP_BIG._size);
InetSocketAddress isa = new InetSocketAddress(originAddr, originPort);
boolean res = sock.connect(isa); // Can toss IOEx, esp if other node is still booting up
assert res : "Should be already connected, but connection is in non-blocking mode and the connection operation is in progress!";
sock.configureBlocking(true);
assert !sock.isConnectionPending() && sock.isBlocking() && sock.isConnected() && sock.isOpen();
sock.socket().setTcpNoDelay(true);
ByteBuffer bb = ByteBuffer.allocate(6).order(ByteOrder.nativeOrder());
// In Case of tcpType == TCPReceiverThread.TCP_EXTERNAL, H2O.H2O_PORT is 0 as it is undefined, because
// H2O cluster is not running in this case. However,
// it is fine as the receiver of the external backend does not use this value.
bb.put(tcpType).putShort(nodeTimeStamp).putChar((char)H2O.H2O_PORT).put((byte) 0xef).flip();
ByteChannel wrappedSocket = socketFactory.clientChannel(sock, isa.getHostName(), isa.getPort());
while (bb.hasRemaining()) { // Write out magic startup sequence
wrappedSocket.write(bb);
}
return wrappedSocket;
} | [
"public",
"static",
"ByteChannel",
"openChan",
"(",
"byte",
"tcpType",
",",
"SocketChannelFactory",
"socketFactory",
",",
"InetAddress",
"originAddr",
",",
"int",
"originPort",
",",
"short",
"nodeTimeStamp",
")",
"throws",
"IOException",
"{",
"// This method can't internally use static fields which depends on initialized H2O cluster in case of",
"//communication to the external H2O cluster",
"// Must make a fresh socket",
"SocketChannel",
"sock",
"=",
"SocketChannel",
".",
"open",
"(",
")",
";",
"sock",
".",
"socket",
"(",
")",
".",
"setReuseAddress",
"(",
"true",
")",
";",
"sock",
".",
"socket",
"(",
")",
".",
"setSendBufferSize",
"(",
"AutoBuffer",
".",
"BBP_BIG",
".",
"_size",
")",
";",
"InetSocketAddress",
"isa",
"=",
"new",
"InetSocketAddress",
"(",
"originAddr",
",",
"originPort",
")",
";",
"boolean",
"res",
"=",
"sock",
".",
"connect",
"(",
"isa",
")",
";",
"// Can toss IOEx, esp if other node is still booting up",
"assert",
"res",
":",
"\"Should be already connected, but connection is in non-blocking mode and the connection operation is in progress!\"",
";",
"sock",
".",
"configureBlocking",
"(",
"true",
")",
";",
"assert",
"!",
"sock",
".",
"isConnectionPending",
"(",
")",
"&&",
"sock",
".",
"isBlocking",
"(",
")",
"&&",
"sock",
".",
"isConnected",
"(",
")",
"&&",
"sock",
".",
"isOpen",
"(",
")",
";",
"sock",
".",
"socket",
"(",
")",
".",
"setTcpNoDelay",
"(",
"true",
")",
";",
"ByteBuffer",
"bb",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"6",
")",
".",
"order",
"(",
"ByteOrder",
".",
"nativeOrder",
"(",
")",
")",
";",
"// In Case of tcpType == TCPReceiverThread.TCP_EXTERNAL, H2O.H2O_PORT is 0 as it is undefined, because",
"// H2O cluster is not running in this case. However,",
"// it is fine as the receiver of the external backend does not use this value.",
"bb",
".",
"put",
"(",
"tcpType",
")",
".",
"putShort",
"(",
"nodeTimeStamp",
")",
".",
"putChar",
"(",
"(",
"char",
")",
"H2O",
".",
"H2O_PORT",
")",
".",
"put",
"(",
"(",
"byte",
")",
"0xef",
")",
".",
"flip",
"(",
")",
";",
"ByteChannel",
"wrappedSocket",
"=",
"socketFactory",
".",
"clientChannel",
"(",
"sock",
",",
"isa",
".",
"getHostName",
"(",
")",
",",
"isa",
".",
"getPort",
"(",
")",
")",
";",
"while",
"(",
"bb",
".",
"hasRemaining",
"(",
")",
")",
"{",
"// Write out magic startup sequence",
"wrappedSocket",
".",
"write",
"(",
"bb",
")",
";",
"}",
"return",
"wrappedSocket",
";",
"}"
]
| Returns a new connection of type {@code tcpType}, the type can be either
TCPReceiverThread.TCP_SMALL, TCPReceiverThread.TCP_BIG or
TCPReceiverThread.TCP_EXTERNAL.
In case of TCPReceiverThread.TCP_EXTERNAL, we need to keep in mind that this method is executed in environment
where H2O is not running, but it is just on the classpath so users can establish connection with the external H2O
cluster.
If socket channel factory is set, the communication will considered to be secured - this depends on the
configuration of the {@link SocketChannelFactory}. In case of the factory is null, the communication won't be secured.
@return new socket channel | [
"Returns",
"a",
"new",
"connection",
"of",
"type",
"{",
"@code",
"tcpType",
"}",
"the",
"type",
"can",
"be",
"either",
"TCPReceiverThread",
".",
"TCP_SMALL",
"TCPReceiverThread",
".",
"TCP_BIG",
"or",
"TCPReceiverThread",
".",
"TCP_EXTERNAL",
"."
]
| train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/H2ONode.java#L449-L474 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseLVals | private Tuple<LVal> parseLVals(EnclosingScope scope) {
"""
Parse an "lval" expression, which is a subset of the possible expressions
forms permitted on the left-hand side of an assignment. LVals are of the
form:
<pre>
LVal ::= LValTerm (',' LValTerm)* ')'
</pre>
@param scope
The enclosing scope for this statement, which determines the
set of visible (i.e. declared) variables and also the current
indentation level.
@return
"""
int start = index;
ArrayList<LVal> elements = new ArrayList<>();
elements.add(parseLVal(index, scope));
// Check whether we have a multiple lvals or not
while (tryAndMatch(true, Comma) != null) {
// Add all expressions separated by a comma
elements.add(parseLVal(index, scope));
// Done
}
return new Tuple<>(elements);
} | java | private Tuple<LVal> parseLVals(EnclosingScope scope) {
int start = index;
ArrayList<LVal> elements = new ArrayList<>();
elements.add(parseLVal(index, scope));
// Check whether we have a multiple lvals or not
while (tryAndMatch(true, Comma) != null) {
// Add all expressions separated by a comma
elements.add(parseLVal(index, scope));
// Done
}
return new Tuple<>(elements);
} | [
"private",
"Tuple",
"<",
"LVal",
">",
"parseLVals",
"(",
"EnclosingScope",
"scope",
")",
"{",
"int",
"start",
"=",
"index",
";",
"ArrayList",
"<",
"LVal",
">",
"elements",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"elements",
".",
"add",
"(",
"parseLVal",
"(",
"index",
",",
"scope",
")",
")",
";",
"// Check whether we have a multiple lvals or not",
"while",
"(",
"tryAndMatch",
"(",
"true",
",",
"Comma",
")",
"!=",
"null",
")",
"{",
"// Add all expressions separated by a comma",
"elements",
".",
"add",
"(",
"parseLVal",
"(",
"index",
",",
"scope",
")",
")",
";",
"// Done",
"}",
"return",
"new",
"Tuple",
"<>",
"(",
"elements",
")",
";",
"}"
]
| Parse an "lval" expression, which is a subset of the possible expressions
forms permitted on the left-hand side of an assignment. LVals are of the
form:
<pre>
LVal ::= LValTerm (',' LValTerm)* ')'
</pre>
@param scope
The enclosing scope for this statement, which determines the
set of visible (i.e. declared) variables and also the current
indentation level.
@return | [
"Parse",
"an",
"lval",
"expression",
"which",
"is",
"a",
"subset",
"of",
"the",
"possible",
"expressions",
"forms",
"permitted",
"on",
"the",
"left",
"-",
"hand",
"side",
"of",
"an",
"assignment",
".",
"LVals",
"are",
"of",
"the",
"form",
":"
]
| train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L1447-L1460 |
liferay/com-liferay-commerce | commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountRelPersistenceImpl.java | CommerceDiscountRelPersistenceImpl.findByCommerceDiscountId | @Override
public List<CommerceDiscountRel> findByCommerceDiscountId(
long commerceDiscountId, int start, int end) {
"""
Returns a range of all the commerce discount rels where commerceDiscountId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceDiscountRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param commerceDiscountId the commerce discount ID
@param start the lower bound of the range of commerce discount rels
@param end the upper bound of the range of commerce discount rels (not inclusive)
@return the range of matching commerce discount rels
"""
return findByCommerceDiscountId(commerceDiscountId, start, end, null);
} | java | @Override
public List<CommerceDiscountRel> findByCommerceDiscountId(
long commerceDiscountId, int start, int end) {
return findByCommerceDiscountId(commerceDiscountId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceDiscountRel",
">",
"findByCommerceDiscountId",
"(",
"long",
"commerceDiscountId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCommerceDiscountId",
"(",
"commerceDiscountId",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
]
| Returns a range of all the commerce discount rels where commerceDiscountId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceDiscountRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param commerceDiscountId the commerce discount ID
@param start the lower bound of the range of commerce discount rels
@param end the upper bound of the range of commerce discount rels (not inclusive)
@return the range of matching commerce discount rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"discount",
"rels",
"where",
"commerceDiscountId",
"=",
"?",
";",
"."
]
| train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountRelPersistenceImpl.java#L142-L146 |
alkacon/opencms-core | src/org/opencms/relations/CmsLinkUpdateUtil.java | CmsLinkUpdateUtil.updateType | public static void updateType(Element element, CmsRelationType type) {
"""
Updates the type for a link xml element node.<p>
@param element the link element node to update
@param type the relation type to set
"""
updateAttribute(element, CmsLink.ATTRIBUTE_TYPE, type.getNameForXml());
} | java | public static void updateType(Element element, CmsRelationType type) {
updateAttribute(element, CmsLink.ATTRIBUTE_TYPE, type.getNameForXml());
} | [
"public",
"static",
"void",
"updateType",
"(",
"Element",
"element",
",",
"CmsRelationType",
"type",
")",
"{",
"updateAttribute",
"(",
"element",
",",
"CmsLink",
".",
"ATTRIBUTE_TYPE",
",",
"type",
".",
"getNameForXml",
"(",
")",
")",
";",
"}"
]
| Updates the type for a link xml element node.<p>
@param element the link element node to update
@param type the relation type to set | [
"Updates",
"the",
"type",
"for",
"a",
"link",
"xml",
"element",
"node",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsLinkUpdateUtil.java#L55-L58 |
square/phrase | src/main/java/com/squareup/phrase/ListPhrase.java | ListPhrase.formatOrThrow | private static <T> CharSequence formatOrThrow(T item, int index, Formatter<T> formatter) {
"""
Formats {@code item} by passing it to {@code formatter.format()} if {@code formatter} is
non-null, else calls {@code item.toString()}. Throws an {@link IllegalArgumentException} if
{@code item} is null, and an {@link IllegalStateException} if {@code formatter.format()}
returns null.
"""
if (item == null) {
throw new IllegalArgumentException("list element cannot be null at index " + index);
}
CharSequence formatted = formatter == null ? item.toString() : formatter.format(item);
if (formatted == null) {
throw new IllegalArgumentException("formatted list element cannot be null at index " + index);
}
if (formatted.length() == 0) {
throw new IllegalArgumentException(
"formatted list element cannot be empty at index " + index);
}
return formatted;
} | java | private static <T> CharSequence formatOrThrow(T item, int index, Formatter<T> formatter) {
if (item == null) {
throw new IllegalArgumentException("list element cannot be null at index " + index);
}
CharSequence formatted = formatter == null ? item.toString() : formatter.format(item);
if (formatted == null) {
throw new IllegalArgumentException("formatted list element cannot be null at index " + index);
}
if (formatted.length() == 0) {
throw new IllegalArgumentException(
"formatted list element cannot be empty at index " + index);
}
return formatted;
} | [
"private",
"static",
"<",
"T",
">",
"CharSequence",
"formatOrThrow",
"(",
"T",
"item",
",",
"int",
"index",
",",
"Formatter",
"<",
"T",
">",
"formatter",
")",
"{",
"if",
"(",
"item",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"list element cannot be null at index \"",
"+",
"index",
")",
";",
"}",
"CharSequence",
"formatted",
"=",
"formatter",
"==",
"null",
"?",
"item",
".",
"toString",
"(",
")",
":",
"formatter",
".",
"format",
"(",
"item",
")",
";",
"if",
"(",
"formatted",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"formatted list element cannot be null at index \"",
"+",
"index",
")",
";",
"}",
"if",
"(",
"formatted",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"formatted list element cannot be empty at index \"",
"+",
"index",
")",
";",
"}",
"return",
"formatted",
";",
"}"
]
| Formats {@code item} by passing it to {@code formatter.format()} if {@code formatter} is
non-null, else calls {@code item.toString()}. Throws an {@link IllegalArgumentException} if
{@code item} is null, and an {@link IllegalStateException} if {@code formatter.format()}
returns null. | [
"Formats",
"{"
]
| train | https://github.com/square/phrase/blob/d91f18e80790832db11b811c462f8e5cd492d97e/src/main/java/com/squareup/phrase/ListPhrase.java#L217-L233 |
alkacon/opencms-core | src/org/opencms/cmis/CmsCmisResourceHelper.java | CmsCmisResourceHelper.deleteObject | public synchronized void deleteObject(CmsCmisCallContext context, String objectId, boolean allVersions) {
"""
Deletes a CMIS object.<p>
@param context the call context
@param objectId the id of the object to delete
@param allVersions flag to delete all version
"""
try {
CmsObject cms = m_repository.getCmsObject(context);
CmsUUID structureId = new CmsUUID(objectId);
CmsResource resource = cms.readResource(structureId);
if (resource.isFolder()) {
boolean isLeaf = !hasChildren(cms, resource);
if (!isLeaf) {
throw new CmisConstraintException("Only leaf resources can be deleted.");
}
}
ensureLock(cms, resource);
cms.deleteResource(resource.getRootPath(), CmsResource.DELETE_PRESERVE_SIBLINGS);
} catch (CmsException e) {
handleCmsException(e);
}
} | java | public synchronized void deleteObject(CmsCmisCallContext context, String objectId, boolean allVersions) {
try {
CmsObject cms = m_repository.getCmsObject(context);
CmsUUID structureId = new CmsUUID(objectId);
CmsResource resource = cms.readResource(structureId);
if (resource.isFolder()) {
boolean isLeaf = !hasChildren(cms, resource);
if (!isLeaf) {
throw new CmisConstraintException("Only leaf resources can be deleted.");
}
}
ensureLock(cms, resource);
cms.deleteResource(resource.getRootPath(), CmsResource.DELETE_PRESERVE_SIBLINGS);
} catch (CmsException e) {
handleCmsException(e);
}
} | [
"public",
"synchronized",
"void",
"deleteObject",
"(",
"CmsCmisCallContext",
"context",
",",
"String",
"objectId",
",",
"boolean",
"allVersions",
")",
"{",
"try",
"{",
"CmsObject",
"cms",
"=",
"m_repository",
".",
"getCmsObject",
"(",
"context",
")",
";",
"CmsUUID",
"structureId",
"=",
"new",
"CmsUUID",
"(",
"objectId",
")",
";",
"CmsResource",
"resource",
"=",
"cms",
".",
"readResource",
"(",
"structureId",
")",
";",
"if",
"(",
"resource",
".",
"isFolder",
"(",
")",
")",
"{",
"boolean",
"isLeaf",
"=",
"!",
"hasChildren",
"(",
"cms",
",",
"resource",
")",
";",
"if",
"(",
"!",
"isLeaf",
")",
"{",
"throw",
"new",
"CmisConstraintException",
"(",
"\"Only leaf resources can be deleted.\"",
")",
";",
"}",
"}",
"ensureLock",
"(",
"cms",
",",
"resource",
")",
";",
"cms",
".",
"deleteResource",
"(",
"resource",
".",
"getRootPath",
"(",
")",
",",
"CmsResource",
".",
"DELETE_PRESERVE_SIBLINGS",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"handleCmsException",
"(",
"e",
")",
";",
"}",
"}"
]
| Deletes a CMIS object.<p>
@param context the call context
@param objectId the id of the object to delete
@param allVersions flag to delete all version | [
"Deletes",
"a",
"CMIS",
"object",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisResourceHelper.java#L119-L136 |
augustd/burp-suite-utils | src/main/java/com/codemagi/burp/parser/HttpRequest.java | HttpRequest.getCookies | public List<ICookie> getCookies() {
"""
Gets the value of the Cookie header
@return A list containing Cookie objects parsed from the internal string
representation
"""
String cookies = getHeader("Cookie");
List<ICookie> output = new ArrayList<>();
if (Utils.isEmpty(cookies)) {
return output;
}
for (String cookieStr : cookies.split("[; ]+")) {
String[] pair = cookieStr.split("=", 2);
output.add(new Cookie(pair[0], pair[1]));
}
return output;
} | java | public List<ICookie> getCookies() {
String cookies = getHeader("Cookie");
List<ICookie> output = new ArrayList<>();
if (Utils.isEmpty(cookies)) {
return output;
}
for (String cookieStr : cookies.split("[; ]+")) {
String[] pair = cookieStr.split("=", 2);
output.add(new Cookie(pair[0], pair[1]));
}
return output;
} | [
"public",
"List",
"<",
"ICookie",
">",
"getCookies",
"(",
")",
"{",
"String",
"cookies",
"=",
"getHeader",
"(",
"\"Cookie\"",
")",
";",
"List",
"<",
"ICookie",
">",
"output",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"Utils",
".",
"isEmpty",
"(",
"cookies",
")",
")",
"{",
"return",
"output",
";",
"}",
"for",
"(",
"String",
"cookieStr",
":",
"cookies",
".",
"split",
"(",
"\"[; ]+\"",
")",
")",
"{",
"String",
"[",
"]",
"pair",
"=",
"cookieStr",
".",
"split",
"(",
"\"=\"",
",",
"2",
")",
";",
"output",
".",
"add",
"(",
"new",
"Cookie",
"(",
"pair",
"[",
"0",
"]",
",",
"pair",
"[",
"1",
"]",
")",
")",
";",
"}",
"return",
"output",
";",
"}"
]
| Gets the value of the Cookie header
@return A list containing Cookie objects parsed from the internal string
representation | [
"Gets",
"the",
"value",
"of",
"the",
"Cookie",
"header"
]
| train | https://github.com/augustd/burp-suite-utils/blob/5e34a6b9147f5705382f98049dd9e4f387b78629/src/main/java/com/codemagi/burp/parser/HttpRequest.java#L250-L263 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java | BpmnParse.parseScriptTaskElement | protected ScriptTaskActivityBehavior parseScriptTaskElement(Element scriptTaskElement) {
"""
Returns a {@link ScriptTaskActivityBehavior} for the script task element
corresponding to the script source or resource specified.
@param scriptTaskElement
the script task element
@return the corresponding {@link ScriptTaskActivityBehavior}
"""
// determine script language
String language = scriptTaskElement.attribute("scriptFormat");
if (language == null) {
language = ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE;
}
String resultVariableName = parseResultVariable(scriptTaskElement);
// determine script source
String scriptSource = null;
Element scriptElement = scriptTaskElement.element("script");
if (scriptElement != null) {
scriptSource = scriptElement.getText();
}
String scriptResource = scriptTaskElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, PROPERTYNAME_RESOURCE);
try {
ExecutableScript script = ScriptUtil.getScript(language, scriptSource, scriptResource, expressionManager);
return new ScriptTaskActivityBehavior(script, resultVariableName);
} catch (ProcessEngineException e) {
addError("Unable to process ScriptTask: " + e.getMessage(), scriptElement);
return null;
}
} | java | protected ScriptTaskActivityBehavior parseScriptTaskElement(Element scriptTaskElement) {
// determine script language
String language = scriptTaskElement.attribute("scriptFormat");
if (language == null) {
language = ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE;
}
String resultVariableName = parseResultVariable(scriptTaskElement);
// determine script source
String scriptSource = null;
Element scriptElement = scriptTaskElement.element("script");
if (scriptElement != null) {
scriptSource = scriptElement.getText();
}
String scriptResource = scriptTaskElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, PROPERTYNAME_RESOURCE);
try {
ExecutableScript script = ScriptUtil.getScript(language, scriptSource, scriptResource, expressionManager);
return new ScriptTaskActivityBehavior(script, resultVariableName);
} catch (ProcessEngineException e) {
addError("Unable to process ScriptTask: " + e.getMessage(), scriptElement);
return null;
}
} | [
"protected",
"ScriptTaskActivityBehavior",
"parseScriptTaskElement",
"(",
"Element",
"scriptTaskElement",
")",
"{",
"// determine script language",
"String",
"language",
"=",
"scriptTaskElement",
".",
"attribute",
"(",
"\"scriptFormat\"",
")",
";",
"if",
"(",
"language",
"==",
"null",
")",
"{",
"language",
"=",
"ScriptingEngines",
".",
"DEFAULT_SCRIPTING_LANGUAGE",
";",
"}",
"String",
"resultVariableName",
"=",
"parseResultVariable",
"(",
"scriptTaskElement",
")",
";",
"// determine script source",
"String",
"scriptSource",
"=",
"null",
";",
"Element",
"scriptElement",
"=",
"scriptTaskElement",
".",
"element",
"(",
"\"script\"",
")",
";",
"if",
"(",
"scriptElement",
"!=",
"null",
")",
"{",
"scriptSource",
"=",
"scriptElement",
".",
"getText",
"(",
")",
";",
"}",
"String",
"scriptResource",
"=",
"scriptTaskElement",
".",
"attributeNS",
"(",
"CAMUNDA_BPMN_EXTENSIONS_NS",
",",
"PROPERTYNAME_RESOURCE",
")",
";",
"try",
"{",
"ExecutableScript",
"script",
"=",
"ScriptUtil",
".",
"getScript",
"(",
"language",
",",
"scriptSource",
",",
"scriptResource",
",",
"expressionManager",
")",
";",
"return",
"new",
"ScriptTaskActivityBehavior",
"(",
"script",
",",
"resultVariableName",
")",
";",
"}",
"catch",
"(",
"ProcessEngineException",
"e",
")",
"{",
"addError",
"(",
"\"Unable to process ScriptTask: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"scriptElement",
")",
";",
"return",
"null",
";",
"}",
"}"
]
| Returns a {@link ScriptTaskActivityBehavior} for the script task element
corresponding to the script source or resource specified.
@param scriptTaskElement
the script task element
@return the corresponding {@link ScriptTaskActivityBehavior} | [
"Returns",
"a",
"{",
"@link",
"ScriptTaskActivityBehavior",
"}",
"for",
"the",
"script",
"task",
"element",
"corresponding",
"to",
"the",
"script",
"source",
"or",
"resource",
"specified",
"."
]
| train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L2063-L2086 |
line/armeria | core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java | TextFormatter.appendEpochMicros | public static void appendEpochMicros(StringBuilder buf, long timeMicros) {
"""
Formats the given epoch time in microseconds to typical human-readable format
"yyyy-MM-dd'T'HH_mm:ss.SSSX" and appends it to the specified {@link StringBuilder}.
"""
buf.append(dateTimeFormatter.format(Instant.ofEpochMilli(TimeUnit.MICROSECONDS.toMillis(timeMicros))))
.append('(').append(timeMicros).append(')');
} | java | public static void appendEpochMicros(StringBuilder buf, long timeMicros) {
buf.append(dateTimeFormatter.format(Instant.ofEpochMilli(TimeUnit.MICROSECONDS.toMillis(timeMicros))))
.append('(').append(timeMicros).append(')');
} | [
"public",
"static",
"void",
"appendEpochMicros",
"(",
"StringBuilder",
"buf",
",",
"long",
"timeMicros",
")",
"{",
"buf",
".",
"append",
"(",
"dateTimeFormatter",
".",
"format",
"(",
"Instant",
".",
"ofEpochMilli",
"(",
"TimeUnit",
".",
"MICROSECONDS",
".",
"toMillis",
"(",
"timeMicros",
")",
")",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"timeMicros",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}"
]
| Formats the given epoch time in microseconds to typical human-readable format
"yyyy-MM-dd'T'HH_mm:ss.SSSX" and appends it to the specified {@link StringBuilder}. | [
"Formats",
"the",
"given",
"epoch",
"time",
"in",
"microseconds",
"to",
"typical",
"human",
"-",
"readable",
"format",
"yyyy",
"-",
"MM",
"-",
"dd",
"T",
"HH_mm",
":",
"ss",
".",
"SSSX",
"and",
"appends",
"it",
"to",
"the",
"specified",
"{"
]
| train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java#L197-L200 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_account_accountName_migrate_destinationServiceName_destinationEmailAddress_destinationEmailAddress_checkMigrate_GET | public OvhMigrationCheckStruct domain_account_accountName_migrate_destinationServiceName_destinationEmailAddress_destinationEmailAddress_checkMigrate_GET(String domain, String accountName, String destinationServiceName, String destinationEmailAddress) throws IOException {
"""
Check if it's possible to migrate
REST: GET /email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}/destinationEmailAddress/{destinationEmailAddress}/checkMigrate
@param domain [required] Name of your domain name
@param accountName [required] Name of account
@param destinationServiceName [required] Service name allowed as migration destination
@param destinationEmailAddress [required] Destination account name
API beta
"""
String qPath = "/email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}/destinationEmailAddress/{destinationEmailAddress}/checkMigrate";
StringBuilder sb = path(qPath, domain, accountName, destinationServiceName, destinationEmailAddress);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhMigrationCheckStruct.class);
} | java | public OvhMigrationCheckStruct domain_account_accountName_migrate_destinationServiceName_destinationEmailAddress_destinationEmailAddress_checkMigrate_GET(String domain, String accountName, String destinationServiceName, String destinationEmailAddress) throws IOException {
String qPath = "/email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}/destinationEmailAddress/{destinationEmailAddress}/checkMigrate";
StringBuilder sb = path(qPath, domain, accountName, destinationServiceName, destinationEmailAddress);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhMigrationCheckStruct.class);
} | [
"public",
"OvhMigrationCheckStruct",
"domain_account_accountName_migrate_destinationServiceName_destinationEmailAddress_destinationEmailAddress_checkMigrate_GET",
"(",
"String",
"domain",
",",
"String",
"accountName",
",",
"String",
"destinationServiceName",
",",
"String",
"destinationEmailAddress",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}/destinationEmailAddress/{destinationEmailAddress}/checkMigrate\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"domain",
",",
"accountName",
",",
"destinationServiceName",
",",
"destinationEmailAddress",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhMigrationCheckStruct",
".",
"class",
")",
";",
"}"
]
| Check if it's possible to migrate
REST: GET /email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}/destinationEmailAddress/{destinationEmailAddress}/checkMigrate
@param domain [required] Name of your domain name
@param accountName [required] Name of account
@param destinationServiceName [required] Service name allowed as migration destination
@param destinationEmailAddress [required] Destination account name
API beta | [
"Check",
"if",
"it",
"s",
"possible",
"to",
"migrate"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L507-L512 |
motown-io/motown | operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java | ChargingStationEventListener.updateEvseStatus | private void updateEvseStatus(ChargingStation chargingStation, String componentId, ComponentStatus status) {
"""
Updates the status of a Evse in the charging station object if the evse id matches the component id.
@param chargingStation charging stationidentifier.
@param componentId component identifier.
@param status new status.
"""
for (Evse evse : chargingStation.getEvses()) {
if (evse.getEvseId().equals(componentId)) {
evse.setStatus(status);
}
}
} | java | private void updateEvseStatus(ChargingStation chargingStation, String componentId, ComponentStatus status) {
for (Evse evse : chargingStation.getEvses()) {
if (evse.getEvseId().equals(componentId)) {
evse.setStatus(status);
}
}
} | [
"private",
"void",
"updateEvseStatus",
"(",
"ChargingStation",
"chargingStation",
",",
"String",
"componentId",
",",
"ComponentStatus",
"status",
")",
"{",
"for",
"(",
"Evse",
"evse",
":",
"chargingStation",
".",
"getEvses",
"(",
")",
")",
"{",
"if",
"(",
"evse",
".",
"getEvseId",
"(",
")",
".",
"equals",
"(",
"componentId",
")",
")",
"{",
"evse",
".",
"setStatus",
"(",
"status",
")",
";",
"}",
"}",
"}"
]
| Updates the status of a Evse in the charging station object if the evse id matches the component id.
@param chargingStation charging stationidentifier.
@param componentId component identifier.
@param status new status. | [
"Updates",
"the",
"status",
"of",
"a",
"Evse",
"in",
"the",
"charging",
"station",
"object",
"if",
"the",
"evse",
"id",
"matches",
"the",
"component",
"id",
"."
]
| train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java#L352-L358 |
rythmengine/rythmengine | src/main/java/org/rythmengine/RythmEngine.java | RythmEngine.accept | @Override
public Object accept(IEvent event, Object param) {
"""
Not an API for user application
@param event
@param param
@return event handler process result
"""
return eventDispatcher().accept(event, param);
} | java | @Override
public Object accept(IEvent event, Object param) {
return eventDispatcher().accept(event, param);
} | [
"@",
"Override",
"public",
"Object",
"accept",
"(",
"IEvent",
"event",
",",
"Object",
"param",
")",
"{",
"return",
"eventDispatcher",
"(",
")",
".",
"accept",
"(",
"event",
",",
"param",
")",
";",
"}"
]
| Not an API for user application
@param event
@param param
@return event handler process result | [
"Not",
"an",
"API",
"for",
"user",
"application"
]
| train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/RythmEngine.java#L1986-L1989 |
steveohara/j2mod | src/main/java/com/ghgande/j2mod/modbus/net/TCPSlaveConnection.java | TCPSlaveConnection.setSocket | private void setSocket(Socket socket, boolean useRtuOverTcp) throws IOException {
"""
Prepares the associated <tt>ModbusTransport</tt> of this
<tt>TCPMasterConnection</tt> for use.
@param socket the socket to be used for communication.
@param useRtuOverTcp True if the RTU protocol should be used over TCP
@throws IOException if an I/O related error occurs.
"""
this.socket = socket;
if (transport == null) {
if (useRtuOverTcp) {
logger.trace("setSocket() -> using RTU over TCP transport.");
transport = new ModbusRTUTCPTransport(socket);
}
else {
logger.trace("setSocket() -> using standard TCP transport.");
transport = new ModbusTCPTransport(socket);
}
}
else {
transport.setSocket(socket);
}
connected = true;
} | java | private void setSocket(Socket socket, boolean useRtuOverTcp) throws IOException {
this.socket = socket;
if (transport == null) {
if (useRtuOverTcp) {
logger.trace("setSocket() -> using RTU over TCP transport.");
transport = new ModbusRTUTCPTransport(socket);
}
else {
logger.trace("setSocket() -> using standard TCP transport.");
transport = new ModbusTCPTransport(socket);
}
}
else {
transport.setSocket(socket);
}
connected = true;
} | [
"private",
"void",
"setSocket",
"(",
"Socket",
"socket",
",",
"boolean",
"useRtuOverTcp",
")",
"throws",
"IOException",
"{",
"this",
".",
"socket",
"=",
"socket",
";",
"if",
"(",
"transport",
"==",
"null",
")",
"{",
"if",
"(",
"useRtuOverTcp",
")",
"{",
"logger",
".",
"trace",
"(",
"\"setSocket() -> using RTU over TCP transport.\"",
")",
";",
"transport",
"=",
"new",
"ModbusRTUTCPTransport",
"(",
"socket",
")",
";",
"}",
"else",
"{",
"logger",
".",
"trace",
"(",
"\"setSocket() -> using standard TCP transport.\"",
")",
";",
"transport",
"=",
"new",
"ModbusTCPTransport",
"(",
"socket",
")",
";",
"}",
"}",
"else",
"{",
"transport",
".",
"setSocket",
"(",
"socket",
")",
";",
"}",
"connected",
"=",
"true",
";",
"}"
]
| Prepares the associated <tt>ModbusTransport</tt> of this
<tt>TCPMasterConnection</tt> for use.
@param socket the socket to be used for communication.
@param useRtuOverTcp True if the RTU protocol should be used over TCP
@throws IOException if an I/O related error occurs. | [
"Prepares",
"the",
"associated",
"<tt",
">",
"ModbusTransport<",
"/",
"tt",
">",
"of",
"this",
"<tt",
">",
"TCPMasterConnection<",
"/",
"tt",
">",
"for",
"use",
"."
]
| train | https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/net/TCPSlaveConnection.java#L108-L126 |
headius/invokebinder | src/main/java/com/headius/invokebinder/SmartBinder.java | SmartBinder.castArg | public SmartBinder castArg(String name, Class<?> type) {
"""
Cast the named argument to the given type.
@param name the name of the argument to cast
@param type the type to which that argument will be cast
@return a new SmartBinder with the cast applied
"""
Signature newSig = signature().replaceArg(name, name, type);
return new SmartBinder(this, newSig, binder.cast(newSig.type()));
} | java | public SmartBinder castArg(String name, Class<?> type) {
Signature newSig = signature().replaceArg(name, name, type);
return new SmartBinder(this, newSig, binder.cast(newSig.type()));
} | [
"public",
"SmartBinder",
"castArg",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"Signature",
"newSig",
"=",
"signature",
"(",
")",
".",
"replaceArg",
"(",
"name",
",",
"name",
",",
"type",
")",
";",
"return",
"new",
"SmartBinder",
"(",
"this",
",",
"newSig",
",",
"binder",
".",
"cast",
"(",
"newSig",
".",
"type",
"(",
")",
")",
")",
";",
"}"
]
| Cast the named argument to the given type.
@param name the name of the argument to cast
@param type the type to which that argument will be cast
@return a new SmartBinder with the cast applied | [
"Cast",
"the",
"named",
"argument",
"to",
"the",
"given",
"type",
"."
]
| train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/SmartBinder.java#L906-L909 |
igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java | OpenPgpManager.createPubkeyElement | private static PubkeyElement createPubkeyElement(byte[] bytes, Date date) {
"""
Create a {@link PubkeyElement} which contains the given {@code data} base64 encoded.
@param bytes byte representation of an OpenPGP public key
@param date date of creation of the element
@return {@link PubkeyElement} containing the key
"""
return new PubkeyElement(new PubkeyElement.PubkeyDataElement(Base64.encode(bytes)), date);
} | java | private static PubkeyElement createPubkeyElement(byte[] bytes, Date date) {
return new PubkeyElement(new PubkeyElement.PubkeyDataElement(Base64.encode(bytes)), date);
} | [
"private",
"static",
"PubkeyElement",
"createPubkeyElement",
"(",
"byte",
"[",
"]",
"bytes",
",",
"Date",
"date",
")",
"{",
"return",
"new",
"PubkeyElement",
"(",
"new",
"PubkeyElement",
".",
"PubkeyDataElement",
"(",
"Base64",
".",
"encode",
"(",
"bytes",
")",
")",
",",
"date",
")",
";",
"}"
]
| Create a {@link PubkeyElement} which contains the given {@code data} base64 encoded.
@param bytes byte representation of an OpenPGP public key
@param date date of creation of the element
@return {@link PubkeyElement} containing the key | [
"Create",
"a",
"{",
"@link",
"PubkeyElement",
"}",
"which",
"contains",
"the",
"given",
"{",
"@code",
"data",
"}",
"base64",
"encoded",
"."
]
| train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java#L637-L639 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java | PhotosApi.setDates | public Response setDates(String photoId, Date datePosted, Date dateTaken, int dateTakenGranularity) throws JinxException {
"""
Set one or both of the dates for a photo.
<br>
This method requires authentication with 'write' permission.
<br>
One or both dates can be set. If no dates are set, nothing will happen.
<br>
Taken dates also have a 'granularity' - the accuracy to which we know the date to be true.
At present, the following granularities are used:
<ul>
<li>0 Y-m-d H:i:s</li>
<li>4 Y-m</li>
<li>6 Y</li>
<li>8 Circa...</li>
</ul>
@param photoId Required. The id of the photo to change dates for.
@param datePosted Optional. date the photo was uploaded to flickr
@param dateTaken Optional. date the photo was taken.
@param dateTakenGranularity Optional. granularity of the date the photo was taken.
@return response object with the result of the requested operation.
@throws JinxException if required parameters are null or empty, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.photos.setDates.html">flickr.photos.setDates</a>
"""
JinxUtils.validateParams(photoId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.setDates");
params.put("photo_id", photoId);
if (datePosted != null) {
params.put("date_posted", JinxUtils.formatDateAsUnixTimestamp(datePosted));
}
if (dateTaken != null) {
params.put("date_taken", JinxUtils.formatDateAsMySqlTimestamp(dateTaken));
}
if (dateTakenGranularity == 0 || dateTakenGranularity == 4 || dateTakenGranularity == 6 || dateTakenGranularity == 8) {
params.put("date_taken_granularity", Integer.toString(dateTakenGranularity));
}
return jinx.flickrPost(params, Response.class);
} | java | public Response setDates(String photoId, Date datePosted, Date dateTaken, int dateTakenGranularity) throws JinxException {
JinxUtils.validateParams(photoId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.setDates");
params.put("photo_id", photoId);
if (datePosted != null) {
params.put("date_posted", JinxUtils.formatDateAsUnixTimestamp(datePosted));
}
if (dateTaken != null) {
params.put("date_taken", JinxUtils.formatDateAsMySqlTimestamp(dateTaken));
}
if (dateTakenGranularity == 0 || dateTakenGranularity == 4 || dateTakenGranularity == 6 || dateTakenGranularity == 8) {
params.put("date_taken_granularity", Integer.toString(dateTakenGranularity));
}
return jinx.flickrPost(params, Response.class);
} | [
"public",
"Response",
"setDates",
"(",
"String",
"photoId",
",",
"Date",
"datePosted",
",",
"Date",
"dateTaken",
",",
"int",
"dateTakenGranularity",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"photoId",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"method\"",
",",
"\"flickr.photos.setDates\"",
")",
";",
"params",
".",
"put",
"(",
"\"photo_id\"",
",",
"photoId",
")",
";",
"if",
"(",
"datePosted",
"!=",
"null",
")",
"{",
"params",
".",
"put",
"(",
"\"date_posted\"",
",",
"JinxUtils",
".",
"formatDateAsUnixTimestamp",
"(",
"datePosted",
")",
")",
";",
"}",
"if",
"(",
"dateTaken",
"!=",
"null",
")",
"{",
"params",
".",
"put",
"(",
"\"date_taken\"",
",",
"JinxUtils",
".",
"formatDateAsMySqlTimestamp",
"(",
"dateTaken",
")",
")",
";",
"}",
"if",
"(",
"dateTakenGranularity",
"==",
"0",
"||",
"dateTakenGranularity",
"==",
"4",
"||",
"dateTakenGranularity",
"==",
"6",
"||",
"dateTakenGranularity",
"==",
"8",
")",
"{",
"params",
".",
"put",
"(",
"\"date_taken_granularity\"",
",",
"Integer",
".",
"toString",
"(",
"dateTakenGranularity",
")",
")",
";",
"}",
"return",
"jinx",
".",
"flickrPost",
"(",
"params",
",",
"Response",
".",
"class",
")",
";",
"}"
]
| Set one or both of the dates for a photo.
<br>
This method requires authentication with 'write' permission.
<br>
One or both dates can be set. If no dates are set, nothing will happen.
<br>
Taken dates also have a 'granularity' - the accuracy to which we know the date to be true.
At present, the following granularities are used:
<ul>
<li>0 Y-m-d H:i:s</li>
<li>4 Y-m</li>
<li>6 Y</li>
<li>8 Circa...</li>
</ul>
@param photoId Required. The id of the photo to change dates for.
@param datePosted Optional. date the photo was uploaded to flickr
@param dateTaken Optional. date the photo was taken.
@param dateTakenGranularity Optional. granularity of the date the photo was taken.
@return response object with the result of the requested operation.
@throws JinxException if required parameters are null or empty, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.photos.setDates.html">flickr.photos.setDates</a> | [
"Set",
"one",
"or",
"both",
"of",
"the",
"dates",
"for",
"a",
"photo",
".",
"<br",
">",
"This",
"method",
"requires",
"authentication",
"with",
"write",
"permission",
".",
"<br",
">",
"One",
"or",
"both",
"dates",
"can",
"be",
"set",
".",
"If",
"no",
"dates",
"are",
"set",
"nothing",
"will",
"happen",
".",
"<br",
">",
"Taken",
"dates",
"also",
"have",
"a",
"granularity",
"-",
"the",
"accuracy",
"to",
"which",
"we",
"know",
"the",
"date",
"to",
"be",
"true",
".",
"At",
"present",
"the",
"following",
"granularities",
"are",
"used",
":",
"<ul",
">",
"<li",
">",
"0",
"Y",
"-",
"m",
"-",
"d",
"H",
":",
"i",
":",
"s<",
"/",
"li",
">",
"<li",
">",
"4",
"Y",
"-",
"m<",
"/",
"li",
">",
"<li",
">",
"6",
"Y<",
"/",
"li",
">",
"<li",
">",
"8",
"Circa",
"...",
"<",
"/",
"li",
">",
"<",
"/",
"ul",
">"
]
| train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java#L919-L934 |
michael-rapp/AndroidUtil | library/src/main/java/de/mrapp/android/util/AppUtil.java | AppUtil.startDialer | public static void startDialer(@NonNull final Context context,
@NonNull final String phoneNumber) {
"""
Starts the dialer in order to call a specific phone number. The call has to be manually
started by the user. If an error occurs while starting the dialer, an {@link
ActivityNotFoundException} will be thrown.
@param context
The context, the dialer should be started from, as an instance of the class {@link
Context}. The context may not be null
@param phoneNumber
The phone number, which should be dialed, as a {@link String}. The phone number may
neither be null, nor empty
"""
Condition.INSTANCE.ensureNotNull(context, "The context may not be null");
Condition.INSTANCE.ensureNotNull(phoneNumber, "The phone number may not be null");
Condition.INSTANCE.ensureNotEmpty(phoneNumber, "The phone number may not be empty");
Uri uri = Uri.parse(phoneNumber.startsWith("tel:") ? phoneNumber : "tel:" + phoneNumber);
Intent intent = new Intent(Intent.ACTION_DIAL, uri);
if (intent.resolveActivity(context.getPackageManager()) == null) {
throw new ActivityNotFoundException("Dialer app not available");
}
context.startActivity(intent);
} | java | public static void startDialer(@NonNull final Context context,
@NonNull final String phoneNumber) {
Condition.INSTANCE.ensureNotNull(context, "The context may not be null");
Condition.INSTANCE.ensureNotNull(phoneNumber, "The phone number may not be null");
Condition.INSTANCE.ensureNotEmpty(phoneNumber, "The phone number may not be empty");
Uri uri = Uri.parse(phoneNumber.startsWith("tel:") ? phoneNumber : "tel:" + phoneNumber);
Intent intent = new Intent(Intent.ACTION_DIAL, uri);
if (intent.resolveActivity(context.getPackageManager()) == null) {
throw new ActivityNotFoundException("Dialer app not available");
}
context.startActivity(intent);
} | [
"public",
"static",
"void",
"startDialer",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"NonNull",
"final",
"String",
"phoneNumber",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"context",
",",
"\"The context may not be null\"",
")",
";",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"phoneNumber",
",",
"\"The phone number may not be null\"",
")",
";",
"Condition",
".",
"INSTANCE",
".",
"ensureNotEmpty",
"(",
"phoneNumber",
",",
"\"The phone number may not be empty\"",
")",
";",
"Uri",
"uri",
"=",
"Uri",
".",
"parse",
"(",
"phoneNumber",
".",
"startsWith",
"(",
"\"tel:\"",
")",
"?",
"phoneNumber",
":",
"\"tel:\"",
"+",
"phoneNumber",
")",
";",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"Intent",
".",
"ACTION_DIAL",
",",
"uri",
")",
";",
"if",
"(",
"intent",
".",
"resolveActivity",
"(",
"context",
".",
"getPackageManager",
"(",
")",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"ActivityNotFoundException",
"(",
"\"Dialer app not available\"",
")",
";",
"}",
"context",
".",
"startActivity",
"(",
"intent",
")",
";",
"}"
]
| Starts the dialer in order to call a specific phone number. The call has to be manually
started by the user. If an error occurs while starting the dialer, an {@link
ActivityNotFoundException} will be thrown.
@param context
The context, the dialer should be started from, as an instance of the class {@link
Context}. The context may not be null
@param phoneNumber
The phone number, which should be dialed, as a {@link String}. The phone number may
neither be null, nor empty | [
"Starts",
"the",
"dialer",
"in",
"order",
"to",
"call",
"a",
"specific",
"phone",
"number",
".",
"The",
"call",
"has",
"to",
"be",
"manually",
"started",
"by",
"the",
"user",
".",
"If",
"an",
"error",
"occurs",
"while",
"starting",
"the",
"dialer",
"an",
"{",
"@link",
"ActivityNotFoundException",
"}",
"will",
"be",
"thrown",
"."
]
| train | https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/AppUtil.java#L352-L365 |
structurizr/java | structurizr-core/src/com/structurizr/documentation/ViewpointsAndPerspectivesDocumentationTemplate.java | ViewpointsAndPerspectivesDocumentationTemplate.addIntroductionSection | public Section addIntroductionSection(SoftwareSystem softwareSystem, File... files) throws IOException {
"""
Adds a "Introduction" section relating to a {@link SoftwareSystem} from one or more files.
@param softwareSystem the {@link SoftwareSystem} the documentation content relates to
@param files one or more File objects that point to the documentation content
@return a documentation {@link Section}
@throws IOException if there is an error reading the files
"""
return addSection(softwareSystem, "Introduction", files);
} | java | public Section addIntroductionSection(SoftwareSystem softwareSystem, File... files) throws IOException {
return addSection(softwareSystem, "Introduction", files);
} | [
"public",
"Section",
"addIntroductionSection",
"(",
"SoftwareSystem",
"softwareSystem",
",",
"File",
"...",
"files",
")",
"throws",
"IOException",
"{",
"return",
"addSection",
"(",
"softwareSystem",
",",
"\"Introduction\"",
",",
"files",
")",
";",
"}"
]
| Adds a "Introduction" section relating to a {@link SoftwareSystem} from one or more files.
@param softwareSystem the {@link SoftwareSystem} the documentation content relates to
@param files one or more File objects that point to the documentation content
@return a documentation {@link Section}
@throws IOException if there is an error reading the files | [
"Adds",
"a",
"Introduction",
"section",
"relating",
"to",
"a",
"{",
"@link",
"SoftwareSystem",
"}",
"from",
"one",
"or",
"more",
"files",
"."
]
| train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/ViewpointsAndPerspectivesDocumentationTemplate.java#L44-L46 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/GCMMessage.java | GCMMessage.setSubstitutions | public void setSubstitutions(java.util.Map<String, java.util.List<String>> substitutions) {
"""
Default message substitutions. Can be overridden by individual address substitutions.
@param substitutions
Default message substitutions. Can be overridden by individual address substitutions.
"""
this.substitutions = substitutions;
} | java | public void setSubstitutions(java.util.Map<String, java.util.List<String>> substitutions) {
this.substitutions = substitutions;
} | [
"public",
"void",
"setSubstitutions",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
">",
"substitutions",
")",
"{",
"this",
".",
"substitutions",
"=",
"substitutions",
";",
"}"
]
| Default message substitutions. Can be overridden by individual address substitutions.
@param substitutions
Default message substitutions. Can be overridden by individual address substitutions. | [
"Default",
"message",
"substitutions",
".",
"Can",
"be",
"overridden",
"by",
"individual",
"address",
"substitutions",
"."
]
| train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/GCMMessage.java#L775-L777 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/model/MessageCenterInteraction.java | MessageCenterInteraction.getRegularStatus | public MessageCenterStatus getRegularStatus() {
"""
Regular status shows customer's hours, expected time until response
"""
InteractionConfiguration configuration = getConfiguration();
if (configuration == null) {
return null;
}
JSONObject status = configuration.optJSONObject(KEY_STATUS);
if (status == null) {
return null;
}
String statusBody = status.optString(KEY_STATUS_BODY);
if (statusBody == null || statusBody.isEmpty()) {
return null;
}
return new MessageCenterStatus(statusBody, null);
} | java | public MessageCenterStatus getRegularStatus() {
InteractionConfiguration configuration = getConfiguration();
if (configuration == null) {
return null;
}
JSONObject status = configuration.optJSONObject(KEY_STATUS);
if (status == null) {
return null;
}
String statusBody = status.optString(KEY_STATUS_BODY);
if (statusBody == null || statusBody.isEmpty()) {
return null;
}
return new MessageCenterStatus(statusBody, null);
} | [
"public",
"MessageCenterStatus",
"getRegularStatus",
"(",
")",
"{",
"InteractionConfiguration",
"configuration",
"=",
"getConfiguration",
"(",
")",
";",
"if",
"(",
"configuration",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"JSONObject",
"status",
"=",
"configuration",
".",
"optJSONObject",
"(",
"KEY_STATUS",
")",
";",
"if",
"(",
"status",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"statusBody",
"=",
"status",
".",
"optString",
"(",
"KEY_STATUS_BODY",
")",
";",
"if",
"(",
"statusBody",
"==",
"null",
"||",
"statusBody",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"MessageCenterStatus",
"(",
"statusBody",
",",
"null",
")",
";",
"}"
]
| Regular status shows customer's hours, expected time until response | [
"Regular",
"status",
"shows",
"customer",
"s",
"hours",
"expected",
"time",
"until",
"response"
]
| train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/model/MessageCenterInteraction.java#L217-L231 |
googleads/googleads-java-lib | modules/dfp_appengine/src/main/java/com/google/api/ads/admanager/jaxws/utils/v201808/Pql.java | Pql.combineResultSets | public static ResultSet combineResultSets(ResultSet first, ResultSet second) {
"""
Combines the first and second result sets, if and only if, the columns
of both result sets match.
@throws IllegalArgumentException if the columns of the first result set
don't match the second
"""
Function<ColumnType, String> columnTypeToString = new Function<ColumnType, String>() {
public String apply(ColumnType input) {
return input.getLabelName();
}
};
List<String> firstColumns =
Lists.transform(Lists.newArrayList(first.getColumnTypes()), columnTypeToString);
List<String> secondColumns =
Lists.transform(Lists.newArrayList(second.getColumnTypes()), columnTypeToString);
if (!firstColumns.equals(secondColumns)) {
throw new IllegalArgumentException(String.format(
"First result set columns [%s] do not match second columns [%s]",
Joiner.on(",").join(firstColumns), Joiner.on(",").join(secondColumns)));
}
List<Row> combinedRows = Lists.newArrayList(first.getRows());
if (second.getRows() != null) {
combinedRows.addAll(Lists.newArrayList(second.getRows()));
}
ResultSet combinedResultSet = new ResultSet();
combinedResultSet.getColumnTypes().addAll(first.getColumnTypes());
combinedResultSet.getRows().addAll(combinedRows);
return combinedResultSet;
} | java | public static ResultSet combineResultSets(ResultSet first, ResultSet second) {
Function<ColumnType, String> columnTypeToString = new Function<ColumnType, String>() {
public String apply(ColumnType input) {
return input.getLabelName();
}
};
List<String> firstColumns =
Lists.transform(Lists.newArrayList(first.getColumnTypes()), columnTypeToString);
List<String> secondColumns =
Lists.transform(Lists.newArrayList(second.getColumnTypes()), columnTypeToString);
if (!firstColumns.equals(secondColumns)) {
throw new IllegalArgumentException(String.format(
"First result set columns [%s] do not match second columns [%s]",
Joiner.on(",").join(firstColumns), Joiner.on(",").join(secondColumns)));
}
List<Row> combinedRows = Lists.newArrayList(first.getRows());
if (second.getRows() != null) {
combinedRows.addAll(Lists.newArrayList(second.getRows()));
}
ResultSet combinedResultSet = new ResultSet();
combinedResultSet.getColumnTypes().addAll(first.getColumnTypes());
combinedResultSet.getRows().addAll(combinedRows);
return combinedResultSet;
} | [
"public",
"static",
"ResultSet",
"combineResultSets",
"(",
"ResultSet",
"first",
",",
"ResultSet",
"second",
")",
"{",
"Function",
"<",
"ColumnType",
",",
"String",
">",
"columnTypeToString",
"=",
"new",
"Function",
"<",
"ColumnType",
",",
"String",
">",
"(",
")",
"{",
"public",
"String",
"apply",
"(",
"ColumnType",
"input",
")",
"{",
"return",
"input",
".",
"getLabelName",
"(",
")",
";",
"}",
"}",
";",
"List",
"<",
"String",
">",
"firstColumns",
"=",
"Lists",
".",
"transform",
"(",
"Lists",
".",
"newArrayList",
"(",
"first",
".",
"getColumnTypes",
"(",
")",
")",
",",
"columnTypeToString",
")",
";",
"List",
"<",
"String",
">",
"secondColumns",
"=",
"Lists",
".",
"transform",
"(",
"Lists",
".",
"newArrayList",
"(",
"second",
".",
"getColumnTypes",
"(",
")",
")",
",",
"columnTypeToString",
")",
";",
"if",
"(",
"!",
"firstColumns",
".",
"equals",
"(",
"secondColumns",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"First result set columns [%s] do not match second columns [%s]\"",
",",
"Joiner",
".",
"on",
"(",
"\",\"",
")",
".",
"join",
"(",
"firstColumns",
")",
",",
"Joiner",
".",
"on",
"(",
"\",\"",
")",
".",
"join",
"(",
"secondColumns",
")",
")",
")",
";",
"}",
"List",
"<",
"Row",
">",
"combinedRows",
"=",
"Lists",
".",
"newArrayList",
"(",
"first",
".",
"getRows",
"(",
")",
")",
";",
"if",
"(",
"second",
".",
"getRows",
"(",
")",
"!=",
"null",
")",
"{",
"combinedRows",
".",
"addAll",
"(",
"Lists",
".",
"newArrayList",
"(",
"second",
".",
"getRows",
"(",
")",
")",
")",
";",
"}",
"ResultSet",
"combinedResultSet",
"=",
"new",
"ResultSet",
"(",
")",
";",
"combinedResultSet",
".",
"getColumnTypes",
"(",
")",
".",
"addAll",
"(",
"first",
".",
"getColumnTypes",
"(",
")",
")",
";",
"combinedResultSet",
".",
"getRows",
"(",
")",
".",
"addAll",
"(",
"combinedRows",
")",
";",
"return",
"combinedResultSet",
";",
"}"
]
| Combines the first and second result sets, if and only if, the columns
of both result sets match.
@throws IllegalArgumentException if the columns of the first result set
don't match the second | [
"Combines",
"the",
"first",
"and",
"second",
"result",
"sets",
"if",
"and",
"only",
"if",
"the",
"columns",
"of",
"both",
"result",
"sets",
"match",
"."
]
| train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/dfp_appengine/src/main/java/com/google/api/ads/admanager/jaxws/utils/v201808/Pql.java#L452-L476 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.readPropertyObject | public CmsProperty readPropertyObject(String resourcePath, String property, boolean search) throws CmsException {
"""
Reads a property object from a resource specified by a property name.<p>
Returns <code>{@link CmsProperty#getNullProperty()}</code> if the property is not found.<p>
@param resourcePath the name of resource where the property is attached to
@param property the property name
@param search if true, the property is searched on all parent folders of the resource,
if it's not found attached directly to the resource
@return the required property, or <code>{@link CmsProperty#getNullProperty()}</code> if the property was not found
@throws CmsException if something goes wrong
"""
CmsResource resource = readResource(resourcePath, CmsResourceFilter.ALL);
return m_securityManager.readPropertyObject(m_context, resource, property, search);
} | java | public CmsProperty readPropertyObject(String resourcePath, String property, boolean search) throws CmsException {
CmsResource resource = readResource(resourcePath, CmsResourceFilter.ALL);
return m_securityManager.readPropertyObject(m_context, resource, property, search);
} | [
"public",
"CmsProperty",
"readPropertyObject",
"(",
"String",
"resourcePath",
",",
"String",
"property",
",",
"boolean",
"search",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"resource",
"=",
"readResource",
"(",
"resourcePath",
",",
"CmsResourceFilter",
".",
"ALL",
")",
";",
"return",
"m_securityManager",
".",
"readPropertyObject",
"(",
"m_context",
",",
"resource",
",",
"property",
",",
"search",
")",
";",
"}"
]
| Reads a property object from a resource specified by a property name.<p>
Returns <code>{@link CmsProperty#getNullProperty()}</code> if the property is not found.<p>
@param resourcePath the name of resource where the property is attached to
@param property the property name
@param search if true, the property is searched on all parent folders of the resource,
if it's not found attached directly to the resource
@return the required property, or <code>{@link CmsProperty#getNullProperty()}</code> if the property was not found
@throws CmsException if something goes wrong | [
"Reads",
"a",
"property",
"object",
"from",
"a",
"resource",
"specified",
"by",
"a",
"property",
"name",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L2942-L2946 |
aws/aws-cloudtrail-processing-library | src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/utils/LibraryUtils.java | LibraryUtils.setMessageAccountId | public static void setMessageAccountId(Message sqsMessage, String s3ObjectKey) {
"""
Add the account ID attribute to the <code>sqsMessage</code> if it does not exist.
@param sqsMessage The SQS message.
@param s3ObjectKey The S3 object key.
"""
if (!sqsMessage.getAttributes().containsKey(SourceAttributeKeys.ACCOUNT_ID.getAttributeKey())) {
String accountId = extractAccountIdFromObjectKey(s3ObjectKey);
if (accountId != null) {
sqsMessage.addAttributesEntry(SourceAttributeKeys.ACCOUNT_ID.getAttributeKey(), accountId);
}
}
} | java | public static void setMessageAccountId(Message sqsMessage, String s3ObjectKey) {
if (!sqsMessage.getAttributes().containsKey(SourceAttributeKeys.ACCOUNT_ID.getAttributeKey())) {
String accountId = extractAccountIdFromObjectKey(s3ObjectKey);
if (accountId != null) {
sqsMessage.addAttributesEntry(SourceAttributeKeys.ACCOUNT_ID.getAttributeKey(), accountId);
}
}
} | [
"public",
"static",
"void",
"setMessageAccountId",
"(",
"Message",
"sqsMessage",
",",
"String",
"s3ObjectKey",
")",
"{",
"if",
"(",
"!",
"sqsMessage",
".",
"getAttributes",
"(",
")",
".",
"containsKey",
"(",
"SourceAttributeKeys",
".",
"ACCOUNT_ID",
".",
"getAttributeKey",
"(",
")",
")",
")",
"{",
"String",
"accountId",
"=",
"extractAccountIdFromObjectKey",
"(",
"s3ObjectKey",
")",
";",
"if",
"(",
"accountId",
"!=",
"null",
")",
"{",
"sqsMessage",
".",
"addAttributesEntry",
"(",
"SourceAttributeKeys",
".",
"ACCOUNT_ID",
".",
"getAttributeKey",
"(",
")",
",",
"accountId",
")",
";",
"}",
"}",
"}"
]
| Add the account ID attribute to the <code>sqsMessage</code> if it does not exist.
@param sqsMessage The SQS message.
@param s3ObjectKey The S3 object key. | [
"Add",
"the",
"account",
"ID",
"attribute",
"to",
"the",
"<code",
">",
"sqsMessage<",
"/",
"code",
">",
"if",
"it",
"does",
"not",
"exist",
"."
]
| train | https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/utils/LibraryUtils.java#L153-L160 |
jenkinsci/jenkins | core/src/main/java/hudson/model/User.java | User.relatedTo | private boolean relatedTo(@Nonnull AbstractBuild<?, ?> b) {
"""
true if {@link AbstractBuild#hasParticipant} or {@link hudson.model.Cause.UserIdCause}
"""
if (b.hasParticipant(this)) {
return true;
}
for (Cause cause : b.getCauses()) {
if (cause instanceof Cause.UserIdCause) {
String userId = ((Cause.UserIdCause) cause).getUserId();
if (userId != null && idStrategy().equals(userId, getId())) {
return true;
}
}
}
return false;
} | java | private boolean relatedTo(@Nonnull AbstractBuild<?, ?> b) {
if (b.hasParticipant(this)) {
return true;
}
for (Cause cause : b.getCauses()) {
if (cause instanceof Cause.UserIdCause) {
String userId = ((Cause.UserIdCause) cause).getUserId();
if (userId != null && idStrategy().equals(userId, getId())) {
return true;
}
}
}
return false;
} | [
"private",
"boolean",
"relatedTo",
"(",
"@",
"Nonnull",
"AbstractBuild",
"<",
"?",
",",
"?",
">",
"b",
")",
"{",
"if",
"(",
"b",
".",
"hasParticipant",
"(",
"this",
")",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"Cause",
"cause",
":",
"b",
".",
"getCauses",
"(",
")",
")",
"{",
"if",
"(",
"cause",
"instanceof",
"Cause",
".",
"UserIdCause",
")",
"{",
"String",
"userId",
"=",
"(",
"(",
"Cause",
".",
"UserIdCause",
")",
"cause",
")",
".",
"getUserId",
"(",
")",
";",
"if",
"(",
"userId",
"!=",
"null",
"&&",
"idStrategy",
"(",
")",
".",
"equals",
"(",
"userId",
",",
"getId",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
]
| true if {@link AbstractBuild#hasParticipant} or {@link hudson.model.Cause.UserIdCause} | [
"true",
"if",
"{"
]
| train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L668-L681 |
tencentyun/cos-java-sdk | src/main/java/com/qcloud/cos/op/FileOp.java | FileOp.uploadSliceData | private String uploadSliceData(UploadSliceFileRequest request, String sliceContent, String session, long offset)
throws AbstractCosException {
"""
上传分片数据
@param request
分片上传请求
@param sliceContent
分片内容
@param session
session会话值
@param offset
分片偏移量
@return JSON格式的字符串, 格式为{"code":$code, "message":"$mess"}, code为0表示成功,
其他为失败, message为success或者失败原因
@throws AbstractCosException
SDK定义的COS异常, 通常是输入参数有误或者环境问题(如网络不通)
"""
String url = buildUrl(request);
long signExpired = System.currentTimeMillis() / 1000 + this.config.getSignExpired();
String sign = Sign.getPeriodEffectiveSign(request.getBucketName(), request.getCosPath(), this.cred, signExpired);
HttpRequest httpRequest = new HttpRequest();
httpRequest.setUrl(url);
httpRequest.addHeader(RequestHeaderKey.Authorization, sign);
httpRequest.addHeader(RequestHeaderKey.USER_AGENT, this.config.getUserAgent());
httpRequest.addParam(RequestBodyKey.OP, RequestBodyValue.OP.UPLOAD_SLICE);
httpRequest.addParam(RequestBodyKey.FILE_CONTENT, sliceContent);
httpRequest.addParam(RequestBodyKey.SESSION, session);
httpRequest.addParam(RequestBodyKey.OFFSET, String.valueOf(offset));
return httpClient.sendHttpRequest(httpRequest);
} | java | private String uploadSliceData(UploadSliceFileRequest request, String sliceContent, String session, long offset)
throws AbstractCosException {
String url = buildUrl(request);
long signExpired = System.currentTimeMillis() / 1000 + this.config.getSignExpired();
String sign = Sign.getPeriodEffectiveSign(request.getBucketName(), request.getCosPath(), this.cred, signExpired);
HttpRequest httpRequest = new HttpRequest();
httpRequest.setUrl(url);
httpRequest.addHeader(RequestHeaderKey.Authorization, sign);
httpRequest.addHeader(RequestHeaderKey.USER_AGENT, this.config.getUserAgent());
httpRequest.addParam(RequestBodyKey.OP, RequestBodyValue.OP.UPLOAD_SLICE);
httpRequest.addParam(RequestBodyKey.FILE_CONTENT, sliceContent);
httpRequest.addParam(RequestBodyKey.SESSION, session);
httpRequest.addParam(RequestBodyKey.OFFSET, String.valueOf(offset));
return httpClient.sendHttpRequest(httpRequest);
} | [
"private",
"String",
"uploadSliceData",
"(",
"UploadSliceFileRequest",
"request",
",",
"String",
"sliceContent",
",",
"String",
"session",
",",
"long",
"offset",
")",
"throws",
"AbstractCosException",
"{",
"String",
"url",
"=",
"buildUrl",
"(",
"request",
")",
";",
"long",
"signExpired",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"/",
"1000",
"+",
"this",
".",
"config",
".",
"getSignExpired",
"(",
")",
";",
"String",
"sign",
"=",
"Sign",
".",
"getPeriodEffectiveSign",
"(",
"request",
".",
"getBucketName",
"(",
")",
",",
"request",
".",
"getCosPath",
"(",
")",
",",
"this",
".",
"cred",
",",
"signExpired",
")",
";",
"HttpRequest",
"httpRequest",
"=",
"new",
"HttpRequest",
"(",
")",
";",
"httpRequest",
".",
"setUrl",
"(",
"url",
")",
";",
"httpRequest",
".",
"addHeader",
"(",
"RequestHeaderKey",
".",
"Authorization",
",",
"sign",
")",
";",
"httpRequest",
".",
"addHeader",
"(",
"RequestHeaderKey",
".",
"USER_AGENT",
",",
"this",
".",
"config",
".",
"getUserAgent",
"(",
")",
")",
";",
"httpRequest",
".",
"addParam",
"(",
"RequestBodyKey",
".",
"OP",
",",
"RequestBodyValue",
".",
"OP",
".",
"UPLOAD_SLICE",
")",
";",
"httpRequest",
".",
"addParam",
"(",
"RequestBodyKey",
".",
"FILE_CONTENT",
",",
"sliceContent",
")",
";",
"httpRequest",
".",
"addParam",
"(",
"RequestBodyKey",
".",
"SESSION",
",",
"session",
")",
";",
"httpRequest",
".",
"addParam",
"(",
"RequestBodyKey",
".",
"OFFSET",
",",
"String",
".",
"valueOf",
"(",
"offset",
")",
")",
";",
"return",
"httpClient",
".",
"sendHttpRequest",
"(",
"httpRequest",
")",
";",
"}"
]
| 上传分片数据
@param request
分片上传请求
@param sliceContent
分片内容
@param session
session会话值
@param offset
分片偏移量
@return JSON格式的字符串, 格式为{"code":$code, "message":"$mess"}, code为0表示成功,
其他为失败, message为success或者失败原因
@throws AbstractCosException
SDK定义的COS异常, 通常是输入参数有误或者环境问题(如网络不通) | [
"上传分片数据"
]
| train | https://github.com/tencentyun/cos-java-sdk/blob/6709a48f67c1ea7b82a7215f5037d6ccf218b630/src/main/java/com/qcloud/cos/op/FileOp.java#L334-L351 |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/api/validation/ValidationMessageManager.java | ValidationMessageManager.getString | public static String getString(String key, Object... params) {
"""
Applies the message parameters and returns the message
from one of the message bundles.
@param key property key
@param params message parameters to be used in message's place holders
@return Resource value or place-holder error String
"""
String message = getStringSafely(key);
if (params != null && params.length > 0) {
return MessageFormat.format(message, params);
} else {
return message;
}
} | java | public static String getString(String key, Object... params) {
String message = getStringSafely(key);
if (params != null && params.length > 0) {
return MessageFormat.format(message, params);
} else {
return message;
}
} | [
"public",
"static",
"String",
"getString",
"(",
"String",
"key",
",",
"Object",
"...",
"params",
")",
"{",
"String",
"message",
"=",
"getStringSafely",
"(",
"key",
")",
";",
"if",
"(",
"params",
"!=",
"null",
"&&",
"params",
".",
"length",
">",
"0",
")",
"{",
"return",
"MessageFormat",
".",
"format",
"(",
"message",
",",
"params",
")",
";",
"}",
"else",
"{",
"return",
"message",
";",
"}",
"}"
]
| Applies the message parameters and returns the message
from one of the message bundles.
@param key property key
@param params message parameters to be used in message's place holders
@return Resource value or place-holder error String | [
"Applies",
"the",
"message",
"parameters",
"and",
"returns",
"the",
"message",
"from",
"one",
"of",
"the",
"message",
"bundles",
"."
]
| train | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/ValidationMessageManager.java#L57-L64 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java | Symtab.enterClass | public ClassSymbol enterClass(ModuleSymbol msym, Name name, TypeSymbol owner) {
"""
Create a new toplevel or member class symbol with given name
and owner and enter in `classes' unless already there.
"""
Assert.checkNonNull(msym);
Name flatname = TypeSymbol.formFlatName(name, owner);
ClassSymbol c = getClass(msym, flatname);
if (c == null) {
c = defineClass(name, owner);
doEnterClass(msym, c);
} else if ((c.name != name || c.owner != owner) && owner.kind == TYP && c.owner.kind == PCK) {
// reassign fields of classes that might have been loaded with
// their flat names.
c.owner.members().remove(c);
c.name = name;
c.owner = owner;
c.fullname = ClassSymbol.formFullName(name, owner);
}
return c;
} | java | public ClassSymbol enterClass(ModuleSymbol msym, Name name, TypeSymbol owner) {
Assert.checkNonNull(msym);
Name flatname = TypeSymbol.formFlatName(name, owner);
ClassSymbol c = getClass(msym, flatname);
if (c == null) {
c = defineClass(name, owner);
doEnterClass(msym, c);
} else if ((c.name != name || c.owner != owner) && owner.kind == TYP && c.owner.kind == PCK) {
// reassign fields of classes that might have been loaded with
// their flat names.
c.owner.members().remove(c);
c.name = name;
c.owner = owner;
c.fullname = ClassSymbol.formFullName(name, owner);
}
return c;
} | [
"public",
"ClassSymbol",
"enterClass",
"(",
"ModuleSymbol",
"msym",
",",
"Name",
"name",
",",
"TypeSymbol",
"owner",
")",
"{",
"Assert",
".",
"checkNonNull",
"(",
"msym",
")",
";",
"Name",
"flatname",
"=",
"TypeSymbol",
".",
"formFlatName",
"(",
"name",
",",
"owner",
")",
";",
"ClassSymbol",
"c",
"=",
"getClass",
"(",
"msym",
",",
"flatname",
")",
";",
"if",
"(",
"c",
"==",
"null",
")",
"{",
"c",
"=",
"defineClass",
"(",
"name",
",",
"owner",
")",
";",
"doEnterClass",
"(",
"msym",
",",
"c",
")",
";",
"}",
"else",
"if",
"(",
"(",
"c",
".",
"name",
"!=",
"name",
"||",
"c",
".",
"owner",
"!=",
"owner",
")",
"&&",
"owner",
".",
"kind",
"==",
"TYP",
"&&",
"c",
".",
"owner",
".",
"kind",
"==",
"PCK",
")",
"{",
"// reassign fields of classes that might have been loaded with",
"// their flat names.",
"c",
".",
"owner",
".",
"members",
"(",
")",
".",
"remove",
"(",
"c",
")",
";",
"c",
".",
"name",
"=",
"name",
";",
"c",
".",
"owner",
"=",
"owner",
";",
"c",
".",
"fullname",
"=",
"ClassSymbol",
".",
"formFullName",
"(",
"name",
",",
"owner",
")",
";",
"}",
"return",
"c",
";",
"}"
]
| Create a new toplevel or member class symbol with given name
and owner and enter in `classes' unless already there. | [
"Create",
"a",
"new",
"toplevel",
"or",
"member",
"class",
"symbol",
"with",
"given",
"name",
"and",
"owner",
"and",
"enter",
"in",
"classes",
"unless",
"already",
"there",
"."
]
| train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java#L605-L621 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getImploded | @Nonnull
public static <KEYTYPE, VALUETYPE> String getImploded (@Nonnull final String sSepOuter,
@Nonnull final String sSepInner,
@Nullable final Map <KEYTYPE, VALUETYPE> aElements) {
"""
Get a concatenated String from all elements of the passed map, separated by
the specified separator strings.
@param sSepOuter
The separator to use for separating the map entries. May not be
<code>null</code>.
@param sSepInner
The separator to use for separating the key from the value. May not be
<code>null</code>.
@param aElements
The map to convert. May be <code>null</code> or empty.
@return The concatenated string.
@param <KEYTYPE>
Map key type
@param <VALUETYPE>
Map value type
"""
return getImplodedMapped (sSepOuter, sSepInner, aElements, String::valueOf, String::valueOf);
} | java | @Nonnull
public static <KEYTYPE, VALUETYPE> String getImploded (@Nonnull final String sSepOuter,
@Nonnull final String sSepInner,
@Nullable final Map <KEYTYPE, VALUETYPE> aElements)
{
return getImplodedMapped (sSepOuter, sSepInner, aElements, String::valueOf, String::valueOf);
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"KEYTYPE",
",",
"VALUETYPE",
">",
"String",
"getImploded",
"(",
"@",
"Nonnull",
"final",
"String",
"sSepOuter",
",",
"@",
"Nonnull",
"final",
"String",
"sSepInner",
",",
"@",
"Nullable",
"final",
"Map",
"<",
"KEYTYPE",
",",
"VALUETYPE",
">",
"aElements",
")",
"{",
"return",
"getImplodedMapped",
"(",
"sSepOuter",
",",
"sSepInner",
",",
"aElements",
",",
"String",
"::",
"valueOf",
",",
"String",
"::",
"valueOf",
")",
";",
"}"
]
| Get a concatenated String from all elements of the passed map, separated by
the specified separator strings.
@param sSepOuter
The separator to use for separating the map entries. May not be
<code>null</code>.
@param sSepInner
The separator to use for separating the key from the value. May not be
<code>null</code>.
@param aElements
The map to convert. May be <code>null</code> or empty.
@return The concatenated string.
@param <KEYTYPE>
Map key type
@param <VALUETYPE>
Map value type | [
"Get",
"a",
"concatenated",
"String",
"from",
"all",
"elements",
"of",
"the",
"passed",
"map",
"separated",
"by",
"the",
"specified",
"separator",
"strings",
"."
]
| train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L1035-L1041 |
strator-dev/greenpepper | greenpepper-open/confluence3/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java | ConfluenceGreenPepper.getImplementedContent | public String getImplementedContent(Page page) throws GreenPepperServerException {
"""
Retrieves the content of the specification at the implemented version.
@param page
@return the content of the specification at the implemented version.
@throws GreenPepperServerException
"""
Integer version = getImplementedVersion(page);
if(version == null)
throw new GreenPepperServerException(NEVER_IMPLEMENTED, "Never Implemented");
return getPageManager().getPageByVersion(page, version).getContent();
} | java | public String getImplementedContent(Page page) throws GreenPepperServerException
{
Integer version = getImplementedVersion(page);
if(version == null)
throw new GreenPepperServerException(NEVER_IMPLEMENTED, "Never Implemented");
return getPageManager().getPageByVersion(page, version).getContent();
} | [
"public",
"String",
"getImplementedContent",
"(",
"Page",
"page",
")",
"throws",
"GreenPepperServerException",
"{",
"Integer",
"version",
"=",
"getImplementedVersion",
"(",
"page",
")",
";",
"if",
"(",
"version",
"==",
"null",
")",
"throw",
"new",
"GreenPepperServerException",
"(",
"NEVER_IMPLEMENTED",
",",
"\"Never Implemented\"",
")",
";",
"return",
"getPageManager",
"(",
")",
".",
"getPageByVersion",
"(",
"page",
",",
"version",
")",
".",
"getContent",
"(",
")",
";",
"}"
]
| Retrieves the content of the specification at the implemented version.
@param page
@return the content of the specification at the implemented version.
@throws GreenPepperServerException | [
"Retrieves",
"the",
"content",
"of",
"the",
"specification",
"at",
"the",
"implemented",
"version",
"."
]
| train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence3/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L565-L572 |
Red5/red5-server-common | src/main/java/org/red5/server/stream/StreamService.java | StreamService.closeStream | public void closeStream(IConnection conn, Number streamId) {
"""
Close stream. This method can close both IClientBroadcastStream (coming from Flash Player to Red5) and ISubscriberStream (from Red5
to Flash Player). Corresponding application handlers (streamSubscriberClose, etc.) are called as if close was initiated by Flash
Player.
It is recommended to remember stream id in application handlers, ex.:
<pre>
public void streamBroadcastStart(IBroadcastStream stream) {
super.streamBroadcastStart(stream);
if (stream instanceof IClientBroadcastStream) {
int publishedStreamId = ((ClientBroadcastStream) stream).getStreamId();
Red5.getConnectionLocal().setAttribute(PUBLISHED_STREAM_ID_ATTRIBUTE, publishedStreamId);
}
}
</pre>
<pre>
public void streamPlaylistItemPlay(IPlaylistSubscriberStream stream, IPlayItem item, boolean isLive) {
super.streamPlaylistItemPlay(stream, item, isLive);
Red5.getConnectionLocal().setAttribute(WATCHED_STREAM_ID_ATTRIBUTE, stream.getStreamId());
}
</pre>
When stream is closed, corresponding NetStream status will be sent to stream provider / consumers. Implementation is based on Red5's
StreamService.close()
@param conn
client connection
@param streamId
stream ID (number: 1,2,...)
"""
log.info("closeStream stream id: {} connection: {}", streamId, conn.getSessionId());
if (conn instanceof IStreamCapableConnection) {
IStreamCapableConnection scConn = (IStreamCapableConnection) conn;
IClientStream stream = scConn.getStreamById(streamId);
if (stream != null) {
if (stream instanceof IClientBroadcastStream) {
// this is a broadcasting stream (from Flash Player to Red5)
IClientBroadcastStream bs = (IClientBroadcastStream) stream;
IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
if (bsScope != null && conn instanceof BaseConnection) {
((BaseConnection) conn).unregisterBasicScope(bsScope);
}
}
stream.close();
scConn.deleteStreamById(streamId);
// in case of broadcasting stream, status is sent automatically by Red5
if (!(stream instanceof IClientBroadcastStream)) {
StreamService.sendNetStreamStatus(conn, StatusCodes.NS_PLAY_STOP, "Stream closed by server", stream.getName(), Status.STATUS, streamId);
}
} else {
log.info("Stream not found - streamId: {} connection: {}", streamId, conn.getSessionId());
}
} else {
log.warn("Connection is not instance of IStreamCapableConnection: {}", conn);
}
} | java | public void closeStream(IConnection conn, Number streamId) {
log.info("closeStream stream id: {} connection: {}", streamId, conn.getSessionId());
if (conn instanceof IStreamCapableConnection) {
IStreamCapableConnection scConn = (IStreamCapableConnection) conn;
IClientStream stream = scConn.getStreamById(streamId);
if (stream != null) {
if (stream instanceof IClientBroadcastStream) {
// this is a broadcasting stream (from Flash Player to Red5)
IClientBroadcastStream bs = (IClientBroadcastStream) stream;
IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
if (bsScope != null && conn instanceof BaseConnection) {
((BaseConnection) conn).unregisterBasicScope(bsScope);
}
}
stream.close();
scConn.deleteStreamById(streamId);
// in case of broadcasting stream, status is sent automatically by Red5
if (!(stream instanceof IClientBroadcastStream)) {
StreamService.sendNetStreamStatus(conn, StatusCodes.NS_PLAY_STOP, "Stream closed by server", stream.getName(), Status.STATUS, streamId);
}
} else {
log.info("Stream not found - streamId: {} connection: {}", streamId, conn.getSessionId());
}
} else {
log.warn("Connection is not instance of IStreamCapableConnection: {}", conn);
}
} | [
"public",
"void",
"closeStream",
"(",
"IConnection",
"conn",
",",
"Number",
"streamId",
")",
"{",
"log",
".",
"info",
"(",
"\"closeStream stream id: {} connection: {}\"",
",",
"streamId",
",",
"conn",
".",
"getSessionId",
"(",
")",
")",
";",
"if",
"(",
"conn",
"instanceof",
"IStreamCapableConnection",
")",
"{",
"IStreamCapableConnection",
"scConn",
"=",
"(",
"IStreamCapableConnection",
")",
"conn",
";",
"IClientStream",
"stream",
"=",
"scConn",
".",
"getStreamById",
"(",
"streamId",
")",
";",
"if",
"(",
"stream",
"!=",
"null",
")",
"{",
"if",
"(",
"stream",
"instanceof",
"IClientBroadcastStream",
")",
"{",
"// this is a broadcasting stream (from Flash Player to Red5)\r",
"IClientBroadcastStream",
"bs",
"=",
"(",
"IClientBroadcastStream",
")",
"stream",
";",
"IBroadcastScope",
"bsScope",
"=",
"getBroadcastScope",
"(",
"conn",
".",
"getScope",
"(",
")",
",",
"bs",
".",
"getPublishedName",
"(",
")",
")",
";",
"if",
"(",
"bsScope",
"!=",
"null",
"&&",
"conn",
"instanceof",
"BaseConnection",
")",
"{",
"(",
"(",
"BaseConnection",
")",
"conn",
")",
".",
"unregisterBasicScope",
"(",
"bsScope",
")",
";",
"}",
"}",
"stream",
".",
"close",
"(",
")",
";",
"scConn",
".",
"deleteStreamById",
"(",
"streamId",
")",
";",
"// in case of broadcasting stream, status is sent automatically by Red5\r",
"if",
"(",
"!",
"(",
"stream",
"instanceof",
"IClientBroadcastStream",
")",
")",
"{",
"StreamService",
".",
"sendNetStreamStatus",
"(",
"conn",
",",
"StatusCodes",
".",
"NS_PLAY_STOP",
",",
"\"Stream closed by server\"",
",",
"stream",
".",
"getName",
"(",
")",
",",
"Status",
".",
"STATUS",
",",
"streamId",
")",
";",
"}",
"}",
"else",
"{",
"log",
".",
"info",
"(",
"\"Stream not found - streamId: {} connection: {}\"",
",",
"streamId",
",",
"conn",
".",
"getSessionId",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"log",
".",
"warn",
"(",
"\"Connection is not instance of IStreamCapableConnection: {}\"",
",",
"conn",
")",
";",
"}",
"}"
]
| Close stream. This method can close both IClientBroadcastStream (coming from Flash Player to Red5) and ISubscriberStream (from Red5
to Flash Player). Corresponding application handlers (streamSubscriberClose, etc.) are called as if close was initiated by Flash
Player.
It is recommended to remember stream id in application handlers, ex.:
<pre>
public void streamBroadcastStart(IBroadcastStream stream) {
super.streamBroadcastStart(stream);
if (stream instanceof IClientBroadcastStream) {
int publishedStreamId = ((ClientBroadcastStream) stream).getStreamId();
Red5.getConnectionLocal().setAttribute(PUBLISHED_STREAM_ID_ATTRIBUTE, publishedStreamId);
}
}
</pre>
<pre>
public void streamPlaylistItemPlay(IPlaylistSubscriberStream stream, IPlayItem item, boolean isLive) {
super.streamPlaylistItemPlay(stream, item, isLive);
Red5.getConnectionLocal().setAttribute(WATCHED_STREAM_ID_ATTRIBUTE, stream.getStreamId());
}
</pre>
When stream is closed, corresponding NetStream status will be sent to stream provider / consumers. Implementation is based on Red5's
StreamService.close()
@param conn
client connection
@param streamId
stream ID (number: 1,2,...) | [
"Close",
"stream",
".",
"This",
"method",
"can",
"close",
"both",
"IClientBroadcastStream",
"(",
"coming",
"from",
"Flash",
"Player",
"to",
"Red5",
")",
"and",
"ISubscriberStream",
"(",
"from",
"Red5",
"to",
"Flash",
"Player",
")",
".",
"Corresponding",
"application",
"handlers",
"(",
"streamSubscriberClose",
"etc",
".",
")",
"are",
"called",
"as",
"if",
"close",
"was",
"initiated",
"by",
"Flash",
"Player",
"."
]
| train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/StreamService.java#L183-L209 |
cdk/cdk | tool/sdg/src/main/java/org/openscience/cdk/layout/HydrogenPlacer.java | HydrogenPlacer.placeHydrogens2D | public void placeHydrogens2D(IAtomContainer container, IAtom atom) {
"""
Place hydrogens connected to the given atom using the average bond length
in the container.
@param container atom container of which <i>atom</i> is a member
@param atom the atom of which to place connected hydrogens
@throws IllegalArgumentException if the <i>atom</i> does not have 2d
coordinates
@see #placeHydrogens2D(org.openscience.cdk.interfaces.IAtomContainer,
double)
"""
double bondLength = GeometryUtil.getBondLengthAverage(container);
placeHydrogens2D(container, atom, bondLength);
} | java | public void placeHydrogens2D(IAtomContainer container, IAtom atom) {
double bondLength = GeometryUtil.getBondLengthAverage(container);
placeHydrogens2D(container, atom, bondLength);
} | [
"public",
"void",
"placeHydrogens2D",
"(",
"IAtomContainer",
"container",
",",
"IAtom",
"atom",
")",
"{",
"double",
"bondLength",
"=",
"GeometryUtil",
".",
"getBondLengthAverage",
"(",
"container",
")",
";",
"placeHydrogens2D",
"(",
"container",
",",
"atom",
",",
"bondLength",
")",
";",
"}"
]
| Place hydrogens connected to the given atom using the average bond length
in the container.
@param container atom container of which <i>atom</i> is a member
@param atom the atom of which to place connected hydrogens
@throws IllegalArgumentException if the <i>atom</i> does not have 2d
coordinates
@see #placeHydrogens2D(org.openscience.cdk.interfaces.IAtomContainer,
double) | [
"Place",
"hydrogens",
"connected",
"to",
"the",
"given",
"atom",
"using",
"the",
"average",
"bond",
"length",
"in",
"the",
"container",
"."
]
| train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/HydrogenPlacer.java#L84-L87 |
code4everything/util | src/main/java/com/zhazhapan/util/dialog/Dialogs.java | Dialogs.getDialog | public static Dialog<String[]> getDialog(String title, ButtonType ok) {
"""
获得一个{@link Dialog}对象
@param title 标题
@param ok 确认按钮
@return {@link Dialog}
"""
Dialog<String[]> dialog = new Dialog<>();
dialog.setTitle(title);
dialog.setHeaderText(null);
dialog.initModality(Modality.APPLICATION_MODAL);
// 自定义确认和取消按钮
ButtonType cancel = new ButtonType(CANCEL_BUTTON_TEXT, ButtonData.CANCEL_CLOSE);
dialog.getDialogPane().getButtonTypes().addAll(ok, cancel);
return dialog;
} | java | public static Dialog<String[]> getDialog(String title, ButtonType ok) {
Dialog<String[]> dialog = new Dialog<>();
dialog.setTitle(title);
dialog.setHeaderText(null);
dialog.initModality(Modality.APPLICATION_MODAL);
// 自定义确认和取消按钮
ButtonType cancel = new ButtonType(CANCEL_BUTTON_TEXT, ButtonData.CANCEL_CLOSE);
dialog.getDialogPane().getButtonTypes().addAll(ok, cancel);
return dialog;
} | [
"public",
"static",
"Dialog",
"<",
"String",
"[",
"]",
">",
"getDialog",
"(",
"String",
"title",
",",
"ButtonType",
"ok",
")",
"{",
"Dialog",
"<",
"String",
"[",
"]",
">",
"dialog",
"=",
"new",
"Dialog",
"<>",
"(",
")",
";",
"dialog",
".",
"setTitle",
"(",
"title",
")",
";",
"dialog",
".",
"setHeaderText",
"(",
"null",
")",
";",
"dialog",
".",
"initModality",
"(",
"Modality",
".",
"APPLICATION_MODAL",
")",
";",
"// 自定义确认和取消按钮",
"ButtonType",
"cancel",
"=",
"new",
"ButtonType",
"(",
"CANCEL_BUTTON_TEXT",
",",
"ButtonData",
".",
"CANCEL_CLOSE",
")",
";",
"dialog",
".",
"getDialogPane",
"(",
")",
".",
"getButtonTypes",
"(",
")",
".",
"addAll",
"(",
"ok",
",",
"cancel",
")",
";",
"return",
"dialog",
";",
"}"
]
| 获得一个{@link Dialog}对象
@param title 标题
@param ok 确认按钮
@return {@link Dialog} | [
"获得一个",
"{",
"@link",
"Dialog",
"}",
"对象"
]
| train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/dialog/Dialogs.java#L63-L74 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/deps/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheEncoder.java | AbstractBinaryMemcacheEncoder.encodeKey | private static void encodeKey(ByteBuf buf, byte[] key) {
"""
Encode the key.
@param buf the {@link ByteBuf} to write into.
@param key the key to encode.
"""
if (key == null || key.length == 0) {
return;
}
buf.writeBytes(key);
} | java | private static void encodeKey(ByteBuf buf, byte[] key) {
if (key == null || key.length == 0) {
return;
}
buf.writeBytes(key);
} | [
"private",
"static",
"void",
"encodeKey",
"(",
"ByteBuf",
"buf",
",",
"byte",
"[",
"]",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
"||",
"key",
".",
"length",
"==",
"0",
")",
"{",
"return",
";",
"}",
"buf",
".",
"writeBytes",
"(",
"key",
")",
";",
"}"
]
| Encode the key.
@param buf the {@link ByteBuf} to write into.
@param key the key to encode. | [
"Encode",
"the",
"key",
"."
]
| train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/deps/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheEncoder.java#L65-L71 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.bucketSort | public static <T> void bucketSort(final List<? extends T> c, final Comparator<? super T> cmp) {
"""
Note: All the objects with same value will be replaced with first element with the same value.
@param c
@param cmp
"""
Array.bucketSort(c, cmp);
} | java | public static <T> void bucketSort(final List<? extends T> c, final Comparator<? super T> cmp) {
Array.bucketSort(c, cmp);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"bucketSort",
"(",
"final",
"List",
"<",
"?",
"extends",
"T",
">",
"c",
",",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"cmp",
")",
"{",
"Array",
".",
"bucketSort",
"(",
"c",
",",
"cmp",
")",
";",
"}"
]
| Note: All the objects with same value will be replaced with first element with the same value.
@param c
@param cmp | [
"Note",
":",
"All",
"the",
"objects",
"with",
"same",
"value",
"will",
"be",
"replaced",
"with",
"first",
"element",
"with",
"the",
"same",
"value",
"."
]
| train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L12054-L12056 |
apache/incubator-heron | heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java | SchedulerStateManagerAdaptor.getPhysicalPlan | public PhysicalPlans.PhysicalPlan getPhysicalPlan(String topologyName) {
"""
Get the physical plan for the given topology
@return PhysicalPlans.PhysicalPlan
"""
return awaitResult(delegate.getPhysicalPlan(null, topologyName));
} | java | public PhysicalPlans.PhysicalPlan getPhysicalPlan(String topologyName) {
return awaitResult(delegate.getPhysicalPlan(null, topologyName));
} | [
"public",
"PhysicalPlans",
".",
"PhysicalPlan",
"getPhysicalPlan",
"(",
"String",
"topologyName",
")",
"{",
"return",
"awaitResult",
"(",
"delegate",
".",
"getPhysicalPlan",
"(",
"null",
",",
"topologyName",
")",
")",
";",
"}"
]
| Get the physical plan for the given topology
@return PhysicalPlans.PhysicalPlan | [
"Get",
"the",
"physical",
"plan",
"for",
"the",
"given",
"topology"
]
| train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java#L293-L295 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java | DefaultFaceletFactory.resolveURL | public URL resolveURL(FacesContext context, URL source, String path) throws IOException {
"""
Resolves a path based on the passed URL. If the path starts with '/', then resolve the path against
{@link javax.faces.context.ExternalContext#getResource(java.lang.String)
javax.faces.context.ExternalContext#getResource(java.lang.String)}. Otherwise create a new URL via
{@link URL#URL(java.net.URL, java.lang.String) URL(URL, String)}.
@param source
base to resolve from
@param path
relative path to the source
@return resolved URL
@throws IOException
"""
if (path.startsWith("/"))
{
context.getAttributes().put(LAST_RESOURCE_RESOLVED, null);
URL url = resolveURL(context, path);
if (url == null)
{
throw new FileNotFoundException(path + " Not Found in ExternalContext as a Resource");
}
return url;
}
else
{
return new URL(source, path);
}
} | java | public URL resolveURL(FacesContext context, URL source, String path) throws IOException
{
if (path.startsWith("/"))
{
context.getAttributes().put(LAST_RESOURCE_RESOLVED, null);
URL url = resolveURL(context, path);
if (url == null)
{
throw new FileNotFoundException(path + " Not Found in ExternalContext as a Resource");
}
return url;
}
else
{
return new URL(source, path);
}
} | [
"public",
"URL",
"resolveURL",
"(",
"FacesContext",
"context",
",",
"URL",
"source",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"if",
"(",
"path",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"context",
".",
"getAttributes",
"(",
")",
".",
"put",
"(",
"LAST_RESOURCE_RESOLVED",
",",
"null",
")",
";",
"URL",
"url",
"=",
"resolveURL",
"(",
"context",
",",
"path",
")",
";",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"path",
"+",
"\" Not Found in ExternalContext as a Resource\"",
")",
";",
"}",
"return",
"url",
";",
"}",
"else",
"{",
"return",
"new",
"URL",
"(",
"source",
",",
"path",
")",
";",
"}",
"}"
]
| Resolves a path based on the passed URL. If the path starts with '/', then resolve the path against
{@link javax.faces.context.ExternalContext#getResource(java.lang.String)
javax.faces.context.ExternalContext#getResource(java.lang.String)}. Otherwise create a new URL via
{@link URL#URL(java.net.URL, java.lang.String) URL(URL, String)}.
@param source
base to resolve from
@param path
relative path to the source
@return resolved URL
@throws IOException | [
"Resolves",
"a",
"path",
"based",
"on",
"the",
"passed",
"URL",
".",
"If",
"the",
"path",
"starts",
"with",
"/",
"then",
"resolve",
"the",
"path",
"against",
"{",
"@link",
"javax",
".",
"faces",
".",
"context",
".",
"ExternalContext#getResource",
"(",
"java",
".",
"lang",
".",
"String",
")",
"javax",
".",
"faces",
".",
"context",
".",
"ExternalContext#getResource",
"(",
"java",
".",
"lang",
".",
"String",
")",
"}",
".",
"Otherwise",
"create",
"a",
"new",
"URL",
"via",
"{",
"@link",
"URL#URL",
"(",
"java",
".",
"net",
".",
"URL",
"java",
".",
"lang",
".",
"String",
")",
"URL",
"(",
"URL",
"String",
")",
"}",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java#L300-L316 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/certificatevalidation/pathvalidation/CertificatePathValidator.java | CertificatePathValidator.validatePath | public void validatePath() throws CertificateVerificationException {
"""
Certificate Path Validation process
@throws CertificateVerificationException if validation process fails.
"""
Security.addProvider(new BouncyCastleProvider());
CollectionCertStoreParameters params = new CollectionCertStoreParameters(fullCertChain);
try {
CertStore store = CertStore.getInstance("Collection", params, Constants.BOUNCY_CASTLE_PROVIDER);
// create certificate path
CertificateFactory fact = CertificateFactory
.getInstance(Constants.X_509, Constants.BOUNCY_CASTLE_PROVIDER);
CertPath certPath = fact.generateCertPath(certChain);
TrustAnchor trustAnchor = new TrustAnchor(fullCertChain.get(fullCertChain.size() - 1), null);
Set<TrustAnchor> trust = Collections.singleton(trustAnchor);
// perform validation
CertPathValidator validator = CertPathValidator
.getInstance(Constants.ALGORITHM, Constants.BOUNCY_CASTLE_PROVIDER);
PKIXParameters param = new PKIXParameters(trust);
param.addCertPathChecker(pathChecker);
param.setRevocationEnabled(false);
param.addCertStore(store);
param.setDate(new Date());
validator.validate(certPath, param);
if (LOG.isInfoEnabled()) {
LOG.info("Certificate path validated");
}
} catch (CertPathValidatorException e) {
throw new CertificateVerificationException(
"Certificate path validation failed on certificate number " + e.getIndex() + ", details: " + e
.getMessage(), e);
} catch (Exception e) {
throw new CertificateVerificationException("Certificate path validation failed", e);
}
} | java | public void validatePath() throws CertificateVerificationException {
Security.addProvider(new BouncyCastleProvider());
CollectionCertStoreParameters params = new CollectionCertStoreParameters(fullCertChain);
try {
CertStore store = CertStore.getInstance("Collection", params, Constants.BOUNCY_CASTLE_PROVIDER);
// create certificate path
CertificateFactory fact = CertificateFactory
.getInstance(Constants.X_509, Constants.BOUNCY_CASTLE_PROVIDER);
CertPath certPath = fact.generateCertPath(certChain);
TrustAnchor trustAnchor = new TrustAnchor(fullCertChain.get(fullCertChain.size() - 1), null);
Set<TrustAnchor> trust = Collections.singleton(trustAnchor);
// perform validation
CertPathValidator validator = CertPathValidator
.getInstance(Constants.ALGORITHM, Constants.BOUNCY_CASTLE_PROVIDER);
PKIXParameters param = new PKIXParameters(trust);
param.addCertPathChecker(pathChecker);
param.setRevocationEnabled(false);
param.addCertStore(store);
param.setDate(new Date());
validator.validate(certPath, param);
if (LOG.isInfoEnabled()) {
LOG.info("Certificate path validated");
}
} catch (CertPathValidatorException e) {
throw new CertificateVerificationException(
"Certificate path validation failed on certificate number " + e.getIndex() + ", details: " + e
.getMessage(), e);
} catch (Exception e) {
throw new CertificateVerificationException("Certificate path validation failed", e);
}
} | [
"public",
"void",
"validatePath",
"(",
")",
"throws",
"CertificateVerificationException",
"{",
"Security",
".",
"addProvider",
"(",
"new",
"BouncyCastleProvider",
"(",
")",
")",
";",
"CollectionCertStoreParameters",
"params",
"=",
"new",
"CollectionCertStoreParameters",
"(",
"fullCertChain",
")",
";",
"try",
"{",
"CertStore",
"store",
"=",
"CertStore",
".",
"getInstance",
"(",
"\"Collection\"",
",",
"params",
",",
"Constants",
".",
"BOUNCY_CASTLE_PROVIDER",
")",
";",
"// create certificate path\r",
"CertificateFactory",
"fact",
"=",
"CertificateFactory",
".",
"getInstance",
"(",
"Constants",
".",
"X_509",
",",
"Constants",
".",
"BOUNCY_CASTLE_PROVIDER",
")",
";",
"CertPath",
"certPath",
"=",
"fact",
".",
"generateCertPath",
"(",
"certChain",
")",
";",
"TrustAnchor",
"trustAnchor",
"=",
"new",
"TrustAnchor",
"(",
"fullCertChain",
".",
"get",
"(",
"fullCertChain",
".",
"size",
"(",
")",
"-",
"1",
")",
",",
"null",
")",
";",
"Set",
"<",
"TrustAnchor",
">",
"trust",
"=",
"Collections",
".",
"singleton",
"(",
"trustAnchor",
")",
";",
"// perform validation\r",
"CertPathValidator",
"validator",
"=",
"CertPathValidator",
".",
"getInstance",
"(",
"Constants",
".",
"ALGORITHM",
",",
"Constants",
".",
"BOUNCY_CASTLE_PROVIDER",
")",
";",
"PKIXParameters",
"param",
"=",
"new",
"PKIXParameters",
"(",
"trust",
")",
";",
"param",
".",
"addCertPathChecker",
"(",
"pathChecker",
")",
";",
"param",
".",
"setRevocationEnabled",
"(",
"false",
")",
";",
"param",
".",
"addCertStore",
"(",
"store",
")",
";",
"param",
".",
"setDate",
"(",
"new",
"Date",
"(",
")",
")",
";",
"validator",
".",
"validate",
"(",
"certPath",
",",
"param",
")",
";",
"if",
"(",
"LOG",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Certificate path validated\"",
")",
";",
"}",
"}",
"catch",
"(",
"CertPathValidatorException",
"e",
")",
"{",
"throw",
"new",
"CertificateVerificationException",
"(",
"\"Certificate path validation failed on certificate number \"",
"+",
"e",
".",
"getIndex",
"(",
")",
"+",
"\", details: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"CertificateVerificationException",
"(",
"\"Certificate path validation failed\"",
",",
"e",
")",
";",
"}",
"}"
]
| Certificate Path Validation process
@throws CertificateVerificationException if validation process fails. | [
"Certificate",
"Path",
"Validation",
"process"
]
| train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/certificatevalidation/pathvalidation/CertificatePathValidator.java#L81-L117 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.numberAwareCompareTo | public static int numberAwareCompareTo(Comparable self, Comparable other) {
"""
Provides a method that compares two comparables using Groovy's
default number aware comparator.
@param self a Comparable
@param other another Comparable
@return a -ve number, 0 or a +ve number according to Groovy's compareTo contract
@since 1.6.0
"""
NumberAwareComparator<Comparable> numberAwareComparator = new NumberAwareComparator<Comparable>();
return numberAwareComparator.compare(self, other);
} | java | public static int numberAwareCompareTo(Comparable self, Comparable other) {
NumberAwareComparator<Comparable> numberAwareComparator = new NumberAwareComparator<Comparable>();
return numberAwareComparator.compare(self, other);
} | [
"public",
"static",
"int",
"numberAwareCompareTo",
"(",
"Comparable",
"self",
",",
"Comparable",
"other",
")",
"{",
"NumberAwareComparator",
"<",
"Comparable",
">",
"numberAwareComparator",
"=",
"new",
"NumberAwareComparator",
"<",
"Comparable",
">",
"(",
")",
";",
"return",
"numberAwareComparator",
".",
"compare",
"(",
"self",
",",
"other",
")",
";",
"}"
]
| Provides a method that compares two comparables using Groovy's
default number aware comparator.
@param self a Comparable
@param other another Comparable
@return a -ve number, 0 or a +ve number according to Groovy's compareTo contract
@since 1.6.0 | [
"Provides",
"a",
"method",
"that",
"compares",
"two",
"comparables",
"using",
"Groovy",
"s",
"default",
"number",
"aware",
"comparator",
"."
]
| train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L1117-L1120 |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/config/liberty/CDI12ContainerConfig.java | CDI12ContainerConfig.modified | @Modified
protected void modified(ComponentContext compcontext, Map<String, Object> properties) {
"""
DS method to modify the configuration of this component
@param compcontext the context of this component
@param properties the updated configuration properties
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Modifying " + this);
}
this.updateConfiguration(properties);
} | java | @Modified
protected void modified(ComponentContext compcontext, Map<String, Object> properties) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Modifying " + this);
}
this.updateConfiguration(properties);
} | [
"@",
"Modified",
"protected",
"void",
"modified",
"(",
"ComponentContext",
"compcontext",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Modifying \"",
"+",
"this",
")",
";",
"}",
"this",
".",
"updateConfiguration",
"(",
"properties",
")",
";",
"}"
]
| DS method to modify the configuration of this component
@param compcontext the context of this component
@param properties the updated configuration properties | [
"DS",
"method",
"to",
"modify",
"the",
"configuration",
"of",
"this",
"component"
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/config/liberty/CDI12ContainerConfig.java#L113-L119 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.getReferencedPropertiesData | protected List<PropertyData> getReferencedPropertiesData(final String identifier) throws RepositoryException {
"""
Get referenced properties data.
@param identifier
referenceable identifier
@return List of PropertyData
@throws RepositoryException
Repository error
"""
List<PropertyData> refProps = null;
if (cache.isEnabled())
{
refProps = cache.getReferencedProperties(identifier);
if (refProps != null)
{
return refProps;
}
}
final DataRequest request = new DataRequest(identifier, DataRequest.GET_REFERENCES);
try
{
request.start();
if (cache.isEnabled())
{
// Try first to get the value from the cache since a
// request could have been launched just before
refProps = cache.getReferencedProperties(identifier);
if (refProps != null)
{
return refProps;
}
}
return executeAction(new PrivilegedExceptionAction<List<PropertyData>>()
{
public List<PropertyData> run() throws RepositoryException
{
List<PropertyData> refProps = CacheableWorkspaceDataManager.super.getReferencesData(identifier, false);
if (cache.isEnabled())
{
cache.addReferencedProperties(identifier, refProps);
}
return refProps;
}
});
}
finally
{
request.done();
}
} | java | protected List<PropertyData> getReferencedPropertiesData(final String identifier) throws RepositoryException
{
List<PropertyData> refProps = null;
if (cache.isEnabled())
{
refProps = cache.getReferencedProperties(identifier);
if (refProps != null)
{
return refProps;
}
}
final DataRequest request = new DataRequest(identifier, DataRequest.GET_REFERENCES);
try
{
request.start();
if (cache.isEnabled())
{
// Try first to get the value from the cache since a
// request could have been launched just before
refProps = cache.getReferencedProperties(identifier);
if (refProps != null)
{
return refProps;
}
}
return executeAction(new PrivilegedExceptionAction<List<PropertyData>>()
{
public List<PropertyData> run() throws RepositoryException
{
List<PropertyData> refProps = CacheableWorkspaceDataManager.super.getReferencesData(identifier, false);
if (cache.isEnabled())
{
cache.addReferencedProperties(identifier, refProps);
}
return refProps;
}
});
}
finally
{
request.done();
}
} | [
"protected",
"List",
"<",
"PropertyData",
">",
"getReferencedPropertiesData",
"(",
"final",
"String",
"identifier",
")",
"throws",
"RepositoryException",
"{",
"List",
"<",
"PropertyData",
">",
"refProps",
"=",
"null",
";",
"if",
"(",
"cache",
".",
"isEnabled",
"(",
")",
")",
"{",
"refProps",
"=",
"cache",
".",
"getReferencedProperties",
"(",
"identifier",
")",
";",
"if",
"(",
"refProps",
"!=",
"null",
")",
"{",
"return",
"refProps",
";",
"}",
"}",
"final",
"DataRequest",
"request",
"=",
"new",
"DataRequest",
"(",
"identifier",
",",
"DataRequest",
".",
"GET_REFERENCES",
")",
";",
"try",
"{",
"request",
".",
"start",
"(",
")",
";",
"if",
"(",
"cache",
".",
"isEnabled",
"(",
")",
")",
"{",
"// Try first to get the value from the cache since a",
"// request could have been launched just before",
"refProps",
"=",
"cache",
".",
"getReferencedProperties",
"(",
"identifier",
")",
";",
"if",
"(",
"refProps",
"!=",
"null",
")",
"{",
"return",
"refProps",
";",
"}",
"}",
"return",
"executeAction",
"(",
"new",
"PrivilegedExceptionAction",
"<",
"List",
"<",
"PropertyData",
">",
">",
"(",
")",
"{",
"public",
"List",
"<",
"PropertyData",
">",
"run",
"(",
")",
"throws",
"RepositoryException",
"{",
"List",
"<",
"PropertyData",
">",
"refProps",
"=",
"CacheableWorkspaceDataManager",
".",
"super",
".",
"getReferencesData",
"(",
"identifier",
",",
"false",
")",
";",
"if",
"(",
"cache",
".",
"isEnabled",
"(",
")",
")",
"{",
"cache",
".",
"addReferencedProperties",
"(",
"identifier",
",",
"refProps",
")",
";",
"}",
"return",
"refProps",
";",
"}",
"}",
")",
";",
"}",
"finally",
"{",
"request",
".",
"done",
"(",
")",
";",
"}",
"}"
]
| Get referenced properties data.
@param identifier
referenceable identifier
@return List of PropertyData
@throws RepositoryException
Repository error | [
"Get",
"referenced",
"properties",
"data",
"."
]
| train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L1626-L1669 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java | ImageLoading.loadBitmapReuseExact | private static ReuseResult loadBitmapReuseExact(ImageSource source, Bitmap dest) throws ImageLoadException {
"""
Loading image with reuse bitmap of same size as source
@param source image source
@param dest destination bitmap
@return loaded bitmap result
@throws ImageLoadException if it is unable to load image
"""
ImageMetadata metadata = source.getImageMetadata();
boolean tryReuse = false;
if (dest.isMutable()
&& dest.getWidth() == metadata.getW()
&& dest.getHeight() == metadata.getH()) {
if (Build.VERSION.SDK_INT >= 19) {
tryReuse = true;
} else if (Build.VERSION.SDK_INT >= 11) {
if (metadata.getFormat() == ImageFormat.JPEG || metadata.getFormat() == ImageFormat.PNG) {
tryReuse = true;
}
}
}
if (tryReuse) {
return source.loadBitmap(dest);
} else {
return new ReuseResult(loadBitmap(source), false);
}
} | java | private static ReuseResult loadBitmapReuseExact(ImageSource source, Bitmap dest) throws ImageLoadException {
ImageMetadata metadata = source.getImageMetadata();
boolean tryReuse = false;
if (dest.isMutable()
&& dest.getWidth() == metadata.getW()
&& dest.getHeight() == metadata.getH()) {
if (Build.VERSION.SDK_INT >= 19) {
tryReuse = true;
} else if (Build.VERSION.SDK_INT >= 11) {
if (metadata.getFormat() == ImageFormat.JPEG || metadata.getFormat() == ImageFormat.PNG) {
tryReuse = true;
}
}
}
if (tryReuse) {
return source.loadBitmap(dest);
} else {
return new ReuseResult(loadBitmap(source), false);
}
} | [
"private",
"static",
"ReuseResult",
"loadBitmapReuseExact",
"(",
"ImageSource",
"source",
",",
"Bitmap",
"dest",
")",
"throws",
"ImageLoadException",
"{",
"ImageMetadata",
"metadata",
"=",
"source",
".",
"getImageMetadata",
"(",
")",
";",
"boolean",
"tryReuse",
"=",
"false",
";",
"if",
"(",
"dest",
".",
"isMutable",
"(",
")",
"&&",
"dest",
".",
"getWidth",
"(",
")",
"==",
"metadata",
".",
"getW",
"(",
")",
"&&",
"dest",
".",
"getHeight",
"(",
")",
"==",
"metadata",
".",
"getH",
"(",
")",
")",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">=",
"19",
")",
"{",
"tryReuse",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">=",
"11",
")",
"{",
"if",
"(",
"metadata",
".",
"getFormat",
"(",
")",
"==",
"ImageFormat",
".",
"JPEG",
"||",
"metadata",
".",
"getFormat",
"(",
")",
"==",
"ImageFormat",
".",
"PNG",
")",
"{",
"tryReuse",
"=",
"true",
";",
"}",
"}",
"}",
"if",
"(",
"tryReuse",
")",
"{",
"return",
"source",
".",
"loadBitmap",
"(",
"dest",
")",
";",
"}",
"else",
"{",
"return",
"new",
"ReuseResult",
"(",
"loadBitmap",
"(",
"source",
")",
",",
"false",
")",
";",
"}",
"}"
]
| Loading image with reuse bitmap of same size as source
@param source image source
@param dest destination bitmap
@return loaded bitmap result
@throws ImageLoadException if it is unable to load image | [
"Loading",
"image",
"with",
"reuse",
"bitmap",
"of",
"same",
"size",
"as",
"source"
]
| train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L424-L444 |
finmath/finmath-lib | src/main/java6/net/finmath/marketdata/model/curves/HazardCurve.java | HazardCurve.createHazardCurveFromHazardRate | public static HazardCurve createHazardCurveFromHazardRate(String name, double[] times, double[] givenHazardRates) {
"""
Create a discount curve from given times and given zero rates using default interpolation and extrapolation methods.
The discount factor is determined by
<code>
givenSurvivalProbabilities[timeIndex] = givenSurvivalProbabilities[timeIndex-1] * Math.exp(- givenHazardRates[timeIndex] * (times[timeIndex]-times[timeIndex-1]));
</code>
@param name The name of this discount curve.
@param times Array of times as doubles.
@param givenHazardRates Array of corresponding zero rates.
@return A new discount factor object.
"""
double[] givenSurvivalProbabilities = new double[givenHazardRates.length];
if(givenHazardRates[0]<0) {
throw new IllegalArgumentException("First hazard rate is not positive");
}
//initialize the term structure
givenSurvivalProbabilities[0] = Math.exp(- givenHazardRates[0] * times[0]);
/*
* Construct the hazard curve by numerically integrating the hazard rates.
* At each step check if the input hazard rate is positive.
*/
for(int timeIndex=1; timeIndex<times.length;timeIndex++) {
if(givenHazardRates[timeIndex]<0) {
throw new IllegalArgumentException("The " + timeIndex + "-th hazard rate is not positive");
}
givenSurvivalProbabilities[timeIndex] = givenSurvivalProbabilities[timeIndex-1] * Math.exp(- givenHazardRates[timeIndex] * (times[timeIndex]-times[timeIndex-1]));
}
return createHazardCurveFromSurvivalProbabilities(name, times, givenSurvivalProbabilities);
} | java | public static HazardCurve createHazardCurveFromHazardRate(String name, double[] times, double[] givenHazardRates){
double[] givenSurvivalProbabilities = new double[givenHazardRates.length];
if(givenHazardRates[0]<0) {
throw new IllegalArgumentException("First hazard rate is not positive");
}
//initialize the term structure
givenSurvivalProbabilities[0] = Math.exp(- givenHazardRates[0] * times[0]);
/*
* Construct the hazard curve by numerically integrating the hazard rates.
* At each step check if the input hazard rate is positive.
*/
for(int timeIndex=1; timeIndex<times.length;timeIndex++) {
if(givenHazardRates[timeIndex]<0) {
throw new IllegalArgumentException("The " + timeIndex + "-th hazard rate is not positive");
}
givenSurvivalProbabilities[timeIndex] = givenSurvivalProbabilities[timeIndex-1] * Math.exp(- givenHazardRates[timeIndex] * (times[timeIndex]-times[timeIndex-1]));
}
return createHazardCurveFromSurvivalProbabilities(name, times, givenSurvivalProbabilities);
} | [
"public",
"static",
"HazardCurve",
"createHazardCurveFromHazardRate",
"(",
"String",
"name",
",",
"double",
"[",
"]",
"times",
",",
"double",
"[",
"]",
"givenHazardRates",
")",
"{",
"double",
"[",
"]",
"givenSurvivalProbabilities",
"=",
"new",
"double",
"[",
"givenHazardRates",
".",
"length",
"]",
";",
"if",
"(",
"givenHazardRates",
"[",
"0",
"]",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"First hazard rate is not positive\"",
")",
";",
"}",
"//initialize the term structure",
"givenSurvivalProbabilities",
"[",
"0",
"]",
"=",
"Math",
".",
"exp",
"(",
"-",
"givenHazardRates",
"[",
"0",
"]",
"*",
"times",
"[",
"0",
"]",
")",
";",
"/*\n\t\t * Construct the hazard curve by numerically integrating the hazard rates.\n\t\t * At each step check if the input hazard rate is positive.\n\t\t */",
"for",
"(",
"int",
"timeIndex",
"=",
"1",
";",
"timeIndex",
"<",
"times",
".",
"length",
";",
"timeIndex",
"++",
")",
"{",
"if",
"(",
"givenHazardRates",
"[",
"timeIndex",
"]",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The \"",
"+",
"timeIndex",
"+",
"\"-th hazard rate is not positive\"",
")",
";",
"}",
"givenSurvivalProbabilities",
"[",
"timeIndex",
"]",
"=",
"givenSurvivalProbabilities",
"[",
"timeIndex",
"-",
"1",
"]",
"*",
"Math",
".",
"exp",
"(",
"-",
"givenHazardRates",
"[",
"timeIndex",
"]",
"*",
"(",
"times",
"[",
"timeIndex",
"]",
"-",
"times",
"[",
"timeIndex",
"-",
"1",
"]",
")",
")",
";",
"}",
"return",
"createHazardCurveFromSurvivalProbabilities",
"(",
"name",
",",
"times",
",",
"givenSurvivalProbabilities",
")",
";",
"}"
]
| Create a discount curve from given times and given zero rates using default interpolation and extrapolation methods.
The discount factor is determined by
<code>
givenSurvivalProbabilities[timeIndex] = givenSurvivalProbabilities[timeIndex-1] * Math.exp(- givenHazardRates[timeIndex] * (times[timeIndex]-times[timeIndex-1]));
</code>
@param name The name of this discount curve.
@param times Array of times as doubles.
@param givenHazardRates Array of corresponding zero rates.
@return A new discount factor object. | [
"Create",
"a",
"discount",
"curve",
"from",
"given",
"times",
"and",
"given",
"zero",
"rates",
"using",
"default",
"interpolation",
"and",
"extrapolation",
"methods",
".",
"The",
"discount",
"factor",
"is",
"determined",
"by",
"<code",
">",
"givenSurvivalProbabilities",
"[",
"timeIndex",
"]",
"=",
"givenSurvivalProbabilities",
"[",
"timeIndex",
"-",
"1",
"]",
"*",
"Math",
".",
"exp",
"(",
"-",
"givenHazardRates",
"[",
"timeIndex",
"]",
"*",
"(",
"times",
"[",
"timeIndex",
"]",
"-",
"times",
"[",
"timeIndex",
"-",
"1",
"]",
"))",
";",
"<",
"/",
"code",
">"
]
| train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/model/curves/HazardCurve.java#L296-L321 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/NGAExtensions.java | NGAExtensions.deleteProperties | public static void deleteProperties(GeoPackageCore geoPackage, String table) {
"""
Delete the Properties extension if the deleted table is the properties
table
@param geoPackage
GeoPackage
@param table
table name
@since 3.2.0
"""
if (table.equalsIgnoreCase(PropertiesCoreExtension.TABLE_NAME)) {
deletePropertiesExtension(geoPackage);
}
} | java | public static void deleteProperties(GeoPackageCore geoPackage, String table) {
if (table.equalsIgnoreCase(PropertiesCoreExtension.TABLE_NAME)) {
deletePropertiesExtension(geoPackage);
}
} | [
"public",
"static",
"void",
"deleteProperties",
"(",
"GeoPackageCore",
"geoPackage",
",",
"String",
"table",
")",
"{",
"if",
"(",
"table",
".",
"equalsIgnoreCase",
"(",
"PropertiesCoreExtension",
".",
"TABLE_NAME",
")",
")",
"{",
"deletePropertiesExtension",
"(",
"geoPackage",
")",
";",
"}",
"}"
]
| Delete the Properties extension if the deleted table is the properties
table
@param geoPackage
GeoPackage
@param table
table name
@since 3.2.0 | [
"Delete",
"the",
"Properties",
"extension",
"if",
"the",
"deleted",
"table",
"is",
"the",
"properties",
"table"
]
| train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/NGAExtensions.java#L253-L259 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java | ValueMap.withBinarySet | public ValueMap withBinarySet(String key, byte[] ... val) {
"""
Sets the value of the specified key in the current ValueMap to the
given value.
"""
super.put(key, new LinkedHashSet<byte[]>(Arrays.asList(val)));
return this;
} | java | public ValueMap withBinarySet(String key, byte[] ... val) {
super.put(key, new LinkedHashSet<byte[]>(Arrays.asList(val)));
return this;
} | [
"public",
"ValueMap",
"withBinarySet",
"(",
"String",
"key",
",",
"byte",
"[",
"]",
"...",
"val",
")",
"{",
"super",
".",
"put",
"(",
"key",
",",
"new",
"LinkedHashSet",
"<",
"byte",
"[",
"]",
">",
"(",
"Arrays",
".",
"asList",
"(",
"val",
")",
")",
")",
";",
"return",
"this",
";",
"}"
]
| Sets the value of the specified key in the current ValueMap to the
given value. | [
"Sets",
"the",
"value",
"of",
"the",
"specified",
"key",
"in",
"the",
"current",
"ValueMap",
"to",
"the",
"given",
"value",
"."
]
| train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java#L149-L152 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java | ServicesInner.beginStart | public void beginStart(String groupName, String serviceName) {
"""
Start service.
The services resource is the top-level resource that represents the Data Migration Service. This action starts the service and the service can be used for data migration.
@param groupName Name of the resource group
@param serviceName Name of the service
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
"""
beginStartWithServiceResponseAsync(groupName, serviceName).toBlocking().single().body();
} | java | public void beginStart(String groupName, String serviceName) {
beginStartWithServiceResponseAsync(groupName, serviceName).toBlocking().single().body();
} | [
"public",
"void",
"beginStart",
"(",
"String",
"groupName",
",",
"String",
"serviceName",
")",
"{",
"beginStartWithServiceResponseAsync",
"(",
"groupName",
",",
"serviceName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
]
| Start service.
The services resource is the top-level resource that represents the Data Migration Service. This action starts the service and the service can be used for data migration.
@param groupName Name of the resource group
@param serviceName Name of the service
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Start",
"service",
".",
"The",
"services",
"resource",
"is",
"the",
"top",
"-",
"level",
"resource",
"that",
"represents",
"the",
"Data",
"Migration",
"Service",
".",
"This",
"action",
"starts",
"the",
"service",
"and",
"the",
"service",
"can",
"be",
"used",
"for",
"data",
"migration",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L1101-L1103 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendCloseBlocking | public static void sendCloseBlocking(final ByteBuffer data, final WebSocketChannel wsChannel) throws IOException {
"""
Sends a complete close message, invoking the callback when complete
@param data The data to send
@param wsChannel The web socket channel
"""
sendCloseBlocking(new CloseMessage(data), wsChannel);
} | java | public static void sendCloseBlocking(final ByteBuffer data, final WebSocketChannel wsChannel) throws IOException {
sendCloseBlocking(new CloseMessage(data), wsChannel);
} | [
"public",
"static",
"void",
"sendCloseBlocking",
"(",
"final",
"ByteBuffer",
"data",
",",
"final",
"WebSocketChannel",
"wsChannel",
")",
"throws",
"IOException",
"{",
"sendCloseBlocking",
"(",
"new",
"CloseMessage",
"(",
"data",
")",
",",
"wsChannel",
")",
";",
"}"
]
| Sends a complete close message, invoking the callback when complete
@param data The data to send
@param wsChannel The web socket channel | [
"Sends",
"a",
"complete",
"close",
"message",
"invoking",
"the",
"callback",
"when",
"complete"
]
| train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L885-L887 |
padrig64/ValidationFramework | validationframework-core/src/main/java/com/google/code/validationframework/base/utils/ValueUtils.java | ValueUtils.areEqual | public static <T> boolean areEqual(T value1, T value2, Comparator<T> comparator) {
"""
Compares the two given values by taking null values into account and the specified comparator.
@param value1 First value.
@param value2 Second value.
@param comparator Comparator to be used to compare the two values in case they are both non null.
@param <T> Type of values to be compared.
@return True if both values are null, or equal according to the comparator.
"""
return ((value1 == null) && (value2 == null)) || //
((value1 != null) && (value2 != null) && (comparator.compare(value1, value2) == 0));
} | java | public static <T> boolean areEqual(T value1, T value2, Comparator<T> comparator) {
return ((value1 == null) && (value2 == null)) || //
((value1 != null) && (value2 != null) && (comparator.compare(value1, value2) == 0));
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"areEqual",
"(",
"T",
"value1",
",",
"T",
"value2",
",",
"Comparator",
"<",
"T",
">",
"comparator",
")",
"{",
"return",
"(",
"(",
"value1",
"==",
"null",
")",
"&&",
"(",
"value2",
"==",
"null",
")",
")",
"||",
"//",
"(",
"(",
"value1",
"!=",
"null",
")",
"&&",
"(",
"value2",
"!=",
"null",
")",
"&&",
"(",
"comparator",
".",
"compare",
"(",
"value1",
",",
"value2",
")",
"==",
"0",
")",
")",
";",
"}"
]
| Compares the two given values by taking null values into account and the specified comparator.
@param value1 First value.
@param value2 Second value.
@param comparator Comparator to be used to compare the two values in case they are both non null.
@param <T> Type of values to be compared.
@return True if both values are null, or equal according to the comparator. | [
"Compares",
"the",
"two",
"given",
"values",
"by",
"taking",
"null",
"values",
"into",
"account",
"and",
"the",
"specified",
"comparator",
"."
]
| train | https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/utils/ValueUtils.java#L68-L71 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/os/BundleUtils.java | BundleUtils.optDouble | public static double optDouble(@Nullable Bundle bundle, @Nullable String key) {
"""
Returns a optional double value. In other words, returns the value mapped by key if it exists and is a double.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns 0.0.
@param bundle a bundle. If the bundle is null, this method will return 0.0.
@param key a key for the value.
@return a double value if exists, 0.0 otherwise.
@see android.os.Bundle#getDouble(String)
"""
return optDouble(bundle, key, 0.d);
} | java | public static double optDouble(@Nullable Bundle bundle, @Nullable String key) {
return optDouble(bundle, key, 0.d);
} | [
"public",
"static",
"double",
"optDouble",
"(",
"@",
"Nullable",
"Bundle",
"bundle",
",",
"@",
"Nullable",
"String",
"key",
")",
"{",
"return",
"optDouble",
"(",
"bundle",
",",
"key",
",",
"0.d",
")",
";",
"}"
]
| Returns a optional double value. In other words, returns the value mapped by key if it exists and is a double.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns 0.0.
@param bundle a bundle. If the bundle is null, this method will return 0.0.
@param key a key for the value.
@return a double value if exists, 0.0 otherwise.
@see android.os.Bundle#getDouble(String) | [
"Returns",
"a",
"optional",
"double",
"value",
".",
"In",
"other",
"words",
"returns",
"the",
"value",
"mapped",
"by",
"key",
"if",
"it",
"exists",
"and",
"is",
"a",
"double",
".",
"The",
"bundle",
"argument",
"is",
"allowed",
"to",
"be",
"{"
]
| train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L425-L427 |
brianwhu/xillium | base/src/main/java/org/xillium/base/Singleton.java | Singleton.get | public <V> T get(Functor<T, V> functor, V argument) throws Exception {
"""
Retrieves the singleton object, creating it by calling a provider if it is not created yet. This method uses
double-checked locking to ensure that only one instance will ever be created, while keeping retrieval cost at
minimum.
@see <a href="http://en.wikipedia.org/wiki/Double-checked_locking">Double-checked locking</a>
@param <V> the argument type to the functor
@param functor a {@link org.xillium.base.Functor Functor} that can be called to create a new value with 1 argument
@param argument the argument to pass to the functor
@return the singleton object
@throws Exception if the functor fails to create a new value
"""
T result = _value;
if (isMissing(result)) synchronized(this) {
result = _value;
if (isMissing(result)) {
_value = result = functor.invoke(argument);
}
}
return result;
} | java | public <V> T get(Functor<T, V> functor, V argument) throws Exception {
T result = _value;
if (isMissing(result)) synchronized(this) {
result = _value;
if (isMissing(result)) {
_value = result = functor.invoke(argument);
}
}
return result;
} | [
"public",
"<",
"V",
">",
"T",
"get",
"(",
"Functor",
"<",
"T",
",",
"V",
">",
"functor",
",",
"V",
"argument",
")",
"throws",
"Exception",
"{",
"T",
"result",
"=",
"_value",
";",
"if",
"(",
"isMissing",
"(",
"result",
")",
")",
"synchronized",
"(",
"this",
")",
"{",
"result",
"=",
"_value",
";",
"if",
"(",
"isMissing",
"(",
"result",
")",
")",
"{",
"_value",
"=",
"result",
"=",
"functor",
".",
"invoke",
"(",
"argument",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
]
| Retrieves the singleton object, creating it by calling a provider if it is not created yet. This method uses
double-checked locking to ensure that only one instance will ever be created, while keeping retrieval cost at
minimum.
@see <a href="http://en.wikipedia.org/wiki/Double-checked_locking">Double-checked locking</a>
@param <V> the argument type to the functor
@param functor a {@link org.xillium.base.Functor Functor} that can be called to create a new value with 1 argument
@param argument the argument to pass to the functor
@return the singleton object
@throws Exception if the functor fails to create a new value | [
"Retrieves",
"the",
"singleton",
"object",
"creating",
"it",
"by",
"calling",
"a",
"provider",
"if",
"it",
"is",
"not",
"created",
"yet",
".",
"This",
"method",
"uses",
"double",
"-",
"checked",
"locking",
"to",
"ensure",
"that",
"only",
"one",
"instance",
"will",
"ever",
"be",
"created",
"while",
"keeping",
"retrieval",
"cost",
"at",
"minimum",
"."
]
| train | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/Singleton.java#L59-L68 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnGatewaysInner.java | P2sVpnGatewaysInner.beginGenerateVpnProfile | public VpnProfileResponseInner beginGenerateVpnProfile(String resourceGroupName, String gatewayName, AuthenticationMethod authenticationMethod) {
"""
Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group.
@param resourceGroupName The name of the resource group.
@param gatewayName The name of the P2SVpnGateway.
@param authenticationMethod VPN client Authentication Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values include: 'EAPTLS', 'EAPMSCHAPv2'
@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 VpnProfileResponseInner object if successful.
"""
return beginGenerateVpnProfileWithServiceResponseAsync(resourceGroupName, gatewayName, authenticationMethod).toBlocking().single().body();
} | java | public VpnProfileResponseInner beginGenerateVpnProfile(String resourceGroupName, String gatewayName, AuthenticationMethod authenticationMethod) {
return beginGenerateVpnProfileWithServiceResponseAsync(resourceGroupName, gatewayName, authenticationMethod).toBlocking().single().body();
} | [
"public",
"VpnProfileResponseInner",
"beginGenerateVpnProfile",
"(",
"String",
"resourceGroupName",
",",
"String",
"gatewayName",
",",
"AuthenticationMethod",
"authenticationMethod",
")",
"{",
"return",
"beginGenerateVpnProfileWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"gatewayName",
",",
"authenticationMethod",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
]
| Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group.
@param resourceGroupName The name of the resource group.
@param gatewayName The name of the P2SVpnGateway.
@param authenticationMethod VPN client Authentication Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values include: 'EAPTLS', 'EAPMSCHAPv2'
@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 VpnProfileResponseInner object if successful. | [
"Generates",
"VPN",
"profile",
"for",
"P2S",
"client",
"of",
"the",
"P2SVpnGateway",
"in",
"the",
"specified",
"resource",
"group",
"."
]
| 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/P2sVpnGatewaysInner.java#L1297-L1299 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/query/values/JcValue.java | JcValue.asString | public JcString asString() {
"""
<div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div>
<div color='red' style="font-size:18px;color:red"><i>return the receiver as a JcString</i></div>
<br/>
"""
JcString ret = new JcString(null, this, null);
QueryRecorder.recordInvocationConditional(this, "asString", ret);
return ret;
} | java | public JcString asString() {
JcString ret = new JcString(null, this, null);
QueryRecorder.recordInvocationConditional(this, "asString", ret);
return ret;
} | [
"public",
"JcString",
"asString",
"(",
")",
"{",
"JcString",
"ret",
"=",
"new",
"JcString",
"(",
"null",
",",
"this",
",",
"null",
")",
";",
"QueryRecorder",
".",
"recordInvocationConditional",
"(",
"this",
",",
"\"asString\"",
",",
"ret",
")",
";",
"return",
"ret",
";",
"}"
]
| <div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div>
<div color='red' style="font-size:18px;color:red"><i>return the receiver as a JcString</i></div>
<br/> | [
"<div",
"color",
"=",
"red",
"style",
"=",
"font",
"-",
"size",
":",
"24px",
";",
"color",
":",
"red",
">",
"<b",
">",
"<i",
">",
"<u",
">",
"JCYPHER<",
"/",
"u",
">",
"<",
"/",
"i",
">",
"<",
"/",
"b",
">",
"<",
"/",
"div",
">",
"<div",
"color",
"=",
"red",
"style",
"=",
"font",
"-",
"size",
":",
"18px",
";",
"color",
":",
"red",
">",
"<i",
">",
"return",
"the",
"receiver",
"as",
"a",
"JcString<",
"/",
"i",
">",
"<",
"/",
"div",
">",
"<br",
"/",
">"
]
| train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/JcValue.java#L70-L74 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java | ConsumerUtil.getSigningKey | Key getSigningKey(JwtConsumerConfig config, JwtContext jwtContext, Map properties) throws KeyException {
"""
Get the appropriate signing key based on the signature algorithm specified in
the config.
"""
Key signingKey = null;
if (config == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JWT consumer config object is null");
}
return null;
}
signingKey = getSigningKeyBasedOnSignatureAlgorithm(config, jwtContext, properties);
if (signingKey == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "A signing key could not be found");
}
}
return signingKey;
} | java | Key getSigningKey(JwtConsumerConfig config, JwtContext jwtContext, Map properties) throws KeyException {
Key signingKey = null;
if (config == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JWT consumer config object is null");
}
return null;
}
signingKey = getSigningKeyBasedOnSignatureAlgorithm(config, jwtContext, properties);
if (signingKey == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "A signing key could not be found");
}
}
return signingKey;
} | [
"Key",
"getSigningKey",
"(",
"JwtConsumerConfig",
"config",
",",
"JwtContext",
"jwtContext",
",",
"Map",
"properties",
")",
"throws",
"KeyException",
"{",
"Key",
"signingKey",
"=",
"null",
";",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"JWT consumer config object is null\"",
")",
";",
"}",
"return",
"null",
";",
"}",
"signingKey",
"=",
"getSigningKeyBasedOnSignatureAlgorithm",
"(",
"config",
",",
"jwtContext",
",",
"properties",
")",
";",
"if",
"(",
"signingKey",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"A signing key could not be found\"",
")",
";",
"}",
"}",
"return",
"signingKey",
";",
"}"
]
| Get the appropriate signing key based on the signature algorithm specified in
the config. | [
"Get",
"the",
"appropriate",
"signing",
"key",
"based",
"on",
"the",
"signature",
"algorithm",
"specified",
"in",
"the",
"config",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java#L122-L137 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java | TransformerRegistry.registerSubsystemTransformers | public TransformersSubRegistration registerSubsystemTransformers(final String name, final ModelVersionRange range, final ResourceTransformer subsystemTransformer, final OperationTransformer operationTransformer, boolean placeholder) {
"""
Register a subsystem transformer.
@param name the subsystem name
@param range the version range
@param subsystemTransformer the resource transformer
@param operationTransformer the operation transformer
@param placeholder whether or not the registered transformers are placeholders
@return the sub registry
"""
final PathAddress subsystemAddress = PathAddress.EMPTY_ADDRESS.append(PathElement.pathElement(SUBSYSTEM, name));
for(final ModelVersion version : range.getVersions()) {
subsystem.createChildRegistry(subsystemAddress, version, subsystemTransformer, operationTransformer, placeholder);
}
return new TransformersSubRegistrationImpl(range, subsystem, subsystemAddress);
} | java | public TransformersSubRegistration registerSubsystemTransformers(final String name, final ModelVersionRange range, final ResourceTransformer subsystemTransformer, final OperationTransformer operationTransformer, boolean placeholder) {
final PathAddress subsystemAddress = PathAddress.EMPTY_ADDRESS.append(PathElement.pathElement(SUBSYSTEM, name));
for(final ModelVersion version : range.getVersions()) {
subsystem.createChildRegistry(subsystemAddress, version, subsystemTransformer, operationTransformer, placeholder);
}
return new TransformersSubRegistrationImpl(range, subsystem, subsystemAddress);
} | [
"public",
"TransformersSubRegistration",
"registerSubsystemTransformers",
"(",
"final",
"String",
"name",
",",
"final",
"ModelVersionRange",
"range",
",",
"final",
"ResourceTransformer",
"subsystemTransformer",
",",
"final",
"OperationTransformer",
"operationTransformer",
",",
"boolean",
"placeholder",
")",
"{",
"final",
"PathAddress",
"subsystemAddress",
"=",
"PathAddress",
".",
"EMPTY_ADDRESS",
".",
"append",
"(",
"PathElement",
".",
"pathElement",
"(",
"SUBSYSTEM",
",",
"name",
")",
")",
";",
"for",
"(",
"final",
"ModelVersion",
"version",
":",
"range",
".",
"getVersions",
"(",
")",
")",
"{",
"subsystem",
".",
"createChildRegistry",
"(",
"subsystemAddress",
",",
"version",
",",
"subsystemTransformer",
",",
"operationTransformer",
",",
"placeholder",
")",
";",
"}",
"return",
"new",
"TransformersSubRegistrationImpl",
"(",
"range",
",",
"subsystem",
",",
"subsystemAddress",
")",
";",
"}"
]
| Register a subsystem transformer.
@param name the subsystem name
@param range the version range
@param subsystemTransformer the resource transformer
@param operationTransformer the operation transformer
@param placeholder whether or not the registered transformers are placeholders
@return the sub registry | [
"Register",
"a",
"subsystem",
"transformer",
"."
]
| train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java#L149-L155 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/chunkblock/ChunkBlockHandler.java | ChunkBlockHandler.addCoord | private void addCoord(World world, BlockPos pos, int size) {
"""
Adds a coordinate for the {@link Chunk Chunks} around {@link BlockPos}.
@param world the world
@param pos the pos
@param size the size
"""
getAffectedChunks(world, pos.getX(), pos.getZ(), size).forEach(c -> addCoord(c, pos));
} | java | private void addCoord(World world, BlockPos pos, int size)
{
getAffectedChunks(world, pos.getX(), pos.getZ(), size).forEach(c -> addCoord(c, pos));
} | [
"private",
"void",
"addCoord",
"(",
"World",
"world",
",",
"BlockPos",
"pos",
",",
"int",
"size",
")",
"{",
"getAffectedChunks",
"(",
"world",
",",
"pos",
".",
"getX",
"(",
")",
",",
"pos",
".",
"getZ",
"(",
")",
",",
"size",
")",
".",
"forEach",
"(",
"c",
"->",
"addCoord",
"(",
"c",
",",
"pos",
")",
")",
";",
"}"
]
| Adds a coordinate for the {@link Chunk Chunks} around {@link BlockPos}.
@param world the world
@param pos the pos
@param size the size | [
"Adds",
"a",
"coordinate",
"for",
"the",
"{",
"@link",
"Chunk",
"Chunks",
"}",
"around",
"{",
"@link",
"BlockPos",
"}",
"."
]
| train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/chunkblock/ChunkBlockHandler.java#L148-L151 |
rometools/rome | rome-propono/src/main/java/com/rometools/propono/atom/server/impl/FileBasedCollection.java | FileBasedCollection.updateMediaEntry | public Entry updateMediaEntry(final String fileName, final String contentType, final InputStream is) throws Exception {
"""
Update media associated with a media-link entry.
@param fileName Internal ID of entry being updated
@param contentType Content type of data
@param is Source of updated data
@throws java.lang.Exception On error
@return Updated Entry as it exists on server
"""
synchronized (FileStore.getFileStore()) {
final File tempFile = File.createTempFile(fileName, "tmp");
final FileOutputStream fos = new FileOutputStream(tempFile);
Utilities.copyInputToOutput(is, fos);
fos.close();
// Update media file
final FileInputStream fis = new FileInputStream(tempFile);
saveMediaFile(fileName, contentType, tempFile.length(), fis);
fis.close();
final File resourceFile = new File(getEntryMediaPath(fileName));
// Load media-link entry to return
final String entryPath = getEntryPath(fileName);
final InputStream in = FileStore.getFileStore().getFileInputStream(entryPath);
final Entry atomEntry = loadAtomResourceEntry(in, resourceFile);
updateTimestamps(atomEntry);
updateMediaEntryAppLinks(atomEntry, fileName, false);
// Update feed with new entry
final Feed f = getFeedDocument();
updateFeedDocumentWithExistingEntry(f, atomEntry);
// Save updated media-link entry
final OutputStream os = FileStore.getFileStore().getFileOutputStream(entryPath);
updateMediaEntryAppLinks(atomEntry, fileName, true);
Atom10Generator.serializeEntry(atomEntry, new OutputStreamWriter(os, "UTF-8"));
os.flush();
os.close();
return atomEntry;
}
} | java | public Entry updateMediaEntry(final String fileName, final String contentType, final InputStream is) throws Exception {
synchronized (FileStore.getFileStore()) {
final File tempFile = File.createTempFile(fileName, "tmp");
final FileOutputStream fos = new FileOutputStream(tempFile);
Utilities.copyInputToOutput(is, fos);
fos.close();
// Update media file
final FileInputStream fis = new FileInputStream(tempFile);
saveMediaFile(fileName, contentType, tempFile.length(), fis);
fis.close();
final File resourceFile = new File(getEntryMediaPath(fileName));
// Load media-link entry to return
final String entryPath = getEntryPath(fileName);
final InputStream in = FileStore.getFileStore().getFileInputStream(entryPath);
final Entry atomEntry = loadAtomResourceEntry(in, resourceFile);
updateTimestamps(atomEntry);
updateMediaEntryAppLinks(atomEntry, fileName, false);
// Update feed with new entry
final Feed f = getFeedDocument();
updateFeedDocumentWithExistingEntry(f, atomEntry);
// Save updated media-link entry
final OutputStream os = FileStore.getFileStore().getFileOutputStream(entryPath);
updateMediaEntryAppLinks(atomEntry, fileName, true);
Atom10Generator.serializeEntry(atomEntry, new OutputStreamWriter(os, "UTF-8"));
os.flush();
os.close();
return atomEntry;
}
} | [
"public",
"Entry",
"updateMediaEntry",
"(",
"final",
"String",
"fileName",
",",
"final",
"String",
"contentType",
",",
"final",
"InputStream",
"is",
")",
"throws",
"Exception",
"{",
"synchronized",
"(",
"FileStore",
".",
"getFileStore",
"(",
")",
")",
"{",
"final",
"File",
"tempFile",
"=",
"File",
".",
"createTempFile",
"(",
"fileName",
",",
"\"tmp\"",
")",
";",
"final",
"FileOutputStream",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"tempFile",
")",
";",
"Utilities",
".",
"copyInputToOutput",
"(",
"is",
",",
"fos",
")",
";",
"fos",
".",
"close",
"(",
")",
";",
"// Update media file",
"final",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"tempFile",
")",
";",
"saveMediaFile",
"(",
"fileName",
",",
"contentType",
",",
"tempFile",
".",
"length",
"(",
")",
",",
"fis",
")",
";",
"fis",
".",
"close",
"(",
")",
";",
"final",
"File",
"resourceFile",
"=",
"new",
"File",
"(",
"getEntryMediaPath",
"(",
"fileName",
")",
")",
";",
"// Load media-link entry to return",
"final",
"String",
"entryPath",
"=",
"getEntryPath",
"(",
"fileName",
")",
";",
"final",
"InputStream",
"in",
"=",
"FileStore",
".",
"getFileStore",
"(",
")",
".",
"getFileInputStream",
"(",
"entryPath",
")",
";",
"final",
"Entry",
"atomEntry",
"=",
"loadAtomResourceEntry",
"(",
"in",
",",
"resourceFile",
")",
";",
"updateTimestamps",
"(",
"atomEntry",
")",
";",
"updateMediaEntryAppLinks",
"(",
"atomEntry",
",",
"fileName",
",",
"false",
")",
";",
"// Update feed with new entry",
"final",
"Feed",
"f",
"=",
"getFeedDocument",
"(",
")",
";",
"updateFeedDocumentWithExistingEntry",
"(",
"f",
",",
"atomEntry",
")",
";",
"// Save updated media-link entry",
"final",
"OutputStream",
"os",
"=",
"FileStore",
".",
"getFileStore",
"(",
")",
".",
"getFileOutputStream",
"(",
"entryPath",
")",
";",
"updateMediaEntryAppLinks",
"(",
"atomEntry",
",",
"fileName",
",",
"true",
")",
";",
"Atom10Generator",
".",
"serializeEntry",
"(",
"atomEntry",
",",
"new",
"OutputStreamWriter",
"(",
"os",
",",
"\"UTF-8\"",
")",
")",
";",
"os",
".",
"flush",
"(",
")",
";",
"os",
".",
"close",
"(",
")",
";",
"return",
"atomEntry",
";",
"}",
"}"
]
| Update media associated with a media-link entry.
@param fileName Internal ID of entry being updated
@param contentType Content type of data
@param is Source of updated data
@throws java.lang.Exception On error
@return Updated Entry as it exists on server | [
"Update",
"media",
"associated",
"with",
"a",
"media",
"-",
"link",
"entry",
"."
]
| train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-propono/src/main/java/com/rometools/propono/atom/server/impl/FileBasedCollection.java#L343-L378 |
jbundle/jbundle | thin/base/screen/cal/other/src/main/java/org/jbundle/thin/base/screen/cal/opt/CachedItem.java | CachedItem.setCacheData | public synchronized void setCacheData(Date startTime, Date endTime, String description, String [] rgstrMeals) {
"""
Change the cache data without calling the methods to change the underlying model.
This method is used by the lineItem to change the screen model without calling a change to the model.
"""
m_cachedInfo.setCacheData(startTime, endTime, description, rgstrMeals);
} | java | public synchronized void setCacheData(Date startTime, Date endTime, String description, String [] rgstrMeals)
{
m_cachedInfo.setCacheData(startTime, endTime, description, rgstrMeals);
} | [
"public",
"synchronized",
"void",
"setCacheData",
"(",
"Date",
"startTime",
",",
"Date",
"endTime",
",",
"String",
"description",
",",
"String",
"[",
"]",
"rgstrMeals",
")",
"{",
"m_cachedInfo",
".",
"setCacheData",
"(",
"startTime",
",",
"endTime",
",",
"description",
",",
"rgstrMeals",
")",
";",
"}"
]
| Change the cache data without calling the methods to change the underlying model.
This method is used by the lineItem to change the screen model without calling a change to the model. | [
"Change",
"the",
"cache",
"data",
"without",
"calling",
"the",
"methods",
"to",
"change",
"the",
"underlying",
"model",
".",
"This",
"method",
"is",
"used",
"by",
"the",
"lineItem",
"to",
"change",
"the",
"screen",
"model",
"without",
"calling",
"a",
"change",
"to",
"the",
"model",
"."
]
| train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/other/src/main/java/org/jbundle/thin/base/screen/cal/opt/CachedItem.java#L213-L216 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Clicker.java | Clicker.clickOnWebElement | public void clickOnWebElement(By by, int match, boolean scroll, boolean useJavaScriptToClick) {
"""
Clicks on a web element using the given By method.
@param by the By object e.g. By.id("id");
@param match if multiple objects match, this determines which one will be clicked
@param scroll true if scrolling should be performed
@param useJavaScriptToClick true if click should be perfomed through JavaScript
"""
WebElement webElement = null;
if(useJavaScriptToClick){
webElement = waiter.waitForWebElement(by, match, Timeout.getSmallTimeout(), false);
if(webElement == null){
Assert.fail("WebElement with " + webUtils.splitNameByUpperCase(by.getClass().getSimpleName()) + ": '" + by.getValue() + "' is not found!");
}
webUtils.executeJavaScript(by, true);
return;
}
WebElement webElementToClick = waiter.waitForWebElement(by, match, Timeout.getSmallTimeout(), scroll);
if(webElementToClick == null){
if(match > 1) {
Assert.fail(match + " WebElements with " + webUtils.splitNameByUpperCase(by.getClass().getSimpleName()) + ": '" + by.getValue() + "' are not found!");
}
else {
Assert.fail("WebElement with " + webUtils.splitNameByUpperCase(by.getClass().getSimpleName()) + ": '" + by.getValue() + "' is not found!");
}
}
clickOnScreen(webElementToClick.getLocationX(), webElementToClick.getLocationY(), null);
} | java | public void clickOnWebElement(By by, int match, boolean scroll, boolean useJavaScriptToClick){
WebElement webElement = null;
if(useJavaScriptToClick){
webElement = waiter.waitForWebElement(by, match, Timeout.getSmallTimeout(), false);
if(webElement == null){
Assert.fail("WebElement with " + webUtils.splitNameByUpperCase(by.getClass().getSimpleName()) + ": '" + by.getValue() + "' is not found!");
}
webUtils.executeJavaScript(by, true);
return;
}
WebElement webElementToClick = waiter.waitForWebElement(by, match, Timeout.getSmallTimeout(), scroll);
if(webElementToClick == null){
if(match > 1) {
Assert.fail(match + " WebElements with " + webUtils.splitNameByUpperCase(by.getClass().getSimpleName()) + ": '" + by.getValue() + "' are not found!");
}
else {
Assert.fail("WebElement with " + webUtils.splitNameByUpperCase(by.getClass().getSimpleName()) + ": '" + by.getValue() + "' is not found!");
}
}
clickOnScreen(webElementToClick.getLocationX(), webElementToClick.getLocationY(), null);
} | [
"public",
"void",
"clickOnWebElement",
"(",
"By",
"by",
",",
"int",
"match",
",",
"boolean",
"scroll",
",",
"boolean",
"useJavaScriptToClick",
")",
"{",
"WebElement",
"webElement",
"=",
"null",
";",
"if",
"(",
"useJavaScriptToClick",
")",
"{",
"webElement",
"=",
"waiter",
".",
"waitForWebElement",
"(",
"by",
",",
"match",
",",
"Timeout",
".",
"getSmallTimeout",
"(",
")",
",",
"false",
")",
";",
"if",
"(",
"webElement",
"==",
"null",
")",
"{",
"Assert",
".",
"fail",
"(",
"\"WebElement with \"",
"+",
"webUtils",
".",
"splitNameByUpperCase",
"(",
"by",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
"+",
"\": '\"",
"+",
"by",
".",
"getValue",
"(",
")",
"+",
"\"' is not found!\"",
")",
";",
"}",
"webUtils",
".",
"executeJavaScript",
"(",
"by",
",",
"true",
")",
";",
"return",
";",
"}",
"WebElement",
"webElementToClick",
"=",
"waiter",
".",
"waitForWebElement",
"(",
"by",
",",
"match",
",",
"Timeout",
".",
"getSmallTimeout",
"(",
")",
",",
"scroll",
")",
";",
"if",
"(",
"webElementToClick",
"==",
"null",
")",
"{",
"if",
"(",
"match",
">",
"1",
")",
"{",
"Assert",
".",
"fail",
"(",
"match",
"+",
"\" WebElements with \"",
"+",
"webUtils",
".",
"splitNameByUpperCase",
"(",
"by",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
"+",
"\": '\"",
"+",
"by",
".",
"getValue",
"(",
")",
"+",
"\"' are not found!\"",
")",
";",
"}",
"else",
"{",
"Assert",
".",
"fail",
"(",
"\"WebElement with \"",
"+",
"webUtils",
".",
"splitNameByUpperCase",
"(",
"by",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
"+",
"\": '\"",
"+",
"by",
".",
"getValue",
"(",
")",
"+",
"\"' is not found!\"",
")",
";",
"}",
"}",
"clickOnScreen",
"(",
"webElementToClick",
".",
"getLocationX",
"(",
")",
",",
"webElementToClick",
".",
"getLocationY",
"(",
")",
",",
"null",
")",
";",
"}"
]
| Clicks on a web element using the given By method.
@param by the By object e.g. By.id("id");
@param match if multiple objects match, this determines which one will be clicked
@param scroll true if scrolling should be performed
@param useJavaScriptToClick true if click should be perfomed through JavaScript | [
"Clicks",
"on",
"a",
"web",
"element",
"using",
"the",
"given",
"By",
"method",
"."
]
| train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Clicker.java#L401-L425 |
morfologik/morfologik-stemming | morfologik-stemming/src/main/java/morfologik/stemming/Dictionary.java | Dictionary.read | public static Dictionary read(URL dictURL) throws IOException {
"""
Attempts to load a dictionary using the URL to the FSA file and the
expected metadata extension.
@param dictURL The URL pointing to the dictionary file (<code>*.dict</code>).
@return An instantiated dictionary.
@throws IOException if an I/O error occurs.
"""
final URL expectedMetadataURL;
try {
String external = dictURL.toExternalForm();
expectedMetadataURL = new URL(DictionaryMetadata.getExpectedMetadataFileName(external));
} catch (MalformedURLException e) {
throw new IOException("Couldn't construct relative feature map URL for: " + dictURL, e);
}
try (InputStream fsaStream = dictURL.openStream();
InputStream metadataStream = expectedMetadataURL.openStream()) {
return read(fsaStream, metadataStream);
}
} | java | public static Dictionary read(URL dictURL) throws IOException {
final URL expectedMetadataURL;
try {
String external = dictURL.toExternalForm();
expectedMetadataURL = new URL(DictionaryMetadata.getExpectedMetadataFileName(external));
} catch (MalformedURLException e) {
throw new IOException("Couldn't construct relative feature map URL for: " + dictURL, e);
}
try (InputStream fsaStream = dictURL.openStream();
InputStream metadataStream = expectedMetadataURL.openStream()) {
return read(fsaStream, metadataStream);
}
} | [
"public",
"static",
"Dictionary",
"read",
"(",
"URL",
"dictURL",
")",
"throws",
"IOException",
"{",
"final",
"URL",
"expectedMetadataURL",
";",
"try",
"{",
"String",
"external",
"=",
"dictURL",
".",
"toExternalForm",
"(",
")",
";",
"expectedMetadataURL",
"=",
"new",
"URL",
"(",
"DictionaryMetadata",
".",
"getExpectedMetadataFileName",
"(",
"external",
")",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Couldn't construct relative feature map URL for: \"",
"+",
"dictURL",
",",
"e",
")",
";",
"}",
"try",
"(",
"InputStream",
"fsaStream",
"=",
"dictURL",
".",
"openStream",
"(",
")",
";",
"InputStream",
"metadataStream",
"=",
"expectedMetadataURL",
".",
"openStream",
"(",
")",
")",
"{",
"return",
"read",
"(",
"fsaStream",
",",
"metadataStream",
")",
";",
"}",
"}"
]
| Attempts to load a dictionary using the URL to the FSA file and the
expected metadata extension.
@param dictURL The URL pointing to the dictionary file (<code>*.dict</code>).
@return An instantiated dictionary.
@throws IOException if an I/O error occurs. | [
"Attempts",
"to",
"load",
"a",
"dictionary",
"using",
"the",
"URL",
"to",
"the",
"FSA",
"file",
"and",
"the",
"expected",
"metadata",
"extension",
"."
]
| train | https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-stemming/src/main/java/morfologik/stemming/Dictionary.java#L77-L90 |
Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java | PollingState.updateFromResponseOnPutPatch | void updateFromResponseOnPutPatch(Response<ResponseBody> response) throws CloudException, IOException {
"""
Updates the polling state from a PUT or PATCH operation.
@param response the response from Retrofit REST call
@throws CloudException thrown if the response is invalid
@throws IOException thrown by deserialization
"""
String responseContent = null;
if (response.body() != null) {
responseContent = response.body().string();
response.body().close();
}
if (responseContent == null || responseContent.isEmpty()) {
throw new CloudException("polling response does not contain a valid body", response);
}
PollingResource resource = serializerAdapter.deserialize(responseContent, PollingResource.class);
final int statusCode = response.code();
if (resource != null && resource.properties != null && resource.properties.provisioningState != null) {
this.withStatus(resource.properties.provisioningState, statusCode);
} else {
this.withStatus(AzureAsyncOperation.SUCCESS_STATUS, statusCode);
}
CloudError error = new CloudError();
this.withErrorBody(error);
error.withCode(this.status());
error.withMessage("Long running operation failed");
this.withResponse(response);
this.withResource(serializerAdapter.<T>deserialize(responseContent, resourceType));
} | java | void updateFromResponseOnPutPatch(Response<ResponseBody> response) throws CloudException, IOException {
String responseContent = null;
if (response.body() != null) {
responseContent = response.body().string();
response.body().close();
}
if (responseContent == null || responseContent.isEmpty()) {
throw new CloudException("polling response does not contain a valid body", response);
}
PollingResource resource = serializerAdapter.deserialize(responseContent, PollingResource.class);
final int statusCode = response.code();
if (resource != null && resource.properties != null && resource.properties.provisioningState != null) {
this.withStatus(resource.properties.provisioningState, statusCode);
} else {
this.withStatus(AzureAsyncOperation.SUCCESS_STATUS, statusCode);
}
CloudError error = new CloudError();
this.withErrorBody(error);
error.withCode(this.status());
error.withMessage("Long running operation failed");
this.withResponse(response);
this.withResource(serializerAdapter.<T>deserialize(responseContent, resourceType));
} | [
"void",
"updateFromResponseOnPutPatch",
"(",
"Response",
"<",
"ResponseBody",
">",
"response",
")",
"throws",
"CloudException",
",",
"IOException",
"{",
"String",
"responseContent",
"=",
"null",
";",
"if",
"(",
"response",
".",
"body",
"(",
")",
"!=",
"null",
")",
"{",
"responseContent",
"=",
"response",
".",
"body",
"(",
")",
".",
"string",
"(",
")",
";",
"response",
".",
"body",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"responseContent",
"==",
"null",
"||",
"responseContent",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"CloudException",
"(",
"\"polling response does not contain a valid body\"",
",",
"response",
")",
";",
"}",
"PollingResource",
"resource",
"=",
"serializerAdapter",
".",
"deserialize",
"(",
"responseContent",
",",
"PollingResource",
".",
"class",
")",
";",
"final",
"int",
"statusCode",
"=",
"response",
".",
"code",
"(",
")",
";",
"if",
"(",
"resource",
"!=",
"null",
"&&",
"resource",
".",
"properties",
"!=",
"null",
"&&",
"resource",
".",
"properties",
".",
"provisioningState",
"!=",
"null",
")",
"{",
"this",
".",
"withStatus",
"(",
"resource",
".",
"properties",
".",
"provisioningState",
",",
"statusCode",
")",
";",
"}",
"else",
"{",
"this",
".",
"withStatus",
"(",
"AzureAsyncOperation",
".",
"SUCCESS_STATUS",
",",
"statusCode",
")",
";",
"}",
"CloudError",
"error",
"=",
"new",
"CloudError",
"(",
")",
";",
"this",
".",
"withErrorBody",
"(",
"error",
")",
";",
"error",
".",
"withCode",
"(",
"this",
".",
"status",
"(",
")",
")",
";",
"error",
".",
"withMessage",
"(",
"\"Long running operation failed\"",
")",
";",
"this",
".",
"withResponse",
"(",
"response",
")",
";",
"this",
".",
"withResource",
"(",
"serializerAdapter",
".",
"<",
"T",
">",
"deserialize",
"(",
"responseContent",
",",
"resourceType",
")",
")",
";",
"}"
]
| Updates the polling state from a PUT or PATCH operation.
@param response the response from Retrofit REST call
@throws CloudException thrown if the response is invalid
@throws IOException thrown by deserialization | [
"Updates",
"the",
"polling",
"state",
"from",
"a",
"PUT",
"or",
"PATCH",
"operation",
"."
]
| train | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java#L261-L286 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.