repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/report/ReportBreakScreen.java | ReportBreakScreen.isPrintableControl | public boolean isPrintableControl(ScreenField sField, int iPrintOptions)
{
// Override this to break
if ((sField == null) || (sField == this))
{ // Asking about this control
int iDisplayOptions = m_iDisplayFieldDesc & (HtmlConstants.HEADING_SCREEN | HtmlConstants.FOOTING_SCREEN);
if (iPrintOptions != 0)
if ((iPrintOptions & iDisplayOptions) == iDisplayOptions)
return true; // detail screens are printed as a sub-screen.
}
return super.isPrintableControl(sField, iPrintOptions);
} | java | public boolean isPrintableControl(ScreenField sField, int iPrintOptions)
{
// Override this to break
if ((sField == null) || (sField == this))
{ // Asking about this control
int iDisplayOptions = m_iDisplayFieldDesc & (HtmlConstants.HEADING_SCREEN | HtmlConstants.FOOTING_SCREEN);
if (iPrintOptions != 0)
if ((iPrintOptions & iDisplayOptions) == iDisplayOptions)
return true; // detail screens are printed as a sub-screen.
}
return super.isPrintableControl(sField, iPrintOptions);
} | [
"public",
"boolean",
"isPrintableControl",
"(",
"ScreenField",
"sField",
",",
"int",
"iPrintOptions",
")",
"{",
"// Override this to break",
"if",
"(",
"(",
"sField",
"==",
"null",
")",
"||",
"(",
"sField",
"==",
"this",
")",
")",
"{",
"// Asking about this cont... | Display this sub-control in html input format?
@param iPrintOptions The view specific print options.
@return True if this sub-control is printable. | [
"Display",
"this",
"sub",
"-",
"control",
"in",
"html",
"input",
"format?"
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/report/ReportBreakScreen.java#L75-L86 |
Azure/azure-sdk-for-java | resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java | ResourcesInner.beginMoveResources | public void beginMoveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) {
beginMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().single().body();
} | java | public void beginMoveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) {
beginMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().single().body();
} | [
"public",
"void",
"beginMoveResources",
"(",
"String",
"sourceResourceGroupName",
",",
"ResourcesMoveInfo",
"parameters",
")",
"{",
"beginMoveResourcesWithServiceResponseAsync",
"(",
"sourceResourceGroupName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"sin... | Moves resources from one resource group to another resource group.
The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes.
@param sourceResourceGroupName The name of the resource group containing the resources to move.
@param parameters Parameters for moving resources.
@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 | [
"Moves",
"resources",
"from",
"one",
"resource",
"group",
"to",
"another",
"resource",
"group",
".",
"The",
"resources",
"to",
"move",
"must",
"be",
"in",
"the",
"same",
"source",
"resource",
"group",
".",
"The",
"target",
"resource",
"group",
"may",
"be",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L491-L493 |
datacleaner/DataCleaner | desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java | Packer.setInsetLeft | public Packer setInsetLeft(final int val) {
Insets i = gc.insets;
if (i == null) {
i = new Insets(0, 0, 0, 0);
}
gc.insets = new Insets(i.top, val, i.bottom, i.right);
setConstraints(comp, gc);
return this;
} | java | public Packer setInsetLeft(final int val) {
Insets i = gc.insets;
if (i == null) {
i = new Insets(0, 0, 0, 0);
}
gc.insets = new Insets(i.top, val, i.bottom, i.right);
setConstraints(comp, gc);
return this;
} | [
"public",
"Packer",
"setInsetLeft",
"(",
"final",
"int",
"val",
")",
"{",
"Insets",
"i",
"=",
"gc",
".",
"insets",
";",
"if",
"(",
"i",
"==",
"null",
")",
"{",
"i",
"=",
"new",
"Insets",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
";",
"}",
... | sets left Insets on the constraints for the current component to the
value specified. | [
"sets",
"left",
"Insets",
"on",
"the",
"constraints",
"for",
"the",
"current",
"component",
"to",
"the",
"value",
"specified",
"."
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L851-L859 |
jbundle/jbundle | app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/PackagesScreen.java | PackagesScreen.doCommand | public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
if (Packages.SCAN.equalsIgnoreCase(strCommand))
{
Map<String,Object> properties = new HashMap<String,Object>();
properties.put(DBParams.PROCESS, ScanPackagesProcess.class.getName());
Application app = (Application)this.getTask().getApplication();
String strProcess = Utility.propertiesToURL(null, properties);
app.getTaskScheduler().addTask(new ProcessRunnerTask(app, strProcess, null));
return true; // Handled
}
return super.doCommand(strCommand, sourceSField, iCommandOptions);
} | java | public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
if (Packages.SCAN.equalsIgnoreCase(strCommand))
{
Map<String,Object> properties = new HashMap<String,Object>();
properties.put(DBParams.PROCESS, ScanPackagesProcess.class.getName());
Application app = (Application)this.getTask().getApplication();
String strProcess = Utility.propertiesToURL(null, properties);
app.getTaskScheduler().addTask(new ProcessRunnerTask(app, strProcess, null));
return true; // Handled
}
return super.doCommand(strCommand, sourceSField, iCommandOptions);
} | [
"public",
"boolean",
"doCommand",
"(",
"String",
"strCommand",
",",
"ScreenField",
"sourceSField",
",",
"int",
"iCommandOptions",
")",
"{",
"if",
"(",
"Packages",
".",
"SCAN",
".",
"equalsIgnoreCase",
"(",
"strCommand",
")",
")",
"{",
"Map",
"<",
"String",
"... | Process the command.
<br />Step 1 - Process the command if possible and return true if processed.
<br />Step 2 - If I can't process, pass to all children (with me as the source).
<br />Step 3 - If children didn't process, pass to parent (with me as the source).
<br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop).
@param strCommand The command to process.
@param sourceSField The source screen field (to avoid echos).
@param iCommandOptions If this command creates a new screen, create in a new window?
@return true if success. | [
"Process",
"the",
"command",
".",
"<br",
"/",
">",
"Step",
"1",
"-",
"Process",
"the",
"command",
"if",
"possible",
"and",
"return",
"true",
"if",
"processed",
".",
"<br",
"/",
">",
"Step",
"2",
"-",
"If",
"I",
"can",
"t",
"process",
"pass",
"to",
... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/PackagesScreen.java#L122-L135 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java | VirtualMachineScaleSetsInner.restartAsync | public Observable<OperationStatusResponseInner> restartAsync(String resourceGroupName, String vmScaleSetName) {
return restartWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | java | public Observable<OperationStatusResponseInner> restartAsync(String resourceGroupName, String vmScaleSetName) {
return restartWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatusResponseInner",
">",
"restartAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
")",
"{",
"return",
"restartWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmScaleSetName",
")",
".",
"map",
... | Restarts one or more virtual machines in a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Restarts",
"one",
"or",
"more",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L2080-L2087 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/ConnectorProperties.java | ConnectorProperties.findConnectorPropertyString | public String findConnectorPropertyString(String desiredPropertyName, String defaultValue) {
String retVal = defaultValue;
String name = null;
ConnectorProperty property = null;
Enumeration<Object> e = this.elements();
while (e.hasMoreElements()) {
property = (ConnectorProperty) e.nextElement();
name = property.getName();
if (name.equals(desiredPropertyName)) {
retVal = (String) property.getValue();
}
}
return retVal;
} | java | public String findConnectorPropertyString(String desiredPropertyName, String defaultValue) {
String retVal = defaultValue;
String name = null;
ConnectorProperty property = null;
Enumeration<Object> e = this.elements();
while (e.hasMoreElements()) {
property = (ConnectorProperty) e.nextElement();
name = property.getName();
if (name.equals(desiredPropertyName)) {
retVal = (String) property.getValue();
}
}
return retVal;
} | [
"public",
"String",
"findConnectorPropertyString",
"(",
"String",
"desiredPropertyName",
",",
"String",
"defaultValue",
")",
"{",
"String",
"retVal",
"=",
"defaultValue",
";",
"String",
"name",
"=",
"null",
";",
"ConnectorProperty",
"property",
"=",
"null",
";",
"... | Given this ConnectorProperties Vector, find the String identified by the
input desiredPropertyName. If not found, return the defaultValue.
@param desiredPropertyName Name of com.ibm.ejs.j2c.ConnectorProperty entry to look for.
@param defaultValue value to return if the desiredPropertyName is not found, or its value is invalid.
@return String | [
"Given",
"this",
"ConnectorProperties",
"Vector",
"find",
"the",
"String",
"identified",
"by",
"the",
"input",
"desiredPropertyName",
".",
"If",
"not",
"found",
"return",
"the",
"defaultValue",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/ConnectorProperties.java#L77-L97 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/ServerRequest.java | ServerRequest.addGetParam | protected void addGetParam(String paramKey, String paramValue) {
try {
params_.put(paramKey, paramValue);
} catch (JSONException ignore) {
}
} | java | protected void addGetParam(String paramKey, String paramValue) {
try {
params_.put(paramKey, paramValue);
} catch (JSONException ignore) {
}
} | [
"protected",
"void",
"addGetParam",
"(",
"String",
"paramKey",
",",
"String",
"paramValue",
")",
"{",
"try",
"{",
"params_",
".",
"put",
"(",
"paramKey",
",",
"paramValue",
")",
";",
"}",
"catch",
"(",
"JSONException",
"ignore",
")",
"{",
"}",
"}"
] | Adds a param and its value to the get request
@param paramKey A {@link String} value for the get param key
@param paramValue A {@link String} value for the get param value | [
"Adds",
"a",
"param",
"and",
"its",
"value",
"to",
"the",
"get",
"request"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/ServerRequest.java#L266-L271 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/graph/EdmondsMaximumMatching.java | EdmondsMaximumMatching.buildPath | private int buildPath(int[] path, int i, int start, int goal) {
while (true) {
// lift the path through the contracted blossom
while (odd[start] != NIL) {
Tuple bridge = bridges.get(start);
// add to the path from the bridge down to where 'start'
// is - we need to reverse it as we travel 'up' the blossom
// and then...
int j = buildPath(path, i, bridge.first, start);
reverse(path, i, j - 1);
i = j;
// ... we travel down the other side of the bridge
start = bridge.second;
}
path[i++] = start;
// root of the tree
if (matching.unmatched(start)) return i;
path[i++] = matching.other(start);
// end of recursive
if (path[i - 1] == goal) return i;
start = odd[path[i - 1]];
}
} | java | private int buildPath(int[] path, int i, int start, int goal) {
while (true) {
// lift the path through the contracted blossom
while (odd[start] != NIL) {
Tuple bridge = bridges.get(start);
// add to the path from the bridge down to where 'start'
// is - we need to reverse it as we travel 'up' the blossom
// and then...
int j = buildPath(path, i, bridge.first, start);
reverse(path, i, j - 1);
i = j;
// ... we travel down the other side of the bridge
start = bridge.second;
}
path[i++] = start;
// root of the tree
if (matching.unmatched(start)) return i;
path[i++] = matching.other(start);
// end of recursive
if (path[i - 1] == goal) return i;
start = odd[path[i - 1]];
}
} | [
"private",
"int",
"buildPath",
"(",
"int",
"[",
"]",
"path",
",",
"int",
"i",
",",
"int",
"start",
",",
"int",
"goal",
")",
"{",
"while",
"(",
"true",
")",
"{",
"// lift the path through the contracted blossom",
"while",
"(",
"odd",
"[",
"start",
"]",
"!... | Builds the path backwards from the specified 'start' vertex until the
'goal'. If the path reaches a blossom then the path through the blossom
is lifted to the original graph.
@param path path storage
@param i offset (in path)
@param start start vertex
@param goal end vertex
@return the number of items set to the path[]. | [
"Builds",
"the",
"path",
"backwards",
"from",
"the",
"specified",
"start",
"vertex",
"until",
"the",
"goal",
".",
"If",
"the",
"path",
"reaches",
"a",
"blossom",
"then",
"the",
"path",
"through",
"the",
"blossom",
"is",
"lifted",
"to",
"the",
"original",
"... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/graph/EdmondsMaximumMatching.java#L333-L363 |
yanzhenjie/Album | album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java | AlbumUtils.getNowDateTime | @NonNull
public static String getNowDateTime(@NonNull String format) {
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ENGLISH);
Date curDate = new Date(System.currentTimeMillis());
return formatter.format(curDate);
} | java | @NonNull
public static String getNowDateTime(@NonNull String format) {
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ENGLISH);
Date curDate = new Date(System.currentTimeMillis());
return formatter.format(curDate);
} | [
"@",
"NonNull",
"public",
"static",
"String",
"getNowDateTime",
"(",
"@",
"NonNull",
"String",
"format",
")",
"{",
"SimpleDateFormat",
"formatter",
"=",
"new",
"SimpleDateFormat",
"(",
"format",
",",
"Locale",
".",
"ENGLISH",
")",
";",
"Date",
"curDate",
"=",
... | Format the current time in the specified format.
@return the time string. | [
"Format",
"the",
"current",
"time",
"in",
"the",
"specified",
"format",
"."
] | train | https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L266-L271 |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/cluster/manager/impl/DefaultClusterManager.java | DefaultClusterManager.removeDeployment | private void removeDeployment(final String deploymentID, Handler<AsyncResult<String>> doneHandler) {
context.execute(new Action<String>() {
@Override
public String perform() {
Collection<String> clusterDeployments = deployments.get(cluster);
if (clusterDeployments != null) {
String deployment = null;
for (String sdeployment : clusterDeployments) {
JsonObject info = new JsonObject(sdeployment);
if (info.getString("id").equals(deploymentID)) {
deployment = sdeployment;
break;
}
}
if (deployment != null) {
deployments.remove(cluster, deployment);
return new JsonObject(deployment).getString("realID");
}
}
return null;
}
}, doneHandler);
} | java | private void removeDeployment(final String deploymentID, Handler<AsyncResult<String>> doneHandler) {
context.execute(new Action<String>() {
@Override
public String perform() {
Collection<String> clusterDeployments = deployments.get(cluster);
if (clusterDeployments != null) {
String deployment = null;
for (String sdeployment : clusterDeployments) {
JsonObject info = new JsonObject(sdeployment);
if (info.getString("id").equals(deploymentID)) {
deployment = sdeployment;
break;
}
}
if (deployment != null) {
deployments.remove(cluster, deployment);
return new JsonObject(deployment).getString("realID");
}
}
return null;
}
}, doneHandler);
} | [
"private",
"void",
"removeDeployment",
"(",
"final",
"String",
"deploymentID",
",",
"Handler",
"<",
"AsyncResult",
"<",
"String",
">",
">",
"doneHandler",
")",
"{",
"context",
".",
"execute",
"(",
"new",
"Action",
"<",
"String",
">",
"(",
")",
"{",
"@",
... | Removes a deployment from the deployments map and returns the real deploymentID. | [
"Removes",
"a",
"deployment",
"from",
"the",
"deployments",
"map",
"and",
"returns",
"the",
"real",
"deploymentID",
"."
] | train | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/cluster/manager/impl/DefaultClusterManager.java#L1253-L1275 |
elibom/jogger | src/main/java/com/elibom/jogger/middleware/router/RouterMiddleware.java | RouterMiddleware.addRoute | public void addRoute(HttpMethod httpMethod, String path, Object controller, Method method) {
// validate signature
Class<?>[] paramTypes = method.getParameterTypes();
if (paramTypes.length != 2 || !paramTypes[0].equals(Request.class) || !paramTypes[1].equals(Response.class)) {
throw new RoutesException("Expecting two params of type com.elibom.jogger.http.Request and com.elibom.jogger.http.Response "
+ "respectively");
}
method.setAccessible(true); // to access methods from anonymous classes
routes.add(new Route(httpMethod, path, controller, method));
} | java | public void addRoute(HttpMethod httpMethod, String path, Object controller, Method method) {
// validate signature
Class<?>[] paramTypes = method.getParameterTypes();
if (paramTypes.length != 2 || !paramTypes[0].equals(Request.class) || !paramTypes[1].equals(Response.class)) {
throw new RoutesException("Expecting two params of type com.elibom.jogger.http.Request and com.elibom.jogger.http.Response "
+ "respectively");
}
method.setAccessible(true); // to access methods from anonymous classes
routes.add(new Route(httpMethod, path, controller, method));
} | [
"public",
"void",
"addRoute",
"(",
"HttpMethod",
"httpMethod",
",",
"String",
"path",
",",
"Object",
"controller",
",",
"Method",
"method",
")",
"{",
"// validate signature",
"Class",
"<",
"?",
">",
"[",
"]",
"paramTypes",
"=",
"method",
".",
"getParameterType... | Creates a {@link Route} object from the received arguments and adds it to the list of routes.
@param httpMethod the HTTP method to which this route is going to respond.
@param path the path to which this route is going to respond.
@param controller the object that will be invoked when this route matches.
@param method the Method that will be invoked when this route matches. | [
"Creates",
"a",
"{",
"@link",
"Route",
"}",
"object",
"from",
"the",
"received",
"arguments",
"and",
"adds",
"it",
"to",
"the",
"list",
"of",
"routes",
"."
] | train | https://github.com/elibom/jogger/blob/d5892ff45e76328d444a68b5a38c26e7bdd0692b/src/main/java/com/elibom/jogger/middleware/router/RouterMiddleware.java#L194-L204 |
Swagger2Markup/swagger2markup | src/main/java/io/github/swagger2markup/internal/document/DefinitionsDocument.java | DefinitionsDocument.buildDefinition | private void buildDefinition(MarkupDocBuilder markupDocBuilder, String definitionName, Model model) {
if (logger.isDebugEnabled()) {
logger.debug("Definition processed : '{}'", definitionName);
}
if (config.isSeparatedDefinitionsEnabled()) {
MarkupDocBuilder defDocBuilder = copyMarkupDocBuilder(markupDocBuilder);
applyDefinitionComponent(defDocBuilder, definitionName, model);
Path definitionFile = context.getOutputPath().resolve(definitionDocumentNameResolver.apply(definitionName));
defDocBuilder.writeToFileWithoutExtension(definitionFile, StandardCharsets.UTF_8);
if (logger.isDebugEnabled()) {
logger.debug("Separate definition file produced : '{}'", definitionFile);
}
definitionRef(markupDocBuilder, definitionName);
} else {
applyDefinitionComponent(markupDocBuilder, definitionName, model);
}
} | java | private void buildDefinition(MarkupDocBuilder markupDocBuilder, String definitionName, Model model) {
if (logger.isDebugEnabled()) {
logger.debug("Definition processed : '{}'", definitionName);
}
if (config.isSeparatedDefinitionsEnabled()) {
MarkupDocBuilder defDocBuilder = copyMarkupDocBuilder(markupDocBuilder);
applyDefinitionComponent(defDocBuilder, definitionName, model);
Path definitionFile = context.getOutputPath().resolve(definitionDocumentNameResolver.apply(definitionName));
defDocBuilder.writeToFileWithoutExtension(definitionFile, StandardCharsets.UTF_8);
if (logger.isDebugEnabled()) {
logger.debug("Separate definition file produced : '{}'", definitionFile);
}
definitionRef(markupDocBuilder, definitionName);
} else {
applyDefinitionComponent(markupDocBuilder, definitionName, model);
}
} | [
"private",
"void",
"buildDefinition",
"(",
"MarkupDocBuilder",
"markupDocBuilder",
",",
"String",
"definitionName",
",",
"Model",
"model",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Definition proces... | Generate definition files depending on the generation mode
@param definitionName definition name to process
@param model definition model to process | [
"Generate",
"definition",
"files",
"depending",
"on",
"the",
"generation",
"mode"
] | train | https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/document/DefinitionsDocument.java#L122-L140 |
Netflix/spectator | spectator-web-spring/src/main/java/com/netflix/spectator/controllers/MetricsController.java | MetricsController.meterToKind | public static String meterToKind(Registry registry, Meter meter) {
String kind;
if (meter instanceof Timer) {
kind = "Timer";
} else if (meter instanceof Counter) {
kind = "Counter";
} else if (meter instanceof Gauge) {
kind = "Gauge";
} else if (meter instanceof DistributionSummary) {
kind = "DistributionSummary";
} else {
kind = meter.getClass().getSimpleName();
}
return kind;
} | java | public static String meterToKind(Registry registry, Meter meter) {
String kind;
if (meter instanceof Timer) {
kind = "Timer";
} else if (meter instanceof Counter) {
kind = "Counter";
} else if (meter instanceof Gauge) {
kind = "Gauge";
} else if (meter instanceof DistributionSummary) {
kind = "DistributionSummary";
} else {
kind = meter.getClass().getSimpleName();
}
return kind;
} | [
"public",
"static",
"String",
"meterToKind",
"(",
"Registry",
"registry",
",",
"Meter",
"meter",
")",
"{",
"String",
"kind",
";",
"if",
"(",
"meter",
"instanceof",
"Timer",
")",
"{",
"kind",
"=",
"\"Timer\"",
";",
"}",
"else",
"if",
"(",
"meter",
"instan... | Determine the type of a meter for reporting purposes.
@param registry
Used to provide supplemental information (e.g. to search for the meter).
@param meter
The meters whose kind we want to know.
@return
A string such as "Counter". If the type cannot be identified as one of
the standard Spectator api interface variants, then the simple class name
is returned. | [
"Determine",
"the",
"type",
"of",
"a",
"meter",
"for",
"reporting",
"purposes",
"."
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-web-spring/src/main/java/com/netflix/spectator/controllers/MetricsController.java#L172-L186 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Organizer.java | Organizer.sortByJavaBeanProperty | public static <T> Collection<T> sortByJavaBeanProperty(String aProperyName,
Collection<T> aCollection)
{
return sortByJavaBeanProperty(aProperyName, aCollection, false);
} | java | public static <T> Collection<T> sortByJavaBeanProperty(String aProperyName,
Collection<T> aCollection)
{
return sortByJavaBeanProperty(aProperyName, aCollection, false);
} | [
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"sortByJavaBeanProperty",
"(",
"String",
"aProperyName",
",",
"Collection",
"<",
"T",
">",
"aCollection",
")",
"{",
"return",
"sortByJavaBeanProperty",
"(",
"aProperyName",
",",
"aCollection",
",",
... | Sort collection of object by a given property name
@param aProperyName
the property name
@param aCollection
the collection of object to sort
@param <T>
the type class
@return the collection of sorted values | [
"Sort",
"collection",
"of",
"object",
"by",
"a",
"given",
"property",
"name"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Organizer.java#L936-L940 |
dita-ot/dita-ot | src/main/java/org/ditang/relaxng/defaults/RelaxNGDefaultsComponent.java | RelaxNGDefaultsComponent.nullOrValue | private boolean nullOrValue(String test, String value) {
if (test == null)
return true;
if (test.equals(value))
return true;
return false;
} | java | private boolean nullOrValue(String test, String value) {
if (test == null)
return true;
if (test.equals(value))
return true;
return false;
} | [
"private",
"boolean",
"nullOrValue",
"(",
"String",
"test",
",",
"String",
"value",
")",
"{",
"if",
"(",
"test",
"==",
"null",
")",
"return",
"true",
";",
"if",
"(",
"test",
".",
"equals",
"(",
"value",
")",
")",
"return",
"true",
";",
"return",
"fal... | Test if a string is either null or equal to a certain value
@param test The string to test
@param value The value to compare to
@return <code>true</code> if a string is either null or equal to a certain value | [
"Test",
"if",
"a",
"string",
"is",
"either",
"null",
"or",
"equal",
"to",
"a",
"certain",
"value"
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/ditang/relaxng/defaults/RelaxNGDefaultsComponent.java#L489-L495 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java | GeneratedDOAuth2UserDaoImpl.queryByCreatedBy | public Iterable<DOAuth2User> queryByCreatedBy(java.lang.String createdBy) {
return queryByField(null, DOAuth2UserMapper.Field.CREATEDBY.getFieldName(), createdBy);
} | java | public Iterable<DOAuth2User> queryByCreatedBy(java.lang.String createdBy) {
return queryByField(null, DOAuth2UserMapper.Field.CREATEDBY.getFieldName(), createdBy);
} | [
"public",
"Iterable",
"<",
"DOAuth2User",
">",
"queryByCreatedBy",
"(",
"java",
".",
"lang",
".",
"String",
"createdBy",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DOAuth2UserMapper",
".",
"Field",
".",
"CREATEDBY",
".",
"getFieldName",
"(",
")",
... | query-by method for field createdBy
@param createdBy the specified attribute
@return an Iterable of DOAuth2Users for the specified createdBy | [
"query",
"-",
"by",
"method",
"for",
"field",
"createdBy"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java#L70-L72 |
beanshell/beanshell | src/main/java/bsh/Reflect.java | Reflect.getClassStaticThis | public static This getClassStaticThis(Class<?> clas, String className) {
try {
return (This) getStaticFieldValue(clas, BSHSTATIC + className);
} catch (Exception e) {
throw new InterpreterError("Unable to get class static space: " + e, e);
}
} | java | public static This getClassStaticThis(Class<?> clas, String className) {
try {
return (This) getStaticFieldValue(clas, BSHSTATIC + className);
} catch (Exception e) {
throw new InterpreterError("Unable to get class static space: " + e, e);
}
} | [
"public",
"static",
"This",
"getClassStaticThis",
"(",
"Class",
"<",
"?",
">",
"clas",
",",
"String",
"className",
")",
"{",
"try",
"{",
"return",
"(",
"This",
")",
"getStaticFieldValue",
"(",
"clas",
",",
"BSHSTATIC",
"+",
"className",
")",
";",
"}",
"c... | Get the static bsh namespace field from the class.
@param className may be the name of clas itself or a superclass of clas. | [
"Get",
"the",
"static",
"bsh",
"namespace",
"field",
"from",
"the",
"class",
"."
] | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Reflect.java#L728-L734 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/runtime/config/DefaultDataGridResourceProvider.java | DefaultDataGridResourceProvider.formatMessage | public String formatMessage(String key, Object[] args) {
String msg = internalFormatMessage(getMessage(key), args);
return msg;
} | java | public String formatMessage(String key, Object[] args) {
String msg = internalFormatMessage(getMessage(key), args);
return msg;
} | [
"public",
"String",
"formatMessage",
"(",
"String",
"key",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"String",
"msg",
"=",
"internalFormatMessage",
"(",
"getMessage",
"(",
"key",
")",
",",
"args",
")",
";",
"return",
"msg",
";",
"}"
] | Format a message associated with the given key and with the given message arguments.
@param key the key
@param args the formatting arguments
@return the formatted message | [
"Format",
"a",
"message",
"associated",
"with",
"the",
"given",
"key",
"and",
"with",
"the",
"given",
"message",
"arguments",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/runtime/config/DefaultDataGridResourceProvider.java#L75-L78 |
sebastiangraf/jSCSI | bundles/target/src/main/java/org/jscsi/target/scsi/cdb/CommandDescriptorBlock.java | CommandDescriptorBlock.addIllegalFieldPointer | protected final void addIllegalFieldPointer (int byteNumber, int bitNumber) {
FieldPointerSenseKeySpecificData fp = new FieldPointerSenseKeySpecificData(true,// senseKeySpecificDataValid
true,// commandData (i.e. invalid field in CDB)
true,// bitPointerValid
bitNumber,// bitPointer
byteNumber);// fieldPointer
addIllegalFieldPointer(fp);
} | java | protected final void addIllegalFieldPointer (int byteNumber, int bitNumber) {
FieldPointerSenseKeySpecificData fp = new FieldPointerSenseKeySpecificData(true,// senseKeySpecificDataValid
true,// commandData (i.e. invalid field in CDB)
true,// bitPointerValid
bitNumber,// bitPointer
byteNumber);// fieldPointer
addIllegalFieldPointer(fp);
} | [
"protected",
"final",
"void",
"addIllegalFieldPointer",
"(",
"int",
"byteNumber",
",",
"int",
"bitNumber",
")",
"{",
"FieldPointerSenseKeySpecificData",
"fp",
"=",
"new",
"FieldPointerSenseKeySpecificData",
"(",
"true",
",",
"// senseKeySpecificDataValid\r",
"true",
",",
... | Adds an instance {@link FieldPointerSenseKeySpecificData}, which specifies an illegal field by the position of
its first byte and its first bit, to {@link #illegalFieldPointers}.
@param byteNumber index of the first byte of the illegal field
@param bitNumber index of the first bit of the illegal field | [
"Adds",
"an",
"instance",
"{",
"@link",
"FieldPointerSenseKeySpecificData",
"}",
"which",
"specifies",
"an",
"illegal",
"field",
"by",
"the",
"position",
"of",
"its",
"first",
"byte",
"and",
"its",
"first",
"bit",
"to",
"{",
"@link",
"#illegalFieldPointers",
"}"... | train | https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/target/src/main/java/org/jscsi/target/scsi/cdb/CommandDescriptorBlock.java#L139-L146 |
tipsy/javalin | src/main/java/io/javalin/apibuilder/ApiBuilder.java | ApiBuilder.wsBefore | public Javalin wsBefore(@NotNull String path, @NotNull Consumer<WsHandler> wsHandler) {
return staticInstance().wsBefore(prefixPath(path), wsHandler);
} | java | public Javalin wsBefore(@NotNull String path, @NotNull Consumer<WsHandler> wsHandler) {
return staticInstance().wsBefore(prefixPath(path), wsHandler);
} | [
"public",
"Javalin",
"wsBefore",
"(",
"@",
"NotNull",
"String",
"path",
",",
"@",
"NotNull",
"Consumer",
"<",
"WsHandler",
">",
"wsHandler",
")",
"{",
"return",
"staticInstance",
"(",
")",
".",
"wsBefore",
"(",
"prefixPath",
"(",
"path",
")",
",",
"wsHandl... | Adds a WebSocket before handler for the specified path to the {@link Javalin} instance.
The method can only be called inside a {@link Javalin#routes(EndpointGroup)}. | [
"Adds",
"a",
"WebSocket",
"before",
"handler",
"for",
"the",
"specified",
"path",
"to",
"the",
"{"
] | train | https://github.com/tipsy/javalin/blob/68b2f7592f237db1c2b597e645697eb75fdaee53/src/main/java/io/javalin/apibuilder/ApiBuilder.java#L412-L414 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/security/SecurityViolationException.java | SecurityViolationException.processException | public void processException(HttpServletRequest req, HttpServletResponse res) throws IOException
{
if (redirectURL != null)
{
res.sendRedirect(redirectURL);
return;
}
if (message == null)
{
res.sendError(statusCode);
}
else
{
res.sendError(statusCode, message);
}
} | java | public void processException(HttpServletRequest req, HttpServletResponse res) throws IOException
{
if (redirectURL != null)
{
res.sendRedirect(redirectURL);
return;
}
if (message == null)
{
res.sendError(statusCode);
}
else
{
res.sendError(statusCode, message);
}
} | [
"public",
"void",
"processException",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
")",
"throws",
"IOException",
"{",
"if",
"(",
"redirectURL",
"!=",
"null",
")",
"{",
"res",
".",
"sendRedirect",
"(",
"redirectURL",
")",
";",
"return",
... | Process security violation exception
@param req - Http servlet request object
@param res - Http servlet response object
@throws IOException if error, otherwise redirects to appropriate error or login page | [
"Process",
"security",
"violation",
"exception"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/security/SecurityViolationException.java#L84-L100 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java | POIUtils.isEmptyCellContents | public static boolean isEmptyCellContents(final Cell cell, final CellFormatter cellFormatter) {
ArgUtils.notNull(cell, "cell");
ArgUtils.notNull(cellFormatter, "cellFormatter");
return getCellContents(cell, cellFormatter).isEmpty();
} | java | public static boolean isEmptyCellContents(final Cell cell, final CellFormatter cellFormatter) {
ArgUtils.notNull(cell, "cell");
ArgUtils.notNull(cellFormatter, "cellFormatter");
return getCellContents(cell, cellFormatter).isEmpty();
} | [
"public",
"static",
"boolean",
"isEmptyCellContents",
"(",
"final",
"Cell",
"cell",
",",
"final",
"CellFormatter",
"cellFormatter",
")",
"{",
"ArgUtils",
".",
"notNull",
"(",
"cell",
",",
"\"cell\"",
")",
";",
"ArgUtils",
".",
"notNull",
"(",
"cellFormatter",
... | フォーマッターを指定してセルの値が空かどうか判定する。
<p>ブランクセルなどの判定は優先的に行う。</p>
@param cell セル
@param cellFormatter セルのフォーマッタ
@throws IllegalArgumentException {@literal sheet == null or cellFormatter == null.}
@return | [
"フォーマッターを指定してセルの値が空かどうか判定する。",
"<p",
">",
"ブランクセルなどの判定は優先的に行う。<",
"/",
"p",
">"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java#L279-L284 |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.clientLoggedOn | protected void clientLoggedOn (String nodeName, ClientInfo clinfo)
{
PresentsSession session = _clmgr.getClient(clinfo.username);
if (session != null) {
log.info("Booting user that has connected on another node",
"username", clinfo.username, "otherNode", nodeName);
session.endSession();
}
} | java | protected void clientLoggedOn (String nodeName, ClientInfo clinfo)
{
PresentsSession session = _clmgr.getClient(clinfo.username);
if (session != null) {
log.info("Booting user that has connected on another node",
"username", clinfo.username, "otherNode", nodeName);
session.endSession();
}
} | [
"protected",
"void",
"clientLoggedOn",
"(",
"String",
"nodeName",
",",
"ClientInfo",
"clinfo",
")",
"{",
"PresentsSession",
"session",
"=",
"_clmgr",
".",
"getClient",
"(",
"clinfo",
".",
"username",
")",
";",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
... | Called when we hear about a client logging on to another node. | [
"Called",
"when",
"we",
"hear",
"about",
"a",
"client",
"logging",
"on",
"to",
"another",
"node",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1357-L1365 |
jbundle/jbundle | base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/html/XAppletHtmlScreen.java | XAppletHtmlScreen.printScreen | public void printScreen(PrintWriter out, ResourceBundle reg)
throws DBException
{
out.println("<html>");
this.printAppletHtmlScreen(out, reg);
out.println("</html>");
/* Map<String,Object> propApplet = new Hashtable<String,Object>();
Map<String,Object> properties = ((AppletHtmlScreen)this.getScreenField()).getAppletProperties(propApplet);
Utility.startTag("applet-properties");
out.println(XMLPropertiesField.propertiesToXML(propApplet));
Utility.endTag("applet-properties");
Utility.startTag("properties");
out.println(XMLPropertiesField.propertiesToXML(properties));
Utility.endTag("properties");
Utility.startTag("jnlp-url");
String strJnlpURL = this.getJnlpURL(propApplet, properties);
out.println(Utility.encodeXML(strJnlpURL));
Utility.endTag("jnlp-url");
*/ } | java | public void printScreen(PrintWriter out, ResourceBundle reg)
throws DBException
{
out.println("<html>");
this.printAppletHtmlScreen(out, reg);
out.println("</html>");
/* Map<String,Object> propApplet = new Hashtable<String,Object>();
Map<String,Object> properties = ((AppletHtmlScreen)this.getScreenField()).getAppletProperties(propApplet);
Utility.startTag("applet-properties");
out.println(XMLPropertiesField.propertiesToXML(propApplet));
Utility.endTag("applet-properties");
Utility.startTag("properties");
out.println(XMLPropertiesField.propertiesToXML(properties));
Utility.endTag("properties");
Utility.startTag("jnlp-url");
String strJnlpURL = this.getJnlpURL(propApplet, properties);
out.println(Utility.encodeXML(strJnlpURL));
Utility.endTag("jnlp-url");
*/ } | [
"public",
"void",
"printScreen",
"(",
"PrintWriter",
"out",
",",
"ResourceBundle",
"reg",
")",
"throws",
"DBException",
"{",
"out",
".",
"println",
"(",
"\"<html>\"",
")",
";",
"this",
".",
"printAppletHtmlScreen",
"(",
"out",
",",
"reg",
")",
";",
"out",
... | Code to display a Menu.
@exception DBException File exception. | [
"Code",
"to",
"display",
"a",
"Menu",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/html/XAppletHtmlScreen.java#L64-L82 |
apache/incubator-gobblin | gobblin-service/src/main/java/org/apache/gobblin/service/modules/scheduler/GobblinServiceJobScheduler.java | GobblinServiceJobScheduler.scheduleJob | @Override
public synchronized void scheduleJob(Properties jobProps, JobListener jobListener) throws JobException {
Map<String, Object> additionalJobDataMap = Maps.newHashMap();
additionalJobDataMap.put(ServiceConfigKeys.GOBBLIN_SERVICE_FLOWSPEC,
this.scheduledFlowSpecs.get(jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY)));
try {
scheduleJob(jobProps, jobListener, additionalJobDataMap, GobblinServiceJob.class);
} catch (Exception e) {
throw new JobException("Failed to schedule job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e);
}
} | java | @Override
public synchronized void scheduleJob(Properties jobProps, JobListener jobListener) throws JobException {
Map<String, Object> additionalJobDataMap = Maps.newHashMap();
additionalJobDataMap.put(ServiceConfigKeys.GOBBLIN_SERVICE_FLOWSPEC,
this.scheduledFlowSpecs.get(jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY)));
try {
scheduleJob(jobProps, jobListener, additionalJobDataMap, GobblinServiceJob.class);
} catch (Exception e) {
throw new JobException("Failed to schedule job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e);
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"scheduleJob",
"(",
"Properties",
"jobProps",
",",
"JobListener",
"jobListener",
")",
"throws",
"JobException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"additionalJobDataMap",
"=",
"Maps",
".",
"newHashMap"... | Synchronize the job scheduling because the same flowSpec can be scheduled by different threads. | [
"Synchronize",
"the",
"job",
"scheduling",
"because",
"the",
"same",
"flowSpec",
"can",
"be",
"scheduled",
"by",
"different",
"threads",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/scheduler/GobblinServiceJobScheduler.java#L191-L202 |
aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/box/MutableChar.java | MutableChar.fromExternal | public static MutableChar fromExternal(final Supplier<Character> s, final Consumer<Character> c) {
return new MutableChar() {
@Override
public char getAsChar() {
return s.get();
}
@Override
public Character get() {
return getAsChar();
}
@Override
public MutableChar set(final char value) {
c.accept(value);
return this;
}
};
} | java | public static MutableChar fromExternal(final Supplier<Character> s, final Consumer<Character> c) {
return new MutableChar() {
@Override
public char getAsChar() {
return s.get();
}
@Override
public Character get() {
return getAsChar();
}
@Override
public MutableChar set(final char value) {
c.accept(value);
return this;
}
};
} | [
"public",
"static",
"MutableChar",
"fromExternal",
"(",
"final",
"Supplier",
"<",
"Character",
">",
"s",
",",
"final",
"Consumer",
"<",
"Character",
">",
"c",
")",
"{",
"return",
"new",
"MutableChar",
"(",
")",
"{",
"@",
"Override",
"public",
"char",
"getA... | Construct a MutableChar that gets and sets an external value using the provided Supplier and Consumer
e.g.
<pre>
{@code
MutableChar mutable = MutableChar.fromExternal(()->!this.value,val->!this.value);
}
</pre>
@param s Supplier of an external value
@param c Consumer that sets an external value
@return MutableChar that gets / sets an external (mutable) value | [
"Construct",
"a",
"MutableChar",
"that",
"gets",
"and",
"sets",
"an",
"external",
"value",
"using",
"the",
"provided",
"Supplier",
"and",
"Consumer"
] | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/MutableChar.java#L81-L99 |
dropwizard/dropwizard | dropwizard-json-logging/src/main/java/io/dropwizard/logging/json/layout/MapBuilder.java | MapBuilder.addNumber | public MapBuilder addNumber(String fieldName, boolean include, Supplier<Number> supplier) {
if (include) {
Number value = supplier.get();
if (value != null) {
map.put(getFieldName(fieldName), value);
}
}
return this;
} | java | public MapBuilder addNumber(String fieldName, boolean include, Supplier<Number> supplier) {
if (include) {
Number value = supplier.get();
if (value != null) {
map.put(getFieldName(fieldName), value);
}
}
return this;
} | [
"public",
"MapBuilder",
"addNumber",
"(",
"String",
"fieldName",
",",
"boolean",
"include",
",",
"Supplier",
"<",
"Number",
">",
"supplier",
")",
"{",
"if",
"(",
"include",
")",
"{",
"Number",
"value",
"=",
"supplier",
".",
"get",
"(",
")",
";",
"if",
... | Adds the number value to the provided map under the provided field name,
if it should be included. The supplier is only invoked if the field is to be included. | [
"Adds",
"the",
"number",
"value",
"to",
"the",
"provided",
"map",
"under",
"the",
"provided",
"field",
"name",
"if",
"it",
"should",
"be",
"included",
".",
"The",
"supplier",
"is",
"only",
"invoked",
"if",
"the",
"field",
"is",
"to",
"be",
"included",
".... | train | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-json-logging/src/main/java/io/dropwizard/logging/json/layout/MapBuilder.java#L77-L85 |
vladmihalcea/flexy-pool | flexy-dropwizard3-metrics/src/main/java/com/vladmihalcea/flexypool/metric/codahale/JmxMetricReporter.java | JmxMetricReporter.init | @Override
public JmxMetricReporter init(ConfigurationProperties configurationProperties, MetricRegistry metricRegistry) {
if (configurationProperties.isJmxEnabled()) {
jmxReporter = JmxReporter
.forRegistry(metricRegistry)
.inDomain(MetricRegistry.name(getClass(), configurationProperties.getUniqueName()))
.build();
}
if(configurationProperties.isJmxAutoStart()) {
start();
}
return this;
} | java | @Override
public JmxMetricReporter init(ConfigurationProperties configurationProperties, MetricRegistry metricRegistry) {
if (configurationProperties.isJmxEnabled()) {
jmxReporter = JmxReporter
.forRegistry(metricRegistry)
.inDomain(MetricRegistry.name(getClass(), configurationProperties.getUniqueName()))
.build();
}
if(configurationProperties.isJmxAutoStart()) {
start();
}
return this;
} | [
"@",
"Override",
"public",
"JmxMetricReporter",
"init",
"(",
"ConfigurationProperties",
"configurationProperties",
",",
"MetricRegistry",
"metricRegistry",
")",
"{",
"if",
"(",
"configurationProperties",
".",
"isJmxEnabled",
"(",
")",
")",
"{",
"jmxReporter",
"=",
"Jm... | The JMX Reporter is activated only if the jmxEnabled property is set. If the jmxAutoStart property is enabled,
the JMX Reporter will start automatically.
@param configurationProperties configuration properties
@param metricRegistry metric registry
@return {@link JmxMetricReporter} | [
"The",
"JMX",
"Reporter",
"is",
"activated",
"only",
"if",
"the",
"jmxEnabled",
"property",
"is",
"set",
".",
"If",
"the",
"jmxAutoStart",
"property",
"is",
"enabled",
"the",
"JMX",
"Reporter",
"will",
"start",
"automatically",
"."
] | train | https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-dropwizard3-metrics/src/main/java/com/vladmihalcea/flexypool/metric/codahale/JmxMetricReporter.java#L25-L37 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/Segment.java | Segment.combineByCustomDictionary | protected static List<Vertex> combineByCustomDictionary(List<Vertex> vertexList, DoubleArrayTrie<CoreDictionary.Attribute> dat, final WordNet wordNetAll)
{
List<Vertex> outputList = combineByCustomDictionary(vertexList, dat);
int line = 0;
for (final Vertex vertex : outputList)
{
final int parentLength = vertex.realWord.length();
final int currentLine = line;
if (parentLength >= 3)
{
CustomDictionary.parseText(vertex.realWord, new AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute>()
{
@Override
public void hit(int begin, int end, CoreDictionary.Attribute value)
{
if (end - begin == parentLength) return;
wordNetAll.add(currentLine + begin, new Vertex(vertex.realWord.substring(begin, end), value));
}
});
}
line += parentLength;
}
return outputList;
} | java | protected static List<Vertex> combineByCustomDictionary(List<Vertex> vertexList, DoubleArrayTrie<CoreDictionary.Attribute> dat, final WordNet wordNetAll)
{
List<Vertex> outputList = combineByCustomDictionary(vertexList, dat);
int line = 0;
for (final Vertex vertex : outputList)
{
final int parentLength = vertex.realWord.length();
final int currentLine = line;
if (parentLength >= 3)
{
CustomDictionary.parseText(vertex.realWord, new AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute>()
{
@Override
public void hit(int begin, int end, CoreDictionary.Attribute value)
{
if (end - begin == parentLength) return;
wordNetAll.add(currentLine + begin, new Vertex(vertex.realWord.substring(begin, end), value));
}
});
}
line += parentLength;
}
return outputList;
} | [
"protected",
"static",
"List",
"<",
"Vertex",
">",
"combineByCustomDictionary",
"(",
"List",
"<",
"Vertex",
">",
"vertexList",
",",
"DoubleArrayTrie",
"<",
"CoreDictionary",
".",
"Attribute",
">",
"dat",
",",
"final",
"WordNet",
"wordNetAll",
")",
"{",
"List",
... | 使用用户词典合并粗分结果,并将用户词语收集到全词图中
@param vertexList 粗分结果
@param dat 用户自定义词典
@param wordNetAll 收集用户词语到全词图中
@return 合并后的结果 | [
"使用用户词典合并粗分结果,并将用户词语收集到全词图中"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Segment.java#L299-L322 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java | CPDefinitionPersistenceImpl.removeByUuid_C | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPDefinition cpDefinition : findByUuid_C(uuid, companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinition);
}
} | java | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPDefinition cpDefinition : findByUuid_C(uuid, companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinition);
}
} | [
"@",
"Override",
"public",
"void",
"removeByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"for",
"(",
"CPDefinition",
"cpDefinition",
":",
"findByUuid_C",
"(",
"uuid",
",",
"companyId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
... | Removes all the cp definitions where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID | [
"Removes",
"all",
"the",
"cp",
"definitions",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L1397-L1403 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java | Execution.triggerCheckpoint | public void triggerCheckpoint(long checkpointId, long timestamp, CheckpointOptions checkpointOptions) {
triggerCheckpointHelper(checkpointId, timestamp, checkpointOptions, false);
} | java | public void triggerCheckpoint(long checkpointId, long timestamp, CheckpointOptions checkpointOptions) {
triggerCheckpointHelper(checkpointId, timestamp, checkpointOptions, false);
} | [
"public",
"void",
"triggerCheckpoint",
"(",
"long",
"checkpointId",
",",
"long",
"timestamp",
",",
"CheckpointOptions",
"checkpointOptions",
")",
"{",
"triggerCheckpointHelper",
"(",
"checkpointId",
",",
"timestamp",
",",
"checkpointOptions",
",",
"false",
")",
";",
... | Trigger a new checkpoint on the task of this execution.
@param checkpointId of th checkpoint to trigger
@param timestamp of the checkpoint to trigger
@param checkpointOptions of the checkpoint to trigger | [
"Trigger",
"a",
"new",
"checkpoint",
"on",
"the",
"task",
"of",
"this",
"execution",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java#L868-L870 |
phax/ph-oton | ph-oton-core/src/main/java/com/helger/photon/core/longrun/LongRunningJobManager.java | LongRunningJobManager.onStartJob | @Nonnull
@Nonempty
public String onStartJob (@Nonnull final ILongRunningJob aJob, @Nullable final String sStartingUserID)
{
ValueEnforcer.notNull (aJob, "Job");
// Create a new unique in-memory ID
final String sJobID = GlobalIDFactory.getNewStringID ();
final LongRunningJobData aJobData = new LongRunningJobData (sJobID, aJob.getJobDescription (), sStartingUserID);
m_aRWLock.writeLocked ( () -> m_aRunningJobs.put (sJobID, aJobData));
return sJobID;
} | java | @Nonnull
@Nonempty
public String onStartJob (@Nonnull final ILongRunningJob aJob, @Nullable final String sStartingUserID)
{
ValueEnforcer.notNull (aJob, "Job");
// Create a new unique in-memory ID
final String sJobID = GlobalIDFactory.getNewStringID ();
final LongRunningJobData aJobData = new LongRunningJobData (sJobID, aJob.getJobDescription (), sStartingUserID);
m_aRWLock.writeLocked ( () -> m_aRunningJobs.put (sJobID, aJobData));
return sJobID;
} | [
"@",
"Nonnull",
"@",
"Nonempty",
"public",
"String",
"onStartJob",
"(",
"@",
"Nonnull",
"final",
"ILongRunningJob",
"aJob",
",",
"@",
"Nullable",
"final",
"String",
"sStartingUserID",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aJob",
",",
"\"Job\"",
")",... | Start a long running job
@param aJob
The job that is to be started
@param sStartingUserID
The ID of the user who started the job
@return The internal long running job ID | [
"Start",
"a",
"long",
"running",
"job"
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/longrun/LongRunningJobManager.java#L62-L73 |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphIterationElementComparator.java | GraphIterationElementComparator.compareConnections | @Pure
protected int compareConnections(PT p1, PT p2) {
assert p1 != null && p2 != null;
return p1.hashCode() - p2.hashCode();
} | java | @Pure
protected int compareConnections(PT p1, PT p2) {
assert p1 != null && p2 != null;
return p1.hashCode() - p2.hashCode();
} | [
"@",
"Pure",
"protected",
"int",
"compareConnections",
"(",
"PT",
"p1",
",",
"PT",
"p2",
")",
"{",
"assert",
"p1",
"!=",
"null",
"&&",
"p2",
"!=",
"null",
";",
"return",
"p1",
".",
"hashCode",
"(",
")",
"-",
"p2",
".",
"hashCode",
"(",
")",
";",
... | Compare the two given entry points.
@param p1 the first connection.
@param p2 the second connection.
@return <code>-1</code> if {@code p1} is lower than {@code p2},
<code>1</code> if {@code p1} is greater than {@code p2},
otherwise <code>0</code>. | [
"Compare",
"the",
"two",
"given",
"entry",
"points",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphIterationElementComparator.java#L90-L94 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/xml/ReceiveMessageActionParser.java | ReceiveMessageActionParser.parseXPathValidationElements | private void parseXPathValidationElements(Element messageElement, XpathMessageValidationContext context) {
//check for validate elements, these elements can either have script, xpath or namespace validation information
//for now we only handle xpath validation
Map<String, Object> validateXpathExpressions = new HashMap<>();
List<?> validateElements = DomUtils.getChildElementsByTagName(messageElement, "validate");
if (validateElements.size() > 0) {
for (Iterator<?> iter = validateElements.iterator(); iter.hasNext();) {
Element validateElement = (Element) iter.next();
extractXPathValidateExpressions(validateElement, validateXpathExpressions);
}
context.setXpathExpressions(validateXpathExpressions);
}
} | java | private void parseXPathValidationElements(Element messageElement, XpathMessageValidationContext context) {
//check for validate elements, these elements can either have script, xpath or namespace validation information
//for now we only handle xpath validation
Map<String, Object> validateXpathExpressions = new HashMap<>();
List<?> validateElements = DomUtils.getChildElementsByTagName(messageElement, "validate");
if (validateElements.size() > 0) {
for (Iterator<?> iter = validateElements.iterator(); iter.hasNext();) {
Element validateElement = (Element) iter.next();
extractXPathValidateExpressions(validateElement, validateXpathExpressions);
}
context.setXpathExpressions(validateXpathExpressions);
}
} | [
"private",
"void",
"parseXPathValidationElements",
"(",
"Element",
"messageElement",
",",
"XpathMessageValidationContext",
"context",
")",
"{",
"//check for validate elements, these elements can either have script, xpath or namespace validation information",
"//for now we only handle xpath v... | Parses validation elements and adds information to the message validation context.
@param messageElement the message DOM element.
@param context the message validation context. | [
"Parses",
"validation",
"elements",
"and",
"adds",
"information",
"to",
"the",
"message",
"validation",
"context",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/ReceiveMessageActionParser.java#L406-L420 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LocalNetworkGatewaysInner.java | LocalNetworkGatewaysInner.updateTagsAsync | public Observable<LocalNetworkGatewayInner> updateTagsAsync(String resourceGroupName, String localNetworkGatewayName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName, tags).map(new Func1<ServiceResponse<LocalNetworkGatewayInner>, LocalNetworkGatewayInner>() {
@Override
public LocalNetworkGatewayInner call(ServiceResponse<LocalNetworkGatewayInner> response) {
return response.body();
}
});
} | java | public Observable<LocalNetworkGatewayInner> updateTagsAsync(String resourceGroupName, String localNetworkGatewayName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName, tags).map(new Func1<ServiceResponse<LocalNetworkGatewayInner>, LocalNetworkGatewayInner>() {
@Override
public LocalNetworkGatewayInner call(ServiceResponse<LocalNetworkGatewayInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LocalNetworkGatewayInner",
">",
"updateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"localNetworkGatewayName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync"... | Updates a local network gateway tags.
@param resourceGroupName The name of the resource group.
@param localNetworkGatewayName The name of the local network gateway.
@param tags Resource tags.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"a",
"local",
"network",
"gateway",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LocalNetworkGatewaysInner.java#L617-L624 |
greenmail-mail-test/greenmail | greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java | GreenMailUtil.sendMimeMessage | public static void sendMimeMessage(MimeMessage mimeMessage) {
try {
Transport.send(mimeMessage);
} catch (MessagingException e) {
throw new IllegalStateException("Can not send message " + mimeMessage, e);
}
} | java | public static void sendMimeMessage(MimeMessage mimeMessage) {
try {
Transport.send(mimeMessage);
} catch (MessagingException e) {
throw new IllegalStateException("Can not send message " + mimeMessage, e);
}
} | [
"public",
"static",
"void",
"sendMimeMessage",
"(",
"MimeMessage",
"mimeMessage",
")",
"{",
"try",
"{",
"Transport",
".",
"send",
"(",
"mimeMessage",
")",
";",
"}",
"catch",
"(",
"MessagingException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"("... | Send the message using the JavaMail session defined in the message
@param mimeMessage Message to send | [
"Send",
"the",
"message",
"using",
"the",
"JavaMail",
"session",
"defined",
"in",
"the",
"message"
] | train | https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java#L271-L277 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressClient.java | AddressClient.insertAddress | @BetaApi
public final Operation insertAddress(String region, Address addressResource) {
InsertAddressHttpRequest request =
InsertAddressHttpRequest.newBuilder()
.setRegion(region)
.setAddressResource(addressResource)
.build();
return insertAddress(request);
} | java | @BetaApi
public final Operation insertAddress(String region, Address addressResource) {
InsertAddressHttpRequest request =
InsertAddressHttpRequest.newBuilder()
.setRegion(region)
.setAddressResource(addressResource)
.build();
return insertAddress(request);
} | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"insertAddress",
"(",
"String",
"region",
",",
"Address",
"addressResource",
")",
"{",
"InsertAddressHttpRequest",
"request",
"=",
"InsertAddressHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setRegion",
"(",
"region... | Creates an address resource in the specified project using the data included in the request.
<p>Sample code:
<pre><code>
try (AddressClient addressClient = AddressClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
Address addressResource = Address.newBuilder().build();
Operation response = addressClient.insertAddress(region.toString(), addressResource);
}
</code></pre>
@param region Name of the region for this request.
@param addressResource A reserved address resource. (== resource_for beta.addresses ==) (==
resource_for v1.addresses ==) (== resource_for beta.globalAddresses ==) (== resource_for
v1.globalAddresses ==)
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"an",
"address",
"resource",
"in",
"the",
"specified",
"project",
"using",
"the",
"data",
"included",
"in",
"the",
"request",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressClient.java#L537-L546 |
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.addDataLakeStoreAccountAsync | public Observable<Void> addDataLakeStoreAccountAsync(String resourceGroupName, String accountName, String dataLakeStoreAccountName, AddDataLakeStoreParameters parameters) {
return addDataLakeStoreAccountWithServiceResponseAsync(resourceGroupName, accountName, dataLakeStoreAccountName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> addDataLakeStoreAccountAsync(String resourceGroupName, String accountName, String dataLakeStoreAccountName, AddDataLakeStoreParameters parameters) {
return addDataLakeStoreAccountWithServiceResponseAsync(resourceGroupName, accountName, dataLakeStoreAccountName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"addDataLakeStoreAccountAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"dataLakeStoreAccountName",
",",
"AddDataLakeStoreParameters",
"parameters",
")",
"{",
"return",
"addDataLakeStoreAccou... | Updates the specified Data Lake Analytics account to include the additional Data Lake Store account.
@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 to which to add the Data Lake Store account.
@param dataLakeStoreAccountName The name of the Data Lake Store account to add.
@param parameters The details of the Data Lake Store account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Updates",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
"to",
"include",
"the",
"additional",
"Data",
"Lake",
"Store",
"account",
"."
] | 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#L1161-L1168 |
wildfly/wildfly-core | logging/src/main/java/org/jboss/as/logging/LoggingSubsystemParser.java | LoggingSubsystemParser.addOperationAddress | static void addOperationAddress(final ModelNode operation, final PathAddress base, final String key, final String value) {
operation.get(OP_ADDR).set(base.append(key, value).toModelNode());
} | java | static void addOperationAddress(final ModelNode operation, final PathAddress base, final String key, final String value) {
operation.get(OP_ADDR).set(base.append(key, value).toModelNode());
} | [
"static",
"void",
"addOperationAddress",
"(",
"final",
"ModelNode",
"operation",
",",
"final",
"PathAddress",
"base",
",",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"operation",
".",
"get",
"(",
"OP_ADDR",
")",
".",
"set",
"(",
"... | Appends the key and value to the address and sets the address on the operation.
@param operation the operation to set the address on
@param base the base address
@param key the key for the new address
@param value the value for the new address | [
"Appends",
"the",
"key",
"and",
"value",
"to",
"the",
"address",
"and",
"sets",
"the",
"address",
"on",
"the",
"operation",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/LoggingSubsystemParser.java#L69-L71 |
lecousin/java-framework-core | net.lecousin.core/src/main/java/net/lecousin/framework/memory/Cache.java | Cache.get | public synchronized Value get(Key key, CloseableListenable user) {
Data<Value> data = map.get(key);
if (data == null) return null;
data.users.add(user);
if (user != null)
user.addCloseListener(new Listener<CloseableListenable>() {
@Override
public void fire(CloseableListenable event) {
event.removeCloseListener(this);
free(data.value, event);
}
});
return data.value;
} | java | public synchronized Value get(Key key, CloseableListenable user) {
Data<Value> data = map.get(key);
if (data == null) return null;
data.users.add(user);
if (user != null)
user.addCloseListener(new Listener<CloseableListenable>() {
@Override
public void fire(CloseableListenable event) {
event.removeCloseListener(this);
free(data.value, event);
}
});
return data.value;
} | [
"public",
"synchronized",
"Value",
"get",
"(",
"Key",
"key",
",",
"CloseableListenable",
"user",
")",
"{",
"Data",
"<",
"Value",
">",
"data",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"data",
"==",
"null",
")",
"return",
"null",
";",
... | Return the cached data corresponding to the given key, or null if it does not exist.
The given user is added as using the cached data. Once closed, the user is automatically
removed from the list of users. | [
"Return",
"the",
"cached",
"data",
"corresponding",
"to",
"the",
"given",
"key",
"or",
"null",
"if",
"it",
"does",
"not",
"exist",
".",
"The",
"given",
"user",
"is",
"added",
"as",
"using",
"the",
"cached",
"data",
".",
"Once",
"closed",
"the",
"user",
... | train | https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/memory/Cache.java#L51-L64 |
SvenEwald/xmlbeam | src/main/java/org/xmlbeam/ProjectionInvocationHandler.java | ProjectionInvocationHandler.findTargetComponentType | private static Class<?> findTargetComponentType(final Method method) {
final Class<?> returnType = method.getReturnType();
if (returnType.isArray()) {
return method.getReturnType().getComponentType();
}
if (!(List.class.equals(returnType) || (Map.class.equals(returnType)) || XBAutoMap.class.isAssignableFrom(returnType) || XBAutoList.class.equals(returnType) || XBAutoValue.class.equals(returnType) || ReflectionHelper.isStreamClass(returnType))) {
return null;
}
final Type type = method.getGenericReturnType();
if (!(type instanceof ParameterizedType) || (((ParameterizedType) type).getActualTypeArguments() == null) || (((ParameterizedType) type).getActualTypeArguments().length < 1)) {
throw new IllegalArgumentException("When using List as return type for method " + method + ", please specify a generic type for the List. Otherwise I do not know which type I should fill the List with.");
}
int index = Map.class.equals(returnType) ? 1 : 0;
assert index < ((ParameterizedType) type).getActualTypeArguments().length;
Type componentType = ((ParameterizedType) type).getActualTypeArguments()[index];
if (!(componentType instanceof Class)) {
throw new IllegalArgumentException("I don't know how to instantiate the generic type for the return type of method " + method);
}
return (Class<?>) componentType;
} | java | private static Class<?> findTargetComponentType(final Method method) {
final Class<?> returnType = method.getReturnType();
if (returnType.isArray()) {
return method.getReturnType().getComponentType();
}
if (!(List.class.equals(returnType) || (Map.class.equals(returnType)) || XBAutoMap.class.isAssignableFrom(returnType) || XBAutoList.class.equals(returnType) || XBAutoValue.class.equals(returnType) || ReflectionHelper.isStreamClass(returnType))) {
return null;
}
final Type type = method.getGenericReturnType();
if (!(type instanceof ParameterizedType) || (((ParameterizedType) type).getActualTypeArguments() == null) || (((ParameterizedType) type).getActualTypeArguments().length < 1)) {
throw new IllegalArgumentException("When using List as return type for method " + method + ", please specify a generic type for the List. Otherwise I do not know which type I should fill the List with.");
}
int index = Map.class.equals(returnType) ? 1 : 0;
assert index < ((ParameterizedType) type).getActualTypeArguments().length;
Type componentType = ((ParameterizedType) type).getActualTypeArguments()[index];
if (!(componentType instanceof Class)) {
throw new IllegalArgumentException("I don't know how to instantiate the generic type for the return type of method " + method);
}
return (Class<?>) componentType;
} | [
"private",
"static",
"Class",
"<",
"?",
">",
"findTargetComponentType",
"(",
"final",
"Method",
"method",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"returnType",
"=",
"method",
".",
"getReturnType",
"(",
")",
";",
"if",
"(",
"returnType",
".",
"isArray",
... | When reading collections, determine the collection component type.
@param method
@return | [
"When",
"reading",
"collections",
"determine",
"the",
"collection",
"component",
"type",
"."
] | train | https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/ProjectionInvocationHandler.java#L921-L942 |
actframework/actframework | src/main/java/act/inject/param/ParamValueLoaderService.java | ParamValueLoaderService.findHandlerMethodAnnotation | private ParamValueLoader findHandlerMethodAnnotation(final Class<? extends Annotation> annoType, ActContext<?> ctx) {
if (null == ctx) {
return ParamValueLoader.NIL;
}
return new ParamValueLoader.NonCacheable() {
@Override
public Object load(Object bean, ActContext<?> ctx, boolean noDefaultValue) {
Method handlerMethod = ctx.handlerMethod();
Method curMethod = ctx.currentMethod();
boolean methodIsCurrent = handlerMethod == curMethod || null == curMethod;
Annotation anno = handlerMethod.getAnnotation(annoType);
if (null == anno && !methodIsCurrent) {
anno = curMethod.getAnnotation(annoType);
}
return anno;
}
};
} | java | private ParamValueLoader findHandlerMethodAnnotation(final Class<? extends Annotation> annoType, ActContext<?> ctx) {
if (null == ctx) {
return ParamValueLoader.NIL;
}
return new ParamValueLoader.NonCacheable() {
@Override
public Object load(Object bean, ActContext<?> ctx, boolean noDefaultValue) {
Method handlerMethod = ctx.handlerMethod();
Method curMethod = ctx.currentMethod();
boolean methodIsCurrent = handlerMethod == curMethod || null == curMethod;
Annotation anno = handlerMethod.getAnnotation(annoType);
if (null == anno && !methodIsCurrent) {
anno = curMethod.getAnnotation(annoType);
}
return anno;
}
};
} | [
"private",
"ParamValueLoader",
"findHandlerMethodAnnotation",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annoType",
",",
"ActContext",
"<",
"?",
">",
"ctx",
")",
"{",
"if",
"(",
"null",
"==",
"ctx",
")",
"{",
"return",
"ParamValueLoader",
... | Returns a `ParamValueLoader` that load annotation from:
* the handler method
* the current method (might be a intercepter method)
@param annoType
the annotation type
@param ctx
the current {@link ActContext}
@return a `ParamValueLoader` instance | [
"Returns",
"a",
"ParamValueLoader",
"that",
"load",
"annotation",
"from",
":",
"*",
"the",
"handler",
"method",
"*",
"the",
"current",
"method",
"(",
"might",
"be",
"a",
"intercepter",
"method",
")"
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/inject/param/ParamValueLoaderService.java#L402-L420 |
lessthanoptimal/ddogleg | src/org/ddogleg/optimization/math/HessianSchurComplement_DSCC.java | HessianSchurComplement_DSCC.computeHessian | @Override
public void computeHessian(DMatrixSparseCSC jacLeft , DMatrixSparseCSC jacRight) {
A.reshape(jacLeft.numCols,jacLeft.numCols,1);
B.reshape(jacLeft.numCols,jacRight.numCols,1);
D.reshape(jacRight.numCols,jacRight.numCols,1);
// take advantage of the inner product's symmetry when possible to reduce
// the number of calculations
CommonOps_DSCC.innerProductLower(jacLeft,tmp0,gw,gx);
CommonOps_DSCC.symmLowerToFull(tmp0,A,gw);
CommonOps_DSCC.multTransA(jacLeft,jacRight,B,gw,gx);
CommonOps_DSCC.innerProductLower(jacRight,tmp0,gw,gx);
CommonOps_DSCC.symmLowerToFull(tmp0,D,gw);
} | java | @Override
public void computeHessian(DMatrixSparseCSC jacLeft , DMatrixSparseCSC jacRight) {
A.reshape(jacLeft.numCols,jacLeft.numCols,1);
B.reshape(jacLeft.numCols,jacRight.numCols,1);
D.reshape(jacRight.numCols,jacRight.numCols,1);
// take advantage of the inner product's symmetry when possible to reduce
// the number of calculations
CommonOps_DSCC.innerProductLower(jacLeft,tmp0,gw,gx);
CommonOps_DSCC.symmLowerToFull(tmp0,A,gw);
CommonOps_DSCC.multTransA(jacLeft,jacRight,B,gw,gx);
CommonOps_DSCC.innerProductLower(jacRight,tmp0,gw,gx);
CommonOps_DSCC.symmLowerToFull(tmp0,D,gw);
} | [
"@",
"Override",
"public",
"void",
"computeHessian",
"(",
"DMatrixSparseCSC",
"jacLeft",
",",
"DMatrixSparseCSC",
"jacRight",
")",
"{",
"A",
".",
"reshape",
"(",
"jacLeft",
".",
"numCols",
",",
"jacLeft",
".",
"numCols",
",",
"1",
")",
";",
"B",
".",
"resh... | Compuets the Hessian in block form
@param jacLeft (Input) Left side of Jacobian
@param jacRight (Input) Right side of Jacobian | [
"Compuets",
"the",
"Hessian",
"in",
"block",
"form"
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/math/HessianSchurComplement_DSCC.java#L60-L73 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/JobLeaderService.java | JobLeaderService.addJob | public void addJob(final JobID jobId, final String defaultTargetAddress) throws Exception {
Preconditions.checkState(JobLeaderService.State.STARTED == state, "The service is currently not running.");
LOG.info("Add job {} for job leader monitoring.", jobId);
final LeaderRetrievalService leaderRetrievalService = highAvailabilityServices.getJobManagerLeaderRetriever(
jobId,
defaultTargetAddress);
JobLeaderService.JobManagerLeaderListener jobManagerLeaderListener = new JobManagerLeaderListener(jobId);
final Tuple2<LeaderRetrievalService, JobManagerLeaderListener> oldEntry = jobLeaderServices.put(jobId, Tuple2.of(leaderRetrievalService, jobManagerLeaderListener));
if (oldEntry != null) {
oldEntry.f0.stop();
oldEntry.f1.stop();
}
leaderRetrievalService.start(jobManagerLeaderListener);
} | java | public void addJob(final JobID jobId, final String defaultTargetAddress) throws Exception {
Preconditions.checkState(JobLeaderService.State.STARTED == state, "The service is currently not running.");
LOG.info("Add job {} for job leader monitoring.", jobId);
final LeaderRetrievalService leaderRetrievalService = highAvailabilityServices.getJobManagerLeaderRetriever(
jobId,
defaultTargetAddress);
JobLeaderService.JobManagerLeaderListener jobManagerLeaderListener = new JobManagerLeaderListener(jobId);
final Tuple2<LeaderRetrievalService, JobManagerLeaderListener> oldEntry = jobLeaderServices.put(jobId, Tuple2.of(leaderRetrievalService, jobManagerLeaderListener));
if (oldEntry != null) {
oldEntry.f0.stop();
oldEntry.f1.stop();
}
leaderRetrievalService.start(jobManagerLeaderListener);
} | [
"public",
"void",
"addJob",
"(",
"final",
"JobID",
"jobId",
",",
"final",
"String",
"defaultTargetAddress",
")",
"throws",
"Exception",
"{",
"Preconditions",
".",
"checkState",
"(",
"JobLeaderService",
".",
"State",
".",
"STARTED",
"==",
"state",
",",
"\"The ser... | Add the given job to be monitored. This means that the service tries to detect leaders for
this job and then tries to establish a connection to it.
@param jobId identifying the job to monitor
@param defaultTargetAddress of the job leader
@throws Exception if an error occurs while starting the leader retrieval service | [
"Add",
"the",
"given",
"job",
"to",
"be",
"monitored",
".",
"This",
"means",
"that",
"the",
"service",
"tries",
"to",
"detect",
"leaders",
"for",
"this",
"job",
"and",
"then",
"tries",
"to",
"establish",
"a",
"connection",
"to",
"it",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/JobLeaderService.java#L190-L209 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/glazedlists/GlazedListsSupport.java | GlazedListsSupport.makeTableFormat | public static TableFormat makeTableFormat(final TableDescription desc)
{
return new AdvancedWritableTableFormat()
{
public Class getColumnClass(int i)
{
return desc.getType(i);
}
public Comparator getColumnComparator(int i)
{
Comparator comp = desc.getColumnComparator(i);
if (comp != null)
return comp;
Class type = getColumnClass(i);
if (Boolean.class.isAssignableFrom(type) || Boolean.TYPE.isAssignableFrom(type))
return GlazedLists.booleanComparator();
else if (String.class.isAssignableFrom(type))
return getLowerCaseStringComparator();
else if(Comparable.class.isAssignableFrom(type))
return GlazedLists.comparableComparator();
else
return null;
}
public int getColumnCount()
{
return desc.getColumnCount();
}
public String getColumnName(int i)
{
return desc.getHeader(i);
}
public Object getColumnValue(Object obj, int i)
{
return desc.getValue(obj, i);
}
public boolean isEditable(Object baseObject, int column)
{
return desc.getColumnEditor(column) != null;
}
public Object setColumnValue(Object baseObject, Object editedValue, int column)
{
desc.setValue(baseObject, column, editedValue);
return baseObject;
}
};
} | java | public static TableFormat makeTableFormat(final TableDescription desc)
{
return new AdvancedWritableTableFormat()
{
public Class getColumnClass(int i)
{
return desc.getType(i);
}
public Comparator getColumnComparator(int i)
{
Comparator comp = desc.getColumnComparator(i);
if (comp != null)
return comp;
Class type = getColumnClass(i);
if (Boolean.class.isAssignableFrom(type) || Boolean.TYPE.isAssignableFrom(type))
return GlazedLists.booleanComparator();
else if (String.class.isAssignableFrom(type))
return getLowerCaseStringComparator();
else if(Comparable.class.isAssignableFrom(type))
return GlazedLists.comparableComparator();
else
return null;
}
public int getColumnCount()
{
return desc.getColumnCount();
}
public String getColumnName(int i)
{
return desc.getHeader(i);
}
public Object getColumnValue(Object obj, int i)
{
return desc.getValue(obj, i);
}
public boolean isEditable(Object baseObject, int column)
{
return desc.getColumnEditor(column) != null;
}
public Object setColumnValue(Object baseObject, Object editedValue, int column)
{
desc.setValue(baseObject, column, editedValue);
return baseObject;
}
};
} | [
"public",
"static",
"TableFormat",
"makeTableFormat",
"(",
"final",
"TableDescription",
"desc",
")",
"{",
"return",
"new",
"AdvancedWritableTableFormat",
"(",
")",
"{",
"public",
"Class",
"getColumnClass",
"(",
"int",
"i",
")",
"{",
"return",
"desc",
".",
"getTy... | Conversion of RCP TableDescription to GlazedLists TableFormat
@param desc
@return AdvancedWritableTableFormat | [
"Conversion",
"of",
"RCP",
"TableDescription",
"to",
"GlazedLists",
"TableFormat"
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/glazedlists/GlazedListsSupport.java#L48-L100 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/XMLProperties.java | XMLProperties.getProperty | public String getProperty(String pKey, String pDefaultValue) {
// Had to override this because Properties uses super.get()...
String value = (String) get(pKey); // Safe cast, see get(Object)
if (value != null) {
return value;
}
return ((defaults != null)
? defaults.getProperty(pKey)
: pDefaultValue);
} | java | public String getProperty(String pKey, String pDefaultValue) {
// Had to override this because Properties uses super.get()...
String value = (String) get(pKey); // Safe cast, see get(Object)
if (value != null) {
return value;
}
return ((defaults != null)
? defaults.getProperty(pKey)
: pDefaultValue);
} | [
"public",
"String",
"getProperty",
"(",
"String",
"pKey",
",",
"String",
"pDefaultValue",
")",
"{",
"// Had to override this because Properties uses super.get()...\r",
"String",
"value",
"=",
"(",
"String",
")",
"get",
"(",
"pKey",
")",
";",
"// Safe cast, see get(Objec... | Searches for the property with the specified key in this property list.
If the key is not found in this property list, the default property list,
and its defaults, recursively, are then checked. The method returns the
default value argument if the property is not found.
@param pKey the hashtable key.
@param pDefaultValue a default value.
@return the value in this property list with the specified key value.
@see #setProperty
@see #defaults | [
"Searches",
"for",
"the",
"property",
"with",
"the",
"specified",
"key",
"in",
"this",
"property",
"list",
".",
"If",
"the",
"key",
"is",
"not",
"found",
"in",
"this",
"property",
"list",
"the",
"default",
"property",
"list",
"and",
"its",
"defaults",
"rec... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/XMLProperties.java#L624-L635 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java | MapExtensions.operator_remove | @Inline(value = "$1.remove($2.getKey(), $2.getValue())", statementExpression = true)
public static <K, V> boolean operator_remove(Map<K, V> map, Pair<? extends K, ? extends V> entry) {
//TODO use the JRE 1.8 API: map.remove(entry.getKey(), entry.getValue());
final K key = entry.getKey();
final V storedValue = map.get(entry.getKey());
if (!Objects.equal(storedValue, entry.getValue())
|| (storedValue == null && !map.containsKey(key))) {
return false;
}
map.remove(key);
return true;
} | java | @Inline(value = "$1.remove($2.getKey(), $2.getValue())", statementExpression = true)
public static <K, V> boolean operator_remove(Map<K, V> map, Pair<? extends K, ? extends V> entry) {
//TODO use the JRE 1.8 API: map.remove(entry.getKey(), entry.getValue());
final K key = entry.getKey();
final V storedValue = map.get(entry.getKey());
if (!Objects.equal(storedValue, entry.getValue())
|| (storedValue == null && !map.containsKey(key))) {
return false;
}
map.remove(key);
return true;
} | [
"@",
"Inline",
"(",
"value",
"=",
"\"$1.remove($2.getKey(), $2.getValue())\"",
",",
"statementExpression",
"=",
"true",
")",
"public",
"static",
"<",
"K",
",",
"V",
">",
"boolean",
"operator_remove",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"Pair",
... | Remove the given pair into the map.
<p>
If the given key is inside the map, but is not mapped to the given value, the
map will not be changed.
</p>
@param <K> type of the map keys.
@param <V> type of the map values.
@param map the map to update.
@param entry the entry (key, value) to remove from the map.
@return {@code true} if the pair was removed.
@since 2.15 | [
"Remove",
"the",
"given",
"pair",
"into",
"the",
"map",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java#L226-L237 |
aws/aws-sdk-java | aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/StepFunctionBuilder.java | StepFunctionBuilder.lte | public static TimestampLessThanOrEqualCondition.Builder lte(String variable, Date expectedValue) {
return TimestampLessThanOrEqualCondition.builder().variable(variable).expectedValue(expectedValue);
} | java | public static TimestampLessThanOrEqualCondition.Builder lte(String variable, Date expectedValue) {
return TimestampLessThanOrEqualCondition.builder().variable(variable).expectedValue(expectedValue);
} | [
"public",
"static",
"TimestampLessThanOrEqualCondition",
".",
"Builder",
"lte",
"(",
"String",
"variable",
",",
"Date",
"expectedValue",
")",
"{",
"return",
"TimestampLessThanOrEqualCondition",
".",
"builder",
"(",
")",
".",
"variable",
"(",
"variable",
")",
".",
... | Binary condition for Timestamp less than or equal to comparison. Dates are converted to ISO8601 UTC timestamps.
@param variable The JSONPath expression that determines which piece of the input document is used for the comparison.
@param expectedValue The expected value for this condition.
@see <a href="https://states-language.net/spec.html#choice-state">https://states-language.net/spec.html#choice-state</a>
@see com.amazonaws.services.stepfunctions.builder.states.Choice | [
"Binary",
"condition",
"for",
"Timestamp",
"less",
"than",
"or",
"equal",
"to",
"comparison",
".",
"Dates",
"are",
"converted",
"to",
"ISO8601",
"UTC",
"timestamps",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/StepFunctionBuilder.java#L452-L454 |
UrielCh/ovh-java-sdk | ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java | ApiOvhMsServices.serviceName_account_userPrincipalName_exchange_GET | public OvhExchangeInformation serviceName_account_userPrincipalName_exchange_GET(String serviceName, String userPrincipalName) throws IOException {
String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/exchange";
StringBuilder sb = path(qPath, serviceName, userPrincipalName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhExchangeInformation.class);
} | java | public OvhExchangeInformation serviceName_account_userPrincipalName_exchange_GET(String serviceName, String userPrincipalName) throws IOException {
String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/exchange";
StringBuilder sb = path(qPath, serviceName, userPrincipalName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhExchangeInformation.class);
} | [
"public",
"OvhExchangeInformation",
"serviceName_account_userPrincipalName_exchange_GET",
"(",
"String",
"serviceName",
",",
"String",
"userPrincipalName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/msServices/{serviceName}/account/{userPrincipalName}/exchange\"",... | Get this object properties
REST: GET /msServices/{serviceName}/account/{userPrincipalName}/exchange
@param serviceName [required] The internal name of your Active Directory organization
@param userPrincipalName [required] User Principal Name
API beta | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java#L386-L391 |
jsurfer/JsonSurfer | jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java | JsonSurfer.collectAll | public Collection<Object> collectAll(String json, JsonPath... paths) {
return collectAll(json, Object.class, paths);
} | java | public Collection<Object> collectAll(String json, JsonPath... paths) {
return collectAll(json, Object.class, paths);
} | [
"public",
"Collection",
"<",
"Object",
">",
"collectAll",
"(",
"String",
"json",
",",
"JsonPath",
"...",
"paths",
")",
"{",
"return",
"collectAll",
"(",
"json",
",",
"Object",
".",
"class",
",",
"paths",
")",
";",
"}"
] | Collect all matched value into a collection
@param json Json string
@param paths JsonPath
@return collection | [
"Collect",
"all",
"matched",
"value",
"into",
"a",
"collection"
] | train | https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L272-L274 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/DateTimeField.java | DateTimeField.doSetData | public int doSetData(Object vpData, boolean bDisplayOption, int iMoveMode)
{
if ((vpData != null) && (!(vpData instanceof java.util.Date)))
return DBConstants.ERROR_RETURN;
return super.doSetData(vpData, bDisplayOption, iMoveMode);
} | java | public int doSetData(Object vpData, boolean bDisplayOption, int iMoveMode)
{
if ((vpData != null) && (!(vpData instanceof java.util.Date)))
return DBConstants.ERROR_RETURN;
return super.doSetData(vpData, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"doSetData",
"(",
"Object",
"vpData",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"if",
"(",
"(",
"vpData",
"!=",
"null",
")",
"&&",
"(",
"!",
"(",
"vpData",
"instanceof",
"java",
".",
"util",
".",
"Date",
")",... | Move this physical binary data to this field.
Must be java Date type.
@param data The physical data to move to this field (must be the correct raw data class).
@param bDisplayOption If true, display after setting the data.
@param iMoveMode The type of move.
@return an error code (0 if success). | [
"Move",
"this",
"physical",
"binary",
"data",
"to",
"this",
"field",
".",
"Must",
"be",
"java",
"Date",
"type",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L475-L480 |
google/closure-compiler | src/com/google/javascript/jscomp/GenerateExports.java | GenerateExports.addExportMethod | private void addExportMethod(Map<String, Node> exports, String export, Node context) {
// We can export as a property if any of the following conditions holds:
// a) ES6 class members, which the above `addExportForEs6Method` handles
// b) this is a property on a name which is also being exported
// c) this is a prototype property
String methodOwnerName = null; // the object this method is on, null for exported names.
boolean isEs5StylePrototypeAssignment = false; // If this is a prototype property
String propertyName = null;
if (context.getFirstChild().isGetProp()) { // e.g. `/** @export */ a.prototype.b = obj;`
Node node = context.getFirstChild(); // e.g. get `a.prototype.b`
Node ownerNode = node.getFirstChild(); // e.g. get `a.prototype`
methodOwnerName = ownerNode.getQualifiedName(); // e.g. get the string "a.prototype"
if (ownerNode.isGetProp()
&& ownerNode.getLastChild().getString().equals(PROTOTYPE_PROPERTY)) {
// e.g. true if ownerNode is `a.prototype`
// false if this export were `/** @export */ a.b = obj;` instead
isEs5StylePrototypeAssignment = true;
}
propertyName = node.getSecondChild().getString();
}
boolean useExportSymbol = true;
if (isEs5StylePrototypeAssignment) {
useExportSymbol = false;
} else if (methodOwnerName != null && exports.containsKey(methodOwnerName)) {
useExportSymbol = false;
}
if (useExportSymbol) {
addExportSymbolCall(export, context);
} else {
addExportPropertyCall(methodOwnerName, context, export, propertyName);
}
} | java | private void addExportMethod(Map<String, Node> exports, String export, Node context) {
// We can export as a property if any of the following conditions holds:
// a) ES6 class members, which the above `addExportForEs6Method` handles
// b) this is a property on a name which is also being exported
// c) this is a prototype property
String methodOwnerName = null; // the object this method is on, null for exported names.
boolean isEs5StylePrototypeAssignment = false; // If this is a prototype property
String propertyName = null;
if (context.getFirstChild().isGetProp()) { // e.g. `/** @export */ a.prototype.b = obj;`
Node node = context.getFirstChild(); // e.g. get `a.prototype.b`
Node ownerNode = node.getFirstChild(); // e.g. get `a.prototype`
methodOwnerName = ownerNode.getQualifiedName(); // e.g. get the string "a.prototype"
if (ownerNode.isGetProp()
&& ownerNode.getLastChild().getString().equals(PROTOTYPE_PROPERTY)) {
// e.g. true if ownerNode is `a.prototype`
// false if this export were `/** @export */ a.b = obj;` instead
isEs5StylePrototypeAssignment = true;
}
propertyName = node.getSecondChild().getString();
}
boolean useExportSymbol = true;
if (isEs5StylePrototypeAssignment) {
useExportSymbol = false;
} else if (methodOwnerName != null && exports.containsKey(methodOwnerName)) {
useExportSymbol = false;
}
if (useExportSymbol) {
addExportSymbolCall(export, context);
} else {
addExportPropertyCall(methodOwnerName, context, export, propertyName);
}
} | [
"private",
"void",
"addExportMethod",
"(",
"Map",
"<",
"String",
",",
"Node",
">",
"exports",
",",
"String",
"export",
",",
"Node",
"context",
")",
"{",
"// We can export as a property if any of the following conditions holds:",
"// a) ES6 class members, which the above `addE... | Emits a call to either goog.exportProperty or goog.exportSymbol.
<p>Attempts to optimize by creating a property export instead of a symbol export, because
property exports are significantly simpler/faster.
@param export The fully qualified name of the object we want to export
@param context The node on which the @export annotation was found | [
"Emits",
"a",
"call",
"to",
"either",
"goog",
".",
"exportProperty",
"or",
"goog",
".",
"exportSymbol",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/GenerateExports.java#L135-L169 |
Netflix/netflix-graph | src/main/java/com/netflix/nfgraph/build/NFBuildGraph.java | NFBuildGraph.getOrCreateNode | public NFBuildGraphNode getOrCreateNode(NFBuildGraphNodeList nodes, NFNodeSpec nodeSpec, int ordinal) {
return nodeCache.getNode(nodes, nodeSpec, ordinal);
} | java | public NFBuildGraphNode getOrCreateNode(NFBuildGraphNodeList nodes, NFNodeSpec nodeSpec, int ordinal) {
return nodeCache.getNode(nodes, nodeSpec, ordinal);
} | [
"public",
"NFBuildGraphNode",
"getOrCreateNode",
"(",
"NFBuildGraphNodeList",
"nodes",
",",
"NFNodeSpec",
"nodeSpec",
",",
"int",
"ordinal",
")",
"{",
"return",
"nodeCache",
".",
"getNode",
"(",
"nodes",
",",
"nodeSpec",
",",
"ordinal",
")",
";",
"}"
] | Creates an {@link com.netflix.nfgraph.build.NFBuildGraphNode} for <code>nodeSpec</code> and <code>ordinal</code>
and adds it to <code>nodes</code>. If such a node exists in <code>nodes</code>, then that node is returned. | [
"Creates",
"an",
"{"
] | train | https://github.com/Netflix/netflix-graph/blob/ee129252a08a9f51dd296d6fca2f0b28b7be284e/src/main/java/com/netflix/nfgraph/build/NFBuildGraph.java#L109-L111 |
osglworks/java-tool | src/main/java/org/osgl/util/BigLines.java | BigLines.preview | public List<String> preview(int limit, boolean noHeaderLine) {
E.illegalArgumentIf(limit < 1, "limit must be positive integer");
return fetch(noHeaderLine ? 1 : 0, limit);
} | java | public List<String> preview(int limit, boolean noHeaderLine) {
E.illegalArgumentIf(limit < 1, "limit must be positive integer");
return fetch(noHeaderLine ? 1 : 0, limit);
} | [
"public",
"List",
"<",
"String",
">",
"preview",
"(",
"int",
"limit",
",",
"boolean",
"noHeaderLine",
")",
"{",
"E",
".",
"illegalArgumentIf",
"(",
"limit",
"<",
"1",
",",
"\"limit must be positive integer\"",
")",
";",
"return",
"fetch",
"(",
"noHeaderLine",
... | Returns first `limit` lines.
@param limit
the number of lines to be returned
@param noHeaderLine
if `false` then header line will be excluded in the return list
@return the first `limit` lines. | [
"Returns",
"first",
"limit",
"lines",
"."
] | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/BigLines.java#L112-L115 |
aws/aws-cloudtrail-processing-library | src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/utils/LibraryUtils.java | LibraryUtils.endToProcess | public static void endToProcess(ProgressReporter progressReporter, boolean processSuccess, ProgressStatus progressStatus, Object reportObject) {
progressStatus.getProgressInfo().setIsSuccess(processSuccess);
progressReporter.reportEnd(progressStatus, reportObject);
} | java | public static void endToProcess(ProgressReporter progressReporter, boolean processSuccess, ProgressStatus progressStatus, Object reportObject) {
progressStatus.getProgressInfo().setIsSuccess(processSuccess);
progressReporter.reportEnd(progressStatus, reportObject);
} | [
"public",
"static",
"void",
"endToProcess",
"(",
"ProgressReporter",
"progressReporter",
",",
"boolean",
"processSuccess",
",",
"ProgressStatus",
"progressStatus",
",",
"Object",
"reportObject",
")",
"{",
"progressStatus",
".",
"getProgressInfo",
"(",
")",
".",
"setIs... | A wrapper function of reporting the result of the processing.
@param progressReporter the {@link ProgressReporter} to report the end of process.
@param processSuccess the result of process.
@param progressStatus the current progress status {@link ProgressStatus}.
@param reportObject the object to send, usually the object returned by {@link ProgressReporter#reportStart(ProgressStatus)}. | [
"A",
"wrapper",
"function",
"of",
"reporting",
"the",
"result",
"of",
"the",
"processing",
"."
] | train | https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/utils/LibraryUtils.java#L192-L195 |
pebble/pebble-android-sdk | PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/util/PebbleDictionary.java | PebbleDictionary.addInt16 | public void addInt16(final int key, final short s) {
PebbleTuple t = PebbleTuple.create(key, PebbleTuple.TupleType.INT, PebbleTuple.Width.SHORT, s);
addTuple(t);
} | java | public void addInt16(final int key, final short s) {
PebbleTuple t = PebbleTuple.create(key, PebbleTuple.TupleType.INT, PebbleTuple.Width.SHORT, s);
addTuple(t);
} | [
"public",
"void",
"addInt16",
"(",
"final",
"int",
"key",
",",
"final",
"short",
"s",
")",
"{",
"PebbleTuple",
"t",
"=",
"PebbleTuple",
".",
"create",
"(",
"key",
",",
"PebbleTuple",
".",
"TupleType",
".",
"INT",
",",
"PebbleTuple",
".",
"Width",
".",
... | Associate the specified signed short with the provided key in the dictionary. If another key-value pair with the
same key is already present in the dictionary, it will be replaced.
@param key
key with which the specified value is associated
@param s
value to be associated with the specified key | [
"Associate",
"the",
"specified",
"signed",
"short",
"with",
"the",
"provided",
"key",
"in",
"the",
"dictionary",
".",
"If",
"another",
"key",
"-",
"value",
"pair",
"with",
"the",
"same",
"key",
"is",
"already",
"present",
"in",
"the",
"dictionary",
"it",
"... | train | https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/util/PebbleDictionary.java#L135-L138 |
SG-O/miIO | src/main/java/de/sg_o/app/miio/vacuum/Vacuum.java | Vacuum.setFanSpeed | public boolean setFanSpeed(int speed) throws CommandExecutionException {
if (speed < 0 || speed > 100) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_PARAMETERS);
JSONArray params = new JSONArray();
params.put(speed);
return sendOk("set_custom_mode", params);
} | java | public boolean setFanSpeed(int speed) throws CommandExecutionException {
if (speed < 0 || speed > 100) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_PARAMETERS);
JSONArray params = new JSONArray();
params.put(speed);
return sendOk("set_custom_mode", params);
} | [
"public",
"boolean",
"setFanSpeed",
"(",
"int",
"speed",
")",
"throws",
"CommandExecutionException",
"{",
"if",
"(",
"speed",
"<",
"0",
"||",
"speed",
">",
"100",
")",
"throw",
"new",
"CommandExecutionException",
"(",
"CommandExecutionException",
".",
"Error",
"... | Set the vacuums fan speed setting.
@param speed The new speed to set.
@return True if the command has been received correctly.
@throws CommandExecutionException When there has been a error during the communication or the response was invalid. | [
"Set",
"the",
"vacuums",
"fan",
"speed",
"setting",
"."
] | train | https://github.com/SG-O/miIO/blob/f352dbd2a699d2cdb1b412ca5e6cbb0c38ca779b/src/main/java/de/sg_o/app/miio/vacuum/Vacuum.java#L178-L183 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.writeAccessControlEntry | public void writeAccessControlEntry(CmsRequestContext context, CmsResource resource, CmsAccessControlEntry ace)
throws CmsException, CmsSecurityException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
checkOfflineProject(dbc);
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_CONTROL, true, CmsResourceFilter.ALL);
if (ace.getPrincipal().equals(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID)) {
// only vfs managers can set the overwrite all ACE
checkRoleForResource(dbc, CmsRole.VFS_MANAGER, resource);
}
m_driverManager.writeAccessControlEntry(dbc, resource, ace);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(Messages.ERR_WRITE_ACL_ENTRY_1, context.getSitePath(resource)),
e);
} finally {
dbc.clear();
}
} | java | public void writeAccessControlEntry(CmsRequestContext context, CmsResource resource, CmsAccessControlEntry ace)
throws CmsException, CmsSecurityException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
checkOfflineProject(dbc);
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_CONTROL, true, CmsResourceFilter.ALL);
if (ace.getPrincipal().equals(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID)) {
// only vfs managers can set the overwrite all ACE
checkRoleForResource(dbc, CmsRole.VFS_MANAGER, resource);
}
m_driverManager.writeAccessControlEntry(dbc, resource, ace);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(Messages.ERR_WRITE_ACL_ENTRY_1, context.getSitePath(resource)),
e);
} finally {
dbc.clear();
}
} | [
"public",
"void",
"writeAccessControlEntry",
"(",
"CmsRequestContext",
"context",
",",
"CmsResource",
"resource",
",",
"CmsAccessControlEntry",
"ace",
")",
"throws",
"CmsException",
",",
"CmsSecurityException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
... | Writes an access control entries to a given resource.<p>
@param context the current request context
@param resource the resource
@param ace the entry to write
@throws CmsSecurityException if the user has insufficient permission for the given resource ({@link CmsPermissionSet#ACCESS_CONTROL} required)
@throws CmsException if something goes wrong | [
"Writes",
"an",
"access",
"control",
"entries",
"to",
"a",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L6593-L6613 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java | base_resource.get_resources | protected base_resource[] get_resources(nitro_service service, options option) throws Exception
{
if (!service.isLogin())
service.login();
String response = _get(service, option);
return get_nitro_response(service, response);
} | java | protected base_resource[] get_resources(nitro_service service, options option) throws Exception
{
if (!service.isLogin())
service.login();
String response = _get(service, option);
return get_nitro_response(service, response);
} | [
"protected",
"base_resource",
"[",
"]",
"get_resources",
"(",
"nitro_service",
"service",
",",
"options",
"option",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"service",
".",
"isLogin",
"(",
")",
")",
"service",
".",
"login",
"(",
")",
";",
"String",... | Use this method to perform a get operation on MPS resource.
@param service nitro_service object.
@param option options class object.
@return Array of API resources of specified type.
@throws Exception API exception is thrown. | [
"Use",
"this",
"method",
"to",
"perform",
"a",
"get",
"operation",
"on",
"MPS",
"resource",
"."
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java#L106-L112 |
trellis-ldp/trellis | components/triplestore/src/main/java/org/trellisldp/triplestore/TriplestoreResource.java | TriplestoreResource.findResource | public static CompletableFuture<Resource> findResource(final RDFConnection rdfConnection, final IRI identifier) {
return supplyAsync(() -> {
final TriplestoreResource res = new TriplestoreResource(rdfConnection, identifier);
res.fetchData();
if (!res.exists()) {
return MISSING_RESOURCE;
} else if (res.isDeleted()) {
return DELETED_RESOURCE;
}
return res;
});
} | java | public static CompletableFuture<Resource> findResource(final RDFConnection rdfConnection, final IRI identifier) {
return supplyAsync(() -> {
final TriplestoreResource res = new TriplestoreResource(rdfConnection, identifier);
res.fetchData();
if (!res.exists()) {
return MISSING_RESOURCE;
} else if (res.isDeleted()) {
return DELETED_RESOURCE;
}
return res;
});
} | [
"public",
"static",
"CompletableFuture",
"<",
"Resource",
">",
"findResource",
"(",
"final",
"RDFConnection",
"rdfConnection",
",",
"final",
"IRI",
"identifier",
")",
"{",
"return",
"supplyAsync",
"(",
"(",
")",
"->",
"{",
"final",
"TriplestoreResource",
"res",
... | Try to load a Trellis resource.
@implSpec This method will load a {@link Resource}, initializing the object with all resource metadata
used with {@link #getModified}, {@link #getInteractionModel} and other data fetched by the accessors.
The resource content is fetched on demand via the {@link #stream} method.
@param rdfConnection the triplestore connector
@param identifier the identifier
@return a new completion stage with a {@link Resource}, if one exists | [
"Try",
"to",
"load",
"a",
"Trellis",
"resource",
"."
] | train | https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/components/triplestore/src/main/java/org/trellisldp/triplestore/TriplestoreResource.java#L103-L114 |
httl/httl | httl/src/main/java/httl/spi/codecs/json/JSONArray.java | JSONArray.getDouble | public double getDouble(int index, double def) {
Object tmp = mArray.get(index);
return tmp != null && tmp instanceof Number ? ((Number) tmp)
.doubleValue() : def;
} | java | public double getDouble(int index, double def) {
Object tmp = mArray.get(index);
return tmp != null && tmp instanceof Number ? ((Number) tmp)
.doubleValue() : def;
} | [
"public",
"double",
"getDouble",
"(",
"int",
"index",
",",
"double",
"def",
")",
"{",
"Object",
"tmp",
"=",
"mArray",
".",
"get",
"(",
"index",
")",
";",
"return",
"tmp",
"!=",
"null",
"&&",
"tmp",
"instanceof",
"Number",
"?",
"(",
"(",
"Number",
")"... | get double value.
@param index index.
@param def default value.
@return value or default value. | [
"get",
"double",
"value",
"."
] | train | https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/spi/codecs/json/JSONArray.java#L101-L105 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmUtils.java | XsdAsmUtils.generateMethodsAndCreateAttribute | static void generateMethodsAndCreateAttribute(Map<String, List<XsdAttribute>> createdAttributes, ClassWriter classWriter, XsdAttribute elementAttribute, String returnType, String className, String apiName) {
XsdAsmAttributes.generateMethodsForAttribute(classWriter, elementAttribute, returnType, className,apiName);
createAttribute(createdAttributes, elementAttribute);
} | java | static void generateMethodsAndCreateAttribute(Map<String, List<XsdAttribute>> createdAttributes, ClassWriter classWriter, XsdAttribute elementAttribute, String returnType, String className, String apiName) {
XsdAsmAttributes.generateMethodsForAttribute(classWriter, elementAttribute, returnType, className,apiName);
createAttribute(createdAttributes, elementAttribute);
} | [
"static",
"void",
"generateMethodsAndCreateAttribute",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"XsdAttribute",
">",
">",
"createdAttributes",
",",
"ClassWriter",
"classWriter",
",",
"XsdAttribute",
"elementAttribute",
",",
"String",
"returnType",
",",
"String",
... | Generates the required methods for adding a given attribute and creates the
respective class, if needed.
@param createdAttributes Information about attributes that were already created.
@param classWriter The {@link ClassWriter} to write the methods.
@param elementAttribute The attribute element.
@param returnType The method return type.
@param className The name of the class which will contain the method to add the attribute.
@param apiName The name of the generated fluent interface. | [
"Generates",
"the",
"required",
"methods",
"for",
"adding",
"a",
"given",
"attribute",
"and",
"creates",
"the",
"respective",
"class",
"if",
"needed",
"."
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmUtils.java#L310-L313 |
landawn/AbacusUtil | src/com/landawn/abacus/util/JdbcUtil.java | JdbcUtil.importData | public static <E extends Exception> int importData(final DataSet dataset, final Collection<String> selectColumnNames, final int offset, final int count,
final Try.Predicate<? super Object[], E> filter, final PreparedStatement stmt, final int batchSize, final int batchInterval)
throws UncheckedSQLException, E {
final Type<?> objType = N.typeOf(Object.class);
final Map<String, Type<?>> columnTypeMap = new HashMap<>();
for (String propName : selectColumnNames) {
columnTypeMap.put(propName, objType);
}
return importData(dataset, offset, count, filter, stmt, batchSize, batchInterval, columnTypeMap);
} | java | public static <E extends Exception> int importData(final DataSet dataset, final Collection<String> selectColumnNames, final int offset, final int count,
final Try.Predicate<? super Object[], E> filter, final PreparedStatement stmt, final int batchSize, final int batchInterval)
throws UncheckedSQLException, E {
final Type<?> objType = N.typeOf(Object.class);
final Map<String, Type<?>> columnTypeMap = new HashMap<>();
for (String propName : selectColumnNames) {
columnTypeMap.put(propName, objType);
}
return importData(dataset, offset, count, filter, stmt, batchSize, batchInterval, columnTypeMap);
} | [
"public",
"static",
"<",
"E",
"extends",
"Exception",
">",
"int",
"importData",
"(",
"final",
"DataSet",
"dataset",
",",
"final",
"Collection",
"<",
"String",
">",
"selectColumnNames",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"count",
",",
"final"... | Imports the data from <code>DataSet</code> to database.
@param dataset
@param selectColumnNames
@param offset
@param count
@param stmt the column order in the sql must be consistent with the column order in the DataSet.
@param batchSize
@param batchInterval
@return
@throws UncheckedSQLException | [
"Imports",
"the",
"data",
"from",
"<code",
">",
"DataSet<",
"/",
"code",
">",
"to",
"database",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L2238-L2249 |
dihedron/dihedron-commons | src/main/java/org/dihedron/patterns/activities/TypedVector.java | TypedVector.removeRange | @Override
public void removeRange(int fromIndex, int toIndex) {
int fromIdx = getRealIndex(fromIndex);
int toIdx = getRealIndex(toIndex);
super.removeRange(fromIdx, toIdx);
} | java | @Override
public void removeRange(int fromIndex, int toIndex) {
int fromIdx = getRealIndex(fromIndex);
int toIdx = getRealIndex(toIndex);
super.removeRange(fromIdx, toIdx);
} | [
"@",
"Override",
"public",
"void",
"removeRange",
"(",
"int",
"fromIndex",
",",
"int",
"toIndex",
")",
"{",
"int",
"fromIdx",
"=",
"getRealIndex",
"(",
"fromIndex",
")",
";",
"int",
"toIdx",
"=",
"getRealIndex",
"(",
"toIndex",
")",
";",
"super",
".",
"r... | Removes from this list all of the elements whose index is between fromIndex,
inclusive, and toIndex, exclusive; both indexes can be negative; for
details see {@link #getRealIndex(int)}.
@param fromIndex
the index to start from, inclusive.
@param toIndex
the index to stop at, exclusive.
@see java.util.Vector#removeRange(int, int) | [
"Removes",
"from",
"this",
"list",
"all",
"of",
"the",
"elements",
"whose",
"index",
"is",
"between",
"fromIndex",
"inclusive",
"and",
"toIndex",
"exclusive",
";",
"both",
"indexes",
"can",
"be",
"negative",
";",
"for",
"details",
"see",
"{",
"@link",
"#getR... | train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/activities/TypedVector.java#L249-L254 |
tvesalainen/lpg | src/main/java/org/vesalainen/parser/util/Input.java | Input.getInstance | public static <T> InputReader getInstance(T input, String cs, Set<ParserFeature> features) throws IOException
{
return getInstance(input, -1, Charset.forName(cs), features);
} | java | public static <T> InputReader getInstance(T input, String cs, Set<ParserFeature> features) throws IOException
{
return getInstance(input, -1, Charset.forName(cs), features);
} | [
"public",
"static",
"<",
"T",
">",
"InputReader",
"getInstance",
"(",
"T",
"input",
",",
"String",
"cs",
",",
"Set",
"<",
"ParserFeature",
">",
"features",
")",
"throws",
"IOException",
"{",
"return",
"getInstance",
"(",
"input",
",",
"-",
"1",
",",
"Cha... | Returns InputReader for input
@param <T>
@param input Any supported input type
@param cs Character set
@param features Needed features
@return
@throws IOException | [
"Returns",
"InputReader",
"for",
"input"
] | train | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/parser/util/Input.java#L242-L245 |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/security/OrientResourceAuthorizationStrategy.java | OrientResourceAuthorizationStrategy.checkResources | public boolean checkResources(RequiredOrientResource[] resources, Action action)
{
for (int i = 0; i < resources.length; i++) {
RequiredOrientResource requiredOrientResource = resources[i];
if(!checkResource(requiredOrientResource, action)) return false;
}
return true;
} | java | public boolean checkResources(RequiredOrientResource[] resources, Action action)
{
for (int i = 0; i < resources.length; i++) {
RequiredOrientResource requiredOrientResource = resources[i];
if(!checkResource(requiredOrientResource, action)) return false;
}
return true;
} | [
"public",
"boolean",
"checkResources",
"(",
"RequiredOrientResource",
"[",
"]",
"resources",
",",
"Action",
"action",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resources",
".",
"length",
";",
"i",
"++",
")",
"{",
"RequiredOrientResource",... | Check that current user has access to all mentioned resources
@param resources {@link RequiredOrientResource}s to check
@param action {@link Action} to check for
@return true if access is allowed | [
"Check",
"that",
"current",
"user",
"has",
"access",
"to",
"all",
"mentioned",
"resources"
] | train | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/security/OrientResourceAuthorizationStrategy.java#L72-L79 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.addResourceToOrgUnit | public void addResourceToOrgUnit(CmsRequestContext context, CmsOrganizationalUnit orgUnit, CmsResource resource)
throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
checkOfflineProject(dbc);
checkRole(dbc, CmsRole.ADMINISTRATOR.forOrgUnit(orgUnit.getName()));
m_driverManager.addResourceToOrgUnit(dbc, orgUnit, resource);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_ADD_RESOURCE_TO_ORGUNIT_2,
orgUnit.getName(),
dbc.removeSiteRoot(resource.getRootPath())),
e);
} finally {
dbc.clear();
}
} | java | public void addResourceToOrgUnit(CmsRequestContext context, CmsOrganizationalUnit orgUnit, CmsResource resource)
throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
checkOfflineProject(dbc);
checkRole(dbc, CmsRole.ADMINISTRATOR.forOrgUnit(orgUnit.getName()));
m_driverManager.addResourceToOrgUnit(dbc, orgUnit, resource);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_ADD_RESOURCE_TO_ORGUNIT_2,
orgUnit.getName(),
dbc.removeSiteRoot(resource.getRootPath())),
e);
} finally {
dbc.clear();
}
} | [
"public",
"void",
"addResourceToOrgUnit",
"(",
"CmsRequestContext",
"context",
",",
"CmsOrganizationalUnit",
"orgUnit",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"conte... | Adds a resource to the given organizational unit.<p>
@param context the current request context
@param orgUnit the organizational unit to add the resource to
@param resource the resource that is to be added to the organizational unit
@throws CmsException if something goes wrong
@see org.opencms.security.CmsOrgUnitManager#addResourceToOrgUnit(CmsObject, String, String)
@see org.opencms.security.CmsOrgUnitManager#removeResourceFromOrgUnit(CmsObject, String, String) | [
"Adds",
"a",
"resource",
"to",
"the",
"given",
"organizational",
"unit",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L247-L266 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java | JsonUtil.getBoolean | public static boolean getBoolean(JsonObject object, String field, boolean defaultValue) {
final JsonValue value = object.get(field);
if (value == null || value.isNull()) {
return defaultValue;
} else {
return value.asBoolean();
}
} | java | public static boolean getBoolean(JsonObject object, String field, boolean defaultValue) {
final JsonValue value = object.get(field);
if (value == null || value.isNull()) {
return defaultValue;
} else {
return value.asBoolean();
}
} | [
"public",
"static",
"boolean",
"getBoolean",
"(",
"JsonObject",
"object",
",",
"String",
"field",
",",
"boolean",
"defaultValue",
")",
"{",
"final",
"JsonValue",
"value",
"=",
"object",
".",
"get",
"(",
"field",
")",
";",
"if",
"(",
"value",
"==",
"null",
... | Returns a field in a Json object as a boolean.
@param object the Json Object
@param field the field in the Json object to return
@param defaultValue a default value for the field if the field value is null
@return the Json field value as a boolean | [
"Returns",
"a",
"field",
"in",
"a",
"Json",
"object",
"as",
"a",
"boolean",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java#L213-L220 |
tiesebarrell/process-assertions | process-assertions-api/src/main/java/org/toxos/processassertions/api/ProcessAssert.java | ProcessAssert.assertTaskUncompleted | public static final void assertTaskUncompleted(final String processInstanceId, final String taskDefinitionKey) {
Validate.notNull(processInstanceId);
Validate.notNull(taskDefinitionKey);
apiCallback.debug(LogMessage.TASK_1, taskDefinitionKey, processInstanceId);
try {
getTaskInstanceAssertable().taskIsUncompleted(processInstanceId, taskDefinitionKey);
} catch (final AssertionError ae) {
apiCallback.fail(ae, LogMessage.ERROR_TASK_1, taskDefinitionKey, processInstanceId);
}
} | java | public static final void assertTaskUncompleted(final String processInstanceId, final String taskDefinitionKey) {
Validate.notNull(processInstanceId);
Validate.notNull(taskDefinitionKey);
apiCallback.debug(LogMessage.TASK_1, taskDefinitionKey, processInstanceId);
try {
getTaskInstanceAssertable().taskIsUncompleted(processInstanceId, taskDefinitionKey);
} catch (final AssertionError ae) {
apiCallback.fail(ae, LogMessage.ERROR_TASK_1, taskDefinitionKey, processInstanceId);
}
} | [
"public",
"static",
"final",
"void",
"assertTaskUncompleted",
"(",
"final",
"String",
"processInstanceId",
",",
"final",
"String",
"taskDefinitionKey",
")",
"{",
"Validate",
".",
"notNull",
"(",
"processInstanceId",
")",
";",
"Validate",
".",
"notNull",
"(",
"task... | Asserts a task with the provided taskDefinitionKey is pending completion in the process instance with the
provided processInstanceId.
@param processInstanceId
the process instance's id to check for. May not be <code>null</code>
@param taskDefinitionKey
the task's definition key to check for. May not be <code>null</code> | [
"Asserts",
"a",
"task",
"with",
"the",
"provided",
"taskDefinitionKey",
"is",
"pending",
"completion",
"in",
"the",
"process",
"instance",
"with",
"the",
"provided",
"processInstanceId",
"."
] | train | https://github.com/tiesebarrell/process-assertions/blob/932a8443982e356cdf5a230165a35c725d9306ab/process-assertions-api/src/main/java/org/toxos/processassertions/api/ProcessAssert.java#L142-L152 |
openengsb/openengsb | components/util/src/main/java/org/openengsb/core/util/ModelUtils.java | ModelUtils.tryToSetValueThroughSetter | private static boolean tryToSetValueThroughSetter(OpenEngSBModelEntry entry, Object instance)
throws IllegalAccessException {
try {
String setterName = getSetterName(entry.getKey());
Method method = instance.getClass().getMethod(setterName, entry.getType());
method.invoke(instance, entry.getValue());
return true;
} catch (NoSuchMethodException e) {
// if there exist no such method, then it is an entry meant for the model tail
} catch (IllegalArgumentException e) {
LOGGER.error("IllegalArgumentException while trying to set values for the new model.", e);
} catch (InvocationTargetException e) {
LOGGER.error("InvocationTargetException while trying to set values for the new model.", e);
}
return false;
} | java | private static boolean tryToSetValueThroughSetter(OpenEngSBModelEntry entry, Object instance)
throws IllegalAccessException {
try {
String setterName = getSetterName(entry.getKey());
Method method = instance.getClass().getMethod(setterName, entry.getType());
method.invoke(instance, entry.getValue());
return true;
} catch (NoSuchMethodException e) {
// if there exist no such method, then it is an entry meant for the model tail
} catch (IllegalArgumentException e) {
LOGGER.error("IllegalArgumentException while trying to set values for the new model.", e);
} catch (InvocationTargetException e) {
LOGGER.error("InvocationTargetException while trying to set values for the new model.", e);
}
return false;
} | [
"private",
"static",
"boolean",
"tryToSetValueThroughSetter",
"(",
"OpenEngSBModelEntry",
"entry",
",",
"Object",
"instance",
")",
"throws",
"IllegalAccessException",
"{",
"try",
"{",
"String",
"setterName",
"=",
"getSetterName",
"(",
"entry",
".",
"getKey",
"(",
")... | Tries to set the value of an OpenEngSBModelEntry to its corresponding setter of the model. Returns true if the
setter can be called, returns false if not. | [
"Tries",
"to",
"set",
"the",
"value",
"of",
"an",
"OpenEngSBModelEntry",
"to",
"its",
"corresponding",
"setter",
"of",
"the",
"model",
".",
"Returns",
"true",
"if",
"the",
"setter",
"can",
"be",
"called",
"returns",
"false",
"if",
"not",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/util/src/main/java/org/openengsb/core/util/ModelUtils.java#L96-L111 |
jmrozanec/cron-utils | src/main/java/com/cronutils/descriptor/DescriptionStrategy.java | DescriptionStrategy.describe | protected String describe(final Every every, final boolean and) {
String description;
if (every.getPeriod().getValue() > 1) {
description = String.format("%s %s ", bundle.getString(EVERY), nominalValue(every.getPeriod())) + " %p ";
} else {
description = bundle.getString(EVERY) + " %s ";
}
if (every.getExpression() instanceof Between) {
final Between between = (Between) every.getExpression();
description +=
MessageFormat.format(
bundle.getString("between_x_and_y"), nominalValue(between.getFrom()), nominalValue(between.getTo())
) + WHITE_SPACE;
}
return description;
} | java | protected String describe(final Every every, final boolean and) {
String description;
if (every.getPeriod().getValue() > 1) {
description = String.format("%s %s ", bundle.getString(EVERY), nominalValue(every.getPeriod())) + " %p ";
} else {
description = bundle.getString(EVERY) + " %s ";
}
if (every.getExpression() instanceof Between) {
final Between between = (Between) every.getExpression();
description +=
MessageFormat.format(
bundle.getString("between_x_and_y"), nominalValue(between.getFrom()), nominalValue(between.getTo())
) + WHITE_SPACE;
}
return description;
} | [
"protected",
"String",
"describe",
"(",
"final",
"Every",
"every",
",",
"final",
"boolean",
"and",
")",
"{",
"String",
"description",
";",
"if",
"(",
"every",
".",
"getPeriod",
"(",
")",
".",
"getValue",
"(",
")",
">",
"1",
")",
"{",
"description",
"="... | Provide a human readable description for Every instance.
@param every - Every
@return human readable description - String | [
"Provide",
"a",
"human",
"readable",
"description",
"for",
"Every",
"instance",
"."
] | train | https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/descriptor/DescriptionStrategy.java#L148-L163 |
TakahikoKawasaki/nv-websocket-client | src/main/java/com/neovisionaries/ws/client/HandshakeReader.java | HandshakeReader.validateAccept | private void validateAccept(StatusLine statusLine, Map<String, List<String>> headers, String key) throws WebSocketException
{
// Get the values of Sec-WebSocket-Accept.
List<String> values = headers.get("Sec-WebSocket-Accept");
if (values == null)
{
// The opening handshake response does not contain 'Sec-WebSocket-Accept' header.
throw new OpeningHandshakeException(
WebSocketError.NO_SEC_WEBSOCKET_ACCEPT_HEADER,
"The opening handshake response does not contain 'Sec-WebSocket-Accept' header.",
statusLine, headers);
}
// The actual value of Sec-WebSocket-Accept.
String actual = values.get(0);
// Concatenate.
String input = key + ACCEPT_MAGIC;
// Expected value of Sec-WebSocket-Accept
String expected;
try
{
// Message digest for SHA-1.
MessageDigest md = MessageDigest.getInstance("SHA-1");
// Compute the digest value.
byte[] digest = md.digest(Misc.getBytesUTF8(input));
// Base64.
expected = Base64.encode(digest);
}
catch (Exception e)
{
// This never happens.
return;
}
if (expected.equals(actual) == false)
{
// The value of 'Sec-WebSocket-Accept' header is different from the expected one.
throw new OpeningHandshakeException(
WebSocketError.UNEXPECTED_SEC_WEBSOCKET_ACCEPT_HEADER,
"The value of 'Sec-WebSocket-Accept' header is different from the expected one.",
statusLine, headers);
}
// OK. The value of Sec-WebSocket-Accept is the same as the expected one.
} | java | private void validateAccept(StatusLine statusLine, Map<String, List<String>> headers, String key) throws WebSocketException
{
// Get the values of Sec-WebSocket-Accept.
List<String> values = headers.get("Sec-WebSocket-Accept");
if (values == null)
{
// The opening handshake response does not contain 'Sec-WebSocket-Accept' header.
throw new OpeningHandshakeException(
WebSocketError.NO_SEC_WEBSOCKET_ACCEPT_HEADER,
"The opening handshake response does not contain 'Sec-WebSocket-Accept' header.",
statusLine, headers);
}
// The actual value of Sec-WebSocket-Accept.
String actual = values.get(0);
// Concatenate.
String input = key + ACCEPT_MAGIC;
// Expected value of Sec-WebSocket-Accept
String expected;
try
{
// Message digest for SHA-1.
MessageDigest md = MessageDigest.getInstance("SHA-1");
// Compute the digest value.
byte[] digest = md.digest(Misc.getBytesUTF8(input));
// Base64.
expected = Base64.encode(digest);
}
catch (Exception e)
{
// This never happens.
return;
}
if (expected.equals(actual) == false)
{
// The value of 'Sec-WebSocket-Accept' header is different from the expected one.
throw new OpeningHandshakeException(
WebSocketError.UNEXPECTED_SEC_WEBSOCKET_ACCEPT_HEADER,
"The value of 'Sec-WebSocket-Accept' header is different from the expected one.",
statusLine, headers);
}
// OK. The value of Sec-WebSocket-Accept is the same as the expected one.
} | [
"private",
"void",
"validateAccept",
"(",
"StatusLine",
"statusLine",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"headers",
",",
"String",
"key",
")",
"throws",
"WebSocketException",
"{",
"// Get the values of Sec-WebSocket-Accept.",
"List",
... | Validate the value of {@code Sec-WebSocket-Accept} header.
<blockquote>
<p>From RFC 6455, p19.</p>
<p><i>
If the response lacks a {@code Sec-WebSocket-Accept} header field or the
{@code Sec-WebSocket-Accept} contains a value other than the base64-encoded
SHA-1 of the concatenation of the {@code Sec-WebSocket-Key} (as a string,
not base64-decoded) with the string "{@code 258EAFA5-E914-47DA-95CA-C5AB0DC85B11}"
but ignoring any leading and trailing whitespace, the client MUST Fail the
WebSocket Connection.
</i></p>
</blockquote> | [
"Validate",
"the",
"value",
"of",
"{",
"@code",
"Sec",
"-",
"WebSocket",
"-",
"Accept",
"}",
"header",
"."
] | train | https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/HandshakeReader.java#L401-L451 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WMenuRenderer.java | WMenuRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WMenu menu = (WMenu) component;
XmlStringBuilder xml = renderContext.getWriter();
int rows = menu.getRows();
xml.appendTagOpen("ui:menu");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
switch (menu.getType()) {
case BAR:
xml.appendAttribute("type", "bar");
break;
case FLYOUT:
xml.appendAttribute("type", "flyout");
break;
case TREE:
xml.appendAttribute("type", "tree");
break;
case COLUMN:
xml.appendAttribute("type", "column");
break;
default:
throw new IllegalStateException("Invalid menu type: " + menu.getType());
}
xml.appendOptionalAttribute("disabled", menu.isDisabled(), "true");
xml.appendOptionalAttribute("hidden", menu.isHidden(), "true");
xml.appendOptionalAttribute("rows", rows > 0, rows);
switch (menu.getSelectionMode()) {
case NONE:
break;
case SINGLE:
xml.appendAttribute("selectMode", "single");
break;
case MULTIPLE:
xml.appendAttribute("selectMode", "multiple");
break;
default:
throw new IllegalStateException("Invalid select mode: " + menu.getSelectMode());
}
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(menu, renderContext);
paintChildren(menu, renderContext);
xml.appendEndTag("ui:menu");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WMenu menu = (WMenu) component;
XmlStringBuilder xml = renderContext.getWriter();
int rows = menu.getRows();
xml.appendTagOpen("ui:menu");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
switch (menu.getType()) {
case BAR:
xml.appendAttribute("type", "bar");
break;
case FLYOUT:
xml.appendAttribute("type", "flyout");
break;
case TREE:
xml.appendAttribute("type", "tree");
break;
case COLUMN:
xml.appendAttribute("type", "column");
break;
default:
throw new IllegalStateException("Invalid menu type: " + menu.getType());
}
xml.appendOptionalAttribute("disabled", menu.isDisabled(), "true");
xml.appendOptionalAttribute("hidden", menu.isHidden(), "true");
xml.appendOptionalAttribute("rows", rows > 0, rows);
switch (menu.getSelectionMode()) {
case NONE:
break;
case SINGLE:
xml.appendAttribute("selectMode", "single");
break;
case MULTIPLE:
xml.appendAttribute("selectMode", "multiple");
break;
default:
throw new IllegalStateException("Invalid select mode: " + menu.getSelectMode());
}
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(menu, renderContext);
paintChildren(menu, renderContext);
xml.appendEndTag("ui:menu");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WMenu",
"menu",
"=",
"(",
"WMenu",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".... | Paints the given WMenu.
@param component the WMenu to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WMenu",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WMenuRenderer.java#L22-L82 |
FlyingHe/UtilsMaven | src/main/java/com/github/flyinghe/tools/WriteExcelUtils.java | WriteExcelUtils.writeWorkBook | public static <T> Workbook writeWorkBook(Workbook workbook, List<T> beans, String dateFormat) {
if (beans == null || beans.isEmpty()) {
return workbook;
}
Map<String, Object> map = null;
if (beans.get(0) instanceof Map) {
map = (Map<String, Object>) beans.get(0);
} else {
map = CommonUtils.toMap(beans.get(0));
}
if (map == null) {
return workbook;
}
List<String> properties = new ArrayList<String>();
properties.addAll(map.keySet());
return WriteExcelUtils.writeWorkBook(workbook, beans, properties, properties, dateFormat);
} | java | public static <T> Workbook writeWorkBook(Workbook workbook, List<T> beans, String dateFormat) {
if (beans == null || beans.isEmpty()) {
return workbook;
}
Map<String, Object> map = null;
if (beans.get(0) instanceof Map) {
map = (Map<String, Object>) beans.get(0);
} else {
map = CommonUtils.toMap(beans.get(0));
}
if (map == null) {
return workbook;
}
List<String> properties = new ArrayList<String>();
properties.addAll(map.keySet());
return WriteExcelUtils.writeWorkBook(workbook, beans, properties, properties, dateFormat);
} | [
"public",
"static",
"<",
"T",
">",
"Workbook",
"writeWorkBook",
"(",
"Workbook",
"workbook",
",",
"List",
"<",
"T",
">",
"beans",
",",
"String",
"dateFormat",
")",
"{",
"if",
"(",
"beans",
"==",
"null",
"||",
"beans",
".",
"isEmpty",
"(",
")",
")",
"... | 将Beans写入WorkBook中,默认以bean中的所有属性作为标题且写入第0行,0-based
@param workbook 指定工作簿
@param beans 指定写入的Beans(或者泛型为Map)
@param dateFormat 日期格式
@return 返回传入的WorkBook | [
"将Beans写入WorkBook中",
"默认以bean中的所有属性作为标题且写入第0行,0",
"-",
"based"
] | train | https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/WriteExcelUtils.java#L328-L344 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/metadata/FunctionManager.java | FunctionManager.resolveFunction | public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)
{
// TODO Actually use session
// Session will be used to provide information about the order of function namespaces to through resolving the function.
// This is likely to be in terms of SQL path. Currently we still don't have support multiple function namespaces, nor
// SQL path. As a result, session is not used here. We still add this to distinguish the two versions of resolveFunction
// while the refactoring is on-going.
return staticFunctionNamespace.resolveFunction(name, parameterTypes);
} | java | public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)
{
// TODO Actually use session
// Session will be used to provide information about the order of function namespaces to through resolving the function.
// This is likely to be in terms of SQL path. Currently we still don't have support multiple function namespaces, nor
// SQL path. As a result, session is not used here. We still add this to distinguish the two versions of resolveFunction
// while the refactoring is on-going.
return staticFunctionNamespace.resolveFunction(name, parameterTypes);
} | [
"public",
"FunctionHandle",
"resolveFunction",
"(",
"Session",
"session",
",",
"QualifiedName",
"name",
",",
"List",
"<",
"TypeSignatureProvider",
">",
"parameterTypes",
")",
"{",
"// TODO Actually use session",
"// Session will be used to provide information about the order of f... | Resolves a function using the SQL path, and implicit type coercions.
@throws PrestoException if there are no matches or multiple matches | [
"Resolves",
"a",
"function",
"using",
"the",
"SQL",
"path",
"and",
"implicit",
"type",
"coercions",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/metadata/FunctionManager.java#L72-L80 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/f/ParamFundamentalEpipolar.java | ParamFundamentalEpipolar.selectDivisor | private double selectDivisor( double v[] , double param[] ) {
double maxValue = 0;
int maxIndex = 0;
for( int i = 0; i < v.length; i++ ) {
if( Math.abs(v[i]) > maxValue ) {
maxValue = Math.abs(v[i]);
maxIndex = i;
}
}
double divisor = v[maxIndex];
int index = 0;
for( int i = 0; i < v.length; i++ ) {
v[i] /= divisor;
if( i != maxIndex ) {
// save first 5 parameters
param[index] = v[i];
// save indexes in the matrix
int col = i < 3 ? col0 : col1;
indexes[index++] = 3*(i%3)+ col;
}
}
// index of 1
int col = maxIndex >= 3 ? col1 : col0;
indexes[5] = 3*(maxIndex % 3) + col;
return divisor;
} | java | private double selectDivisor( double v[] , double param[] ) {
double maxValue = 0;
int maxIndex = 0;
for( int i = 0; i < v.length; i++ ) {
if( Math.abs(v[i]) > maxValue ) {
maxValue = Math.abs(v[i]);
maxIndex = i;
}
}
double divisor = v[maxIndex];
int index = 0;
for( int i = 0; i < v.length; i++ ) {
v[i] /= divisor;
if( i != maxIndex ) {
// save first 5 parameters
param[index] = v[i];
// save indexes in the matrix
int col = i < 3 ? col0 : col1;
indexes[index++] = 3*(i%3)+ col;
}
}
// index of 1
int col = maxIndex >= 3 ? col1 : col0;
indexes[5] = 3*(maxIndex % 3) + col;
return divisor;
} | [
"private",
"double",
"selectDivisor",
"(",
"double",
"v",
"[",
"]",
",",
"double",
"param",
"[",
"]",
")",
"{",
"double",
"maxValue",
"=",
"0",
";",
"int",
"maxIndex",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"v",
".",
"l... | The divisor is the element in the first two columns that has the largest absolute value.
Finds this element, sets col0 to be the row which contains it, and specifies which elements
in that column are to be used.
@return Value of the divisor | [
"The",
"divisor",
"is",
"the",
"element",
"in",
"the",
"first",
"two",
"columns",
"that",
"has",
"the",
"largest",
"absolute",
"value",
".",
"Finds",
"this",
"element",
"sets",
"col0",
"to",
"be",
"the",
"row",
"which",
"contains",
"it",
"and",
"specifies"... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/f/ParamFundamentalEpipolar.java#L94-L125 |
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/JobTargetExecutionsInner.java | JobTargetExecutionsInner.listByStepAsync | public Observable<Page<JobExecutionInner>> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) {
return listByStepWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top)
.map(new Func1<ServiceResponse<Page<JobExecutionInner>>, Page<JobExecutionInner>>() {
@Override
public Page<JobExecutionInner> call(ServiceResponse<Page<JobExecutionInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<JobExecutionInner>> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) {
return listByStepWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top)
.map(new Func1<ServiceResponse<Page<JobExecutionInner>>, Page<JobExecutionInner>>() {
@Override
public Page<JobExecutionInner> call(ServiceResponse<Page<JobExecutionInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"JobExecutionInner",
">",
">",
"listByStepAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"serverName",
",",
"final",
"String",
"jobAgentName",
",",
"final",
"String",
"jobName",
",",
"final",
... | Lists the target executions of a job step execution.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent.
@param jobName The name of the job to get.
@param jobExecutionId The id of the job execution
@param stepName The name of the step.
@param createTimeMin If specified, only job executions created at or after the specified time are included.
@param createTimeMax If specified, only job executions created before the specified time are included.
@param endTimeMin If specified, only job executions completed at or after the specified time are included.
@param endTimeMax If specified, only job executions completed before the specified time are included.
@param isActive If specified, only active or only completed job executions are included.
@param skip The number of elements in the collection to skip.
@param top The number of elements to return from the collection.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<JobExecutionInner> object | [
"Lists",
"the",
"target",
"executions",
"of",
"a",
"job",
"step",
"execution",
"."
] | 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/JobTargetExecutionsInner.java#L650-L658 |
drewnoakes/metadata-extractor | Source/com/drew/imaging/jpeg/JpegSegmentData.java | JpegSegmentData.removeSegmentOccurrence | @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
public void removeSegmentOccurrence(byte segmentType, int occurrence)
{
final List<byte[]> segmentList = _segmentDataMap.get(segmentType);
segmentList.remove(occurrence);
} | java | @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
public void removeSegmentOccurrence(byte segmentType, int occurrence)
{
final List<byte[]> segmentList = _segmentDataMap.get(segmentType);
segmentList.remove(occurrence);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"MismatchedQueryAndUpdateOfCollection\"",
"}",
")",
"public",
"void",
"removeSegmentOccurrence",
"(",
"byte",
"segmentType",
",",
"int",
"occurrence",
")",
"{",
"final",
"List",
"<",
"byte",
"[",
"]",
">",
"segmentList",
"=",
... | Removes a specified instance of a segment's data from the collection. Use this method when more than one
occurrence of segment data exists for a given type exists.
@param segmentType identifies the required segment
@param occurrence the zero-based index of the segment occurrence to remove. | [
"Removes",
"a",
"specified",
"instance",
"of",
"a",
"segment",
"s",
"data",
"from",
"the",
"collection",
".",
"Use",
"this",
"method",
"when",
"more",
"than",
"one",
"occurrence",
"of",
"segment",
"data",
"exists",
"for",
"a",
"given",
"type",
"exists",
".... | train | https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/imaging/jpeg/JpegSegmentData.java#L222-L227 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.fromCollection | public <OUT> DataStreamSource<OUT> fromCollection(Collection<OUT> data, TypeInformation<OUT> typeInfo) {
Preconditions.checkNotNull(data, "Collection must not be null");
// must not have null elements and mixed elements
FromElementsFunction.checkCollection(data, typeInfo.getTypeClass());
SourceFunction<OUT> function;
try {
function = new FromElementsFunction<>(typeInfo.createSerializer(getConfig()), data);
}
catch (IOException e) {
throw new RuntimeException(e.getMessage(), e);
}
return addSource(function, "Collection Source", typeInfo).setParallelism(1);
} | java | public <OUT> DataStreamSource<OUT> fromCollection(Collection<OUT> data, TypeInformation<OUT> typeInfo) {
Preconditions.checkNotNull(data, "Collection must not be null");
// must not have null elements and mixed elements
FromElementsFunction.checkCollection(data, typeInfo.getTypeClass());
SourceFunction<OUT> function;
try {
function = new FromElementsFunction<>(typeInfo.createSerializer(getConfig()), data);
}
catch (IOException e) {
throw new RuntimeException(e.getMessage(), e);
}
return addSource(function, "Collection Source", typeInfo).setParallelism(1);
} | [
"public",
"<",
"OUT",
">",
"DataStreamSource",
"<",
"OUT",
">",
"fromCollection",
"(",
"Collection",
"<",
"OUT",
">",
"data",
",",
"TypeInformation",
"<",
"OUT",
">",
"typeInfo",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"data",
",",
"\"Collection... | Creates a data stream from the given non-empty collection.
<p>Note that this operation will result in a non-parallel data stream source,
i.e., a data stream source with parallelism one.
@param data
The collection of elements to create the data stream from
@param typeInfo
The TypeInformation for the produced data stream
@param <OUT>
The type of the returned data stream
@return The data stream representing the given collection | [
"Creates",
"a",
"data",
"stream",
"from",
"the",
"given",
"non",
"-",
"empty",
"collection",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L805-L819 |
openengsb/openengsb | components/services/src/main/java/org/openengsb/core/services/internal/security/ldap/TimebasedOrderFilter.java | TimebasedOrderFilter.addId | public static void addId(Entry entry, boolean updateRdn) {
String uuid = newUUID().toString();
try {
entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, UNIQUE_OBJECT_OC);
entry.add(ID_ATTRIBUTE, uuid);
} catch (LdapException e) {
throw new LdapRuntimeException(e);
}
if (updateRdn) {
Dn newDn = LdapUtils.concatDn(ID_ATTRIBUTE, uuid, entry.getDn().getParent());
entry.setDn(newDn);
}
} | java | public static void addId(Entry entry, boolean updateRdn) {
String uuid = newUUID().toString();
try {
entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, UNIQUE_OBJECT_OC);
entry.add(ID_ATTRIBUTE, uuid);
} catch (LdapException e) {
throw new LdapRuntimeException(e);
}
if (updateRdn) {
Dn newDn = LdapUtils.concatDn(ID_ATTRIBUTE, uuid, entry.getDn().getParent());
entry.setDn(newDn);
}
} | [
"public",
"static",
"void",
"addId",
"(",
"Entry",
"entry",
",",
"boolean",
"updateRdn",
")",
"{",
"String",
"uuid",
"=",
"newUUID",
"(",
")",
".",
"toString",
"(",
")",
";",
"try",
"{",
"entry",
".",
"add",
"(",
"SchemaConstants",
".",
"OBJECT_CLASS_ATT... | Adds a timebased uuid to entry. If updateRdn is true, the uuid becomes the rdn. Use this to handle duplicates. | [
"Adds",
"a",
"timebased",
"uuid",
"to",
"entry",
".",
"If",
"updateRdn",
"is",
"true",
"the",
"uuid",
"becomes",
"the",
"rdn",
".",
"Use",
"this",
"to",
"handle",
"duplicates",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/services/src/main/java/org/openengsb/core/services/internal/security/ldap/TimebasedOrderFilter.java#L57-L69 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/util/concurrent/Monitor.java | Monitor.enterIfInterruptibly | public boolean enterIfInterruptibly(Guard guard, long time, TimeUnit unit)
throws InterruptedException {
if (guard.monitor != this) {
throw new IllegalMonitorStateException();
}
final ReentrantLock lock = this.lock;
if (!lock.tryLock(time, unit)) {
return false;
}
boolean satisfied = false;
try {
return satisfied = guard.isSatisfied();
} finally {
if (!satisfied) {
lock.unlock();
}
}
} | java | public boolean enterIfInterruptibly(Guard guard, long time, TimeUnit unit)
throws InterruptedException {
if (guard.monitor != this) {
throw new IllegalMonitorStateException();
}
final ReentrantLock lock = this.lock;
if (!lock.tryLock(time, unit)) {
return false;
}
boolean satisfied = false;
try {
return satisfied = guard.isSatisfied();
} finally {
if (!satisfied) {
lock.unlock();
}
}
} | [
"public",
"boolean",
"enterIfInterruptibly",
"(",
"Guard",
"guard",
",",
"long",
"time",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"guard",
".",
"monitor",
"!=",
"this",
")",
"{",
"throw",
"new",
"IllegalMonitorStateExceptio... | Enters this monitor if the guard is satisfied. Blocks at most the given time acquiring the
lock, but does not wait for the guard to be satisfied, and may be interrupted.
@return whether the monitor was entered, which guarantees that the guard is now satisfied | [
"Enters",
"this",
"monitor",
"if",
"the",
"guard",
"is",
"satisfied",
".",
"Blocks",
"at",
"most",
"the",
"given",
"time",
"acquiring",
"the",
"lock",
"but",
"does",
"not",
"wait",
"for",
"the",
"guard",
"to",
"be",
"satisfied",
"and",
"may",
"be",
"inte... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/util/concurrent/Monitor.java#L680-L698 |
alkacon/opencms-core | src/org/opencms/publish/CmsPublishManager.java | CmsPublishManager.publishProject | public CmsUUID publishProject(
CmsObject cms,
I_CmsReport report,
CmsResource directPublishResource,
boolean directPublishSiblings) throws CmsException {
return publishProject(cms, report, getPublishList(cms, directPublishResource, directPublishSiblings));
} | java | public CmsUUID publishProject(
CmsObject cms,
I_CmsReport report,
CmsResource directPublishResource,
boolean directPublishSiblings) throws CmsException {
return publishProject(cms, report, getPublishList(cms, directPublishResource, directPublishSiblings));
} | [
"public",
"CmsUUID",
"publishProject",
"(",
"CmsObject",
"cms",
",",
"I_CmsReport",
"report",
",",
"CmsResource",
"directPublishResource",
",",
"boolean",
"directPublishSiblings",
")",
"throws",
"CmsException",
"{",
"return",
"publishProject",
"(",
"cms",
",",
"report... | Direct publishes a specified resource.<p>
@param cms the cms request context
@param report an instance of <code>{@link I_CmsReport}</code> to print messages
@param directPublishResource a <code>{@link CmsResource}</code> that gets directly published;
or <code>null</code> if an entire project gets published.
@param directPublishSiblings if a <code>{@link CmsResource}</code> that should get published directly is
provided as an argument, all eventual siblings of this resource
get publish too, if this flag is <code>true</code>.
@return the publish history id of the published project
@throws CmsException if something goes wrong | [
"Direct",
"publishes",
"a",
"specified",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/publish/CmsPublishManager.java#L580-L587 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/distance/Distance.java | Distance.Taneja | public static double Taneja(double[] p, double[] q) {
double r = 0;
for (int i = 0; i < p.length; i++) {
if (p[i] != 0 && q[i] != 0) {
double pq = p[i] + q[i];
r += (pq / 2) * Math.log(pq / (2 * Math.sqrt(p[i] * q[i])));
}
}
return r;
} | java | public static double Taneja(double[] p, double[] q) {
double r = 0;
for (int i = 0; i < p.length; i++) {
if (p[i] != 0 && q[i] != 0) {
double pq = p[i] + q[i];
r += (pq / 2) * Math.log(pq / (2 * Math.sqrt(p[i] * q[i])));
}
}
return r;
} | [
"public",
"static",
"double",
"Taneja",
"(",
"double",
"[",
"]",
"p",
",",
"double",
"[",
"]",
"q",
")",
"{",
"double",
"r",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"p",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",... | Gets the Taneja divergence.
@param p P vector.
@param q Q vector.
@return The Taneja divergence between p and q. | [
"Gets",
"the",
"Taneja",
"divergence",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L889-L898 |
OpenTSDB/opentsdb | src/tsd/HttpJsonSerializer.java | HttpJsonSerializer.parseUidMetaV1 | public UIDMeta parseUidMetaV1() {
final String json = query.getContent();
if (json == null || json.isEmpty()) {
throw new BadRequestException(HttpResponseStatus.BAD_REQUEST,
"Missing message content",
"Supply valid JSON formatted data in the body of your request");
}
try {
return JSON.parseToObject(json, UIDMeta.class);
} catch (IllegalArgumentException iae) {
throw new BadRequestException("Unable to parse the given JSON", iae);
}
} | java | public UIDMeta parseUidMetaV1() {
final String json = query.getContent();
if (json == null || json.isEmpty()) {
throw new BadRequestException(HttpResponseStatus.BAD_REQUEST,
"Missing message content",
"Supply valid JSON formatted data in the body of your request");
}
try {
return JSON.parseToObject(json, UIDMeta.class);
} catch (IllegalArgumentException iae) {
throw new BadRequestException("Unable to parse the given JSON", iae);
}
} | [
"public",
"UIDMeta",
"parseUidMetaV1",
"(",
")",
"{",
"final",
"String",
"json",
"=",
"query",
".",
"getContent",
"(",
")",
";",
"if",
"(",
"json",
"==",
"null",
"||",
"json",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"BadRequestException",
"... | Parses a single UIDMeta object
@throws JSONException if parsing failed
@throws BadRequestException if the content was missing or parsing failed | [
"Parses",
"a",
"single",
"UIDMeta",
"object"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpJsonSerializer.java#L308-L320 |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/image/ShowImages.java | ShowImages.setupWindow | public static JFrame setupWindow( final JComponent component , String title, final boolean closeOnExit ) {
BoofSwingUtil.checkGuiThread();
final JFrame frame = new JFrame(title);
frame.add(component, BorderLayout.CENTER);
frame.pack();
frame.setLocationRelativeTo(null); // centers window in the monitor
if( closeOnExit )
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
return frame;
} | java | public static JFrame setupWindow( final JComponent component , String title, final boolean closeOnExit ) {
BoofSwingUtil.checkGuiThread();
final JFrame frame = new JFrame(title);
frame.add(component, BorderLayout.CENTER);
frame.pack();
frame.setLocationRelativeTo(null); // centers window in the monitor
if( closeOnExit )
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
return frame;
} | [
"public",
"static",
"JFrame",
"setupWindow",
"(",
"final",
"JComponent",
"component",
",",
"String",
"title",
",",
"final",
"boolean",
"closeOnExit",
")",
"{",
"BoofSwingUtil",
".",
"checkGuiThread",
"(",
")",
";",
"final",
"JFrame",
"frame",
"=",
"new",
"JFra... | Sets up the window but doesn't show it. Must be called in a GUI thread | [
"Sets",
"up",
"the",
"window",
"but",
"doesn",
"t",
"show",
"it",
".",
"Must",
"be",
"called",
"in",
"a",
"GUI",
"thread"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/image/ShowImages.java#L145-L157 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java | FieldUtils.readField | public static Object readField(final Field field, final Object target, final boolean forceAccess) throws IllegalAccessException {
Validate.isTrue(field != null, "The field must not be null");
if (forceAccess && !field.isAccessible()) {
field.setAccessible(true);
} else {
MemberUtils.setAccessibleWorkaround(field);
}
return field.get(target);
} | java | public static Object readField(final Field field, final Object target, final boolean forceAccess) throws IllegalAccessException {
Validate.isTrue(field != null, "The field must not be null");
if (forceAccess && !field.isAccessible()) {
field.setAccessible(true);
} else {
MemberUtils.setAccessibleWorkaround(field);
}
return field.get(target);
} | [
"public",
"static",
"Object",
"readField",
"(",
"final",
"Field",
"field",
",",
"final",
"Object",
"target",
",",
"final",
"boolean",
"forceAccess",
")",
"throws",
"IllegalAccessException",
"{",
"Validate",
".",
"isTrue",
"(",
"field",
"!=",
"null",
",",
"\"Th... | Reads a {@link Field}.
@param field
the field to use
@param target
the object to call on, may be {@code null} for {@code static} fields
@param forceAccess
whether to break scope restrictions using the
{@link java.lang.reflect.AccessibleObject#setAccessible(boolean)} method.
@return the field value
@throws IllegalArgumentException
if the field is {@code null}
@throws IllegalAccessException
if the field is not made accessible | [
"Reads",
"a",
"{",
"@link",
"Field",
"}",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java#L422-L430 |
wg/lettuce | src/main/java/com/lambdaworks/redis/RedisClient.java | RedisClient.connectAsync | public <K, V> RedisAsyncConnection<K, V> connectAsync(RedisCodec<K, V> codec) {
BlockingQueue<Command<K, V, ?>> queue = new LinkedBlockingQueue<Command<K, V, ?>>();
CommandHandler<K, V> handler = new CommandHandler<K, V>(queue);
RedisAsyncConnection<K, V> connection = new RedisAsyncConnection<K, V>(queue, codec, timeout, unit);
return connect(handler, connection);
} | java | public <K, V> RedisAsyncConnection<K, V> connectAsync(RedisCodec<K, V> codec) {
BlockingQueue<Command<K, V, ?>> queue = new LinkedBlockingQueue<Command<K, V, ?>>();
CommandHandler<K, V> handler = new CommandHandler<K, V>(queue);
RedisAsyncConnection<K, V> connection = new RedisAsyncConnection<K, V>(queue, codec, timeout, unit);
return connect(handler, connection);
} | [
"public",
"<",
"K",
",",
"V",
">",
"RedisAsyncConnection",
"<",
"K",
",",
"V",
">",
"connectAsync",
"(",
"RedisCodec",
"<",
"K",
",",
"V",
">",
"codec",
")",
"{",
"BlockingQueue",
"<",
"Command",
"<",
"K",
",",
"V",
",",
"?",
">",
">",
"queue",
"... | Open a new asynchronous connection to the redis server. Use the supplied
{@link RedisCodec codec} to encode/decode keys and values.
@param codec Use this codec to encode/decode keys and values.
@return A new connection. | [
"Open",
"a",
"new",
"asynchronous",
"connection",
"to",
"the",
"redis",
"server",
".",
"Use",
"the",
"supplied",
"{",
"@link",
"RedisCodec",
"codec",
"}",
"to",
"encode",
"/",
"decode",
"keys",
"and",
"values",
"."
] | train | https://github.com/wg/lettuce/blob/5141640dc8289ff3af07b44a87020cef719c5f4a/src/main/java/com/lambdaworks/redis/RedisClient.java#L133-L140 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/WriteChannelConfiguration.java | WriteChannelConfiguration.newBuilder | public static Builder newBuilder(TableId destinationTable, FormatOptions format) {
return newBuilder(destinationTable).setFormatOptions(format);
} | java | public static Builder newBuilder(TableId destinationTable, FormatOptions format) {
return newBuilder(destinationTable).setFormatOptions(format);
} | [
"public",
"static",
"Builder",
"newBuilder",
"(",
"TableId",
"destinationTable",
",",
"FormatOptions",
"format",
")",
"{",
"return",
"newBuilder",
"(",
"destinationTable",
")",
".",
"setFormatOptions",
"(",
"format",
")",
";",
"}"
] | Creates a builder for a BigQuery Load Configuration given the destination table and format. | [
"Creates",
"a",
"builder",
"for",
"a",
"BigQuery",
"Load",
"Configuration",
"given",
"the",
"destination",
"table",
"and",
"format",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/WriteChannelConfiguration.java#L489-L491 |
dlemmermann/CalendarFX | CalendarFXView/src/main/java/com/calendarfx/util/Util.java | Util.bindBidirectional | public static <L, R> void bindBidirectional(Property<L> leftProperty, Property<R> rightProperty, Converter<L, R> converter) {
BidirectionalConversionBinding<L, R> binding = new BidirectionalConversionBinding<>(leftProperty, rightProperty, converter);
leftProperty.addListener(binding);
rightProperty.addListener(binding);
leftProperty.setValue(converter.toLeft(rightProperty.getValue()));
} | java | public static <L, R> void bindBidirectional(Property<L> leftProperty, Property<R> rightProperty, Converter<L, R> converter) {
BidirectionalConversionBinding<L, R> binding = new BidirectionalConversionBinding<>(leftProperty, rightProperty, converter);
leftProperty.addListener(binding);
rightProperty.addListener(binding);
leftProperty.setValue(converter.toLeft(rightProperty.getValue()));
} | [
"public",
"static",
"<",
"L",
",",
"R",
">",
"void",
"bindBidirectional",
"(",
"Property",
"<",
"L",
">",
"leftProperty",
",",
"Property",
"<",
"R",
">",
"rightProperty",
",",
"Converter",
"<",
"L",
",",
"R",
">",
"converter",
")",
"{",
"BidirectionalCon... | Creates a bidirectional binding between the two given properties of different types via the
help of a {@link Converter}.
@param leftProperty the left property
@param rightProperty the right property
@param converter the converter
@param <L> the type of the left property
@param <R> the type of the right property | [
"Creates",
"a",
"bidirectional",
"binding",
"between",
"the",
"two",
"given",
"properties",
"of",
"different",
"types",
"via",
"the",
"help",
"of",
"a",
"{",
"@link",
"Converter",
"}",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/util/Util.java#L309-L314 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java | WatchUtil.createAll | public static WatchMonitor createAll(URI uri, int maxDepth, Watcher watcher) {
return createAll(Paths.get(uri), maxDepth, watcher);
} | java | public static WatchMonitor createAll(URI uri, int maxDepth, Watcher watcher) {
return createAll(Paths.get(uri), maxDepth, watcher);
} | [
"public",
"static",
"WatchMonitor",
"createAll",
"(",
"URI",
"uri",
",",
"int",
"maxDepth",
",",
"Watcher",
"watcher",
")",
"{",
"return",
"createAll",
"(",
"Paths",
".",
"get",
"(",
"uri",
")",
",",
"maxDepth",
",",
"watcher",
")",
";",
"}"
] | 创建并初始化监听,监听所有事件
@param uri URI
@param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录
@param watcher {@link Watcher}
@return {@link WatchMonitor} | [
"创建并初始化监听,监听所有事件"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java#L178-L180 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseLambdaConstant | private Expr parseLambdaConstant(EnclosingScope scope, boolean terminated) {
int start = index;
match(Ampersand);
Name name = parseName(scope);
Tuple<Type> parameters;
// Check whether or not parameters are supplied
if (tryAndMatch(terminated, LeftBrace) != null) {
// Yes, parameters are supplied!
ArrayList<Type> tmp = new ArrayList<>();
boolean firstTime = true;
while (eventuallyMatch(RightBrace) == null) {
int p_start = index;
if (!firstTime) {
match(Comma);
}
firstTime = false;
Type type = parseType(scope);
tmp.add(type);
}
parameters = new Tuple<>(tmp);
} else {
// No, parameters are not supplied.
parameters = new Tuple<>();
}
Decl.Link link = new Decl.Link<Decl.Callable>(name);
Decl.Binding<Type.Callable, Decl.Callable> binding = new Decl.Binding<>(link, new Tuple<>());
return annotateSourceLocation(new Expr.LambdaAccess(binding, parameters), start);
} | java | private Expr parseLambdaConstant(EnclosingScope scope, boolean terminated) {
int start = index;
match(Ampersand);
Name name = parseName(scope);
Tuple<Type> parameters;
// Check whether or not parameters are supplied
if (tryAndMatch(terminated, LeftBrace) != null) {
// Yes, parameters are supplied!
ArrayList<Type> tmp = new ArrayList<>();
boolean firstTime = true;
while (eventuallyMatch(RightBrace) == null) {
int p_start = index;
if (!firstTime) {
match(Comma);
}
firstTime = false;
Type type = parseType(scope);
tmp.add(type);
}
parameters = new Tuple<>(tmp);
} else {
// No, parameters are not supplied.
parameters = new Tuple<>();
}
Decl.Link link = new Decl.Link<Decl.Callable>(name);
Decl.Binding<Type.Callable, Decl.Callable> binding = new Decl.Binding<>(link, new Tuple<>());
return annotateSourceLocation(new Expr.LambdaAccess(binding, parameters), start);
} | [
"private",
"Expr",
"parseLambdaConstant",
"(",
"EnclosingScope",
"scope",
",",
"boolean",
"terminated",
")",
"{",
"int",
"start",
"=",
"index",
";",
"match",
"(",
"Ampersand",
")",
";",
"Name",
"name",
"=",
"parseName",
"(",
"scope",
")",
";",
"Tuple",
"<"... | Parse an address expression, which has the form:
<pre>
TermExpr::= ...
| '&' Identifier [ '(' Type (',' Type)* ')']
</pre>
@param scope
The enclosing scope for this statement, which determines the
set of visible (i.e. declared) variables and also the current
indentation level.
@param terminated
This indicates that the expression is known to be terminated
(or not). An expression that's known to be terminated is one
which is guaranteed to be followed by something. This is
important because it means that we can ignore any newline
characters encountered in parsing this expression, and that
we'll never overrun the end of the expression (i.e. because
there's guaranteed to be something which terminates this
expression). A classic situation where terminated is true is
when parsing an expression surrounded in braces. In such case,
we know the right-brace will always terminate this expression.
@return | [
"Parse",
"an",
"address",
"expression",
"which",
"has",
"the",
"form",
":"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L3217-L3244 |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.build | public String build( final File directory) throws NoSuchAlgorithmException, IOException {
final String rpm = format.getLead().getName() + "." + format.getLead().getArch().toString().toLowerCase() + ".rpm";
final File file = new File( directory, rpm);
if ( file.exists()) file.delete();
RandomAccessFile raFile = new RandomAccessFile( file, "rw");
build(raFile.getChannel());
raFile.close();
return rpm;
} | java | public String build( final File directory) throws NoSuchAlgorithmException, IOException {
final String rpm = format.getLead().getName() + "." + format.getLead().getArch().toString().toLowerCase() + ".rpm";
final File file = new File( directory, rpm);
if ( file.exists()) file.delete();
RandomAccessFile raFile = new RandomAccessFile( file, "rw");
build(raFile.getChannel());
raFile.close();
return rpm;
} | [
"public",
"String",
"build",
"(",
"final",
"File",
"directory",
")",
"throws",
"NoSuchAlgorithmException",
",",
"IOException",
"{",
"final",
"String",
"rpm",
"=",
"format",
".",
"getLead",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\".\"",
"+",
"format",
".... | Generates an RPM with a standard name consisting of the RPM package name, version, release,
and type in the given directory.
@param directory the destination directory for the new RPM file.
@return the name of the rpm
@throws NoSuchAlgorithmException the algorithm isn't supported
@throws IOException there was an IO error | [
"Generates",
"an",
"RPM",
"with",
"a",
"standard",
"name",
"consisting",
"of",
"the",
"RPM",
"package",
"name",
"version",
"release",
"and",
"type",
"in",
"the",
"given",
"directory",
"."
] | train | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L1233-L1241 |
brettonw/Bag | src/main/java/com/brettonw/bag/Bag.java | Bag.getLong | public Long getLong (String key, Supplier<Long> notFound) {
return getParsed (key, Long::new, notFound);
} | java | public Long getLong (String key, Supplier<Long> notFound) {
return getParsed (key, Long::new, notFound);
} | [
"public",
"Long",
"getLong",
"(",
"String",
"key",
",",
"Supplier",
"<",
"Long",
">",
"notFound",
")",
"{",
"return",
"getParsed",
"(",
"key",
",",
"Long",
"::",
"new",
",",
"notFound",
")",
";",
"}"
] | Retrieve a mapped element and return it as a Long.
@param key A string value used to index the element.
@param notFound A function to create a new Long if the requested key was not found
@return The element as a Long, or notFound if the element is not found. | [
"Retrieve",
"a",
"mapped",
"element",
"and",
"return",
"it",
"as",
"a",
"Long",
"."
] | train | https://github.com/brettonw/Bag/blob/25c0ff74893b6c9a2c61bf0f97189ab82e0b2f56/src/main/java/com/brettonw/bag/Bag.java#L187-L189 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/FileUtils.java | FileUtils.osSensitiveEndsWith | public static boolean osSensitiveEndsWith( String str, String suffix )
{
if ( OS_CASE_SENSITIVE )
{
return str.endsWith( suffix );
}
else
{
int strLen = str.length();
int suffixLen = suffix.length();
if ( strLen < suffixLen )
{
return false;
}
return ( str.substring( strLen - suffixLen ).equalsIgnoreCase( suffix ) );
}
} | java | public static boolean osSensitiveEndsWith( String str, String suffix )
{
if ( OS_CASE_SENSITIVE )
{
return str.endsWith( suffix );
}
else
{
int strLen = str.length();
int suffixLen = suffix.length();
if ( strLen < suffixLen )
{
return false;
}
return ( str.substring( strLen - suffixLen ).equalsIgnoreCase( suffix ) );
}
} | [
"public",
"static",
"boolean",
"osSensitiveEndsWith",
"(",
"String",
"str",
",",
"String",
"suffix",
")",
"{",
"if",
"(",
"OS_CASE_SENSITIVE",
")",
"{",
"return",
"str",
".",
"endsWith",
"(",
"suffix",
")",
";",
"}",
"else",
"{",
"int",
"strLen",
"=",
"s... | Tell whether a string ends with a particular suffix, with case sensitivity determined by the operating system.
@param str the String to test.
@param suffix the suffix to look for.
@return <code>true</code> when:
<ul>
<li><code>str</code> ends with <code>suffix</code>, or,</li>
<li>the operating system is not case-sensitive with regard to file names, and <code>str</code> ends with
<code>suffix</code>, ignoring case.</li>
</ul>
@see #isOSCaseSensitive() | [
"Tell",
"whether",
"a",
"string",
"ends",
"with",
"a",
"particular",
"suffix",
"with",
"case",
"sensitivity",
"determined",
"by",
"the",
"operating",
"system",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/FileUtils.java#L141-L159 |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java | CliFrontend.runClusterAction | private <T> void runClusterAction(CustomCommandLine<T> activeCommandLine, CommandLine commandLine, ClusterAction<T> clusterAction) throws FlinkException {
final ClusterDescriptor<T> clusterDescriptor = activeCommandLine.createClusterDescriptor(commandLine);
final T clusterId = activeCommandLine.getClusterId(commandLine);
if (clusterId == null) {
throw new FlinkException("No cluster id was specified. Please specify a cluster to which " +
"you would like to connect.");
} else {
try {
final ClusterClient<T> clusterClient = clusterDescriptor.retrieve(clusterId);
try {
clusterAction.runAction(clusterClient);
} finally {
try {
clusterClient.shutdown();
} catch (Exception e) {
LOG.info("Could not properly shut down the cluster client.", e);
}
}
} finally {
try {
clusterDescriptor.close();
} catch (Exception e) {
LOG.info("Could not properly close the cluster descriptor.", e);
}
}
}
} | java | private <T> void runClusterAction(CustomCommandLine<T> activeCommandLine, CommandLine commandLine, ClusterAction<T> clusterAction) throws FlinkException {
final ClusterDescriptor<T> clusterDescriptor = activeCommandLine.createClusterDescriptor(commandLine);
final T clusterId = activeCommandLine.getClusterId(commandLine);
if (clusterId == null) {
throw new FlinkException("No cluster id was specified. Please specify a cluster to which " +
"you would like to connect.");
} else {
try {
final ClusterClient<T> clusterClient = clusterDescriptor.retrieve(clusterId);
try {
clusterAction.runAction(clusterClient);
} finally {
try {
clusterClient.shutdown();
} catch (Exception e) {
LOG.info("Could not properly shut down the cluster client.", e);
}
}
} finally {
try {
clusterDescriptor.close();
} catch (Exception e) {
LOG.info("Could not properly close the cluster descriptor.", e);
}
}
}
} | [
"private",
"<",
"T",
">",
"void",
"runClusterAction",
"(",
"CustomCommandLine",
"<",
"T",
">",
"activeCommandLine",
",",
"CommandLine",
"commandLine",
",",
"ClusterAction",
"<",
"T",
">",
"clusterAction",
")",
"throws",
"FlinkException",
"{",
"final",
"ClusterDesc... | Retrieves the {@link ClusterClient} from the given {@link CustomCommandLine} and runs the given
{@link ClusterAction} against it.
@param activeCommandLine to create the {@link ClusterDescriptor} from
@param commandLine containing the parsed command line options
@param clusterAction the cluster action to run against the retrieved {@link ClusterClient}.
@param <T> type of the cluster id
@throws FlinkException if something goes wrong | [
"Retrieves",
"the",
"{",
"@link",
"ClusterClient",
"}",
"from",
"the",
"given",
"{",
"@link",
"CustomCommandLine",
"}",
"and",
"runs",
"the",
"given",
"{",
"@link",
"ClusterAction",
"}",
"against",
"it",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java#L905-L934 |
SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/utils/ManifestUtils.java | ManifestUtils.getPropertyValues | public static List<String> getPropertyValues(ClassLoader classloader, String key) {
List<String> values = new ArrayList<>();
try {
Enumeration<URL> resources = classloader.getResources("META-INF/MANIFEST.MF");
while (resources.hasMoreElements()) {
Manifest manifest = new Manifest(resources.nextElement().openStream());
Attributes attributes = manifest.getMainAttributes();
String value = attributes.getValue(key);
if (value != null) {
values.add(value);
}
}
} catch (IOException e) {
throw new SonarException("Fail to load manifests from classloader: " + classloader, e);
}
return values;
} | java | public static List<String> getPropertyValues(ClassLoader classloader, String key) {
List<String> values = new ArrayList<>();
try {
Enumeration<URL> resources = classloader.getResources("META-INF/MANIFEST.MF");
while (resources.hasMoreElements()) {
Manifest manifest = new Manifest(resources.nextElement().openStream());
Attributes attributes = manifest.getMainAttributes();
String value = attributes.getValue(key);
if (value != null) {
values.add(value);
}
}
} catch (IOException e) {
throw new SonarException("Fail to load manifests from classloader: " + classloader, e);
}
return values;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getPropertyValues",
"(",
"ClassLoader",
"classloader",
",",
"String",
"key",
")",
"{",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"{",
"Enumeration",
"<",
"U... | Search for a property in all the manifests found in the classloader
@return the values, an empty list if the property is not found. | [
"Search",
"for",
"a",
"property",
"in",
"all",
"the",
"manifests",
"found",
"in",
"the",
"classloader"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ManifestUtils.java#L43-L59 |
perwendel/spark | src/main/java/spark/Request.java | Request.queryParamOrDefault | public String queryParamOrDefault(String queryParam, String defaultValue) {
String value = queryParams(queryParam);
return value != null ? value : defaultValue;
} | java | public String queryParamOrDefault(String queryParam, String defaultValue) {
String value = queryParams(queryParam);
return value != null ? value : defaultValue;
} | [
"public",
"String",
"queryParamOrDefault",
"(",
"String",
"queryParam",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"queryParams",
"(",
"queryParam",
")",
";",
"return",
"value",
"!=",
"null",
"?",
"value",
":",
"defaultValue",
";",
"}"
] | Gets the query param, or returns default value
@param queryParam the query parameter
@param defaultValue the default value
@return the value of the provided queryParam, or default if value is null
Example: query parameter 'id' from the following request URI: /hello?id=foo | [
"Gets",
"the",
"query",
"param",
"or",
"returns",
"default",
"value"
] | train | https://github.com/perwendel/spark/blob/080fb1f9d6e580f6742e9589044c7420d3157b8b/src/main/java/spark/Request.java#L303-L306 |
entrusc/xdata | src/main/java/com/moebiusgames/xdata/DataNode.java | DataNode.setObjectList | public <T> void setObjectList(ListDataKey<T> key, List<T> objects) {
if (key == null) {
throw new IllegalArgumentException("key must not be null");
}
if (objects == null && !key.allowNull()) {
throw new IllegalArgumentException("list key \"" + key.getName() + "\" disallows null values but object was null");
}
data.put(key.getName(), deepListCopy(objects));
} | java | public <T> void setObjectList(ListDataKey<T> key, List<T> objects) {
if (key == null) {
throw new IllegalArgumentException("key must not be null");
}
if (objects == null && !key.allowNull()) {
throw new IllegalArgumentException("list key \"" + key.getName() + "\" disallows null values but object was null");
}
data.put(key.getName(), deepListCopy(objects));
} | [
"public",
"<",
"T",
">",
"void",
"setObjectList",
"(",
"ListDataKey",
"<",
"T",
">",
"key",
",",
"List",
"<",
"T",
">",
"objects",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"key must not be nul... | stores a list of objects for a given key
@param <T>
@param key a list data key (where isList is set to true)
@param objects | [
"stores",
"a",
"list",
"of",
"objects",
"for",
"a",
"given",
"key"
] | train | https://github.com/entrusc/xdata/blob/44ba4c59fd639c99b89fc8995ba83fe89ca4239d/src/main/java/com/moebiusgames/xdata/DataNode.java#L130-L138 |
GoogleCloudPlatform/appengine-plugins-core | src/main/java/com/google/cloud/tools/appengine/operations/Deployment.java | Deployment.deployConfig | @VisibleForTesting
void deployConfig(String filename, DeployProjectConfigurationConfiguration configuration)
throws AppEngineException {
Preconditions.checkNotNull(configuration);
Preconditions.checkNotNull(configuration.getAppEngineDirectory());
Path deployable = configuration.getAppEngineDirectory().resolve(filename);
Preconditions.checkArgument(
Files.isRegularFile(deployable), deployable.toString() + " does not exist.");
List<String> arguments = new ArrayList<>();
arguments.add("app");
arguments.add("deploy");
arguments.add(deployable.toAbsolutePath().toString());
arguments.addAll(GcloudArgs.get("server", configuration.getServer()));
arguments.addAll(GcloudArgs.get("project", configuration.getProjectId()));
try {
runner.run(arguments, null);
} catch (ProcessHandlerException | IOException ex) {
throw new AppEngineException(ex);
}
} | java | @VisibleForTesting
void deployConfig(String filename, DeployProjectConfigurationConfiguration configuration)
throws AppEngineException {
Preconditions.checkNotNull(configuration);
Preconditions.checkNotNull(configuration.getAppEngineDirectory());
Path deployable = configuration.getAppEngineDirectory().resolve(filename);
Preconditions.checkArgument(
Files.isRegularFile(deployable), deployable.toString() + " does not exist.");
List<String> arguments = new ArrayList<>();
arguments.add("app");
arguments.add("deploy");
arguments.add(deployable.toAbsolutePath().toString());
arguments.addAll(GcloudArgs.get("server", configuration.getServer()));
arguments.addAll(GcloudArgs.get("project", configuration.getProjectId()));
try {
runner.run(arguments, null);
} catch (ProcessHandlerException | IOException ex) {
throw new AppEngineException(ex);
}
} | [
"@",
"VisibleForTesting",
"void",
"deployConfig",
"(",
"String",
"filename",
",",
"DeployProjectConfigurationConfiguration",
"configuration",
")",
"throws",
"AppEngineException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"configuration",
")",
";",
"Preconditions",
"... | Common configuration deployment function.
@param filename Yaml file that we want to deploy (cron.yaml, dos.yaml, etc)
@param configuration Deployment configuration | [
"Common",
"configuration",
"deployment",
"function",
"."
] | train | https://github.com/GoogleCloudPlatform/appengine-plugins-core/blob/d22e9fa1103522409ab6fdfbf68c4a5a0bc5b97d/src/main/java/com/google/cloud/tools/appengine/operations/Deployment.java#L126-L148 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/MediaApi.java | MediaApi.addContent | public ApiSuccessResponse addContent(String mediatype, String id, AddContentData addContentData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = addContentWithHttpInfo(mediatype, id, addContentData);
return resp.getData();
} | java | public ApiSuccessResponse addContent(String mediatype, String id, AddContentData addContentData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = addContentWithHttpInfo(mediatype, id, addContentData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"addContent",
"(",
"String",
"mediatype",
",",
"String",
"id",
",",
"AddContentData",
"addContentData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"addContentWithHttpInfo",
"(",
"medi... | Create the interaction in UCS database
Create the interaction in UCS database
@param mediatype media-type of interaction (required)
@param id id of the interaction (required)
@param addContentData (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Create",
"the",
"interaction",
"in",
"UCS",
"database",
"Create",
"the",
"interaction",
"in",
"UCS",
"database"
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L452-L455 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.