repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
MenoData/Time4J | base/src/main/java/net/time4j/calendar/astro/SolarTime.java | SolarTime.ofLocation | public static SolarTime ofLocation(
double latitude,
double longitude,
int altitude,
String calculator
) {
"""
/*[deutsch]
<p>Liefert die Sonnenzeit zur angegebenen geographischen Position. </p>
<p>Diese Methode nimmt geographische Angaben nur in Dezimalgrad entgegen. Wenn diese Daten aber
in Grad, Bogenminuten und Bogensekunden vorliegen, sollten Anwender den {@link #ofLocation() Builder-Ansatz}
bevorzugen. </p>
@param latitude geographical latitude in decimal degrees ({@code -90.0 <= x <= +90.0})
@param longitude geographical longitude in decimal degrees ({@code -180.0 <= x < 180.0})
@param altitude geographical altitude relative to sea level in meters ({@code 0 <= x < 11,0000})
@param calculator name of solar time calculator
@return instance of local solar time
@throws IllegalArgumentException if the coordinates are out of range or the calculator is unknown
@see Calculator#name()
@since 3.34/4.29
"""
check(latitude, longitude, altitude, calculator);
return new SolarTime(latitude, longitude, altitude, calculator, null);
} | java | public static SolarTime ofLocation(
double latitude,
double longitude,
int altitude,
String calculator
) {
check(latitude, longitude, altitude, calculator);
return new SolarTime(latitude, longitude, altitude, calculator, null);
} | [
"public",
"static",
"SolarTime",
"ofLocation",
"(",
"double",
"latitude",
",",
"double",
"longitude",
",",
"int",
"altitude",
",",
"String",
"calculator",
")",
"{",
"check",
"(",
"latitude",
",",
"longitude",
",",
"altitude",
",",
"calculator",
")",
";",
"return",
"new",
"SolarTime",
"(",
"latitude",
",",
"longitude",
",",
"altitude",
",",
"calculator",
",",
"null",
")",
";",
"}"
] | /*[deutsch]
<p>Liefert die Sonnenzeit zur angegebenen geographischen Position. </p>
<p>Diese Methode nimmt geographische Angaben nur in Dezimalgrad entgegen. Wenn diese Daten aber
in Grad, Bogenminuten und Bogensekunden vorliegen, sollten Anwender den {@link #ofLocation() Builder-Ansatz}
bevorzugen. </p>
@param latitude geographical latitude in decimal degrees ({@code -90.0 <= x <= +90.0})
@param longitude geographical longitude in decimal degrees ({@code -180.0 <= x < 180.0})
@param altitude geographical altitude relative to sea level in meters ({@code 0 <= x < 11,0000})
@param calculator name of solar time calculator
@return instance of local solar time
@throws IllegalArgumentException if the coordinates are out of range or the calculator is unknown
@see Calculator#name()
@since 3.34/4.29 | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Liefert",
"die",
"Sonnenzeit",
"zur",
"angegebenen",
"geographischen",
"Position",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/astro/SolarTime.java#L400-L410 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getLastToken | @Nullable
public static String getLastToken (@Nullable final String sStr, @Nullable final String sSearch) {
"""
Get the last token from (and excluding) the separating string.
@param sStr
The string to search. May be <code>null</code>.
@param sSearch
The search string. May be <code>null</code>.
@return The passed string if no such separator token was found.
"""
if (StringHelper.hasNoText (sSearch))
return sStr;
final int nIndex = getLastIndexOf (sStr, sSearch);
return nIndex == StringHelper.STRING_NOT_FOUND ? sStr : sStr.substring (nIndex + getLength (sSearch));
} | java | @Nullable
public static String getLastToken (@Nullable final String sStr, @Nullable final String sSearch)
{
if (StringHelper.hasNoText (sSearch))
return sStr;
final int nIndex = getLastIndexOf (sStr, sSearch);
return nIndex == StringHelper.STRING_NOT_FOUND ? sStr : sStr.substring (nIndex + getLength (sSearch));
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getLastToken",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"@",
"Nullable",
"final",
"String",
"sSearch",
")",
"{",
"if",
"(",
"StringHelper",
".",
"hasNoText",
"(",
"sSearch",
")",
")",
"return",
"sStr",
";",
"final",
"int",
"nIndex",
"=",
"getLastIndexOf",
"(",
"sStr",
",",
"sSearch",
")",
";",
"return",
"nIndex",
"==",
"StringHelper",
".",
"STRING_NOT_FOUND",
"?",
"sStr",
":",
"sStr",
".",
"substring",
"(",
"nIndex",
"+",
"getLength",
"(",
"sSearch",
")",
")",
";",
"}"
] | Get the last token from (and excluding) the separating string.
@param sStr
The string to search. May be <code>null</code>.
@param sSearch
The search string. May be <code>null</code>.
@return The passed string if no such separator token was found. | [
"Get",
"the",
"last",
"token",
"from",
"(",
"and",
"excluding",
")",
"the",
"separating",
"string",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L5154-L5161 |
lucee/Lucee | core/src/main/java/lucee/transformer/bytecode/util/ASMUtil.java | ASMUtil.toType | public static Type toType(String cfType, boolean axistype) throws PageException {
"""
translate a string cfml type definition to a Type Object
@param cfType
@param axistype
@return
@throws PageException
"""
return toType(Caster.cfTypeToClass(cfType), axistype);
} | java | public static Type toType(String cfType, boolean axistype) throws PageException {
return toType(Caster.cfTypeToClass(cfType), axistype);
} | [
"public",
"static",
"Type",
"toType",
"(",
"String",
"cfType",
",",
"boolean",
"axistype",
")",
"throws",
"PageException",
"{",
"return",
"toType",
"(",
"Caster",
".",
"cfTypeToClass",
"(",
"cfType",
")",
",",
"axistype",
")",
";",
"}"
] | translate a string cfml type definition to a Type Object
@param cfType
@param axistype
@return
@throws PageException | [
"translate",
"a",
"string",
"cfml",
"type",
"definition",
"to",
"a",
"Type",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/util/ASMUtil.java#L646-L648 |
dmerkushov/log-helper | src/main/java/ru/dmerkushov/loghelper/LogHelperDebug.java | LogHelperDebug.printMessage | public static void printMessage (String message, boolean force) {
"""
Print a message to <code>System.out</code>, with an every-line prefix: "log-helper DEBUG: "
@param message
@param force <code>true</code> if we need to override the debug enabled flag (i.e. the message is REALLY important), <code>false</code> otherwise
"""
if (isDebugEnabled () || force) {
String toOutput = "log-helper DEBUG: " + message.replaceAll ("\n", "\nlog-helper DEBUG: ");
System.out.println (toOutput);
}
} | java | public static void printMessage (String message, boolean force) {
if (isDebugEnabled () || force) {
String toOutput = "log-helper DEBUG: " + message.replaceAll ("\n", "\nlog-helper DEBUG: ");
System.out.println (toOutput);
}
} | [
"public",
"static",
"void",
"printMessage",
"(",
"String",
"message",
",",
"boolean",
"force",
")",
"{",
"if",
"(",
"isDebugEnabled",
"(",
")",
"||",
"force",
")",
"{",
"String",
"toOutput",
"=",
"\"log-helper DEBUG: \"",
"+",
"message",
".",
"replaceAll",
"(",
"\"\\n\"",
",",
"\"\\nlog-helper DEBUG: \"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"toOutput",
")",
";",
"}",
"}"
] | Print a message to <code>System.out</code>, with an every-line prefix: "log-helper DEBUG: "
@param message
@param force <code>true</code> if we need to override the debug enabled flag (i.e. the message is REALLY important), <code>false</code> otherwise | [
"Print",
"a",
"message",
"to",
"<code",
">",
"System",
".",
"out<",
"/",
"code",
">",
"with",
"an",
"every",
"-",
"line",
"prefix",
":",
"log",
"-",
"helper",
"DEBUG",
":"
] | train | https://github.com/dmerkushov/log-helper/blob/3b7d3d30faa7f1437b27cd07c10fa579a995de23/src/main/java/ru/dmerkushov/loghelper/LogHelperDebug.java#L52-L57 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/APIKeysInner.java | APIKeysInner.listAsync | public Observable<List<ApplicationInsightsComponentAPIKeyInner>> listAsync(String resourceGroupName, String resourceName) {
"""
Gets a list of API keys of an Application Insights component.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<ApplicationInsightsComponentAPIKeyInner> object
"""
return listWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentAPIKeyInner>>, List<ApplicationInsightsComponentAPIKeyInner>>() {
@Override
public List<ApplicationInsightsComponentAPIKeyInner> call(ServiceResponse<List<ApplicationInsightsComponentAPIKeyInner>> response) {
return response.body();
}
});
} | java | public Observable<List<ApplicationInsightsComponentAPIKeyInner>> listAsync(String resourceGroupName, String resourceName) {
return listWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentAPIKeyInner>>, List<ApplicationInsightsComponentAPIKeyInner>>() {
@Override
public List<ApplicationInsightsComponentAPIKeyInner> call(ServiceResponse<List<ApplicationInsightsComponentAPIKeyInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"ApplicationInsightsComponentAPIKeyInner",
">",
">",
"listAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"List",
"<",
"ApplicationInsightsComponentAPIKeyInner",
">",
">",
",",
"List",
"<",
"ApplicationInsightsComponentAPIKeyInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"List",
"<",
"ApplicationInsightsComponentAPIKeyInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"List",
"<",
"ApplicationInsightsComponentAPIKeyInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets a list of API keys of an Application Insights component.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<ApplicationInsightsComponentAPIKeyInner> object | [
"Gets",
"a",
"list",
"of",
"API",
"keys",
"of",
"an",
"Application",
"Insights",
"component",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/APIKeysInner.java#L113-L120 |
google/closure-compiler | src/com/google/javascript/jscomp/CheckJSDoc.java | CheckJSDoc.validateClassLevelJsDoc | private void validateClassLevelJsDoc(Node n, JSDocInfo info) {
"""
Checks that class-level annotations like @interface/@extends are not used on member functions.
"""
if (info != null && n.isMemberFunctionDef()
&& hasClassLevelJsDoc(info)) {
report(n, DISALLOWED_MEMBER_JSDOC);
}
} | java | private void validateClassLevelJsDoc(Node n, JSDocInfo info) {
if (info != null && n.isMemberFunctionDef()
&& hasClassLevelJsDoc(info)) {
report(n, DISALLOWED_MEMBER_JSDOC);
}
} | [
"private",
"void",
"validateClassLevelJsDoc",
"(",
"Node",
"n",
",",
"JSDocInfo",
"info",
")",
"{",
"if",
"(",
"info",
"!=",
"null",
"&&",
"n",
".",
"isMemberFunctionDef",
"(",
")",
"&&",
"hasClassLevelJsDoc",
"(",
"info",
")",
")",
"{",
"report",
"(",
"n",
",",
"DISALLOWED_MEMBER_JSDOC",
")",
";",
"}",
"}"
] | Checks that class-level annotations like @interface/@extends are not used on member functions. | [
"Checks",
"that",
"class",
"-",
"level",
"annotations",
"like"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckJSDoc.java#L310-L315 |
alkacon/opencms-core | src/org/opencms/workflow/CmsDefaultPublishResourceFormatter.java | CmsDefaultPublishResourceFormatter.getOuAwareName | public static String getOuAwareName(CmsObject cms, String name) {
"""
Returns the simple name if the ou is the same as the current user's ou.<p>
@param cms the CMS context
@param name the fully qualified name to check
@return the simple name if the ou is the same as the current user's ou
"""
String ou = CmsOrganizationalUnit.getParentFqn(name);
if (ou.equals(cms.getRequestContext().getCurrentUser().getOuFqn())) {
return CmsOrganizationalUnit.getSimpleName(name);
}
return CmsOrganizationalUnit.SEPARATOR + name;
} | java | public static String getOuAwareName(CmsObject cms, String name) {
String ou = CmsOrganizationalUnit.getParentFqn(name);
if (ou.equals(cms.getRequestContext().getCurrentUser().getOuFqn())) {
return CmsOrganizationalUnit.getSimpleName(name);
}
return CmsOrganizationalUnit.SEPARATOR + name;
} | [
"public",
"static",
"String",
"getOuAwareName",
"(",
"CmsObject",
"cms",
",",
"String",
"name",
")",
"{",
"String",
"ou",
"=",
"CmsOrganizationalUnit",
".",
"getParentFqn",
"(",
"name",
")",
";",
"if",
"(",
"ou",
".",
"equals",
"(",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getCurrentUser",
"(",
")",
".",
"getOuFqn",
"(",
")",
")",
")",
"{",
"return",
"CmsOrganizationalUnit",
".",
"getSimpleName",
"(",
"name",
")",
";",
"}",
"return",
"CmsOrganizationalUnit",
".",
"SEPARATOR",
"+",
"name",
";",
"}"
] | Returns the simple name if the ou is the same as the current user's ou.<p>
@param cms the CMS context
@param name the fully qualified name to check
@return the simple name if the ou is the same as the current user's ou | [
"Returns",
"the",
"simple",
"name",
"if",
"the",
"ou",
"is",
"the",
"same",
"as",
"the",
"current",
"user",
"s",
"ou",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workflow/CmsDefaultPublishResourceFormatter.java#L324-L331 |
xqbase/tuna | core/src/main/java/com/xqbase/tuna/ConnectionFilter.java | ConnectionFilter.send | @Override
public void send(byte[] b, int off, int len) {
"""
Wraps sent data, from the application side to the network side
"""
handler.send(b, off, len);
} | java | @Override
public void send(byte[] b, int off, int len) {
handler.send(b, off, len);
} | [
"@",
"Override",
"public",
"void",
"send",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"{",
"handler",
".",
"send",
"(",
"b",
",",
"off",
",",
"len",
")",
";",
"}"
] | Wraps sent data, from the application side to the network side | [
"Wraps",
"sent",
"data",
"from",
"the",
"application",
"side",
"to",
"the",
"network",
"side"
] | train | https://github.com/xqbase/tuna/blob/60d05a9e03877a3daafe9de83dc4427c6cbb9995/core/src/main/java/com/xqbase/tuna/ConnectionFilter.java#L28-L31 |
kmi/iserve | iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java | GenericLogicDiscoverer.findServicesClassifiedBySome | @Override
public Map<URI, MatchResult> findServicesClassifiedBySome(Set<URI> modelReferences) {
"""
Discover the services that are classified by some (i.e., at least one) of the types given. That is, all those
that have some level of matching with respect to at least one entity provided in the model references.
@param modelReferences the classifications to match against
@return a Set containing all the matching services. If there are no solutions, the Set should be empty, not null.
"""
return findServicesClassifiedBySome(modelReferences, LogicConceptMatchType.Plugin);
} | java | @Override
public Map<URI, MatchResult> findServicesClassifiedBySome(Set<URI> modelReferences) {
return findServicesClassifiedBySome(modelReferences, LogicConceptMatchType.Plugin);
} | [
"@",
"Override",
"public",
"Map",
"<",
"URI",
",",
"MatchResult",
">",
"findServicesClassifiedBySome",
"(",
"Set",
"<",
"URI",
">",
"modelReferences",
")",
"{",
"return",
"findServicesClassifiedBySome",
"(",
"modelReferences",
",",
"LogicConceptMatchType",
".",
"Plugin",
")",
";",
"}"
] | Discover the services that are classified by some (i.e., at least one) of the types given. That is, all those
that have some level of matching with respect to at least one entity provided in the model references.
@param modelReferences the classifications to match against
@return a Set containing all the matching services. If there are no solutions, the Set should be empty, not null. | [
"Discover",
"the",
"services",
"that",
"are",
"classified",
"by",
"some",
"(",
"i",
".",
"e",
".",
"at",
"least",
"one",
")",
"of",
"the",
"types",
"given",
".",
"That",
"is",
"all",
"those",
"that",
"have",
"some",
"level",
"of",
"matching",
"with",
"respect",
"to",
"at",
"least",
"one",
"entity",
"provided",
"in",
"the",
"model",
"references",
"."
] | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java#L452-L455 |
thorntail/thorntail | fractions/microprofile/microprofile-jwt/src/main/java/org/wildfly/swarm/microprofile/jwtauth/deployment/auth/JWTAuthMethodExtension.java | JWTAuthMethodExtension.handleDeployment | @Override
public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) {
"""
This registers the JWTAuthMechanismFactory under the "MP-JWT" mechanism name
@param deploymentInfo - the deployment to augment
@param servletContext - the ServletContext for the deployment
"""
deploymentInfo.addAuthenticationMechanism("MP-JWT", new JWTAuthMechanismFactory());
deploymentInfo.addInnerHandlerChainWrapper(MpJwtPrincipalHandler::new);
} | java | @Override
public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) {
deploymentInfo.addAuthenticationMechanism("MP-JWT", new JWTAuthMechanismFactory());
deploymentInfo.addInnerHandlerChainWrapper(MpJwtPrincipalHandler::new);
} | [
"@",
"Override",
"public",
"void",
"handleDeployment",
"(",
"DeploymentInfo",
"deploymentInfo",
",",
"ServletContext",
"servletContext",
")",
"{",
"deploymentInfo",
".",
"addAuthenticationMechanism",
"(",
"\"MP-JWT\"",
",",
"new",
"JWTAuthMechanismFactory",
"(",
")",
")",
";",
"deploymentInfo",
".",
"addInnerHandlerChainWrapper",
"(",
"MpJwtPrincipalHandler",
"::",
"new",
")",
";",
"}"
] | This registers the JWTAuthMechanismFactory under the "MP-JWT" mechanism name
@param deploymentInfo - the deployment to augment
@param servletContext - the ServletContext for the deployment | [
"This",
"registers",
"the",
"JWTAuthMechanismFactory",
"under",
"the",
"MP",
"-",
"JWT",
"mechanism",
"name"
] | train | https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/fractions/microprofile/microprofile-jwt/src/main/java/org/wildfly/swarm/microprofile/jwtauth/deployment/auth/JWTAuthMethodExtension.java#L35-L39 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.beginCreateOrUpdateWorkerPoolAsync | public Observable<WorkerPoolResourceInner> beginCreateOrUpdateWorkerPoolAsync(String resourceGroupName, String name, String workerPoolName, WorkerPoolResourceInner workerPoolEnvelope) {
"""
Create or update a worker pool.
Create or update a worker pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param workerPoolName Name of the worker pool.
@param workerPoolEnvelope Properties of the worker pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkerPoolResourceInner object
"""
return beginCreateOrUpdateWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName, workerPoolEnvelope).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() {
@Override
public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) {
return response.body();
}
});
} | java | public Observable<WorkerPoolResourceInner> beginCreateOrUpdateWorkerPoolAsync(String resourceGroupName, String name, String workerPoolName, WorkerPoolResourceInner workerPoolEnvelope) {
return beginCreateOrUpdateWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName, workerPoolEnvelope).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() {
@Override
public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkerPoolResourceInner",
">",
"beginCreateOrUpdateWorkerPoolAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"String",
"workerPoolName",
",",
"WorkerPoolResourceInner",
"workerPoolEnvelope",
")",
"{",
"return",
"beginCreateOrUpdateWorkerPoolWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"workerPoolName",
",",
"workerPoolEnvelope",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"WorkerPoolResourceInner",
">",
",",
"WorkerPoolResourceInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"WorkerPoolResourceInner",
"call",
"(",
"ServiceResponse",
"<",
"WorkerPoolResourceInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Create or update a worker pool.
Create or update a worker pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param workerPoolName Name of the worker pool.
@param workerPoolEnvelope Properties of the worker pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkerPoolResourceInner object | [
"Create",
"or",
"update",
"a",
"worker",
"pool",
".",
"Create",
"or",
"update",
"a",
"worker",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L5309-L5316 |
nantesnlp/uima-tokens-regex | src/main/java/fr/univnantes/lina/uima/tkregex/model/automata/AutomatonInstance.java | AutomatonInstance.doClone | public AutomatonInstance doClone() {
"""
Creates a clone of the current automatonEng instance for
iteration alternative purposes.
@return
"""
AutomatonInstance clone = new AutomatonInstance(this.automatonEng, this.current, this.instanceId, this.safeGuard);
clone.failed = this.failed;
clone.transitionCount = this.transitionCount;
clone.failCount = this.failCount;
clone.iterateCount = this.iterateCount;
clone.backtrackCount = this.backtrackCount;
clone.trace = new LinkedList<>();
for(StateExploration se:this.trace) {
clone.trace.add(se.doClone());
}
return clone;
} | java | public AutomatonInstance doClone() {
AutomatonInstance clone = new AutomatonInstance(this.automatonEng, this.current, this.instanceId, this.safeGuard);
clone.failed = this.failed;
clone.transitionCount = this.transitionCount;
clone.failCount = this.failCount;
clone.iterateCount = this.iterateCount;
clone.backtrackCount = this.backtrackCount;
clone.trace = new LinkedList<>();
for(StateExploration se:this.trace) {
clone.trace.add(se.doClone());
}
return clone;
} | [
"public",
"AutomatonInstance",
"doClone",
"(",
")",
"{",
"AutomatonInstance",
"clone",
"=",
"new",
"AutomatonInstance",
"(",
"this",
".",
"automatonEng",
",",
"this",
".",
"current",
",",
"this",
".",
"instanceId",
",",
"this",
".",
"safeGuard",
")",
";",
"clone",
".",
"failed",
"=",
"this",
".",
"failed",
";",
"clone",
".",
"transitionCount",
"=",
"this",
".",
"transitionCount",
";",
"clone",
".",
"failCount",
"=",
"this",
".",
"failCount",
";",
"clone",
".",
"iterateCount",
"=",
"this",
".",
"iterateCount",
";",
"clone",
".",
"backtrackCount",
"=",
"this",
".",
"backtrackCount",
";",
"clone",
".",
"trace",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"for",
"(",
"StateExploration",
"se",
":",
"this",
".",
"trace",
")",
"{",
"clone",
".",
"trace",
".",
"add",
"(",
"se",
".",
"doClone",
"(",
")",
")",
";",
"}",
"return",
"clone",
";",
"}"
] | Creates a clone of the current automatonEng instance for
iteration alternative purposes.
@return | [
"Creates",
"a",
"clone",
"of",
"the",
"current",
"automatonEng",
"instance",
"for",
"iteration",
"alternative",
"purposes",
"."
] | train | https://github.com/nantesnlp/uima-tokens-regex/blob/15c97c09007af9c33c7bddf8e74d5829d04623e2/src/main/java/fr/univnantes/lina/uima/tkregex/model/automata/AutomatonInstance.java#L74-L86 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.readIdForUrlName | public CmsUUID readIdForUrlName(CmsDbContext dbc, String name) throws CmsDataAccessException {
"""
Reads the structure id which is mapped to a given URL name.<p>
@param dbc the current database context
@param name the name for which the mapped structure id should be looked up
@return the structure id which is mapped to the given name, or null if there is no such id
@throws CmsDataAccessException if something goes wrong
"""
List<CmsUrlNameMappingEntry> entries = getVfsDriver(dbc).readUrlNameMappingEntries(
dbc,
dbc.currentProject().isOnlineProject(),
CmsUrlNameMappingFilter.ALL.filterName(name));
if (entries.isEmpty()) {
return null;
}
return entries.get(0).getStructureId();
} | java | public CmsUUID readIdForUrlName(CmsDbContext dbc, String name) throws CmsDataAccessException {
List<CmsUrlNameMappingEntry> entries = getVfsDriver(dbc).readUrlNameMappingEntries(
dbc,
dbc.currentProject().isOnlineProject(),
CmsUrlNameMappingFilter.ALL.filterName(name));
if (entries.isEmpty()) {
return null;
}
return entries.get(0).getStructureId();
} | [
"public",
"CmsUUID",
"readIdForUrlName",
"(",
"CmsDbContext",
"dbc",
",",
"String",
"name",
")",
"throws",
"CmsDataAccessException",
"{",
"List",
"<",
"CmsUrlNameMappingEntry",
">",
"entries",
"=",
"getVfsDriver",
"(",
"dbc",
")",
".",
"readUrlNameMappingEntries",
"(",
"dbc",
",",
"dbc",
".",
"currentProject",
"(",
")",
".",
"isOnlineProject",
"(",
")",
",",
"CmsUrlNameMappingFilter",
".",
"ALL",
".",
"filterName",
"(",
"name",
")",
")",
";",
"if",
"(",
"entries",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"entries",
".",
"get",
"(",
"0",
")",
".",
"getStructureId",
"(",
")",
";",
"}"
] | Reads the structure id which is mapped to a given URL name.<p>
@param dbc the current database context
@param name the name for which the mapped structure id should be looked up
@return the structure id which is mapped to the given name, or null if there is no such id
@throws CmsDataAccessException if something goes wrong | [
"Reads",
"the",
"structure",
"id",
"which",
"is",
"mapped",
"to",
"a",
"given",
"URL",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L7014-L7024 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.endOfWeek | public static Calendar endOfWeek(Calendar calendar, boolean isSundayAsLastDay) {
"""
获取某周的结束时间
@param calendar 日期 {@link Calendar}
@param isSundayAsLastDay 是否周日做为一周的最后一天(false表示周六做为最后一天)
@return {@link Calendar}
@since 3.1.2
"""
if(isSundayAsLastDay) {
calendar.setFirstDayOfWeek(Calendar.MONDAY);
}
return ceiling(calendar, DateField.WEEK_OF_MONTH);
} | java | public static Calendar endOfWeek(Calendar calendar, boolean isSundayAsLastDay) {
if(isSundayAsLastDay) {
calendar.setFirstDayOfWeek(Calendar.MONDAY);
}
return ceiling(calendar, DateField.WEEK_OF_MONTH);
} | [
"public",
"static",
"Calendar",
"endOfWeek",
"(",
"Calendar",
"calendar",
",",
"boolean",
"isSundayAsLastDay",
")",
"{",
"if",
"(",
"isSundayAsLastDay",
")",
"{",
"calendar",
".",
"setFirstDayOfWeek",
"(",
"Calendar",
".",
"MONDAY",
")",
";",
"}",
"return",
"ceiling",
"(",
"calendar",
",",
"DateField",
".",
"WEEK_OF_MONTH",
")",
";",
"}"
] | 获取某周的结束时间
@param calendar 日期 {@link Calendar}
@param isSundayAsLastDay 是否周日做为一周的最后一天(false表示周六做为最后一天)
@return {@link Calendar}
@since 3.1.2 | [
"获取某周的结束时间"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L922-L927 |
opendigitaleducation/web-utils | src/main/java/org/vertx/java/core/http/RouteMatcher.java | RouteMatcher.connectWithRegEx | public RouteMatcher connectWithRegEx(String regex, Handler<HttpServerRequest> handler) {
"""
Specify a handler that will be called for a matching HTTP CONNECT
@param regex A regular expression
@param handler The handler to call
"""
addRegEx(regex, handler, connectBindings);
return this;
} | java | public RouteMatcher connectWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, connectBindings);
return this;
} | [
"public",
"RouteMatcher",
"connectWithRegEx",
"(",
"String",
"regex",
",",
"Handler",
"<",
"HttpServerRequest",
">",
"handler",
")",
"{",
"addRegEx",
"(",
"regex",
",",
"handler",
",",
"connectBindings",
")",
";",
"return",
"this",
";",
"}"
] | Specify a handler that will be called for a matching HTTP CONNECT
@param regex A regular expression
@param handler The handler to call | [
"Specify",
"a",
"handler",
"that",
"will",
"be",
"called",
"for",
"a",
"matching",
"HTTP",
"CONNECT"
] | train | https://github.com/opendigitaleducation/web-utils/blob/5c12f7e8781a9a0fbbe7b8d9fb741627aa97a1e3/src/main/java/org/vertx/java/core/http/RouteMatcher.java#L279-L282 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseClient.java | LicenseClient.insertLicense | @BetaApi
public final Operation insertLicense(ProjectName project, License licenseResource) {
"""
Create a License resource in the specified project.
<p>Sample code:
<pre><code>
try (LicenseClient licenseClient = LicenseClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
License licenseResource = License.newBuilder().build();
Operation response = licenseClient.insertLicense(project, licenseResource);
}
</code></pre>
@param project Project ID for this request.
@param licenseResource A license resource.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
"""
InsertLicenseHttpRequest request =
InsertLicenseHttpRequest.newBuilder()
.setProject(project == null ? null : project.toString())
.setLicenseResource(licenseResource)
.build();
return insertLicense(request);
} | java | @BetaApi
public final Operation insertLicense(ProjectName project, License licenseResource) {
InsertLicenseHttpRequest request =
InsertLicenseHttpRequest.newBuilder()
.setProject(project == null ? null : project.toString())
.setLicenseResource(licenseResource)
.build();
return insertLicense(request);
} | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"insertLicense",
"(",
"ProjectName",
"project",
",",
"License",
"licenseResource",
")",
"{",
"InsertLicenseHttpRequest",
"request",
"=",
"InsertLicenseHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setProject",
"(",
"project",
"==",
"null",
"?",
"null",
":",
"project",
".",
"toString",
"(",
")",
")",
".",
"setLicenseResource",
"(",
"licenseResource",
")",
".",
"build",
"(",
")",
";",
"return",
"insertLicense",
"(",
"request",
")",
";",
"}"
] | Create a License resource in the specified project.
<p>Sample code:
<pre><code>
try (LicenseClient licenseClient = LicenseClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
License licenseResource = License.newBuilder().build();
Operation response = licenseClient.insertLicense(project, licenseResource);
}
</code></pre>
@param project Project ID for this request.
@param licenseResource A license resource.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Create",
"a",
"License",
"resource",
"in",
"the",
"specified",
"project",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseClient.java#L466-L475 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java | JsonObject.getString | public String getString(String name, String defaultValue) {
"""
Returns the <code>String</code> value of the member with the specified name in this object. If
this object does not contain a member with this name, the given default value is returned. If
this object contains multiple members with the given name, the last one is picked. If this
member's value does not represent a JSON string, an exception is thrown.
@param name
the name of the member whose value is to be returned
@param defaultValue
the value to be returned if the requested member is missing
@return the value of the last member with the specified name, or the given default value if
this object does not contain a member with that name
"""
JsonValue value = get(name);
return value != null ? value.asString() : defaultValue;
} | java | public String getString(String name, String defaultValue) {
JsonValue value = get(name);
return value != null ? value.asString() : defaultValue;
} | [
"public",
"String",
"getString",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"JsonValue",
"value",
"=",
"get",
"(",
"name",
")",
";",
"return",
"value",
"!=",
"null",
"?",
"value",
".",
"asString",
"(",
")",
":",
"defaultValue",
";",
"}"
] | Returns the <code>String</code> value of the member with the specified name in this object. If
this object does not contain a member with this name, the given default value is returned. If
this object contains multiple members with the given name, the last one is picked. If this
member's value does not represent a JSON string, an exception is thrown.
@param name
the name of the member whose value is to be returned
@param defaultValue
the value to be returned if the requested member is missing
@return the value of the last member with the specified name, or the given default value if
this object does not contain a member with that name | [
"Returns",
"the",
"<code",
">",
"String<",
"/",
"code",
">",
"value",
"of",
"the",
"member",
"with",
"the",
"specified",
"name",
"in",
"this",
"object",
".",
"If",
"this",
"object",
"does",
"not",
"contain",
"a",
"member",
"with",
"this",
"name",
"the",
"given",
"default",
"value",
"is",
"returned",
".",
"If",
"this",
"object",
"contains",
"multiple",
"members",
"with",
"the",
"given",
"name",
"the",
"last",
"one",
"is",
"picked",
".",
"If",
"this",
"member",
"s",
"value",
"does",
"not",
"represent",
"a",
"JSON",
"string",
"an",
"exception",
"is",
"thrown",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java#L675-L678 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsSitemapToolbar.java | CmsSitemapToolbar.setClipboardEnabled | public void setClipboardEnabled(boolean enabled, String disabledReason) {
"""
Enables/disables the new clipboard button.<p>
@param enabled <code>true</code> to enable the button
@param disabledReason the reason, why the button is disabled
"""
if (m_clipboardButton != null) {
if (enabled) {
m_clipboardButton.enable();
} else {
m_clipboardButton.disable(disabledReason);
}
}
} | java | public void setClipboardEnabled(boolean enabled, String disabledReason) {
if (m_clipboardButton != null) {
if (enabled) {
m_clipboardButton.enable();
} else {
m_clipboardButton.disable(disabledReason);
}
}
} | [
"public",
"void",
"setClipboardEnabled",
"(",
"boolean",
"enabled",
",",
"String",
"disabledReason",
")",
"{",
"if",
"(",
"m_clipboardButton",
"!=",
"null",
")",
"{",
"if",
"(",
"enabled",
")",
"{",
"m_clipboardButton",
".",
"enable",
"(",
")",
";",
"}",
"else",
"{",
"m_clipboardButton",
".",
"disable",
"(",
"disabledReason",
")",
";",
"}",
"}",
"}"
] | Enables/disables the new clipboard button.<p>
@param enabled <code>true</code> to enable the button
@param disabledReason the reason, why the button is disabled | [
"Enables",
"/",
"disables",
"the",
"new",
"clipboard",
"button",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsSitemapToolbar.java#L192-L201 |
craftercms/core | src/main/java/org/craftercms/core/xml/mergers/impl/resolvers/DescriptorMergeStrategyResolverChain.java | DescriptorMergeStrategyResolverChain.getStrategy | public DescriptorMergeStrategy getStrategy(String descriptorUrl, Document descriptorDom) {
"""
Returns the first non-null strategy returned by a {@link DescriptorMergeStrategyResolver} of the chain.
If there a no resolvers in the chain, or non of resolvers returns a {@link DescriptorMergeStrategy}, a
default strategy is returned.
@param descriptorUrl the URL that identifies the descriptor
@param descriptorDom the XML DOM of the descriptor
@return the first non-null strategy returned by a {@link DescriptorMergeStrategyResolver} of the chain,
or a default one if all the resolvers returned null.
"""
DescriptorMergeStrategy strategy;
if (CollectionUtils.isNotEmpty(resolvers)) {
for (DescriptorMergeStrategyResolver resolver : resolvers) {
strategy = resolver.getStrategy(descriptorUrl, descriptorDom);
if (strategy != null) {
return strategy;
}
}
}
return defaultStrategy;
} | java | public DescriptorMergeStrategy getStrategy(String descriptorUrl, Document descriptorDom) {
DescriptorMergeStrategy strategy;
if (CollectionUtils.isNotEmpty(resolvers)) {
for (DescriptorMergeStrategyResolver resolver : resolvers) {
strategy = resolver.getStrategy(descriptorUrl, descriptorDom);
if (strategy != null) {
return strategy;
}
}
}
return defaultStrategy;
} | [
"public",
"DescriptorMergeStrategy",
"getStrategy",
"(",
"String",
"descriptorUrl",
",",
"Document",
"descriptorDom",
")",
"{",
"DescriptorMergeStrategy",
"strategy",
";",
"if",
"(",
"CollectionUtils",
".",
"isNotEmpty",
"(",
"resolvers",
")",
")",
"{",
"for",
"(",
"DescriptorMergeStrategyResolver",
"resolver",
":",
"resolvers",
")",
"{",
"strategy",
"=",
"resolver",
".",
"getStrategy",
"(",
"descriptorUrl",
",",
"descriptorDom",
")",
";",
"if",
"(",
"strategy",
"!=",
"null",
")",
"{",
"return",
"strategy",
";",
"}",
"}",
"}",
"return",
"defaultStrategy",
";",
"}"
] | Returns the first non-null strategy returned by a {@link DescriptorMergeStrategyResolver} of the chain.
If there a no resolvers in the chain, or non of resolvers returns a {@link DescriptorMergeStrategy}, a
default strategy is returned.
@param descriptorUrl the URL that identifies the descriptor
@param descriptorDom the XML DOM of the descriptor
@return the first non-null strategy returned by a {@link DescriptorMergeStrategyResolver} of the chain,
or a default one if all the resolvers returned null. | [
"Returns",
"the",
"first",
"non",
"-",
"null",
"strategy",
"returned",
"by",
"a",
"{",
"@link",
"DescriptorMergeStrategyResolver",
"}",
"of",
"the",
"chain",
".",
"If",
"there",
"a",
"no",
"resolvers",
"in",
"the",
"chain",
"or",
"non",
"of",
"resolvers",
"returns",
"a",
"{",
"@link",
"DescriptorMergeStrategy",
"}",
"a",
"default",
"strategy",
"is",
"returned",
"."
] | train | https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/xml/mergers/impl/resolvers/DescriptorMergeStrategyResolverChain.java#L57-L70 |
Nexmo/nexmo-java | src/main/java/com/nexmo/client/insight/InsightClient.java | InsightClient.getAdvancedNumberInsight | public AdvancedInsightResponse getAdvancedNumberInsight(String number, String country) throws IOException, NexmoClientException {
"""
Perform an Advanced Insight Request with a number and country.
@param number A single phone number that you need insight about in national or international format.
@param country If a number does not have a country code or it is uncertain, set the two-character country code.
@return A {@link AdvancedInsightResponse} representing the response from the Nexmo Number Insight API.
@throws IOException if a network error occurred contacting the Nexmo Nexmo Number Insight API.
@throws NexmoClientException if there was a problem with the Nexmo request or response objects.
"""
return getAdvancedNumberInsight(AdvancedInsightRequest.withNumberAndCountry(number, country));
} | java | public AdvancedInsightResponse getAdvancedNumberInsight(String number, String country) throws IOException, NexmoClientException {
return getAdvancedNumberInsight(AdvancedInsightRequest.withNumberAndCountry(number, country));
} | [
"public",
"AdvancedInsightResponse",
"getAdvancedNumberInsight",
"(",
"String",
"number",
",",
"String",
"country",
")",
"throws",
"IOException",
",",
"NexmoClientException",
"{",
"return",
"getAdvancedNumberInsight",
"(",
"AdvancedInsightRequest",
".",
"withNumberAndCountry",
"(",
"number",
",",
"country",
")",
")",
";",
"}"
] | Perform an Advanced Insight Request with a number and country.
@param number A single phone number that you need insight about in national or international format.
@param country If a number does not have a country code or it is uncertain, set the two-character country code.
@return A {@link AdvancedInsightResponse} representing the response from the Nexmo Number Insight API.
@throws IOException if a network error occurred contacting the Nexmo Nexmo Number Insight API.
@throws NexmoClientException if there was a problem with the Nexmo request or response objects. | [
"Perform",
"an",
"Advanced",
"Insight",
"Request",
"with",
"a",
"number",
"and",
"country",
"."
] | train | https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/insight/InsightClient.java#L184-L186 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RegistriesInner.java | RegistriesInner.scheduleRun | public RunInner scheduleRun(String resourceGroupName, String registryName, RunRequest runRequest) {
"""
Schedules a new run based on the request parameters and add it to the run queue.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param runRequest The parameters of a run that needs to scheduled.
@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 RunInner object if successful.
"""
return scheduleRunWithServiceResponseAsync(resourceGroupName, registryName, runRequest).toBlocking().last().body();
} | java | public RunInner scheduleRun(String resourceGroupName, String registryName, RunRequest runRequest) {
return scheduleRunWithServiceResponseAsync(resourceGroupName, registryName, runRequest).toBlocking().last().body();
} | [
"public",
"RunInner",
"scheduleRun",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"RunRequest",
"runRequest",
")",
"{",
"return",
"scheduleRunWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"runRequest",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Schedules a new run based on the request parameters and add it to the run queue.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param runRequest The parameters of a run that needs to scheduled.
@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 RunInner object if successful. | [
"Schedules",
"a",
"new",
"run",
"based",
"on",
"the",
"request",
"parameters",
"and",
"add",
"it",
"to",
"the",
"run",
"queue",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RegistriesInner.java#L1727-L1729 |
biojava/biojava | biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MultipleAlignmentJmolDisplay.java | MultipleAlignmentJmolDisplay.showMultipleAligmentPanel | public static void showMultipleAligmentPanel(MultipleAlignment multAln,
AbstractAlignmentJmol jmol) throws StructureException {
"""
Creates a new Frame with the MultipleAlignment Sequence Panel.
The panel can communicate with the Jmol 3D visualization by
selecting the aligned residues of every structure.
@param multAln
@param jmol
@throws StructureException
"""
MultipleAligPanel me = new MultipleAligPanel(multAln, jmol);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setTitle(jmol.getTitle());
me.setPreferredSize(new Dimension(
me.getCoordManager().getPreferredWidth() ,
me.getCoordManager().getPreferredHeight()));
JMenuBar menu = MenuCreator.getAlignmentPanelMenu(
frame,me,null, multAln);
frame.setJMenuBar(menu);
JScrollPane scroll = new JScrollPane(me);
scroll.setAutoscrolls(true);
MultipleStatusDisplay status = new MultipleStatusDisplay(me);
me.addAlignmentPositionListener(status);
Box vBox = Box.createVerticalBox();
vBox.add(scroll);
vBox.add(status);
frame.getContentPane().add(vBox);
frame.pack();
frame.setVisible(true);
frame.addWindowListener(me);
frame.addWindowListener(status);
} | java | public static void showMultipleAligmentPanel(MultipleAlignment multAln,
AbstractAlignmentJmol jmol) throws StructureException {
MultipleAligPanel me = new MultipleAligPanel(multAln, jmol);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setTitle(jmol.getTitle());
me.setPreferredSize(new Dimension(
me.getCoordManager().getPreferredWidth() ,
me.getCoordManager().getPreferredHeight()));
JMenuBar menu = MenuCreator.getAlignmentPanelMenu(
frame,me,null, multAln);
frame.setJMenuBar(menu);
JScrollPane scroll = new JScrollPane(me);
scroll.setAutoscrolls(true);
MultipleStatusDisplay status = new MultipleStatusDisplay(me);
me.addAlignmentPositionListener(status);
Box vBox = Box.createVerticalBox();
vBox.add(scroll);
vBox.add(status);
frame.getContentPane().add(vBox);
frame.pack();
frame.setVisible(true);
frame.addWindowListener(me);
frame.addWindowListener(status);
} | [
"public",
"static",
"void",
"showMultipleAligmentPanel",
"(",
"MultipleAlignment",
"multAln",
",",
"AbstractAlignmentJmol",
"jmol",
")",
"throws",
"StructureException",
"{",
"MultipleAligPanel",
"me",
"=",
"new",
"MultipleAligPanel",
"(",
"multAln",
",",
"jmol",
")",
";",
"JFrame",
"frame",
"=",
"new",
"JFrame",
"(",
")",
";",
"frame",
".",
"setDefaultCloseOperation",
"(",
"JFrame",
".",
"DISPOSE_ON_CLOSE",
")",
";",
"frame",
".",
"setTitle",
"(",
"jmol",
".",
"getTitle",
"(",
")",
")",
";",
"me",
".",
"setPreferredSize",
"(",
"new",
"Dimension",
"(",
"me",
".",
"getCoordManager",
"(",
")",
".",
"getPreferredWidth",
"(",
")",
",",
"me",
".",
"getCoordManager",
"(",
")",
".",
"getPreferredHeight",
"(",
")",
")",
")",
";",
"JMenuBar",
"menu",
"=",
"MenuCreator",
".",
"getAlignmentPanelMenu",
"(",
"frame",
",",
"me",
",",
"null",
",",
"multAln",
")",
";",
"frame",
".",
"setJMenuBar",
"(",
"menu",
")",
";",
"JScrollPane",
"scroll",
"=",
"new",
"JScrollPane",
"(",
"me",
")",
";",
"scroll",
".",
"setAutoscrolls",
"(",
"true",
")",
";",
"MultipleStatusDisplay",
"status",
"=",
"new",
"MultipleStatusDisplay",
"(",
"me",
")",
";",
"me",
".",
"addAlignmentPositionListener",
"(",
"status",
")",
";",
"Box",
"vBox",
"=",
"Box",
".",
"createVerticalBox",
"(",
")",
";",
"vBox",
".",
"add",
"(",
"scroll",
")",
";",
"vBox",
".",
"add",
"(",
"status",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"vBox",
")",
";",
"frame",
".",
"pack",
"(",
")",
";",
"frame",
".",
"setVisible",
"(",
"true",
")",
";",
"frame",
".",
"addWindowListener",
"(",
"me",
")",
";",
"frame",
".",
"addWindowListener",
"(",
"status",
")",
";",
"}"
] | Creates a new Frame with the MultipleAlignment Sequence Panel.
The panel can communicate with the Jmol 3D visualization by
selecting the aligned residues of every structure.
@param multAln
@param jmol
@throws StructureException | [
"Creates",
"a",
"new",
"Frame",
"with",
"the",
"MultipleAlignment",
"Sequence",
"Panel",
".",
"The",
"panel",
"can",
"communicate",
"with",
"the",
"Jmol",
"3D",
"visualization",
"by",
"selecting",
"the",
"aligned",
"residues",
"of",
"every",
"structure",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MultipleAlignmentJmolDisplay.java#L105-L137 |
JOML-CI/JOML | src/org/joml/Quaternionf.java | Quaternionf.fromAxisAngleDeg | public Quaternionf fromAxisAngleDeg(Vector3fc axis, float angle) {
"""
Set this quaternion to be a representation of the supplied axis and
angle (in degrees).
@param axis
the rotation axis
@param angle
the angle in degrees
@return this
"""
return fromAxisAngleRad(axis.x(), axis.y(), axis.z(), (float) Math.toRadians(angle));
} | java | public Quaternionf fromAxisAngleDeg(Vector3fc axis, float angle) {
return fromAxisAngleRad(axis.x(), axis.y(), axis.z(), (float) Math.toRadians(angle));
} | [
"public",
"Quaternionf",
"fromAxisAngleDeg",
"(",
"Vector3fc",
"axis",
",",
"float",
"angle",
")",
"{",
"return",
"fromAxisAngleRad",
"(",
"axis",
".",
"x",
"(",
")",
",",
"axis",
".",
"y",
"(",
")",
",",
"axis",
".",
"z",
"(",
")",
",",
"(",
"float",
")",
"Math",
".",
"toRadians",
"(",
"angle",
")",
")",
";",
"}"
] | Set this quaternion to be a representation of the supplied axis and
angle (in degrees).
@param axis
the rotation axis
@param angle
the angle in degrees
@return this | [
"Set",
"this",
"quaternion",
"to",
"be",
"a",
"representation",
"of",
"the",
"supplied",
"axis",
"and",
"angle",
"(",
"in",
"degrees",
")",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaternionf.java#L920-L922 |
authlete/authlete-java-common | src/main/java/com/authlete/common/util/Utils.java | Utils.fromJson | public static <T> T fromJson(String json, Class<T> klass) {
"""
Convert the given JSON string into an object using
<a href="https://github.com/google/gson">Gson</a>.
@param json
The input JSON.
@param klass
The class of the resultant object.
@return
A new object generated based on the input JSON.
@since 2.0
"""
return GSON.fromJson(json, klass);
} | java | public static <T> T fromJson(String json, Class<T> klass)
{
return GSON.fromJson(json, klass);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"fromJson",
"(",
"String",
"json",
",",
"Class",
"<",
"T",
">",
"klass",
")",
"{",
"return",
"GSON",
".",
"fromJson",
"(",
"json",
",",
"klass",
")",
";",
"}"
] | Convert the given JSON string into an object using
<a href="https://github.com/google/gson">Gson</a>.
@param json
The input JSON.
@param klass
The class of the resultant object.
@return
A new object generated based on the input JSON.
@since 2.0 | [
"Convert",
"the",
"given",
"JSON",
"string",
"into",
"an",
"object",
"using",
"<a",
"href",
"=",
"https",
":",
"//",
"github",
".",
"com",
"/",
"google",
"/",
"gson",
">",
"Gson<",
"/",
"a",
">",
"."
] | train | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/Utils.java#L157-L160 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java | BlobContainersInner.listAsync | public Observable<ListContainerItemsInner> listAsync(String resourceGroupName, String accountName) {
"""
Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ListContainerItemsInner object
"""
return listWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<ListContainerItemsInner>, ListContainerItemsInner>() {
@Override
public ListContainerItemsInner call(ServiceResponse<ListContainerItemsInner> response) {
return response.body();
}
});
} | java | public Observable<ListContainerItemsInner> listAsync(String resourceGroupName, String accountName) {
return listWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<ListContainerItemsInner>, ListContainerItemsInner>() {
@Override
public ListContainerItemsInner call(ServiceResponse<ListContainerItemsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ListContainerItemsInner",
">",
"listAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ListContainerItemsInner",
">",
",",
"ListContainerItemsInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ListContainerItemsInner",
"call",
"(",
"ServiceResponse",
"<",
"ListContainerItemsInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ListContainerItemsInner object | [
"Lists",
"all",
"containers",
"and",
"does",
"not",
"support",
"a",
"prefix",
"like",
"data",
"plane",
".",
"Also",
"SRP",
"today",
"does",
"not",
"return",
"continuation",
"token",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L154-L161 |
mgormley/prim | src/main/java_generated/edu/jhu/prim/vector/IntLongDenseVector.java | IntLongDenseVector.add | public void add(IntLongVector other) {
"""
Updates this vector to be the entrywise sum of this vector with the other.
"""
if (other instanceof IntLongUnsortedVector) {
IntLongUnsortedVector vec = (IntLongUnsortedVector) other;
for (int i=0; i<vec.top; i++) {
this.add(vec.idx[i], vec.vals[i]);
}
} else {
// TODO: Add special case for IntLongDenseVector.
other.iterate(new SparseBinaryOpApplier(this, new Lambda.LongAdd()));
}
} | java | public void add(IntLongVector other) {
if (other instanceof IntLongUnsortedVector) {
IntLongUnsortedVector vec = (IntLongUnsortedVector) other;
for (int i=0; i<vec.top; i++) {
this.add(vec.idx[i], vec.vals[i]);
}
} else {
// TODO: Add special case for IntLongDenseVector.
other.iterate(new SparseBinaryOpApplier(this, new Lambda.LongAdd()));
}
} | [
"public",
"void",
"add",
"(",
"IntLongVector",
"other",
")",
"{",
"if",
"(",
"other",
"instanceof",
"IntLongUnsortedVector",
")",
"{",
"IntLongUnsortedVector",
"vec",
"=",
"(",
"IntLongUnsortedVector",
")",
"other",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"vec",
".",
"top",
";",
"i",
"++",
")",
"{",
"this",
".",
"add",
"(",
"vec",
".",
"idx",
"[",
"i",
"]",
",",
"vec",
".",
"vals",
"[",
"i",
"]",
")",
";",
"}",
"}",
"else",
"{",
"// TODO: Add special case for IntLongDenseVector.",
"other",
".",
"iterate",
"(",
"new",
"SparseBinaryOpApplier",
"(",
"this",
",",
"new",
"Lambda",
".",
"LongAdd",
"(",
")",
")",
")",
";",
"}",
"}"
] | Updates this vector to be the entrywise sum of this vector with the other. | [
"Updates",
"this",
"vector",
"to",
"be",
"the",
"entrywise",
"sum",
"of",
"this",
"vector",
"with",
"the",
"other",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/vector/IntLongDenseVector.java#L143-L153 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java | MapExtensions.operator_minus | @Pure
public static <K, V> Map<K, V> operator_minus(Map<K, V> left, final Pair<? extends K, ? extends V> right) {
"""
Remove the given pair from a given map for obtaining a new map.
<p>
If the given key is inside the map, but is not mapped to the given value, the
map will not be changed.
</p>
<p>
The replied map is a view on the given map. It means that any change
in the original map is reflected to the result of this operation.
</p>
@param <K> type of the map keys.
@param <V> type of the map values.
@param left the map to consider.
@param right the entry (key, value) to remove from the map.
@return an immutable map with the content of the map and with the given entry.
@throws IllegalArgumentException - when the right operand key exists in the left operand.
@since 2.15
"""
return Maps.filterEntries(left, new Predicate<Entry<K, V>>() {
@Override
public boolean apply(Entry<K, V> input) {
return !Objects.equal(input.getKey(), right.getKey()) || !Objects.equal(input.getValue(), right.getValue());
}
});
} | java | @Pure
public static <K, V> Map<K, V> operator_minus(Map<K, V> left, final Pair<? extends K, ? extends V> right) {
return Maps.filterEntries(left, new Predicate<Entry<K, V>>() {
@Override
public boolean apply(Entry<K, V> input) {
return !Objects.equal(input.getKey(), right.getKey()) || !Objects.equal(input.getValue(), right.getValue());
}
});
} | [
"@",
"Pure",
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"operator_minus",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"left",
",",
"final",
"Pair",
"<",
"?",
"extends",
"K",
",",
"?",
"extends",
"V",
">",
"right",
")",
"{",
"return",
"Maps",
".",
"filterEntries",
"(",
"left",
",",
"new",
"Predicate",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"apply",
"(",
"Entry",
"<",
"K",
",",
"V",
">",
"input",
")",
"{",
"return",
"!",
"Objects",
".",
"equal",
"(",
"input",
".",
"getKey",
"(",
")",
",",
"right",
".",
"getKey",
"(",
")",
")",
"||",
"!",
"Objects",
".",
"equal",
"(",
"input",
".",
"getValue",
"(",
")",
",",
"right",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] | Remove the given pair from a given map for obtaining a new map.
<p>
If the given key is inside the map, but is not mapped to the given value, the
map will not be changed.
</p>
<p>
The replied map is a view on the given map. It means that any change
in the original map is reflected to the result of this operation.
</p>
@param <K> type of the map keys.
@param <V> type of the map values.
@param left the map to consider.
@param right the entry (key, value) to remove from the map.
@return an immutable map with the content of the map and with the given entry.
@throws IllegalArgumentException - when the right operand key exists in the left operand.
@since 2.15 | [
"Remove",
"the",
"given",
"pair",
"from",
"a",
"given",
"map",
"for",
"obtaining",
"a",
"new",
"map",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java#L275-L283 |
LAW-Unimi/BUbiNG | src/it/unimi/di/law/bubing/util/Util.java | Util.writeVByte | public static int writeVByte(final int x, final OutputStream os) throws IOException {
"""
Encodes a natural number to an {@link OutputStream} using vByte.
@param x a natural number.
@param os an output stream.
@return the number of bytes written.
"""
if (x < (1 << 7)) {
os.write(x);
return 1;
}
if (x < (1 << 14)) {
os.write((x >>> 7 | 0x80));
os.write(x & 0x7F);
return 2;
}
if (x < (1 << 21)) {
os.write((x >>> 14 | 0x80));
os.write((x >>> 7 | 0x80));
os.write(x & 0x7F);
return 3;
}
if (x < (1 << 28)) {
os.write((x >>> 21 | 0x80));
os.write((x >>> 14 | 0x80));
os.write((x >>> 7 | 0x80));
os.write(x & 0x7F);
return 4;
}
os.write((x >>> 28 | 0x80));
os.write((x >>> 21 | 0x80));
os.write((x >>> 14 | 0x80));
os.write((x >>> 7 | 0x80));
os.write(x & 0x7F);
return 5;
} | java | public static int writeVByte(final int x, final OutputStream os) throws IOException {
if (x < (1 << 7)) {
os.write(x);
return 1;
}
if (x < (1 << 14)) {
os.write((x >>> 7 | 0x80));
os.write(x & 0x7F);
return 2;
}
if (x < (1 << 21)) {
os.write((x >>> 14 | 0x80));
os.write((x >>> 7 | 0x80));
os.write(x & 0x7F);
return 3;
}
if (x < (1 << 28)) {
os.write((x >>> 21 | 0x80));
os.write((x >>> 14 | 0x80));
os.write((x >>> 7 | 0x80));
os.write(x & 0x7F);
return 4;
}
os.write((x >>> 28 | 0x80));
os.write((x >>> 21 | 0x80));
os.write((x >>> 14 | 0x80));
os.write((x >>> 7 | 0x80));
os.write(x & 0x7F);
return 5;
} | [
"public",
"static",
"int",
"writeVByte",
"(",
"final",
"int",
"x",
",",
"final",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"if",
"(",
"x",
"<",
"(",
"1",
"<<",
"7",
")",
")",
"{",
"os",
".",
"write",
"(",
"x",
")",
";",
"return",
"1",
";",
"}",
"if",
"(",
"x",
"<",
"(",
"1",
"<<",
"14",
")",
")",
"{",
"os",
".",
"write",
"(",
"(",
"x",
">>>",
"7",
"|",
"0x80",
")",
")",
";",
"os",
".",
"write",
"(",
"x",
"&",
"0x7F",
")",
";",
"return",
"2",
";",
"}",
"if",
"(",
"x",
"<",
"(",
"1",
"<<",
"21",
")",
")",
"{",
"os",
".",
"write",
"(",
"(",
"x",
">>>",
"14",
"|",
"0x80",
")",
")",
";",
"os",
".",
"write",
"(",
"(",
"x",
">>>",
"7",
"|",
"0x80",
")",
")",
";",
"os",
".",
"write",
"(",
"x",
"&",
"0x7F",
")",
";",
"return",
"3",
";",
"}",
"if",
"(",
"x",
"<",
"(",
"1",
"<<",
"28",
")",
")",
"{",
"os",
".",
"write",
"(",
"(",
"x",
">>>",
"21",
"|",
"0x80",
")",
")",
";",
"os",
".",
"write",
"(",
"(",
"x",
">>>",
"14",
"|",
"0x80",
")",
")",
";",
"os",
".",
"write",
"(",
"(",
"x",
">>>",
"7",
"|",
"0x80",
")",
")",
";",
"os",
".",
"write",
"(",
"x",
"&",
"0x7F",
")",
";",
"return",
"4",
";",
"}",
"os",
".",
"write",
"(",
"(",
"x",
">>>",
"28",
"|",
"0x80",
")",
")",
";",
"os",
".",
"write",
"(",
"(",
"x",
">>>",
"21",
"|",
"0x80",
")",
")",
";",
"os",
".",
"write",
"(",
"(",
"x",
">>>",
"14",
"|",
"0x80",
")",
")",
";",
"os",
".",
"write",
"(",
"(",
"x",
">>>",
"7",
"|",
"0x80",
")",
")",
";",
"os",
".",
"write",
"(",
"x",
"&",
"0x7F",
")",
";",
"return",
"5",
";",
"}"
] | Encodes a natural number to an {@link OutputStream} using vByte.
@param x a natural number.
@param os an output stream.
@return the number of bytes written. | [
"Encodes",
"a",
"natural",
"number",
"to",
"an",
"{",
"@link",
"OutputStream",
"}",
"using",
"vByte",
"."
] | train | https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/Util.java#L113-L146 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java | VersionsImpl.listAsync | public Observable<List<VersionInfo>> listAsync(UUID appId, ListVersionsOptionalParameter listOptionalParameter) {
"""
Gets the application versions info.
@param appId The application ID.
@param listOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<VersionInfo> object
"""
return listWithServiceResponseAsync(appId, listOptionalParameter).map(new Func1<ServiceResponse<List<VersionInfo>>, List<VersionInfo>>() {
@Override
public List<VersionInfo> call(ServiceResponse<List<VersionInfo>> response) {
return response.body();
}
});
} | java | public Observable<List<VersionInfo>> listAsync(UUID appId, ListVersionsOptionalParameter listOptionalParameter) {
return listWithServiceResponseAsync(appId, listOptionalParameter).map(new Func1<ServiceResponse<List<VersionInfo>>, List<VersionInfo>>() {
@Override
public List<VersionInfo> call(ServiceResponse<List<VersionInfo>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"VersionInfo",
">",
">",
"listAsync",
"(",
"UUID",
"appId",
",",
"ListVersionsOptionalParameter",
"listOptionalParameter",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"appId",
",",
"listOptionalParameter",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"List",
"<",
"VersionInfo",
">",
">",
",",
"List",
"<",
"VersionInfo",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"List",
"<",
"VersionInfo",
">",
"call",
"(",
"ServiceResponse",
"<",
"List",
"<",
"VersionInfo",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets the application versions info.
@param appId The application ID.
@param listOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<VersionInfo> object | [
"Gets",
"the",
"application",
"versions",
"info",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java#L315-L322 |
jenetics/jenetics | jenetics/src/main/java/io/jenetics/internal/collection/Array.java | Array.checkIndex | public static void checkIndex(final int from, final int until, final int size) {
"""
Check the given {@code from} and {@code until} indices.
@param from the from index, inclusively.
@param until the until index, exclusively.
@param size the array size
@throws ArrayIndexOutOfBoundsException if the given index is not in the
valid range.
"""
if (from < 0) {
throw new ArrayIndexOutOfBoundsException("fromIndex = " + from);
}
if (until > size) {
throw new ArrayIndexOutOfBoundsException(format(
"Invalid index range: [%d, %s)", from, until
));
}
if (from > until) {
throw new IllegalArgumentException(format(
"fromIndex(%d) > toIndex(%d)", from, until
));
}
} | java | public static void checkIndex(final int from, final int until, final int size) {
if (from < 0) {
throw new ArrayIndexOutOfBoundsException("fromIndex = " + from);
}
if (until > size) {
throw new ArrayIndexOutOfBoundsException(format(
"Invalid index range: [%d, %s)", from, until
));
}
if (from > until) {
throw new IllegalArgumentException(format(
"fromIndex(%d) > toIndex(%d)", from, until
));
}
} | [
"public",
"static",
"void",
"checkIndex",
"(",
"final",
"int",
"from",
",",
"final",
"int",
"until",
",",
"final",
"int",
"size",
")",
"{",
"if",
"(",
"from",
"<",
"0",
")",
"{",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"\"fromIndex = \"",
"+",
"from",
")",
";",
"}",
"if",
"(",
"until",
">",
"size",
")",
"{",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"format",
"(",
"\"Invalid index range: [%d, %s)\"",
",",
"from",
",",
"until",
")",
")",
";",
"}",
"if",
"(",
"from",
">",
"until",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"\"fromIndex(%d) > toIndex(%d)\"",
",",
"from",
",",
"until",
")",
")",
";",
"}",
"}"
] | Check the given {@code from} and {@code until} indices.
@param from the from index, inclusively.
@param until the until index, exclusively.
@param size the array size
@throws ArrayIndexOutOfBoundsException if the given index is not in the
valid range. | [
"Check",
"the",
"given",
"{",
"@code",
"from",
"}",
"and",
"{",
"@code",
"until",
"}",
"indices",
"."
] | train | https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/internal/collection/Array.java#L317-L331 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java | DefaultFeatureForm.getValue | @Api
public void getValue(String name, StringAttribute attribute) {
"""
Get a string value from the form, and place it in <code>attribute</code>.
@param name attribute name
@param attribute attribute to put value
@since 1.11.1
"""
attribute.setValue((String) formWidget.getValue(name));
} | java | @Api
public void getValue(String name, StringAttribute attribute) {
attribute.setValue((String) formWidget.getValue(name));
} | [
"@",
"Api",
"public",
"void",
"getValue",
"(",
"String",
"name",
",",
"StringAttribute",
"attribute",
")",
"{",
"attribute",
".",
"setValue",
"(",
"(",
"String",
")",
"formWidget",
".",
"getValue",
"(",
"name",
")",
")",
";",
"}"
] | Get a string value from the form, and place it in <code>attribute</code>.
@param name attribute name
@param attribute attribute to put value
@since 1.11.1 | [
"Get",
"a",
"string",
"value",
"from",
"the",
"form",
"and",
"place",
"it",
"in",
"<code",
">",
"attribute<",
"/",
"code",
">",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java#L728-L731 |
sculptor/sculptor | sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java | JpaHelper.findField | public static Field findField(Class<?> clazz, String name) {
"""
tries to find a field by a field name
@param clazz type
@param name name of the field
@return
"""
Class<?> entityClass = clazz;
while (!Object.class.equals(entityClass) && entityClass != null) {
Field[] fields = entityClass.getDeclaredFields();
for (Field field : fields) {
if (name.equals(field.getName())) {
return field;
}
}
entityClass = entityClass.getSuperclass();
}
return null;
} | java | public static Field findField(Class<?> clazz, String name) {
Class<?> entityClass = clazz;
while (!Object.class.equals(entityClass) && entityClass != null) {
Field[] fields = entityClass.getDeclaredFields();
for (Field field : fields) {
if (name.equals(field.getName())) {
return field;
}
}
entityClass = entityClass.getSuperclass();
}
return null;
} | [
"public",
"static",
"Field",
"findField",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"name",
")",
"{",
"Class",
"<",
"?",
">",
"entityClass",
"=",
"clazz",
";",
"while",
"(",
"!",
"Object",
".",
"class",
".",
"equals",
"(",
"entityClass",
")",
"&&",
"entityClass",
"!=",
"null",
")",
"{",
"Field",
"[",
"]",
"fields",
"=",
"entityClass",
".",
"getDeclaredFields",
"(",
")",
";",
"for",
"(",
"Field",
"field",
":",
"fields",
")",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"field",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"field",
";",
"}",
"}",
"entityClass",
"=",
"entityClass",
".",
"getSuperclass",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | tries to find a field by a field name
@param clazz type
@param name name of the field
@return | [
"tries",
"to",
"find",
"a",
"field",
"by",
"a",
"field",
"name"
] | train | https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java#L114-L126 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java | ManagedDatabasesInner.createOrUpdate | public ManagedDatabaseInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) {
"""
Creates a new database or updates an existing database.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance.
@param databaseName The name of the database.
@param parameters The requested database resource state.
@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 ManagedDatabaseInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().last().body();
} | java | public ManagedDatabaseInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().last().body();
} | [
"public",
"ManagedDatabaseInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
",",
"String",
"databaseName",
",",
"ManagedDatabaseInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"managedInstanceName",
",",
"databaseName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates a new database or updates an existing database.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance.
@param databaseName The name of the database.
@param parameters The requested database resource state.
@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 ManagedDatabaseInner object if successful. | [
"Creates",
"a",
"new",
"database",
"or",
"updates",
"an",
"existing",
"database",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java#L515-L517 |
RestComm/Restcomm-Connect | restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/cache/DiskCacheFactory.java | DiskCacheFactory.getDiskCache | public DiskCache getDiskCache(final String cachePath, final String cacheUri) {
"""
constructor for compatibility with existing cache implementation
"""
return new DiskCache(downloader, cachePath, cacheUri, true, cfg.isNoWavCache());
} | java | public DiskCache getDiskCache(final String cachePath, final String cacheUri) {
return new DiskCache(downloader, cachePath, cacheUri, true, cfg.isNoWavCache());
} | [
"public",
"DiskCache",
"getDiskCache",
"(",
"final",
"String",
"cachePath",
",",
"final",
"String",
"cacheUri",
")",
"{",
"return",
"new",
"DiskCache",
"(",
"downloader",
",",
"cachePath",
",",
"cacheUri",
",",
"true",
",",
"cfg",
".",
"isNoWavCache",
"(",
")",
")",
";",
"}"
] | constructor for compatibility with existing cache implementation | [
"constructor",
"for",
"compatibility",
"with",
"existing",
"cache",
"implementation"
] | train | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/cache/DiskCacheFactory.java#L27-L29 |
sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java | Gradient.setKnots | public void setKnots(int[] x, int[] y, byte[] types, int offset, int count) {
"""
Set the values of a set of knots.
@param x the knot positions
@param y the knot colors
@param types the knot types
@param offset the first knot to set
@param count the number of knots
"""
numKnots = count;
xKnots = new int[numKnots];
yKnots = new int[numKnots];
knotTypes = new byte[numKnots];
System.arraycopy(x, offset, xKnots, 0, numKnots);
System.arraycopy(y, offset, yKnots, 0, numKnots);
System.arraycopy(types, offset, knotTypes, 0, numKnots);
sortKnots();
rebuildGradient();
} | java | public void setKnots(int[] x, int[] y, byte[] types, int offset, int count) {
numKnots = count;
xKnots = new int[numKnots];
yKnots = new int[numKnots];
knotTypes = new byte[numKnots];
System.arraycopy(x, offset, xKnots, 0, numKnots);
System.arraycopy(y, offset, yKnots, 0, numKnots);
System.arraycopy(types, offset, knotTypes, 0, numKnots);
sortKnots();
rebuildGradient();
} | [
"public",
"void",
"setKnots",
"(",
"int",
"[",
"]",
"x",
",",
"int",
"[",
"]",
"y",
",",
"byte",
"[",
"]",
"types",
",",
"int",
"offset",
",",
"int",
"count",
")",
"{",
"numKnots",
"=",
"count",
";",
"xKnots",
"=",
"new",
"int",
"[",
"numKnots",
"]",
";",
"yKnots",
"=",
"new",
"int",
"[",
"numKnots",
"]",
";",
"knotTypes",
"=",
"new",
"byte",
"[",
"numKnots",
"]",
";",
"System",
".",
"arraycopy",
"(",
"x",
",",
"offset",
",",
"xKnots",
",",
"0",
",",
"numKnots",
")",
";",
"System",
".",
"arraycopy",
"(",
"y",
",",
"offset",
",",
"yKnots",
",",
"0",
",",
"numKnots",
")",
";",
"System",
".",
"arraycopy",
"(",
"types",
",",
"offset",
",",
"knotTypes",
",",
"0",
",",
"numKnots",
")",
";",
"sortKnots",
"(",
")",
";",
"rebuildGradient",
"(",
")",
";",
"}"
] | Set the values of a set of knots.
@param x the knot positions
@param y the knot colors
@param types the knot types
@param offset the first knot to set
@param count the number of knots | [
"Set",
"the",
"values",
"of",
"a",
"set",
"of",
"knots",
"."
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L316-L326 |
realexpayments/rxp-hpp-java | src/main/java/com/realexpayments/hpp/sdk/utils/JsonUtils.java | JsonUtils.toJson | public static String toJson(HppResponse hppResponse) {
"""
Method serialises <code>HppResponse</code> to JSON.
@param hppResponse
@return String
"""
try {
return hppResponseWriter.writeValueAsString(hppResponse);
} catch (JsonProcessingException ex) {
LOGGER.error("Error writing HppResponse to JSON.", ex);
throw new RealexException("Error writing HppResponse to JSON.", ex);
}
} | java | public static String toJson(HppResponse hppResponse) {
try {
return hppResponseWriter.writeValueAsString(hppResponse);
} catch (JsonProcessingException ex) {
LOGGER.error("Error writing HppResponse to JSON.", ex);
throw new RealexException("Error writing HppResponse to JSON.", ex);
}
} | [
"public",
"static",
"String",
"toJson",
"(",
"HppResponse",
"hppResponse",
")",
"{",
"try",
"{",
"return",
"hppResponseWriter",
".",
"writeValueAsString",
"(",
"hppResponse",
")",
";",
"}",
"catch",
"(",
"JsonProcessingException",
"ex",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Error writing HppResponse to JSON.\"",
",",
"ex",
")",
";",
"throw",
"new",
"RealexException",
"(",
"\"Error writing HppResponse to JSON.\"",
",",
"ex",
")",
";",
"}",
"}"
] | Method serialises <code>HppResponse</code> to JSON.
@param hppResponse
@return String | [
"Method",
"serialises",
"<code",
">",
"HppResponse<",
"/",
"code",
">",
"to",
"JSON",
"."
] | train | https://github.com/realexpayments/rxp-hpp-java/blob/29cc5df036af09a6d8ea16ccd7e02e856f72620f/src/main/java/com/realexpayments/hpp/sdk/utils/JsonUtils.java#L78-L85 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ItemRule.java | ItemRule.putValue | public void putValue(String name, Token[] tokens) {
"""
Puts the specified value with the specified key to this Map type item.
@param name the value name; may be null
@param tokens an array of tokens
"""
if (type == null) {
type = ItemType.MAP;
}
if (!isMappableType()) {
throw new IllegalArgumentException("The type of this item must be 'map' or 'properties'");
}
if (tokensMap == null) {
tokensMap = new LinkedHashMap<>();
}
tokensMap.put(name, tokens);
} | java | public void putValue(String name, Token[] tokens) {
if (type == null) {
type = ItemType.MAP;
}
if (!isMappableType()) {
throw new IllegalArgumentException("The type of this item must be 'map' or 'properties'");
}
if (tokensMap == null) {
tokensMap = new LinkedHashMap<>();
}
tokensMap.put(name, tokens);
} | [
"public",
"void",
"putValue",
"(",
"String",
"name",
",",
"Token",
"[",
"]",
"tokens",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"type",
"=",
"ItemType",
".",
"MAP",
";",
"}",
"if",
"(",
"!",
"isMappableType",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The type of this item must be 'map' or 'properties'\"",
")",
";",
"}",
"if",
"(",
"tokensMap",
"==",
"null",
")",
"{",
"tokensMap",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"}",
"tokensMap",
".",
"put",
"(",
"name",
",",
"tokens",
")",
";",
"}"
] | Puts the specified value with the specified key to this Map type item.
@param name the value name; may be null
@param tokens an array of tokens | [
"Puts",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"to",
"this",
"Map",
"type",
"item",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L250-L261 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemIf.java | ElemIf.callChildVisitors | protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) {
"""
Call the children visitors.
@param visitor The visitor whose appropriate method will be called.
"""
if(callAttrs)
m_test.getExpression().callVisitors(m_test, visitor);
super.callChildVisitors(visitor, callAttrs);
} | java | protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs)
{
if(callAttrs)
m_test.getExpression().callVisitors(m_test, visitor);
super.callChildVisitors(visitor, callAttrs);
} | [
"protected",
"void",
"callChildVisitors",
"(",
"XSLTVisitor",
"visitor",
",",
"boolean",
"callAttrs",
")",
"{",
"if",
"(",
"callAttrs",
")",
"m_test",
".",
"getExpression",
"(",
")",
".",
"callVisitors",
"(",
"m_test",
",",
"visitor",
")",
";",
"super",
".",
"callChildVisitors",
"(",
"visitor",
",",
"callAttrs",
")",
";",
"}"
] | Call the children visitors.
@param visitor The visitor whose appropriate method will be called. | [
"Call",
"the",
"children",
"visitors",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemIf.java#L143-L148 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java | ReviewsImpl.getVideoFramesWithServiceResponseAsync | public Observable<ServiceResponse<Frames>> getVideoFramesWithServiceResponseAsync(String teamName, String reviewId, GetVideoFramesOptionalParameter getVideoFramesOptionalParameter) {
"""
The reviews created would show up for Reviewers on your team. As Reviewers complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on the specified CallBackEndpoint.
<h3>CallBack Schemas </h3>
<h4>Review Completion CallBack Sample</h4>
<p>
{<br/>
"ReviewId": "<Review Id>",<br/>
"ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
"ModifiedBy": "<Name of the Reviewer>",<br/>
"CallBackType": "Review",<br/>
"ContentId": "<The ContentId that was specified input>",<br/>
"Metadata": {<br/>
"adultscore": "0.xxx",<br/>
"a": "False",<br/>
"racyscore": "0.xxx",<br/>
"r": "True"<br/>
},<br/>
"ReviewerResultTags": {<br/>
"a": "False",<br/>
"r": "True"<br/>
}<br/>
}<br/>
</p>.
@param teamName Your team name.
@param reviewId Id of the review.
@param getVideoFramesOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Frames object
"""
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (teamName == null) {
throw new IllegalArgumentException("Parameter teamName is required and cannot be null.");
}
if (reviewId == null) {
throw new IllegalArgumentException("Parameter reviewId is required and cannot be null.");
}
final Integer startSeed = getVideoFramesOptionalParameter != null ? getVideoFramesOptionalParameter.startSeed() : null;
final Integer noOfRecords = getVideoFramesOptionalParameter != null ? getVideoFramesOptionalParameter.noOfRecords() : null;
final String filter = getVideoFramesOptionalParameter != null ? getVideoFramesOptionalParameter.filter() : null;
return getVideoFramesWithServiceResponseAsync(teamName, reviewId, startSeed, noOfRecords, filter);
} | java | public Observable<ServiceResponse<Frames>> getVideoFramesWithServiceResponseAsync(String teamName, String reviewId, GetVideoFramesOptionalParameter getVideoFramesOptionalParameter) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (teamName == null) {
throw new IllegalArgumentException("Parameter teamName is required and cannot be null.");
}
if (reviewId == null) {
throw new IllegalArgumentException("Parameter reviewId is required and cannot be null.");
}
final Integer startSeed = getVideoFramesOptionalParameter != null ? getVideoFramesOptionalParameter.startSeed() : null;
final Integer noOfRecords = getVideoFramesOptionalParameter != null ? getVideoFramesOptionalParameter.noOfRecords() : null;
final String filter = getVideoFramesOptionalParameter != null ? getVideoFramesOptionalParameter.filter() : null;
return getVideoFramesWithServiceResponseAsync(teamName, reviewId, startSeed, noOfRecords, filter);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Frames",
">",
">",
"getVideoFramesWithServiceResponseAsync",
"(",
"String",
"teamName",
",",
"String",
"reviewId",
",",
"GetVideoFramesOptionalParameter",
"getVideoFramesOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
".",
"baseUrl",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter this.client.baseUrl() is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"teamName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter teamName is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"reviewId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter reviewId is required and cannot be null.\"",
")",
";",
"}",
"final",
"Integer",
"startSeed",
"=",
"getVideoFramesOptionalParameter",
"!=",
"null",
"?",
"getVideoFramesOptionalParameter",
".",
"startSeed",
"(",
")",
":",
"null",
";",
"final",
"Integer",
"noOfRecords",
"=",
"getVideoFramesOptionalParameter",
"!=",
"null",
"?",
"getVideoFramesOptionalParameter",
".",
"noOfRecords",
"(",
")",
":",
"null",
";",
"final",
"String",
"filter",
"=",
"getVideoFramesOptionalParameter",
"!=",
"null",
"?",
"getVideoFramesOptionalParameter",
".",
"filter",
"(",
")",
":",
"null",
";",
"return",
"getVideoFramesWithServiceResponseAsync",
"(",
"teamName",
",",
"reviewId",
",",
"startSeed",
",",
"noOfRecords",
",",
"filter",
")",
";",
"}"
] | The reviews created would show up for Reviewers on your team. As Reviewers complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on the specified CallBackEndpoint.
<h3>CallBack Schemas </h3>
<h4>Review Completion CallBack Sample</h4>
<p>
{<br/>
"ReviewId": "<Review Id>",<br/>
"ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
"ModifiedBy": "<Name of the Reviewer>",<br/>
"CallBackType": "Review",<br/>
"ContentId": "<The ContentId that was specified input>",<br/>
"Metadata": {<br/>
"adultscore": "0.xxx",<br/>
"a": "False",<br/>
"racyscore": "0.xxx",<br/>
"r": "True"<br/>
},<br/>
"ReviewerResultTags": {<br/>
"a": "False",<br/>
"r": "True"<br/>
}<br/>
}<br/>
</p>.
@param teamName Your team name.
@param reviewId Id of the review.
@param getVideoFramesOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Frames object | [
"The",
"reviews",
"created",
"would",
"show",
"up",
"for",
"Reviewers",
"on",
"your",
"team",
".",
"As",
"Reviewers",
"complete",
"reviewing",
"results",
"of",
"the",
"Review",
"would",
"be",
"POSTED",
"(",
"i",
".",
"e",
".",
"HTTP",
"POST",
")",
"on",
"the",
"specified",
"CallBackEndpoint",
".",
"<",
";",
"h3>",
";",
"CallBack",
"Schemas",
"<",
";",
"/",
"h3>",
";",
"<",
";",
"h4>",
";",
"Review",
"Completion",
"CallBack",
"Sample<",
";",
"/",
"h4>",
";",
"<",
";",
"p>",
";",
"{",
"<",
";",
"br",
"/",
">",
";",
"ReviewId",
":",
"<",
";",
"Review",
"Id>",
";",
"<",
";",
"br",
"/",
">",
";",
"ModifiedOn",
":",
"2016",
"-",
"10",
"-",
"11T22",
":",
"36",
":",
"32",
".",
"9934851Z",
"<",
";",
"br",
"/",
">",
";",
"ModifiedBy",
":",
"<",
";",
"Name",
"of",
"the",
"Reviewer>",
";",
"<",
";",
"br",
"/",
">",
";",
"CallBackType",
":",
"Review",
"<",
";",
"br",
"/",
">",
";",
"ContentId",
":",
"<",
";",
"The",
"ContentId",
"that",
"was",
"specified",
"input>",
";",
"<",
";",
"br",
"/",
">",
";",
"Metadata",
":",
"{",
"<",
";",
"br",
"/",
">",
";",
"adultscore",
":",
"0",
".",
"xxx",
"<",
";",
"br",
"/",
">",
";",
"a",
":",
"False",
"<",
";",
"br",
"/",
">",
";",
"racyscore",
":",
"0",
".",
"xxx",
"<",
";",
"br",
"/",
">",
";",
"r",
":",
"True",
"<",
";",
"br",
"/",
">",
";",
"}",
"<",
";",
"br",
"/",
">",
";",
"ReviewerResultTags",
":",
"{",
"<",
";",
"br",
"/",
">",
";",
"a",
":",
"False",
"<",
";",
"br",
"/",
">",
";",
"r",
":",
"True",
"<",
";",
"br",
"/",
">",
";",
"}",
"<",
";",
"br",
"/",
">",
";",
"}",
"<",
";",
"br",
"/",
">",
";",
"<",
";",
"/",
"p>",
";",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L1450-L1465 |
alkacon/opencms-core | src/org/opencms/workplace/CmsLoginUserAgreement.java | CmsLoginUserAgreement.dialogScriptSubmit | @Override
public String dialogScriptSubmit() {
"""
The standard JavaScript for submitting the dialog is overridden to show an alert in case that
an agreement is declined.<p>
See also {@link CmsDialog#dialogScriptSubmit()}
@return the standard JavaScript for submitting the dialog
"""
if (useNewStyle()) {
return super.dialogScriptSubmit();
}
StringBuffer result = new StringBuffer(512);
result.append("function submitAction(actionValue, theForm, formName) {\n");
result.append("\tif (theForm == null) {\n");
result.append("\t\ttheForm = document.forms[formName];\n");
result.append("\t}\n");
result.append("\ttheForm." + PARAM_FRAMENAME + ".value = window.name;\n");
result.append("\tif (actionValue == \"" + DIALOG_OK + "\") {\n");
result.append("\t\treturn true;\n");
result.append("\t}");
String declinedMessage = getConfigurationContentStringValue(NODE_MESSAGE_DECLINED);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(declinedMessage)) {
// add the alert to show the declined message
result.append(" else if (actionValue == \"" + DIALOG_CANCEL + "\") {\n");
result.append("\t\talert(\"");
result.append(CmsStringUtil.escapeJavaScript(declinedMessage));
result.append("\");\n");
result.append("\t}\n");
}
result.append("\ttheForm." + PARAM_ACTION + ".value = actionValue;\n");
result.append("\ttheForm.submit();\n");
result.append("\treturn false;\n");
result.append("}\n");
return result.toString();
} | java | @Override
public String dialogScriptSubmit() {
if (useNewStyle()) {
return super.dialogScriptSubmit();
}
StringBuffer result = new StringBuffer(512);
result.append("function submitAction(actionValue, theForm, formName) {\n");
result.append("\tif (theForm == null) {\n");
result.append("\t\ttheForm = document.forms[formName];\n");
result.append("\t}\n");
result.append("\ttheForm." + PARAM_FRAMENAME + ".value = window.name;\n");
result.append("\tif (actionValue == \"" + DIALOG_OK + "\") {\n");
result.append("\t\treturn true;\n");
result.append("\t}");
String declinedMessage = getConfigurationContentStringValue(NODE_MESSAGE_DECLINED);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(declinedMessage)) {
// add the alert to show the declined message
result.append(" else if (actionValue == \"" + DIALOG_CANCEL + "\") {\n");
result.append("\t\talert(\"");
result.append(CmsStringUtil.escapeJavaScript(declinedMessage));
result.append("\");\n");
result.append("\t}\n");
}
result.append("\ttheForm." + PARAM_ACTION + ".value = actionValue;\n");
result.append("\ttheForm.submit();\n");
result.append("\treturn false;\n");
result.append("}\n");
return result.toString();
} | [
"@",
"Override",
"public",
"String",
"dialogScriptSubmit",
"(",
")",
"{",
"if",
"(",
"useNewStyle",
"(",
")",
")",
"{",
"return",
"super",
".",
"dialogScriptSubmit",
"(",
")",
";",
"}",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"512",
")",
";",
"result",
".",
"append",
"(",
"\"function submitAction(actionValue, theForm, formName) {\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\tif (theForm == null) {\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\\ttheForm = document.forms[formName];\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t}\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\ttheForm.\"",
"+",
"PARAM_FRAMENAME",
"+",
"\".value = window.name;\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\tif (actionValue == \\\"\"",
"+",
"DIALOG_OK",
"+",
"\"\\\") {\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\\treturn true;\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t}\"",
")",
";",
"String",
"declinedMessage",
"=",
"getConfigurationContentStringValue",
"(",
"NODE_MESSAGE_DECLINED",
")",
";",
"if",
"(",
"CmsStringUtil",
".",
"isNotEmptyOrWhitespaceOnly",
"(",
"declinedMessage",
")",
")",
"{",
"// add the alert to show the declined message",
"result",
".",
"append",
"(",
"\" else if (actionValue == \\\"\"",
"+",
"DIALOG_CANCEL",
"+",
"\"\\\") {\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t\\talert(\\\"\"",
")",
";",
"result",
".",
"append",
"(",
"CmsStringUtil",
".",
"escapeJavaScript",
"(",
"declinedMessage",
")",
")",
";",
"result",
".",
"append",
"(",
"\"\\\");\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\t}\\n\"",
")",
";",
"}",
"result",
".",
"append",
"(",
"\"\\ttheForm.\"",
"+",
"PARAM_ACTION",
"+",
"\".value = actionValue;\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\ttheForm.submit();\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"\\treturn false;\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"}\\n\"",
")",
";",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] | The standard JavaScript for submitting the dialog is overridden to show an alert in case that
an agreement is declined.<p>
See also {@link CmsDialog#dialogScriptSubmit()}
@return the standard JavaScript for submitting the dialog | [
"The",
"standard",
"JavaScript",
"for",
"submitting",
"the",
"dialog",
"is",
"overridden",
"to",
"show",
"an",
"alert",
"in",
"case",
"that",
"an",
"agreement",
"is",
"declined",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsLoginUserAgreement.java#L200-L230 |
Jasig/uPortal | uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/EditManager.java | EditManager.getEditSet | private static Element getEditSet(Element node, Document plf, IPerson person, boolean create)
throws PortalException {
"""
Get the edit set if any stored in the passed in node. If not found and if the create flag is
true then create a new edit set and add it as a child to the passed in node. Then return it.
"""
Node child = node.getFirstChild();
while (child != null) {
if (child.getNodeName().equals(Constants.ELM_EDIT_SET)) return (Element) child;
child = child.getNextSibling();
}
if (create == false) return null;
String ID = null;
try {
ID = getDLS().getNextStructDirectiveId(person);
} catch (Exception e) {
throw new PortalException(
"Exception encountered while "
+ "generating new edit set node "
+ "Id for userId="
+ person.getID(),
e);
}
Element editSet = plf.createElement(Constants.ELM_EDIT_SET);
editSet.setAttribute(Constants.ATT_TYPE, Constants.ELM_EDIT_SET);
editSet.setAttribute(Constants.ATT_ID, ID);
node.appendChild(editSet);
return editSet;
} | java | private static Element getEditSet(Element node, Document plf, IPerson person, boolean create)
throws PortalException {
Node child = node.getFirstChild();
while (child != null) {
if (child.getNodeName().equals(Constants.ELM_EDIT_SET)) return (Element) child;
child = child.getNextSibling();
}
if (create == false) return null;
String ID = null;
try {
ID = getDLS().getNextStructDirectiveId(person);
} catch (Exception e) {
throw new PortalException(
"Exception encountered while "
+ "generating new edit set node "
+ "Id for userId="
+ person.getID(),
e);
}
Element editSet = plf.createElement(Constants.ELM_EDIT_SET);
editSet.setAttribute(Constants.ATT_TYPE, Constants.ELM_EDIT_SET);
editSet.setAttribute(Constants.ATT_ID, ID);
node.appendChild(editSet);
return editSet;
} | [
"private",
"static",
"Element",
"getEditSet",
"(",
"Element",
"node",
",",
"Document",
"plf",
",",
"IPerson",
"person",
",",
"boolean",
"create",
")",
"throws",
"PortalException",
"{",
"Node",
"child",
"=",
"node",
".",
"getFirstChild",
"(",
")",
";",
"while",
"(",
"child",
"!=",
"null",
")",
"{",
"if",
"(",
"child",
".",
"getNodeName",
"(",
")",
".",
"equals",
"(",
"Constants",
".",
"ELM_EDIT_SET",
")",
")",
"return",
"(",
"Element",
")",
"child",
";",
"child",
"=",
"child",
".",
"getNextSibling",
"(",
")",
";",
"}",
"if",
"(",
"create",
"==",
"false",
")",
"return",
"null",
";",
"String",
"ID",
"=",
"null",
";",
"try",
"{",
"ID",
"=",
"getDLS",
"(",
")",
".",
"getNextStructDirectiveId",
"(",
"person",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"PortalException",
"(",
"\"Exception encountered while \"",
"+",
"\"generating new edit set node \"",
"+",
"\"Id for userId=\"",
"+",
"person",
".",
"getID",
"(",
")",
",",
"e",
")",
";",
"}",
"Element",
"editSet",
"=",
"plf",
".",
"createElement",
"(",
"Constants",
".",
"ELM_EDIT_SET",
")",
";",
"editSet",
".",
"setAttribute",
"(",
"Constants",
".",
"ATT_TYPE",
",",
"Constants",
".",
"ELM_EDIT_SET",
")",
";",
"editSet",
".",
"setAttribute",
"(",
"Constants",
".",
"ATT_ID",
",",
"ID",
")",
";",
"node",
".",
"appendChild",
"(",
"editSet",
")",
";",
"return",
"editSet",
";",
"}"
] | Get the edit set if any stored in the passed in node. If not found and if the create flag is
true then create a new edit set and add it as a child to the passed in node. Then return it. | [
"Get",
"the",
"edit",
"set",
"if",
"any",
"stored",
"in",
"the",
"passed",
"in",
"node",
".",
"If",
"not",
"found",
"and",
"if",
"the",
"create",
"flag",
"is",
"true",
"then",
"create",
"a",
"new",
"edit",
"set",
"and",
"add",
"it",
"as",
"a",
"child",
"to",
"the",
"passed",
"in",
"node",
".",
"Then",
"return",
"it",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/EditManager.java#L54-L82 |
Netflix/conductor | core/src/main/java/com/netflix/conductor/service/utils/ServiceUtils.java | ServiceUtils.checkNotNullOrEmpty | public static void checkNotNullOrEmpty(Map<?, ?> map, String errorMessage) {
"""
This method checks if the input map is valid or not.
@param map input of type {@link Map}
@param errorMessage The exception message use if the map is empty or null
@throws com.netflix.conductor.core.execution.ApplicationException if input map is not valid
"""
if(map == null || map.isEmpty()) {
throw new ApplicationException(ApplicationException.Code.INVALID_INPUT, errorMessage);
}
} | java | public static void checkNotNullOrEmpty(Map<?, ?> map, String errorMessage) {
if(map == null || map.isEmpty()) {
throw new ApplicationException(ApplicationException.Code.INVALID_INPUT, errorMessage);
}
} | [
"public",
"static",
"void",
"checkNotNullOrEmpty",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"String",
"errorMessage",
")",
"{",
"if",
"(",
"map",
"==",
"null",
"||",
"map",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"ApplicationException",
"(",
"ApplicationException",
".",
"Code",
".",
"INVALID_INPUT",
",",
"errorMessage",
")",
";",
"}",
"}"
] | This method checks if the input map is valid or not.
@param map input of type {@link Map}
@param errorMessage The exception message use if the map is empty or null
@throws com.netflix.conductor.core.execution.ApplicationException if input map is not valid | [
"This",
"method",
"checks",
"if",
"the",
"input",
"map",
"is",
"valid",
"or",
"not",
"."
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/service/utils/ServiceUtils.java#L75-L79 |
eclipse/xtext-core | org.eclipse.xtext/src/org/eclipse/xtext/scoping/Scopes.java | Scopes.scopedElementsFor | public static <T extends EObject> Iterable<IEObjectDescription> scopedElementsFor(Iterable<? extends T> elements,
final Function<T, QualifiedName> nameComputation) {
"""
transforms an {@link Iterable} of {@link EObject}s into an {@link Iterable} of {@link IEObjectDescription}s computing
the name of the elements using the passed {@link Function} If the passed function returns null the object is
filtered out.
"""
Iterable<IEObjectDescription> transformed = Iterables.transform(elements,
new Function<T, IEObjectDescription>() {
@Override
public IEObjectDescription apply(T from) {
final QualifiedName qualifiedName = nameComputation.apply(from);
if (qualifiedName != null)
return new EObjectDescription(qualifiedName, from, null);
return null;
}
});
return Iterables.filter(transformed, Predicates.notNull());
} | java | public static <T extends EObject> Iterable<IEObjectDescription> scopedElementsFor(Iterable<? extends T> elements,
final Function<T, QualifiedName> nameComputation) {
Iterable<IEObjectDescription> transformed = Iterables.transform(elements,
new Function<T, IEObjectDescription>() {
@Override
public IEObjectDescription apply(T from) {
final QualifiedName qualifiedName = nameComputation.apply(from);
if (qualifiedName != null)
return new EObjectDescription(qualifiedName, from, null);
return null;
}
});
return Iterables.filter(transformed, Predicates.notNull());
} | [
"public",
"static",
"<",
"T",
"extends",
"EObject",
">",
"Iterable",
"<",
"IEObjectDescription",
">",
"scopedElementsFor",
"(",
"Iterable",
"<",
"?",
"extends",
"T",
">",
"elements",
",",
"final",
"Function",
"<",
"T",
",",
"QualifiedName",
">",
"nameComputation",
")",
"{",
"Iterable",
"<",
"IEObjectDescription",
">",
"transformed",
"=",
"Iterables",
".",
"transform",
"(",
"elements",
",",
"new",
"Function",
"<",
"T",
",",
"IEObjectDescription",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"IEObjectDescription",
"apply",
"(",
"T",
"from",
")",
"{",
"final",
"QualifiedName",
"qualifiedName",
"=",
"nameComputation",
".",
"apply",
"(",
"from",
")",
";",
"if",
"(",
"qualifiedName",
"!=",
"null",
")",
"return",
"new",
"EObjectDescription",
"(",
"qualifiedName",
",",
"from",
",",
"null",
")",
";",
"return",
"null",
";",
"}",
"}",
")",
";",
"return",
"Iterables",
".",
"filter",
"(",
"transformed",
",",
"Predicates",
".",
"notNull",
"(",
")",
")",
";",
"}"
] | transforms an {@link Iterable} of {@link EObject}s into an {@link Iterable} of {@link IEObjectDescription}s computing
the name of the elements using the passed {@link Function} If the passed function returns null the object is
filtered out. | [
"transforms",
"an",
"{"
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/scoping/Scopes.java#L87-L100 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mime/MimeTypeParser.java | MimeTypeParser.safeParseMimeType | @Nullable
public static MimeType safeParseMimeType (@Nullable final String sMimeType) {
"""
Try to convert the string representation of a MIME type to an object. The
default quoting algorithm {@link CMimeType#DEFAULT_QUOTING} is used to
unquote strings. Compared to {@link #parseMimeType(String)} this method
swallows all {@link MimeTypeParserException} and simply returns
<code>null</code>.
@param sMimeType
The string representation to be converted. May be <code>null</code>.
@return <code>null</code> if the parsed string is empty or not a valid mime
type.
"""
try
{
return parseMimeType (sMimeType, CMimeType.DEFAULT_QUOTING);
}
catch (final MimeTypeParserException ex)
{
return null;
}
} | java | @Nullable
public static MimeType safeParseMimeType (@Nullable final String sMimeType)
{
try
{
return parseMimeType (sMimeType, CMimeType.DEFAULT_QUOTING);
}
catch (final MimeTypeParserException ex)
{
return null;
}
} | [
"@",
"Nullable",
"public",
"static",
"MimeType",
"safeParseMimeType",
"(",
"@",
"Nullable",
"final",
"String",
"sMimeType",
")",
"{",
"try",
"{",
"return",
"parseMimeType",
"(",
"sMimeType",
",",
"CMimeType",
".",
"DEFAULT_QUOTING",
")",
";",
"}",
"catch",
"(",
"final",
"MimeTypeParserException",
"ex",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Try to convert the string representation of a MIME type to an object. The
default quoting algorithm {@link CMimeType#DEFAULT_QUOTING} is used to
unquote strings. Compared to {@link #parseMimeType(String)} this method
swallows all {@link MimeTypeParserException} and simply returns
<code>null</code>.
@param sMimeType
The string representation to be converted. May be <code>null</code>.
@return <code>null</code> if the parsed string is empty or not a valid mime
type. | [
"Try",
"to",
"convert",
"the",
"string",
"representation",
"of",
"a",
"MIME",
"type",
"to",
"an",
"object",
".",
"The",
"default",
"quoting",
"algorithm",
"{",
"@link",
"CMimeType#DEFAULT_QUOTING",
"}",
"is",
"used",
"to",
"unquote",
"strings",
".",
"Compared",
"to",
"{",
"@link",
"#parseMimeType",
"(",
"String",
")",
"}",
"this",
"method",
"swallows",
"all",
"{",
"@link",
"MimeTypeParserException",
"}",
"and",
"simply",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mime/MimeTypeParser.java#L390-L401 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java | ElementFilter.modulesIn | public static Set<ModuleElement>
modulesIn(Set<? extends Element> elements) {
"""
Returns a set of modules in {@code elements}.
@return a set of modules in {@code elements}
@param elements the elements to filter
@since 9
@spec JPMS
"""
return setFilter(elements, MODULE_KIND, ModuleElement.class);
} | java | public static Set<ModuleElement>
modulesIn(Set<? extends Element> elements) {
return setFilter(elements, MODULE_KIND, ModuleElement.class);
} | [
"public",
"static",
"Set",
"<",
"ModuleElement",
">",
"modulesIn",
"(",
"Set",
"<",
"?",
"extends",
"Element",
">",
"elements",
")",
"{",
"return",
"setFilter",
"(",
"elements",
",",
"MODULE_KIND",
",",
"ModuleElement",
".",
"class",
")",
";",
"}"
] | Returns a set of modules in {@code elements}.
@return a set of modules in {@code elements}
@param elements the elements to filter
@since 9
@spec JPMS | [
"Returns",
"a",
"set",
"of",
"modules",
"in",
"{"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L206-L209 |
banq/jdonframework | src/main/java/com/jdon/util/jdom/XMLFilterBase.java | XMLFilterBase.setProperty | public void setProperty (String name, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException {
"""
Set the value of a property.
<p>This will always fail if the parent is null.</p>
@param name The property name.
@param state The requested property value.
@exception org.xml.sax.SAXNotRecognizedException When the
XMLReader does not recognize the property name.
@exception org.xml.sax.SAXNotSupportedException When the
XMLReader recognizes the property name but
cannot set the requested value.
@see org.xml.sax.XMLReader#setProperty
"""
for (int i = 0; i < LEXICAL_HANDLER_NAMES.length; i++) {
if (LEXICAL_HANDLER_NAMES[i].equals(name)) {
setLexicalHandler((LexicalHandler) value);
return;
}
}
super.setProperty(name, value);
} | java | public void setProperty (String name, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException
{
for (int i = 0; i < LEXICAL_HANDLER_NAMES.length; i++) {
if (LEXICAL_HANDLER_NAMES[i].equals(name)) {
setLexicalHandler((LexicalHandler) value);
return;
}
}
super.setProperty(name, value);
} | [
"public",
"void",
"setProperty",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"throws",
"SAXNotRecognizedException",
",",
"SAXNotSupportedException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"LEXICAL_HANDLER_NAMES",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"LEXICAL_HANDLER_NAMES",
"[",
"i",
"]",
".",
"equals",
"(",
"name",
")",
")",
"{",
"setLexicalHandler",
"(",
"(",
"LexicalHandler",
")",
"value",
")",
";",
"return",
";",
"}",
"}",
"super",
".",
"setProperty",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Set the value of a property.
<p>This will always fail if the parent is null.</p>
@param name The property name.
@param state The requested property value.
@exception org.xml.sax.SAXNotRecognizedException When the
XMLReader does not recognize the property name.
@exception org.xml.sax.SAXNotSupportedException When the
XMLReader recognizes the property name but
cannot set the requested value.
@see org.xml.sax.XMLReader#setProperty | [
"Set",
"the",
"value",
"of",
"a",
"property",
"."
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/jdom/XMLFilterBase.java#L507-L517 |
EdwardRaff/JSAT | JSAT/src/jsat/driftdetectors/DDM.java | DDM.setWarningThreshold | public void setWarningThreshold(double warningThreshold) {
"""
Sets the multiplier on the standard deviation that must be exceeded to
initiate a warning state. Once in the warning state, DDM will begin to
collect a history of the inputs <br>
Increasing the warning threshold makes it take longer to start detecting
a change, but reduces false positives. <br>
If the warning threshold is set above the
{@link #setDriftThreshold(double) }, the drift state will not occur until
the warning state is reached, and the warning state will be skipped.
@param warningThreshold the positive multiplier threshold for starting a
warning state
"""
if(warningThreshold <= 0 || Double.isNaN(warningThreshold) || Double.isInfinite(warningThreshold))
throw new IllegalArgumentException("warning threshold must be positive, not " + warningThreshold);
this.warningThreshold = warningThreshold;
} | java | public void setWarningThreshold(double warningThreshold)
{
if(warningThreshold <= 0 || Double.isNaN(warningThreshold) || Double.isInfinite(warningThreshold))
throw new IllegalArgumentException("warning threshold must be positive, not " + warningThreshold);
this.warningThreshold = warningThreshold;
} | [
"public",
"void",
"setWarningThreshold",
"(",
"double",
"warningThreshold",
")",
"{",
"if",
"(",
"warningThreshold",
"<=",
"0",
"||",
"Double",
".",
"isNaN",
"(",
"warningThreshold",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"warningThreshold",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"warning threshold must be positive, not \"",
"+",
"warningThreshold",
")",
";",
"this",
".",
"warningThreshold",
"=",
"warningThreshold",
";",
"}"
] | Sets the multiplier on the standard deviation that must be exceeded to
initiate a warning state. Once in the warning state, DDM will begin to
collect a history of the inputs <br>
Increasing the warning threshold makes it take longer to start detecting
a change, but reduces false positives. <br>
If the warning threshold is set above the
{@link #setDriftThreshold(double) }, the drift state will not occur until
the warning state is reached, and the warning state will be skipped.
@param warningThreshold the positive multiplier threshold for starting a
warning state | [
"Sets",
"the",
"multiplier",
"on",
"the",
"standard",
"deviation",
"that",
"must",
"be",
"exceeded",
"to",
"initiate",
"a",
"warning",
"state",
".",
"Once",
"in",
"the",
"warning",
"state",
"DDM",
"will",
"begin",
"to",
"collect",
"a",
"history",
"of",
"the",
"inputs",
"<br",
">",
"Increasing",
"the",
"warning",
"threshold",
"makes",
"it",
"take",
"longer",
"to",
"start",
"detecting",
"a",
"change",
"but",
"reduces",
"false",
"positives",
".",
"<br",
">",
"If",
"the",
"warning",
"threshold",
"is",
"set",
"above",
"the",
"{"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/driftdetectors/DDM.java#L152-L157 |
rholder/guava-retrying | src/main/java/com/github/rholder/retry/WaitStrategies.java | WaitStrategies.fixedWait | public static WaitStrategy fixedWait(long sleepTime, @Nonnull TimeUnit timeUnit) throws IllegalStateException {
"""
Returns a wait strategy that sleeps a fixed amount of time before retrying.
@param sleepTime the time to sleep
@param timeUnit the unit of the time to sleep
@return a wait strategy that sleeps a fixed amount of time
@throws IllegalStateException if the sleep time is < 0
"""
Preconditions.checkNotNull(timeUnit, "The time unit may not be null");
return new FixedWaitStrategy(timeUnit.toMillis(sleepTime));
} | java | public static WaitStrategy fixedWait(long sleepTime, @Nonnull TimeUnit timeUnit) throws IllegalStateException {
Preconditions.checkNotNull(timeUnit, "The time unit may not be null");
return new FixedWaitStrategy(timeUnit.toMillis(sleepTime));
} | [
"public",
"static",
"WaitStrategy",
"fixedWait",
"(",
"long",
"sleepTime",
",",
"@",
"Nonnull",
"TimeUnit",
"timeUnit",
")",
"throws",
"IllegalStateException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"timeUnit",
",",
"\"The time unit may not be null\"",
")",
";",
"return",
"new",
"FixedWaitStrategy",
"(",
"timeUnit",
".",
"toMillis",
"(",
"sleepTime",
")",
")",
";",
"}"
] | Returns a wait strategy that sleeps a fixed amount of time before retrying.
@param sleepTime the time to sleep
@param timeUnit the unit of the time to sleep
@return a wait strategy that sleeps a fixed amount of time
@throws IllegalStateException if the sleep time is < 0 | [
"Returns",
"a",
"wait",
"strategy",
"that",
"sleeps",
"a",
"fixed",
"amount",
"of",
"time",
"before",
"retrying",
"."
] | train | https://github.com/rholder/guava-retrying/blob/177b6c9b9f3e7957f404f0bdb8e23374cb1de43f/src/main/java/com/github/rholder/retry/WaitStrategies.java#L58-L61 |
bluelinelabs/LoganSquare | core/src/main/java/com/bluelinelabs/logansquare/LoganSquare.java | LoganSquare.registerTypeConverter | public static <E> void registerTypeConverter(Class<E> cls, TypeConverter<E> converter) {
"""
Register a new TypeConverter for parsing and serialization.
@param cls The class for which the TypeConverter should be used.
@param converter The TypeConverter
"""
TYPE_CONVERTERS.put(cls, converter);
} | java | public static <E> void registerTypeConverter(Class<E> cls, TypeConverter<E> converter) {
TYPE_CONVERTERS.put(cls, converter);
} | [
"public",
"static",
"<",
"E",
">",
"void",
"registerTypeConverter",
"(",
"Class",
"<",
"E",
">",
"cls",
",",
"TypeConverter",
"<",
"E",
">",
"converter",
")",
"{",
"TYPE_CONVERTERS",
".",
"put",
"(",
"cls",
",",
"converter",
")",
";",
"}"
] | Register a new TypeConverter for parsing and serialization.
@param cls The class for which the TypeConverter should be used.
@param converter The TypeConverter | [
"Register",
"a",
"new",
"TypeConverter",
"for",
"parsing",
"and",
"serialization",
"."
] | train | https://github.com/bluelinelabs/LoganSquare/blob/6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06/core/src/main/java/com/bluelinelabs/logansquare/LoganSquare.java#L349-L351 |
dashorst/wicket-stuff-markup-validator | isorelax/src/main/java/org/iso_relax/verifier/VerifierFactory.java | VerifierFactory.newInstance | public static VerifierFactory newInstance(String language,ClassLoader classLoader) throws VerifierConfigurationException {
"""
Creates a new instance of a VerifierFactory for the specified schema language.
@param language
URI that specifies the schema language.
<p>
It is preferable to use the namespace URI of the schema language
to designate the schema language. For example,
<table><thead>
<tr>
<td>URI</td>
<td>language</td>
</tr>
</thead><tbody>
<tr>
<td><tt>http://relaxng.org/ns/structure/0.9</tt></td>
<td><a href="http://www.oasis-open.org/committees/relax-ng/">
RELAX NG
</a></td>
</tr><tr>
<td><tt>http://www.xml.gr.jp/xmlns/relaxCore</tt></td>
<td><a href="http://www.xml.gr.jp/relax">
RELAX Core
</a></td>
</tr><tr>
<td><tt>http://www.xml.gr.jp/xmlns/relaxNamespace</tt></td>
<td><a href="http://www.xml.gr.jp/relax">
RELAX Namespace
</a></td>
</tr><tr>
<td><tt>http://www.thaiopensource.com/trex</tt></td>
<td><a href="http://www.thaiopensource.com/trex">
TREX
</a></td>
</tr><tr>
<td><tt>http://www.w3.org/2001/XMLSchema</tt></td>
<td><a href="http://www.w3.org/TR/xmlschema-1">
W3C XML Schema
</a></td>
</tr><tr>
<td><tt>http://www.w3.org/XML/1998/namespace</tt></td>
<td><a href="http://www.w3.org/TR/REC-xml">
XML DTD
</a></td>
</tr>
</tbody></table>
@param classLoader
This class loader is used to search the available implementation.
@return
a non-null valid VerifierFactory instance.
@exception VerifierConfigurationException
if no implementation is available for the specified language.
"""
Iterator itr = providers( VerifierFactoryLoader.class, classLoader );
while(itr.hasNext()) {
VerifierFactoryLoader loader = (VerifierFactoryLoader)itr.next();
try {
VerifierFactory factory = loader.createFactory(language);
if(factory!=null) return factory;
} catch (Throwable t) {} // ignore any error
}
throw new VerifierConfigurationException("no validation engine available for: "+language);
} | java | public static VerifierFactory newInstance(String language,ClassLoader classLoader) throws VerifierConfigurationException {
Iterator itr = providers( VerifierFactoryLoader.class, classLoader );
while(itr.hasNext()) {
VerifierFactoryLoader loader = (VerifierFactoryLoader)itr.next();
try {
VerifierFactory factory = loader.createFactory(language);
if(factory!=null) return factory;
} catch (Throwable t) {} // ignore any error
}
throw new VerifierConfigurationException("no validation engine available for: "+language);
} | [
"public",
"static",
"VerifierFactory",
"newInstance",
"(",
"String",
"language",
",",
"ClassLoader",
"classLoader",
")",
"throws",
"VerifierConfigurationException",
"{",
"Iterator",
"itr",
"=",
"providers",
"(",
"VerifierFactoryLoader",
".",
"class",
",",
"classLoader",
")",
";",
"while",
"(",
"itr",
".",
"hasNext",
"(",
")",
")",
"{",
"VerifierFactoryLoader",
"loader",
"=",
"(",
"VerifierFactoryLoader",
")",
"itr",
".",
"next",
"(",
")",
";",
"try",
"{",
"VerifierFactory",
"factory",
"=",
"loader",
".",
"createFactory",
"(",
"language",
")",
";",
"if",
"(",
"factory",
"!=",
"null",
")",
"return",
"factory",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"}",
"// ignore any error\r",
"}",
"throw",
"new",
"VerifierConfigurationException",
"(",
"\"no validation engine available for: \"",
"+",
"language",
")",
";",
"}"
] | Creates a new instance of a VerifierFactory for the specified schema language.
@param language
URI that specifies the schema language.
<p>
It is preferable to use the namespace URI of the schema language
to designate the schema language. For example,
<table><thead>
<tr>
<td>URI</td>
<td>language</td>
</tr>
</thead><tbody>
<tr>
<td><tt>http://relaxng.org/ns/structure/0.9</tt></td>
<td><a href="http://www.oasis-open.org/committees/relax-ng/">
RELAX NG
</a></td>
</tr><tr>
<td><tt>http://www.xml.gr.jp/xmlns/relaxCore</tt></td>
<td><a href="http://www.xml.gr.jp/relax">
RELAX Core
</a></td>
</tr><tr>
<td><tt>http://www.xml.gr.jp/xmlns/relaxNamespace</tt></td>
<td><a href="http://www.xml.gr.jp/relax">
RELAX Namespace
</a></td>
</tr><tr>
<td><tt>http://www.thaiopensource.com/trex</tt></td>
<td><a href="http://www.thaiopensource.com/trex">
TREX
</a></td>
</tr><tr>
<td><tt>http://www.w3.org/2001/XMLSchema</tt></td>
<td><a href="http://www.w3.org/TR/xmlschema-1">
W3C XML Schema
</a></td>
</tr><tr>
<td><tt>http://www.w3.org/XML/1998/namespace</tt></td>
<td><a href="http://www.w3.org/TR/REC-xml">
XML DTD
</a></td>
</tr>
</tbody></table>
@param classLoader
This class loader is used to search the available implementation.
@return
a non-null valid VerifierFactory instance.
@exception VerifierConfigurationException
if no implementation is available for the specified language. | [
"Creates",
"a",
"new",
"instance",
"of",
"a",
"VerifierFactory",
"for",
"the",
"specified",
"schema",
"language",
"."
] | train | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/isorelax/src/main/java/org/iso_relax/verifier/VerifierFactory.java#L323-L334 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPP14Reader.java | MPP14Reader.readSubProjects | private void readSubProjects(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex) {
"""
Read a list of sub projects.
@param data byte array
@param uniqueIDOffset offset of unique ID
@param filePathOffset offset of file path
@param fileNameOffset offset of file name
@param subprojectIndex index of the subproject, used to calculate unique id offset
"""
while (uniqueIDOffset < filePathOffset)
{
readSubProject(data, uniqueIDOffset, filePathOffset, fileNameOffset, subprojectIndex++);
uniqueIDOffset += 4;
}
} | java | private void readSubProjects(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex)
{
while (uniqueIDOffset < filePathOffset)
{
readSubProject(data, uniqueIDOffset, filePathOffset, fileNameOffset, subprojectIndex++);
uniqueIDOffset += 4;
}
} | [
"private",
"void",
"readSubProjects",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"uniqueIDOffset",
",",
"int",
"filePathOffset",
",",
"int",
"fileNameOffset",
",",
"int",
"subprojectIndex",
")",
"{",
"while",
"(",
"uniqueIDOffset",
"<",
"filePathOffset",
")",
"{",
"readSubProject",
"(",
"data",
",",
"uniqueIDOffset",
",",
"filePathOffset",
",",
"fileNameOffset",
",",
"subprojectIndex",
"++",
")",
";",
"uniqueIDOffset",
"+=",
"4",
";",
"}",
"}"
] | Read a list of sub projects.
@param data byte array
@param uniqueIDOffset offset of unique ID
@param filePathOffset offset of file path
@param fileNameOffset offset of file name
@param subprojectIndex index of the subproject, used to calculate unique id offset | [
"Read",
"a",
"list",
"of",
"sub",
"projects",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L559-L566 |
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java | CommerceNotificationQueueEntryPersistenceImpl.findByLtS | @Override
public List<CommerceNotificationQueueEntry> findByLtS(Date sentDate,
int start, int end,
OrderByComparator<CommerceNotificationQueueEntry> orderByComparator) {
"""
Returns an ordered range of all the commerce notification queue entries where sentDate < ?.
<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 CommerceNotificationQueueEntryModelImpl}. 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 sentDate the sent date
@param start the lower bound of the range of commerce notification queue entries
@param end the upper bound of the range of commerce notification queue entries (not inclusive)
@param orderByComparator the comparator to order the results by (optionally <code>null</code>)
@return the ordered range of matching commerce notification queue entries
"""
return findByLtS(sentDate, start, end, orderByComparator, true);
} | java | @Override
public List<CommerceNotificationQueueEntry> findByLtS(Date sentDate,
int start, int end,
OrderByComparator<CommerceNotificationQueueEntry> orderByComparator) {
return findByLtS(sentDate, start, end, orderByComparator, true);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceNotificationQueueEntry",
">",
"findByLtS",
"(",
"Date",
"sentDate",
",",
"int",
"start",
",",
"int",
"end",
",",
"OrderByComparator",
"<",
"CommerceNotificationQueueEntry",
">",
"orderByComparator",
")",
"{",
"return",
"findByLtS",
"(",
"sentDate",
",",
"start",
",",
"end",
",",
"orderByComparator",
",",
"true",
")",
";",
"}"
] | Returns an ordered range of all the commerce notification queue entries where sentDate < ?.
<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 CommerceNotificationQueueEntryModelImpl}. 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 sentDate the sent date
@param start the lower bound of the range of commerce notification queue entries
@param end the upper bound of the range of commerce notification queue entries (not inclusive)
@param orderByComparator the comparator to order the results by (optionally <code>null</code>)
@return the ordered range of matching commerce notification queue entries | [
"Returns",
"an",
"ordered",
"range",
"of",
"all",
"the",
"commerce",
"notification",
"queue",
"entries",
"where",
"sentDate",
"<",
";",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java#L1722-L1727 |
pietermartin/sqlg | sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java | Schema.removeGlobalUniqueIndex | void removeGlobalUniqueIndex(GlobalUniqueIndex index, boolean preserveData) {
"""
remove the given global unique index
@param index the index to remove
@param preserveData should we keep the sql data?
"""
getTopology().lock();
String fn = index.getName();
if (!uncommittedRemovedGlobalUniqueIndexes.contains(fn)) {
uncommittedRemovedGlobalUniqueIndexes.add(fn);
TopologyManager.removeGlobalUniqueIndex(sqlgGraph, fn);
if (!preserveData) {
getVertexLabel(index.getName()).ifPresent(
(VertexLabel vl) -> vl.remove(false));
}
getTopology().fire(index, "", TopologyChangeAction.DELETE);
}
} | java | void removeGlobalUniqueIndex(GlobalUniqueIndex index, boolean preserveData) {
getTopology().lock();
String fn = index.getName();
if (!uncommittedRemovedGlobalUniqueIndexes.contains(fn)) {
uncommittedRemovedGlobalUniqueIndexes.add(fn);
TopologyManager.removeGlobalUniqueIndex(sqlgGraph, fn);
if (!preserveData) {
getVertexLabel(index.getName()).ifPresent(
(VertexLabel vl) -> vl.remove(false));
}
getTopology().fire(index, "", TopologyChangeAction.DELETE);
}
} | [
"void",
"removeGlobalUniqueIndex",
"(",
"GlobalUniqueIndex",
"index",
",",
"boolean",
"preserveData",
")",
"{",
"getTopology",
"(",
")",
".",
"lock",
"(",
")",
";",
"String",
"fn",
"=",
"index",
".",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"uncommittedRemovedGlobalUniqueIndexes",
".",
"contains",
"(",
"fn",
")",
")",
"{",
"uncommittedRemovedGlobalUniqueIndexes",
".",
"add",
"(",
"fn",
")",
";",
"TopologyManager",
".",
"removeGlobalUniqueIndex",
"(",
"sqlgGraph",
",",
"fn",
")",
";",
"if",
"(",
"!",
"preserveData",
")",
"{",
"getVertexLabel",
"(",
"index",
".",
"getName",
"(",
")",
")",
".",
"ifPresent",
"(",
"(",
"VertexLabel",
"vl",
")",
"->",
"vl",
".",
"remove",
"(",
"false",
")",
")",
";",
"}",
"getTopology",
"(",
")",
".",
"fire",
"(",
"index",
",",
"\"\"",
",",
"TopologyChangeAction",
".",
"DELETE",
")",
";",
"}",
"}"
] | remove the given global unique index
@param index the index to remove
@param preserveData should we keep the sql data? | [
"remove",
"the",
"given",
"global",
"unique",
"index"
] | train | https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L1810-L1822 |
classgraph/classgraph | src/main/java/nonapi/io/github/classgraph/utils/ReflectionUtils.java | ReflectionUtils.getFieldVal | public static Object getFieldVal(final Object obj, final String fieldName, final boolean throwException)
throws IllegalArgumentException {
"""
Get the value of the named field in the class of the given object or any of its superclasses. If an exception
is thrown while trying to read the field, and throwException is true, then IllegalArgumentException is thrown
wrapping the cause, otherwise this will return null. If passed a null object, returns null unless
throwException is true, then throws IllegalArgumentException.
@param obj
The object.
@param fieldName
The field name.
@param throwException
If true, throw an exception if the field value could not be read.
@return The field value.
@throws IllegalArgumentException
If the field value could not be read.
"""
if (obj == null || fieldName == null) {
if (throwException) {
throw new NullPointerException();
} else {
return null;
}
}
return getFieldVal(obj.getClass(), obj, fieldName, throwException);
} | java | public static Object getFieldVal(final Object obj, final String fieldName, final boolean throwException)
throws IllegalArgumentException {
if (obj == null || fieldName == null) {
if (throwException) {
throw new NullPointerException();
} else {
return null;
}
}
return getFieldVal(obj.getClass(), obj, fieldName, throwException);
} | [
"public",
"static",
"Object",
"getFieldVal",
"(",
"final",
"Object",
"obj",
",",
"final",
"String",
"fieldName",
",",
"final",
"boolean",
"throwException",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"obj",
"==",
"null",
"||",
"fieldName",
"==",
"null",
")",
"{",
"if",
"(",
"throwException",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"return",
"getFieldVal",
"(",
"obj",
".",
"getClass",
"(",
")",
",",
"obj",
",",
"fieldName",
",",
"throwException",
")",
";",
"}"
] | Get the value of the named field in the class of the given object or any of its superclasses. If an exception
is thrown while trying to read the field, and throwException is true, then IllegalArgumentException is thrown
wrapping the cause, otherwise this will return null. If passed a null object, returns null unless
throwException is true, then throws IllegalArgumentException.
@param obj
The object.
@param fieldName
The field name.
@param throwException
If true, throw an exception if the field value could not be read.
@return The field value.
@throws IllegalArgumentException
If the field value could not be read. | [
"Get",
"the",
"value",
"of",
"the",
"named",
"field",
"in",
"the",
"class",
"of",
"the",
"given",
"object",
"or",
"any",
"of",
"its",
"superclasses",
".",
"If",
"an",
"exception",
"is",
"thrown",
"while",
"trying",
"to",
"read",
"the",
"field",
"and",
"throwException",
"is",
"true",
"then",
"IllegalArgumentException",
"is",
"thrown",
"wrapping",
"the",
"cause",
"otherwise",
"this",
"will",
"return",
"null",
".",
"If",
"passed",
"a",
"null",
"object",
"returns",
"null",
"unless",
"throwException",
"is",
"true",
"then",
"throws",
"IllegalArgumentException",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/utils/ReflectionUtils.java#L123-L133 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/authorization/authorizationpolicylabel_stats.java | authorizationpolicylabel_stats.get | public static authorizationpolicylabel_stats get(nitro_service service, String labelname) throws Exception {
"""
Use this API to fetch statistics of authorizationpolicylabel_stats resource of given name .
"""
authorizationpolicylabel_stats obj = new authorizationpolicylabel_stats();
obj.set_labelname(labelname);
authorizationpolicylabel_stats response = (authorizationpolicylabel_stats) obj.stat_resource(service);
return response;
} | java | public static authorizationpolicylabel_stats get(nitro_service service, String labelname) throws Exception{
authorizationpolicylabel_stats obj = new authorizationpolicylabel_stats();
obj.set_labelname(labelname);
authorizationpolicylabel_stats response = (authorizationpolicylabel_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"authorizationpolicylabel_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"labelname",
")",
"throws",
"Exception",
"{",
"authorizationpolicylabel_stats",
"obj",
"=",
"new",
"authorizationpolicylabel_stats",
"(",
")",
";",
"obj",
".",
"set_labelname",
"(",
"labelname",
")",
";",
"authorizationpolicylabel_stats",
"response",
"=",
"(",
"authorizationpolicylabel_stats",
")",
"obj",
".",
"stat_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch statistics of authorizationpolicylabel_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"authorizationpolicylabel_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/authorization/authorizationpolicylabel_stats.java#L149-L154 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NodeTemplateClient.java | NodeTemplateClient.insertNodeTemplate | @BetaApi
public final Operation insertNodeTemplate(String region, NodeTemplate nodeTemplateResource) {
"""
Creates a NodeTemplate resource in the specified project using the data included in the
request.
<p>Sample code:
<pre><code>
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
NodeTemplate nodeTemplateResource = NodeTemplate.newBuilder().build();
Operation response = nodeTemplateClient.insertNodeTemplate(region.toString(), nodeTemplateResource);
}
</code></pre>
@param region The name of the region for this request.
@param nodeTemplateResource A Node Template resource. To learn more about node templates and
sole-tenant nodes, read the Sole-tenant nodes documentation. (== resource_for
beta.nodeTemplates ==) (== resource_for v1.nodeTemplates ==)
@throws com.google.api.gax.rpc.ApiException if the remote call fails
"""
InsertNodeTemplateHttpRequest request =
InsertNodeTemplateHttpRequest.newBuilder()
.setRegion(region)
.setNodeTemplateResource(nodeTemplateResource)
.build();
return insertNodeTemplate(request);
} | java | @BetaApi
public final Operation insertNodeTemplate(String region, NodeTemplate nodeTemplateResource) {
InsertNodeTemplateHttpRequest request =
InsertNodeTemplateHttpRequest.newBuilder()
.setRegion(region)
.setNodeTemplateResource(nodeTemplateResource)
.build();
return insertNodeTemplate(request);
} | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"insertNodeTemplate",
"(",
"String",
"region",
",",
"NodeTemplate",
"nodeTemplateResource",
")",
"{",
"InsertNodeTemplateHttpRequest",
"request",
"=",
"InsertNodeTemplateHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setRegion",
"(",
"region",
")",
".",
"setNodeTemplateResource",
"(",
"nodeTemplateResource",
")",
".",
"build",
"(",
")",
";",
"return",
"insertNodeTemplate",
"(",
"request",
")",
";",
"}"
] | Creates a NodeTemplate resource in the specified project using the data included in the
request.
<p>Sample code:
<pre><code>
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
NodeTemplate nodeTemplateResource = NodeTemplate.newBuilder().build();
Operation response = nodeTemplateClient.insertNodeTemplate(region.toString(), nodeTemplateResource);
}
</code></pre>
@param region The name of the region for this request.
@param nodeTemplateResource A Node Template resource. To learn more about node templates and
sole-tenant nodes, read the Sole-tenant nodes documentation. (== resource_for
beta.nodeTemplates ==) (== resource_for v1.nodeTemplates ==)
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"NodeTemplate",
"resource",
"in",
"the",
"specified",
"project",
"using",
"the",
"data",
"included",
"in",
"the",
"request",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NodeTemplateClient.java#L651-L660 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/MethodFinder.java | MethodFinder.findMatchingMethod | public static Method findMatchingMethod(Method originalMethod, String methodName) {
"""
Recursively search the class hierarchy of the class which declares {@code originalMethod} to find a method named {@code methodName} with the same signature as
{@code originalMethod}
@return The matching method, or {@code null} if one could not be found
"""
Class<?> originalClass = originalMethod.getDeclaringClass();
return AccessController.doPrivileged(new PrivilegedAction<Method>() {
@Override
public Method run() {
return findMatchingMethod(originalMethod, methodName, originalClass, new ResolutionContext(), originalClass);
}
});
} | java | public static Method findMatchingMethod(Method originalMethod, String methodName) {
Class<?> originalClass = originalMethod.getDeclaringClass();
return AccessController.doPrivileged(new PrivilegedAction<Method>() {
@Override
public Method run() {
return findMatchingMethod(originalMethod, methodName, originalClass, new ResolutionContext(), originalClass);
}
});
} | [
"public",
"static",
"Method",
"findMatchingMethod",
"(",
"Method",
"originalMethod",
",",
"String",
"methodName",
")",
"{",
"Class",
"<",
"?",
">",
"originalClass",
"=",
"originalMethod",
".",
"getDeclaringClass",
"(",
")",
";",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Method",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Method",
"run",
"(",
")",
"{",
"return",
"findMatchingMethod",
"(",
"originalMethod",
",",
"methodName",
",",
"originalClass",
",",
"new",
"ResolutionContext",
"(",
")",
",",
"originalClass",
")",
";",
"}",
"}",
")",
";",
"}"
] | Recursively search the class hierarchy of the class which declares {@code originalMethod} to find a method named {@code methodName} with the same signature as
{@code originalMethod}
@return The matching method, or {@code null} if one could not be found | [
"Recursively",
"search",
"the",
"class",
"hierarchy",
"of",
"the",
"class",
"which",
"declares",
"{",
"@code",
"originalMethod",
"}",
"to",
"find",
"a",
"method",
"named",
"{",
"@code",
"methodName",
"}",
"with",
"the",
"same",
"signature",
"as",
"{",
"@code",
"originalMethod",
"}"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/MethodFinder.java#L40-L49 |
AlmogBaku/IntlPhoneInput | intlphoneinput/src/main/java/net/rimoto/intlphoneinput/CountrySpinnerAdapter.java | CountrySpinnerAdapter.getDropDownView | @Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
"""
Drop down item view
@param position position of item
@param convertView View of item
@param parent parent view of item's view
@return covertView
"""
final ViewHolder viewHolder;
if (convertView == null) {
convertView = mLayoutInflater.inflate(R.layout.item_country, parent, false);
viewHolder = new ViewHolder();
viewHolder.mImageView = (ImageView) convertView.findViewById(R.id.intl_phone_edit__country__item_image);
viewHolder.mNameView = (TextView) convertView.findViewById(R.id.intl_phone_edit__country__item_name);
viewHolder.mDialCode = (TextView) convertView.findViewById(R.id.intl_phone_edit__country__item_dialcode);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
Country country = getItem(position);
viewHolder.mImageView.setImageResource(getFlagResource(country));
viewHolder.mNameView.setText(country.getName());
viewHolder.mDialCode.setText(String.format("+%s", country.getDialCode()));
return convertView;
} | java | @Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
final ViewHolder viewHolder;
if (convertView == null) {
convertView = mLayoutInflater.inflate(R.layout.item_country, parent, false);
viewHolder = new ViewHolder();
viewHolder.mImageView = (ImageView) convertView.findViewById(R.id.intl_phone_edit__country__item_image);
viewHolder.mNameView = (TextView) convertView.findViewById(R.id.intl_phone_edit__country__item_name);
viewHolder.mDialCode = (TextView) convertView.findViewById(R.id.intl_phone_edit__country__item_dialcode);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
Country country = getItem(position);
viewHolder.mImageView.setImageResource(getFlagResource(country));
viewHolder.mNameView.setText(country.getName());
viewHolder.mDialCode.setText(String.format("+%s", country.getDialCode()));
return convertView;
} | [
"@",
"Override",
"public",
"View",
"getDropDownView",
"(",
"int",
"position",
",",
"View",
"convertView",
",",
"ViewGroup",
"parent",
")",
"{",
"final",
"ViewHolder",
"viewHolder",
";",
"if",
"(",
"convertView",
"==",
"null",
")",
"{",
"convertView",
"=",
"mLayoutInflater",
".",
"inflate",
"(",
"R",
".",
"layout",
".",
"item_country",
",",
"parent",
",",
"false",
")",
";",
"viewHolder",
"=",
"new",
"ViewHolder",
"(",
")",
";",
"viewHolder",
".",
"mImageView",
"=",
"(",
"ImageView",
")",
"convertView",
".",
"findViewById",
"(",
"R",
".",
"id",
".",
"intl_phone_edit__country__item_image",
")",
";",
"viewHolder",
".",
"mNameView",
"=",
"(",
"TextView",
")",
"convertView",
".",
"findViewById",
"(",
"R",
".",
"id",
".",
"intl_phone_edit__country__item_name",
")",
";",
"viewHolder",
".",
"mDialCode",
"=",
"(",
"TextView",
")",
"convertView",
".",
"findViewById",
"(",
"R",
".",
"id",
".",
"intl_phone_edit__country__item_dialcode",
")",
";",
"convertView",
".",
"setTag",
"(",
"viewHolder",
")",
";",
"}",
"else",
"{",
"viewHolder",
"=",
"(",
"ViewHolder",
")",
"convertView",
".",
"getTag",
"(",
")",
";",
"}",
"Country",
"country",
"=",
"getItem",
"(",
"position",
")",
";",
"viewHolder",
".",
"mImageView",
".",
"setImageResource",
"(",
"getFlagResource",
"(",
"country",
")",
")",
";",
"viewHolder",
".",
"mNameView",
".",
"setText",
"(",
"country",
".",
"getName",
"(",
")",
")",
";",
"viewHolder",
".",
"mDialCode",
".",
"setText",
"(",
"String",
".",
"format",
"(",
"\"+%s\"",
",",
"country",
".",
"getDialCode",
"(",
")",
")",
")",
";",
"return",
"convertView",
";",
"}"
] | Drop down item view
@param position position of item
@param convertView View of item
@param parent parent view of item's view
@return covertView | [
"Drop",
"down",
"item",
"view"
] | train | https://github.com/AlmogBaku/IntlPhoneInput/blob/ac7313a2d1683feb4d535d5dbee6676b53879059/intlphoneinput/src/main/java/net/rimoto/intlphoneinput/CountrySpinnerAdapter.java#L32-L51 |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/offline/Offliner.java | Offliner.retrieveResponseFromCache | private Response retrieveResponseFromCache(Request request, @Nullable Response response) {
"""
Retrieve a {@link Response} from the offline layer.
@param request request for which an offline response must be retrieved
@param response original response which lead to an offline access. Can be null.
@return offline response or null if no response can be retrieve from the offline layer.
"""
Response.Builder cachedResponse;
if (response != null) {
cachedResponse = response.newBuilder();
} else {
cachedResponse = new Response.Builder()
.request(request)
.protocol(Protocol.HTTP_1_1);
}
String cached = retrieveFromCache(request.url().toString());
if (cached != null) {
return cachedResponse
.code(200)
.body(ResponseBody.create(
MediaType.parse("application/json"),
cached)
).build();
} else {
return response;
}
} | java | private Response retrieveResponseFromCache(Request request, @Nullable Response response) {
Response.Builder cachedResponse;
if (response != null) {
cachedResponse = response.newBuilder();
} else {
cachedResponse = new Response.Builder()
.request(request)
.protocol(Protocol.HTTP_1_1);
}
String cached = retrieveFromCache(request.url().toString());
if (cached != null) {
return cachedResponse
.code(200)
.body(ResponseBody.create(
MediaType.parse("application/json"),
cached)
).build();
} else {
return response;
}
} | [
"private",
"Response",
"retrieveResponseFromCache",
"(",
"Request",
"request",
",",
"@",
"Nullable",
"Response",
"response",
")",
"{",
"Response",
".",
"Builder",
"cachedResponse",
";",
"if",
"(",
"response",
"!=",
"null",
")",
"{",
"cachedResponse",
"=",
"response",
".",
"newBuilder",
"(",
")",
";",
"}",
"else",
"{",
"cachedResponse",
"=",
"new",
"Response",
".",
"Builder",
"(",
")",
".",
"request",
"(",
"request",
")",
".",
"protocol",
"(",
"Protocol",
".",
"HTTP_1_1",
")",
";",
"}",
"String",
"cached",
"=",
"retrieveFromCache",
"(",
"request",
".",
"url",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"cached",
"!=",
"null",
")",
"{",
"return",
"cachedResponse",
".",
"code",
"(",
"200",
")",
".",
"body",
"(",
"ResponseBody",
".",
"create",
"(",
"MediaType",
".",
"parse",
"(",
"\"application/json\"",
")",
",",
"cached",
")",
")",
".",
"build",
"(",
")",
";",
"}",
"else",
"{",
"return",
"response",
";",
"}",
"}"
] | Retrieve a {@link Response} from the offline layer.
@param request request for which an offline response must be retrieved
@param response original response which lead to an offline access. Can be null.
@return offline response or null if no response can be retrieve from the offline layer. | [
"Retrieve",
"a",
"{",
"@link",
"Response",
"}",
"from",
"the",
"offline",
"layer",
"."
] | train | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/offline/Offliner.java#L128-L148 |
PawelAdamski/HttpClientMock | src/main/java/com/github/paweladamski/httpclientmock/HttpClientResponseBuilder.java | HttpClientResponseBuilder.withStatus | public HttpClientResponseBuilder withStatus(int statusCode) {
"""
Sets response status code.
@param statusCode response status code
@return response builder
"""
Action lastAction = newRule.getLastAction();
StatusResponse statusAction = new StatusResponse(lastAction, statusCode);
newRule.overrideLastAction(statusAction);
return this;
} | java | public HttpClientResponseBuilder withStatus(int statusCode) {
Action lastAction = newRule.getLastAction();
StatusResponse statusAction = new StatusResponse(lastAction, statusCode);
newRule.overrideLastAction(statusAction);
return this;
} | [
"public",
"HttpClientResponseBuilder",
"withStatus",
"(",
"int",
"statusCode",
")",
"{",
"Action",
"lastAction",
"=",
"newRule",
".",
"getLastAction",
"(",
")",
";",
"StatusResponse",
"statusAction",
"=",
"new",
"StatusResponse",
"(",
"lastAction",
",",
"statusCode",
")",
";",
"newRule",
".",
"overrideLastAction",
"(",
"statusAction",
")",
";",
"return",
"this",
";",
"}"
] | Sets response status code.
@param statusCode response status code
@return response builder | [
"Sets",
"response",
"status",
"code",
"."
] | train | https://github.com/PawelAdamski/HttpClientMock/blob/0205498434bbc0c78c187a51181cac9b266a28fb/src/main/java/com/github/paweladamski/httpclientmock/HttpClientResponseBuilder.java#L39-L44 |
anotheria/moskito | moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java | MonitoringAspect.doProfilingMethod | @Around(value = "execution(* *(..)) && (@annotation(method))")
public Object doProfilingMethod(ProceedingJoinPoint pjp, Monitor method) throws Throwable {
"""
Common method profiling entry-point.
@param pjp
{@link ProceedingJoinPoint}
@param method
{@link Monitor}
@return call result
@throws Throwable
in case of error during {@link ProceedingJoinPoint#proceed()}
"""
return doProfiling(pjp, method.producerId(), method.subsystem(), method.category());
} | java | @Around(value = "execution(* *(..)) && (@annotation(method))")
public Object doProfilingMethod(ProceedingJoinPoint pjp, Monitor method) throws Throwable {
return doProfiling(pjp, method.producerId(), method.subsystem(), method.category());
} | [
"@",
"Around",
"(",
"value",
"=",
"\"execution(* *(..)) && (@annotation(method))\"",
")",
"public",
"Object",
"doProfilingMethod",
"(",
"ProceedingJoinPoint",
"pjp",
",",
"Monitor",
"method",
")",
"throws",
"Throwable",
"{",
"return",
"doProfiling",
"(",
"pjp",
",",
"method",
".",
"producerId",
"(",
")",
",",
"method",
".",
"subsystem",
"(",
")",
",",
"method",
".",
"category",
"(",
")",
")",
";",
"}"
] | Common method profiling entry-point.
@param pjp
{@link ProceedingJoinPoint}
@param method
{@link Monitor}
@return call result
@throws Throwable
in case of error during {@link ProceedingJoinPoint#proceed()} | [
"Common",
"method",
"profiling",
"entry",
"-",
"point",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java#L36-L39 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/interest/FactoryInterestPointAlgs.java | FactoryInterestPointAlgs.harrisLaplace | public static <T extends ImageGray<T>, D extends ImageGray<D>>
FeatureLaplacePyramid<T, D> harrisLaplace(int extractRadius,
float detectThreshold,
int maxFeatures,
Class<T> imageType,
Class<D> derivType) {
"""
Creates a {@link FeatureLaplacePyramid} which is uses the Harris corner detector.
@param extractRadius Size of the feature used to detect the corners.
@param detectThreshold Minimum corner intensity required
@param maxFeatures Max number of features that can be found.
@param imageType Type of input image.
@param derivType Image derivative type.
@return CornerLaplaceScaleSpace
"""
GradientCornerIntensity<D> harris = FactoryIntensityPointAlg.harris(extractRadius, 0.04f, false, derivType);
GeneralFeatureIntensity<T, D> intensity = new WrapperGradientCornerIntensity<>(harris);
NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(
new ConfigExtract(extractRadius, detectThreshold, extractRadius, true));
GeneralFeatureDetector<T, D> detector = new GeneralFeatureDetector<>(intensity, extractor);
detector.setMaxFeatures(maxFeatures);
AnyImageDerivative<T, D> deriv = GImageDerivativeOps.derivativeForScaleSpace(imageType,derivType);
ImageFunctionSparse<T> sparseLaplace = FactoryDerivativeSparse.createLaplacian(imageType, null);
return new FeatureLaplacePyramid<>(detector, sparseLaplace, deriv, 2);
} | java | public static <T extends ImageGray<T>, D extends ImageGray<D>>
FeatureLaplacePyramid<T, D> harrisLaplace(int extractRadius,
float detectThreshold,
int maxFeatures,
Class<T> imageType,
Class<D> derivType) {
GradientCornerIntensity<D> harris = FactoryIntensityPointAlg.harris(extractRadius, 0.04f, false, derivType);
GeneralFeatureIntensity<T, D> intensity = new WrapperGradientCornerIntensity<>(harris);
NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(
new ConfigExtract(extractRadius, detectThreshold, extractRadius, true));
GeneralFeatureDetector<T, D> detector = new GeneralFeatureDetector<>(intensity, extractor);
detector.setMaxFeatures(maxFeatures);
AnyImageDerivative<T, D> deriv = GImageDerivativeOps.derivativeForScaleSpace(imageType,derivType);
ImageFunctionSparse<T> sparseLaplace = FactoryDerivativeSparse.createLaplacian(imageType, null);
return new FeatureLaplacePyramid<>(detector, sparseLaplace, deriv, 2);
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
",",
"D",
"extends",
"ImageGray",
"<",
"D",
">",
">",
"FeatureLaplacePyramid",
"<",
"T",
",",
"D",
">",
"harrisLaplace",
"(",
"int",
"extractRadius",
",",
"float",
"detectThreshold",
",",
"int",
"maxFeatures",
",",
"Class",
"<",
"T",
">",
"imageType",
",",
"Class",
"<",
"D",
">",
"derivType",
")",
"{",
"GradientCornerIntensity",
"<",
"D",
">",
"harris",
"=",
"FactoryIntensityPointAlg",
".",
"harris",
"(",
"extractRadius",
",",
"0.04f",
",",
"false",
",",
"derivType",
")",
";",
"GeneralFeatureIntensity",
"<",
"T",
",",
"D",
">",
"intensity",
"=",
"new",
"WrapperGradientCornerIntensity",
"<>",
"(",
"harris",
")",
";",
"NonMaxSuppression",
"extractor",
"=",
"FactoryFeatureExtractor",
".",
"nonmax",
"(",
"new",
"ConfigExtract",
"(",
"extractRadius",
",",
"detectThreshold",
",",
"extractRadius",
",",
"true",
")",
")",
";",
"GeneralFeatureDetector",
"<",
"T",
",",
"D",
">",
"detector",
"=",
"new",
"GeneralFeatureDetector",
"<>",
"(",
"intensity",
",",
"extractor",
")",
";",
"detector",
".",
"setMaxFeatures",
"(",
"maxFeatures",
")",
";",
"AnyImageDerivative",
"<",
"T",
",",
"D",
">",
"deriv",
"=",
"GImageDerivativeOps",
".",
"derivativeForScaleSpace",
"(",
"imageType",
",",
"derivType",
")",
";",
"ImageFunctionSparse",
"<",
"T",
">",
"sparseLaplace",
"=",
"FactoryDerivativeSparse",
".",
"createLaplacian",
"(",
"imageType",
",",
"null",
")",
";",
"return",
"new",
"FeatureLaplacePyramid",
"<>",
"(",
"detector",
",",
"sparseLaplace",
",",
"deriv",
",",
"2",
")",
";",
"}"
] | Creates a {@link FeatureLaplacePyramid} which is uses the Harris corner detector.
@param extractRadius Size of the feature used to detect the corners.
@param detectThreshold Minimum corner intensity required
@param maxFeatures Max number of features that can be found.
@param imageType Type of input image.
@param derivType Image derivative type.
@return CornerLaplaceScaleSpace | [
"Creates",
"a",
"{",
"@link",
"FeatureLaplacePyramid",
"}",
"which",
"is",
"uses",
"the",
"Harris",
"corner",
"detector",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/interest/FactoryInterestPointAlgs.java#L144-L161 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java | ClustersInner.beginExecuteScriptActions | public void beginExecuteScriptActions(String resourceGroupName, String clusterName, ExecuteScriptActionParameters parameters) {
"""
Executes script actions on the specified HDInsight cluster.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@param parameters The parameters for executing script actions.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
"""
beginExecuteScriptActionsWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body();
} | java | public void beginExecuteScriptActions(String resourceGroupName, String clusterName, ExecuteScriptActionParameters parameters) {
beginExecuteScriptActionsWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body();
} | [
"public",
"void",
"beginExecuteScriptActions",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"ExecuteScriptActionParameters",
"parameters",
")",
"{",
"beginExecuteScriptActionsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Executes script actions on the specified HDInsight cluster.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@param parameters The parameters for executing script actions.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Executes",
"script",
"actions",
"on",
"the",
"specified",
"HDInsight",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java#L1795-L1797 |
mapsforge/mapsforge | mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/model/TDNode.java | TDNode.fromNode | public static TDNode fromNode(Node node, List<String> preferredLanguages) {
"""
Constructs a new TDNode from a given osmosis node entity. Checks the validity of the entity.
@param node the osmosis entity
@param preferredLanguages the preferred language(s) or null if no preference
@return a new TDNode
"""
SpecialTagExtractionResult ster = OSMUtils.extractSpecialFields(node, preferredLanguages);
Map<Short, Object> knownWayTags = OSMUtils.extractKnownPOITags(node);
return new TDNode(node.getId(), LatLongUtils.degreesToMicrodegrees(node.getLatitude()),
LatLongUtils.degreesToMicrodegrees(node.getLongitude()), ster.getElevation(), ster.getLayer(),
ster.getHousenumber(), ster.getName(), knownWayTags);
} | java | public static TDNode fromNode(Node node, List<String> preferredLanguages) {
SpecialTagExtractionResult ster = OSMUtils.extractSpecialFields(node, preferredLanguages);
Map<Short, Object> knownWayTags = OSMUtils.extractKnownPOITags(node);
return new TDNode(node.getId(), LatLongUtils.degreesToMicrodegrees(node.getLatitude()),
LatLongUtils.degreesToMicrodegrees(node.getLongitude()), ster.getElevation(), ster.getLayer(),
ster.getHousenumber(), ster.getName(), knownWayTags);
} | [
"public",
"static",
"TDNode",
"fromNode",
"(",
"Node",
"node",
",",
"List",
"<",
"String",
">",
"preferredLanguages",
")",
"{",
"SpecialTagExtractionResult",
"ster",
"=",
"OSMUtils",
".",
"extractSpecialFields",
"(",
"node",
",",
"preferredLanguages",
")",
";",
"Map",
"<",
"Short",
",",
"Object",
">",
"knownWayTags",
"=",
"OSMUtils",
".",
"extractKnownPOITags",
"(",
"node",
")",
";",
"return",
"new",
"TDNode",
"(",
"node",
".",
"getId",
"(",
")",
",",
"LatLongUtils",
".",
"degreesToMicrodegrees",
"(",
"node",
".",
"getLatitude",
"(",
")",
")",
",",
"LatLongUtils",
".",
"degreesToMicrodegrees",
"(",
"node",
".",
"getLongitude",
"(",
")",
")",
",",
"ster",
".",
"getElevation",
"(",
")",
",",
"ster",
".",
"getLayer",
"(",
")",
",",
"ster",
".",
"getHousenumber",
"(",
")",
",",
"ster",
".",
"getName",
"(",
")",
",",
"knownWayTags",
")",
";",
"}"
] | Constructs a new TDNode from a given osmosis node entity. Checks the validity of the entity.
@param node the osmosis entity
@param preferredLanguages the preferred language(s) or null if no preference
@return a new TDNode | [
"Constructs",
"a",
"new",
"TDNode",
"from",
"a",
"given",
"osmosis",
"node",
"entity",
".",
"Checks",
"the",
"validity",
"of",
"the",
"entity",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/model/TDNode.java#L42-L49 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobsInner.java | JobsInner.stopAsync | public Observable<Void> stopAsync(String resourceGroupName, String automationAccountName, UUID jobId) {
"""
Stop the job identified by jobId.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param jobId The job id.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return stopWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> stopAsync(String resourceGroupName, String automationAccountName, UUID jobId) {
return stopWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"stopAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"UUID",
"jobId",
")",
"{",
"return",
"stopWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
",",
"jobId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Void",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponse",
"<",
"Void",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Stop the job identified by jobId.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param jobId The job id.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Stop",
"the",
"job",
"identified",
"by",
"jobId",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobsInner.java#L417-L424 |
relayrides/pushy | pushy/src/main/java/com/turo/pushy/apns/ApnsClientBuilder.java | ApnsClientBuilder.setClientCredentials | public ApnsClientBuilder setClientCredentials(final X509Certificate clientCertificate, final PrivateKey privateKey, final String privateKeyPassword) {
"""
<p>Sets the TLS credentials for the client under construction. Clients constructed with TLS credentials will use
TLS-based authentication when sending push notifications.</p>
<p>Clients may not have both TLS credentials and a signing key.</p>
@param clientCertificate the certificate to be used to identify the client to the APNs server
@param privateKey the private key for the client certificate
@param privateKeyPassword the password to be used to decrypt the private key; may be {@code null} if the private
key does not require a password
@return a reference to this builder
@since 0.8
"""
this.clientCertificate = clientCertificate;
this.privateKey = privateKey;
this.privateKeyPassword = privateKeyPassword;
return this;
} | java | public ApnsClientBuilder setClientCredentials(final X509Certificate clientCertificate, final PrivateKey privateKey, final String privateKeyPassword) {
this.clientCertificate = clientCertificate;
this.privateKey = privateKey;
this.privateKeyPassword = privateKeyPassword;
return this;
} | [
"public",
"ApnsClientBuilder",
"setClientCredentials",
"(",
"final",
"X509Certificate",
"clientCertificate",
",",
"final",
"PrivateKey",
"privateKey",
",",
"final",
"String",
"privateKeyPassword",
")",
"{",
"this",
".",
"clientCertificate",
"=",
"clientCertificate",
";",
"this",
".",
"privateKey",
"=",
"privateKey",
";",
"this",
".",
"privateKeyPassword",
"=",
"privateKeyPassword",
";",
"return",
"this",
";",
"}"
] | <p>Sets the TLS credentials for the client under construction. Clients constructed with TLS credentials will use
TLS-based authentication when sending push notifications.</p>
<p>Clients may not have both TLS credentials and a signing key.</p>
@param clientCertificate the certificate to be used to identify the client to the APNs server
@param privateKey the private key for the client certificate
@param privateKeyPassword the password to be used to decrypt the private key; may be {@code null} if the private
key does not require a password
@return a reference to this builder
@since 0.8 | [
"<p",
">",
"Sets",
"the",
"TLS",
"credentials",
"for",
"the",
"client",
"under",
"construction",
".",
"Clients",
"constructed",
"with",
"TLS",
"credentials",
"will",
"use",
"TLS",
"-",
"based",
"authentication",
"when",
"sending",
"push",
"notifications",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/pushy/src/main/java/com/turo/pushy/apns/ApnsClientBuilder.java#L253-L259 |
playn/playn | scene/src/playn/scene/LayerUtil.java | LayerUtil.layerToParent | public static Point layerToParent(Layer layer, Layer parent, XY point, Point into) {
"""
Converts the supplied point from coordinates relative to the specified
child layer to coordinates relative to the specified parent layer. The
results are stored into {@code into}, which is returned for convenience.
"""
into.set(point);
while (layer != parent) {
if (layer == null) {
throw new IllegalArgumentException(
"Failed to find parent, perhaps you passed parent, layer instead of "
+ "layer, parent?");
}
into.x -= layer.originX();
into.y -= layer.originY();
layer.transform().transform(into, into);
layer = layer.parent();
}
return into;
} | java | public static Point layerToParent(Layer layer, Layer parent, XY point, Point into) {
into.set(point);
while (layer != parent) {
if (layer == null) {
throw new IllegalArgumentException(
"Failed to find parent, perhaps you passed parent, layer instead of "
+ "layer, parent?");
}
into.x -= layer.originX();
into.y -= layer.originY();
layer.transform().transform(into, into);
layer = layer.parent();
}
return into;
} | [
"public",
"static",
"Point",
"layerToParent",
"(",
"Layer",
"layer",
",",
"Layer",
"parent",
",",
"XY",
"point",
",",
"Point",
"into",
")",
"{",
"into",
".",
"set",
"(",
"point",
")",
";",
"while",
"(",
"layer",
"!=",
"parent",
")",
"{",
"if",
"(",
"layer",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Failed to find parent, perhaps you passed parent, layer instead of \"",
"+",
"\"layer, parent?\"",
")",
";",
"}",
"into",
".",
"x",
"-=",
"layer",
".",
"originX",
"(",
")",
";",
"into",
".",
"y",
"-=",
"layer",
".",
"originY",
"(",
")",
";",
"layer",
".",
"transform",
"(",
")",
".",
"transform",
"(",
"into",
",",
"into",
")",
";",
"layer",
"=",
"layer",
".",
"parent",
"(",
")",
";",
"}",
"return",
"into",
";",
"}"
] | Converts the supplied point from coordinates relative to the specified
child layer to coordinates relative to the specified parent layer. The
results are stored into {@code into}, which is returned for convenience. | [
"Converts",
"the",
"supplied",
"point",
"from",
"coordinates",
"relative",
"to",
"the",
"specified",
"child",
"layer",
"to",
"coordinates",
"relative",
"to",
"the",
"specified",
"parent",
"layer",
".",
"The",
"results",
"are",
"stored",
"into",
"{"
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/LayerUtil.java#L54-L68 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java | DatabaseImpl.getPublicIdentifier | public String getPublicIdentifier() throws DocumentStoreException {
"""
<p>Returns the DocumentStore's unique identifier.</p>
<p>This is used for the checkpoint document in a remote DocumentStore
during replication.</p>
@return a unique identifier for the DocumentStore.
@throws DocumentStoreException if there was an error retrieving the unique identifier from the
database
"""
Misc.checkState(this.isOpen(), "Database is closed");
try {
return get(queue.submit(new GetPublicIdentifierCallable()));
} catch (ExecutionException e) {
logger.log(Level.SEVERE, "Failed to get public ID", e);
throw new DocumentStoreException("Failed to get public ID", e);
}
} | java | public String getPublicIdentifier() throws DocumentStoreException {
Misc.checkState(this.isOpen(), "Database is closed");
try {
return get(queue.submit(new GetPublicIdentifierCallable()));
} catch (ExecutionException e) {
logger.log(Level.SEVERE, "Failed to get public ID", e);
throw new DocumentStoreException("Failed to get public ID", e);
}
} | [
"public",
"String",
"getPublicIdentifier",
"(",
")",
"throws",
"DocumentStoreException",
"{",
"Misc",
".",
"checkState",
"(",
"this",
".",
"isOpen",
"(",
")",
",",
"\"Database is closed\"",
")",
";",
"try",
"{",
"return",
"get",
"(",
"queue",
".",
"submit",
"(",
"new",
"GetPublicIdentifierCallable",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"ExecutionException",
"e",
")",
"{",
"logger",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"\"Failed to get public ID\"",
",",
"e",
")",
";",
"throw",
"new",
"DocumentStoreException",
"(",
"\"Failed to get public ID\"",
",",
"e",
")",
";",
"}",
"}"
] | <p>Returns the DocumentStore's unique identifier.</p>
<p>This is used for the checkpoint document in a remote DocumentStore
during replication.</p>
@return a unique identifier for the DocumentStore.
@throws DocumentStoreException if there was an error retrieving the unique identifier from the
database | [
"<p",
">",
"Returns",
"the",
"DocumentStore",
"s",
"unique",
"identifier",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java#L495-L503 |
dickschoeller/gedbrowser | gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/util/DateParser.java | DateParser.handleBetween | private String handleBetween(final String input) {
"""
Process between syntax. Just leave the beginning date.
@param input the source string
@return the stripped result
"""
final String outString = input.replace("BETWEEN ", "")
.replace("BET ", "").replace("FROM ", "");
return truncateAt(truncateAt(outString, " AND "), " TO ").trim();
} | java | private String handleBetween(final String input) {
final String outString = input.replace("BETWEEN ", "")
.replace("BET ", "").replace("FROM ", "");
return truncateAt(truncateAt(outString, " AND "), " TO ").trim();
} | [
"private",
"String",
"handleBetween",
"(",
"final",
"String",
"input",
")",
"{",
"final",
"String",
"outString",
"=",
"input",
".",
"replace",
"(",
"\"BETWEEN \"",
",",
"\"\"",
")",
".",
"replace",
"(",
"\"BET \"",
",",
"\"\"",
")",
".",
"replace",
"(",
"\"FROM \"",
",",
"\"\"",
")",
";",
"return",
"truncateAt",
"(",
"truncateAt",
"(",
"outString",
",",
"\" AND \"",
")",
",",
"\" TO \"",
")",
".",
"trim",
"(",
")",
";",
"}"
] | Process between syntax. Just leave the beginning date.
@param input the source string
@return the stripped result | [
"Process",
"between",
"syntax",
".",
"Just",
"leave",
"the",
"beginning",
"date",
"."
] | train | https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/util/DateParser.java#L205-L209 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/Table.java | Table.dropIndex | public void dropIndex(Session session, String indexname) {
"""
Performs Table structure modification and changes to the index nodes
to remove a given index from a MEMORY or TEXT table. Not for PK index.
"""
// find the array index for indexname and remove
int todrop = getIndexIndex(indexname);
indexList = (Index[]) ArrayUtil.toAdjustedArray(indexList, null,
todrop, -1);
for (int i = 0; i < indexList.length; i++) {
indexList[i].setPosition(i);
}
setBestRowIdentifiers();
if (store != null) {
store.resetAccessorKeys(indexList);
}
} | java | public void dropIndex(Session session, String indexname) {
// find the array index for indexname and remove
int todrop = getIndexIndex(indexname);
indexList = (Index[]) ArrayUtil.toAdjustedArray(indexList, null,
todrop, -1);
for (int i = 0; i < indexList.length; i++) {
indexList[i].setPosition(i);
}
setBestRowIdentifiers();
if (store != null) {
store.resetAccessorKeys(indexList);
}
} | [
"public",
"void",
"dropIndex",
"(",
"Session",
"session",
",",
"String",
"indexname",
")",
"{",
"// find the array index for indexname and remove",
"int",
"todrop",
"=",
"getIndexIndex",
"(",
"indexname",
")",
";",
"indexList",
"=",
"(",
"Index",
"[",
"]",
")",
"ArrayUtil",
".",
"toAdjustedArray",
"(",
"indexList",
",",
"null",
",",
"todrop",
",",
"-",
"1",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"indexList",
".",
"length",
";",
"i",
"++",
")",
"{",
"indexList",
"[",
"i",
"]",
".",
"setPosition",
"(",
"i",
")",
";",
"}",
"setBestRowIdentifiers",
"(",
")",
";",
"if",
"(",
"store",
"!=",
"null",
")",
"{",
"store",
".",
"resetAccessorKeys",
"(",
"indexList",
")",
";",
"}",
"}"
] | Performs Table structure modification and changes to the index nodes
to remove a given index from a MEMORY or TEXT table. Not for PK index. | [
"Performs",
"Table",
"structure",
"modification",
"and",
"changes",
"to",
"the",
"index",
"nodes",
"to",
"remove",
"a",
"given",
"index",
"from",
"a",
"MEMORY",
"or",
"TEXT",
"table",
".",
"Not",
"for",
"PK",
"index",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/Table.java#L2159-L2176 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/libs/modules/ModelsEngine.java | ModelsEngine.sourcesNet | public static boolean sourcesNet( RandomIter flowIterator, int[] colRow, int num, RandomIter netNum ) {
"""
Controls if the considered point is a source in the network map.
@param flowIterator
{@link RandomIter iterator} of flowdirections map
@param colRow the col and row of the point to check.
@param num
channel number
@param netNum
{@link RandomIter iterator} of the netnumbering map.
@return
"""
int[][] dir = {{0, 0, 0}, {1, 0, 5}, {1, -1, 6}, {0, -1, 7}, {-1, -1, 8}, {-1, 0, 1}, {-1, 1, 2}, {0, 1, 3}, {1, 1, 4}};
if (flowIterator.getSampleDouble(colRow[0], colRow[1], 0) <= 10.0
&& flowIterator.getSampleDouble(colRow[0], colRow[1], 0) > 0.0) {
for( int k = 1; k <= 8; k++ ) {
if (flowIterator.getSampleDouble(colRow[0] + dir[k][0], colRow[1] + dir[k][1], 0) == dir[k][2]
&& netNum.getSampleDouble(colRow[0] + dir[k][0], colRow[1] + dir[k][1], 0) == num) {
return false;
}
}
return true;
} else {
return false;
}
} | java | public static boolean sourcesNet( RandomIter flowIterator, int[] colRow, int num, RandomIter netNum ) {
int[][] dir = {{0, 0, 0}, {1, 0, 5}, {1, -1, 6}, {0, -1, 7}, {-1, -1, 8}, {-1, 0, 1}, {-1, 1, 2}, {0, 1, 3}, {1, 1, 4}};
if (flowIterator.getSampleDouble(colRow[0], colRow[1], 0) <= 10.0
&& flowIterator.getSampleDouble(colRow[0], colRow[1], 0) > 0.0) {
for( int k = 1; k <= 8; k++ ) {
if (flowIterator.getSampleDouble(colRow[0] + dir[k][0], colRow[1] + dir[k][1], 0) == dir[k][2]
&& netNum.getSampleDouble(colRow[0] + dir[k][0], colRow[1] + dir[k][1], 0) == num) {
return false;
}
}
return true;
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"sourcesNet",
"(",
"RandomIter",
"flowIterator",
",",
"int",
"[",
"]",
"colRow",
",",
"int",
"num",
",",
"RandomIter",
"netNum",
")",
"{",
"int",
"[",
"]",
"[",
"]",
"dir",
"=",
"{",
"{",
"0",
",",
"0",
",",
"0",
"}",
",",
"{",
"1",
",",
"0",
",",
"5",
"}",
",",
"{",
"1",
",",
"-",
"1",
",",
"6",
"}",
",",
"{",
"0",
",",
"-",
"1",
",",
"7",
"}",
",",
"{",
"-",
"1",
",",
"-",
"1",
",",
"8",
"}",
",",
"{",
"-",
"1",
",",
"0",
",",
"1",
"}",
",",
"{",
"-",
"1",
",",
"1",
",",
"2",
"}",
",",
"{",
"0",
",",
"1",
",",
"3",
"}",
",",
"{",
"1",
",",
"1",
",",
"4",
"}",
"}",
";",
"if",
"(",
"flowIterator",
".",
"getSampleDouble",
"(",
"colRow",
"[",
"0",
"]",
",",
"colRow",
"[",
"1",
"]",
",",
"0",
")",
"<=",
"10.0",
"&&",
"flowIterator",
".",
"getSampleDouble",
"(",
"colRow",
"[",
"0",
"]",
",",
"colRow",
"[",
"1",
"]",
",",
"0",
")",
">",
"0.0",
")",
"{",
"for",
"(",
"int",
"k",
"=",
"1",
";",
"k",
"<=",
"8",
";",
"k",
"++",
")",
"{",
"if",
"(",
"flowIterator",
".",
"getSampleDouble",
"(",
"colRow",
"[",
"0",
"]",
"+",
"dir",
"[",
"k",
"]",
"[",
"0",
"]",
",",
"colRow",
"[",
"1",
"]",
"+",
"dir",
"[",
"k",
"]",
"[",
"1",
"]",
",",
"0",
")",
"==",
"dir",
"[",
"k",
"]",
"[",
"2",
"]",
"&&",
"netNum",
".",
"getSampleDouble",
"(",
"colRow",
"[",
"0",
"]",
"+",
"dir",
"[",
"k",
"]",
"[",
"0",
"]",
",",
"colRow",
"[",
"1",
"]",
"+",
"dir",
"[",
"k",
"]",
"[",
"1",
"]",
",",
"0",
")",
"==",
"num",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] | Controls if the considered point is a source in the network map.
@param flowIterator
{@link RandomIter iterator} of flowdirections map
@param colRow the col and row of the point to check.
@param num
channel number
@param netNum
{@link RandomIter iterator} of the netnumbering map.
@return | [
"Controls",
"if",
"the",
"considered",
"point",
"is",
"a",
"source",
"in",
"the",
"network",
"map",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/libs/modules/ModelsEngine.java#L442-L458 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ListApi.java | ListApi.getNullableString | public static String getNullableString(final List list, final Integer... path) {
"""
Get string value by path.
@param list subject
@param path nodes to walk in map
@return value
"""
return getNullable(list, String.class, path);
} | java | public static String getNullableString(final List list, final Integer... path) {
return getNullable(list, String.class, path);
} | [
"public",
"static",
"String",
"getNullableString",
"(",
"final",
"List",
"list",
",",
"final",
"Integer",
"...",
"path",
")",
"{",
"return",
"getNullable",
"(",
"list",
",",
"String",
".",
"class",
",",
"path",
")",
";",
"}"
] | Get string value by path.
@param list subject
@param path nodes to walk in map
@return value | [
"Get",
"string",
"value",
"by",
"path",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ListApi.java#L160-L162 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/automaticdifferentiation/backward/alternative/RandomVariableUniqueVariableFactory.java | RandomVariableUniqueVariableFactory.createRandomVariable | public RandomVariable createRandomVariable(RandomVariable randomvariable, boolean isConstant, ArrayList<RandomVariableUniqueVariable> parentVariables, RandomVariableUniqueVariable.OperatorType parentOperatorType) {
"""
Add an object of {@link RandomVariable} to variable list at the index of the current ID
and rises the current ID to the next one.
@param randomvariable object of {@link RandomVariable} to add to ArrayList and return as {@link RandomVariableUniqueVariable}
@param isConstant boolean such that if true the derivative will be set to zero
@param parentVariables List of {@link RandomVariableUniqueVariable} that are the parents of the new instance
@param parentOperatorType Operator type
@return new instance of {@link RandomVariableUniqueVariable}
"""
int factoryID = currentFactoryID++;
listOfAllVariables.add(
factoryID,
randomvariable
);
return new RandomVariableUniqueVariable(factoryID, isConstant, parentVariables, parentOperatorType);
} | java | public RandomVariable createRandomVariable(RandomVariable randomvariable, boolean isConstant, ArrayList<RandomVariableUniqueVariable> parentVariables, RandomVariableUniqueVariable.OperatorType parentOperatorType) {
int factoryID = currentFactoryID++;
listOfAllVariables.add(
factoryID,
randomvariable
);
return new RandomVariableUniqueVariable(factoryID, isConstant, parentVariables, parentOperatorType);
} | [
"public",
"RandomVariable",
"createRandomVariable",
"(",
"RandomVariable",
"randomvariable",
",",
"boolean",
"isConstant",
",",
"ArrayList",
"<",
"RandomVariableUniqueVariable",
">",
"parentVariables",
",",
"RandomVariableUniqueVariable",
".",
"OperatorType",
"parentOperatorType",
")",
"{",
"int",
"factoryID",
"=",
"currentFactoryID",
"++",
";",
"listOfAllVariables",
".",
"add",
"(",
"factoryID",
",",
"randomvariable",
")",
";",
"return",
"new",
"RandomVariableUniqueVariable",
"(",
"factoryID",
",",
"isConstant",
",",
"parentVariables",
",",
"parentOperatorType",
")",
";",
"}"
] | Add an object of {@link RandomVariable} to variable list at the index of the current ID
and rises the current ID to the next one.
@param randomvariable object of {@link RandomVariable} to add to ArrayList and return as {@link RandomVariableUniqueVariable}
@param isConstant boolean such that if true the derivative will be set to zero
@param parentVariables List of {@link RandomVariableUniqueVariable} that are the parents of the new instance
@param parentOperatorType Operator type
@return new instance of {@link RandomVariableUniqueVariable} | [
"Add",
"an",
"object",
"of",
"{"
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/automaticdifferentiation/backward/alternative/RandomVariableUniqueVariableFactory.java#L49-L59 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/Check.java | Check.superiorStrict | public static void superiorStrict(int a, int b) {
"""
Check if <code>a</code> is strictly superior to <code>b</code>.
@param a The parameter to test.
@param b The parameter to compare to.
@throws LionEngineException If check failed.
"""
if (a <= b)
{
throw new LionEngineException(ERROR_ARGUMENT
+ String.valueOf(a)
+ ERROR_SUPERIOR_STRICT
+ String.valueOf(b));
}
} | java | public static void superiorStrict(int a, int b)
{
if (a <= b)
{
throw new LionEngineException(ERROR_ARGUMENT
+ String.valueOf(a)
+ ERROR_SUPERIOR_STRICT
+ String.valueOf(b));
}
} | [
"public",
"static",
"void",
"superiorStrict",
"(",
"int",
"a",
",",
"int",
"b",
")",
"{",
"if",
"(",
"a",
"<=",
"b",
")",
"{",
"throw",
"new",
"LionEngineException",
"(",
"ERROR_ARGUMENT",
"+",
"String",
".",
"valueOf",
"(",
"a",
")",
"+",
"ERROR_SUPERIOR_STRICT",
"+",
"String",
".",
"valueOf",
"(",
"b",
")",
")",
";",
"}",
"}"
] | Check if <code>a</code> is strictly superior to <code>b</code>.
@param a The parameter to test.
@param b The parameter to compare to.
@throws LionEngineException If check failed. | [
"Check",
"if",
"<code",
">",
"a<",
"/",
"code",
">",
"is",
"strictly",
"superior",
"to",
"<code",
">",
"b<",
"/",
"code",
">",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/Check.java#L82-L91 |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.getLayoutDimension | private int getLayoutDimension(final int dimension, final int margin, final int total) {
"""
Returns a dimension (width or height) of the dialog, depending of the margin of the
corresponding orientation and the display space, which is available in total.
@param dimension
The dimension, which should be used, in pixels as an {@link Integer value}
@param margin
The margin in pixels as an {@link Integer} value
@param total
The display space, which is available in total, in pixels as an {@link Integer}
value
@return The dimension of the dialog as an {@link Integer} value
"""
if (dimension == Dialog.MATCH_PARENT) {
return RelativeLayout.LayoutParams.MATCH_PARENT;
} else if (dimension == Dialog.WRAP_CONTENT) {
return RelativeLayout.LayoutParams.WRAP_CONTENT;
} else {
return Math.min(dimension, total - margin);
}
} | java | private int getLayoutDimension(final int dimension, final int margin, final int total) {
if (dimension == Dialog.MATCH_PARENT) {
return RelativeLayout.LayoutParams.MATCH_PARENT;
} else if (dimension == Dialog.WRAP_CONTENT) {
return RelativeLayout.LayoutParams.WRAP_CONTENT;
} else {
return Math.min(dimension, total - margin);
}
} | [
"private",
"int",
"getLayoutDimension",
"(",
"final",
"int",
"dimension",
",",
"final",
"int",
"margin",
",",
"final",
"int",
"total",
")",
"{",
"if",
"(",
"dimension",
"==",
"Dialog",
".",
"MATCH_PARENT",
")",
"{",
"return",
"RelativeLayout",
".",
"LayoutParams",
".",
"MATCH_PARENT",
";",
"}",
"else",
"if",
"(",
"dimension",
"==",
"Dialog",
".",
"WRAP_CONTENT",
")",
"{",
"return",
"RelativeLayout",
".",
"LayoutParams",
".",
"WRAP_CONTENT",
";",
"}",
"else",
"{",
"return",
"Math",
".",
"min",
"(",
"dimension",
",",
"total",
"-",
"margin",
")",
";",
"}",
"}"
] | Returns a dimension (width or height) of the dialog, depending of the margin of the
corresponding orientation and the display space, which is available in total.
@param dimension
The dimension, which should be used, in pixels as an {@link Integer value}
@param margin
The margin in pixels as an {@link Integer} value
@param total
The display space, which is available in total, in pixels as an {@link Integer}
value
@return The dimension of the dialog as an {@link Integer} value | [
"Returns",
"a",
"dimension",
"(",
"width",
"or",
"height",
")",
"of",
"the",
"dialog",
"depending",
"of",
"the",
"margin",
"of",
"the",
"corresponding",
"orientation",
"and",
"the",
"display",
"space",
"which",
"is",
"available",
"in",
"total",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L653-L661 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/MutableDictionary.java | MutableDictionary.setDouble | @NonNull
@Override
public MutableDictionary setDouble(@NonNull String key, double value) {
"""
Set a double value for the given key.
@param key The key
@param value The double value.
@return The self object.
"""
return setValue(key, value);
} | java | @NonNull
@Override
public MutableDictionary setDouble(@NonNull String key, double value) {
return setValue(key, value);
} | [
"@",
"NonNull",
"@",
"Override",
"public",
"MutableDictionary",
"setDouble",
"(",
"@",
"NonNull",
"String",
"key",
",",
"double",
"value",
")",
"{",
"return",
"setValue",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Set a double value for the given key.
@param key The key
@param value The double value.
@return The self object. | [
"Set",
"a",
"double",
"value",
"for",
"the",
"given",
"key",
"."
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableDictionary.java#L182-L186 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/CommitsApi.java | CommitsApi.addComment | public Comment addComment(Object projectIdOrPath, String sha, String note, String path, Integer line, LineType lineType) throws GitLabApiException {
"""
Add a comment to a commit. In order to post a comment in a particular line of a particular file,
you must specify the full commit SHA, the path, the line and lineType should be NEW.
<pre><code>GitLab Endpoint: POST /projects/:id/repository/commits/:sha/comments</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param sha a commit hash or name of a branch or tag
@param note the text of the comment, required
@param path the file path relative to the repository, optional
@param line the line number where the comment should be placed, optional
@param lineType the line type, optional
@return a Comment instance for the posted comment
@throws GitLabApiException GitLabApiException if any exception occurs during execution
"""
GitLabApiForm formData = new GitLabApiForm()
.withParam("note", note, true)
.withParam("path", path)
.withParam("line", line)
.withParam("line_type", lineType);
Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "repository", "commits", sha, "comments");
return (response.readEntity(Comment.class));
} | java | public Comment addComment(Object projectIdOrPath, String sha, String note, String path, Integer line, LineType lineType) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("note", note, true)
.withParam("path", path)
.withParam("line", line)
.withParam("line_type", lineType);
Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "repository", "commits", sha, "comments");
return (response.readEntity(Comment.class));
} | [
"public",
"Comment",
"addComment",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"sha",
",",
"String",
"note",
",",
"String",
"path",
",",
"Integer",
"line",
",",
"LineType",
"lineType",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\"note\"",
",",
"note",
",",
"true",
")",
".",
"withParam",
"(",
"\"path\"",
",",
"path",
")",
".",
"withParam",
"(",
"\"line\"",
",",
"line",
")",
".",
"withParam",
"(",
"\"line_type\"",
",",
"lineType",
")",
";",
"Response",
"response",
"=",
"post",
"(",
"Response",
".",
"Status",
".",
"CREATED",
",",
"formData",
",",
"\"projects\"",
",",
"getProjectIdOrPath",
"(",
"projectIdOrPath",
")",
",",
"\"repository\"",
",",
"\"commits\"",
",",
"sha",
",",
"\"comments\"",
")",
";",
"return",
"(",
"response",
".",
"readEntity",
"(",
"Comment",
".",
"class",
")",
")",
";",
"}"
] | Add a comment to a commit. In order to post a comment in a particular line of a particular file,
you must specify the full commit SHA, the path, the line and lineType should be NEW.
<pre><code>GitLab Endpoint: POST /projects/:id/repository/commits/:sha/comments</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param sha a commit hash or name of a branch or tag
@param note the text of the comment, required
@param path the file path relative to the repository, optional
@param line the line number where the comment should be placed, optional
@param lineType the line type, optional
@return a Comment instance for the posted comment
@throws GitLabApiException GitLabApiException if any exception occurs during execution | [
"Add",
"a",
"comment",
"to",
"a",
"commit",
".",
"In",
"order",
"to",
"post",
"a",
"comment",
"in",
"a",
"particular",
"line",
"of",
"a",
"particular",
"file",
"you",
"must",
"specify",
"the",
"full",
"commit",
"SHA",
"the",
"path",
"the",
"line",
"and",
"lineType",
"should",
"be",
"NEW",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/CommitsApi.java#L526-L534 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java | VirtualHubsInner.getByResourceGroupAsync | public Observable<VirtualHubInner> getByResourceGroupAsync(String resourceGroupName, String virtualHubName) {
"""
Retrieves the details of a VirtualHub.
@param resourceGroupName The resource group name of the VirtualHub.
@param virtualHubName The name of the VirtualHub.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualHubInner object
"""
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualHubName).map(new Func1<ServiceResponse<VirtualHubInner>, VirtualHubInner>() {
@Override
public VirtualHubInner call(ServiceResponse<VirtualHubInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualHubInner> getByResourceGroupAsync(String resourceGroupName, String virtualHubName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualHubName).map(new Func1<ServiceResponse<VirtualHubInner>, VirtualHubInner>() {
@Override
public VirtualHubInner call(ServiceResponse<VirtualHubInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualHubInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualHubName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualHubName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"VirtualHubInner",
">",
",",
"VirtualHubInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"VirtualHubInner",
"call",
"(",
"ServiceResponse",
"<",
"VirtualHubInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Retrieves the details of a VirtualHub.
@param resourceGroupName The resource group name of the VirtualHub.
@param virtualHubName The name of the VirtualHub.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualHubInner object | [
"Retrieves",
"the",
"details",
"of",
"a",
"VirtualHub",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java#L151-L158 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.charactersRaw | protected void charactersRaw(char ch[], int start, int length)
throws org.xml.sax.SAXException {
"""
If available, when the disable-output-escaping attribute is used,
output raw text without escaping.
@param ch The characters from the XML document.
@param start The start position in the array.
@param length The number of characters to read from the array.
@throws org.xml.sax.SAXException
"""
if (m_inEntityRef)
return;
try
{
if (m_elemContext.m_startTagOpen)
{
closeStartTag();
m_elemContext.m_startTagOpen = false;
}
m_ispreserve = true;
m_writer.write(ch, start, length);
}
catch (IOException e)
{
throw new SAXException(e);
}
} | java | protected void charactersRaw(char ch[], int start, int length)
throws org.xml.sax.SAXException
{
if (m_inEntityRef)
return;
try
{
if (m_elemContext.m_startTagOpen)
{
closeStartTag();
m_elemContext.m_startTagOpen = false;
}
m_ispreserve = true;
m_writer.write(ch, start, length);
}
catch (IOException e)
{
throw new SAXException(e);
}
} | [
"protected",
"void",
"charactersRaw",
"(",
"char",
"ch",
"[",
"]",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"if",
"(",
"m_inEntityRef",
")",
"return",
";",
"try",
"{",
"if",
"(",
"m_elemContext",
".",
"m_startTagOpen",
")",
"{",
"closeStartTag",
"(",
")",
";",
"m_elemContext",
".",
"m_startTagOpen",
"=",
"false",
";",
"}",
"m_ispreserve",
"=",
"true",
";",
"m_writer",
".",
"write",
"(",
"ch",
",",
"start",
",",
"length",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"SAXException",
"(",
"e",
")",
";",
"}",
"}"
] | If available, when the disable-output-escaping attribute is used,
output raw text without escaping.
@param ch The characters from the XML document.
@param start The start position in the array.
@param length The number of characters to read from the array.
@throws org.xml.sax.SAXException | [
"If",
"available",
"when",
"the",
"disable",
"-",
"output",
"-",
"escaping",
"attribute",
"is",
"used",
"output",
"raw",
"text",
"without",
"escaping",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L1344-L1367 |
mcxiaoke/Android-Next | core/src/main/java/com/mcxiaoke/next/geo/LastLocationFinder.java | LastLocationFinder.getLastBestLocation | public Location getLastBestLocation(int minDistance, long minTime) {
"""
Returns the most accurate and timely previously detected location.
Where the last result is beyond the specified maximum distance or
latency a one-off location update is returned via the {@link LocationListener}
@param minDistance Minimum distance before we require a location update.
@param minTime Minimum time required between location updates.
@return The most accurate and / or timely previously detected location.
"""
Location bestResult = null;
float bestAccuracy = Float.MAX_VALUE;
long bestTime = Long.MIN_VALUE;
// Iterate through all the providers on the system, keeping
// note of the most accurate result within the acceptable time limit.
// If no result is found within maxTime, return the newest Location.
List<String> matchingProviders = locationManager.getAllProviders();
for (String provider : matchingProviders) {
Location location = locationManager.getLastKnownLocation(provider);
if (location != null) {
float accuracy = location.getAccuracy();
long time = location.getTime();
if ((time > minTime && accuracy < bestAccuracy)) {
bestResult = location;
bestAccuracy = accuracy;
bestTime = time;
} else if (time < minTime && bestAccuracy == Float.MAX_VALUE && time > bestTime) {
bestResult = location;
bestTime = time;
}
}
}
// If the best result is beyond the allowed time limit, or the accuracy of the
// best result is wider than the acceptable maximum distance, request a single update.
// This check simply implements the same conditions we set when requesting regular
// location updates every [minTime] and [minDistance].
if (locationListener != null && (bestTime < minTime || bestAccuracy > minDistance)) {
IntentFilter locIntentFilter = new IntentFilter(SINGLE_LOCATION_UPDATE_ACTION);
context.registerReceiver(singleUpdateReceiver, locIntentFilter);
locationManager.requestSingleUpdate(criteria, pendingIntent);
}
return bestResult;
} | java | public Location getLastBestLocation(int minDistance, long minTime) {
Location bestResult = null;
float bestAccuracy = Float.MAX_VALUE;
long bestTime = Long.MIN_VALUE;
// Iterate through all the providers on the system, keeping
// note of the most accurate result within the acceptable time limit.
// If no result is found within maxTime, return the newest Location.
List<String> matchingProviders = locationManager.getAllProviders();
for (String provider : matchingProviders) {
Location location = locationManager.getLastKnownLocation(provider);
if (location != null) {
float accuracy = location.getAccuracy();
long time = location.getTime();
if ((time > minTime && accuracy < bestAccuracy)) {
bestResult = location;
bestAccuracy = accuracy;
bestTime = time;
} else if (time < minTime && bestAccuracy == Float.MAX_VALUE && time > bestTime) {
bestResult = location;
bestTime = time;
}
}
}
// If the best result is beyond the allowed time limit, or the accuracy of the
// best result is wider than the acceptable maximum distance, request a single update.
// This check simply implements the same conditions we set when requesting regular
// location updates every [minTime] and [minDistance].
if (locationListener != null && (bestTime < minTime || bestAccuracy > minDistance)) {
IntentFilter locIntentFilter = new IntentFilter(SINGLE_LOCATION_UPDATE_ACTION);
context.registerReceiver(singleUpdateReceiver, locIntentFilter);
locationManager.requestSingleUpdate(criteria, pendingIntent);
}
return bestResult;
} | [
"public",
"Location",
"getLastBestLocation",
"(",
"int",
"minDistance",
",",
"long",
"minTime",
")",
"{",
"Location",
"bestResult",
"=",
"null",
";",
"float",
"bestAccuracy",
"=",
"Float",
".",
"MAX_VALUE",
";",
"long",
"bestTime",
"=",
"Long",
".",
"MIN_VALUE",
";",
"// Iterate through all the providers on the system, keeping",
"// note of the most accurate result within the acceptable time limit.",
"// If no result is found within maxTime, return the newest Location.",
"List",
"<",
"String",
">",
"matchingProviders",
"=",
"locationManager",
".",
"getAllProviders",
"(",
")",
";",
"for",
"(",
"String",
"provider",
":",
"matchingProviders",
")",
"{",
"Location",
"location",
"=",
"locationManager",
".",
"getLastKnownLocation",
"(",
"provider",
")",
";",
"if",
"(",
"location",
"!=",
"null",
")",
"{",
"float",
"accuracy",
"=",
"location",
".",
"getAccuracy",
"(",
")",
";",
"long",
"time",
"=",
"location",
".",
"getTime",
"(",
")",
";",
"if",
"(",
"(",
"time",
">",
"minTime",
"&&",
"accuracy",
"<",
"bestAccuracy",
")",
")",
"{",
"bestResult",
"=",
"location",
";",
"bestAccuracy",
"=",
"accuracy",
";",
"bestTime",
"=",
"time",
";",
"}",
"else",
"if",
"(",
"time",
"<",
"minTime",
"&&",
"bestAccuracy",
"==",
"Float",
".",
"MAX_VALUE",
"&&",
"time",
">",
"bestTime",
")",
"{",
"bestResult",
"=",
"location",
";",
"bestTime",
"=",
"time",
";",
"}",
"}",
"}",
"// If the best result is beyond the allowed time limit, or the accuracy of the",
"// best result is wider than the acceptable maximum distance, request a single update.",
"// This check simply implements the same conditions we set when requesting regular",
"// location updates every [minTime] and [minDistance].",
"if",
"(",
"locationListener",
"!=",
"null",
"&&",
"(",
"bestTime",
"<",
"minTime",
"||",
"bestAccuracy",
">",
"minDistance",
")",
")",
"{",
"IntentFilter",
"locIntentFilter",
"=",
"new",
"IntentFilter",
"(",
"SINGLE_LOCATION_UPDATE_ACTION",
")",
";",
"context",
".",
"registerReceiver",
"(",
"singleUpdateReceiver",
",",
"locIntentFilter",
")",
";",
"locationManager",
".",
"requestSingleUpdate",
"(",
"criteria",
",",
"pendingIntent",
")",
";",
"}",
"return",
"bestResult",
";",
"}"
] | Returns the most accurate and timely previously detected location.
Where the last result is beyond the specified maximum distance or
latency a one-off location update is returned via the {@link LocationListener}
@param minDistance Minimum distance before we require a location update.
@param minTime Minimum time required between location updates.
@return The most accurate and / or timely previously detected location. | [
"Returns",
"the",
"most",
"accurate",
"and",
"timely",
"previously",
"detected",
"location",
".",
"Where",
"the",
"last",
"result",
"is",
"beyond",
"the",
"specified",
"maximum",
"distance",
"or",
"latency",
"a",
"one",
"-",
"off",
"location",
"update",
"is",
"returned",
"via",
"the",
"{",
"@link",
"LocationListener",
"}"
] | train | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/geo/LastLocationFinder.java#L69-L106 |
fabiomaffioletti/jsondoc | jsondoc-core/src/main/java/org/jsondoc/core/scanner/AbstractJSONDocScanner.java | AbstractJSONDocScanner.getApiDoc | private ApiDoc getApiDoc(Class<?> controller, MethodDisplay displayMethodAs) {
"""
Gets the API documentation for a single class annotated with @Api and for its methods, annotated with @ApiMethod
@param controller
@return
"""
log.debug("Getting JSONDoc for class: " + controller.getName());
ApiDoc apiDoc = initApiDoc(controller);
apiDoc.setSupportedversions(JSONDocApiVersionDocBuilder.build(controller));
apiDoc.setAuth(JSONDocApiAuthDocBuilder.getApiAuthDocForController(controller));
apiDoc.setMethods(getApiMethodDocs(controller, displayMethodAs));
if(controller.isAnnotationPresent(Api.class)) {
apiDoc = mergeApiDoc(controller, apiDoc);
}
return apiDoc;
} | java | private ApiDoc getApiDoc(Class<?> controller, MethodDisplay displayMethodAs) {
log.debug("Getting JSONDoc for class: " + controller.getName());
ApiDoc apiDoc = initApiDoc(controller);
apiDoc.setSupportedversions(JSONDocApiVersionDocBuilder.build(controller));
apiDoc.setAuth(JSONDocApiAuthDocBuilder.getApiAuthDocForController(controller));
apiDoc.setMethods(getApiMethodDocs(controller, displayMethodAs));
if(controller.isAnnotationPresent(Api.class)) {
apiDoc = mergeApiDoc(controller, apiDoc);
}
return apiDoc;
} | [
"private",
"ApiDoc",
"getApiDoc",
"(",
"Class",
"<",
"?",
">",
"controller",
",",
"MethodDisplay",
"displayMethodAs",
")",
"{",
"log",
".",
"debug",
"(",
"\"Getting JSONDoc for class: \"",
"+",
"controller",
".",
"getName",
"(",
")",
")",
";",
"ApiDoc",
"apiDoc",
"=",
"initApiDoc",
"(",
"controller",
")",
";",
"apiDoc",
".",
"setSupportedversions",
"(",
"JSONDocApiVersionDocBuilder",
".",
"build",
"(",
"controller",
")",
")",
";",
"apiDoc",
".",
"setAuth",
"(",
"JSONDocApiAuthDocBuilder",
".",
"getApiAuthDocForController",
"(",
"controller",
")",
")",
";",
"apiDoc",
".",
"setMethods",
"(",
"getApiMethodDocs",
"(",
"controller",
",",
"displayMethodAs",
")",
")",
";",
"if",
"(",
"controller",
".",
"isAnnotationPresent",
"(",
"Api",
".",
"class",
")",
")",
"{",
"apiDoc",
"=",
"mergeApiDoc",
"(",
"controller",
",",
"apiDoc",
")",
";",
"}",
"return",
"apiDoc",
";",
"}"
] | Gets the API documentation for a single class annotated with @Api and for its methods, annotated with @ApiMethod
@param controller
@return | [
"Gets",
"the",
"API",
"documentation",
"for",
"a",
"single",
"class",
"annotated",
"with"
] | train | https://github.com/fabiomaffioletti/jsondoc/blob/26bf413c236e7c3b66f534c2451b157783c1f45e/jsondoc-core/src/main/java/org/jsondoc/core/scanner/AbstractJSONDocScanner.java#L135-L148 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java | VirtualNetworksInner.beginCreateOrUpdate | public VirtualNetworkInner beginCreateOrUpdate(String resourceGroupName, String virtualNetworkName, VirtualNetworkInner parameters) {
"""
Creates or updates a virtual network in the specified resource group.
@param resourceGroupName The name of the resource group.
@param virtualNetworkName The name of the virtual network.
@param parameters Parameters supplied to the create or update virtual network operation
@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 VirtualNetworkInner object if successful.
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, parameters).toBlocking().single().body();
} | java | public VirtualNetworkInner beginCreateOrUpdate(String resourceGroupName, String virtualNetworkName, VirtualNetworkInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, parameters).toBlocking().single().body();
} | [
"public",
"VirtualNetworkInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkName",
",",
"VirtualNetworkInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates or updates a virtual network in the specified resource group.
@param resourceGroupName The name of the resource group.
@param virtualNetworkName The name of the virtual network.
@param parameters Parameters supplied to the create or update virtual network operation
@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 VirtualNetworkInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"virtual",
"network",
"in",
"the",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java#L531-L533 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftDataResultHelper.java | ThriftDataResultHelper.transformThriftResultAndAddToList | public <T> List<T> transformThriftResultAndAddToList(Map<ByteBuffer, List<ColumnOrSuperColumn>> coscResultMap,
ColumnFamilyType columnFamilyType, ThriftRow row) {
"""
Transforms data retrieved as result via thrift to a List whose content
type is determined by {@link ColumnFamilyType}.
@param <T> the generic type
@param coscResultMap the cosc result map
@param columnFamilyType the column family type
@param row the row
@return the list
"""
List<ColumnOrSuperColumn> coscList = new ArrayList<ColumnOrSuperColumn>();
for (List<ColumnOrSuperColumn> list : coscResultMap.values())
{
coscList.addAll(list);
}
return transformThriftResult(coscList, columnFamilyType, row);
} | java | public <T> List<T> transformThriftResultAndAddToList(Map<ByteBuffer, List<ColumnOrSuperColumn>> coscResultMap,
ColumnFamilyType columnFamilyType, ThriftRow row)
{
List<ColumnOrSuperColumn> coscList = new ArrayList<ColumnOrSuperColumn>();
for (List<ColumnOrSuperColumn> list : coscResultMap.values())
{
coscList.addAll(list);
}
return transformThriftResult(coscList, columnFamilyType, row);
} | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"transformThriftResultAndAddToList",
"(",
"Map",
"<",
"ByteBuffer",
",",
"List",
"<",
"ColumnOrSuperColumn",
">",
">",
"coscResultMap",
",",
"ColumnFamilyType",
"columnFamilyType",
",",
"ThriftRow",
"row",
")",
"{",
"List",
"<",
"ColumnOrSuperColumn",
">",
"coscList",
"=",
"new",
"ArrayList",
"<",
"ColumnOrSuperColumn",
">",
"(",
")",
";",
"for",
"(",
"List",
"<",
"ColumnOrSuperColumn",
">",
"list",
":",
"coscResultMap",
".",
"values",
"(",
")",
")",
"{",
"coscList",
".",
"addAll",
"(",
"list",
")",
";",
"}",
"return",
"transformThriftResult",
"(",
"coscList",
",",
"columnFamilyType",
",",
"row",
")",
";",
"}"
] | Transforms data retrieved as result via thrift to a List whose content
type is determined by {@link ColumnFamilyType}.
@param <T> the generic type
@param coscResultMap the cosc result map
@param columnFamilyType the column family type
@param row the row
@return the list | [
"Transforms",
"data",
"retrieved",
"as",
"result",
"via",
"thrift",
"to",
"a",
"List",
"whose",
"content",
"type",
"is",
"determined",
"by",
"{",
"@link",
"ColumnFamilyType",
"}",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftDataResultHelper.java#L191-L203 |
BioPAX/Paxtools | paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java | QueryExecuter.runGOI | public static Set<BioPAXElement> runGOI(
Set<BioPAXElement> sourceSet,
Model model,
int limit,
Filter... filters) {
"""
Gets paths between the seed nodes.
@param sourceSet Seed to the query
@param model BioPAX model
@param limit Length limit for the paths to be found
@param filters for filtering graph elements
@return BioPAX elements in the result
@deprecated Use runPathsBetween instead
"""
return runPathsFromTo(sourceSet, sourceSet, model, LimitType.NORMAL, limit, filters);
} | java | public static Set<BioPAXElement> runGOI(
Set<BioPAXElement> sourceSet,
Model model,
int limit,
Filter... filters)
{
return runPathsFromTo(sourceSet, sourceSet, model, LimitType.NORMAL, limit, filters);
} | [
"public",
"static",
"Set",
"<",
"BioPAXElement",
">",
"runGOI",
"(",
"Set",
"<",
"BioPAXElement",
">",
"sourceSet",
",",
"Model",
"model",
",",
"int",
"limit",
",",
"Filter",
"...",
"filters",
")",
"{",
"return",
"runPathsFromTo",
"(",
"sourceSet",
",",
"sourceSet",
",",
"model",
",",
"LimitType",
".",
"NORMAL",
",",
"limit",
",",
"filters",
")",
";",
"}"
] | Gets paths between the seed nodes.
@param sourceSet Seed to the query
@param model BioPAX model
@param limit Length limit for the paths to be found
@param filters for filtering graph elements
@return BioPAX elements in the result
@deprecated Use runPathsBetween instead | [
"Gets",
"paths",
"between",
"the",
"seed",
"nodes",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L176-L183 |
offbynull/coroutines | instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/SynchronizationGenerators.java | SynchronizationGenerators.enterMonitorAndStore | public static InsnList enterMonitorAndStore(MarkerType markerType, LockVariables lockVars) {
"""
Generates instruction to enter a monitor (top item on the stack) and store it in the {@link LockState} object sitting in the
lockstate variable.
@param markerType debug marker type
@param lockVars variables for lock/synchpoint functionality
@return instructions to enter a monitor and store it in the {@link LockState} object
@throws NullPointerException if any argument is {@code null}
@throws IllegalArgumentException if lock variables aren't set (the method doesn't contain any monitorenter/monitorexit instructions)
"""
Validate.notNull(markerType);
Validate.notNull(lockVars);
Variable lockStateVar = lockVars.getLockStateVar();
Validate.isTrue(lockStateVar != null);
Type clsType = Type.getType(LOCKSTATE_ENTER_METHOD.getDeclaringClass());
Type methodType = Type.getType(LOCKSTATE_ENTER_METHOD);
String clsInternalName = clsType.getInternalName();
String methodDesc = methodType.getDescriptor();
String methodName = LOCKSTATE_ENTER_METHOD.getName();
// NOTE: This adds to the lock state AFTER locking.
return merge(
debugMarker(markerType, "Entering monitor and storing"),
// [obj]
new InsnNode(Opcodes.DUP), // [obj, obj]
new InsnNode(Opcodes.MONITORENTER), // [obj]
new VarInsnNode(Opcodes.ALOAD, lockStateVar.getIndex()), // [obj, lockState]
new InsnNode(Opcodes.SWAP), // [lockState, obj]
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, // []
clsInternalName,
methodName,
methodDesc,
false)
);
} | java | public static InsnList enterMonitorAndStore(MarkerType markerType, LockVariables lockVars) {
Validate.notNull(markerType);
Validate.notNull(lockVars);
Variable lockStateVar = lockVars.getLockStateVar();
Validate.isTrue(lockStateVar != null);
Type clsType = Type.getType(LOCKSTATE_ENTER_METHOD.getDeclaringClass());
Type methodType = Type.getType(LOCKSTATE_ENTER_METHOD);
String clsInternalName = clsType.getInternalName();
String methodDesc = methodType.getDescriptor();
String methodName = LOCKSTATE_ENTER_METHOD.getName();
// NOTE: This adds to the lock state AFTER locking.
return merge(
debugMarker(markerType, "Entering monitor and storing"),
// [obj]
new InsnNode(Opcodes.DUP), // [obj, obj]
new InsnNode(Opcodes.MONITORENTER), // [obj]
new VarInsnNode(Opcodes.ALOAD, lockStateVar.getIndex()), // [obj, lockState]
new InsnNode(Opcodes.SWAP), // [lockState, obj]
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, // []
clsInternalName,
methodName,
methodDesc,
false)
);
} | [
"public",
"static",
"InsnList",
"enterMonitorAndStore",
"(",
"MarkerType",
"markerType",
",",
"LockVariables",
"lockVars",
")",
"{",
"Validate",
".",
"notNull",
"(",
"markerType",
")",
";",
"Validate",
".",
"notNull",
"(",
"lockVars",
")",
";",
"Variable",
"lockStateVar",
"=",
"lockVars",
".",
"getLockStateVar",
"(",
")",
";",
"Validate",
".",
"isTrue",
"(",
"lockStateVar",
"!=",
"null",
")",
";",
"Type",
"clsType",
"=",
"Type",
".",
"getType",
"(",
"LOCKSTATE_ENTER_METHOD",
".",
"getDeclaringClass",
"(",
")",
")",
";",
"Type",
"methodType",
"=",
"Type",
".",
"getType",
"(",
"LOCKSTATE_ENTER_METHOD",
")",
";",
"String",
"clsInternalName",
"=",
"clsType",
".",
"getInternalName",
"(",
")",
";",
"String",
"methodDesc",
"=",
"methodType",
".",
"getDescriptor",
"(",
")",
";",
"String",
"methodName",
"=",
"LOCKSTATE_ENTER_METHOD",
".",
"getName",
"(",
")",
";",
"// NOTE: This adds to the lock state AFTER locking.",
"return",
"merge",
"(",
"debugMarker",
"(",
"markerType",
",",
"\"Entering monitor and storing\"",
")",
",",
"// [obj]",
"new",
"InsnNode",
"(",
"Opcodes",
".",
"DUP",
")",
",",
"// [obj, obj]",
"new",
"InsnNode",
"(",
"Opcodes",
".",
"MONITORENTER",
")",
",",
"// [obj]",
"new",
"VarInsnNode",
"(",
"Opcodes",
".",
"ALOAD",
",",
"lockStateVar",
".",
"getIndex",
"(",
")",
")",
",",
"// [obj, lockState]",
"new",
"InsnNode",
"(",
"Opcodes",
".",
"SWAP",
")",
",",
"// [lockState, obj]",
"new",
"MethodInsnNode",
"(",
"Opcodes",
".",
"INVOKEVIRTUAL",
",",
"// []",
"clsInternalName",
",",
"methodName",
",",
"methodDesc",
",",
"false",
")",
")",
";",
"}"
] | Generates instruction to enter a monitor (top item on the stack) and store it in the {@link LockState} object sitting in the
lockstate variable.
@param markerType debug marker type
@param lockVars variables for lock/synchpoint functionality
@return instructions to enter a monitor and store it in the {@link LockState} object
@throws NullPointerException if any argument is {@code null}
@throws IllegalArgumentException if lock variables aren't set (the method doesn't contain any monitorenter/monitorexit instructions) | [
"Generates",
"instruction",
"to",
"enter",
"a",
"monitor",
"(",
"top",
"item",
"on",
"the",
"stack",
")",
"and",
"store",
"it",
"in",
"the",
"{"
] | train | https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/SynchronizationGenerators.java#L149-L176 |
netty/netty | common/src/main/java/io/netty/util/NetUtil.java | NetUtil.createByteArrayFromIpAddressString | public static byte[] createByteArrayFromIpAddressString(String ipAddressString) {
"""
Creates an byte[] based on an ipAddressString. No error handling is performed here.
"""
if (isValidIpV4Address(ipAddressString)) {
return validIpV4ToBytes(ipAddressString);
}
if (isValidIpV6Address(ipAddressString)) {
if (ipAddressString.charAt(0) == '[') {
ipAddressString = ipAddressString.substring(1, ipAddressString.length() - 1);
}
int percentPos = ipAddressString.indexOf('%');
if (percentPos >= 0) {
ipAddressString = ipAddressString.substring(0, percentPos);
}
return getIPv6ByName(ipAddressString, true);
}
return null;
} | java | public static byte[] createByteArrayFromIpAddressString(String ipAddressString) {
if (isValidIpV4Address(ipAddressString)) {
return validIpV4ToBytes(ipAddressString);
}
if (isValidIpV6Address(ipAddressString)) {
if (ipAddressString.charAt(0) == '[') {
ipAddressString = ipAddressString.substring(1, ipAddressString.length() - 1);
}
int percentPos = ipAddressString.indexOf('%');
if (percentPos >= 0) {
ipAddressString = ipAddressString.substring(0, percentPos);
}
return getIPv6ByName(ipAddressString, true);
}
return null;
} | [
"public",
"static",
"byte",
"[",
"]",
"createByteArrayFromIpAddressString",
"(",
"String",
"ipAddressString",
")",
"{",
"if",
"(",
"isValidIpV4Address",
"(",
"ipAddressString",
")",
")",
"{",
"return",
"validIpV4ToBytes",
"(",
"ipAddressString",
")",
";",
"}",
"if",
"(",
"isValidIpV6Address",
"(",
"ipAddressString",
")",
")",
"{",
"if",
"(",
"ipAddressString",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"{",
"ipAddressString",
"=",
"ipAddressString",
".",
"substring",
"(",
"1",
",",
"ipAddressString",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"int",
"percentPos",
"=",
"ipAddressString",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"percentPos",
">=",
"0",
")",
"{",
"ipAddressString",
"=",
"ipAddressString",
".",
"substring",
"(",
"0",
",",
"percentPos",
")",
";",
"}",
"return",
"getIPv6ByName",
"(",
"ipAddressString",
",",
"true",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Creates an byte[] based on an ipAddressString. No error handling is performed here. | [
"Creates",
"an",
"byte",
"[]",
"based",
"on",
"an",
"ipAddressString",
".",
"No",
"error",
"handling",
"is",
"performed",
"here",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/NetUtil.java#L366-L385 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cdn_dedicated_serviceName_cacheRule_duration_POST | public OvhOrder cdn_dedicated_serviceName_cacheRule_duration_POST(String serviceName, String duration, OvhOrderCacheRuleEnum cacheRule) throws IOException {
"""
Create order
REST: POST /order/cdn/dedicated/{serviceName}/cacheRule/{duration}
@param cacheRule [required] cache rule upgrade option to 100 or 1000
@param serviceName [required] The internal name of your CDN offer
@param duration [required] Duration
"""
String qPath = "/order/cdn/dedicated/{serviceName}/cacheRule/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "cacheRule", cacheRule);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder cdn_dedicated_serviceName_cacheRule_duration_POST(String serviceName, String duration, OvhOrderCacheRuleEnum cacheRule) throws IOException {
String qPath = "/order/cdn/dedicated/{serviceName}/cacheRule/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "cacheRule", cacheRule);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"cdn_dedicated_serviceName_cacheRule_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"OvhOrderCacheRuleEnum",
"cacheRule",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cdn/dedicated/{serviceName}/cacheRule/{duration}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"duration",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"cacheRule\"",
",",
"cacheRule",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhOrder",
".",
"class",
")",
";",
"}"
] | Create order
REST: POST /order/cdn/dedicated/{serviceName}/cacheRule/{duration}
@param cacheRule [required] cache rule upgrade option to 100 or 1000
@param serviceName [required] The internal name of your CDN offer
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5293-L5300 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/res/XSLMessages.java | XSLMessages.createWarning | public static final String createWarning(String msgKey, Object args[]) //throws Exception {
"""
Creates a message from the specified key and replacement
arguments, localized to the given locale.
@param msgKey The key for the message text.
@param args The arguments to be used as replacement text
in the message created.
@return The formatted warning string.
"""
// BEGIN android-changed
// don't localize exception messages
return createMsg(XSLTBundle, msgKey, args);
// END android-changed
} | java | public static final String createWarning(String msgKey, Object args[]) //throws Exception
{
// BEGIN android-changed
// don't localize exception messages
return createMsg(XSLTBundle, msgKey, args);
// END android-changed
} | [
"public",
"static",
"final",
"String",
"createWarning",
"(",
"String",
"msgKey",
",",
"Object",
"args",
"[",
"]",
")",
"//throws Exception",
"{",
"// BEGIN android-changed",
"// don't localize exception messages",
"return",
"createMsg",
"(",
"XSLTBundle",
",",
"msgKey",
",",
"args",
")",
";",
"// END android-changed",
"}"
] | Creates a message from the specified key and replacement
arguments, localized to the given locale.
@param msgKey The key for the message text.
@param args The arguments to be used as replacement text
in the message created.
@return The formatted warning string. | [
"Creates",
"a",
"message",
"from",
"the",
"specified",
"key",
"and",
"replacement",
"arguments",
"localized",
"to",
"the",
"given",
"locale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/res/XSLMessages.java#L66-L72 |
jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java | HBasePanel.printHtmlBanner | public void printHtmlBanner(PrintWriter out, ResourceBundle reg)
throws DBException {
"""
Print the top nav menu.
@param out The html out stream.
@param reg The resources object.
@exception DBException File exception.
"""
if (HBasePanel.getFirstToUpper(this.getProperty(DBParams.BANNERS), 'N') == 'Y')
{
String strNav = reg.getString("htmlBanner");
strNav = Utility.replaceResources(strNav, reg, null, null);
this.writeHtmlString(strNav, out);
}
} | java | public void printHtmlBanner(PrintWriter out, ResourceBundle reg)
throws DBException
{
if (HBasePanel.getFirstToUpper(this.getProperty(DBParams.BANNERS), 'N') == 'Y')
{
String strNav = reg.getString("htmlBanner");
strNav = Utility.replaceResources(strNav, reg, null, null);
this.writeHtmlString(strNav, out);
}
} | [
"public",
"void",
"printHtmlBanner",
"(",
"PrintWriter",
"out",
",",
"ResourceBundle",
"reg",
")",
"throws",
"DBException",
"{",
"if",
"(",
"HBasePanel",
".",
"getFirstToUpper",
"(",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"BANNERS",
")",
",",
"'",
"'",
")",
"==",
"'",
"'",
")",
"{",
"String",
"strNav",
"=",
"reg",
".",
"getString",
"(",
"\"htmlBanner\"",
")",
";",
"strNav",
"=",
"Utility",
".",
"replaceResources",
"(",
"strNav",
",",
"reg",
",",
"null",
",",
"null",
")",
";",
"this",
".",
"writeHtmlString",
"(",
"strNav",
",",
"out",
")",
";",
"}",
"}"
] | Print the top nav menu.
@param out The html out stream.
@param reg The resources object.
@exception DBException File exception. | [
"Print",
"the",
"top",
"nav",
"menu",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java#L251-L260 |
Lukaszpg/jPUBG | src/main/java/pro/lukasgorny/factory/JPubgFactory.java | JPubgFactory.getWrapper | public static JPubg getWrapper(@Nonnull String apiKey, int connectionTimeout) {
"""
Returns fully initialized, ready to use API object with specified connection timeout.
@param apiKey your http://pubgtracker.com API-KEY
@param connectionTimeout connection timeout in miliseconds (default 5000 miliseconds - 5 seconds)
@return Fully initialized API object
"""
validateApiKey(apiKey);
return new JPubgImpl(apiKey, connectionTimeout);
} | java | public static JPubg getWrapper(@Nonnull String apiKey, int connectionTimeout) {
validateApiKey(apiKey);
return new JPubgImpl(apiKey, connectionTimeout);
} | [
"public",
"static",
"JPubg",
"getWrapper",
"(",
"@",
"Nonnull",
"String",
"apiKey",
",",
"int",
"connectionTimeout",
")",
"{",
"validateApiKey",
"(",
"apiKey",
")",
";",
"return",
"new",
"JPubgImpl",
"(",
"apiKey",
",",
"connectionTimeout",
")",
";",
"}"
] | Returns fully initialized, ready to use API object with specified connection timeout.
@param apiKey your http://pubgtracker.com API-KEY
@param connectionTimeout connection timeout in miliseconds (default 5000 miliseconds - 5 seconds)
@return Fully initialized API object | [
"Returns",
"fully",
"initialized",
"ready",
"to",
"use",
"API",
"object",
"with",
"specified",
"connection",
"timeout",
"."
] | train | https://github.com/Lukaszpg/jPUBG/blob/e4ff6176dea5cb0f876e6d553f467ee882a4749a/src/main/java/pro/lukasgorny/factory/JPubgFactory.java#L34-L37 |
palatable/lambda | src/main/java/com/jnape/palatable/lambda/adt/Try.java | Try.withResources | public static <A extends AutoCloseable, B extends AutoCloseable, C> Try<Exception, C> withResources(
CheckedSupplier<? extends Exception, ? extends A> aSupplier,
CheckedFn1<? extends Exception, ? super A, ? extends B> bFn,
CheckedFn1<? extends Exception, ? super B, ? extends Try<? extends Exception, ? extends C>> fn) {
"""
Convenience overload of {@link Try#withResources(CheckedSupplier, CheckedFn1) withResources} that cascades
dependent resource creation via nested calls.
@param aSupplier the first resource supplier
@param bFn the dependent resource function
@param fn the function body
@param <A> the first resource type
@param <B> the second resource type
@param <C> the function return type
@return a {@link Try} representing the result of the function's application to the dependent resource
"""
return withResources(aSupplier, a -> withResources(() -> bFn.apply(a), fn::apply));
} | java | public static <A extends AutoCloseable, B extends AutoCloseable, C> Try<Exception, C> withResources(
CheckedSupplier<? extends Exception, ? extends A> aSupplier,
CheckedFn1<? extends Exception, ? super A, ? extends B> bFn,
CheckedFn1<? extends Exception, ? super B, ? extends Try<? extends Exception, ? extends C>> fn) {
return withResources(aSupplier, a -> withResources(() -> bFn.apply(a), fn::apply));
} | [
"public",
"static",
"<",
"A",
"extends",
"AutoCloseable",
",",
"B",
"extends",
"AutoCloseable",
",",
"C",
">",
"Try",
"<",
"Exception",
",",
"C",
">",
"withResources",
"(",
"CheckedSupplier",
"<",
"?",
"extends",
"Exception",
",",
"?",
"extends",
"A",
">",
"aSupplier",
",",
"CheckedFn1",
"<",
"?",
"extends",
"Exception",
",",
"?",
"super",
"A",
",",
"?",
"extends",
"B",
">",
"bFn",
",",
"CheckedFn1",
"<",
"?",
"extends",
"Exception",
",",
"?",
"super",
"B",
",",
"?",
"extends",
"Try",
"<",
"?",
"extends",
"Exception",
",",
"?",
"extends",
"C",
">",
">",
"fn",
")",
"{",
"return",
"withResources",
"(",
"aSupplier",
",",
"a",
"->",
"withResources",
"(",
"(",
")",
"->",
"bFn",
".",
"apply",
"(",
"a",
")",
",",
"fn",
"::",
"apply",
")",
")",
";",
"}"
] | Convenience overload of {@link Try#withResources(CheckedSupplier, CheckedFn1) withResources} that cascades
dependent resource creation via nested calls.
@param aSupplier the first resource supplier
@param bFn the dependent resource function
@param fn the function body
@param <A> the first resource type
@param <B> the second resource type
@param <C> the function return type
@return a {@link Try} representing the result of the function's application to the dependent resource | [
"Convenience",
"overload",
"of",
"{",
"@link",
"Try#withResources",
"(",
"CheckedSupplier",
"CheckedFn1",
")",
"withResources",
"}",
"that",
"cascades",
"dependent",
"resource",
"creation",
"via",
"nested",
"calls",
"."
] | train | https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/adt/Try.java#L342-L347 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.purgeDeletedSecret | public void purgeDeletedSecret(String vaultBaseUrl, String secretName) {
"""
Permanently deletes the specified secret.
The purge deleted secret operation removes the secret permanently, without the possibility of recovery. This operation can only be enabled on a soft-delete enabled vault. This operation requires the secrets/purge permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param secretName The name of the secret.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
"""
purgeDeletedSecretWithServiceResponseAsync(vaultBaseUrl, secretName).toBlocking().single().body();
} | java | public void purgeDeletedSecret(String vaultBaseUrl, String secretName) {
purgeDeletedSecretWithServiceResponseAsync(vaultBaseUrl, secretName).toBlocking().single().body();
} | [
"public",
"void",
"purgeDeletedSecret",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"secretName",
")",
"{",
"purgeDeletedSecretWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"secretName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Permanently deletes the specified secret.
The purge deleted secret operation removes the secret permanently, without the possibility of recovery. This operation can only be enabled on a soft-delete enabled vault. This operation requires the secrets/purge permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param secretName The name of the secret.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Permanently",
"deletes",
"the",
"specified",
"secret",
".",
"The",
"purge",
"deleted",
"secret",
"operation",
"removes",
"the",
"secret",
"permanently",
"without",
"the",
"possibility",
"of",
"recovery",
".",
"This",
"operation",
"can",
"only",
"be",
"enabled",
"on",
"a",
"soft",
"-",
"delete",
"enabled",
"vault",
".",
"This",
"operation",
"requires",
"the",
"secrets",
"/",
"purge",
"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#L4730-L4732 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/AssertKripton.java | AssertKripton.assertTrueOrInvalidPropertyName | public static void assertTrueOrInvalidPropertyName(boolean expression, SQLProperty item1, SQLProperty item2) {
"""
Assert true or invalid property name.
@param expression
the expression
@param item1
the item 1
@param item2
the item 2
"""
if (!expression) {
String msg = String.format("Properties '%s#%s' and '%s#%s' must have same column name",
item1.getParent().name, item1.name, item2.getParent().name, item2.name);
throw (new InvalidPropertyToColumnConversion(msg));
}
} | java | public static void assertTrueOrInvalidPropertyName(boolean expression, SQLProperty item1, SQLProperty item2) {
if (!expression) {
String msg = String.format("Properties '%s#%s' and '%s#%s' must have same column name",
item1.getParent().name, item1.name, item2.getParent().name, item2.name);
throw (new InvalidPropertyToColumnConversion(msg));
}
} | [
"public",
"static",
"void",
"assertTrueOrInvalidPropertyName",
"(",
"boolean",
"expression",
",",
"SQLProperty",
"item1",
",",
"SQLProperty",
"item2",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"String",
"msg",
"=",
"String",
".",
"format",
"(",
"\"Properties '%s#%s' and '%s#%s' must have same column name\"",
",",
"item1",
".",
"getParent",
"(",
")",
".",
"name",
",",
"item1",
".",
"name",
",",
"item2",
".",
"getParent",
"(",
")",
".",
"name",
",",
"item2",
".",
"name",
")",
";",
"throw",
"(",
"new",
"InvalidPropertyToColumnConversion",
"(",
"msg",
")",
")",
";",
"}",
"}"
] | Assert true or invalid property name.
@param expression
the expression
@param item1
the item 1
@param item2
the item 2 | [
"Assert",
"true",
"or",
"invalid",
"property",
"name",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/AssertKripton.java#L327-L334 |
wg/lettuce | src/main/java/com/lambdaworks/redis/RedisClient.java | RedisClient.connectPubSub | public <K, V> RedisPubSubConnection<K, V> connectPubSub(RedisCodec<K, V> codec) {
"""
Open a new pub/sub connection to the redis server. Use the supplied
{@link RedisCodec codec} to encode/decode keys and values.
@param codec Use this codec to encode/decode keys and values.
@return A new pub/sub connection.
"""
BlockingQueue<Command<K, V, ?>> queue = new LinkedBlockingQueue<Command<K, V, ?>>();
PubSubCommandHandler<K, V> handler = new PubSubCommandHandler<K, V>(queue, codec);
RedisPubSubConnection<K, V> connection = new RedisPubSubConnection<K, V>(queue, codec, timeout, unit);
return connect(handler, connection);
} | java | public <K, V> RedisPubSubConnection<K, V> connectPubSub(RedisCodec<K, V> codec) {
BlockingQueue<Command<K, V, ?>> queue = new LinkedBlockingQueue<Command<K, V, ?>>();
PubSubCommandHandler<K, V> handler = new PubSubCommandHandler<K, V>(queue, codec);
RedisPubSubConnection<K, V> connection = new RedisPubSubConnection<K, V>(queue, codec, timeout, unit);
return connect(handler, connection);
} | [
"public",
"<",
"K",
",",
"V",
">",
"RedisPubSubConnection",
"<",
"K",
",",
"V",
">",
"connectPubSub",
"(",
"RedisCodec",
"<",
"K",
",",
"V",
">",
"codec",
")",
"{",
"BlockingQueue",
"<",
"Command",
"<",
"K",
",",
"V",
",",
"?",
">",
">",
"queue",
"=",
"new",
"LinkedBlockingQueue",
"<",
"Command",
"<",
"K",
",",
"V",
",",
"?",
">",
">",
"(",
")",
";",
"PubSubCommandHandler",
"<",
"K",
",",
"V",
">",
"handler",
"=",
"new",
"PubSubCommandHandler",
"<",
"K",
",",
"V",
">",
"(",
"queue",
",",
"codec",
")",
";",
"RedisPubSubConnection",
"<",
"K",
",",
"V",
">",
"connection",
"=",
"new",
"RedisPubSubConnection",
"<",
"K",
",",
"V",
">",
"(",
"queue",
",",
"codec",
",",
"timeout",
",",
"unit",
")",
";",
"return",
"connect",
"(",
"handler",
",",
"connection",
")",
";",
"}"
] | Open a new pub/sub connection to the redis server. Use the supplied
{@link RedisCodec codec} to encode/decode keys and values.
@param codec Use this codec to encode/decode keys and values.
@return A new pub/sub connection. | [
"Open",
"a",
"new",
"pub",
"/",
"sub",
"connection",
"to",
"the",
"redis",
"server",
".",
"Use",
"the",
"supplied",
"{",
"@link",
"RedisCodec",
"codec",
"}",
"to",
"encode",
"/",
"decode",
"keys",
"and",
"values",
"."
] | train | https://github.com/wg/lettuce/blob/5141640dc8289ff3af07b44a87020cef719c5f4a/src/main/java/com/lambdaworks/redis/RedisClient.java#L150-L157 |
jboss/jboss-el-api_spec | src/main/java/javax/el/ELManager.java | ELManager.defineBean | public Object defineBean(String name, Object bean) {
"""
Define a bean in the local bean repository
@param name The name of the bean
@param bean The bean instance to be defined. If null, the definition
of the bean is removed.
"""
Object ret = getELContext().getBeans().get(name);
getELContext().getBeans().put(name, bean);
return ret;
} | java | public Object defineBean(String name, Object bean) {
Object ret = getELContext().getBeans().get(name);
getELContext().getBeans().put(name, bean);
return ret;
} | [
"public",
"Object",
"defineBean",
"(",
"String",
"name",
",",
"Object",
"bean",
")",
"{",
"Object",
"ret",
"=",
"getELContext",
"(",
")",
".",
"getBeans",
"(",
")",
".",
"get",
"(",
"name",
")",
";",
"getELContext",
"(",
")",
".",
"getBeans",
"(",
")",
".",
"put",
"(",
"name",
",",
"bean",
")",
";",
"return",
"ret",
";",
"}"
] | Define a bean in the local bean repository
@param name The name of the bean
@param bean The bean instance to be defined. If null, the definition
of the bean is removed. | [
"Define",
"a",
"bean",
"in",
"the",
"local",
"bean",
"repository"
] | train | https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ELManager.java#L177-L181 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java | DebuggableThreadPoolExecutor.createWithFixedPoolSize | public static DebuggableThreadPoolExecutor createWithFixedPoolSize(String threadPoolName, int size) {
"""
Returns a ThreadPoolExecutor with a fixed number of threads.
When all threads are actively executing tasks, new tasks are queued.
If (most) threads are expected to be idle most of the time, prefer createWithMaxSize() instead.
@param threadPoolName the name of the threads created by this executor
@param size the fixed number of threads for this executor
@return the new DebuggableThreadPoolExecutor
"""
return createWithMaximumPoolSize(threadPoolName, size, Integer.MAX_VALUE, TimeUnit.SECONDS);
} | java | public static DebuggableThreadPoolExecutor createWithFixedPoolSize(String threadPoolName, int size)
{
return createWithMaximumPoolSize(threadPoolName, size, Integer.MAX_VALUE, TimeUnit.SECONDS);
} | [
"public",
"static",
"DebuggableThreadPoolExecutor",
"createWithFixedPoolSize",
"(",
"String",
"threadPoolName",
",",
"int",
"size",
")",
"{",
"return",
"createWithMaximumPoolSize",
"(",
"threadPoolName",
",",
"size",
",",
"Integer",
".",
"MAX_VALUE",
",",
"TimeUnit",
".",
"SECONDS",
")",
";",
"}"
] | Returns a ThreadPoolExecutor with a fixed number of threads.
When all threads are actively executing tasks, new tasks are queued.
If (most) threads are expected to be idle most of the time, prefer createWithMaxSize() instead.
@param threadPoolName the name of the threads created by this executor
@param size the fixed number of threads for this executor
@return the new DebuggableThreadPoolExecutor | [
"Returns",
"a",
"ThreadPoolExecutor",
"with",
"a",
"fixed",
"number",
"of",
"threads",
".",
"When",
"all",
"threads",
"are",
"actively",
"executing",
"tasks",
"new",
"tasks",
"are",
"queued",
".",
"If",
"(",
"most",
")",
"threads",
"are",
"expected",
"to",
"be",
"idle",
"most",
"of",
"the",
"time",
"prefer",
"createWithMaxSize",
"()",
"instead",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java#L110-L113 |
nutzam/nutzboot | nutzboot-starter/nutzboot-starter-fastdfs/src/main/java/org/nutz/boot/starter/fastdfs/FastdfsService.java | FastdfsService.getFileName | private String getFileName(int type, String tokenFilename) {
"""
获取文件名
@param type 0-原图 1水印图 2缩略图
@param tokenFilename 文件名
@return
"""
StringBuilder sb = new StringBuilder();
String filename = tokenFilename.substring(0, tokenFilename.indexOf(EXT_SEPERATOR));
String ext = tokenFilename.substring(tokenFilename.indexOf(EXT_SEPERATOR));
sb.append(filename);
switch (type) {
case 1:
sb.append(IMAGE_WATERMARK_SUFFIX);
break;
case 2:
sb.append(IMAGE_THUMB_SUFFIX);
break;
}
sb.append(ext);
return sb.toString();
} | java | private String getFileName(int type, String tokenFilename) {
StringBuilder sb = new StringBuilder();
String filename = tokenFilename.substring(0, tokenFilename.indexOf(EXT_SEPERATOR));
String ext = tokenFilename.substring(tokenFilename.indexOf(EXT_SEPERATOR));
sb.append(filename);
switch (type) {
case 1:
sb.append(IMAGE_WATERMARK_SUFFIX);
break;
case 2:
sb.append(IMAGE_THUMB_SUFFIX);
break;
}
sb.append(ext);
return sb.toString();
} | [
"private",
"String",
"getFileName",
"(",
"int",
"type",
",",
"String",
"tokenFilename",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"filename",
"=",
"tokenFilename",
".",
"substring",
"(",
"0",
",",
"tokenFilename",
".",
"indexOf",
"(",
"EXT_SEPERATOR",
")",
")",
";",
"String",
"ext",
"=",
"tokenFilename",
".",
"substring",
"(",
"tokenFilename",
".",
"indexOf",
"(",
"EXT_SEPERATOR",
")",
")",
";",
"sb",
".",
"append",
"(",
"filename",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"1",
":",
"sb",
".",
"append",
"(",
"IMAGE_WATERMARK_SUFFIX",
")",
";",
"break",
";",
"case",
"2",
":",
"sb",
".",
"append",
"(",
"IMAGE_THUMB_SUFFIX",
")",
";",
"break",
";",
"}",
"sb",
".",
"append",
"(",
"ext",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | 获取文件名
@param type 0-原图 1水印图 2缩略图
@param tokenFilename 文件名
@return | [
"获取文件名"
] | train | https://github.com/nutzam/nutzboot/blob/fd33fd4fdce058eab594f28e4d3202f997e3c66a/nutzboot-starter/nutzboot-starter-fastdfs/src/main/java/org/nutz/boot/starter/fastdfs/FastdfsService.java#L174-L189 |
lessthanoptimal/ddogleg | src/org/ddogleg/nn/alg/VpTree.java | VpTree.nthElement | private void nthElement(int left, int right, int n, double[] origin) {
"""
Ensures that the n-th element is in a correct position in the list based on
the distance from origin.
@param left start of range
@param right end of range (exclusive)
@param n element to put in the right position
@param origin origin to compute the distance to
"""
int npos = partitionItems(left, right, n, origin);
if (npos < n)
nthElement(npos + 1, right, n, origin);
if (npos > n)
nthElement(left, npos, n, origin);
} | java | private void nthElement(int left, int right, int n, double[] origin) {
int npos = partitionItems(left, right, n, origin);
if (npos < n)
nthElement(npos + 1, right, n, origin);
if (npos > n)
nthElement(left, npos, n, origin);
} | [
"private",
"void",
"nthElement",
"(",
"int",
"left",
",",
"int",
"right",
",",
"int",
"n",
",",
"double",
"[",
"]",
"origin",
")",
"{",
"int",
"npos",
"=",
"partitionItems",
"(",
"left",
",",
"right",
",",
"n",
",",
"origin",
")",
";",
"if",
"(",
"npos",
"<",
"n",
")",
"nthElement",
"(",
"npos",
"+",
"1",
",",
"right",
",",
"n",
",",
"origin",
")",
";",
"if",
"(",
"npos",
">",
"n",
")",
"nthElement",
"(",
"left",
",",
"npos",
",",
"n",
",",
"origin",
")",
";",
"}"
] | Ensures that the n-th element is in a correct position in the list based on
the distance from origin.
@param left start of range
@param right end of range (exclusive)
@param n element to put in the right position
@param origin origin to compute the distance to | [
"Ensures",
"that",
"the",
"n",
"-",
"th",
"element",
"is",
"in",
"a",
"correct",
"position",
"in",
"the",
"list",
"based",
"on",
"the",
"distance",
"from",
"origin",
"."
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/VpTree.java#L133-L139 |
pravega/pravega | controller/src/main/java/io/pravega/controller/task/Stream/StreamMetadataTasks.java | StreamMetadataTasks.deleteStream | public CompletableFuture<DeleteStreamStatus.Status> deleteStream(final String scope, final String stream,
final OperationContext contextOpt) {
"""
Delete a stream. Precondition for deleting a stream is that the stream sholud be sealed.
@param scope scope.
@param stream stream name.
@param contextOpt optional context
@return delete status.
"""
final OperationContext context = contextOpt == null ? streamMetadataStore.createContext(scope, stream) : contextOpt;
final long requestId = requestTracker.getRequestIdFor("deleteStream", scope, stream);
return streamMetadataStore.getState(scope, stream, false, context, executor)
.thenCompose(state -> {
if (!state.equals(State.SEALED)) {
return CompletableFuture.completedFuture(false);
} else {
return streamMetadataStore.getCreationTime(scope, stream, context, executor)
.thenApply(time -> new DeleteStreamEvent(scope, stream, requestId, time))
.thenCompose(event -> writeEvent(event))
.thenApply(x -> true);
}
})
.thenCompose(result -> {
if (result) {
return checkDone(() -> isDeleted(scope, stream))
.thenApply(x -> DeleteStreamStatus.Status.SUCCESS);
} else {
return CompletableFuture.completedFuture(DeleteStreamStatus.Status.STREAM_NOT_SEALED);
}
})
.exceptionally(ex -> {
log.warn(requestId, "Exception thrown while deleting stream {}", ex.getMessage());
return handleDeleteStreamError(ex, requestId);
});
} | java | public CompletableFuture<DeleteStreamStatus.Status> deleteStream(final String scope, final String stream,
final OperationContext contextOpt) {
final OperationContext context = contextOpt == null ? streamMetadataStore.createContext(scope, stream) : contextOpt;
final long requestId = requestTracker.getRequestIdFor("deleteStream", scope, stream);
return streamMetadataStore.getState(scope, stream, false, context, executor)
.thenCompose(state -> {
if (!state.equals(State.SEALED)) {
return CompletableFuture.completedFuture(false);
} else {
return streamMetadataStore.getCreationTime(scope, stream, context, executor)
.thenApply(time -> new DeleteStreamEvent(scope, stream, requestId, time))
.thenCompose(event -> writeEvent(event))
.thenApply(x -> true);
}
})
.thenCompose(result -> {
if (result) {
return checkDone(() -> isDeleted(scope, stream))
.thenApply(x -> DeleteStreamStatus.Status.SUCCESS);
} else {
return CompletableFuture.completedFuture(DeleteStreamStatus.Status.STREAM_NOT_SEALED);
}
})
.exceptionally(ex -> {
log.warn(requestId, "Exception thrown while deleting stream {}", ex.getMessage());
return handleDeleteStreamError(ex, requestId);
});
} | [
"public",
"CompletableFuture",
"<",
"DeleteStreamStatus",
".",
"Status",
">",
"deleteStream",
"(",
"final",
"String",
"scope",
",",
"final",
"String",
"stream",
",",
"final",
"OperationContext",
"contextOpt",
")",
"{",
"final",
"OperationContext",
"context",
"=",
"contextOpt",
"==",
"null",
"?",
"streamMetadataStore",
".",
"createContext",
"(",
"scope",
",",
"stream",
")",
":",
"contextOpt",
";",
"final",
"long",
"requestId",
"=",
"requestTracker",
".",
"getRequestIdFor",
"(",
"\"deleteStream\"",
",",
"scope",
",",
"stream",
")",
";",
"return",
"streamMetadataStore",
".",
"getState",
"(",
"scope",
",",
"stream",
",",
"false",
",",
"context",
",",
"executor",
")",
".",
"thenCompose",
"(",
"state",
"->",
"{",
"if",
"(",
"!",
"state",
".",
"equals",
"(",
"State",
".",
"SEALED",
")",
")",
"{",
"return",
"CompletableFuture",
".",
"completedFuture",
"(",
"false",
")",
";",
"}",
"else",
"{",
"return",
"streamMetadataStore",
".",
"getCreationTime",
"(",
"scope",
",",
"stream",
",",
"context",
",",
"executor",
")",
".",
"thenApply",
"(",
"time",
"->",
"new",
"DeleteStreamEvent",
"(",
"scope",
",",
"stream",
",",
"requestId",
",",
"time",
")",
")",
".",
"thenCompose",
"(",
"event",
"->",
"writeEvent",
"(",
"event",
")",
")",
".",
"thenApply",
"(",
"x",
"->",
"true",
")",
";",
"}",
"}",
")",
".",
"thenCompose",
"(",
"result",
"->",
"{",
"if",
"(",
"result",
")",
"{",
"return",
"checkDone",
"(",
"(",
")",
"->",
"isDeleted",
"(",
"scope",
",",
"stream",
")",
")",
".",
"thenApply",
"(",
"x",
"->",
"DeleteStreamStatus",
".",
"Status",
".",
"SUCCESS",
")",
";",
"}",
"else",
"{",
"return",
"CompletableFuture",
".",
"completedFuture",
"(",
"DeleteStreamStatus",
".",
"Status",
".",
"STREAM_NOT_SEALED",
")",
";",
"}",
"}",
")",
".",
"exceptionally",
"(",
"ex",
"->",
"{",
"log",
".",
"warn",
"(",
"requestId",
",",
"\"Exception thrown while deleting stream {}\"",
",",
"ex",
".",
"getMessage",
"(",
")",
")",
";",
"return",
"handleDeleteStreamError",
"(",
"ex",
",",
"requestId",
")",
";",
"}",
")",
";",
"}"
] | Delete a stream. Precondition for deleting a stream is that the stream sholud be sealed.
@param scope scope.
@param stream stream name.
@param contextOpt optional context
@return delete status. | [
"Delete",
"a",
"stream",
".",
"Precondition",
"for",
"deleting",
"a",
"stream",
"is",
"that",
"the",
"stream",
"sholud",
"be",
"sealed",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/task/Stream/StreamMetadataTasks.java#L484-L512 |
Samsung/GearVRf | GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/AnimationInteractivityManager.java | AnimationInteractivityManager.StringFieldMatch | private boolean StringFieldMatch (String original, String matching) {
"""
/* Allows string matching fields, handling mis-matched case, if value has 'set' so
'set_translation' and 'translation' or 'translation_changed' and 'translation' match.
Also gets rid of leading and trailing spaces. All possible in JavaScript and X3D Routes.
"""
boolean equal = false;
original = original.toLowerCase().trim();
matching = matching.toLowerCase();
if (original.endsWith(matching)) {
equal = true;
}
else if (original.startsWith(matching)) {
equal = true;
}
return equal;
} | java | private boolean StringFieldMatch (String original, String matching) {
boolean equal = false;
original = original.toLowerCase().trim();
matching = matching.toLowerCase();
if (original.endsWith(matching)) {
equal = true;
}
else if (original.startsWith(matching)) {
equal = true;
}
return equal;
} | [
"private",
"boolean",
"StringFieldMatch",
"(",
"String",
"original",
",",
"String",
"matching",
")",
"{",
"boolean",
"equal",
"=",
"false",
";",
"original",
"=",
"original",
".",
"toLowerCase",
"(",
")",
".",
"trim",
"(",
")",
";",
"matching",
"=",
"matching",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"original",
".",
"endsWith",
"(",
"matching",
")",
")",
"{",
"equal",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"original",
".",
"startsWith",
"(",
"matching",
")",
")",
"{",
"equal",
"=",
"true",
";",
"}",
"return",
"equal",
";",
"}"
] | /* Allows string matching fields, handling mis-matched case, if value has 'set' so
'set_translation' and 'translation' or 'translation_changed' and 'translation' match.
Also gets rid of leading and trailing spaces. All possible in JavaScript and X3D Routes. | [
"/",
"*",
"Allows",
"string",
"matching",
"fields",
"handling",
"mis",
"-",
"matched",
"case",
"if",
"value",
"has",
"set",
"so",
"set_translation",
"and",
"translation",
"or",
"translation_changed",
"and",
"translation",
"match",
".",
"Also",
"gets",
"rid",
"of",
"leading",
"and",
"trailing",
"spaces",
".",
"All",
"possible",
"in",
"JavaScript",
"and",
"X3D",
"Routes",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/AnimationInteractivityManager.java#L1556-L1567 |
Subsets and Splits