repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkTapsInner.java | VirtualNetworkTapsInner.beginDelete | public void beginDelete(String resourceGroupName, String tapName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, tapName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String tapName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, tapName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"tapName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"tapName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",... | Deletes the specified virtual network tap.
@param resourceGroupName The name of the resource group.
@param tapName The name of the virtual network tap.
@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 | [
"Deletes",
"the",
"specified",
"virtual",
"network",
"tap",
"."
] | 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/VirtualNetworkTapsInner.java#L191-L193 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/DdosProtectionPlansInner.java | DdosProtectionPlansInner.beginCreateOrUpdate | public DdosProtectionPlanInner beginCreateOrUpdate(String resourceGroupName, String ddosProtectionPlanName, DdosProtectionPlanInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName, parameters).toBlocking().single().body();
} | java | public DdosProtectionPlanInner beginCreateOrUpdate(String resourceGroupName, String ddosProtectionPlanName, DdosProtectionPlanInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName, parameters).toBlocking().single().body();
} | [
"public",
"DdosProtectionPlanInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"ddosProtectionPlanName",
",",
"DdosProtectionPlanInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",... | Creates or updates a DDoS protection plan.
@param resourceGroupName The name of the resource group.
@param ddosProtectionPlanName The name of the DDoS protection plan.
@param parameters Parameters supplied to the create or update operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DdosProtectionPlanInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"DDoS",
"protection",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/DdosProtectionPlansInner.java#L426-L428 |
facebookarchive/swift | swift-codec/src/main/java/com/facebook/swift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java | ThriftCodecByteCodeGenerator.buildUnion | private LocalVariableDefinition buildUnion(MethodDefinition read, Map<Short, LocalVariableDefinition> unionData)
{
// construct the instance and store it in the instance local variable
LocalVariableDefinition instance = constructUnionInstance(read);
// switch (fieldId)
read.loadVariable("fieldId");
List<CaseStatement> cases = new ArrayList<>();
for (ThriftFieldMetadata field : metadata.getFields(THRIFT_FIELD)) {
cases.add(caseStatement(field.getId(), field.getName() + "-inject-field"));
}
read.switchStatement("inject-default", cases);
for (ThriftFieldMetadata field : metadata.getFields(THRIFT_FIELD)) {
// case field.id:
read.visitLabel(field.getName() + "-inject-field");
injectField(read, field, instance, unionData.get(field.getId()));
if (field.getMethodInjection().isPresent()) {
injectMethod(read, field.getMethodInjection().get(), instance, unionData);
}
read.gotoLabel("inject-default");
}
// default case
read.visitLabel("inject-default");
// find the @ThriftUnionId field
ThriftFieldMetadata idField = getOnlyElement(metadata.getFields(THRIFT_UNION_ID));
injectIdField(read, idField, instance, unionData);
// invoke factory method if present
invokeFactoryMethod(read, unionData, instance);
return instance;
} | java | private LocalVariableDefinition buildUnion(MethodDefinition read, Map<Short, LocalVariableDefinition> unionData)
{
// construct the instance and store it in the instance local variable
LocalVariableDefinition instance = constructUnionInstance(read);
// switch (fieldId)
read.loadVariable("fieldId");
List<CaseStatement> cases = new ArrayList<>();
for (ThriftFieldMetadata field : metadata.getFields(THRIFT_FIELD)) {
cases.add(caseStatement(field.getId(), field.getName() + "-inject-field"));
}
read.switchStatement("inject-default", cases);
for (ThriftFieldMetadata field : metadata.getFields(THRIFT_FIELD)) {
// case field.id:
read.visitLabel(field.getName() + "-inject-field");
injectField(read, field, instance, unionData.get(field.getId()));
if (field.getMethodInjection().isPresent()) {
injectMethod(read, field.getMethodInjection().get(), instance, unionData);
}
read.gotoLabel("inject-default");
}
// default case
read.visitLabel("inject-default");
// find the @ThriftUnionId field
ThriftFieldMetadata idField = getOnlyElement(metadata.getFields(THRIFT_UNION_ID));
injectIdField(read, idField, instance, unionData);
// invoke factory method if present
invokeFactoryMethod(read, unionData, instance);
return instance;
} | [
"private",
"LocalVariableDefinition",
"buildUnion",
"(",
"MethodDefinition",
"read",
",",
"Map",
"<",
"Short",
",",
"LocalVariableDefinition",
">",
"unionData",
")",
"{",
"// construct the instance and store it in the instance local variable",
"LocalVariableDefinition",
"instance... | Defines the code to build the struct instance using the data in the local variables. | [
"Defines",
"the",
"code",
"to",
"build",
"the",
"struct",
"instance",
"using",
"the",
"data",
"in",
"the",
"local",
"variables",
"."
] | train | https://github.com/facebookarchive/swift/blob/3f1f098a50d6106f50cd6fe1c361dd373ede0197/swift-codec/src/main/java/com/facebook/swift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java#L603-L642 |
alibaba/otter | shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkClientx.java | ZkClientx.createPersistent | public void createPersistent(String path, Object data) throws ZkInterruptedException, IllegalArgumentException,
ZkException, RuntimeException {
create(path, data, CreateMode.PERSISTENT);
} | java | public void createPersistent(String path, Object data) throws ZkInterruptedException, IllegalArgumentException,
ZkException, RuntimeException {
create(path, data, CreateMode.PERSISTENT);
} | [
"public",
"void",
"createPersistent",
"(",
"String",
"path",
",",
"Object",
"data",
")",
"throws",
"ZkInterruptedException",
",",
"IllegalArgumentException",
",",
"ZkException",
",",
"RuntimeException",
"{",
"create",
"(",
"path",
",",
"data",
",",
"CreateMode",
"... | Create a persistent node.
@param path
@param data
@throws ZkInterruptedException if operation was interrupted, or a required reconnection got interrupted
@throws IllegalArgumentException if called from anything except the ZooKeeper event thread
@throws ZkException if any ZooKeeper exception occurred
@throws RuntimeException if any other exception occurs | [
"Create",
"a",
"persistent",
"node",
"."
] | train | https://github.com/alibaba/otter/blob/c7b5f94a0dd162e01ddffaf3a63cade7d23fca55/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkClientx.java#L348-L351 |
yanzhenjie/AndServer | api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java | CollectionUtils.containsInstance | public static boolean containsInstance(Collection<?> collection, Object element) {
if (collection != null) {
for (Object candidate : collection) {
if (candidate == element) {
return true;
}
}
}
return false;
} | java | public static boolean containsInstance(Collection<?> collection, Object element) {
if (collection != null) {
for (Object candidate : collection) {
if (candidate == element) {
return true;
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"containsInstance",
"(",
"Collection",
"<",
"?",
">",
"collection",
",",
"Object",
"element",
")",
"{",
"if",
"(",
"collection",
"!=",
"null",
")",
"{",
"for",
"(",
"Object",
"candidate",
":",
"collection",
")",
"{",
"if",
... | Check whether the given Collection contains the given element instance. <p>Enforces the given instance to be
present, rather than returning {@code true} for an equal element as well.
@param collection the Collection to check.
@param element the element to look for.
@return {@code true} if found, {@code false} else. | [
"Check",
"whether",
"the",
"given",
"Collection",
"contains",
"the",
"given",
"element",
"instance",
".",
"<p",
">",
"Enforces",
"the",
"given",
"instance",
"to",
"be",
"present",
"rather",
"than",
"returning",
"{",
"@code",
"true",
"}",
"for",
"an",
"equal"... | train | https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java#L170-L179 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java | MapComposedElement.setPointAt | public boolean setPointAt(int index, double x, double y, boolean canonize) {
final int count = getPointCount();
int idx = index;
if (idx < 0) {
idx = count + idx;
}
if (idx < 0) {
throw new IndexOutOfBoundsException(idx + "<0"); //$NON-NLS-1$
}
if (idx >= count) {
throw new IndexOutOfBoundsException(idx + ">=" + count); //$NON-NLS-1$
}
final PointFusionValidator validator = getPointFusionValidator();
final int idx1 = idx * 2;
final int idx2 = idx1 + 1;
if (!validator.isSame(x, y, this.pointCoordinates[idx1], this.pointCoordinates[idx2])) {
this.pointCoordinates[idx1] = x;
this.pointCoordinates[idx2] = y;
if (canonize) {
canonize(idx);
}
fireShapeChanged();
fireElementChanged();
return true;
}
return false;
} | java | public boolean setPointAt(int index, double x, double y, boolean canonize) {
final int count = getPointCount();
int idx = index;
if (idx < 0) {
idx = count + idx;
}
if (idx < 0) {
throw new IndexOutOfBoundsException(idx + "<0"); //$NON-NLS-1$
}
if (idx >= count) {
throw new IndexOutOfBoundsException(idx + ">=" + count); //$NON-NLS-1$
}
final PointFusionValidator validator = getPointFusionValidator();
final int idx1 = idx * 2;
final int idx2 = idx1 + 1;
if (!validator.isSame(x, y, this.pointCoordinates[idx1], this.pointCoordinates[idx2])) {
this.pointCoordinates[idx1] = x;
this.pointCoordinates[idx2] = y;
if (canonize) {
canonize(idx);
}
fireShapeChanged();
fireElementChanged();
return true;
}
return false;
} | [
"public",
"boolean",
"setPointAt",
"(",
"int",
"index",
",",
"double",
"x",
",",
"double",
"y",
",",
"boolean",
"canonize",
")",
"{",
"final",
"int",
"count",
"=",
"getPointCount",
"(",
")",
";",
"int",
"idx",
"=",
"index",
";",
"if",
"(",
"idx",
"<"... | Set the specified point at the given index.
<p>If the <var>index</var> is negative, it will corresponds
to an index starting from the end of the list.
@param index is the index of the desired point
@param x is the new value of the point
@param y is the new value of the point
@param canonize indicates if the function {@link #canonize(int)} must be called.
@return <code>true</code> if the point was set, <code>false</code> if
the specified coordinates correspond to the already existing point.
@throws IndexOutOfBoundsException in case of error. | [
"Set",
"the",
"specified",
"point",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java#L937-L965 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java | WordVectorSerializer.writeWordVectors | @Deprecated
public static void writeWordVectors(@NonNull Word2Vec vec, @NonNull OutputStream outputStream) throws IOException {
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8))) {
writeWordVectors(vec, writer);
}
} | java | @Deprecated
public static void writeWordVectors(@NonNull Word2Vec vec, @NonNull OutputStream outputStream) throws IOException {
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8))) {
writeWordVectors(vec, writer);
}
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"writeWordVectors",
"(",
"@",
"NonNull",
"Word2Vec",
"vec",
",",
"@",
"NonNull",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"try",
"(",
"BufferedWriter",
"writer",
"=",
"new",
"BufferedWriter",... | Writes the word vectors to the given OutputStream. Note that this assumes an in memory cache.
@param vec the word2vec to write
@param outputStream - OutputStream, where all data should be sent to
the path to write
@throws IOException | [
"Writes",
"the",
"word",
"vectors",
"to",
"the",
"given",
"OutputStream",
".",
"Note",
"that",
"this",
"assumes",
"an",
"in",
"memory",
"cache",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L1511-L1516 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/EigenValueDecomposition.java | EigenValueDecomposition.sortByEigenValue | public void sortByEigenValue(Comparator<Double> cmp)
{
if(isComplex())
throw new ArithmeticException("Eigen values can not be sorted due to complex results");
IndexTable it = new IndexTable(DoubleList.unmodifiableView(d, d.length), cmp);
for(int i = 0; i < d.length; i++)
{
RowColumnOps.swapCol(V, i, it.index(i));
double tmp = d[i];
d[i] = d[it.index(i)];
d[it.index(i)] = tmp;
it.swap(i, it.index(i));
}
} | java | public void sortByEigenValue(Comparator<Double> cmp)
{
if(isComplex())
throw new ArithmeticException("Eigen values can not be sorted due to complex results");
IndexTable it = new IndexTable(DoubleList.unmodifiableView(d, d.length), cmp);
for(int i = 0; i < d.length; i++)
{
RowColumnOps.swapCol(V, i, it.index(i));
double tmp = d[i];
d[i] = d[it.index(i)];
d[it.index(i)] = tmp;
it.swap(i, it.index(i));
}
} | [
"public",
"void",
"sortByEigenValue",
"(",
"Comparator",
"<",
"Double",
">",
"cmp",
")",
"{",
"if",
"(",
"isComplex",
"(",
")",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"Eigen values can not be sorted due to complex results\"",
")",
";",
"IndexTable",
"it"... | Sorts the eigen values and the corresponding eigenvector columns by the
associated eigen value. Sorting can not occur if complex values are
present.
@param cmp the comparator to use to sort the eigen values | [
"Sorts",
"the",
"eigen",
"values",
"and",
"the",
"corresponding",
"eigenvector",
"columns",
"by",
"the",
"associated",
"eigen",
"value",
".",
"Sorting",
"can",
"not",
"occur",
"if",
"complex",
"values",
"are",
"present",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/EigenValueDecomposition.java#L692-L708 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockWithChecksumFileReader.java | BlockWithChecksumFileReader.metaFileExists | static public boolean metaFileExists(FSDatasetInterface dataset, int namespaceId, Block b) throws IOException {
return getMetaFile(dataset, namespaceId, b).exists();
} | java | static public boolean metaFileExists(FSDatasetInterface dataset, int namespaceId, Block b) throws IOException {
return getMetaFile(dataset, namespaceId, b).exists();
} | [
"static",
"public",
"boolean",
"metaFileExists",
"(",
"FSDatasetInterface",
"dataset",
",",
"int",
"namespaceId",
",",
"Block",
"b",
")",
"throws",
"IOException",
"{",
"return",
"getMetaFile",
"(",
"dataset",
",",
"namespaceId",
",",
"b",
")",
".",
"exists",
"... | Does the meta file exist for this block?
@param namespaceId - parent namespace id
@param b - the block
@return true of the metafile for specified block exits
@throws IOException | [
"Does",
"the",
"meta",
"file",
"exist",
"for",
"this",
"block?"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockWithChecksumFileReader.java#L468-L470 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/render/R.java | R.findComponentFormId | public static String findComponentFormId(FacesContext fc, UIComponent c) {
UIComponent parent = c.getParent();
while (parent != null) {
if (parent instanceof UIForm) {
return parent.getClientId(fc);
}
parent = parent.getParent();
}
return null;
} | java | public static String findComponentFormId(FacesContext fc, UIComponent c) {
UIComponent parent = c.getParent();
while (parent != null) {
if (parent instanceof UIForm) {
return parent.getClientId(fc);
}
parent = parent.getParent();
}
return null;
} | [
"public",
"static",
"String",
"findComponentFormId",
"(",
"FacesContext",
"fc",
",",
"UIComponent",
"c",
")",
"{",
"UIComponent",
"parent",
"=",
"c",
".",
"getParent",
"(",
")",
";",
"while",
"(",
"parent",
"!=",
"null",
")",
"{",
"if",
"(",
"parent",
"i... | Finds the Form Id of a component inside a form.
@param fc
FacesContext instance
@param c
UIComponent instance
@return | [
"Finds",
"the",
"Form",
"Id",
"of",
"a",
"component",
"inside",
"a",
"form",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L313-L323 |
Jasig/uPortal | uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/services/GroupService.java | GroupService.getEntity | private static IEntity getEntity(String key, Class<?> type, String service)
throws GroupsException {
return instance().igetEntity(key, type, service);
} | java | private static IEntity getEntity(String key, Class<?> type, String service)
throws GroupsException {
return instance().igetEntity(key, type, service);
} | [
"private",
"static",
"IEntity",
"getEntity",
"(",
"String",
"key",
",",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"service",
")",
"throws",
"GroupsException",
"{",
"return",
"instance",
"(",
")",
".",
"igetEntity",
"(",
"key",
",",
"type",
",",
"ser... | Returns an <code>IEntity</code> representing a portal entity. This does not guarantee that
the entity actually exists.
@param key String - the group key.
@param type Class - the Class of the underlying IGroupMember.
@param service String - the name of the component service.
@return org.apereo.portal.groups.IEntity | [
"Returns",
"an",
"<code",
">",
"IEntity<",
"/",
"code",
">",
"representing",
"a",
"portal",
"entity",
".",
"This",
"does",
"not",
"guarantee",
"that",
"the",
"entity",
"actually",
"exists",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/services/GroupService.java#L161-L164 |
skyscreamer/JSONassert | src/main/java/org/skyscreamer/jsonassert/JSONAssert.java | JSONAssert.assertNotEquals | public static void assertNotEquals(String expectedStr, JSONObject actual, JSONCompareMode compareMode)
throws JSONException {
assertNotEquals("", expectedStr, actual, compareMode);
} | java | public static void assertNotEquals(String expectedStr, JSONObject actual, JSONCompareMode compareMode)
throws JSONException {
assertNotEquals("", expectedStr, actual, compareMode);
} | [
"public",
"static",
"void",
"assertNotEquals",
"(",
"String",
"expectedStr",
",",
"JSONObject",
"actual",
",",
"JSONCompareMode",
"compareMode",
")",
"throws",
"JSONException",
"{",
"assertNotEquals",
"(",
"\"\"",
",",
"expectedStr",
",",
"actual",
",",
"compareMode... | Asserts that the JSONObject provided does not match the expected string. If it is it throws an
{@link AssertionError}.
@see #assertEquals(String, JSONObject, JSONCompareMode)
@param expectedStr Expected JSON string
@param actual JSONObject to compare
@param compareMode Specifies which comparison mode to use
@throws JSONException JSON parsing error | [
"Asserts",
"that",
"the",
"JSONObject",
"provided",
"does",
"not",
"match",
"the",
"expected",
"string",
".",
"If",
"it",
"is",
"it",
"throws",
"an",
"{",
"@link",
"AssertionError",
"}",
"."
] | train | https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONAssert.java#L163-L166 |
paypal/SeLion | client/src/main/java/com/paypal/selion/internal/reports/excelreport/ExcelReport.java | ExcelReport.generateReport | public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String sOpDirectory) {
logger.entering(new Object[] { xmlSuites, suites, sOpDirectory });
if (ListenerManager.isCurrentMethodSkipped(this)) {
logger.exiting(ListenerManager.THREAD_EXCLUSION_MSG);
return;
}
if (logger.isLoggable(Level.INFO)) {
logger.log(Level.INFO, "Generating ExcelReport");
}
TestCaseResult.setOutputDirectory(sOpDirectory);
// Generate data to suit excel report.
this.generateSummaryData(suites);
this.generateTCBasedData(allTestsResults);
// Create the Excel Report
this.createExcelReport();
// Render the report
Path p = Paths.get(sOpDirectory, reportFileName);
try {
Path opDirectory = Paths.get(sOpDirectory);
if (!Files.exists(opDirectory)) {
Files.createDirectories(Paths.get(sOpDirectory));
}
FileOutputStream fOut = new FileOutputStream(p.toFile());
wb.write(fOut);
fOut.flush();
} catch (IOException e) {
logger.log(Level.SEVERE, e.getMessage(), e);
}
if (logger.isLoggable(Level.INFO)) {
logger.log(Level.INFO, "Excel File Created @ " + p.toAbsolutePath().toString());
}
} | java | public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String sOpDirectory) {
logger.entering(new Object[] { xmlSuites, suites, sOpDirectory });
if (ListenerManager.isCurrentMethodSkipped(this)) {
logger.exiting(ListenerManager.THREAD_EXCLUSION_MSG);
return;
}
if (logger.isLoggable(Level.INFO)) {
logger.log(Level.INFO, "Generating ExcelReport");
}
TestCaseResult.setOutputDirectory(sOpDirectory);
// Generate data to suit excel report.
this.generateSummaryData(suites);
this.generateTCBasedData(allTestsResults);
// Create the Excel Report
this.createExcelReport();
// Render the report
Path p = Paths.get(sOpDirectory, reportFileName);
try {
Path opDirectory = Paths.get(sOpDirectory);
if (!Files.exists(opDirectory)) {
Files.createDirectories(Paths.get(sOpDirectory));
}
FileOutputStream fOut = new FileOutputStream(p.toFile());
wb.write(fOut);
fOut.flush();
} catch (IOException e) {
logger.log(Level.SEVERE, e.getMessage(), e);
}
if (logger.isLoggable(Level.INFO)) {
logger.log(Level.INFO, "Excel File Created @ " + p.toAbsolutePath().toString());
}
} | [
"public",
"void",
"generateReport",
"(",
"List",
"<",
"XmlSuite",
">",
"xmlSuites",
",",
"List",
"<",
"ISuite",
">",
"suites",
",",
"String",
"sOpDirectory",
")",
"{",
"logger",
".",
"entering",
"(",
"new",
"Object",
"[",
"]",
"{",
"xmlSuites",
",",
"sui... | The first method that gets called when generating the report. Generates data in way the Excel should appear.
Creates the Excel Report and writes it to a file. | [
"The",
"first",
"method",
"that",
"gets",
"called",
"when",
"generating",
"the",
"report",
".",
"Generates",
"data",
"in",
"way",
"the",
"Excel",
"should",
"appear",
".",
"Creates",
"the",
"Excel",
"Report",
"and",
"writes",
"it",
"to",
"a",
"file",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/internal/reports/excelreport/ExcelReport.java#L98-L137 |
twitter/cloudhopper-commons | ch-commons-xbean/src/main/java/com/cloudhopper/commons/xbean/util/PropertiesReplacementUtil.java | PropertiesReplacementUtil.replaceProperties | static public InputStream replaceProperties(File file, Properties props) throws IOException, SubstitutionException {
return replaceProperties(new FileInputStream(file), props);
} | java | static public InputStream replaceProperties(File file, Properties props) throws IOException, SubstitutionException {
return replaceProperties(new FileInputStream(file), props);
} | [
"static",
"public",
"InputStream",
"replaceProperties",
"(",
"File",
"file",
",",
"Properties",
"props",
")",
"throws",
"IOException",
",",
"SubstitutionException",
"{",
"return",
"replaceProperties",
"(",
"new",
"FileInputStream",
"(",
"file",
")",
",",
"props",
... | Creates an InputStream containing the document resulting from replacing template
parameters in the given file.
@param file The template file
@param props The properties
@return An InputStream containing the resulting document. | [
"Creates",
"an",
"InputStream",
"containing",
"the",
"document",
"resulting",
"from",
"replacing",
"template",
"parameters",
"in",
"the",
"given",
"file",
"."
] | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-xbean/src/main/java/com/cloudhopper/commons/xbean/util/PropertiesReplacementUtil.java#L99-L101 |
nakamura5akihito/six-util | src/main/java/jp/go/aist/six/util/core/xml/spring327/AbstractMarshaller.java | AbstractMarshaller.unmarshalSaxSource | protected Object unmarshalSaxSource(SAXSource saxSource) throws XmlMappingException, IOException {
if (saxSource.getXMLReader() == null) {
try {
saxSource.setXMLReader(createXmlReader());
}
catch (SAXException ex) {
throw new UnmarshallingFailureException("Could not create XMLReader for SAXSource", ex);
}
}
if (saxSource.getInputSource() == null) {
saxSource.setInputSource(new InputSource());
}
return unmarshalSaxReader(saxSource.getXMLReader(), saxSource.getInputSource());
} | java | protected Object unmarshalSaxSource(SAXSource saxSource) throws XmlMappingException, IOException {
if (saxSource.getXMLReader() == null) {
try {
saxSource.setXMLReader(createXmlReader());
}
catch (SAXException ex) {
throw new UnmarshallingFailureException("Could not create XMLReader for SAXSource", ex);
}
}
if (saxSource.getInputSource() == null) {
saxSource.setInputSource(new InputSource());
}
return unmarshalSaxReader(saxSource.getXMLReader(), saxSource.getInputSource());
} | [
"protected",
"Object",
"unmarshalSaxSource",
"(",
"SAXSource",
"saxSource",
")",
"throws",
"XmlMappingException",
",",
"IOException",
"{",
"if",
"(",
"saxSource",
".",
"getXMLReader",
"(",
")",
"==",
"null",
")",
"{",
"try",
"{",
"saxSource",
".",
"setXMLReader"... | Template method for handling {@code SAXSource}s.
<p>This implementation delegates to {@code unmarshalSaxReader}.
@param saxSource the {@code SAXSource}
@return the object graph
@throws XmlMappingException if the given source cannot be mapped to an object
@throws IOException if an I/O Exception occurs
@see #unmarshalSaxReader(org.xml.sax.XMLReader, org.xml.sax.InputSource) | [
"Template",
"method",
"for",
"handling",
"{"
] | train | https://github.com/nakamura5akihito/six-util/blob/a6db388a345e220cea2b1fa6324d15c80c6278b6/src/main/java/jp/go/aist/six/util/core/xml/spring327/AbstractMarshaller.java#L345-L358 |
networknt/light-4j | dump/src/main/java/com/networknt/dump/QueryParametersDumper.java | QueryParametersDumper.dumpRequest | @Override
public void dumpRequest(Map<String, Object> result) {
exchange.getQueryParameters().forEach((k, v) -> {
if (config.getRequestFilteredQueryParameters().contains(k)) {
//mask query parameter value
String queryParameterValue = config.isMaskEnabled() ? Mask.maskRegex( v.getFirst(), "queryParameter", k) : v.getFirst();
queryParametersMap.put(k, queryParameterValue);
}
});
this.putDumpInfoTo(result);
} | java | @Override
public void dumpRequest(Map<String, Object> result) {
exchange.getQueryParameters().forEach((k, v) -> {
if (config.getRequestFilteredQueryParameters().contains(k)) {
//mask query parameter value
String queryParameterValue = config.isMaskEnabled() ? Mask.maskRegex( v.getFirst(), "queryParameter", k) : v.getFirst();
queryParametersMap.put(k, queryParameterValue);
}
});
this.putDumpInfoTo(result);
} | [
"@",
"Override",
"public",
"void",
"dumpRequest",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"exchange",
".",
"getQueryParameters",
"(",
")",
".",
"forEach",
"(",
"(",
"k",
",",
"v",
")",
"->",
"{",
"if",
"(",
"config",
".",
... | impl of dumping request query parameter to result
@param result A map you want to put dump information to | [
"impl",
"of",
"dumping",
"request",
"query",
"parameter",
"to",
"result"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/QueryParametersDumper.java#L39-L49 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.delCacheEntry | public void delCacheEntry(CacheEntry ce, int cause, int source, boolean fromDepIdTemplateInvalidation) {
htod.delCacheEntry(ce, cause, source, fromDepIdTemplateInvalidation);
} | java | public void delCacheEntry(CacheEntry ce, int cause, int source, boolean fromDepIdTemplateInvalidation) {
htod.delCacheEntry(ce, cause, source, fromDepIdTemplateInvalidation);
} | [
"public",
"void",
"delCacheEntry",
"(",
"CacheEntry",
"ce",
",",
"int",
"cause",
",",
"int",
"source",
",",
"boolean",
"fromDepIdTemplateInvalidation",
")",
"{",
"htod",
".",
"delCacheEntry",
"(",
"ce",
",",
"cause",
",",
"source",
",",
"fromDepIdTemplateInvalid... | Call this method to a cache entry from the disk.
@param ce
- cache entry. | [
"Call",
"this",
"method",
"to",
"a",
"cache",
"entry",
"from",
"the",
"disk",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1287-L1289 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java | ThreadLocalRandom.longs | public LongStream longs(long streamSize) {
if (streamSize < 0L)
throw new IllegalArgumentException(BAD_SIZE);
return StreamSupport.longStream
(new RandomLongsSpliterator
(0L, streamSize, Long.MAX_VALUE, 0L),
false);
} | java | public LongStream longs(long streamSize) {
if (streamSize < 0L)
throw new IllegalArgumentException(BAD_SIZE);
return StreamSupport.longStream
(new RandomLongsSpliterator
(0L, streamSize, Long.MAX_VALUE, 0L),
false);
} | [
"public",
"LongStream",
"longs",
"(",
"long",
"streamSize",
")",
"{",
"if",
"(",
"streamSize",
"<",
"0L",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"BAD_SIZE",
")",
";",
"return",
"StreamSupport",
".",
"longStream",
"(",
"new",
"RandomLongsSpliterato... | Returns a stream producing the given {@code streamSize} number of
pseudorandom {@code long} values.
@param streamSize the number of values to generate
@return a stream of pseudorandom {@code long} values
@throws IllegalArgumentException if {@code streamSize} is
less than zero
@since 1.8 | [
"Returns",
"a",
"stream",
"producing",
"the",
"given",
"{",
"@code",
"streamSize",
"}",
"number",
"of",
"pseudorandom",
"{",
"@code",
"long",
"}",
"values",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java#L562-L569 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/script/ScriptValidationContext.java | ScriptValidationContext.getValidationScript | public String getValidationScript(TestContext context) {
try {
if (validationScriptResourcePath != null) {
return context.replaceDynamicContentInString(FileUtils.readToString(FileUtils.getFileResource(validationScriptResourcePath, context),
Charset.forName(context.replaceDynamicContentInString(validationScriptResourceCharset))));
} else if (validationScript != null) {
return context.replaceDynamicContentInString(validationScript);
} else {
return "";
}
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to load validation script resource", e);
}
} | java | public String getValidationScript(TestContext context) {
try {
if (validationScriptResourcePath != null) {
return context.replaceDynamicContentInString(FileUtils.readToString(FileUtils.getFileResource(validationScriptResourcePath, context),
Charset.forName(context.replaceDynamicContentInString(validationScriptResourceCharset))));
} else if (validationScript != null) {
return context.replaceDynamicContentInString(validationScript);
} else {
return "";
}
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to load validation script resource", e);
}
} | [
"public",
"String",
"getValidationScript",
"(",
"TestContext",
"context",
")",
"{",
"try",
"{",
"if",
"(",
"validationScriptResourcePath",
"!=",
"null",
")",
"{",
"return",
"context",
".",
"replaceDynamicContentInString",
"(",
"FileUtils",
".",
"readToString",
"(",
... | Constructs the actual validation script either from data or external resource.
@param context the current TestContext.
@return the validationScript
@throws CitrusRuntimeException | [
"Constructs",
"the",
"actual",
"validation",
"script",
"either",
"from",
"data",
"or",
"external",
"resource",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/script/ScriptValidationContext.java#L75-L88 |
buschmais/jqa-maven3-plugin | src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenProjectScannerPlugin.java | MavenProjectScannerPlugin.scanFile | private <F extends FileDescriptor> F scanFile(MavenProjectDirectoryDescriptor projectDescriptor, File file, String path, Scope scope, Scanner scanner) {
scanner.getContext().push(MavenProjectDirectoryDescriptor.class, projectDescriptor);
try {
return scanner.scan(file, path, scope);
} finally {
scanner.getContext().pop(MavenProjectDirectoryDescriptor.class);
}
} | java | private <F extends FileDescriptor> F scanFile(MavenProjectDirectoryDescriptor projectDescriptor, File file, String path, Scope scope, Scanner scanner) {
scanner.getContext().push(MavenProjectDirectoryDescriptor.class, projectDescriptor);
try {
return scanner.scan(file, path, scope);
} finally {
scanner.getContext().pop(MavenProjectDirectoryDescriptor.class);
}
} | [
"private",
"<",
"F",
"extends",
"FileDescriptor",
">",
"F",
"scanFile",
"(",
"MavenProjectDirectoryDescriptor",
"projectDescriptor",
",",
"File",
"file",
",",
"String",
"path",
",",
"Scope",
"scope",
",",
"Scanner",
"scanner",
")",
"{",
"scanner",
".",
"getConte... | Scan a given file.
<p>
The current project is pushed to the context.
</p>
@param projectDescriptor
The maven project descriptor.
@param file
The file.
@param path
The path.
@param scope
The scope.
@param scanner
The scanner. | [
"Scan",
"a",
"given",
"file",
"."
] | train | https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenProjectScannerPlugin.java#L360-L367 |
elki-project/elki | elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/util/DynamicParameters.java | DynamicParameters.addParameter | public synchronized void addParameter(Parameter<?> option, String value, int bits, int depth) {
parameters.add(new Node(option, value, bits, depth));
} | java | public synchronized void addParameter(Parameter<?> option, String value, int bits, int depth) {
parameters.add(new Node(option, value, bits, depth));
} | [
"public",
"synchronized",
"void",
"addParameter",
"(",
"Parameter",
"<",
"?",
">",
"option",
",",
"String",
"value",
",",
"int",
"bits",
",",
"int",
"depth",
")",
"{",
"parameters",
".",
"add",
"(",
"new",
"Node",
"(",
"option",
",",
"value",
",",
"bit... | Add a single parameter to the list
@param option Option
@param value Value
@param bits Bits
@param depth Depth | [
"Add",
"a",
"single",
"parameter",
"to",
"the",
"list"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/util/DynamicParameters.java#L198-L200 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ch/Subtypes2.java | Subtypes2.traverseSupertypesDepthFirst | public void traverseSupertypesDepthFirst(ClassDescriptor start, SupertypeTraversalVisitor visitor) throws ClassNotFoundException {
this.traverseSupertypesDepthFirstHelper(start, visitor, new HashSet<ClassDescriptor>());
} | java | public void traverseSupertypesDepthFirst(ClassDescriptor start, SupertypeTraversalVisitor visitor) throws ClassNotFoundException {
this.traverseSupertypesDepthFirstHelper(start, visitor, new HashSet<ClassDescriptor>());
} | [
"public",
"void",
"traverseSupertypesDepthFirst",
"(",
"ClassDescriptor",
"start",
",",
"SupertypeTraversalVisitor",
"visitor",
")",
"throws",
"ClassNotFoundException",
"{",
"this",
".",
"traverseSupertypesDepthFirstHelper",
"(",
"start",
",",
"visitor",
",",
"new",
"Hash... | Starting at the class or interface named by the given ClassDescriptor,
traverse the inheritance graph depth first, visiting each class only
once. This is much faster than traversing all paths in certain circumstances.
@param start
ClassDescriptor naming the class where the traversal should
start
@param visitor
an InheritanceGraphVisitor
@throws ClassNotFoundException
if the start vertex cannot be resolved | [
"Starting",
"at",
"the",
"class",
"or",
"interface",
"named",
"by",
"the",
"given",
"ClassDescriptor",
"traverse",
"the",
"inheritance",
"graph",
"depth",
"first",
"visiting",
"each",
"class",
"only",
"once",
".",
"This",
"is",
"much",
"faster",
"than",
"trave... | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ch/Subtypes2.java#L1010-L1012 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java | SslContextBuilder.keyManager | public SslContextBuilder keyManager(PrivateKey key, String keyPassword, X509Certificate... keyCertChain) {
if (forServer) {
checkNotNull(keyCertChain, "keyCertChain required for servers");
if (keyCertChain.length == 0) {
throw new IllegalArgumentException("keyCertChain must be non-empty");
}
checkNotNull(key, "key required for servers");
}
if (keyCertChain == null || keyCertChain.length == 0) {
this.keyCertChain = null;
} else {
for (X509Certificate cert: keyCertChain) {
if (cert == null) {
throw new IllegalArgumentException("keyCertChain contains null entry");
}
}
this.keyCertChain = keyCertChain.clone();
}
this.key = key;
this.keyPassword = keyPassword;
keyManagerFactory = null;
return this;
} | java | public SslContextBuilder keyManager(PrivateKey key, String keyPassword, X509Certificate... keyCertChain) {
if (forServer) {
checkNotNull(keyCertChain, "keyCertChain required for servers");
if (keyCertChain.length == 0) {
throw new IllegalArgumentException("keyCertChain must be non-empty");
}
checkNotNull(key, "key required for servers");
}
if (keyCertChain == null || keyCertChain.length == 0) {
this.keyCertChain = null;
} else {
for (X509Certificate cert: keyCertChain) {
if (cert == null) {
throw new IllegalArgumentException("keyCertChain contains null entry");
}
}
this.keyCertChain = keyCertChain.clone();
}
this.key = key;
this.keyPassword = keyPassword;
keyManagerFactory = null;
return this;
} | [
"public",
"SslContextBuilder",
"keyManager",
"(",
"PrivateKey",
"key",
",",
"String",
"keyPassword",
",",
"X509Certificate",
"...",
"keyCertChain",
")",
"{",
"if",
"(",
"forServer",
")",
"{",
"checkNotNull",
"(",
"keyCertChain",
",",
"\"keyCertChain required for serve... | Identifying certificate for this host. {@code keyCertChain} and {@code key} may
be {@code null} for client contexts, which disables mutual authentication.
@param key a PKCS#8 private key file
@param keyPassword the password of the {@code key}, or {@code null} if it's not
password-protected
@param keyCertChain an X.509 certificate chain | [
"Identifying",
"certificate",
"for",
"this",
"host",
".",
"{",
"@code",
"keyCertChain",
"}",
"and",
"{",
"@code",
"key",
"}",
"may",
"be",
"{",
"@code",
"null",
"}",
"for",
"client",
"contexts",
"which",
"disables",
"mutual",
"authentication",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L310-L332 |
eurekaclinical/protempa | protempa-ksb-protege/src/main/java/org/protempa/backend/ksb/protege/ProtegeKnowledgeSourceBackend.java | ProtegeKnowledgeSourceBackend.readClass | private Cls readClass(String name, String superClass)
throws KnowledgeSourceReadException {
Cls cls = this.cm.getCls(name);
Cls superCls = this.cm.getCls(superClass);
if (cls != null && cls.hasSuperclass(superCls)) {
return cls;
} else {
return null;
}
} | java | private Cls readClass(String name, String superClass)
throws KnowledgeSourceReadException {
Cls cls = this.cm.getCls(name);
Cls superCls = this.cm.getCls(superClass);
if (cls != null && cls.hasSuperclass(superCls)) {
return cls;
} else {
return null;
}
} | [
"private",
"Cls",
"readClass",
"(",
"String",
"name",
",",
"String",
"superClass",
")",
"throws",
"KnowledgeSourceReadException",
"{",
"Cls",
"cls",
"=",
"this",
".",
"cm",
".",
"getCls",
"(",
"name",
")",
";",
"Cls",
"superCls",
"=",
"this",
".",
"cm",
... | Returns the Cls from Protege if a matching Cls is found with the given
ancestor
@param name Name of the class to fetch
@param superClass name of the anscestor
@return A Cls containing the given class name
@throws KnowledgeSourceReadException | [
"Returns",
"the",
"Cls",
"from",
"Protege",
"if",
"a",
"matching",
"Cls",
"is",
"found",
"with",
"the",
"given",
"ancestor"
] | train | https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-ksb-protege/src/main/java/org/protempa/backend/ksb/protege/ProtegeKnowledgeSourceBackend.java#L222-L231 |
woo-j/OkapiBarcode | src/main/java/uk/org/okapibarcode/OkapiBarcode.java | OkapiBarcode.main | public static void main(String[] args) {
Settings settings = new Settings();
new JCommander(settings, args);
if (!settings.isGuiSupressed()) {
OkapiUI okapiUi = new OkapiUI();
okapiUi.setVisible(true);
} else {
int returnValue;
returnValue = commandLine(settings);
if (returnValue != 0) {
System.out.println("An error occurred");
}
}
} | java | public static void main(String[] args) {
Settings settings = new Settings();
new JCommander(settings, args);
if (!settings.isGuiSupressed()) {
OkapiUI okapiUi = new OkapiUI();
okapiUi.setVisible(true);
} else {
int returnValue;
returnValue = commandLine(settings);
if (returnValue != 0) {
System.out.println("An error occurred");
}
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"Settings",
"settings",
"=",
"new",
"Settings",
"(",
")",
";",
"new",
"JCommander",
"(",
"settings",
",",
"args",
")",
";",
"if",
"(",
"!",
"settings",
".",
"isGuiSupressed"... | Starts the Okapi Barcode UI.
@param args the command line arguments | [
"Starts",
"the",
"Okapi",
"Barcode",
"UI",
"."
] | train | https://github.com/woo-j/OkapiBarcode/blob/d1cb4f4ab64557cd3db64d9a473528a52ce58081/src/main/java/uk/org/okapibarcode/OkapiBarcode.java#L41-L57 |
youngmonkeys/ezyfox-sfs2x | src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/MessageEventHandler.java | MessageEventHandler.notifyToHandlers | protected void notifyToHandlers(Object message, ISFSObject params) {
if(params == null) params = new SFSObject();
for(ServerHandlerClass handler : handlers) {
notifyToHandler(handler, message, params);
}
} | java | protected void notifyToHandlers(Object message, ISFSObject params) {
if(params == null) params = new SFSObject();
for(ServerHandlerClass handler : handlers) {
notifyToHandler(handler, message, params);
}
} | [
"protected",
"void",
"notifyToHandlers",
"(",
"Object",
"message",
",",
"ISFSObject",
"params",
")",
"{",
"if",
"(",
"params",
"==",
"null",
")",
"params",
"=",
"new",
"SFSObject",
"(",
")",
";",
"for",
"(",
"ServerHandlerClass",
"handler",
":",
"handlers",
... | Propagate event to handlers
@param message message data
@param params addition data to send | [
"Propagate",
"event",
"to",
"handlers"
] | train | https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/MessageEventHandler.java#L34-L39 |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/LocalCall.java | LocalCall.callAsync | public CompletionStage<Optional<Map<String, CompletionStage<Result<R>>>>> callAsync(
SaltClient client,
Target<?> target,
AuthMethod auth,
EventStream events,
CompletionStage<GenericError> cancel,
Batch batch) {
return callAsync(client, target, auth, events, cancel, Optional.of(batch));
} | java | public CompletionStage<Optional<Map<String, CompletionStage<Result<R>>>>> callAsync(
SaltClient client,
Target<?> target,
AuthMethod auth,
EventStream events,
CompletionStage<GenericError> cancel,
Batch batch) {
return callAsync(client, target, auth, events, cancel, Optional.of(batch));
} | [
"public",
"CompletionStage",
"<",
"Optional",
"<",
"Map",
"<",
"String",
",",
"CompletionStage",
"<",
"Result",
"<",
"R",
">",
">",
">",
">",
">",
"callAsync",
"(",
"SaltClient",
"client",
",",
"Target",
"<",
"?",
">",
"target",
",",
"AuthMethod",
"auth"... | Calls this salt call via the async client and returns the results
as they come in via the event stream.
@param client SaltClient instance
@param target the target for the function
@param events the event stream to use
@param cancel future to cancel the action
@param auth authentication credentials to use
@param batch parameter for enabling and configuring batching
@return a map from minion id to future of the result. | [
"Calls",
"this",
"salt",
"call",
"via",
"the",
"async",
"client",
"and",
"returns",
"the",
"results",
"as",
"they",
"come",
"in",
"via",
"the",
"event",
"stream",
"."
] | train | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/LocalCall.java#L193-L201 |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/operations/deployment/DeploymentUploadUtil.java | DeploymentUploadUtil.addContentToExplodedAndTransformOperation | public static byte[] addContentToExplodedAndTransformOperation(OperationContext context, ModelNode operation, ContentRepository contentRepository) throws OperationFailedException, ExplodedContentException {
final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS);
ModelNode contentItem = getContentItem(deploymentResource);
byte[] oldHash = CONTENT_HASH.resolveModelAttribute(context, contentItem).asBytes();
List<ModelNode> contents = CONTENT_PARAM_ALL_EXPLODED.resolveModelAttribute(context, operation).asList();
final List<ExplodedContent> addedFiles = new ArrayList<>(contents.size());
final ModelNode slave = operation.clone();
ModelNode slaveAddedfiles = slave.get(UPDATED_PATHS.getName()).setEmptyList();
for(ModelNode content : contents) {
InputStream in;
if(hasValidContentAdditionParameterDefined(content)) {
in = getInputStream(context, content);
} else {
in = null;
}
String path = TARGET_PATH.resolveModelAttribute(context, content).asString();
addedFiles.add(new ExplodedContent(path, in));
slaveAddedfiles.add(path);
}
final boolean overwrite = OVERWRITE.resolveModelAttribute(context, operation).asBoolean(true);
final byte[] hash = contentRepository.addContentToExploded(oldHash, addedFiles, overwrite);
// Clear the contents and update with the hash
ModelNode addedContent = new ModelNode().setEmptyObject();
addedContent.get(HASH).set(hash);
addedContent.get(TARGET_PATH.getName()).set(".");
slave.get(CONTENT).setEmptyList().add(addedContent);
// Add the domain op transformer
List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);
if (transformers == null) {
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());
}
transformers.add(new CompositeOperationAwareTransmuter(slave));
return hash;
} | java | public static byte[] addContentToExplodedAndTransformOperation(OperationContext context, ModelNode operation, ContentRepository contentRepository) throws OperationFailedException, ExplodedContentException {
final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS);
ModelNode contentItem = getContentItem(deploymentResource);
byte[] oldHash = CONTENT_HASH.resolveModelAttribute(context, contentItem).asBytes();
List<ModelNode> contents = CONTENT_PARAM_ALL_EXPLODED.resolveModelAttribute(context, operation).asList();
final List<ExplodedContent> addedFiles = new ArrayList<>(contents.size());
final ModelNode slave = operation.clone();
ModelNode slaveAddedfiles = slave.get(UPDATED_PATHS.getName()).setEmptyList();
for(ModelNode content : contents) {
InputStream in;
if(hasValidContentAdditionParameterDefined(content)) {
in = getInputStream(context, content);
} else {
in = null;
}
String path = TARGET_PATH.resolveModelAttribute(context, content).asString();
addedFiles.add(new ExplodedContent(path, in));
slaveAddedfiles.add(path);
}
final boolean overwrite = OVERWRITE.resolveModelAttribute(context, operation).asBoolean(true);
final byte[] hash = contentRepository.addContentToExploded(oldHash, addedFiles, overwrite);
// Clear the contents and update with the hash
ModelNode addedContent = new ModelNode().setEmptyObject();
addedContent.get(HASH).set(hash);
addedContent.get(TARGET_PATH.getName()).set(".");
slave.get(CONTENT).setEmptyList().add(addedContent);
// Add the domain op transformer
List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);
if (transformers == null) {
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());
}
transformers.add(new CompositeOperationAwareTransmuter(slave));
return hash;
} | [
"public",
"static",
"byte",
"[",
"]",
"addContentToExplodedAndTransformOperation",
"(",
"OperationContext",
"context",
",",
"ModelNode",
"operation",
",",
"ContentRepository",
"contentRepository",
")",
"throws",
"OperationFailedException",
",",
"ExplodedContentException",
"{"... | Add contents to the deployment and attach a "transformed" slave operation to the operation context.
@param context the operation context
@param operation the original operation
@param contentRepository the content repository
@return the hash of the uploaded deployment content
@throws IOException
@throws OperationFailedException | [
"Add",
"contents",
"to",
"the",
"deployment",
"and",
"attach",
"a",
"transformed",
"slave",
"operation",
"to",
"the",
"operation",
"context",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/deployment/DeploymentUploadUtil.java#L180-L215 |
landawn/AbacusUtil | src/com/landawn/abacus/util/StringUtil.java | StringUtil.swapCase | public static String swapCase(final String str) {
if (N.isNullOrEmpty(str)) {
return str;
}
final char[] cbuf = str.toCharArray();
char ch = 0;
for (int i = 0, len = cbuf.length; i < len; i++) {
ch = cbuf[i];
if (Character.isUpperCase(ch) || Character.isTitleCase(ch)) {
cbuf[i] = Character.toLowerCase(ch);
} else if (Character.isLowerCase(ch)) {
cbuf[i] = Character.toUpperCase(ch);
}
}
return newString(cbuf, true);
} | java | public static String swapCase(final String str) {
if (N.isNullOrEmpty(str)) {
return str;
}
final char[] cbuf = str.toCharArray();
char ch = 0;
for (int i = 0, len = cbuf.length; i < len; i++) {
ch = cbuf[i];
if (Character.isUpperCase(ch) || Character.isTitleCase(ch)) {
cbuf[i] = Character.toLowerCase(ch);
} else if (Character.isLowerCase(ch)) {
cbuf[i] = Character.toUpperCase(ch);
}
}
return newString(cbuf, true);
} | [
"public",
"static",
"String",
"swapCase",
"(",
"final",
"String",
"str",
")",
"{",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"str",
")",
")",
"{",
"return",
"str",
";",
"}",
"final",
"char",
"[",
"]",
"cbuf",
"=",
"str",
".",
"toCharArray",
"(",
"... | <p>
Swaps the case of a String changing upper and title case to lower case,
and lower case to upper case.
</p>
<ul>
<li>Upper case character converts to Lower case</li>
<li>Title case character converts to Lower case</li>
<li>Lower case character converts to Upper case</li>
</ul>
<p>
For a word based algorithm, see
{@link org.apache.commons.lang3.text.WordUtils#swapCase(String)}. A
{@code null} input String returns {@code null}.
</p>
<pre>
N.swapCase(null) = null
N.swapCase("") = ""
N.swapCase("The dog has a BONE") = "tHE DOG HAS A bone"
</pre>
<p>
NOTE: This method changed in Lang version 2.0. It no longer performs a
word based algorithm. If you only use ASCII, you will notice no change.
That functionality is available in
org.apache.commons.lang3.text.WordUtils.
</p>
@param str
the String to swap case, may be null
@return the changed String, {@code null} if null String input | [
"<p",
">",
"Swaps",
"the",
"case",
"of",
"a",
"String",
"changing",
"upper",
"and",
"title",
"case",
"to",
"lower",
"case",
"and",
"lower",
"case",
"to",
"upper",
"case",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L763-L781 |
micronaut-projects/micronaut-core | core/src/main/java/io/micronaut/core/beans/AbstractBeanIntrospection.java | AbstractBeanIntrospection.indexProperty | @SuppressWarnings("unused")
@Internal
@UsedByGeneratedCode
protected final void indexProperty(
@Nonnull Class<? extends Annotation> annotationType,
@Nonnull String propertyName,
@Nonnull String annotationValue) {
indexProperty(annotationType, propertyName);
if (StringUtils.isNotEmpty(annotationValue) && StringUtils.isNotEmpty(propertyName)) {
if (indexedValues == null) {
indexedValues = new HashMap<>(10);
}
final BeanProperty<T, Object> property = beanProperties.get(propertyName);
indexedValues.put(new AnnotationValueKey(annotationType, annotationValue), property);
}
} | java | @SuppressWarnings("unused")
@Internal
@UsedByGeneratedCode
protected final void indexProperty(
@Nonnull Class<? extends Annotation> annotationType,
@Nonnull String propertyName,
@Nonnull String annotationValue) {
indexProperty(annotationType, propertyName);
if (StringUtils.isNotEmpty(annotationValue) && StringUtils.isNotEmpty(propertyName)) {
if (indexedValues == null) {
indexedValues = new HashMap<>(10);
}
final BeanProperty<T, Object> property = beanProperties.get(propertyName);
indexedValues.put(new AnnotationValueKey(annotationType, annotationValue), property);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"@",
"Internal",
"@",
"UsedByGeneratedCode",
"protected",
"final",
"void",
"indexProperty",
"(",
"@",
"Nonnull",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
",",
"@",
"Nonnull",
"String",
"p... | Used to produce an index for particular annotation type. Method referenced by generated byte code and
not for public consumption. Should be called after {@link #addProperty(BeanProperty)} if required.
@param annotationType The annotation type
@param propertyName The property name
@param annotationValue The annotation value | [
"Used",
"to",
"produce",
"an",
"index",
"for",
"particular",
"annotation",
"type",
".",
"Method",
"referenced",
"by",
"generated",
"byte",
"code",
"and",
"not",
"for",
"public",
"consumption",
".",
"Should",
"be",
"called",
"after",
"{",
"@link",
"#addProperty... | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/beans/AbstractBeanIntrospection.java#L204-L219 |
samskivert/samskivert | src/main/java/com/samskivert/jdbc/JORARepository.java | JORARepository.loadByExample | protected <T> T loadByExample (
final Table<T> table, final T example, final FieldMask mask)
throws PersistenceException
{
return execute(new Operation<T>() {
public T invoke (Connection conn, DatabaseLiaison liaison)
throws SQLException, PersistenceException
{
return table.queryByExample(conn, example, mask).get();
}
});
} | java | protected <T> T loadByExample (
final Table<T> table, final T example, final FieldMask mask)
throws PersistenceException
{
return execute(new Operation<T>() {
public T invoke (Connection conn, DatabaseLiaison liaison)
throws SQLException, PersistenceException
{
return table.queryByExample(conn, example, mask).get();
}
});
} | [
"protected",
"<",
"T",
">",
"T",
"loadByExample",
"(",
"final",
"Table",
"<",
"T",
">",
"table",
",",
"final",
"T",
"example",
",",
"final",
"FieldMask",
"mask",
")",
"throws",
"PersistenceException",
"{",
"return",
"execute",
"(",
"new",
"Operation",
"<",... | Loads a single object from the specified table that matches the
supplied example. <em>Note:</em> the query should match one or zero
records, not more. | [
"Loads",
"a",
"single",
"object",
"from",
"the",
"specified",
"table",
"that",
"matches",
"the",
"supplied",
"example",
".",
"<em",
">",
"Note",
":",
"<",
"/",
"em",
">",
"the",
"query",
"should",
"match",
"one",
"or",
"zero",
"records",
"not",
"more",
... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/JORARepository.java#L223-L234 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.deleteRegexEntityModel | public OperationStatus deleteRegexEntityModel(UUID appId, String versionId, UUID regexEntityId) {
return deleteRegexEntityModelWithServiceResponseAsync(appId, versionId, regexEntityId).toBlocking().single().body();
} | java | public OperationStatus deleteRegexEntityModel(UUID appId, String versionId, UUID regexEntityId) {
return deleteRegexEntityModelWithServiceResponseAsync(appId, versionId, regexEntityId).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"deleteRegexEntityModel",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"regexEntityId",
")",
"{",
"return",
"deleteRegexEntityModelWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"regexEntityId",
")",
".",
... | Deletes a regex entity model from the application.
@param appId The application ID.
@param versionId The version ID.
@param regexEntityId The regex entity extractor ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Deletes",
"a",
"regex",
"entity",
"model",
"from",
"the",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L10369-L10371 |
structr/structr | structr-modules/structr-signed-jar-module/src/main/java/org/structr/jar/SignedJarBuilder.java | SignedJarBuilder.writeEntry | private void writeEntry(final InputStream input, final JarEntry entry) throws IOException {
// add the entry to the jar archive
jarOutputStream.putNextEntry(entry);
// read the content of the entry from the input stream, and write it into the archive.
int count;
while ((count = input.read(buffer)) != -1) {
jarOutputStream.write(buffer, 0, count);
if (messageDigest != null) {
messageDigest.update(buffer, 0, count);
}
}
jarOutputStream.closeEntry();
if (manifest != null) {
Attributes attr = manifest.getAttributes(entry.getName());
if (attr == null) {
attr = new Attributes();
manifest.getEntries().put(entry.getName(), attr);
}
attr.putValue("SHA1-Digest", new String(Base64.encode(messageDigest.digest()), "ASCII"));
}
} | java | private void writeEntry(final InputStream input, final JarEntry entry) throws IOException {
// add the entry to the jar archive
jarOutputStream.putNextEntry(entry);
// read the content of the entry from the input stream, and write it into the archive.
int count;
while ((count = input.read(buffer)) != -1) {
jarOutputStream.write(buffer, 0, count);
if (messageDigest != null) {
messageDigest.update(buffer, 0, count);
}
}
jarOutputStream.closeEntry();
if (manifest != null) {
Attributes attr = manifest.getAttributes(entry.getName());
if (attr == null) {
attr = new Attributes();
manifest.getEntries().put(entry.getName(), attr);
}
attr.putValue("SHA1-Digest", new String(Base64.encode(messageDigest.digest()), "ASCII"));
}
} | [
"private",
"void",
"writeEntry",
"(",
"final",
"InputStream",
"input",
",",
"final",
"JarEntry",
"entry",
")",
"throws",
"IOException",
"{",
"// add the entry to the jar archive",
"jarOutputStream",
".",
"putNextEntry",
"(",
"entry",
")",
";",
"// read the content of th... | Adds an entry to the output jar, and write its content from the {@link InputStream}
@param input The input stream from where to write the entry content.
@param entry the entry to write in the jar.
@throws IOException | [
"Adds",
"an",
"entry",
"to",
"the",
"output",
"jar",
"and",
"write",
"its",
"content",
"from",
"the",
"{",
"@link",
"InputStream",
"}"
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-modules/structr-signed-jar-module/src/main/java/org/structr/jar/SignedJarBuilder.java#L164-L194 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/FacetUrl.java | FacetUrl.getFacetUrl | public static MozuUrl getFacetUrl(Integer facetId, String responseFields, Boolean validate)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/facets/{facetId}?validate={validate}&responseFields={responseFields}");
formatter.formatUrl("facetId", facetId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("validate", validate);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getFacetUrl(Integer facetId, String responseFields, Boolean validate)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/facets/{facetId}?validate={validate}&responseFields={responseFields}");
formatter.formatUrl("facetId", facetId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("validate", validate);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getFacetUrl",
"(",
"Integer",
"facetId",
",",
"String",
"responseFields",
",",
"Boolean",
"validate",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/facets/{facetId}?validate={validate}&... | Get Resource Url for GetFacet
@param facetId Unique identifier of the facet to retrieve.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param validate Validates that the product category associated with a facet is active. System-supplied and read only.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetFacet"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/FacetUrl.java#L23-L30 |
vdurmont/etaprinter | src/main/java/com/vdurmont/etaprinter/ETAStatusGenerator.java | ETAStatusGenerator.getStatus | public static String getStatus(String elementName, long percentage, double speed, String speedUnit, Duration eta) {
StringBuilder sb = new StringBuilder(getBar(percentage));
sb.append((long) speed);
if (elementName != null) {
sb.append(" ").append(elementName);
}
sb.append("/").append(speedUnit);
sb.append(" ETA ").append(FORMATTER.print(eta.toPeriod()));
return sb.toString();
} | java | public static String getStatus(String elementName, long percentage, double speed, String speedUnit, Duration eta) {
StringBuilder sb = new StringBuilder(getBar(percentage));
sb.append((long) speed);
if (elementName != null) {
sb.append(" ").append(elementName);
}
sb.append("/").append(speedUnit);
sb.append(" ETA ").append(FORMATTER.print(eta.toPeriod()));
return sb.toString();
} | [
"public",
"static",
"String",
"getStatus",
"(",
"String",
"elementName",
",",
"long",
"percentage",
",",
"double",
"speed",
",",
"String",
"speedUnit",
",",
"Duration",
"eta",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"getBar",
"(",
... | Generate the full status.
@param elementName the optional name of the element that is processed
@param percentage the progression percentage
@param speed the speed of the processing (in number of element by speed unit)
@param speedUnit the unit of the given speed
@param eta the estimated remaining duration for the processing
@return the status string | [
"Generate",
"the",
"full",
"status",
"."
] | train | https://github.com/vdurmont/etaprinter/blob/19039bdbbece8b05ceab2a23757f4e1e8b6872cb/src/main/java/com/vdurmont/etaprinter/ETAStatusGenerator.java#L46-L55 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java | SheetRowResourcesImpl.sendRow | @Deprecated
public void sendRow(long sheetId, long rowId, RowEmail email) throws SmartsheetException {
this.createResource("sheets/" + sheetId + "/rows/" + rowId + "/emails", RowEmail.class, email);
} | java | @Deprecated
public void sendRow(long sheetId, long rowId, RowEmail email) throws SmartsheetException {
this.createResource("sheets/" + sheetId + "/rows/" + rowId + "/emails", RowEmail.class, email);
} | [
"@",
"Deprecated",
"public",
"void",
"sendRow",
"(",
"long",
"sheetId",
",",
"long",
"rowId",
",",
"RowEmail",
"email",
")",
"throws",
"SmartsheetException",
"{",
"this",
".",
"createResource",
"(",
"\"sheets/\"",
"+",
"sheetId",
"+",
"\"/rows/\"",
"+",
"rowId... | @deprecated as of API V2.0.2, replaced by {@link #sendRows(long, MultiRowEmail)}
Send a row via email to the designated recipients.
It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/rows/{rowId}/emails
Exceptions:
IllegalArgumentException : if any argument is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param sheetId the id of the sheet
@param rowId the id of the row
@param email the row email
@throws SmartsheetException the smartsheet exception | [
"@deprecated",
"as",
"of",
"API",
"V2",
".",
"0",
".",
"2",
"replaced",
"by",
"{",
"@link",
"#sendRows",
"(",
"long",
"MultiRowEmail",
")",
"}",
"Send",
"a",
"row",
"via",
"email",
"to",
"the",
"designated",
"recipients",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java#L207-L210 |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/options/OptionsImpl.java | OptionsImpl.propertiesFileUpdated | protected void propertiesFileUpdated(Properties updated, long sequence) {
Properties newProps = new Properties(getDefaultOptions());
Enumeration<?> propsEnum = updated.propertyNames();
while (propsEnum.hasMoreElements()) {
String name = (String)propsEnum.nextElement();
newProps.setProperty(name, updated.getProperty(name));
}
setProps(newProps);
updateNotify(sequence);
} | java | protected void propertiesFileUpdated(Properties updated, long sequence) {
Properties newProps = new Properties(getDefaultOptions());
Enumeration<?> propsEnum = updated.propertyNames();
while (propsEnum.hasMoreElements()) {
String name = (String)propsEnum.nextElement();
newProps.setProperty(name, updated.getProperty(name));
}
setProps(newProps);
updateNotify(sequence);
} | [
"protected",
"void",
"propertiesFileUpdated",
"(",
"Properties",
"updated",
",",
"long",
"sequence",
")",
"{",
"Properties",
"newProps",
"=",
"new",
"Properties",
"(",
"getDefaultOptions",
"(",
")",
")",
";",
"Enumeration",
"<",
"?",
">",
"propsEnum",
"=",
"up... | Listener method for being informed of changes to the properties file by another
instance of this class. Called by other instances of this class for instances
that use the same properties file when properties are saved.
@param updated
the updated properties
@param sequence
the update sequence number | [
"Listener",
"method",
"for",
"being",
"informed",
"of",
"changes",
"to",
"the",
"properties",
"file",
"by",
"another",
"instance",
"of",
"this",
"class",
".",
"Called",
"by",
"other",
"instances",
"of",
"this",
"class",
"for",
"instances",
"that",
"use",
"th... | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/options/OptionsImpl.java#L356-L365 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/graph/primitives/Graph.java | Graph.addEdge | @Override
public void addEdge(int from, int to, E value, boolean directed) {
addEdge(new Edge<>(from, to, value, directed));
} | java | @Override
public void addEdge(int from, int to, E value, boolean directed) {
addEdge(new Edge<>(from, to, value, directed));
} | [
"@",
"Override",
"public",
"void",
"addEdge",
"(",
"int",
"from",
",",
"int",
"to",
",",
"E",
"value",
",",
"boolean",
"directed",
")",
"{",
"addEdge",
"(",
"new",
"Edge",
"<>",
"(",
"from",
",",
"to",
",",
"value",
",",
"directed",
")",
")",
";",
... | Convenience method for adding an edge (directed or undirected) to graph
@param from
@param to
@param value
@param directed | [
"Convenience",
"method",
"for",
"adding",
"an",
"edge",
"(",
"directed",
"or",
"undirected",
")",
"to",
"graph"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/graph/primitives/Graph.java#L162-L165 |
alkacon/opencms-core | src/org/opencms/ade/containerpage/inherited/CmsInheritanceGroupUtils.java | CmsInheritanceGroupUtils.getInheritanceGroupContentByName | public static CmsResource getInheritanceGroupContentByName(CmsObject cms, String name) throws CmsException {
String oldSiteRoot = cms.getRequestContext().getSiteRoot();
try {
cms.getRequestContext().setSiteRoot("");
List<CmsResource> resources = cms.readResourcesWithProperty(
"/",
CmsPropertyDefinition.PROPERTY_KEYWORDS,
name);
Iterator<CmsResource> resourceIter = resources.iterator();
while (resourceIter.hasNext()) {
CmsResource currentRes = resourceIter.next();
if (!OpenCms.getResourceManager().getResourceType(currentRes).getTypeName().equals(
"inheritance_group")) {
resourceIter.remove();
}
}
if (resources.isEmpty()) {
throw new CmsVfsResourceNotFoundException(
org.opencms.gwt.Messages.get().container(
org.opencms.gwt.Messages.ERR_INHERITANCE_GROUP_NOT_FOUND_1,
name));
}
return resources.get(0);
} finally {
cms.getRequestContext().setSiteRoot(oldSiteRoot);
}
} | java | public static CmsResource getInheritanceGroupContentByName(CmsObject cms, String name) throws CmsException {
String oldSiteRoot = cms.getRequestContext().getSiteRoot();
try {
cms.getRequestContext().setSiteRoot("");
List<CmsResource> resources = cms.readResourcesWithProperty(
"/",
CmsPropertyDefinition.PROPERTY_KEYWORDS,
name);
Iterator<CmsResource> resourceIter = resources.iterator();
while (resourceIter.hasNext()) {
CmsResource currentRes = resourceIter.next();
if (!OpenCms.getResourceManager().getResourceType(currentRes).getTypeName().equals(
"inheritance_group")) {
resourceIter.remove();
}
}
if (resources.isEmpty()) {
throw new CmsVfsResourceNotFoundException(
org.opencms.gwt.Messages.get().container(
org.opencms.gwt.Messages.ERR_INHERITANCE_GROUP_NOT_FOUND_1,
name));
}
return resources.get(0);
} finally {
cms.getRequestContext().setSiteRoot(oldSiteRoot);
}
} | [
"public",
"static",
"CmsResource",
"getInheritanceGroupContentByName",
"(",
"CmsObject",
"cms",
",",
"String",
"name",
")",
"throws",
"CmsException",
"{",
"String",
"oldSiteRoot",
"=",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getSiteRoot",
"(",
")",
";",
... | Finds the inheritance group content with a given internal name.<p>
Currently this is implemented as a property search, which may be potentially slow.<p>
@param cms the current CMS context
@param name the name to search
@return the inheritance group resource
@throws CmsException if something goes wrong | [
"Finds",
"the",
"inheritance",
"group",
"content",
"with",
"a",
"given",
"internal",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/inherited/CmsInheritanceGroupUtils.java#L70-L97 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/Validate.java | Validate.notEmpty | public static <T extends Map<?, ?>> T notEmpty(final T map, final String message, final Object... values) {
return INSTANCE.notEmpty(map, message, values);
} | java | public static <T extends Map<?, ?>> T notEmpty(final T map, final String message, final Object... values) {
return INSTANCE.notEmpty(map, message, values);
} | [
"public",
"static",
"<",
"T",
"extends",
"Map",
"<",
"?",
",",
"?",
">",
">",
"T",
"notEmpty",
"(",
"final",
"T",
"map",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"return",
"INSTANCE",
".",
"notEmpty",
"(",... | <p>Validate that the specified argument map is neither {@code null} nor a size of zero (no elements); otherwise throwing an exception with the specified message.
<pre>Validate.notEmpty(myMap, "The map must not be empty");</pre>
@param <T>
the map type
@param map
the map to check, validated not null by this method
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param values
the optional values for the formatted exception message, null array not recommended
@return the validated map (never {@code null} method for chaining)
@throws NullPointerValidationException
if the map is {@code null}
@throws IllegalArgumentException
if the map is empty
@see #notEmpty(Object[]) | [
"<p",
">",
"Validate",
"that",
"the",
"specified",
"argument",
"map",
"is",
"neither",
"{",
"@code",
"null",
"}",
"nor",
"a",
"size",
"of",
"zero",
"(",
"no",
"elements",
")",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/Validate.java#L916-L918 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/interactions/Actions.java | Actions.dragAndDropBy | public Actions dragAndDropBy(WebElement source, int xOffset, int yOffset) {
if (isBuildingActions()) {
action.addAction(new ClickAndHoldAction(jsonMouse, (Locatable) source));
action.addAction(new MoveToOffsetAction(jsonMouse, null, xOffset, yOffset));
action.addAction(new ButtonReleaseAction(jsonMouse, null));
}
return moveInTicks(source, 0, 0)
.tick(defaultMouse.createPointerDown(LEFT.asArg()))
.tick(defaultMouse.createPointerMove(Duration.ofMillis(250), Origin.pointer(), xOffset, yOffset))
.tick(defaultMouse.createPointerUp(LEFT.asArg()));
} | java | public Actions dragAndDropBy(WebElement source, int xOffset, int yOffset) {
if (isBuildingActions()) {
action.addAction(new ClickAndHoldAction(jsonMouse, (Locatable) source));
action.addAction(new MoveToOffsetAction(jsonMouse, null, xOffset, yOffset));
action.addAction(new ButtonReleaseAction(jsonMouse, null));
}
return moveInTicks(source, 0, 0)
.tick(defaultMouse.createPointerDown(LEFT.asArg()))
.tick(defaultMouse.createPointerMove(Duration.ofMillis(250), Origin.pointer(), xOffset, yOffset))
.tick(defaultMouse.createPointerUp(LEFT.asArg()));
} | [
"public",
"Actions",
"dragAndDropBy",
"(",
"WebElement",
"source",
",",
"int",
"xOffset",
",",
"int",
"yOffset",
")",
"{",
"if",
"(",
"isBuildingActions",
"(",
")",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"ClickAndHoldAction",
"(",
"jsonMouse",
","... | A convenience method that performs click-and-hold at the location of the source element,
moves by a given offset, then releases the mouse.
@param source element to emulate button down at.
@param xOffset horizontal move offset.
@param yOffset vertical move offset.
@return A self reference. | [
"A",
"convenience",
"method",
"that",
"performs",
"click",
"-",
"and",
"-",
"hold",
"at",
"the",
"location",
"of",
"the",
"source",
"element",
"moves",
"by",
"a",
"given",
"offset",
"then",
"releases",
"the",
"mouse",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L470-L481 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxRetentionPolicy.java | BoxRetentionPolicy.getAll | public static Iterable<BoxRetentionPolicy.Info> getAll(final BoxAPIConnection api, String ... fields) {
return getAll(null, null, null, DEFAULT_LIMIT, api, fields);
} | java | public static Iterable<BoxRetentionPolicy.Info> getAll(final BoxAPIConnection api, String ... fields) {
return getAll(null, null, null, DEFAULT_LIMIT, api, fields);
} | [
"public",
"static",
"Iterable",
"<",
"BoxRetentionPolicy",
".",
"Info",
">",
"getAll",
"(",
"final",
"BoxAPIConnection",
"api",
",",
"String",
"...",
"fields",
")",
"{",
"return",
"getAll",
"(",
"null",
",",
"null",
",",
"null",
",",
"DEFAULT_LIMIT",
",",
... | Returns all the retention policies.
@param api the API connection to be used by the resource.
@param fields the fields to retrieve.
@return an iterable with all the retention policies. | [
"Returns",
"all",
"the",
"retention",
"policies",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxRetentionPolicy.java#L346-L348 |
ops4j/org.ops4j.pax.logging | pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java | ThrowableProxy.getCauseStackTraceAsString | public String getCauseStackTraceAsString(final List<String> ignorePackages, final TextRenderer textRenderer, final String suffix) {
final StringBuilder sb = new StringBuilder();
if (this.causeProxy != null) {
this.formatWrapper(sb, this.causeProxy, ignorePackages, textRenderer, suffix);
sb.append(WRAPPED_BY_LABEL);
renderSuffix(suffix, sb, textRenderer);
}
this.renderOn(sb, textRenderer);
renderSuffix(suffix, sb, textRenderer);
textRenderer.render(EOL_STR, sb, "Text");
this.formatElements(sb, Strings.EMPTY, 0, this.throwable.getStackTrace(), this.extendedStackTrace,
ignorePackages, textRenderer, suffix);
return sb.toString();
} | java | public String getCauseStackTraceAsString(final List<String> ignorePackages, final TextRenderer textRenderer, final String suffix) {
final StringBuilder sb = new StringBuilder();
if (this.causeProxy != null) {
this.formatWrapper(sb, this.causeProxy, ignorePackages, textRenderer, suffix);
sb.append(WRAPPED_BY_LABEL);
renderSuffix(suffix, sb, textRenderer);
}
this.renderOn(sb, textRenderer);
renderSuffix(suffix, sb, textRenderer);
textRenderer.render(EOL_STR, sb, "Text");
this.formatElements(sb, Strings.EMPTY, 0, this.throwable.getStackTrace(), this.extendedStackTrace,
ignorePackages, textRenderer, suffix);
return sb.toString();
} | [
"public",
"String",
"getCauseStackTraceAsString",
"(",
"final",
"List",
"<",
"String",
">",
"ignorePackages",
",",
"final",
"TextRenderer",
"textRenderer",
",",
"final",
"String",
"suffix",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"("... | Formats the Throwable that is the cause of this Throwable.
@param ignorePackages The List of packages to be suppressed from the trace.
@param textRenderer the text renderer
@param suffix
@return The formatted Throwable that caused this Throwable. | [
"Formats",
"the",
"Throwable",
"that",
"is",
"the",
"cause",
"of",
"this",
"Throwable",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java#L422-L435 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java | QueryReferenceBroker.retrieveProxyReference | public void retrieveProxyReference(Object obj, ClassDescriptor cld, ObjectReferenceDescriptor rds, boolean forced)
{
PersistentField refField;
Object refObj = null;
pb.getInternalCache().enableMaterializationCache();
try
{
Identity id = getReferencedObjectIdentity(obj, rds, cld);
if (id != null){
refObj = pb.createProxy(rds.getItemClass(), id);
}
refField = rds.getPersistentField();
refField.set(obj, refObj);
if ((refObj != null) && prefetchProxies
&& (m_retrievalTasks != null)
&& (rds.getProxyPrefetchingLimit() > 0))
{
IndirectionHandler handler = ProxyHelper.getIndirectionHandler(refObj);
if ((handler != null)
&& addRetrievalTask(obj, rds))
{
new PBMaterializationListener(obj, m_retrievalTasks,
rds, rds.getProxyPrefetchingLimit());
}
}
pb.getInternalCache().disableMaterializationCache();
}
catch(RuntimeException e)
{
pb.getInternalCache().doLocalClear();
throw e;
}
} | java | public void retrieveProxyReference(Object obj, ClassDescriptor cld, ObjectReferenceDescriptor rds, boolean forced)
{
PersistentField refField;
Object refObj = null;
pb.getInternalCache().enableMaterializationCache();
try
{
Identity id = getReferencedObjectIdentity(obj, rds, cld);
if (id != null){
refObj = pb.createProxy(rds.getItemClass(), id);
}
refField = rds.getPersistentField();
refField.set(obj, refObj);
if ((refObj != null) && prefetchProxies
&& (m_retrievalTasks != null)
&& (rds.getProxyPrefetchingLimit() > 0))
{
IndirectionHandler handler = ProxyHelper.getIndirectionHandler(refObj);
if ((handler != null)
&& addRetrievalTask(obj, rds))
{
new PBMaterializationListener(obj, m_retrievalTasks,
rds, rds.getProxyPrefetchingLimit());
}
}
pb.getInternalCache().disableMaterializationCache();
}
catch(RuntimeException e)
{
pb.getInternalCache().doLocalClear();
throw e;
}
} | [
"public",
"void",
"retrieveProxyReference",
"(",
"Object",
"obj",
",",
"ClassDescriptor",
"cld",
",",
"ObjectReferenceDescriptor",
"rds",
",",
"boolean",
"forced",
")",
"{",
"PersistentField",
"refField",
";",
"Object",
"refObj",
"=",
"null",
";",
"pb",
".",
"ge... | Retrieve a single Reference.
This implementation retrieves a referenced object from the data backend
if <b>cascade-retrieve</b> is true or if <b>forced</b> is true.
@param obj - object that will have it's field set with a referenced object.
@param cld - the ClassDescriptor describring obj
@param rds - the ObjectReferenceDescriptor of the reference attribute to be loaded
@param forced - if set to true, the reference is loaded even if the rds differs. | [
"Retrieve",
"a",
"single",
"Reference",
".",
"This",
"implementation",
"retrieves",
"a",
"referenced",
"object",
"from",
"the",
"data",
"backend",
"if",
"<b",
">",
"cascade",
"-",
"retrieve<",
"/",
"b",
">",
"is",
"true",
"or",
"if",
"<b",
">",
"forced<",
... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L477-L515 |
hypfvieh/java-utils | src/main/java/com/github/hypfvieh/util/SystemUtil.java | SystemUtil.normalizePath | public static String normalizePath(String _path, boolean _appendFinalSeparator) {
if (_path == null) {
return _path;
}
String path = _path
.replace("\\", FILE_SEPARATOR)
.replace("/", FILE_SEPARATOR);
if (_appendFinalSeparator && !path.endsWith(FILE_SEPARATOR)) {
path += FILE_SEPARATOR;
}
return path;
} | java | public static String normalizePath(String _path, boolean _appendFinalSeparator) {
if (_path == null) {
return _path;
}
String path = _path
.replace("\\", FILE_SEPARATOR)
.replace("/", FILE_SEPARATOR);
if (_appendFinalSeparator && !path.endsWith(FILE_SEPARATOR)) {
path += FILE_SEPARATOR;
}
return path;
} | [
"public",
"static",
"String",
"normalizePath",
"(",
"String",
"_path",
",",
"boolean",
"_appendFinalSeparator",
")",
"{",
"if",
"(",
"_path",
"==",
"null",
")",
"{",
"return",
"_path",
";",
"}",
"String",
"path",
"=",
"_path",
".",
"replace",
"(",
"\"\\\\\... | Normalize a file system path expression for the current OS.
Replaces path separators by this OS's path separator.
Appends a final path separator if parameter is set
and if not yet present.
@param _path path
@param _appendFinalSeparator controls appendix of separator at the end
@return normalized path | [
"Normalize",
"a",
"file",
"system",
"path",
"expression",
"for",
"the",
"current",
"OS",
".",
"Replaces",
"path",
"separators",
"by",
"this",
"OS",
"s",
"path",
"separator",
".",
"Appends",
"a",
"final",
"path",
"separator",
"if",
"parameter",
"is",
"set",
... | train | https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/SystemUtil.java#L409-L421 |
roboconf/roboconf-platform | core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/extensions/AbstractRoutingClient.java | AbstractRoutingClient.unsubscribe | protected void unsubscribe( String id, MessagingContext ctx ) throws IOException {
if( ! canProceed())
return;
Set<MessagingContext> sub = this.routingContext.subscriptions.get( id );
if( sub != null ) {
sub.remove( ctx );
if( sub.isEmpty())
this.routingContext.subscriptions.remove( id );
}
} | java | protected void unsubscribe( String id, MessagingContext ctx ) throws IOException {
if( ! canProceed())
return;
Set<MessagingContext> sub = this.routingContext.subscriptions.get( id );
if( sub != null ) {
sub.remove( ctx );
if( sub.isEmpty())
this.routingContext.subscriptions.remove( id );
}
} | [
"protected",
"void",
"unsubscribe",
"(",
"String",
"id",
",",
"MessagingContext",
"ctx",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"canProceed",
"(",
")",
")",
"return",
";",
"Set",
"<",
"MessagingContext",
">",
"sub",
"=",
"this",
".",
"routingCo... | Unregisters a subscription between an ID and a context.
@param id a client ID
@param ctx a messaging context
@throws IOException | [
"Unregisters",
"a",
"subscription",
"between",
"an",
"ID",
"and",
"a",
"context",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/extensions/AbstractRoutingClient.java#L286-L297 |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspElFunctions.java | CmsJspElFunctions.convertResource | public static CmsJspResourceWrapper convertResource(CmsObject cms, Object input) throws CmsException {
CmsJspResourceWrapper result;
if (input instanceof CmsResource) {
result = CmsJspResourceWrapper.wrap(cms, (CmsResource)input);
} else {
result = CmsJspResourceWrapper.wrap(cms, convertRawResource(cms, input));
}
return result;
} | java | public static CmsJspResourceWrapper convertResource(CmsObject cms, Object input) throws CmsException {
CmsJspResourceWrapper result;
if (input instanceof CmsResource) {
result = CmsJspResourceWrapper.wrap(cms, (CmsResource)input);
} else {
result = CmsJspResourceWrapper.wrap(cms, convertRawResource(cms, input));
}
return result;
} | [
"public",
"static",
"CmsJspResourceWrapper",
"convertResource",
"(",
"CmsObject",
"cms",
",",
"Object",
"input",
")",
"throws",
"CmsException",
"{",
"CmsJspResourceWrapper",
"result",
";",
"if",
"(",
"input",
"instanceof",
"CmsResource",
")",
"{",
"result",
"=",
"... | Returns a resource wrapper created from the input.
The wrapped result of {@link #convertRawResource(CmsObject, Object)} is returned.
@param cms the current OpenCms user context
@param input the input to create a resource from
@return a resource wrapper created from the given Object
@throws CmsException in case of errors accessing the OpenCms VFS for reading the resource | [
"Returns",
"a",
"resource",
"wrapper",
"created",
"from",
"the",
"input",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspElFunctions.java#L365-L374 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/archivalurl/StandardAttributeRewriter.java | StandardAttributeRewriter.initTransformers | protected void initTransformers() {
if (jsBlockTrans == null)
jsBlockTrans = new JSStringTransformer();
URLStringTransformer anchorTrans = new URLStringTransformer();
anchorTrans.setJsTransformer(jsBlockTrans);
transformers = new HashMap<String, StringTransformer>();
transformers.put("fw", new URLStringTransformer("fw_"));
transformers.put("if", new URLStringTransformer("if_"));
transformers.put("cs", new URLStringTransformer("cs_"));
transformers.put("js", new URLStringTransformer("js_"));
transformers.put("im", new URLStringTransformer("im_"));
transformers.put("oe", new URLStringTransformer("oe_"));
transformers.put("an", anchorTrans);
transformers.put("jb", jsBlockTrans);
transformers.put("ci", new InlineCSSStringTransformer());
transformers.put("mt", new MetaRefreshUrlStringTransformer());
transformers.put("ss", new SrcsetStringTransformer());
transformers.put("in", new RegexReplaceStringTransformer("^.*$", ""));
if (customTransformers != null) {
transformers.putAll(customTransformers);
customTransformers = null;
}
} | java | protected void initTransformers() {
if (jsBlockTrans == null)
jsBlockTrans = new JSStringTransformer();
URLStringTransformer anchorTrans = new URLStringTransformer();
anchorTrans.setJsTransformer(jsBlockTrans);
transformers = new HashMap<String, StringTransformer>();
transformers.put("fw", new URLStringTransformer("fw_"));
transformers.put("if", new URLStringTransformer("if_"));
transformers.put("cs", new URLStringTransformer("cs_"));
transformers.put("js", new URLStringTransformer("js_"));
transformers.put("im", new URLStringTransformer("im_"));
transformers.put("oe", new URLStringTransformer("oe_"));
transformers.put("an", anchorTrans);
transformers.put("jb", jsBlockTrans);
transformers.put("ci", new InlineCSSStringTransformer());
transformers.put("mt", new MetaRefreshUrlStringTransformer());
transformers.put("ss", new SrcsetStringTransformer());
transformers.put("in", new RegexReplaceStringTransformer("^.*$", ""));
if (customTransformers != null) {
transformers.putAll(customTransformers);
customTransformers = null;
}
} | [
"protected",
"void",
"initTransformers",
"(",
")",
"{",
"if",
"(",
"jsBlockTrans",
"==",
"null",
")",
"jsBlockTrans",
"=",
"new",
"JSStringTransformer",
"(",
")",
";",
"URLStringTransformer",
"anchorTrans",
"=",
"new",
"URLStringTransformer",
"(",
")",
";",
"anc... | Initialize {@code StringTransformer}s, register them to
{@code transformers} map by their name. | [
"Initialize",
"{"
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/archivalurl/StandardAttributeRewriter.java#L211-L235 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java | DefaultFaceletFactory.getViewMetadataFacelet | @Override
public Facelet getViewMetadataFacelet(FacesContext facesContext, String uri)
throws IOException
{
URL url = (URL) _relativeLocations.get(uri);
if (url == null)
{
url = resolveURL(facesContext, getBaseUrl(), uri);
ViewResource viewResource = (ViewResource) facesContext.getAttributes().get(
FaceletFactory.LAST_RESOURCE_RESOLVED);
if (url != null)
{
if (viewResource != null)
{
// If a view resource has been used to resolve a resource, the cache is in
// the ResourceHandler implementation. No need to cache in _relativeLocations.
}
else
{
Map<String, URL> newLoc = new HashMap<String, URL>(_relativeLocations);
newLoc.put(uri, url);
_relativeLocations = newLoc;
}
}
else
{
throw new IOException("'" + uri + "' not found.");
}
}
return this.getViewMetadataFacelet(url);
} | java | @Override
public Facelet getViewMetadataFacelet(FacesContext facesContext, String uri)
throws IOException
{
URL url = (URL) _relativeLocations.get(uri);
if (url == null)
{
url = resolveURL(facesContext, getBaseUrl(), uri);
ViewResource viewResource = (ViewResource) facesContext.getAttributes().get(
FaceletFactory.LAST_RESOURCE_RESOLVED);
if (url != null)
{
if (viewResource != null)
{
// If a view resource has been used to resolve a resource, the cache is in
// the ResourceHandler implementation. No need to cache in _relativeLocations.
}
else
{
Map<String, URL> newLoc = new HashMap<String, URL>(_relativeLocations);
newLoc.put(uri, url);
_relativeLocations = newLoc;
}
}
else
{
throw new IOException("'" + uri + "' not found.");
}
}
return this.getViewMetadataFacelet(url);
} | [
"@",
"Override",
"public",
"Facelet",
"getViewMetadataFacelet",
"(",
"FacesContext",
"facesContext",
",",
"String",
"uri",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"(",
"URL",
")",
"_relativeLocations",
".",
"get",
"(",
"uri",
")",
";",
"if",
"(... | Works in the same way as getFacelet(String uri), but redirect
to getViewMetadataFacelet(URL url)
@since 2.0 | [
"Works",
"in",
"the",
"same",
"way",
"as",
"getFacelet",
"(",
"String",
"uri",
")",
"but",
"redirect",
"to",
"getViewMetadataFacelet",
"(",
"URL",
"url",
")"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java#L464-L494 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/AbstractEntityReader.java | AbstractEntityReader.recursivelyFindEntities | public Object recursivelyFindEntities(Object entity, Map<String, Object> relationsMap, EntityMetadata m,
PersistenceDelegator pd, boolean lazilyLoaded, Map<Object, Object> relationStack)
{
return handleAssociation(entity, relationsMap, m, pd, lazilyLoaded, relationStack);
} | java | public Object recursivelyFindEntities(Object entity, Map<String, Object> relationsMap, EntityMetadata m,
PersistenceDelegator pd, boolean lazilyLoaded, Map<Object, Object> relationStack)
{
return handleAssociation(entity, relationsMap, m, pd, lazilyLoaded, relationStack);
} | [
"public",
"Object",
"recursivelyFindEntities",
"(",
"Object",
"entity",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"relationsMap",
",",
"EntityMetadata",
"m",
",",
"PersistenceDelegator",
"pd",
",",
"boolean",
"lazilyLoaded",
",",
"Map",
"<",
"Object",
",",
... | Recursively fetches associated entities for a given <code>entity</code>
@param entity
@param relationsMap
@param client
@param m
@param pd
@return | [
"Recursively",
"fetches",
"associated",
"entities",
"for",
"a",
"given",
"<code",
">",
"entity<",
"/",
"code",
">"
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/AbstractEntityReader.java#L518-L523 |
jbake-org/jbake | jbake-core/src/main/java/org/jbake/app/ContentStore.java | ContentStore.mergeDocument | public ODocument mergeDocument(Map<String, ? extends Object> incomingDocMap)
{
String sourceUri = (String) incomingDocMap.get(DocumentAttributes.SOURCE_URI.toString());
if (null == sourceUri)
throw new IllegalArgumentException("Document sourceUri is null.");
String docType = (String) incomingDocMap.get(Crawler.Attributes.TYPE);
if (null == docType)
throw new IllegalArgumentException("Document docType is null.");
// Get a document by sourceUri
String sql = "SELECT * FROM " + docType + " WHERE sourceuri=?";
activateOnCurrentThread();
List<ODocument> results = db.command(new OSQLSynchQuery<ODocument>(sql)).execute(sourceUri);
if (results.size() == 0)
throw new JBakeException("No document with sourceUri '"+sourceUri+"'.");
// Update it from the given map.
ODocument incomingDoc = new ODocument(docType);
incomingDoc.fromMap(incomingDocMap);
ODocument merged = results.get(0).merge(incomingDoc, true, false);
return merged;
} | java | public ODocument mergeDocument(Map<String, ? extends Object> incomingDocMap)
{
String sourceUri = (String) incomingDocMap.get(DocumentAttributes.SOURCE_URI.toString());
if (null == sourceUri)
throw new IllegalArgumentException("Document sourceUri is null.");
String docType = (String) incomingDocMap.get(Crawler.Attributes.TYPE);
if (null == docType)
throw new IllegalArgumentException("Document docType is null.");
// Get a document by sourceUri
String sql = "SELECT * FROM " + docType + " WHERE sourceuri=?";
activateOnCurrentThread();
List<ODocument> results = db.command(new OSQLSynchQuery<ODocument>(sql)).execute(sourceUri);
if (results.size() == 0)
throw new JBakeException("No document with sourceUri '"+sourceUri+"'.");
// Update it from the given map.
ODocument incomingDoc = new ODocument(docType);
incomingDoc.fromMap(incomingDocMap);
ODocument merged = results.get(0).merge(incomingDoc, true, false);
return merged;
} | [
"public",
"ODocument",
"mergeDocument",
"(",
"Map",
"<",
"String",
",",
"?",
"extends",
"Object",
">",
"incomingDocMap",
")",
"{",
"String",
"sourceUri",
"=",
"(",
"String",
")",
"incomingDocMap",
".",
"get",
"(",
"DocumentAttributes",
".",
"SOURCE_URI",
".",
... | Get a document by sourceUri and update it from the given map.
@param incomingDocMap The document's db columns.
@return The saved document.
@throws IllegalArgumentException if sourceUri or docType are null, or if the document doesn't exist. | [
"Get",
"a",
"document",
"by",
"sourceUri",
"and",
"update",
"it",
"from",
"the",
"given",
"map",
"."
] | train | https://github.com/jbake-org/jbake/blob/beb9042a54bf0eb168821d524c88b9ea0bee88dc/jbake-core/src/main/java/org/jbake/app/ContentStore.java#L194-L215 |
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-eclipse/src/main/java/org/ops4j/pax/exam/container/eclipse/EclipseOptions.java | EclipseOptions.fromTarget | public static EclipseTargetPlatform fromTarget(InputStream targetDefinition, File cacheFolder)
throws IOException {
return new TargetResolver(targetDefinition, cacheFolder);
} | java | public static EclipseTargetPlatform fromTarget(InputStream targetDefinition, File cacheFolder)
throws IOException {
return new TargetResolver(targetDefinition, cacheFolder);
} | [
"public",
"static",
"EclipseTargetPlatform",
"fromTarget",
"(",
"InputStream",
"targetDefinition",
",",
"File",
"cacheFolder",
")",
"throws",
"IOException",
"{",
"return",
"new",
"TargetResolver",
"(",
"targetDefinition",
",",
"cacheFolder",
")",
";",
"}"
] | Use an Eclipse Target file to provision bundles from, the cache folder can be used to specify
a location where the resolve result of the target is stored (e.g. if the target is based on
software-sites) the cache will be refreshed if the sequenceNumber changes but in no other
circumstances so it might be needed to clear the cache if something changes on the remote
server but the target stays unmodified.
@param targetDefinition
@param cacheFolder
@return
@throws IOException | [
"Use",
"an",
"Eclipse",
"Target",
"file",
"to",
"provision",
"bundles",
"from",
"the",
"cache",
"folder",
"can",
"be",
"used",
"to",
"specify",
"a",
"location",
"where",
"the",
"resolve",
"result",
"of",
"the",
"target",
"is",
"stored",
"(",
"e",
".",
"g... | train | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-eclipse/src/main/java/org/ops4j/pax/exam/container/eclipse/EclipseOptions.java#L132-L135 |
HeidelTime/heideltime | src/jflexcrf/Viterbi.java | Viterbi.computeVi | public void computeVi(List seq, int pos, DoubleVector Vi, boolean isExp) {
Vi.assign(0.0);
// start scan features for sequence "seq" at position "pos"
model.taggerFGen.startScanSFeaturesAt(seq, pos);
// examine all features at position "pos"
while (model.taggerFGen.hasNextSFeature()) {
Feature f = model.taggerFGen.nextSFeature();
if (f.ftype == Feature.STAT_FEATURE1) {
Vi.vect[f.y] += model.lambda[f.idx] * f.val;
}
}
// take exponential operator
if (isExp) {
for (int i = 0; i < Vi.len; i++) {
Vi.vect[i] = Math.exp(Vi.vect[i]);
}
}
} | java | public void computeVi(List seq, int pos, DoubleVector Vi, boolean isExp) {
Vi.assign(0.0);
// start scan features for sequence "seq" at position "pos"
model.taggerFGen.startScanSFeaturesAt(seq, pos);
// examine all features at position "pos"
while (model.taggerFGen.hasNextSFeature()) {
Feature f = model.taggerFGen.nextSFeature();
if (f.ftype == Feature.STAT_FEATURE1) {
Vi.vect[f.y] += model.lambda[f.idx] * f.val;
}
}
// take exponential operator
if (isExp) {
for (int i = 0; i < Vi.len; i++) {
Vi.vect[i] = Math.exp(Vi.vect[i]);
}
}
} | [
"public",
"void",
"computeVi",
"(",
"List",
"seq",
",",
"int",
"pos",
",",
"DoubleVector",
"Vi",
",",
"boolean",
"isExp",
")",
"{",
"Vi",
".",
"assign",
"(",
"0.0",
")",
";",
"// start scan features for sequence \"seq\" at position \"pos\"",
"model",
".",
"tagge... | Compute vi.
@param seq the seq
@param pos the pos
@param Vi the vi
@param isExp the is exp | [
"Compute",
"vi",
"."
] | train | https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/jflexcrf/Viterbi.java#L139-L159 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java | ShapeGenerator.createRoundRectangle | public Shape createRoundRectangle(final int x, final int y, final int w, final int h, final CornerSize size, final CornerStyle topLeft,
final CornerStyle bottomLeft, final CornerStyle bottomRight, final CornerStyle topRight) {
return createRoundRectangleInternal(x, y, w, h, size.getRadius(w, h), topLeft, bottomLeft, bottomRight, topRight);
} | java | public Shape createRoundRectangle(final int x, final int y, final int w, final int h, final CornerSize size, final CornerStyle topLeft,
final CornerStyle bottomLeft, final CornerStyle bottomRight, final CornerStyle topRight) {
return createRoundRectangleInternal(x, y, w, h, size.getRadius(w, h), topLeft, bottomLeft, bottomRight, topRight);
} | [
"public",
"Shape",
"createRoundRectangle",
"(",
"final",
"int",
"x",
",",
"final",
"int",
"y",
",",
"final",
"int",
"w",
",",
"final",
"int",
"h",
",",
"final",
"CornerSize",
"size",
",",
"final",
"CornerStyle",
"topLeft",
",",
"final",
"CornerStyle",
"bot... | Return a path for a rectangle with optionally rounded corners.
@param x the X coordinate of the upper-left corner of the
rectangle
@param y the Y coordinate of the upper-left corner of the
rectangle
@param w the width of the rectangle
@param h the height of the rectangle
@param size the CornerSize value representing the amount of
rounding
@param topLeft the CornerStyle of the upper-left corner. This must
be one of {@code CornerStyle.SQUARE} or
{@code CornerStyle.ROUNDED}.
@param bottomLeft the CornerStyle of the lower-left corner. This must
be one of {@code CornerStyle.SQUARE} or
{@code CornerStyle.ROUNDED}.
@param bottomRight the CornerStyle of the lower-right corner. This must
be one of {@code CornerStyle.SQUARE} or
{@code CornerStyle.ROUNDED}.
@param topRight the CornerStyle of the upper-right corner. This must
be one of {@code CornerStyle.SQUARE} or
{@code CornerStyle.ROUNDED}.
@return a path representing the shape. | [
"Return",
"a",
"path",
"for",
"a",
"rectangle",
"with",
"optionally",
"rounded",
"corners",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L239-L242 |
GerdHolz/TOVAL | src/de/invation/code/toval/validate/Validate.java | Validate.inclusiveBetween | public static <T extends Object> void inclusiveBetween(T start, T end, Comparable<T> value) {
if(!validation) return;
Validate.notNull(start);
Validate.notNull(end);
Validate.notNull(value);
if(value.compareTo(start) < 0)
throw new ParameterException(ErrorCode.RANGEVIOLATION, "Parameter is not in range ["+start+";"+end+"]: " + value);
if(value.compareTo(end) > 0)
throw new ParameterException(ErrorCode.RANGEVIOLATION, "Parameter is not in range ["+start+";"+end+"]: " + value);
} | java | public static <T extends Object> void inclusiveBetween(T start, T end, Comparable<T> value) {
if(!validation) return;
Validate.notNull(start);
Validate.notNull(end);
Validate.notNull(value);
if(value.compareTo(start) < 0)
throw new ParameterException(ErrorCode.RANGEVIOLATION, "Parameter is not in range ["+start+";"+end+"]: " + value);
if(value.compareTo(end) > 0)
throw new ParameterException(ErrorCode.RANGEVIOLATION, "Parameter is not in range ["+start+";"+end+"]: " + value);
} | [
"public",
"static",
"<",
"T",
"extends",
"Object",
">",
"void",
"inclusiveBetween",
"(",
"T",
"start",
",",
"T",
"end",
",",
"Comparable",
"<",
"T",
">",
"value",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"Validate",
".",
"notNull",
... | Checks if the given value lies in between the start and end values (inclusive).
@param start The start value (lower bound).
@param end The end value (upper bound).
@param value The comparable value to validate.
@throws ParameterException if some parameters are <code>null</code>, the given value lies not between the start and end values. | [
"Checks",
"if",
"the",
"given",
"value",
"lies",
"in",
"between",
"the",
"start",
"and",
"end",
"values",
"(",
"inclusive",
")",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L361-L370 |
apache/incubator-druid | server/src/main/java/org/apache/druid/curator/discovery/DiscoveryModule.java | DiscoveryModule.register | public static void register(Binder binder, Annotation annotation)
{
registerKey(binder, Key.get(new TypeLiteral<DruidNode>(){}, annotation));
} | java | public static void register(Binder binder, Annotation annotation)
{
registerKey(binder, Key.get(new TypeLiteral<DruidNode>(){}, annotation));
} | [
"public",
"static",
"void",
"register",
"(",
"Binder",
"binder",
",",
"Annotation",
"annotation",
")",
"{",
"registerKey",
"(",
"binder",
",",
"Key",
".",
"get",
"(",
"new",
"TypeLiteral",
"<",
"DruidNode",
">",
"(",
")",
"{",
"}",
",",
"annotation",
")"... | Requests that the annotated DruidNode instance be injected and published as part of the lifecycle.
That is, this module will announce the DruidNode instance returned by
injector.getInstance(Key.get(DruidNode.class, annotation)) automatically.
Announcement will happen in the ANNOUNCEMENTS stage of the Lifecycle
@param annotation The annotation instance to use in finding the DruidNode instance, usually a Named annotation | [
"Requests",
"that",
"the",
"annotated",
"DruidNode",
"instance",
"be",
"injected",
"and",
"published",
"as",
"part",
"of",
"the",
"lifecycle",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/curator/discovery/DiscoveryModule.java#L112-L115 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/CharInfo.java | CharInfo.defineChar2StringMapping | boolean defineChar2StringMapping(String outputString, char inputChar)
{
CharKey character = new CharKey(inputChar);
m_charToString.put(character, outputString);
set(inputChar); // mark the character has having a mapping to a String
boolean extraMapping = extraEntity(outputString, inputChar);
return extraMapping;
} | java | boolean defineChar2StringMapping(String outputString, char inputChar)
{
CharKey character = new CharKey(inputChar);
m_charToString.put(character, outputString);
set(inputChar); // mark the character has having a mapping to a String
boolean extraMapping = extraEntity(outputString, inputChar);
return extraMapping;
} | [
"boolean",
"defineChar2StringMapping",
"(",
"String",
"outputString",
",",
"char",
"inputChar",
")",
"{",
"CharKey",
"character",
"=",
"new",
"CharKey",
"(",
"inputChar",
")",
";",
"m_charToString",
".",
"put",
"(",
"character",
",",
"outputString",
")",
";",
... | Call this method to register a char to String mapping, for example
to map '<' to "<".
@param outputString The String to map to.
@param inputChar The char to map from.
@return true if the mapping is not one of:
<ul>
<li> '<' to "<"
<li> '>' to ">"
<li> '&' to "&"
<li> '"' to """
</ul> | [
"Call",
"this",
"method",
"to",
"register",
"a",
"char",
"to",
"String",
"mapping",
"for",
"example",
"to",
"map",
"<",
"to",
"<",
";",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/CharInfo.java#L738-L747 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/maplayer/MultiMapLayer.java | MultiMapLayer.fireLayerAddedEvent | protected void fireLayerAddedEvent(MapLayer layer, int index) {
fireLayerHierarchyChangedEvent(new MapLayerHierarchyEvent(this, layer, Type.ADD_CHILD, index, layer.isTemporaryLayer()));
} | java | protected void fireLayerAddedEvent(MapLayer layer, int index) {
fireLayerHierarchyChangedEvent(new MapLayerHierarchyEvent(this, layer, Type.ADD_CHILD, index, layer.isTemporaryLayer()));
} | [
"protected",
"void",
"fireLayerAddedEvent",
"(",
"MapLayer",
"layer",
",",
"int",
"index",
")",
"{",
"fireLayerHierarchyChangedEvent",
"(",
"new",
"MapLayerHierarchyEvent",
"(",
"this",
",",
"layer",
",",
"Type",
".",
"ADD_CHILD",
",",
"index",
",",
"layer",
"."... | Fire the event that indicates a layer was added.
@param layer is the added layer.
@param index is the insertion index. | [
"Fire",
"the",
"event",
"that",
"indicates",
"a",
"layer",
"was",
"added",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/maplayer/MultiMapLayer.java#L443-L445 |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/AT_Context.java | AT_Context.setFrameTopBottomMargin | public AT_Context setFrameTopBottomMargin(int frameTop, int frameBottom){
if(frameTop>-1 && frameBottom>-1){
this.frameTopMargin = frameTop;
this.frameBottomMargin = frameBottom;
}
return this;
} | java | public AT_Context setFrameTopBottomMargin(int frameTop, int frameBottom){
if(frameTop>-1 && frameBottom>-1){
this.frameTopMargin = frameTop;
this.frameBottomMargin = frameBottom;
}
return this;
} | [
"public",
"AT_Context",
"setFrameTopBottomMargin",
"(",
"int",
"frameTop",
",",
"int",
"frameBottom",
")",
"{",
"if",
"(",
"frameTop",
">",
"-",
"1",
"&&",
"frameBottom",
">",
"-",
"1",
")",
"{",
"this",
".",
"frameTopMargin",
"=",
"frameTop",
";",
"this",... | Sets the top and bottom frame margin.
@param frameTop margin
@param frameBottom margin
@return this to allow chaining | [
"Sets",
"the",
"top",
"and",
"bottom",
"frame",
"margin",
"."
] | train | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Context.java#L294-L300 |
kmi/iserve | iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java | Util.getMatchType | public static DiscoMatchType getMatchType(boolean isSubsume, boolean isPlugin) {
if (isSubsume) {
if (isPlugin) {
// If plugin and subsume -> this is an exact match
return DiscoMatchType.Exact;
}
return DiscoMatchType.Subsume;
} else {
if (isPlugin) {
return DiscoMatchType.Plugin;
}
}
return DiscoMatchType.Fail;
} | java | public static DiscoMatchType getMatchType(boolean isSubsume, boolean isPlugin) {
if (isSubsume) {
if (isPlugin) {
// If plugin and subsume -> this is an exact match
return DiscoMatchType.Exact;
}
return DiscoMatchType.Subsume;
} else {
if (isPlugin) {
return DiscoMatchType.Plugin;
}
}
return DiscoMatchType.Fail;
} | [
"public",
"static",
"DiscoMatchType",
"getMatchType",
"(",
"boolean",
"isSubsume",
",",
"boolean",
"isPlugin",
")",
"{",
"if",
"(",
"isSubsume",
")",
"{",
"if",
"(",
"isPlugin",
")",
"{",
"// If plugin and subsume -> this is an exact match",
"return",
"DiscoMatchType"... | Given the match between concepts obtain the match type
@param isSubsume true if the concept match is subsumes
@param isPlugin true if the concept match is plugin
@return Exact, Plugin or Subsumes depending on the values | [
"Given",
"the",
"match",
"between",
"concepts",
"obtain",
"the",
"match",
"type"
] | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L513-L526 |
VoltDB/voltdb | src/frontend/org/voltdb/importer/ChannelDistributer.java | ChannelDistributer.asChannelSet | static NavigableSet<ChannelSpec> asChannelSet(byte[] data)
throws JSONException, IllegalArgumentException {
ImmutableSortedSet.Builder<ChannelSpec> sbld = ImmutableSortedSet.naturalOrder();
JSONArray ja = new JSONArray(new String(data, StandardCharsets.UTF_8));
for (int i=0; i< ja.length(); ++i) {
sbld.add(new ChannelSpec(ja.getString(i)));
}
return sbld.build();
} | java | static NavigableSet<ChannelSpec> asChannelSet(byte[] data)
throws JSONException, IllegalArgumentException {
ImmutableSortedSet.Builder<ChannelSpec> sbld = ImmutableSortedSet.naturalOrder();
JSONArray ja = new JSONArray(new String(data, StandardCharsets.UTF_8));
for (int i=0; i< ja.length(); ++i) {
sbld.add(new ChannelSpec(ja.getString(i)));
}
return sbld.build();
} | [
"static",
"NavigableSet",
"<",
"ChannelSpec",
">",
"asChannelSet",
"(",
"byte",
"[",
"]",
"data",
")",
"throws",
"JSONException",
",",
"IllegalArgumentException",
"{",
"ImmutableSortedSet",
".",
"Builder",
"<",
"ChannelSpec",
">",
"sbld",
"=",
"ImmutableSortedSet",
... | Reads the JSON document contained in the byte array data, and
converts it to a {@link NavigableSet<ChannelSpec> set of channel specs}
@param data zookeeper node data content
@return a {@link NavigableSet<ChannelSpec> set of channel specs}
@throws JSONException on JSON parse failures
@throws IllegalArgumentException on encoded channel spec parse failures | [
"Reads",
"the",
"JSON",
"document",
"contained",
"in",
"the",
"byte",
"array",
"data",
"and",
"converts",
"it",
"to",
"a",
"{",
"@link",
"NavigableSet<ChannelSpec",
">",
"set",
"of",
"channel",
"specs",
"}"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/importer/ChannelDistributer.java#L184-L192 |
eurekaclinical/protempa | protempa-framework/src/main/java/org/protempa/TemporalExtendedParameterDefinition.java | TemporalExtendedParameterDefinition.getMatches | @Override
boolean getMatches(Proposition proposition, Collection<String> propIds) throws KnowledgeSourceReadException {
if (!super.getMatches(proposition, propIds)) {
return false;
}
if (!(proposition instanceof TemporalParameter)) {
return false;
}
TemporalParameter tp = (TemporalParameter) proposition;
if (this.value != null) {
Value pValue = tp.getValue();
if (this.value != pValue && !this.value.equals(pValue)) {
return false;
}
}
return true;
} | java | @Override
boolean getMatches(Proposition proposition, Collection<String> propIds) throws KnowledgeSourceReadException {
if (!super.getMatches(proposition, propIds)) {
return false;
}
if (!(proposition instanceof TemporalParameter)) {
return false;
}
TemporalParameter tp = (TemporalParameter) proposition;
if (this.value != null) {
Value pValue = tp.getValue();
if (this.value != pValue && !this.value.equals(pValue)) {
return false;
}
}
return true;
} | [
"@",
"Override",
"boolean",
"getMatches",
"(",
"Proposition",
"proposition",
",",
"Collection",
"<",
"String",
">",
"propIds",
")",
"throws",
"KnowledgeSourceReadException",
"{",
"if",
"(",
"!",
"super",
".",
"getMatches",
"(",
"proposition",
",",
"propIds",
")"... | Returns whether a parameter has the same id and value, and consistent
duration as specified by this extended parameter definition.
@param parameter a <code>Parameter</code>
@return <code>true</code> if <code>parameter</code> has the same id and
value, and consistent duration as specified by this extended parameter
definition, or <code>false</code> if not, or if <code>parameter</code>
is <code>null</code>. | [
"Returns",
"whether",
"a",
"parameter",
"has",
"the",
"same",
"id",
"and",
"value",
"and",
"consistent",
"duration",
"as",
"specified",
"by",
"this",
"extended",
"parameter",
"definition",
"."
] | train | https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/TemporalExtendedParameterDefinition.java#L60-L78 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/RegressionPlan.java | RegressionPlan.createRegressionSuite | public RegressionSuite createRegressionSuite(String name, Map<String, Object> attributes) {
return getInstance().create().regressionSuite(name, this, attributes);
} | java | public RegressionSuite createRegressionSuite(String name, Map<String, Object> attributes) {
return getInstance().create().regressionSuite(name, this, attributes);
} | [
"public",
"RegressionSuite",
"createRegressionSuite",
"(",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
")",
"{",
"return",
"getInstance",
"(",
")",
".",
"create",
"(",
")",
".",
"regressionSuite",
"(",
"name",
",",
"this",
... | Create a new Regression Suite with title assigned with this Regression Plan.
@param name Title of the suite.
@param attributes Additional attributes for initialization Regression Suite.
@return Regression Suite. | [
"Create",
"a",
"new",
"Regression",
"Suite",
"with",
"title",
"assigned",
"with",
"this",
"Regression",
"Plan",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/RegressionPlan.java#L79-L81 |
pedrovgs/Lynx | lynx/src/main/java/com/github/pedrovgs/lynx/LynxActivity.java | LynxActivity.getIntent | public static Intent getIntent(Context context, LynxConfig lynxConfig) {
if (lynxConfig == null) {
lynxConfig = new LynxConfig();
}
Intent intent = new Intent(context, LynxActivity.class);
intent.putExtra(LYNX_CONFIG_EXTRA, lynxConfig);
return intent;
} | java | public static Intent getIntent(Context context, LynxConfig lynxConfig) {
if (lynxConfig == null) {
lynxConfig = new LynxConfig();
}
Intent intent = new Intent(context, LynxActivity.class);
intent.putExtra(LYNX_CONFIG_EXTRA, lynxConfig);
return intent;
} | [
"public",
"static",
"Intent",
"getIntent",
"(",
"Context",
"context",
",",
"LynxConfig",
"lynxConfig",
")",
"{",
"if",
"(",
"lynxConfig",
"==",
"null",
")",
"{",
"lynxConfig",
"=",
"new",
"LynxConfig",
"(",
")",
";",
"}",
"Intent",
"intent",
"=",
"new",
... | Generates an Intent to start LynxActivity with a LynxConfig configuration passed as parameter.
@param context the application context
@param lynxConfig the lynx configuration
@return a new {@code Intent} to start {@link LynxActivity} | [
"Generates",
"an",
"Intent",
"to",
"start",
"LynxActivity",
"with",
"a",
"LynxConfig",
"configuration",
"passed",
"as",
"parameter",
"."
] | train | https://github.com/pedrovgs/Lynx/blob/6097ab18b76c1ebdd0819c10e5d09ec19ea5bf4d/lynx/src/main/java/com/github/pedrovgs/lynx/LynxActivity.java#L54-L61 |
wildfly/wildfly-core | elytron/src/main/java/org/wildfly/extension/elytron/ServiceUtil.java | ServiceUtil.addInjection | ServiceBuilder<?> addInjection(ServiceBuilder<?> sb, Injector<T> injector, String name) {
return addInjection(sb, injector, serviceName(name));
} | java | ServiceBuilder<?> addInjection(ServiceBuilder<?> sb, Injector<T> injector, String name) {
return addInjection(sb, injector, serviceName(name));
} | [
"ServiceBuilder",
"<",
"?",
">",
"addInjection",
"(",
"ServiceBuilder",
"<",
"?",
">",
"sb",
",",
"Injector",
"<",
"T",
">",
"injector",
",",
"String",
"name",
")",
"{",
"return",
"addInjection",
"(",
"sb",
",",
"injector",
",",
"serviceName",
"(",
"name... | Using the supplied {@link Injector} add a dependency on the {@link Service} identified by the supplied name.
@param sb - the {@link ServiceBuilder} to use for the injection.
@param injector - the {@link Injector} to inject into.
@param name - the simple name of the service to inject.
@return The {@link ServiceBuilder} passed in to allow method chaining. | [
"Using",
"the",
"supplied",
"{",
"@link",
"Injector",
"}",
"add",
"a",
"dependency",
"on",
"the",
"{",
"@link",
"Service",
"}",
"identified",
"by",
"the",
"supplied",
"name",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/elytron/src/main/java/org/wildfly/extension/elytron/ServiceUtil.java#L94-L96 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java | OjbTagsHandler.forAllTables | public void forAllTables(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _torqueModel.getTables(); it.hasNext(); )
{
_curTableDef = (TableDef)it.next();
generate(template);
}
_curTableDef = null;
} | java | public void forAllTables(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _torqueModel.getTables(); it.hasNext(); )
{
_curTableDef = (TableDef)it.next();
generate(template);
}
_curTableDef = null;
} | [
"public",
"void",
"forAllTables",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"for",
"(",
"Iterator",
"it",
"=",
"_torqueModel",
".",
"getTables",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
"... | Processes the template for all table definitions in the torque model.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" | [
"Processes",
"the",
"template",
"for",
"all",
"table",
"definitions",
"in",
"the",
"torque",
"model",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L1326-L1334 |
Red5/red5-server-common | src/main/java/org/red5/server/so/ClientSharedObject.java | ClientSharedObject.notifyUpdate | protected void notifyUpdate(String key, Object value) {
for (ISharedObjectListener listener : listeners) {
listener.onSharedObjectUpdate(this, key, value);
}
} | java | protected void notifyUpdate(String key, Object value) {
for (ISharedObjectListener listener : listeners) {
listener.onSharedObjectUpdate(this, key, value);
}
} | [
"protected",
"void",
"notifyUpdate",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"for",
"(",
"ISharedObjectListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"onSharedObjectUpdate",
"(",
"this",
",",
"key",
",",
"value",
")",
";"... | Notify listeners on update
@param key
Updated attribute key
@param value
Updated attribute value | [
"Notify",
"listeners",
"on",
"update"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/so/ClientSharedObject.java#L211-L215 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsPositionBean.java | CmsPositionBean.ensureSurrounds | public void ensureSurrounds(CmsPositionBean child, int padding) {
// increase the size of the outer rectangle
if ((getLeft() + padding) > child.getLeft()) {
int diff = getLeft() - child.getLeft();
// ensure padding
diff += padding;
setLeft(getLeft() - diff);
setWidth(getWidth() + diff);
}
if ((getTop() + padding) > child.getTop()) {
int diff = getTop() - child.getTop();
diff += padding;
setTop(getTop() - diff);
setHeight(getHeight() + diff);
}
if ((getLeft() + getWidth()) < (child.getLeft() + child.getWidth() + padding)) {
int diff = (child.getLeft() + child.getWidth()) - (getLeft() + getWidth());
diff += padding;
setWidth(getWidth() + diff);
}
if ((getTop() + getHeight()) < (child.getTop() + child.getHeight() + padding)) {
int diff = (child.getTop() + child.getHeight()) - (getTop() + getHeight());
diff += padding;
setHeight(getHeight() + diff);
}
} | java | public void ensureSurrounds(CmsPositionBean child, int padding) {
// increase the size of the outer rectangle
if ((getLeft() + padding) > child.getLeft()) {
int diff = getLeft() - child.getLeft();
// ensure padding
diff += padding;
setLeft(getLeft() - diff);
setWidth(getWidth() + diff);
}
if ((getTop() + padding) > child.getTop()) {
int diff = getTop() - child.getTop();
diff += padding;
setTop(getTop() - diff);
setHeight(getHeight() + diff);
}
if ((getLeft() + getWidth()) < (child.getLeft() + child.getWidth() + padding)) {
int diff = (child.getLeft() + child.getWidth()) - (getLeft() + getWidth());
diff += padding;
setWidth(getWidth() + diff);
}
if ((getTop() + getHeight()) < (child.getTop() + child.getHeight() + padding)) {
int diff = (child.getTop() + child.getHeight()) - (getTop() + getHeight());
diff += padding;
setHeight(getHeight() + diff);
}
} | [
"public",
"void",
"ensureSurrounds",
"(",
"CmsPositionBean",
"child",
",",
"int",
"padding",
")",
"{",
"// increase the size of the outer rectangle",
"if",
"(",
"(",
"getLeft",
"(",
")",
"+",
"padding",
")",
">",
"child",
".",
"getLeft",
"(",
")",
")",
"{",
... | Increases the dimensions to completely surround the child.<p>
@param child the child position info
@param padding the padding to apply | [
"Increases",
"the",
"dimensions",
"to",
"completely",
"surround",
"the",
"child",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsPositionBean.java#L410-L436 |
HubSpot/jinjava | src/main/java/com/hubspot/jinjava/interpret/JinjavaInterpreter.java | JinjavaInterpreter.resolveProperty | public Object resolveProperty(Object object, String propertyName) {
return resolveProperty(object, Collections.singletonList(propertyName));
} | java | public Object resolveProperty(Object object, String propertyName) {
return resolveProperty(object, Collections.singletonList(propertyName));
} | [
"public",
"Object",
"resolveProperty",
"(",
"Object",
"object",
",",
"String",
"propertyName",
")",
"{",
"return",
"resolveProperty",
"(",
"object",
",",
"Collections",
".",
"singletonList",
"(",
"propertyName",
")",
")",
";",
"}"
] | Resolve property of bean.
@param object
Bean.
@param propertyName
Name of property to resolve.
@return Value of property. | [
"Resolve",
"property",
"of",
"bean",
"."
] | train | https://github.com/HubSpot/jinjava/blob/ce570935630f49c666170d2330b0b9ba4eddb955/src/main/java/com/hubspot/jinjava/interpret/JinjavaInterpreter.java#L433-L435 |
Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java | BlockDrawingHelper.DrawPrimitive | private void DrawPrimitive( DrawSphere s, World w ) throws Exception
{
XMLBlockState blockType = new XMLBlockState(s.getType(), s.getColour(), null, s.getVariant());
if (!blockType.isValid())
throw new Exception("Unrecognised block type: " + s.getType().value());
int radius = s.getRadius();
for( int x = s.getX() - radius; x <= s.getX() + radius; x++ )
{
for( int y = s.getY() - radius; y <= s.getY() + radius; y++ )
{
for( int z = s.getZ() - radius; z <= s.getZ() + radius; z++ )
{
if ((z - s.getZ()) * (z - s.getZ()) + (y - s.getY()) * (y - s.getY()) + (x - s.getX()) * (x - s.getX()) <= (radius*radius))
{
BlockPos pos = new BlockPos( x, y, z );
setBlockState( w, pos, blockType );
AxisAlignedBB aabb = new AxisAlignedBB(pos, new BlockPos(x+1, y+1, z+1));
clearEntities(w, aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ);
}
}
}
}
} | java | private void DrawPrimitive( DrawSphere s, World w ) throws Exception
{
XMLBlockState blockType = new XMLBlockState(s.getType(), s.getColour(), null, s.getVariant());
if (!blockType.isValid())
throw new Exception("Unrecognised block type: " + s.getType().value());
int radius = s.getRadius();
for( int x = s.getX() - radius; x <= s.getX() + radius; x++ )
{
for( int y = s.getY() - radius; y <= s.getY() + radius; y++ )
{
for( int z = s.getZ() - radius; z <= s.getZ() + radius; z++ )
{
if ((z - s.getZ()) * (z - s.getZ()) + (y - s.getY()) * (y - s.getY()) + (x - s.getX()) * (x - s.getX()) <= (radius*radius))
{
BlockPos pos = new BlockPos( x, y, z );
setBlockState( w, pos, blockType );
AxisAlignedBB aabb = new AxisAlignedBB(pos, new BlockPos(x+1, y+1, z+1));
clearEntities(w, aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ);
}
}
}
}
} | [
"private",
"void",
"DrawPrimitive",
"(",
"DrawSphere",
"s",
",",
"World",
"w",
")",
"throws",
"Exception",
"{",
"XMLBlockState",
"blockType",
"=",
"new",
"XMLBlockState",
"(",
"s",
".",
"getType",
"(",
")",
",",
"s",
".",
"getColour",
"(",
")",
",",
"nul... | Draw a solid sphere made up of Minecraft blocks.
@param s Contains information about the sphere to be drawn.
@param w The world in which to draw.
@throws Exception Throws an exception if the block type is not recognised. | [
"Draw",
"a",
"solid",
"sphere",
"made",
"up",
"of",
"Minecraft",
"blocks",
"."
] | train | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java#L248-L271 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java | EvidenceCollection.addEvidence | public void addEvidence(EvidenceType type, String source, String name, String value, Confidence confidence) {
final Evidence e = new Evidence(source, name, value, confidence);
addEvidence(type, e);
} | java | public void addEvidence(EvidenceType type, String source, String name, String value, Confidence confidence) {
final Evidence e = new Evidence(source, name, value, confidence);
addEvidence(type, e);
} | [
"public",
"void",
"addEvidence",
"(",
"EvidenceType",
"type",
",",
"String",
"source",
",",
"String",
"name",
",",
"String",
"value",
",",
"Confidence",
"confidence",
")",
"{",
"final",
"Evidence",
"e",
"=",
"new",
"Evidence",
"(",
"source",
",",
"name",
"... | Creates an Evidence object from the parameters and adds the resulting
object to the evidence collection.
@param type the type of evidence (vendor, product, version)
@param source the source of the Evidence.
@param name the name of the Evidence.
@param value the value of the Evidence.
@param confidence the confidence of the Evidence. | [
"Creates",
"an",
"Evidence",
"object",
"from",
"the",
"parameters",
"and",
"adds",
"the",
"resulting",
"object",
"to",
"the",
"evidence",
"collection",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java#L200-L203 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java | ComputeNodesImpl.reimage | public void reimage(String poolId, String nodeId) {
reimageWithServiceResponseAsync(poolId, nodeId).toBlocking().single().body();
} | java | public void reimage(String poolId, String nodeId) {
reimageWithServiceResponseAsync(poolId, nodeId).toBlocking().single().body();
} | [
"public",
"void",
"reimage",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
")",
"{",
"reimageWithServiceResponseAsync",
"(",
"poolId",
",",
"nodeId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Reinstalls the operating system on the specified compute node.
You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node that you want to restart.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Reinstalls",
"the",
"operating",
"system",
"on",
"the",
"specified",
"compute",
"node",
".",
"You",
"can",
"reinstall",
"the",
"operating",
"system",
"on",
"a",
"node",
"only",
"if",
"it",
"is",
"in",
"an",
"idle",
"or",
"running",
"state",
".",
"This",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L1283-L1285 |
Impetus/Kundera | src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBDataHandler.java | KuduDBDataHandler.addToRow | public static void addToRow(PartialRow row, String jpaColumnName, Object value, Type type)
{
if (value == null)
{
row.setNull(jpaColumnName);
}
else
{
switch (type)
{
case BINARY:
row.addBinary(jpaColumnName, (byte[]) value);
break;
case BOOL:
row.addBoolean(jpaColumnName, (Boolean) value);
break;
case DOUBLE:
row.addDouble(jpaColumnName, (Double) value);
break;
case FLOAT:
row.addFloat(jpaColumnName, (Float) value);
break;
case INT16:
row.addShort(jpaColumnName, (Short) value);
break;
case INT32:
row.addInt(jpaColumnName, (Integer) value);
break;
case INT64:
row.addLong(jpaColumnName, (Long) value);
break;
case INT8:
row.addByte(jpaColumnName, (Byte) value);
break;
case STRING:
row.addString(jpaColumnName, (String) value);
break;
case UNIXTIME_MICROS:
default:
logger.error(type + " type is not supported by Kudu");
throw new KunderaException(type + " type is not supported by Kudu");
}
}
} | java | public static void addToRow(PartialRow row, String jpaColumnName, Object value, Type type)
{
if (value == null)
{
row.setNull(jpaColumnName);
}
else
{
switch (type)
{
case BINARY:
row.addBinary(jpaColumnName, (byte[]) value);
break;
case BOOL:
row.addBoolean(jpaColumnName, (Boolean) value);
break;
case DOUBLE:
row.addDouble(jpaColumnName, (Double) value);
break;
case FLOAT:
row.addFloat(jpaColumnName, (Float) value);
break;
case INT16:
row.addShort(jpaColumnName, (Short) value);
break;
case INT32:
row.addInt(jpaColumnName, (Integer) value);
break;
case INT64:
row.addLong(jpaColumnName, (Long) value);
break;
case INT8:
row.addByte(jpaColumnName, (Byte) value);
break;
case STRING:
row.addString(jpaColumnName, (String) value);
break;
case UNIXTIME_MICROS:
default:
logger.error(type + " type is not supported by Kudu");
throw new KunderaException(type + " type is not supported by Kudu");
}
}
} | [
"public",
"static",
"void",
"addToRow",
"(",
"PartialRow",
"row",
",",
"String",
"jpaColumnName",
",",
"Object",
"value",
",",
"Type",
"type",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"row",
".",
"setNull",
"(",
"jpaColumnName",
")",
";",
... | Adds the to row.
@param row
the row
@param jpaColumnName
the jpa column name
@param value
the value
@param type
the type | [
"Adds",
"the",
"to",
"row",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBDataHandler.java#L69-L112 |
Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/client/ClientFactory.java | ClientFactory.getNamedClient | public static synchronized IClient getNamedClient(String name, Class<? extends IClientConfig> configClass) {
if (simpleClientMap.get(name) != null) {
return simpleClientMap.get(name);
}
try {
return createNamedClient(name, configClass);
} catch (ClientException e) {
throw new RuntimeException("Unable to create client", e);
}
} | java | public static synchronized IClient getNamedClient(String name, Class<? extends IClientConfig> configClass) {
if (simpleClientMap.get(name) != null) {
return simpleClientMap.get(name);
}
try {
return createNamedClient(name, configClass);
} catch (ClientException e) {
throw new RuntimeException("Unable to create client", e);
}
} | [
"public",
"static",
"synchronized",
"IClient",
"getNamedClient",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
"extends",
"IClientConfig",
">",
"configClass",
")",
"{",
"if",
"(",
"simpleClientMap",
".",
"get",
"(",
"name",
")",
"!=",
"null",
")",
"{",
"r... | Return the named client from map if already created. Otherwise creates the client using the configuration returned by {@link #createNamedClient(String, Class)}.
@throws RuntimeException if an error occurs in creating the client. | [
"Return",
"the",
"named",
"client",
"from",
"map",
"if",
"already",
"created",
".",
"Otherwise",
"creates",
"the",
"client",
"using",
"the",
"configuration",
"returned",
"by",
"{",
"@link",
"#createNamedClient",
"(",
"String",
"Class",
")",
"}",
"."
] | train | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/client/ClientFactory.java#L111-L120 |
spring-projects/spring-security-oauth | spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/OAuth2Exception.java | OAuth2Exception.addAdditionalInformation | public void addAdditionalInformation(String key, String value) {
if (this.additionalInformation == null) {
this.additionalInformation = new TreeMap<String, String>();
}
this.additionalInformation.put(key, value);
} | java | public void addAdditionalInformation(String key, String value) {
if (this.additionalInformation == null) {
this.additionalInformation = new TreeMap<String, String>();
}
this.additionalInformation.put(key, value);
} | [
"public",
"void",
"addAdditionalInformation",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"this",
".",
"additionalInformation",
"==",
"null",
")",
"{",
"this",
".",
"additionalInformation",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"S... | Add some additional information with this OAuth error.
@param key The key.
@param value The value. | [
"Add",
"some",
"additional",
"information",
"with",
"this",
"OAuth",
"error",
"."
] | train | https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/OAuth2Exception.java#L79-L86 |
samskivert/pythagoras | src/main/java/pythagoras/i/Points.java | Points.distanceSq | public static int distanceSq (int x1, int y1, int x2, int y2) {
x2 -= x1;
y2 -= y1;
return x2 * x2 + y2 * y2;
} | java | public static int distanceSq (int x1, int y1, int x2, int y2) {
x2 -= x1;
y2 -= y1;
return x2 * x2 + y2 * y2;
} | [
"public",
"static",
"int",
"distanceSq",
"(",
"int",
"x1",
",",
"int",
"y1",
",",
"int",
"x2",
",",
"int",
"y2",
")",
"{",
"x2",
"-=",
"x1",
";",
"y2",
"-=",
"y1",
";",
"return",
"x2",
"*",
"x2",
"+",
"y2",
"*",
"y2",
";",
"}"
] | Returns the squared Euclidian distance between the specified two points. | [
"Returns",
"the",
"squared",
"Euclidian",
"distance",
"between",
"the",
"specified",
"two",
"points",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/i/Points.java#L15-L19 |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/LogUtils.java | LogUtils.configureLogback | public static void configureLogback( ServletContext servletContext, File logDirFallback, String vHostName, Logger log ) throws FileNotFoundException, MalformedURLException, IOException {
log.debug("Reconfiguring Logback!");
String systemLogDir = System.getProperty(LOG_DIRECTORY_OVERRIDE, System.getProperty(JBOSS_LOG_DIR));
if (systemLogDir != null) {
systemLogDir += "/" + vHostName;
}
File logDir = FileSystemManager.getWritableDirectoryWithFailovers(systemLogDir,servletContext.getInitParameter(LOG_DIR_INIT_PARAM), logDirFallback.getAbsolutePath());
if(logDir != null) {
log.debug("Resetting logback context.");
URL configFile = servletContext.getResource("/WEB-INF/context-logback.xml");
log.debug("Configuring logback with file, {}", configFile);
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
try {
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(context);
context.stop();
context.reset();
context.putProperty("logDir", logDir.getCanonicalPath());
configurator.doConfigure(configFile);
} catch (JoranException je) {
// StatusPrinter will handle this
} finally {
context.start();
log.debug("Done resetting logback.");
}
StatusPrinter.printInCaseOfErrorsOrWarnings(context);
}
} | java | public static void configureLogback( ServletContext servletContext, File logDirFallback, String vHostName, Logger log ) throws FileNotFoundException, MalformedURLException, IOException {
log.debug("Reconfiguring Logback!");
String systemLogDir = System.getProperty(LOG_DIRECTORY_OVERRIDE, System.getProperty(JBOSS_LOG_DIR));
if (systemLogDir != null) {
systemLogDir += "/" + vHostName;
}
File logDir = FileSystemManager.getWritableDirectoryWithFailovers(systemLogDir,servletContext.getInitParameter(LOG_DIR_INIT_PARAM), logDirFallback.getAbsolutePath());
if(logDir != null) {
log.debug("Resetting logback context.");
URL configFile = servletContext.getResource("/WEB-INF/context-logback.xml");
log.debug("Configuring logback with file, {}", configFile);
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
try {
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(context);
context.stop();
context.reset();
context.putProperty("logDir", logDir.getCanonicalPath());
configurator.doConfigure(configFile);
} catch (JoranException je) {
// StatusPrinter will handle this
} finally {
context.start();
log.debug("Done resetting logback.");
}
StatusPrinter.printInCaseOfErrorsOrWarnings(context);
}
} | [
"public",
"static",
"void",
"configureLogback",
"(",
"ServletContext",
"servletContext",
",",
"File",
"logDirFallback",
",",
"String",
"vHostName",
",",
"Logger",
"log",
")",
"throws",
"FileNotFoundException",
",",
"MalformedURLException",
",",
"IOException",
"{",
"lo... | <p>Reconfigures the logging context.</p>
<p>The LoggerContext gets configured with "/WEB-INF/context-logback.xml". There is a <code>logDir</code> property set here which is expected to be the directory that the log file is written to.</p>
<p>The <code>logDir</code> property gets set on the LoggerContext with the following logic.</p>
<ul>
<li>{@link LOG_DIR_INIT_PARAM} context parameter will be created and checked if it is writable.</li>
<li>The File object passed in is used as a fall-back if it can be created and written to.</li>
</ul>
@see {@link LoggerContext}
@param servletContext The current servlet context.
@param logDirFallback The fall-back directory to log to.
@param vHostName
@param log
@throws FileNotFoundException Thrown if no logDir can be written to.
@throws MalformedURLException
@throws IOException | [
"<p",
">",
"Reconfigures",
"the",
"logging",
"context",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"LoggerContext",
"gets",
"configured",
"with",
"/",
"WEB",
"-",
"INF",
"/",
"context",
"-",
"logback",
".",
"xml",
".",
"There",
"is",
"a",
"<code",
">... | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/LogUtils.java#L119-L146 |
xiancloud/xian | xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/JsonWriter.java | JsonWriter.toJSONString | public static void toJSONString(OutputAccessor out, Map<String, ? extends Object> map) {
writeObjectStart(out);
boolean first = true;
for (Map.Entry<String, ? extends Object> entry : map.entrySet()) {
if (first) {
first = false;
} else {
writeKeyValueSeparator(out);
}
writeMapEntry(out, entry.getKey(), entry.getValue());
}
writeObjectEnd(out);
} | java | public static void toJSONString(OutputAccessor out, Map<String, ? extends Object> map) {
writeObjectStart(out);
boolean first = true;
for (Map.Entry<String, ? extends Object> entry : map.entrySet()) {
if (first) {
first = false;
} else {
writeKeyValueSeparator(out);
}
writeMapEntry(out, entry.getKey(), entry.getValue());
}
writeObjectEnd(out);
} | [
"public",
"static",
"void",
"toJSONString",
"(",
"OutputAccessor",
"out",
",",
"Map",
"<",
"String",
",",
"?",
"extends",
"Object",
">",
"map",
")",
"{",
"writeObjectStart",
"(",
"out",
")",
";",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"Map",
... | Utility method to write a {@link Map} into a JSON representation.
@param out
@param map | [
"Utility",
"method",
"to",
"write",
"a",
"{",
"@link",
"Map",
"}",
"into",
"a",
"JSON",
"representation",
"."
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/JsonWriter.java#L74-L92 |
real-logic/agrona | agrona/src/main/java/org/agrona/SystemUtil.java | SystemUtil.parseSize | public static long parseSize(final String propertyName, final String propertyValue)
{
final int lengthMinusSuffix = propertyValue.length() - 1;
final char lastCharacter = propertyValue.charAt(lengthMinusSuffix);
if (Character.isDigit(lastCharacter))
{
return Long.valueOf(propertyValue);
}
final long value = AsciiEncoding.parseLongAscii(propertyValue, 0, lengthMinusSuffix);
switch (lastCharacter)
{
case 'k':
case 'K':
if (value > MAX_K_VALUE)
{
throw new NumberFormatException(propertyName + " would overflow long: " + propertyValue);
}
return value * 1024;
case 'm':
case 'M':
if (value > MAX_M_VALUE)
{
throw new NumberFormatException(propertyName + " would overflow long: " + propertyValue);
}
return value * 1024 * 1024;
case 'g':
case 'G':
if (value > MAX_G_VALUE)
{
throw new NumberFormatException(propertyName + " would overflow long: " + propertyValue);
}
return value * 1024 * 1024 * 1024;
default:
throw new NumberFormatException(
propertyName + ": " + propertyValue + " should end with: k, m, or g.");
}
} | java | public static long parseSize(final String propertyName, final String propertyValue)
{
final int lengthMinusSuffix = propertyValue.length() - 1;
final char lastCharacter = propertyValue.charAt(lengthMinusSuffix);
if (Character.isDigit(lastCharacter))
{
return Long.valueOf(propertyValue);
}
final long value = AsciiEncoding.parseLongAscii(propertyValue, 0, lengthMinusSuffix);
switch (lastCharacter)
{
case 'k':
case 'K':
if (value > MAX_K_VALUE)
{
throw new NumberFormatException(propertyName + " would overflow long: " + propertyValue);
}
return value * 1024;
case 'm':
case 'M':
if (value > MAX_M_VALUE)
{
throw new NumberFormatException(propertyName + " would overflow long: " + propertyValue);
}
return value * 1024 * 1024;
case 'g':
case 'G':
if (value > MAX_G_VALUE)
{
throw new NumberFormatException(propertyName + " would overflow long: " + propertyValue);
}
return value * 1024 * 1024 * 1024;
default:
throw new NumberFormatException(
propertyName + ": " + propertyValue + " should end with: k, m, or g.");
}
} | [
"public",
"static",
"long",
"parseSize",
"(",
"final",
"String",
"propertyName",
",",
"final",
"String",
"propertyValue",
")",
"{",
"final",
"int",
"lengthMinusSuffix",
"=",
"propertyValue",
".",
"length",
"(",
")",
"-",
"1",
";",
"final",
"char",
"lastCharact... | Parse a string representation of a value with optional suffix of 'g', 'm', and 'k' suffix to indicate
gigabytes, megabytes, or kilobytes respectively.
@param propertyName that associated with the size value.
@param propertyValue to be parsed.
@return the long value.
@throws NumberFormatException if the value is out of range or mal-formatted. | [
"Parse",
"a",
"string",
"representation",
"of",
"a",
"value",
"with",
"optional",
"suffix",
"of",
"g",
"m",
"and",
"k",
"suffix",
"to",
"indicate",
"gigabytes",
"megabytes",
"or",
"kilobytes",
"respectively",
"."
] | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/SystemUtil.java#L284-L325 |
devnull-tools/trugger | src/main/java/tools/devnull/trugger/reflection/impl/TruggerGenericTypeResolver.java | TruggerGenericTypeResolver.resolveType | static Class resolveType(Type genericType, Map<Type, Type> typeVariableMap) {
Type rawType = getRawType(genericType, typeVariableMap);
return (rawType instanceof Class ? (Class) rawType : Object.class);
} | java | static Class resolveType(Type genericType, Map<Type, Type> typeVariableMap) {
Type rawType = getRawType(genericType, typeVariableMap);
return (rawType instanceof Class ? (Class) rawType : Object.class);
} | [
"static",
"Class",
"resolveType",
"(",
"Type",
"genericType",
",",
"Map",
"<",
"Type",
",",
"Type",
">",
"typeVariableMap",
")",
"{",
"Type",
"rawType",
"=",
"getRawType",
"(",
"genericType",
",",
"typeVariableMap",
")",
";",
"return",
"(",
"rawType",
"insta... | Resolve the specified generic type against the given TypeVariable map.
@param genericType the generic type to resolve
@param typeVariableMap the TypeVariable Map to resolved against
@return the type if it resolves to a Class, or <code>Object.class otherwise | [
"Resolve",
"the",
"specified",
"generic",
"type",
"against",
"the",
"given",
"TypeVariable",
"map",
"."
] | train | https://github.com/devnull-tools/trugger/blob/614d5f0b30daf82fc251a46fb436d0fc5e787627/src/main/java/tools/devnull/trugger/reflection/impl/TruggerGenericTypeResolver.java#L59-L62 |
JRebirth/JRebirth | org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java | AbstractSlideModel.findAngle | private double findAngle(final double fromX, final double fromY, final double toX, final double toY) {
final double yDelta = toY - fromY;
final double y = Math.sin(yDelta) * Math.cos(toX);
final double x = Math.cos(fromX) * Math.sin(toX)
- Math.sin(fromX) * Math.cos(toX) * Math.cos(yDelta);
double angle = Math.toDegrees(Math.atan2(y, x));
// Keep a positive angle
while (angle < 0) {
angle += 360;
}
return (float) angle % 360;
} | java | private double findAngle(final double fromX, final double fromY, final double toX, final double toY) {
final double yDelta = toY - fromY;
final double y = Math.sin(yDelta) * Math.cos(toX);
final double x = Math.cos(fromX) * Math.sin(toX)
- Math.sin(fromX) * Math.cos(toX) * Math.cos(yDelta);
double angle = Math.toDegrees(Math.atan2(y, x));
// Keep a positive angle
while (angle < 0) {
angle += 360;
}
return (float) angle % 360;
} | [
"private",
"double",
"findAngle",
"(",
"final",
"double",
"fromX",
",",
"final",
"double",
"fromY",
",",
"final",
"double",
"toX",
",",
"final",
"double",
"toY",
")",
"{",
"final",
"double",
"yDelta",
"=",
"toY",
"-",
"fromY",
";",
"final",
"double",
"y"... | Return the right angle for the given coordinate.
@param fromX the x starting point coordinate
@param toX the x arrival point coordinate
@param fromY the y starting point coordinate
@param toY the y arrival point coordinate
@return the right angle | [
"Return",
"the",
"right",
"angle",
"for",
"the",
"given",
"coordinate",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java#L534-L546 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/ProductUrl.java | ProductUrl.deleteProductInCatalogUrl | public static MozuUrl deleteProductInCatalogUrl(Integer catalogId, String productCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/ProductInCatalogs/{catalogId}");
formatter.formatUrl("catalogId", catalogId);
formatter.formatUrl("productCode", productCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteProductInCatalogUrl(Integer catalogId, String productCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/ProductInCatalogs/{catalogId}");
formatter.formatUrl("catalogId", catalogId);
formatter.formatUrl("productCode", productCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteProductInCatalogUrl",
"(",
"Integer",
"catalogId",
",",
"String",
"productCode",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/products/{productCode}/ProductInCatalogs/{catalogId}\"",
... | Get Resource Url for DeleteProductInCatalog
@param catalogId Unique identifier for a catalog.
@param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteProductInCatalog"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/ProductUrl.java#L180-L186 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.updateVariableNameAndReference | public SDVariable updateVariableNameAndReference(SDVariable varToUpdate, String newVarName) {
if (varToUpdate == null) {
throw new NullPointerException("Null input: No variable found for updating!");
}
if(newVarName != null && variables.containsKey(newVarName) && varToUpdate != variables.get(newVarName).getVariable()){
throw new IllegalStateException("Variable name \"" + newVarName + "\" already exists for a different SDVariable");
}
if (newVarName == null && variables.containsKey(varToUpdate.getVarName())) {
//Edge case: suppose we do m1=sd.mean(in), m2=sd.mean(m1) -> both initially have the name
// "mean" and consequently a new variable name needs to be generated
newVarName = generateNewVarName(varToUpdate.getVarName(), 0);
}
if (newVarName == null || varToUpdate.getVarName().equals(newVarName)) {
return varToUpdate;
}
val oldVarName = varToUpdate.getVarName();
varToUpdate.setVarName(newVarName);
updateVariableName(oldVarName, newVarName);
return varToUpdate;
} | java | public SDVariable updateVariableNameAndReference(SDVariable varToUpdate, String newVarName) {
if (varToUpdate == null) {
throw new NullPointerException("Null input: No variable found for updating!");
}
if(newVarName != null && variables.containsKey(newVarName) && varToUpdate != variables.get(newVarName).getVariable()){
throw new IllegalStateException("Variable name \"" + newVarName + "\" already exists for a different SDVariable");
}
if (newVarName == null && variables.containsKey(varToUpdate.getVarName())) {
//Edge case: suppose we do m1=sd.mean(in), m2=sd.mean(m1) -> both initially have the name
// "mean" and consequently a new variable name needs to be generated
newVarName = generateNewVarName(varToUpdate.getVarName(), 0);
}
if (newVarName == null || varToUpdate.getVarName().equals(newVarName)) {
return varToUpdate;
}
val oldVarName = varToUpdate.getVarName();
varToUpdate.setVarName(newVarName);
updateVariableName(oldVarName, newVarName);
return varToUpdate;
} | [
"public",
"SDVariable",
"updateVariableNameAndReference",
"(",
"SDVariable",
"varToUpdate",
",",
"String",
"newVarName",
")",
"{",
"if",
"(",
"varToUpdate",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Null input: No variable found for updating!... | Updates the variable name property on the passed in variable, the reference in samediff, and returns the variable.
<p>
Note that if null for the new variable is passed in, it will just return the original input variable.
@param varToUpdate the variable to update
@param newVarName the new variable name
@return the passed in variable | [
"Updates",
"the",
"variable",
"name",
"property",
"on",
"the",
"passed",
"in",
"variable",
"the",
"reference",
"in",
"samediff",
"and",
"returns",
"the",
"variable",
".",
"<p",
">",
"Note",
"that",
"if",
"null",
"for",
"the",
"new",
"variable",
"is",
"pass... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L3803-L3826 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/tx/narayana/XAResourceWrapperImpl.java | XAResourceWrapperImpl.convertXid | private Xid convertXid(Xid xid)
{
if (xid instanceof XidWrapper)
return xid;
else
return new XidWrapperImpl(xid, pad, jndiName);
} | java | private Xid convertXid(Xid xid)
{
if (xid instanceof XidWrapper)
return xid;
else
return new XidWrapperImpl(xid, pad, jndiName);
} | [
"private",
"Xid",
"convertXid",
"(",
"Xid",
"xid",
")",
"{",
"if",
"(",
"xid",
"instanceof",
"XidWrapper",
")",
"return",
"xid",
";",
"else",
"return",
"new",
"XidWrapperImpl",
"(",
"xid",
",",
"pad",
",",
"jndiName",
")",
";",
"}"
] | Return wrapper for given xid.
@param xid xid
@return return wrapper | [
"Return",
"wrapper",
"for",
"given",
"xid",
"."
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tx/narayana/XAResourceWrapperImpl.java#L258-L264 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/RaftNodeImpl.java | RaftNodeImpl.invalidateFuturesUntil | private void invalidateFuturesUntil(long entryIndex, Object response) {
int count = 0;
Iterator<Entry<Long, SimpleCompletableFuture>> iterator = futures.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Long, SimpleCompletableFuture> entry = iterator.next();
long index = entry.getKey();
if (index <= entryIndex) {
entry.getValue().setResult(response);
iterator.remove();
count++;
}
}
if (count > 0) {
logger.warning("Invalidated " + count + " futures until log index: " + entryIndex);
}
} | java | private void invalidateFuturesUntil(long entryIndex, Object response) {
int count = 0;
Iterator<Entry<Long, SimpleCompletableFuture>> iterator = futures.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Long, SimpleCompletableFuture> entry = iterator.next();
long index = entry.getKey();
if (index <= entryIndex) {
entry.getValue().setResult(response);
iterator.remove();
count++;
}
}
if (count > 0) {
logger.warning("Invalidated " + count + " futures until log index: " + entryIndex);
}
} | [
"private",
"void",
"invalidateFuturesUntil",
"(",
"long",
"entryIndex",
",",
"Object",
"response",
")",
"{",
"int",
"count",
"=",
"0",
";",
"Iterator",
"<",
"Entry",
"<",
"Long",
",",
"SimpleCompletableFuture",
">",
">",
"iterator",
"=",
"futures",
".",
"ent... | Invalidates futures registered with indexes {@code <= entryIndex}. Note that {@code entryIndex} is inclusive.
{@link StaleAppendRequestException} is set a result to futures. | [
"Invalidates",
"futures",
"registered",
"with",
"indexes",
"{"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/RaftNodeImpl.java#L707-L723 |
andkulikov/Transitions-Everywhere | library(1.x)/src/main/java/com/transitionseverywhere/TransitionManager.java | TransitionManager.changeScene | private static void changeScene(@NonNull Scene scene, @Nullable Transition transition) {
final ViewGroup sceneRoot = scene.getSceneRoot();
if (!sPendingTransitions.contains(sceneRoot)) {
Transition transitionClone = null;
if (isTransitionsAllowed()) {
sPendingTransitions.add(sceneRoot);
if (transition != null) {
transitionClone = transition.clone();
transitionClone.setSceneRoot(sceneRoot);
}
Scene oldScene = Scene.getCurrentScene(sceneRoot);
if (oldScene != null && transitionClone != null &&
oldScene.isCreatedFromLayoutResource()) {
transitionClone.setCanRemoveViews(true);
}
}
sceneChangeSetup(sceneRoot, transitionClone);
scene.enter();
sceneChangeRunTransition(sceneRoot, transitionClone);
}
} | java | private static void changeScene(@NonNull Scene scene, @Nullable Transition transition) {
final ViewGroup sceneRoot = scene.getSceneRoot();
if (!sPendingTransitions.contains(sceneRoot)) {
Transition transitionClone = null;
if (isTransitionsAllowed()) {
sPendingTransitions.add(sceneRoot);
if (transition != null) {
transitionClone = transition.clone();
transitionClone.setSceneRoot(sceneRoot);
}
Scene oldScene = Scene.getCurrentScene(sceneRoot);
if (oldScene != null && transitionClone != null &&
oldScene.isCreatedFromLayoutResource()) {
transitionClone.setCanRemoveViews(true);
}
}
sceneChangeSetup(sceneRoot, transitionClone);
scene.enter();
sceneChangeRunTransition(sceneRoot, transitionClone);
}
} | [
"private",
"static",
"void",
"changeScene",
"(",
"@",
"NonNull",
"Scene",
"scene",
",",
"@",
"Nullable",
"Transition",
"transition",
")",
"{",
"final",
"ViewGroup",
"sceneRoot",
"=",
"scene",
".",
"getSceneRoot",
"(",
")",
";",
"if",
"(",
"!",
"sPendingTrans... | This is where all of the work of a transition/scene-change is
orchestrated. This method captures the start values for the given
transition, exits the current Scene, enters the new scene, captures
the end values for the transition, and finally plays the
resulting values-populated transition.
@param scene The scene being entered
@param transition The transition to play for this scene change | [
"This",
"is",
"where",
"all",
"of",
"the",
"work",
"of",
"a",
"transition",
"/",
"scene",
"-",
"change",
"is",
"orchestrated",
".",
"This",
"method",
"captures",
"the",
"start",
"values",
"for",
"the",
"given",
"transition",
"exits",
"the",
"current",
"Sce... | train | https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/TransitionManager.java#L185-L211 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/MemcachedClient.java | MemcachedClient.asyncGets | @Override
public <T> OperationFuture<CASValue<T>> asyncGets(final String key,
final Transcoder<T> tc) {
final CountDownLatch latch = new CountDownLatch(1);
final OperationFuture<CASValue<T>> rv =
new OperationFuture<CASValue<T>>(key, latch, operationTimeout,
executorService);
Operation op = opFact.gets(key, new GetsOperation.Callback() {
private CASValue<T> val;
@Override
public void receivedStatus(OperationStatus status) {
rv.set(val, status);
}
@Override
public void gotData(String k, int flags, long cas, byte[] data) {
assert key.equals(k) : "Wrong key returned";
val =
new CASValue<T>(cas, tc.decode(new CachedData(flags, data,
tc.getMaxSize())));
}
@Override
public void complete() {
latch.countDown();
rv.signalComplete();
}
});
rv.setOperation(op);
mconn.enqueueOperation(key, op);
return rv;
} | java | @Override
public <T> OperationFuture<CASValue<T>> asyncGets(final String key,
final Transcoder<T> tc) {
final CountDownLatch latch = new CountDownLatch(1);
final OperationFuture<CASValue<T>> rv =
new OperationFuture<CASValue<T>>(key, latch, operationTimeout,
executorService);
Operation op = opFact.gets(key, new GetsOperation.Callback() {
private CASValue<T> val;
@Override
public void receivedStatus(OperationStatus status) {
rv.set(val, status);
}
@Override
public void gotData(String k, int flags, long cas, byte[] data) {
assert key.equals(k) : "Wrong key returned";
val =
new CASValue<T>(cas, tc.decode(new CachedData(flags, data,
tc.getMaxSize())));
}
@Override
public void complete() {
latch.countDown();
rv.signalComplete();
}
});
rv.setOperation(op);
mconn.enqueueOperation(key, op);
return rv;
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"OperationFuture",
"<",
"CASValue",
"<",
"T",
">",
">",
"asyncGets",
"(",
"final",
"String",
"key",
",",
"final",
"Transcoder",
"<",
"T",
">",
"tc",
")",
"{",
"final",
"CountDownLatch",
"latch",
"=",
"new",
"Co... | Gets (with CAS support) the given key asynchronously.
@param <T>
@param key the key to fetch
@param tc the transcoder to serialize and unserialize value
@return a future that will hold the return value of the fetch
@throws IllegalStateException in the rare circumstance where queue is too
full to accept any more requests | [
"Gets",
"(",
"with",
"CAS",
"support",
")",
"the",
"given",
"key",
"asynchronously",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L1071-L1105 |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/service/DtoConverterServiceImpl.java | DtoConverterServiceImpl.toInternal | public Object toInternal(Attribute<?> attribute) throws GeomajasException {
if (attribute instanceof PrimitiveAttribute<?>) {
return toPrimitiveObject((PrimitiveAttribute<?>) attribute);
} else if (attribute instanceof AssociationAttribute<?>) {
return toAssociationObject((AssociationAttribute<?>) attribute);
} else {
throw new GeomajasException(ExceptionCode.CONVERSION_PROBLEM, attribute);
}
} | java | public Object toInternal(Attribute<?> attribute) throws GeomajasException {
if (attribute instanceof PrimitiveAttribute<?>) {
return toPrimitiveObject((PrimitiveAttribute<?>) attribute);
} else if (attribute instanceof AssociationAttribute<?>) {
return toAssociationObject((AssociationAttribute<?>) attribute);
} else {
throw new GeomajasException(ExceptionCode.CONVERSION_PROBLEM, attribute);
}
} | [
"public",
"Object",
"toInternal",
"(",
"Attribute",
"<",
"?",
">",
"attribute",
")",
"throws",
"GeomajasException",
"{",
"if",
"(",
"attribute",
"instanceof",
"PrimitiveAttribute",
"<",
"?",
">",
")",
"{",
"return",
"toPrimitiveObject",
"(",
"(",
"PrimitiveAttri... | Converts a DTO attribute into a generic attribute object.
@param attribute
The DTO attribute.
@return The server side attribute representation. As we don't know at this point what kind of object the
attribute is (that's a problem for the <code>FeatureModel</code>), we return an <code>Object</code>. | [
"Converts",
"a",
"DTO",
"attribute",
"into",
"a",
"generic",
"attribute",
"object",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/service/DtoConverterServiceImpl.java#L97-L105 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/MutableDocument.java | MutableDocument.setFloat | @NonNull
@Override
public MutableDocument setFloat(@NonNull String key, float value) {
return setValue(key, value);
} | java | @NonNull
@Override
public MutableDocument setFloat(@NonNull String key, float value) {
return setValue(key, value);
} | [
"@",
"NonNull",
"@",
"Override",
"public",
"MutableDocument",
"setFloat",
"(",
"@",
"NonNull",
"String",
"key",
",",
"float",
"value",
")",
"{",
"return",
"setValue",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Set a float value for the given key
@param key the key.
@param key the float value.
@return this MutableDocument instance | [
"Set",
"a",
"float",
"value",
"for",
"the",
"given",
"key"
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableDocument.java#L210-L214 |
alibaba/Tangram-Android | tangram/src/main/java/com/tmall/wireless/tangram/BaseTangramEngine.java | BaseTangramEngine.insertData | @Deprecated
public void insertData(int position, @Nullable T data) {
Preconditions.checkState(mGroupBasicAdapter != null, "Must call bindView() first");
insertData(position, mDataParser.parseGroup(data, this));
} | java | @Deprecated
public void insertData(int position, @Nullable T data) {
Preconditions.checkState(mGroupBasicAdapter != null, "Must call bindView() first");
insertData(position, mDataParser.parseGroup(data, this));
} | [
"@",
"Deprecated",
"public",
"void",
"insertData",
"(",
"int",
"position",
",",
"@",
"Nullable",
"T",
"data",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"mGroupBasicAdapter",
"!=",
"null",
",",
"\"Must call bindView() first\"",
")",
";",
"insertData",
"(... | Insert original data to Tangram at target position. It cause full screen item's rebinding, be careful.
@param position Target insert position.
@param data Original data with type {@link T}. | [
"Insert",
"original",
"data",
"to",
"Tangram",
"at",
"target",
"position",
".",
"It",
"cause",
"full",
"screen",
"item",
"s",
"rebinding",
"be",
"careful",
"."
] | train | https://github.com/alibaba/Tangram-Android/blob/caa57f54e009c8dacd34a2322d5761956ebed321/tangram/src/main/java/com/tmall/wireless/tangram/BaseTangramEngine.java#L345-L350 |
NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java | DfuServiceInitiator.setZip | public DfuServiceInitiator setZip(@Nullable final Uri uri, @Nullable final String path) {
return init(uri, path, 0, DfuBaseService.TYPE_AUTO, DfuBaseService.MIME_TYPE_ZIP);
} | java | public DfuServiceInitiator setZip(@Nullable final Uri uri, @Nullable final String path) {
return init(uri, path, 0, DfuBaseService.TYPE_AUTO, DfuBaseService.MIME_TYPE_ZIP);
} | [
"public",
"DfuServiceInitiator",
"setZip",
"(",
"@",
"Nullable",
"final",
"Uri",
"uri",
",",
"@",
"Nullable",
"final",
"String",
"path",
")",
"{",
"return",
"init",
"(",
"uri",
",",
"path",
",",
"0",
",",
"DfuBaseService",
".",
"TYPE_AUTO",
",",
"DfuBaseSe... | Sets the URI or path of the ZIP file.
At least one of the parameters must not be null.
If the URI and path are not null the URI will be used.
@param uri the URI of the file
@param path the path of the file
@return the builder | [
"Sets",
"the",
"URI",
"or",
"path",
"of",
"the",
"ZIP",
"file",
".",
"At",
"least",
"one",
"of",
"the",
"parameters",
"must",
"not",
"be",
"null",
".",
"If",
"the",
"URI",
"and",
"path",
"are",
"not",
"null",
"the",
"URI",
"will",
"be",
"used",
"."... | train | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L604-L606 |
jenkinsci/jenkins | core/src/main/java/jenkins/tasks/SimpleBuildWrapper.java | SimpleBuildWrapper.makeBuildVariables | @Override public void makeBuildVariables(AbstractBuild build, Map<String,String> variables) {
super.makeBuildVariables(build, variables);
} | java | @Override public void makeBuildVariables(AbstractBuild build, Map<String,String> variables) {
super.makeBuildVariables(build, variables);
} | [
"@",
"Override",
"public",
"void",
"makeBuildVariables",
"(",
"AbstractBuild",
"build",
",",
"Map",
"<",
"String",
",",
"String",
">",
"variables",
")",
"{",
"super",
".",
"makeBuildVariables",
"(",
"build",
",",
"variables",
")",
";",
"}"
] | May be overridden but this will only take effect when used as a {@link BuildWrapper} on an {@link AbstractProject}.
<p>{@inheritDoc}
@since 1.608 | [
"May",
"be",
"overridden",
"but",
"this",
"will",
"only",
"take",
"effect",
"when",
"used",
"as",
"a",
"{"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/tasks/SimpleBuildWrapper.java#L215-L217 |
arxanchain/java-common | src/main/java/com/arxanfintech/common/crypto/core/cryptohash/KeccakCore.java | KeccakCore.decodeLELong | private static long decodeLELong(byte[] buf, int off)
{
return (buf[off + 0] & 0xFFL)
| ((buf[off + 1] & 0xFFL) << 8)
| ((buf[off + 2] & 0xFFL) << 16)
| ((buf[off + 3] & 0xFFL) << 24)
| ((buf[off + 4] & 0xFFL) << 32)
| ((buf[off + 5] & 0xFFL) << 40)
| ((buf[off + 6] & 0xFFL) << 48)
| ((buf[off + 7] & 0xFFL) << 56);
} | java | private static long decodeLELong(byte[] buf, int off)
{
return (buf[off + 0] & 0xFFL)
| ((buf[off + 1] & 0xFFL) << 8)
| ((buf[off + 2] & 0xFFL) << 16)
| ((buf[off + 3] & 0xFFL) << 24)
| ((buf[off + 4] & 0xFFL) << 32)
| ((buf[off + 5] & 0xFFL) << 40)
| ((buf[off + 6] & 0xFFL) << 48)
| ((buf[off + 7] & 0xFFL) << 56);
} | [
"private",
"static",
"long",
"decodeLELong",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"off",
")",
"{",
"return",
"(",
"buf",
"[",
"off",
"+",
"0",
"]",
"&",
"0xFF",
"L",
")",
"|",
"(",
"(",
"buf",
"[",
"off",
"+",
"1",
"]",
"&",
"0xFF",
"L",... | Decode a 64-bit little-endian word from the array {@code buf}
at offset {@code off}.
@param buf the source buffer
@param off the source offset
@return the decoded value | [
"Decode",
"a",
"64",
"-",
"bit",
"little",
"-",
"endian",
"word",
"from",
"the",
"array",
"{",
"@code",
"buf",
"}",
"at",
"offset",
"{",
"@code",
"off",
"}",
"."
] | train | https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/cryptohash/KeccakCore.java#L72-L82 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Array.java | Array.binarySearch | static int binarySearch(final short[] a, final int fromIndex, final int toIndex, final short key) {
if (N.isNullOrEmpty(a)) {
return N.INDEX_NOT_FOUND;
}
return Arrays.binarySearch(a, fromIndex, toIndex, key);
} | java | static int binarySearch(final short[] a, final int fromIndex, final int toIndex, final short key) {
if (N.isNullOrEmpty(a)) {
return N.INDEX_NOT_FOUND;
}
return Arrays.binarySearch(a, fromIndex, toIndex, key);
} | [
"static",
"int",
"binarySearch",
"(",
"final",
"short",
"[",
"]",
"a",
",",
"final",
"int",
"fromIndex",
",",
"final",
"int",
"toIndex",
",",
"final",
"short",
"key",
")",
"{",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"a",
")",
")",
"{",
"return",
... | {@link Arrays#binarySearch(short[], int, int, short)}
@param a
@param fromIndex
@param toIndex
@param key
@return | [
"{",
"@link",
"Arrays#binarySearch",
"(",
"short",
"[]",
"int",
"int",
"short",
")",
"}"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Array.java#L3349-L3355 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.setOrthoSymmetric | public Matrix4f setOrthoSymmetric(float width, float height, float zNear, float zFar) {
return setOrthoSymmetric(width, height, zNear, zFar, false);
} | java | public Matrix4f setOrthoSymmetric(float width, float height, float zNear, float zFar) {
return setOrthoSymmetric(width, height, zNear, zFar, false);
} | [
"public",
"Matrix4f",
"setOrthoSymmetric",
"(",
"float",
"width",
",",
"float",
"height",
",",
"float",
"zNear",
",",
"float",
"zFar",
")",
"{",
"return",
"setOrthoSymmetric",
"(",
"width",
",",
"height",
",",
"zNear",
",",
"zFar",
",",
"false",
")",
";",
... | Set this matrix to be a symmetric orthographic projection transformation for a right-handed coordinate system
using OpenGL's NDC z range of <code>[-1..+1]</code>.
<p>
This method is equivalent to calling {@link #setOrtho(float, float, float, float, float, float) setOrtho()} with
<code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>.
<p>
In order to apply the symmetric orthographic projection to an already existing transformation,
use {@link #orthoSymmetric(float, float, float, float) orthoSymmetric()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #orthoSymmetric(float, float, float, float)
@param width
the distance between the right and left frustum edges
@param height
the distance between the top and bottom frustum edges
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"a",
"symmetric",
"orthographic",
"projection",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"using",
"OpenGL",
"s",
"NDC",
"z",
"range",
"of",
"<code",
">",
"[",
"-",
"1",
"..",
"+",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L7703-L7705 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/conversation/Conversation.java | Conversation.saveConversationData | private synchronized void saveConversationData() throws SerializerException {
if (ApptentiveLog.canLog(ApptentiveLog.Level.VERBOSE)) {
ApptentiveLog.v(CONVERSATION, "Saving conversation data...");
ApptentiveLog.v(CONVERSATION, "EventData: %s", getEventData().toString());
ApptentiveLog.v(CONVERSATION, "Messages: %s", messageManager.getMessageStore().toString());
}
long start = System.currentTimeMillis();
FileSerializer serializer = new EncryptedFileSerializer(conversationDataFile, encryptionKey);
serializer.serialize(conversationData);
ApptentiveLog.v(CONVERSATION, "Conversation data saved (took %d ms)", System.currentTimeMillis() - start);
} | java | private synchronized void saveConversationData() throws SerializerException {
if (ApptentiveLog.canLog(ApptentiveLog.Level.VERBOSE)) {
ApptentiveLog.v(CONVERSATION, "Saving conversation data...");
ApptentiveLog.v(CONVERSATION, "EventData: %s", getEventData().toString());
ApptentiveLog.v(CONVERSATION, "Messages: %s", messageManager.getMessageStore().toString());
}
long start = System.currentTimeMillis();
FileSerializer serializer = new EncryptedFileSerializer(conversationDataFile, encryptionKey);
serializer.serialize(conversationData);
ApptentiveLog.v(CONVERSATION, "Conversation data saved (took %d ms)", System.currentTimeMillis() - start);
} | [
"private",
"synchronized",
"void",
"saveConversationData",
"(",
")",
"throws",
"SerializerException",
"{",
"if",
"(",
"ApptentiveLog",
".",
"canLog",
"(",
"ApptentiveLog",
".",
"Level",
".",
"VERBOSE",
")",
")",
"{",
"ApptentiveLog",
".",
"v",
"(",
"CONVERSATION... | Saves conversation data to the disk synchronously. Returns <code>true</code>
if succeed. | [
"Saves",
"conversation",
"data",
"to",
"the",
"disk",
"synchronously",
".",
"Returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"succeed",
"."
] | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/conversation/Conversation.java#L381-L392 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/DevicesManagementApi.java | DevicesManagementApi.queryPropertiesAsync | public com.squareup.okhttp.Call queryPropertiesAsync(String dtid, Integer count, Integer offset, String filter, Boolean includeTimestamp, final ApiCallback<MetadataQueryEnvelope> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = queryPropertiesValidateBeforeCall(dtid, count, offset, filter, includeTimestamp, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<MetadataQueryEnvelope>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | java | public com.squareup.okhttp.Call queryPropertiesAsync(String dtid, Integer count, Integer offset, String filter, Boolean includeTimestamp, final ApiCallback<MetadataQueryEnvelope> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = queryPropertiesValidateBeforeCall(dtid, count, offset, filter, includeTimestamp, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<MetadataQueryEnvelope>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"queryPropertiesAsync",
"(",
"String",
"dtid",
",",
"Integer",
"count",
",",
"Integer",
"offset",
",",
"String",
"filter",
",",
"Boolean",
"includeTimestamp",
",",
"final",
"ApiCallback",
"<",
"Meta... | Query device properties across devices. (asynchronously)
Query device properties across devices.
@param dtid Device Type ID. (required)
@param count Max results count. (optional)
@param offset Result starting offset. (optional)
@param filter Query filter. Comma-separated key=value pairs (optional)
@param includeTimestamp Include timestamp. (optional)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"Query",
"device",
"properties",
"across",
"devices",
".",
"(",
"asynchronously",
")",
"Query",
"device",
"properties",
"across",
"devices",
"."
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesManagementApi.java#L1455-L1480 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java | Gen.genDef | public void genDef(JCTree tree, Env<GenContext> env) {
Env<GenContext> prevEnv = this.env;
try {
this.env = env;
tree.accept(this);
} catch (CompletionFailure ex) {
chk.completionError(tree.pos(), ex);
} finally {
this.env = prevEnv;
}
} | java | public void genDef(JCTree tree, Env<GenContext> env) {
Env<GenContext> prevEnv = this.env;
try {
this.env = env;
tree.accept(this);
} catch (CompletionFailure ex) {
chk.completionError(tree.pos(), ex);
} finally {
this.env = prevEnv;
}
} | [
"public",
"void",
"genDef",
"(",
"JCTree",
"tree",
",",
"Env",
"<",
"GenContext",
">",
"env",
")",
"{",
"Env",
"<",
"GenContext",
">",
"prevEnv",
"=",
"this",
".",
"env",
";",
"try",
"{",
"this",
".",
"env",
"=",
"env",
";",
"tree",
".",
"accept",
... | Visitor method: generate code for a definition, catching and reporting
any completion failures.
@param tree The definition to be visited.
@param env The environment current at the definition. | [
"Visitor",
"method",
":",
"generate",
"code",
"for",
"a",
"definition",
"catching",
"and",
"reporting",
"any",
"completion",
"failures",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L589-L599 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java | SeleniumHelper.waitForJavascriptCallback | public Object waitForJavascriptCallback(String statementPattern, Object... parameters) {
JavascriptExecutor jse = (JavascriptExecutor) driver();
Object result = JavascriptHelper.waitForJavascriptCallback(jse, statementPattern, parameters);
return result;
} | java | public Object waitForJavascriptCallback(String statementPattern, Object... parameters) {
JavascriptExecutor jse = (JavascriptExecutor) driver();
Object result = JavascriptHelper.waitForJavascriptCallback(jse, statementPattern, parameters);
return result;
} | [
"public",
"Object",
"waitForJavascriptCallback",
"(",
"String",
"statementPattern",
",",
"Object",
"...",
"parameters",
")",
"{",
"JavascriptExecutor",
"jse",
"=",
"(",
"JavascriptExecutor",
")",
"driver",
"(",
")",
";",
"Object",
"result",
"=",
"JavascriptHelper",
... | Executes Javascript in browser and then waits for 'callback' to be invoked.
If statementPattern should reference the magic (function) variable 'callback' which should be
called to provide this method's result.
If the statementPattern contains the magic variable 'arguments'
the parameters will also be passed to the statement. In the latter case the parameters
must be a number, a boolean, a String, WebElement, or a List of any combination of the above.
@link http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/JavascriptExecutor.html#executeAsyncScript(java.lang.String,%20java.lang.Object...)
@param statementPattern javascript to run, possibly with placeholders to be replaced.
@param parameters placeholder values that should be replaced before executing the script.
@return return value from statement. | [
"Executes",
"Javascript",
"in",
"browser",
"and",
"then",
"waits",
"for",
"callback",
"to",
"be",
"invoked",
".",
"If",
"statementPattern",
"should",
"reference",
"the",
"magic",
"(",
"function",
")",
"variable",
"callback",
"which",
"should",
"be",
"called",
... | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L464-L468 |
aws/aws-sdk-java | aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/UpdateIdentityPoolResult.java | UpdateIdentityPoolResult.withSupportedLoginProviders | public UpdateIdentityPoolResult withSupportedLoginProviders(java.util.Map<String, String> supportedLoginProviders) {
setSupportedLoginProviders(supportedLoginProviders);
return this;
} | java | public UpdateIdentityPoolResult withSupportedLoginProviders(java.util.Map<String, String> supportedLoginProviders) {
setSupportedLoginProviders(supportedLoginProviders);
return this;
} | [
"public",
"UpdateIdentityPoolResult",
"withSupportedLoginProviders",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"supportedLoginProviders",
")",
"{",
"setSupportedLoginProviders",
"(",
"supportedLoginProviders",
")",
";",
"return",
"this",
... | <p>
Optional key:value pairs mapping provider names to provider app IDs.
</p>
@param supportedLoginProviders
Optional key:value pairs mapping provider names to provider app IDs.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Optional",
"key",
":",
"value",
"pairs",
"mapping",
"provider",
"names",
"to",
"provider",
"app",
"IDs",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/UpdateIdentityPoolResult.java#L252-L255 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.