repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java | TermOfUsePanel.newDisclaimerPanel | protected Component newDisclaimerPanel(final String id,
final IModel<HeaderContentListModelBean> model)
{
return new DisclaimerPanel(id, Model.of(model.getObject()));
} | java | protected Component newDisclaimerPanel(final String id,
final IModel<HeaderContentListModelBean> model)
{
return new DisclaimerPanel(id, Model.of(model.getObject()));
} | [
"protected",
"Component",
"newDisclaimerPanel",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"HeaderContentListModelBean",
">",
"model",
")",
"{",
"return",
"new",
"DisclaimerPanel",
"(",
"id",
",",
"Model",
".",
"of",
"(",
"model",
".",
"getObje... | Factory method for creating the new {@link Component} for the disclaimer. This method is
invoked in the constructor from the derived classes and can be overridden so users can
provide their own version of a new {@link Component} for the disclaimer.
@param id
the id
@param model
the model
@return the new {@link Component} for the disclaimer | [
"Factory",
"method",
"for",
"creating",
"the",
"new",
"{",
"@link",
"Component",
"}",
"for",
"the",
"disclaimer",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java#L242-L246 |
alkacon/opencms-core | src/org/opencms/util/CmsStringUtil.java | CmsStringUtil.trimToSize | public static String trimToSize(String source, int length, String suffix) {
int area = (length > 100) ? length / 2 : length;
return trimToSize(source, length, area, suffix);
} | java | public static String trimToSize(String source, int length, String suffix) {
int area = (length > 100) ? length / 2 : length;
return trimToSize(source, length, area, suffix);
} | [
"public",
"static",
"String",
"trimToSize",
"(",
"String",
"source",
",",
"int",
"length",
",",
"String",
"suffix",
")",
"{",
"int",
"area",
"=",
"(",
"length",
">",
"100",
")",
"?",
"length",
"/",
"2",
":",
"length",
";",
"return",
"trimToSize",
"(",
... | Returns a substring of the source, which is at most length characters long.<p>
If a char is cut, the given <code>suffix</code> is appended to the result.<p>
This is almost the same as calling {@link #trimToSize(String, int, int, String)} with the
parameters <code>(source, length, length*, suffix)</code>. If <code>length</code>
if larger then 100, then <code>length* = length / 2</code>,
otherwise <code>length* = length</code>.<p>
@param source the string to trim
@param length the maximum length of the string to be returned
@param suffix the suffix to append in case the String was trimmed
@return a substring of the source, which is at most length characters long | [
"Returns",
"a",
"substring",
"of",
"the",
"source",
"which",
"is",
"at",
"most",
"length",
"characters",
"long",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L2164-L2168 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableClusterUtilities.java | BigtableClusterUtilities.waitForOperation | public void waitForOperation(String operationName, int maxSeconds) throws InterruptedException {
long endTimeMillis = TimeUnit.SECONDS.toMillis(maxSeconds) + System.currentTimeMillis();
GetOperationRequest request = GetOperationRequest.newBuilder().setName(operationName).build();
do {
Thread.sleep(500);
Operation response = client.getOperation(request);
if (response.getDone()) {
switch (response.getResultCase()) {
case RESPONSE:
return;
case ERROR:
throw new RuntimeException("Cluster could not be resized: " + response.getError());
case RESULT_NOT_SET:
throw new IllegalStateException(
"System returned invalid response for Operation check: " + response);
}
}
} while (System.currentTimeMillis() < endTimeMillis);
throw new IllegalStateException(
String.format("Waited %d seconds and cluster was not resized yet.", maxSeconds));
} | java | public void waitForOperation(String operationName, int maxSeconds) throws InterruptedException {
long endTimeMillis = TimeUnit.SECONDS.toMillis(maxSeconds) + System.currentTimeMillis();
GetOperationRequest request = GetOperationRequest.newBuilder().setName(operationName).build();
do {
Thread.sleep(500);
Operation response = client.getOperation(request);
if (response.getDone()) {
switch (response.getResultCase()) {
case RESPONSE:
return;
case ERROR:
throw new RuntimeException("Cluster could not be resized: " + response.getError());
case RESULT_NOT_SET:
throw new IllegalStateException(
"System returned invalid response for Operation check: " + response);
}
}
} while (System.currentTimeMillis() < endTimeMillis);
throw new IllegalStateException(
String.format("Waited %d seconds and cluster was not resized yet.", maxSeconds));
} | [
"public",
"void",
"waitForOperation",
"(",
"String",
"operationName",
",",
"int",
"maxSeconds",
")",
"throws",
"InterruptedException",
"{",
"long",
"endTimeMillis",
"=",
"TimeUnit",
".",
"SECONDS",
".",
"toMillis",
"(",
"maxSeconds",
")",
"+",
"System",
".",
"cu... | Waits for an operation like cluster resizing to complete.
@param operationName The fully qualified name of the operation
@param maxSeconds The maximum amount of seconds to wait for the operation to complete.
@throws InterruptedException if a user interrupts the process, usually with a ^C. | [
"Waits",
"for",
"an",
"operation",
"like",
"cluster",
"resizing",
"to",
"complete",
"."
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableClusterUtilities.java#L251-L273 |
mapsforge/mapsforge | mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java | MercatorProjection.metersToPixelsWithScaleFactor | public static double metersToPixelsWithScaleFactor(float meters, double latitude, double scaleFactor, int tileSize) {
return meters / MercatorProjection.calculateGroundResolutionWithScaleFactor(latitude, scaleFactor, tileSize);
} | java | public static double metersToPixelsWithScaleFactor(float meters, double latitude, double scaleFactor, int tileSize) {
return meters / MercatorProjection.calculateGroundResolutionWithScaleFactor(latitude, scaleFactor, tileSize);
} | [
"public",
"static",
"double",
"metersToPixelsWithScaleFactor",
"(",
"float",
"meters",
",",
"double",
"latitude",
",",
"double",
"scaleFactor",
",",
"int",
"tileSize",
")",
"{",
"return",
"meters",
"/",
"MercatorProjection",
".",
"calculateGroundResolutionWithScaleFacto... | Converts meters to pixels at latitude for zoom-level.
@param meters the meters to convert
@param latitude the latitude for the conversion.
@param scaleFactor the scale factor for the conversion.
@return pixels that represent the meters at the given zoom-level and latitude. | [
"Converts",
"meters",
"to",
"pixels",
"at",
"latitude",
"for",
"zoom",
"-",
"level",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L312-L314 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.copyNameAnnotations | static void copyNameAnnotations(Node source, Node destination) {
if (source.getBooleanProp(Node.IS_CONSTANT_NAME)) {
destination.putBooleanProp(Node.IS_CONSTANT_NAME, true);
}
} | java | static void copyNameAnnotations(Node source, Node destination) {
if (source.getBooleanProp(Node.IS_CONSTANT_NAME)) {
destination.putBooleanProp(Node.IS_CONSTANT_NAME, true);
}
} | [
"static",
"void",
"copyNameAnnotations",
"(",
"Node",
"source",
",",
"Node",
"destination",
")",
"{",
"if",
"(",
"source",
".",
"getBooleanProp",
"(",
"Node",
".",
"IS_CONSTANT_NAME",
")",
")",
"{",
"destination",
".",
"putBooleanProp",
"(",
"Node",
".",
"IS... | Copy any annotations that follow a named value.
@param source
@param destination | [
"Copy",
"any",
"annotations",
"that",
"follow",
"a",
"named",
"value",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L3927-L3931 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/stream/streamselector.java | streamselector.get | public static streamselector get(nitro_service service, String name) throws Exception{
streamselector obj = new streamselector();
obj.set_name(name);
streamselector response = (streamselector) obj.get_resource(service);
return response;
} | java | public static streamselector get(nitro_service service, String name) throws Exception{
streamselector obj = new streamselector();
obj.set_name(name);
streamselector response = (streamselector) obj.get_resource(service);
return response;
} | [
"public",
"static",
"streamselector",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"streamselector",
"obj",
"=",
"new",
"streamselector",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"stream... | Use this API to fetch streamselector resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"streamselector",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/stream/streamselector.java#L234-L239 |
johncarl81/transfuse | transfuse-support/src/main/java/org/androidtransfuse/adapter/classes/ASTClassFactory.java | ASTClassFactory.getMethod | public ASTMethod getMethod(Method method) {
ImmutableList<ASTParameter> astParameters = getParameters(method);
ASTAccessModifier modifier = ASTAccessModifier.getModifier(method.getModifiers());
ImmutableSet<ASTType> throwsTypes = getTypes(method.getExceptionTypes());
return new ASTClassMethod(method, getType(method.getReturnType(), method.getGenericReturnType()), astParameters, modifier, getAnnotations(method), throwsTypes);
} | java | public ASTMethod getMethod(Method method) {
ImmutableList<ASTParameter> astParameters = getParameters(method);
ASTAccessModifier modifier = ASTAccessModifier.getModifier(method.getModifiers());
ImmutableSet<ASTType> throwsTypes = getTypes(method.getExceptionTypes());
return new ASTClassMethod(method, getType(method.getReturnType(), method.getGenericReturnType()), astParameters, modifier, getAnnotations(method), throwsTypes);
} | [
"public",
"ASTMethod",
"getMethod",
"(",
"Method",
"method",
")",
"{",
"ImmutableList",
"<",
"ASTParameter",
">",
"astParameters",
"=",
"getParameters",
"(",
"method",
")",
";",
"ASTAccessModifier",
"modifier",
"=",
"ASTAccessModifier",
".",
"getModifier",
"(",
"m... | Builds an AST Method fromm the given input method.
@param method
@return AST Method | [
"Builds",
"an",
"AST",
"Method",
"fromm",
"the",
"given",
"input",
"method",
"."
] | train | https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/adapter/classes/ASTClassFactory.java#L211-L218 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/vpn/vpnvserver_stats.java | vpnvserver_stats.get | public static vpnvserver_stats get(nitro_service service, String name) throws Exception{
vpnvserver_stats obj = new vpnvserver_stats();
obj.set_name(name);
vpnvserver_stats response = (vpnvserver_stats) obj.stat_resource(service);
return response;
} | java | public static vpnvserver_stats get(nitro_service service, String name) throws Exception{
vpnvserver_stats obj = new vpnvserver_stats();
obj.set_name(name);
vpnvserver_stats response = (vpnvserver_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"vpnvserver_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"vpnvserver_stats",
"obj",
"=",
"new",
"vpnvserver_stats",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"... | Use this API to fetch statistics of vpnvserver_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"vpnvserver_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/vpn/vpnvserver_stats.java#L249-L254 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.listSasTokensAsync | public Observable<Page<SasTokenInfoInner>> listSasTokensAsync(final String resourceGroupName, final String accountName, final String storageAccountName, final String containerName) {
return listSasTokensWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName, containerName)
.map(new Func1<ServiceResponse<Page<SasTokenInfoInner>>, Page<SasTokenInfoInner>>() {
@Override
public Page<SasTokenInfoInner> call(ServiceResponse<Page<SasTokenInfoInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<SasTokenInfoInner>> listSasTokensAsync(final String resourceGroupName, final String accountName, final String storageAccountName, final String containerName) {
return listSasTokensWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName, containerName)
.map(new Func1<ServiceResponse<Page<SasTokenInfoInner>>, Page<SasTokenInfoInner>>() {
@Override
public Page<SasTokenInfoInner> call(ServiceResponse<Page<SasTokenInfoInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"SasTokenInfoInner",
">",
">",
"listSasTokensAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"accountName",
",",
"final",
"String",
"storageAccountName",
",",
"final",
"String",
"containerName",
... | Gets the SAS token associated with the specified Data Lake Analytics and Azure Storage account and container combination.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account.
@param accountName The name of the Data Lake Analytics account from which an Azure Storage account's SAS token is being requested.
@param storageAccountName The name of the Azure storage account for which the SAS token is being requested.
@param containerName The name of the Azure storage container for which the SAS token is being requested.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SasTokenInfoInner> object | [
"Gets",
"the",
"SAS",
"token",
"associated",
"with",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"and",
"Azure",
"Storage",
"account",
"and",
"container",
"combination",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L852-L860 |
legsem/legstar-core2 | legstar-base/src/main/java/com/legstar/base/type/primitive/CobolPrimitiveType.java | CobolPrimitiveType.isValid | public boolean isValid(CobolContext cobolContext, byte[] hostData, int start) {
return isValid(javaClass, cobolContext, hostData, start);
} | java | public boolean isValid(CobolContext cobolContext, byte[] hostData, int start) {
return isValid(javaClass, cobolContext, hostData, start);
} | [
"public",
"boolean",
"isValid",
"(",
"CobolContext",
"cobolContext",
",",
"byte",
"[",
"]",
"hostData",
",",
"int",
"start",
")",
"{",
"return",
"isValid",
"(",
"javaClass",
",",
"cobolContext",
",",
"hostData",
",",
"start",
")",
";",
"}"
] | Check if a byte array contains valid mainframe data for this type
characteristics.
@param cobolContext host COBOL configuration parameters
@param hostData the byte array containing mainframe data
@param start the start position for the expected type in the byte array
@return true if the byte array contains a valid type | [
"Check",
"if",
"a",
"byte",
"array",
"contains",
"valid",
"mainframe",
"data",
"for",
"this",
"type",
"characteristics",
"."
] | train | https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base/src/main/java/com/legstar/base/type/primitive/CobolPrimitiveType.java#L54-L56 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/ThriftUtils.java | ThriftUtils.createThreadedServer | public static TServer createThreadedServer(TProcessorFactory processorFactory,
TProtocolFactory protocolFactory, int port, int maxWorkerThreads,
int clientTimeoutMillisecs, int maxFrameSize) throws TTransportException {
if (maxWorkerThreads < 1) {
maxWorkerThreads = Math.max(2, Runtime.getRuntime().availableProcessors());
}
TServerTransport transport = new TServerSocket(port, clientTimeoutMillisecs);
TTransportFactory transportFactory = new TFramedTransport.Factory(maxFrameSize);
TThreadPoolServer.Args args = new TThreadPoolServer.Args(transport)
.processorFactory(processorFactory).protocolFactory(protocolFactory)
.transportFactory(transportFactory).minWorkerThreads(1)
.maxWorkerThreads(maxWorkerThreads);
TThreadPoolServer server = new TThreadPoolServer(args);
return server;
} | java | public static TServer createThreadedServer(TProcessorFactory processorFactory,
TProtocolFactory protocolFactory, int port, int maxWorkerThreads,
int clientTimeoutMillisecs, int maxFrameSize) throws TTransportException {
if (maxWorkerThreads < 1) {
maxWorkerThreads = Math.max(2, Runtime.getRuntime().availableProcessors());
}
TServerTransport transport = new TServerSocket(port, clientTimeoutMillisecs);
TTransportFactory transportFactory = new TFramedTransport.Factory(maxFrameSize);
TThreadPoolServer.Args args = new TThreadPoolServer.Args(transport)
.processorFactory(processorFactory).protocolFactory(protocolFactory)
.transportFactory(transportFactory).minWorkerThreads(1)
.maxWorkerThreads(maxWorkerThreads);
TThreadPoolServer server = new TThreadPoolServer(args);
return server;
} | [
"public",
"static",
"TServer",
"createThreadedServer",
"(",
"TProcessorFactory",
"processorFactory",
",",
"TProtocolFactory",
"protocolFactory",
",",
"int",
"port",
",",
"int",
"maxWorkerThreads",
",",
"int",
"clientTimeoutMillisecs",
",",
"int",
"maxFrameSize",
")",
"t... | Helper method to create a new framed-transport, threaded-{@link TServer}.
<p>
Note: if {@code maxWorkerThreads < 1}, the {@link TServer} is created
with {@code maxWorkerThreads} =
{@code Math.max(2, Runtime.getRuntime().availableProcessors())}
</p>
@param processorFactory
@param protocolFactory
@param port
@param maxWorkerThreads
@param clientTimeoutMillisecs
@param maxFrameSize
@return
@throws TTransportException | [
"Helper",
"method",
"to",
"create",
"a",
"new",
"framed",
"-",
"transport",
"threaded",
"-",
"{",
"@link",
"TServer",
"}",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/ThriftUtils.java#L101-L115 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/XmlHttpResponse.java | XmlHttpResponse.getRawXPath | public String getRawXPath(String xPathExpr, Object... params) {
return getRawXPath(getResponse(), xPathExpr, params);
} | java | public String getRawXPath(String xPathExpr, Object... params) {
return getRawXPath(getResponse(), xPathExpr, params);
} | [
"public",
"String",
"getRawXPath",
"(",
"String",
"xPathExpr",
",",
"Object",
"...",
"params",
")",
"{",
"return",
"getRawXPath",
"(",
"getResponse",
"(",
")",
",",
"xPathExpr",
",",
"params",
")",
";",
"}"
] | Gets XPath value without checking whether response is valid.
@param xPathExpr expression to apply to response.
@param params values to put inside expression before evaluation
@return result of xpath expression. | [
"Gets",
"XPath",
"value",
"without",
"checking",
"whether",
"response",
"is",
"valid",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/XmlHttpResponse.java#L63-L65 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/component/RoundedBorder.java | RoundedBorder.getInteriorRectangle | public static Rectangle getInteriorRectangle(Component c, Border b, int x, int y, int width, int height) {
final Insets insets;
if (b != null) {
insets = b.getBorderInsets(c);
} else {
insets = new Insets(0, 0, 0, 0);
}
return new Rectangle(x + insets.left, //
y + insets.top, //
width - insets.right - insets.left, //
height - insets.top - insets.bottom);
} | java | public static Rectangle getInteriorRectangle(Component c, Border b, int x, int y, int width, int height) {
final Insets insets;
if (b != null) {
insets = b.getBorderInsets(c);
} else {
insets = new Insets(0, 0, 0, 0);
}
return new Rectangle(x + insets.left, //
y + insets.top, //
width - insets.right - insets.left, //
height - insets.top - insets.bottom);
} | [
"public",
"static",
"Rectangle",
"getInteriorRectangle",
"(",
"Component",
"c",
",",
"Border",
"b",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"final",
"Insets",
"insets",
";",
"if",
"(",
"b",
"!=",
"null",
... | Gets the interior rectangle.
@param c
the target component.
@param b
the border.
@param x
the x coordinate.
@param y
the y coordinate.
@param width
the width.
@param height
the height.
@return the rectangle. | [
"Gets",
"the",
"interior",
"rectangle",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/RoundedBorder.java#L167-L180 |
jenkinsci/jenkins | core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java | HudsonPrivateSecurityRealm.doCreateFirstAccount | @RequirePOST
public void doCreateFirstAccount(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
if(hasSomeUser()) {
rsp.sendError(SC_UNAUTHORIZED,"First user was already created");
return;
}
User u = createAccount(req, rsp, false, "firstUser.jelly");
if (u!=null) {
tryToMakeAdmin(u);
loginAndTakeBack(req, rsp, u);
}
} | java | @RequirePOST
public void doCreateFirstAccount(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
if(hasSomeUser()) {
rsp.sendError(SC_UNAUTHORIZED,"First user was already created");
return;
}
User u = createAccount(req, rsp, false, "firstUser.jelly");
if (u!=null) {
tryToMakeAdmin(u);
loginAndTakeBack(req, rsp, u);
}
} | [
"@",
"RequirePOST",
"public",
"void",
"doCreateFirstAccount",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"if",
"(",
"hasSomeUser",
"(",
")",
")",
"{",
"rsp",
".",
"sendError",
"(",
"... | Creates a first admin user account.
<p>
This can be run by anyone, but only to create the very first user account. | [
"Creates",
"a",
"first",
"admin",
"user",
"account",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L348-L359 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java | ManagedDatabasesInner.beginCreateOrUpdateAsync | public Observable<ManagedDatabaseInner> beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1<ServiceResponse<ManagedDatabaseInner>, ManagedDatabaseInner>() {
@Override
public ManagedDatabaseInner call(ServiceResponse<ManagedDatabaseInner> response) {
return response.body();
}
});
} | java | public Observable<ManagedDatabaseInner> beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1<ServiceResponse<ManagedDatabaseInner>, ManagedDatabaseInner>() {
@Override
public ManagedDatabaseInner call(ServiceResponse<ManagedDatabaseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ManagedDatabaseInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
",",
"String",
"databaseName",
",",
"ManagedDatabaseInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdate... | Creates a new database or updates an existing database.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance.
@param databaseName The name of the database.
@param parameters The requested database resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ManagedDatabaseInner object | [
"Creates",
"a",
"new",
"database",
"or",
"updates",
"an",
"existing",
"database",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java#L628-L635 |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/core/internal/utils/PropertyUtils.java | PropertyUtils.getProperty | public static Object getProperty(Object bean, String field) {
INSTANCE.checkParameters(bean, field);
try {
return INSTANCE.getPropertyValue(bean, field);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
throw handleReflectionException(bean, field, e);
}
} | java | public static Object getProperty(Object bean, String field) {
INSTANCE.checkParameters(bean, field);
try {
return INSTANCE.getPropertyValue(bean, field);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
throw handleReflectionException(bean, field, e);
}
} | [
"public",
"static",
"Object",
"getProperty",
"(",
"Object",
"bean",
",",
"String",
"field",
")",
"{",
"INSTANCE",
".",
"checkParameters",
"(",
"bean",
",",
"field",
")",
";",
"try",
"{",
"return",
"INSTANCE",
".",
"getPropertyValue",
"(",
"bean",
",",
"fie... | Get bean's property value. The sequence of searches for getting a value is as follows:
<ol>
<li>All class fields are found using {@link ClassUtils#getClassFields(Class)}</li>
<li>Search for a field with the name of the desired one is made</li>
<li>If a field is found and it's a non-public field, the value is returned using the accompanying getter</li>
<li>If a field is found and it's a public field, the value is returned using the public field</li>
<li>If a field is not found, a search for a getter is made - all class getters are found using
{@link ClassUtils#getClassFields(Class)}</li>
<li>From class getters, an appropriate getter with name of the desired one is used</li>
</ol>
@param bean bean to be accessed
@param field bean's fieldName
@return bean's property value | [
"Get",
"bean",
"s",
"property",
"value",
".",
"The",
"sequence",
"of",
"searches",
"for",
"getting",
"a",
"value",
"is",
"as",
"follows",
":",
"<ol",
">",
"<li",
">",
"All",
"class",
"fields",
"are",
"found",
"using",
"{",
"@link",
"ClassUtils#getClassFiel... | train | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/utils/PropertyUtils.java#L45-L53 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/mock/MockRequest.java | MockRequest.addParameterForButton | public void addParameterForButton(final UIContext uic, final WButton button) {
UIContextHolder.pushContext(uic);
try {
setParameter(button.getId(), "x");
} finally {
UIContextHolder.popContext();
}
} | java | public void addParameterForButton(final UIContext uic, final WButton button) {
UIContextHolder.pushContext(uic);
try {
setParameter(button.getId(), "x");
} finally {
UIContextHolder.popContext();
}
} | [
"public",
"void",
"addParameterForButton",
"(",
"final",
"UIContext",
"uic",
",",
"final",
"WButton",
"button",
")",
"{",
"UIContextHolder",
".",
"pushContext",
"(",
"uic",
")",
";",
"try",
"{",
"setParameter",
"(",
"button",
".",
"getId",
"(",
")",
",",
"... | Convenience method that adds a parameter emulating a button press.
@param uic the current user's UIContext
@param button the button to add a parameter for. | [
"Convenience",
"method",
"that",
"adds",
"a",
"parameter",
"emulating",
"a",
"button",
"press",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/mock/MockRequest.java#L90-L97 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/chunkcollision/ChunkCollision.java | ChunkCollision.onGetCollisionBoxes | @SubscribeEvent
public void onGetCollisionBoxes(GetCollisionBoxesEvent event)
// public void getCollisionBoxes(World world, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity entity)
{
//no mask, no need to check for collision
if (event.getAabb() == null)
return;
for (Chunk chunk : ChunkBlockHandler.getAffectedChunks(event.getWorld(), event.getAabb()))
collisionRegistry.processCallbacks(chunk, event.getAabb(), event.getCollisionBoxesList());
} | java | @SubscribeEvent
public void onGetCollisionBoxes(GetCollisionBoxesEvent event)
// public void getCollisionBoxes(World world, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity entity)
{
//no mask, no need to check for collision
if (event.getAabb() == null)
return;
for (Chunk chunk : ChunkBlockHandler.getAffectedChunks(event.getWorld(), event.getAabb()))
collisionRegistry.processCallbacks(chunk, event.getAabb(), event.getCollisionBoxesList());
} | [
"@",
"SubscribeEvent",
"public",
"void",
"onGetCollisionBoxes",
"(",
"GetCollisionBoxesEvent",
"event",
")",
"//\tpublic void getCollisionBoxes(World world, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity entity)",
"{",
"//no mask, no need to check for collision",
"if",
"(",
"event"... | Gets the collision bounding boxes for the intersecting chunks.<br>
Called via ASM from {@link World#getCollisionBoxes(Entity, AxisAlignedBB)}
@param event the event | [
"Gets",
"the",
"collision",
"bounding",
"boxes",
"for",
"the",
"intersecting",
"chunks",
".",
"<br",
">",
"Called",
"via",
"ASM",
"from",
"{",
"@link",
"World#getCollisionBoxes",
"(",
"Entity",
"AxisAlignedBB",
")",
"}"
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/chunkcollision/ChunkCollision.java#L105-L115 |
jglobus/JGlobus | gridftp/src/main/java/org/globus/ftp/dc/SocketPool.java | SocketPool.checkIn | public synchronized void checkIn(SocketBox sb) {
if (((ManagedSocketBox) sb).getStatus() != ManagedSocketBox.BUSY) {
throw new IllegalArgumentException("The socket is already marked free, cannot check it in twice.");
}
if (!busySockets.containsKey(sb)) {
throw new IllegalArgumentException("This socket does not exist in the pool of busy sockets.");
}
if (freeSockets.containsKey(sb)) {
throw new IllegalArgumentException("This socket already exists in the pool of free sockets.");
}
if (! ((ManagedSocketBox)sb).isReusable()) {
throw new IllegalArgumentException("This socket is not reusable; cannot check in.");
}
((ManagedSocketBox) sb).setStatus(ManagedSocketBox.FREE);
busySockets.remove(sb);
freeSockets.put(sb, sb);
} | java | public synchronized void checkIn(SocketBox sb) {
if (((ManagedSocketBox) sb).getStatus() != ManagedSocketBox.BUSY) {
throw new IllegalArgumentException("The socket is already marked free, cannot check it in twice.");
}
if (!busySockets.containsKey(sb)) {
throw new IllegalArgumentException("This socket does not exist in the pool of busy sockets.");
}
if (freeSockets.containsKey(sb)) {
throw new IllegalArgumentException("This socket already exists in the pool of free sockets.");
}
if (! ((ManagedSocketBox)sb).isReusable()) {
throw new IllegalArgumentException("This socket is not reusable; cannot check in.");
}
((ManagedSocketBox) sb).setStatus(ManagedSocketBox.FREE);
busySockets.remove(sb);
freeSockets.put(sb, sb);
} | [
"public",
"synchronized",
"void",
"checkIn",
"(",
"SocketBox",
"sb",
")",
"{",
"if",
"(",
"(",
"(",
"ManagedSocketBox",
")",
"sb",
")",
".",
"getStatus",
"(",
")",
"!=",
"ManagedSocketBox",
".",
"BUSY",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Before calling this method, the socket needs to be first add()ed to the pool and checked out. Note: checking in a
socket that is not reusable will cause its removal from the pool. | [
"Before",
"calling",
"this",
"method",
"the",
"socket",
"needs",
"to",
"be",
"first",
"add",
"()",
"ed",
"to",
"the",
"pool",
"and",
"checked",
"out",
".",
"Note",
":",
"checking",
"in",
"a",
"socket",
"that",
"is",
"not",
"reusable",
"will",
"cause",
... | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/dc/SocketPool.java#L122-L146 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/json/JsonPathUtils.java | JsonPathUtils.evaluateAsString | public static String evaluateAsString(String payload, String jsonPathExpression) {
try {
JSONParser parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE);
Object receivedJson = parser.parse(payload);
ReadContext readerContext = JsonPath.parse(receivedJson);
return evaluateAsString(readerContext, jsonPathExpression);
} catch (ParseException e) {
throw new CitrusRuntimeException("Failed to parse JSON text", e);
}
} | java | public static String evaluateAsString(String payload, String jsonPathExpression) {
try {
JSONParser parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE);
Object receivedJson = parser.parse(payload);
ReadContext readerContext = JsonPath.parse(receivedJson);
return evaluateAsString(readerContext, jsonPathExpression);
} catch (ParseException e) {
throw new CitrusRuntimeException("Failed to parse JSON text", e);
}
} | [
"public",
"static",
"String",
"evaluateAsString",
"(",
"String",
"payload",
",",
"String",
"jsonPathExpression",
")",
"{",
"try",
"{",
"JSONParser",
"parser",
"=",
"new",
"JSONParser",
"(",
"JSONParser",
".",
"MODE_JSON_SIMPLE",
")",
";",
"Object",
"receivedJson",... | Evaluate JsonPath expression on given payload string and return result as string.
@param payload
@param jsonPathExpression
@return | [
"Evaluate",
"JsonPath",
"expression",
"on",
"given",
"payload",
"string",
"and",
"return",
"result",
"as",
"string",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/json/JsonPathUtils.java#L104-L114 |
gilberto-torrezan/viacep | src/main/java/com/github/gilbertotorrezan/viacep/gwt/ViaCEPGWTClient.java | ViaCEPGWTClient.getEndereco | public void getEndereco(String cep, MethodCallback<ViaCEPEndereco> callback){
char[] chars = cep.toCharArray();
StringBuilder builder = new StringBuilder();
for (int i = 0; i< chars.length; i++){
if (Character.isDigit(chars[i])){
builder.append(chars[i]);
}
}
cep = builder.toString();
if (cep.length() != 8){
callback.onFailure(null, new IllegalArgumentException("CEP inválido - deve conter 8 dígitos: " + cep));
return;
}
ViaCEPGWTService service = getService();
service.getEndereco(cep, callback);
} | java | public void getEndereco(String cep, MethodCallback<ViaCEPEndereco> callback){
char[] chars = cep.toCharArray();
StringBuilder builder = new StringBuilder();
for (int i = 0; i< chars.length; i++){
if (Character.isDigit(chars[i])){
builder.append(chars[i]);
}
}
cep = builder.toString();
if (cep.length() != 8){
callback.onFailure(null, new IllegalArgumentException("CEP inválido - deve conter 8 dígitos: " + cep));
return;
}
ViaCEPGWTService service = getService();
service.getEndereco(cep, callback);
} | [
"public",
"void",
"getEndereco",
"(",
"String",
"cep",
",",
"MethodCallback",
"<",
"ViaCEPEndereco",
">",
"callback",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"cep",
".",
"toCharArray",
"(",
")",
";",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",... | Executa a consulta de endereço a partir de um CEP.
@param cep CEP da localidade onde se quer consultar o endereço. Precisa ter 8 dígitos - a formatação é feita pelo cliente.
CEPs válidos (que contém 8 dígitos): "20930-040", "abc0 1311000xy z", "20930 040". CEPs inválidos (que não contém 8 dígitos): "00000", "abc", "123456789"
@param callback O retorno da chamada ao webservice. Erros de validação de campos e de conexão são tratados no callback. | [
"Executa",
"a",
"consulta",
"de",
"endereço",
"a",
"partir",
"de",
"um",
"CEP",
"."
] | train | https://github.com/gilberto-torrezan/viacep/blob/96f203f72accb970e20a14792f0ea0b1b6553e3f/src/main/java/com/github/gilbertotorrezan/viacep/gwt/ViaCEPGWTClient.java#L87-L105 |
Azure/azure-sdk-for-java | compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java | SnapshotsInner.updateAsync | public Observable<SnapshotInner> updateAsync(String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) {
return updateWithServiceResponseAsync(resourceGroupName, snapshotName, snapshot).map(new Func1<ServiceResponse<SnapshotInner>, SnapshotInner>() {
@Override
public SnapshotInner call(ServiceResponse<SnapshotInner> response) {
return response.body();
}
});
} | java | public Observable<SnapshotInner> updateAsync(String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) {
return updateWithServiceResponseAsync(resourceGroupName, snapshotName, snapshot).map(new Func1<ServiceResponse<SnapshotInner>, SnapshotInner>() {
@Override
public SnapshotInner call(ServiceResponse<SnapshotInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SnapshotInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"snapshotName",
",",
"SnapshotUpdate",
"snapshot",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"snapshotName",
"... | Updates (patches) a snapshot.
@param resourceGroupName The name of the resource group.
@param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
@param snapshot Snapshot object supplied in the body of the Patch snapshot operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"(",
"patches",
")",
"a",
"snapshot",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java#L343-L350 |
mgormley/prim | src/main/java_generated/edu/jhu/prim/vector/IntFloatVectorSlice.java | IntFloatVectorSlice.lookupIndex | public int lookupIndex(float value, float delta) {
for (int i=0; i<size; i++) {
if (Primitives.equals(elements[i + start], value, delta)) {
return i;
}
}
return -1;
} | java | public int lookupIndex(float value, float delta) {
for (int i=0; i<size; i++) {
if (Primitives.equals(elements[i + start], value, delta)) {
return i;
}
}
return -1;
} | [
"public",
"int",
"lookupIndex",
"(",
"float",
"value",
",",
"float",
"delta",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Primitives",
".",
"equals",
"(",
"elements",
"[",
"i",
"+",
"... | Gets the index of the first element in this vector with the specified
value, or -1 if it is not present.
@param value The value to search for.
@param delta The delta with which to evaluate equality.
@return The index or -1 if not present. | [
"Gets",
"the",
"index",
"of",
"the",
"first",
"element",
"in",
"this",
"vector",
"with",
"the",
"specified",
"value",
"or",
"-",
"1",
"if",
"it",
"is",
"not",
"present",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/vector/IntFloatVectorSlice.java#L170-L177 |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/CacheEntry.java | CacheEntry.tryGetInputStream | public InputStream tryGetInputStream(HttpServletRequest request, MutableObject<byte[]> sourceMapResult) throws IOException {
InputStream result = null;
// Check bytes before filename when reading and reverse order when setting
if (bytes != null || filename != null) {
try {
result = getInputStream(request, sourceMapResult);
} catch (Exception e) {
if (LayerImpl.log.isLoggable(Level.SEVERE)) {
LayerImpl.log.log(Level.SEVERE, e.getMessage(), e);
}
// just return null
}
}
return result;
} | java | public InputStream tryGetInputStream(HttpServletRequest request, MutableObject<byte[]> sourceMapResult) throws IOException {
InputStream result = null;
// Check bytes before filename when reading and reverse order when setting
if (bytes != null || filename != null) {
try {
result = getInputStream(request, sourceMapResult);
} catch (Exception e) {
if (LayerImpl.log.isLoggable(Level.SEVERE)) {
LayerImpl.log.log(Level.SEVERE, e.getMessage(), e);
}
// just return null
}
}
return result;
} | [
"public",
"InputStream",
"tryGetInputStream",
"(",
"HttpServletRequest",
"request",
",",
"MutableObject",
"<",
"byte",
"[",
"]",
">",
"sourceMapResult",
")",
"throws",
"IOException",
"{",
"InputStream",
"result",
"=",
"null",
";",
"// Check bytes before filename when re... | Can fail by returning null, but won't throw an exception.
@param request
the request object
@param sourceMapResult
(Output) mutable object reference to the source map. May be null
if source maps are not being requested.
@return The LayerInputStream, or null if data is not available
@throws IOException | [
"Can",
"fail",
"by",
"returning",
"null",
"but",
"won",
"t",
"throw",
"an",
"exception",
"."
] | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/CacheEntry.java#L150-L164 |
bwkimmel/jdcp | jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java | FileClassManager.getClassDefinition | private ByteBuffer getClassDefinition(File directory, String name) {
String baseName = getBaseFileName(name);
File digestFile = new File(directory, baseName + CLASS_EXTENSION);
return ByteBuffer.wrap(getFileContents(digestFile));
} | java | private ByteBuffer getClassDefinition(File directory, String name) {
String baseName = getBaseFileName(name);
File digestFile = new File(directory, baseName + CLASS_EXTENSION);
return ByteBuffer.wrap(getFileContents(digestFile));
} | [
"private",
"ByteBuffer",
"getClassDefinition",
"(",
"File",
"directory",
",",
"String",
"name",
")",
"{",
"String",
"baseName",
"=",
"getBaseFileName",
"(",
"name",
")",
";",
"File",
"digestFile",
"=",
"new",
"File",
"(",
"directory",
",",
"baseName",
"+",
"... | Gets the definition of a class.
@param directory The root of the directory tree containing the class
definition.
@param name The fully qualified name of the class.
@return A <code>ByteBuffer</code> containing the class definition. | [
"Gets",
"the",
"definition",
"of",
"a",
"class",
"."
] | train | https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java#L267-L271 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java | GrailsDomainBinder.calculateForeignKeyColumnCount | private int calculateForeignKeyColumnCount(PersistentEntity refDomainClass, String[] propertyNames) {
int expectedForeignKeyColumnLength = 0;
for (String propertyName : propertyNames) {
PersistentProperty referencedProperty = refDomainClass.getPropertyByName(propertyName);
if(referencedProperty instanceof ToOne) {
ToOne toOne = (ToOne) referencedProperty;
PersistentProperty[] compositeIdentity = toOne.getAssociatedEntity().getCompositeIdentity();
if(compositeIdentity != null) {
expectedForeignKeyColumnLength += compositeIdentity.length;
}
else {
expectedForeignKeyColumnLength++;
}
}
else {
expectedForeignKeyColumnLength++;
}
}
return expectedForeignKeyColumnLength;
} | java | private int calculateForeignKeyColumnCount(PersistentEntity refDomainClass, String[] propertyNames) {
int expectedForeignKeyColumnLength = 0;
for (String propertyName : propertyNames) {
PersistentProperty referencedProperty = refDomainClass.getPropertyByName(propertyName);
if(referencedProperty instanceof ToOne) {
ToOne toOne = (ToOne) referencedProperty;
PersistentProperty[] compositeIdentity = toOne.getAssociatedEntity().getCompositeIdentity();
if(compositeIdentity != null) {
expectedForeignKeyColumnLength += compositeIdentity.length;
}
else {
expectedForeignKeyColumnLength++;
}
}
else {
expectedForeignKeyColumnLength++;
}
}
return expectedForeignKeyColumnLength;
} | [
"private",
"int",
"calculateForeignKeyColumnCount",
"(",
"PersistentEntity",
"refDomainClass",
",",
"String",
"[",
"]",
"propertyNames",
")",
"{",
"int",
"expectedForeignKeyColumnLength",
"=",
"0",
";",
"for",
"(",
"String",
"propertyName",
":",
"propertyNames",
")",
... | number of columns required for a column key we have to perform the calculation here | [
"number",
"of",
"columns",
"required",
"for",
"a",
"column",
"key",
"we",
"have",
"to",
"perform",
"the",
"calculation",
"here"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java#L2422-L2441 |
juebanlin/util4j | util4j/src/main/java/net/jueb/util4j/util/WxQRUtil.java | WxQRUtil.getPerpetualQR_senceId | public static String getPerpetualQR_senceId(String access_token, int senceId) {
// 获取数据的地址(微信提供)
String url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + access_token;
JsonObject content = new JsonObject();
content.addProperty("action_name", "QR_LIMIT_SCENE");
JsonObject scene = new JsonObject();
scene.addProperty("scene_id", senceId);
JsonObject action_info = new JsonObject();
action_info.add("scene", scene);
content.add("action_info", action_info);
// 发送给微信服务器的数据
String jsonStr = content.toString();
String qrurl = null;
try {
HttpUtil http = new HttpUtil();
byte[] data = http.httpsPost(url, jsonStr.getBytes());
JsonObject json = new JsonParser().parse(new String(data)).getAsJsonObject();
qrurl = json.get("url").getAsString();
} catch (Exception e) {
e.printStackTrace();
}
return qrurl;
} | java | public static String getPerpetualQR_senceId(String access_token, int senceId) {
// 获取数据的地址(微信提供)
String url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + access_token;
JsonObject content = new JsonObject();
content.addProperty("action_name", "QR_LIMIT_SCENE");
JsonObject scene = new JsonObject();
scene.addProperty("scene_id", senceId);
JsonObject action_info = new JsonObject();
action_info.add("scene", scene);
content.add("action_info", action_info);
// 发送给微信服务器的数据
String jsonStr = content.toString();
String qrurl = null;
try {
HttpUtil http = new HttpUtil();
byte[] data = http.httpsPost(url, jsonStr.getBytes());
JsonObject json = new JsonParser().parse(new String(data)).getAsJsonObject();
qrurl = json.get("url").getAsString();
} catch (Exception e) {
e.printStackTrace();
}
return qrurl;
} | [
"public",
"static",
"String",
"getPerpetualQR_senceId",
"(",
"String",
"access_token",
",",
"int",
"senceId",
")",
"{",
"// 获取数据的地址(微信提供)\r",
"String",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=\"",
"+",
"access_token",
";",
"JsonObject",
"... | 生成永久二维码
http请求方式: POST URL:
https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=TOKEN
POST数据格式:json POST数据例子:{"action_name": "QR_LIMIT_SCENE", "action_info":
{"scene": {"scene_id": 123}}}
@param senceId
@return | [
"生成永久二维码",
"http请求方式",
":",
"POST",
"URL",
":",
"https",
":",
"//",
"api",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"cgi",
"-",
"bin",
"/",
"qrcode",
"/",
"create?access_token",
"=",
"TOKEN",
"POST数据格式:json",
"POST数据例子:",
"{",
"action_name",
":",
"QR_L... | train | https://github.com/juebanlin/util4j/blob/c404b2dbdedf7a8890533b351257fa8af4f1439f/util4j/src/main/java/net/jueb/util4j/util/WxQRUtil.java#L67-L89 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringParser.java | StringParser.parseLongObj | @Nullable
public static Long parseLongObj (@Nullable final String sStr)
{
return parseLongObj (sStr, DEFAULT_RADIX, null);
} | java | @Nullable
public static Long parseLongObj (@Nullable final String sStr)
{
return parseLongObj (sStr, DEFAULT_RADIX, null);
} | [
"@",
"Nullable",
"public",
"static",
"Long",
"parseLongObj",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
")",
"{",
"return",
"parseLongObj",
"(",
"sStr",
",",
"DEFAULT_RADIX",
",",
"null",
")",
";",
"}"
] | Parse the given {@link String} as {@link Long} with radix
{@value #DEFAULT_RADIX}.
@param sStr
The string to parse. May be <code>null</code>.
@return <code>null</code> if the string does not represent a valid value. | [
"Parse",
"the",
"given",
"{",
"@link",
"String",
"}",
"as",
"{",
"@link",
"Long",
"}",
"with",
"radix",
"{",
"@value",
"#DEFAULT_RADIX",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L1115-L1119 |
voldemort/voldemort | src/java/voldemort/utils/MetadataVersionStoreUtils.java | MetadataVersionStoreUtils.getProperties | public static Properties getProperties(SystemStoreClient<String, String> versionStore) {
Properties props = null;
Versioned<String> versioned = versionStore.getSysStore(SystemStoreConstants.VERSIONS_METADATA_KEY);
if(versioned != null && versioned.getValue() != null) {
try {
String versionList = versioned.getValue();
props = new Properties();
props.load(new ByteArrayInputStream(versionList.getBytes()));
} catch(Exception e) {
logger.warn("Error retrieving properties ", e);
}
}
return props;
} | java | public static Properties getProperties(SystemStoreClient<String, String> versionStore) {
Properties props = null;
Versioned<String> versioned = versionStore.getSysStore(SystemStoreConstants.VERSIONS_METADATA_KEY);
if(versioned != null && versioned.getValue() != null) {
try {
String versionList = versioned.getValue();
props = new Properties();
props.load(new ByteArrayInputStream(versionList.getBytes()));
} catch(Exception e) {
logger.warn("Error retrieving properties ", e);
}
}
return props;
} | [
"public",
"static",
"Properties",
"getProperties",
"(",
"SystemStoreClient",
"<",
"String",
",",
"String",
">",
"versionStore",
")",
"{",
"Properties",
"props",
"=",
"null",
";",
"Versioned",
"<",
"String",
">",
"versioned",
"=",
"versionStore",
".",
"getSysStor... | Retrieves a properties (hashmap) consisting of all the metadata versions
@param versionStore The system store client used to retrieve the metadata
versions
@return Properties object containing all the
'property_name=property_value' values | [
"Retrieves",
"a",
"properties",
"(",
"hashmap",
")",
"consisting",
"of",
"all",
"the",
"metadata",
"versions"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/MetadataVersionStoreUtils.java#L51-L65 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updateHierarchicalEntityRole | public OperationStatus updateHierarchicalEntityRole(UUID appId, String versionId, UUID hEntityId, UUID roleId, UpdateHierarchicalEntityRoleOptionalParameter updateHierarchicalEntityRoleOptionalParameter) {
return updateHierarchicalEntityRoleWithServiceResponseAsync(appId, versionId, hEntityId, roleId, updateHierarchicalEntityRoleOptionalParameter).toBlocking().single().body();
} | java | public OperationStatus updateHierarchicalEntityRole(UUID appId, String versionId, UUID hEntityId, UUID roleId, UpdateHierarchicalEntityRoleOptionalParameter updateHierarchicalEntityRoleOptionalParameter) {
return updateHierarchicalEntityRoleWithServiceResponseAsync(appId, versionId, hEntityId, roleId, updateHierarchicalEntityRoleOptionalParameter).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"updateHierarchicalEntityRole",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"hEntityId",
",",
"UUID",
"roleId",
",",
"UpdateHierarchicalEntityRoleOptionalParameter",
"updateHierarchicalEntityRoleOptionalParameter",
")",
"{",
"re... | Update an entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param hEntityId The hierarchical entity extractor ID.
@param roleId The entity role ID.
@param updateHierarchicalEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Update",
"an",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L13260-L13262 |
landawn/AbacusUtil | src/com/landawn/abacus/util/FilenameUtil.java | FilenameUtil.wildcardMatch | public static boolean wildcardMatch(final String filename, final String wildcardfilter, boolean caseSensitivity) {
return wildcardMatch(filename, wildcardfilter, caseSensitivity ? IOCase.SENSITIVE : IOCase.INSENSITIVE);
} | java | public static boolean wildcardMatch(final String filename, final String wildcardfilter, boolean caseSensitivity) {
return wildcardMatch(filename, wildcardfilter, caseSensitivity ? IOCase.SENSITIVE : IOCase.INSENSITIVE);
} | [
"public",
"static",
"boolean",
"wildcardMatch",
"(",
"final",
"String",
"filename",
",",
"final",
"String",
"wildcardfilter",
",",
"boolean",
"caseSensitivity",
")",
"{",
"return",
"wildcardMatch",
"(",
"filename",
",",
"wildcardfilter",
",",
"caseSensitivity",
"?",... | Checks a filename to see if it matches the specified wildcard filter
allowing control over case-sensitivity.
<p>
The wildcard filter uses the characters '?' and '*' to represent a
single or multiple (zero or more) wildcard characters.
N.B. the sequence "*?" does not work properly at present in match strings.
@param filename the filename to match on
@param wildcardfilter the wildcard string to match against
@param caseSensitivity what case sensitivity rule to use, null means case-sensitive
@return true if the filename matches the wilcard string | [
"Checks",
"a",
"filename",
"to",
"see",
"if",
"it",
"matches",
"the",
"specified",
"wildcard",
"filter",
"allowing",
"control",
"over",
"case",
"-",
"sensitivity",
".",
"<p",
">",
"The",
"wildcard",
"filter",
"uses",
"the",
"characters",
"?",
"and",
"*",
"... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/FilenameUtil.java#L1299-L1301 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java | JdbcCpoAdapter.persistObjects | @Override
public <T> long persistObjects(String name, Collection<T> coll) throws CpoException {
return processUpdateGroup(coll, JdbcCpoAdapter.PERSIST_GROUP, name, null, null, null);
} | java | @Override
public <T> long persistObjects(String name, Collection<T> coll) throws CpoException {
return processUpdateGroup(coll, JdbcCpoAdapter.PERSIST_GROUP, name, null, null, null);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"long",
"persistObjects",
"(",
"String",
"name",
",",
"Collection",
"<",
"T",
">",
"coll",
")",
"throws",
"CpoException",
"{",
"return",
"processUpdateGroup",
"(",
"coll",
",",
"JdbcCpoAdapter",
".",
"PERSIST_GROUP",
... | Persists a collection of Objects into the datasource. The CpoAdapter will check to see if this object exists in the
datasource. If it exists, the object is updated in the datasource If the object does not exist, then it is created
in the datasource. This method stores the object in the datasource. The objects in the collection will be treated
as one transaction, meaning that if one of the objects fail being inserted or updated in the datasource then the
entire collection will be rolled back.
<p/>
<pre>Example:
<code>
<p/>
class SomeObject so = null;
class CpoAdapter cpo = null;
<p/>
try {
cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
} catch (CpoException ce) {
// Handle the error
cpo = null;
}
<p/>
if (cpo!=null) {
ArrayList al = new ArrayList();
for (int i=0; i<3; i++){
so = new SomeObject();
so.setId(1);
so.setName("SomeName");
al.add(so);
}
try{
cpo.persistObjects("myPersist",al);
} catch (CpoException ce) {
// Handle the error
}
}
</code>
</pre>
@param name The name which identifies which EXISTS, INSERT, and UPDATE Function Groups to execute to persist the
object.
@param coll This is a collection of objects that have been defined within the metadata of the datasource. If the
class is not defined an exception will be thrown.
@return DOCUMENT ME!
@throws CpoException Thrown if there are errors accessing the datasource
@see #existsObject
@see #insertObject
@see #updateObject | [
"Persists",
"a",
"collection",
"of",
"Objects",
"into",
"the",
"datasource",
".",
"The",
"CpoAdapter",
"will",
"check",
"to",
"see",
"if",
"this",
"object",
"exists",
"in",
"the",
"datasource",
".",
"If",
"it",
"exists",
"the",
"object",
"is",
"updated",
"... | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L1396-L1399 |
OpenLiberty/open-liberty | dev/com.ibm.ws.junit.extensions/src/org/apache/tools/ant/taskdefs/PumpStreamHandler.java | PumpStreamHandler.createPump | protected Thread createPump(InputStream is, OutputStream os,
boolean closeWhenExhausted) {
return createPump(is, os, closeWhenExhausted, true);
} | java | protected Thread createPump(InputStream is, OutputStream os,
boolean closeWhenExhausted) {
return createPump(is, os, closeWhenExhausted, true);
} | [
"protected",
"Thread",
"createPump",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
",",
"boolean",
"closeWhenExhausted",
")",
"{",
"return",
"createPump",
"(",
"is",
",",
"os",
",",
"closeWhenExhausted",
",",
"true",
")",
";",
"}"
] | Creates a stream pumper to copy the given input stream to the
given output stream.
@param is the input stream to copy from.
@param os the output stream to copy to.
@param closeWhenExhausted if true close the inputstream.
@return a thread object that does the pumping, subclasses
should return an instance of {@link ThreadWithPumper
ThreadWithPumper}. | [
"Creates",
"a",
"stream",
"pumper",
"to",
"copy",
"the",
"given",
"input",
"stream",
"to",
"the",
"given",
"output",
"stream",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.junit.extensions/src/org/apache/tools/ant/taskdefs/PumpStreamHandler.java#L268-L271 |
jtrfp/javamod | src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java | BasicModMixer.setupChannelFilter | protected void setupChannelFilter(ChannelMemory aktMemo, boolean bReset, int flt_modifier)
{
double cutOff = (double)((aktMemo.nCutOff + aktMemo.nCutSwing)&0x7F);
double resonance = (double)((aktMemo.nResonance + aktMemo.nResSwing)&0x7F);
double fc = cutOffToFrequency((long)cutOff, flt_modifier, (mod.getSongFlags()&Helpers.SONG_EXFILTERRANGE)!=0);
fc *= 2.0d * 3.14159265358 / ((double)sampleRate);
double dmpfac = Math.pow(10.0d, -((24.0d / 128.0d) * resonance) / 20.0d);
double d = (1.0d - 2.0d * dmpfac) * fc;
if (d > 2.0d) d = 2.0d;
d = (2.0d * dmpfac - d) / fc;
double e = Math.pow(1.0d / fc, 2.0d);
double fg = 1.0d / (1.0d + d + e);
double fg1 = -e * fg;
double fg0 = 1.0d - fg - fg1;
switch(aktMemo.nFilterMode)
{
case Helpers.FLTMODE_HIGHPASS:
aktMemo.nFilter_A0 = (long)((1.0d-fg) * Helpers.FILTER_PRECISION);
aktMemo.nFilter_B0 = (long)(fg0 * Helpers.FILTER_PRECISION);
aktMemo.nFilter_B1 = (long)(fg1 * Helpers.FILTER_PRECISION);
aktMemo.nFilter_HP = -1;
break;
default:
aktMemo.nFilter_A0 = (long)(fg * Helpers.FILTER_PRECISION);
aktMemo.nFilter_B0 = (long)(fg0 * Helpers.FILTER_PRECISION);
aktMemo.nFilter_B1 = (long)(fg1 * Helpers.FILTER_PRECISION);
aktMemo.nFilter_HP = 0;
break;
}
if (bReset) aktMemo.nFilter_Y1 = aktMemo.nFilter_Y2 = 0;
aktMemo.filterOn = true;
} | java | protected void setupChannelFilter(ChannelMemory aktMemo, boolean bReset, int flt_modifier)
{
double cutOff = (double)((aktMemo.nCutOff + aktMemo.nCutSwing)&0x7F);
double resonance = (double)((aktMemo.nResonance + aktMemo.nResSwing)&0x7F);
double fc = cutOffToFrequency((long)cutOff, flt_modifier, (mod.getSongFlags()&Helpers.SONG_EXFILTERRANGE)!=0);
fc *= 2.0d * 3.14159265358 / ((double)sampleRate);
double dmpfac = Math.pow(10.0d, -((24.0d / 128.0d) * resonance) / 20.0d);
double d = (1.0d - 2.0d * dmpfac) * fc;
if (d > 2.0d) d = 2.0d;
d = (2.0d * dmpfac - d) / fc;
double e = Math.pow(1.0d / fc, 2.0d);
double fg = 1.0d / (1.0d + d + e);
double fg1 = -e * fg;
double fg0 = 1.0d - fg - fg1;
switch(aktMemo.nFilterMode)
{
case Helpers.FLTMODE_HIGHPASS:
aktMemo.nFilter_A0 = (long)((1.0d-fg) * Helpers.FILTER_PRECISION);
aktMemo.nFilter_B0 = (long)(fg0 * Helpers.FILTER_PRECISION);
aktMemo.nFilter_B1 = (long)(fg1 * Helpers.FILTER_PRECISION);
aktMemo.nFilter_HP = -1;
break;
default:
aktMemo.nFilter_A0 = (long)(fg * Helpers.FILTER_PRECISION);
aktMemo.nFilter_B0 = (long)(fg0 * Helpers.FILTER_PRECISION);
aktMemo.nFilter_B1 = (long)(fg1 * Helpers.FILTER_PRECISION);
aktMemo.nFilter_HP = 0;
break;
}
if (bReset) aktMemo.nFilter_Y1 = aktMemo.nFilter_Y2 = 0;
aktMemo.filterOn = true;
} | [
"protected",
"void",
"setupChannelFilter",
"(",
"ChannelMemory",
"aktMemo",
",",
"boolean",
"bReset",
",",
"int",
"flt_modifier",
")",
"{",
"double",
"cutOff",
"=",
"(",
"double",
")",
"(",
"(",
"aktMemo",
".",
"nCutOff",
"+",
"aktMemo",
".",
"nCutSwing",
")... | Simple 2-poles resonant filter
@since 31.03.2010
@param aktMemo
@param bReset
@param flt_modifier | [
"Simple",
"2",
"-",
"poles",
"resonant",
"filter"
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java#L512-L550 |
azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/FileUtils.java | FileUtils.deleteFileOrDirectory | public static void deleteFileOrDirectory(File file) {
if (!file.isDirectory()) {
file.delete();
return;
}
if (file.list().length == 0) { //Nothing under directory. Just delete it.
file.delete();
return;
}
for (String temp : file.list()) { //Delete files or directory under current directory.
File fileDelete = new File(file, temp);
deleteFileOrDirectory(fileDelete);
}
//Now there is nothing under directory, delete it.
deleteFileOrDirectory(file);
} | java | public static void deleteFileOrDirectory(File file) {
if (!file.isDirectory()) {
file.delete();
return;
}
if (file.list().length == 0) { //Nothing under directory. Just delete it.
file.delete();
return;
}
for (String temp : file.list()) { //Delete files or directory under current directory.
File fileDelete = new File(file, temp);
deleteFileOrDirectory(fileDelete);
}
//Now there is nothing under directory, delete it.
deleteFileOrDirectory(file);
} | [
"public",
"static",
"void",
"deleteFileOrDirectory",
"(",
"File",
"file",
")",
"{",
"if",
"(",
"!",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"file",
".",
"delete",
"(",
")",
";",
"return",
";",
"}",
"if",
"(",
"file",
".",
"list",
"(",
")",
... | Delete file or directory.
(Apache FileUtils.deleteDirectory has a bug and is not working.) | [
"Delete",
"file",
"or",
"directory",
".",
"(",
"Apache",
"FileUtils",
".",
"deleteDirectory",
"has",
"a",
"bug",
"and",
"is",
"not",
"working",
".",
")"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/FileUtils.java#L40-L57 |
iorga-group/iraj | iraj/src/main/java/com/iorga/iraj/servlet/CacheAwareServlet.java | CacheAwareServlet.doGet | @Override
protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException {
// Serve the requested resource, including the data content
serveResource(request, response, true);
} | java | @Override
protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException {
// Serve the requested resource, including the data content
serveResource(request, response, true);
} | [
"@",
"Override",
"protected",
"void",
"doGet",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"// Serve the requested resource, including the data content",
"serveReso... | Process a GET request for the specified resource.
@param request
The servlet request we are processing
@param response
The servlet response we are creating
@exception IOException
if an input/output error occurs
@exception ServletException
if a servlet-specified error occurs | [
"Process",
"a",
"GET",
"request",
"for",
"the",
"specified",
"resource",
"."
] | train | https://github.com/iorga-group/iraj/blob/5fdee26464248f29833610de402275eb64505542/iraj/src/main/java/com/iorga/iraj/servlet/CacheAwareServlet.java#L163-L169 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkPeeringsInner.java | VirtualNetworkPeeringsInner.createOrUpdate | public VirtualNetworkPeeringInner createOrUpdate(String resourceGroupName, String virtualNetworkName, String virtualNetworkPeeringName, VirtualNetworkPeeringInner virtualNetworkPeeringParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters).toBlocking().last().body();
} | java | public VirtualNetworkPeeringInner createOrUpdate(String resourceGroupName, String virtualNetworkName, String virtualNetworkPeeringName, VirtualNetworkPeeringInner virtualNetworkPeeringParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters).toBlocking().last().body();
} | [
"public",
"VirtualNetworkPeeringInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkName",
",",
"String",
"virtualNetworkPeeringName",
",",
"VirtualNetworkPeeringInner",
"virtualNetworkPeeringParameters",
")",
"{",
"return",
"createOrUpdate... | Creates or updates a peering in the specified virtual network.
@param resourceGroupName The name of the resource group.
@param virtualNetworkName The name of the virtual network.
@param virtualNetworkPeeringName The name of the peering.
@param virtualNetworkPeeringParameters Parameters supplied to the create or update virtual network peering operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VirtualNetworkPeeringInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"peering",
"in",
"the",
"specified",
"virtual",
"network",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkPeeringsInner.java#L362-L364 |
biojava/biojava | biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastAlignmentProperties.java | NCBIQBlastAlignmentProperties.setBlastFromToPosition | public void setBlastFromToPosition(int start, int end) {
if (start >= end) {
throw new IllegalArgumentException("Start index must be less than end index");
}
setAlignmentOption(QUERY_FROM, String.valueOf(start));
setAlignmentOption(QUERY_TO, String.valueOf(end));
} | java | public void setBlastFromToPosition(int start, int end) {
if (start >= end) {
throw new IllegalArgumentException("Start index must be less than end index");
}
setAlignmentOption(QUERY_FROM, String.valueOf(start));
setAlignmentOption(QUERY_TO, String.valueOf(end));
} | [
"public",
"void",
"setBlastFromToPosition",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"if",
"(",
"start",
">=",
"end",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Start index must be less than end index\"",
")",
";",
"}",
"setAlignmentOpt... | Sets the QUERY_FROM and QUERY_TO parameters to be use by blast. Do not use if you want to use the whole sequence.<br/>
Blastall equivalent: -L
@param start QUERY_FROM parameter
@param end QUERY_TO parameter | [
"Sets",
"the",
"QUERY_FROM",
"and",
"QUERY_TO",
"parameters",
"to",
"be",
"use",
"by",
"blast",
".",
"Do",
"not",
"use",
"if",
"you",
"want",
"to",
"use",
"the",
"whole",
"sequence",
".",
"<br",
"/",
">",
"Blastall",
"equivalent",
":",
"-",
"L"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastAlignmentProperties.java#L335-L341 |
signit-wesign/java-sdk | src/main/java/cn/signit/sdk/util/HmacSignatureBuilder.java | HmacSignatureBuilder.assertAuthFail | public void assertAuthFail(byte[] expectedSignature, BuilderMode builderMode, String errorMessage) {
if (isHashEquals(expectedSignature, builderMode)) {
if (Validator.isEmpty(errorMessage)) {
throw new IllegalArgumentException();
} else {
throw new IllegalArgumentException(errorMessage);
}
}
} | java | public void assertAuthFail(byte[] expectedSignature, BuilderMode builderMode, String errorMessage) {
if (isHashEquals(expectedSignature, builderMode)) {
if (Validator.isEmpty(errorMessage)) {
throw new IllegalArgumentException();
} else {
throw new IllegalArgumentException(errorMessage);
}
}
} | [
"public",
"void",
"assertAuthFail",
"(",
"byte",
"[",
"]",
"expectedSignature",
",",
"BuilderMode",
"builderMode",
",",
"String",
"errorMessage",
")",
"{",
"if",
"(",
"isHashEquals",
"(",
"expectedSignature",
",",
"builderMode",
")",
")",
"{",
"if",
"(",
"Vali... | 断言认证失败.<br>
若认证成功,则抛出异常{@link java.lang.IllegalArgumentException}.
@param expectedSignature
传入的期望摘要
@param builderMode
采用的构建模式
@param errorMessage
自定义异常抛出的消息
@throws IllegalArgumentException
参数不合法异常
@author zhd
@since 1.0.0 | [
"断言认证失败",
".",
"<br",
">",
"若认证成功",
"则抛出异常",
"{",
"@link",
"java",
".",
"lang",
".",
"IllegalArgumentException",
"}",
"."
] | train | https://github.com/signit-wesign/java-sdk/blob/6f3196c9d444818a953396fdaa8ffed9794d9530/src/main/java/cn/signit/sdk/util/HmacSignatureBuilder.java#L641-L649 |
nominanuda/zen-project | zen-dataobject/src/main/java/com/nominanuda/dataobject/DataStructHelper.java | DataStructHelper.copyPush | public void copyPush(Obj source, Obj target) {
Iterator<String> itr = source.keyIterator();
while (itr.hasNext()) {
String key = itr.next();
Object sval = source.get(key);
putPush(target, key, sval);
}
} | java | public void copyPush(Obj source, Obj target) {
Iterator<String> itr = source.keyIterator();
while (itr.hasNext()) {
String key = itr.next();
Object sval = source.get(key);
putPush(target, key, sval);
}
} | [
"public",
"void",
"copyPush",
"(",
"Obj",
"source",
",",
"Obj",
"target",
")",
"{",
"Iterator",
"<",
"String",
">",
"itr",
"=",
"source",
".",
"keyIterator",
"(",
")",
";",
"while",
"(",
"itr",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"key",
"... | {a:1} {b:1} => {a:1, b:1} {a:1} {a:1} => {a:[1, 1]} {a:1} {a:null} =>
{a:[1, null]} {a:{b:1}} {a:null} => {a:[{b:1}, null]} {a:{b:1}}
{a:{b:{c:null}}} => {a:{b:[1,{c:null}]}} {a:1} {a:[2]} => {a:[1,2]}
{a:[1]} {a:[2]} => {a:[1,2]} {a:{b:1}} {a:[2]} => {a:[{b:1},2]} {a:{b:1}}
{a:{b:[2]}} => {a:{b:[1,2]}} {a:1} {} => {a:1}} | [
"{",
"a",
":",
"1",
"}",
"{",
"b",
":",
"1",
"}",
"=",
">",
"{",
"a",
":",
"1",
"b",
":",
"1",
"}",
"{",
"a",
":",
"1",
"}",
"{",
"a",
":",
"1",
"}",
"=",
">",
"{",
"a",
":",
"[",
"1",
"1",
"]",
"}",
"{",
"a",
":",
"1",
"}",
"... | train | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-dataobject/src/main/java/com/nominanuda/dataobject/DataStructHelper.java#L226-L233 |
xcesco/kripton | kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/SQLiteUpdateTaskHelper.java | SQLiteUpdateTaskHelper.dropTablesWithPrefix | public static void dropTablesWithPrefix(SQLiteDatabase db, String prefix) {
Logger.info("MASSIVE TABLE DROP OPERATION%s", StringUtils.ifNotEmptyAppend(prefix, " WITH PREFIX "));
drop(db, QueryType.TABLE, prefix);
} | java | public static void dropTablesWithPrefix(SQLiteDatabase db, String prefix) {
Logger.info("MASSIVE TABLE DROP OPERATION%s", StringUtils.ifNotEmptyAppend(prefix, " WITH PREFIX "));
drop(db, QueryType.TABLE, prefix);
} | [
"public",
"static",
"void",
"dropTablesWithPrefix",
"(",
"SQLiteDatabase",
"db",
",",
"String",
"prefix",
")",
"{",
"Logger",
".",
"info",
"(",
"\"MASSIVE TABLE DROP OPERATION%s\"",
",",
"StringUtils",
".",
"ifNotEmptyAppend",
"(",
"prefix",
",",
"\" WITH PREFIX \"",
... | Drop all table with specific prefix.
@param db
the db
@param prefix
the prefix | [
"Drop",
"all",
"table",
"with",
"specific",
"prefix",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/SQLiteUpdateTaskHelper.java#L183-L186 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java | FileInfo.fromItemInfo | public static FileInfo fromItemInfo(PathCodec pathCodec, GoogleCloudStorageItemInfo itemInfo) {
if (itemInfo.isRoot()) {
return ROOT_INFO;
}
URI path = pathCodec.getPath(itemInfo.getBucketName(), itemInfo.getObjectName(), true);
return new FileInfo(path, itemInfo);
} | java | public static FileInfo fromItemInfo(PathCodec pathCodec, GoogleCloudStorageItemInfo itemInfo) {
if (itemInfo.isRoot()) {
return ROOT_INFO;
}
URI path = pathCodec.getPath(itemInfo.getBucketName(), itemInfo.getObjectName(), true);
return new FileInfo(path, itemInfo);
} | [
"public",
"static",
"FileInfo",
"fromItemInfo",
"(",
"PathCodec",
"pathCodec",
",",
"GoogleCloudStorageItemInfo",
"itemInfo",
")",
"{",
"if",
"(",
"itemInfo",
".",
"isRoot",
"(",
")",
")",
"{",
"return",
"ROOT_INFO",
";",
"}",
"URI",
"path",
"=",
"pathCodec",
... | Handy factory method for constructing a FileInfo from a GoogleCloudStorageItemInfo while
potentially returning a singleton instead of really constructing an object for cases like ROOT. | [
"Handy",
"factory",
"method",
"for",
"constructing",
"a",
"FileInfo",
"from",
"a",
"GoogleCloudStorageItemInfo",
"while",
"potentially",
"returning",
"a",
"singleton",
"instead",
"of",
"really",
"constructing",
"an",
"object",
"for",
"cases",
"like",
"ROOT",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java#L244-L250 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/core/N1qlQueryExecutor.java | N1qlQueryExecutor.extractPreparedPayloadFromResponse | protected PreparedPayload extractPreparedPayloadFromResponse(PrepareStatement prepared, JsonObject response) {
return new PreparedPayload(
prepared.originalStatement(),
response.getString("name"),
response.getString("encoded_plan")
);
} | java | protected PreparedPayload extractPreparedPayloadFromResponse(PrepareStatement prepared, JsonObject response) {
return new PreparedPayload(
prepared.originalStatement(),
response.getString("name"),
response.getString("encoded_plan")
);
} | [
"protected",
"PreparedPayload",
"extractPreparedPayloadFromResponse",
"(",
"PrepareStatement",
"prepared",
",",
"JsonObject",
"response",
")",
"{",
"return",
"new",
"PreparedPayload",
"(",
"prepared",
".",
"originalStatement",
"(",
")",
",",
"response",
".",
"getString"... | Extracts the {@link PreparedPayload} from the server's response during a PREPARE. | [
"Extracts",
"the",
"{"
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/core/N1qlQueryExecutor.java#L593-L599 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.3/src/com/ibm/ws/microprofile/config13/sources/OSGiConfigUtils.java | OSGiConfigUtils.getApplicationServiceRef | public static ServiceReference<Application> getApplicationServiceRef(BundleContext bundleContext, String applicationName) {
ServiceReference<Application> appRef = null;
if (FrameworkState.isValid()) {
Collection<ServiceReference<Application>> appRefs;
try {
appRefs = bundleContext.getServiceReferences(Application.class,
FilterUtils.createPropertyFilter("name", applicationName));
} catch (InvalidSyntaxException e) {
throw new ConfigException(e);
}
if (appRefs != null && appRefs.size() > 0) {
if (appRefs.size() > 1) {
throw new ConfigException(Tr.formatMessage(tc, "duplicate.application.name.CWMCG0202E", applicationName));
}
appRef = appRefs.iterator().next();
}
}
return appRef;
} | java | public static ServiceReference<Application> getApplicationServiceRef(BundleContext bundleContext, String applicationName) {
ServiceReference<Application> appRef = null;
if (FrameworkState.isValid()) {
Collection<ServiceReference<Application>> appRefs;
try {
appRefs = bundleContext.getServiceReferences(Application.class,
FilterUtils.createPropertyFilter("name", applicationName));
} catch (InvalidSyntaxException e) {
throw new ConfigException(e);
}
if (appRefs != null && appRefs.size() > 0) {
if (appRefs.size() > 1) {
throw new ConfigException(Tr.formatMessage(tc, "duplicate.application.name.CWMCG0202E", applicationName));
}
appRef = appRefs.iterator().next();
}
}
return appRef;
} | [
"public",
"static",
"ServiceReference",
"<",
"Application",
">",
"getApplicationServiceRef",
"(",
"BundleContext",
"bundleContext",
",",
"String",
"applicationName",
")",
"{",
"ServiceReference",
"<",
"Application",
">",
"appRef",
"=",
"null",
";",
"if",
"(",
"Frame... | Get the Application ServiceReferences which has the given name, or null if not found
@param bundleContext The context to use to find the application service references
@param applicationName The application name to look for
@return A ServiceReference for the given application | [
"Get",
"the",
"Application",
"ServiceReferences",
"which",
"has",
"the",
"given",
"name",
"or",
"null",
"if",
"not",
"found"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.3/src/com/ibm/ws/microprofile/config13/sources/OSGiConfigUtils.java#L162-L183 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRJassimpAdapter.java | GVRJassimpAdapter.makeSkeleton | private void makeSkeleton(GVRSceneObject root)
{
if (!mBoneMap.isEmpty())
{
BoneCollector nodeProcessor = new BoneCollector();
root.forAllDescendants(nodeProcessor);
mSkeleton = new GVRSkeleton(root, nodeProcessor.getBoneNames());
GVRPose bindPose = new GVRPose(mSkeleton);
Matrix4f bindPoseMtx = new Matrix4f();
GVRSceneObject skelRoot = mSkeleton.getOwnerObject().getParent();
Matrix4f rootMtx = skelRoot.getTransform().getModelMatrix4f();
rootMtx.invert();
for (int boneId = 0; boneId < mSkeleton.getNumBones(); ++boneId)
{
String boneName = mSkeleton.getBoneName(boneId);
AiBone aiBone = mBoneMap.get(boneName);
GVRSceneObject bone = mSkeleton.getBone(boneId);
if (aiBone != null)
{
float[] matrixdata = aiBone.getOffsetMatrix(sWrapperProvider);
bindPoseMtx.set(matrixdata);
bindPoseMtx.invert();
bindPose.setWorldMatrix(boneId, bindPoseMtx);
}
else
{
GVRTransform t = bone.getTransform();
Matrix4f mtx = t.getModelMatrix4f();
mtx.invert();
rootMtx.mul(mtx, mtx);
bindPose.setWorldMatrix(boneId, mtx);
Log.e("BONE", "no bind pose matrix for bone %s", boneName);
}
}
mSkeleton.setBindPose(bindPose);
}
} | java | private void makeSkeleton(GVRSceneObject root)
{
if (!mBoneMap.isEmpty())
{
BoneCollector nodeProcessor = new BoneCollector();
root.forAllDescendants(nodeProcessor);
mSkeleton = new GVRSkeleton(root, nodeProcessor.getBoneNames());
GVRPose bindPose = new GVRPose(mSkeleton);
Matrix4f bindPoseMtx = new Matrix4f();
GVRSceneObject skelRoot = mSkeleton.getOwnerObject().getParent();
Matrix4f rootMtx = skelRoot.getTransform().getModelMatrix4f();
rootMtx.invert();
for (int boneId = 0; boneId < mSkeleton.getNumBones(); ++boneId)
{
String boneName = mSkeleton.getBoneName(boneId);
AiBone aiBone = mBoneMap.get(boneName);
GVRSceneObject bone = mSkeleton.getBone(boneId);
if (aiBone != null)
{
float[] matrixdata = aiBone.getOffsetMatrix(sWrapperProvider);
bindPoseMtx.set(matrixdata);
bindPoseMtx.invert();
bindPose.setWorldMatrix(boneId, bindPoseMtx);
}
else
{
GVRTransform t = bone.getTransform();
Matrix4f mtx = t.getModelMatrix4f();
mtx.invert();
rootMtx.mul(mtx, mtx);
bindPose.setWorldMatrix(boneId, mtx);
Log.e("BONE", "no bind pose matrix for bone %s", boneName);
}
}
mSkeleton.setBindPose(bindPose);
}
} | [
"private",
"void",
"makeSkeleton",
"(",
"GVRSceneObject",
"root",
")",
"{",
"if",
"(",
"!",
"mBoneMap",
".",
"isEmpty",
"(",
")",
")",
"{",
"BoneCollector",
"nodeProcessor",
"=",
"new",
"BoneCollector",
"(",
")",
";",
"root",
".",
"forAllDescendants",
"(",
... | /*
if there was a skinned mesh the bone map acts as a lookup
table that maps bone names to their corresponding AiBone objects.
The BoneCollector constructs the skeleton from the bone names in
the map and the scene nodes, attempting to connect bones
where there are gaps to produce a complete skeleton. | [
"/",
"*",
"if",
"there",
"was",
"a",
"skinned",
"mesh",
"the",
"bone",
"map",
"acts",
"as",
"a",
"lookup",
"table",
"that",
"maps",
"bone",
"names",
"to",
"their",
"corresponding",
"AiBone",
"objects",
".",
"The",
"BoneCollector",
"constructs",
"the",
"ske... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRJassimpAdapter.java#L550-L591 |
redkale/redkale | src/org/redkale/convert/json/JsonReader.java | JsonReader.readMapB | @Override
public final int readMapB(DeMember member, byte[] typevals, Decodeable keyDecoder, Decodeable valuedecoder) {
return readArrayB(member, typevals, keyDecoder);
} | java | @Override
public final int readMapB(DeMember member, byte[] typevals, Decodeable keyDecoder, Decodeable valuedecoder) {
return readArrayB(member, typevals, keyDecoder);
} | [
"@",
"Override",
"public",
"final",
"int",
"readMapB",
"(",
"DeMember",
"member",
",",
"byte",
"[",
"]",
"typevals",
",",
"Decodeable",
"keyDecoder",
",",
"Decodeable",
"valuedecoder",
")",
"{",
"return",
"readArrayB",
"(",
"member",
",",
"typevals",
",",
"k... | 判断下一个非空白字符是否为{
@param member DeMember
@param typevals byte[]
@param keyDecoder Decodeable
@param valuedecoder Decodeable
@return SIGN_NOLENGTH 或 SIGN_NULL | [
"判断下一个非空白字符是否为",
"{"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/convert/json/JsonReader.java#L215-L218 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java | MithraManager.executeTransactionalCommandInSeparateThread | public Object executeTransactionalCommandInSeparateThread(final TransactionalCommand command, final int retries)
throws MithraBusinessException
{
return executeTransactionalCommandInSeparateThread(command, new TransactionStyle(this.transactionTimeout, retries));
} | java | public Object executeTransactionalCommandInSeparateThread(final TransactionalCommand command, final int retries)
throws MithraBusinessException
{
return executeTransactionalCommandInSeparateThread(command, new TransactionStyle(this.transactionTimeout, retries));
} | [
"public",
"Object",
"executeTransactionalCommandInSeparateThread",
"(",
"final",
"TransactionalCommand",
"command",
",",
"final",
"int",
"retries",
")",
"throws",
"MithraBusinessException",
"{",
"return",
"executeTransactionalCommandInSeparateThread",
"(",
"command",
",",
"ne... | Use this method very carefully. It can easily lead to a deadlock.
executes the transactional command in a separate thread with a custom number of retries. Using a separate thread
creates a brand new transactional context and therefore this transaction will not join
the context of any outer transactions. For example, if the outer transaction rolls back, this command will not.
Calling this method will lead to deadlock if the outer transaction has locked any object that will be accessed
in this transaction. It can also lead to deadlock if the same table is accessed in the outer transaction as
this command. It can also lead to a deadlock if the connection pool is tied up in the outer transaction
and has nothing left for this command.
@param command an implementation of TransactionalCommand
@param retries number of times to retry in case of retriable exceptions
@return whatever the transaction command's execute method returned.
@throws MithraBusinessException if something goes wrong. the transaction will be fully rolled back in this case. | [
"Use",
"this",
"method",
"very",
"carefully",
".",
"It",
"can",
"easily",
"lead",
"to",
"a",
"deadlock",
".",
"executes",
"the",
"transactional",
"command",
"in",
"a",
"separate",
"thread",
"with",
"a",
"custom",
"number",
"of",
"retries",
".",
"Using",
"a... | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java#L470-L474 |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/Setting.java | Setting.set | public Setting set(String group, String key, String value) {
this.put(group, key, value);
return this;
} | java | public Setting set(String group, String key, String value) {
this.put(group, key, value);
return this;
} | [
"public",
"Setting",
"set",
"(",
"String",
"group",
",",
"String",
"key",
",",
"String",
"value",
")",
"{",
"this",
".",
"put",
"(",
"group",
",",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | 将键值对加入到对应分组中
@param group 分组
@param key 键
@param value 值
@return 此key之前存在的值,如果没有返回null | [
"将键值对加入到对应分组中"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/Setting.java#L510-L513 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java | ApiOvhHostingprivateDatabase.serviceName_availableVersions_GET | public ArrayList<OvhAvailableVersionEnum> serviceName_availableVersions_GET(String serviceName) throws IOException {
String qPath = "/hosting/privateDatabase/{serviceName}/availableVersions";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t4);
} | java | public ArrayList<OvhAvailableVersionEnum> serviceName_availableVersions_GET(String serviceName) throws IOException {
String qPath = "/hosting/privateDatabase/{serviceName}/availableVersions";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t4);
} | [
"public",
"ArrayList",
"<",
"OvhAvailableVersionEnum",
">",
"serviceName_availableVersions_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/privateDatabase/{serviceName}/availableVersions\"",
";",
"StringBuilder",
"sb",
... | Get the availables versions for this private database
REST: GET /hosting/privateDatabase/{serviceName}/availableVersions
@param serviceName [required] The internal name of your private database | [
"Get",
"the",
"availables",
"versions",
"for",
"this",
"private",
"database"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java#L886-L891 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Flowable.java | Flowable.concatMapMaybeDelayError | @CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final <R> Flowable<R> concatMapMaybeDelayError(Function<? super T, ? extends MaybeSource<? extends R>> mapper, boolean tillTheEnd, int prefetch) {
ObjectHelper.requireNonNull(mapper, "mapper is null");
ObjectHelper.verifyPositive(prefetch, "prefetch");
return RxJavaPlugins.onAssembly(new FlowableConcatMapMaybe<T, R>(this, mapper, tillTheEnd ? ErrorMode.END : ErrorMode.BOUNDARY, prefetch));
} | java | @CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final <R> Flowable<R> concatMapMaybeDelayError(Function<? super T, ? extends MaybeSource<? extends R>> mapper, boolean tillTheEnd, int prefetch) {
ObjectHelper.requireNonNull(mapper, "mapper is null");
ObjectHelper.verifyPositive(prefetch, "prefetch");
return RxJavaPlugins.onAssembly(new FlowableConcatMapMaybe<T, R>(this, mapper, tillTheEnd ? ErrorMode.END : ErrorMode.BOUNDARY, prefetch));
} | [
"@",
"CheckReturnValue",
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"FULL",
")",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"<",
"R",
">",
"Flowable",
"<",
"R",
">",
"concatMapMaybeDelayError",
"(",
"Fun... | Maps the upstream items into {@link MaybeSource}s and subscribes to them one after the
other terminates, emits their success value if available and optionally delaying all errors
till both this {@code Flowable} and all inner {@code MaybeSource}s terminate.
<p>
<img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/concatMap.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator expects the upstream to support backpressure and honors
the backpressure from downstream. If this {@code Flowable} violates the rule, the operator will
signal a {@code MissingBackpressureException}.</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code concatMapMaybeDelayError} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
<p>History: 2.1.11 - experimental
@param <R> the result type of the inner {@code MaybeSource}s
@param mapper the function called with the upstream item and should return
a {@code MaybeSource} to become the next source to
be subscribed to
@param tillTheEnd If {@code true}, errors from this {@code Flowable} or any of the
inner {@code MaybeSource}s are delayed until all
of them terminate. If {@code false}, an error from this
{@code Flowable} is delayed until the current inner
{@code MaybeSource} terminates and only then is
it emitted to the downstream.
@param prefetch The number of upstream items to prefetch so that fresh items are
ready to be mapped when a previous {@code MaybeSource} terminates.
The operator replenishes after half of the prefetch amount has been consumed
and turned into {@code MaybeSource}s.
@return a new Flowable instance
@see #concatMapMaybe(Function, int)
@since 2.2 | [
"Maps",
"the",
"upstream",
"items",
"into",
"{"
] | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L7725-L7732 |
UrielCh/ovh-java-sdk | ovh-java-sdk-paastimeseries/src/main/java/net/minidev/ovh/api/ApiOvhPaastimeseries.java | ApiOvhPaastimeseries.serviceName_setup_POST | public OvhProject serviceName_setup_POST(String serviceName, String description, String displayName, String raTokenId, String raTokenKey, String regionId) throws IOException {
String qPath = "/paas/timeseries/{serviceName}/setup";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "displayName", displayName);
addBody(o, "raTokenId", raTokenId);
addBody(o, "raTokenKey", raTokenKey);
addBody(o, "regionId", regionId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhProject.class);
} | java | public OvhProject serviceName_setup_POST(String serviceName, String description, String displayName, String raTokenId, String raTokenKey, String regionId) throws IOException {
String qPath = "/paas/timeseries/{serviceName}/setup";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "displayName", displayName);
addBody(o, "raTokenId", raTokenId);
addBody(o, "raTokenKey", raTokenKey);
addBody(o, "regionId", regionId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhProject.class);
} | [
"public",
"OvhProject",
"serviceName_setup_POST",
"(",
"String",
"serviceName",
",",
"String",
"description",
",",
"String",
"displayName",
",",
"String",
"raTokenId",
",",
"String",
"raTokenKey",
",",
"String",
"regionId",
")",
"throws",
"IOException",
"{",
"String... | Setup a project
REST: POST /paas/timeseries/{serviceName}/setup
@param serviceName [required] Service Name
@param displayName [required] Project name
@param description [required] Project description
@param regionId [required] Region to use
@param raTokenId [required] Your runabove app token id
@param raTokenKey [required] Your runabove app token key
@deprecated | [
"Setup",
"a",
"project"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-paastimeseries/src/main/java/net/minidev/ovh/api/ApiOvhPaastimeseries.java#L128-L139 |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/storage/project/ProjectInitializer.java | ProjectInitializer.initializeInternalProject | public static void initializeInternalProject(CommandExecutor executor) {
final long creationTimeMillis = System.currentTimeMillis();
try {
executor.execute(createProject(creationTimeMillis, Author.SYSTEM, INTERNAL_PROJ))
.get();
} catch (Throwable cause) {
cause = Exceptions.peel(cause);
if (!(cause instanceof ProjectExistsException)) {
throw new Error("failed to initialize an internal project", cause);
}
}
// These repositories might be created when creating an internal project, but we try to create them
// again here in order to make sure them exist because sometimes their names are changed.
for (final String repo : ImmutableList.of(Project.REPO_META, Project.REPO_DOGMA)) {
try {
executor.execute(createRepository(creationTimeMillis, Author.SYSTEM, INTERNAL_PROJ, repo))
.get();
} catch (Throwable cause) {
cause = Exceptions.peel(cause);
if (!(cause instanceof RepositoryExistsException)) {
throw new Error(cause);
}
}
}
} | java | public static void initializeInternalProject(CommandExecutor executor) {
final long creationTimeMillis = System.currentTimeMillis();
try {
executor.execute(createProject(creationTimeMillis, Author.SYSTEM, INTERNAL_PROJ))
.get();
} catch (Throwable cause) {
cause = Exceptions.peel(cause);
if (!(cause instanceof ProjectExistsException)) {
throw new Error("failed to initialize an internal project", cause);
}
}
// These repositories might be created when creating an internal project, but we try to create them
// again here in order to make sure them exist because sometimes their names are changed.
for (final String repo : ImmutableList.of(Project.REPO_META, Project.REPO_DOGMA)) {
try {
executor.execute(createRepository(creationTimeMillis, Author.SYSTEM, INTERNAL_PROJ, repo))
.get();
} catch (Throwable cause) {
cause = Exceptions.peel(cause);
if (!(cause instanceof RepositoryExistsException)) {
throw new Error(cause);
}
}
}
} | [
"public",
"static",
"void",
"initializeInternalProject",
"(",
"CommandExecutor",
"executor",
")",
"{",
"final",
"long",
"creationTimeMillis",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"try",
"{",
"executor",
".",
"execute",
"(",
"createProject",
"(",... | Creates an internal project and repositories such as a token storage. | [
"Creates",
"an",
"internal",
"project",
"and",
"repositories",
"such",
"as",
"a",
"token",
"storage",
"."
] | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/storage/project/ProjectInitializer.java#L38-L62 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_gaxpy.java | Dcs_gaxpy.cs_gaxpy | public static boolean cs_gaxpy(Dcs A, double[] x, double[] y) {
int p, j, n, Ap[], Ai[];
double Ax[];
if (!Dcs_util.CS_CSC(A) || x == null || y == null)
return (false); /* check inputs */
n = A.n;
Ap = A.p;
Ai = A.i;
Ax = A.x;
for (j = 0; j < n; j++) {
for (p = Ap[j]; p < Ap[j + 1]; p++) {
y[Ai[p]] += Ax[p] * x[j];
}
}
return (true);
} | java | public static boolean cs_gaxpy(Dcs A, double[] x, double[] y) {
int p, j, n, Ap[], Ai[];
double Ax[];
if (!Dcs_util.CS_CSC(A) || x == null || y == null)
return (false); /* check inputs */
n = A.n;
Ap = A.p;
Ai = A.i;
Ax = A.x;
for (j = 0; j < n; j++) {
for (p = Ap[j]; p < Ap[j + 1]; p++) {
y[Ai[p]] += Ax[p] * x[j];
}
}
return (true);
} | [
"public",
"static",
"boolean",
"cs_gaxpy",
"(",
"Dcs",
"A",
",",
"double",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
")",
"{",
"int",
"p",
",",
"j",
",",
"n",
",",
"Ap",
"[",
"]",
",",
"Ai",
"[",
"]",
";",
"double",
"Ax",
"[",
"]",
";",
... | Sparse matrix times dense column vector, y = A*x+y.
@param A
column-compressed matrix
@param x
size n, vector x
@param y
size m, vector y
@return true if successful, false on error | [
"Sparse",
"matrix",
"times",
"dense",
"column",
"vector",
"y",
"=",
"A",
"*",
"x",
"+",
"y",
"."
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_gaxpy.java#L48-L63 |
wcm-io/wcm-io-caconfig | editor/bundle/src/main/java/io/wcm/caconfig/editor/impl/ConfigurationEditorFilterService.java | ConfigurationEditorFilterService.allowAdd | public boolean allowAdd(@NotNull Resource contextResource, @NotNull String configName) {
return serviceResolver.resolveAll(ConfigurationEditorFilter.class, contextResource).getServices()
.filter(filter -> !filter.allowAdd(configName))
.count() == 0;
} | java | public boolean allowAdd(@NotNull Resource contextResource, @NotNull String configName) {
return serviceResolver.resolveAll(ConfigurationEditorFilter.class, contextResource).getServices()
.filter(filter -> !filter.allowAdd(configName))
.count() == 0;
} | [
"public",
"boolean",
"allowAdd",
"(",
"@",
"NotNull",
"Resource",
"contextResource",
",",
"@",
"NotNull",
"String",
"configName",
")",
"{",
"return",
"serviceResolver",
".",
"resolveAll",
"(",
"ConfigurationEditorFilter",
".",
"class",
",",
"contextResource",
")",
... | Allow to add configurations with this name in the configuration editor.
@param contextResource Content resource
@param configName Configuration name
@return if true, the configuration is offered in the "add configuration" dialog | [
"Allow",
"to",
"add",
"configurations",
"with",
"this",
"name",
"in",
"the",
"configuration",
"editor",
"."
] | train | https://github.com/wcm-io/wcm-io-caconfig/blob/48592eadb0b62a09eec555cedfae7e00b213f6ed/editor/bundle/src/main/java/io/wcm/caconfig/editor/impl/ConfigurationEditorFilterService.java#L45-L49 |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.initActionButtonAttrs | private void initActionButtonAttrs(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
TypedArray attributes = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ActionButton,
defStyleAttr, defStyleRes);
try {
initType(attributes);
initSize(attributes);
initButtonColor(attributes);
initButtonColorPressed(attributes);
initRippleEffectEnabled(attributes);
initButtonColorRipple(attributes);
initShadowRadius(attributes);
initShadowXOffset(attributes);
initShadowYOffset(attributes);
initShadowColor(attributes);
initShadowResponsiveEffectEnabled(attributes);
initStrokeWidth(attributes);
initStrokeColor(attributes);
initImage(attributes);
initImageSize(attributes);
initShowAnimation(attributes);
initHideAnimation(attributes);
} catch (Exception e) {
LOGGER.trace("Failed to read attribute", e);
} finally {
attributes.recycle();
}
LOGGER.trace("Successfully initialized the Action Button attributes");
} | java | private void initActionButtonAttrs(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
TypedArray attributes = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ActionButton,
defStyleAttr, defStyleRes);
try {
initType(attributes);
initSize(attributes);
initButtonColor(attributes);
initButtonColorPressed(attributes);
initRippleEffectEnabled(attributes);
initButtonColorRipple(attributes);
initShadowRadius(attributes);
initShadowXOffset(attributes);
initShadowYOffset(attributes);
initShadowColor(attributes);
initShadowResponsiveEffectEnabled(attributes);
initStrokeWidth(attributes);
initStrokeColor(attributes);
initImage(attributes);
initImageSize(attributes);
initShowAnimation(attributes);
initHideAnimation(attributes);
} catch (Exception e) {
LOGGER.trace("Failed to read attribute", e);
} finally {
attributes.recycle();
}
LOGGER.trace("Successfully initialized the Action Button attributes");
} | [
"private",
"void",
"initActionButtonAttrs",
"(",
"Context",
"context",
",",
"AttributeSet",
"attrs",
",",
"int",
"defStyleAttr",
",",
"int",
"defStyleRes",
")",
"{",
"TypedArray",
"attributes",
"=",
"context",
".",
"getTheme",
"(",
")",
".",
"obtainStyledAttribute... | Initializes the <b>Action Button</b> attributes, declared within XML resource
<p>
Makes calls to different initialization methods for parameters initialization.
For those parameters, which are not declared in the XML resource,
the default value will be used
@param context context the view is running in
@param attrs attributes of the XML tag that is inflating the view
@param defStyleAttr attribute in the current theme that contains a
reference to a style resource that supplies default values for
the view. Can be 0 to not look for defaults
@param defStyleRes resource identifier of a style resource that
supplies default values for the view, used only if
defStyleAttr is 0 or can not be found in the theme. Can be 0
to not look for defaults | [
"Initializes",
"the",
"<b",
">",
"Action",
"Button<",
"/",
"b",
">",
"attributes",
"declared",
"within",
"XML",
"resource",
"<p",
">",
"Makes",
"calls",
"to",
"different",
"initialization",
"methods",
"for",
"parameters",
"initialization",
".",
"For",
"those",
... | train | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L286-L313 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/OracleHelper.java | OracleHelper.setReadOnly | @Override
public void setReadOnly(WSRdbManagedConnectionImpl managedConn, boolean readOnly, boolean externalCall)
throws SQLException {
if (tc.isDebugEnabled())
Tr.debug(this, tc, "setReadOnly", managedConn, readOnly, externalCall);
if (externalCall)
{
if (readOnly) {
// Fix this message later
throw new SQLException(AdapterUtil.getNLSMessage("METHOD_UNSUPPORTED", "setReadOnly", Connection.class.getName()));
} else {
// ignore it but log an informational message stating that we won't start a transaction
Tr.info(tc, "ORA_READONLY");
}
} else
{
if (tc.isDebugEnabled())
Tr.debug(this, tc, "setReadOnly ignored for internal call");
}
} | java | @Override
public void setReadOnly(WSRdbManagedConnectionImpl managedConn, boolean readOnly, boolean externalCall)
throws SQLException {
if (tc.isDebugEnabled())
Tr.debug(this, tc, "setReadOnly", managedConn, readOnly, externalCall);
if (externalCall)
{
if (readOnly) {
// Fix this message later
throw new SQLException(AdapterUtil.getNLSMessage("METHOD_UNSUPPORTED", "setReadOnly", Connection.class.getName()));
} else {
// ignore it but log an informational message stating that we won't start a transaction
Tr.info(tc, "ORA_READONLY");
}
} else
{
if (tc.isDebugEnabled())
Tr.debug(this, tc, "setReadOnly ignored for internal call");
}
} | [
"@",
"Override",
"public",
"void",
"setReadOnly",
"(",
"WSRdbManagedConnectionImpl",
"managedConn",
",",
"boolean",
"readOnly",
",",
"boolean",
"externalCall",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
... | <p>This method is used to do special handling for readOnly when method setReadOnly is called.
If readOnly is true, an SQLException is thrown. If readOnly is false, we ignore it
and log an informational message.</p>
@param managedConn WSRdbManagedConnectionImpl object
@param readOnly The readOnly value going to be set
@param externalCall indicates if caller is WAS or user application, | [
"<p",
">",
"This",
"method",
"is",
"used",
"to",
"do",
"special",
"handling",
"for",
"readOnly",
"when",
"method",
"setReadOnly",
"is",
"called",
".",
"If",
"readOnly",
"is",
"true",
"an",
"SQLException",
"is",
"thrown",
".",
"If",
"readOnly",
"is",
"false... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/OracleHelper.java#L697-L718 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/DatabaseHelper.java | DatabaseHelper.psSetBytes | public void psSetBytes(PreparedStatement pstmtImpl, int i, byte[] x) throws SQLException {
pstmtImpl.setBytes(i, x);
} | java | public void psSetBytes(PreparedStatement pstmtImpl, int i, byte[] x) throws SQLException {
pstmtImpl.setBytes(i, x);
} | [
"public",
"void",
"psSetBytes",
"(",
"PreparedStatement",
"pstmtImpl",
",",
"int",
"i",
",",
"byte",
"[",
"]",
"x",
")",
"throws",
"SQLException",
"{",
"pstmtImpl",
".",
"setBytes",
"(",
"i",
",",
"x",
")",
";",
"}"
] | Allow for special handling of Oracle prepared statement setBytes
This method just does the normal setBytes call, Oracle helper overrides it | [
"Allow",
"for",
"special",
"handling",
"of",
"Oracle",
"prepared",
"statement",
"setBytes",
"This",
"method",
"just",
"does",
"the",
"normal",
"setBytes",
"call",
"Oracle",
"helper",
"overrides",
"it"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/DatabaseHelper.java#L615-L617 |
dlew/joda-time-android | library/src/main/java/net/danlew/android/joda/DateUtils.java | DateUtils.formatDateTime | public static String formatDateTime(Context context, ReadablePartial time, int flags) {
return android.text.format.DateUtils.formatDateTime(context, toMillis(time), flags | FORMAT_UTC);
} | java | public static String formatDateTime(Context context, ReadablePartial time, int flags) {
return android.text.format.DateUtils.formatDateTime(context, toMillis(time), flags | FORMAT_UTC);
} | [
"public",
"static",
"String",
"formatDateTime",
"(",
"Context",
"context",
",",
"ReadablePartial",
"time",
",",
"int",
"flags",
")",
"{",
"return",
"android",
".",
"text",
".",
"format",
".",
"DateUtils",
".",
"formatDateTime",
"(",
"context",
",",
"toMillis",... | Formats a date or a time according to the local conventions.
Since ReadablePartials don't support all fields, we fill in any blanks
needed for formatting by using the epoch (1970-01-01T00:00:00Z).
See {@link android.text.format.DateUtils#formatDateTime} for full docs.
@param context the context is required only if the time is shown
@param time a point in time
@param flags a bit mask of formatting options
@return a string containing the formatted date/time. | [
"Formats",
"a",
"date",
"or",
"a",
"time",
"according",
"to",
"the",
"local",
"conventions",
"."
] | train | https://github.com/dlew/joda-time-android/blob/5bf96f6ef4ea63ee91e73e1e528896fa00108dec/library/src/main/java/net/danlew/android/joda/DateUtils.java#L79-L81 |
before/uadetector | modules/uadetector-core/src/main/java/net/sf/uadetector/internal/util/FileUtil.java | FileUtil.isEmpty | public static boolean isEmpty(final File file, final Charset charset) throws IOException {
boolean empty = false;
BufferedReader reader = null;
boolean threw = true;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), charset));
final String line = reader.readLine();
empty = line == null;
threw = false;
} finally {
Closeables.close(reader, threw);
}
return empty;
} | java | public static boolean isEmpty(final File file, final Charset charset) throws IOException {
boolean empty = false;
BufferedReader reader = null;
boolean threw = true;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), charset));
final String line = reader.readLine();
empty = line == null;
threw = false;
} finally {
Closeables.close(reader, threw);
}
return empty;
} | [
"public",
"static",
"boolean",
"isEmpty",
"(",
"final",
"File",
"file",
",",
"final",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"boolean",
"empty",
"=",
"false",
";",
"BufferedReader",
"reader",
"=",
"null",
";",
"boolean",
"threw",
"=",
"true... | Checks if the given file is empty.
@param file
the file that could be empty
@return {@code true} when the file is accessible and empty otherwise {@code false}
@throws IOException
if an I/O error occurs | [
"Checks",
"if",
"the",
"given",
"file",
"is",
"empty",
"."
] | train | https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/internal/util/FileUtil.java#L41-L54 |
mbrade/prefixedproperties | pp-core/src/main/java/net/sf/prefixedproperties/PrefixedProperties.java | PrefixedProperties.getProperty | @Override
public String getProperty(final String value, final String def) {
final String result = getProperty(value);
return result == null ? def : result;
} | java | @Override
public String getProperty(final String value, final String def) {
final String result = getProperty(value);
return result == null ? def : result;
} | [
"@",
"Override",
"public",
"String",
"getProperty",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"def",
")",
"{",
"final",
"String",
"result",
"=",
"getProperty",
"(",
"value",
")",
";",
"return",
"result",
"==",
"null",
"?",
"def",
":",
"res... | Gets the property.
@param value
the value
@param def
the def
@return the property | [
"Gets",
"the",
"property",
"."
] | train | https://github.com/mbrade/prefixedproperties/blob/ac430409ea37e244158002b3cf1504417835a0b2/pp-core/src/main/java/net/sf/prefixedproperties/PrefixedProperties.java#L1351-L1355 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java | ToUnknownStream.ignorableWhitespace | public void ignorableWhitespace(char[] ch, int start, int length)
throws SAXException
{
if (m_firstTagNotEmitted)
{
flush();
}
m_handler.ignorableWhitespace(ch, start, length);
} | java | public void ignorableWhitespace(char[] ch, int start, int length)
throws SAXException
{
if (m_firstTagNotEmitted)
{
flush();
}
m_handler.ignorableWhitespace(ch, start, length);
} | [
"public",
"void",
"ignorableWhitespace",
"(",
"char",
"[",
"]",
"ch",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"m_firstTagNotEmitted",
")",
"{",
"flush",
"(",
")",
";",
"}",
"m_handler",
".",
"ignorableWhite... | Pass the call on to the underlying handler
@see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) | [
"Pass",
"the",
"call",
"on",
"to",
"the",
"underlying",
"handler"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java#L839-L847 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_account_primaryEmailAddress_protocol_PUT | public void organizationName_service_exchangeService_account_primaryEmailAddress_protocol_PUT(String organizationName, String exchangeService, String primaryEmailAddress, OvhExchangeAccountProtocol body) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/account/{primaryEmailAddress}/protocol";
StringBuilder sb = path(qPath, organizationName, exchangeService, primaryEmailAddress);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void organizationName_service_exchangeService_account_primaryEmailAddress_protocol_PUT(String organizationName, String exchangeService, String primaryEmailAddress, OvhExchangeAccountProtocol body) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/account/{primaryEmailAddress}/protocol";
StringBuilder sb = path(qPath, organizationName, exchangeService, primaryEmailAddress);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"organizationName_service_exchangeService_account_primaryEmailAddress_protocol_PUT",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"primaryEmailAddress",
",",
"OvhExchangeAccountProtocol",
"body",
")",
"throws",
"IOException",... | Alter this object properties
REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/account/{primaryEmailAddress}/protocol
@param body [required] New object properties
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param primaryEmailAddress [required] Default email for this mailbox | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L1625-L1629 |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java | WarUtils.addEnvContextParam | public static void addEnvContextParam(Document doc, Element root) {
Element ctxParam = doc.createElement("context-param");
Element paramName = doc.createElement("param-name");
paramName.appendChild(doc.createTextNode("shiroEnvironmentClass"));
ctxParam.appendChild(paramName);
Element paramValue = doc.createElement("param-value");
paramValue.appendChild(doc.createTextNode("com.meltmedia.cadmium.servlets.shiro.WebEnvironment"));
ctxParam.appendChild(paramValue);
addRelativeTo(root, ctxParam, "listener", false);
} | java | public static void addEnvContextParam(Document doc, Element root) {
Element ctxParam = doc.createElement("context-param");
Element paramName = doc.createElement("param-name");
paramName.appendChild(doc.createTextNode("shiroEnvironmentClass"));
ctxParam.appendChild(paramName);
Element paramValue = doc.createElement("param-value");
paramValue.appendChild(doc.createTextNode("com.meltmedia.cadmium.servlets.shiro.WebEnvironment"));
ctxParam.appendChild(paramValue);
addRelativeTo(root, ctxParam, "listener", false);
} | [
"public",
"static",
"void",
"addEnvContextParam",
"(",
"Document",
"doc",
",",
"Element",
"root",
")",
"{",
"Element",
"ctxParam",
"=",
"doc",
".",
"createElement",
"(",
"\"context-param\"",
")",
";",
"Element",
"paramName",
"=",
"doc",
".",
"createElement",
"... | Adds a context parameter to a web.xml file to override where the shiro environment class.
@param doc The xml DOM document to create the new xml elements with.
@param root The xml Element node to add the context param to. | [
"Adds",
"a",
"context",
"parameter",
"to",
"a",
"web",
".",
"xml",
"file",
"to",
"override",
"where",
"the",
"shiro",
"environment",
"class",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L296-L306 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/backup_file.java | backup_file.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
backup_file_responses result = (backup_file_responses) service.get_payload_formatter().string_to_resource(backup_file_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.backup_file_response_array);
}
backup_file[] result_backup_file = new backup_file[result.backup_file_response_array.length];
for(int i = 0; i < result.backup_file_response_array.length; i++)
{
result_backup_file[i] = result.backup_file_response_array[i].backup_file[0];
}
return result_backup_file;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
backup_file_responses result = (backup_file_responses) service.get_payload_formatter().string_to_resource(backup_file_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.backup_file_response_array);
}
backup_file[] result_backup_file = new backup_file[result.backup_file_response_array.length];
for(int i = 0; i < result.backup_file_response_array.length; i++)
{
result_backup_file[i] = result.backup_file_response_array[i].backup_file[0];
}
return result_backup_file;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"backup_file_responses",
"result",
"=",
"(",
"backup_file_responses",
")",
"service",
".",
"get_payload_format... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/backup_file.java#L265-L282 |
grails/grails-core | grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java | GrailsASTUtils.buildPutMapExpression | public static MethodCallExpression buildPutMapExpression(final Expression objectExpression, final String keyName, final Expression valueExpression) {
return applyDefaultMethodTarget(new MethodCallExpression(objectExpression, "put", new ArgumentListExpression(new ConstantExpression(keyName), valueExpression)), Map.class);
} | java | public static MethodCallExpression buildPutMapExpression(final Expression objectExpression, final String keyName, final Expression valueExpression) {
return applyDefaultMethodTarget(new MethodCallExpression(objectExpression, "put", new ArgumentListExpression(new ConstantExpression(keyName), valueExpression)), Map.class);
} | [
"public",
"static",
"MethodCallExpression",
"buildPutMapExpression",
"(",
"final",
"Expression",
"objectExpression",
",",
"final",
"String",
"keyName",
",",
"final",
"Expression",
"valueExpression",
")",
"{",
"return",
"applyDefaultMethodTarget",
"(",
"new",
"MethodCallEx... | Build static direct call to put entry in Map
@param objectExpression
@param keyName
@param valueExpression
@return The method call expression | [
"Build",
"static",
"direct",
"call",
"to",
"put",
"entry",
"in",
"Map"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L1351-L1353 |
Frostman/dropbox4j | src/main/java/ru/frostman/dropbox/api/DropboxClient.java | DropboxClient.putFile | public void putFile(File file, String path) throws IOException {
OAuthRequest request = new OAuthRequest(Verb.POST, FILES_URL + encode(path));
Multipart.attachFile(file, request);
service.signRequest(accessToken, request);
checkFiles(request.send());
} | java | public void putFile(File file, String path) throws IOException {
OAuthRequest request = new OAuthRequest(Verb.POST, FILES_URL + encode(path));
Multipart.attachFile(file, request);
service.signRequest(accessToken, request);
checkFiles(request.send());
} | [
"public",
"void",
"putFile",
"(",
"File",
"file",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"OAuthRequest",
"request",
"=",
"new",
"OAuthRequest",
"(",
"Verb",
".",
"POST",
",",
"FILES_URL",
"+",
"encode",
"(",
"path",
")",
")",
";",
"Mul... | Upload specified file to specified folder.
@param file to upload
@param path of target folder
@throws IOException iff exception while accessing file | [
"Upload",
"specified",
"file",
"to",
"specified",
"folder",
"."
] | train | https://github.com/Frostman/dropbox4j/blob/774c817e5bf294d0139ecb5ac81399be50ada5e0/src/main/java/ru/frostman/dropbox/api/DropboxClient.java#L277-L283 |
dbracewell/hermes | hermes-core/src/main/java/com/davidbracewell/hermes/corpus/processing/TermExtractionProcessor.java | TermExtractionProcessor.onComplete | protected Corpus onComplete(Corpus corpus, ProcessorContext context, Counter<String> counts) {
return corpus;
} | java | protected Corpus onComplete(Corpus corpus, ProcessorContext context, Counter<String> counts) {
return corpus;
} | [
"protected",
"Corpus",
"onComplete",
"(",
"Corpus",
"corpus",
",",
"ProcessorContext",
"context",
",",
"Counter",
"<",
"String",
">",
"counts",
")",
"{",
"return",
"corpus",
";",
"}"
] | On complete corpus.
@param corpus the corpus
@param context the context
@param counts the counts
@return the corpus | [
"On",
"complete",
"corpus",
"."
] | train | https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/corpus/processing/TermExtractionProcessor.java#L73-L75 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java | StrSpliter.splitByRegex | public static List<String> splitByRegex(String str, String separatorRegex, int limit, boolean isTrim, boolean ignoreEmpty){
final Pattern pattern = PatternPool.get(separatorRegex);
return split(str, pattern, limit, isTrim, ignoreEmpty);
} | java | public static List<String> splitByRegex(String str, String separatorRegex, int limit, boolean isTrim, boolean ignoreEmpty){
final Pattern pattern = PatternPool.get(separatorRegex);
return split(str, pattern, limit, isTrim, ignoreEmpty);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"splitByRegex",
"(",
"String",
"str",
",",
"String",
"separatorRegex",
",",
"int",
"limit",
",",
"boolean",
"isTrim",
",",
"boolean",
"ignoreEmpty",
")",
"{",
"final",
"Pattern",
"pattern",
"=",
"PatternPool",
... | 通过正则切分字符串
@param str 字符串
@param separatorRegex 分隔符正则
@param limit 限制分片数
@param isTrim 是否去除切分字符串后每个元素两边的空格
@param ignoreEmpty 是否忽略空串
@return 切分后的集合
@since 3.0.8 | [
"通过正则切分字符串"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java#L399-L402 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java | Query.endBefore | @Nonnull
public Query endBefore(@Nonnull DocumentSnapshot snapshot) {
QueryOptions newOptions = new QueryOptions(options);
newOptions.fieldOrders = createImplicitOrderBy();
newOptions.endCursor = createCursor(newOptions.fieldOrders, snapshot, true);
return new Query(firestore, path, newOptions);
} | java | @Nonnull
public Query endBefore(@Nonnull DocumentSnapshot snapshot) {
QueryOptions newOptions = new QueryOptions(options);
newOptions.fieldOrders = createImplicitOrderBy();
newOptions.endCursor = createCursor(newOptions.fieldOrders, snapshot, true);
return new Query(firestore, path, newOptions);
} | [
"@",
"Nonnull",
"public",
"Query",
"endBefore",
"(",
"@",
"Nonnull",
"DocumentSnapshot",
"snapshot",
")",
"{",
"QueryOptions",
"newOptions",
"=",
"new",
"QueryOptions",
"(",
"options",
")",
";",
"newOptions",
".",
"fieldOrders",
"=",
"createImplicitOrderBy",
"(",
... | Creates and returns a new Query that ends before the provided document (exclusive). The end
position is relative to the order of the query. The document must contain all of the fields
provided in the orderBy of this query.
@param snapshot The snapshot of the document to end before.
@return The created Query. | [
"Creates",
"and",
"returns",
"a",
"new",
"Query",
"that",
"ends",
"before",
"the",
"provided",
"document",
"(",
"exclusive",
")",
".",
"The",
"end",
"position",
"is",
"relative",
"to",
"the",
"order",
"of",
"the",
"query",
".",
"The",
"document",
"must",
... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L812-L818 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlGraphicsContext.java | VmlGraphicsContext.setSize | public void setSize(int newWidth, int newHeight) {
this.width = newWidth;
this.height = newHeight;
if (helper.getRootElement() != null) {
applyElementSize(helper.getRootElement(), newWidth, newHeight, false);
Dom.setStyleAttribute(helper.getRootElement(), "clip", "rect(0 " + newWidth + "px " + newHeight + "px 0)");
} else {
SC.logWarn("problems");
}
} | java | public void setSize(int newWidth, int newHeight) {
this.width = newWidth;
this.height = newHeight;
if (helper.getRootElement() != null) {
applyElementSize(helper.getRootElement(), newWidth, newHeight, false);
Dom.setStyleAttribute(helper.getRootElement(), "clip", "rect(0 " + newWidth + "px " + newHeight + "px 0)");
} else {
SC.logWarn("problems");
}
} | [
"public",
"void",
"setSize",
"(",
"int",
"newWidth",
",",
"int",
"newHeight",
")",
"{",
"this",
".",
"width",
"=",
"newWidth",
";",
"this",
".",
"height",
"=",
"newHeight",
";",
"if",
"(",
"helper",
".",
"getRootElement",
"(",
")",
"!=",
"null",
")",
... | Apply a new size on the graphics context.
@param newWidth
The new newWidth in pixels for this graphics context.
@param newHeight
The new newHeight in pixels for this graphics context. | [
"Apply",
"a",
"new",
"size",
"on",
"the",
"graphics",
"context",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlGraphicsContext.java#L664-L674 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java | ElementKindVisitor6.visitExecutable | @Override
public R visitExecutable(ExecutableElement e, P p) {
ElementKind k = e.getKind();
switch(k) {
case CONSTRUCTOR:
return visitExecutableAsConstructor(e, p);
case INSTANCE_INIT:
return visitExecutableAsInstanceInit(e, p);
case METHOD:
return visitExecutableAsMethod(e, p);
case STATIC_INIT:
return visitExecutableAsStaticInit(e, p);
default:
throw new AssertionError("Bad kind " + k + " for ExecutableElement" + e);
}
} | java | @Override
public R visitExecutable(ExecutableElement e, P p) {
ElementKind k = e.getKind();
switch(k) {
case CONSTRUCTOR:
return visitExecutableAsConstructor(e, p);
case INSTANCE_INIT:
return visitExecutableAsInstanceInit(e, p);
case METHOD:
return visitExecutableAsMethod(e, p);
case STATIC_INIT:
return visitExecutableAsStaticInit(e, p);
default:
throw new AssertionError("Bad kind " + k + " for ExecutableElement" + e);
}
} | [
"@",
"Override",
"public",
"R",
"visitExecutable",
"(",
"ExecutableElement",
"e",
",",
"P",
"p",
")",
"{",
"ElementKind",
"k",
"=",
"e",
".",
"getKind",
"(",
")",
";",
"switch",
"(",
"k",
")",
"{",
"case",
"CONSTRUCTOR",
":",
"return",
"visitExecutableAs... | Visits an executable element, dispatching to the visit method
for the specific {@linkplain ElementKind kind} of executable,
{@code CONSTRUCTOR}, {@code INSTANCE_INIT}, {@code METHOD}, or
{@code STATIC_INIT}.
@param e {@inheritDoc}
@param p {@inheritDoc}
@return the result of the kind-specific visit method | [
"Visits",
"an",
"executable",
"element",
"dispatching",
"to",
"the",
"visit",
"method",
"for",
"the",
"specific",
"{",
"@linkplain",
"ElementKind",
"kind",
"}",
"of",
"executable",
"{",
"@code",
"CONSTRUCTOR",
"}",
"{",
"@code",
"INSTANCE_INIT",
"}",
"{",
"@co... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java#L327-L346 |
alkacon/opencms-core | src/org/opencms/xml/content/CmsXmlContent.java | CmsXmlContent.removeSurplusValuesInOtherLocales | private void removeSurplusValuesInOtherLocales(String elementPath, int valueCount, Locale sourceLocale) {
for (Locale locale : getLocales()) {
if (locale.equals(sourceLocale)) {
continue;
}
List<I_CmsXmlContentValue> localeValues = getValues(elementPath, locale);
for (int i = valueCount; i < localeValues.size(); i++) {
removeValue(elementPath, locale, 0);
}
}
} | java | private void removeSurplusValuesInOtherLocales(String elementPath, int valueCount, Locale sourceLocale) {
for (Locale locale : getLocales()) {
if (locale.equals(sourceLocale)) {
continue;
}
List<I_CmsXmlContentValue> localeValues = getValues(elementPath, locale);
for (int i = valueCount; i < localeValues.size(); i++) {
removeValue(elementPath, locale, 0);
}
}
} | [
"private",
"void",
"removeSurplusValuesInOtherLocales",
"(",
"String",
"elementPath",
",",
"int",
"valueCount",
",",
"Locale",
"sourceLocale",
")",
"{",
"for",
"(",
"Locale",
"locale",
":",
"getLocales",
"(",
")",
")",
"{",
"if",
"(",
"locale",
".",
"equals",
... | Removes all surplus values of locale independent fields in the other locales.<p>
@param elementPath the element path
@param valueCount the value count
@param sourceLocale the source locale | [
"Removes",
"all",
"surplus",
"values",
"of",
"locale",
"independent",
"fields",
"in",
"the",
"other",
"locales",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContent.java#L1093-L1104 |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java | PipelineBuilder.addRangeExpr | public void addRangeExpr(final INodeReadTrx mTransaction) {
assert getPipeStack().size() >= 2;
final AbsAxis mOperand2 = getPipeStack().pop().getExpr();
final AbsAxis mOperand1 = getPipeStack().pop().getExpr();
final AbsAxis axis = new RangeAxis(mTransaction, mOperand1, mOperand2);
if (getPipeStack().empty() || getExpression().getSize() != 0) {
addExpressionSingle();
}
getExpression().add(axis);
} | java | public void addRangeExpr(final INodeReadTrx mTransaction) {
assert getPipeStack().size() >= 2;
final AbsAxis mOperand2 = getPipeStack().pop().getExpr();
final AbsAxis mOperand1 = getPipeStack().pop().getExpr();
final AbsAxis axis = new RangeAxis(mTransaction, mOperand1, mOperand2);
if (getPipeStack().empty() || getExpression().getSize() != 0) {
addExpressionSingle();
}
getExpression().add(axis);
} | [
"public",
"void",
"addRangeExpr",
"(",
"final",
"INodeReadTrx",
"mTransaction",
")",
"{",
"assert",
"getPipeStack",
"(",
")",
".",
"size",
"(",
")",
">=",
"2",
";",
"final",
"AbsAxis",
"mOperand2",
"=",
"getPipeStack",
"(",
")",
".",
"pop",
"(",
")",
"."... | Adds a range expression to the pipeline.
@param mTransaction
Transaction to operate with. | [
"Adds",
"a",
"range",
"expression",
"to",
"the",
"pipeline",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java#L645-L658 |
liferay/com-liferay-commerce | commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListItemPersistenceImpl.java | CommerceWishListItemPersistenceImpl.findByCW_CPI | @Override
public List<CommerceWishListItem> findByCW_CPI(long commerceWishListId,
String CPInstanceUuid, int start, int end) {
return findByCW_CPI(commerceWishListId, CPInstanceUuid, start, end, null);
} | java | @Override
public List<CommerceWishListItem> findByCW_CPI(long commerceWishListId,
String CPInstanceUuid, int start, int end) {
return findByCW_CPI(commerceWishListId, CPInstanceUuid, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceWishListItem",
">",
"findByCW_CPI",
"(",
"long",
"commerceWishListId",
",",
"String",
"CPInstanceUuid",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCW_CPI",
"(",
"commerceWishListId",
",",
"... | Returns a range of all the commerce wish list items where commerceWishListId = ? and CPInstanceUuid = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceWishListItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param commerceWishListId the commerce wish list ID
@param CPInstanceUuid the cp instance uuid
@param start the lower bound of the range of commerce wish list items
@param end the upper bound of the range of commerce wish list items (not inclusive)
@return the range of matching commerce wish list items | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"wish",
"list",
"items",
"where",
"commerceWishListId",
"=",
"?",
";",
"and",
"CPInstanceUuid",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListItemPersistenceImpl.java#L1758-L1762 |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlExceptionTranslator.java | PostgreSqlExceptionTranslator.translateInvalidIntegerException | static MolgenisValidationException translateInvalidIntegerException(PSQLException pSqlException) {
ServerErrorMessage serverErrorMessage = pSqlException.getServerErrorMessage();
String message = serverErrorMessage.getMessage();
Matcher matcher =
Pattern.compile("invalid input syntax for \\b(?:type )?\\b(.+?): \"(.*?)\"")
.matcher(message);
boolean matches = matcher.matches();
if (!matches) {
throw new RuntimeException(ERROR_TRANSLATING_EXCEPTION_MSG, pSqlException);
}
String postgreSqlType = matcher.group(1);
// convert PostgreSQL data type to attribute type:
String type;
switch (postgreSqlType) {
case "boolean":
type = BOOL.toString();
break;
case "date":
type = DATE.toString();
break;
case "timestamp with time zone":
type = DATE_TIME.toString();
break;
case "double precision":
type = DECIMAL.toString();
break;
case "integer":
type = INT.toString() + " or " + LONG.toString();
break;
default:
type = postgreSqlType;
break;
}
String value = matcher.group(2);
ConstraintViolation constraintViolation =
new ConstraintViolation(
format("Value [%s] of this entity attribute is not of type [%s].", value, type), null);
return new MolgenisValidationException(singleton(constraintViolation));
} | java | static MolgenisValidationException translateInvalidIntegerException(PSQLException pSqlException) {
ServerErrorMessage serverErrorMessage = pSqlException.getServerErrorMessage();
String message = serverErrorMessage.getMessage();
Matcher matcher =
Pattern.compile("invalid input syntax for \\b(?:type )?\\b(.+?): \"(.*?)\"")
.matcher(message);
boolean matches = matcher.matches();
if (!matches) {
throw new RuntimeException(ERROR_TRANSLATING_EXCEPTION_MSG, pSqlException);
}
String postgreSqlType = matcher.group(1);
// convert PostgreSQL data type to attribute type:
String type;
switch (postgreSqlType) {
case "boolean":
type = BOOL.toString();
break;
case "date":
type = DATE.toString();
break;
case "timestamp with time zone":
type = DATE_TIME.toString();
break;
case "double precision":
type = DECIMAL.toString();
break;
case "integer":
type = INT.toString() + " or " + LONG.toString();
break;
default:
type = postgreSqlType;
break;
}
String value = matcher.group(2);
ConstraintViolation constraintViolation =
new ConstraintViolation(
format("Value [%s] of this entity attribute is not of type [%s].", value, type), null);
return new MolgenisValidationException(singleton(constraintViolation));
} | [
"static",
"MolgenisValidationException",
"translateInvalidIntegerException",
"(",
"PSQLException",
"pSqlException",
")",
"{",
"ServerErrorMessage",
"serverErrorMessage",
"=",
"pSqlException",
".",
"getServerErrorMessage",
"(",
")",
";",
"String",
"message",
"=",
"serverErrorM... | Package private for testability
@param pSqlException PostgreSQL exception
@return translated validation exception | [
"Package",
"private",
"for",
"testability"
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlExceptionTranslator.java#L231-L271 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/query/Parser.java | Parser.findMinIfNot | private int findMinIfNot(int a, int b, int notMin) {
if (a <= notMin) {
return b;
}
if (b <= notMin) {
return a;
}
return Math.min(a, b);
} | java | private int findMinIfNot(int a, int b, int notMin) {
if (a <= notMin) {
return b;
}
if (b <= notMin) {
return a;
}
return Math.min(a, b);
} | [
"private",
"int",
"findMinIfNot",
"(",
"int",
"a",
",",
"int",
"b",
",",
"int",
"notMin",
")",
"{",
"if",
"(",
"a",
"<=",
"notMin",
")",
"{",
"return",
"b",
";",
"}",
"if",
"(",
"b",
"<=",
"notMin",
")",
"{",
"return",
"a",
";",
"}",
"return",
... | finds min choosing a lower bound.
@param a first number
@param b second number
@param notMin lower bound | [
"finds",
"min",
"choosing",
"a",
"lower",
"bound",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/Parser.java#L226-L234 |
aicer/hibiscus-http-client | src/main/java/org/aicer/hibiscus/util/HashGenerator.java | HashGenerator.getSHA1Hash | public static String getSHA1Hash(final String input) throws HibiscusException {
String hashValue = null;
try {
final MessageDigest messageDigest = MessageDigest.getInstance(MESSAGE_DIGEST_ALGORITHM_SHA1);
byte[] sha1Hash = new byte[BYTE_LENGTH_SHA1];
messageDigest.update(input.getBytes(ENCODING_CHARSET_NAME), MESSAGE_DIGEST_UPDATE_OFFSET, input.length());
sha1Hash = messageDigest.digest();
hashValue = convertToHex(sha1Hash);
} catch (NoSuchAlgorithmException e) {
throw new HibiscusException("Unsupported Message Digest Algorithm " + MESSAGE_DIGEST_ALGORITHM_SHA1, e);
} catch (UnsupportedEncodingException e) {
throw new HibiscusException("Unsupported Encoding " + ENCODING_CHARSET_NAME , e);
}
return hashValue;
} | java | public static String getSHA1Hash(final String input) throws HibiscusException {
String hashValue = null;
try {
final MessageDigest messageDigest = MessageDigest.getInstance(MESSAGE_DIGEST_ALGORITHM_SHA1);
byte[] sha1Hash = new byte[BYTE_LENGTH_SHA1];
messageDigest.update(input.getBytes(ENCODING_CHARSET_NAME), MESSAGE_DIGEST_UPDATE_OFFSET, input.length());
sha1Hash = messageDigest.digest();
hashValue = convertToHex(sha1Hash);
} catch (NoSuchAlgorithmException e) {
throw new HibiscusException("Unsupported Message Digest Algorithm " + MESSAGE_DIGEST_ALGORITHM_SHA1, e);
} catch (UnsupportedEncodingException e) {
throw new HibiscusException("Unsupported Encoding " + ENCODING_CHARSET_NAME , e);
}
return hashValue;
} | [
"public",
"static",
"String",
"getSHA1Hash",
"(",
"final",
"String",
"input",
")",
"throws",
"HibiscusException",
"{",
"String",
"hashValue",
"=",
"null",
";",
"try",
"{",
"final",
"MessageDigest",
"messageDigest",
"=",
"MessageDigest",
".",
"getInstance",
"(",
... | Returns the SHA1 hash of the input string
@param input Input string
@return String The sha1 hash of the input string
@throws HibiscusException | [
"Returns",
"the",
"SHA1",
"hash",
"of",
"the",
"input",
"string"
] | train | https://github.com/aicer/hibiscus-http-client/blob/a037e3cf8d4bb862d38a55a090778736a48d67cc/src/main/java/org/aicer/hibiscus/util/HashGenerator.java#L87-L108 |
roboconf/roboconf-platform | core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java | AgentUtils.changeRoboconfLogLevel | public static void changeRoboconfLogLevel( String logLevel, String etcDir )
throws IOException {
if( ! Utils.isEmptyOrWhitespaces( etcDir )) {
File f = new File( etcDir, AgentConstants.KARAF_LOG_CONF_FILE );
if( f.exists()) {
Properties props = Utils.readPropertiesFile( f );
props.put( "log4j.logger.net.roboconf", logLevel + ", roboconf" );
Utils.writePropertiesFile( props, f );
}
}
} | java | public static void changeRoboconfLogLevel( String logLevel, String etcDir )
throws IOException {
if( ! Utils.isEmptyOrWhitespaces( etcDir )) {
File f = new File( etcDir, AgentConstants.KARAF_LOG_CONF_FILE );
if( f.exists()) {
Properties props = Utils.readPropertiesFile( f );
props.put( "log4j.logger.net.roboconf", logLevel + ", roboconf" );
Utils.writePropertiesFile( props, f );
}
}
} | [
"public",
"static",
"void",
"changeRoboconfLogLevel",
"(",
"String",
"logLevel",
",",
"String",
"etcDir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"Utils",
".",
"isEmptyOrWhitespaces",
"(",
"etcDir",
")",
")",
"{",
"File",
"f",
"=",
"new",
"File",
... | Changes the level of the Roboconf logger.
<p>
This method assumes the default log configuration for a Roboconf
distribution has a certain shape. If a user manually changed the log
configuration (not the level, but the logger name, as an example), then
this will not work.
</p> | [
"Changes",
"the",
"level",
"of",
"the",
"Roboconf",
"logger",
".",
"<p",
">",
"This",
"method",
"assumes",
"the",
"default",
"log",
"configuration",
"for",
"a",
"Roboconf",
"distribution",
"has",
"a",
"certain",
"shape",
".",
"If",
"a",
"user",
"manually",
... | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java#L169-L181 |
qiujuer/Genius-Android | caprice/graphics/src/main/java/net/qiujuer/genius/graphics/Blur.java | Blur.onStackBlurClip | public static Bitmap onStackBlurClip(Bitmap original, int radius) {
Bitmap bitmap = checkSource(original, radius);
// Return this none blur
if (radius == 1) {
return bitmap;
}
int h = bitmap.getHeight();
int w = bitmap.getWidth();
final int clipPixels = 1024 * 256;
float clipScale = (h * w) / clipPixels;
int minLen = radius + radius + 50;
if (clipScale >= 2) {
float itemLen = h / clipScale;
itemLen = itemLen < minLen ? minLen : itemLen;
clipScale = h / itemLen;
}
if (clipScale < 2) {
//Jni BitMap Blur
nativeStackBlurBitmap(bitmap, radius);
} else {
if (clipScale > 12)
clipScale = 12;
//Jni BitMap Blur
onStackBlurClip(bitmap, radius, (int) clipScale);
}
return (bitmap);
} | java | public static Bitmap onStackBlurClip(Bitmap original, int radius) {
Bitmap bitmap = checkSource(original, radius);
// Return this none blur
if (radius == 1) {
return bitmap;
}
int h = bitmap.getHeight();
int w = bitmap.getWidth();
final int clipPixels = 1024 * 256;
float clipScale = (h * w) / clipPixels;
int minLen = radius + radius + 50;
if (clipScale >= 2) {
float itemLen = h / clipScale;
itemLen = itemLen < minLen ? minLen : itemLen;
clipScale = h / itemLen;
}
if (clipScale < 2) {
//Jni BitMap Blur
nativeStackBlurBitmap(bitmap, radius);
} else {
if (clipScale > 12)
clipScale = 12;
//Jni BitMap Blur
onStackBlurClip(bitmap, radius, (int) clipScale);
}
return (bitmap);
} | [
"public",
"static",
"Bitmap",
"onStackBlurClip",
"(",
"Bitmap",
"original",
",",
"int",
"radius",
")",
"{",
"Bitmap",
"bitmap",
"=",
"checkSource",
"(",
"original",
",",
"radius",
")",
";",
"// Return this none blur",
"if",
"(",
"radius",
"==",
"1",
")",
"{"... | StackBlur By Jni Bitmap
in this we will cut the source bitmap to some parts.
We'll deal(blur) with it one by one. This will reduce the memory consumption.
@param original Original Image
@param radius Blur radius
@return Image Bitmap | [
"StackBlur",
"By",
"Jni",
"Bitmap",
"in",
"this",
"we",
"will",
"cut",
"the",
"source",
"bitmap",
"to",
"some",
"parts",
".",
"We",
"ll",
"deal",
"(",
"blur",
")",
"with",
"it",
"one",
"by",
"one",
".",
"This",
"will",
"reduce",
"the",
"memory",
"con... | train | https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/graphics/src/main/java/net/qiujuer/genius/graphics/Blur.java#L72-L104 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java | Types.asSub | public Type asSub(Type t, Symbol sym) {
return asSub.visit(t, sym);
} | java | public Type asSub(Type t, Symbol sym) {
return asSub.visit(t, sym);
} | [
"public",
"Type",
"asSub",
"(",
"Type",
"t",
",",
"Symbol",
"sym",
")",
"{",
"return",
"asSub",
".",
"visit",
"(",
"t",
",",
"sym",
")",
";",
"}"
] | Return the least specific subtype of t that starts with symbol
sym. If none exists, return null. The least specific subtype
is determined as follows:
<p>If there is exactly one parameterized instance of sym that is a
subtype of t, that parameterized instance is returned.<br>
Otherwise, if the plain type or raw type `sym' is a subtype of
type t, the type `sym' itself is returned. Otherwise, null is
returned. | [
"Return",
"the",
"least",
"specific",
"subtype",
"of",
"t",
"that",
"starts",
"with",
"symbol",
"sym",
".",
"If",
"none",
"exists",
"return",
"null",
".",
"The",
"least",
"specific",
"subtype",
"is",
"determined",
"as",
"follows",
":"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L242-L244 |
JOML-CI/JOML | src/org/joml/Matrix3x2d.java | Matrix3x2d.get3x3 | public DoubleBuffer get3x3(int index, DoubleBuffer buffer) {
MemUtil.INSTANCE.put3x3(this, index, buffer);
return buffer;
} | java | public DoubleBuffer get3x3(int index, DoubleBuffer buffer) {
MemUtil.INSTANCE.put3x3(this, index, buffer);
return buffer;
} | [
"public",
"DoubleBuffer",
"get3x3",
"(",
"int",
"index",
",",
"DoubleBuffer",
"buffer",
")",
"{",
"MemUtil",
".",
"INSTANCE",
".",
"put3x3",
"(",
"this",
",",
"index",
",",
"buffer",
")",
";",
"return",
"buffer",
";",
"}"
] | Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied {@link DoubleBuffer} starting at the specified
absolute buffer position/index.
<p>
This method will not increment the position of the given DoubleBuffer.
@param index
the absolute position into the DoubleBuffer
@param buffer
will receive the values of this matrix in column-major order
@return the passed in buffer | [
"Store",
"this",
"matrix",
"as",
"an",
"equivalent",
"3x3",
"matrix",
"in",
"column",
"-",
"major",
"order",
"into",
"the",
"supplied",
"{",
"@link",
"DoubleBuffer",
"}",
"starting",
"at",
"the",
"specified",
"absolute",
"buffer",
"position",
"/",
"index",
"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2d.java#L912-L915 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/Utils.java | Utils.getMessage | @Trivial
public static final String getMessage(String key, Object... params) {
return TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), key, params, key);
} | java | @Trivial
public static final String getMessage(String key, Object... params) {
return TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), key, params, key);
} | [
"@",
"Trivial",
"public",
"static",
"final",
"String",
"getMessage",
"(",
"String",
"key",
",",
"Object",
"...",
"params",
")",
"{",
"return",
"TraceNLS",
".",
"getFormattedMessage",
"(",
"Utils",
".",
"class",
",",
"tc",
".",
"getResourceBundleName",
"(",
"... | Gets an NLS message.
@param key the message key
@param params the message parameters
@return formatted message | [
"Gets",
"an",
"NLS",
"message",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/Utils.java#L107-L110 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/inline/InlineRendition.java | InlineRendition.getScaledDimension | private Dimension getScaledDimension(Dimension originalDimension) {
// check if image has to be rescaled
Dimension requestedDimension = getRequestedDimension();
boolean scaleWidth = (requestedDimension.getWidth() > 0
&& requestedDimension.getWidth() != originalDimension.getWidth());
boolean scaleHeight = (requestedDimension.getHeight() > 0
&& requestedDimension.getHeight() != originalDimension.getHeight());
if (scaleWidth || scaleHeight) {
long requestedWidth = requestedDimension.getWidth();
long requestedHeight = requestedDimension.getHeight();
// calculate missing width/height from ratio if not specified
double imageRatio = (double)originalDimension.getWidth() / (double)originalDimension.getHeight();
if (requestedWidth == 0 && requestedHeight > 0) {
requestedWidth = (int)Math.round(requestedHeight * imageRatio);
}
else if (requestedWidth > 0 && requestedHeight == 0) {
requestedHeight = (int)Math.round(requestedWidth / imageRatio);
}
// calculate requested ratio
double requestedRatio = (double)requestedWidth / (double)requestedHeight;
// if ratio does not match, or requested width/height is larger than the original image scaling is not possible
if (!Ratio.matches(imageRatio, requestedRatio)
|| (originalDimension.getWidth() < requestedWidth)
|| (originalDimension.getHeight() < requestedHeight)) {
return SCALING_NOT_POSSIBLE_DIMENSION;
}
else {
return new Dimension(requestedWidth, requestedHeight);
}
}
return null;
} | java | private Dimension getScaledDimension(Dimension originalDimension) {
// check if image has to be rescaled
Dimension requestedDimension = getRequestedDimension();
boolean scaleWidth = (requestedDimension.getWidth() > 0
&& requestedDimension.getWidth() != originalDimension.getWidth());
boolean scaleHeight = (requestedDimension.getHeight() > 0
&& requestedDimension.getHeight() != originalDimension.getHeight());
if (scaleWidth || scaleHeight) {
long requestedWidth = requestedDimension.getWidth();
long requestedHeight = requestedDimension.getHeight();
// calculate missing width/height from ratio if not specified
double imageRatio = (double)originalDimension.getWidth() / (double)originalDimension.getHeight();
if (requestedWidth == 0 && requestedHeight > 0) {
requestedWidth = (int)Math.round(requestedHeight * imageRatio);
}
else if (requestedWidth > 0 && requestedHeight == 0) {
requestedHeight = (int)Math.round(requestedWidth / imageRatio);
}
// calculate requested ratio
double requestedRatio = (double)requestedWidth / (double)requestedHeight;
// if ratio does not match, or requested width/height is larger than the original image scaling is not possible
if (!Ratio.matches(imageRatio, requestedRatio)
|| (originalDimension.getWidth() < requestedWidth)
|| (originalDimension.getHeight() < requestedHeight)) {
return SCALING_NOT_POSSIBLE_DIMENSION;
}
else {
return new Dimension(requestedWidth, requestedHeight);
}
}
return null;
} | [
"private",
"Dimension",
"getScaledDimension",
"(",
"Dimension",
"originalDimension",
")",
"{",
"// check if image has to be rescaled",
"Dimension",
"requestedDimension",
"=",
"getRequestedDimension",
"(",
")",
";",
"boolean",
"scaleWidth",
"=",
"(",
"requestedDimension",
".... | Checks if the current binary is an image and has to be scaled. In this case the destination dimension is returned.
@return Scaled destination or null if no scaling is required. If a destination object with both
width and height set to -1 is returned, a scaling is required but not possible with the given source
object. | [
"Checks",
"if",
"the",
"current",
"binary",
"is",
"an",
"image",
"and",
"has",
"to",
"be",
"scaled",
".",
"In",
"this",
"case",
"the",
"destination",
"dimension",
"is",
"returned",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/inline/InlineRendition.java#L150-L187 |
rey5137/material | material/src/main/java/com/rey/material/widget/EditText.java | EditText.setCompoundDrawablesRelativeWithIntrinsicBounds | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public void setCompoundDrawablesRelativeWithIntrinsicBounds (Drawable start, Drawable top, Drawable end, Drawable bottom){
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
mInputView.setCompoundDrawablesRelativeWithIntrinsicBounds(start, top, end, bottom);
else
mInputView.setCompoundDrawablesWithIntrinsicBounds(start, top, end, bottom);
} | java | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public void setCompoundDrawablesRelativeWithIntrinsicBounds (Drawable start, Drawable top, Drawable end, Drawable bottom){
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
mInputView.setCompoundDrawablesRelativeWithIntrinsicBounds(start, top, end, bottom);
else
mInputView.setCompoundDrawablesWithIntrinsicBounds(start, top, end, bottom);
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"JELLY_BEAN_MR1",
")",
"public",
"void",
"setCompoundDrawablesRelativeWithIntrinsicBounds",
"(",
"Drawable",
"start",
",",
"Drawable",
"top",
",",
"Drawable",
"end",
",",
"Drawable",
"bottom",
")",
"{",
"i... | Sets the Drawables (if any) to appear to the start of, above, to the end
of, and below the text. Use {@code null} if you do not want a Drawable
there. The Drawables' bounds will be set to their intrinsic bounds.
<p>
Calling this method will overwrite any Drawables previously set using
{@link #setCompoundDrawables} or related methods.
@attr ref android.R.styleable#TextView_drawableStart
@attr ref android.R.styleable#TextView_drawableTop
@attr ref android.R.styleable#TextView_drawableEnd
@attr ref android.R.styleable#TextView_drawableBottom | [
"Sets",
"the",
"Drawables",
"(",
"if",
"any",
")",
"to",
"appear",
"to",
"the",
"start",
"of",
"above",
"to",
"the",
"end",
"of",
"and",
"below",
"the",
"text",
".",
"Use",
"{",
"@code",
"null",
"}",
"if",
"you",
"do",
"not",
"want",
"a",
"Drawable... | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L2739-L2745 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/routing/subnetwork/PrepareRoutingSubnetworks.java | PrepareRoutingSubnetworks.detectNodeRemovedForAllEncoders | boolean detectNodeRemovedForAllEncoders(EdgeExplorer edgeExplorerAllEdges, int nodeIndex) {
// we could implement a 'fast check' for several previously marked removed nodes via GHBitSet
// removedNodesPerVehicle. The problem is that we would need long-indices but BitSet only supports int (due to nodeIndex*numberOfEncoders)
// if no edges are reachable return true
EdgeIterator iter = edgeExplorerAllEdges.setBaseNode(nodeIndex);
while (iter.next()) {
// if at least on encoder allows one direction return false
for (BooleanEncodedValue accessEnc : accessEncList) {
if (iter.get(accessEnc) || iter.getReverse(accessEnc))
return false;
}
}
return true;
} | java | boolean detectNodeRemovedForAllEncoders(EdgeExplorer edgeExplorerAllEdges, int nodeIndex) {
// we could implement a 'fast check' for several previously marked removed nodes via GHBitSet
// removedNodesPerVehicle. The problem is that we would need long-indices but BitSet only supports int (due to nodeIndex*numberOfEncoders)
// if no edges are reachable return true
EdgeIterator iter = edgeExplorerAllEdges.setBaseNode(nodeIndex);
while (iter.next()) {
// if at least on encoder allows one direction return false
for (BooleanEncodedValue accessEnc : accessEncList) {
if (iter.get(accessEnc) || iter.getReverse(accessEnc))
return false;
}
}
return true;
} | [
"boolean",
"detectNodeRemovedForAllEncoders",
"(",
"EdgeExplorer",
"edgeExplorerAllEdges",
",",
"int",
"nodeIndex",
")",
"{",
"// we could implement a 'fast check' for several previously marked removed nodes via GHBitSet ",
"// removedNodesPerVehicle. The problem is that we would need long-ind... | This method checks if the node is removed or inaccessible for ALL encoders.
@return true if no edges are reachable from the specified nodeIndex for any flag encoder. | [
"This",
"method",
"checks",
"if",
"the",
"node",
"is",
"removed",
"or",
"inaccessible",
"for",
"ALL",
"encoders",
"."
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/subnetwork/PrepareRoutingSubnetworks.java#L257-L272 |
jayantk/jklol | src/com/jayantkrish/jklol/cli/AbstractCli.java | AbstractCli.createGradientOptimizer | protected GradientOptimizer createGradientOptimizer(int numExamples) {
if (opts.contains(CommonOptions.STOCHASTIC_GRADIENT) &&
opts.contains(CommonOptions.LBFGS)) {
if (parsedOptions.has(lbfgs)) {
return createLbfgs(numExamples);
} else {
return createStochasticGradientTrainer(numExamples);
}
} else if (opts.contains(CommonOptions.STOCHASTIC_GRADIENT)) {
return createStochasticGradientTrainer(numExamples);
} else if (opts.contains(CommonOptions.LBFGS)) {
return createLbfgs(numExamples);
}
throw new UnsupportedOperationException("To use createGradientOptimizer, the CLI constructor must specify STOCHASTIC_GRADIENT and/or LBFGS.");
} | java | protected GradientOptimizer createGradientOptimizer(int numExamples) {
if (opts.contains(CommonOptions.STOCHASTIC_GRADIENT) &&
opts.contains(CommonOptions.LBFGS)) {
if (parsedOptions.has(lbfgs)) {
return createLbfgs(numExamples);
} else {
return createStochasticGradientTrainer(numExamples);
}
} else if (opts.contains(CommonOptions.STOCHASTIC_GRADIENT)) {
return createStochasticGradientTrainer(numExamples);
} else if (opts.contains(CommonOptions.LBFGS)) {
return createLbfgs(numExamples);
}
throw new UnsupportedOperationException("To use createGradientOptimizer, the CLI constructor must specify STOCHASTIC_GRADIENT and/or LBFGS.");
} | [
"protected",
"GradientOptimizer",
"createGradientOptimizer",
"(",
"int",
"numExamples",
")",
"{",
"if",
"(",
"opts",
".",
"contains",
"(",
"CommonOptions",
".",
"STOCHASTIC_GRADIENT",
")",
"&&",
"opts",
".",
"contains",
"(",
"CommonOptions",
".",
"LBFGS",
")",
"... | Creates a gradient-based optimization algorithm based on the
given command-line parameters. To use this method, pass at least
one of {@link CommonOptions#STOCHASTIC_GRADIENT} or
{@link CommonOptions#LBFGS} to the constructor. This method
allows users to easily select different optimization algorithms
and parameterizations.
@param numExamples
@return | [
"Creates",
"a",
"gradient",
"-",
"based",
"optimization",
"algorithm",
"based",
"on",
"the",
"given",
"command",
"-",
"line",
"parameters",
".",
"To",
"use",
"this",
"method",
"pass",
"at",
"least",
"one",
"of",
"{",
"@link",
"CommonOptions#STOCHASTIC_GRADIENT",... | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/cli/AbstractCli.java#L447-L462 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/GDiscreteFourierTransformOps.java | GDiscreteFourierTransformOps.realToComplex | public static void realToComplex(GrayF real , ImageInterleaved complex ) {
if( complex instanceof InterleavedF32 ) {
DiscreteFourierTransformOps.realToComplex((GrayF32) real, (InterleavedF32) complex);
} else if( complex instanceof InterleavedF64 ) {
DiscreteFourierTransformOps.realToComplex((GrayF64) real, (InterleavedF64) complex);
} else {
throw new IllegalArgumentException("Unknown image type");
}
} | java | public static void realToComplex(GrayF real , ImageInterleaved complex ) {
if( complex instanceof InterleavedF32 ) {
DiscreteFourierTransformOps.realToComplex((GrayF32) real, (InterleavedF32) complex);
} else if( complex instanceof InterleavedF64 ) {
DiscreteFourierTransformOps.realToComplex((GrayF64) real, (InterleavedF64) complex);
} else {
throw new IllegalArgumentException("Unknown image type");
}
} | [
"public",
"static",
"void",
"realToComplex",
"(",
"GrayF",
"real",
",",
"ImageInterleaved",
"complex",
")",
"{",
"if",
"(",
"complex",
"instanceof",
"InterleavedF32",
")",
"{",
"DiscreteFourierTransformOps",
".",
"realToComplex",
"(",
"(",
"GrayF32",
")",
"real",
... | Converts a regular image into a complex interleaved image with the imaginary component set to zero.
@param real (Input) Regular image.
@param complex (Output) Equivalent complex image. | [
"Converts",
"a",
"regular",
"image",
"into",
"a",
"complex",
"interleaved",
"image",
"with",
"the",
"imaginary",
"component",
"set",
"to",
"zero",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/GDiscreteFourierTransformOps.java#L105-L113 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ServicesApi.java | ServicesApi.setHipChat | public void setHipChat(Object projectIdOrPath, String token, String room, String server) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("token", token)
.withParam("room", room)
.withParam("server", server);
put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "services", "hipchat");
} | java | public void setHipChat(Object projectIdOrPath, String token, String room, String server) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("token", token)
.withParam("room", room)
.withParam("server", server);
put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "services", "hipchat");
} | [
"public",
"void",
"setHipChat",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"token",
",",
"String",
"room",
",",
"String",
"server",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withPara... | Activates HipChatService notifications.
<pre><code>GitLab Endpoint: PUT /projects/:id/services/hipchat</code></pre>
@param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
@param token for authentication
@param room HipChatService Room
@param server HipChatService Server URL
@throws GitLabApiException if any exception occurs
@deprecated replaced with {@link #updateHipChatService(Object, HipChatService) updateHipChat} method | [
"Activates",
"HipChatService",
"notifications",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ServicesApi.java#L129-L135 |
UrielCh/ovh-java-sdk | ovh-java-sdk-service/src/main/java/net/minidev/ovh/api/ApiOvhService.java | ApiOvhService.serviceId_renew_GET | public ArrayList<OvhRenewDescription> serviceId_renew_GET(String serviceId, Boolean includeOptions) throws IOException {
String qPath = "/service/{serviceId}/renew";
StringBuilder sb = path(qPath, serviceId);
query(sb, "includeOptions", includeOptions);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<OvhRenewDescription> serviceId_renew_GET(String serviceId, Boolean includeOptions) throws IOException {
String qPath = "/service/{serviceId}/renew";
StringBuilder sb = path(qPath, serviceId);
query(sb, "includeOptions", includeOptions);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"OvhRenewDescription",
">",
"serviceId_renew_GET",
"(",
"String",
"serviceId",
",",
"Boolean",
"includeOptions",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/service/{serviceId}/renew\"",
";",
"StringBuilder",
"sb",
"=",
"... | List possible renews for this service
REST: GET /service/{serviceId}/renew
@param serviceId [required] Service Id
@param includeOptions [required] Include service's option(s)
API beta | [
"List",
"possible",
"renews",
"for",
"this",
"service"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-service/src/main/java/net/minidev/ovh/api/ApiOvhService.java#L91-L97 |
JodaOrg/joda-money | src/main/java/org/joda/money/format/MoneyFormatterBuilder.java | MoneyFormatterBuilder.appendAmount | public MoneyFormatterBuilder appendAmount(MoneyAmountStyle style) {
MoneyFormatter.checkNotNull(style, "MoneyAmountStyle must not be null");
AmountPrinterParser pp = new AmountPrinterParser(style);
return appendInternal(pp, pp);
} | java | public MoneyFormatterBuilder appendAmount(MoneyAmountStyle style) {
MoneyFormatter.checkNotNull(style, "MoneyAmountStyle must not be null");
AmountPrinterParser pp = new AmountPrinterParser(style);
return appendInternal(pp, pp);
} | [
"public",
"MoneyFormatterBuilder",
"appendAmount",
"(",
"MoneyAmountStyle",
"style",
")",
"{",
"MoneyFormatter",
".",
"checkNotNull",
"(",
"style",
",",
"\"MoneyAmountStyle must not be null\"",
")",
";",
"AmountPrinterParser",
"pp",
"=",
"new",
"AmountPrinterParser",
"(",... | Appends the amount to the builder using the specified amount style.
<p>
The amount is the value itself, such as '12.34'.
<p>
The amount style allows the formatting of the number to be controlled in detail.
This includes the characters for positive, negative, decimal, grouping and whether
to output the absolute or signed amount.
See {@link MoneyAmountStyle} for more details.
@param style the style to use, not null
@return this, for chaining, never null | [
"Appends",
"the",
"amount",
"to",
"the",
"builder",
"using",
"the",
"specified",
"amount",
"style",
".",
"<p",
">",
"The",
"amount",
"is",
"the",
"value",
"itself",
"such",
"as",
"12",
".",
"34",
".",
"<p",
">",
"The",
"amount",
"style",
"allows",
"the... | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/format/MoneyFormatterBuilder.java#L92-L96 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/BizwifiAPI.java | BizwifiAPI.deviceAdd | public static BaseResult deviceAdd(String accessToken, ShopInfo shopInfo) {
return deviceAdd(accessToken, JsonUtil.toJSONString(shopInfo));
} | java | public static BaseResult deviceAdd(String accessToken, ShopInfo shopInfo) {
return deviceAdd(accessToken, JsonUtil.toJSONString(shopInfo));
} | [
"public",
"static",
"BaseResult",
"deviceAdd",
"(",
"String",
"accessToken",
",",
"ShopInfo",
"shopInfo",
")",
"{",
"return",
"deviceAdd",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"shopInfo",
")",
")",
";",
"}"
] | Wi-Fi设备管理-添加密码型设备
@param accessToken accessToken
@param shopInfo shopInfo
@return BaseResult | [
"Wi",
"-",
"Fi设备管理",
"-",
"添加密码型设备"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L316-L318 |
petergeneric/stdlib | util/carbon-client/src/main/java/com/peterphi/carbon/type/XMLWrapper.java | XMLWrapper.setAttribute | public void setAttribute(String name, String value)
{
if (value != null)
getElement().setAttribute(name, value);
else
getElement().removeAttribute(name);
} | java | public void setAttribute(String name, String value)
{
if (value != null)
getElement().setAttribute(name, value);
else
getElement().removeAttribute(name);
} | [
"public",
"void",
"setAttribute",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"getElement",
"(",
")",
".",
"setAttribute",
"(",
"name",
",",
"value",
")",
";",
"else",
"getElement",
"(",
")",
".",
"... | Helper method to set the value of an attribute on this Element
@param name
the attribute name
@param value
the value to set - if null the attribute is removed | [
"Helper",
"method",
"to",
"set",
"the",
"value",
"of",
"an",
"attribute",
"on",
"this",
"Element"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/util/carbon-client/src/main/java/com/peterphi/carbon/type/XMLWrapper.java#L40-L46 |
jenkinsci/jenkins | core/src/main/java/hudson/XmlFile.java | XmlFile.replaceIfNotAtTopLevel | public static Object replaceIfNotAtTopLevel(Object o, Supplier<Object> replacement) {
File currentlyWriting = writing.get();
if (beingWritten.containsKey(o) || currentlyWriting == null) {
return o;
} else {
LOGGER.log(Level.WARNING, "JENKINS-45892: reference to " + o + " being saved from unexpected " + currentlyWriting, new IllegalStateException());
return replacement.get();
}
} | java | public static Object replaceIfNotAtTopLevel(Object o, Supplier<Object> replacement) {
File currentlyWriting = writing.get();
if (beingWritten.containsKey(o) || currentlyWriting == null) {
return o;
} else {
LOGGER.log(Level.WARNING, "JENKINS-45892: reference to " + o + " being saved from unexpected " + currentlyWriting, new IllegalStateException());
return replacement.get();
}
} | [
"public",
"static",
"Object",
"replaceIfNotAtTopLevel",
"(",
"Object",
"o",
",",
"Supplier",
"<",
"Object",
">",
"replacement",
")",
"{",
"File",
"currentlyWriting",
"=",
"writing",
".",
"get",
"(",
")",
";",
"if",
"(",
"beingWritten",
".",
"containsKey",
"(... | Provides an XStream replacement for an object unless a call to {@link #write} is currently in progress.
As per JENKINS-45892 this may be used by any class which expects to be written at top level to an XML file
but which cannot safely be serialized as a nested object (for example, because it expects some {@code onLoad} hook):
implement a {@code writeReplace} method delegating to this method.
The replacement need not be {@link Serializable} since it is only necessary for use from XStream.
@param o an object ({@code this} from {@code writeReplace})
@param replacement a supplier of a safely serializable replacement object with a {@code readResolve} method
@return {@code o}, if {@link #write} is being called on it, else the replacement
@since 2.74 | [
"Provides",
"an",
"XStream",
"replacement",
"for",
"an",
"object",
"unless",
"a",
"call",
"to",
"{"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/XmlFile.java#L217-L225 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/SemanticAPI.java | SemanticAPI.addvoicetorecofortext | public static BaseResult addvoicetorecofortext(String accessToken, String voiceId, String lang, File voice) {
HttpPost httpPost = new HttpPost(BASE_URI + "/cgi-bin/media/voice/addvoicetorecofortext");
FileBody bin = new FileBody(voice);
HttpEntity reqEntity = MultipartEntityBuilder.create()
.addPart("media", bin)
.addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(accessToken))
.addTextBody("format", MediaType.voice_mp3.fileSuffix())
.addTextBody("voice_id", voiceId)
.addTextBody("lang", lang == null || lang.isEmpty() ? "zh_CN" : lang)
.build();
httpPost.setEntity(reqEntity);
return LocalHttpClient.executeJsonResult(httpPost, BaseResult.class);
} | java | public static BaseResult addvoicetorecofortext(String accessToken, String voiceId, String lang, File voice) {
HttpPost httpPost = new HttpPost(BASE_URI + "/cgi-bin/media/voice/addvoicetorecofortext");
FileBody bin = new FileBody(voice);
HttpEntity reqEntity = MultipartEntityBuilder.create()
.addPart("media", bin)
.addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(accessToken))
.addTextBody("format", MediaType.voice_mp3.fileSuffix())
.addTextBody("voice_id", voiceId)
.addTextBody("lang", lang == null || lang.isEmpty() ? "zh_CN" : lang)
.build();
httpPost.setEntity(reqEntity);
return LocalHttpClient.executeJsonResult(httpPost, BaseResult.class);
} | [
"public",
"static",
"BaseResult",
"addvoicetorecofortext",
"(",
"String",
"accessToken",
",",
"String",
"voiceId",
",",
"String",
"lang",
",",
"File",
"voice",
")",
"{",
"HttpPost",
"httpPost",
"=",
"new",
"HttpPost",
"(",
"BASE_URI",
"+",
"\"/cgi-bin/media/voice/... | 提交语音
@param accessToken 接口调用凭证
@param voiceId 语音唯一标识
@param lang 语言,zh_CN 或 en_US,默认中文
@param voice 文件格式 只支持mp3,16k,单声道,最大1M
@return BaseResult
@since 2.8.22 | [
"提交语音"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/SemanticAPI.java#L124-L137 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java | EncodingUtils.urlEncode | @SneakyThrows
public static String urlEncode(final String value, final String encoding) {
return URLEncoder.encode(value, encoding);
} | java | @SneakyThrows
public static String urlEncode(final String value, final String encoding) {
return URLEncoder.encode(value, encoding);
} | [
"@",
"SneakyThrows",
"public",
"static",
"String",
"urlEncode",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"encoding",
")",
"{",
"return",
"URLEncoder",
".",
"encode",
"(",
"value",
",",
"encoding",
")",
";",
"}"
] | Url encode a value.
@param value the value to encode
@param encoding the encoding
@return the encoded value | [
"Url",
"encode",
"a",
"value",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java#L240-L243 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/TopLevelDomainsInner.java | TopLevelDomainsInner.listAgreementsAsync | public Observable<Page<TldLegalAgreementInner>> listAgreementsAsync(final String name, final TopLevelDomainAgreementOption agreementOption) {
return listAgreementsWithServiceResponseAsync(name, agreementOption)
.map(new Func1<ServiceResponse<Page<TldLegalAgreementInner>>, Page<TldLegalAgreementInner>>() {
@Override
public Page<TldLegalAgreementInner> call(ServiceResponse<Page<TldLegalAgreementInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<TldLegalAgreementInner>> listAgreementsAsync(final String name, final TopLevelDomainAgreementOption agreementOption) {
return listAgreementsWithServiceResponseAsync(name, agreementOption)
.map(new Func1<ServiceResponse<Page<TldLegalAgreementInner>>, Page<TldLegalAgreementInner>>() {
@Override
public Page<TldLegalAgreementInner> call(ServiceResponse<Page<TldLegalAgreementInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"TldLegalAgreementInner",
">",
">",
"listAgreementsAsync",
"(",
"final",
"String",
"name",
",",
"final",
"TopLevelDomainAgreementOption",
"agreementOption",
")",
"{",
"return",
"listAgreementsWithServiceResponseAsync",
"(",
"name"... | Gets all legal agreements that user needs to accept before purchasing a domain.
Gets all legal agreements that user needs to accept before purchasing a domain.
@param name Name of the top-level domain.
@param agreementOption Domain agreement options.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<TldLegalAgreementInner> object | [
"Gets",
"all",
"legal",
"agreements",
"that",
"user",
"needs",
"to",
"accept",
"before",
"purchasing",
"a",
"domain",
".",
"Gets",
"all",
"legal",
"agreements",
"that",
"user",
"needs",
"to",
"accept",
"before",
"purchasing",
"a",
"domain",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/TopLevelDomainsInner.java#L333-L341 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java | ListIterate.forEachInBoth | public static <T1, T2> void forEachInBoth(List<T1> list1, List<T2> list2, Procedure2<? super T1, ? super T2> procedure)
{
if (list1 != null && list2 != null)
{
if (list1.size() == list2.size())
{
if (list1 instanceof RandomAccess && list2 instanceof RandomAccess)
{
RandomAccessListIterate.forEachInBoth(list1, list2, procedure);
}
else
{
Iterator<T1> iterator1 = list1.iterator();
Iterator<T2> iterator2 = list2.iterator();
int size = list2.size();
for (int i = 0; i < size; i++)
{
procedure.value(iterator1.next(), iterator2.next());
}
}
}
else
{
throw new RuntimeException("Attempt to call forEachInBoth with two Lists of different sizes :"
+ list1.size()
+ ':'
+ list2.size());
}
}
} | java | public static <T1, T2> void forEachInBoth(List<T1> list1, List<T2> list2, Procedure2<? super T1, ? super T2> procedure)
{
if (list1 != null && list2 != null)
{
if (list1.size() == list2.size())
{
if (list1 instanceof RandomAccess && list2 instanceof RandomAccess)
{
RandomAccessListIterate.forEachInBoth(list1, list2, procedure);
}
else
{
Iterator<T1> iterator1 = list1.iterator();
Iterator<T2> iterator2 = list2.iterator();
int size = list2.size();
for (int i = 0; i < size; i++)
{
procedure.value(iterator1.next(), iterator2.next());
}
}
}
else
{
throw new RuntimeException("Attempt to call forEachInBoth with two Lists of different sizes :"
+ list1.size()
+ ':'
+ list2.size());
}
}
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"void",
"forEachInBoth",
"(",
"List",
"<",
"T1",
">",
"list1",
",",
"List",
"<",
"T2",
">",
"list2",
",",
"Procedure2",
"<",
"?",
"super",
"T1",
",",
"?",
"super",
"T2",
">",
"procedure",
")",
"{",
"... | Iterates over both lists together, evaluating Procedure2 with the current element from each list. | [
"Iterates",
"over",
"both",
"lists",
"together",
"evaluating",
"Procedure2",
"with",
"the",
"current",
"element",
"from",
"each",
"list",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java#L806-L835 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java | PgPreparedStatement.bindString | private void bindString(int paramIndex, String s, int oid) throws SQLException {
preparedParameters.setStringParameter(paramIndex, s, oid);
} | java | private void bindString(int paramIndex, String s, int oid) throws SQLException {
preparedParameters.setStringParameter(paramIndex, s, oid);
} | [
"private",
"void",
"bindString",
"(",
"int",
"paramIndex",
",",
"String",
"s",
",",
"int",
"oid",
")",
"throws",
"SQLException",
"{",
"preparedParameters",
".",
"setStringParameter",
"(",
"paramIndex",
",",
"s",
",",
"oid",
")",
";",
"}"
] | This version is for values that should turn into strings e.g. setString directly calls
bindString with no escaping; the per-protocol ParameterList does escaping as needed.
@param paramIndex parameter index
@param s value
@param oid type oid
@throws SQLException if something goes wrong | [
"This",
"version",
"is",
"for",
"values",
"that",
"should",
"turn",
"into",
"strings",
"e",
".",
"g",
".",
"setString",
"directly",
"calls",
"bindString",
"with",
"no",
"escaping",
";",
"the",
"per",
"-",
"protocol",
"ParameterList",
"does",
"escaping",
"as"... | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java#L1001-L1003 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/pipeline/LabeledChunkIdentifier.java | LabeledChunkIdentifier.getAnnotatedChunks | @SuppressWarnings("unchecked")
public List<CoreMap> getAnnotatedChunks(List<CoreLabel> tokens, int totalTokensOffset,
Class textKey, Class labelKey,
Class tokenChunkKey, Class tokenLabelKey)
{
List<CoreMap> chunks = new ArrayList();
LabelTagType prevTagType = null;
int tokenBegin = -1;
for (int i = 0; i < tokens.size(); i++) {
CoreLabel token = tokens.get(i);
String label = (String) token.get(labelKey);
LabelTagType curTagType = getTagType(label);
if (isEndOfChunk(prevTagType, curTagType)) {
int tokenEnd = i;
CoreMap chunk = ChunkAnnotationUtils.getAnnotatedChunk(tokens, tokenBegin, tokenEnd, totalTokensOffset,
tokenChunkKey, textKey, tokenLabelKey);
chunk.set(labelKey, prevTagType.type);
chunks.add(chunk);
tokenBegin = -1;
}
if (isStartOfChunk(prevTagType, curTagType)) {
if (tokenBegin >= 0) {
throw new RuntimeException("New chunk started, prev chunk not ended yet!");
}
tokenBegin = i;
}
prevTagType = curTagType;
}
if (tokenBegin >= 0) {
CoreMap chunk = ChunkAnnotationUtils.getAnnotatedChunk(tokens, tokenBegin, tokens.size(), totalTokensOffset,
tokenChunkKey, textKey, tokenLabelKey);
chunk.set(labelKey, prevTagType.type);
chunks.add(chunk);
}
// System.out.println("number of chunks " + chunks.size());
return chunks;
} | java | @SuppressWarnings("unchecked")
public List<CoreMap> getAnnotatedChunks(List<CoreLabel> tokens, int totalTokensOffset,
Class textKey, Class labelKey,
Class tokenChunkKey, Class tokenLabelKey)
{
List<CoreMap> chunks = new ArrayList();
LabelTagType prevTagType = null;
int tokenBegin = -1;
for (int i = 0; i < tokens.size(); i++) {
CoreLabel token = tokens.get(i);
String label = (String) token.get(labelKey);
LabelTagType curTagType = getTagType(label);
if (isEndOfChunk(prevTagType, curTagType)) {
int tokenEnd = i;
CoreMap chunk = ChunkAnnotationUtils.getAnnotatedChunk(tokens, tokenBegin, tokenEnd, totalTokensOffset,
tokenChunkKey, textKey, tokenLabelKey);
chunk.set(labelKey, prevTagType.type);
chunks.add(chunk);
tokenBegin = -1;
}
if (isStartOfChunk(prevTagType, curTagType)) {
if (tokenBegin >= 0) {
throw new RuntimeException("New chunk started, prev chunk not ended yet!");
}
tokenBegin = i;
}
prevTagType = curTagType;
}
if (tokenBegin >= 0) {
CoreMap chunk = ChunkAnnotationUtils.getAnnotatedChunk(tokens, tokenBegin, tokens.size(), totalTokensOffset,
tokenChunkKey, textKey, tokenLabelKey);
chunk.set(labelKey, prevTagType.type);
chunks.add(chunk);
}
// System.out.println("number of chunks " + chunks.size());
return chunks;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"List",
"<",
"CoreMap",
">",
"getAnnotatedChunks",
"(",
"List",
"<",
"CoreLabel",
">",
"tokens",
",",
"int",
"totalTokensOffset",
",",
"Class",
"textKey",
",",
"Class",
"labelKey",
",",
"Class",
"to... | Find and annotate chunks. Returns list of CoreMap (Annotation) objects
each representing a chunk with the following annotations set:
CharacterOffsetBeginAnnotation - set to CharacterOffsetBeginAnnotation of first token in chunk
CharacterOffsetEndAnnotation - set to CharacterOffsetEndAnnotation of last token in chunk
TokensAnnotation - List of tokens in this chunk
TokenBeginAnnotation - Index of first token in chunk (index in original list of tokens)
TokenEndAnnotation - Index of last token in chunk (index in original list of tokens)
TextAnnotation - String representing tokens in this chunks (token text separated by space)
@param tokens - List of tokens to look for chunks
@param totalTokensOffset - Index of tokens to offset by
@param labelKey - Key to use to find the token label (to determine if inside chunk or not)
@param textKey - Key to use to find the token text
@param tokenChunkKey - If not null, each token is annotated with the chunk using this key
@param tokenLabelKey - If not null, each token is annotated with the text associated with the chunk using this key
@return List of annotations (each as a CoreMap) representing the chunks of tokens | [
"Find",
"and",
"annotate",
"chunks",
".",
"Returns",
"list",
"of",
"CoreMap",
"(",
"Annotation",
")",
"objects",
"each",
"representing",
"a",
"chunk",
"with",
"the",
"following",
"annotations",
"set",
":",
"CharacterOffsetBeginAnnotation",
"-",
"set",
"to",
"Cha... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/pipeline/LabeledChunkIdentifier.java#L83-L119 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.setDate | public void setDate(String itemName, Date date) {
if (date == null) {
setItem(itemName, null);
} else {
setItem(itemName, DateUtil.toHL7(date));
}
} | java | public void setDate(String itemName, Date date) {
if (date == null) {
setItem(itemName, null);
} else {
setItem(itemName, DateUtil.toHL7(date));
}
} | [
"public",
"void",
"setDate",
"(",
"String",
"itemName",
",",
"Date",
"date",
")",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"setItem",
"(",
"itemName",
",",
"null",
")",
";",
"}",
"else",
"{",
"setItem",
"(",
"itemName",
",",
"DateUtil",
".",
... | Saves a date item object as a context item.
@param itemName Item name
@param date Date value | [
"Saves",
"a",
"date",
"item",
"object",
"as",
"a",
"context",
"item",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L284-L290 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.