repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java | MapPolyline.toPath2D | @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
@Pure
public final Path2d toPath2D(double startPosition, double endPosition) {
final Path2d path = new Path2d();
toPath2D(path, startPosition, endPosition);
return path;
} | java | @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
@Pure
public final Path2d toPath2D(double startPosition, double endPosition) {
final Path2d path = new Path2d();
toPath2D(path, startPosition, endPosition);
return path;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"checkstyle:cyclomaticcomplexity\"",
",",
"\"checkstyle:npathcomplexity\"",
"}",
")",
"@",
"Pure",
"public",
"final",
"Path2d",
"toPath2D",
"(",
"double",
"startPosition",
",",
"double",
"endPosition",
")",
"{",
"final",
"Path2d",
... | Replies the Path2D that corresponds to this polyline.
If <var>startPosition</var> is greater to zero,
the replied path will be clipped to ignore the part of
the polyline before the given value.
If <var>endPosition</var> is lower to the length of the polyline,
the replied path will be clipped to ignore the part of
the polyline after the given value.
@param startPosition is the curviline position from which the polyline is drawn.
@param endPosition is the curviline position to which the polyline is drawn.
@return the clipped 2D path.
@since 4.0 | [
"Replies",
"the",
"Path2D",
"that",
"corresponds",
"to",
"this",
"polyline",
".",
"If",
"<var",
">",
"startPosition<",
"/",
"var",
">",
"is",
"greater",
"to",
"zero",
"the",
"replied",
"path",
"will",
"be",
"clipped",
"to",
"ignore",
"the",
"part",
"of",
... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java#L518-L524 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java | PoolsImpl.evaluateAutoScale | public AutoScaleRun evaluateAutoScale(String poolId, String autoScaleFormula, PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions) {
return evaluateAutoScaleWithServiceResponseAsync(poolId, autoScaleFormula, poolEvaluateAutoScaleOptions).toBlocking().single().body();
} | java | public AutoScaleRun evaluateAutoScale(String poolId, String autoScaleFormula, PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions) {
return evaluateAutoScaleWithServiceResponseAsync(poolId, autoScaleFormula, poolEvaluateAutoScaleOptions).toBlocking().single().body();
} | [
"public",
"AutoScaleRun",
"evaluateAutoScale",
"(",
"String",
"poolId",
",",
"String",
"autoScaleFormula",
",",
"PoolEvaluateAutoScaleOptions",
"poolEvaluateAutoScaleOptions",
")",
"{",
"return",
"evaluateAutoScaleWithServiceResponseAsync",
"(",
"poolId",
",",
"autoScaleFormula... | Gets the result of evaluating an automatic scaling formula on the pool.
This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula.
@param poolId The ID of the pool on which to evaluate the automatic scaling formula.
@param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling).
@param poolEvaluateAutoScaleOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AutoScaleRun object if successful. | [
"Gets",
"the",
"result",
"of",
"evaluating",
"an",
"automatic",
"scaling",
"formula",
"on",
"the",
"pool",
".",
"This",
"API",
"is",
"primarily",
"for",
"validating",
"an",
"autoscale",
"formula",
"as",
"it",
"simply",
"returns",
"the",
"result",
"without",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L2605-L2607 |
Coveros/selenified | src/main/java/com/coveros/selenified/utilities/Reporter.java | Reporter.recordStep | private void recordStep(String action, String expectedResult, String actualResult, Boolean screenshot, Success success) {
stepNum++;
String imageLink = "";
if (screenshot && isRealBrowser()) {
// get a screen shot of the action
imageLink = captureEntirePageScreenshot();
}
// determine time differences
Date currentTime = new Date();
long dTime = currentTime.getTime() - lastTime;
long tTime = currentTime.getTime() - startTime;
lastTime = currentTime.getTime();
try (
// Reopen file
FileWriter fw = new FileWriter(file, true); BufferedWriter out = new BufferedWriter(fw)) {
// record the action
out.write(START_ROW);
out.write(" <td align='center'>" + stepNum + ".</td>\n");
out.write(START_CELL + action + END_CELL);
out.write(START_CELL + expectedResult + END_CELL);
out.write(START_CELL + actualResult + imageLink + END_CELL);
out.write(START_CELL + dTime + "ms / " + tTime + "ms</td>\n");
out.write(" <td class='" + success.toString().toLowerCase() + "'>" + success + END_CELL);
out.write(END_ROW);
} catch (IOException e) {
log.error(e);
}
} | java | private void recordStep(String action, String expectedResult, String actualResult, Boolean screenshot, Success success) {
stepNum++;
String imageLink = "";
if (screenshot && isRealBrowser()) {
// get a screen shot of the action
imageLink = captureEntirePageScreenshot();
}
// determine time differences
Date currentTime = new Date();
long dTime = currentTime.getTime() - lastTime;
long tTime = currentTime.getTime() - startTime;
lastTime = currentTime.getTime();
try (
// Reopen file
FileWriter fw = new FileWriter(file, true); BufferedWriter out = new BufferedWriter(fw)) {
// record the action
out.write(START_ROW);
out.write(" <td align='center'>" + stepNum + ".</td>\n");
out.write(START_CELL + action + END_CELL);
out.write(START_CELL + expectedResult + END_CELL);
out.write(START_CELL + actualResult + imageLink + END_CELL);
out.write(START_CELL + dTime + "ms / " + tTime + "ms</td>\n");
out.write(" <td class='" + success.toString().toLowerCase() + "'>" + success + END_CELL);
out.write(END_ROW);
} catch (IOException e) {
log.error(e);
}
} | [
"private",
"void",
"recordStep",
"(",
"String",
"action",
",",
"String",
"expectedResult",
",",
"String",
"actualResult",
",",
"Boolean",
"screenshot",
",",
"Success",
"success",
")",
"{",
"stepNum",
"++",
";",
"String",
"imageLink",
"=",
"\"\"",
";",
"if",
... | Records the performed step to the output file. This includes the action taken if any, the
expected result, and the actual result. If a screenshot is desired, indicate as such. If
a 'real' browser is not being used (not NONE or HTMLUNIT), then no screenshot will be taken
@param action - the step that was performed
@param expectedResult - the result that was expected to occur
@param actualResult - the result that actually occurred
@param screenshot - should a screenshot be taken
@param success - the result of the action | [
"Records",
"the",
"performed",
"step",
"to",
"the",
"output",
"file",
".",
"This",
"includes",
"the",
"action",
"taken",
"if",
"any",
"the",
"expected",
"result",
"and",
"the",
"actual",
"result",
".",
"If",
"a",
"screenshot",
"is",
"desired",
"indicate",
... | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/utilities/Reporter.java#L462-L489 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/dialog/util/DialogUtilsBehavior.java | DialogUtilsBehavior.simpleDialog | public JsStatement simpleDialog(String title, String message)
{
JsStatement statement = new JsStatement();
statement.append("$.ui.dialog.wiquery.simpleDialog(");
statement.append("" + Session.get().nextSequenceValue() + ", ");
statement.append(DialogUtilsLanguages.getDialogUtilsLiteral(DialogUtilsLanguages
.getDialogUtilsLanguages(getLocale())) + ", ");
statement.append(JsUtils.quotes(title, true) + ", ");
statement.append(JsUtils.doubleQuotes(message, true) + ")");
return statement;
} | java | public JsStatement simpleDialog(String title, String message)
{
JsStatement statement = new JsStatement();
statement.append("$.ui.dialog.wiquery.simpleDialog(");
statement.append("" + Session.get().nextSequenceValue() + ", ");
statement.append(DialogUtilsLanguages.getDialogUtilsLiteral(DialogUtilsLanguages
.getDialogUtilsLanguages(getLocale())) + ", ");
statement.append(JsUtils.quotes(title, true) + ", ");
statement.append(JsUtils.doubleQuotes(message, true) + ")");
return statement;
} | [
"public",
"JsStatement",
"simpleDialog",
"(",
"String",
"title",
",",
"String",
"message",
")",
"{",
"JsStatement",
"statement",
"=",
"new",
"JsStatement",
"(",
")",
";",
"statement",
".",
"append",
"(",
"\"$.ui.dialog.wiquery.simpleDialog(\"",
")",
";",
"statemen... | Method creating a simple dialog
@param title
Title
@param message
Message
@return the required {@link JsStatement} | [
"Method",
"creating",
"a",
"simple",
"dialog"
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/dialog/util/DialogUtilsBehavior.java#L372-L383 |
Appendium/objectlabkit | fxcalc/src/main/java/net/objectlab/kit/fxcalc/MajorCurrencyRankingImpl.java | MajorCurrencyRankingImpl.isMarketConvention | @Override
public boolean isMarketConvention(final String ccy1, final String ccy2) {
return selectMajorCurrency(ccy1, ccy2).equals(ccy1);
} | java | @Override
public boolean isMarketConvention(final String ccy1, final String ccy2) {
return selectMajorCurrency(ccy1, ccy2).equals(ccy1);
} | [
"@",
"Override",
"public",
"boolean",
"isMarketConvention",
"(",
"final",
"String",
"ccy1",
",",
"final",
"String",
"ccy2",
")",
"{",
"return",
"selectMajorCurrency",
"(",
"ccy1",
",",
"ccy2",
")",
".",
"equals",
"(",
"ccy1",
")",
";",
"}"
] | returns true if the ccy1 is the major one for the given currency pair. | [
"returns",
"true",
"if",
"the",
"ccy1",
"is",
"the",
"major",
"one",
"for",
"the",
"given",
"currency",
"pair",
"."
] | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/fxcalc/src/main/java/net/objectlab/kit/fxcalc/MajorCurrencyRankingImpl.java#L55-L58 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/DestinationUrl.java | DestinationUrl.removeDestinationUrl | public static MozuUrl removeDestinationUrl(String checkoutId, String destinationId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/destinations/{destinationId}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("destinationId", destinationId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl removeDestinationUrl(String checkoutId, String destinationId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/destinations/{destinationId}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("destinationId", destinationId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"removeDestinationUrl",
"(",
"String",
"checkoutId",
",",
"String",
"destinationId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/checkouts/{checkoutId}/destinations/{destinationId}\"",
")",
";",
"fo... | Get Resource Url for RemoveDestination
@param checkoutId The unique identifier of the checkout.
@param destinationId The unique identifier of the destination.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"RemoveDestination"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/DestinationUrl.java#L80-L86 |
springfox/springfox | springfox-spring-web/src/main/java/springfox/documentation/spring/web/paths/DefaultPathProvider.java | DefaultPathProvider.getResourceListingPath | @Override
public String getResourceListingPath(String groupName, String apiDeclaration) {
String candidate = agnosticUriComponentBuilder(getDocumentationPath())
.pathSegment(groupName, apiDeclaration)
.build()
.toString();
return removeAdjacentForwardSlashes(candidate);
} | java | @Override
public String getResourceListingPath(String groupName, String apiDeclaration) {
String candidate = agnosticUriComponentBuilder(getDocumentationPath())
.pathSegment(groupName, apiDeclaration)
.build()
.toString();
return removeAdjacentForwardSlashes(candidate);
} | [
"@",
"Override",
"public",
"String",
"getResourceListingPath",
"(",
"String",
"groupName",
",",
"String",
"apiDeclaration",
")",
"{",
"String",
"candidate",
"=",
"agnosticUriComponentBuilder",
"(",
"getDocumentationPath",
"(",
")",
")",
".",
"pathSegment",
"(",
"gro... | Corresponds to the path attribute of a swagger Resource Object (within a Resource Listing).
<p>
This method builds a URL based off of
@param groupName the group name for this Resource Object e.g. 'default'
@param apiDeclaration the identifier for the api declaration e.g 'business-controller'
@return the resource listing path
@see DefaultPathProvider#getDocumentationPath()
by appending the swagger group and apiDeclaration | [
"Corresponds",
"to",
"the",
"path",
"attribute",
"of",
"a",
"swagger",
"Resource",
"Object",
"(",
"within",
"a",
"Resource",
"Listing",
")",
".",
"<p",
">",
"This",
"method",
"builds",
"a",
"URL",
"based",
"off",
"of"
] | train | https://github.com/springfox/springfox/blob/e40e2d6f4b345ffa35cd5c0ca7a12589036acaf7/springfox-spring-web/src/main/java/springfox/documentation/spring/web/paths/DefaultPathProvider.java#L71-L78 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/handler/ExecHandler.java | ExecHandler.verifyArguments | private void verifyArguments(JmxExecRequest request, OperationAndParamType pTypes, int pNrParams, List<Object> pArgs) {
if ( (pNrParams > 0 && pArgs == null) || (pArgs != null && pArgs.size() != pNrParams)) {
throw new IllegalArgumentException("Invalid number of operation arguments. Operation " +
request.getOperation() + " on " + request.getObjectName() + " requires " + pTypes.paramClasses.length +
" parameters, not " + (pArgs == null ? 0 : pArgs.size()) + " as given");
}
} | java | private void verifyArguments(JmxExecRequest request, OperationAndParamType pTypes, int pNrParams, List<Object> pArgs) {
if ( (pNrParams > 0 && pArgs == null) || (pArgs != null && pArgs.size() != pNrParams)) {
throw new IllegalArgumentException("Invalid number of operation arguments. Operation " +
request.getOperation() + " on " + request.getObjectName() + " requires " + pTypes.paramClasses.length +
" parameters, not " + (pArgs == null ? 0 : pArgs.size()) + " as given");
}
} | [
"private",
"void",
"verifyArguments",
"(",
"JmxExecRequest",
"request",
",",
"OperationAndParamType",
"pTypes",
",",
"int",
"pNrParams",
",",
"List",
"<",
"Object",
">",
"pArgs",
")",
"{",
"if",
"(",
"(",
"pNrParams",
">",
"0",
"&&",
"pArgs",
"==",
"null",
... | check whether the given arguments are compatible with the signature and if not so, raise an excepton | [
"check",
"whether",
"the",
"given",
"arguments",
"are",
"compatible",
"with",
"the",
"signature",
"and",
"if",
"not",
"so",
"raise",
"an",
"excepton"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/handler/ExecHandler.java#L102-L108 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toList | public static List toList(Object o, List defaultValue) {
return toList(o, false, defaultValue);
} | java | public static List toList(Object o, List defaultValue) {
return toList(o, false, defaultValue);
} | [
"public",
"static",
"List",
"toList",
"(",
"Object",
"o",
",",
"List",
"defaultValue",
")",
"{",
"return",
"toList",
"(",
"o",
",",
"false",
",",
"defaultValue",
")",
";",
"}"
] | cast a Object to a Array Object
@param o Object to cast
@param defaultValue
@return casted Array | [
"cast",
"a",
"Object",
"to",
"a",
"Array",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L2195-L2197 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/ChaincodeCollectionConfiguration.java | ChaincodeCollectionConfiguration.fromYamlFile | public static ChaincodeCollectionConfiguration fromYamlFile(File configFile) throws InvalidArgumentException, IOException, ChaincodeCollectionConfigurationException {
return fromFile(configFile, false);
} | java | public static ChaincodeCollectionConfiguration fromYamlFile(File configFile) throws InvalidArgumentException, IOException, ChaincodeCollectionConfigurationException {
return fromFile(configFile, false);
} | [
"public",
"static",
"ChaincodeCollectionConfiguration",
"fromYamlFile",
"(",
"File",
"configFile",
")",
"throws",
"InvalidArgumentException",
",",
"IOException",
",",
"ChaincodeCollectionConfigurationException",
"{",
"return",
"fromFile",
"(",
"configFile",
",",
"false",
")... | Creates a new ChaincodeCollectionConfiguration instance configured with details supplied in a YAML file.
@param configFile The file containing the network configuration
@return A new ChaincodeCollectionConfiguration instance
@throws InvalidArgumentException
@throws IOException | [
"Creates",
"a",
"new",
"ChaincodeCollectionConfiguration",
"instance",
"configured",
"with",
"details",
"supplied",
"in",
"a",
"YAML",
"file",
"."
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/ChaincodeCollectionConfiguration.java#L88-L90 |
paypal/SeLion | server/src/main/java/com/paypal/selion/utils/AuthenticationHelper.java | AuthenticationHelper.authenticate | public static boolean authenticate(String userName, String userPassword) {
LOGGER.entering(userName, StringUtils.isBlank(userPassword) ? userPassword : userPassword.replaceAll(".", "*"));
boolean validLogin = false;
byte[] currentAuthData;
byte[] hashedInputData;
if (StringUtils.isBlank(userName) || StringUtils.isBlank(userPassword)) {
return validLogin;
}
try {
File authFile = new File(AUTH_FILE_LOCATION);
if (!authFile.exists()) {
authFile.createNewFile();
createAuthFile(authFile, DEFAULT_USERNAME, DEFAULT_PASSWORD);
}
currentAuthData = getBytesFromFile(authFile);
hashedInputData = hashData(userName, userPassword);
validLogin = Arrays.equals(currentAuthData, hashedInputData);
} catch (Exception e) {
validLogin = false;
}
LOGGER.exiting(validLogin);
return validLogin;
} | java | public static boolean authenticate(String userName, String userPassword) {
LOGGER.entering(userName, StringUtils.isBlank(userPassword) ? userPassword : userPassword.replaceAll(".", "*"));
boolean validLogin = false;
byte[] currentAuthData;
byte[] hashedInputData;
if (StringUtils.isBlank(userName) || StringUtils.isBlank(userPassword)) {
return validLogin;
}
try {
File authFile = new File(AUTH_FILE_LOCATION);
if (!authFile.exists()) {
authFile.createNewFile();
createAuthFile(authFile, DEFAULT_USERNAME, DEFAULT_PASSWORD);
}
currentAuthData = getBytesFromFile(authFile);
hashedInputData = hashData(userName, userPassword);
validLogin = Arrays.equals(currentAuthData, hashedInputData);
} catch (Exception e) {
validLogin = false;
}
LOGGER.exiting(validLogin);
return validLogin;
} | [
"public",
"static",
"boolean",
"authenticate",
"(",
"String",
"userName",
",",
"String",
"userPassword",
")",
"{",
"LOGGER",
".",
"entering",
"(",
"userName",
",",
"StringUtils",
".",
"isBlank",
"(",
"userPassword",
")",
"?",
"userPassword",
":",
"userPassword",... | Tries authenticating a given credentials and returns <code>true</code> if the credentials were valid.
@param userName
@param userPassword
@return - <code>true</code> if the credentials were valid. | [
"Tries",
"authenticating",
"a",
"given",
"credentials",
"and",
"returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"the",
"credentials",
"were",
"valid",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/utils/AuthenticationHelper.java#L68-L90 |
apache/groovy | src/main/java/org/codehaus/groovy/classgen/asm/MopWriter.java | MopWriter.getMopMethodName | public static String getMopMethodName(MethodNode method, boolean useThis) {
ClassNode declaringNode = method.getDeclaringClass();
int distance = 0;
for (; declaringNode != null; declaringNode = declaringNode.getSuperClass()) {
distance++;
}
return (useThis ? "this" : "super") + "$" + distance + "$" + method.getName();
} | java | public static String getMopMethodName(MethodNode method, boolean useThis) {
ClassNode declaringNode = method.getDeclaringClass();
int distance = 0;
for (; declaringNode != null; declaringNode = declaringNode.getSuperClass()) {
distance++;
}
return (useThis ? "this" : "super") + "$" + distance + "$" + method.getName();
} | [
"public",
"static",
"String",
"getMopMethodName",
"(",
"MethodNode",
"method",
",",
"boolean",
"useThis",
")",
"{",
"ClassNode",
"declaringNode",
"=",
"method",
".",
"getDeclaringClass",
"(",
")",
";",
"int",
"distance",
"=",
"0",
";",
"for",
"(",
";",
"decl... | creates a MOP method name from a method
@param method the method to be called by the mop method
@param useThis if true, then it is a call on "this", "super" else
@return the mop method name | [
"creates",
"a",
"MOP",
"method",
"name",
"from",
"a",
"method"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/MopWriter.java#L160-L167 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/storage/translation/DOTranslationUtility.java | DOTranslationUtility.readStateAttribute | public static String readStateAttribute(String rawValue) throws ParseException {
if (MODEL.DELETED.looselyMatches(rawValue, true)) {
return "D";
} else if (MODEL.INACTIVE.looselyMatches(rawValue, true)) {
return "I";
} else if (MODEL.ACTIVE.looselyMatches(rawValue, true)
|| rawValue == null
|| rawValue.isEmpty()) {
return "A";
} else {
throw new ParseException("Could not interpret state value of '"
+ rawValue + "'", 0);
}
} | java | public static String readStateAttribute(String rawValue) throws ParseException {
if (MODEL.DELETED.looselyMatches(rawValue, true)) {
return "D";
} else if (MODEL.INACTIVE.looselyMatches(rawValue, true)) {
return "I";
} else if (MODEL.ACTIVE.looselyMatches(rawValue, true)
|| rawValue == null
|| rawValue.isEmpty()) {
return "A";
} else {
throw new ParseException("Could not interpret state value of '"
+ rawValue + "'", 0);
}
} | [
"public",
"static",
"String",
"readStateAttribute",
"(",
"String",
"rawValue",
")",
"throws",
"ParseException",
"{",
"if",
"(",
"MODEL",
".",
"DELETED",
".",
"looselyMatches",
"(",
"rawValue",
",",
"true",
")",
")",
"{",
"return",
"\"D\"",
";",
"}",
"else",
... | Parse and read the object state value from raw text.
<p>
Reads a text representation of object state, and returns a "state code"
abbreviation corresponding to that state. Null or empty values are interpreted
as "Active".
</p>
XXX: It might clearer to nix state codes altogether and just use the full value
@param rawValue Raw string to parse. May be null
@return String containing the state code (A, D, or I)
@throws ParseException thrown when state value cannot be determined | [
"Parse",
"and",
"read",
"the",
"object",
"state",
"value",
"from",
"raw",
"text",
".",
"<p",
">",
"Reads",
"a",
"text",
"representation",
"of",
"object",
"state",
"and",
"returns",
"a",
"state",
"code",
"abbreviation",
"corresponding",
"to",
"that",
"state",... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/storage/translation/DOTranslationUtility.java#L875-L888 |
mbenson/uelbox | src/main/java/uelbox/UEL.java | UEL.getContext | public static <T> T getContext(ELContext context, Class<T> key, T defaultValue) {
@SuppressWarnings("unchecked")
final T result = (T) context.getContext(key);
return result == null ? defaultValue : result;
} | java | public static <T> T getContext(ELContext context, Class<T> key, T defaultValue) {
@SuppressWarnings("unchecked")
final T result = (T) context.getContext(key);
return result == null ? defaultValue : result;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getContext",
"(",
"ELContext",
"context",
",",
"Class",
"<",
"T",
">",
"key",
",",
"T",
"defaultValue",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"final",
"T",
"result",
"=",
"(",
"T",
")",
... | Casts context objects per documented convention.
@param <T>
@param context
@param key
@param defaultValue
@return T | [
"Casts",
"context",
"objects",
"per",
"documented",
"convention",
"."
] | train | https://github.com/mbenson/uelbox/blob/b0c2df2c738295bddfd3c16a916e67c9c7c512ef/src/main/java/uelbox/UEL.java#L120-L124 |
redbox-mint/redbox | plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java | CurationManager.scheduleTransformers | private void scheduleTransformers(JsonSimple message, JsonSimple response) {
String oid = message.getString(null, "oid");
List<String> list = message.getStringList("transformer", "metadata");
if (list != null && !list.isEmpty()) {
for (String id : list) {
JsonObject order = newTransform(response, id, oid);
// Add item config to message... if it exists
JsonObject itemConfig = message.getObject(
"transformerOverrides", id);
if (itemConfig != null) {
JsonObject config = (JsonObject) order.get("config");
config.putAll(itemConfig);
}
}
}
} | java | private void scheduleTransformers(JsonSimple message, JsonSimple response) {
String oid = message.getString(null, "oid");
List<String> list = message.getStringList("transformer", "metadata");
if (list != null && !list.isEmpty()) {
for (String id : list) {
JsonObject order = newTransform(response, id, oid);
// Add item config to message... if it exists
JsonObject itemConfig = message.getObject(
"transformerOverrides", id);
if (itemConfig != null) {
JsonObject config = (JsonObject) order.get("config");
config.putAll(itemConfig);
}
}
}
} | [
"private",
"void",
"scheduleTransformers",
"(",
"JsonSimple",
"message",
",",
"JsonSimple",
"response",
")",
"{",
"String",
"oid",
"=",
"message",
".",
"getString",
"(",
"null",
",",
"\"oid\"",
")",
";",
"List",
"<",
"String",
">",
"list",
"=",
"message",
... | Generate orders for the list of normal transformers scheduled to execute
on the tool chain
@param message
The incoming message, which contains the tool chain config for
this object
@param response
The response to edit
@param oid
The object to schedule for clearing | [
"Generate",
"orders",
"for",
"the",
"list",
"of",
"normal",
"transformers",
"scheduled",
"to",
"execute",
"on",
"the",
"tool",
"chain"
] | train | https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java#L1616-L1631 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/JCRUserListAccess.java | JCRUserListAccess.reuseIterator | protected void reuseIterator(Session session, int newPosition) throws RepositoryException
{
if (!(canReuseIterator() && iterator != null && iterator.getPosition() == newPosition))
{
iterator = createIterator(session);
iterator.skip(newPosition);
}
} | java | protected void reuseIterator(Session session, int newPosition) throws RepositoryException
{
if (!(canReuseIterator() && iterator != null && iterator.getPosition() == newPosition))
{
iterator = createIterator(session);
iterator.skip(newPosition);
}
} | [
"protected",
"void",
"reuseIterator",
"(",
"Session",
"session",
",",
"int",
"newPosition",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"!",
"(",
"canReuseIterator",
"(",
")",
"&&",
"iterator",
"!=",
"null",
"&&",
"iterator",
".",
"getPosition",
"(",... | Check if possible to reuse current iterator (which means possibility to fetch next nodes in row).
Otherwise the new one will be created. | [
"Check",
"if",
"possible",
"to",
"reuse",
"current",
"iterator",
"(",
"which",
"means",
"possibility",
"to",
"fetch",
"next",
"nodes",
"in",
"row",
")",
".",
"Otherwise",
"the",
"new",
"one",
"will",
"be",
"created",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/JCRUserListAccess.java#L161-L168 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-integrations/valkyrie-rcp-jideoss/src/main/java/org/valkyriercp/component/JideOverlayService.java | JideOverlayService.installOverlay | @Override
public Boolean installOverlay(JComponent targetComponent, JComponent overlay) {
return this.installOverlay(targetComponent, overlay, SwingConstants.NORTH_WEST, null);
} | java | @Override
public Boolean installOverlay(JComponent targetComponent, JComponent overlay) {
return this.installOverlay(targetComponent, overlay, SwingConstants.NORTH_WEST, null);
} | [
"@",
"Override",
"public",
"Boolean",
"installOverlay",
"(",
"JComponent",
"targetComponent",
",",
"JComponent",
"overlay",
")",
"{",
"return",
"this",
".",
"installOverlay",
"(",
"targetComponent",
",",
"overlay",
",",
"SwingConstants",
".",
"NORTH_WEST",
",",
"n... | {@inheritDoc}
<p>
Employs a default position <code>SwingConstants.NORTH_WEST</code> and <code>null</code> insets to avoid changes.
@see #installOverlay(JComponent, JComponent, int, Insets) | [
"{",
"@inheritDoc",
"}",
"<p",
">",
"Employs",
"a",
"default",
"position",
"<code",
">",
"SwingConstants",
".",
"NORTH_WEST<",
"/",
"code",
">",
"and",
"<code",
">",
"null<",
"/",
"code",
">",
"insets",
"to",
"avoid",
"changes",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jideoss/src/main/java/org/valkyriercp/component/JideOverlayService.java#L99-L103 |
VoltDB/voltdb | src/frontend/org/voltcore/agreement/AgreementSeeker.java | AgreementSeeker.removeValues | static protected void removeValues(TreeMultimap<Long, Long> mm, Set<Long> values) {
Iterator<Map.Entry<Long, Long>> itr = mm.entries().iterator();
while (itr.hasNext()) {
Map.Entry<Long, Long> e = itr.next();
if (values.contains(e.getValue())) {
itr.remove();
}
}
} | java | static protected void removeValues(TreeMultimap<Long, Long> mm, Set<Long> values) {
Iterator<Map.Entry<Long, Long>> itr = mm.entries().iterator();
while (itr.hasNext()) {
Map.Entry<Long, Long> e = itr.next();
if (values.contains(e.getValue())) {
itr.remove();
}
}
} | [
"static",
"protected",
"void",
"removeValues",
"(",
"TreeMultimap",
"<",
"Long",
",",
"Long",
">",
"mm",
",",
"Set",
"<",
"Long",
">",
"values",
")",
"{",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"Long",
",",
"Long",
">",
">",
"itr",
"=",
"mm",
"... | Convenience method that remove all instances of the given values
from the given map
@param mm a multimap
@param values a set of values that need to be removed | [
"Convenience",
"method",
"that",
"remove",
"all",
"instances",
"of",
"the",
"given",
"values",
"from",
"the",
"given",
"map"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/AgreementSeeker.java#L116-L124 |
mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/utils/ComparableItemListImpl.java | ComparableItemListImpl.withComparator | public ComparableItemListImpl<Item> withComparator(@Nullable Comparator<Item> comparator) {
return withComparator(comparator, true);
} | java | public ComparableItemListImpl<Item> withComparator(@Nullable Comparator<Item> comparator) {
return withComparator(comparator, true);
} | [
"public",
"ComparableItemListImpl",
"<",
"Item",
">",
"withComparator",
"(",
"@",
"Nullable",
"Comparator",
"<",
"Item",
">",
"comparator",
")",
"{",
"return",
"withComparator",
"(",
"comparator",
",",
"true",
")",
";",
"}"
] | define a comparator which will be used to sort the list "everytime" it is altered
NOTE this will only sort if you "set" a new list or "add" new items (not if you provide a position for the add function)
@param comparator used to sort the list
@return this | [
"define",
"a",
"comparator",
"which",
"will",
"be",
"used",
"to",
"sort",
"the",
"list",
"everytime",
"it",
"is",
"altered",
"NOTE",
"this",
"will",
"only",
"sort",
"if",
"you",
"set",
"a",
"new",
"list",
"or",
"add",
"new",
"items",
"(",
"not",
"if",
... | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/utils/ComparableItemListImpl.java#L44-L46 |
infinispan/infinispan | core/src/main/java/org/infinispan/manager/DefaultCacheManager.java | DefaultCacheManager.getCache | @Override
public <K, V> Cache<K, V> getCache() {
if (defaultCacheName == null) {
throw log.noDefaultCache();
}
return internalGetCache(defaultCacheName, defaultCacheName);
} | java | @Override
public <K, V> Cache<K, V> getCache() {
if (defaultCacheName == null) {
throw log.noDefaultCache();
}
return internalGetCache(defaultCacheName, defaultCacheName);
} | [
"@",
"Override",
"public",
"<",
"K",
",",
"V",
">",
"Cache",
"<",
"K",
",",
"V",
">",
"getCache",
"(",
")",
"{",
"if",
"(",
"defaultCacheName",
"==",
"null",
")",
"{",
"throw",
"log",
".",
"noDefaultCache",
"(",
")",
";",
"}",
"return",
"internalGe... | Retrieves the default cache associated with this cache manager. Note that the default cache does not need to be
explicitly created with {@link #createCache(String, String)} (String)} since it is automatically created lazily
when first used.
<p/>
As such, this method is always guaranteed to return the default cache.
@return the default cache. | [
"Retrieves",
"the",
"default",
"cache",
"associated",
"with",
"this",
"cache",
"manager",
".",
"Note",
"that",
"the",
"default",
"cache",
"does",
"not",
"need",
"to",
"be",
"explicitly",
"created",
"with",
"{",
"@link",
"#createCache",
"(",
"String",
"String",... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/manager/DefaultCacheManager.java#L434-L440 |
taskadapter/redmine-java-api | src/main/java/com/taskadapter/redmineapi/TimeEntryManager.java | TimeEntryManager.getTimeEntries | public ResultsWrapper<TimeEntry> getTimeEntries(Map<String, String> parameters) throws RedmineException {
return DirectObjectsSearcher.getObjectsListNoPaging(transport, parameters, TimeEntry.class);
} | java | public ResultsWrapper<TimeEntry> getTimeEntries(Map<String, String> parameters) throws RedmineException {
return DirectObjectsSearcher.getObjectsListNoPaging(transport, parameters, TimeEntry.class);
} | [
"public",
"ResultsWrapper",
"<",
"TimeEntry",
">",
"getTimeEntries",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"throws",
"RedmineException",
"{",
"return",
"DirectObjectsSearcher",
".",
"getObjectsListNoPaging",
"(",
"transport",
",",
"parame... | Direct method to search for objects using any Redmine REST API parameters you want.
<p>Unlike other getXXXObjects() methods in this library, this one does NOT handle paging for you so
you have to provide "offset" and "limit" parameters if you want to control paging.
<p>Sample usage:
<pre>
final Map<String, String> params = new HashMap<String, String>();
params.put("project_id", projectId);
params.put("activity_id", activityId);
final List<TimeEntry> elements = issueManager.getTimeEntries(params);
</pre>
see other possible parameters on Redmine REST doc page:
http://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries#Listing-time-entries
@param parameters the http parameters key/value pairs to append to the rest api request
@return resultsWrapper with raw response from Redmine REST API
@throws RedmineAuthenticationException invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.
@throws RedmineException | [
"Direct",
"method",
"to",
"search",
"for",
"objects",
"using",
"any",
"Redmine",
"REST",
"API",
"parameters",
"you",
"want",
".",
"<p",
">",
"Unlike",
"other",
"getXXXObjects",
"()",
"methods",
"in",
"this",
"library",
"this",
"one",
"does",
"NOT",
"handle",... | train | https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/TimeEntryManager.java#L68-L70 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/FieldDataScratchHandler.java | FieldDataScratchHandler.init | public void init(BaseField field, boolean bChangeDataOnRefresh)
{
super.init(field);
m_objOriginalData = null;
m_bAlwaysEnabled = false;
m_bChangeDataOnRefresh = bChangeDataOnRefresh;
this.setRespondsToMode(DBConstants.SCREEN_MOVE, false);
} | java | public void init(BaseField field, boolean bChangeDataOnRefresh)
{
super.init(field);
m_objOriginalData = null;
m_bAlwaysEnabled = false;
m_bChangeDataOnRefresh = bChangeDataOnRefresh;
this.setRespondsToMode(DBConstants.SCREEN_MOVE, false);
} | [
"public",
"void",
"init",
"(",
"BaseField",
"field",
",",
"boolean",
"bChangeDataOnRefresh",
")",
"{",
"super",
".",
"init",
"(",
"field",
")",
";",
"m_objOriginalData",
"=",
"null",
";",
"m_bAlwaysEnabled",
"=",
"false",
";",
"m_bChangeDataOnRefresh",
"=",
"b... | Constructor.
@param field The basefield owner of this listener (usually null and set on setOwner()). | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/FieldDataScratchHandler.java#L68-L75 |
UrielCh/ovh-java-sdk | ovh-java-sdk-support/src/main/java/net/minidev/ovh/api/ApiOvhSupport.java | ApiOvhSupport.tickets_ticketId_messages_GET | public ArrayList<OvhMessage> tickets_ticketId_messages_GET(Long ticketId) throws IOException {
String qPath = "/support/tickets/{ticketId}/messages";
StringBuilder sb = path(qPath, ticketId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<OvhMessage> tickets_ticketId_messages_GET(Long ticketId) throws IOException {
String qPath = "/support/tickets/{ticketId}/messages";
StringBuilder sb = path(qPath, ticketId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"OvhMessage",
">",
"tickets_ticketId_messages_GET",
"(",
"Long",
"ticketId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/support/tickets/{ticketId}/messages\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
... | Get ticket messages
REST: GET /support/tickets/{ticketId}/messages
@param ticketId [required] internal ticket identifier | [
"Get",
"ticket",
"messages"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-support/src/main/java/net/minidev/ovh/api/ApiOvhSupport.java#L78-L83 |
mnlipp/jgrapes | org.jgrapes.http/src/org/jgrapes/http/HttpServer.java | HttpServer.onClosed | @Handler(channels = NetworkChannel.class)
public void onClosed(Closed event, IOSubchannel netChannel) {
LinkedIOSubchannel.downstreamChannel(this, netChannel,
WebAppMsgChannel.class).ifPresent(appChannel -> {
appChannel.handleClosed(event);
});
} | java | @Handler(channels = NetworkChannel.class)
public void onClosed(Closed event, IOSubchannel netChannel) {
LinkedIOSubchannel.downstreamChannel(this, netChannel,
WebAppMsgChannel.class).ifPresent(appChannel -> {
appChannel.handleClosed(event);
});
} | [
"@",
"Handler",
"(",
"channels",
"=",
"NetworkChannel",
".",
"class",
")",
"public",
"void",
"onClosed",
"(",
"Closed",
"event",
",",
"IOSubchannel",
"netChannel",
")",
"{",
"LinkedIOSubchannel",
".",
"downstreamChannel",
"(",
"this",
",",
"netChannel",
",",
"... | Forwards a {@link Closed} event to the application channel.
@param event the event
@param netChannel the net channel | [
"Forwards",
"a",
"{",
"@link",
"Closed",
"}",
"event",
"to",
"the",
"application",
"channel",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/HttpServer.java#L270-L276 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.preInvoke | @Override
public Object preInvoke(HttpServletRequest req, HttpServletResponse resp, String servletName, boolean enforceSecurity) throws SecurityViolationException, IOException {
Subject invokedSubject = subjectManager.getInvocationSubject();
Subject receivedSubject = subjectManager.getCallerSubject();
WebSecurityContext webSecurityContext = new WebSecurityContext(invokedSubject, receivedSubject);
setUnauthenticatedSubjectIfNeeded(invokedSubject, receivedSubject);
if (req != null) {
SRTServletRequestUtils.setPrivateAttribute(req, SECURITY_CONTEXT, webSecurityContext);
}
if (enforceSecurity) {
// Authentication and authorization are not required
// for servlet init or destroy and, per spec, should
// not be done for forward or include paths.
if (req != null) {
performSecurityChecks(req, resp, receivedSubject, webSecurityContext);
}
if (req != null) {
extraAuditData.put("HTTP_SERVLET_REQUEST", req);
}
//auditManager.setHttpServletRequest(req);
performDelegation(servletName);
syncToOSThread(webSecurityContext);
}
return webSecurityContext;
} | java | @Override
public Object preInvoke(HttpServletRequest req, HttpServletResponse resp, String servletName, boolean enforceSecurity) throws SecurityViolationException, IOException {
Subject invokedSubject = subjectManager.getInvocationSubject();
Subject receivedSubject = subjectManager.getCallerSubject();
WebSecurityContext webSecurityContext = new WebSecurityContext(invokedSubject, receivedSubject);
setUnauthenticatedSubjectIfNeeded(invokedSubject, receivedSubject);
if (req != null) {
SRTServletRequestUtils.setPrivateAttribute(req, SECURITY_CONTEXT, webSecurityContext);
}
if (enforceSecurity) {
// Authentication and authorization are not required
// for servlet init or destroy and, per spec, should
// not be done for forward or include paths.
if (req != null) {
performSecurityChecks(req, resp, receivedSubject, webSecurityContext);
}
if (req != null) {
extraAuditData.put("HTTP_SERVLET_REQUEST", req);
}
//auditManager.setHttpServletRequest(req);
performDelegation(servletName);
syncToOSThread(webSecurityContext);
}
return webSecurityContext;
} | [
"@",
"Override",
"public",
"Object",
"preInvoke",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"resp",
",",
"String",
"servletName",
",",
"boolean",
"enforceSecurity",
")",
"throws",
"SecurityViolationException",
",",
"IOException",
"{",
"Subject",
"i... | This preInvoke is called for every request and when processing
AsyncErrorHandling. It is also called (passing in false for
<code>enforceSecurity</code>) for static files to check whether
the user has access to the file on the zOS file system.
<p>
preInvoke also handles runAs delegation.
<p> {@inheritDoc} | [
"This",
"preInvoke",
"is",
"called",
"for",
"every",
"request",
"and",
"when",
"processing",
"AsyncErrorHandling",
".",
"It",
"is",
"also",
"called",
"(",
"passing",
"in",
"false",
"for",
"<code",
">",
"enforceSecurity<",
"/",
"code",
">",
")",
"for",
"stati... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L554-L586 |
line/armeria | core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java | TextFormatter.appendEpoch | @Deprecated
public static void appendEpoch(StringBuilder buf, long timeMillis) {
buf.append(dateTimeFormatter.format(Instant.ofEpochMilli(timeMillis)))
.append('(').append(timeMillis).append(')');
} | java | @Deprecated
public static void appendEpoch(StringBuilder buf, long timeMillis) {
buf.append(dateTimeFormatter.format(Instant.ofEpochMilli(timeMillis)))
.append('(').append(timeMillis).append(')');
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"appendEpoch",
"(",
"StringBuilder",
"buf",
",",
"long",
"timeMillis",
")",
"{",
"buf",
".",
"append",
"(",
"dateTimeFormatter",
".",
"format",
"(",
"Instant",
".",
"ofEpochMilli",
"(",
"timeMillis",
")",
")",
"... | Formats the given epoch time in milliseconds to typical human-readable format
"yyyy-MM-dd'T'HH_mm:ss.SSSX" and appends it to the specified {@link StringBuilder}.
@deprecated Use {@link #appendEpochMillis(StringBuilder, long)}. | [
"Formats",
"the",
"given",
"epoch",
"time",
"in",
"milliseconds",
"to",
"typical",
"human",
"-",
"readable",
"format",
"yyyy",
"-",
"MM",
"-",
"dd",
"T",
"HH_mm",
":",
"ss",
".",
"SSSX",
"and",
"appends",
"it",
"to",
"the",
"specified",
"{",
"@link",
"... | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java#L148-L152 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java | StylesheetHandler.ignorableWhitespace | public void ignorableWhitespace(char ch[], int start, int length)
throws org.xml.sax.SAXException
{
if (!m_shouldProcess)
return;
getCurrentProcessor().ignorableWhitespace(this, ch, start, length);
} | java | public void ignorableWhitespace(char ch[], int start, int length)
throws org.xml.sax.SAXException
{
if (!m_shouldProcess)
return;
getCurrentProcessor().ignorableWhitespace(this, ch, start, length);
} | [
"public",
"void",
"ignorableWhitespace",
"(",
"char",
"ch",
"[",
"]",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"if",
"(",
"!",
"m_shouldProcess",
")",
"return",
";",
"getCurrentPro... | Receive notification of ignorable whitespace in element content.
@param ch The whitespace characters.
@param start The start position in the character array.
@param length The number of characters to use from the
character array.
@see org.xml.sax.ContentHandler#ignorableWhitespace
@throws org.xml.sax.SAXException Any SAX exception, possibly
wrapping another exception. | [
"Receive",
"notification",
"of",
"ignorable",
"whitespace",
"in",
"element",
"content",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java#L720-L728 |
dwdyer/watchmaker | examples/src/java/main/org/uncommons/watchmaker/examples/geneticprogramming/TreeEvaluator.java | TreeEvaluator.getFitness | public double getFitness(Node candidate, List<? extends Node> population)
{
double error = 0;
for (Map.Entry<double[], Double> entry : data.entrySet())
{
double actualValue = candidate.evaluate(entry.getKey());
double diff = actualValue - entry.getValue();
error += (diff * diff);
}
return error;
} | java | public double getFitness(Node candidate, List<? extends Node> population)
{
double error = 0;
for (Map.Entry<double[], Double> entry : data.entrySet())
{
double actualValue = candidate.evaluate(entry.getKey());
double diff = actualValue - entry.getValue();
error += (diff * diff);
}
return error;
} | [
"public",
"double",
"getFitness",
"(",
"Node",
"candidate",
",",
"List",
"<",
"?",
"extends",
"Node",
">",
"population",
")",
"{",
"double",
"error",
"=",
"0",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"double",
"[",
"]",
",",
"Double",
">",
"entry"... | If the evolved program correctly calculates the right answer
for all sets of inputs then it has a fitness of zero. Otherwise, its fitness
is an error value that indicates how accurate it was (the larger the combined
error value, the less accurate the function is).
The combined error value is calculated by summing the squares of each individual
error (the difference between the expected output and the actual output).
@param candidate The program tree to evaluate.
@param population Ignored by this implementation.
@return The fitness score for the specified candidate. | [
"If",
"the",
"evolved",
"program",
"correctly",
"calculates",
"the",
"right",
"answer",
"for",
"all",
"sets",
"of",
"inputs",
"then",
"it",
"has",
"a",
"fitness",
"of",
"zero",
".",
"Otherwise",
"its",
"fitness",
"is",
"an",
"error",
"value",
"that",
"indi... | train | https://github.com/dwdyer/watchmaker/blob/33d942350e6bf7d9a17b9262a4f898158530247e/examples/src/java/main/org/uncommons/watchmaker/examples/geneticprogramming/TreeEvaluator.java#L57-L67 |
actorapp/actor-platform | actor-server/actor-frontend/src/main/java/im/actor/crypto/primitives/kuznechik/KuznechikCipher.java | KuznechikCipher.decryptBlock | @Override
public void decryptBlock(byte[] data, int offset, byte[] dest, int destOffset) {
// w128_t x;
// x.q[0] = ((uint64_t *) blk)[0] ^ key->k[9].q[0];
// x.q[1] = ((uint64_t *) blk)[1] ^ key->k[9].q[1];
Kuz128 x = new Kuz128();
x.setQ(0, ByteStrings.bytesToLong(data, offset) ^ key.getK()[9].getQ(0));
x.setQ(1, ByteStrings.bytesToLong(data, offset + 8) ^ key.getK()[9].getQ(1));
for (int i = 8; i >= 0; i--) {
// kuz_l_inv(&x);
KuznechikMath.kuz_l_inv(x);
for (int j = 0; j < 16; j++) {
// x.b[j] = kuz_pi_inv[x.b[j]];
x.getB()[j] = KuznechikTables.kuz_pi_inv[x.getB()[j] & 0xFF];
}
// x.q[0] ^= key->k[i].q[0];
x.setQ(0, x.getQ(0) ^ key.getK()[i].getQ(0));
// x.q[1] ^= key->k[i].q[1];
x.setQ(1, x.getQ(1) ^ key.getK()[i].getQ(1));
}
// ((uint64_t *) blk)[0] = x.q[0];
// ((uint64_t *) blk)[1] = x.q[1];
ByteStrings.write(dest, destOffset, ByteStrings.longToBytes(x.getQ(0)), 0, 8);
ByteStrings.write(dest, destOffset + 8, ByteStrings.longToBytes(x.getQ(1)), 0, 8);
} | java | @Override
public void decryptBlock(byte[] data, int offset, byte[] dest, int destOffset) {
// w128_t x;
// x.q[0] = ((uint64_t *) blk)[0] ^ key->k[9].q[0];
// x.q[1] = ((uint64_t *) blk)[1] ^ key->k[9].q[1];
Kuz128 x = new Kuz128();
x.setQ(0, ByteStrings.bytesToLong(data, offset) ^ key.getK()[9].getQ(0));
x.setQ(1, ByteStrings.bytesToLong(data, offset + 8) ^ key.getK()[9].getQ(1));
for (int i = 8; i >= 0; i--) {
// kuz_l_inv(&x);
KuznechikMath.kuz_l_inv(x);
for (int j = 0; j < 16; j++) {
// x.b[j] = kuz_pi_inv[x.b[j]];
x.getB()[j] = KuznechikTables.kuz_pi_inv[x.getB()[j] & 0xFF];
}
// x.q[0] ^= key->k[i].q[0];
x.setQ(0, x.getQ(0) ^ key.getK()[i].getQ(0));
// x.q[1] ^= key->k[i].q[1];
x.setQ(1, x.getQ(1) ^ key.getK()[i].getQ(1));
}
// ((uint64_t *) blk)[0] = x.q[0];
// ((uint64_t *) blk)[1] = x.q[1];
ByteStrings.write(dest, destOffset, ByteStrings.longToBytes(x.getQ(0)), 0, 8);
ByteStrings.write(dest, destOffset + 8, ByteStrings.longToBytes(x.getQ(1)), 0, 8);
} | [
"@",
"Override",
"public",
"void",
"decryptBlock",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"byte",
"[",
"]",
"dest",
",",
"int",
"destOffset",
")",
"{",
"// w128_t x;",
"// x.q[0] = ((uint64_t *) blk)[0] ^ key->k[9].q[0];",
"// x.q[1] = ((uint64_t ... | Decrypting block with Kuznechik encryption
@param data source data for decryption
@param offset offset in data
@param dest destination array
@param destOffset destination offset | [
"Decrypting",
"block",
"with",
"Kuznechik",
"encryption"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-server/actor-frontend/src/main/java/im/actor/crypto/primitives/kuznechik/KuznechikCipher.java#L67-L95 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/AirlineCheckinTemplateBuilder.java | AirlineCheckinTemplateBuilder.addQuickReply | public AirlineCheckinTemplateBuilder addQuickReply(String title,
String payload) {
this.messageBuilder.addQuickReply(title, payload);
return this;
} | java | public AirlineCheckinTemplateBuilder addQuickReply(String title,
String payload) {
this.messageBuilder.addQuickReply(title, payload);
return this;
} | [
"public",
"AirlineCheckinTemplateBuilder",
"addQuickReply",
"(",
"String",
"title",
",",
"String",
"payload",
")",
"{",
"this",
".",
"messageBuilder",
".",
"addQuickReply",
"(",
"title",
",",
"payload",
")",
";",
"return",
"this",
";",
"}"
] | Adds a {@link QuickReply} to the current object.
@param title
the quick reply button label. It can't be empty.
@param payload
the payload sent back when the button is pressed. It can't be
empty.
@return this builder.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies"
> Facebook's Messenger Platform Quick Replies Documentation</a> | [
"Adds",
"a",
"{",
"@link",
"QuickReply",
"}",
"to",
"the",
"current",
"object",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/AirlineCheckinTemplateBuilder.java#L139-L143 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Graphics.java | Graphics.scale | public void scale(float sx, float sy) {
this.sx = this.sx * sx;
this.sy = this.sy * sy;
checkPush();
predraw();
GL.glScalef(sx, sy, 1);
postdraw();
} | java | public void scale(float sx, float sy) {
this.sx = this.sx * sx;
this.sy = this.sy * sy;
checkPush();
predraw();
GL.glScalef(sx, sy, 1);
postdraw();
} | [
"public",
"void",
"scale",
"(",
"float",
"sx",
",",
"float",
"sy",
")",
"{",
"this",
".",
"sx",
"=",
"this",
".",
"sx",
"*",
"sx",
";",
"this",
".",
"sy",
"=",
"this",
".",
"sy",
"*",
"sy",
";",
"checkPush",
"(",
")",
";",
"predraw",
"(",
")"... | Apply a scaling factor to everything drawn on the graphics context
@param sx
The scaling factor to apply to the x axis
@param sy
The scaling factor to apply to the y axis | [
"Apply",
"a",
"scaling",
"factor",
"to",
"everything",
"drawn",
"on",
"the",
"graphics",
"context"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L350-L359 |
groupon/odo | client/src/main/java/com/groupon/odo/client/Client.java | Client.exportConfigurationAndProfile | public JSONObject exportConfigurationAndProfile(String oldExport) {
try {
BasicNameValuePair[] params = {
new BasicNameValuePair("oldExport", oldExport)
};
String url = BASE_BACKUP_PROFILE + "/" + uriEncode(this._profileName) + "/" + this._clientId;
return new JSONObject(doGet(url, new BasicNameValuePair[]{}));
} catch (Exception e) {
return new JSONObject();
}
} | java | public JSONObject exportConfigurationAndProfile(String oldExport) {
try {
BasicNameValuePair[] params = {
new BasicNameValuePair("oldExport", oldExport)
};
String url = BASE_BACKUP_PROFILE + "/" + uriEncode(this._profileName) + "/" + this._clientId;
return new JSONObject(doGet(url, new BasicNameValuePair[]{}));
} catch (Exception e) {
return new JSONObject();
}
} | [
"public",
"JSONObject",
"exportConfigurationAndProfile",
"(",
"String",
"oldExport",
")",
"{",
"try",
"{",
"BasicNameValuePair",
"[",
"]",
"params",
"=",
"{",
"new",
"BasicNameValuePair",
"(",
"\"oldExport\"",
",",
"oldExport",
")",
"}",
";",
"String",
"url",
"=... | Export the odo overrides setup and odo configuration
@param oldExport Whether this is a backup from scratch or backing up because user will upload after (matches API)
@return The odo configuration and overrides in JSON format, can be written to a file after | [
"Export",
"the",
"odo",
"overrides",
"setup",
"and",
"odo",
"configuration"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L1372-L1382 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java | AiMaterial.setDefault | public void setDefault(PropertyKey key, Object defaultValue) {
if (null == defaultValue) {
throw new IllegalArgumentException("defaultValue may not be null");
}
if (key.m_type != defaultValue.getClass()) {
throw new IllegalArgumentException(
"defaultValue has wrong type, " +
"expected: " + key.m_type + ", found: " +
defaultValue.getClass());
}
m_defaults.put(key, defaultValue);
} | java | public void setDefault(PropertyKey key, Object defaultValue) {
if (null == defaultValue) {
throw new IllegalArgumentException("defaultValue may not be null");
}
if (key.m_type != defaultValue.getClass()) {
throw new IllegalArgumentException(
"defaultValue has wrong type, " +
"expected: " + key.m_type + ", found: " +
defaultValue.getClass());
}
m_defaults.put(key, defaultValue);
} | [
"public",
"void",
"setDefault",
"(",
"PropertyKey",
"key",
",",
"Object",
"defaultValue",
")",
"{",
"if",
"(",
"null",
"==",
"defaultValue",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"defaultValue may not be null\"",
")",
";",
"}",
"if",
"(",
... | Sets a default value.<p>
The passed in Object must match the type of the key as returned by
the corresponding <code>getXXX()</code> method.
@param key the key
@param defaultValue the new default, may not be null
@throws IllegalArgumentException if defaultValue is null or has a wrong
type | [
"Sets",
"a",
"default",
"value",
".",
"<p",
">"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java#L521-L533 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/util/ThreadedServer.java | ThreadedServer.newServerSocket | protected ServerSocket newServerSocket(InetAddrPort address, int acceptQueueSize)
throws java.io.IOException
{
if (address == null) return new ServerSocket(0, acceptQueueSize);
return new ServerSocket(address.getPort(), acceptQueueSize, address.getInetAddress());
} | java | protected ServerSocket newServerSocket(InetAddrPort address, int acceptQueueSize)
throws java.io.IOException
{
if (address == null) return new ServerSocket(0, acceptQueueSize);
return new ServerSocket(address.getPort(), acceptQueueSize, address.getInetAddress());
} | [
"protected",
"ServerSocket",
"newServerSocket",
"(",
"InetAddrPort",
"address",
",",
"int",
"acceptQueueSize",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
"{",
"if",
"(",
"address",
"==",
"null",
")",
"return",
"new",
"ServerSocket",
"(",
"0",
",",
... | New server socket. Creates a new servers socket. May be overriden by derived class to create
specialist serversockets (eg SSL).
@param address Address and port
@param acceptQueueSize Accept queue size
@return The new ServerSocket
@exception java.io.IOException | [
"New",
"server",
"socket",
".",
"Creates",
"a",
"new",
"servers",
"socket",
".",
"May",
"be",
"overriden",
"by",
"derived",
"class",
"to",
"create",
"specialist",
"serversockets",
"(",
"eg",
"SSL",
")",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/ThreadedServer.java#L386-L392 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_voicemail_serviceName_directories_id_move_POST | public void billingAccount_voicemail_serviceName_directories_id_move_POST(String billingAccount, String serviceName, Long id, OvhVoicemailMessageFolderDirectoryEnum dir) throws IOException {
String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}/move";
StringBuilder sb = path(qPath, billingAccount, serviceName, id);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "dir", dir);
exec(qPath, "POST", sb.toString(), o);
} | java | public void billingAccount_voicemail_serviceName_directories_id_move_POST(String billingAccount, String serviceName, Long id, OvhVoicemailMessageFolderDirectoryEnum dir) throws IOException {
String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}/move";
StringBuilder sb = path(qPath, billingAccount, serviceName, id);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "dir", dir);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"billingAccount_voicemail_serviceName_directories_id_move_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"id",
",",
"OvhVoicemailMessageFolderDirectoryEnum",
"dir",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"... | Move the message to another directory
REST: POST /telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}/move
@param dir [required] Greeting voicemail directory
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param id [required] Id of the object | [
"Move",
"the",
"message",
"to",
"another",
"directory"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7909-L7915 |
liferay/com-liferay-commerce | commerce-payment-service/src/main/java/com/liferay/commerce/payment/service/persistence/impl/CommercePaymentMethodGroupRelPersistenceImpl.java | CommercePaymentMethodGroupRelPersistenceImpl.fetchByG_E | @Override
public CommercePaymentMethodGroupRel fetchByG_E(long groupId,
String engineKey) {
return fetchByG_E(groupId, engineKey, true);
} | java | @Override
public CommercePaymentMethodGroupRel fetchByG_E(long groupId,
String engineKey) {
return fetchByG_E(groupId, engineKey, true);
} | [
"@",
"Override",
"public",
"CommercePaymentMethodGroupRel",
"fetchByG_E",
"(",
"long",
"groupId",
",",
"String",
"engineKey",
")",
"{",
"return",
"fetchByG_E",
"(",
"groupId",
",",
"engineKey",
",",
"true",
")",
";",
"}"
] | Returns the commerce payment method group rel where groupId = ? and engineKey = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param groupId the group ID
@param engineKey the engine key
@return the matching commerce payment method group rel, or <code>null</code> if a matching commerce payment method group rel could not be found | [
"Returns",
"the",
"commerce",
"payment",
"method",
"group",
"rel",
"where",
"groupId",
"=",
"?",
";",
"and",
"engineKey",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Us... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-payment-service/src/main/java/com/liferay/commerce/payment/service/persistence/impl/CommercePaymentMethodGroupRelPersistenceImpl.java#L670-L674 |
OpenTSDB/opentsdb | src/meta/TSMeta.java | TSMeta.parseFromColumn | public static Deferred<TSMeta> parseFromColumn(final TSDB tsdb,
final KeyValue column, final boolean load_uidmetas) {
if (column.value() == null || column.value().length < 1) {
throw new IllegalArgumentException("Empty column value");
}
final TSMeta parsed_meta = JSON.parseToObject(column.value(), TSMeta.class);
// fix in case the tsuid is missing
if (parsed_meta.tsuid == null || parsed_meta.tsuid.isEmpty()) {
parsed_meta.tsuid = UniqueId.uidToString(column.key());
}
Deferred<TSMeta> meta = getFromStorage(tsdb, UniqueId.stringToUid(parsed_meta.tsuid));
if (!load_uidmetas) {
return meta;
}
return meta.addCallbackDeferring(new LoadUIDs(tsdb, parsed_meta.tsuid));
} | java | public static Deferred<TSMeta> parseFromColumn(final TSDB tsdb,
final KeyValue column, final boolean load_uidmetas) {
if (column.value() == null || column.value().length < 1) {
throw new IllegalArgumentException("Empty column value");
}
final TSMeta parsed_meta = JSON.parseToObject(column.value(), TSMeta.class);
// fix in case the tsuid is missing
if (parsed_meta.tsuid == null || parsed_meta.tsuid.isEmpty()) {
parsed_meta.tsuid = UniqueId.uidToString(column.key());
}
Deferred<TSMeta> meta = getFromStorage(tsdb, UniqueId.stringToUid(parsed_meta.tsuid));
if (!load_uidmetas) {
return meta;
}
return meta.addCallbackDeferring(new LoadUIDs(tsdb, parsed_meta.tsuid));
} | [
"public",
"static",
"Deferred",
"<",
"TSMeta",
">",
"parseFromColumn",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"KeyValue",
"column",
",",
"final",
"boolean",
"load_uidmetas",
")",
"{",
"if",
"(",
"column",
".",
"value",
"(",
")",
"==",
"null",
"||",
... | Parses a TSMeta object from the given column, optionally loading the
UIDMeta objects
@param tsdb The TSDB to use for storage access
@param column The KeyValue column to parse
@param load_uidmetas Whether or not UIDmeta objects should be loaded
@return A TSMeta if parsed successfully
@throws NoSuchUniqueName if one of the UIDMeta objects does not exist
@throws JSONException if the data was corrupted | [
"Parses",
"a",
"TSMeta",
"object",
"from",
"the",
"given",
"column",
"optionally",
"loading",
"the",
"UIDMeta",
"objects"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/TSMeta.java#L404-L424 |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/LdapTemplate.java | LdapTemplate.deleteRecursively | protected void deleteRecursively(DirContext ctx, Name name) {
NamingEnumeration enumeration = null;
try {
enumeration = ctx.listBindings(name);
while (enumeration.hasMore()) {
Binding binding = (Binding) enumeration.next();
LdapName childName = LdapUtils.newLdapName(binding.getName());
childName.addAll(0, name);
deleteRecursively(ctx, childName);
}
ctx.unbind(name);
if (LOG.isDebugEnabled()) {
LOG.debug("Entry " + name + " deleted");
}
}
catch (javax.naming.NamingException e) {
throw LdapUtils.convertLdapException(e);
}
finally {
try {
enumeration.close();
}
catch (Exception e) {
// Never mind this
}
}
} | java | protected void deleteRecursively(DirContext ctx, Name name) {
NamingEnumeration enumeration = null;
try {
enumeration = ctx.listBindings(name);
while (enumeration.hasMore()) {
Binding binding = (Binding) enumeration.next();
LdapName childName = LdapUtils.newLdapName(binding.getName());
childName.addAll(0, name);
deleteRecursively(ctx, childName);
}
ctx.unbind(name);
if (LOG.isDebugEnabled()) {
LOG.debug("Entry " + name + " deleted");
}
}
catch (javax.naming.NamingException e) {
throw LdapUtils.convertLdapException(e);
}
finally {
try {
enumeration.close();
}
catch (Exception e) {
// Never mind this
}
}
} | [
"protected",
"void",
"deleteRecursively",
"(",
"DirContext",
"ctx",
",",
"Name",
"name",
")",
"{",
"NamingEnumeration",
"enumeration",
"=",
"null",
";",
"try",
"{",
"enumeration",
"=",
"ctx",
".",
"listBindings",
"(",
"name",
")",
";",
"while",
"(",
"enumera... | Delete all subcontexts including the current one recursively.
@param ctx The context to use for deleting.
@param name The starting point to delete recursively.
@throws NamingException if any error occurs | [
"Delete",
"all",
"subcontexts",
"including",
"the",
"current",
"one",
"recursively",
"."
] | train | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/LdapTemplate.java#L1096-L1123 |
ArcBees/gwtquery | gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java | JsUtils.runJavascriptFunction | public static <T> T runJavascriptFunction(JavaScriptObject o, String meth, Object... args) {
return runJavascriptFunctionImpl(o, meth, JsObjectArray.create().add(args).<JsArrayMixed>cast());
} | java | public static <T> T runJavascriptFunction(JavaScriptObject o, String meth, Object... args) {
return runJavascriptFunctionImpl(o, meth, JsObjectArray.create().add(args).<JsArrayMixed>cast());
} | [
"public",
"static",
"<",
"T",
">",
"T",
"runJavascriptFunction",
"(",
"JavaScriptObject",
"o",
",",
"String",
"meth",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"runJavascriptFunctionImpl",
"(",
"o",
",",
"meth",
",",
"JsObjectArray",
".",
"create",
"... | Call via jsni any arbitrary function present in a Javascript object.
It's thought for avoiding to create jsni methods to call external functions and
facilitate the writing of js wrappers.
Example
<pre>
// Create a svg node in our document.
Element svg = runJavascriptFunction(document, "createElementNS", "http://www.w3.org/2000/svg", "svg");
// Append it to the dom
$(svg).appendTo(document);
</pre>
@param o the javascript object where the function is, it it is null we use window.
@param meth the literal name of the function to call, dot separators are allowed.
@param args an array with the arguments to pass to the function.
@return the java ready boxed object returned by the jsni method or null, if the
call return a number we will get a Double, if it returns a boolean we get a java
Boolean, strings comes as java String, otherwise we get the javascript object.
@deprecated use jsni instead. | [
"Call",
"via",
"jsni",
"any",
"arbitrary",
"function",
"present",
"in",
"a",
"Javascript",
"object",
"."
] | train | https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L593-L595 |
UrielCh/ovh-java-sdk | ovh-java-sdk-core/src/main/java/net/minidev/ovh/api/ApiOvhAuth.java | ApiOvhAuth.credential_POST | public net.minidev.ovh.api.auth.OvhCredential credential_POST(OvhAccessRule[] accessRules, String redirection) throws IOException {
String qPath = "/auth/credential";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "accessRules", accessRules);
addBody(o, "redirection", redirection);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, net.minidev.ovh.api.auth.OvhCredential.class);
} | java | public net.minidev.ovh.api.auth.OvhCredential credential_POST(OvhAccessRule[] accessRules, String redirection) throws IOException {
String qPath = "/auth/credential";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "accessRules", accessRules);
addBody(o, "redirection", redirection);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, net.minidev.ovh.api.auth.OvhCredential.class);
} | [
"public",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"auth",
".",
"OvhCredential",
"credential_POST",
"(",
"OvhAccessRule",
"[",
"]",
"accessRules",
",",
"String",
"redirection",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/auth/cred... | Request a new credential for your application
REST: POST /auth/credential
@param accessRules [required] Access required for your application
@param redirection [required] Where you want to redirect the user after sucessfull authentication | [
"Request",
"a",
"new",
"credential",
"for",
"your",
"application"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-core/src/main/java/net/minidev/ovh/api/ApiOvhAuth.java#L62-L70 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java | ExecutionGraph.tryRestartOrFail | private boolean tryRestartOrFail(long globalModVersionForRestart) {
JobStatus currentState = state;
if (currentState == JobStatus.FAILING || currentState == JobStatus.RESTARTING) {
final Throwable failureCause = this.failureCause;
synchronized (progressLock) {
if (LOG.isDebugEnabled()) {
LOG.debug("Try to restart or fail the job {} ({}) if no longer possible.", getJobName(), getJobID(), failureCause);
} else {
LOG.info("Try to restart or fail the job {} ({}) if no longer possible.", getJobName(), getJobID());
}
final boolean isFailureCauseAllowingRestart = !(failureCause instanceof SuppressRestartsException);
final boolean isRestartStrategyAllowingRestart = restartStrategy.canRestart();
boolean isRestartable = isFailureCauseAllowingRestart && isRestartStrategyAllowingRestart;
if (isRestartable && transitionState(currentState, JobStatus.RESTARTING)) {
LOG.info("Restarting the job {} ({}).", getJobName(), getJobID());
RestartCallback restarter = new ExecutionGraphRestartCallback(this, globalModVersionForRestart);
restartStrategy.restart(restarter, getJobMasterMainThreadExecutor());
return true;
}
else if (!isRestartable && transitionState(currentState, JobStatus.FAILED, failureCause)) {
final String cause1 = isFailureCauseAllowingRestart ? null :
"a type of SuppressRestartsException was thrown";
final String cause2 = isRestartStrategyAllowingRestart ? null :
"the restart strategy prevented it";
LOG.info("Could not restart the job {} ({}) because {}.", getJobName(), getJobID(),
StringUtils.concatenateWithAnd(cause1, cause2), failureCause);
onTerminalState(JobStatus.FAILED);
return true;
} else {
// we must have changed the state concurrently, thus we cannot complete this operation
return false;
}
}
} else {
// this operation is only allowed in the state FAILING or RESTARTING
return false;
}
} | java | private boolean tryRestartOrFail(long globalModVersionForRestart) {
JobStatus currentState = state;
if (currentState == JobStatus.FAILING || currentState == JobStatus.RESTARTING) {
final Throwable failureCause = this.failureCause;
synchronized (progressLock) {
if (LOG.isDebugEnabled()) {
LOG.debug("Try to restart or fail the job {} ({}) if no longer possible.", getJobName(), getJobID(), failureCause);
} else {
LOG.info("Try to restart or fail the job {} ({}) if no longer possible.", getJobName(), getJobID());
}
final boolean isFailureCauseAllowingRestart = !(failureCause instanceof SuppressRestartsException);
final boolean isRestartStrategyAllowingRestart = restartStrategy.canRestart();
boolean isRestartable = isFailureCauseAllowingRestart && isRestartStrategyAllowingRestart;
if (isRestartable && transitionState(currentState, JobStatus.RESTARTING)) {
LOG.info("Restarting the job {} ({}).", getJobName(), getJobID());
RestartCallback restarter = new ExecutionGraphRestartCallback(this, globalModVersionForRestart);
restartStrategy.restart(restarter, getJobMasterMainThreadExecutor());
return true;
}
else if (!isRestartable && transitionState(currentState, JobStatus.FAILED, failureCause)) {
final String cause1 = isFailureCauseAllowingRestart ? null :
"a type of SuppressRestartsException was thrown";
final String cause2 = isRestartStrategyAllowingRestart ? null :
"the restart strategy prevented it";
LOG.info("Could not restart the job {} ({}) because {}.", getJobName(), getJobID(),
StringUtils.concatenateWithAnd(cause1, cause2), failureCause);
onTerminalState(JobStatus.FAILED);
return true;
} else {
// we must have changed the state concurrently, thus we cannot complete this operation
return false;
}
}
} else {
// this operation is only allowed in the state FAILING or RESTARTING
return false;
}
} | [
"private",
"boolean",
"tryRestartOrFail",
"(",
"long",
"globalModVersionForRestart",
")",
"{",
"JobStatus",
"currentState",
"=",
"state",
";",
"if",
"(",
"currentState",
"==",
"JobStatus",
".",
"FAILING",
"||",
"currentState",
"==",
"JobStatus",
".",
"RESTARTING",
... | Try to restart the job. If we cannot restart the job (e.g. no more restarts allowed), then
try to fail the job. This operation is only permitted if the current state is FAILING or
RESTARTING.
@return true if the operation could be executed; false if a concurrent job status change occurred | [
"Try",
"to",
"restart",
"the",
"job",
".",
"If",
"we",
"cannot",
"restart",
"the",
"job",
"(",
"e",
".",
"g",
".",
"no",
"more",
"restarts",
"allowed",
")",
"then",
"try",
"to",
"fail",
"the",
"job",
".",
"This",
"operation",
"is",
"only",
"permitted... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java#L1468-L1513 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java | DevicesInner.scanForUpdates | public void scanForUpdates(String deviceName, String resourceGroupName) {
scanForUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().last().body();
} | java | public void scanForUpdates(String deviceName, String resourceGroupName) {
scanForUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().last().body();
} | [
"public",
"void",
"scanForUpdates",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
")",
"{",
"scanForUpdatesWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroupName",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"bod... | Scans for updates on a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Scans",
"for",
"updates",
"on",
"a",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1682-L1684 |
atomix/atomix | agent/src/main/java/io/atomix/agent/AtomixAgent.java | AtomixAgent.parseArgs | static Namespace parseArgs(String[] args, List<String> unknown) {
ArgumentParser parser = createParser();
Namespace namespace = null;
try {
namespace = parser.parseKnownArgs(args, unknown);
} catch (ArgumentParserException e) {
parser.handleError(e);
System.exit(1);
}
return namespace;
} | java | static Namespace parseArgs(String[] args, List<String> unknown) {
ArgumentParser parser = createParser();
Namespace namespace = null;
try {
namespace = parser.parseKnownArgs(args, unknown);
} catch (ArgumentParserException e) {
parser.handleError(e);
System.exit(1);
}
return namespace;
} | [
"static",
"Namespace",
"parseArgs",
"(",
"String",
"[",
"]",
"args",
",",
"List",
"<",
"String",
">",
"unknown",
")",
"{",
"ArgumentParser",
"parser",
"=",
"createParser",
"(",
")",
";",
"Namespace",
"namespace",
"=",
"null",
";",
"try",
"{",
"namespace",
... | Parses the command line arguments, returning an argparse4j namespace.
@param args the arguments to parse
@return the namespace | [
"Parses",
"the",
"command",
"line",
"arguments",
"returning",
"an",
"argparse4j",
"namespace",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/agent/src/main/java/io/atomix/agent/AtomixAgent.java#L89-L99 |
Stratio/stratio-cassandra | src/java/com/stratio/cassandra/index/service/RowService.java | RowService.build | public static RowService build(ColumnFamilyStore baseCfs, ColumnDefinition columnDefinition) {
int clusteringPosition = baseCfs.metadata.clusteringColumns().size();
if (clusteringPosition > 0) {
return new RowServiceWide(baseCfs, columnDefinition);
} else {
return new RowServiceSkinny(baseCfs, columnDefinition);
}
} | java | public static RowService build(ColumnFamilyStore baseCfs, ColumnDefinition columnDefinition) {
int clusteringPosition = baseCfs.metadata.clusteringColumns().size();
if (clusteringPosition > 0) {
return new RowServiceWide(baseCfs, columnDefinition);
} else {
return new RowServiceSkinny(baseCfs, columnDefinition);
}
} | [
"public",
"static",
"RowService",
"build",
"(",
"ColumnFamilyStore",
"baseCfs",
",",
"ColumnDefinition",
"columnDefinition",
")",
"{",
"int",
"clusteringPosition",
"=",
"baseCfs",
".",
"metadata",
".",
"clusteringColumns",
"(",
")",
".",
"size",
"(",
")",
";",
"... | Returns a new {@link RowService} for the specified {@link ColumnFamilyStore} and {@link ColumnDefinition}.
@param baseCfs The {@link ColumnFamilyStore} associated to the managed index.
@param columnDefinition The {@link ColumnDefinition} of the indexed column.
@return A new {@link RowService} for the specified {@link ColumnFamilyStore} and {@link ColumnDefinition}. | [
"Returns",
"a",
"new",
"{",
"@link",
"RowService",
"}",
"for",
"the",
"specified",
"{",
"@link",
"ColumnFamilyStore",
"}",
"and",
"{",
"@link",
"ColumnDefinition",
"}",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/service/RowService.java#L102-L109 |
VoltDB/voltdb | src/frontend/org/voltdb/InvocationDispatcher.java | InvocationDispatcher.sendSentinel | public final void sendSentinel(long txnId, int partitionId) {
final long initiatorHSId = m_cartographer.getHSIdForSinglePartitionMaster(partitionId);
sendSentinel(txnId, initiatorHSId, -1, -1, true);
} | java | public final void sendSentinel(long txnId, int partitionId) {
final long initiatorHSId = m_cartographer.getHSIdForSinglePartitionMaster(partitionId);
sendSentinel(txnId, initiatorHSId, -1, -1, true);
} | [
"public",
"final",
"void",
"sendSentinel",
"(",
"long",
"txnId",
",",
"int",
"partitionId",
")",
"{",
"final",
"long",
"initiatorHSId",
"=",
"m_cartographer",
".",
"getHSIdForSinglePartitionMaster",
"(",
"partitionId",
")",
";",
"sendSentinel",
"(",
"txnId",
",",
... | Send a command log replay sentinel to the given partition.
@param txnId
@param partitionId | [
"Send",
"a",
"command",
"log",
"replay",
"sentinel",
"to",
"the",
"given",
"partition",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/InvocationDispatcher.java#L898-L901 |
brettwooldridge/HikariCP | src/main/java/com/zaxxer/hikari/util/UtilityElf.java | UtilityElf.safeIsAssignableFrom | public static boolean safeIsAssignableFrom(Object obj, String className) {
try {
Class<?> clazz = Class.forName(className);
return clazz.isAssignableFrom(obj.getClass());
} catch (ClassNotFoundException ignored) {
return false;
}
} | java | public static boolean safeIsAssignableFrom(Object obj, String className) {
try {
Class<?> clazz = Class.forName(className);
return clazz.isAssignableFrom(obj.getClass());
} catch (ClassNotFoundException ignored) {
return false;
}
} | [
"public",
"static",
"boolean",
"safeIsAssignableFrom",
"(",
"Object",
"obj",
",",
"String",
"className",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
";",
"return",
"clazz",
".",
"isAssignableF... | Checks whether an object is an instance of given type without throwing exception when the class is not loaded.
@param obj the object to check
@param className String class
@return true if object is assignable from the type, false otherwise or when the class cannot be loaded | [
"Checks",
"whether",
"an",
"object",
"is",
"an",
"instance",
"of",
"given",
"type",
"without",
"throwing",
"exception",
"when",
"the",
"class",
"is",
"not",
"loaded",
"."
] | train | https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/UtilityElf.java#L73-L80 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/BufferDump.java | BufferDump.formatLineId | static private StringBuilder formatLineId(StringBuilder buffer, int value) {
char[] chars = new char[4];
for (int i = 3; i >= 0; i--) {
chars[i] = (char) HEX_BYTES[(value % 16) & 0xF];
value >>= 4;
}
return buffer.append(chars);
} | java | static private StringBuilder formatLineId(StringBuilder buffer, int value) {
char[] chars = new char[4];
for (int i = 3; i >= 0; i--) {
chars[i] = (char) HEX_BYTES[(value % 16) & 0xF];
value >>= 4;
}
return buffer.append(chars);
} | [
"static",
"private",
"StringBuilder",
"formatLineId",
"(",
"StringBuilder",
"buffer",
",",
"int",
"value",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"new",
"char",
"[",
"4",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"3",
";",
"i",
">=",
"0",
";",
"i",... | Format the input value as a four digit hex number, padding with zeros.
@param buffer
@param value
@return StringBuilder | [
"Format",
"the",
"input",
"value",
"as",
"a",
"four",
"digit",
"hex",
"number",
"padding",
"with",
"zeros",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/BufferDump.java#L94-L101 |
languagetool-org/languagetool | languagetool-server/src/main/java/org/languagetool/server/UserLimits.java | UserLimits.getLimitsFromToken | static UserLimits getLimitsFromToken(HTTPServerConfig config, String jwtToken) {
Objects.requireNonNull(jwtToken);
try {
String secretKey = config.getSecretTokenKey();
if (secretKey == null) {
throw new RuntimeException("You specified a 'token' parameter but this server doesn't accept tokens");
}
Algorithm algorithm = Algorithm.HMAC256(secretKey);
DecodedJWT decodedToken;
try {
JWT.require(algorithm).build().verify(jwtToken);
decodedToken = JWT.decode(jwtToken);
} catch (JWTDecodeException e) {
throw new AuthException("Could not decode token '" + jwtToken + "'", e);
}
Claim maxTextLengthClaim = decodedToken.getClaim("maxTextLength");
Claim premiumClaim = decodedToken.getClaim("premium");
boolean hasPremium = !premiumClaim.isNull() && premiumClaim.asBoolean();
Claim uidClaim = decodedToken.getClaim("uid");
long uid = uidClaim.isNull() ? -1 : uidClaim.asLong();
return new UserLimits(
maxTextLengthClaim.isNull() ? config.maxTextLength : maxTextLengthClaim.asInt(),
config.maxCheckTimeMillis,
hasPremium ? uid : null);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} | java | static UserLimits getLimitsFromToken(HTTPServerConfig config, String jwtToken) {
Objects.requireNonNull(jwtToken);
try {
String secretKey = config.getSecretTokenKey();
if (secretKey == null) {
throw new RuntimeException("You specified a 'token' parameter but this server doesn't accept tokens");
}
Algorithm algorithm = Algorithm.HMAC256(secretKey);
DecodedJWT decodedToken;
try {
JWT.require(algorithm).build().verify(jwtToken);
decodedToken = JWT.decode(jwtToken);
} catch (JWTDecodeException e) {
throw new AuthException("Could not decode token '" + jwtToken + "'", e);
}
Claim maxTextLengthClaim = decodedToken.getClaim("maxTextLength");
Claim premiumClaim = decodedToken.getClaim("premium");
boolean hasPremium = !premiumClaim.isNull() && premiumClaim.asBoolean();
Claim uidClaim = decodedToken.getClaim("uid");
long uid = uidClaim.isNull() ? -1 : uidClaim.asLong();
return new UserLimits(
maxTextLengthClaim.isNull() ? config.maxTextLength : maxTextLengthClaim.asInt(),
config.maxCheckTimeMillis,
hasPremium ? uid : null);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} | [
"static",
"UserLimits",
"getLimitsFromToken",
"(",
"HTTPServerConfig",
"config",
",",
"String",
"jwtToken",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"jwtToken",
")",
";",
"try",
"{",
"String",
"secretKey",
"=",
"config",
".",
"getSecretTokenKey",
"(",
")... | Get limits from the JWT key itself, no database access needed. | [
"Get",
"limits",
"from",
"the",
"JWT",
"key",
"itself",
"no",
"database",
"access",
"needed",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-server/src/main/java/org/languagetool/server/UserLimits.java#L65-L92 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagBundle.java | CmsJspTagBundle.getLocale | static Locale getLocale(PageContext pageContext, String name) {
Locale loc = null;
Object obj = javax.servlet.jsp.jstl.core.Config.find(pageContext, name);
if (obj != null) {
if (obj instanceof Locale) {
loc = (Locale)obj;
} else {
loc = SetLocaleSupport.parseLocale((String)obj);
}
}
return loc;
} | java | static Locale getLocale(PageContext pageContext, String name) {
Locale loc = null;
Object obj = javax.servlet.jsp.jstl.core.Config.find(pageContext, name);
if (obj != null) {
if (obj instanceof Locale) {
loc = (Locale)obj;
} else {
loc = SetLocaleSupport.parseLocale((String)obj);
}
}
return loc;
} | [
"static",
"Locale",
"getLocale",
"(",
"PageContext",
"pageContext",
",",
"String",
"name",
")",
"{",
"Locale",
"loc",
"=",
"null",
";",
"Object",
"obj",
"=",
"javax",
".",
"servlet",
".",
"jsp",
".",
"jstl",
".",
"core",
".",
"Config",
".",
"find",
"("... | Returns the locale specified by the named scoped attribute or context
configuration parameter.
<p> The named scoped attribute is searched in the page, request,
session (if valid), and application scope(s) (in this order). If no such
attribute exists in any of the scopes, the locale is taken from the
named context configuration parameter.
@param pageContext the page in which to search for the named scoped
attribute or context configuration parameter
@param name the name of the scoped attribute or context configuration
parameter
@return the locale specified by the named scoped attribute or context
configuration parameter, or <tt>null</tt> if no scoped attribute or
configuration parameter with the given name exists | [
"Returns",
"the",
"locale",
"specified",
"by",
"the",
"named",
"scoped",
"attribute",
"or",
"context",
"configuration",
"parameter",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagBundle.java#L135-L149 |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ExecutePLSQLBuilder.java | ExecutePLSQLBuilder.sqlResource | public ExecutePLSQLBuilder sqlResource(Resource sqlResource, Charset charset) {
try {
action.setScript(FileUtils.readToString(sqlResource, charset));
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read sql resource", e);
}
return this;
} | java | public ExecutePLSQLBuilder sqlResource(Resource sqlResource, Charset charset) {
try {
action.setScript(FileUtils.readToString(sqlResource, charset));
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read sql resource", e);
}
return this;
} | [
"public",
"ExecutePLSQLBuilder",
"sqlResource",
"(",
"Resource",
"sqlResource",
",",
"Charset",
"charset",
")",
"{",
"try",
"{",
"action",
".",
"setScript",
"(",
"FileUtils",
".",
"readToString",
"(",
"sqlResource",
",",
"charset",
")",
")",
";",
"}",
"catch",... | Setter for external file resource containing the SQL statements to execute.
@param sqlResource
@param charset | [
"Setter",
"for",
"external",
"file",
"resource",
"containing",
"the",
"SQL",
"statements",
"to",
"execute",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ExecutePLSQLBuilder.java#L156-L163 |
ckpoint/CheckPoint | src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java | MsgSettingController.deleteValidationDataLists | @DeleteMapping("/setting/delete/param/from/url")
public void deleteValidationDataLists(HttpServletRequest req, @RequestBody List<ValidationData> datas) {
this.validationSessionComponent.sessionCheck(req);
this.msgSettingService.deleteValidationData(datas);
} | java | @DeleteMapping("/setting/delete/param/from/url")
public void deleteValidationDataLists(HttpServletRequest req, @RequestBody List<ValidationData> datas) {
this.validationSessionComponent.sessionCheck(req);
this.msgSettingService.deleteValidationData(datas);
} | [
"@",
"DeleteMapping",
"(",
"\"/setting/delete/param/from/url\"",
")",
"public",
"void",
"deleteValidationDataLists",
"(",
"HttpServletRequest",
"req",
",",
"@",
"RequestBody",
"List",
"<",
"ValidationData",
">",
"datas",
")",
"{",
"this",
".",
"validationSessionComponen... | Delete validation data lists.
@param req the req
@param datas the datas | [
"Delete",
"validation",
"data",
"lists",
"."
] | train | https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java#L181-L185 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java | TypeHandlerUtils.convertClob | public static Object convertClob(Object clob, byte[] value) throws SQLException {
ByteArrayInputStream input = new ByteArrayInputStream(value);
//OutputStream output = clob.setAsciiStream(1);
OutputStream output = null;
try {
output = (OutputStream) MappingUtils.invokeFunction(clob, "setAsciiStream", new Class[]{long.class}, new Object[]{1});
} catch (MjdbcException ex) {
throw new MjdbcSQLException(ex);
}
try {
copy(input, output);
output.flush();
output.close();
} catch (IOException ex) {
throw new MjdbcSQLException(ex);
}
return clob;
} | java | public static Object convertClob(Object clob, byte[] value) throws SQLException {
ByteArrayInputStream input = new ByteArrayInputStream(value);
//OutputStream output = clob.setAsciiStream(1);
OutputStream output = null;
try {
output = (OutputStream) MappingUtils.invokeFunction(clob, "setAsciiStream", new Class[]{long.class}, new Object[]{1});
} catch (MjdbcException ex) {
throw new MjdbcSQLException(ex);
}
try {
copy(input, output);
output.flush();
output.close();
} catch (IOException ex) {
throw new MjdbcSQLException(ex);
}
return clob;
} | [
"public",
"static",
"Object",
"convertClob",
"(",
"Object",
"clob",
",",
"byte",
"[",
"]",
"value",
")",
"throws",
"SQLException",
"{",
"ByteArrayInputStream",
"input",
"=",
"new",
"ByteArrayInputStream",
"(",
"value",
")",
";",
"//OutputStream output = clob.setAsci... | Transfers data from byte[] into sql.Clob
@param clob sql.Clob which would be filled
@param value array of bytes
@return sql.Clob from array of bytes
@throws SQLException | [
"Transfers",
"data",
"from",
"byte",
"[]",
"into",
"sql",
".",
"Clob"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L216-L236 |
transloadit/java-sdk | src/main/java/com/transloadit/sdk/Request.java | Request.jsonifyData | private String jsonifyData(Map<String, ? extends Object> data) {
JSONObject jsonData = new JSONObject(data);
return jsonData.toString();
} | java | private String jsonifyData(Map<String, ? extends Object> data) {
JSONObject jsonData = new JSONObject(data);
return jsonData.toString();
} | [
"private",
"String",
"jsonifyData",
"(",
"Map",
"<",
"String",
",",
"?",
"extends",
"Object",
">",
"data",
")",
"{",
"JSONObject",
"jsonData",
"=",
"new",
"JSONObject",
"(",
"data",
")",
";",
"return",
"jsonData",
".",
"toString",
"(",
")",
";",
"}"
] | converts Map of data to json string
@param data map data to converted to json
@return {@link String} | [
"converts",
"Map",
"of",
"data",
"to",
"json",
"string"
] | train | https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/Request.java#L273-L277 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java | XpathUtils.asFloat | public static Float asFloat(String expression, Node node, XPath xpath)
throws XPathExpressionException {
String floatString = evaluateAsString(expression, node, xpath);
return (isEmptyString(floatString)) ? null : Float.valueOf(floatString);
} | java | public static Float asFloat(String expression, Node node, XPath xpath)
throws XPathExpressionException {
String floatString = evaluateAsString(expression, node, xpath);
return (isEmptyString(floatString)) ? null : Float.valueOf(floatString);
} | [
"public",
"static",
"Float",
"asFloat",
"(",
"String",
"expression",
",",
"Node",
"node",
",",
"XPath",
"xpath",
")",
"throws",
"XPathExpressionException",
"{",
"String",
"floatString",
"=",
"evaluateAsString",
"(",
"expression",
",",
"node",
",",
"xpath",
")",
... | Same as {@link #asFloat(String, Node)} but allows an xpath to be passed
in explicitly for reuse. | [
"Same",
"as",
"{"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java#L356-L360 |
mygreen/excel-cellformatter | src/main/java/com/github/mygreen/cellformatter/JXLCellFormatter.java | JXLCellFormatter.getCellValue | private CellFormatResult getCellValue(final Cell cell, final Locale locale, final boolean isStartDate1904) {
final JXLCell jxlCell = new JXLCell(cell, isStartDate1904);
final short formatIndex = jxlCell.getFormatIndex();
final String formatPattern = jxlCell.getFormatPattern();
if(formatterResolver.canResolve(formatIndex)) {
final CellFormatter cellFormatter = formatterResolver.getFormatter(formatIndex);
return cellFormatter.format(jxlCell, locale);
} else if(formatterResolver.canResolve(formatPattern)) {
final CellFormatter cellFormatter = formatterResolver.getFormatter(formatPattern);
return cellFormatter.format(jxlCell, locale);
} else {
// キャッシュに登録する。
final CellFormatter cellFormatter = formatterResolver.createFormatter(formatPattern) ;
if(isCache()) {
formatterResolver.registerFormatter(formatPattern, cellFormatter);
}
return cellFormatter.format(jxlCell, locale);
}
} | java | private CellFormatResult getCellValue(final Cell cell, final Locale locale, final boolean isStartDate1904) {
final JXLCell jxlCell = new JXLCell(cell, isStartDate1904);
final short formatIndex = jxlCell.getFormatIndex();
final String formatPattern = jxlCell.getFormatPattern();
if(formatterResolver.canResolve(formatIndex)) {
final CellFormatter cellFormatter = formatterResolver.getFormatter(formatIndex);
return cellFormatter.format(jxlCell, locale);
} else if(formatterResolver.canResolve(formatPattern)) {
final CellFormatter cellFormatter = formatterResolver.getFormatter(formatPattern);
return cellFormatter.format(jxlCell, locale);
} else {
// キャッシュに登録する。
final CellFormatter cellFormatter = formatterResolver.createFormatter(formatPattern) ;
if(isCache()) {
formatterResolver.registerFormatter(formatPattern, cellFormatter);
}
return cellFormatter.format(jxlCell, locale);
}
} | [
"private",
"CellFormatResult",
"getCellValue",
"(",
"final",
"Cell",
"cell",
",",
"final",
"Locale",
"locale",
",",
"final",
"boolean",
"isStartDate1904",
")",
"{",
"final",
"JXLCell",
"jxlCell",
"=",
"new",
"JXLCell",
"(",
"cell",
",",
"isStartDate1904",
")",
... | セルの値をフォーマットする。
@param cell フォーマット対象のセル
@param locale ロケール
@param isStartDate1904 1904年始まりかどうか。
@return | [
"セルの値をフォーマットする。"
] | train | https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/JXLCellFormatter.java#L257-L281 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/NLS.java | NLS.getInteger | public int getInteger(String key) throws MissingResourceException {
String result = getString(key);
try {
return Integer.parseInt(result);
} catch (NumberFormatException nfe) {
if (tc.isEventEnabled()) {
Tr.event(tc, "Unable to parse " + result + " as Integer.");
}
// DGH20040823: Begin fix for defect 218797 - Source provided by Tom Musta
// String msg = messages.getString("NLS.integerParseError",
// "Unable to parse as integer.");
String msg = getMessages().getString("NLS.integerParseError",
"Unable to parse as integer.");
// DGH20040823: End fix for defect 218797 - Source provided by Tom Musta
throw new MissingResourceException(msg, bundleName, key);
}
} | java | public int getInteger(String key) throws MissingResourceException {
String result = getString(key);
try {
return Integer.parseInt(result);
} catch (NumberFormatException nfe) {
if (tc.isEventEnabled()) {
Tr.event(tc, "Unable to parse " + result + " as Integer.");
}
// DGH20040823: Begin fix for defect 218797 - Source provided by Tom Musta
// String msg = messages.getString("NLS.integerParseError",
// "Unable to parse as integer.");
String msg = getMessages().getString("NLS.integerParseError",
"Unable to parse as integer.");
// DGH20040823: End fix for defect 218797 - Source provided by Tom Musta
throw new MissingResourceException(msg, bundleName, key);
}
} | [
"public",
"int",
"getInteger",
"(",
"String",
"key",
")",
"throws",
"MissingResourceException",
"{",
"String",
"result",
"=",
"getString",
"(",
"key",
")",
";",
"try",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"result",
")",
";",
"}",
"catch",
"(",
... | Not sure why this is here. Looks like it is a replacement for
Integer.getInteger. | [
"Not",
"sure",
"why",
"this",
"is",
"here",
".",
"Looks",
"like",
"it",
"is",
"a",
"replacement",
"for",
"Integer",
".",
"getInteger",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/NLS.java#L408-L424 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/xml/AnnotationReader.java | AnnotationReader.getAnnotation | @SuppressWarnings("unchecked")
public <A extends Annotation> A getAnnotation(final Class<?> clazz, final Class<A> annClass) throws AnnotationReadException {
if(xmlInfo != null && xmlInfo.containsClassInfo(clazz.getName())) {
final ClassInfo classInfo = xmlInfo.getClassInfo(clazz.getName());
if(classInfo.containsAnnotationInfo(annClass.getName())) {
AnnotationInfo annInfo = classInfo.getAnnotationInfo(annClass.getName());
try {
return (A)annotationBuilder.buildAnnotation(Class.forName(annInfo.getClassName()), annInfo);
} catch (ClassNotFoundException e) {
throw new AnnotationReadException(String.format("not found class '%s'", annInfo.getClassName()), e);
}
}
}
return clazz.getAnnotation(annClass);
} | java | @SuppressWarnings("unchecked")
public <A extends Annotation> A getAnnotation(final Class<?> clazz, final Class<A> annClass) throws AnnotationReadException {
if(xmlInfo != null && xmlInfo.containsClassInfo(clazz.getName())) {
final ClassInfo classInfo = xmlInfo.getClassInfo(clazz.getName());
if(classInfo.containsAnnotationInfo(annClass.getName())) {
AnnotationInfo annInfo = classInfo.getAnnotationInfo(annClass.getName());
try {
return (A)annotationBuilder.buildAnnotation(Class.forName(annInfo.getClassName()), annInfo);
} catch (ClassNotFoundException e) {
throw new AnnotationReadException(String.format("not found class '%s'", annInfo.getClassName()), e);
}
}
}
return clazz.getAnnotation(annClass);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"A",
"extends",
"Annotation",
">",
"A",
"getAnnotation",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"Class",
"<",
"A",
">",
"annClass",
")",
"throws",
"AnnotationReadExcepti... | Returns a class annotation for the specified type if such an annotation is present, else null.
@param <A> the type of the annotation
@param clazz the target class
@param annClass the Class object corresponding to the annotation type
@return the target class's annotation for the specified annotation type if present on this element, else null
@throws AnnotationReadException | [
"Returns",
"a",
"class",
"annotation",
"for",
"the",
"specified",
"type",
"if",
"such",
"an",
"annotation",
"is",
"present",
"else",
"null",
"."
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/xml/AnnotationReader.java#L89-L105 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/parsers/SEPAParserFactory.java | SEPAParserFactory.get | public static ISEPAParser get(SepaVersion version) {
ISEPAParser parser = null;
String className = version.getParserClass();
try {
log.debug("trying to init SEPA parser: " + className);
Class cl = Class.forName(className);
parser = (ISEPAParser) cl.newInstance();
} catch (Exception e) {
String msg = "Error creating SEPA parser";
throw new HBCI_Exception(msg, e);
}
return parser;
} | java | public static ISEPAParser get(SepaVersion version) {
ISEPAParser parser = null;
String className = version.getParserClass();
try {
log.debug("trying to init SEPA parser: " + className);
Class cl = Class.forName(className);
parser = (ISEPAParser) cl.newInstance();
} catch (Exception e) {
String msg = "Error creating SEPA parser";
throw new HBCI_Exception(msg, e);
}
return parser;
} | [
"public",
"static",
"ISEPAParser",
"get",
"(",
"SepaVersion",
"version",
")",
"{",
"ISEPAParser",
"parser",
"=",
"null",
";",
"String",
"className",
"=",
"version",
".",
"getParserClass",
"(",
")",
";",
"try",
"{",
"log",
".",
"debug",
"(",
"\"trying to init... | Gibt den passenden SEPA Parser für die angegebene PAIN-Version.
@param version die PAIN-Version.
@return ISEPAParser | [
"Gibt",
"den",
"passenden",
"SEPA",
"Parser",
"für",
"die",
"angegebene",
"PAIN",
"-",
"Version",
"."
] | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/parsers/SEPAParserFactory.java#L18-L31 |
skjolber/3d-bin-container-packing | src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java | LargestAreaFitFirstPackager.isBetter2D | protected int isBetter2D(Box a, Box b) {
int compare = Long.compare(a.getVolume(), b.getVolume());
if(compare != 0) {
return compare;
}
return Long.compare(b.getFootprint(), a.getFootprint()); // i.e. smaller i better
} | java | protected int isBetter2D(Box a, Box b) {
int compare = Long.compare(a.getVolume(), b.getVolume());
if(compare != 0) {
return compare;
}
return Long.compare(b.getFootprint(), a.getFootprint()); // i.e. smaller i better
} | [
"protected",
"int",
"isBetter2D",
"(",
"Box",
"a",
",",
"Box",
"b",
")",
"{",
"int",
"compare",
"=",
"Long",
".",
"compare",
"(",
"a",
".",
"getVolume",
"(",
")",
",",
"b",
".",
"getVolume",
"(",
")",
")",
";",
"if",
"(",
"compare",
"!=",
"0",
... | Is box b better than a?
@param a box
@param b box
@return -1 if b is better, 0 if equal, 1 if b is better | [
"Is",
"box",
"b",
"better",
"than",
"a?"
] | train | https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java#L432-L439 |
apache/incubator-gobblin | gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/BaseJdbcBufferedInserter.java | BaseJdbcBufferedInserter.createInsertStatementStr | protected String createInsertStatementStr(String databaseName, String table) {
return String.format(INSERT_STATEMENT_PREFIX_FORMAT, databaseName, table, JOINER_ON_COMMA.join(this.columnNames));
} | java | protected String createInsertStatementStr(String databaseName, String table) {
return String.format(INSERT_STATEMENT_PREFIX_FORMAT, databaseName, table, JOINER_ON_COMMA.join(this.columnNames));
} | [
"protected",
"String",
"createInsertStatementStr",
"(",
"String",
"databaseName",
",",
"String",
"table",
")",
"{",
"return",
"String",
".",
"format",
"(",
"INSERT_STATEMENT_PREFIX_FORMAT",
",",
"databaseName",
",",
"table",
",",
"JOINER_ON_COMMA",
".",
"join",
"(",... | Populates the placeholders and constructs the prefix of batch insert statement
@param databaseName name of the database
@param table name of the table
@return {@link #INSERT_STATEMENT_PREFIX_FORMAT} with all its resolved placeholders | [
"Populates",
"the",
"placeholders",
"and",
"constructs",
"the",
"prefix",
"of",
"batch",
"insert",
"statement"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/BaseJdbcBufferedInserter.java#L175-L177 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java | ImageModerationsImpl.findFacesUrlInputWithServiceResponseAsync | public Observable<ServiceResponse<FoundFaces>> findFacesUrlInputWithServiceResponseAsync(String contentType, BodyModelModel imageUrl, FindFacesUrlInputOptionalParameter findFacesUrlInputOptionalParameter) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (contentType == null) {
throw new IllegalArgumentException("Parameter contentType is required and cannot be null.");
}
if (imageUrl == null) {
throw new IllegalArgumentException("Parameter imageUrl is required and cannot be null.");
}
Validator.validate(imageUrl);
final Boolean cacheImage = findFacesUrlInputOptionalParameter != null ? findFacesUrlInputOptionalParameter.cacheImage() : null;
return findFacesUrlInputWithServiceResponseAsync(contentType, imageUrl, cacheImage);
} | java | public Observable<ServiceResponse<FoundFaces>> findFacesUrlInputWithServiceResponseAsync(String contentType, BodyModelModel imageUrl, FindFacesUrlInputOptionalParameter findFacesUrlInputOptionalParameter) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (contentType == null) {
throw new IllegalArgumentException("Parameter contentType is required and cannot be null.");
}
if (imageUrl == null) {
throw new IllegalArgumentException("Parameter imageUrl is required and cannot be null.");
}
Validator.validate(imageUrl);
final Boolean cacheImage = findFacesUrlInputOptionalParameter != null ? findFacesUrlInputOptionalParameter.cacheImage() : null;
return findFacesUrlInputWithServiceResponseAsync(contentType, imageUrl, cacheImage);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"FoundFaces",
">",
">",
"findFacesUrlInputWithServiceResponseAsync",
"(",
"String",
"contentType",
",",
"BodyModelModel",
"imageUrl",
",",
"FindFacesUrlInputOptionalParameter",
"findFacesUrlInputOptionalParameter",
")",
"{",
... | Returns the list of faces found.
@param contentType The content type.
@param imageUrl The image url.
@param findFacesUrlInputOptionalParameter 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 FoundFaces object | [
"Returns",
"the",
"list",
"of",
"faces",
"found",
"."
] | 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/ImageModerationsImpl.java#L920-L934 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ImageSegmentationOps.java | ImageSegmentationOps.regionPixelId_to_Compact | public static void regionPixelId_to_Compact(GrayS32 graph, GrowQueue_I32 segmentId, GrayS32 output) {
InputSanityCheck.checkSameShape(graph,output);
// Change the label of root nodes to be the new compacted labels
for( int i = 0; i < segmentId.size; i++ ) {
graph.data[segmentId.data[i]] = i;
}
// In the second pass assign all the children to the new compacted labels
for( int y = 0; y < output.height; y++ ) {
int indexGraph = graph.startIndex + y*graph.stride;
int indexOut = output.startIndex + y*output.stride;
for( int x = 0; x < output.width; x++ , indexGraph++,indexOut++) {
output.data[indexOut] = graph.data[graph.data[indexGraph]];
}
}
// need to do some clean up since the above approach doesn't work for the roots
for( int i = 0; i < segmentId.size; i++ ) {
int indexGraph = segmentId.data[i] - graph.startIndex;
int x = indexGraph%graph.stride;
int y = indexGraph/graph.stride;
output.data[output.startIndex + y*output.stride + x] = i;
}
} | java | public static void regionPixelId_to_Compact(GrayS32 graph, GrowQueue_I32 segmentId, GrayS32 output) {
InputSanityCheck.checkSameShape(graph,output);
// Change the label of root nodes to be the new compacted labels
for( int i = 0; i < segmentId.size; i++ ) {
graph.data[segmentId.data[i]] = i;
}
// In the second pass assign all the children to the new compacted labels
for( int y = 0; y < output.height; y++ ) {
int indexGraph = graph.startIndex + y*graph.stride;
int indexOut = output.startIndex + y*output.stride;
for( int x = 0; x < output.width; x++ , indexGraph++,indexOut++) {
output.data[indexOut] = graph.data[graph.data[indexGraph]];
}
}
// need to do some clean up since the above approach doesn't work for the roots
for( int i = 0; i < segmentId.size; i++ ) {
int indexGraph = segmentId.data[i] - graph.startIndex;
int x = indexGraph%graph.stride;
int y = indexGraph/graph.stride;
output.data[output.startIndex + y*output.stride + x] = i;
}
} | [
"public",
"static",
"void",
"regionPixelId_to_Compact",
"(",
"GrayS32",
"graph",
",",
"GrowQueue_I32",
"segmentId",
",",
"GrayS32",
"output",
")",
"{",
"InputSanityCheck",
".",
"checkSameShape",
"(",
"graph",
",",
"output",
")",
";",
"// Change the label of root nodes... | Compacts the region labels such that they are consecutive numbers starting from 0.
The ID of a root node must the index of a pixel in the 'graph' image, taking in account the change
in coordinates for sub-images.
@param graph Input segmented image where the ID's are not compacted
@param segmentId List of segment ID's. See comment above about what ID's are acceptable.
@param output The new image after it has been compacted | [
"Compacts",
"the",
"region",
"labels",
"such",
"that",
"they",
"are",
"consecutive",
"numbers",
"starting",
"from",
"0",
".",
"The",
"ID",
"of",
"a",
"root",
"node",
"must",
"the",
"index",
"of",
"a",
"pixel",
"in",
"the",
"graph",
"image",
"taking",
"in... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ImageSegmentationOps.java#L85-L111 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/search/SearchQuery.java | SearchQuery.addFacet | public SearchQuery addFacet(String facetName, SearchFacet facet) {
if (facet == null || facetName == null) {
throw new NullPointerException("Facet name and description must not be null");
}
this.facets.put(facetName, facet);
return this;
} | java | public SearchQuery addFacet(String facetName, SearchFacet facet) {
if (facet == null || facetName == null) {
throw new NullPointerException("Facet name and description must not be null");
}
this.facets.put(facetName, facet);
return this;
} | [
"public",
"SearchQuery",
"addFacet",
"(",
"String",
"facetName",
",",
"SearchFacet",
"facet",
")",
"{",
"if",
"(",
"facet",
"==",
"null",
"||",
"facetName",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Facet name and description must not... | Adds one {@link SearchFacet} to the query.
This is an additive operation (the given facets are added to any facet previously requested),
but if an existing facet has the same name it will be replaced.
This drives the inclusion of the {@link SearchQueryResult#facets()} facets} in the {@link SearchQueryResult}.
Note that to be faceted, a field's value must be stored in the FTS index.
@param facetName the name of the facet to add (or replace if one already exists with same name).
@param facet the facet to add. | [
"Adds",
"one",
"{",
"@link",
"SearchFacet",
"}",
"to",
"the",
"query",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/search/SearchQuery.java#L375-L381 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.deferFuture | public static <T> Observable<T> deferFuture(
Func0<? extends Future<? extends Observable<? extends T>>> observableFactoryAsync,
Scheduler scheduler) {
return OperatorDeferFuture.deferFuture(observableFactoryAsync, scheduler);
} | java | public static <T> Observable<T> deferFuture(
Func0<? extends Future<? extends Observable<? extends T>>> observableFactoryAsync,
Scheduler scheduler) {
return OperatorDeferFuture.deferFuture(observableFactoryAsync, scheduler);
} | [
"public",
"static",
"<",
"T",
">",
"Observable",
"<",
"T",
">",
"deferFuture",
"(",
"Func0",
"<",
"?",
"extends",
"Future",
"<",
"?",
"extends",
"Observable",
"<",
"?",
"extends",
"T",
">",
">",
">",
"observableFactoryAsync",
",",
"Scheduler",
"scheduler",... | Returns an Observable that starts the specified asynchronous factory function whenever a new observer
subscribes.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/deferFuture.s.png" alt="">
@param <T> the result type
@param observableFactoryAsync the asynchronous function to start for each observer
@param scheduler the Scheduler where the completion of the Future is awaited
@return the Observable emitting items produced by the asynchronous observer produced by the factory
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-deferfuture">RxJava Wiki: deferFuture()</a> | [
"Returns",
"an",
"Observable",
"that",
"starts",
"the",
"specified",
"asynchronous",
"factory",
"function",
"whenever",
"a",
"new",
"observer",
"subscribes",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L1816-L1820 |
tango-controls/JTango | server/src/main/java/org/tango/server/dynamic/DynamicManager.java | DynamicManager.addCommand | public void addCommand(final ICommandBehavior behavior) throws DevFailed {
final String cmdName = behavior.getConfiguration().getName();
xlogger.entry("adding dynamic command {}", cmdName);
final CommandImpl commandImpl = new CommandImpl(behavior, deviceImpl.getName());
commandImpl.setStateMachine(behavior.getStateMachine());
deviceImpl.addCommand(commandImpl);
dynamicCommands.put(cmdName.toLowerCase(Locale.ENGLISH), commandImpl);
deviceImpl.pushInterfaceChangeEvent(false);
xlogger.exit();
} | java | public void addCommand(final ICommandBehavior behavior) throws DevFailed {
final String cmdName = behavior.getConfiguration().getName();
xlogger.entry("adding dynamic command {}", cmdName);
final CommandImpl commandImpl = new CommandImpl(behavior, deviceImpl.getName());
commandImpl.setStateMachine(behavior.getStateMachine());
deviceImpl.addCommand(commandImpl);
dynamicCommands.put(cmdName.toLowerCase(Locale.ENGLISH), commandImpl);
deviceImpl.pushInterfaceChangeEvent(false);
xlogger.exit();
} | [
"public",
"void",
"addCommand",
"(",
"final",
"ICommandBehavior",
"behavior",
")",
"throws",
"DevFailed",
"{",
"final",
"String",
"cmdName",
"=",
"behavior",
".",
"getConfiguration",
"(",
")",
".",
"getName",
"(",
")",
";",
"xlogger",
".",
"entry",
"(",
"\"a... | Add command. Only if not already exists on device
@param behavior
@throws DevFailed | [
"Add",
"command",
".",
"Only",
"if",
"not",
"already",
"exists",
"on",
"device"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/dynamic/DynamicManager.java#L268-L277 |
alkacon/opencms-core | src/org/opencms/file/CmsProject.java | CmsProject.isInsideProject | public static boolean isInsideProject(List<String> projectResources, String resourcename) {
for (int i = (projectResources.size() - 1); i >= 0; i--) {
String projectResource = projectResources.get(i);
if (CmsResource.isFolder(projectResource)) {
if (resourcename.startsWith(projectResource)) {
// folder - check only the prefix
return true;
}
} else {
if (resourcename.equals(projectResource)) {
// file - check the full path
return true;
}
}
}
return false;
} | java | public static boolean isInsideProject(List<String> projectResources, String resourcename) {
for (int i = (projectResources.size() - 1); i >= 0; i--) {
String projectResource = projectResources.get(i);
if (CmsResource.isFolder(projectResource)) {
if (resourcename.startsWith(projectResource)) {
// folder - check only the prefix
return true;
}
} else {
if (resourcename.equals(projectResource)) {
// file - check the full path
return true;
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"isInsideProject",
"(",
"List",
"<",
"String",
">",
"projectResources",
",",
"String",
"resourcename",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"(",
"projectResources",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"i",
">=",
... | Checks if the full resource name (including the site root) of a resource matches
any of the project resources of a project.<p>
@param projectResources a List of project resources as Strings
@param resourcename the resource to check
@return true, if the resource is "inside" the project resources | [
"Checks",
"if",
"the",
"full",
"resource",
"name",
"(",
"including",
"the",
"site",
"root",
")",
"of",
"a",
"resource",
"matches",
"any",
"of",
"the",
"project",
"resources",
"of",
"a",
"project",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsProject.java#L240-L257 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java | VelocityUtil.merge | public static void merge(Template template, VelocityContext context, Writer writer) {
if (template == null) {
throw new UtilException("Template is null");
}
if (context == null) {
context = new VelocityContext(globalContext);
} else {
// 加入全局上下文
for (Entry<String, Object> entry : globalContext.entrySet()) {
context.put(entry.getKey(), entry.getValue());
}
}
template.merge(context, writer);
} | java | public static void merge(Template template, VelocityContext context, Writer writer) {
if (template == null) {
throw new UtilException("Template is null");
}
if (context == null) {
context = new VelocityContext(globalContext);
} else {
// 加入全局上下文
for (Entry<String, Object> entry : globalContext.entrySet()) {
context.put(entry.getKey(), entry.getValue());
}
}
template.merge(context, writer);
} | [
"public",
"static",
"void",
"merge",
"(",
"Template",
"template",
",",
"VelocityContext",
"context",
",",
"Writer",
"writer",
")",
"{",
"if",
"(",
"template",
"==",
"null",
")",
"{",
"throw",
"new",
"UtilException",
"(",
"\"Template is null\"",
")",
";",
"}"... | 融合模板和内容并写入到Writer
@param template 模板
@param context 内容
@param writer Writer | [
"融合模板和内容并写入到Writer"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L254-L268 |
james-hu/jabb-core | src/main/java/net/sf/jabb/util/parallel/BackoffStrategies.java | BackoffStrategies.fibonacciBackoff | public static BackoffStrategy fibonacciBackoff(long maximumTime, TimeUnit maximumTimeUnit) {
Preconditions.checkNotNull(maximumTimeUnit, "The maximum time unit may not be null");
return new FibonacciBackoffStrategy(1, maximumTimeUnit.toMillis(maximumTime));
} | java | public static BackoffStrategy fibonacciBackoff(long maximumTime, TimeUnit maximumTimeUnit) {
Preconditions.checkNotNull(maximumTimeUnit, "The maximum time unit may not be null");
return new FibonacciBackoffStrategy(1, maximumTimeUnit.toMillis(maximumTime));
} | [
"public",
"static",
"BackoffStrategy",
"fibonacciBackoff",
"(",
"long",
"maximumTime",
",",
"TimeUnit",
"maximumTimeUnit",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"maximumTimeUnit",
",",
"\"The maximum time unit may not be null\"",
")",
";",
"return",
"new",
... | Returns a strategy which waits for an increasing amount of time after the first failed attempt,
and in Fibonacci increments after each failed attempt up to the {@code maximumTime}.
@param maximumTime the maximum time to wait
@param maximumTimeUnit the unit of the maximum time
@return a backoff strategy that increments with each failed attempt using a Fibonacci sequence | [
"Returns",
"a",
"strategy",
"which",
"waits",
"for",
"an",
"increasing",
"amount",
"of",
"time",
"after",
"the",
"first",
"failed",
"attempt",
"and",
"in",
"Fibonacci",
"increments",
"after",
"each",
"failed",
"attempt",
"up",
"to",
"the",
"{",
"@code",
"max... | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/parallel/BackoffStrategies.java#L252-L255 |
jbundle/jbundle | thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageReceiver.java | RemoteMessageReceiver.setNewFilterProperties | public void setNewFilterProperties(BaseMessageFilter messageFilter, Object[][] mxProperties, Map<String, Object> propFilter)
{
super.setNewFilterProperties(messageFilter, mxProperties, propFilter); // Does nothing.
try {
if (messageFilter.isUpdateRemoteFilter()) // Almost always true
if (messageFilter.getRemoteFilterID() != null) // If the remote filter exists
m_receiveQueue.updateRemoteFilterProperties(messageFilter, mxProperties, propFilter);
} catch (RemoteException ex) {
ex.printStackTrace();
}
} | java | public void setNewFilterProperties(BaseMessageFilter messageFilter, Object[][] mxProperties, Map<String, Object> propFilter)
{
super.setNewFilterProperties(messageFilter, mxProperties, propFilter); // Does nothing.
try {
if (messageFilter.isUpdateRemoteFilter()) // Almost always true
if (messageFilter.getRemoteFilterID() != null) // If the remote filter exists
m_receiveQueue.updateRemoteFilterProperties(messageFilter, mxProperties, propFilter);
} catch (RemoteException ex) {
ex.printStackTrace();
}
} | [
"public",
"void",
"setNewFilterProperties",
"(",
"BaseMessageFilter",
"messageFilter",
",",
"Object",
"[",
"]",
"[",
"]",
"mxProperties",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"propFilter",
")",
"{",
"super",
".",
"setNewFilterProperties",
"(",
"message... | Update this filter with this new information.
Override this to do something if there is a remote version of this filter.
@param messageFilter The message filter I am updating.
@param properties New filter information (ie, bookmark=345). | [
"Update",
"this",
"filter",
"with",
"this",
"new",
"information",
".",
"Override",
"this",
"to",
"do",
"something",
"if",
"there",
"is",
"a",
"remote",
"version",
"of",
"this",
"filter",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageReceiver.java#L151-L161 |
Erudika/para | para-server/src/main/java/com/erudika/para/security/filters/LdapAuthFilter.java | LdapAuthFilter.getOrCreateUser | public UserAuthentication getOrCreateUser(App app, String accessToken) throws IOException {
UserAuthentication userAuth = null;
if (accessToken != null && accessToken.contains(Config.SEPARATOR)) {
String[] parts = accessToken.split(Config.SEPARATOR, 2);
String username = parts[0];
String password = parts[1];
try {
Authentication auth = new LDAPAuthentication(username, password).withApp(app);
// set authentication in context to avoid warning message from SpringSecurityAuthenticationSource
SecurityContextHolder.getContext().setAuthentication(new AnonymousAuthenticationToken("key",
"anonymous", AuthorityUtils.createAuthorityList("ROLE_ANONYMOUS")));
Authentication ldapAuth = getAuthenticationManager().authenticate(auth);
if (ldapAuth != null) {
//success!
userAuth = getOrCreateUser(app, ldapAuth);
}
} catch (Exception ex) {
LOG.info("Failed to authenticate '{}' with LDAP server: {}", username, ex.getMessage());
}
}
return SecurityUtils.checkIfActive(userAuth, SecurityUtils.getAuthenticatedUser(userAuth), false);
} | java | public UserAuthentication getOrCreateUser(App app, String accessToken) throws IOException {
UserAuthentication userAuth = null;
if (accessToken != null && accessToken.contains(Config.SEPARATOR)) {
String[] parts = accessToken.split(Config.SEPARATOR, 2);
String username = parts[0];
String password = parts[1];
try {
Authentication auth = new LDAPAuthentication(username, password).withApp(app);
// set authentication in context to avoid warning message from SpringSecurityAuthenticationSource
SecurityContextHolder.getContext().setAuthentication(new AnonymousAuthenticationToken("key",
"anonymous", AuthorityUtils.createAuthorityList("ROLE_ANONYMOUS")));
Authentication ldapAuth = getAuthenticationManager().authenticate(auth);
if (ldapAuth != null) {
//success!
userAuth = getOrCreateUser(app, ldapAuth);
}
} catch (Exception ex) {
LOG.info("Failed to authenticate '{}' with LDAP server: {}", username, ex.getMessage());
}
}
return SecurityUtils.checkIfActive(userAuth, SecurityUtils.getAuthenticatedUser(userAuth), false);
} | [
"public",
"UserAuthentication",
"getOrCreateUser",
"(",
"App",
"app",
",",
"String",
"accessToken",
")",
"throws",
"IOException",
"{",
"UserAuthentication",
"userAuth",
"=",
"null",
";",
"if",
"(",
"accessToken",
"!=",
"null",
"&&",
"accessToken",
".",
"contains",... | Calls an external API to get the user profile using a given access token.
@param app the app where the user will be created, use null for root app
@param accessToken access token - in the case of LDAP this is should be "uid:password"
@return {@link UserAuthentication} object or null if something went wrong
@throws IOException ex | [
"Calls",
"an",
"external",
"API",
"to",
"get",
"the",
"user",
"profile",
"using",
"a",
"given",
"access",
"token",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/filters/LdapAuthFilter.java#L167-L189 |
hibernate/hibernate-metamodelgen | src/main/java/org/hibernate/jpamodelgen/util/TypeUtils.java | TypeUtils.getAnnotationMirror | public static AnnotationMirror getAnnotationMirror(Element element, String fqcn) {
assert element != null;
assert fqcn != null;
AnnotationMirror mirror = null;
for ( AnnotationMirror am : element.getAnnotationMirrors() ) {
if ( isAnnotationMirrorOfType( am, fqcn ) ) {
mirror = am;
break;
}
}
return mirror;
} | java | public static AnnotationMirror getAnnotationMirror(Element element, String fqcn) {
assert element != null;
assert fqcn != null;
AnnotationMirror mirror = null;
for ( AnnotationMirror am : element.getAnnotationMirrors() ) {
if ( isAnnotationMirrorOfType( am, fqcn ) ) {
mirror = am;
break;
}
}
return mirror;
} | [
"public",
"static",
"AnnotationMirror",
"getAnnotationMirror",
"(",
"Element",
"element",
",",
"String",
"fqcn",
")",
"{",
"assert",
"element",
"!=",
"null",
";",
"assert",
"fqcn",
"!=",
"null",
";",
"AnnotationMirror",
"mirror",
"=",
"null",
";",
"for",
"(",
... | Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param fqcn the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the {@code Element} or {@code null} in case
the {@code TypeElement} does not host the specified annotation. | [
"Checks",
"whether",
"the",
"{",
"@code",
"Element",
"}",
"hosts",
"the",
"annotation",
"with",
"the",
"given",
"fully",
"qualified",
"class",
"name",
"."
] | train | https://github.com/hibernate/hibernate-metamodelgen/blob/2c87b262bc03b1a5a541789fc00c54e0531a36b2/src/main/java/org/hibernate/jpamodelgen/util/TypeUtils.java#L145-L157 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatednas/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednas.java | ApiOvhDedicatednas.serviceName_partition_partitionName_quota_POST | public OvhTask serviceName_partition_partitionName_quota_POST(String serviceName, String partitionName, Long size, Long uid) throws IOException {
String qPath = "/dedicated/nas/{serviceName}/partition/{partitionName}/quota";
StringBuilder sb = path(qPath, serviceName, partitionName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "size", size);
addBody(o, "uid", uid);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_partition_partitionName_quota_POST(String serviceName, String partitionName, Long size, Long uid) throws IOException {
String qPath = "/dedicated/nas/{serviceName}/partition/{partitionName}/quota";
StringBuilder sb = path(qPath, serviceName, partitionName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "size", size);
addBody(o, "uid", uid);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_partition_partitionName_quota_POST",
"(",
"String",
"serviceName",
",",
"String",
"partitionName",
",",
"Long",
"size",
",",
"Long",
"uid",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/nas/{serviceName}/partiti... | Set a new quota
REST: POST /dedicated/nas/{serviceName}/partition/{partitionName}/quota
@param uid [required] the uid to set quota on
@param size [required] the size to set in MB
@param serviceName [required] The internal name of your storage
@param partitionName [required] the given name of partition | [
"Set",
"a",
"new",
"quota"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatednas/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednas.java#L282-L290 |
strator-dev/greenpepper | greenpepper-open/greenpepper-maven-runner/src/main/java/com/greenpepper/maven/runner/util/ReflectionUtils.java | ReflectionUtils.getDeclaredFieldValue | public static Object getDeclaredFieldValue(Object object, String declaredFieldName)
throws Exception
{
Field field = object.getClass().getDeclaredField(declaredFieldName);
field.setAccessible(true);
return field.get(object);
} | java | public static Object getDeclaredFieldValue(Object object, String declaredFieldName)
throws Exception
{
Field field = object.getClass().getDeclaredField(declaredFieldName);
field.setAccessible(true);
return field.get(object);
} | [
"public",
"static",
"Object",
"getDeclaredFieldValue",
"(",
"Object",
"object",
",",
"String",
"declaredFieldName",
")",
"throws",
"Exception",
"{",
"Field",
"field",
"=",
"object",
".",
"getClass",
"(",
")",
".",
"getDeclaredField",
"(",
"declaredFieldName",
")",... | <p>getDeclaredFieldValue.</p>
@param object a {@link java.lang.Object} object.
@param declaredFieldName a {@link java.lang.String} object.
@return a {@link java.lang.Object} object.
@throws java.lang.Exception if any. | [
"<p",
">",
"getDeclaredFieldValue",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/greenpepper-maven-runner/src/main/java/com/greenpepper/maven/runner/util/ReflectionUtils.java#L41-L49 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java | HexUtil.appendHexString | static public void appendHexString(StringBuilder buffer, short value) {
assertNotNull(buffer);
int nibble = (value & 0xF000) >>> 12;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x0F00) >>> 8;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x00F0) >>> 4;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x000F);
buffer.append(HEX_TABLE[nibble]);
} | java | static public void appendHexString(StringBuilder buffer, short value) {
assertNotNull(buffer);
int nibble = (value & 0xF000) >>> 12;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x0F00) >>> 8;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x00F0) >>> 4;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x000F);
buffer.append(HEX_TABLE[nibble]);
} | [
"static",
"public",
"void",
"appendHexString",
"(",
"StringBuilder",
"buffer",
",",
"short",
"value",
")",
"{",
"assertNotNull",
"(",
"buffer",
")",
";",
"int",
"nibble",
"=",
"(",
"value",
"&",
"0xF000",
")",
">>>",
"12",
";",
"buffer",
".",
"append",
"... | Appends 4 characters to a StringBuilder with the short in a "Big Endian"
hexidecimal format. For example, a short 0x1234 will be appended as a
String in format "1234". A short of value 0 will be appended as "0000".
@param buffer The StringBuilder the short value in hexidecimal format
will be appended to. If the buffer is null, this method will throw
a NullPointerException.
@param value The short value that will be converted to a hexidecimal String. | [
"Appends",
"4",
"characters",
"to",
"a",
"StringBuilder",
"with",
"the",
"short",
"in",
"a",
"Big",
"Endian",
"hexidecimal",
"format",
".",
"For",
"example",
"a",
"short",
"0x1234",
"will",
"be",
"appended",
"as",
"a",
"String",
"in",
"format",
"1234",
"."... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L173-L183 |
demidenko05/beige-uml | beige-uml-swing/src/main/java/org/beigesoft/uml/ui/swing/PaneDiagramSwing.java | PaneDiagramSwing.setDiagramControllerAndPalettes | public void setDiagramControllerAndPalettes(IControllerDiagramUml<?, ?> controllerDiagramUml, Component palletteDiagram, Component palletteZoom) {
this.activeControllerDiagramUml = controllerDiagramUml;
if(currentPaletteDiagram != null) {
this.actionPropertiesPane.remove(currentPaletteDiagram);
}
this.actionPropertiesPane.add(palletteDiagram, BorderLayout.CENTER);
currentPaletteDiagram = palletteDiagram;
if(!isZoomPalletteAdded) {
this.actionPropertiesPane.add(palletteZoom, BorderLayout.SOUTH);
isZoomPalletteAdded = true;
}
} | java | public void setDiagramControllerAndPalettes(IControllerDiagramUml<?, ?> controllerDiagramUml, Component palletteDiagram, Component palletteZoom) {
this.activeControllerDiagramUml = controllerDiagramUml;
if(currentPaletteDiagram != null) {
this.actionPropertiesPane.remove(currentPaletteDiagram);
}
this.actionPropertiesPane.add(palletteDiagram, BorderLayout.CENTER);
currentPaletteDiagram = palletteDiagram;
if(!isZoomPalletteAdded) {
this.actionPropertiesPane.add(palletteZoom, BorderLayout.SOUTH);
isZoomPalletteAdded = true;
}
} | [
"public",
"void",
"setDiagramControllerAndPalettes",
"(",
"IControllerDiagramUml",
"<",
"?",
",",
"?",
">",
"controllerDiagramUml",
",",
"Component",
"palletteDiagram",
",",
"Component",
"palletteZoom",
")",
"{",
"this",
".",
"activeControllerDiagramUml",
"=",
"controll... | Set current diagram maker
e.g. ClassDiagramMaker or ActivityDiagramMaker
@param controllerDiagramUml
@param palletteDiagram | [
"Set",
"current",
"diagram",
"maker",
"e",
".",
"g",
".",
"ClassDiagramMaker",
"or",
"ActivityDiagramMaker"
] | train | https://github.com/demidenko05/beige-uml/blob/65f6024fa944e10875d9a3be3e4a586bede39683/beige-uml-swing/src/main/java/org/beigesoft/uml/ui/swing/PaneDiagramSwing.java#L58-L69 |
devnied/EMV-NFC-Paycard-Enrollment | library/src/main/java/com/github/devnied/emvnfccard/parser/EmvTemplate.java | EmvTemplate.parseFCIProprietaryTemplate | protected List<Application> parseFCIProprietaryTemplate(final byte[] pData) throws CommunicationException {
List<Application> ret = new ArrayList<Application>();
// Get SFI
byte[] data = TlvUtil.getValue(pData, EmvTags.SFI);
// Check SFI
if (data != null) {
int sfi = BytesUtils.byteArrayToInt(data);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("SFI found:" + sfi);
}
// For each records
for (int rec = 0; rec < MAX_RECORD_SFI; rec++) {
data = provider.transceive(new CommandApdu(CommandEnum.READ_RECORD, rec, sfi << 3 | 4, 0).toBytes());
// Check response
if (ResponseUtils.isSucceed(data)) {
// Get applications Tags
ret.addAll(getApplicationTemplate(data));
} else {
// No more records
break;
}
}
} else {
// Read Application template
ret.addAll(getApplicationTemplate(pData));
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("(FCI) Issuer Discretionary Data is already present");
}
}
return ret;
} | java | protected List<Application> parseFCIProprietaryTemplate(final byte[] pData) throws CommunicationException {
List<Application> ret = new ArrayList<Application>();
// Get SFI
byte[] data = TlvUtil.getValue(pData, EmvTags.SFI);
// Check SFI
if (data != null) {
int sfi = BytesUtils.byteArrayToInt(data);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("SFI found:" + sfi);
}
// For each records
for (int rec = 0; rec < MAX_RECORD_SFI; rec++) {
data = provider.transceive(new CommandApdu(CommandEnum.READ_RECORD, rec, sfi << 3 | 4, 0).toBytes());
// Check response
if (ResponseUtils.isSucceed(data)) {
// Get applications Tags
ret.addAll(getApplicationTemplate(data));
} else {
// No more records
break;
}
}
} else {
// Read Application template
ret.addAll(getApplicationTemplate(pData));
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("(FCI) Issuer Discretionary Data is already present");
}
}
return ret;
} | [
"protected",
"List",
"<",
"Application",
">",
"parseFCIProprietaryTemplate",
"(",
"final",
"byte",
"[",
"]",
"pData",
")",
"throws",
"CommunicationException",
"{",
"List",
"<",
"Application",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"Application",
">",
"(",
"... | Method used to parse FCI Proprietary Template
@param pData
data to parse
@return the list of EMV application in the card
@throws CommunicationException communication error | [
"Method",
"used",
"to",
"parse",
"FCI",
"Proprietary",
"Template"
] | train | https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/parser/EmvTemplate.java#L435-L466 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/db/GeoPackageCoreConnection.java | GeoPackageCoreConnection.querySingleTypedResult | public <T> T querySingleTypedResult(String sql, String[] args) {
@SuppressWarnings("unchecked")
T result = (T) querySingleResult(sql, args);
return result;
} | java | public <T> T querySingleTypedResult(String sql, String[] args) {
@SuppressWarnings("unchecked")
T result = (T) querySingleResult(sql, args);
return result;
} | [
"public",
"<",
"T",
">",
"T",
"querySingleTypedResult",
"(",
"String",
"sql",
",",
"String",
"[",
"]",
"args",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"T",
"result",
"=",
"(",
"T",
")",
"querySingleResult",
"(",
"sql",
",",
"args",
... | Query the SQL for a single result typed object in the first column
@param <T>
result value type
@param sql
sql statement
@param args
sql arguments
@return single result object
@since 3.1.0 | [
"Query",
"the",
"SQL",
"for",
"a",
"single",
"result",
"typed",
"object",
"in",
"the",
"first",
"column"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/db/GeoPackageCoreConnection.java#L190-L194 |
Jasig/uPortal | uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/providers/PersonEvaluatorFactory.java | PersonEvaluatorFactory.getAttributeEvaluator | public Evaluator getAttributeEvaluator(String name, String mode, String value)
throws Exception {
return new AttributeEvaluator(name, mode, value);
} | java | public Evaluator getAttributeEvaluator(String name, String mode, String value)
throws Exception {
return new AttributeEvaluator(name, mode, value);
} | [
"public",
"Evaluator",
"getAttributeEvaluator",
"(",
"String",
"name",
",",
"String",
"mode",
",",
"String",
"value",
")",
"throws",
"Exception",
"{",
"return",
"new",
"AttributeEvaluator",
"(",
"name",
",",
"mode",
",",
"value",
")",
";",
"}"
] | returns an Evaluator unique to the type of attribute being evaluated. subclasses can override
this method to return the Evaluator that's appropriate to their implementation.
@param name the attribute's name.
@param mode the attribute's mode. (i.e. 'equals')
@param value the attribute's value.
@return an Evaluator for evaluating attributes | [
"returns",
"an",
"Evaluator",
"unique",
"to",
"the",
"type",
"of",
"attribute",
"being",
"evaluated",
".",
"subclasses",
"can",
"override",
"this",
"method",
"to",
"return",
"the",
"Evaluator",
"that",
"s",
"appropriate",
"to",
"their",
"implementation",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/providers/PersonEvaluatorFactory.java#L155-L158 |
yasserg/crawler4j | crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java | CrawlController.addSeenUrl | public void addSeenUrl(String url, int docId) throws UnsupportedEncodingException {
String canonicalUrl = URLCanonicalizer.getCanonicalURL(url);
if (canonicalUrl == null) {
logger.error("Invalid Url: {} (can't cannonicalize it!)", url);
} else {
try {
docIdServer.addUrlAndDocId(canonicalUrl, docId);
} catch (RuntimeException e) {
if (config.isHaltOnError()) {
throw e;
} else {
logger.error("Could not add seen url: {}", e.getMessage());
}
}
}
} | java | public void addSeenUrl(String url, int docId) throws UnsupportedEncodingException {
String canonicalUrl = URLCanonicalizer.getCanonicalURL(url);
if (canonicalUrl == null) {
logger.error("Invalid Url: {} (can't cannonicalize it!)", url);
} else {
try {
docIdServer.addUrlAndDocId(canonicalUrl, docId);
} catch (RuntimeException e) {
if (config.isHaltOnError()) {
throw e;
} else {
logger.error("Could not add seen url: {}", e.getMessage());
}
}
}
} | [
"public",
"void",
"addSeenUrl",
"(",
"String",
"url",
",",
"int",
"docId",
")",
"throws",
"UnsupportedEncodingException",
"{",
"String",
"canonicalUrl",
"=",
"URLCanonicalizer",
".",
"getCanonicalURL",
"(",
"url",
")",
";",
"if",
"(",
"canonicalUrl",
"==",
"null... | This function can called to assign a specific document id to a url. This
feature is useful when you have had a previous crawl and have stored the
Urls and their associated document ids and want to have a new crawl which
is aware of the previously seen Urls and won't re-crawl them.
Note that if you add three seen Urls with document ids 1,2, and 7. Then
the next URL that is found during the crawl will get a doc id of 8. Also
you need to ensure to add seen Urls in increasing order of document ids.
@param url
the URL of the page
@param docId
the document id that you want to be assigned to this URL.
@throws UnsupportedEncodingException | [
"This",
"function",
"can",
"called",
"to",
"assign",
"a",
"specific",
"document",
"id",
"to",
"a",
"url",
".",
"This",
"feature",
"is",
"useful",
"when",
"you",
"have",
"had",
"a",
"previous",
"crawl",
"and",
"have",
"stored",
"the",
"Urls",
"and",
"thei... | train | https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java#L568-L583 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java | BitsUtil.hammingDistance | public static int hammingDistance(long[] x, long[] y) {
final int lx = x.length, ly = y.length;
final int min = (lx < ly) ? lx : ly;
int i = 0, h = 0;
for(; i < min; i++) {
h += Long.bitCount(x[i] ^ y[i]);
}
for(; i < lx; i++) {
h += Long.bitCount(x[i]);
}
for(; i < ly; i++) {
h += Long.bitCount(y[i]);
}
return h;
} | java | public static int hammingDistance(long[] x, long[] y) {
final int lx = x.length, ly = y.length;
final int min = (lx < ly) ? lx : ly;
int i = 0, h = 0;
for(; i < min; i++) {
h += Long.bitCount(x[i] ^ y[i]);
}
for(; i < lx; i++) {
h += Long.bitCount(x[i]);
}
for(; i < ly; i++) {
h += Long.bitCount(y[i]);
}
return h;
} | [
"public",
"static",
"int",
"hammingDistance",
"(",
"long",
"[",
"]",
"x",
",",
"long",
"[",
"]",
"y",
")",
"{",
"final",
"int",
"lx",
"=",
"x",
".",
"length",
",",
"ly",
"=",
"y",
".",
"length",
";",
"final",
"int",
"min",
"=",
"(",
"lx",
"<",
... | Compute the Hamming distance (Size of symmetric difference), i.e.
{@code cardinality(a ^ b)}.
@param x First vector
@param y Second vector
@return Cardinality of symmetric difference | [
"Compute",
"the",
"Hamming",
"distance",
"(",
"Size",
"of",
"symmetric",
"difference",
")",
"i",
".",
"e",
".",
"{",
"@code",
"cardinality",
"(",
"a",
"^",
"b",
")",
"}",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java#L1526-L1540 |
intellimate/Izou | src/main/java/org/intellimate/izou/output/OutputManager.java | OutputManager.generateAllOutputExtensions | public <T, X> List<CompletableFuture<X>> generateAllOutputExtensions(OutputPluginModel<T, X> outputPlugin,
T t, EventModel event) {
IdentifiableSet<OutputExtensionModel<?, ?>> extensions = outputExtensions.get(outputPlugin.getID());
if (extensions == null)
return new ArrayList<>();
return filterType(extensions, outputPlugin).stream()
.map(extension -> {
try {
//noinspection unchecked
return (OutputExtensionModel<X, T>) extension;
} catch (ClassCastException e) {
return null;
}
})
.filter(Objects::nonNull)
.filter(outputExtension -> outputExtension.canRun(event))
.map(extension -> submit(() -> extension.generate(event, t)))
.collect(Collectors.toList());
} | java | public <T, X> List<CompletableFuture<X>> generateAllOutputExtensions(OutputPluginModel<T, X> outputPlugin,
T t, EventModel event) {
IdentifiableSet<OutputExtensionModel<?, ?>> extensions = outputExtensions.get(outputPlugin.getID());
if (extensions == null)
return new ArrayList<>();
return filterType(extensions, outputPlugin).stream()
.map(extension -> {
try {
//noinspection unchecked
return (OutputExtensionModel<X, T>) extension;
} catch (ClassCastException e) {
return null;
}
})
.filter(Objects::nonNull)
.filter(outputExtension -> outputExtension.canRun(event))
.map(extension -> submit(() -> extension.generate(event, t)))
.collect(Collectors.toList());
} | [
"public",
"<",
"T",
",",
"X",
">",
"List",
"<",
"CompletableFuture",
"<",
"X",
">",
">",
"generateAllOutputExtensions",
"(",
"OutputPluginModel",
"<",
"T",
",",
"X",
">",
"outputPlugin",
",",
"T",
"t",
",",
"EventModel",
"event",
")",
"{",
"IdentifiableSet... | Starts every associated OutputExtension
@param outputPlugin the OutputPlugin to generate the Data for
@param t the argument or null
@param event the Event to generate for
@param <T> the type of the argument
@param <X> the return type
@return a List of Future-Objects | [
"Starts",
"every",
"associated",
"OutputExtension"
] | train | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/output/OutputManager.java#L258-L276 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/GeoPackageExtensions.java | GeoPackageExtensions.deleteSchema | public static void deleteSchema(GeoPackageCore geoPackage, String table) {
DataColumnsDao dataColumnsDao = geoPackage.getDataColumnsDao();
try {
if (dataColumnsDao.isTableExists()) {
dataColumnsDao.deleteByTableName(table);
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to delete Schema extension. GeoPackage: "
+ geoPackage.getName() + ", Table: " + table, e);
}
} | java | public static void deleteSchema(GeoPackageCore geoPackage, String table) {
DataColumnsDao dataColumnsDao = geoPackage.getDataColumnsDao();
try {
if (dataColumnsDao.isTableExists()) {
dataColumnsDao.deleteByTableName(table);
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to delete Schema extension. GeoPackage: "
+ geoPackage.getName() + ", Table: " + table, e);
}
} | [
"public",
"static",
"void",
"deleteSchema",
"(",
"GeoPackageCore",
"geoPackage",
",",
"String",
"table",
")",
"{",
"DataColumnsDao",
"dataColumnsDao",
"=",
"geoPackage",
".",
"getDataColumnsDao",
"(",
")",
";",
"try",
"{",
"if",
"(",
"dataColumnsDao",
".",
"isTa... | Delete the Schema extensions for the table
@param geoPackage
GeoPackage
@param table
table name
@since 3.2.0 | [
"Delete",
"the",
"Schema",
"extensions",
"for",
"the",
"table"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/GeoPackageExtensions.java#L318-L331 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java | CollectionLiteralsTypeComputer.createMapTypeReference | protected LightweightTypeReference createMapTypeReference(JvmGenericType mapType, LightweightTypeReference pairType, LightweightTypeReference expectation, ITypeReferenceOwner owner) {
List<LightweightTypeReference> leftAndRight = pairType.getTypeArguments();
LightweightTypeReference left = leftAndRight.get(0).getInvariantBoundSubstitute();
LightweightTypeReference right = leftAndRight.get(1).getInvariantBoundSubstitute();
LightweightTypeReference mapExpectation = getMapExpectation(expectation);
if (mapExpectation != null) {
List<LightweightTypeReference> typeArguments = expectation.getTypeArguments();
left = doNormalizeElementType(left, typeArguments.get(0));
right = doNormalizeElementType(right, typeArguments.get(1));
}
ParameterizedTypeReference result = owner.newParameterizedTypeReference(mapType);
result.addTypeArgument(left.copyInto(owner));
result.addTypeArgument(right.copyInto(owner));
if (mapExpectation != null && !expectation.isAssignableFrom(result)) {
// expectation does not match the computed type, but looks good according to the element types:
// use expected type
if (matchesExpectation(left, mapExpectation.getTypeArguments().get(0)) && matchesExpectation(right, mapExpectation.getTypeArguments().get(1))) {
return expectation;
}
}
return result;
} | java | protected LightweightTypeReference createMapTypeReference(JvmGenericType mapType, LightweightTypeReference pairType, LightweightTypeReference expectation, ITypeReferenceOwner owner) {
List<LightweightTypeReference> leftAndRight = pairType.getTypeArguments();
LightweightTypeReference left = leftAndRight.get(0).getInvariantBoundSubstitute();
LightweightTypeReference right = leftAndRight.get(1).getInvariantBoundSubstitute();
LightweightTypeReference mapExpectation = getMapExpectation(expectation);
if (mapExpectation != null) {
List<LightweightTypeReference> typeArguments = expectation.getTypeArguments();
left = doNormalizeElementType(left, typeArguments.get(0));
right = doNormalizeElementType(right, typeArguments.get(1));
}
ParameterizedTypeReference result = owner.newParameterizedTypeReference(mapType);
result.addTypeArgument(left.copyInto(owner));
result.addTypeArgument(right.copyInto(owner));
if (mapExpectation != null && !expectation.isAssignableFrom(result)) {
// expectation does not match the computed type, but looks good according to the element types:
// use expected type
if (matchesExpectation(left, mapExpectation.getTypeArguments().get(0)) && matchesExpectation(right, mapExpectation.getTypeArguments().get(1))) {
return expectation;
}
}
return result;
} | [
"protected",
"LightweightTypeReference",
"createMapTypeReference",
"(",
"JvmGenericType",
"mapType",
",",
"LightweightTypeReference",
"pairType",
",",
"LightweightTypeReference",
"expectation",
",",
"ITypeReferenceOwner",
"owner",
")",
"{",
"List",
"<",
"LightweightTypeReferenc... | Creates a map type reference that comes as close as possible / necessary to its expected type. | [
"Creates",
"a",
"map",
"type",
"reference",
"that",
"comes",
"as",
"close",
"as",
"possible",
"/",
"necessary",
"to",
"its",
"expected",
"type",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java#L261-L284 |
buschmais/jqa-core-framework | report/src/main/java/com/buschmais/jqassistant/core/report/impl/XmlReportPlugin.java | XmlReportPlugin.writeColumn | private void writeColumn(String columnName, Object value) throws XMLStreamException {
xmlStreamWriter.writeStartElement("column");
xmlStreamWriter.writeAttribute("name", columnName);
String stringValue = null;
if (value instanceof CompositeObject) {
CompositeObject descriptor = (CompositeObject) value;
LanguageElement elementValue = LanguageHelper.getLanguageElement(descriptor);
if (elementValue != null) {
xmlStreamWriter.writeStartElement("element");
xmlStreamWriter.writeAttribute("language", elementValue.getLanguage());
xmlStreamWriter.writeCharacters(elementValue.name());
xmlStreamWriter.writeEndElement(); // element
SourceProvider sourceProvider = elementValue.getSourceProvider();
stringValue = sourceProvider.getName(descriptor);
String sourceFile = sourceProvider.getSourceFile(descriptor);
Integer lineNumber = sourceProvider.getLineNumber(descriptor);
if (sourceFile != null) {
xmlStreamWriter.writeStartElement("source");
xmlStreamWriter.writeAttribute("name", sourceFile);
if (lineNumber != null) {
xmlStreamWriter.writeAttribute("line", lineNumber.toString());
}
xmlStreamWriter.writeEndElement(); // sourceFile
}
}
} else if (value != null) {
stringValue = ReportHelper.getLabel(value);
}
xmlStreamWriter.writeStartElement("value");
xmlStreamWriter.writeCharacters(stringValue);
xmlStreamWriter.writeEndElement(); // value
xmlStreamWriter.writeEndElement(); // column
} | java | private void writeColumn(String columnName, Object value) throws XMLStreamException {
xmlStreamWriter.writeStartElement("column");
xmlStreamWriter.writeAttribute("name", columnName);
String stringValue = null;
if (value instanceof CompositeObject) {
CompositeObject descriptor = (CompositeObject) value;
LanguageElement elementValue = LanguageHelper.getLanguageElement(descriptor);
if (elementValue != null) {
xmlStreamWriter.writeStartElement("element");
xmlStreamWriter.writeAttribute("language", elementValue.getLanguage());
xmlStreamWriter.writeCharacters(elementValue.name());
xmlStreamWriter.writeEndElement(); // element
SourceProvider sourceProvider = elementValue.getSourceProvider();
stringValue = sourceProvider.getName(descriptor);
String sourceFile = sourceProvider.getSourceFile(descriptor);
Integer lineNumber = sourceProvider.getLineNumber(descriptor);
if (sourceFile != null) {
xmlStreamWriter.writeStartElement("source");
xmlStreamWriter.writeAttribute("name", sourceFile);
if (lineNumber != null) {
xmlStreamWriter.writeAttribute("line", lineNumber.toString());
}
xmlStreamWriter.writeEndElement(); // sourceFile
}
}
} else if (value != null) {
stringValue = ReportHelper.getLabel(value);
}
xmlStreamWriter.writeStartElement("value");
xmlStreamWriter.writeCharacters(stringValue);
xmlStreamWriter.writeEndElement(); // value
xmlStreamWriter.writeEndElement(); // column
} | [
"private",
"void",
"writeColumn",
"(",
"String",
"columnName",
",",
"Object",
"value",
")",
"throws",
"XMLStreamException",
"{",
"xmlStreamWriter",
".",
"writeStartElement",
"(",
"\"column\"",
")",
";",
"xmlStreamWriter",
".",
"writeAttribute",
"(",
"\"name\"",
",",... | Determines the language and language element of a descriptor from a result
column.
@param columnName
The name of the column.
@param value
The value.
@throws XMLStreamException
If a problem occurs. | [
"Determines",
"the",
"language",
"and",
"language",
"element",
"of",
"a",
"descriptor",
"from",
"a",
"result",
"column",
"."
] | train | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/report/src/main/java/com/buschmais/jqassistant/core/report/impl/XmlReportPlugin.java#L243-L275 |
WolfgangFahl/Mediawiki-Japi | src/main/java/com/bitplan/mediawiki/japi/user/WikiUser.java | WikiUser.getPropertyFile | public static File getPropertyFile(String wikiId, String user) {
String userPropertiesFileName = System.getProperty("user.home")
+ "/.mediawiki-japi/" + user + "_" + wikiId + ".ini";
File propFile = new File(userPropertiesFileName);
return propFile;
} | java | public static File getPropertyFile(String wikiId, String user) {
String userPropertiesFileName = System.getProperty("user.home")
+ "/.mediawiki-japi/" + user + "_" + wikiId + ".ini";
File propFile = new File(userPropertiesFileName);
return propFile;
} | [
"public",
"static",
"File",
"getPropertyFile",
"(",
"String",
"wikiId",
",",
"String",
"user",
")",
"{",
"String",
"userPropertiesFileName",
"=",
"System",
".",
"getProperty",
"(",
"\"user.home\"",
")",
"+",
"\"/.mediawiki-japi/\"",
"+",
"user",
"+",
"\"_\"",
"+... | get the property file for the given wikiId and user
@param wikiId - the wiki to get the data for
@param user - the user
@return the property File | [
"get",
"the",
"property",
"file",
"for",
"the",
"given",
"wikiId",
"and",
"user"
] | train | https://github.com/WolfgangFahl/Mediawiki-Japi/blob/78d0177ebfe02eb05da5550839727861f1e888a5/src/main/java/com/bitplan/mediawiki/japi/user/WikiUser.java#L92-L97 |
alkacon/opencms-core | src/org/opencms/acacia/shared/CmsEntity.java | CmsEntity.insertAttributeValue | public void insertAttributeValue(String attributeName, String value, int index) {
if (m_simpleAttributes.containsKey(attributeName)) {
m_simpleAttributes.get(attributeName).add(index, value);
} else {
setAttributeValue(attributeName, value);
}
fireChange();
} | java | public void insertAttributeValue(String attributeName, String value, int index) {
if (m_simpleAttributes.containsKey(attributeName)) {
m_simpleAttributes.get(attributeName).add(index, value);
} else {
setAttributeValue(attributeName, value);
}
fireChange();
} | [
"public",
"void",
"insertAttributeValue",
"(",
"String",
"attributeName",
",",
"String",
"value",
",",
"int",
"index",
")",
"{",
"if",
"(",
"m_simpleAttributes",
".",
"containsKey",
"(",
"attributeName",
")",
")",
"{",
"m_simpleAttributes",
".",
"get",
"(",
"a... | Inserts a new attribute value at the given index.<p>
@param attributeName the attribute name
@param value the attribute value
@param index the value index | [
"Inserts",
"a",
"new",
"attribute",
"value",
"at",
"the",
"given",
"index",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/CmsEntity.java#L509-L517 |
spring-projects/spring-credhub | spring-credhub-core/src/main/java/org/springframework/credhub/configuration/CredHubTemplateFactory.java | CredHubTemplateFactory.credHubTemplate | public CredHubTemplate credHubTemplate(CredHubProperties credHubProperties,
ClientOptions clientOptions,
ClientRegistrationRepository clientRegistrationRepository,
OAuth2AuthorizedClientService authorizedClientService) {
return new CredHubTemplate(credHubProperties, clientHttpRequestFactory(clientOptions),
clientRegistrationRepository, authorizedClientService);
} | java | public CredHubTemplate credHubTemplate(CredHubProperties credHubProperties,
ClientOptions clientOptions,
ClientRegistrationRepository clientRegistrationRepository,
OAuth2AuthorizedClientService authorizedClientService) {
return new CredHubTemplate(credHubProperties, clientHttpRequestFactory(clientOptions),
clientRegistrationRepository, authorizedClientService);
} | [
"public",
"CredHubTemplate",
"credHubTemplate",
"(",
"CredHubProperties",
"credHubProperties",
",",
"ClientOptions",
"clientOptions",
",",
"ClientRegistrationRepository",
"clientRegistrationRepository",
",",
"OAuth2AuthorizedClientService",
"authorizedClientService",
")",
"{",
"ret... | Create a {@link CredHubTemplate} for interaction with a CredHub server
using OAuth2 for authentication.
@param credHubProperties connection properties
@param clientOptions connection options
@param clientRegistrationRepository a repository of OAuth2 client registrations
@param authorizedClientService a repository of authorized OAuth2 clients
@return a {@code CredHubTemplate} | [
"Create",
"a",
"{",
"@link",
"CredHubTemplate",
"}",
"for",
"interaction",
"with",
"a",
"CredHub",
"server",
"using",
"OAuth2",
"for",
"authentication",
"."
] | train | https://github.com/spring-projects/spring-credhub/blob/4d82cfa60d6c04e707ff32d78bc5d80cff4e132e/spring-credhub-core/src/main/java/org/springframework/credhub/configuration/CredHubTemplateFactory.java#L61-L67 |
apache/groovy | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.executeInsert | public List<List<Object>> executeInsert(String sql, Object[] params) throws SQLException {
return executeInsert(sql, Arrays.asList(params));
} | java | public List<List<Object>> executeInsert(String sql, Object[] params) throws SQLException {
return executeInsert(sql, Arrays.asList(params));
} | [
"public",
"List",
"<",
"List",
"<",
"Object",
">",
">",
"executeInsert",
"(",
"String",
"sql",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"SQLException",
"{",
"return",
"executeInsert",
"(",
"sql",
",",
"Arrays",
".",
"asList",
"(",
"params",
")",... | Executes the given SQL statement (typically an INSERT statement).
<p>
An Object array variant of {@link #executeInsert(String, List)}.
<p>
This method supports named and named ordinal parameters by supplying such
parameters in the <code>params</code> array. See the class Javadoc for more details.
@param sql The SQL statement to execute
@param params The parameter values that will be substituted
into the SQL statement's parameter slots
@return A list of the auto-generated column values for each
inserted row (typically auto-generated keys)
@throws SQLException if a database access error occurs | [
"Executes",
"the",
"given",
"SQL",
"statement",
"(",
"typically",
"an",
"INSERT",
"statement",
")",
".",
"<p",
">",
"An",
"Object",
"array",
"variant",
"of",
"{",
"@link",
"#executeInsert",
"(",
"String",
"List",
")",
"}",
".",
"<p",
">",
"This",
"method... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L2755-L2757 |
mozilla/rhino | src/org/mozilla/javascript/ScriptableObject.java | ScriptableObject.put | @Override
public void put(int index, Scriptable start, Object value)
{
if (externalData != null) {
if (index < externalData.getArrayLength()) {
externalData.setArrayElement(index, value);
} else {
throw new JavaScriptException(
ScriptRuntime.newNativeError(Context.getCurrentContext(), this,
TopLevel.NativeErrors.RangeError,
new Object[] { "External array index out of bounds " }),
null, 0);
}
return;
}
if (putImpl(null, index, start, value))
return;
if (start == this) throw Kit.codeBug();
start.put(index, start, value);
} | java | @Override
public void put(int index, Scriptable start, Object value)
{
if (externalData != null) {
if (index < externalData.getArrayLength()) {
externalData.setArrayElement(index, value);
} else {
throw new JavaScriptException(
ScriptRuntime.newNativeError(Context.getCurrentContext(), this,
TopLevel.NativeErrors.RangeError,
new Object[] { "External array index out of bounds " }),
null, 0);
}
return;
}
if (putImpl(null, index, start, value))
return;
if (start == this) throw Kit.codeBug();
start.put(index, start, value);
} | [
"@",
"Override",
"public",
"void",
"put",
"(",
"int",
"index",
",",
"Scriptable",
"start",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"externalData",
"!=",
"null",
")",
"{",
"if",
"(",
"index",
"<",
"externalData",
".",
"getArrayLength",
"(",
")",
")... | Sets the value of the indexed property, creating it if need be.
@param index the numeric index for the property
@param start the object whose property is being set
@param value value to set the property to | [
"Sets",
"the",
"value",
"of",
"the",
"indexed",
"property",
"creating",
"it",
"if",
"need",
"be",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L535-L556 |
powermock/powermock | powermock-core/src/main/java/org/powermock/core/ClassReplicaCreator.java | ClassReplicaCreator.addDelegatorField | private <T> void addDelegatorField(T delegator, final CtClass replicaClass) throws CannotCompileException {
CtField f = CtField.make(String.format("private %s %s = null;", delegator.getClass().getName(),
POWERMOCK_INSTANCE_DELEGATOR_FIELD_NAME), replicaClass);
replicaClass.addField(f);
} | java | private <T> void addDelegatorField(T delegator, final CtClass replicaClass) throws CannotCompileException {
CtField f = CtField.make(String.format("private %s %s = null;", delegator.getClass().getName(),
POWERMOCK_INSTANCE_DELEGATOR_FIELD_NAME), replicaClass);
replicaClass.addField(f);
} | [
"private",
"<",
"T",
">",
"void",
"addDelegatorField",
"(",
"T",
"delegator",
",",
"final",
"CtClass",
"replicaClass",
")",
"throws",
"CannotCompileException",
"{",
"CtField",
"f",
"=",
"CtField",
".",
"make",
"(",
"String",
".",
"format",
"(",
"\"private %s %... | Add a field to the replica class that holds the instance delegator. I.e.
if we're creating a instance replica of {@code java.lang.Long} this
methods adds a new field of type {@code delegator.getClass()} to the
replica class. | [
"Add",
"a",
"field",
"to",
"the",
"replica",
"class",
"that",
"holds",
"the",
"instance",
"delegator",
".",
"I",
".",
"e",
".",
"if",
"we",
"re",
"creating",
"a",
"instance",
"replica",
"of",
"{"
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-core/src/main/java/org/powermock/core/ClassReplicaCreator.java#L120-L124 |
webmetrics/browsermob-proxy | src/main/java/cz/mallat/uasparser/UASparser.java | UASparser.processOsRegex | private void processOsRegex(String useragent, UserAgentInfo retObj) {
try {
lock.lock();
for (Map.Entry<Pattern, Long> entry : osRegMap.entrySet()) {
Matcher matcher = entry.getKey().matcher(useragent);
if (matcher.find()) {
// simply copy the OS data into the result object
Long idOs = entry.getValue();
OsEntry os = osMap.get(idOs);
if (os != null) {
os.copyTo(retObj);
}
break;
}
}
} finally {
lock.unlock();
}
} | java | private void processOsRegex(String useragent, UserAgentInfo retObj) {
try {
lock.lock();
for (Map.Entry<Pattern, Long> entry : osRegMap.entrySet()) {
Matcher matcher = entry.getKey().matcher(useragent);
if (matcher.find()) {
// simply copy the OS data into the result object
Long idOs = entry.getValue();
OsEntry os = osMap.get(idOs);
if (os != null) {
os.copyTo(retObj);
}
break;
}
}
} finally {
lock.unlock();
}
} | [
"private",
"void",
"processOsRegex",
"(",
"String",
"useragent",
",",
"UserAgentInfo",
"retObj",
")",
"{",
"try",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Pattern",
",",
"Long",
">",
"entry",
":",
"osRegMap",
".",... | Searches in the os regex table. if found a match copies the os data
@param useragent
@param retObj | [
"Searches",
"in",
"the",
"os",
"regex",
"table",
".",
"if",
"found",
"a",
"match",
"copies",
"the",
"os",
"data"
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/cz/mallat/uasparser/UASparser.java#L107-L126 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java | CmsSitemapController.isValidEntryAndPath | private boolean isValidEntryAndPath(CmsClientSitemapEntry entry, String toPath) {
return ((toPath != null)
&& (CmsResource.getParentFolder(toPath) != null)
&& (entry != null)
&& (getEntry(CmsResource.getParentFolder(toPath)) != null)
&& (getEntry(entry.getSitePath()) != null));
} | java | private boolean isValidEntryAndPath(CmsClientSitemapEntry entry, String toPath) {
return ((toPath != null)
&& (CmsResource.getParentFolder(toPath) != null)
&& (entry != null)
&& (getEntry(CmsResource.getParentFolder(toPath)) != null)
&& (getEntry(entry.getSitePath()) != null));
} | [
"private",
"boolean",
"isValidEntryAndPath",
"(",
"CmsClientSitemapEntry",
"entry",
",",
"String",
"toPath",
")",
"{",
"return",
"(",
"(",
"toPath",
"!=",
"null",
")",
"&&",
"(",
"CmsResource",
".",
"getParentFolder",
"(",
"toPath",
")",
"!=",
"null",
")",
"... | Validates the entry and the given path.<p>
@param entry the entry
@param toPath the path
@return <code>true</code> if entry and path are valid | [
"Validates",
"the",
"entry",
"and",
"the",
"given",
"path",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L2374-L2381 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColor.java | CmsColor.RGBtoHSV | private void RGBtoHSV(float red, float green, float blue) {
float min = 0;
float max = 0;
float delta = 0;
min = MIN(red, green, blue);
max = MAX(red, green, blue);
m_bri = max; // v
delta = max - min;
if (max != 0) {
m_sat = delta / max; // s
} else {
m_sat = 0;
m_hue = 0;
return;
}
if (delta == 0) {
m_hue = 0;
return;
}
if (red == max) {
m_hue = (green - blue) / delta;
} else if (green == max) {
m_hue = 2 + ((blue - red) / delta);
} else {
m_hue = 4 + ((red - green) / delta);
}
m_hue *= 60;
if (m_hue < 0) {
m_hue += 360;
}
} | java | private void RGBtoHSV(float red, float green, float blue) {
float min = 0;
float max = 0;
float delta = 0;
min = MIN(red, green, blue);
max = MAX(red, green, blue);
m_bri = max; // v
delta = max - min;
if (max != 0) {
m_sat = delta / max; // s
} else {
m_sat = 0;
m_hue = 0;
return;
}
if (delta == 0) {
m_hue = 0;
return;
}
if (red == max) {
m_hue = (green - blue) / delta;
} else if (green == max) {
m_hue = 2 + ((blue - red) / delta);
} else {
m_hue = 4 + ((red - green) / delta);
}
m_hue *= 60;
if (m_hue < 0) {
m_hue += 360;
}
} | [
"private",
"void",
"RGBtoHSV",
"(",
"float",
"red",
",",
"float",
"green",
",",
"float",
"blue",
")",
"{",
"float",
"min",
"=",
"0",
";",
"float",
"max",
"=",
"0",
";",
"float",
"delta",
"=",
"0",
";",
"min",
"=",
"MIN",
"(",
"red",
",",
"green",... | Converts the RGB into the HSV.<p>
@param red value
@param green value
@param blue value | [
"Converts",
"the",
"RGB",
"into",
"the",
"HSV",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColor.java#L302-L341 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/StatementUtil.java | StatementUtil.fillParams | public static PreparedStatement fillParams(PreparedStatement ps, Collection<Object> params) throws SQLException {
return fillParams(ps, params.toArray(new Object[params.size()]));
} | java | public static PreparedStatement fillParams(PreparedStatement ps, Collection<Object> params) throws SQLException {
return fillParams(ps, params.toArray(new Object[params.size()]));
} | [
"public",
"static",
"PreparedStatement",
"fillParams",
"(",
"PreparedStatement",
"ps",
",",
"Collection",
"<",
"Object",
">",
"params",
")",
"throws",
"SQLException",
"{",
"return",
"fillParams",
"(",
"ps",
",",
"params",
".",
"toArray",
"(",
"new",
"Object",
... | 填充SQL的参数。
@param ps PreparedStatement
@param params SQL参数
@return {@link PreparedStatement}
@throws SQLException SQL执行异常 | [
"填充SQL的参数。"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/StatementUtil.java#L40-L42 |
facebook/fresco | fbcore/src/main/java/com/facebook/common/file/FileTree.java | FileTree.walkFileTree | public static void walkFileTree(File directory, FileTreeVisitor visitor) {
visitor.preVisitDirectory(directory);
File[] files = directory.listFiles();
if (files != null) {
for (File file: files) {
if (file.isDirectory()) {
walkFileTree(file, visitor);
} else {
visitor.visitFile(file);
}
}
}
visitor.postVisitDirectory(directory);
} | java | public static void walkFileTree(File directory, FileTreeVisitor visitor) {
visitor.preVisitDirectory(directory);
File[] files = directory.listFiles();
if (files != null) {
for (File file: files) {
if (file.isDirectory()) {
walkFileTree(file, visitor);
} else {
visitor.visitFile(file);
}
}
}
visitor.postVisitDirectory(directory);
} | [
"public",
"static",
"void",
"walkFileTree",
"(",
"File",
"directory",
",",
"FileTreeVisitor",
"visitor",
")",
"{",
"visitor",
".",
"preVisitDirectory",
"(",
"directory",
")",
";",
"File",
"[",
"]",
"files",
"=",
"directory",
".",
"listFiles",
"(",
")",
";",
... | Iterates over the file tree of a directory. It receives a visitor and will call its methods
for each file in the directory.
preVisitDirectory (directory)
visitFile (file)
- recursively the same for every subdirectory
postVisitDirectory (directory)
@param directory the directory to iterate
@param visitor the visitor that will be invoked for each directory/file in the tree | [
"Iterates",
"over",
"the",
"file",
"tree",
"of",
"a",
"directory",
".",
"It",
"receives",
"a",
"visitor",
"and",
"will",
"call",
"its",
"methods",
"for",
"each",
"file",
"in",
"the",
"directory",
".",
"preVisitDirectory",
"(",
"directory",
")",
"visitFile",
... | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/file/FileTree.java#L30-L43 |
apache/reef | lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/process/ReefRunnableProcessObserver.java | ReefRunnableProcessObserver.onUncleanExit | private void onUncleanExit(final String processId, final int exitCode) {
this.onResourceStatus(
ResourceStatusEventImpl.newBuilder()
.setIdentifier(processId)
.setState(State.FAILED)
.setExitCode(exitCode)
.build()
);
} | java | private void onUncleanExit(final String processId, final int exitCode) {
this.onResourceStatus(
ResourceStatusEventImpl.newBuilder()
.setIdentifier(processId)
.setState(State.FAILED)
.setExitCode(exitCode)
.build()
);
} | [
"private",
"void",
"onUncleanExit",
"(",
"final",
"String",
"processId",
",",
"final",
"int",
"exitCode",
")",
"{",
"this",
".",
"onResourceStatus",
"(",
"ResourceStatusEventImpl",
".",
"newBuilder",
"(",
")",
".",
"setIdentifier",
"(",
"processId",
")",
".",
... | Inform REEF of an unclean process exit.
@param processId
@param exitCode | [
"Inform",
"REEF",
"of",
"an",
"unclean",
"process",
"exit",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/process/ReefRunnableProcessObserver.java#L102-L110 |
HanSolo/tilesfx | src/main/java/eu/hansolo/tilesfx/tools/SunMoonCalculator.java | SunMoonCalculator.getDateAsString | public static String getDateAsString(final double JULIAN_DAY, final int TIMEZONE_OFFSET) throws Exception {
if (JULIAN_DAY == -1) return "NO RISE/SET/TRANSIT FOR THIS OBSERVER/DATE";
int date[] = SunMoonCalculator.getDate(JULIAN_DAY);
return date[0] + "/" + date[1] + "/" + date[2] + " " + ((date[3] + TIMEZONE_OFFSET) % 24) + ":" + date[4] + ":" + date[5] + " UT";
} | java | public static String getDateAsString(final double JULIAN_DAY, final int TIMEZONE_OFFSET) throws Exception {
if (JULIAN_DAY == -1) return "NO RISE/SET/TRANSIT FOR THIS OBSERVER/DATE";
int date[] = SunMoonCalculator.getDate(JULIAN_DAY);
return date[0] + "/" + date[1] + "/" + date[2] + " " + ((date[3] + TIMEZONE_OFFSET) % 24) + ":" + date[4] + ":" + date[5] + " UT";
} | [
"public",
"static",
"String",
"getDateAsString",
"(",
"final",
"double",
"JULIAN_DAY",
",",
"final",
"int",
"TIMEZONE_OFFSET",
")",
"throws",
"Exception",
"{",
"if",
"(",
"JULIAN_DAY",
"==",
"-",
"1",
")",
"return",
"\"NO RISE/SET/TRANSIT FOR THIS OBSERVER/DATE\"",
... | Returns a date as a string.
@param JULIAN_DAY The Juliand day.
@return The String.
@throws Exception If the date does not exists. | [
"Returns",
"a",
"date",
"as",
"a",
"string",
"."
] | train | https://github.com/HanSolo/tilesfx/blob/36eb07b1119017beb851dad95256439224d1fcf4/src/main/java/eu/hansolo/tilesfx/tools/SunMoonCalculator.java#L215-L220 |
davetcc/tcMenu | tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java | MenuTree.moveItem | public void moveItem(SubMenuItem parent, MenuItem newItem, MoveType moveType) {
synchronized (subMenuItems) {
ArrayList<MenuItem> items = subMenuItems.get(parent);
int idx = items.indexOf(newItem);
if(idx < 0) return;
items.remove(idx);
idx = (moveType == MoveType.MOVE_UP)? --idx : ++idx;
if(idx<0) idx=0;
if(idx>=items.size()) {
items.add(newItem);
}
else {
items.add(idx, newItem);
}
}
} | java | public void moveItem(SubMenuItem parent, MenuItem newItem, MoveType moveType) {
synchronized (subMenuItems) {
ArrayList<MenuItem> items = subMenuItems.get(parent);
int idx = items.indexOf(newItem);
if(idx < 0) return;
items.remove(idx);
idx = (moveType == MoveType.MOVE_UP)? --idx : ++idx;
if(idx<0) idx=0;
if(idx>=items.size()) {
items.add(newItem);
}
else {
items.add(idx, newItem);
}
}
} | [
"public",
"void",
"moveItem",
"(",
"SubMenuItem",
"parent",
",",
"MenuItem",
"newItem",
",",
"MoveType",
"moveType",
")",
"{",
"synchronized",
"(",
"subMenuItems",
")",
"{",
"ArrayList",
"<",
"MenuItem",
">",
"items",
"=",
"subMenuItems",
".",
"get",
"(",
"p... | Moves the item either up or down in the list for that submenu
@param parent the parent id
@param newItem the item to move
@param moveType the direction of the move. | [
"Moves",
"the",
"item",
"either",
"up",
"or",
"down",
"in",
"the",
"list",
"for",
"that",
"submenu"
] | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L156-L174 |
williamwebb/alogger | BillingHelper/src/main/java/com/jug6ernaut/billing/IabHelper.java | IabHelper.consumeAsync | public void consumeAsync(Purchase purchase, OnConsumeFinishedListener listener) {
checkNotDisposed();
checkSetupDone("consume");
List<Purchase> purchases = new ArrayList<Purchase>();
purchases.add(purchase);
consumeAsyncInternal(purchases, listener, null);
} | java | public void consumeAsync(Purchase purchase, OnConsumeFinishedListener listener) {
checkNotDisposed();
checkSetupDone("consume");
List<Purchase> purchases = new ArrayList<Purchase>();
purchases.add(purchase);
consumeAsyncInternal(purchases, listener, null);
} | [
"public",
"void",
"consumeAsync",
"(",
"Purchase",
"purchase",
",",
"OnConsumeFinishedListener",
"listener",
")",
"{",
"checkNotDisposed",
"(",
")",
";",
"checkSetupDone",
"(",
"\"consume\"",
")",
";",
"List",
"<",
"Purchase",
">",
"purchases",
"=",
"new",
"Arra... | Asynchronous wrapper to item consumption. Works like {@link #consume}, but
performs the consumption in the background and notifies completion through
the provided listener. This method is safe to call from a UI thread.
@param purchase The purchase to be consumed.
@param listener The listener to notify when the consumption operation finishes. | [
"Asynchronous",
"wrapper",
"to",
"item",
"consumption",
".",
"Works",
"like",
"{",
"@link",
"#consume",
"}",
"but",
"performs",
"the",
"consumption",
"in",
"the",
"background",
"and",
"notifies",
"completion",
"through",
"the",
"provided",
"listener",
".",
"This... | train | https://github.com/williamwebb/alogger/blob/61fca49e0b8d9c3a76c40da8883ac354b240351e/BillingHelper/src/main/java/com/jug6ernaut/billing/IabHelper.java#L734-L740 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java | GVRPose.setPosition | public boolean setPosition(float x, float y, float z)
{
Bone bone = mBones[0];
float dx = x - bone.WorldMatrix.m30();
float dy = y - bone.WorldMatrix.m31();
float dz = z - bone.WorldMatrix.m32();
sync();
bone.LocalMatrix.setTranslation(x, y, z);
for (int i = 0; i < mBones.length; ++i)
{
bone = mBones[i];
bone.WorldMatrix.m30(bone.WorldMatrix.m30() + dx);
bone.WorldMatrix.m31(bone.WorldMatrix.m31() + dy);
bone.WorldMatrix.m32(bone.WorldMatrix.m32() + dz);
}
if (sDebug)
{
Log.d("BONE", "setWorldPosition: %s ", mSkeleton.getBoneName(0), bone.toString());
}
return true;
} | java | public boolean setPosition(float x, float y, float z)
{
Bone bone = mBones[0];
float dx = x - bone.WorldMatrix.m30();
float dy = y - bone.WorldMatrix.m31();
float dz = z - bone.WorldMatrix.m32();
sync();
bone.LocalMatrix.setTranslation(x, y, z);
for (int i = 0; i < mBones.length; ++i)
{
bone = mBones[i];
bone.WorldMatrix.m30(bone.WorldMatrix.m30() + dx);
bone.WorldMatrix.m31(bone.WorldMatrix.m31() + dy);
bone.WorldMatrix.m32(bone.WorldMatrix.m32() + dz);
}
if (sDebug)
{
Log.d("BONE", "setWorldPosition: %s ", mSkeleton.getBoneName(0), bone.toString());
}
return true;
} | [
"public",
"boolean",
"setPosition",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"Bone",
"bone",
"=",
"mBones",
"[",
"0",
"]",
";",
"float",
"dx",
"=",
"x",
"-",
"bone",
".",
"WorldMatrix",
".",
"m30",
"(",
")",
";",
"float"... | Sets the world position of a root bone and propagates to all children.
<p>
This has the effect of moving the overall skeleton to a new position
without affecting the orientation of it's bones.
@param x,y,z new world position of root bone.
@return true if world position set, false if bone is not a root bone.
@see #setWorldPositions
@see #getWorldPosition | [
"Sets",
"the",
"world",
"position",
"of",
"a",
"root",
"bone",
"and",
"propagates",
"to",
"all",
"children",
".",
"<p",
">",
"This",
"has",
"the",
"effect",
"of",
"moving",
"the",
"overall",
"skeleton",
"to",
"a",
"new",
"position",
"without",
"affecting",... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java#L841-L862 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.