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 |
|---|---|---|---|---|---|---|---|---|---|---|
jnr/jnr-x86asm | src/main/java/jnr/x86asm/SerializerIntrinsics.java | SerializerIntrinsics.j_short | public final void j_short(CONDITION cc, Label label, int hint)
{
// Adjust returned condition to jxx_short version.
_emitJcc(INST_CODE.valueOf(conditionToJCC(cc).ordinal() + INST_J_SHORT.ordinal() - INST_J.ordinal()), label, hint);
} | java | public final void j_short(CONDITION cc, Label label, int hint)
{
// Adjust returned condition to jxx_short version.
_emitJcc(INST_CODE.valueOf(conditionToJCC(cc).ordinal() + INST_J_SHORT.ordinal() - INST_J.ordinal()), label, hint);
} | [
"public",
"final",
"void",
"j_short",
"(",
"CONDITION",
"cc",
",",
"Label",
"label",
",",
"int",
"hint",
")",
"{",
"// Adjust returned condition to jxx_short version.",
"_emitJcc",
"(",
"INST_CODE",
".",
"valueOf",
"(",
"conditionToJCC",
"(",
"cc",
")",
".",
"or... | ! continues with the instruction following the Jcc instruction. | [
"!",
"continues",
"with",
"the",
"instruction",
"following",
"the",
"Jcc",
"instruction",
"."
] | train | https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/SerializerIntrinsics.java#L779-L783 |
JodaOrg/joda-time | src/main/java/org/joda/time/field/FieldUtils.java | FieldUtils.safeDivide | public static long safeDivide(long dividend, long divisor) {
if (dividend == Long.MIN_VALUE && divisor == -1L) {
throw new ArithmeticException("Multiplication overflows a long: " + dividend + " / " + divisor);
}
return dividend / divisor;
} | java | public static long safeDivide(long dividend, long divisor) {
if (dividend == Long.MIN_VALUE && divisor == -1L) {
throw new ArithmeticException("Multiplication overflows a long: " + dividend + " / " + divisor);
}
return dividend / divisor;
} | [
"public",
"static",
"long",
"safeDivide",
"(",
"long",
"dividend",
",",
"long",
"divisor",
")",
"{",
"if",
"(",
"dividend",
"==",
"Long",
".",
"MIN_VALUE",
"&&",
"divisor",
"==",
"-",
"1L",
")",
"{",
"throw",
"new",
"ArithmeticException",
"(",
"\"Multiplic... | Divides the dividend by the divisor throwing an exception if
overflow occurs or the divisor is zero.
@param dividend the dividend
@param divisor the divisor
@return the new total
@throws ArithmeticException if the operation overflows or the divisor is zero | [
"Divides",
"the",
"dividend",
"by",
"the",
"divisor",
"throwing",
"an",
"exception",
"if",
"overflow",
"occurs",
"or",
"the",
"divisor",
"is",
"zero",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/field/FieldUtils.java#L191-L196 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/ModuleAssets.java | ModuleAssets.fetchAll | public CMAArray<CMAAsset> fetchAll(String spaceId, String environmentId) {
return fetchAll(spaceId, environmentId, new HashMap<>());
} | java | public CMAArray<CMAAsset> fetchAll(String spaceId, String environmentId) {
return fetchAll(spaceId, environmentId, new HashMap<>());
} | [
"public",
"CMAArray",
"<",
"CMAAsset",
">",
"fetchAll",
"(",
"String",
"spaceId",
",",
"String",
"environmentId",
")",
"{",
"return",
"fetchAll",
"(",
"spaceId",
",",
"environmentId",
",",
"new",
"HashMap",
"<>",
"(",
")",
")",
";",
"}"
] | Fetch all Assets from the given space and environment.
<p>
This fetch uses the default parameter defined in {@link DefaultQueryParameter#FETCH}
@param spaceId Space ID
@param environmentId Environment ID
@return {@link CMAArray} result instance
@throws IllegalArgumentException if spaceId is null.
@throws IllegalArgumentException if environment id is null. | [
"Fetch",
"all",
"Assets",
"from",
"the",
"given",
"space",
"and",
"environment",
".",
"<p",
">",
"This",
"fetch",
"uses",
"the",
"default",
"parameter",
"defined",
"in",
"{",
"@link",
"DefaultQueryParameter#FETCH",
"}"
] | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleAssets.java#L194-L196 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/spillover/spilloverpolicy_binding.java | spilloverpolicy_binding.get | public static spilloverpolicy_binding get(nitro_service service, String name) throws Exception{
spilloverpolicy_binding obj = new spilloverpolicy_binding();
obj.set_name(name);
spilloverpolicy_binding response = (spilloverpolicy_binding) obj.get_resource(service);
return response;
} | java | public static spilloverpolicy_binding get(nitro_service service, String name) throws Exception{
spilloverpolicy_binding obj = new spilloverpolicy_binding();
obj.set_name(name);
spilloverpolicy_binding response = (spilloverpolicy_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"spilloverpolicy_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"spilloverpolicy_binding",
"obj",
"=",
"new",
"spilloverpolicy_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"nam... | Use this API to fetch spilloverpolicy_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"spilloverpolicy_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/spillover/spilloverpolicy_binding.java#L125-L130 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ch/Subtypes2.java | Subtypes2.addClassVertexForMissingClass | private ClassVertex addClassVertexForMissingClass(ClassDescriptor missingClassDescriptor, boolean isInterfaceEdge) {
ClassVertex missingClassVertex = ClassVertex.createMissingClassVertex(missingClassDescriptor, isInterfaceEdge);
missingClassVertex.setFinished(true);
addVertexToGraph(missingClassDescriptor, missingClassVertex);
AnalysisContext.currentAnalysisContext();
AnalysisContext.reportMissingClass(missingClassDescriptor);
return missingClassVertex;
} | java | private ClassVertex addClassVertexForMissingClass(ClassDescriptor missingClassDescriptor, boolean isInterfaceEdge) {
ClassVertex missingClassVertex = ClassVertex.createMissingClassVertex(missingClassDescriptor, isInterfaceEdge);
missingClassVertex.setFinished(true);
addVertexToGraph(missingClassDescriptor, missingClassVertex);
AnalysisContext.currentAnalysisContext();
AnalysisContext.reportMissingClass(missingClassDescriptor);
return missingClassVertex;
} | [
"private",
"ClassVertex",
"addClassVertexForMissingClass",
"(",
"ClassDescriptor",
"missingClassDescriptor",
",",
"boolean",
"isInterfaceEdge",
")",
"{",
"ClassVertex",
"missingClassVertex",
"=",
"ClassVertex",
".",
"createMissingClassVertex",
"(",
"missingClassDescriptor",
","... | Add a ClassVertex representing a missing class.
@param missingClassDescriptor
ClassDescriptor naming a missing class
@param isInterfaceEdge
@return the ClassVertex representing the missing class | [
"Add",
"a",
"ClassVertex",
"representing",
"a",
"missing",
"class",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ch/Subtypes2.java#L1381-L1390 |
VoltDB/voltdb | src/frontend/org/voltdb/planner/FilterMatcher.java | FilterMatcher.equalsAsCVE | private static boolean equalsAsCVE(AbstractExpression e1, AbstractExpression e2) {
final ConstantValueExpression ce1 = asCVE(e1), ce2 = asCVE(e2);
return ce1 == null || ce2 == null ? ce1 == ce2 : ce1.equals(ce2);
} | java | private static boolean equalsAsCVE(AbstractExpression e1, AbstractExpression e2) {
final ConstantValueExpression ce1 = asCVE(e1), ce2 = asCVE(e2);
return ce1 == null || ce2 == null ? ce1 == ce2 : ce1.equals(ce2);
} | [
"private",
"static",
"boolean",
"equalsAsCVE",
"(",
"AbstractExpression",
"e1",
",",
"AbstractExpression",
"e2",
")",
"{",
"final",
"ConstantValueExpression",
"ce1",
"=",
"asCVE",
"(",
"e1",
")",
",",
"ce2",
"=",
"asCVE",
"(",
"e2",
")",
";",
"return",
"ce1"... | Check whether two expressions, each either a CVE or PVE, have same content.
\pre both must be either CVE or PVE.
@param e1 first expression
@param e2 second expression
@return whether their contents match. | [
"Check",
"whether",
"two",
"expressions",
"each",
"either",
"a",
"CVE",
"or",
"PVE",
"have",
"same",
"content",
".",
"\\",
"pre",
"both",
"must",
"be",
"either",
"CVE",
"or",
"PVE",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/FilterMatcher.java#L149-L152 |
voldemort/voldemort | src/java/voldemort/versioning/VectorClockUtils.java | VectorClockUtils.makeClock | public static VectorClock makeClock(Set<Integer> serverIds, long clockValue, long timestamp) {
List<ClockEntry> clockEntries = new ArrayList<ClockEntry>(serverIds.size());
for(Integer serverId: serverIds) {
clockEntries.add(new ClockEntry(serverId.shortValue(), clockValue));
}
return new VectorClock(clockEntries, timestamp);
} | java | public static VectorClock makeClock(Set<Integer> serverIds, long clockValue, long timestamp) {
List<ClockEntry> clockEntries = new ArrayList<ClockEntry>(serverIds.size());
for(Integer serverId: serverIds) {
clockEntries.add(new ClockEntry(serverId.shortValue(), clockValue));
}
return new VectorClock(clockEntries, timestamp);
} | [
"public",
"static",
"VectorClock",
"makeClock",
"(",
"Set",
"<",
"Integer",
">",
"serverIds",
",",
"long",
"clockValue",
",",
"long",
"timestamp",
")",
"{",
"List",
"<",
"ClockEntry",
">",
"clockEntries",
"=",
"new",
"ArrayList",
"<",
"ClockEntry",
">",
"(",... | Generates a vector clock with the provided values
@param serverIds servers in the clock
@param clockValue value of the clock for each server entry
@param timestamp ts value to be set for the clock
@return | [
"Generates",
"a",
"vector",
"clock",
"with",
"the",
"provided",
"values"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/versioning/VectorClockUtils.java#L137-L143 |
molgenis/molgenis | molgenis-core-ui/src/main/java/org/molgenis/core/ui/thememanager/ThemeManagerController.java | ThemeManagerController.addBootstrapTheme | @PreAuthorize("hasAnyRole('ROLE_SU')")
@PostMapping(value = "/add-bootstrap-theme")
public @ResponseBody Style addBootstrapTheme(
@RequestParam(value = "bootstrap3-style") MultipartFile bootstrap3Style,
@RequestParam(value = "bootstrap4-style", required = false) MultipartFile bootstrap4Style)
throws MolgenisStyleException {
String styleIdentifier = bootstrap3Style.getOriginalFilename();
try {
String bs4FileName = null;
InputStream bs3InputStream = null;
InputStream bs4InputStream = null;
try {
bs3InputStream = bootstrap3Style.getInputStream();
if (bootstrap4Style != null) {
bs4FileName = bootstrap4Style.getOriginalFilename();
bs4InputStream = bootstrap4Style.getInputStream();
}
return styleService.addStyle(
styleIdentifier,
bootstrap3Style.getOriginalFilename(),
bs3InputStream,
bs4FileName,
bs4InputStream);
} finally {
if (bs3InputStream != null) {
bs3InputStream.close();
}
if (bs4InputStream != null) {
bs4InputStream.close();
}
}
} catch (IOException e) {
throw new MolgenisStyleException("unable to add style: " + styleIdentifier, e);
}
} | java | @PreAuthorize("hasAnyRole('ROLE_SU')")
@PostMapping(value = "/add-bootstrap-theme")
public @ResponseBody Style addBootstrapTheme(
@RequestParam(value = "bootstrap3-style") MultipartFile bootstrap3Style,
@RequestParam(value = "bootstrap4-style", required = false) MultipartFile bootstrap4Style)
throws MolgenisStyleException {
String styleIdentifier = bootstrap3Style.getOriginalFilename();
try {
String bs4FileName = null;
InputStream bs3InputStream = null;
InputStream bs4InputStream = null;
try {
bs3InputStream = bootstrap3Style.getInputStream();
if (bootstrap4Style != null) {
bs4FileName = bootstrap4Style.getOriginalFilename();
bs4InputStream = bootstrap4Style.getInputStream();
}
return styleService.addStyle(
styleIdentifier,
bootstrap3Style.getOriginalFilename(),
bs3InputStream,
bs4FileName,
bs4InputStream);
} finally {
if (bs3InputStream != null) {
bs3InputStream.close();
}
if (bs4InputStream != null) {
bs4InputStream.close();
}
}
} catch (IOException e) {
throw new MolgenisStyleException("unable to add style: " + styleIdentifier, e);
}
} | [
"@",
"PreAuthorize",
"(",
"\"hasAnyRole('ROLE_SU')\"",
")",
"@",
"PostMapping",
"(",
"value",
"=",
"\"/add-bootstrap-theme\"",
")",
"public",
"@",
"ResponseBody",
"Style",
"addBootstrapTheme",
"(",
"@",
"RequestParam",
"(",
"value",
"=",
"\"bootstrap3-style\"",
")",
... | Add a new bootstrap theme, theme is passed as a bootstrap css file. It is mandatory to pass a
bootstrap3 style file but optional to pass a bootstrap 4 style file | [
"Add",
"a",
"new",
"bootstrap",
"theme",
"theme",
"is",
"passed",
"as",
"a",
"bootstrap",
"css",
"file",
".",
"It",
"is",
"mandatory",
"to",
"pass",
"a",
"bootstrap3",
"style",
"file",
"but",
"optional",
"to",
"pass",
"a",
"bootstrap",
"4",
"style",
"fil... | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/thememanager/ThemeManagerController.java#L65-L99 |
Impetus/Kundera | src/kundera-mongo/src/main/java/com/impetus/client/mongodb/query/MongoDBQuery.java | MongoDBQuery.createLikeRegex | public static String createLikeRegex(String expr, boolean ignoreCase)
{
String regex = createRegex(expr, ignoreCase);
regex = regex.replace("_", ".").replace("%", ".*?");
return regex;
} | java | public static String createLikeRegex(String expr, boolean ignoreCase)
{
String regex = createRegex(expr, ignoreCase);
regex = regex.replace("_", ".").replace("%", ".*?");
return regex;
} | [
"public",
"static",
"String",
"createLikeRegex",
"(",
"String",
"expr",
",",
"boolean",
"ignoreCase",
")",
"{",
"String",
"regex",
"=",
"createRegex",
"(",
"expr",
",",
"ignoreCase",
")",
";",
"regex",
"=",
"regex",
".",
"replace",
"(",
"\"_\"",
",",
"\".\... | Create regular expression equivalent to any like operator string match
function.
@param expr
the expr
@param ignoreCase
whether to ignore the case
@return the string | [
"Create",
"regular",
"expression",
"equivalent",
"to",
"any",
"like",
"operator",
"string",
"match",
"function",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/query/MongoDBQuery.java#L1278-L1284 |
ixa-ehu/ixa-pipe-ml | src/main/java/eus/ixa/ixa/pipe/ml/utils/IOUtils.java | IOUtils.checkInputFile | private static void checkInputFile(final String name, final File inFile) {
String isFailure = null;
if (inFile.isDirectory()) {
isFailure = "The " + name + " file is a directory!";
} else if (!inFile.exists()) {
isFailure = "The " + name + " file does not exist!";
} else if (!inFile.canRead()) {
isFailure = "No permissions to read the " + name + " file!";
}
if (null != isFailure) {
throw new TerminateToolException(-1,
isFailure + " Path: " + inFile.getAbsolutePath());
}
} | java | private static void checkInputFile(final String name, final File inFile) {
String isFailure = null;
if (inFile.isDirectory()) {
isFailure = "The " + name + " file is a directory!";
} else if (!inFile.exists()) {
isFailure = "The " + name + " file does not exist!";
} else if (!inFile.canRead()) {
isFailure = "No permissions to read the " + name + " file!";
}
if (null != isFailure) {
throw new TerminateToolException(-1,
isFailure + " Path: " + inFile.getAbsolutePath());
}
} | [
"private",
"static",
"void",
"checkInputFile",
"(",
"final",
"String",
"name",
",",
"final",
"File",
"inFile",
")",
"{",
"String",
"isFailure",
"=",
"null",
";",
"if",
"(",
"inFile",
".",
"isDirectory",
"(",
")",
")",
"{",
"isFailure",
"=",
"\"The \"",
"... | Check input file integrity.
@param name
the name of the file
@param inFile
the file | [
"Check",
"input",
"file",
"integrity",
"."
] | train | https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/utils/IOUtils.java#L143-L159 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java | ApplicationGatewaysInner.beginBackendHealthAsync | public Observable<ApplicationGatewayBackendHealthInner> beginBackendHealthAsync(String resourceGroupName, String applicationGatewayName, String expand) {
return beginBackendHealthWithServiceResponseAsync(resourceGroupName, applicationGatewayName, expand).map(new Func1<ServiceResponse<ApplicationGatewayBackendHealthInner>, ApplicationGatewayBackendHealthInner>() {
@Override
public ApplicationGatewayBackendHealthInner call(ServiceResponse<ApplicationGatewayBackendHealthInner> response) {
return response.body();
}
});
} | java | public Observable<ApplicationGatewayBackendHealthInner> beginBackendHealthAsync(String resourceGroupName, String applicationGatewayName, String expand) {
return beginBackendHealthWithServiceResponseAsync(resourceGroupName, applicationGatewayName, expand).map(new Func1<ServiceResponse<ApplicationGatewayBackendHealthInner>, ApplicationGatewayBackendHealthInner>() {
@Override
public ApplicationGatewayBackendHealthInner call(ServiceResponse<ApplicationGatewayBackendHealthInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationGatewayBackendHealthInner",
">",
"beginBackendHealthAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"applicationGatewayName",
",",
"String",
"expand",
")",
"{",
"return",
"beginBackendHealthWithServiceResponseAsync",
"(",
"r... | Gets the backend health of the specified application gateway in a resource group.
@param resourceGroupName The name of the resource group.
@param applicationGatewayName The name of the application gateway.
@param expand Expands BackendAddressPool and BackendHttpSettings referenced in backend health.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationGatewayBackendHealthInner object | [
"Gets",
"the",
"backend",
"health",
"of",
"the",
"specified",
"application",
"gateway",
"in",
"a",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L1649-L1656 |
iig-uni-freiburg/SEWOL | src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java | ProcessContext.setDataFor | public void setDataFor(String activity, Set<String> attributes) throws CompatibilityException {
validateActivity(activity);
validateAttributes(attributes);
if (!attributes.isEmpty()) {
Map<String, Set<DataUsage>> dataUsage = new HashMap<>();
for (String attribute : attributes) {
dataUsage.put(attribute, new HashSet<>(validUsageModes));
}
activityDataUsage.put(activity, dataUsage);
}
} | java | public void setDataFor(String activity, Set<String> attributes) throws CompatibilityException {
validateActivity(activity);
validateAttributes(attributes);
if (!attributes.isEmpty()) {
Map<String, Set<DataUsage>> dataUsage = new HashMap<>();
for (String attribute : attributes) {
dataUsage.put(attribute, new HashSet<>(validUsageModes));
}
activityDataUsage.put(activity, dataUsage);
}
} | [
"public",
"void",
"setDataFor",
"(",
"String",
"activity",
",",
"Set",
"<",
"String",
">",
"attributes",
")",
"throws",
"CompatibilityException",
"{",
"validateActivity",
"(",
"activity",
")",
";",
"validateAttributes",
"(",
"attributes",
")",
";",
"if",
"(",
... | Sets the data attributes used by the given activity.<br>
The given activity/attributes have to be known by the context, i.e.
be contained in the activity/attribute list.
@param activity Activity for which the attribute usage is set.
@param attributes Attributes used as input by the given activity.
@throws ParameterException
@throws CompatibilityException
@throws IllegalArgumentException If the given activity/attributes are
not known.
@throws NullPointerException If the attribute set is
<code>null</code>.
@see #getAttributes() | [
"Sets",
"the",
"data",
"attributes",
"used",
"by",
"the",
"given",
"activity",
".",
"<br",
">",
"The",
"given",
"activity",
"/",
"attributes",
"have",
"to",
"be",
"known",
"by",
"the",
"context",
"i",
".",
"e",
".",
"be",
"contained",
"in",
"the",
"act... | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java#L558-L568 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java | BasePanel.selectField | public void selectField(ScreenField sfCurrent, int iSelectField)
{
ScreenField sField = this.getComponentAfter(sfCurrent, iSelectField);
if (sField != null)
sField.requestFocus();
} | java | public void selectField(ScreenField sfCurrent, int iSelectField)
{
ScreenField sField = this.getComponentAfter(sfCurrent, iSelectField);
if (sField != null)
sField.requestFocus();
} | [
"public",
"void",
"selectField",
"(",
"ScreenField",
"sfCurrent",
",",
"int",
"iSelectField",
")",
"{",
"ScreenField",
"sField",
"=",
"this",
".",
"getComponentAfter",
"(",
"sfCurrent",
",",
"iSelectField",
")",
";",
"if",
"(",
"sField",
"!=",
"null",
")",
"... | Move the focus to the next logical field.
@param sfCurrent The currently selected screen field.
@param iSelectField The screen field to select (next/prev/first/last). | [
"Move",
"the",
"focus",
"to",
"the",
"next",
"logical",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L1219-L1224 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.setCertificateContacts | public Contacts setCertificateContacts(String vaultBaseUrl, Contacts contacts) {
return setCertificateContactsWithServiceResponseAsync(vaultBaseUrl, contacts).toBlocking().single().body();
} | java | public Contacts setCertificateContacts(String vaultBaseUrl, Contacts contacts) {
return setCertificateContactsWithServiceResponseAsync(vaultBaseUrl, contacts).toBlocking().single().body();
} | [
"public",
"Contacts",
"setCertificateContacts",
"(",
"String",
"vaultBaseUrl",
",",
"Contacts",
"contacts",
")",
"{",
"return",
"setCertificateContactsWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"contacts",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"("... | Sets the certificate contacts for the specified key vault.
Sets the certificate contacts for the specified key vault. This operation requires the certificates/managecontacts permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param contacts The contacts for the key vault certificate.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the Contacts object if successful. | [
"Sets",
"the",
"certificate",
"contacts",
"for",
"the",
"specified",
"key",
"vault",
".",
"Sets",
"the",
"certificate",
"contacts",
"for",
"the",
"specified",
"key",
"vault",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"managecontacts",
"pe... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L5413-L5415 |
liferay/com-liferay-commerce | commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java | CommerceDiscountPersistenceImpl.countByLtE_S | @Override
public int countByLtE_S(Date expirationDate, int status) {
FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_COUNT_BY_LTE_S;
Object[] finderArgs = new Object[] { _getTime(expirationDate), status };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_COMMERCEDISCOUNT_WHERE);
boolean bindExpirationDate = false;
if (expirationDate == null) {
query.append(_FINDER_COLUMN_LTE_S_EXPIRATIONDATE_1);
}
else {
bindExpirationDate = true;
query.append(_FINDER_COLUMN_LTE_S_EXPIRATIONDATE_2);
}
query.append(_FINDER_COLUMN_LTE_S_STATUS_2);
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
if (bindExpirationDate) {
qPos.add(new Timestamp(expirationDate.getTime()));
}
qPos.add(status);
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | java | @Override
public int countByLtE_S(Date expirationDate, int status) {
FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_COUNT_BY_LTE_S;
Object[] finderArgs = new Object[] { _getTime(expirationDate), status };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_COMMERCEDISCOUNT_WHERE);
boolean bindExpirationDate = false;
if (expirationDate == null) {
query.append(_FINDER_COLUMN_LTE_S_EXPIRATIONDATE_1);
}
else {
bindExpirationDate = true;
query.append(_FINDER_COLUMN_LTE_S_EXPIRATIONDATE_2);
}
query.append(_FINDER_COLUMN_LTE_S_STATUS_2);
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
if (bindExpirationDate) {
qPos.add(new Timestamp(expirationDate.getTime()));
}
qPos.add(status);
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | [
"@",
"Override",
"public",
"int",
"countByLtE_S",
"(",
"Date",
"expirationDate",
",",
"int",
"status",
")",
"{",
"FinderPath",
"finderPath",
"=",
"FINDER_PATH_WITH_PAGINATION_COUNT_BY_LTE_S",
";",
"Object",
"[",
"]",
"finderArgs",
"=",
"new",
"Object",
"[",
"]",
... | Returns the number of commerce discounts where expirationDate < ? and status = ?.
@param expirationDate the expiration date
@param status the status
@return the number of matching commerce discounts | [
"Returns",
"the",
"number",
"of",
"commerce",
"discounts",
"where",
"expirationDate",
"<",
";",
"?",
";",
"and",
"status",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java#L4438-L4496 |
recruit-mp/android-RMP-Appirater | library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java | RmpAppirater.appLaunched | public static void appLaunched(Context context, ShowRateDialogCondition showRateDialogCondition) {
appLaunched(context, showRateDialogCondition, null, null);
} | java | public static void appLaunched(Context context, ShowRateDialogCondition showRateDialogCondition) {
appLaunched(context, showRateDialogCondition, null, null);
} | [
"public",
"static",
"void",
"appLaunched",
"(",
"Context",
"context",
",",
"ShowRateDialogCondition",
"showRateDialogCondition",
")",
"{",
"appLaunched",
"(",
"context",
",",
"showRateDialogCondition",
",",
"null",
",",
"null",
")",
";",
"}"
] | Tells RMP-Appirater that the app has launched.
<p/>
Rating dialog is shown after calling this method.
@param context Context
@param showRateDialogCondition Showing rate dialog condition. | [
"Tells",
"RMP",
"-",
"Appirater",
"that",
"the",
"app",
"has",
"launched",
".",
"<p",
"/",
">",
"Rating",
"dialog",
"is",
"shown",
"after",
"calling",
"this",
"method",
"."
] | train | https://github.com/recruit-mp/android-RMP-Appirater/blob/14fcdf110dfb97120303f39aab1de9393e84b90a/library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java#L71-L73 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/DynaBean.java | DynaBean.get | @SuppressWarnings("unchecked")
public <T> T get(String fieldName) throws BeanException{
if(Map.class.isAssignableFrom(beanClass)){
return (T) ((Map<?, ?>)bean).get(fieldName);
}else{
try {
final Method method = BeanUtil.getBeanDesc(beanClass).getGetter(fieldName);
if(null == method){
throw new BeanException("No get method for {}", fieldName);
}
return (T) method.invoke(this.bean);
} catch (Exception e) {
throw new BeanException(e);
}
}
} | java | @SuppressWarnings("unchecked")
public <T> T get(String fieldName) throws BeanException{
if(Map.class.isAssignableFrom(beanClass)){
return (T) ((Map<?, ?>)bean).get(fieldName);
}else{
try {
final Method method = BeanUtil.getBeanDesc(beanClass).getGetter(fieldName);
if(null == method){
throw new BeanException("No get method for {}", fieldName);
}
return (T) method.invoke(this.bean);
} catch (Exception e) {
throw new BeanException(e);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"get",
"(",
"String",
"fieldName",
")",
"throws",
"BeanException",
"{",
"if",
"(",
"Map",
".",
"class",
".",
"isAssignableFrom",
"(",
"beanClass",
")",
")",
"{",
"return",
... | 获得字段对应值
@param <T> 属性值类型
@param fieldName 字段名
@return 字段值
@throws BeanException 反射获取属性值或字段值导致的异常 | [
"获得字段对应值"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/DynaBean.java#L74-L89 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/http/handler/ProxyHandler.java | ProxyHandler.isForbidden | protected boolean isForbidden(String scheme, String host, int port, boolean openNonPrivPorts)
{
// Check port
Integer p = new Integer(port);
if (port > 0 && !_allowedConnectPorts.contains(p))
{
if (!openNonPrivPorts || port <= 1024)
return true;
}
// Must be a scheme that can be proxied.
if (scheme == null || !_ProxySchemes.containsKey(scheme))
return true;
// Must be in any defined white list
if (_proxyHostsWhiteList != null && !_proxyHostsWhiteList.contains(host))
return true;
// Must not be in any defined black list
if (_proxyHostsBlackList != null && _proxyHostsBlackList.contains(host))
return true;
return false;
} | java | protected boolean isForbidden(String scheme, String host, int port, boolean openNonPrivPorts)
{
// Check port
Integer p = new Integer(port);
if (port > 0 && !_allowedConnectPorts.contains(p))
{
if (!openNonPrivPorts || port <= 1024)
return true;
}
// Must be a scheme that can be proxied.
if (scheme == null || !_ProxySchemes.containsKey(scheme))
return true;
// Must be in any defined white list
if (_proxyHostsWhiteList != null && !_proxyHostsWhiteList.contains(host))
return true;
// Must not be in any defined black list
if (_proxyHostsBlackList != null && _proxyHostsBlackList.contains(host))
return true;
return false;
} | [
"protected",
"boolean",
"isForbidden",
"(",
"String",
"scheme",
",",
"String",
"host",
",",
"int",
"port",
",",
"boolean",
"openNonPrivPorts",
")",
"{",
"// Check port",
"Integer",
"p",
"=",
"new",
"Integer",
"(",
"port",
")",
";",
"if",
"(",
"port",
">",
... | Is scheme,host & port Forbidden.
@param scheme A scheme that mast be in the proxySchemes StringMap.
@param host A host that must pass the white and black lists
@param port A port that must in the allowedConnectPorts Set
@param openNonPrivPorts If true ports greater than 1024 are allowed.
@return True if the request to the scheme,host and port is not forbidden. | [
"Is",
"scheme",
"host",
"&",
"port",
"Forbidden",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/handler/ProxyHandler.java#L586-L609 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/random/RandomLong.java | RandomLong.updateLong | public static long updateLong(long value, long range)
{
range = range == 0 ? (long)(0.1 * value) : range;
long minValue = value - range;
long maxValue = value + range;
return nextLong(minValue, maxValue);
} | java | public static long updateLong(long value, long range)
{
range = range == 0 ? (long)(0.1 * value) : range;
long minValue = value - range;
long maxValue = value + range;
return nextLong(minValue, maxValue);
} | [
"public",
"static",
"long",
"updateLong",
"(",
"long",
"value",
",",
"long",
"range",
")",
"{",
"range",
"=",
"range",
"==",
"0",
"?",
"(",
"long",
")",
"(",
"0.1",
"*",
"value",
")",
":",
"range",
";",
"long",
"minValue",
"=",
"value",
"-",
"range... | Updates (drifts) a long value within specified range defined
@param value a long value to drift.
@param range (optional) a range. Default: 10% of the value
@return updated random long value. | [
"Updates",
"(",
"drifts",
")",
"a",
"long",
"value",
"within",
"specified",
"range",
"defined"
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/random/RandomLong.java#L69-L75 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java | JobsImpl.disableAsync | public Observable<Void> disableAsync(String jobId, DisableJobOption disableTasks) {
return disableWithServiceResponseAsync(jobId, disableTasks).map(new Func1<ServiceResponseWithHeaders<Void, JobDisableHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobDisableHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> disableAsync(String jobId, DisableJobOption disableTasks) {
return disableWithServiceResponseAsync(jobId, disableTasks).map(new Func1<ServiceResponseWithHeaders<Void, JobDisableHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobDisableHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"disableAsync",
"(",
"String",
"jobId",
",",
"DisableJobOption",
"disableTasks",
")",
"{",
"return",
"disableWithServiceResponseAsync",
"(",
"jobId",
",",
"disableTasks",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"Servi... | Disables the specified job, preventing new tasks from running.
The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409.
@param jobId The ID of the job to disable.
@param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait'
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Disables",
"the",
"specified",
"job",
"preventing",
"new",
"tasks",
"from",
"running",
".",
"The",
"Batch",
"Service",
"immediately",
"moves",
"the",
"job",
"to",
"the",
"disabling",
"state",
".",
"Batch",
"then",
"uses",
"the",
"disableTasks",
"parameter",
"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L1343-L1350 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Channel.java | Channel.updateChannelConfiguration | public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, byte[]... signers) throws TransactionException, InvalidArgumentException {
updateChannelConfiguration(updateChannelConfiguration, getRandomOrderer(), signers);
} | java | public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, byte[]... signers) throws TransactionException, InvalidArgumentException {
updateChannelConfiguration(updateChannelConfiguration, getRandomOrderer(), signers);
} | [
"public",
"void",
"updateChannelConfiguration",
"(",
"UpdateChannelConfiguration",
"updateChannelConfiguration",
",",
"byte",
"[",
"]",
"...",
"signers",
")",
"throws",
"TransactionException",
",",
"InvalidArgumentException",
"{",
"updateChannelConfiguration",
"(",
"updateCha... | Update channel with specified channel configuration
@param updateChannelConfiguration Updated Channel configuration
@param signers signers
@throws TransactionException
@throws InvalidArgumentException | [
"Update",
"channel",
"with",
"specified",
"channel",
"configuration"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L406-L410 |
js-lib-com/dom | src/main/java/js/dom/w3c/DocumentImpl.java | DocumentImpl.getElement | Element getElement(Node node) {
if (node == null) {
return null;
}
// element instance is cached as node user defined data and reused
Object value = node.getUserData(BACK_REF);
if (value != null) {
return (Element) value;
}
Element el = new ElementImpl(this, node);
node.setUserData(BACK_REF, el, null);
return el;
} | java | Element getElement(Node node) {
if (node == null) {
return null;
}
// element instance is cached as node user defined data and reused
Object value = node.getUserData(BACK_REF);
if (value != null) {
return (Element) value;
}
Element el = new ElementImpl(this, node);
node.setUserData(BACK_REF, el, null);
return el;
} | [
"Element",
"getElement",
"(",
"Node",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// element instance is cached as node user defined data and reused\r",
"Object",
"value",
"=",
"node",
".",
"getUserData",
"(",
"BACK_RE... | Get the element associated to node. Returns the element bound to given node. If no element instance found, create a new
{@link Element} instance, bound it to node then returns it. Returns null is given node is undefined or null.
<p>
Element instance is saved on node using {@link Node#setUserData(String, Object, org.w3c.dom.UserDataHandler)} and reused.
See {@link #BACK_REF} for key used to store element instance.
@param node native W3C DOM Node.
@return element wrapping the given node or null. | [
"Get",
"the",
"element",
"associated",
"to",
"node",
".",
"Returns",
"the",
"element",
"bound",
"to",
"given",
"node",
".",
"If",
"no",
"element",
"instance",
"found",
"create",
"a",
"new",
"{",
"@link",
"Element",
"}",
"instance",
"bound",
"it",
"to",
"... | train | https://github.com/js-lib-com/dom/blob/8c7cd7c802977f210674dec7c2a8f61e8de05b63/src/main/java/js/dom/w3c/DocumentImpl.java#L65-L77 |
spring-projects/spring-data-solr | src/main/java/org/springframework/data/solr/core/query/Criteria.java | Criteria.within | public Criteria within(Point location, @Nullable Distance distance) {
Assert.notNull(location, "Location must not be null!");
assertPositiveDistanceValue(distance);
predicates.add(
new Predicate(OperationKey.WITHIN, new Object[] { location, distance != null ? distance : new Distance(0) }));
return this;
} | java | public Criteria within(Point location, @Nullable Distance distance) {
Assert.notNull(location, "Location must not be null!");
assertPositiveDistanceValue(distance);
predicates.add(
new Predicate(OperationKey.WITHIN, new Object[] { location, distance != null ? distance : new Distance(0) }));
return this;
} | [
"public",
"Criteria",
"within",
"(",
"Point",
"location",
",",
"@",
"Nullable",
"Distance",
"distance",
")",
"{",
"Assert",
".",
"notNull",
"(",
"location",
",",
"\"Location must not be null!\"",
")",
";",
"assertPositiveDistanceValue",
"(",
"distance",
")",
";",
... | Creates new {@link Predicate} for {@code !geodist}
@param location {@link Point} in degrees
@param distance
@return | [
"Creates",
"new",
"{",
"@link",
"Predicate",
"}",
"for",
"{",
"@code",
"!geodist",
"}"
] | train | https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L500-L506 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java | SpiderTransaction.deleteShardedLinkRow | public void deleteShardedLinkRow(FieldDefinition linkDef, String owningObjID, int shardNumber) {
assert linkDef.isSharded();
assert shardNumber > 0;
deleteRow(SpiderService.termsStoreName(linkDef.getTableDef()),
SpiderService.shardedLinkTermRowKey(linkDef, owningObjID, shardNumber));
} | java | public void deleteShardedLinkRow(FieldDefinition linkDef, String owningObjID, int shardNumber) {
assert linkDef.isSharded();
assert shardNumber > 0;
deleteRow(SpiderService.termsStoreName(linkDef.getTableDef()),
SpiderService.shardedLinkTermRowKey(linkDef, owningObjID, shardNumber));
} | [
"public",
"void",
"deleteShardedLinkRow",
"(",
"FieldDefinition",
"linkDef",
",",
"String",
"owningObjID",
",",
"int",
"shardNumber",
")",
"{",
"assert",
"linkDef",
".",
"isSharded",
"(",
")",
";",
"assert",
"shardNumber",
">",
"0",
";",
"deleteRow",
"(",
"Spi... | Delete the shard row for the given sharded link and shard number.
@param linkDef {@link FieldDefinition} of a sharded link.
@param owningObjID ID of object that owns the link.
@param shardNumber Shard number of row to be deleted. Must be > 0.
@see #addShardedLinkValue(String, FieldDefinition, DBObject, int)
@see SpiderService#shardedLinkTermRowKey(FieldDefinition, String, int) | [
"Delete",
"the",
"shard",
"row",
"for",
"the",
"given",
"sharded",
"link",
"and",
"shard",
"number",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java#L449-L454 |
aws/aws-sdk-java | aws-java-sdk-glacier/src/main/java/com/amazonaws/services/glacier/transfer/ArchiveTransferManager.java | ArchiveTransferManager.appendToFile | private void appendToFile(RandomAccessFile output, InputStream input)
throws IOException {
byte[] buffer = new byte[1024 * 1024];
int bytesRead = 0;
do {
bytesRead = input.read(buffer);
if (bytesRead < 0)
break;
output.write(buffer, 0, bytesRead);
} while (bytesRead > 0);
return;
} | java | private void appendToFile(RandomAccessFile output, InputStream input)
throws IOException {
byte[] buffer = new byte[1024 * 1024];
int bytesRead = 0;
do {
bytesRead = input.read(buffer);
if (bytesRead < 0)
break;
output.write(buffer, 0, bytesRead);
} while (bytesRead > 0);
return;
} | [
"private",
"void",
"appendToFile",
"(",
"RandomAccessFile",
"output",
",",
"InputStream",
"input",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"1024",
"*",
"1024",
"]",
";",
"int",
"bytesRead",
"=",
"0",
";",
"... | Writes the data from the given input stream to the given output stream. | [
"Writes",
"the",
"data",
"from",
"the",
"given",
"input",
"stream",
"to",
"the",
"given",
"output",
"stream",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glacier/src/main/java/com/amazonaws/services/glacier/transfer/ArchiveTransferManager.java#L660-L671 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/lang/NativeLoader.java | NativeLoader.loadLibrary0 | static void loadLibrary0(String pLibrary, String pResource, ClassLoader pLoader) {
if (pLibrary == null) {
throw new IllegalArgumentException("library == null");
}
// Try loading normal way
UnsatisfiedLinkError unsatisfied;
try {
System.loadLibrary(pLibrary);
return;
}
catch (UnsatisfiedLinkError err) {
// Ignore
unsatisfied = err;
}
final ClassLoader loader = pLoader != null ? pLoader : Thread.currentThread().getContextClassLoader();
final String resource = pResource != null ? pResource : getResourceFor(pLibrary);
// TODO: resource may be null, and that MIGHT be okay, IFF the resource
// is allready unpacked to the user dir... However, we then need another
// way to resolve the library extension...
// Right now we just fail in a predictable way (no NPE)!
if (resource == null) {
throw unsatisfied;
}
// Default to load/store from user.home
File dir = new File(System.getProperty("user.home") + "/.twelvemonkeys/lib");
dir.mkdirs();
//File libraryFile = new File(dir.getAbsolutePath(), pLibrary + LIBRARY_EXTENSION);
File libraryFile = new File(dir.getAbsolutePath(), pLibrary + "." + FileUtil.getExtension(resource));
if (!libraryFile.exists()) {
try {
extractToUserDir(resource, libraryFile, loader);
}
catch (IOException ioe) {
UnsatisfiedLinkError err = new UnsatisfiedLinkError("Unable to extract resource to dir: " + libraryFile.getAbsolutePath());
err.initCause(ioe);
throw err;
}
}
// Try to load the library from the file we just wrote
System.load(libraryFile.getAbsolutePath());
} | java | static void loadLibrary0(String pLibrary, String pResource, ClassLoader pLoader) {
if (pLibrary == null) {
throw new IllegalArgumentException("library == null");
}
// Try loading normal way
UnsatisfiedLinkError unsatisfied;
try {
System.loadLibrary(pLibrary);
return;
}
catch (UnsatisfiedLinkError err) {
// Ignore
unsatisfied = err;
}
final ClassLoader loader = pLoader != null ? pLoader : Thread.currentThread().getContextClassLoader();
final String resource = pResource != null ? pResource : getResourceFor(pLibrary);
// TODO: resource may be null, and that MIGHT be okay, IFF the resource
// is allready unpacked to the user dir... However, we then need another
// way to resolve the library extension...
// Right now we just fail in a predictable way (no NPE)!
if (resource == null) {
throw unsatisfied;
}
// Default to load/store from user.home
File dir = new File(System.getProperty("user.home") + "/.twelvemonkeys/lib");
dir.mkdirs();
//File libraryFile = new File(dir.getAbsolutePath(), pLibrary + LIBRARY_EXTENSION);
File libraryFile = new File(dir.getAbsolutePath(), pLibrary + "." + FileUtil.getExtension(resource));
if (!libraryFile.exists()) {
try {
extractToUserDir(resource, libraryFile, loader);
}
catch (IOException ioe) {
UnsatisfiedLinkError err = new UnsatisfiedLinkError("Unable to extract resource to dir: " + libraryFile.getAbsolutePath());
err.initCause(ioe);
throw err;
}
}
// Try to load the library from the file we just wrote
System.load(libraryFile.getAbsolutePath());
} | [
"static",
"void",
"loadLibrary0",
"(",
"String",
"pLibrary",
",",
"String",
"pResource",
",",
"ClassLoader",
"pLoader",
")",
"{",
"if",
"(",
"pLibrary",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"library == null\"",
")",
";",
"... | Loads a native library.
@param pLibrary name of the library
@param pResource name of the resource
@param pLoader the class loader to use
@throws UnsatisfiedLinkError | [
"Loads",
"a",
"native",
"library",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/lang/NativeLoader.java#L230-L276 |
riversun/bigdoc | src/main/java/org/riversun/bigdoc/bin/BinFileSearcher.java | BinFileSearcher.searchPartially | public List<Long> searchPartially(File f, byte[] searchBytes, long startPosition, long maxSizeToRead) {
if (USE_NIO) {
return searchPartiallyUsingNIO(f, searchBytes, startPosition, maxSizeToRead, null);
} else {
return searchPartiallyUsingLegacy(f, searchBytes, startPosition, maxSizeToRead, null);
}
} | java | public List<Long> searchPartially(File f, byte[] searchBytes, long startPosition, long maxSizeToRead) {
if (USE_NIO) {
return searchPartiallyUsingNIO(f, searchBytes, startPosition, maxSizeToRead, null);
} else {
return searchPartiallyUsingLegacy(f, searchBytes, startPosition, maxSizeToRead, null);
}
} | [
"public",
"List",
"<",
"Long",
">",
"searchPartially",
"(",
"File",
"f",
",",
"byte",
"[",
"]",
"searchBytes",
",",
"long",
"startPosition",
",",
"long",
"maxSizeToRead",
")",
"{",
"if",
"(",
"USE_NIO",
")",
"{",
"return",
"searchPartiallyUsingNIO",
"(",
"... | Search for a sequence of bytes from the file within the specified size
range starting at the specified position .
@param f
@param searchBytes
a sequence of bytes you want to find
@param startPosition
'0' means the beginning of the file
@param maxSizeToRead
max size to read.'-1' means read until the end.
@return | [
"Search",
"for",
"a",
"sequence",
"of",
"bytes",
"from",
"the",
"file",
"within",
"the",
"specified",
"size",
"range",
"starting",
"at",
"the",
"specified",
"position",
"."
] | train | https://github.com/riversun/bigdoc/blob/46bd7c9a8667be23acdb1ad8286027e4b08cff3a/src/main/java/org/riversun/bigdoc/bin/BinFileSearcher.java#L220-L226 |
Drivemode/TypefaceHelper | TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java | TypefaceHelper.setTypeface | public <D extends Dialog> void setTypeface(D dialog, @StringRes int strResId) {
setTypeface(dialog, mApplication.getString(strResId));
} | java | public <D extends Dialog> void setTypeface(D dialog, @StringRes int strResId) {
setTypeface(dialog, mApplication.getString(strResId));
} | [
"public",
"<",
"D",
"extends",
"Dialog",
">",
"void",
"setTypeface",
"(",
"D",
"dialog",
",",
"@",
"StringRes",
"int",
"strResId",
")",
"{",
"setTypeface",
"(",
"dialog",
",",
"mApplication",
".",
"getString",
"(",
"strResId",
")",
")",
";",
"}"
] | Set the typeface for the dialog view.
@param dialog the dialog.
@param strResId string resource containing typeface name. | [
"Set",
"the",
"typeface",
"for",
"the",
"dialog",
"view",
"."
] | train | https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L475-L477 |
demidenko05/beigesoft-orm | src/main/java/org/beigesoft/orm/service/ASrvOrm.java | ASrvOrm.updateEntity | @Override
public final <T> void updateEntity(
final Map<String, Object> pAddParam,
final T pEntity) throws Exception {
ColumnsValues columnsValues = evalColumnsValues(pAddParam, pEntity);
String whereStr = evalWhereForUpdate(pEntity, columnsValues);
prepareColumnValuesForUpdate(columnsValues, pEntity);
int result = getSrvDatabase().executeUpdate(pEntity.getClass()
.getSimpleName().toUpperCase(), columnsValues, whereStr);
if (result != 1) {
if (result == 0 && columnsValues.ifContains(VERSION_NAME)) {
throw new ExceptionWithCode(ISrvDatabase.DIRTY_READ, "dirty_read");
} else {
String query = hlpInsertUpdate.evalSqlUpdate(pEntity.getClass()
.getSimpleName().toUpperCase(), columnsValues,
whereStr);
throw new ExceptionWithCode(ISrvDatabase.ERROR_INSERT_UPDATE,
"It should be 1 row updated but it was "
+ result + ", query:\n" + query);
}
}
} | java | @Override
public final <T> void updateEntity(
final Map<String, Object> pAddParam,
final T pEntity) throws Exception {
ColumnsValues columnsValues = evalColumnsValues(pAddParam, pEntity);
String whereStr = evalWhereForUpdate(pEntity, columnsValues);
prepareColumnValuesForUpdate(columnsValues, pEntity);
int result = getSrvDatabase().executeUpdate(pEntity.getClass()
.getSimpleName().toUpperCase(), columnsValues, whereStr);
if (result != 1) {
if (result == 0 && columnsValues.ifContains(VERSION_NAME)) {
throw new ExceptionWithCode(ISrvDatabase.DIRTY_READ, "dirty_read");
} else {
String query = hlpInsertUpdate.evalSqlUpdate(pEntity.getClass()
.getSimpleName().toUpperCase(), columnsValues,
whereStr);
throw new ExceptionWithCode(ISrvDatabase.ERROR_INSERT_UPDATE,
"It should be 1 row updated but it was "
+ result + ", query:\n" + query);
}
}
} | [
"@",
"Override",
"public",
"final",
"<",
"T",
">",
"void",
"updateEntity",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"pAddParam",
",",
"final",
"T",
"pEntity",
")",
"throws",
"Exception",
"{",
"ColumnsValues",
"columnsValues",
"=",
"evalColumns... | <p>Update entity in DB.</p>
@param <T> entity type
@param pAddParam additional param
@param pEntity entity
@throws Exception - an exception | [
"<p",
">",
"Update",
"entity",
"in",
"DB",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/demidenko05/beigesoft-orm/blob/f1b2c70701a111741a436911ca24ef9d38eba0b9/src/main/java/org/beigesoft/orm/service/ASrvOrm.java#L268-L289 |
axibase/atsd-jdbc | src/main/java/com/axibase/tsd/driver/jdbc/ext/AtsdMeta.java | AtsdMeta.prepareGetMetricUrls | @Nonnull
static Collection<MetricLocation> prepareGetMetricUrls(List<String> metricMasks, String tableFilter, boolean underscoreAsLiteral) {
if (WildcardsUtil.isRetrieveAllPattern(tableFilter) || tableFilter.isEmpty()) {
if (metricMasks.isEmpty()) {
return Collections.emptyList();
} else {
return buildPatternDisjunction(metricMasks, underscoreAsLiteral);
}
} else {
return Collections.singletonList(buildAtsdPatternUrl(tableFilter, underscoreAsLiteral));
}
} | java | @Nonnull
static Collection<MetricLocation> prepareGetMetricUrls(List<String> metricMasks, String tableFilter, boolean underscoreAsLiteral) {
if (WildcardsUtil.isRetrieveAllPattern(tableFilter) || tableFilter.isEmpty()) {
if (metricMasks.isEmpty()) {
return Collections.emptyList();
} else {
return buildPatternDisjunction(metricMasks, underscoreAsLiteral);
}
} else {
return Collections.singletonList(buildAtsdPatternUrl(tableFilter, underscoreAsLiteral));
}
} | [
"@",
"Nonnull",
"static",
"Collection",
"<",
"MetricLocation",
">",
"prepareGetMetricUrls",
"(",
"List",
"<",
"String",
">",
"metricMasks",
",",
"String",
"tableFilter",
",",
"boolean",
"underscoreAsLiteral",
")",
"{",
"if",
"(",
"WildcardsUtil",
".",
"isRetrieveA... | Prepare URL to retrieve metrics
@param metricMasks filter specified in `tables` connection string parameter
@param tableFilter filter specified in method parameter
@param underscoreAsLiteral treat underscore as not a metacharacter
@return MetricLocation | [
"Prepare",
"URL",
"to",
"retrieve",
"metrics"
] | train | https://github.com/axibase/atsd-jdbc/blob/8bbd9d65f645272aa1d7fc07081bd10bd3e0c376/src/main/java/com/axibase/tsd/driver/jdbc/ext/AtsdMeta.java#L661-L672 |
cqframework/clinical_quality_language | Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java | ElmBaseVisitor.visitInterval | public T visitInterval(Interval elm, C context) {
if (elm.getLow() != null) {
visitElement(elm.getLow(), context);
}
if (elm.getLowClosedExpression() != null) {
visitElement(elm.getLowClosedExpression(), context);
}
if (elm.getHigh() != null) {
visitElement(elm.getHigh(), context);
}
if (elm.getHighClosedExpression() != null) {
visitElement(elm.getHighClosedExpression(), context);
}
return null;
} | java | public T visitInterval(Interval elm, C context) {
if (elm.getLow() != null) {
visitElement(elm.getLow(), context);
}
if (elm.getLowClosedExpression() != null) {
visitElement(elm.getLowClosedExpression(), context);
}
if (elm.getHigh() != null) {
visitElement(elm.getHigh(), context);
}
if (elm.getHighClosedExpression() != null) {
visitElement(elm.getHighClosedExpression(), context);
}
return null;
} | [
"public",
"T",
"visitInterval",
"(",
"Interval",
"elm",
",",
"C",
"context",
")",
"{",
"if",
"(",
"elm",
".",
"getLow",
"(",
")",
"!=",
"null",
")",
"{",
"visitElement",
"(",
"elm",
".",
"getLow",
"(",
")",
",",
"context",
")",
";",
"}",
"if",
"(... | Visit a Interval. This method will be called for
every node in the tree that is a Interval.
@param elm the ELM tree
@param context the context passed to the visitor
@return the visitor result | [
"Visit",
"a",
"Interval",
".",
"This",
"method",
"will",
"be",
"called",
"for",
"every",
"node",
"in",
"the",
"tree",
"that",
"is",
"a",
"Interval",
"."
] | train | https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L511-L525 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.addFileToClassPath | public static void addFileToClassPath(Path file, Configuration conf)
throws IOException {
String classpath = conf.get("mapred.job.classpath.files");
conf.set("mapred.job.classpath.files", classpath == null ? file.toString()
: classpath + System.getProperty("path.separator") + file.toString());
URI uri = file.makeQualified(file.getFileSystem(conf)).toUri();
addCacheFile(uri, conf);
} | java | public static void addFileToClassPath(Path file, Configuration conf)
throws IOException {
String classpath = conf.get("mapred.job.classpath.files");
conf.set("mapred.job.classpath.files", classpath == null ? file.toString()
: classpath + System.getProperty("path.separator") + file.toString());
URI uri = file.makeQualified(file.getFileSystem(conf)).toUri();
addCacheFile(uri, conf);
} | [
"public",
"static",
"void",
"addFileToClassPath",
"(",
"Path",
"file",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"String",
"classpath",
"=",
"conf",
".",
"get",
"(",
"\"mapred.job.classpath.files\"",
")",
";",
"conf",
".",
"set",
"(",
"\... | Add an file path to the current set of classpath entries It adds the file
to cache as well.
@param file Path of the file to be added
@param conf Configuration that contains the classpath setting | [
"Add",
"an",
"file",
"path",
"to",
"the",
"current",
"set",
"of",
"classpath",
"entries",
"It",
"adds",
"the",
"file",
"to",
"cache",
"as",
"well",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L969-L977 |
elastic/elasticsearch-hadoop | mr/src/main/java/org/elasticsearch/hadoop/cfg/Settings.java | Settings.getClusterInfoOrNull | public ClusterInfo getClusterInfoOrNull() {
String clusterName = getProperty(InternalConfigurationOptions.INTERNAL_ES_CLUSTER_NAME);
if (clusterName == null) {
return null;
}
String clusterUUID = getProperty(InternalConfigurationOptions.INTERNAL_ES_CLUSTER_UUID);
EsMajorVersion version = getInternalVersionOrThrow();
return new ClusterInfo(new ClusterName(clusterName, clusterUUID), version);
} | java | public ClusterInfo getClusterInfoOrNull() {
String clusterName = getProperty(InternalConfigurationOptions.INTERNAL_ES_CLUSTER_NAME);
if (clusterName == null) {
return null;
}
String clusterUUID = getProperty(InternalConfigurationOptions.INTERNAL_ES_CLUSTER_UUID);
EsMajorVersion version = getInternalVersionOrThrow();
return new ClusterInfo(new ClusterName(clusterName, clusterUUID), version);
} | [
"public",
"ClusterInfo",
"getClusterInfoOrNull",
"(",
")",
"{",
"String",
"clusterName",
"=",
"getProperty",
"(",
"InternalConfigurationOptions",
".",
"INTERNAL_ES_CLUSTER_NAME",
")",
";",
"if",
"(",
"clusterName",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}... | Get the internal cluster name and version or null if not present in the settings
@return the {@link ClusterInfo} extracted from the properties or null if not present | [
"Get",
"the",
"internal",
"cluster",
"name",
"and",
"version",
"or",
"null",
"if",
"not",
"present",
"in",
"the",
"settings"
] | train | https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/cfg/Settings.java#L93-L101 |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyFooterItemRangeRemoved | public final void notifyFooterItemRangeRemoved(int positionStart, int itemCount) {
if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > footerItemCount) {
throw new IndexOutOfBoundsException("The given range [" + positionStart + " - "
+ (positionStart + itemCount - 1) + "] is not within the position bounds for footer items [0 - "
+ (footerItemCount - 1) + "].");
}
notifyItemRangeRemoved(positionStart + headerItemCount + contentItemCount, itemCount);
} | java | public final void notifyFooterItemRangeRemoved(int positionStart, int itemCount) {
if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > footerItemCount) {
throw new IndexOutOfBoundsException("The given range [" + positionStart + " - "
+ (positionStart + itemCount - 1) + "] is not within the position bounds for footer items [0 - "
+ (footerItemCount - 1) + "].");
}
notifyItemRangeRemoved(positionStart + headerItemCount + contentItemCount, itemCount);
} | [
"public",
"final",
"void",
"notifyFooterItemRangeRemoved",
"(",
"int",
"positionStart",
",",
"int",
"itemCount",
")",
"{",
"if",
"(",
"positionStart",
"<",
"0",
"||",
"itemCount",
"<",
"0",
"||",
"positionStart",
"+",
"itemCount",
">",
"footerItemCount",
")",
... | Notifies that multiple footer items are removed.
@param positionStart the position.
@param itemCount the item count. | [
"Notifies",
"that",
"multiple",
"footer",
"items",
"are",
"removed",
"."
] | train | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L404-L411 |
mozilla/rhino | src/org/mozilla/javascript/ScriptableObject.java | ScriptableObject.getProperty | public static Object getProperty(Scriptable obj, int index)
{
Scriptable start = obj;
Object result;
do {
result = obj.get(index, start);
if (result != Scriptable.NOT_FOUND)
break;
obj = obj.getPrototype();
} while (obj != null);
return result;
} | java | public static Object getProperty(Scriptable obj, int index)
{
Scriptable start = obj;
Object result;
do {
result = obj.get(index, start);
if (result != Scriptable.NOT_FOUND)
break;
obj = obj.getPrototype();
} while (obj != null);
return result;
} | [
"public",
"static",
"Object",
"getProperty",
"(",
"Scriptable",
"obj",
",",
"int",
"index",
")",
"{",
"Scriptable",
"start",
"=",
"obj",
";",
"Object",
"result",
";",
"do",
"{",
"result",
"=",
"obj",
".",
"get",
"(",
"index",
",",
"start",
")",
";",
... | Gets an indexed property from an object or any object in its prototype chain.
<p>
Searches the prototype chain for a property with integral index
<code>index</code>. Note that if you wish to look for properties with numerical
but non-integral indicies, you should use getProperty(Scriptable,String) with
the string value of the index.
<p>
@param obj a JavaScript object
@param index an integral index
@return the value of a property with index <code>index</code> found in
<code>obj</code> or any object in its prototype chain, or
<code>Scriptable.NOT_FOUND</code> if not found
@since 1.5R2 | [
"Gets",
"an",
"indexed",
"property",
"from",
"an",
"object",
"or",
"any",
"object",
"in",
"its",
"prototype",
"chain",
".",
"<p",
">",
"Searches",
"the",
"prototype",
"chain",
"for",
"a",
"property",
"with",
"integral",
"index",
"<code",
">",
"index<",
"/"... | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L2386-L2397 |
GoogleCloudPlatform/appengine-mapreduce | java/src/main/java/com/google/appengine/tools/mapreduce/outputs/LevelDbOutputWriter.java | LevelDbOutputWriter.writePhysicalRecord | private void writePhysicalRecord(ByteBuffer data, Record record) {
writeBuffer.putInt(generateCrc(data.array(), data.position(), record.getBytes(),
record.getType()));
writeBuffer.putShort((short) record.getBytes());
writeBuffer.put(record.getType().value());
int oldLimit = data.limit();
data.limit(data.position() + record.getBytes());
writeBuffer.put(data);
data.limit(oldLimit);
} | java | private void writePhysicalRecord(ByteBuffer data, Record record) {
writeBuffer.putInt(generateCrc(data.array(), data.position(), record.getBytes(),
record.getType()));
writeBuffer.putShort((short) record.getBytes());
writeBuffer.put(record.getType().value());
int oldLimit = data.limit();
data.limit(data.position() + record.getBytes());
writeBuffer.put(data);
data.limit(oldLimit);
} | [
"private",
"void",
"writePhysicalRecord",
"(",
"ByteBuffer",
"data",
",",
"Record",
"record",
")",
"{",
"writeBuffer",
".",
"putInt",
"(",
"generateCrc",
"(",
"data",
".",
"array",
"(",
")",
",",
"data",
".",
"position",
"(",
")",
",",
"record",
".",
"ge... | This method creates a record inside of a {@link ByteBuffer}
@param data The data to output.
@param record A {@link Record} object that describes
which data to write. | [
"This",
"method",
"creates",
"a",
"record",
"inside",
"of",
"a",
"{",
"@link",
"ByteBuffer",
"}"
] | train | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/outputs/LevelDbOutputWriter.java#L182-L191 |
strator-dev/greenpepper | greenpepper-open/extensions-external/php/src/main/java/com/greenpepper/phpsud/compiler/CompilerWrapper.java | CompilerWrapper.addConstructor | public void addConstructor(Class<?> [] params, String ... lines) throws CannotCompileException, NotFoundException {
CtConstructor c = new CtConstructor(getList(params), clazz);
int modifiers = Modifier.PUBLIC;
c.setModifiers(modifiers);
c.setBody(formatCode(lines));
clazz.addConstructor(c);
} | java | public void addConstructor(Class<?> [] params, String ... lines) throws CannotCompileException, NotFoundException {
CtConstructor c = new CtConstructor(getList(params), clazz);
int modifiers = Modifier.PUBLIC;
c.setModifiers(modifiers);
c.setBody(formatCode(lines));
clazz.addConstructor(c);
} | [
"public",
"void",
"addConstructor",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
"params",
",",
"String",
"...",
"lines",
")",
"throws",
"CannotCompileException",
",",
"NotFoundException",
"{",
"CtConstructor",
"c",
"=",
"new",
"CtConstructor",
"(",
"getList",
"(",
... | <p>addConstructor.</p>
@param params an array of {@link java.lang.Class} objects.
@param lines a {@link java.lang.String} object.
@throws javassist.CannotCompileException if any.
@throws javassist.NotFoundException if any. | [
"<p",
">",
"addConstructor",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/extensions-external/php/src/main/java/com/greenpepper/phpsud/compiler/CompilerWrapper.java#L171-L177 |
phax/ph-css | ph-css/src/main/java/com/helger/css/decl/CSSExpression.java | CSSExpression.addNumber | @Nonnull
public CSSExpression addNumber (@Nonnegative final int nIndex, final double dValue)
{
return addMember (nIndex, new CSSExpressionMemberTermSimple (dValue));
} | java | @Nonnull
public CSSExpression addNumber (@Nonnegative final int nIndex, final double dValue)
{
return addMember (nIndex, new CSSExpressionMemberTermSimple (dValue));
} | [
"@",
"Nonnull",
"public",
"CSSExpression",
"addNumber",
"(",
"@",
"Nonnegative",
"final",
"int",
"nIndex",
",",
"final",
"double",
"dValue",
")",
"{",
"return",
"addMember",
"(",
"nIndex",
",",
"new",
"CSSExpressionMemberTermSimple",
"(",
"dValue",
")",
")",
"... | Shortcut method to add a numeric value
@param nIndex
The index where the member should be added. Must be ≥ 0.
@param dValue
The value to be added.
@return this | [
"Shortcut",
"method",
"to",
"add",
"a",
"numeric",
"value"
] | train | https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/decl/CSSExpression.java#L224-L228 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/ELHelper.java | ELHelper.processString | @Trivial
protected String processString(String name, String expression, boolean immediateOnly) {
return processString(name, expression, immediateOnly, false);
} | java | @Trivial
protected String processString(String name, String expression, boolean immediateOnly) {
return processString(name, expression, immediateOnly, false);
} | [
"@",
"Trivial",
"protected",
"String",
"processString",
"(",
"String",
"name",
",",
"String",
"expression",
",",
"boolean",
"immediateOnly",
")",
"{",
"return",
"processString",
"(",
"name",
",",
"expression",
",",
"immediateOnly",
",",
"false",
")",
";",
"}"
... | This method will process a configuration value for any configuration setting in
{@link LdapIdentityStoreDefinition} or {@link DatabaseIdentityStoreDefinition} that
is a string and whose name is NOT a "*Expression". It will first check to see if it
is a EL expression. It it is, it will return the evaluated expression; otherwise, it
will return the literal String.
@param name The name of the property. Used for error messages.
@param expression The value returned from from the identity store definition, which can
either be a literal String or an EL expression.
@param immediateOnly Return null if the value is a deferred EL expression.
@return The String value. | [
"This",
"method",
"will",
"process",
"a",
"configuration",
"value",
"for",
"any",
"configuration",
"setting",
"in",
"{",
"@link",
"LdapIdentityStoreDefinition",
"}",
"or",
"{",
"@link",
"DatabaseIdentityStoreDefinition",
"}",
"that",
"is",
"a",
"string",
"and",
"w... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/ELHelper.java#L232-L235 |
Azure/azure-sdk-for-java | privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/VirtualNetworkLinksInner.java | VirtualNetworkLinksInner.listAsync | public Observable<Page<VirtualNetworkLinkInner>> listAsync(final String resourceGroupName, final String privateZoneName, final Integer top) {
return listWithServiceResponseAsync(resourceGroupName, privateZoneName, top)
.map(new Func1<ServiceResponse<Page<VirtualNetworkLinkInner>>, Page<VirtualNetworkLinkInner>>() {
@Override
public Page<VirtualNetworkLinkInner> call(ServiceResponse<Page<VirtualNetworkLinkInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<VirtualNetworkLinkInner>> listAsync(final String resourceGroupName, final String privateZoneName, final Integer top) {
return listWithServiceResponseAsync(resourceGroupName, privateZoneName, top)
.map(new Func1<ServiceResponse<Page<VirtualNetworkLinkInner>>, Page<VirtualNetworkLinkInner>>() {
@Override
public Page<VirtualNetworkLinkInner> call(ServiceResponse<Page<VirtualNetworkLinkInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"VirtualNetworkLinkInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"privateZoneName",
",",
"final",
"Integer",
"top",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(... | Lists the virtual network links to the specified Private DNS zone.
@param resourceGroupName The name of the resource group.
@param privateZoneName The name of the Private DNS zone (without a terminating dot).
@param top The maximum number of virtual network links to return. If not specified, returns up to 100 virtual network links.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<VirtualNetworkLinkInner> object | [
"Lists",
"the",
"virtual",
"network",
"links",
"to",
"the",
"specified",
"Private",
"DNS",
"zone",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/VirtualNetworkLinksInner.java#L1460-L1468 |
deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java | SparkUtils.readStringFromFile | public static String readStringFromFile(String path, Configuration hadoopConfig) throws IOException {
FileSystem fileSystem = FileSystem.get(hadoopConfig);
try (BufferedInputStream bis = new BufferedInputStream(fileSystem.open(new Path(path)))) {
byte[] asBytes = IOUtils.toByteArray(bis);
return new String(asBytes, "UTF-8");
}
} | java | public static String readStringFromFile(String path, Configuration hadoopConfig) throws IOException {
FileSystem fileSystem = FileSystem.get(hadoopConfig);
try (BufferedInputStream bis = new BufferedInputStream(fileSystem.open(new Path(path)))) {
byte[] asBytes = IOUtils.toByteArray(bis);
return new String(asBytes, "UTF-8");
}
} | [
"public",
"static",
"String",
"readStringFromFile",
"(",
"String",
"path",
",",
"Configuration",
"hadoopConfig",
")",
"throws",
"IOException",
"{",
"FileSystem",
"fileSystem",
"=",
"FileSystem",
".",
"get",
"(",
"hadoopConfig",
")",
";",
"try",
"(",
"BufferedInput... | Read a UTF-8 format String from HDFS (or local)
@param path Path to write the string
@param hadoopConfig Hadoop configuration, for example from SparkContext.hadoopConfiguration() | [
"Read",
"a",
"UTF",
"-",
"8",
"format",
"String",
"from",
"HDFS",
"(",
"or",
"local",
")"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java#L129-L135 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/time/JMTimeUtil.java | JMTimeUtil.changeTimestampToLong | public static long changeTimestampToLong(String dateFormat,
String timestamp, String zoneId) {
return changeTimestampToLong(getSimpleDateFormat(dateFormat, zoneId),
timestamp);
} | java | public static long changeTimestampToLong(String dateFormat,
String timestamp, String zoneId) {
return changeTimestampToLong(getSimpleDateFormat(dateFormat, zoneId),
timestamp);
} | [
"public",
"static",
"long",
"changeTimestampToLong",
"(",
"String",
"dateFormat",
",",
"String",
"timestamp",
",",
"String",
"zoneId",
")",
"{",
"return",
"changeTimestampToLong",
"(",
"getSimpleDateFormat",
"(",
"dateFormat",
",",
"zoneId",
")",
",",
"timestamp",
... | Change timestamp to long long.
@param dateFormat the date format
@param timestamp the timestamp
@param zoneId the zone id
@return the long | [
"Change",
"timestamp",
"to",
"long",
"long",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/time/JMTimeUtil.java#L554-L558 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/favorites/FavoritesInterface.java | FavoritesInterface.getContext | public PhotoContext getContext(String photoId, String userId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_CONTEXT);
parameters.put("photo_id", photoId);
parameters.put("user_id", userId);
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Collection<Element> payload = response.getPayloadCollection();
PhotoContext photoContext = new PhotoContext();
for (Element element : payload) {
String elementName = element.getTagName();
if (elementName.equals("prevphoto")) {
Photo photo = new Photo();
photo.setId(element.getAttribute("id"));
photoContext.setPreviousPhoto(photo);
} else if (elementName.equals("nextphoto")) {
Photo photo = new Photo();
photo.setId(element.getAttribute("id"));
photoContext.setNextPhoto(photo);
} else {
if (logger.isInfoEnabled()) {
logger.info("unsupported element name: " + elementName);
}
}
}
return photoContext;
} | java | public PhotoContext getContext(String photoId, String userId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_CONTEXT);
parameters.put("photo_id", photoId);
parameters.put("user_id", userId);
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Collection<Element> payload = response.getPayloadCollection();
PhotoContext photoContext = new PhotoContext();
for (Element element : payload) {
String elementName = element.getTagName();
if (elementName.equals("prevphoto")) {
Photo photo = new Photo();
photo.setId(element.getAttribute("id"));
photoContext.setPreviousPhoto(photo);
} else if (elementName.equals("nextphoto")) {
Photo photo = new Photo();
photo.setId(element.getAttribute("id"));
photoContext.setNextPhoto(photo);
} else {
if (logger.isInfoEnabled()) {
logger.info("unsupported element name: " + elementName);
}
}
}
return photoContext;
} | [
"public",
"PhotoContext",
"getContext",
"(",
"String",
"photoId",
",",
"String",
"userId",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";... | Returns next and previous favorites for a photo in a user's favorites
@param photoId
The photo id
@param userId
The user's ID
@see <a href="http://www.flickr.com/services/api/flickr.favorites.getContext.html">flickr.favorites.getContext</a> | [
"Returns",
"next",
"and",
"previous",
"favorites",
"for",
"a",
"photo",
"in",
"a",
"user",
"s",
"favorites"
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/favorites/FavoritesInterface.java#L203-L234 |
SourcePond/fileobserver | fileobserver-impl/src/main/java/ch/sourcepond/io/fileobserver/impl/fs/DirectoryRegistrationWalker.java | DirectoryRegistrationWalker.rootAdded | void rootAdded(final EventDispatcher pDispatcher, final Directory pNewRoot) {
directoryCreated(pDispatcher, pNewRoot, pNewRoot.getPath());
} | java | void rootAdded(final EventDispatcher pDispatcher, final Directory pNewRoot) {
directoryCreated(pDispatcher, pNewRoot, pNewRoot.getPath());
} | [
"void",
"rootAdded",
"(",
"final",
"EventDispatcher",
"pDispatcher",
",",
"final",
"Directory",
"pNewRoot",
")",
"{",
"directoryCreated",
"(",
"pDispatcher",
",",
"pNewRoot",
",",
"pNewRoot",
".",
"getPath",
"(",
")",
")",
";",
"}"
] | Registers the directory specified and all its sub-directories with the watch-service held by this object.
Additionally, it passes any detected file to {@link PathChangeListener#modified(PathChangeEvent)} to the listeners
specified.
@param pNewRoot Newly created directory, must not be {@code null} | [
"Registers",
"the",
"directory",
"specified",
"and",
"all",
"its",
"sub",
"-",
"directories",
"with",
"the",
"watch",
"-",
"service",
"held",
"by",
"this",
"object",
".",
"Additionally",
"it",
"passes",
"any",
"detected",
"file",
"to",
"{",
"@link",
"PathCha... | train | https://github.com/SourcePond/fileobserver/blob/dfb3055ed35759a47f52f6cfdea49879c415fd6b/fileobserver-impl/src/main/java/ch/sourcepond/io/fileobserver/impl/fs/DirectoryRegistrationWalker.java#L111-L113 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java | AbstractAsymmetricCrypto.decryptStr | public String decryptStr(String data, KeyType keyType) {
return decryptStr(data, keyType, CharsetUtil.CHARSET_UTF_8);
} | java | public String decryptStr(String data, KeyType keyType) {
return decryptStr(data, keyType, CharsetUtil.CHARSET_UTF_8);
} | [
"public",
"String",
"decryptStr",
"(",
"String",
"data",
",",
"KeyType",
"keyType",
")",
"{",
"return",
"decryptStr",
"(",
"data",
",",
"keyType",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
")",
";",
"}"
] | 解密为字符串,密文需为Hex(16进制)或Base64字符串
@param data 数据,Hex(16进制)或Base64字符串
@param keyType 密钥类型
@return 解密后的密文
@since 4.5.2 | [
"解密为字符串,密文需为Hex(16进制)或Base64字符串"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L271-L273 |
JOML-CI/JOML | src/org/joml/Matrix4x3d.java | Matrix4x3d.lookAt | public Matrix4x3d lookAt(double eyeX, double eyeY, double eyeZ,
double centerX, double centerY, double centerZ,
double upX, double upY, double upZ, Matrix4x3d dest) {
if ((properties & PROPERTY_IDENTITY) != 0)
return dest.setLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
return lookAtGeneric(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ, dest);
} | java | public Matrix4x3d lookAt(double eyeX, double eyeY, double eyeZ,
double centerX, double centerY, double centerZ,
double upX, double upY, double upZ, Matrix4x3d dest) {
if ((properties & PROPERTY_IDENTITY) != 0)
return dest.setLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
return lookAtGeneric(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ, dest);
} | [
"public",
"Matrix4x3d",
"lookAt",
"(",
"double",
"eyeX",
",",
"double",
"eyeY",
",",
"double",
"eyeZ",
",",
"double",
"centerX",
",",
"double",
"centerY",
",",
"double",
"centerZ",
",",
"double",
"upX",
",",
"double",
"upY",
",",
"double",
"upZ",
",",
"M... | Apply a "lookat" transformation to this matrix for a right-handed coordinate system,
that aligns <code>-z</code> with <code>center - eye</code> and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookat matrix,
then the new matrix will be <code>M * L</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * L * v</code>,
the lookat transformation will be applied first!
<p>
In order to set the matrix to a lookat transformation without post-multiplying it,
use {@link #setLookAt(double, double, double, double, double, double, double, double, double) setLookAt()}.
@see #lookAt(Vector3dc, Vector3dc, Vector3dc)
@see #setLookAt(double, double, double, double, double, double, double, double, double)
@param eyeX
the x-coordinate of the eye/camera location
@param eyeY
the y-coordinate of the eye/camera location
@param eyeZ
the z-coordinate of the eye/camera location
@param centerX
the x-coordinate of the point to look at
@param centerY
the y-coordinate of the point to look at
@param centerZ
the z-coordinate of the point to look at
@param upX
the x-coordinate of the up vector
@param upY
the y-coordinate of the up vector
@param upZ
the z-coordinate of the up vector
@param dest
will hold the result
@return dest | [
"Apply",
"a",
"lookat",
"transformation",
"to",
"this",
"matrix",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"that",
"aligns",
"<code",
">",
"-",
"z<",
"/",
"code",
">",
"with",
"<code",
">",
"center",
"-",
"eye<",
"/",
"code",
">",
"a... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L8250-L8256 |
raydac/netbeans-mmd-plugin | mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/utils/Utils.java | Utils.rescaleImageAndEncodeAsBase64 | @Nonnull
public static String rescaleImageAndEncodeAsBase64(@Nonnull Image image, final int maxSize) throws IOException {
final int width = image.getWidth(null);
final int height = image.getHeight(null);
final int maxImageSideSize = maxSize > 0 ? maxSize : Math.max(width, height);
final float imageScale = width > maxImageSideSize || height > maxImageSideSize ? (float) maxImageSideSize / (float) Math.max(width, height) : 1.0f;
if (!(image instanceof RenderedImage) || Float.compare(imageScale, 1.0f) != 0) {
final int swidth;
final int sheight;
if (Float.compare(imageScale, 1.0f) == 0) {
swidth = width;
sheight = height;
} else {
swidth = Math.round(imageScale * width);
sheight = Math.round(imageScale * height);
}
final BufferedImage buffer = new BufferedImage(swidth, sheight, BufferedImage.TYPE_INT_ARGB);
final Graphics2D gfx = (Graphics2D) buffer.createGraphics();
gfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
gfx.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
gfx.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
gfx.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
gfx.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
gfx.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
gfx.drawImage(image, AffineTransform.getScaleInstance(imageScale, imageScale), null);
gfx.dispose();
image = buffer;
}
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
if (!ImageIO.write((RenderedImage) image, "png", bos)) {
throw new IOException("Can't encode image as PNG");
}
} finally {
IOUtils.closeQuietly(bos);
}
return Utils.base64encode(bos.toByteArray());
} | java | @Nonnull
public static String rescaleImageAndEncodeAsBase64(@Nonnull Image image, final int maxSize) throws IOException {
final int width = image.getWidth(null);
final int height = image.getHeight(null);
final int maxImageSideSize = maxSize > 0 ? maxSize : Math.max(width, height);
final float imageScale = width > maxImageSideSize || height > maxImageSideSize ? (float) maxImageSideSize / (float) Math.max(width, height) : 1.0f;
if (!(image instanceof RenderedImage) || Float.compare(imageScale, 1.0f) != 0) {
final int swidth;
final int sheight;
if (Float.compare(imageScale, 1.0f) == 0) {
swidth = width;
sheight = height;
} else {
swidth = Math.round(imageScale * width);
sheight = Math.round(imageScale * height);
}
final BufferedImage buffer = new BufferedImage(swidth, sheight, BufferedImage.TYPE_INT_ARGB);
final Graphics2D gfx = (Graphics2D) buffer.createGraphics();
gfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
gfx.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
gfx.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
gfx.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
gfx.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
gfx.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
gfx.drawImage(image, AffineTransform.getScaleInstance(imageScale, imageScale), null);
gfx.dispose();
image = buffer;
}
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
if (!ImageIO.write((RenderedImage) image, "png", bos)) {
throw new IOException("Can't encode image as PNG");
}
} finally {
IOUtils.closeQuietly(bos);
}
return Utils.base64encode(bos.toByteArray());
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"rescaleImageAndEncodeAsBase64",
"(",
"@",
"Nonnull",
"Image",
"image",
",",
"final",
"int",
"maxSize",
")",
"throws",
"IOException",
"{",
"final",
"int",
"width",
"=",
"image",
".",
"getWidth",
"(",
"null",
")",
... | Rescale image and encode into Base64.
@param image image to rescale and encode
@param maxSize max size of image, if less or zero then don't rescale
@return scaled and encoded image
@throws IOException if it was impossible to encode image
@since 1.4.0 | [
"Rescale",
"image",
"and",
"encode",
"into",
"Base64",
"."
] | train | https://github.com/raydac/netbeans-mmd-plugin/blob/997493d23556a25354372b6419a64a0fbd0ac6ba/mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/utils/Utils.java#L333-L378 |
jbundle/jbundle | thin/base/message/src/main/java/org/jbundle/thin/base/message/MessageReceiverFilterList.java | MessageReceiverFilterList.setNewFilterTree | public void setNewFilterTree(BaseMessageFilter messageFilter, Object[][] mxProperties)
{
if (mxProperties != null)
messageFilter.setNameValueTree(mxProperties); // Update the new properties.
} | java | public void setNewFilterTree(BaseMessageFilter messageFilter, Object[][] mxProperties)
{
if (mxProperties != null)
messageFilter.setNameValueTree(mxProperties); // Update the new properties.
} | [
"public",
"void",
"setNewFilterTree",
"(",
"BaseMessageFilter",
"messageFilter",
",",
"Object",
"[",
"]",
"[",
"]",
"mxProperties",
")",
"{",
"if",
"(",
"mxProperties",
"!=",
"null",
")",
"messageFilter",
".",
"setNameValueTree",
"(",
"mxProperties",
")",
";",
... | Update this filter with this new information.
@param messageFilter The message filter I am updating.
@param propKeys New tree key filter information (ie, bookmark=345). | [
"Update",
"this",
"filter",
"with",
"this",
"new",
"information",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/MessageReceiverFilterList.java#L176-L180 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/geom/Curve.java | Curve.pointAt | public Vector2f pointAt(float t) {
float a = 1 - t;
float b = t;
float f1 = a * a * a;
float f2 = 3 * a * a * b;
float f3 = 3 * a * b * b;
float f4 = b * b * b;
float nx = (p1.x * f1) + (c1.x * f2) + (c2.x * f3) + (p2.x * f4);
float ny = (p1.y * f1) + (c1.y * f2) + (c2.y * f3) + (p2.y * f4);
return new Vector2f(nx,ny);
} | java | public Vector2f pointAt(float t) {
float a = 1 - t;
float b = t;
float f1 = a * a * a;
float f2 = 3 * a * a * b;
float f3 = 3 * a * b * b;
float f4 = b * b * b;
float nx = (p1.x * f1) + (c1.x * f2) + (c2.x * f3) + (p2.x * f4);
float ny = (p1.y * f1) + (c1.y * f2) + (c2.y * f3) + (p2.y * f4);
return new Vector2f(nx,ny);
} | [
"public",
"Vector2f",
"pointAt",
"(",
"float",
"t",
")",
"{",
"float",
"a",
"=",
"1",
"-",
"t",
";",
"float",
"b",
"=",
"t",
";",
"float",
"f1",
"=",
"a",
"*",
"a",
"*",
"a",
";",
"float",
"f2",
"=",
"3",
"*",
"a",
"*",
"a",
"*",
"b",
";"... | Get the point at a particular location on the curve
@param t A value between 0 and 1 defining the location of the curve the point is at
@return The point on the curve | [
"Get",
"the",
"point",
"at",
"a",
"particular",
"location",
"on",
"the",
"curve"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Curve.java#L59-L72 |
phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/GrammarDirectoryScanner.java | GrammarDirectoryScanner.getTargetFiles | protected File [] getTargetFiles (final File targetDirectory, final String grammarFile, final GrammarInfo grammarInfo)
{
final File parserFile = new File (targetDirectory, grammarInfo.getParserFile ());
return new File [] { parserFile };
} | java | protected File [] getTargetFiles (final File targetDirectory, final String grammarFile, final GrammarInfo grammarInfo)
{
final File parserFile = new File (targetDirectory, grammarInfo.getParserFile ());
return new File [] { parserFile };
} | [
"protected",
"File",
"[",
"]",
"getTargetFiles",
"(",
"final",
"File",
"targetDirectory",
",",
"final",
"String",
"grammarFile",
",",
"final",
"GrammarInfo",
"grammarInfo",
")",
"{",
"final",
"File",
"parserFile",
"=",
"new",
"File",
"(",
"targetDirectory",
",",... | Determines the output files corresponding to the specified grammar file.
@param targetDirectory
The absolute path to the output directory for the target files, must
not be <code>null</code>.
@param grammarFile
The path to the grammar file, relative to the scanned source
directory, must not be <code>null</code>.
@param grammarInfo
The grammar info describing the grammar file, must not be
<code>null</code>
@return A file array with target files, never <code>null</code>. | [
"Determines",
"the",
"output",
"files",
"corresponding",
"to",
"the",
"specified",
"grammar",
"file",
"."
] | train | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/GrammarDirectoryScanner.java#L220-L224 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Graphics.java | Graphics.drawLine | public void drawLine(float x1, float y1, float x2, float y2) {
float lineWidth = this.lineWidth - 1;
if (LSR.applyGLLineFixes()) {
if (x1 == x2) {
if (y1 > y2) {
float temp = y2;
y2 = y1;
y1 = temp;
}
float step = 1 / sy;
lineWidth = lineWidth / sy;
fillRect(x1-(lineWidth/2.0f),y1-(lineWidth/2.0f),lineWidth+step,(y2-y1)+lineWidth+step);
return;
} else if (y1 == y2) {
if (x1 > x2) {
float temp = x2;
x2 = x1;
x1 = temp;
}
float step = 1 / sx;
lineWidth = lineWidth / sx;
fillRect(x1-(lineWidth/2.0f),y1-(lineWidth/2.0f),(x2-x1)+lineWidth+step,lineWidth+step);
return;
}
}
predraw();
currentColor.bind();
TextureImpl.bindNone();
LSR.start();
LSR.vertex(x1,y1);
LSR.vertex(x2,y2);
LSR.end();
postdraw();
} | java | public void drawLine(float x1, float y1, float x2, float y2) {
float lineWidth = this.lineWidth - 1;
if (LSR.applyGLLineFixes()) {
if (x1 == x2) {
if (y1 > y2) {
float temp = y2;
y2 = y1;
y1 = temp;
}
float step = 1 / sy;
lineWidth = lineWidth / sy;
fillRect(x1-(lineWidth/2.0f),y1-(lineWidth/2.0f),lineWidth+step,(y2-y1)+lineWidth+step);
return;
} else if (y1 == y2) {
if (x1 > x2) {
float temp = x2;
x2 = x1;
x1 = temp;
}
float step = 1 / sx;
lineWidth = lineWidth / sx;
fillRect(x1-(lineWidth/2.0f),y1-(lineWidth/2.0f),(x2-x1)+lineWidth+step,lineWidth+step);
return;
}
}
predraw();
currentColor.bind();
TextureImpl.bindNone();
LSR.start();
LSR.vertex(x1,y1);
LSR.vertex(x2,y2);
LSR.end();
postdraw();
} | [
"public",
"void",
"drawLine",
"(",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
")",
"{",
"float",
"lineWidth",
"=",
"this",
".",
"lineWidth",
"-",
"1",
";",
"if",
"(",
"LSR",
".",
"applyGLLineFixes",
"(",
")",
")",
"{... | Draw a line on the canvas in the current colour
@param x1
The x coordinate of the start point
@param y1
The y coordinate of the start point
@param x2
The x coordinate of the end point
@param y2
The y coordinate of the end point | [
"Draw",
"a",
"line",
"on",
"the",
"canvas",
"in",
"the",
"current",
"colour"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L452-L489 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br/br_adduser.java | br_adduser.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_adduser_responses result = (br_adduser_responses) service.get_payload_formatter().string_to_resource(br_adduser_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_adduser_response_array);
}
br_adduser[] result_br_adduser = new br_adduser[result.br_adduser_response_array.length];
for(int i = 0; i < result.br_adduser_response_array.length; i++)
{
result_br_adduser[i] = result.br_adduser_response_array[i].br_adduser[0];
}
return result_br_adduser;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_adduser_responses result = (br_adduser_responses) service.get_payload_formatter().string_to_resource(br_adduser_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_adduser_response_array);
}
br_adduser[] result_br_adduser = new br_adduser[result.br_adduser_response_array.length];
for(int i = 0; i < result.br_adduser_response_array.length; i++)
{
result_br_adduser[i] = result.br_adduser_response_array[i].br_adduser[0];
}
return result_br_adduser;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"br_adduser_responses",
"result",
"=",
"(",
"br_adduser_responses",
")",
"service",
".",
"get_payload_formatte... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_adduser.java#L199-L216 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/CrateDigger.java | CrateDigger.deliverDatabaseUpdate | private void deliverDatabaseUpdate(SlotReference slot, Database database, boolean available) {
for (final DatabaseListener listener : getDatabaseListeners()) {
try {
if (available) {
listener.databaseMounted(slot, database);
} else {
listener.databaseUnmounted(slot, database);
}
} catch (Throwable t) {
logger.warn("Problem delivering rekordbox database availability update to listener", t);
}
}
} | java | private void deliverDatabaseUpdate(SlotReference slot, Database database, boolean available) {
for (final DatabaseListener listener : getDatabaseListeners()) {
try {
if (available) {
listener.databaseMounted(slot, database);
} else {
listener.databaseUnmounted(slot, database);
}
} catch (Throwable t) {
logger.warn("Problem delivering rekordbox database availability update to listener", t);
}
}
} | [
"private",
"void",
"deliverDatabaseUpdate",
"(",
"SlotReference",
"slot",
",",
"Database",
"database",
",",
"boolean",
"available",
")",
"{",
"for",
"(",
"final",
"DatabaseListener",
"listener",
":",
"getDatabaseListeners",
"(",
")",
")",
"{",
"try",
"{",
"if",
... | Send a database announcement to all registered listeners.
@param slot the media slot whose database availability has changed
@param database the database whose relevance has changed
@param available if {@code} true, the database is newly available, otherwise it is no longer relevant | [
"Send",
"a",
"database",
"announcement",
"to",
"all",
"registered",
"listeners",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/CrateDigger.java#L726-L738 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/vod/VodClient.java | VodClient.generateMediaDeliveryInfo | public GenerateMediaDeliveryInfoResponse generateMediaDeliveryInfo(GenerateMediaDeliveryInfoRequest request) {
checkStringNotEmpty(request.getMediaId(), "Media ID should not be null or empty!");
InternalRequest internalRequest =
createRequest(HttpMethodName.GET, request, PATH_MEDIA, request.getMediaId(), PARA_GENDELIVERY);
internalRequest.addParameter(PARAM_TRANSCODING_PRESET_NAME, request.getTranscodingPresetName());
return invokeHttpClient(internalRequest, GenerateMediaDeliveryInfoResponse.class);
} | java | public GenerateMediaDeliveryInfoResponse generateMediaDeliveryInfo(GenerateMediaDeliveryInfoRequest request) {
checkStringNotEmpty(request.getMediaId(), "Media ID should not be null or empty!");
InternalRequest internalRequest =
createRequest(HttpMethodName.GET, request, PATH_MEDIA, request.getMediaId(), PARA_GENDELIVERY);
internalRequest.addParameter(PARAM_TRANSCODING_PRESET_NAME, request.getTranscodingPresetName());
return invokeHttpClient(internalRequest, GenerateMediaDeliveryInfoResponse.class);
} | [
"public",
"GenerateMediaDeliveryInfoResponse",
"generateMediaDeliveryInfo",
"(",
"GenerateMediaDeliveryInfoRequest",
"request",
")",
"{",
"checkStringNotEmpty",
"(",
"request",
".",
"getMediaId",
"(",
")",
",",
"\"Media ID should not be null or empty!\"",
")",
";",
"InternalReq... | Delete the specific media resource managed by VOD service.
<p>
The caller <i>must</i> authenticate with a valid BCE Access Key / Private Key pair.
@param request The request object containing all the options on how to
@return empty response will be returned | [
"Delete",
"the",
"specific",
"media",
"resource",
"managed",
"by",
"VOD",
"service",
".",
"<p",
">",
"The",
"caller",
"<i",
">",
"must<",
"/",
"i",
">",
"authenticate",
"with",
"a",
"valid",
"BCE",
"Access",
"Key",
"/",
"Private",
"Key",
"pair",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L770-L776 |
deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/writable/BytesWritable.java | BytesWritable.asNd4jBuffer | public DataBuffer asNd4jBuffer(DataType type, int elementSize) {
int length = content.length / elementSize;
DataBuffer ret = Nd4j.createBuffer(ByteBuffer.allocateDirect(content.length),type,length,0);
for(int i = 0; i < length; i++) {
switch(type) {
case DOUBLE:
ret.put(i,getDouble(i));
break;
case INT:
ret.put(i,getInt(i));
break;
case FLOAT:
ret.put(i,getFloat(i));
break;
case LONG:
ret.put(i,getLong(i));
break;
}
}
return ret;
} | java | public DataBuffer asNd4jBuffer(DataType type, int elementSize) {
int length = content.length / elementSize;
DataBuffer ret = Nd4j.createBuffer(ByteBuffer.allocateDirect(content.length),type,length,0);
for(int i = 0; i < length; i++) {
switch(type) {
case DOUBLE:
ret.put(i,getDouble(i));
break;
case INT:
ret.put(i,getInt(i));
break;
case FLOAT:
ret.put(i,getFloat(i));
break;
case LONG:
ret.put(i,getLong(i));
break;
}
}
return ret;
} | [
"public",
"DataBuffer",
"asNd4jBuffer",
"(",
"DataType",
"type",
",",
"int",
"elementSize",
")",
"{",
"int",
"length",
"=",
"content",
".",
"length",
"/",
"elementSize",
";",
"DataBuffer",
"ret",
"=",
"Nd4j",
".",
"createBuffer",
"(",
"ByteBuffer",
".",
"all... | Convert the underlying contents of this {@link Writable}
to an nd4j {@link DataBuffer}. Note that this is a *copy*
of the underlying buffer.
Also note that {@link java.nio.ByteBuffer#allocateDirect(int)}
is used for allocation.
This should be considered an expensive operation.
This buffer should be cached when used. Once used, this can be
used in standard Nd4j operations.
Beyond that, the reason we have to use allocateDirect
is due to nd4j data buffers being stored off heap (whether on cpu or gpu)
@param type the type of the data buffer
@param elementSize the size of each element in the buffer
@return the equivalent nd4j data buffer | [
"Convert",
"the",
"underlying",
"contents",
"of",
"this",
"{",
"@link",
"Writable",
"}",
"to",
"an",
"nd4j",
"{",
"@link",
"DataBuffer",
"}",
".",
"Note",
"that",
"this",
"is",
"a",
"*",
"copy",
"*",
"of",
"the",
"underlying",
"buffer",
".",
"Also",
"n... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/writable/BytesWritable.java#L85-L105 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/RedisChannelHandler.java | RedisChannelHandler.registerCloseables | public void registerCloseables(final Collection<Closeable> registry, Closeable... closeables) {
registry.addAll(Arrays.asList(closeables));
addListener(resource -> {
for (Closeable closeable : closeables) {
if (closeable == RedisChannelHandler.this) {
continue;
}
try {
if (closeable instanceof AsyncCloseable) {
((AsyncCloseable) closeable).closeAsync();
} else {
closeable.close();
}
} catch (IOException e) {
if (debugEnabled) {
logger.debug(e.toString(), e);
}
}
}
registry.removeAll(Arrays.asList(closeables));
});
} | java | public void registerCloseables(final Collection<Closeable> registry, Closeable... closeables) {
registry.addAll(Arrays.asList(closeables));
addListener(resource -> {
for (Closeable closeable : closeables) {
if (closeable == RedisChannelHandler.this) {
continue;
}
try {
if (closeable instanceof AsyncCloseable) {
((AsyncCloseable) closeable).closeAsync();
} else {
closeable.close();
}
} catch (IOException e) {
if (debugEnabled) {
logger.debug(e.toString(), e);
}
}
}
registry.removeAll(Arrays.asList(closeables));
});
} | [
"public",
"void",
"registerCloseables",
"(",
"final",
"Collection",
"<",
"Closeable",
">",
"registry",
",",
"Closeable",
"...",
"closeables",
")",
"{",
"registry",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"closeables",
")",
")",
";",
"addListener",
... | Register Closeable resources. Internal access only.
@param registry registry of closeables
@param closeables closeables to register | [
"Register",
"Closeable",
"resources",
".",
"Internal",
"access",
"only",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/RedisChannelHandler.java#L225-L250 |
elki-project/elki | elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/query/RStarTreeKNNQuery.java | RStarTreeKNNQuery.getSortedEntries | protected List<DoubleDistanceEntry> getSortedEntries(AbstractRStarTreeNode<?, ?> node, DBIDs ids) {
List<DoubleDistanceEntry> result = new ArrayList<>();
for(int i = 0; i < node.getNumEntries(); i++) {
SpatialEntry entry = node.getEntry(i);
double minMinDist = Double.MAX_VALUE;
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
double minDist = distanceFunction.minDist(entry, relation.get(iter));
tree.statistics.countDistanceCalculation();
minMinDist = Math.min(minDist, minMinDist);
}
result.add(new DoubleDistanceEntry(entry, minMinDist));
}
Collections.sort(result);
return result;
} | java | protected List<DoubleDistanceEntry> getSortedEntries(AbstractRStarTreeNode<?, ?> node, DBIDs ids) {
List<DoubleDistanceEntry> result = new ArrayList<>();
for(int i = 0; i < node.getNumEntries(); i++) {
SpatialEntry entry = node.getEntry(i);
double minMinDist = Double.MAX_VALUE;
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
double minDist = distanceFunction.minDist(entry, relation.get(iter));
tree.statistics.countDistanceCalculation();
minMinDist = Math.min(minDist, minMinDist);
}
result.add(new DoubleDistanceEntry(entry, minMinDist));
}
Collections.sort(result);
return result;
} | [
"protected",
"List",
"<",
"DoubleDistanceEntry",
">",
"getSortedEntries",
"(",
"AbstractRStarTreeNode",
"<",
"?",
",",
"?",
">",
"node",
",",
"DBIDs",
"ids",
")",
"{",
"List",
"<",
"DoubleDistanceEntry",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")"... | Sorts the entries of the specified node according to their minimum distance
to the specified objects.
@param node the node
@param ids the id of the objects
@return a list of the sorted entries | [
"Sorts",
"the",
"entries",
"of",
"the",
"specified",
"node",
"according",
"to",
"their",
"minimum",
"distance",
"to",
"the",
"specified",
"objects",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/query/RStarTreeKNNQuery.java#L214-L230 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/databases/information/TableInformation.java | TableInformation.addForeignKey | public void addForeignKey(final String _fkName,
final String _colName,
final String _refTableName,
final String _refColName,
final boolean _cascade)
{
this.fkMap.put(_fkName.toUpperCase(),
new ForeignKeyInformation(_fkName, _colName, _refTableName, _refColName, _cascade));
} | java | public void addForeignKey(final String _fkName,
final String _colName,
final String _refTableName,
final String _refColName,
final boolean _cascade)
{
this.fkMap.put(_fkName.toUpperCase(),
new ForeignKeyInformation(_fkName, _colName, _refTableName, _refColName, _cascade));
} | [
"public",
"void",
"addForeignKey",
"(",
"final",
"String",
"_fkName",
",",
"final",
"String",
"_colName",
",",
"final",
"String",
"_refTableName",
",",
"final",
"String",
"_refColName",
",",
"final",
"boolean",
"_cascade",
")",
"{",
"this",
".",
"fkMap",
".",
... | Fetches all foreign keys for this table.
@param _fkName name of foreign key
@param _colName name of column name
@param _refTableName name of referenced SQL table
@param _refColName name of column within referenced SQL table
@param _cascade delete cascade activated
@see #fkMap | [
"Fetches",
"all",
"foreign",
"keys",
"for",
"this",
"table",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/databases/information/TableInformation.java#L156-L164 |
Alluxio/alluxio | integration/checker/src/main/java/alluxio/checker/SparkIntegrationChecker.java | SparkIntegrationChecker.printConfigInfo | private void printConfigInfo(SparkConf conf, PrintWriter reportWriter) {
// Get Spark configurations
if (conf.contains("spark.master")) {
reportWriter.printf("Spark master is: %s.%n%n", conf.get("spark.master"));
}
if (conf.contains("spark.submit.deployMode")) {
reportWriter.printf("spark-submit deploy mode is: %s.%n%n",
conf.get("spark.submit.deployMode"));
}
if (conf.contains("spark.driver.extraClassPath")) {
reportWriter.printf("spark.driver.extraClassPath includes jar paths: %s.%n%n",
conf.get("spark.driver.extraClassPath"));
}
if (conf.contains("spark.executor.extraClassPath")) {
reportWriter.printf("spark.executor.extraClassPath includes jar paths: %s.%n%n",
conf.get("spark.executor.extraClassPath"));
}
} | java | private void printConfigInfo(SparkConf conf, PrintWriter reportWriter) {
// Get Spark configurations
if (conf.contains("spark.master")) {
reportWriter.printf("Spark master is: %s.%n%n", conf.get("spark.master"));
}
if (conf.contains("spark.submit.deployMode")) {
reportWriter.printf("spark-submit deploy mode is: %s.%n%n",
conf.get("spark.submit.deployMode"));
}
if (conf.contains("spark.driver.extraClassPath")) {
reportWriter.printf("spark.driver.extraClassPath includes jar paths: %s.%n%n",
conf.get("spark.driver.extraClassPath"));
}
if (conf.contains("spark.executor.extraClassPath")) {
reportWriter.printf("spark.executor.extraClassPath includes jar paths: %s.%n%n",
conf.get("spark.executor.extraClassPath"));
}
} | [
"private",
"void",
"printConfigInfo",
"(",
"SparkConf",
"conf",
",",
"PrintWriter",
"reportWriter",
")",
"{",
"// Get Spark configurations",
"if",
"(",
"conf",
".",
"contains",
"(",
"\"spark.master\"",
")",
")",
"{",
"reportWriter",
".",
"printf",
"(",
"\"Spark ma... | Saves related Spark and Alluxio configuration information.
@param conf the current SparkConf
@param reportWriter save user-facing messages to a generated file | [
"Saves",
"related",
"Spark",
"and",
"Alluxio",
"configuration",
"information",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/integration/checker/src/main/java/alluxio/checker/SparkIntegrationChecker.java#L144-L161 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSameIndividualAxiomImpl_CustomFieldSerializer.java | OWLSameIndividualAxiomImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLSameIndividualAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLSameIndividualAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLSameIndividualAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
] | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSameIndividualAxiomImpl_CustomFieldSerializer.java#L74-L77 |
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsAdditionalInfosDialog.java | CmsAdditionalInfosDialog.addAddInfoLayout | private void addAddInfoLayout(String key, Object value, boolean editable) {
HorizontalLayout res = addInfoLayout(key, value, editable);
if (editable) {
m_userinfoGroup.addRow(res);
} else {
m_userinfoNoEditGroup.addRow(res);
}
} | java | private void addAddInfoLayout(String key, Object value, boolean editable) {
HorizontalLayout res = addInfoLayout(key, value, editable);
if (editable) {
m_userinfoGroup.addRow(res);
} else {
m_userinfoNoEditGroup.addRow(res);
}
} | [
"private",
"void",
"addAddInfoLayout",
"(",
"String",
"key",
",",
"Object",
"value",
",",
"boolean",
"editable",
")",
"{",
"HorizontalLayout",
"res",
"=",
"addInfoLayout",
"(",
"key",
",",
"value",
",",
"editable",
")",
";",
"if",
"(",
"editable",
")",
"{"... | Add key value pair as component to ui.<p>
@param key string
@param value object
@param editable boolean | [
"Add",
"key",
"value",
"pair",
"as",
"component",
"to",
"ui",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsAdditionalInfosDialog.java#L251-L259 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.writeLines | public static <T> File writeLines(Collection<T> list, File file, String charset, boolean isAppend) throws IORuntimeException {
return FileWriter.create(file, CharsetUtil.charset(charset)).writeLines(list, isAppend);
} | java | public static <T> File writeLines(Collection<T> list, File file, String charset, boolean isAppend) throws IORuntimeException {
return FileWriter.create(file, CharsetUtil.charset(charset)).writeLines(list, isAppend);
} | [
"public",
"static",
"<",
"T",
">",
"File",
"writeLines",
"(",
"Collection",
"<",
"T",
">",
"list",
",",
"File",
"file",
",",
"String",
"charset",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileWriter",
".",
"create",
"... | 将列表写入文件
@param <T> 集合元素类型
@param list 列表
@param file 文件
@param charset 字符集
@param isAppend 是否追加
@return 目标文件
@throws IORuntimeException IO异常 | [
"将列表写入文件"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3056-L3058 |
lexs/webimageloader | webimageloader/src/main/java/com/webimageloader/util/HeaderParser.java | HeaderParser.skipWhitespace | private static int skipWhitespace(String input, int pos) {
for (; pos < input.length(); pos++) {
char c = input.charAt(pos);
if (c != ' ' && c != '\t') {
break;
}
}
return pos;
} | java | private static int skipWhitespace(String input, int pos) {
for (; pos < input.length(); pos++) {
char c = input.charAt(pos);
if (c != ' ' && c != '\t') {
break;
}
}
return pos;
} | [
"private",
"static",
"int",
"skipWhitespace",
"(",
"String",
"input",
",",
"int",
"pos",
")",
"{",
"for",
"(",
";",
"pos",
"<",
"input",
".",
"length",
"(",
")",
";",
"pos",
"++",
")",
"{",
"char",
"c",
"=",
"input",
".",
"charAt",
"(",
"pos",
")... | Returns the next non-whitespace character in {@code input} that is white
space. Result is undefined if input contains newline characters. | [
"Returns",
"the",
"next",
"non",
"-",
"whitespace",
"character",
"in",
"{"
] | train | https://github.com/lexs/webimageloader/blob/b29bac036a3855e2f0adf95d3391ee4bbc14457c/webimageloader/src/main/java/com/webimageloader/util/HeaderParser.java#L56-L64 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/WidgetUtil.java | WidgetUtil.createFlashContainer | public static HTML createFlashContainer (
String ident, String movie, int width, int height, String flashVars)
{
return createContainer(new FlashObject(ident, movie, width, height, flashVars));
} | java | public static HTML createFlashContainer (
String ident, String movie, int width, int height, String flashVars)
{
return createContainer(new FlashObject(ident, movie, width, height, flashVars));
} | [
"public",
"static",
"HTML",
"createFlashContainer",
"(",
"String",
"ident",
",",
"String",
"movie",
",",
"int",
"width",
",",
"int",
"height",
",",
"String",
"flashVars",
")",
"{",
"return",
"createContainer",
"(",
"new",
"FlashObject",
"(",
"ident",
",",
"m... | Creates the HTML to display a Flash movie for the browser on which we're running.
@param flashVars a pre-URLEncoded string containing flash variables, or null.
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16417 | [
"Creates",
"the",
"HTML",
"to",
"display",
"a",
"Flash",
"movie",
"for",
"the",
"browser",
"on",
"which",
"we",
"re",
"running",
"."
] | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/WidgetUtil.java#L141-L145 |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.addLink | public void addLink( final String path, final String target, int permissions, String username, String groupname) throws NoSuchAlgorithmException, IOException {
contents.addLink( path, target, permissions, username, groupname);
} | java | public void addLink( final String path, final String target, int permissions, String username, String groupname) throws NoSuchAlgorithmException, IOException {
contents.addLink( path, target, permissions, username, groupname);
} | [
"public",
"void",
"addLink",
"(",
"final",
"String",
"path",
",",
"final",
"String",
"target",
",",
"int",
"permissions",
",",
"String",
"username",
",",
"String",
"groupname",
")",
"throws",
"NoSuchAlgorithmException",
",",
"IOException",
"{",
"contents",
".",
... | Adds a symbolic link to the repository.
@param path the absolute path at which this link will be installed.
@param target the path of the file this link will point to.
@param permissions the permissions flags
@param username user owner of the link
@param groupname group owner of the link
@throws NoSuchAlgorithmException the algorithm isn't supported
@throws IOException there was an IO error | [
"Adds",
"a",
"symbolic",
"link",
"to",
"the",
"repository",
"."
] | train | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L1162-L1164 |
beangle/beangle3 | ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java | BeanDefinitionParser.parseKeyElement | protected Object parseKeyElement(Element keyEle, BeanDefinition bd, String defaultKeyTypeName) {
NodeList nl = keyEle.getChildNodes();
Element subElement = null;
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element) {
// Child element is what we're looking for.
if (subElement != null)
error("<key> element must not contain more than one value sub-element", keyEle);
else subElement = (Element) node;
}
}
return parsePropertySubElement(subElement, bd, defaultKeyTypeName);
} | java | protected Object parseKeyElement(Element keyEle, BeanDefinition bd, String defaultKeyTypeName) {
NodeList nl = keyEle.getChildNodes();
Element subElement = null;
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element) {
// Child element is what we're looking for.
if (subElement != null)
error("<key> element must not contain more than one value sub-element", keyEle);
else subElement = (Element) node;
}
}
return parsePropertySubElement(subElement, bd, defaultKeyTypeName);
} | [
"protected",
"Object",
"parseKeyElement",
"(",
"Element",
"keyEle",
",",
"BeanDefinition",
"bd",
",",
"String",
"defaultKeyTypeName",
")",
"{",
"NodeList",
"nl",
"=",
"keyEle",
".",
"getChildNodes",
"(",
")",
";",
"Element",
"subElement",
"=",
"null",
";",
"fo... | Parse a key sub-element of a map element.
@param keyEle a {@link org.w3c.dom.Element} object.
@param bd a {@link org.springframework.beans.factory.config.BeanDefinition} object.
@param defaultKeyTypeName a {@link java.lang.String} object.
@return a {@link java.lang.Object} object. | [
"Parse",
"a",
"key",
"sub",
"-",
"element",
"of",
"a",
"map",
"element",
"."
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java#L990-L1003 |
jglobus/JGlobus | ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java | BouncyCastleCertProcessingFactory.createCertificate | public X509Certificate createCertificate(InputStream certRequestInputStream, X509Certificate cert,
PrivateKey privateKey, int lifetime, GSIConstants.CertificateType certType, X509ExtensionSet extSet,
String cnValue) throws IOException, GeneralSecurityException {
ASN1InputStream derin = new ASN1InputStream(certRequestInputStream);
ASN1Primitive reqInfo = derin.readObject();
PKCS10CertificationRequest certReq = new PKCS10CertificationRequest((ASN1Sequence) reqInfo);
boolean rs = certReq.verify();
if (!rs) {
String err = i18n.getMessage("certReqVerification");
throw new GeneralSecurityException(err);
}
return createProxyCertificate(cert, privateKey, certReq.getPublicKey(), lifetime, certType, extSet, cnValue);
} | java | public X509Certificate createCertificate(InputStream certRequestInputStream, X509Certificate cert,
PrivateKey privateKey, int lifetime, GSIConstants.CertificateType certType, X509ExtensionSet extSet,
String cnValue) throws IOException, GeneralSecurityException {
ASN1InputStream derin = new ASN1InputStream(certRequestInputStream);
ASN1Primitive reqInfo = derin.readObject();
PKCS10CertificationRequest certReq = new PKCS10CertificationRequest((ASN1Sequence) reqInfo);
boolean rs = certReq.verify();
if (!rs) {
String err = i18n.getMessage("certReqVerification");
throw new GeneralSecurityException(err);
}
return createProxyCertificate(cert, privateKey, certReq.getPublicKey(), lifetime, certType, extSet, cnValue);
} | [
"public",
"X509Certificate",
"createCertificate",
"(",
"InputStream",
"certRequestInputStream",
",",
"X509Certificate",
"cert",
",",
"PrivateKey",
"privateKey",
",",
"int",
"lifetime",
",",
"GSIConstants",
".",
"CertificateType",
"certType",
",",
"X509ExtensionSet",
"extS... | Creates a proxy certificate from the certificate request. (Signs a certificate request creating a new
certificate)
@see #createProxyCertificate(X509Certificate, PrivateKey, PublicKey, int, int, X509ExtensionSet,
String) createProxyCertificate
@param certRequestInputStream
the input stream to read the certificate request from.
@param cert
the issuer certificate
@param privateKey
the private key to sign the new certificate with.
@param lifetime
lifetime of the new certificate in seconds. If 0 (or less then) the new certificate will
have the same lifetime as the issuing certificate.
@param certType
the type of proxy credential to create
@param extSet
a set of X.509 extensions to be included in the new proxy certificate. Can be null. If
delegation mode is {@link org.globus.gsi.GSIConstants.CertificateType#GSI_3_RESTRICTED_PROXY
GSIConstants.CertificateType.GSI_3_RESTRICTED_PROXY} or {@link org.globus.gsi.GSIConstants.CertificateType#GSI_4_RESTRICTED_PROXY
GSIConstants.CertificateType.GSI_4_RESTRICTED_PROXY} then
{@link org.globus.gsi.proxy.ext.ProxyCertInfoExtension ProxyCertInfoExtension} must be
present in the extension set.
@param cnValue
the value of the CN component of the subject of the new certificate. If null, the defaults
will be used depending on the proxy certificate type created.
@return <code>X509Certificate</code> the new proxy certificate
@exception IOException
if error reading the certificate request
@exception GeneralSecurityException
if a security error occurs. | [
"Creates",
"a",
"proxy",
"certificate",
"from",
"the",
"certificate",
"request",
".",
"(",
"Signs",
"a",
"certificate",
"request",
"creating",
"a",
"new",
"certificate",
")"
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java#L571-L587 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/listeners/AddResourcesListener.java | AddResourcesListener.addResourceToHeadButAfterJQuery | public static void addResourceToHeadButAfterJQuery(String library, String resource) {
addResource(resource, library, library + "#" + resource, RESOURCE_KEY);
} | java | public static void addResourceToHeadButAfterJQuery(String library, String resource) {
addResource(resource, library, library + "#" + resource, RESOURCE_KEY);
} | [
"public",
"static",
"void",
"addResourceToHeadButAfterJQuery",
"(",
"String",
"library",
",",
"String",
"resource",
")",
"{",
"addResource",
"(",
"resource",
",",
"library",
",",
"library",
"+",
"\"#\"",
"+",
"resource",
",",
"RESOURCE_KEY",
")",
";",
"}"
] | Registers a JS file that needs to be included in the header of the HTML file,
but after jQuery and AngularJS.
@param library The name of the sub-folder of the resources folder.
@param resource The name of the resource file within the library folder. | [
"Registers",
"a",
"JS",
"file",
"that",
"needs",
"to",
"be",
"included",
"in",
"the",
"header",
"of",
"the",
"HTML",
"file",
"but",
"after",
"jQuery",
"and",
"AngularJS",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/listeners/AddResourcesListener.java#L838-L840 |
lets-blade/blade | src/main/java/com/blade/Environment.java | Environment.add | public Environment add(@NonNull String key, @NonNull Object value) {
return set(key, value);
} | java | public Environment add(@NonNull String key, @NonNull Object value) {
return set(key, value);
} | [
"public",
"Environment",
"add",
"(",
"@",
"NonNull",
"String",
"key",
",",
"@",
"NonNull",
"Object",
"value",
")",
"{",
"return",
"set",
"(",
"key",
",",
"value",
")",
";",
"}"
] | And Set the same
@param key key
@param value value
@return return Environment instance | [
"And",
"Set",
"the",
"same"
] | train | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/Environment.java#L229-L231 |
eurekaclinical/protempa | protempa-framework/src/main/java/org/protempa/HorizontalTemporalInference.java | HorizontalTemporalInference.execute | <T extends TemporalProposition> boolean execute(
PropositionDefinition propDef, Segment<T> tp1, Segment<T> tp2) {
if (tp1 == null || tp2 == null) {
return false;
}
return executeInternal(propDef, tp1.getInterval(), tp2.getInterval());
} | java | <T extends TemporalProposition> boolean execute(
PropositionDefinition propDef, Segment<T> tp1, Segment<T> tp2) {
if (tp1 == null || tp2 == null) {
return false;
}
return executeInternal(propDef, tp1.getInterval(), tp2.getInterval());
} | [
"<",
"T",
"extends",
"TemporalProposition",
">",
"boolean",
"execute",
"(",
"PropositionDefinition",
"propDef",
",",
"Segment",
"<",
"T",
">",
"tp1",
",",
"Segment",
"<",
"T",
">",
"tp2",
")",
"{",
"if",
"(",
"tp1",
"==",
"null",
"||",
"tp2",
"==",
"nu... | Computes whether the union of two segments of temporal propositions
should be taken.
We assume that
<code>tp1</code> is before or at the same time as
<code>tp2</code>, and that
<code>tp1</code> and
<code>tp2</code> are instances of
<code>propDef</code>.
@param propDef a {@link PropositionDefinition}.
@param tp1 a {@link Segment<? extends TemporalProposition>}.
@param tp2 a {@link Segment<? extends TemporalProposition>}.
@return <code>true</code> if they should be combined, <code>false</code>
otherwise. | [
"Computes",
"whether",
"the",
"union",
"of",
"two",
"segments",
"of",
"temporal",
"propositions",
"should",
"be",
"taken",
"."
] | train | https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/HorizontalTemporalInference.java#L62-L69 |
maxirosson/jdroid-android | jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/SQLiteRepository.java | SQLiteRepository.addColumn | private void addColumn(StringBuilder builder, Column column) {
builder.append(column.getColumnName());
builder.append(" ");
builder.append(column.getDataType().getType());
Boolean optional = column.isOptional();
if (optional != null) {
builder.append(optional ? " NULL" : " NOT NULL");
}
String extraQualifier = column.getExtraQualifier();
if (extraQualifier != null) {
builder.append(" ");
builder.append(extraQualifier);
}
} | java | private void addColumn(StringBuilder builder, Column column) {
builder.append(column.getColumnName());
builder.append(" ");
builder.append(column.getDataType().getType());
Boolean optional = column.isOptional();
if (optional != null) {
builder.append(optional ? " NULL" : " NOT NULL");
}
String extraQualifier = column.getExtraQualifier();
if (extraQualifier != null) {
builder.append(" ");
builder.append(extraQualifier);
}
} | [
"private",
"void",
"addColumn",
"(",
"StringBuilder",
"builder",
",",
"Column",
"column",
")",
"{",
"builder",
".",
"append",
"(",
"column",
".",
"getColumnName",
"(",
")",
")",
";",
"builder",
".",
"append",
"(",
"\" \"",
")",
";",
"builder",
".",
"appe... | Generate the SQL definition for a column.
@param builder current StringBuilder to add the SQL definition.
@param column column definition. | [
"Generate",
"the",
"SQL",
"definition",
"for",
"a",
"column",
"."
] | train | https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/SQLiteRepository.java#L508-L521 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/cache/cachepolicylabel_stats.java | cachepolicylabel_stats.get | public static cachepolicylabel_stats get(nitro_service service, String labelname) throws Exception{
cachepolicylabel_stats obj = new cachepolicylabel_stats();
obj.set_labelname(labelname);
cachepolicylabel_stats response = (cachepolicylabel_stats) obj.stat_resource(service);
return response;
} | java | public static cachepolicylabel_stats get(nitro_service service, String labelname) throws Exception{
cachepolicylabel_stats obj = new cachepolicylabel_stats();
obj.set_labelname(labelname);
cachepolicylabel_stats response = (cachepolicylabel_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"cachepolicylabel_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"labelname",
")",
"throws",
"Exception",
"{",
"cachepolicylabel_stats",
"obj",
"=",
"new",
"cachepolicylabel_stats",
"(",
")",
";",
"obj",
".",
"set_labelname",
"(",... | Use this API to fetch statistics of cachepolicylabel_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"cachepolicylabel_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/cache/cachepolicylabel_stats.java#L149-L154 |
dottydingo/hyperion | client/src/main/java/com/dottydingo/hyperion/client/HyperionClient.java | HyperionClient.readResponse | protected <T> T readResponse(Response response,JavaType javaType)
{
try
{
return objectMapper.readValue(response.body().byteStream(), javaType);
}
catch (IOException e)
{
throw new ClientMarshallingException("Error reading results.",e);
}
} | java | protected <T> T readResponse(Response response,JavaType javaType)
{
try
{
return objectMapper.readValue(response.body().byteStream(), javaType);
}
catch (IOException e)
{
throw new ClientMarshallingException("Error reading results.",e);
}
} | [
"protected",
"<",
"T",
">",
"T",
"readResponse",
"(",
"Response",
"response",
",",
"JavaType",
"javaType",
")",
"{",
"try",
"{",
"return",
"objectMapper",
".",
"readValue",
"(",
"response",
".",
"body",
"(",
")",
".",
"byteStream",
"(",
")",
",",
"javaTy... | Read the response and unmarshall into the expected type
@param response The http response
@param javaType The type to return
@return The response value | [
"Read",
"the",
"response",
"and",
"unmarshall",
"into",
"the",
"expected",
"type"
] | train | https://github.com/dottydingo/hyperion/blob/c4d119c90024a88c0335d7d318e9ccdb70149764/client/src/main/java/com/dottydingo/hyperion/client/HyperionClient.java#L371-L381 |
Hygieia/Hygieia | hygieia-jenkins-plugin/src/main/java/hygieia/builder/SonarBuilder.java | SonarBuilder.sonarProcessingComplete | private boolean sonarProcessingComplete(Run<?, ?> run, TaskListener listener, RestCall restCall, String ceQueryIntervalInSecondsString, String ceQueryMaxAttemptsString) throws ParseException {
// Sonar 5.2+ check if the sonar ce api url exists. If not,
// then the project is using old sonar version and hence
// request to Compute Engine api is not required.
String sonarCEAPIUrl = "";
int ceQueryIntervalInSeconds = HygieiaUtils.getSafePositiveInteger(ceQueryIntervalInSecondsString, DEFAULT_QUERY_INTERVAL);
int ceQueryMaxAttempts = HygieiaUtils.getSafePositiveInteger(ceQueryMaxAttemptsString, DEFAULT_QUERY_MAX_ATTEMPTS);
try {
sonarCEAPIUrl = extractSonarProcessingStatusUrlFromLogs(run);
} catch (IOException e) {
e.printStackTrace();
}
if (StringUtils.isEmpty(sonarCEAPIUrl)) {
// request to CE API is not required as Sonar Version < 5.2
return true;
}
// keep polling Sonar CE API for max configured attempts to fetch
// status of sonar analysis. After every attempt if CE API is not yet
// ready, sleep for configured interval period.
// Return true as soon as the status changes to SUCCESS
for (int i = 0; i < ceQueryMaxAttempts; i++) {
// get the status of sonar analysis using Sonar CE API
RestCall.RestCallResponse ceAPIResponse = restCall.makeRestCallGet(sonarCEAPIUrl);
int responseCodeCEAPI = ceAPIResponse.getResponseCode();
if (responseCodeCEAPI == HttpStatus.SC_OK) {
String taskStatus = getSonarTaskStatus(ceAPIResponse.getResponseString());
switch (taskStatus) {
case "IN_PROGRESS":
case "PENDING":
// Wait the configured interval then retry
listener.getLogger().println("Waiting for report processing to complete...");
try {
Thread.sleep(ceQueryIntervalInSeconds * 1000);
} catch (InterruptedException ie) {
listener.getLogger().println("Sonar report processing errored while getting the status...");
return false;
}
break;
case "SUCCESS":
// Exit
listener.getLogger().println("Sonar report processing completed...");
return true;
default:
listener.getLogger().println("Hygieia Publisher: Sonar CE API returned bad status: " + taskStatus);
return false;
}
} else {
listener.getLogger().println("Hygieia Publisher: Sonar CE API Connection failed. Response: " + responseCodeCEAPI);
return false;
}
}
listener.getLogger().println("Hygieia Publisher: Sonar CE API could not return response on time.");
return false;
} | java | private boolean sonarProcessingComplete(Run<?, ?> run, TaskListener listener, RestCall restCall, String ceQueryIntervalInSecondsString, String ceQueryMaxAttemptsString) throws ParseException {
// Sonar 5.2+ check if the sonar ce api url exists. If not,
// then the project is using old sonar version and hence
// request to Compute Engine api is not required.
String sonarCEAPIUrl = "";
int ceQueryIntervalInSeconds = HygieiaUtils.getSafePositiveInteger(ceQueryIntervalInSecondsString, DEFAULT_QUERY_INTERVAL);
int ceQueryMaxAttempts = HygieiaUtils.getSafePositiveInteger(ceQueryMaxAttemptsString, DEFAULT_QUERY_MAX_ATTEMPTS);
try {
sonarCEAPIUrl = extractSonarProcessingStatusUrlFromLogs(run);
} catch (IOException e) {
e.printStackTrace();
}
if (StringUtils.isEmpty(sonarCEAPIUrl)) {
// request to CE API is not required as Sonar Version < 5.2
return true;
}
// keep polling Sonar CE API for max configured attempts to fetch
// status of sonar analysis. After every attempt if CE API is not yet
// ready, sleep for configured interval period.
// Return true as soon as the status changes to SUCCESS
for (int i = 0; i < ceQueryMaxAttempts; i++) {
// get the status of sonar analysis using Sonar CE API
RestCall.RestCallResponse ceAPIResponse = restCall.makeRestCallGet(sonarCEAPIUrl);
int responseCodeCEAPI = ceAPIResponse.getResponseCode();
if (responseCodeCEAPI == HttpStatus.SC_OK) {
String taskStatus = getSonarTaskStatus(ceAPIResponse.getResponseString());
switch (taskStatus) {
case "IN_PROGRESS":
case "PENDING":
// Wait the configured interval then retry
listener.getLogger().println("Waiting for report processing to complete...");
try {
Thread.sleep(ceQueryIntervalInSeconds * 1000);
} catch (InterruptedException ie) {
listener.getLogger().println("Sonar report processing errored while getting the status...");
return false;
}
break;
case "SUCCESS":
// Exit
listener.getLogger().println("Sonar report processing completed...");
return true;
default:
listener.getLogger().println("Hygieia Publisher: Sonar CE API returned bad status: " + taskStatus);
return false;
}
} else {
listener.getLogger().println("Hygieia Publisher: Sonar CE API Connection failed. Response: " + responseCodeCEAPI);
return false;
}
}
listener.getLogger().println("Hygieia Publisher: Sonar CE API could not return response on time.");
return false;
} | [
"private",
"boolean",
"sonarProcessingComplete",
"(",
"Run",
"<",
"?",
",",
"?",
">",
"run",
",",
"TaskListener",
"listener",
",",
"RestCall",
"restCall",
",",
"String",
"ceQueryIntervalInSecondsString",
",",
"String",
"ceQueryMaxAttemptsString",
")",
"throws",
"Par... | Keeps polling Sonar's Compute Engine (CE) API to determine status of sonar analysis
From Sonar 5.2+, the final analysis is now an asynchronous and the status
of the sonar analysis needs to be determined from the Sonar CE API
@param restCall RestCall
@return true after Compute Engine has completed processing or it is an old Sonar version.
Else returns false
@throws ParseException ParseException | [
"Keeps",
"polling",
"Sonar",
"s",
"Compute",
"Engine",
"(",
"CE",
")",
"API",
"to",
"determine",
"status",
"of",
"sonar",
"analysis",
"From",
"Sonar",
"5",
".",
"2",
"+",
"the",
"final",
"analysis",
"is",
"now",
"an",
"asynchronous",
"and",
"the",
"statu... | train | https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/hygieia-jenkins-plugin/src/main/java/hygieia/builder/SonarBuilder.java#L112-L167 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/memory/impl/CudaDirectProvider.java | CudaDirectProvider.pingDeviceForFreeMemory | public boolean pingDeviceForFreeMemory(Integer deviceId, long requiredMemory) {
/*
long[] totalMem = new long[1];
long[] freeMem = new long[1];
JCuda.cudaMemGetInfo(freeMem, totalMem);
long free = freeMem[0];
long total = totalMem[0];
long used = total - free;
/*
We don't want to allocate memory if it's too close to the end of available ram.
*/
//if (configuration != null && used > total * configuration.getMaxDeviceMemoryUsed()) return false;
/*
if (free + requiredMemory < total * 0.85)
return true;
else return false;
*/
long freeMem = nativeOps.getDeviceFreeMemory(-1);
if (freeMem - requiredMemory < DEVICE_RESERVED_SPACE)
return false;
else
return true;
} | java | public boolean pingDeviceForFreeMemory(Integer deviceId, long requiredMemory) {
/*
long[] totalMem = new long[1];
long[] freeMem = new long[1];
JCuda.cudaMemGetInfo(freeMem, totalMem);
long free = freeMem[0];
long total = totalMem[0];
long used = total - free;
/*
We don't want to allocate memory if it's too close to the end of available ram.
*/
//if (configuration != null && used > total * configuration.getMaxDeviceMemoryUsed()) return false;
/*
if (free + requiredMemory < total * 0.85)
return true;
else return false;
*/
long freeMem = nativeOps.getDeviceFreeMemory(-1);
if (freeMem - requiredMemory < DEVICE_RESERVED_SPACE)
return false;
else
return true;
} | [
"public",
"boolean",
"pingDeviceForFreeMemory",
"(",
"Integer",
"deviceId",
",",
"long",
"requiredMemory",
")",
"{",
"/*\n long[] totalMem = new long[1];\n long[] freeMem = new long[1];\n \n \n JCuda.cudaMemGetInfo(freeMem, totalMem);\n \n long ... | This method checks specified device for specified amount of memory
@param deviceId
@param requiredMemory
@return | [
"This",
"method",
"checks",
"specified",
"device",
"for",
"specified",
"amount",
"of",
"memory"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/memory/impl/CudaDirectProvider.java#L189-L216 |
apiman/apiman | manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java | AuditUtils.contractBrokenFromClient | public static AuditEntryBean contractBrokenFromClient(ContractBean bean, ISecurityContext securityContext) {
AuditEntryBean entry = newEntry(bean.getClient().getClient().getOrganization().getId(), AuditEntityType.Client, securityContext);
entry.setWhat(AuditEntryType.BreakContract);
entry.setEntityId(bean.getClient().getClient().getId());
entry.setEntityVersion(bean.getClient().getVersion());
ContractData data = new ContractData(bean);
entry.setData(toJSON(data));
return entry;
} | java | public static AuditEntryBean contractBrokenFromClient(ContractBean bean, ISecurityContext securityContext) {
AuditEntryBean entry = newEntry(bean.getClient().getClient().getOrganization().getId(), AuditEntityType.Client, securityContext);
entry.setWhat(AuditEntryType.BreakContract);
entry.setEntityId(bean.getClient().getClient().getId());
entry.setEntityVersion(bean.getClient().getVersion());
ContractData data = new ContractData(bean);
entry.setData(toJSON(data));
return entry;
} | [
"public",
"static",
"AuditEntryBean",
"contractBrokenFromClient",
"(",
"ContractBean",
"bean",
",",
"ISecurityContext",
"securityContext",
")",
"{",
"AuditEntryBean",
"entry",
"=",
"newEntry",
"(",
"bean",
".",
"getClient",
"(",
")",
".",
"getClient",
"(",
")",
".... | Creates an audit entry for the 'contract broken' event.
@param bean the bean
@param securityContext the security context
@return the audit entry | [
"Creates",
"an",
"audit",
"entry",
"for",
"the",
"contract",
"broken",
"event",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java#L458-L466 |
alkacon/opencms-core | src/org/opencms/xml/CmsXmlUtils.java | CmsXmlUtils.validateXmlStructure | public static void validateXmlStructure(Document document, String encoding, EntityResolver resolver)
throws CmsXmlException {
// generate bytes from document
byte[] xmlData = ((ByteArrayOutputStream)marshal(
document,
new ByteArrayOutputStream(512),
encoding)).toByteArray();
validateXmlStructure(xmlData, resolver);
} | java | public static void validateXmlStructure(Document document, String encoding, EntityResolver resolver)
throws CmsXmlException {
// generate bytes from document
byte[] xmlData = ((ByteArrayOutputStream)marshal(
document,
new ByteArrayOutputStream(512),
encoding)).toByteArray();
validateXmlStructure(xmlData, resolver);
} | [
"public",
"static",
"void",
"validateXmlStructure",
"(",
"Document",
"document",
",",
"String",
"encoding",
",",
"EntityResolver",
"resolver",
")",
"throws",
"CmsXmlException",
"{",
"// generate bytes from document",
"byte",
"[",
"]",
"xmlData",
"=",
"(",
"(",
"Byte... | Validates the structure of a XML document with the DTD or XML schema used
by the document.<p>
@param document a XML document that should be validated
@param encoding the encoding to use when marshalling the XML document (required)
@param resolver the XML entity resolver to use
@throws CmsXmlException if the validation fails | [
"Validates",
"the",
"structure",
"of",
"a",
"XML",
"document",
"with",
"the",
"DTD",
"or",
"XML",
"schema",
"used",
"by",
"the",
"document",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlUtils.java#L842-L851 |
shrinkwrap/resolver | maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/aether/ClasspathWorkspaceReader.java | ClasspathWorkspaceReader.areEquivalent | private boolean areEquivalent(final Artifact artifact, final Artifact foundArtifact) {
boolean areEquivalent = (foundArtifact.getGroupId().equals(artifact.getGroupId())
&& foundArtifact.getArtifactId().equals(artifact.getArtifactId()) && foundArtifact.getVersion().equals(
artifact.getVersion()));
return areEquivalent;
} | java | private boolean areEquivalent(final Artifact artifact, final Artifact foundArtifact) {
boolean areEquivalent = (foundArtifact.getGroupId().equals(artifact.getGroupId())
&& foundArtifact.getArtifactId().equals(artifact.getArtifactId()) && foundArtifact.getVersion().equals(
artifact.getVersion()));
return areEquivalent;
} | [
"private",
"boolean",
"areEquivalent",
"(",
"final",
"Artifact",
"artifact",
",",
"final",
"Artifact",
"foundArtifact",
")",
"{",
"boolean",
"areEquivalent",
"=",
"(",
"foundArtifact",
".",
"getGroupId",
"(",
")",
".",
"equals",
"(",
"artifact",
".",
"getGroupId... | Returns if two artifacts are equivalent, that is, have the same groupId, artifactId and Version
@param artifact
left side artifact to be compared
@param foundArtifact
right side artifact to be compared
@return true if the groupId, artifactId and version matches | [
"Returns",
"if",
"two",
"artifacts",
"are",
"equivalent",
"that",
"is",
"have",
"the",
"same",
"groupId",
"artifactId",
"and",
"Version"
] | train | https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/aether/ClasspathWorkspaceReader.java#L236-L241 |
BioPAX/Paxtools | paxtools-core/src/main/java/org/biopax/paxtools/converter/LevelUpgrader.java | LevelUpgrader.createSimplePhysicalEntity | private SimplePhysicalEntity createSimplePhysicalEntity(physicalEntityParticipant pep) {
physicalEntity pe2 = pep.getPHYSICAL_ENTITY();
return createSimplePhysicalEntity(pe2, pep.getUri());
} | java | private SimplePhysicalEntity createSimplePhysicalEntity(physicalEntityParticipant pep) {
physicalEntity pe2 = pep.getPHYSICAL_ENTITY();
return createSimplePhysicalEntity(pe2, pep.getUri());
} | [
"private",
"SimplePhysicalEntity",
"createSimplePhysicalEntity",
"(",
"physicalEntityParticipant",
"pep",
")",
"{",
"physicalEntity",
"pe2",
"=",
"pep",
".",
"getPHYSICAL_ENTITY",
"(",
")",
";",
"return",
"createSimplePhysicalEntity",
"(",
"pe2",
",",
"pep",
".",
"get... | /*
Create L3 simple PE type using the L2 pEP.
When pEP's PHYSICAL_ENTITY is either complex
or basic physicalEntity, null will be the result. | [
"/",
"*",
"Create",
"L3",
"simple",
"PE",
"type",
"using",
"the",
"L2",
"pEP",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/converter/LevelUpgrader.java#L250-L253 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Signature.java | Signature.argType | public Signature argType(int index, Class<?> type) {
return new Signature(type().changeParameterType(index, type), argNames());
} | java | public Signature argType(int index, Class<?> type) {
return new Signature(type().changeParameterType(index, type), argNames());
} | [
"public",
"Signature",
"argType",
"(",
"int",
"index",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"new",
"Signature",
"(",
"type",
"(",
")",
".",
"changeParameterType",
"(",
"index",
",",
"type",
")",
",",
"argNames",
"(",
")",
")",
";"... | Set the argument type at the given index.
@param index the index at which to set the argument type
@param type the type to set
@return a new signature with the given type at the given index | [
"Set",
"the",
"argument",
"type",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Signature.java#L653-L655 |
kaazing/gateway | service/amqp/src/main/java/org/kaazing/gateway/service/amqp/amqp091/AmqpTable.java | AmqpTable.addInteger | public AmqpTable addInteger(String key, int value) {
this.add(key, value, AmqpType.INT);
return this;
} | java | public AmqpTable addInteger(String key, int value) {
this.add(key, value, AmqpType.INT);
return this;
} | [
"public",
"AmqpTable",
"addInteger",
"(",
"String",
"key",
",",
"int",
"value",
")",
"{",
"this",
".",
"add",
"(",
"key",
",",
"value",
",",
"AmqpType",
".",
"INT",
")",
";",
"return",
"this",
";",
"}"
] | Adds an integer entry to the AmqpTable.
@param key name of an entry
@param value integer value of an entry
@return AmqpTable object that holds the table of entries | [
"Adds",
"an",
"integer",
"entry",
"to",
"the",
"AmqpTable",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/amqp/src/main/java/org/kaazing/gateway/service/amqp/amqp091/AmqpTable.java#L130-L133 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/resource/InterfaceDefinition.java | InterfaceDefinition.wrapAsList | @Deprecated
private static ListAttributeDefinition wrapAsList(final AttributeDefinition def) {
final ListAttributeDefinition list = new ListAttributeDefinition(new SimpleListAttributeDefinition.Builder(def.getName(), def)
.setElementValidator(def.getValidator())) {
@Override
public ModelNode getNoTextDescription(boolean forOperation) {
final ModelNode model = super.getNoTextDescription(forOperation);
setValueType(model);
return model;
}
@Override
protected void addValueTypeDescription(final ModelNode node, final ResourceBundle bundle) {
setValueType(node);
}
@Override
public void marshallAsElement(final ModelNode resourceModel, final boolean marshalDefault, final XMLStreamWriter writer) throws XMLStreamException {
throw new RuntimeException();
}
@Override
protected void addAttributeValueTypeDescription(ModelNode node, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle) {
setValueType(node);
}
@Override
protected void addOperationParameterValueTypeDescription(ModelNode node, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle) {
setValueType(node);
}
private void setValueType(ModelNode node) {
node.get(ModelDescriptionConstants.VALUE_TYPE).set(ModelType.STRING);
}
};
return list;
} | java | @Deprecated
private static ListAttributeDefinition wrapAsList(final AttributeDefinition def) {
final ListAttributeDefinition list = new ListAttributeDefinition(new SimpleListAttributeDefinition.Builder(def.getName(), def)
.setElementValidator(def.getValidator())) {
@Override
public ModelNode getNoTextDescription(boolean forOperation) {
final ModelNode model = super.getNoTextDescription(forOperation);
setValueType(model);
return model;
}
@Override
protected void addValueTypeDescription(final ModelNode node, final ResourceBundle bundle) {
setValueType(node);
}
@Override
public void marshallAsElement(final ModelNode resourceModel, final boolean marshalDefault, final XMLStreamWriter writer) throws XMLStreamException {
throw new RuntimeException();
}
@Override
protected void addAttributeValueTypeDescription(ModelNode node, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle) {
setValueType(node);
}
@Override
protected void addOperationParameterValueTypeDescription(ModelNode node, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle) {
setValueType(node);
}
private void setValueType(ModelNode node) {
node.get(ModelDescriptionConstants.VALUE_TYPE).set(ModelType.STRING);
}
};
return list;
} | [
"@",
"Deprecated",
"private",
"static",
"ListAttributeDefinition",
"wrapAsList",
"(",
"final",
"AttributeDefinition",
"def",
")",
"{",
"final",
"ListAttributeDefinition",
"list",
"=",
"new",
"ListAttributeDefinition",
"(",
"new",
"SimpleListAttributeDefinition",
".",
"Bui... | Wrap a simple attribute def as list.
@param def the attribute definition
@return the list attribute def | [
"Wrap",
"a",
"simple",
"attribute",
"def",
"as",
"list",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/resource/InterfaceDefinition.java#L309-L347 |
teatrove/teatrove | teaapps/src/main/java/org/teatrove/teaapps/contexts/DateContext.java | DateContext.createDateWithValidation | public Date createDateWithValidation(String dateString, String inputFormat) {
try { return createDate(dateString, inputFormat); }
catch (Exception exception) {
Syslog.debug("DateContextImpl.createDateWithValidation: Error " +
"creating date with " + dateString + "/" +
inputFormat + "; Exception: " + exception.getMessage());
}
return null;
} | java | public Date createDateWithValidation(String dateString, String inputFormat) {
try { return createDate(dateString, inputFormat); }
catch (Exception exception) {
Syslog.debug("DateContextImpl.createDateWithValidation: Error " +
"creating date with " + dateString + "/" +
inputFormat + "; Exception: " + exception.getMessage());
}
return null;
} | [
"public",
"Date",
"createDateWithValidation",
"(",
"String",
"dateString",
",",
"String",
"inputFormat",
")",
"{",
"try",
"{",
"return",
"createDate",
"(",
"dateString",
",",
"inputFormat",
")",
";",
"}",
"catch",
"(",
"Exception",
"exception",
")",
"{",
"Sysl... | Creates a date object based on the format passed in. Exceptions are NOT
thrown by this method and instead <code>null</code> is returned.
Otherwise, this is identical to {@link #createDate(String, String)}.
@param dateString The string from which to create a date
@param inputFormat The format of the date string
@return The {@link Date} instance representing the date
@see #createDate(String, String) | [
"Creates",
"a",
"date",
"object",
"based",
"on",
"the",
"format",
"passed",
"in",
".",
"Exceptions",
"are",
"NOT",
"thrown",
"by",
"this",
"method",
"and",
"instead",
"<code",
">",
"null<",
"/",
"code",
">",
"is",
"returned",
".",
"Otherwise",
"this",
"i... | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/DateContext.java#L210-L219 |
Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/meta/StorageDirView.java | StorageDirView.createTempBlockMeta | public TempBlockMeta createTempBlockMeta(long sessionId, long blockId, long initialBlockSize) {
return new TempBlockMeta(sessionId, blockId, initialBlockSize, mDir);
} | java | public TempBlockMeta createTempBlockMeta(long sessionId, long blockId, long initialBlockSize) {
return new TempBlockMeta(sessionId, blockId, initialBlockSize, mDir);
} | [
"public",
"TempBlockMeta",
"createTempBlockMeta",
"(",
"long",
"sessionId",
",",
"long",
"blockId",
",",
"long",
"initialBlockSize",
")",
"{",
"return",
"new",
"TempBlockMeta",
"(",
"sessionId",
",",
"blockId",
",",
"initialBlockSize",
",",
"mDir",
")",
";",
"}"... | Creates a {@link TempBlockMeta} given sessionId, blockId, and initialBlockSize.
@param sessionId of the owning session
@param blockId of the new block
@param initialBlockSize of the new block
@return a new {@link TempBlockMeta} under the underlying directory | [
"Creates",
"a",
"{",
"@link",
"TempBlockMeta",
"}",
"given",
"sessionId",
"blockId",
"and",
"initialBlockSize",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/meta/StorageDirView.java#L148-L150 |
Azure/azure-sdk-for-java | eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/EventSubscriptionsInner.java | EventSubscriptionsInner.listByDomainTopic | public List<EventSubscriptionInner> listByDomainTopic(String resourceGroupName, String domainName, String topicName) {
return listByDomainTopicWithServiceResponseAsync(resourceGroupName, domainName, topicName).toBlocking().single().body();
} | java | public List<EventSubscriptionInner> listByDomainTopic(String resourceGroupName, String domainName, String topicName) {
return listByDomainTopicWithServiceResponseAsync(resourceGroupName, domainName, topicName).toBlocking().single().body();
} | [
"public",
"List",
"<",
"EventSubscriptionInner",
">",
"listByDomainTopic",
"(",
"String",
"resourceGroupName",
",",
"String",
"domainName",
",",
"String",
"topicName",
")",
"{",
"return",
"listByDomainTopicWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"domainN... | List all event subscriptions for a specific domain topic.
List all event subscriptions that have been created for a specific domain topic.
@param resourceGroupName The name of the resource group within the user's subscription.
@param domainName Name of the top level domain
@param topicName Name of the domain topic
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<EventSubscriptionInner> object if successful. | [
"List",
"all",
"event",
"subscriptions",
"for",
"a",
"specific",
"domain",
"topic",
".",
"List",
"all",
"event",
"subscriptions",
"that",
"have",
"been",
"created",
"for",
"a",
"specific",
"domain",
"topic",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/EventSubscriptionsInner.java#L1678-L1680 |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.proxyRemoteObject | public <T extends DObject> void proxyRemoteObject (
String nodeName, final int remoteOid, final ResultListener<Integer> listener)
{
proxyRemoteObject(new DObjectAddress(nodeName, remoteOid), listener);
} | java | public <T extends DObject> void proxyRemoteObject (
String nodeName, final int remoteOid, final ResultListener<Integer> listener)
{
proxyRemoteObject(new DObjectAddress(nodeName, remoteOid), listener);
} | [
"public",
"<",
"T",
"extends",
"DObject",
">",
"void",
"proxyRemoteObject",
"(",
"String",
"nodeName",
",",
"final",
"int",
"remoteOid",
",",
"final",
"ResultListener",
"<",
"Integer",
">",
"listener",
")",
"{",
"proxyRemoteObject",
"(",
"new",
"DObjectAddress",... | Initiates a proxy on an object that is managed by the specified peer. The object will be
proxied into this server's distributed object space and its local oid reported back to the
supplied result listener.
<p> Note that proxy requests <em>do not</em> stack like subscription requests. Only one
entity must issue a request to proxy an object and that entity must be responsible for
releasing the proxy when it knows that there are no longer any local subscribers to the
object. | [
"Initiates",
"a",
"proxy",
"on",
"an",
"object",
"that",
"is",
"managed",
"by",
"the",
"specified",
"peer",
".",
"The",
"object",
"will",
"be",
"proxied",
"into",
"this",
"server",
"s",
"distributed",
"object",
"space",
"and",
"its",
"local",
"oid",
"repor... | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L631-L635 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/app/DialogFragmentUtils.java | DialogFragmentUtils.dismissOnLoaderCallback | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void dismissOnLoaderCallback(Handler handler, final android.app.FragmentManager manager, final String tag) {
handler.post(new Runnable() {
@Override
public void run() {
android.app.DialogFragment fragment = (android.app.DialogFragment) manager.findFragmentByTag(tag);
if (fragment != null) {
fragment.dismiss();
}
}
});
} | java | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void dismissOnLoaderCallback(Handler handler, final android.app.FragmentManager manager, final String tag) {
handler.post(new Runnable() {
@Override
public void run() {
android.app.DialogFragment fragment = (android.app.DialogFragment) manager.findFragmentByTag(tag);
if (fragment != null) {
fragment.dismiss();
}
}
});
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"HONEYCOMB",
")",
"public",
"static",
"void",
"dismissOnLoaderCallback",
"(",
"Handler",
"handler",
",",
"final",
"android",
".",
"app",
".",
"FragmentManager",
"manager",
",",
"final",
"String",
"tag",
... | Dismiss {@link android.app.DialogFragment} for the tag on the loader callbacks with the specified {@link android.os.Handler}.
@param handler the handler, in most case, this handler is the main handler.
@param manager the manager.
@param tag the tag string that is related to the {@link android.app.DialogFragment}. | [
"Dismiss",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/DialogFragmentUtils.java#L75-L86 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_app_by_wan_volume.java | br_app_by_wan_volume.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_app_by_wan_volume_responses result = (br_app_by_wan_volume_responses) service.get_payload_formatter().string_to_resource(br_app_by_wan_volume_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_app_by_wan_volume_response_array);
}
br_app_by_wan_volume[] result_br_app_by_wan_volume = new br_app_by_wan_volume[result.br_app_by_wan_volume_response_array.length];
for(int i = 0; i < result.br_app_by_wan_volume_response_array.length; i++)
{
result_br_app_by_wan_volume[i] = result.br_app_by_wan_volume_response_array[i].br_app_by_wan_volume[0];
}
return result_br_app_by_wan_volume;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_app_by_wan_volume_responses result = (br_app_by_wan_volume_responses) service.get_payload_formatter().string_to_resource(br_app_by_wan_volume_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_app_by_wan_volume_response_array);
}
br_app_by_wan_volume[] result_br_app_by_wan_volume = new br_app_by_wan_volume[result.br_app_by_wan_volume_response_array.length];
for(int i = 0; i < result.br_app_by_wan_volume_response_array.length; i++)
{
result_br_app_by_wan_volume[i] = result.br_app_by_wan_volume_response_array[i].br_app_by_wan_volume[0];
}
return result_br_app_by_wan_volume;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"br_app_by_wan_volume_responses",
"result",
"=",
"(",
"br_app_by_wan_volume_responses",
")",
"service",
".",
"... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_app_by_wan_volume.java#L262-L279 |
RuedigerMoeller/kontraktor | src/main/java/org/nustaq/kontraktor/asyncio/AsyncFile.java | AsyncFile.asOutputStream | public OutputStream asOutputStream() {
if ( tmp != null )
throw new RuntimeException("can create Input/OutputStream only once");
tmp = new byte[1];
return new OutputStream() {
@Override
public void write(int b) throws IOException {
tmp[0] = (byte) b;
write(tmp, 0, 1);
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
if ( event == null ) {
event = new AsyncFileIOEvent(0,0, ByteBuffer.allocate(len));
}
if ( event.getBuffer().capacity() < len ) {
event.buffer = ByteBuffer.allocate(len);
}
ByteBuffer buffer = event.buffer;
event.reset();
buffer.put(b,off,len);
buffer.flip();
event = AsyncFile.this.write(event.getNextPosition(), buffer).await();
if ( event.getRead() != len )
throw new RuntimeException("unexpected. Pls report");
}
@Override
public void close() throws IOException {
AsyncFile.this.close();
}
};
} | java | public OutputStream asOutputStream() {
if ( tmp != null )
throw new RuntimeException("can create Input/OutputStream only once");
tmp = new byte[1];
return new OutputStream() {
@Override
public void write(int b) throws IOException {
tmp[0] = (byte) b;
write(tmp, 0, 1);
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
if ( event == null ) {
event = new AsyncFileIOEvent(0,0, ByteBuffer.allocate(len));
}
if ( event.getBuffer().capacity() < len ) {
event.buffer = ByteBuffer.allocate(len);
}
ByteBuffer buffer = event.buffer;
event.reset();
buffer.put(b,off,len);
buffer.flip();
event = AsyncFile.this.write(event.getNextPosition(), buffer).await();
if ( event.getRead() != len )
throw new RuntimeException("unexpected. Pls report");
}
@Override
public void close() throws IOException {
AsyncFile.this.close();
}
};
} | [
"public",
"OutputStream",
"asOutputStream",
"(",
")",
"{",
"if",
"(",
"tmp",
"!=",
"null",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"can create Input/OutputStream only once\"",
")",
";",
"tmp",
"=",
"new",
"byte",
"[",
"1",
"]",
";",
"return",
"new",
... | return a pseudo-blocking output stream. Note: due to limitations of the current await implementation (stack based),
when writing many files concurrently from a single actor thread don't mix high latency file locations (e.g. remote file systems vs. local)
with low latency ones. If this is required, fall back to the more basic read/write methods returning futures.
@return | [
"return",
"a",
"pseudo",
"-",
"blocking",
"output",
"stream",
".",
"Note",
":",
"due",
"to",
"limitations",
"of",
"the",
"current",
"await",
"implementation",
"(",
"stack",
"based",
")",
"when",
"writing",
"many",
"files",
"concurrently",
"from",
"a",
"singl... | train | https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/src/main/java/org/nustaq/kontraktor/asyncio/AsyncFile.java#L107-L142 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/component/UIData.java | UIData.setValueBinding | public void setValueBinding(String name, ValueBinding binding) {
if ("value".equals(name)) {
setDataModel(null);
} else if ("var".equals(name) || "rowIndex".equals(name)) {
throw new IllegalArgumentException();
}
super.setValueBinding(name, binding);
} | java | public void setValueBinding(String name, ValueBinding binding) {
if ("value".equals(name)) {
setDataModel(null);
} else if ("var".equals(name) || "rowIndex".equals(name)) {
throw new IllegalArgumentException();
}
super.setValueBinding(name, binding);
} | [
"public",
"void",
"setValueBinding",
"(",
"String",
"name",
",",
"ValueBinding",
"binding",
")",
"{",
"if",
"(",
"\"value\"",
".",
"equals",
"(",
"name",
")",
")",
"{",
"setDataModel",
"(",
"null",
")",
";",
"}",
"else",
"if",
"(",
"\"var\"",
".",
"equ... | <p>If "name" is something other than "value", "var", or "rowIndex", rely
on the superclass conversion from <code>ValueBinding</code> to
<code>ValueExpression</code>.</p>
@param name Name of the attribute or property for which to set a
{@link ValueBinding}
@param binding The {@link ValueBinding} to set, or <code>null</code> to
remove any currently set {@link ValueBinding}
@throws IllegalArgumentException if <code>name</code> is one of
<code>id</code>, <code>parent</code>,
<code>var</code>, or <code>rowIndex</code>
@throws NullPointerException if <code>name</code> is <code>null</code>
@deprecated This has been replaced by {@link #setValueExpression(java.lang.String,
javax.el.ValueExpression)}. | [
"<p",
">",
"If",
"name",
"is",
"something",
"other",
"than",
"value",
"var",
"or",
"rowIndex",
"rely",
"on",
"the",
"superclass",
"conversion",
"from",
"<code",
">",
"ValueBinding<",
"/",
"code",
">",
"to",
"<code",
">",
"ValueExpression<",
"/",
"code",
">... | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/UIData.java#L770-L779 |
adyliu/jafka | src/main/java/io/jafka/log/LogManager.java | LogManager.createLogs | public int createLogs(String topic, final int partitions, final boolean forceEnlarge) {
TopicNameValidator.validate(topic);
synchronized (logCreationLock) {
final int configPartitions = getPartition(topic);
if (configPartitions >= partitions || !forceEnlarge) {
return configPartitions;
}
topicPartitionsMap.put(topic, partitions);
if (config.getEnableZookeeper()) {
if (getLogPool(topic, 0) != null) {//created already
topicRegisterTasks.add(new TopicTask(TopicTask.TaskType.ENLARGE, topic));
} else {
topicRegisterTasks.add(new TopicTask(TopicTask.TaskType.CREATE, topic));
}
}
return partitions;
}
} | java | public int createLogs(String topic, final int partitions, final boolean forceEnlarge) {
TopicNameValidator.validate(topic);
synchronized (logCreationLock) {
final int configPartitions = getPartition(topic);
if (configPartitions >= partitions || !forceEnlarge) {
return configPartitions;
}
topicPartitionsMap.put(topic, partitions);
if (config.getEnableZookeeper()) {
if (getLogPool(topic, 0) != null) {//created already
topicRegisterTasks.add(new TopicTask(TopicTask.TaskType.ENLARGE, topic));
} else {
topicRegisterTasks.add(new TopicTask(TopicTask.TaskType.CREATE, topic));
}
}
return partitions;
}
} | [
"public",
"int",
"createLogs",
"(",
"String",
"topic",
",",
"final",
"int",
"partitions",
",",
"final",
"boolean",
"forceEnlarge",
")",
"{",
"TopicNameValidator",
".",
"validate",
"(",
"topic",
")",
";",
"synchronized",
"(",
"logCreationLock",
")",
"{",
"final... | create logs with given partition number
@param topic the topic name
@param partitions partition number
@param forceEnlarge enlarge the partition number of log if smaller than runtime
@return the partition number of the log after enlarging | [
"create",
"logs",
"with",
"given",
"partition",
"number"
] | train | https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/log/LogManager.java#L508-L525 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java | DefaultInstalledExtensionRepository.removeInstalledExtension | private void removeInstalledExtension(DefaultInstalledExtension installedExtension, String namespace)
{
removeInstalledFeature(installedExtension.getId().getId(), namespace);
for (ExtensionId feature : installedExtension.getExtensionFeatures()) {
removeInstalledFeature(feature.getId(), namespace);
}
removeFromBackwardDependencies(installedExtension, namespace);
if (!installedExtension.isInstalled()) {
removeCachedExtension(installedExtension);
}
} | java | private void removeInstalledExtension(DefaultInstalledExtension installedExtension, String namespace)
{
removeInstalledFeature(installedExtension.getId().getId(), namespace);
for (ExtensionId feature : installedExtension.getExtensionFeatures()) {
removeInstalledFeature(feature.getId(), namespace);
}
removeFromBackwardDependencies(installedExtension, namespace);
if (!installedExtension.isInstalled()) {
removeCachedExtension(installedExtension);
}
} | [
"private",
"void",
"removeInstalledExtension",
"(",
"DefaultInstalledExtension",
"installedExtension",
",",
"String",
"namespace",
")",
"{",
"removeInstalledFeature",
"(",
"installedExtension",
".",
"getId",
"(",
")",
".",
"getId",
"(",
")",
",",
"namespace",
")",
"... | Uninstall provided extension.
@param installedExtension the extension to uninstall
@param namespace the namespace
@see #uninstallExtension(LocalExtension, String) | [
"Uninstall",
"provided",
"extension",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java#L430-L443 |
alkacon/opencms-core | src/org/opencms/acacia/shared/CmsEntity.java | CmsEntity.setAttributeValue | public void setAttributeValue(String attributeName, String value) {
m_entityAttributes.remove(attributeName);
List<String> values = new ArrayList<String>();
values.add(value);
m_simpleAttributes.put(attributeName, values);
fireChange();
} | java | public void setAttributeValue(String attributeName, String value) {
m_entityAttributes.remove(attributeName);
List<String> values = new ArrayList<String>();
values.add(value);
m_simpleAttributes.put(attributeName, values);
fireChange();
} | [
"public",
"void",
"setAttributeValue",
"(",
"String",
"attributeName",
",",
"String",
"value",
")",
"{",
"m_entityAttributes",
".",
"remove",
"(",
"attributeName",
")",
";",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"... | Sets the given attribute value. Will remove all previous attribute values.<p>
@param attributeName the attribute name
@param value the attribute value | [
"Sets",
"the",
"given",
"attribute",
"value",
".",
"Will",
"remove",
"all",
"previous",
"attribute",
"values",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/CmsEntity.java#L624-L631 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonArray.java | JsonArray.fromJson | public static JsonArray fromJson(String s) {
try {
return CouchbaseAsyncBucket.JSON_ARRAY_TRANSCODER.stringToJsonArray(s);
} catch (Exception e) {
throw new IllegalArgumentException("Cannot convert string to JsonArray", e);
}
} | java | public static JsonArray fromJson(String s) {
try {
return CouchbaseAsyncBucket.JSON_ARRAY_TRANSCODER.stringToJsonArray(s);
} catch (Exception e) {
throw new IllegalArgumentException("Cannot convert string to JsonArray", e);
}
} | [
"public",
"static",
"JsonArray",
"fromJson",
"(",
"String",
"s",
")",
"{",
"try",
"{",
"return",
"CouchbaseAsyncBucket",
".",
"JSON_ARRAY_TRANSCODER",
".",
"stringToJsonArray",
"(",
"s",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new"... | Static method to create a {@link JsonArray} from a JSON {@link String}.
Not to be confused with {@link #from(Object...)} from(aString)} which will populate a new array with the string.
The string is expected to be a valid JSON array representation (eg. starting with a '[').
@param s the JSON String to convert to a {@link JsonArray}.
@return the corresponding {@link JsonArray}.
@throws IllegalArgumentException if the conversion cannot be done. | [
"Static",
"method",
"to",
"create",
"a",
"{",
"@link",
"JsonArray",
"}",
"from",
"a",
"JSON",
"{",
"@link",
"String",
"}",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonArray.java#L179-L185 |
apache/incubator-gobblin | gobblin-modules/gobblin-http/src/main/java/org/apache/gobblin/utils/HttpUtils.java | HttpUtils.updateStatusType | public static void updateStatusType(ResponseStatus status, int statusCode, Set<String> errorCodeWhitelist) {
if (statusCode >= 300 & statusCode < 500) {
List<String> whitelist = new ArrayList<>();
whitelist.add(Integer.toString(statusCode));
if (statusCode > 400) {
whitelist.add(HttpConstants.CODE_4XX);
} else {
whitelist.add(HttpConstants.CODE_3XX);
}
if (whitelist.stream().anyMatch(errorCodeWhitelist::contains)) {
status.setType(StatusType.CONTINUE);
} else {
status.setType(StatusType.CLIENT_ERROR);
}
} else if (statusCode >= 500) {
List<String> whitelist = Arrays.asList(Integer.toString(statusCode), HttpConstants.CODE_5XX);
if (whitelist.stream().anyMatch(errorCodeWhitelist::contains)) {
status.setType(StatusType.CONTINUE);
} else {
status.setType(StatusType.SERVER_ERROR);
}
}
} | java | public static void updateStatusType(ResponseStatus status, int statusCode, Set<String> errorCodeWhitelist) {
if (statusCode >= 300 & statusCode < 500) {
List<String> whitelist = new ArrayList<>();
whitelist.add(Integer.toString(statusCode));
if (statusCode > 400) {
whitelist.add(HttpConstants.CODE_4XX);
} else {
whitelist.add(HttpConstants.CODE_3XX);
}
if (whitelist.stream().anyMatch(errorCodeWhitelist::contains)) {
status.setType(StatusType.CONTINUE);
} else {
status.setType(StatusType.CLIENT_ERROR);
}
} else if (statusCode >= 500) {
List<String> whitelist = Arrays.asList(Integer.toString(statusCode), HttpConstants.CODE_5XX);
if (whitelist.stream().anyMatch(errorCodeWhitelist::contains)) {
status.setType(StatusType.CONTINUE);
} else {
status.setType(StatusType.SERVER_ERROR);
}
}
} | [
"public",
"static",
"void",
"updateStatusType",
"(",
"ResponseStatus",
"status",
",",
"int",
"statusCode",
",",
"Set",
"<",
"String",
">",
"errorCodeWhitelist",
")",
"{",
"if",
"(",
"statusCode",
">=",
"300",
"&",
"statusCode",
"<",
"500",
")",
"{",
"List",
... | Update {@link StatusType} of a {@link ResponseStatus} based on statusCode and error code white list
@param status a status report after handling the a response
@param statusCode a status code in http domain
@param errorCodeWhitelist a whitelist specifies what http error codes are tolerable | [
"Update",
"{",
"@link",
"StatusType",
"}",
"of",
"a",
"{",
"@link",
"ResponseStatus",
"}",
"based",
"on",
"statusCode",
"and",
"error",
"code",
"white",
"list"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-http/src/main/java/org/apache/gobblin/utils/HttpUtils.java#L144-L166 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.substring | public String substring(final int startIndex, int endIndex) {
endIndex = validateRange(startIndex, endIndex);
return new String(buffer, startIndex, endIndex - startIndex);
} | java | public String substring(final int startIndex, int endIndex) {
endIndex = validateRange(startIndex, endIndex);
return new String(buffer, startIndex, endIndex - startIndex);
} | [
"public",
"String",
"substring",
"(",
"final",
"int",
"startIndex",
",",
"int",
"endIndex",
")",
"{",
"endIndex",
"=",
"validateRange",
"(",
"startIndex",
",",
"endIndex",
")",
";",
"return",
"new",
"String",
"(",
"buffer",
",",
"startIndex",
",",
"endIndex"... | Extracts a portion of this string builder as a string.
<p>
Note: This method treats an endIndex greater than the length of the
builder as equal to the length of the builder, and continues
without error, unlike StringBuffer or String.
@param startIndex the start index, inclusive, must be valid
@param endIndex the end index, exclusive, must be valid except
that if too large it is treated as end of string
@return the new string
@throws IndexOutOfBoundsException if the index is invalid | [
"Extracts",
"a",
"portion",
"of",
"this",
"string",
"builder",
"as",
"a",
"string",
".",
"<p",
">",
"Note",
":",
"This",
"method",
"treats",
"an",
"endIndex",
"greater",
"than",
"the",
"length",
"of",
"the",
"builder",
"as",
"equal",
"to",
"the",
"length... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2279-L2282 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/io/Files.java | Files.copy | public static void copy(File from, Charset charset, Appendable to) throws IOException {
asCharSource(from, charset).copyTo(to);
} | java | public static void copy(File from, Charset charset, Appendable to) throws IOException {
asCharSource(from, charset).copyTo(to);
} | [
"public",
"static",
"void",
"copy",
"(",
"File",
"from",
",",
"Charset",
"charset",
",",
"Appendable",
"to",
")",
"throws",
"IOException",
"{",
"asCharSource",
"(",
"from",
",",
"charset",
")",
".",
"copyTo",
"(",
"to",
")",
";",
"}"
] | Copies all characters from a file to an appendable object, using the given character set.
@param from the source file
@param charset the charset used to decode the input stream; see {@link StandardCharsets} for
helpful predefined constants
@param to the appendable object
@throws IOException if an I/O error occurs | [
"Copies",
"all",
"characters",
"from",
"a",
"file",
"to",
"an",
"appendable",
"object",
"using",
"the",
"given",
"character",
"set",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/io/Files.java#L357-L359 |
stevespringett/Alpine | alpine/src/main/java/alpine/util/MapperUtil.java | MapperUtil.readAsObjectOf | public static <T> T readAsObjectOf(Class<T> clazz, String value) {
final ObjectMapper mapper = new ObjectMapper();
try {
return mapper.readValue(value, clazz);
} catch (IOException e) {
LOGGER.error(e.getMessage(), e.fillInStackTrace());
}
return null;
} | java | public static <T> T readAsObjectOf(Class<T> clazz, String value) {
final ObjectMapper mapper = new ObjectMapper();
try {
return mapper.readValue(value, clazz);
} catch (IOException e) {
LOGGER.error(e.getMessage(), e.fillInStackTrace());
}
return null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"readAsObjectOf",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"value",
")",
"{",
"final",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"try",
"{",
"return",
"mapper",
".",
"readVa... | Reads in a String value and returns the object for which it represents.
@param clazz The expected class of the value
@param value the value to parse
@param <T> The expected type to return
@return the mapped object | [
"Reads",
"in",
"a",
"String",
"value",
"and",
"returns",
"the",
"object",
"for",
"which",
"it",
"represents",
"."
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/util/MapperUtil.java#L46-L54 |
google/closure-compiler | src/com/google/javascript/jscomp/PassFactory.java | PassFactory.createEmptyPass | public static PassFactory createEmptyPass(String name) {
return new PassFactory(name, true) {
@Override
protected CompilerPass create(final AbstractCompiler compiler) {
return new CompilerPass() {
@Override
public void process(Node externs, Node root) {}
};
}
@Override
protected FeatureSet featureSet() {
return FeatureSet.latest();
}
};
} | java | public static PassFactory createEmptyPass(String name) {
return new PassFactory(name, true) {
@Override
protected CompilerPass create(final AbstractCompiler compiler) {
return new CompilerPass() {
@Override
public void process(Node externs, Node root) {}
};
}
@Override
protected FeatureSet featureSet() {
return FeatureSet.latest();
}
};
} | [
"public",
"static",
"PassFactory",
"createEmptyPass",
"(",
"String",
"name",
")",
"{",
"return",
"new",
"PassFactory",
"(",
"name",
",",
"true",
")",
"{",
"@",
"Override",
"protected",
"CompilerPass",
"create",
"(",
"final",
"AbstractCompiler",
"compiler",
")",
... | Create a no-op pass that can only run once. Used to break up loops. | [
"Create",
"a",
"no",
"-",
"op",
"pass",
"that",
"can",
"only",
"run",
"once",
".",
"Used",
"to",
"break",
"up",
"loops",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PassFactory.java#L93-L108 |
geomajas/geomajas-project-client-gwt2 | impl/src/main/java/org/geomajas/gwt2/client/service/DomService.java | DomService.setTop | public static void setTop(Element element, int top) {
if (Dom.isIE()) { // Limitation in IE8...
while (top > 1000000) {
top -= 1000000;
}
while (top < -1000000) {
top += 1000000;
}
}
Dom.setStyleAttribute(element, "top", top + "px");
} | java | public static void setTop(Element element, int top) {
if (Dom.isIE()) { // Limitation in IE8...
while (top > 1000000) {
top -= 1000000;
}
while (top < -1000000) {
top += 1000000;
}
}
Dom.setStyleAttribute(element, "top", top + "px");
} | [
"public",
"static",
"void",
"setTop",
"(",
"Element",
"element",
",",
"int",
"top",
")",
"{",
"if",
"(",
"Dom",
".",
"isIE",
"(",
")",
")",
"{",
"// Limitation in IE8...",
"while",
"(",
"top",
">",
"1000000",
")",
"{",
"top",
"-=",
"1000000",
";",
"}... | Apply the "top" style attribute on the given element.
@param element
The DOM element.
@param top
The top value. | [
"Apply",
"the",
"top",
"style",
"attribute",
"on",
"the",
"given",
"element",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/service/DomService.java#L48-L58 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.