repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
openengsb/openengsb | components/util/src/main/java/org/openengsb/core/util/OsgiUtils.java | OsgiUtils.getFilterForLocation | public static Filter getFilterForLocation(Class<?> clazz, String location, String context)
throws IllegalArgumentException {
String filter = makeLocationFilterString(location, context);
return FilterUtils.makeFilter(clazz, filter);
} | java | public static Filter getFilterForLocation(Class<?> clazz, String location, String context)
throws IllegalArgumentException {
String filter = makeLocationFilterString(location, context);
return FilterUtils.makeFilter(clazz, filter);
} | [
"public",
"static",
"Filter",
"getFilterForLocation",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"location",
",",
"String",
"context",
")",
"throws",
"IllegalArgumentException",
"{",
"String",
"filter",
"=",
"makeLocationFilterString",
"(",
"location",
"... | returns a filter that matches services with the given class and location in both the given context and the
root-context
@throws IllegalArgumentException if the location contains special characters that prevent the filter from
compiling | [
"returns",
"a",
"filter",
"that",
"matches",
"services",
"with",
"the",
"given",
"class",
"and",
"location",
"in",
"both",
"the",
"given",
"context",
"and",
"the",
"root",
"-",
"context"
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/util/src/main/java/org/openengsb/core/util/OsgiUtils.java#L40-L44 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/AzureFirewallsInner.java | AzureFirewallsInner.getByResourceGroup | public AzureFirewallInner getByResourceGroup(String resourceGroupName, String azureFirewallName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, azureFirewallName).toBlocking().single().body();
} | java | public AzureFirewallInner getByResourceGroup(String resourceGroupName, String azureFirewallName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, azureFirewallName).toBlocking().single().body();
} | [
"public",
"AzureFirewallInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"azureFirewallName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"azureFirewallName",
")",
".",
"toBlocking",
"(",
"... | Gets the specified Azure Firewall.
@param resourceGroupName The name of the resource group.
@param azureFirewallName The name of the Azure Firewall.
@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 AzureFirewallInner object if successful. | [
"Gets",
"the",
"specified",
"Azure",
"Firewall",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/AzureFirewallsInner.java#L266-L268 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscNodesInner.java | DscNodesInner.updateAsync | public Observable<DscNodeInner> updateAsync(String resourceGroupName, String automationAccountName, String nodeId, DscNodeUpdateParameters parameters) {
return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeId, parameters).map(new Func1<ServiceResponse<DscNodeInner>, DscNodeInner>() {
@Override
public DscNodeInner call(ServiceResponse<DscNodeInner> response) {
return response.body();
}
});
} | java | public Observable<DscNodeInner> updateAsync(String resourceGroupName, String automationAccountName, String nodeId, DscNodeUpdateParameters parameters) {
return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeId, parameters).map(new Func1<ServiceResponse<DscNodeInner>, DscNodeInner>() {
@Override
public DscNodeInner call(ServiceResponse<DscNodeInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DscNodeInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"nodeId",
",",
"DscNodeUpdateParameters",
"parameters",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
... | Update the dsc node.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param nodeId Parameters supplied to the update dsc node.
@param parameters Parameters supplied to the update dsc node.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DscNodeInner object | [
"Update",
"the",
"dsc",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscNodesInner.java#L310-L317 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfAction.java | PdfAction.gotoEmbedded | public static PdfAction gotoEmbedded(String filename, PdfTargetDictionary target, String dest, boolean isName, boolean newWindow) {
if (isName)
return gotoEmbedded(filename, target, new PdfName(dest), newWindow);
else
return gotoEmbedded(filename, target, new PdfString(dest, null), newWindow);
} | java | public static PdfAction gotoEmbedded(String filename, PdfTargetDictionary target, String dest, boolean isName, boolean newWindow) {
if (isName)
return gotoEmbedded(filename, target, new PdfName(dest), newWindow);
else
return gotoEmbedded(filename, target, new PdfString(dest, null), newWindow);
} | [
"public",
"static",
"PdfAction",
"gotoEmbedded",
"(",
"String",
"filename",
",",
"PdfTargetDictionary",
"target",
",",
"String",
"dest",
",",
"boolean",
"isName",
",",
"boolean",
"newWindow",
")",
"{",
"if",
"(",
"isName",
")",
"return",
"gotoEmbedded",
"(",
"... | Creates a GoToE action to an embedded file.
@param filename the root document of the target (null if the target is in the same document)
@param dest the named destination
@param isName if true sets the destination as a name, if false sets it as a String
@return a GoToE action | [
"Creates",
"a",
"GoToE",
"action",
"to",
"an",
"embedded",
"file",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfAction.java#L508-L513 |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertNotStatic | public static void assertNotStatic(final Field field, Class<? extends Annotation> annotation)
{
if (Modifier.isStatic(field.getModifiers()))
{
throw annotation == null ? MESSAGES.fieldCannotBeStaticOrFinal(field) : MESSAGES.fieldCannotBeStaticOrFinal2(field, annotation);
}
} | java | public static void assertNotStatic(final Field field, Class<? extends Annotation> annotation)
{
if (Modifier.isStatic(field.getModifiers()))
{
throw annotation == null ? MESSAGES.fieldCannotBeStaticOrFinal(field) : MESSAGES.fieldCannotBeStaticOrFinal2(field, annotation);
}
} | [
"public",
"static",
"void",
"assertNotStatic",
"(",
"final",
"Field",
"field",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"if",
"(",
"Modifier",
".",
"isStatic",
"(",
"field",
".",
"getModifiers",
"(",
")",
")",
")",
"{... | Asserts field is not static.
@param field to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"field",
"is",
"not",
"static",
"."
] | train | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L229-L235 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.transform | public static void transform(Source source, Result result, String charset, int indent) {
final TransformerFactory factory = TransformerFactory.newInstance();
try {
final Transformer xformer = factory.newTransformer();
if (indent > 0) {
xformer.setOutputProperty(OutputKeys.INDENT, "yes");
xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", String.valueOf(indent));
}
if (StrUtil.isNotBlank(charset)) {
xformer.setOutputProperty(OutputKeys.ENCODING, charset);
}
xformer.transform(source, result);
} catch (Exception e) {
throw new UtilException(e, "Trans xml document to string error!");
}
} | java | public static void transform(Source source, Result result, String charset, int indent) {
final TransformerFactory factory = TransformerFactory.newInstance();
try {
final Transformer xformer = factory.newTransformer();
if (indent > 0) {
xformer.setOutputProperty(OutputKeys.INDENT, "yes");
xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", String.valueOf(indent));
}
if (StrUtil.isNotBlank(charset)) {
xformer.setOutputProperty(OutputKeys.ENCODING, charset);
}
xformer.transform(source, result);
} catch (Exception e) {
throw new UtilException(e, "Trans xml document to string error!");
}
} | [
"public",
"static",
"void",
"transform",
"(",
"Source",
"source",
",",
"Result",
"result",
",",
"String",
"charset",
",",
"int",
"indent",
")",
"{",
"final",
"TransformerFactory",
"factory",
"=",
"TransformerFactory",
".",
"newInstance",
"(",
")",
";",
"try",
... | 将XML文档写出<br>
格式化输出逻辑参考:https://stackoverflow.com/questions/139076/how-to-pretty-print-xml-from-java
@param source 源
@param result 目标
@param charset 编码
@param indent 格式化输出中缩进量,小于1表示不格式化输出
@since 4.0.9 | [
"将XML文档写出<br",
">",
"格式化输出逻辑参考:https",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"139076",
"/",
"how",
"-",
"to",
"-",
"pretty",
"-",
"print",
"-",
"xml",
"-",
"from",
"-",
"java"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L351-L366 |
h2oai/h2o-3 | h2o-persist-s3/src/main/java/water/persist/PersistS3.java | PersistS3.getObjectForKey | private static S3Object getObjectForKey(Key k, long offset, long length) throws IOException {
String[] bk = decodeKey(k);
GetObjectRequest r = new GetObjectRequest(bk[0], bk[1]);
r.setRange(offset, offset + length - 1); // Range is *inclusive* according to docs???
return getClient().getObject(r);
} | java | private static S3Object getObjectForKey(Key k, long offset, long length) throws IOException {
String[] bk = decodeKey(k);
GetObjectRequest r = new GetObjectRequest(bk[0], bk[1]);
r.setRange(offset, offset + length - 1); // Range is *inclusive* according to docs???
return getClient().getObject(r);
} | [
"private",
"static",
"S3Object",
"getObjectForKey",
"(",
"Key",
"k",
",",
"long",
"offset",
",",
"long",
"length",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"bk",
"=",
"decodeKey",
"(",
"k",
")",
";",
"GetObjectRequest",
"r",
"=",
"new",
"Ge... | Gets the S3 object associated with the key that can read length bytes from offset | [
"Gets",
"the",
"S3",
"object",
"associated",
"with",
"the",
"key",
"that",
"can",
"read",
"length",
"bytes",
"from",
"offset"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-persist-s3/src/main/java/water/persist/PersistS3.java#L336-L341 |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java | ComplexMath_F64.multiply | public static void multiply(Complex_F64 a, Complex_F64 b, Complex_F64 result) {
result.real = a.real * b.real - a.imaginary*b.imaginary;
result.imaginary = a.real*b.imaginary + a.imaginary*b.real;
} | java | public static void multiply(Complex_F64 a, Complex_F64 b, Complex_F64 result) {
result.real = a.real * b.real - a.imaginary*b.imaginary;
result.imaginary = a.real*b.imaginary + a.imaginary*b.real;
} | [
"public",
"static",
"void",
"multiply",
"(",
"Complex_F64",
"a",
",",
"Complex_F64",
"b",
",",
"Complex_F64",
"result",
")",
"{",
"result",
".",
"real",
"=",
"a",
".",
"real",
"*",
"b",
".",
"real",
"-",
"a",
".",
"imaginary",
"*",
"b",
".",
"imagina... | <p>
Multiplication: result = a * b
</p>
@param a Complex number. Not modified.
@param b Complex number. Not modified.
@param result Storage for output | [
"<p",
">",
"Multiplication",
":",
"result",
"=",
"a",
"*",
"b",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java#L80-L83 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/deref/UnconditionalValueDerefAnalysis.java | UnconditionalValueDerefAnalysis.findValueKnownNonnullOnBranch | private @CheckForNull
ValueNumber findValueKnownNonnullOnBranch(UnconditionalValueDerefSet fact, Edge edge) {
IsNullValueFrame invFrame = invDataflow.getResultFact(edge.getSource());
if (!invFrame.isValid()) {
return null;
}
IsNullConditionDecision decision = invFrame.getDecision();
if (decision == null) {
return null;
}
IsNullValue inv = decision.getDecision(edge.getType());
if (inv == null || !inv.isDefinitelyNotNull()) {
return null;
}
ValueNumber value = decision.getValue();
if (DEBUG) {
System.out.println("Value number " + value + " is known nonnull on " + edge);
}
return value;
} | java | private @CheckForNull
ValueNumber findValueKnownNonnullOnBranch(UnconditionalValueDerefSet fact, Edge edge) {
IsNullValueFrame invFrame = invDataflow.getResultFact(edge.getSource());
if (!invFrame.isValid()) {
return null;
}
IsNullConditionDecision decision = invFrame.getDecision();
if (decision == null) {
return null;
}
IsNullValue inv = decision.getDecision(edge.getType());
if (inv == null || !inv.isDefinitelyNotNull()) {
return null;
}
ValueNumber value = decision.getValue();
if (DEBUG) {
System.out.println("Value number " + value + " is known nonnull on " + edge);
}
return value;
} | [
"private",
"@",
"CheckForNull",
"ValueNumber",
"findValueKnownNonnullOnBranch",
"(",
"UnconditionalValueDerefSet",
"fact",
",",
"Edge",
"edge",
")",
"{",
"IsNullValueFrame",
"invFrame",
"=",
"invDataflow",
".",
"getResultFact",
"(",
"edge",
".",
"getSource",
"(",
")",... | Clear deref sets of values if this edge is the non-null branch of an if
comparison.
@param fact
a datflow fact
@param edge
edge to check
@return possibly-modified dataflow fact | [
"Clear",
"deref",
"sets",
"of",
"values",
"if",
"this",
"edge",
"is",
"the",
"non",
"-",
"null",
"branch",
"of",
"an",
"if",
"comparison",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/deref/UnconditionalValueDerefAnalysis.java#L909-L931 |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398FellowshipSupplementalV1_2Generator.java | PHS398FellowshipSupplementalV1_2Generator.getInstitutionalBaseSalary | private void getInstitutionalBaseSalary(Budget budget, Map<Integer, String> budgetMap) {
InstitutionalBaseSalary institutionalBaseSalary = InstitutionalBaseSalary.Factory.newInstance();
if (budgetMap.get(SENIOR_FELL) != null && budgetMap.get(SENIOR_FELL).equals(YnqConstant.YES.code())) {
if (budgetMap.get(BASE_SALARY) != null) {
institutionalBaseSalary.setAmount(new BigDecimal(budgetMap.get(BASE_SALARY)));
}
if (budgetMap.get(ACAD_PERIOD) != null) {
institutionalBaseSalary.setAcademicPeriod(AcademicPeriod.Enum.forString(budgetMap.get(ACAD_PERIOD)));
}
if (budgetMap.get(SALARY_MONTHS) != null) {
institutionalBaseSalary.setNumberOfMonths(new BigDecimal(budgetMap.get(SALARY_MONTHS)));
}
budget.setInstitutionalBaseSalary(institutionalBaseSalary);
}
} | java | private void getInstitutionalBaseSalary(Budget budget, Map<Integer, String> budgetMap) {
InstitutionalBaseSalary institutionalBaseSalary = InstitutionalBaseSalary.Factory.newInstance();
if (budgetMap.get(SENIOR_FELL) != null && budgetMap.get(SENIOR_FELL).equals(YnqConstant.YES.code())) {
if (budgetMap.get(BASE_SALARY) != null) {
institutionalBaseSalary.setAmount(new BigDecimal(budgetMap.get(BASE_SALARY)));
}
if (budgetMap.get(ACAD_PERIOD) != null) {
institutionalBaseSalary.setAcademicPeriod(AcademicPeriod.Enum.forString(budgetMap.get(ACAD_PERIOD)));
}
if (budgetMap.get(SALARY_MONTHS) != null) {
institutionalBaseSalary.setNumberOfMonths(new BigDecimal(budgetMap.get(SALARY_MONTHS)));
}
budget.setInstitutionalBaseSalary(institutionalBaseSalary);
}
} | [
"private",
"void",
"getInstitutionalBaseSalary",
"(",
"Budget",
"budget",
",",
"Map",
"<",
"Integer",
",",
"String",
">",
"budgetMap",
")",
"{",
"InstitutionalBaseSalary",
"institutionalBaseSalary",
"=",
"InstitutionalBaseSalary",
".",
"Factory",
".",
"newInstance",
"... | /*
This method is used to set data to InstitutionalBaseSalary XMLObject from budgetMap data for Budget | [
"/",
"*",
"This",
"method",
"is",
"used",
"to",
"set",
"data",
"to",
"InstitutionalBaseSalary",
"XMLObject",
"from",
"budgetMap",
"data",
"for",
"Budget"
] | train | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398FellowshipSupplementalV1_2Generator.java#L600-L614 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/ArrayUtils.java | ArrayUtils.indexOf | @NullSafe
public static <T> int indexOf(T[] array, T element) {
for (int index = 0, length = nullSafeLength(array); index < length; index++) {
if (equalsIgnoreNull(array[index], element)) {
return index;
}
}
return -1;
} | java | @NullSafe
public static <T> int indexOf(T[] array, T element) {
for (int index = 0, length = nullSafeLength(array); index < length; index++) {
if (equalsIgnoreNull(array[index], element)) {
return index;
}
}
return -1;
} | [
"@",
"NullSafe",
"public",
"static",
"<",
"T",
">",
"int",
"indexOf",
"(",
"T",
"[",
"]",
"array",
",",
"T",
"element",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"0",
",",
"length",
"=",
"nullSafeLength",
"(",
"array",
")",
";",
"index",
"<",
"l... | Null-safe method to find the index of the given {@code element} in the given {@code array}.
@param <T> {@link Class} type of elements in the array.
@param array array used to search for {@code element}.
@param element {@link Object} element to search for in the given {@code array}.
@return the index of the given {@code element} in the given {@code array} or return {@literal -1}
if {@code element} could not be found. | [
"Null",
"-",
"safe",
"method",
"to",
"find",
"the",
"index",
"of",
"the",
"given",
"{",
"@code",
"element",
"}",
"in",
"the",
"given",
"{",
"@code",
"array",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/ArrayUtils.java#L510-L520 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/user/UserCoreDao.java | UserCoreDao.buildColumnsAs | public String[] buildColumnsAs(String[] columns, String value) {
String[] values = new String[columns.length];
for (int i = 0; i < columns.length; i++) {
values[i] = value;
}
return buildColumnsAs(columns, values);
} | java | public String[] buildColumnsAs(String[] columns, String value) {
String[] values = new String[columns.length];
for (int i = 0; i < columns.length; i++) {
values[i] = value;
}
return buildColumnsAs(columns, values);
} | [
"public",
"String",
"[",
"]",
"buildColumnsAs",
"(",
"String",
"[",
"]",
"columns",
",",
"String",
"value",
")",
"{",
"String",
"[",
"]",
"values",
"=",
"new",
"String",
"[",
"columns",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";"... | Build "columns as" values for the table columns with the specified
columns as the specified value
@param columns
columns to include as value
@param value
"columns as" value for specified columns
@return "columns as" values
@since 2.0.0 | [
"Build",
"columns",
"as",
"values",
"for",
"the",
"table",
"columns",
"with",
"the",
"specified",
"columns",
"as",
"the",
"specified",
"value"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/user/UserCoreDao.java#L1584-L1592 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/CallbackHandlerInterceptor.java | CallbackHandlerInterceptor.getDownloadedFile | private InputStream getDownloadedFile(String response) throws FMSException {
if (response != null) {
try {
URL url = new URL(response);
return url.openStream();
} catch (Exception e) {
throw new FMSException("Exception while downloading the file from URL.", e);
}
}
return null;
} | java | private InputStream getDownloadedFile(String response) throws FMSException {
if (response != null) {
try {
URL url = new URL(response);
return url.openStream();
} catch (Exception e) {
throw new FMSException("Exception while downloading the file from URL.", e);
}
}
return null;
} | [
"private",
"InputStream",
"getDownloadedFile",
"(",
"String",
"response",
")",
"throws",
"FMSException",
"{",
"if",
"(",
"response",
"!=",
"null",
")",
"{",
"try",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"response",
")",
";",
"return",
"url",
".",
"op... | Method to get the input stream from the download URL returned from service
@param response the download URL string
@return InputStream the downloaded file
@throws FMSException | [
"Method",
"to",
"get",
"the",
"input",
"stream",
"from",
"the",
"download",
"URL",
"returned",
"from",
"service"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/CallbackHandlerInterceptor.java#L309-L320 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/spi/LobEngine.java | LobEngine.setClobValue | public void setClobValue(long locator, Clob data) throws PersistException, IOException {
if (data == null) {
deleteLob(locator);
return;
}
if (locator == 0) {
throw new IllegalArgumentException("Cannot use locator zero");
}
if (data instanceof ClobImpl) {
BlobImpl impl = ((ClobImpl) data).getWrappedBlob();
if (impl.getEnclosing() == this && impl.mLocator == locator) {
// Blob is ours and locator is the same, so nothing to do.
return;
}
}
try {
setClobValue(locator, data.openReader(0, 0));
} catch (FetchException e) {
throw e.toPersistException();
}
} | java | public void setClobValue(long locator, Clob data) throws PersistException, IOException {
if (data == null) {
deleteLob(locator);
return;
}
if (locator == 0) {
throw new IllegalArgumentException("Cannot use locator zero");
}
if (data instanceof ClobImpl) {
BlobImpl impl = ((ClobImpl) data).getWrappedBlob();
if (impl.getEnclosing() == this && impl.mLocator == locator) {
// Blob is ours and locator is the same, so nothing to do.
return;
}
}
try {
setClobValue(locator, data.openReader(0, 0));
} catch (FetchException e) {
throw e.toPersistException();
}
} | [
"public",
"void",
"setClobValue",
"(",
"long",
"locator",
",",
"Clob",
"data",
")",
"throws",
"PersistException",
",",
"IOException",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"deleteLob",
"(",
"locator",
")",
";",
"return",
";",
"}",
"if",
"(",
... | Stores a value into a Clob, replacing anything that was there
before. Passing null deletes the Clob, which is a convenience for
auto-generated code that may call this method.
@param locator lob locator as created by createNewClob
@param data source of data for Clob, which may be null to delete
@throws IllegalArgumentException if locator is zero | [
"Stores",
"a",
"value",
"into",
"a",
"Clob",
"replacing",
"anything",
"that",
"was",
"there",
"before",
".",
"Passing",
"null",
"deletes",
"the",
"Clob",
"which",
"is",
"a",
"convenience",
"for",
"auto",
"-",
"generated",
"code",
"that",
"may",
"call",
"th... | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/spi/LobEngine.java#L333-L356 |
amaembo/streamex | src/main/java/one/util/streamex/IntStreamEx.java | IntStreamEx.minByDouble | public OptionalInt minByDouble(IntToDoubleFunction keyExtractor) {
return collect(PrimitiveBox::new, (box, i) -> {
double key = keyExtractor.applyAsDouble(i);
if (!box.b || Double.compare(box.d, key) > 0) {
box.b = true;
box.d = key;
box.i = i;
}
}, PrimitiveBox.MIN_DOUBLE).asInt();
} | java | public OptionalInt minByDouble(IntToDoubleFunction keyExtractor) {
return collect(PrimitiveBox::new, (box, i) -> {
double key = keyExtractor.applyAsDouble(i);
if (!box.b || Double.compare(box.d, key) > 0) {
box.b = true;
box.d = key;
box.i = i;
}
}, PrimitiveBox.MIN_DOUBLE).asInt();
} | [
"public",
"OptionalInt",
"minByDouble",
"(",
"IntToDoubleFunction",
"keyExtractor",
")",
"{",
"return",
"collect",
"(",
"PrimitiveBox",
"::",
"new",
",",
"(",
"box",
",",
"i",
")",
"->",
"{",
"double",
"key",
"=",
"keyExtractor",
".",
"applyAsDouble",
"(",
"... | Returns the minimum element of this stream according to the provided key
extractor function.
<p>
This is a terminal operation.
@param keyExtractor a non-interfering, stateless function
@return an {@code OptionalInt} describing some element of this stream for
which the lowest value was returned by key extractor, or an empty
{@code OptionalInt} if the stream is empty
@since 0.1.2 | [
"Returns",
"the",
"minimum",
"element",
"of",
"this",
"stream",
"according",
"to",
"the",
"provided",
"key",
"extractor",
"function",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L1061-L1070 |
tweea/matrixjavalib-main-web | src/main/java/net/matrix/web/html/HTMLs.java | HTMLs.fitToLength | public static String fitToLength(final String html, final int length) {
if (html == null) {
return StringUtils.repeat(SPACE, length);
}
int len = html.length();
if (len >= length) {
return html;
}
StringBuilder sb = new StringBuilder();
sb.append(html);
for (int i = 0; i < length - len; i++) {
sb.append(SPACE);
}
return sb.toString();
} | java | public static String fitToLength(final String html, final int length) {
if (html == null) {
return StringUtils.repeat(SPACE, length);
}
int len = html.length();
if (len >= length) {
return html;
}
StringBuilder sb = new StringBuilder();
sb.append(html);
for (int i = 0; i < length - len; i++) {
sb.append(SPACE);
}
return sb.toString();
} | [
"public",
"static",
"String",
"fitToLength",
"(",
"final",
"String",
"html",
",",
"final",
"int",
"length",
")",
"{",
"if",
"(",
"html",
"==",
"null",
")",
"{",
"return",
"StringUtils",
".",
"repeat",
"(",
"SPACE",
",",
"length",
")",
";",
"}",
"int",
... | 将 HTML 文本适配到指定长度。
@param html
HTML 文本
@param length
目标长度
@return 适配结果 | [
"将",
"HTML",
"文本适配到指定长度。"
] | train | https://github.com/tweea/matrixjavalib-main-web/blob/c3386e728e6f97ff3a3d2cd94769e82840b1266f/src/main/java/net/matrix/web/html/HTMLs.java#L33-L48 |
io7m/jaffirm | com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java | Postconditions.checkPostconditionsD | public static double checkPostconditionsD(
final double value,
final ContractDoubleConditionType... conditions)
throws PostconditionViolationException
{
final Violations violations = innerCheckAllDouble(value, conditions);
if (violations != null) {
throw failed(null, Double.valueOf(value), violations);
}
return value;
} | java | public static double checkPostconditionsD(
final double value,
final ContractDoubleConditionType... conditions)
throws PostconditionViolationException
{
final Violations violations = innerCheckAllDouble(value, conditions);
if (violations != null) {
throw failed(null, Double.valueOf(value), violations);
}
return value;
} | [
"public",
"static",
"double",
"checkPostconditionsD",
"(",
"final",
"double",
"value",
",",
"final",
"ContractDoubleConditionType",
"...",
"conditions",
")",
"throws",
"PostconditionViolationException",
"{",
"final",
"Violations",
"violations",
"=",
"innerCheckAllDouble",
... | A {@code double} specialized version of {@link #checkPostconditions(Object,
ContractConditionType[])}
@param value The value
@param conditions The conditions the value must obey
@return value
@throws PostconditionViolationException If any of the conditions are false | [
"A",
"{",
"@code",
"double",
"}",
"specialized",
"version",
"of",
"{",
"@link",
"#checkPostconditions",
"(",
"Object",
"ContractConditionType",
"[]",
")",
"}"
] | train | https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java#L146-L156 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/TranslatorTypes.java | TranslatorTypes.createTranslator | public static DPTXlator createTranslator(int mainNumber, String dptID)
throws KNXException
{
try {
final int main = getMainNumber(mainNumber, dptID);
final MainType type = (MainType) map.get(new Integer(main));
if (type != null)
return type.createTranslator(dptID);
}
catch (final NumberFormatException e) {}
throw new KNXException("main number not found for " + dptID);
} | java | public static DPTXlator createTranslator(int mainNumber, String dptID)
throws KNXException
{
try {
final int main = getMainNumber(mainNumber, dptID);
final MainType type = (MainType) map.get(new Integer(main));
if (type != null)
return type.createTranslator(dptID);
}
catch (final NumberFormatException e) {}
throw new KNXException("main number not found for " + dptID);
} | [
"public",
"static",
"DPTXlator",
"createTranslator",
"(",
"int",
"mainNumber",
",",
"String",
"dptID",
")",
"throws",
"KNXException",
"{",
"try",
"{",
"final",
"int",
"main",
"=",
"getMainNumber",
"(",
"mainNumber",
",",
"dptID",
")",
";",
"final",
"MainType",... | Creates a DPT translator for the given datapoint type ID.
<p>
The translation behavior of a DPT translator instance is uniquely defined by the
supplied datapoint type ID.
<p>
If the <code>dptID</code> argument is built up the recommended way, that is "<i>main
number</i>.<i>sub number</i>", the <code>mainNumber</code> argument might be
left 0 to use the datapoint type ID only.<br>
Note, that we don't enforce any particular or standardized format on the dptID
structure, so using a different formatted dptID solely without main number argument
results in undefined behavior.
@param mainNumber data type main number, number >= 0; use 0 to infer translator
type from <code>dptID</code> argument only
@param dptID datapoint type ID for selecting a particular kind of value translation
@return the new {@link DPTXlator} object
@throws KNXException on main type not found or creation failed (refer to
{@link MainType#createTranslator(String)}) | [
"Creates",
"a",
"DPT",
"translator",
"for",
"the",
"given",
"datapoint",
"type",
"ID",
".",
"<p",
">",
"The",
"translation",
"behavior",
"of",
"a",
"DPT",
"translator",
"instance",
"is",
"uniquely",
"defined",
"by",
"the",
"supplied",
"datapoint",
"type",
"I... | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/TranslatorTypes.java#L460-L471 |
joelittlejohn/jsonschema2pojo | jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/PropertiesRule.java | PropertiesRule.apply | @Override
public JDefinedClass apply(String nodeName, JsonNode node, JsonNode parent, JDefinedClass jclass, Schema schema) {
if (node == null) {
node = JsonNodeFactory.instance.objectNode();
}
for (Iterator<String> properties = node.fieldNames(); properties.hasNext(); ) {
String property = properties.next();
ruleFactory.getPropertyRule().apply(property, node.get(property), node, jclass, schema);
}
if (ruleFactory.getGenerationConfig().isGenerateBuilders() && !jclass._extends().name().equals("Object")) {
addOverrideBuilders(jclass, jclass.owner()._getClass(jclass._extends().fullName()));
}
ruleFactory.getAnnotator().propertyOrder(jclass, node);
return jclass;
} | java | @Override
public JDefinedClass apply(String nodeName, JsonNode node, JsonNode parent, JDefinedClass jclass, Schema schema) {
if (node == null) {
node = JsonNodeFactory.instance.objectNode();
}
for (Iterator<String> properties = node.fieldNames(); properties.hasNext(); ) {
String property = properties.next();
ruleFactory.getPropertyRule().apply(property, node.get(property), node, jclass, schema);
}
if (ruleFactory.getGenerationConfig().isGenerateBuilders() && !jclass._extends().name().equals("Object")) {
addOverrideBuilders(jclass, jclass.owner()._getClass(jclass._extends().fullName()));
}
ruleFactory.getAnnotator().propertyOrder(jclass, node);
return jclass;
} | [
"@",
"Override",
"public",
"JDefinedClass",
"apply",
"(",
"String",
"nodeName",
",",
"JsonNode",
"node",
",",
"JsonNode",
"parent",
",",
"JDefinedClass",
"jclass",
",",
"Schema",
"schema",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"node",
"=",
... | Applies this schema rule to take the required code generation steps.
<p>
For each property present within the properties node, this rule will
invoke the 'property' rule provided by the given schema mapper.
@param nodeName
the name of the node for which properties are being added
@param node
the properties node, containing property names and their
definition
@param jclass
the Java type which will have the given properties added
@return the given jclass | [
"Applies",
"this",
"schema",
"rule",
"to",
"take",
"the",
"required",
"code",
"generation",
"steps",
".",
"<p",
">",
"For",
"each",
"property",
"present",
"within",
"the",
"properties",
"node",
"this",
"rule",
"will",
"invoke",
"the",
"property",
"rule",
"pr... | train | https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/PropertiesRule.java#L61-L80 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java | StyleCache.setFeatureStyle | public boolean setFeatureStyle(PolygonOptions polygonOptions, FeatureStyle featureStyle) {
return StyleUtils.setFeatureStyle(polygonOptions, featureStyle, density);
} | java | public boolean setFeatureStyle(PolygonOptions polygonOptions, FeatureStyle featureStyle) {
return StyleUtils.setFeatureStyle(polygonOptions, featureStyle, density);
} | [
"public",
"boolean",
"setFeatureStyle",
"(",
"PolygonOptions",
"polygonOptions",
",",
"FeatureStyle",
"featureStyle",
")",
"{",
"return",
"StyleUtils",
".",
"setFeatureStyle",
"(",
"polygonOptions",
",",
"featureStyle",
",",
"density",
")",
";",
"}"
] | Set the feature style into the polygon options
@param polygonOptions polygon options
@param featureStyle feature style
@return true if style was set into the polygon options | [
"Set",
"the",
"feature",
"style",
"into",
"the",
"polygon",
"options"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java#L313-L315 |
Alluxio/alluxio | core/server/common/src/main/java/alluxio/cli/validation/Utils.java | Utils.isMountingPoint | public static boolean isMountingPoint(String path, String[] fsTypes) throws IOException {
List<UnixMountInfo> infoList = ShellUtils.getUnixMountInfo();
for (UnixMountInfo info : infoList) {
Optional<String> mountPoint = info.getMountPoint();
Optional<String> fsType = info.getFsType();
if (mountPoint.isPresent() && mountPoint.get().equals(path) && fsType.isPresent()) {
for (String expectedType : fsTypes) {
if (fsType.get().equalsIgnoreCase(expectedType)) {
return true;
}
}
}
}
return false;
} | java | public static boolean isMountingPoint(String path, String[] fsTypes) throws IOException {
List<UnixMountInfo> infoList = ShellUtils.getUnixMountInfo();
for (UnixMountInfo info : infoList) {
Optional<String> mountPoint = info.getMountPoint();
Optional<String> fsType = info.getFsType();
if (mountPoint.isPresent() && mountPoint.get().equals(path) && fsType.isPresent()) {
for (String expectedType : fsTypes) {
if (fsType.get().equalsIgnoreCase(expectedType)) {
return true;
}
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"isMountingPoint",
"(",
"String",
"path",
",",
"String",
"[",
"]",
"fsTypes",
")",
"throws",
"IOException",
"{",
"List",
"<",
"UnixMountInfo",
">",
"infoList",
"=",
"ShellUtils",
".",
"getUnixMountInfo",
"(",
")",
";",
"for",
"... | Checks whether a path is the mounting point of a RAM disk volume.
@param path a string represents the path to be checked
@param fsTypes an array of strings represents expected file system type
@return true if the path is the mounting point of volume with one of the given fsTypes,
false otherwise
@throws IOException if the function fails to get the mount information of the system | [
"Checks",
"whether",
"a",
"path",
"is",
"the",
"mounting",
"point",
"of",
"a",
"RAM",
"disk",
"volume",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/cli/validation/Utils.java#L115-L129 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ExceptionRule.java | ExceptionRule.getMatchedDepth | private int getMatchedDepth(String exceptionType, Throwable ex) {
Throwable t = ex.getCause();
if (t != null) {
return getMatchedDepth(exceptionType, t);
} else {
return getMatchedDepth(exceptionType, ex.getClass(), 0);
}
} | java | private int getMatchedDepth(String exceptionType, Throwable ex) {
Throwable t = ex.getCause();
if (t != null) {
return getMatchedDepth(exceptionType, t);
} else {
return getMatchedDepth(exceptionType, ex.getClass(), 0);
}
} | [
"private",
"int",
"getMatchedDepth",
"(",
"String",
"exceptionType",
",",
"Throwable",
"ex",
")",
"{",
"Throwable",
"t",
"=",
"ex",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"t",
"!=",
"null",
")",
"{",
"return",
"getMatchedDepth",
"(",
"exceptionType",
... | Returns the matched depth.
@param exceptionType the exception type
@param ex the throwable exception
@return the matched depth | [
"Returns",
"the",
"matched",
"depth",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ExceptionRule.java#L98-L105 |
raydac/java-comment-preprocessor | jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java | PreprocessorContext.setSharedResource | public void setSharedResource(@Nonnull final String name, @Nonnull final Object obj) {
assertNotNull("Name is null", name);
assertNotNull("Object is null", obj);
sharedResources.put(name, obj);
} | java | public void setSharedResource(@Nonnull final String name, @Nonnull final Object obj) {
assertNotNull("Name is null", name);
assertNotNull("Object is null", obj);
sharedResources.put(name, obj);
} | [
"public",
"void",
"setSharedResource",
"(",
"@",
"Nonnull",
"final",
"String",
"name",
",",
"@",
"Nonnull",
"final",
"Object",
"obj",
")",
"{",
"assertNotNull",
"(",
"\"Name is null\"",
",",
"name",
")",
";",
"assertNotNull",
"(",
"\"Object is null\"",
",",
"o... | Set a shared source, it is an object saved into the inside map for a name
@param name the name for the saved project, must not be null
@param obj the object to be saved in, must not be null | [
"Set",
"a",
"shared",
"source",
"it",
"is",
"an",
"object",
"saved",
"into",
"the",
"inside",
"map",
"for",
"a",
"name"
] | train | https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java#L332-L337 |
forge/core | projects/api/src/main/java/org/jboss/forge/addon/projects/ui/AbstractProjectCommand.java | AbstractProjectCommand.filterValueChoicesFromStack | protected <T extends ProjectFacet> boolean filterValueChoicesFromStack(Project project, UISelectOne<T> select)
{
boolean result = true;
Optional<Stack> stackOptional = project.getStack();
// Filtering only supported facets
if (stackOptional.isPresent())
{
Stack stack = stackOptional.get();
Iterable<T> valueChoices = select.getValueChoices();
Set<T> filter = stack.filter(select.getValueType(), valueChoices);
select.setValueChoices(filter);
if (filter.size() == 1)
{
select.setDefaultValue(filter.iterator().next());
result = false;
}
else if (filter.size() == 0)
{
result = false;
}
// FIXME: JBIDE-21584: Contains return false because of proxy class
// else if (!filter.contains(select.getValue()))
// {
// select.setDefaultValue((T) null);
// }
}
return result;
} | java | protected <T extends ProjectFacet> boolean filterValueChoicesFromStack(Project project, UISelectOne<T> select)
{
boolean result = true;
Optional<Stack> stackOptional = project.getStack();
// Filtering only supported facets
if (stackOptional.isPresent())
{
Stack stack = stackOptional.get();
Iterable<T> valueChoices = select.getValueChoices();
Set<T> filter = stack.filter(select.getValueType(), valueChoices);
select.setValueChoices(filter);
if (filter.size() == 1)
{
select.setDefaultValue(filter.iterator().next());
result = false;
}
else if (filter.size() == 0)
{
result = false;
}
// FIXME: JBIDE-21584: Contains return false because of proxy class
// else if (!filter.contains(select.getValue()))
// {
// select.setDefaultValue((T) null);
// }
}
return result;
} | [
"protected",
"<",
"T",
"extends",
"ProjectFacet",
">",
"boolean",
"filterValueChoicesFromStack",
"(",
"Project",
"project",
",",
"UISelectOne",
"<",
"T",
">",
"select",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"Optional",
"<",
"Stack",
">",
"stackOptio... | Filters the given value choices according the current enabled stack
@param select the {@link SelectComponent} containing the value choices to be filtered
@return <code>true</code> if it should be displayed in the UI | [
"Filters",
"the",
"given",
"value",
"choices",
"according",
"the",
"current",
"enabled",
"stack"
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/projects/api/src/main/java/org/jboss/forge/addon/projects/ui/AbstractProjectCommand.java#L102-L129 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/PeriodFormatterBuilder.java | PeriodFormatterBuilder.appendPrefix | private PeriodFormatterBuilder appendPrefix(PeriodFieldAffix prefix) {
if (prefix == null) {
throw new IllegalArgumentException();
}
if (iPrefix != null) {
prefix = new CompositeAffix(iPrefix, prefix);
}
iPrefix = prefix;
return this;
} | java | private PeriodFormatterBuilder appendPrefix(PeriodFieldAffix prefix) {
if (prefix == null) {
throw new IllegalArgumentException();
}
if (iPrefix != null) {
prefix = new CompositeAffix(iPrefix, prefix);
}
iPrefix = prefix;
return this;
} | [
"private",
"PeriodFormatterBuilder",
"appendPrefix",
"(",
"PeriodFieldAffix",
"prefix",
")",
"{",
"if",
"(",
"prefix",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"if",
"(",
"iPrefix",
"!=",
"null",
")",
"{",
"pref... | Append a field prefix which applies only to the next appended field. If
the field is not printed, neither is the prefix.
@param prefix custom prefix
@return this PeriodFormatterBuilder
@see #appendSuffix | [
"Append",
"a",
"field",
"prefix",
"which",
"applies",
"only",
"to",
"the",
"next",
"appended",
"field",
".",
"If",
"the",
"field",
"is",
"not",
"printed",
"neither",
"is",
"the",
"prefix",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/PeriodFormatterBuilder.java#L432-L441 |
geomajas/geomajas-project-client-gwt2 | common-gwt/command/src/main/java/org/geomajas/gwt/client/util/Log.java | Log.logError | public static void logError(String message, Throwable t) {
logError(message + SEP + getMessage(t));
} | java | public static void logError(String message, Throwable t) {
logError(message + SEP + getMessage(t));
} | [
"public",
"static",
"void",
"logError",
"(",
"String",
"message",
",",
"Throwable",
"t",
")",
"{",
"logError",
"(",
"message",
"+",
"SEP",
"+",
"getMessage",
"(",
"t",
")",
")",
";",
"}"
] | Error logging with cause.
@param message message
@param t cause | [
"Error",
"logging",
"with",
"cause",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/Log.java#L129-L131 |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/PopularityStratifiedRecall.java | PopularityStratifiedRecall.getValueAt | @Override
public double getValueAt(final U user, final int at) {
if (userRecallAtCutoff.containsKey(at) && userRecallAtCutoff.get(at).containsKey(user)) {
return userRecallAtCutoff.get(at).get(user) / userTotalRecall.get(user);
}
return Double.NaN;
} | java | @Override
public double getValueAt(final U user, final int at) {
if (userRecallAtCutoff.containsKey(at) && userRecallAtCutoff.get(at).containsKey(user)) {
return userRecallAtCutoff.get(at).get(user) / userTotalRecall.get(user);
}
return Double.NaN;
} | [
"@",
"Override",
"public",
"double",
"getValueAt",
"(",
"final",
"U",
"user",
",",
"final",
"int",
"at",
")",
"{",
"if",
"(",
"userRecallAtCutoff",
".",
"containsKey",
"(",
"at",
")",
"&&",
"userRecallAtCutoff",
".",
"get",
"(",
"at",
")",
".",
"contains... | Method to return the recall value at a particular cutoff level for a
given user.
@param user the user
@param at cutoff level
@return the recall corresponding to the requested user at the cutoff
level | [
"Method",
"to",
"return",
"the",
"recall",
"value",
"at",
"a",
"particular",
"cutoff",
"level",
"for",
"a",
"given",
"user",
"."
] | train | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/PopularityStratifiedRecall.java#L224-L230 |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.queryColumn | public static <T> List<T> queryColumn(
String sql, String columnName, Class<T> columnType, Object[] params) throws YankSQLException {
return queryColumn(YankPoolManager.DEFAULT_POOL_NAME, sql, columnName, columnType, params);
} | java | public static <T> List<T> queryColumn(
String sql, String columnName, Class<T> columnType, Object[] params) throws YankSQLException {
return queryColumn(YankPoolManager.DEFAULT_POOL_NAME, sql, columnName, columnType, params);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"queryColumn",
"(",
"String",
"sql",
",",
"String",
"columnName",
",",
"Class",
"<",
"T",
">",
"columnType",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"YankSQLException",
"{",
"return",
... | Return a List of Objects from a single table column given an SQL statement using the default
connection pool.
@param <T>
@param sql The SQL statement
@param params The replacement parameters
@param columnType The Class of the desired return Objects matching the table
@return The Column as a List | [
"Return",
"a",
"List",
"of",
"Objects",
"from",
"a",
"single",
"table",
"column",
"given",
"an",
"SQL",
"statement",
"using",
"the",
"default",
"connection",
"pool",
"."
] | train | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L565-L569 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java | RPUtils.scanForLeaves | public static void scanForLeaves(List<RPNode> nodes,RPTree scan) {
scanForLeaves(nodes,scan.getRoot());
} | java | public static void scanForLeaves(List<RPNode> nodes,RPTree scan) {
scanForLeaves(nodes,scan.getRoot());
} | [
"public",
"static",
"void",
"scanForLeaves",
"(",
"List",
"<",
"RPNode",
">",
"nodes",
",",
"RPTree",
"scan",
")",
"{",
"scanForLeaves",
"(",
"nodes",
",",
"scan",
".",
"getRoot",
"(",
")",
")",
";",
"}"
] | Scan for leaves accumulating
the nodes in the passed in list
@param nodes the nodes so far
@param scan the tree to scan | [
"Scan",
"for",
"leaves",
"accumulating",
"the",
"nodes",
"in",
"the",
"passed",
"in",
"list"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java#L451-L453 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationMetadataUpdater.java | OperationMetadataUpdater.fromMetadata | private <T> T fromMetadata(Function<ContainerMetadata, T> getter) {
ContainerMetadataUpdateTransaction txn = getActiveTransaction();
return getter.apply(txn == null ? this.metadata : txn);
} | java | private <T> T fromMetadata(Function<ContainerMetadata, T> getter) {
ContainerMetadataUpdateTransaction txn = getActiveTransaction();
return getter.apply(txn == null ? this.metadata : txn);
} | [
"private",
"<",
"T",
">",
"T",
"fromMetadata",
"(",
"Function",
"<",
"ContainerMetadata",
",",
"T",
">",
"getter",
")",
"{",
"ContainerMetadataUpdateTransaction",
"txn",
"=",
"getActiveTransaction",
"(",
")",
";",
"return",
"getter",
".",
"apply",
"(",
"txn",
... | Returns the result of the given function applied either to the current UpdateTransaction (if any), or the base metadata,
if no UpdateTransaction exists.
@param getter The Function to apply.
@param <T> Result type.
@return The result of the given Function. | [
"Returns",
"the",
"result",
"of",
"the",
"given",
"function",
"applied",
"either",
"to",
"the",
"current",
"UpdateTransaction",
"(",
"if",
"any",
")",
"or",
"the",
"base",
"metadata",
"if",
"no",
"UpdateTransaction",
"exists",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationMetadataUpdater.java#L251-L254 |
xvik/generics-resolver | src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java | TypeToStringUtils.toStringConstructor | public static String toStringConstructor(final Constructor constructor, final Map<String, Type> generics) {
return String.format("%s(%s)",
constructor.getDeclaringClass().getSimpleName(),
toStringTypes(constructor.getGenericParameterTypes(), generics));
} | java | public static String toStringConstructor(final Constructor constructor, final Map<String, Type> generics) {
return String.format("%s(%s)",
constructor.getDeclaringClass().getSimpleName(),
toStringTypes(constructor.getGenericParameterTypes(), generics));
} | [
"public",
"static",
"String",
"toStringConstructor",
"(",
"final",
"Constructor",
"constructor",
",",
"final",
"Map",
"<",
"String",
",",
"Type",
">",
"generics",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"%s(%s)\"",
",",
"constructor",
".",
"getDecl... | <pre>{@code class B extends A<Long> {}
class A<T> {
A(T arg);
}
Constructor method = A.class.getConstructor(Object.class);
Map<String, Type> generics = (context of B).method().visibleGenericsMap();
TypeToStringUtils.toStringConstructor(constructor, generics) == "A(Long)"
}</pre>.
@param constructor constructor
@param generics required generics (type generics and possible constructor generics)
@return constructor string with replaced generic variables
@see ru.vyarus.java.generics.resolver.util.map.PrintableGenericsMap to print not known generic names
@see ru.vyarus.java.generics.resolver.util.map.IgnoreGenericsMap to print Object instead of not known generic | [
"<pre",
">",
"{",
"@code",
"class",
"B",
"extends",
"A<Long",
">",
"{}",
"class",
"A<T",
">",
"{",
"A",
"(",
"T",
"arg",
")",
";",
"}"
] | train | https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java#L214-L218 |
lucmoreau/ProvToolbox | prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java | ProvFactory.newWasInvalidatedBy | public WasInvalidatedBy newWasInvalidatedBy(QualifiedName id, QualifiedName entity, QualifiedName activity) {
WasInvalidatedBy res = of.createWasInvalidatedBy();
res.setId(id);
res.setEntity(entity);
res.setActivity(activity);
return res;
} | java | public WasInvalidatedBy newWasInvalidatedBy(QualifiedName id, QualifiedName entity, QualifiedName activity) {
WasInvalidatedBy res = of.createWasInvalidatedBy();
res.setId(id);
res.setEntity(entity);
res.setActivity(activity);
return res;
} | [
"public",
"WasInvalidatedBy",
"newWasInvalidatedBy",
"(",
"QualifiedName",
"id",
",",
"QualifiedName",
"entity",
",",
"QualifiedName",
"activity",
")",
"{",
"WasInvalidatedBy",
"res",
"=",
"of",
".",
"createWasInvalidatedBy",
"(",
")",
";",
"res",
".",
"setId",
"(... | A factory method to create an instance of an invalidation {@link WasInvalidatedBy}
@param id an optional identifier for a usage
@param entity an identifier for the created <a href="http://www.w3.org/TR/prov-dm/#invalidation.entity">entity</a>
@param activity an optional identifier for the <a href="http://www.w3.org/TR/prov-dm/#invalidation.activity">activity</a> that creates the entity
@return an instance of {@link WasInvalidatedBy} | [
"A",
"factory",
"method",
"to",
"create",
"an",
"instance",
"of",
"an",
"invalidation",
"{"
] | train | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L1459-L1465 |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/CWC_LongestLine.java | CWC_LongestLine.add | public CWC_LongestLine add(final int minWidth, final int maxWidth) {
this.minWidths = ArrayUtils.add(this.minWidths, minWidth);
this.maxWidths = ArrayUtils.add(this.maxWidths, maxWidth);
return this;
} | java | public CWC_LongestLine add(final int minWidth, final int maxWidth) {
this.minWidths = ArrayUtils.add(this.minWidths, minWidth);
this.maxWidths = ArrayUtils.add(this.maxWidths, maxWidth);
return this;
} | [
"public",
"CWC_LongestLine",
"add",
"(",
"final",
"int",
"minWidth",
",",
"final",
"int",
"maxWidth",
")",
"{",
"this",
".",
"minWidths",
"=",
"ArrayUtils",
".",
"add",
"(",
"this",
".",
"minWidths",
",",
"minWidth",
")",
";",
"this",
".",
"maxWidths",
"... | Creates a new width object.
@param minWidth minimum column width as number of characters
@param maxWidth maximum column width as number of characters
@return self to allow for chaining | [
"Creates",
"a",
"new",
"width",
"object",
"."
] | train | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/CWC_LongestLine.java#L51-L55 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_rsva_serviceName_allowedRateCodes_GET | public ArrayList<OvhRateCodeInformation> billingAccount_rsva_serviceName_allowedRateCodes_GET(String billingAccount, String serviceName) throws IOException {
String qPath = "/telephony/{billingAccount}/rsva/{serviceName}/allowedRateCodes";
StringBuilder sb = path(qPath, billingAccount, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t18);
} | java | public ArrayList<OvhRateCodeInformation> billingAccount_rsva_serviceName_allowedRateCodes_GET(String billingAccount, String serviceName) throws IOException {
String qPath = "/telephony/{billingAccount}/rsva/{serviceName}/allowedRateCodes";
StringBuilder sb = path(qPath, billingAccount, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t18);
} | [
"public",
"ArrayList",
"<",
"OvhRateCodeInformation",
">",
"billingAccount_rsva_serviceName_allowedRateCodes_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/rsva/{serv... | Compatible rate codes related to this value added service
REST: GET /telephony/{billingAccount}/rsva/{serviceName}/allowedRateCodes
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Compatible",
"rate",
"codes",
"related",
"to",
"this",
"value",
"added",
"service"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L6008-L6013 |
crawljax/crawljax | core/src/main/java/com/crawljax/condition/eventablecondition/EventableConditionChecker.java | EventableConditionChecker.checkXpathStartsWithXpathEventableCondition | public boolean checkXpathStartsWithXpathEventableCondition(Document dom,
EventableCondition eventableCondition, String xpath) throws XPathExpressionException {
if (eventableCondition == null || Strings
.isNullOrEmpty(eventableCondition.getInXPath())) {
throw new CrawljaxException("Eventable has no XPath condition");
}
List<String> expressions =
XPathHelper.getXpathForXPathExpressions(dom, eventableCondition.getInXPath());
return checkXPathUnderXPaths(xpath, expressions);
} | java | public boolean checkXpathStartsWithXpathEventableCondition(Document dom,
EventableCondition eventableCondition, String xpath) throws XPathExpressionException {
if (eventableCondition == null || Strings
.isNullOrEmpty(eventableCondition.getInXPath())) {
throw new CrawljaxException("Eventable has no XPath condition");
}
List<String> expressions =
XPathHelper.getXpathForXPathExpressions(dom, eventableCondition.getInXPath());
return checkXPathUnderXPaths(xpath, expressions);
} | [
"public",
"boolean",
"checkXpathStartsWithXpathEventableCondition",
"(",
"Document",
"dom",
",",
"EventableCondition",
"eventableCondition",
",",
"String",
"xpath",
")",
"throws",
"XPathExpressionException",
"{",
"if",
"(",
"eventableCondition",
"==",
"null",
"||",
"Strin... | Checks whether an XPath expression starts with an XPath eventable condition.
@param dom The DOM String.
@param eventableCondition The eventable condition.
@param xpath The XPath.
@return boolean whether xpath starts with xpath location of eventable condition xpath
condition
@throws XPathExpressionException
@throws CrawljaxException when eventableCondition is null or its inXPath has not been set | [
"Checks",
"whether",
"an",
"XPath",
"expression",
"starts",
"with",
"an",
"XPath",
"eventable",
"condition",
"."
] | train | https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/condition/eventablecondition/EventableConditionChecker.java#L66-L76 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Color.java | Color.scaleCopy | public Color scaleCopy(float value) {
Color copy = new Color(r,g,b,a);
copy.r *= value;
copy.g *= value;
copy.b *= value;
copy.a *= value;
return copy;
} | java | public Color scaleCopy(float value) {
Color copy = new Color(r,g,b,a);
copy.r *= value;
copy.g *= value;
copy.b *= value;
copy.a *= value;
return copy;
} | [
"public",
"Color",
"scaleCopy",
"(",
"float",
"value",
")",
"{",
"Color",
"copy",
"=",
"new",
"Color",
"(",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
";",
"copy",
".",
"r",
"*=",
"value",
";",
"copy",
".",
"g",
"*=",
"value",
";",
"copy",
".",
... | Scale the components of the colour by the given value
@param value The value to scale by
@return The copy which has been scaled | [
"Scale",
"the",
"components",
"of",
"the",
"colour",
"by",
"the",
"given",
"value"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Color.java#L383-L391 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/file/HttpFileServiceBuilder.java | HttpFileServiceBuilder.cacheControl | public HttpFileServiceBuilder cacheControl(CharSequence cacheControl) {
requireNonNull(cacheControl, "cacheControl");
return setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl);
} | java | public HttpFileServiceBuilder cacheControl(CharSequence cacheControl) {
requireNonNull(cacheControl, "cacheControl");
return setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl);
} | [
"public",
"HttpFileServiceBuilder",
"cacheControl",
"(",
"CharSequence",
"cacheControl",
")",
"{",
"requireNonNull",
"(",
"cacheControl",
",",
"\"cacheControl\"",
")",
";",
"return",
"setHeader",
"(",
"HttpHeaderNames",
".",
"CACHE_CONTROL",
",",
"cacheControl",
")",
... | Sets the {@code "cache-control"} header. This method is a shortcut of:
<pre>{@code
builder.setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl);
}</pre> | [
"Sets",
"the",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/file/HttpFileServiceBuilder.java#L217-L220 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/instance/NodeExtensionFactory.java | NodeExtensionFactory.create | public static NodeExtension create(Node node, List<String> extensionPriorityList) {
try {
ClassLoader classLoader = node.getConfigClassLoader();
Class<NodeExtension> chosenExtension = null;
int chosenPriority = Integer.MAX_VALUE;
for (Iterator<Class<NodeExtension>> iter =
ServiceLoader.classIterator(NodeExtension.class, NODE_EXTENSION_FACTORY_ID, classLoader);
iter.hasNext();
) {
Class<NodeExtension> currExt = iter.next();
warnIfDuplicate(currExt);
int currPriority = extensionPriorityList.indexOf(currExt.getName());
if (currPriority == -1) {
continue;
}
if (currPriority < chosenPriority) {
chosenPriority = currPriority;
chosenExtension = currExt;
}
}
if (chosenExtension == null) {
throw new HazelcastException("ServiceLoader didn't find any services registered under "
+ NODE_EXTENSION_FACTORY_ID);
}
return chosenExtension.getConstructor(Node.class).newInstance(node);
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
} | java | public static NodeExtension create(Node node, List<String> extensionPriorityList) {
try {
ClassLoader classLoader = node.getConfigClassLoader();
Class<NodeExtension> chosenExtension = null;
int chosenPriority = Integer.MAX_VALUE;
for (Iterator<Class<NodeExtension>> iter =
ServiceLoader.classIterator(NodeExtension.class, NODE_EXTENSION_FACTORY_ID, classLoader);
iter.hasNext();
) {
Class<NodeExtension> currExt = iter.next();
warnIfDuplicate(currExt);
int currPriority = extensionPriorityList.indexOf(currExt.getName());
if (currPriority == -1) {
continue;
}
if (currPriority < chosenPriority) {
chosenPriority = currPriority;
chosenExtension = currExt;
}
}
if (chosenExtension == null) {
throw new HazelcastException("ServiceLoader didn't find any services registered under "
+ NODE_EXTENSION_FACTORY_ID);
}
return chosenExtension.getConstructor(Node.class).newInstance(node);
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
} | [
"public",
"static",
"NodeExtension",
"create",
"(",
"Node",
"node",
",",
"List",
"<",
"String",
">",
"extensionPriorityList",
")",
"{",
"try",
"{",
"ClassLoader",
"classLoader",
"=",
"node",
".",
"getConfigClassLoader",
"(",
")",
";",
"Class",
"<",
"NodeExtens... | Uses the Hazelcast ServiceLoader to discover all registered {@link
NodeExtension} classes and identify the one to instantiate and use as
the provided {@code node}'s extension. It chooses the class based on
the provided priority list of class names, these are the rules:
<ol><li>
A class's priority is its zero-based index in the list.
</li><li>
Lower number means higher priority.
</li><li>
A class that doesn't appear in the list doesn't qualify for selection.
</li></ol>
<p>
The dynamic selection of the node extension allows Hazelcast
Enterprise's JAR to be swapped in for the core Hazelcast JAR with no
changes to user's code or configuration. Hazelcast core code can call
this method with a priority list naming both the default and the
enterprise node extension and it will automatically prefer the
Enterprise one when present.
<p>
The explicit priority list is necessary because a Hazelcast Jet JAR
contains both the default node extension and the Jet node extension,
but the one to choose depends on whether the user is requesting to
start an IMDG or a Jet instance.
@param node Hazelcast node whose extension this method must provide
@param extensionPriorityList priority list of fully qualified extension class names
@return the selected node extension | [
"Uses",
"the",
"Hazelcast",
"ServiceLoader",
"to",
"discover",
"all",
"registered",
"{",
"@link",
"NodeExtension",
"}",
"classes",
"and",
"identify",
"the",
"one",
"to",
"instantiate",
"and",
"use",
"as",
"the",
"provided",
"{",
"@code",
"node",
"}",
"s",
"e... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/instance/NodeExtensionFactory.java#L65-L93 |
susom/database | src/main/java/com/github/susom/database/DatabaseProviderVertx.java | DatabaseProviderVertx.fromPool | @CheckReturnValue
public static Builder fromPool(Vertx vertx, Pool pool) {
WorkerExecutor executor = vertx.createSharedWorkerExecutor("DbWorker-" + poolNameCounter.getAndAdd(1), pool.size);
return new BuilderImpl(executor, () -> {
try {
executor.close();
} catch (Exception e) {
log.warn("Problem closing database worker executor", e);
}
if (pool.poolShutdown != null) {
pool.poolShutdown.close();
}
}, () -> {
try {
return pool.dataSource.getConnection();
} catch (Exception e) {
throw new DatabaseException("Unable to obtain a connection from DriverManager", e);
}
}, new OptionsDefault(pool.flavor));
} | java | @CheckReturnValue
public static Builder fromPool(Vertx vertx, Pool pool) {
WorkerExecutor executor = vertx.createSharedWorkerExecutor("DbWorker-" + poolNameCounter.getAndAdd(1), pool.size);
return new BuilderImpl(executor, () -> {
try {
executor.close();
} catch (Exception e) {
log.warn("Problem closing database worker executor", e);
}
if (pool.poolShutdown != null) {
pool.poolShutdown.close();
}
}, () -> {
try {
return pool.dataSource.getConnection();
} catch (Exception e) {
throw new DatabaseException("Unable to obtain a connection from DriverManager", e);
}
}, new OptionsDefault(pool.flavor));
} | [
"@",
"CheckReturnValue",
"public",
"static",
"Builder",
"fromPool",
"(",
"Vertx",
"vertx",
",",
"Pool",
"pool",
")",
"{",
"WorkerExecutor",
"executor",
"=",
"vertx",
".",
"createSharedWorkerExecutor",
"(",
"\"DbWorker-\"",
"+",
"poolNameCounter",
".",
"getAndAdd",
... | Use an externally configured DataSource, Flavor, and optionally a shutdown hook.
The shutdown hook may be null if you don't want calls to Builder.close() to attempt
any shutdown. The DataSource and Flavor are mandatory. | [
"Use",
"an",
"externally",
"configured",
"DataSource",
"Flavor",
"and",
"optionally",
"a",
"shutdown",
"hook",
".",
"The",
"shutdown",
"hook",
"may",
"be",
"null",
"if",
"you",
"don",
"t",
"want",
"calls",
"to",
"Builder",
".",
"close",
"()",
"to",
"attemp... | train | https://github.com/susom/database/blob/25add9e08ad863712f9b5e319b6cb826f6f97640/src/main/java/com/github/susom/database/DatabaseProviderVertx.java#L111-L130 |
square/dagger | compiler/src/main/java/dagger/internal/codegen/Util.java | Util.typeToString | public static void typeToString(final TypeMirror type, final StringBuilder result,
final char innerClassSeparator) {
type.accept(new SimpleTypeVisitor6<Void, Void>() {
@Override public Void visitDeclared(DeclaredType declaredType, Void v) {
TypeElement typeElement = (TypeElement) declaredType.asElement();
rawTypeToString(result, typeElement, innerClassSeparator);
List<? extends TypeMirror> typeArguments = declaredType.getTypeArguments();
if (!typeArguments.isEmpty()) {
result.append("<");
for (int i = 0; i < typeArguments.size(); i++) {
if (i != 0) {
result.append(", ");
}
typeToString(typeArguments.get(i), result, innerClassSeparator);
}
result.append(">");
}
return null;
}
@Override public Void visitPrimitive(PrimitiveType primitiveType, Void v) {
result.append(box((PrimitiveType) type));
return null;
}
@Override public Void visitArray(ArrayType arrayType, Void v) {
TypeMirror type = arrayType.getComponentType();
if (type instanceof PrimitiveType) {
result.append(type.toString()); // Don't box, since this is an array.
} else {
typeToString(arrayType.getComponentType(), result, innerClassSeparator);
}
result.append("[]");
return null;
}
@Override public Void visitTypeVariable(TypeVariable typeVariable, Void v) {
result.append(typeVariable.asElement().getSimpleName());
return null;
}
@Override public Void visitError(ErrorType errorType, Void v) {
// Error type found, a type may not yet have been generated, but we need the type
// so we can generate the correct code in anticipation of the type being available
// to the compiler.
// Paramterized types which don't exist are returned as an error type whose name is "<any>"
if ("<any>".equals(errorType.toString())) {
throw new CodeGenerationIncompleteException(
"Type reported as <any> is likely a not-yet generated parameterized type.");
}
// TODO(cgruber): Figure out a strategy for non-FQCN cases.
result.append(errorType.toString());
return null;
}
@Override protected Void defaultAction(TypeMirror typeMirror, Void v) {
throw new UnsupportedOperationException(
"Unexpected TypeKind " + typeMirror.getKind() + " for " + typeMirror);
}
}, null);
} | java | public static void typeToString(final TypeMirror type, final StringBuilder result,
final char innerClassSeparator) {
type.accept(new SimpleTypeVisitor6<Void, Void>() {
@Override public Void visitDeclared(DeclaredType declaredType, Void v) {
TypeElement typeElement = (TypeElement) declaredType.asElement();
rawTypeToString(result, typeElement, innerClassSeparator);
List<? extends TypeMirror> typeArguments = declaredType.getTypeArguments();
if (!typeArguments.isEmpty()) {
result.append("<");
for (int i = 0; i < typeArguments.size(); i++) {
if (i != 0) {
result.append(", ");
}
typeToString(typeArguments.get(i), result, innerClassSeparator);
}
result.append(">");
}
return null;
}
@Override public Void visitPrimitive(PrimitiveType primitiveType, Void v) {
result.append(box((PrimitiveType) type));
return null;
}
@Override public Void visitArray(ArrayType arrayType, Void v) {
TypeMirror type = arrayType.getComponentType();
if (type instanceof PrimitiveType) {
result.append(type.toString()); // Don't box, since this is an array.
} else {
typeToString(arrayType.getComponentType(), result, innerClassSeparator);
}
result.append("[]");
return null;
}
@Override public Void visitTypeVariable(TypeVariable typeVariable, Void v) {
result.append(typeVariable.asElement().getSimpleName());
return null;
}
@Override public Void visitError(ErrorType errorType, Void v) {
// Error type found, a type may not yet have been generated, but we need the type
// so we can generate the correct code in anticipation of the type being available
// to the compiler.
// Paramterized types which don't exist are returned as an error type whose name is "<any>"
if ("<any>".equals(errorType.toString())) {
throw new CodeGenerationIncompleteException(
"Type reported as <any> is likely a not-yet generated parameterized type.");
}
// TODO(cgruber): Figure out a strategy for non-FQCN cases.
result.append(errorType.toString());
return null;
}
@Override protected Void defaultAction(TypeMirror typeMirror, Void v) {
throw new UnsupportedOperationException(
"Unexpected TypeKind " + typeMirror.getKind() + " for " + typeMirror);
}
}, null);
} | [
"public",
"static",
"void",
"typeToString",
"(",
"final",
"TypeMirror",
"type",
",",
"final",
"StringBuilder",
"result",
",",
"final",
"char",
"innerClassSeparator",
")",
"{",
"type",
".",
"accept",
"(",
"new",
"SimpleTypeVisitor6",
"<",
"Void",
",",
"Void",
"... | Appends a string for {@code type} to {@code result}. Primitive types are
always boxed.
@param innerClassSeparator either '.' or '$', which will appear in a
class name like "java.lang.Map.Entry" or "java.lang.Map$Entry".
Use '.' for references to existing types in code. Use '$' to define new
class names and for strings that will be used by runtime reflection. | [
"Appends",
"a",
"string",
"for",
"{",
"@code",
"type",
"}",
"to",
"{",
"@code",
"result",
"}",
".",
"Primitive",
"types",
"are",
"always",
"boxed",
"."
] | train | https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/compiler/src/main/java/dagger/internal/codegen/Util.java#L123-L179 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java | Text.getRelativeParent | public static String getRelativeParent(String path, int level)
{
int idx = path.length();
while (level > 0)
{
idx = path.lastIndexOf('/', idx - 1);
if (idx < 0)
{
return "";
}
level--;
}
return (idx == 0) ? "/" : path.substring(0, idx);
} | java | public static String getRelativeParent(String path, int level)
{
int idx = path.length();
while (level > 0)
{
idx = path.lastIndexOf('/', idx - 1);
if (idx < 0)
{
return "";
}
level--;
}
return (idx == 0) ? "/" : path.substring(0, idx);
} | [
"public",
"static",
"String",
"getRelativeParent",
"(",
"String",
"path",
",",
"int",
"level",
")",
"{",
"int",
"idx",
"=",
"path",
".",
"length",
"(",
")",
";",
"while",
"(",
"level",
">",
"0",
")",
"{",
"idx",
"=",
"path",
".",
"lastIndexOf",
"(",
... | Returns the n<sup>th</sup> relative parent of the path, where n=level.
<p>
Example:<br>
<code>
Text.getRelativeParent("/foo/bar/test", 1) == "/foo/bar"
</code>
@param path
the path of the page
@param level
the level of the parent
@return String relative parent | [
"Returns",
"the",
"n<sup",
">",
"th<",
"/",
"sup",
">",
"relative",
"parent",
"of",
"the",
"path",
"where",
"n",
"=",
"level",
".",
"<p",
">",
"Example",
":",
"<br",
">",
"<code",
">",
"Text",
".",
"getRelativeParent",
"(",
"/",
"foo",
"/",
"bar",
... | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L760-L773 |
iovation/launchkey-java | sdk/src/main/java/com/iovation/launchkey/sdk/crypto/JCECrypto.java | JCECrypto.getRSAPrivateKeyFromPEM | public static RSAPrivateKey getRSAPrivateKeyFromPEM(Provider provider, String pem) {
try {
KeyFactory keyFactory = KeyFactory.getInstance("RSA", provider);
return (RSAPrivateKey) keyFactory.generatePrivate(new PKCS8EncodedKeySpec(getKeyBytesFromPEM(pem)));
} catch (NoSuchAlgorithmException e) {
throw new IllegalArgumentException("Algorithm SHA256withRSA is not available", e);
} catch (InvalidKeySpecException e) {
throw new IllegalArgumentException("Invalid PEM provided", e);
}
} | java | public static RSAPrivateKey getRSAPrivateKeyFromPEM(Provider provider, String pem) {
try {
KeyFactory keyFactory = KeyFactory.getInstance("RSA", provider);
return (RSAPrivateKey) keyFactory.generatePrivate(new PKCS8EncodedKeySpec(getKeyBytesFromPEM(pem)));
} catch (NoSuchAlgorithmException e) {
throw new IllegalArgumentException("Algorithm SHA256withRSA is not available", e);
} catch (InvalidKeySpecException e) {
throw new IllegalArgumentException("Invalid PEM provided", e);
}
} | [
"public",
"static",
"RSAPrivateKey",
"getRSAPrivateKeyFromPEM",
"(",
"Provider",
"provider",
",",
"String",
"pem",
")",
"{",
"try",
"{",
"KeyFactory",
"keyFactory",
"=",
"KeyFactory",
".",
"getInstance",
"(",
"\"RSA\"",
",",
"provider",
")",
";",
"return",
"(",
... | Get an RSA private key utilizing the provided provider and PEM formatted string
@param provider Provider to generate the key
@param pem PEM formatted key string
@return RSA private key | [
"Get",
"an",
"RSA",
"private",
"key",
"utilizing",
"the",
"provided",
"provider",
"and",
"PEM",
"formatted",
"string"
] | train | https://github.com/iovation/launchkey-java/blob/ceecc70b9b04af07ddc14c57d4bcc933a4e0379c/sdk/src/main/java/com/iovation/launchkey/sdk/crypto/JCECrypto.java#L96-L105 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/util/FileUtils.java | FileUtils.copyFileToDirectory | public static void copyFileToDirectory(File srcFile, File destDir, boolean preserveFileDate) throws IOException {
if (destDir == null) {
throw new IllegalArgumentException("Destination must not be null");
}
if (destDir.exists() && destDir.isDirectory() == false) {
throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory");
}
copyFile(srcFile, new File(destDir, srcFile.getName()), preserveFileDate);
} | java | public static void copyFileToDirectory(File srcFile, File destDir, boolean preserveFileDate) throws IOException {
if (destDir == null) {
throw new IllegalArgumentException("Destination must not be null");
}
if (destDir.exists() && destDir.isDirectory() == false) {
throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory");
}
copyFile(srcFile, new File(destDir, srcFile.getName()), preserveFileDate);
} | [
"public",
"static",
"void",
"copyFileToDirectory",
"(",
"File",
"srcFile",
",",
"File",
"destDir",
",",
"boolean",
"preserveFileDate",
")",
"throws",
"IOException",
"{",
"if",
"(",
"destDir",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(... | Copies a file to a directory optionally preserving the file date.
<p>
This method copies the contents of the specified source file to a file of
the same name in the specified destination directory. The destination
directory is created if it does not exist. If the destination file
exists, then this method will overwrite it.
@param srcFile
an existing file to copy, must not be <code>null</code>
@param destDir
the directory to place the copy in, must not be
<code>null</code>
@param preserveFileDate
true if the file date of the copy should be the same as the
original
@throws NullPointerException
if source or destination is <code>null</code>
@throws IOException
if source or destination is invalid
@throws IOException
if an IO error occurs during copying
@see #copyFile(File, File, boolean)
@since Commons IO 1.3 | [
"Copies",
"a",
"file",
"to",
"a",
"directory",
"optionally",
"preserving",
"the",
"file",
"date",
".",
"<p",
">",
"This",
"method",
"copies",
"the",
"contents",
"of",
"the",
"specified",
"source",
"file",
"to",
"a",
"file",
"of",
"the",
"same",
"name",
"... | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/util/FileUtils.java#L130-L138 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/stats/Counters.java | Counters.addInPlace | public static <E> void addInPlace(Counter<E> target, Collection<E> arg) {
for (E key : arg) {
target.incrementCount(key, 1);
}
} | java | public static <E> void addInPlace(Counter<E> target, Collection<E> arg) {
for (E key : arg) {
target.incrementCount(key, 1);
}
} | [
"public",
"static",
"<",
"E",
">",
"void",
"addInPlace",
"(",
"Counter",
"<",
"E",
">",
"target",
",",
"Collection",
"<",
"E",
">",
"arg",
")",
"{",
"for",
"(",
"E",
"key",
":",
"arg",
")",
"{",
"target",
".",
"incrementCount",
"(",
"key",
",",
"... | Sets each value of target to be target[k]+
num-of-times-it-occurs-in-collection if the key is present in the arg
collection. | [
"Sets",
"each",
"value",
"of",
"target",
"to",
"be",
"target",
"[",
"k",
"]",
"+",
"num",
"-",
"of",
"-",
"times",
"-",
"it",
"-",
"occurs",
"-",
"in",
"-",
"collection",
"if",
"the",
"key",
"is",
"present",
"in",
"the",
"arg",
"collection",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L373-L377 |
tvesalainen/util | util/src/main/java/org/vesalainen/lang/Primitives.java | Primitives.parseUnsignedInt | public static final int parseUnsignedInt(CharSequence cs, int radix, int beginIndex, int endIndex)
{
check(cs, radix, NumberRanges.UnsignedIntRange, beginIndex, endIndex);
int end = endIndex;
int result = 0;
int index = beginIndex;
int cp = Character.codePointAt(cs, index);
if (cp == '+')
{
index++;
}
if (index >= end)
{
throw new NumberFormatException("unparsable number "+cs.subSequence(beginIndex, endIndex));
}
while (index < end)
{
result *= radix;
cp = Character.codePointAt(cs, index);
int digit = Character.digit(cp, radix);
if (digit == -1)
{
throw new NumberFormatException("unparsable number "+cs.subSequence(beginIndex, endIndex));
}
result += digit;
if (Character.isBmpCodePoint(cp))
{
index++;
}
else
{
index += 2;
}
}
return result;
} | java | public static final int parseUnsignedInt(CharSequence cs, int radix, int beginIndex, int endIndex)
{
check(cs, radix, NumberRanges.UnsignedIntRange, beginIndex, endIndex);
int end = endIndex;
int result = 0;
int index = beginIndex;
int cp = Character.codePointAt(cs, index);
if (cp == '+')
{
index++;
}
if (index >= end)
{
throw new NumberFormatException("unparsable number "+cs.subSequence(beginIndex, endIndex));
}
while (index < end)
{
result *= radix;
cp = Character.codePointAt(cs, index);
int digit = Character.digit(cp, radix);
if (digit == -1)
{
throw new NumberFormatException("unparsable number "+cs.subSequence(beginIndex, endIndex));
}
result += digit;
if (Character.isBmpCodePoint(cp))
{
index++;
}
else
{
index += 2;
}
}
return result;
} | [
"public",
"static",
"final",
"int",
"parseUnsignedInt",
"(",
"CharSequence",
"cs",
",",
"int",
"radix",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"check",
"(",
"cs",
",",
"radix",
",",
"NumberRanges",
".",
"UnsignedIntRange",
",",
"beginInd... | Parses unsigned int from input.
<p>Input can start with '+'.
<p>Numeric value is according to radix
@param cs
@param radix A value between Character.MIN_RADIX and Character.MAX_RADIX or -2
@param beginIndex the index to the first char of the text range.
@param endIndex the index after the last char of the text range.
@return
@throws java.lang.NumberFormatException if input cannot be parsed to proper
int.
@see java.lang.Integer#parseUnsignedInt(java.lang.String, int)
@see java.lang.Character#digit(int, int) | [
"Parses",
"unsigned",
"int",
"from",
"input",
".",
"<p",
">",
"Input",
"can",
"start",
"with",
"+",
".",
"<p",
">",
"Numeric",
"value",
"is",
"according",
"to",
"radix"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L1489-L1524 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJBar3DChartBuilder.java | DJBar3DChartBuilder.addSerie | public DJBar3DChartBuilder addSerie(AbstractColumn column, String label) {
getDataset().addSerie(column, label);
return this;
} | java | public DJBar3DChartBuilder addSerie(AbstractColumn column, String label) {
getDataset().addSerie(column, label);
return this;
} | [
"public",
"DJBar3DChartBuilder",
"addSerie",
"(",
"AbstractColumn",
"column",
",",
"String",
"label",
")",
"{",
"getDataset",
"(",
")",
".",
"addSerie",
"(",
"column",
",",
"label",
")",
";",
"return",
"this",
";",
"}"
] | Adds the specified serie column to the dataset with custom label.
@param column the serie column
@param label column the custom label | [
"Adds",
"the",
"specified",
"serie",
"column",
"to",
"the",
"dataset",
"with",
"custom",
"label",
"."
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJBar3DChartBuilder.java#L366-L369 |
unbescape/unbescape | src/main/java/org/unbescape/uri/UriEscape.java | UriEscape.escapeUriFragmentId | public static String escapeUriFragmentId(final String text, final String encoding) {
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
return UriEscapeUtil.escape(text, UriEscapeUtil.UriEscapeType.FRAGMENT_ID, encoding);
} | java | public static String escapeUriFragmentId(final String text, final String encoding) {
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
return UriEscapeUtil.escape(text, UriEscapeUtil.UriEscapeType.FRAGMENT_ID, encoding);
} | [
"public",
"static",
"String",
"escapeUriFragmentId",
"(",
"final",
"String",
"text",
",",
"final",
"String",
"encoding",
")",
"{",
"if",
"(",
"encoding",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument 'encoding' cannot be null\"... | <p>
Perform am URI fragment identifier <strong>escape</strong> operation
on a <tt>String</tt> input.
</p>
<p>
The following are the only allowed chars in an URI fragment identifier (will not be escaped):
</p>
<ul>
<li><tt>A-Z a-z 0-9</tt></li>
<li><tt>- . _ ~</tt></li>
<li><tt>! $ & ' ( ) * + , ; =</tt></li>
<li><tt>: @</tt></li>
<li><tt>/ ?</tt></li>
</ul>
<p>
All other chars will be escaped by converting them to the sequence of bytes that
represents them in the specified <em>encoding</em> and then representing each byte
in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be escaped.
@param encoding the encoding to be used for escaping.
@return The escaped result <tt>String</tt>. As a memory-performance improvement, will return the exact
same object as the <tt>text</tt> input argument if no escaping modifications were required (and
no additional <tt>String</tt> objects will be created during processing). Will
return <tt>null</tt> if input is <tt>null</tt>. | [
"<p",
">",
"Perform",
"am",
"URI",
"fragment",
"identifier",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"following",
"are",
"the",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L402-L407 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/query/impl/Indexes.java | Indexes.addOrGetIndex | public synchronized InternalIndex addOrGetIndex(String name, boolean ordered) {
InternalIndex index = indexesByName.get(name);
if (index != null) {
return index;
}
String[] components = PredicateUtils.parseOutCompositeIndexComponents(name);
if (components == null) {
name = PredicateUtils.canonicalizeAttribute(name);
} else {
name = PredicateUtils.constructCanonicalCompositeIndexName(components);
}
index = indexesByName.get(name);
if (index != null) {
return index;
}
index = indexProvider.createIndex(name, components, ordered, extractors, serializationService, indexCopyBehavior,
stats.createPerIndexStats(ordered, usesCachedQueryableEntries));
indexesByName.put(name, index);
attributeIndexRegistry.register(index);
converterCache.invalidate(index);
indexes = indexesByName.values().toArray(EMPTY_INDEXES);
if (components != null) {
InternalIndex[] oldCompositeIndexes = compositeIndexes;
InternalIndex[] newCompositeIndexes = Arrays.copyOf(oldCompositeIndexes, oldCompositeIndexes.length + 1);
newCompositeIndexes[oldCompositeIndexes.length] = index;
compositeIndexes = newCompositeIndexes;
}
return index;
} | java | public synchronized InternalIndex addOrGetIndex(String name, boolean ordered) {
InternalIndex index = indexesByName.get(name);
if (index != null) {
return index;
}
String[] components = PredicateUtils.parseOutCompositeIndexComponents(name);
if (components == null) {
name = PredicateUtils.canonicalizeAttribute(name);
} else {
name = PredicateUtils.constructCanonicalCompositeIndexName(components);
}
index = indexesByName.get(name);
if (index != null) {
return index;
}
index = indexProvider.createIndex(name, components, ordered, extractors, serializationService, indexCopyBehavior,
stats.createPerIndexStats(ordered, usesCachedQueryableEntries));
indexesByName.put(name, index);
attributeIndexRegistry.register(index);
converterCache.invalidate(index);
indexes = indexesByName.values().toArray(EMPTY_INDEXES);
if (components != null) {
InternalIndex[] oldCompositeIndexes = compositeIndexes;
InternalIndex[] newCompositeIndexes = Arrays.copyOf(oldCompositeIndexes, oldCompositeIndexes.length + 1);
newCompositeIndexes[oldCompositeIndexes.length] = index;
compositeIndexes = newCompositeIndexes;
}
return index;
} | [
"public",
"synchronized",
"InternalIndex",
"addOrGetIndex",
"(",
"String",
"name",
",",
"boolean",
"ordered",
")",
"{",
"InternalIndex",
"index",
"=",
"indexesByName",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"index",
"!=",
"null",
")",
"{",
"return",
... | Obtains the existing index or creates a new one (if an index doesn't exist
yet) for the given name in this indexes instance.
@param name the name of the index; the passed value might not
represent a canonical index name (as specified by
{@link Index#getName()), in this case the method
canonicalizes it.
@param ordered {@code true} if the new index should be ordered, {@code
false} otherwise.
@return the existing or created index. | [
"Obtains",
"the",
"existing",
"index",
"or",
"creates",
"a",
"new",
"one",
"(",
"if",
"an",
"index",
"doesn",
"t",
"exist",
"yet",
")",
"for",
"the",
"given",
"name",
"in",
"this",
"indexes",
"instance",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/impl/Indexes.java#L121-L154 |
james-hu/jabb-core | src/main/java/net/sf/jabb/util/db/ConnectionUtility.java | ConnectionUtility.createDataSource | public static DataSource createDataSource(String source, String jndiName){
DataSource ds = createDataSource(source);
if (ds != null && jndiName != null){
InitialContext ic;
try {
ic = new InitialContext();
ic.bind(jndiName, ds);
} catch (NamingException e) {
log.error("Failed to bind data source '" + source + "' to JNDI name: " + jndiName, e);
}
}
return ds;
} | java | public static DataSource createDataSource(String source, String jndiName){
DataSource ds = createDataSource(source);
if (ds != null && jndiName != null){
InitialContext ic;
try {
ic = new InitialContext();
ic.bind(jndiName, ds);
} catch (NamingException e) {
log.error("Failed to bind data source '" + source + "' to JNDI name: " + jndiName, e);
}
}
return ds;
} | [
"public",
"static",
"DataSource",
"createDataSource",
"(",
"String",
"source",
",",
"String",
"jndiName",
")",
"{",
"DataSource",
"ds",
"=",
"createDataSource",
"(",
"source",
")",
";",
"if",
"(",
"ds",
"!=",
"null",
"&&",
"jndiName",
"!=",
"null",
")",
"{... | Create DataSource and bind it to JNDI
@param source configuration
@param jndiName JNDI name that the DataSource needs to be bind to
@return The DataSource created | [
"Create",
"DataSource",
"and",
"bind",
"it",
"to",
"JNDI"
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/ConnectionUtility.java#L246-L258 |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java | PrimaveraReader.processCalendarHours | private void processCalendarHours(ProjectCalendar calendar, Record dayRecord)
{
// ... for each day of the week
Day day = Day.getInstance(Integer.parseInt(dayRecord.getField()));
// Get hours
List<Record> recHours = dayRecord.getChildren();
if (recHours.size() == 0)
{
// No data -> not working
calendar.setWorkingDay(day, false);
}
else
{
calendar.setWorkingDay(day, true);
// Read hours
ProjectCalendarHours hours = calendar.addCalendarHours(day);
for (Record recWorkingHours : recHours)
{
addHours(hours, recWorkingHours);
}
}
} | java | private void processCalendarHours(ProjectCalendar calendar, Record dayRecord)
{
// ... for each day of the week
Day day = Day.getInstance(Integer.parseInt(dayRecord.getField()));
// Get hours
List<Record> recHours = dayRecord.getChildren();
if (recHours.size() == 0)
{
// No data -> not working
calendar.setWorkingDay(day, false);
}
else
{
calendar.setWorkingDay(day, true);
// Read hours
ProjectCalendarHours hours = calendar.addCalendarHours(day);
for (Record recWorkingHours : recHours)
{
addHours(hours, recWorkingHours);
}
}
} | [
"private",
"void",
"processCalendarHours",
"(",
"ProjectCalendar",
"calendar",
",",
"Record",
"dayRecord",
")",
"{",
"// ... for each day of the week",
"Day",
"day",
"=",
"Day",
".",
"getInstance",
"(",
"Integer",
".",
"parseInt",
"(",
"dayRecord",
".",
"getField",
... | Process hours in a working day.
@param calendar project calendar
@param dayRecord working day data | [
"Process",
"hours",
"in",
"a",
"working",
"day",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L381-L402 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java | JavacParser.syntaxError | protected JCErroneous syntaxError(String key, TokenKind arg) {
return syntaxError(token.pos, key, arg);
} | java | protected JCErroneous syntaxError(String key, TokenKind arg) {
return syntaxError(token.pos, key, arg);
} | [
"protected",
"JCErroneous",
"syntaxError",
"(",
"String",
"key",
",",
"TokenKind",
"arg",
")",
"{",
"return",
"syntaxError",
"(",
"token",
".",
"pos",
",",
"key",
",",
"arg",
")",
";",
"}"
] | Generate a syntax error at current position unless one was
already reported at the same position. | [
"Generate",
"a",
"syntax",
"error",
"at",
"current",
"position",
"unless",
"one",
"was",
"already",
"reported",
"at",
"the",
"same",
"position",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L499-L501 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java | DateTimeFormatterBuilder.appendDecimal | public DateTimeFormatterBuilder appendDecimal(
DateTimeFieldType fieldType, int minDigits, int maxDigits) {
if (fieldType == null) {
throw new IllegalArgumentException("Field type must not be null");
}
if (maxDigits < minDigits) {
maxDigits = minDigits;
}
if (minDigits < 0 || maxDigits <= 0) {
throw new IllegalArgumentException();
}
if (minDigits <= 1) {
return append0(new UnpaddedNumber(fieldType, maxDigits, false));
} else {
return append0(new PaddedNumber(fieldType, maxDigits, false, minDigits));
}
} | java | public DateTimeFormatterBuilder appendDecimal(
DateTimeFieldType fieldType, int minDigits, int maxDigits) {
if (fieldType == null) {
throw new IllegalArgumentException("Field type must not be null");
}
if (maxDigits < minDigits) {
maxDigits = minDigits;
}
if (minDigits < 0 || maxDigits <= 0) {
throw new IllegalArgumentException();
}
if (minDigits <= 1) {
return append0(new UnpaddedNumber(fieldType, maxDigits, false));
} else {
return append0(new PaddedNumber(fieldType, maxDigits, false, minDigits));
}
} | [
"public",
"DateTimeFormatterBuilder",
"appendDecimal",
"(",
"DateTimeFieldType",
"fieldType",
",",
"int",
"minDigits",
",",
"int",
"maxDigits",
")",
"{",
"if",
"(",
"fieldType",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Field type m... | Instructs the printer to emit a field value as a decimal number, and the
parser to expect an unsigned decimal number.
@param fieldType type of field to append
@param minDigits minimum number of digits to <i>print</i>
@param maxDigits maximum number of digits to <i>parse</i>, or the estimated
maximum number of digits to print
@return this DateTimeFormatterBuilder, for chaining
@throws IllegalArgumentException if field type is null | [
"Instructs",
"the",
"printer",
"to",
"emit",
"a",
"field",
"value",
"as",
"a",
"decimal",
"number",
"and",
"the",
"parser",
"to",
"expect",
"an",
"unsigned",
"decimal",
"number",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java#L433-L449 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/http/handler/ProxyHandler.java | ProxyHandler.customizeConnection | protected void customizeConnection(String pathInContext, String pathParams, HttpRequest request, URLConnection connection) throws IOException
{
} | java | protected void customizeConnection(String pathInContext, String pathParams, HttpRequest request, URLConnection connection) throws IOException
{
} | [
"protected",
"void",
"customizeConnection",
"(",
"String",
"pathInContext",
",",
"String",
"pathParams",
",",
"HttpRequest",
"request",
",",
"URLConnection",
"connection",
")",
"throws",
"IOException",
"{",
"}"
] | Customize proxy URL connection. Method to allow derived handlers to customize the connection. | [
"Customize",
"proxy",
"URL",
"connection",
".",
"Method",
"to",
"allow",
"derived",
"handlers",
"to",
"customize",
"the",
"connection",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/handler/ProxyHandler.java#L539-L541 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.countUsers | long countUsers(CmsDbContext dbc, CmsUserSearchParameters searchParams) throws CmsDataAccessException {
return getUserDriver(dbc).countUsers(dbc, searchParams);
} | java | long countUsers(CmsDbContext dbc, CmsUserSearchParameters searchParams) throws CmsDataAccessException {
return getUserDriver(dbc).countUsers(dbc, searchParams);
} | [
"long",
"countUsers",
"(",
"CmsDbContext",
"dbc",
",",
"CmsUserSearchParameters",
"searchParams",
")",
"throws",
"CmsDataAccessException",
"{",
"return",
"getUserDriver",
"(",
"dbc",
")",
".",
"countUsers",
"(",
"dbc",
",",
"searchParams",
")",
";",
"}"
] | Counts the total number of users which fit the given criteria.<p>
@param dbc the database context
@param searchParams the user search criteria
@return the total number of users matching the criteria
@throws CmsDataAccessException if something goes wrong | [
"Counts",
"the",
"total",
"number",
"of",
"users",
"which",
"fit",
"the",
"given",
"criteria",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L10637-L10640 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java | AbstractIndexWriter.addMemberDesc | protected void addMemberDesc(MemberDoc member, Content contentTree) {
ClassDoc containing = member.containingClass();
String classdesc = utils.getTypeName(
configuration, containing, true) + " ";
if (member.isField()) {
if (member.isStatic()) {
contentTree.addContent(
getResource("doclet.Static_variable_in", classdesc));
} else {
contentTree.addContent(
getResource("doclet.Variable_in", classdesc));
}
} else if (member.isConstructor()) {
contentTree.addContent(
getResource("doclet.Constructor_for", classdesc));
} else if (member.isMethod()) {
if (member.isStatic()) {
contentTree.addContent(
getResource("doclet.Static_method_in", classdesc));
} else {
contentTree.addContent(
getResource("doclet.Method_in", classdesc));
}
}
addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing,
false, contentTree);
} | java | protected void addMemberDesc(MemberDoc member, Content contentTree) {
ClassDoc containing = member.containingClass();
String classdesc = utils.getTypeName(
configuration, containing, true) + " ";
if (member.isField()) {
if (member.isStatic()) {
contentTree.addContent(
getResource("doclet.Static_variable_in", classdesc));
} else {
contentTree.addContent(
getResource("doclet.Variable_in", classdesc));
}
} else if (member.isConstructor()) {
contentTree.addContent(
getResource("doclet.Constructor_for", classdesc));
} else if (member.isMethod()) {
if (member.isStatic()) {
contentTree.addContent(
getResource("doclet.Static_method_in", classdesc));
} else {
contentTree.addContent(
getResource("doclet.Method_in", classdesc));
}
}
addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing,
false, contentTree);
} | [
"protected",
"void",
"addMemberDesc",
"(",
"MemberDoc",
"member",
",",
"Content",
"contentTree",
")",
"{",
"ClassDoc",
"containing",
"=",
"member",
".",
"containingClass",
"(",
")",
";",
"String",
"classdesc",
"=",
"utils",
".",
"getTypeName",
"(",
"configuratio... | Add description about the Static Varible/Method/Constructor for a
member.
@param member MemberDoc for the member within the Class Kind
@param contentTree the content tree to which the member description will be added | [
"Add",
"description",
"about",
"the",
"Static",
"Varible",
"/",
"Method",
"/",
"Constructor",
"for",
"a",
"member",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java#L327-L353 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/impl/ItemLinkMap.java | ItemLinkMap.put | public final void put(long key, AbstractItemLink link)
{
// 666212 starts
// we do not want to contest the monitor. If the lockObject is null we
// will lazily initialize it.
if (null == _entry)
{
// we need to synchronize on the monitor to ensure that we are not
// in a race to lazily initialize
synchronized ( _entryCreationLock )
{
if ( null == _entry ){
_entry = new AbstractItemLink[_linkCapacity.intValue()];
}
}
}
// 666212 ends
synchronized (_getLock(key))
{
// NOTE: this pushes the new entry onto the front of the list. Means we
// will retrieve in lifo order. This may not be optimal
int i = _indexOfKey(key);
AbstractItemLink nextEntry = _entry[i];
_entry[i] = link;
link.setNextMappedLink(nextEntry);
_size.incrementAndGet(); // Defect 597160
}
} | java | public final void put(long key, AbstractItemLink link)
{
// 666212 starts
// we do not want to contest the monitor. If the lockObject is null we
// will lazily initialize it.
if (null == _entry)
{
// we need to synchronize on the monitor to ensure that we are not
// in a race to lazily initialize
synchronized ( _entryCreationLock )
{
if ( null == _entry ){
_entry = new AbstractItemLink[_linkCapacity.intValue()];
}
}
}
// 666212 ends
synchronized (_getLock(key))
{
// NOTE: this pushes the new entry onto the front of the list. Means we
// will retrieve in lifo order. This may not be optimal
int i = _indexOfKey(key);
AbstractItemLink nextEntry = _entry[i];
_entry[i] = link;
link.setNextMappedLink(nextEntry);
_size.incrementAndGet(); // Defect 597160
}
} | [
"public",
"final",
"void",
"put",
"(",
"long",
"key",
",",
"AbstractItemLink",
"link",
")",
"{",
"// 666212 starts",
"// we do not want to contest the monitor. If the lockObject is null we",
"// will lazily initialize it.",
"if",
"(",
"null",
"==",
"_entry",
")",
"{",
"//... | Associates the specified value with the specified key in this map.
If the map previously contained a mapping for this key, the old
value is replaced.
@param key key with which the specified value is to be associated.
@param link link to be associated with the specified key. | [
"Associates",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"in",
"this",
"map",
".",
"If",
"the",
"map",
"previously",
"contained",
"a",
"mapping",
"for",
"this",
"key",
"the",
"old",
"value",
"is",
"replaced",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/impl/ItemLinkMap.java#L256-L285 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/utils/AuthUtils.java | AuthUtils.purgeOAuthAccessTokens | public static void purgeOAuthAccessTokens(RequestContext requestContext, String provider) {
String key = String.format(PROVIDER_ACCESS_TOKENS, provider);
HttpSession session = requestContext.getRequest().getSession();
OAuthAccessToken[] accessTokens = (OAuthAccessToken[]) session.getAttribute(key);
if (accessTokens != null) {
session.removeAttribute(key);
}
} | java | public static void purgeOAuthAccessTokens(RequestContext requestContext, String provider) {
String key = String.format(PROVIDER_ACCESS_TOKENS, provider);
HttpSession session = requestContext.getRequest().getSession();
OAuthAccessToken[] accessTokens = (OAuthAccessToken[]) session.getAttribute(key);
if (accessTokens != null) {
session.removeAttribute(key);
}
} | [
"public",
"static",
"void",
"purgeOAuthAccessTokens",
"(",
"RequestContext",
"requestContext",
",",
"String",
"provider",
")",
"{",
"String",
"key",
"=",
"String",
".",
"format",
"(",
"PROVIDER_ACCESS_TOKENS",
",",
"provider",
")",
";",
"HttpSession",
"session",
"... | Purges all OAuth tokens from given provider
@param requestContext request context
@param provider provider | [
"Purges",
"all",
"OAuth",
"tokens",
"from",
"given",
"provider"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/utils/AuthUtils.java#L138-L145 |
xiaosunzhu/resource-utils | src/main/java/net/sunyijun/resource/config/Configs.java | Configs.setDebugConfigs | public static void setDebugConfigs(OneProperties debugConfigsObj, String debugConfigAbsoluteClassPath) {
if (debugConfigsObj != null) {
Configs.debugConfigs = debugConfigsObj;
}
if (debugConfigAbsoluteClassPath != null) {
Configs.debugConfigAbsoluteClassPath = debugConfigAbsoluteClassPath;
Configs.debugConfigs.initConfigs(Configs.debugConfigAbsoluteClassPath);
} else if (debugConfigs != null) { // use new systemConfigs, need initConfigs.
Configs.debugConfigs.initConfigs(Configs.debugConfigAbsoluteClassPath);
}
} | java | public static void setDebugConfigs(OneProperties debugConfigsObj, String debugConfigAbsoluteClassPath) {
if (debugConfigsObj != null) {
Configs.debugConfigs = debugConfigsObj;
}
if (debugConfigAbsoluteClassPath != null) {
Configs.debugConfigAbsoluteClassPath = debugConfigAbsoluteClassPath;
Configs.debugConfigs.initConfigs(Configs.debugConfigAbsoluteClassPath);
} else if (debugConfigs != null) { // use new systemConfigs, need initConfigs.
Configs.debugConfigs.initConfigs(Configs.debugConfigAbsoluteClassPath);
}
} | [
"public",
"static",
"void",
"setDebugConfigs",
"(",
"OneProperties",
"debugConfigsObj",
",",
"String",
"debugConfigAbsoluteClassPath",
")",
"{",
"if",
"(",
"debugConfigsObj",
"!=",
"null",
")",
"{",
"Configs",
".",
"debugConfigs",
"=",
"debugConfigsObj",
";",
"}",
... | <p>Set self define debug configs.</p>
Can use self debug configs path or self class extends {@link OneProperties}.
@param debugConfigsObj self class extends {@link OneProperties}.
If null means not use self class.
@param debugConfigAbsoluteClassPath self system configs path.
If null means use default path "{@value #DEFAULT_DEBUG_CONFIG_ABSOLUTE_CLASS_PATH}"
@see OneProperties | [
"<p",
">",
"Set",
"self",
"define",
"debug",
"configs",
".",
"<",
"/",
"p",
">",
"Can",
"use",
"self",
"debug",
"configs",
"path",
"or",
"self",
"class",
"extends",
"{",
"@link",
"OneProperties",
"}",
"."
] | train | https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/Configs.java#L641-L651 |
Swagger2Markup/swagger2markup | src/main/java/io/github/swagger2markup/Swagger2MarkupProperties.java | Swagger2MarkupProperties.getRequiredURI | public URI getRequiredURI(String key) {
Optional<String> property = getString(key);
if (property.isPresent()) {
return URIUtils.create(property.get());
} else {
throw new IllegalStateException(String.format("required key [%s] not found", key));
}
} | java | public URI getRequiredURI(String key) {
Optional<String> property = getString(key);
if (property.isPresent()) {
return URIUtils.create(property.get());
} else {
throw new IllegalStateException(String.format("required key [%s] not found", key));
}
} | [
"public",
"URI",
"getRequiredURI",
"(",
"String",
"key",
")",
"{",
"Optional",
"<",
"String",
">",
"property",
"=",
"getString",
"(",
"key",
")",
";",
"if",
"(",
"property",
".",
"isPresent",
"(",
")",
")",
"{",
"return",
"URIUtils",
".",
"create",
"("... | Return the URI property value associated with the given key (never {@code null}).
@return The URI property
@throws IllegalStateException if the key cannot be resolved | [
"Return",
"the",
"URI",
"property",
"value",
"associated",
"with",
"the",
"given",
"key",
"(",
"never",
"{",
"@code",
"null",
"}",
")",
"."
] | train | https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/Swagger2MarkupProperties.java#L201-L208 |
elki-project/elki | elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/intrinsic/IDOS.java | IDOS.computeIDs | protected DoubleDataStore computeIDs(DBIDs ids, KNNQuery<O> knnQ) {
WritableDoubleDataStore intDims = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP);
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Intrinsic dimensionality", ids.size(), LOG) : null;
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
double id = 0.;
try {
id = estimator.estimate(knnQ, iter, k_c + 1);
}
catch(ArithmeticException e) {
id = 0; // Too many duplicates, etc.
}
intDims.putDouble(iter, id);
LOG.incrementProcessed(prog);
}
LOG.ensureCompleted(prog);
return intDims;
} | java | protected DoubleDataStore computeIDs(DBIDs ids, KNNQuery<O> knnQ) {
WritableDoubleDataStore intDims = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP);
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Intrinsic dimensionality", ids.size(), LOG) : null;
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
double id = 0.;
try {
id = estimator.estimate(knnQ, iter, k_c + 1);
}
catch(ArithmeticException e) {
id = 0; // Too many duplicates, etc.
}
intDims.putDouble(iter, id);
LOG.incrementProcessed(prog);
}
LOG.ensureCompleted(prog);
return intDims;
} | [
"protected",
"DoubleDataStore",
"computeIDs",
"(",
"DBIDs",
"ids",
",",
"KNNQuery",
"<",
"O",
">",
"knnQ",
")",
"{",
"WritableDoubleDataStore",
"intDims",
"=",
"DataStoreUtil",
".",
"makeDoubleStorage",
"(",
"ids",
",",
"DataStoreFactory",
".",
"HINT_HOT",
"|",
... | Computes all IDs
@param ids the DBIDs to process
@param knnQ the KNN query
@return The computed intrinsic dimensionalities. | [
"Computes",
"all",
"IDs"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/intrinsic/IDOS.java#L153-L169 |
cucumber/cucumber-jvm | java/src/main/java/cucumber/runtime/java/JavaBackend.java | JavaBackend.loadGlue | public void loadGlue(Glue glue, Method method, Class<?> glueCodeClass) {
this.glue = glue;
methodScanner.scan(this, method, glueCodeClass);
} | java | public void loadGlue(Glue glue, Method method, Class<?> glueCodeClass) {
this.glue = glue;
methodScanner.scan(this, method, glueCodeClass);
} | [
"public",
"void",
"loadGlue",
"(",
"Glue",
"glue",
",",
"Method",
"method",
",",
"Class",
"<",
"?",
">",
"glueCodeClass",
")",
"{",
"this",
".",
"glue",
"=",
"glue",
";",
"methodScanner",
".",
"scan",
"(",
"this",
",",
"method",
",",
"glueCodeClass",
"... | Convenience method for frameworks that wish to load glue from methods explicitly (possibly
found with a different mechanism than Cucumber's built-in classpath scanning).
@param glue where stepdefs and hooks will be added.
@param method a candidate method.
@param glueCodeClass the class implementing the method. Must not be a subclass of the class implementing the method. | [
"Convenience",
"method",
"for",
"frameworks",
"that",
"wish",
"to",
"load",
"glue",
"from",
"methods",
"explicitly",
"(",
"possibly",
"found",
"with",
"a",
"different",
"mechanism",
"than",
"Cucumber",
"s",
"built",
"-",
"in",
"classpath",
"scanning",
")",
"."... | train | https://github.com/cucumber/cucumber-jvm/blob/437bb3a1f1d91b56f44059c835765b395eefc777/java/src/main/java/cucumber/runtime/java/JavaBackend.java#L107-L110 |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.forceNegativeIfTrue | public static BigDecimal forceNegativeIfTrue(final boolean condition, final BigDecimal amount) {
return condition ? BigDecimalUtil.negate(BigDecimalUtil.abs(amount)) : BigDecimalUtil.abs(amount);
} | java | public static BigDecimal forceNegativeIfTrue(final boolean condition, final BigDecimal amount) {
return condition ? BigDecimalUtil.negate(BigDecimalUtil.abs(amount)) : BigDecimalUtil.abs(amount);
} | [
"public",
"static",
"BigDecimal",
"forceNegativeIfTrue",
"(",
"final",
"boolean",
"condition",
",",
"final",
"BigDecimal",
"amount",
")",
"{",
"return",
"condition",
"?",
"BigDecimalUtil",
".",
"negate",
"(",
"BigDecimalUtil",
".",
"abs",
"(",
"amount",
")",
")"... | Return a negative amount based on amount if true, otherwise return the ABS. | [
"Return",
"a",
"negative",
"amount",
"based",
"on",
"amount",
"if",
"true",
"otherwise",
"return",
"the",
"ABS",
"."
] | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L708-L710 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Exception.java | Http2Exception.closedStreamError | public static Http2Exception closedStreamError(Http2Error error, String fmt, Object... args) {
return new ClosedStreamCreationException(error, String.format(fmt, args));
} | java | public static Http2Exception closedStreamError(Http2Error error, String fmt, Object... args) {
return new ClosedStreamCreationException(error, String.format(fmt, args));
} | [
"public",
"static",
"Http2Exception",
"closedStreamError",
"(",
"Http2Error",
"error",
",",
"String",
"fmt",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"ClosedStreamCreationException",
"(",
"error",
",",
"String",
".",
"format",
"(",
"fmt",
",",
... | Use if an error has occurred which can not be isolated to a single stream, but instead applies
to the entire connection.
@param error The type of error as defined by the HTTP/2 specification.
@param fmt String with the content and format for the additional debug data.
@param args Objects which fit into the format defined by {@code fmt}.
@return An exception which can be translated into a HTTP/2 error. | [
"Use",
"if",
"an",
"error",
"has",
"occurred",
"which",
"can",
"not",
"be",
"isolated",
"to",
"a",
"single",
"stream",
"but",
"instead",
"applies",
"to",
"the",
"entire",
"connection",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Exception.java#L110-L112 |
rey5137/material | material/src/main/java/com/rey/material/widget/FloatingActionButton.java | FloatingActionButton.setLineMorphingState | public void setLineMorphingState(int state, boolean animation){
if(mIcon != null && mIcon instanceof LineMorphingDrawable)
((LineMorphingDrawable)mIcon).switchLineState(state, animation);
} | java | public void setLineMorphingState(int state, boolean animation){
if(mIcon != null && mIcon instanceof LineMorphingDrawable)
((LineMorphingDrawable)mIcon).switchLineState(state, animation);
} | [
"public",
"void",
"setLineMorphingState",
"(",
"int",
"state",
",",
"boolean",
"animation",
")",
"{",
"if",
"(",
"mIcon",
"!=",
"null",
"&&",
"mIcon",
"instanceof",
"LineMorphingDrawable",
")",
"(",
"(",
"LineMorphingDrawable",
")",
"mIcon",
")",
".",
"switchL... | Set the line state of LineMorphingDrawable that is used as this button's icon.
@param state The line state.
@param animation Indicate should show animation when switch line state or not. | [
"Set",
"the",
"line",
"state",
"of",
"LineMorphingDrawable",
"that",
"is",
"used",
"as",
"this",
"button",
"s",
"icon",
"."
] | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/FloatingActionButton.java#L253-L256 |
vladmihalcea/flexy-pool | flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java | ReflectionUtils.handleException | private static ReflectionException handleException(String methodName, NoSuchMethodException e) {
LOGGER.error("Couldn't find method " + methodName, e);
return new ReflectionException(e);
} | java | private static ReflectionException handleException(String methodName, NoSuchMethodException e) {
LOGGER.error("Couldn't find method " + methodName, e);
return new ReflectionException(e);
} | [
"private",
"static",
"ReflectionException",
"handleException",
"(",
"String",
"methodName",
",",
"NoSuchMethodException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Couldn't find method \"",
"+",
"methodName",
",",
"e",
")",
";",
"return",
"new",
"ReflectionExce... | Handle {@link NoSuchMethodException} by logging it and rethrown it as a {@link ReflectionException}
@param methodName method name
@param e exception
@return wrapped exception | [
"Handle",
"{",
"@link",
"NoSuchMethodException",
"}",
"by",
"logging",
"it",
"and",
"rethrown",
"it",
"as",
"a",
"{",
"@link",
"ReflectionException",
"}"
] | train | https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java#L172-L175 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/rules/spelling/symspell/implementation/SymSpell.java | SymSpell.loadDictionary | public boolean loadDictionary(InputStream corpus, int termIndex, int countIndex) {
if (corpus == null) {
return false;
}
BufferedReader br = new BufferedReader(new InputStreamReader(corpus, StandardCharsets.UTF_8));
return loadDictionary(br, termIndex, countIndex);
} | java | public boolean loadDictionary(InputStream corpus, int termIndex, int countIndex) {
if (corpus == null) {
return false;
}
BufferedReader br = new BufferedReader(new InputStreamReader(corpus, StandardCharsets.UTF_8));
return loadDictionary(br, termIndex, countIndex);
} | [
"public",
"boolean",
"loadDictionary",
"(",
"InputStream",
"corpus",
",",
"int",
"termIndex",
",",
"int",
"countIndex",
")",
"{",
"if",
"(",
"corpus",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
... | / <returns>True if file loaded, or false if file not found.</returns> | [
"/",
"<returns",
">",
"True",
"if",
"file",
"loaded",
"or",
"false",
"if",
"file",
"not",
"found",
".",
"<",
"/",
"returns",
">"
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/symspell/implementation/SymSpell.java#L210-L216 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java | ZooKeeperUtils.createCheckpointIDCounter | public static ZooKeeperCheckpointIDCounter createCheckpointIDCounter(
CuratorFramework client,
Configuration configuration,
JobID jobId) {
String checkpointIdCounterPath = configuration.getString(
HighAvailabilityOptions.HA_ZOOKEEPER_CHECKPOINT_COUNTER_PATH);
checkpointIdCounterPath += ZooKeeperSubmittedJobGraphStore.getPathForJob(jobId);
return new ZooKeeperCheckpointIDCounter(client, checkpointIdCounterPath);
} | java | public static ZooKeeperCheckpointIDCounter createCheckpointIDCounter(
CuratorFramework client,
Configuration configuration,
JobID jobId) {
String checkpointIdCounterPath = configuration.getString(
HighAvailabilityOptions.HA_ZOOKEEPER_CHECKPOINT_COUNTER_PATH);
checkpointIdCounterPath += ZooKeeperSubmittedJobGraphStore.getPathForJob(jobId);
return new ZooKeeperCheckpointIDCounter(client, checkpointIdCounterPath);
} | [
"public",
"static",
"ZooKeeperCheckpointIDCounter",
"createCheckpointIDCounter",
"(",
"CuratorFramework",
"client",
",",
"Configuration",
"configuration",
",",
"JobID",
"jobId",
")",
"{",
"String",
"checkpointIdCounterPath",
"=",
"configuration",
".",
"getString",
"(",
"H... | Creates a {@link ZooKeeperCheckpointIDCounter} instance.
@param client The {@link CuratorFramework} ZooKeeper client to use
@param configuration {@link Configuration} object
@param jobId ID of job to create the instance for
@return {@link ZooKeeperCheckpointIDCounter} instance | [
"Creates",
"a",
"{",
"@link",
"ZooKeeperCheckpointIDCounter",
"}",
"instance",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java#L331-L342 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/internal/DatabaseURIHelper.java | DatabaseURIHelper.documentUri | public URI documentUri(String documentId, Params params) {
return this.documentId(documentId).query(params).build();
} | java | public URI documentUri(String documentId, Params params) {
return this.documentId(documentId).query(params).build();
} | [
"public",
"URI",
"documentUri",
"(",
"String",
"documentId",
",",
"Params",
"params",
")",
"{",
"return",
"this",
".",
"documentId",
"(",
"documentId",
")",
".",
"query",
"(",
"params",
")",
".",
"build",
"(",
")",
";",
"}"
] | Returns URI for {@code documentId} with {@code query} key and value. | [
"Returns",
"URI",
"for",
"{"
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/internal/DatabaseURIHelper.java#L141-L143 |
jbundle/jbundle | thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JDescTextField.java | JDescTextField.init | public void init(int cols, String strDescription, ActionListener actionListener)
{
m_strDescription = strDescription;
m_actionListener = actionListener;
this.setText(null);
this.addFocusListener(new FocusAdapter()
{ // Make sure a tab with a changed field triggers action performed.
String m_strOldValue;
public void focusGained(FocusEvent evt)
{
myFocusGained();
m_strOldValue = getText();
super.focusLost(evt);
}
public void focusLost(FocusEvent evt)
{
super.focusLost(evt);
myFocusLost();
if (m_actionListener != null)
if (!m_strOldValue.equalsIgnoreCase(getText()))
m_actionListener.actionPerformed(new ActionEvent(JDescTextField.this, evt.getID(), null));
}
});
this.setAlignmentX(LEFT_ALIGNMENT);
this.setAlignmentY(TOP_ALIGNMENT);
if (m_actionListener != null)
this.addActionListener(m_actionListener); // Validate on change
} | java | public void init(int cols, String strDescription, ActionListener actionListener)
{
m_strDescription = strDescription;
m_actionListener = actionListener;
this.setText(null);
this.addFocusListener(new FocusAdapter()
{ // Make sure a tab with a changed field triggers action performed.
String m_strOldValue;
public void focusGained(FocusEvent evt)
{
myFocusGained();
m_strOldValue = getText();
super.focusLost(evt);
}
public void focusLost(FocusEvent evt)
{
super.focusLost(evt);
myFocusLost();
if (m_actionListener != null)
if (!m_strOldValue.equalsIgnoreCase(getText()))
m_actionListener.actionPerformed(new ActionEvent(JDescTextField.this, evt.getID(), null));
}
});
this.setAlignmentX(LEFT_ALIGNMENT);
this.setAlignmentY(TOP_ALIGNMENT);
if (m_actionListener != null)
this.addActionListener(m_actionListener); // Validate on change
} | [
"public",
"void",
"init",
"(",
"int",
"cols",
",",
"String",
"strDescription",
",",
"ActionListener",
"actionListener",
")",
"{",
"m_strDescription",
"=",
"strDescription",
";",
"m_actionListener",
"=",
"actionListener",
";",
"this",
".",
"setText",
"(",
"null",
... | Constructor.
@param cols The columns for this text field.
@param strDescription The description to display when this component is blank.
@param actionListener The action listener for this field (must be removed and return added for this to work). | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JDescTextField.java#L79-L106 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/TableBuilder.java | TableBuilder.setColumnStyle | public void setColumnStyle(final int col, final TableColumnStyle ts) throws FastOdsException {
TableBuilder.checkCol(col);
this.stylesContainer.addContentFontFaceContainerStyle(ts);
ts.addToContentStyles(this.stylesContainer);
this.columnStyles.set(col, ts);
} | java | public void setColumnStyle(final int col, final TableColumnStyle ts) throws FastOdsException {
TableBuilder.checkCol(col);
this.stylesContainer.addContentFontFaceContainerStyle(ts);
ts.addToContentStyles(this.stylesContainer);
this.columnStyles.set(col, ts);
} | [
"public",
"void",
"setColumnStyle",
"(",
"final",
"int",
"col",
",",
"final",
"TableColumnStyle",
"ts",
")",
"throws",
"FastOdsException",
"{",
"TableBuilder",
".",
"checkCol",
"(",
"col",
")",
";",
"this",
".",
"stylesContainer",
".",
"addContentFontFaceContainer... | Set the style of a column.
@param col The column number
@param ts The style to be used, make sure the style is of type
TableFamilyStyle.STYLEFAMILY_TABLECOLUMN
@throws FastOdsException Thrown if col has an invalid value. | [
"Set",
"the",
"style",
"of",
"a",
"column",
"."
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/TableBuilder.java#L369-L374 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/calendar/CalendarUtils.java | CalendarUtils.floorDivide | public static final int floorDivide(int n, int d, int[] r) {
if (n >= 0) {
r[0] = n % d;
return n / d;
}
int q = ((n + 1) / d) - 1;
r[0] = n - (q * d);
return q;
} | java | public static final int floorDivide(int n, int d, int[] r) {
if (n >= 0) {
r[0] = n % d;
return n / d;
}
int q = ((n + 1) / d) - 1;
r[0] = n - (q * d);
return q;
} | [
"public",
"static",
"final",
"int",
"floorDivide",
"(",
"int",
"n",
",",
"int",
"d",
",",
"int",
"[",
"]",
"r",
")",
"{",
"if",
"(",
"n",
">=",
"0",
")",
"{",
"r",
"[",
"0",
"]",
"=",
"n",
"%",
"d",
";",
"return",
"n",
"/",
"d",
";",
"}",... | Divides two integers and returns the floor of the quotient and
the modulus remainder. For example,
<code>floorDivide(-1,4)</code> returns <code>-1</code> with
<code>3</code> as its remainder, while <code>-1/4</code> is
<code>0</code> and <code>-1%4</code> is <code>-1</code>.
@param n the numerator
@param d a divisor which must be > 0
@param r an array of at least one element in which the value
<code>mod(n, d)</code> is returned.
@return the floor of the quotient. | [
"Divides",
"two",
"integers",
"and",
"returns",
"the",
"floor",
"of",
"the",
"quotient",
"and",
"the",
"modulus",
"remainder",
".",
"For",
"example",
"<code",
">",
"floorDivide",
"(",
"-",
"1",
"4",
")",
"<",
"/",
"code",
">",
"returns",
"<code",
">",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/calendar/CalendarUtils.java#L102-L110 |
mgledi/DRUMS | src/main/java/com/unister/semweb/drums/util/KeyUtils.java | KeyUtils.compareKey | public static int compareKey(byte[] key1, byte[] key2) {
return compareKey(key1, key2, Math.min(key1.length, key2.length));
} | java | public static int compareKey(byte[] key1, byte[] key2) {
return compareKey(key1, key2, Math.min(key1.length, key2.length));
} | [
"public",
"static",
"int",
"compareKey",
"(",
"byte",
"[",
"]",
"key1",
",",
"byte",
"[",
"]",
"key2",
")",
"{",
"return",
"compareKey",
"(",
"key1",
",",
"key2",
",",
"Math",
".",
"min",
"(",
"key1",
".",
"length",
",",
"key2",
".",
"length",
")",... | Compares the two byte-arrays on the basis of unsigned bytes. The array will be compared by each element up to the
length of the smaller array. If all elements are equal and the array are not equal sized, the larger array is
seen as larger.
@param key1
@param key2
@return <0 if key1 < key2<br>
0 if key1 == key2<br>
>0 if key1 > key2 | [
"Compares",
"the",
"two",
"byte",
"-",
"arrays",
"on",
"the",
"basis",
"of",
"unsigned",
"bytes",
".",
"The",
"array",
"will",
"be",
"compared",
"by",
"each",
"element",
"up",
"to",
"the",
"length",
"of",
"the",
"smaller",
"array",
".",
"If",
"all",
"e... | train | https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/util/KeyUtils.java#L88-L90 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java | CacheProviderWrapper.internalInvalidateByDepId | @Override
public void internalInvalidateByDepId(Object id, int causeOfInvalidation, int source, boolean bFireIL) {
final String methodName = "internalInvalidateByDepId()";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id);
}
this.invalidateExternalCaches(id, null);
this.coreCache.invalidateByDependency(id, true);
} | java | @Override
public void internalInvalidateByDepId(Object id, int causeOfInvalidation, int source, boolean bFireIL) {
final String methodName = "internalInvalidateByDepId()";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id);
}
this.invalidateExternalCaches(id, null);
this.coreCache.invalidateByDependency(id, true);
} | [
"@",
"Override",
"public",
"void",
"internalInvalidateByDepId",
"(",
"Object",
"id",
",",
"int",
"causeOfInvalidation",
",",
"int",
"source",
",",
"boolean",
"bFireIL",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"internalInvalidateByDepId()\"",
";",
"if",
"... | This invalidates all entries in this Cache having a dependency
on this dependency id.
@param id dependency id.
@param causeOfInvalidation The cause of invalidation
@param source The source of invalidation (local or remote)
@param bFireIL True to fire invalidation event | [
"This",
"invalidates",
"all",
"entries",
"in",
"this",
"Cache",
"having",
"a",
"dependency",
"on",
"this",
"dependency",
"id",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L466-L474 |
schallee/alib4j | servlet/src/main/java/net/darkmist/alib/servlet/SerializableRequestDispatcher.java | SerializableRequestDispatcher.readObject | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
// this should set servlet...
in.defaultReadObject();
try
{
init();
}
catch(ServletException e)
{ // This could happen if it is deserialized in
// a container where the name or path does not
// exist. I can't see this happening unless the
// container itself is screwed up though.
throw new IllegalStateException("Unable to reinitialize dispatcher after deserialization.", e);
}
} | java | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
// this should set servlet...
in.defaultReadObject();
try
{
init();
}
catch(ServletException e)
{ // This could happen if it is deserialized in
// a container where the name or path does not
// exist. I can't see this happening unless the
// container itself is screwed up though.
throw new IllegalStateException("Unable to reinitialize dispatcher after deserialization.", e);
}
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"// this should set servlet...",
"in",
".",
"defaultReadObject",
"(",
")",
";",
"try",
"{",
"init",
"(",
")",
";",
"}",
"catch",
"(... | Custom deserialization. This handles setting transient fields
through @{link #init()}. | [
"Custom",
"deserialization",
".",
"This",
"handles",
"setting",
"transient",
"fields",
"through"
] | train | https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/servlet/src/main/java/net/darkmist/alib/servlet/SerializableRequestDispatcher.java#L102-L117 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_resource_sw.java | xen_health_resource_sw.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
xen_health_resource_sw_responses result = (xen_health_resource_sw_responses) service.get_payload_formatter().string_to_resource(xen_health_resource_sw_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.xen_health_resource_sw_response_array);
}
xen_health_resource_sw[] result_xen_health_resource_sw = new xen_health_resource_sw[result.xen_health_resource_sw_response_array.length];
for(int i = 0; i < result.xen_health_resource_sw_response_array.length; i++)
{
result_xen_health_resource_sw[i] = result.xen_health_resource_sw_response_array[i].xen_health_resource_sw[0];
}
return result_xen_health_resource_sw;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
xen_health_resource_sw_responses result = (xen_health_resource_sw_responses) service.get_payload_formatter().string_to_resource(xen_health_resource_sw_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.xen_health_resource_sw_response_array);
}
xen_health_resource_sw[] result_xen_health_resource_sw = new xen_health_resource_sw[result.xen_health_resource_sw_response_array.length];
for(int i = 0; i < result.xen_health_resource_sw_response_array.length; i++)
{
result_xen_health_resource_sw[i] = result.xen_health_resource_sw_response_array[i].xen_health_resource_sw[0];
}
return result_xen_health_resource_sw;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"xen_health_resource_sw_responses",
"result",
"=",
"(",
"xen_health_resource_sw_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/xen/xen_health_resource_sw.java#L173-L190 |
bsblabs/embed-for-vaadin | com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/EmbedVaadinConfig.java | EmbedVaadinConfig.buildUrl | static String buildUrl(int httpPort, String context) {
final StringBuilder sb = new StringBuilder();
sb.append("http://localhost:");
if (httpPort == PORT_AUTO) {
sb.append("[auto]");
} else {
sb.append(httpPort);
}
sb.append(context);
return sb.toString();
} | java | static String buildUrl(int httpPort, String context) {
final StringBuilder sb = new StringBuilder();
sb.append("http://localhost:");
if (httpPort == PORT_AUTO) {
sb.append("[auto]");
} else {
sb.append(httpPort);
}
sb.append(context);
return sb.toString();
} | [
"static",
"String",
"buildUrl",
"(",
"int",
"httpPort",
",",
"String",
"context",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"http://localhost:\"",
")",
";",
"if",
"(",
"httpPort",
"=="... | Build a url for the specified port and context.
<p/>
If the <tt>httpPort</tt> is equal to {@link #PORT_AUTO}, the
returned url is not used as is because no http port has been
allocated yet.
@param httpPort the http port to use
@param context the context of the url
@return a <tt>localhost</tt> url for the specified port and context | [
"Build",
"a",
"url",
"for",
"the",
"specified",
"port",
"and",
"context",
".",
"<p",
"/",
">",
"If",
"the",
"<tt",
">",
"httpPort<",
"/",
"tt",
">",
"is",
"equal",
"to",
"{",
"@link",
"#PORT_AUTO",
"}",
"the",
"returned",
"url",
"is",
"not",
"used",
... | train | https://github.com/bsblabs/embed-for-vaadin/blob/f902e70def56ab54d287d2600f9c6eef9e66c225/com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/EmbedVaadinConfig.java#L417-L428 |
citrusframework/citrus | modules/citrus-vertx/src/main/java/com/consol/citrus/vertx/endpoint/VertxSyncConsumer.java | VertxSyncConsumer.saveReplyDestination | public void saveReplyDestination(Message receivedMessage, TestContext context) {
if (receivedMessage.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS) != null) {
String correlationKeyName = endpointConfiguration.getCorrelator().getCorrelationKeyName(getName());
String correlationKey = endpointConfiguration.getCorrelator().getCorrelationKey(receivedMessage);
correlationManager.saveCorrelationKey(correlationKeyName, correlationKey, context);
correlationManager.store(correlationKey, receivedMessage.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS).toString());
} else {
log.warn("Unable to retrieve reply address for message \n" +
receivedMessage + "\n - no reply address found in message headers!");
}
} | java | public void saveReplyDestination(Message receivedMessage, TestContext context) {
if (receivedMessage.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS) != null) {
String correlationKeyName = endpointConfiguration.getCorrelator().getCorrelationKeyName(getName());
String correlationKey = endpointConfiguration.getCorrelator().getCorrelationKey(receivedMessage);
correlationManager.saveCorrelationKey(correlationKeyName, correlationKey, context);
correlationManager.store(correlationKey, receivedMessage.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS).toString());
} else {
log.warn("Unable to retrieve reply address for message \n" +
receivedMessage + "\n - no reply address found in message headers!");
}
} | [
"public",
"void",
"saveReplyDestination",
"(",
"Message",
"receivedMessage",
",",
"TestContext",
"context",
")",
"{",
"if",
"(",
"receivedMessage",
".",
"getHeader",
"(",
"CitrusVertxMessageHeaders",
".",
"VERTX_REPLY_ADDRESS",
")",
"!=",
"null",
")",
"{",
"String",... | Store the reply address either straight forward or with a given
message correlation key.
@param receivedMessage
@param context | [
"Store",
"the",
"reply",
"address",
"either",
"straight",
"forward",
"or",
"with",
"a",
"given",
"message",
"correlation",
"key",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-vertx/src/main/java/com/consol/citrus/vertx/endpoint/VertxSyncConsumer.java#L97-L107 |
UrielCh/ovh-java-sdk | ovh-java-sdk-core/src/main/java/net/minidev/ovh/core/ApiOvhUtils.java | ApiOvhUtils.convertTo | public static <T> T convertTo(String in, TypeReference<T> mapTo) throws IOException {
try {
return mapper.readValue(in, mapTo);
} catch (Exception e) {
log.error("Can not convert:{} to {}", in, mapTo, e);
throw new OvhServiceException("local", "conversion Error to " + mapTo);
}
} | java | public static <T> T convertTo(String in, TypeReference<T> mapTo) throws IOException {
try {
return mapper.readValue(in, mapTo);
} catch (Exception e) {
log.error("Can not convert:{} to {}", in, mapTo, e);
throw new OvhServiceException("local", "conversion Error to " + mapTo);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"convertTo",
"(",
"String",
"in",
",",
"TypeReference",
"<",
"T",
">",
"mapTo",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"mapper",
".",
"readValue",
"(",
"in",
",",
"mapTo",
")",
";",
"}",
"catc... | Convert JSON String to a POJO java
@param in
@param mapTo
@return POJO Object
@throws IOException | [
"Convert",
"JSON",
"String",
"to",
"a",
"POJO",
"java"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-core/src/main/java/net/minidev/ovh/core/ApiOvhUtils.java#L41-L48 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java | JobsImpl.patchAsync | public Observable<Void> patchAsync(String jobId, JobPatchParameter jobPatchParameter, JobPatchOptions jobPatchOptions) {
return patchWithServiceResponseAsync(jobId, jobPatchParameter, jobPatchOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobPatchHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobPatchHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> patchAsync(String jobId, JobPatchParameter jobPatchParameter, JobPatchOptions jobPatchOptions) {
return patchWithServiceResponseAsync(jobId, jobPatchParameter, jobPatchOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobPatchHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobPatchHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"patchAsync",
"(",
"String",
"jobId",
",",
"JobPatchParameter",
"jobPatchParameter",
",",
"JobPatchOptions",
"jobPatchOptions",
")",
"{",
"return",
"patchWithServiceResponseAsync",
"(",
"jobId",
",",
"jobPatchParameter",
",",
... | Updates the properties of the specified job.
This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints.
@param jobId The ID of the job whose properties you want to update.
@param jobPatchParameter The parameters for the request.
@param jobPatchOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Updates",
"the",
"properties",
"of",
"the",
"specified",
"job",
".",
"This",
"replaces",
"only",
"the",
"job",
"properties",
"specified",
"in",
"the",
"request",
".",
"For",
"example",
"if",
"the",
"job",
"has",
"constraints",
"and",
"a",
"request",
"does",... | 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#L961-L968 |
SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/webhook/WebhookDeliveryDao.java | WebhookDeliveryDao.selectOrderedByCeTaskUuid | public List<WebhookDeliveryLiteDto> selectOrderedByCeTaskUuid(DbSession dbSession, String ceTaskUuid, int offset, int limit) {
return mapper(dbSession).selectOrderedByCeTaskUuid(ceTaskUuid, new RowBounds(offset, limit));
} | java | public List<WebhookDeliveryLiteDto> selectOrderedByCeTaskUuid(DbSession dbSession, String ceTaskUuid, int offset, int limit) {
return mapper(dbSession).selectOrderedByCeTaskUuid(ceTaskUuid, new RowBounds(offset, limit));
} | [
"public",
"List",
"<",
"WebhookDeliveryLiteDto",
">",
"selectOrderedByCeTaskUuid",
"(",
"DbSession",
"dbSession",
",",
"String",
"ceTaskUuid",
",",
"int",
"offset",
",",
"int",
"limit",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"selectOrderedByCeTa... | All the deliveries for the specified CE task. Results are ordered by descending date. | [
"All",
"the",
"deliveries",
"for",
"the",
"specified",
"CE",
"task",
".",
"Results",
"are",
"ordered",
"by",
"descending",
"date",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/webhook/WebhookDeliveryDao.java#L67-L69 |
cdk/cdk | descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java | XLogPDescriptor.getAromaticCarbonsCount | private int getAromaticCarbonsCount(IAtomContainer ac, IAtom atom) {
List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
int carocounter = 0;
for (IAtom neighbour : neighbours) {
if (neighbour.getSymbol().equals("C") && neighbour.getFlag(CDKConstants.ISAROMATIC)) {
carocounter += 1;
}
}
return carocounter;
} | java | private int getAromaticCarbonsCount(IAtomContainer ac, IAtom atom) {
List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
int carocounter = 0;
for (IAtom neighbour : neighbours) {
if (neighbour.getSymbol().equals("C") && neighbour.getFlag(CDKConstants.ISAROMATIC)) {
carocounter += 1;
}
}
return carocounter;
} | [
"private",
"int",
"getAromaticCarbonsCount",
"(",
"IAtomContainer",
"ac",
",",
"IAtom",
"atom",
")",
"{",
"List",
"<",
"IAtom",
">",
"neighbours",
"=",
"ac",
".",
"getConnectedAtomsList",
"(",
"atom",
")",
";",
"int",
"carocounter",
"=",
"0",
";",
"for",
"... | Gets the aromaticCarbonsCount attribute of the XLogPDescriptor object.
@param ac Description of the Parameter
@param atom Description of the Parameter
@return The aromaticCarbonsCount value | [
"Gets",
"the",
"aromaticCarbonsCount",
"attribute",
"of",
"the",
"XLogPDescriptor",
"object",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java#L1074-L1083 |
TheBlackChamber/commons-encryption | src/main/java/net/theblackchamber/crypto/implementations/FileEncryptor.java | FileEncryptor.encryptFile | public void encryptFile(File file, boolean replace) throws MissingParameterException, IOException {
if(file == null || !file.exists()){
throw new MissingParameterException("File not specified or file does not exist.");
}
FileInputStream fis = new FileInputStream(file);
ByteArrayOutputStream baos = new ByteArrayOutputStream(1000);
encryptStream(fis, baos);
File tmpEncrypted = File.createTempFile("commonsencryption", RandomStringUtils.randomAlphanumeric(10));
if(!tmpEncrypted.exists()){
throw new IOException("Failed to encrypt file.");
}
FileOutputStream fos = new FileOutputStream(tmpEncrypted);
IOUtils.write(baos.toByteArray(),fos);
fos.close();
if(replace){
File bkpFile = FileUtils.getFile(file.getAbsolutePath() + ".bkp");
FileUtils.moveFile(file, bkpFile);
try{
FileUtils.moveFile(tmpEncrypted, FileUtils.getFile(file.getAbsolutePath()));
}catch(IOException e){
throw new IOException("Failed to encrypt file. Existing file saved with \".bkp\": " + e.getMessage(),e);
}
bkpFile.delete();
}else{
FileUtils.moveFile(tmpEncrypted, FileUtils.getFile(file.getAbsolutePath() + ".encrypted"));
}
} | java | public void encryptFile(File file, boolean replace) throws MissingParameterException, IOException {
if(file == null || !file.exists()){
throw new MissingParameterException("File not specified or file does not exist.");
}
FileInputStream fis = new FileInputStream(file);
ByteArrayOutputStream baos = new ByteArrayOutputStream(1000);
encryptStream(fis, baos);
File tmpEncrypted = File.createTempFile("commonsencryption", RandomStringUtils.randomAlphanumeric(10));
if(!tmpEncrypted.exists()){
throw new IOException("Failed to encrypt file.");
}
FileOutputStream fos = new FileOutputStream(tmpEncrypted);
IOUtils.write(baos.toByteArray(),fos);
fos.close();
if(replace){
File bkpFile = FileUtils.getFile(file.getAbsolutePath() + ".bkp");
FileUtils.moveFile(file, bkpFile);
try{
FileUtils.moveFile(tmpEncrypted, FileUtils.getFile(file.getAbsolutePath()));
}catch(IOException e){
throw new IOException("Failed to encrypt file. Existing file saved with \".bkp\": " + e.getMessage(),e);
}
bkpFile.delete();
}else{
FileUtils.moveFile(tmpEncrypted, FileUtils.getFile(file.getAbsolutePath() + ".encrypted"));
}
} | [
"public",
"void",
"encryptFile",
"(",
"File",
"file",
",",
"boolean",
"replace",
")",
"throws",
"MissingParameterException",
",",
"IOException",
"{",
"if",
"(",
"file",
"==",
"null",
"||",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"... | Encrypt a file.
@param file
The file to encrypt
@param replace
True - Replace the specified file with the encrypted version.
False - Keep the unencrypted file.
@throws MissingParameterException
@throws IOException | [
"Encrypt",
"a",
"file",
"."
] | train | https://github.com/TheBlackChamber/commons-encryption/blob/0cbbf7c07ae3c133cc82b6dde7ab7af91ddf64d0/src/main/java/net/theblackchamber/crypto/implementations/FileEncryptor.java#L85-L129 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/route/Route.java | Route.PUT | public static Route PUT(String uriPattern, RouteHandler routeHandler) {
return new Route(HttpConstants.Method.PUT, uriPattern, routeHandler);
} | java | public static Route PUT(String uriPattern, RouteHandler routeHandler) {
return new Route(HttpConstants.Method.PUT, uriPattern, routeHandler);
} | [
"public",
"static",
"Route",
"PUT",
"(",
"String",
"uriPattern",
",",
"RouteHandler",
"routeHandler",
")",
"{",
"return",
"new",
"Route",
"(",
"HttpConstants",
".",
"Method",
".",
"PUT",
",",
"uriPattern",
",",
"routeHandler",
")",
";",
"}"
] | Create a {@code PUT} route.
@param uriPattern
@param routeHandler
@return | [
"Create",
"a",
"{",
"@code",
"PUT",
"}",
"route",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/Route.java#L114-L116 |
samskivert/samskivert | src/main/java/com/samskivert/swing/util/DialogUtil.java | DialogUtil.createDialog | public static JInternalDialog createDialog (JFrame frame, JPanel content)
{
return createDialog(frame, null, content);
} | java | public static JInternalDialog createDialog (JFrame frame, JPanel content)
{
return createDialog(frame, null, content);
} | [
"public",
"static",
"JInternalDialog",
"createDialog",
"(",
"JFrame",
"frame",
",",
"JPanel",
"content",
")",
"{",
"return",
"createDialog",
"(",
"frame",
",",
"null",
",",
"content",
")",
";",
"}"
] | Creates and shows an internal dialog with the specified panel. | [
"Creates",
"and",
"shows",
"an",
"internal",
"dialog",
"with",
"the",
"specified",
"panel",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/DialogUtil.java#L25-L28 |
BioPAX/Paxtools | paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java | QueryExecuter.prepareSingleNodeSetFromSets | public static Set<Node> prepareSingleNodeSetFromSets(Set<Set<BioPAXElement>> sets, Graph graph)
{
Set<BioPAXElement> elements = new HashSet<BioPAXElement>();
for (Set<BioPAXElement> set : sets)
{
elements.addAll(set);
}
return prepareSingleNodeSet(elements, graph);
} | java | public static Set<Node> prepareSingleNodeSetFromSets(Set<Set<BioPAXElement>> sets, Graph graph)
{
Set<BioPAXElement> elements = new HashSet<BioPAXElement>();
for (Set<BioPAXElement> set : sets)
{
elements.addAll(set);
}
return prepareSingleNodeSet(elements, graph);
} | [
"public",
"static",
"Set",
"<",
"Node",
">",
"prepareSingleNodeSetFromSets",
"(",
"Set",
"<",
"Set",
"<",
"BioPAXElement",
">",
">",
"sets",
",",
"Graph",
"graph",
")",
"{",
"Set",
"<",
"BioPAXElement",
">",
"elements",
"=",
"new",
"HashSet",
"<",
"BioPAXE... | Gets the related wrappers of the given elements in the sets.
@param sets Sets of elements to get the related wrappers
@param graph Owner graph
@return Related wrappers in a set | [
"Gets",
"the",
"related",
"wrappers",
"of",
"the",
"given",
"elements",
"in",
"the",
"sets",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L525-L533 |
icode/ameba | src/main/java/ameba/websocket/internal/LocalizationMessages.java | LocalizationMessages.ENDPOINT_UNKNOWN_PARAMS | public static String ENDPOINT_UNKNOWN_PARAMS(Object arg0, Object arg1, Object arg2) {
return localizer.localize(localizableENDPOINT_UNKNOWN_PARAMS(arg0, arg1, arg2));
} | java | public static String ENDPOINT_UNKNOWN_PARAMS(Object arg0, Object arg1, Object arg2) {
return localizer.localize(localizableENDPOINT_UNKNOWN_PARAMS(arg0, arg1, arg2));
} | [
"public",
"static",
"String",
"ENDPOINT_UNKNOWN_PARAMS",
"(",
"Object",
"arg0",
",",
"Object",
"arg1",
",",
"Object",
"arg2",
")",
"{",
"return",
"localizer",
".",
"localize",
"(",
"localizableENDPOINT_UNKNOWN_PARAMS",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
")",... | Unknown parameter(s) for {0}.{1} method annotated with @OnError annotation: {2}. This method will be ignored. | [
"Unknown",
"parameter",
"(",
"s",
")",
"for",
"{",
"0",
"}",
".",
"{",
"1",
"}",
"method",
"annotated",
"with"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/websocket/internal/LocalizationMessages.java#L66-L68 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_domain_POST | public OvhTask organizationName_service_exchangeService_domain_POST(String organizationName, String exchangeService, Boolean configureAutodiscover, Boolean configureMx, Boolean main, String mxRelay, String name, String organization2010, OvhDomainTypeEnum type) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain";
StringBuilder sb = path(qPath, organizationName, exchangeService);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "configureAutodiscover", configureAutodiscover);
addBody(o, "configureMx", configureMx);
addBody(o, "main", main);
addBody(o, "mxRelay", mxRelay);
addBody(o, "name", name);
addBody(o, "organization2010", organization2010);
addBody(o, "type", type);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask organizationName_service_exchangeService_domain_POST(String organizationName, String exchangeService, Boolean configureAutodiscover, Boolean configureMx, Boolean main, String mxRelay, String name, String organization2010, OvhDomainTypeEnum type) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain";
StringBuilder sb = path(qPath, organizationName, exchangeService);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "configureAutodiscover", configureAutodiscover);
addBody(o, "configureMx", configureMx);
addBody(o, "main", main);
addBody(o, "mxRelay", mxRelay);
addBody(o, "name", name);
addBody(o, "organization2010", organization2010);
addBody(o, "type", type);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"organizationName_service_exchangeService_domain_POST",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"Boolean",
"configureAutodiscover",
",",
"Boolean",
"configureMx",
",",
"Boolean",
"main",
",",
"String",
"mxRelay",
",",
... | Create new domain in exchange services
REST: POST /email/exchange/{organizationName}/service/{exchangeService}/domain
@param configureMx [required] If you host domain in OVH we can configure mx record automatically
@param type [required] Type of domain that You want to install
@param name [required] Domain to install on server
@param configureAutodiscover [required] If you host domain in OVH we can configure autodiscover record automatically
@param main [required] This newly created domain will be an organization (Exchange 2010 only)
@param organization2010 [required] If specified, indicates which organization this newly created domain will be part of (Exchange 2010 only)
@param mxRelay [required] If specified, emails to not existing address will be redirected to that domain
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service | [
"Create",
"new",
"domain",
"in",
"exchange",
"services"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L445-L458 |
Azure/azure-sdk-for-java | cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckSkuAvailabilitysInner.java | CheckSkuAvailabilitysInner.listAsync | public Observable<CheckSkuAvailabilityResultListInner> listAsync(String location, List<SkuName> skus, Kind kind, String type) {
return listWithServiceResponseAsync(location, skus, kind, type).map(new Func1<ServiceResponse<CheckSkuAvailabilityResultListInner>, CheckSkuAvailabilityResultListInner>() {
@Override
public CheckSkuAvailabilityResultListInner call(ServiceResponse<CheckSkuAvailabilityResultListInner> response) {
return response.body();
}
});
} | java | public Observable<CheckSkuAvailabilityResultListInner> listAsync(String location, List<SkuName> skus, Kind kind, String type) {
return listWithServiceResponseAsync(location, skus, kind, type).map(new Func1<ServiceResponse<CheckSkuAvailabilityResultListInner>, CheckSkuAvailabilityResultListInner>() {
@Override
public CheckSkuAvailabilityResultListInner call(ServiceResponse<CheckSkuAvailabilityResultListInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CheckSkuAvailabilityResultListInner",
">",
"listAsync",
"(",
"String",
"location",
",",
"List",
"<",
"SkuName",
">",
"skus",
",",
"Kind",
"kind",
",",
"String",
"type",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"locatio... | Check available SKUs.
@param location Resource location.
@param skus The SKU of the resource.
@param kind The Kind of the resource. Possible values include: 'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7', 'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', 'ContentModerator', 'CustomSpeech', 'CustomVision.Prediction', 'CustomVision.Training', 'Emotion', 'Face', 'LUIS', 'QnAMaker', 'SpeakerRecognition', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM'
@param type The Type of the resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CheckSkuAvailabilityResultListInner object | [
"Check",
"available",
"SKUs",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckSkuAvailabilitysInner.java#L107-L114 |
facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/DistributedAvatarFileSystem.java | DistributedAvatarFileSystem.getFileStatus | public FileStatus getFileStatus(final Path f, final boolean useStandby)
throws IOException {
return new StandbyCaller<FileStatus>() {
@Override
FileStatus call(DistributedFileSystem fs) throws IOException {
return fs.getFileStatus(f);
}
}.callFS(useStandby);
} | java | public FileStatus getFileStatus(final Path f, final boolean useStandby)
throws IOException {
return new StandbyCaller<FileStatus>() {
@Override
FileStatus call(DistributedFileSystem fs) throws IOException {
return fs.getFileStatus(f);
}
}.callFS(useStandby);
} | [
"public",
"FileStatus",
"getFileStatus",
"(",
"final",
"Path",
"f",
",",
"final",
"boolean",
"useStandby",
")",
"throws",
"IOException",
"{",
"return",
"new",
"StandbyCaller",
"<",
"FileStatus",
">",
"(",
")",
"{",
"@",
"Override",
"FileStatus",
"call",
"(",
... | Return the stat information about a file.
@param f path
@param useStandby flag indicating whether to read from standby avatar
@throws FileNotFoundException if the file does not exist. | [
"Return",
"the",
"stat",
"information",
"about",
"a",
"file",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/DistributedAvatarFileSystem.java#L464-L472 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java | PageFlowManagedObject.reinitializeIfNecessary | void reinitializeIfNecessary(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext)
{
if (_servletContext == null) {
reinitialize(request, response, servletContext);
}
} | java | void reinitializeIfNecessary(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext)
{
if (_servletContext == null) {
reinitialize(request, response, servletContext);
}
} | [
"void",
"reinitializeIfNecessary",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"ServletContext",
"servletContext",
")",
"{",
"if",
"(",
"_servletContext",
"==",
"null",
")",
"{",
"reinitialize",
"(",
"request",
",",
"response",
... | Internal method to reinitialize only if necessary. The test is whether the ServletContext
reference has been lost. | [
"Internal",
"method",
"to",
"reinitialize",
"only",
"if",
"necessary",
".",
"The",
"test",
"is",
"whether",
"the",
"ServletContext",
"reference",
"has",
"been",
"lost",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java#L80-L85 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java | NamespaceDataPersister.addNamespaces | public void addNamespaces(Map<String, String> namespaceMap) throws RepositoryException
{
if (!started)
{
log.warn("Unable save namespaces in to the storage. Storage not initialized");
return;
}
PlainChangesLog changesLog = new PlainChangesLogImpl();
for (Map.Entry<String, String> entry : namespaceMap.entrySet())
{
String prefix = entry.getKey();
String uri = entry.getValue();
if (prefix != null)
{
if (log.isDebugEnabled())
log.debug("Namespace " + uri + ":" + prefix);
internallAdd(changesLog, prefix, uri);
}
}
dataManager.save(new TransactionChangesLog(changesLog));
} | java | public void addNamespaces(Map<String, String> namespaceMap) throws RepositoryException
{
if (!started)
{
log.warn("Unable save namespaces in to the storage. Storage not initialized");
return;
}
PlainChangesLog changesLog = new PlainChangesLogImpl();
for (Map.Entry<String, String> entry : namespaceMap.entrySet())
{
String prefix = entry.getKey();
String uri = entry.getValue();
if (prefix != null)
{
if (log.isDebugEnabled())
log.debug("Namespace " + uri + ":" + prefix);
internallAdd(changesLog, prefix, uri);
}
}
dataManager.save(new TransactionChangesLog(changesLog));
} | [
"public",
"void",
"addNamespaces",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"namespaceMap",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"!",
"started",
")",
"{",
"log",
".",
"warn",
"(",
"\"Unable save namespaces in to the storage. Storage not initia... | Add new namespace.
@param namespaceMap
@throws RepositoryException Repository error | [
"Add",
"new",
"namespace",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java#L137-L160 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.rotationTowards | public Matrix4f rotationTowards(Vector3fc dir, Vector3fc up) {
return rotationTowards(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z());
} | java | public Matrix4f rotationTowards(Vector3fc dir, Vector3fc up) {
return rotationTowards(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z());
} | [
"public",
"Matrix4f",
"rotationTowards",
"(",
"Vector3fc",
"dir",
",",
"Vector3fc",
"up",
")",
"{",
"return",
"rotationTowards",
"(",
"dir",
".",
"x",
"(",
")",
",",
"dir",
".",
"y",
"(",
")",
",",
"dir",
".",
"z",
"(",
")",
",",
"up",
".",
"x",
... | Set this matrix to a model transformation for a right-handed coordinate system,
that aligns the local <code>-z</code> axis with <code>dir</code>.
<p>
In order to apply the rotation transformation to a previous existing transformation,
use {@link #rotateTowards(float, float, float, float, float, float) rotateTowards}.
<p>
This method is equivalent to calling: <code>setLookAt(new Vector3f(), new Vector3f(dir).negate(), up).invertAffine()</code>
@see #rotationTowards(Vector3fc, Vector3fc)
@see #rotateTowards(float, float, float, float, float, float)
@param dir
the direction to orient the local -z axis towards
@param up
the up vector
@return this | [
"Set",
"this",
"matrix",
"to",
"a",
"model",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"that",
"aligns",
"the",
"local",
"<code",
">",
"-",
"z<",
"/",
"code",
">",
"axis",
"with",
"<code",
">",
"dir<",
"/",
"code",
"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L14306-L14308 |
looly/hutool | hutool-captcha/src/main/java/cn/hutool/captcha/ShearCaptcha.java | ShearCaptcha.shearY | private void shearY(Graphics g, int w1, int h1, Color color) {
int period = RandomUtil.randomInt(40) + 10; // 50;
boolean borderGap = true;
int frames = 20;
int phase = 7;
for (int i = 0; i < w1; i++) {
double d = (double) (period >> 1) * Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames);
g.copyArea(i, 0, 1, h1, 0, (int) d);
if (borderGap) {
g.setColor(color);
g.drawLine(i, (int) d, i, 0);
g.drawLine(i, (int) d + h1, i, h1);
}
}
} | java | private void shearY(Graphics g, int w1, int h1, Color color) {
int period = RandomUtil.randomInt(40) + 10; // 50;
boolean borderGap = true;
int frames = 20;
int phase = 7;
for (int i = 0; i < w1; i++) {
double d = (double) (period >> 1) * Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames);
g.copyArea(i, 0, 1, h1, 0, (int) d);
if (borderGap) {
g.setColor(color);
g.drawLine(i, (int) d, i, 0);
g.drawLine(i, (int) d + h1, i, h1);
}
}
} | [
"private",
"void",
"shearY",
"(",
"Graphics",
"g",
",",
"int",
"w1",
",",
"int",
"h1",
",",
"Color",
"color",
")",
"{",
"int",
"period",
"=",
"RandomUtil",
".",
"randomInt",
"(",
"40",
")",
"+",
"10",
";",
"// 50;\r",
"boolean",
"borderGap",
"=",
"tr... | X坐标扭曲
@param g {@link Graphics}
@param w1 w1
@param h1 h1
@param color 颜色 | [
"X坐标扭曲"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-captcha/src/main/java/cn/hutool/captcha/ShearCaptcha.java#L150-L168 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java | QueueContainer.txnOfferBackupReserve | public void txnOfferBackupReserve(long itemId, String transactionId) {
TxQueueItem o = txnOfferReserveInternal(itemId, transactionId);
if (o != null) {
logger.severe("txnOfferBackupReserve operation-> Item exists already at txMap for itemId: " + itemId);
}
} | java | public void txnOfferBackupReserve(long itemId, String transactionId) {
TxQueueItem o = txnOfferReserveInternal(itemId, transactionId);
if (o != null) {
logger.severe("txnOfferBackupReserve operation-> Item exists already at txMap for itemId: " + itemId);
}
} | [
"public",
"void",
"txnOfferBackupReserve",
"(",
"long",
"itemId",
",",
"String",
"transactionId",
")",
"{",
"TxQueueItem",
"o",
"=",
"txnOfferReserveInternal",
"(",
"itemId",
",",
"transactionId",
")",
";",
"if",
"(",
"o",
"!=",
"null",
")",
"{",
"logger",
"... | Reserves an ID for a future queue item and associates it with the given {@code transactionId}.
The item is not yet visible in the queue, it is just reserved for future insertion.
@param transactionId the ID of the transaction offering this item
@param itemId the ID of the item being reserved | [
"Reserves",
"an",
"ID",
"for",
"a",
"future",
"queue",
"item",
"and",
"associates",
"it",
"with",
"the",
"given",
"{",
"@code",
"transactionId",
"}",
".",
"The",
"item",
"is",
"not",
"yet",
"visible",
"in",
"the",
"queue",
"it",
"is",
"just",
"reserved",... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java#L319-L324 |
OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.hbaseGet | private Deferred<byte[]> hbaseGet(final byte[] key, final byte[] family) {
final GetRequest get = new GetRequest(table, key);
get.family(family).qualifier(kind);
class GetCB implements Callback<byte[], ArrayList<KeyValue>> {
public byte[] call(final ArrayList<KeyValue> row) {
if (row == null || row.isEmpty()) {
return null;
}
return row.get(0).value();
}
}
return client.get(get).addCallback(new GetCB());
} | java | private Deferred<byte[]> hbaseGet(final byte[] key, final byte[] family) {
final GetRequest get = new GetRequest(table, key);
get.family(family).qualifier(kind);
class GetCB implements Callback<byte[], ArrayList<KeyValue>> {
public byte[] call(final ArrayList<KeyValue> row) {
if (row == null || row.isEmpty()) {
return null;
}
return row.get(0).value();
}
}
return client.get(get).addCallback(new GetCB());
} | [
"private",
"Deferred",
"<",
"byte",
"[",
"]",
">",
"hbaseGet",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"family",
")",
"{",
"final",
"GetRequest",
"get",
"=",
"new",
"GetRequest",
"(",
"table",
",",
"key",
")",
";",
"g... | Returns the cell of the specified row key, using family:kind. | [
"Returns",
"the",
"cell",
"of",
"the",
"specified",
"row",
"key",
"using",
"family",
":",
"kind",
"."
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L1338-L1350 |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/NodeServiceImpl.java | NodeServiceImpl.copyObject | @Override
public void copyObject(final FedoraSession session, final String source, final String destination) {
final Session jcrSession = getJcrSession(session);
try {
jcrSession.getWorkspace().copy(source, destination);
touchLdpMembershipResource(getJcrNode(find(session, destination)));
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
} | java | @Override
public void copyObject(final FedoraSession session, final String source, final String destination) {
final Session jcrSession = getJcrSession(session);
try {
jcrSession.getWorkspace().copy(source, destination);
touchLdpMembershipResource(getJcrNode(find(session, destination)));
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
} | [
"@",
"Override",
"public",
"void",
"copyObject",
"(",
"final",
"FedoraSession",
"session",
",",
"final",
"String",
"source",
",",
"final",
"String",
"destination",
")",
"{",
"final",
"Session",
"jcrSession",
"=",
"getJcrSession",
"(",
"session",
")",
";",
"try... | Copy an existing object from the source path to the destination path
@param session a JCR session
@param source the source path
@param destination the destination path | [
"Copy",
"an",
"existing",
"object",
"from",
"the",
"source",
"path",
"to",
"the",
"destination",
"path"
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/NodeServiceImpl.java#L92-L101 |
Netflix/conductor | client/src/main/java/com/netflix/conductor/client/http/ClientBase.java | ClientBase.downloadFromExternalStorage | @SuppressWarnings("unchecked")
protected Map<String, Object> downloadFromExternalStorage(ExternalPayloadStorage.PayloadType payloadType, String path) {
Preconditions.checkArgument(StringUtils.isNotBlank(path), "uri cannot be blank");
ExternalStorageLocation externalStorageLocation = payloadStorage.getLocation(ExternalPayloadStorage.Operation.READ, payloadType, path);
try (InputStream inputStream = payloadStorage.download(externalStorageLocation.getUri())) {
return objectMapper.readValue(inputStream, Map.class);
} catch (IOException e) {
String errorMsg = String.format("Unable to download payload from external storage location: %s", path);
logger.error(errorMsg, e);
throw new ConductorClientException(errorMsg, e);
}
} | java | @SuppressWarnings("unchecked")
protected Map<String, Object> downloadFromExternalStorage(ExternalPayloadStorage.PayloadType payloadType, String path) {
Preconditions.checkArgument(StringUtils.isNotBlank(path), "uri cannot be blank");
ExternalStorageLocation externalStorageLocation = payloadStorage.getLocation(ExternalPayloadStorage.Operation.READ, payloadType, path);
try (InputStream inputStream = payloadStorage.download(externalStorageLocation.getUri())) {
return objectMapper.readValue(inputStream, Map.class);
} catch (IOException e) {
String errorMsg = String.format("Unable to download payload from external storage location: %s", path);
logger.error(errorMsg, e);
throw new ConductorClientException(errorMsg, e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"Map",
"<",
"String",
",",
"Object",
">",
"downloadFromExternalStorage",
"(",
"ExternalPayloadStorage",
".",
"PayloadType",
"payloadType",
",",
"String",
"path",
")",
"{",
"Preconditions",
".",
"checkA... | Uses the {@link PayloadStorage} for downloading large payloads to be used by the client.
Gets the uri of the payload fom the server and then downloads from this location.
@param payloadType the {@link com.netflix.conductor.common.utils.ExternalPayloadStorage.PayloadType} to be downloaded
@param path the relative of the payload in external storage
@return the payload object that is stored in external storage | [
"Uses",
"the",
"{",
"@link",
"PayloadStorage",
"}",
"for",
"downloading",
"large",
"payloads",
"to",
"be",
"used",
"by",
"the",
"client",
".",
"Gets",
"the",
"uri",
"of",
"the",
"payload",
"fom",
"the",
"server",
"and",
"then",
"downloads",
"from",
"this",... | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/ClientBase.java#L219-L230 |
SahaginOrg/sahagin-java | src/main/java/org/sahagin/runlib/runresultsgen/RunResultsGenerateHookSetter.java | RunResultsGenerateHookSetter.beforeHookInsertLine | private int beforeHookInsertLine(TestMethod method, int codeLineIndex) {
if (!isLineLastStament(method, codeLineIndex)) {
// don't insert the beforeHook since afterHook does not inserted to this line
return -1;
}
// so that not to insert the hook to the middle of the line,
// search the line top statement and insert hook to the statement line
for (int i = codeLineIndex; i > 0; i--) {
CodeLine thisLine = method.getCodeBody().get(i);
CodeLine prevLine = method.getCodeBody().get(i - 1);
assert prevLine.getEndLine() <= thisLine.getEndLine();
if (prevLine.getEndLine() != thisLine.getStartLine()) {
return thisLine.getStartLine();
}
}
return method.getCodeBody().get(0).getStartLine();
} | java | private int beforeHookInsertLine(TestMethod method, int codeLineIndex) {
if (!isLineLastStament(method, codeLineIndex)) {
// don't insert the beforeHook since afterHook does not inserted to this line
return -1;
}
// so that not to insert the hook to the middle of the line,
// search the line top statement and insert hook to the statement line
for (int i = codeLineIndex; i > 0; i--) {
CodeLine thisLine = method.getCodeBody().get(i);
CodeLine prevLine = method.getCodeBody().get(i - 1);
assert prevLine.getEndLine() <= thisLine.getEndLine();
if (prevLine.getEndLine() != thisLine.getStartLine()) {
return thisLine.getStartLine();
}
}
return method.getCodeBody().get(0).getStartLine();
} | [
"private",
"int",
"beforeHookInsertLine",
"(",
"TestMethod",
"method",
",",
"int",
"codeLineIndex",
")",
"{",
"if",
"(",
"!",
"isLineLastStament",
"(",
"method",
",",
"codeLineIndex",
")",
")",
"{",
"// don't insert the beforeHook since afterHook does not inserted to this... | Returns -1 if beforeHook for the codeLineIndex should not be inserted | [
"Returns",
"-",
"1",
"if",
"beforeHook",
"for",
"the",
"codeLineIndex",
"should",
"not",
"be",
"inserted"
] | train | https://github.com/SahaginOrg/sahagin-java/blob/7ace428adebe3466ceb5826bc9681f8e3d52be68/src/main/java/org/sahagin/runlib/runresultsgen/RunResultsGenerateHookSetter.java#L128-L145 |
UrielCh/ovh-java-sdk | ovh-java-sdk-freefax/src/main/java/net/minidev/ovh/api/ApiOvhFreefax.java | ApiOvhFreefax.serviceName_voicemail_changeRouting_POST | public void serviceName_voicemail_changeRouting_POST(String serviceName, OvhVoicefaxRoutingEnum routing) throws IOException {
String qPath = "/freefax/{serviceName}/voicemail/changeRouting";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "routing", routing);
exec(qPath, "POST", sb.toString(), o);
} | java | public void serviceName_voicemail_changeRouting_POST(String serviceName, OvhVoicefaxRoutingEnum routing) throws IOException {
String qPath = "/freefax/{serviceName}/voicemail/changeRouting";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "routing", routing);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"serviceName_voicemail_changeRouting_POST",
"(",
"String",
"serviceName",
",",
"OvhVoicefaxRoutingEnum",
"routing",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/freefax/{serviceName}/voicemail/changeRouting\"",
";",
"StringBuilder",
"sb",
"... | Disable/Enable voicemail. Available only if the line has fax capabilities
REST: POST /freefax/{serviceName}/voicemail/changeRouting
@param routing [required] Activate or Desactivate voicemail on the line
@param serviceName [required] Freefax number | [
"Disable",
"/",
"Enable",
"voicemail",
".",
"Available",
"only",
"if",
"the",
"line",
"has",
"fax",
"capabilities"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-freefax/src/main/java/net/minidev/ovh/api/ApiOvhFreefax.java#L126-L132 |
pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java | BookKeeperLog.initialize | @Override
public void initialize(Duration timeout) throws DurableDataLogException {
List<Long> ledgersToDelete;
LogMetadata newMetadata;
synchronized (this.lock) {
Preconditions.checkState(this.writeLedger == null, "BookKeeperLog is already initialized.");
assert this.logMetadata == null : "writeLedger == null but logMetadata != null";
// Get metadata about the current state of the log, if any.
LogMetadata oldMetadata = loadMetadata();
if (oldMetadata != null) {
if (!oldMetadata.isEnabled()) {
throw new DataLogDisabledException("BookKeeperLog is disabled. Cannot initialize.");
}
// Fence out ledgers.
val emptyLedgerIds = Ledgers.fenceOut(oldMetadata.getLedgers(), this.bookKeeper, this.config, this.traceObjectId);
// Update Metadata to reflect those newly found empty ledgers.
oldMetadata = oldMetadata.updateLedgerStatus(emptyLedgerIds);
}
// Create new ledger.
LedgerHandle newLedger = Ledgers.create(this.bookKeeper, this.config);
log.info("{}: Created Ledger {}.", this.traceObjectId, newLedger.getId());
// Update Metadata with new Ledger and persist to ZooKeeper.
newMetadata = updateMetadata(oldMetadata, newLedger, true);
LedgerMetadata ledgerMetadata = newMetadata.getLedger(newLedger.getId());
assert ledgerMetadata != null : "cannot find newly added ledger metadata";
this.writeLedger = new WriteLedger(newLedger, ledgerMetadata);
this.logMetadata = newMetadata;
ledgersToDelete = getLedgerIdsToDelete(oldMetadata, newMetadata);
}
// Delete the orphaned ledgers from BookKeeper.
ledgersToDelete.forEach(id -> {
try {
Ledgers.delete(id, this.bookKeeper);
log.info("{}: Deleted orphan empty ledger {}.", this.traceObjectId, id);
} catch (DurableDataLogException ex) {
// A failure here has no effect on the initialization of BookKeeperLog. In this case, the (empty) Ledger
// will remain in BookKeeper until manually deleted by a cleanup tool.
log.warn("{}: Unable to delete orphan empty ledger {}.", this.traceObjectId, id, ex);
}
});
log.info("{}: Initialized (Epoch = {}, UpdateVersion = {}).", this.traceObjectId, newMetadata.getEpoch(), newMetadata.getUpdateVersion());
} | java | @Override
public void initialize(Duration timeout) throws DurableDataLogException {
List<Long> ledgersToDelete;
LogMetadata newMetadata;
synchronized (this.lock) {
Preconditions.checkState(this.writeLedger == null, "BookKeeperLog is already initialized.");
assert this.logMetadata == null : "writeLedger == null but logMetadata != null";
// Get metadata about the current state of the log, if any.
LogMetadata oldMetadata = loadMetadata();
if (oldMetadata != null) {
if (!oldMetadata.isEnabled()) {
throw new DataLogDisabledException("BookKeeperLog is disabled. Cannot initialize.");
}
// Fence out ledgers.
val emptyLedgerIds = Ledgers.fenceOut(oldMetadata.getLedgers(), this.bookKeeper, this.config, this.traceObjectId);
// Update Metadata to reflect those newly found empty ledgers.
oldMetadata = oldMetadata.updateLedgerStatus(emptyLedgerIds);
}
// Create new ledger.
LedgerHandle newLedger = Ledgers.create(this.bookKeeper, this.config);
log.info("{}: Created Ledger {}.", this.traceObjectId, newLedger.getId());
// Update Metadata with new Ledger and persist to ZooKeeper.
newMetadata = updateMetadata(oldMetadata, newLedger, true);
LedgerMetadata ledgerMetadata = newMetadata.getLedger(newLedger.getId());
assert ledgerMetadata != null : "cannot find newly added ledger metadata";
this.writeLedger = new WriteLedger(newLedger, ledgerMetadata);
this.logMetadata = newMetadata;
ledgersToDelete = getLedgerIdsToDelete(oldMetadata, newMetadata);
}
// Delete the orphaned ledgers from BookKeeper.
ledgersToDelete.forEach(id -> {
try {
Ledgers.delete(id, this.bookKeeper);
log.info("{}: Deleted orphan empty ledger {}.", this.traceObjectId, id);
} catch (DurableDataLogException ex) {
// A failure here has no effect on the initialization of BookKeeperLog. In this case, the (empty) Ledger
// will remain in BookKeeper until manually deleted by a cleanup tool.
log.warn("{}: Unable to delete orphan empty ledger {}.", this.traceObjectId, id, ex);
}
});
log.info("{}: Initialized (Epoch = {}, UpdateVersion = {}).", this.traceObjectId, newMetadata.getEpoch(), newMetadata.getUpdateVersion());
} | [
"@",
"Override",
"public",
"void",
"initialize",
"(",
"Duration",
"timeout",
")",
"throws",
"DurableDataLogException",
"{",
"List",
"<",
"Long",
">",
"ledgersToDelete",
";",
"LogMetadata",
"newMetadata",
";",
"synchronized",
"(",
"this",
".",
"lock",
")",
"{",
... | Open-Fences this BookKeeper log using the following protocol:
1. Read Log Metadata from ZooKeeper.
2. Fence at least the last 2 ledgers in the Ledger List.
3. Create a new Ledger.
3.1 If any of the steps so far fails, the process is interrupted at the point of failure, and no cleanup is attempted.
4. Update Log Metadata using compare-and-set (this update contains the new ledger and new epoch).
4.1 If CAS fails on metadata update, the newly created Ledger is deleted (this means we were fenced out by some
other instance) and no other update is performed.
@param timeout Timeout for the operation.
@throws DataLogWriterNotPrimaryException If we were fenced-out during this process.
@throws DataLogNotAvailableException If BookKeeper or ZooKeeper are not available.
@throws DataLogDisabledException If the BookKeeperLog is disabled. No fencing is attempted in this case.
@throws DataLogInitializationException If a general initialization error occurred.
@throws DurableDataLogException If another type of exception occurred. | [
"Open",
"-",
"Fences",
"this",
"BookKeeper",
"log",
"using",
"the",
"following",
"protocol",
":",
"1",
".",
"Read",
"Log",
"Metadata",
"from",
"ZooKeeper",
".",
"2",
".",
"Fence",
"at",
"least",
"the",
"last",
"2",
"ledgers",
"in",
"the",
"Ledger",
"List... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java#L205-L253 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.