repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/user/custom/UserCustomTableReader.java | UserCustomTableReader.readTable | public static UserCustomTable readTable(GeoPackageConnection connection,
String tableName) {
UserCustomConnection userDb = new UserCustomConnection(connection);
return readTable(userDb, tableName);
} | java | public static UserCustomTable readTable(GeoPackageConnection connection,
String tableName) {
UserCustomConnection userDb = new UserCustomConnection(connection);
return readTable(userDb, tableName);
} | [
"public",
"static",
"UserCustomTable",
"readTable",
"(",
"GeoPackageConnection",
"connection",
",",
"String",
"tableName",
")",
"{",
"UserCustomConnection",
"userDb",
"=",
"new",
"UserCustomConnection",
"(",
"connection",
")",
";",
"return",
"readTable",
"(",
"userDb"... | Read the table
@param connection
GeoPackage connection
@param tableName
table name
@return table | [
"Read",
"the",
"table"
] | train | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/user/custom/UserCustomTableReader.java#L65-L69 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java | JobOperations.getJob | public CloudJob getJob(String jobId, DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobGetOptions getJobOptions = new JobGetOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel);
bhMgr.applyRequestBehaviors(getJobOptions);
return this.parentBatchClient.protocolLayer().jobs().get(jobId, getJobOptions);
} | java | public CloudJob getJob(String jobId, DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobGetOptions getJobOptions = new JobGetOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel);
bhMgr.applyRequestBehaviors(getJobOptions);
return this.parentBatchClient.protocolLayer().jobs().get(jobId, getJobOptions);
} | [
"public",
"CloudJob",
"getJob",
"(",
"String",
"jobId",
",",
"DetailLevel",
"detailLevel",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"JobGetOptions",
"getJobOptions",
"=",
"n... | Gets the specified {@link CloudJob}.
@param jobId The ID of the job to get.
@param detailLevel A {@link DetailLevel} used for controlling which properties are retrieved from the service.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@return A {@link CloudJob} containing information about the specified Azure Batch job.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Gets",
"the",
"specified",
"{",
"@link",
"CloudJob",
"}",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java#L141-L149 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/JavaBean.java | JavaBean.populate | public static void populate(Map<?,?> aValues, Object bean, PropertyConverter<Object, Object> valueConverter)
{
Object key = null;
Object keyValue;
try
{
for(Map.Entry<?, ?> entry : aValues.entrySet())
{
key = entry.getKey();
keyValue = entry.getValue();
PropertyDescriptor desc = getPropertyDescriptor(bean, String.valueOf(key));
if(desc == null)
continue; //skip
if(desc.getWriteMethod() == null)
continue;
if(valueConverter!= null)
{
Class<?> aClass = desc.getPropertyType();
keyValue = valueConverter.convert(keyValue,aClass);
}
Method invoke = desc.getWriteMethod();
invoke.invoke(bean, keyValue);
}
}
catch (Exception e)
{
throw new FormatException(e.getMessage()+" values:"+aValues,e);
}
} | java | public static void populate(Map<?,?> aValues, Object bean, PropertyConverter<Object, Object> valueConverter)
{
Object key = null;
Object keyValue;
try
{
for(Map.Entry<?, ?> entry : aValues.entrySet())
{
key = entry.getKey();
keyValue = entry.getValue();
PropertyDescriptor desc = getPropertyDescriptor(bean, String.valueOf(key));
if(desc == null)
continue; //skip
if(desc.getWriteMethod() == null)
continue;
if(valueConverter!= null)
{
Class<?> aClass = desc.getPropertyType();
keyValue = valueConverter.convert(keyValue,aClass);
}
Method invoke = desc.getWriteMethod();
invoke.invoke(bean, keyValue);
}
}
catch (Exception e)
{
throw new FormatException(e.getMessage()+" values:"+aValues,e);
}
} | [
"public",
"static",
"void",
"populate",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"aValues",
",",
"Object",
"bean",
",",
"PropertyConverter",
"<",
"Object",
",",
"Object",
">",
"valueConverter",
")",
"{",
"Object",
"key",
"=",
"null",
";",
"Object",
"keyValue... | Support nested map objects
@param aValues the key/value properties
@param bean the object to write to
@param valueConverter the value converter strategy object | [
"Support",
"nested",
"map",
"objects",
"@param",
"aValues",
"the",
"key",
"/",
"value",
"properties",
"@param",
"bean",
"the",
"object",
"to",
"write",
"to",
"@param",
"valueConverter",
"the",
"value",
"converter",
"strategy",
"object"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/JavaBean.java#L95-L131 |
molgenis/molgenis | molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/CsvServiceImpl.java | CsvServiceImpl.validateCsvFile | private void validateCsvFile(List<String[]> content, String fileName) {
if (content.isEmpty()) {
throw new MolgenisDataException(format("CSV-file: [{0}] is empty", fileName));
}
if (content.size() == 1) {
throw new MolgenisDataException(
format("Header was found, but no data is present in file [{0}]", fileName));
}
int headerLength = content.get(0).length;
content.forEach(
row -> {
if (row.length != headerLength) {
throw new MolgenisDataException(
format("Column count in CSV-file: [{0}] is not consistent", fileName));
}
});
} | java | private void validateCsvFile(List<String[]> content, String fileName) {
if (content.isEmpty()) {
throw new MolgenisDataException(format("CSV-file: [{0}] is empty", fileName));
}
if (content.size() == 1) {
throw new MolgenisDataException(
format("Header was found, but no data is present in file [{0}]", fileName));
}
int headerLength = content.get(0).length;
content.forEach(
row -> {
if (row.length != headerLength) {
throw new MolgenisDataException(
format("Column count in CSV-file: [{0}] is not consistent", fileName));
}
});
} | [
"private",
"void",
"validateCsvFile",
"(",
"List",
"<",
"String",
"[",
"]",
">",
"content",
",",
"String",
"fileName",
")",
"{",
"if",
"(",
"content",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"MolgenisDataException",
"(",
"format",
"(",
"\"CSV... | Validates CSV file content.
<p>Checks that the content is not empty. Checks that at least one data row is present. Checks
that data row lengths are consistent with the header row length.
@param content content of CSV-file
@param fileName the name of the file that is validated
@throws MolgenisDataException if the validation fails | [
"Validates",
"CSV",
"file",
"content",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/CsvServiceImpl.java#L69-L87 |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/meta/model/Attribute.java | Attribute.getRange | public Range getRange() {
Long rangeMin = getRangeMin();
Long rangeMax = getRangeMax();
return rangeMin != null || rangeMax != null ? new Range(rangeMin, rangeMax) : null;
} | java | public Range getRange() {
Long rangeMin = getRangeMin();
Long rangeMax = getRangeMax();
return rangeMin != null || rangeMax != null ? new Range(rangeMin, rangeMax) : null;
} | [
"public",
"Range",
"getRange",
"(",
")",
"{",
"Long",
"rangeMin",
"=",
"getRangeMin",
"(",
")",
";",
"Long",
"rangeMax",
"=",
"getRangeMax",
"(",
")",
";",
"return",
"rangeMin",
"!=",
"null",
"||",
"rangeMax",
"!=",
"null",
"?",
"new",
"Range",
"(",
"r... | For int and long fields, the value must be between min and max (included) of the range
@return attribute value range | [
"For",
"int",
"and",
"long",
"fields",
"the",
"value",
"must",
"be",
"between",
"min",
"and",
"max",
"(",
"included",
")",
"of",
"the",
"range"
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/model/Attribute.java#L609-L613 |
beangle/beangle3 | struts/s2/src/main/java/org/beangle/struts2/view/component/Component.java | Component.findValue | protected Object findValue(String expr, String field, String errorMsg) {
if (expr == null) {
throw fieldError(field, errorMsg, null);
} else {
Object value = null;
Exception problem = null;
try {
value = findValue(expr);
} catch (Exception e) {
problem = e;
}
if (value == null) { throw fieldError(field, errorMsg, problem); }
return value;
}
} | java | protected Object findValue(String expr, String field, String errorMsg) {
if (expr == null) {
throw fieldError(field, errorMsg, null);
} else {
Object value = null;
Exception problem = null;
try {
value = findValue(expr);
} catch (Exception e) {
problem = e;
}
if (value == null) { throw fieldError(field, errorMsg, problem); }
return value;
}
} | [
"protected",
"Object",
"findValue",
"(",
"String",
"expr",
",",
"String",
"field",
",",
"String",
"errorMsg",
")",
"{",
"if",
"(",
"expr",
"==",
"null",
")",
"{",
"throw",
"fieldError",
"(",
"field",
",",
"errorMsg",
",",
"null",
")",
";",
"}",
"else",... | Evaluates the OGNL stack to find an Object value.
<p/>
Function just like <code>findValue(String)</code> except that if the given expression is
<tt>null</tt/> a error is logged and a <code>RuntimeException</code> is thrown constructed with
a messaged based on the given field and errorMsg paramter.
@param expr
OGNL expression.
@param field
field name used when throwing <code>RuntimeException</code>.
@param errorMsg
error message used when throwing <code>RuntimeException</code> .
@return the Object found, is never <tt>null</tt>.
@throws StrutsException
is thrown in case of not found in the OGNL stack, or
expression is <tt>null</tt>. | [
"Evaluates",
"the",
"OGNL",
"stack",
"to",
"find",
"an",
"Object",
"value",
".",
"<p",
"/",
">",
"Function",
"just",
"like",
"<code",
">",
"findValue",
"(",
"String",
")",
"<",
"/",
"code",
">",
"except",
"that",
"if",
"the",
"given",
"expression",
"is... | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/view/component/Component.java#L328-L344 |
couchbase/couchbase-lite-java-core | src/main/java/com/couchbase/lite/store/SQLiteViewStore.java | SQLiteViewStore.groupKey | public static Object groupKey(Object key, int groupLevel) {
if (groupLevel > 0 && (key instanceof List) && (((List<Object>) key).size() > groupLevel)) {
return ((List<Object>) key).subList(0, groupLevel);
} else {
return key;
}
} | java | public static Object groupKey(Object key, int groupLevel) {
if (groupLevel > 0 && (key instanceof List) && (((List<Object>) key).size() > groupLevel)) {
return ((List<Object>) key).subList(0, groupLevel);
} else {
return key;
}
} | [
"public",
"static",
"Object",
"groupKey",
"(",
"Object",
"key",
",",
"int",
"groupLevel",
")",
"{",
"if",
"(",
"groupLevel",
">",
"0",
"&&",
"(",
"key",
"instanceof",
"List",
")",
"&&",
"(",
"(",
"(",
"List",
"<",
"Object",
">",
")",
"key",
")",
".... | Returns the prefix of the key to use in the result row, at this groupLevel | [
"Returns",
"the",
"prefix",
"of",
"the",
"key",
"to",
"use",
"in",
"the",
"result",
"row",
"at",
"this",
"groupLevel"
] | train | https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/store/SQLiteViewStore.java#L1138-L1144 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/webapp/resources/ArtifactResource.java | ArtifactResource.getVersions | @GET
@Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON})
@Path("/{gavc}" + ServerAPI.GET_VERSIONS)
public Response getVersions(@PathParam("gavc") final String gavc){
if(LOG.isInfoEnabled()) {
LOG.info(String.format("Got a get artifact versions request [%s]", gavc));
}
final ListView view = new ListView("Versions View", "version");
final List<String> versions = getArtifactHandler().getArtifactVersions(gavc);
Collections.sort(versions);
view.addAll(versions);
return Response.ok(view).build();
} | java | @GET
@Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON})
@Path("/{gavc}" + ServerAPI.GET_VERSIONS)
public Response getVersions(@PathParam("gavc") final String gavc){
if(LOG.isInfoEnabled()) {
LOG.info(String.format("Got a get artifact versions request [%s]", gavc));
}
final ListView view = new ListView("Versions View", "version");
final List<String> versions = getArtifactHandler().getArtifactVersions(gavc);
Collections.sort(versions);
view.addAll(versions);
return Response.ok(view).build();
} | [
"@",
"GET",
"@",
"Produces",
"(",
"{",
"MediaType",
".",
"TEXT_HTML",
",",
"MediaType",
".",
"APPLICATION_JSON",
"}",
")",
"@",
"Path",
"(",
"\"/{gavc}\"",
"+",
"ServerAPI",
".",
"GET_VERSIONS",
")",
"public",
"Response",
"getVersions",
"(",
"@",
"PathParam"... | Returns the list of available versions of an artifact
This method is call via GET <grapes_url>/artifact/<gavc>/versions
@param gavc String
@return Response a list of versions in JSON or in HTML | [
"Returns",
"the",
"list",
"of",
"available",
"versions",
"of",
"an",
"artifact",
"This",
"method",
"is",
"call",
"via",
"GET",
"<grapes_url",
">",
"/",
"artifact",
"/",
"<gavc",
">",
"/",
"versions"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/ArtifactResource.java#L167-L182 |
windup/windup | rules-base/api/src/main/java/org/jboss/windup/rules/files/condition/FileContent.java | FileContent.fromInput | private void fromInput(List<FileModel> vertices, GraphRewrite event)
{
if (vertices.isEmpty() && StringUtils.isNotBlank(getInputVariablesName()))
{
for (WindupVertexFrame windupVertexFrame : Variables.instance(event).findVariable(getInputVariablesName()))
{
if (windupVertexFrame instanceof FileModel)
vertices.add((FileModel) windupVertexFrame);
if (windupVertexFrame instanceof FileReferenceModel)
vertices.add(((FileReferenceModel) windupVertexFrame).getFile());
}
}
} | java | private void fromInput(List<FileModel> vertices, GraphRewrite event)
{
if (vertices.isEmpty() && StringUtils.isNotBlank(getInputVariablesName()))
{
for (WindupVertexFrame windupVertexFrame : Variables.instance(event).findVariable(getInputVariablesName()))
{
if (windupVertexFrame instanceof FileModel)
vertices.add((FileModel) windupVertexFrame);
if (windupVertexFrame instanceof FileReferenceModel)
vertices.add(((FileReferenceModel) windupVertexFrame).getFile());
}
}
} | [
"private",
"void",
"fromInput",
"(",
"List",
"<",
"FileModel",
">",
"vertices",
",",
"GraphRewrite",
"event",
")",
"{",
"if",
"(",
"vertices",
".",
"isEmpty",
"(",
")",
"&&",
"StringUtils",
".",
"isNotBlank",
"(",
"getInputVariablesName",
"(",
")",
")",
")... | Generating the input vertices is quite complex. Therefore there are multiple methods that handles the input vertices based on the attribute
specified in specific order. This method handles the {@link FileContent#from(String)} attribute. | [
"Generating",
"the",
"input",
"vertices",
"is",
"quite",
"complex",
".",
"Therefore",
"there",
"are",
"multiple",
"methods",
"that",
"handles",
"the",
"input",
"vertices",
"based",
"on",
"the",
"attribute",
"specified",
"in",
"specific",
"order",
".",
"This",
... | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-base/api/src/main/java/org/jboss/windup/rules/files/condition/FileContent.java#L285-L297 |
mgledi/DRUMS | src/main/java/com/unister/semweb/drums/bucket/hashfunction/util/RangeHashSorter.java | RangeHashSorter.insertionSort | private void insertionSort(int left, int right) {
for (int p = left + 1; p <= right; p++) {
byte[] tmpRange = ranges[p];
String tmpFilename = filenames[p];
int j;
for (j = p; j > left && KeyUtils.compareKey(tmpRange, ranges[j - 1]) < 0; j--) {
ranges[j] = ranges[j - 1];
filenames[j] = filenames[j - 1];
}
ranges[j] = tmpRange;
filenames[j] = tmpFilename;
}
} | java | private void insertionSort(int left, int right) {
for (int p = left + 1; p <= right; p++) {
byte[] tmpRange = ranges[p];
String tmpFilename = filenames[p];
int j;
for (j = p; j > left && KeyUtils.compareKey(tmpRange, ranges[j - 1]) < 0; j--) {
ranges[j] = ranges[j - 1];
filenames[j] = filenames[j - 1];
}
ranges[j] = tmpRange;
filenames[j] = tmpFilename;
}
} | [
"private",
"void",
"insertionSort",
"(",
"int",
"left",
",",
"int",
"right",
")",
"{",
"for",
"(",
"int",
"p",
"=",
"left",
"+",
"1",
";",
"p",
"<=",
"right",
";",
"p",
"++",
")",
"{",
"byte",
"[",
"]",
"tmpRange",
"=",
"ranges",
"[",
"p",
"]",... | Internal insertion sort routine for subarrays of ranges that is used by quicksort.
@param left
the left-most index of the subarray.
@param right
the right-most index of the subarray. | [
"Internal",
"insertion",
"sort",
"routine",
"for",
"subarrays",
"of",
"ranges",
"that",
"is",
"used",
"by",
"quicksort",
"."
] | train | https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/bucket/hashfunction/util/RangeHashSorter.java#L118-L131 |
pravega/pravega | controller/src/main/java/io/pravega/controller/fault/SegmentMonitorLeader.java | SegmentMonitorLeader.takeLeadership | @Override
@Synchronized
public void takeLeadership(CuratorFramework client) throws Exception {
log.info("Obtained leadership to monitor the Host to Segment Container Mapping");
//Attempt a rebalance whenever leadership is obtained to ensure no host events are missed.
hostsChange.release();
//Start cluster monitor.
pravegaServiceCluster = new ClusterZKImpl(client, ClusterType.HOST);
//Add listener to track host changes on the monitored pravega cluster.
pravegaServiceCluster.addListener((type, host) -> {
switch (type) {
case HOST_ADDED:
case HOST_REMOVED:
//We don't keep track of the hosts and we always query for the entire set from the cluster
//when changes occur. This is to avoid any inconsistencies if we miss any notifications.
log.info("Received event: {} for host: {}. Wake up leader for rebalancing", type, host);
hostsChange.release();
break;
case ERROR:
//This event should be due to ZK connection errors and would have been received by the monitor too,
//hence not handling it explicitly here.
log.info("Received error event when monitoring the pravega host cluster, ignoring...");
break;
}
});
//Keep looping here as long as possible to stay as the leader and exclusively monitor the pravega cluster.
while (true) {
try {
if (suspended.get()) {
log.info("Monitor is suspended, waiting for notification to resume");
suspendMonitor.acquire();
log.info("Resuming monitor");
}
hostsChange.acquire();
log.info("Received rebalance event");
// Wait here until rebalance can be performed.
waitForRebalance();
// Clear all events that has been received until this point since this will be included in the current
// rebalance operation.
hostsChange.drainPermits();
triggerRebalance();
} catch (InterruptedException e) {
log.warn("Leadership interrupted, releasing monitor thread");
//Stop watching the pravega cluster.
pravegaServiceCluster.close();
throw e;
} catch (Exception e) {
//We will not release leadership if in suspended mode.
if (!suspended.get()) {
log.warn("Failed to perform rebalancing, relinquishing leadership");
//Stop watching the pravega cluster.
pravegaServiceCluster.close();
throw e;
}
}
}
} | java | @Override
@Synchronized
public void takeLeadership(CuratorFramework client) throws Exception {
log.info("Obtained leadership to monitor the Host to Segment Container Mapping");
//Attempt a rebalance whenever leadership is obtained to ensure no host events are missed.
hostsChange.release();
//Start cluster monitor.
pravegaServiceCluster = new ClusterZKImpl(client, ClusterType.HOST);
//Add listener to track host changes on the monitored pravega cluster.
pravegaServiceCluster.addListener((type, host) -> {
switch (type) {
case HOST_ADDED:
case HOST_REMOVED:
//We don't keep track of the hosts and we always query for the entire set from the cluster
//when changes occur. This is to avoid any inconsistencies if we miss any notifications.
log.info("Received event: {} for host: {}. Wake up leader for rebalancing", type, host);
hostsChange.release();
break;
case ERROR:
//This event should be due to ZK connection errors and would have been received by the monitor too,
//hence not handling it explicitly here.
log.info("Received error event when monitoring the pravega host cluster, ignoring...");
break;
}
});
//Keep looping here as long as possible to stay as the leader and exclusively monitor the pravega cluster.
while (true) {
try {
if (suspended.get()) {
log.info("Monitor is suspended, waiting for notification to resume");
suspendMonitor.acquire();
log.info("Resuming monitor");
}
hostsChange.acquire();
log.info("Received rebalance event");
// Wait here until rebalance can be performed.
waitForRebalance();
// Clear all events that has been received until this point since this will be included in the current
// rebalance operation.
hostsChange.drainPermits();
triggerRebalance();
} catch (InterruptedException e) {
log.warn("Leadership interrupted, releasing monitor thread");
//Stop watching the pravega cluster.
pravegaServiceCluster.close();
throw e;
} catch (Exception e) {
//We will not release leadership if in suspended mode.
if (!suspended.get()) {
log.warn("Failed to perform rebalancing, relinquishing leadership");
//Stop watching the pravega cluster.
pravegaServiceCluster.close();
throw e;
}
}
}
} | [
"@",
"Override",
"@",
"Synchronized",
"public",
"void",
"takeLeadership",
"(",
"CuratorFramework",
"client",
")",
"throws",
"Exception",
"{",
"log",
".",
"info",
"(",
"\"Obtained leadership to monitor the Host to Segment Container Mapping\"",
")",
";",
"//Attempt a rebalanc... | This function is called when the current instance is made the leader. The leadership is relinquished when this
function exits.
@param client The curator client.
@throws Exception On any error. This would result in leadership being relinquished. | [
"This",
"function",
"is",
"called",
"when",
"the",
"current",
"instance",
"is",
"made",
"the",
"leader",
".",
"The",
"leadership",
"is",
"relinquished",
"when",
"this",
"function",
"exits",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/fault/SegmentMonitorLeader.java#L108-L173 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReceiptTemplateBuilder.java | ReceiptTemplateBuilder.addQuickReply | public ReceiptTemplateBuilder addQuickReply(String title, String payload) {
this.messageBuilder.addQuickReply(title, payload);
return this;
} | java | public ReceiptTemplateBuilder addQuickReply(String title, String payload) {
this.messageBuilder.addQuickReply(title, payload);
return this;
} | [
"public",
"ReceiptTemplateBuilder",
"addQuickReply",
"(",
"String",
"title",
",",
"String",
"payload",
")",
"{",
"this",
".",
"messageBuilder",
".",
"addQuickReply",
"(",
"title",
",",
"payload",
")",
";",
"return",
"this",
";",
"}"
] | Adds a {@link QuickReply} to the current object.
@param title
the quick reply button label. It can't be empty.
@param payload
the payload sent back when the button is pressed. It can't be
empty.
@return this builder.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies"
> Facebook's Messenger Platform Quick Replies Documentation</a> | [
"Adds",
"a",
"{",
"@link",
"QuickReply",
"}",
"to",
"the",
"current",
"object",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReceiptTemplateBuilder.java#L245-L248 |
osglworks/java-tool | src/main/java/org/osgl/Lang.java | F4.andThen | public F4<P1, P2, P3, P4, R> andThen(
final Func4<? super P1, ? super P2, ? super P3, ? super P4, ? extends R>... fs
) {
if (0 == fs.length) {
return this;
}
final Func4<P1, P2, P3, P4, R> me = this;
return new F4<P1, P2, P3, P4, R>() {
@Override
public R apply(P1 p1, P2 p2, P3 p3, P4 p4) {
R r = me.apply(p1, p2, p3, p4);
for (Func4<? super P1, ? super P2, ? super P3, ? super P4, ? extends R> f : fs) {
r = f.apply(p1, p2, p3, p4);
}
return r;
}
};
} | java | public F4<P1, P2, P3, P4, R> andThen(
final Func4<? super P1, ? super P2, ? super P3, ? super P4, ? extends R>... fs
) {
if (0 == fs.length) {
return this;
}
final Func4<P1, P2, P3, P4, R> me = this;
return new F4<P1, P2, P3, P4, R>() {
@Override
public R apply(P1 p1, P2 p2, P3 p3, P4 p4) {
R r = me.apply(p1, p2, p3, p4);
for (Func4<? super P1, ? super P2, ? super P3, ? super P4, ? extends R> f : fs) {
r = f.apply(p1, p2, p3, p4);
}
return r;
}
};
} | [
"public",
"F4",
"<",
"P1",
",",
"P2",
",",
"P3",
",",
"P4",
",",
"R",
">",
"andThen",
"(",
"final",
"Func4",
"<",
"?",
"super",
"P1",
",",
"?",
"super",
"P2",
",",
"?",
"super",
"P3",
",",
"?",
"super",
"P4",
",",
"?",
"extends",
"R",
">",
... | Returns a composed function that applied, in sequence, this function and
all functions specified one by one. If applying anyone of the functions
throws an exception, it is relayed to the caller of the composed function.
If an exception is thrown out, the following functions will not be applied.
<p>When apply the composed function, the result of the last function
is returned</p>
@param fs
a sequence of function to be applied after this function
@return a composed function | [
"Returns",
"a",
"composed",
"function",
"that",
"applied",
"in",
"sequence",
"this",
"function",
"and",
"all",
"functions",
"specified",
"one",
"by",
"one",
".",
"If",
"applying",
"anyone",
"of",
"the",
"functions",
"throws",
"an",
"exception",
"it",
"is",
"... | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L1574-L1592 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/util/Strings.java | Strings.joinStrings | public static String joinStrings(List<String> strings, boolean fixCase, char withChar) {
if (strings == null || strings.size() == 0) {
return "";
}
StringBuilder result = null;
for (String s : strings) {
if (fixCase) {
s = fixCase(s);
}
if (result == null) {
result = new StringBuilder(s);
} else {
result.append(withChar);
result.append(s);
}
}
return result.toString();
} | java | public static String joinStrings(List<String> strings, boolean fixCase, char withChar) {
if (strings == null || strings.size() == 0) {
return "";
}
StringBuilder result = null;
for (String s : strings) {
if (fixCase) {
s = fixCase(s);
}
if (result == null) {
result = new StringBuilder(s);
} else {
result.append(withChar);
result.append(s);
}
}
return result.toString();
} | [
"public",
"static",
"String",
"joinStrings",
"(",
"List",
"<",
"String",
">",
"strings",
",",
"boolean",
"fixCase",
",",
"char",
"withChar",
")",
"{",
"if",
"(",
"strings",
"==",
"null",
"||",
"strings",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"r... | Generic string joining function.
@param strings Strings to be joined
@param fixCase does it need to fix word case
@param withChar char to join strings with.
@return joined-string | [
"Generic",
"string",
"joining",
"function",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/util/Strings.java#L40-L57 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/webui/UIFileInfo.java | UIFileInfo.addBlock | public void addBlock(String tierAlias, long blockId, long blockSize, long blockLastAccessTimeMs) {
UIFileBlockInfo block =
new UIFileBlockInfo(blockId, blockSize, blockLastAccessTimeMs, tierAlias,
mAlluxioConfiguration);
List<UIFileBlockInfo> blocksOnTier = mBlocksOnTier.get(tierAlias);
if (blocksOnTier == null) {
blocksOnTier = new ArrayList<>();
mBlocksOnTier.put(tierAlias, blocksOnTier);
}
blocksOnTier.add(block);
Long sizeOnTier = mSizeOnTier.get(tierAlias);
mSizeOnTier.put(tierAlias, (sizeOnTier == null ? 0L : sizeOnTier) + blockSize);
} | java | public void addBlock(String tierAlias, long blockId, long blockSize, long blockLastAccessTimeMs) {
UIFileBlockInfo block =
new UIFileBlockInfo(blockId, blockSize, blockLastAccessTimeMs, tierAlias,
mAlluxioConfiguration);
List<UIFileBlockInfo> blocksOnTier = mBlocksOnTier.get(tierAlias);
if (blocksOnTier == null) {
blocksOnTier = new ArrayList<>();
mBlocksOnTier.put(tierAlias, blocksOnTier);
}
blocksOnTier.add(block);
Long sizeOnTier = mSizeOnTier.get(tierAlias);
mSizeOnTier.put(tierAlias, (sizeOnTier == null ? 0L : sizeOnTier) + blockSize);
} | [
"public",
"void",
"addBlock",
"(",
"String",
"tierAlias",
",",
"long",
"blockId",
",",
"long",
"blockSize",
",",
"long",
"blockLastAccessTimeMs",
")",
"{",
"UIFileBlockInfo",
"block",
"=",
"new",
"UIFileBlockInfo",
"(",
"blockId",
",",
"blockSize",
",",
"blockLa... | Adds a block to the file information.
@param tierAlias the tier alias
@param blockId the block id
@param blockSize the block size
@param blockLastAccessTimeMs the last access time (in milliseconds) | [
"Adds",
"a",
"block",
"to",
"the",
"file",
"information",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/webui/UIFileInfo.java#L189-L202 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/ServiceBuilder.java | ServiceBuilder.withStreamSegmentStore | public ServiceBuilder withStreamSegmentStore(Function<ComponentSetup, StreamSegmentStore> streamSegmentStoreCreator) {
Preconditions.checkNotNull(streamSegmentStoreCreator, "streamSegmentStoreCreator");
this.streamSegmentStoreCreator = streamSegmentStoreCreator;
return this;
} | java | public ServiceBuilder withStreamSegmentStore(Function<ComponentSetup, StreamSegmentStore> streamSegmentStoreCreator) {
Preconditions.checkNotNull(streamSegmentStoreCreator, "streamSegmentStoreCreator");
this.streamSegmentStoreCreator = streamSegmentStoreCreator;
return this;
} | [
"public",
"ServiceBuilder",
"withStreamSegmentStore",
"(",
"Function",
"<",
"ComponentSetup",
",",
"StreamSegmentStore",
">",
"streamSegmentStoreCreator",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"streamSegmentStoreCreator",
",",
"\"streamSegmentStoreCreator\"",
"... | Attaches the given StreamSegmentStore creator to this ServiceBuilder. The given Function will not be invoked
right away; it will be called when needed.
@param streamSegmentStoreCreator The Function to attach.
@return This ServiceBuilder. | [
"Attaches",
"the",
"given",
"StreamSegmentStore",
"creator",
"to",
"this",
"ServiceBuilder",
".",
"The",
"given",
"Function",
"will",
"not",
"be",
"invoked",
"right",
"away",
";",
"it",
"will",
"be",
"called",
"when",
"needed",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/ServiceBuilder.java#L222-L226 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java | Types.asSuper | public Type asSuper(Type t, Symbol sym) {
/* Some examples:
*
* (Enum<E>, Comparable) => Comparable<E>
* (c.s.s.d.AttributeTree.ValueKind, Enum) => Enum<c.s.s.d.AttributeTree.ValueKind>
* (c.s.s.t.ExpressionTree, c.s.s.t.Tree) => c.s.s.t.Tree
* (j.u.List<capture#160 of ? extends c.s.s.d.DocTree>, Iterable) =>
* Iterable<capture#160 of ? extends c.s.s.d.DocTree>
*/
if (sym.type == syms.objectType) { //optimization
return syms.objectType;
}
return asSuper.visit(t, sym);
} | java | public Type asSuper(Type t, Symbol sym) {
/* Some examples:
*
* (Enum<E>, Comparable) => Comparable<E>
* (c.s.s.d.AttributeTree.ValueKind, Enum) => Enum<c.s.s.d.AttributeTree.ValueKind>
* (c.s.s.t.ExpressionTree, c.s.s.t.Tree) => c.s.s.t.Tree
* (j.u.List<capture#160 of ? extends c.s.s.d.DocTree>, Iterable) =>
* Iterable<capture#160 of ? extends c.s.s.d.DocTree>
*/
if (sym.type == syms.objectType) { //optimization
return syms.objectType;
}
return asSuper.visit(t, sym);
} | [
"public",
"Type",
"asSuper",
"(",
"Type",
"t",
",",
"Symbol",
"sym",
")",
"{",
"/* Some examples:\n *\n * (Enum<E>, Comparable) => Comparable<E>\n * (c.s.s.d.AttributeTree.ValueKind, Enum) => Enum<c.s.s.d.AttributeTree.ValueKind>\n * (c.s.s.t.ExpressionTree, c.s... | Return the (most specific) base type of t that starts with the
given symbol. If none exists, return null.
Caveat Emptor: Since javac represents the class of all arrays with a singleton
symbol Symtab.arrayClass, which by being a singleton cannot hold any discriminant,
this method could yield surprising answers when invoked on arrays. For example when
invoked with t being byte [] and sym being t.sym itself, asSuper would answer null.
@param t a type
@param sym a symbol | [
"Return",
"the",
"(",
"most",
"specific",
")",
"base",
"type",
"of",
"t",
"that",
"starts",
"with",
"the",
"given",
"symbol",
".",
"If",
"none",
"exists",
"return",
"null",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L1853-L1866 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.readFile | public CmsFile readFile(CmsDbContext dbc, CmsResource resource) throws CmsException {
if (resource.isFolder()) {
throw new CmsVfsResourceNotFoundException(
Messages.get().container(
Messages.ERR_ACCESS_FOLDER_AS_FILE_1,
dbc.removeSiteRoot(resource.getRootPath())));
}
CmsUUID projectId = dbc.currentProject().getUuid();
CmsFile file = null;
if (resource instanceof I_CmsHistoryResource) {
file = new CmsHistoryFile((I_CmsHistoryResource)resource);
file.setContents(
getHistoryDriver(dbc).readContent(
dbc,
resource.getResourceId(),
((I_CmsHistoryResource)resource).getPublishTag()));
} else {
file = new CmsFile(resource);
file.setContents(getVfsDriver(dbc).readContent(dbc, projectId, resource.getResourceId()));
}
return file;
} | java | public CmsFile readFile(CmsDbContext dbc, CmsResource resource) throws CmsException {
if (resource.isFolder()) {
throw new CmsVfsResourceNotFoundException(
Messages.get().container(
Messages.ERR_ACCESS_FOLDER_AS_FILE_1,
dbc.removeSiteRoot(resource.getRootPath())));
}
CmsUUID projectId = dbc.currentProject().getUuid();
CmsFile file = null;
if (resource instanceof I_CmsHistoryResource) {
file = new CmsHistoryFile((I_CmsHistoryResource)resource);
file.setContents(
getHistoryDriver(dbc).readContent(
dbc,
resource.getResourceId(),
((I_CmsHistoryResource)resource).getPublishTag()));
} else {
file = new CmsFile(resource);
file.setContents(getVfsDriver(dbc).readContent(dbc, projectId, resource.getResourceId()));
}
return file;
} | [
"public",
"CmsFile",
"readFile",
"(",
"CmsDbContext",
"dbc",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"resource",
".",
"isFolder",
"(",
")",
")",
"{",
"throw",
"new",
"CmsVfsResourceNotFoundException",
"(",
"Messages",
".",
... | Reads a file resource (including it's binary content) from the VFS,
using the specified resource filter.<p>
In case you do not need the file content,
use <code>{@link #readResource(CmsDbContext, String, CmsResourceFilter)}</code> instead.<p>
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
"valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
will ignore the date release / date expired information of the resource.<p>
@param dbc the current database context
@param resource the base file resource (without content)
@return the file read from the VFS
@throws CmsException if operation was not successful | [
"Reads",
"a",
"file",
"resource",
"(",
"including",
"it",
"s",
"binary",
"content",
")",
"from",
"the",
"VFS",
"using",
"the",
"specified",
"resource",
"filter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L6824-L6847 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/collect/ImmutableList.java | ImmutableList.subList | @Override
public ImmutableList<E> subList(int fromIndex, int toIndex) {
checkPositionIndexes(fromIndex, toIndex, size());
int length = toIndex - fromIndex;
if (length == size()) {
return this;
}
switch (length) {
case 0:
return of();
case 1:
return of(get(fromIndex));
default:
return subListUnchecked(fromIndex, toIndex);
}
} | java | @Override
public ImmutableList<E> subList(int fromIndex, int toIndex) {
checkPositionIndexes(fromIndex, toIndex, size());
int length = toIndex - fromIndex;
if (length == size()) {
return this;
}
switch (length) {
case 0:
return of();
case 1:
return of(get(fromIndex));
default:
return subListUnchecked(fromIndex, toIndex);
}
} | [
"@",
"Override",
"public",
"ImmutableList",
"<",
"E",
">",
"subList",
"(",
"int",
"fromIndex",
",",
"int",
"toIndex",
")",
"{",
"checkPositionIndexes",
"(",
"fromIndex",
",",
"toIndex",
",",
"size",
"(",
")",
")",
";",
"int",
"length",
"=",
"toIndex",
"-... | Returns an immutable list of the elements between the specified {@code
fromIndex}, inclusive, and {@code toIndex}, exclusive. (If {@code
fromIndex} and {@code toIndex} are equal, the empty immutable list is
returned.) | [
"Returns",
"an",
"immutable",
"list",
"of",
"the",
"elements",
"between",
"the",
"specified",
"{"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/ImmutableList.java#L360-L375 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/SdkHttpUtils.java | SdkHttpUtils.encodeParameters | public static String encodeParameters(SignableRequest<?> request) {
final Map<String, List<String>> requestParams = request.getParameters();
if (requestParams.isEmpty()) return null;
final List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
for (Entry<String, List<String>> entry : requestParams.entrySet()) {
String parameterName = entry.getKey();
for (String value : entry.getValue()) {
nameValuePairs
.add(new BasicNameValuePair(parameterName, value));
}
}
return URLEncodedUtils.format(nameValuePairs, DEFAULT_ENCODING);
} | java | public static String encodeParameters(SignableRequest<?> request) {
final Map<String, List<String>> requestParams = request.getParameters();
if (requestParams.isEmpty()) return null;
final List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
for (Entry<String, List<String>> entry : requestParams.entrySet()) {
String parameterName = entry.getKey();
for (String value : entry.getValue()) {
nameValuePairs
.add(new BasicNameValuePair(parameterName, value));
}
}
return URLEncodedUtils.format(nameValuePairs, DEFAULT_ENCODING);
} | [
"public",
"static",
"String",
"encodeParameters",
"(",
"SignableRequest",
"<",
"?",
">",
"request",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"requestParams",
"=",
"request",
".",
"getParameters",
"(",
")",
";",
"if",
... | Creates an encoded query string from all the parameters in the specified
request.
@param request
The request containing the parameters to encode.
@return Null if no parameters were present, otherwise the encoded query
string for the parameters present in the specified request. | [
"Creates",
"an",
"encoded",
"query",
"string",
"from",
"all",
"the",
"parameters",
"in",
"the",
"specified",
"request",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/SdkHttpUtils.java#L159-L176 |
otto-de/edison-microservice | edison-jobs/src/main/java/de/otto/edison/jobs/repository/inmem/InMemJobMetaRepository.java | InMemJobMetaRepository.getJobMeta | @Override
public JobMeta getJobMeta(String jobType) {
final Map<String, String> document = map.get(jobType);
if (document != null) {
final Map<String, String> meta = document.keySet()
.stream()
.filter(key -> !key.startsWith("_e_"))
.collect(toMap(
key -> key,
document::get
));
final boolean isRunning = document.containsKey(KEY_RUNNING);
final boolean isDisabled = document.containsKey(KEY_DISABLED);
final String comment = document.get(KEY_DISABLED);
return new JobMeta(jobType, isRunning, isDisabled, comment, meta);
} else {
return new JobMeta(jobType, false, false, "", emptyMap());
}
} | java | @Override
public JobMeta getJobMeta(String jobType) {
final Map<String, String> document = map.get(jobType);
if (document != null) {
final Map<String, String> meta = document.keySet()
.stream()
.filter(key -> !key.startsWith("_e_"))
.collect(toMap(
key -> key,
document::get
));
final boolean isRunning = document.containsKey(KEY_RUNNING);
final boolean isDisabled = document.containsKey(KEY_DISABLED);
final String comment = document.get(KEY_DISABLED);
return new JobMeta(jobType, isRunning, isDisabled, comment, meta);
} else {
return new JobMeta(jobType, false, false, "", emptyMap());
}
} | [
"@",
"Override",
"public",
"JobMeta",
"getJobMeta",
"(",
"String",
"jobType",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"document",
"=",
"map",
".",
"get",
"(",
"jobType",
")",
";",
"if",
"(",
"document",
"!=",
"null",
")",
"{",
"f... | Returns the current state of the specified job type.
@param jobType the job type
@return current state of the job type | [
"Returns",
"the",
"current",
"state",
"of",
"the",
"specified",
"job",
"type",
"."
] | train | https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-jobs/src/main/java/de/otto/edison/jobs/repository/inmem/InMemJobMetaRepository.java#L100-L118 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmVisitor.java | XsdAsmVisitor.generateVisitorInterface | private static void generateVisitorInterface(Set<String> elementNames, List<XsdAttribute> attributes, String apiName) {
ClassWriter classWriter = generateClass(ELEMENT_VISITOR, JAVA_OBJECT, null, null, ACC_PUBLIC + ACC_ABSTRACT + ACC_SUPER, apiName);
MethodVisitor mVisitor = classWriter.visitMethod(ACC_PUBLIC, CONSTRUCTOR, "()V", null, null);
mVisitor.visitCode();
mVisitor.visitVarInsn(ALOAD, 0);
mVisitor.visitMethodInsn(INVOKESPECIAL, JAVA_OBJECT, CONSTRUCTOR, "()V", false);
mVisitor.visitInsn(RETURN);
mVisitor.visitMaxs(1, 1);
mVisitor.visitEnd();
mVisitor = classWriter.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, VISIT_ELEMENT_NAME, "(" + elementTypeDesc + ")V", null, null);
mVisitor.visitEnd();
mVisitor = classWriter.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, VISIT_ATTRIBUTE_NAME, "(" + JAVA_STRING_DESC + JAVA_STRING_DESC + ")V", null, null);
mVisitor.visitEnd();
mVisitor = classWriter.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, VISIT_PARENT_NAME, "(" + elementTypeDesc + ")V", null, null);
mVisitor.visitEnd();
mVisitor = classWriter.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, "visitText", "(" + textTypeDesc + ")V", "<R:" + JAVA_OBJECT_DESC + ">(L" + textType + "<+" + elementTypeDesc + "TR;>;)V", null);
mVisitor.visitEnd();
mVisitor = classWriter.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, "visitComment", "(" + textTypeDesc + ")V", "<R:" + JAVA_OBJECT_DESC + ">(L" + textType + "<+" + elementTypeDesc + "TR;>;)V", null);
mVisitor.visitEnd();
mVisitor = classWriter.visitMethod(ACC_PUBLIC, "visitOpenDynamic", "()V", null, null);
mVisitor.visitCode();
mVisitor.visitInsn(RETURN);
mVisitor.visitMaxs(0, 1);
mVisitor.visitEnd();
mVisitor = classWriter.visitMethod(ACC_PUBLIC, "visitCloseDynamic", "()V", null, null);
mVisitor.visitCode();
mVisitor.visitInsn(RETURN);
mVisitor.visitMaxs(0, 1);
mVisitor.visitEnd();
elementNames.forEach(elementName -> addVisitorParentMethod(classWriter, elementName, apiName));
elementNames.forEach(elementName -> addVisitorElementMethod(classWriter, elementName, apiName));
attributes.forEach(attribute -> addVisitorAttributeMethod(classWriter, attribute));
writeClassToFile(ELEMENT_VISITOR, classWriter, apiName);
} | java | private static void generateVisitorInterface(Set<String> elementNames, List<XsdAttribute> attributes, String apiName) {
ClassWriter classWriter = generateClass(ELEMENT_VISITOR, JAVA_OBJECT, null, null, ACC_PUBLIC + ACC_ABSTRACT + ACC_SUPER, apiName);
MethodVisitor mVisitor = classWriter.visitMethod(ACC_PUBLIC, CONSTRUCTOR, "()V", null, null);
mVisitor.visitCode();
mVisitor.visitVarInsn(ALOAD, 0);
mVisitor.visitMethodInsn(INVOKESPECIAL, JAVA_OBJECT, CONSTRUCTOR, "()V", false);
mVisitor.visitInsn(RETURN);
mVisitor.visitMaxs(1, 1);
mVisitor.visitEnd();
mVisitor = classWriter.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, VISIT_ELEMENT_NAME, "(" + elementTypeDesc + ")V", null, null);
mVisitor.visitEnd();
mVisitor = classWriter.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, VISIT_ATTRIBUTE_NAME, "(" + JAVA_STRING_DESC + JAVA_STRING_DESC + ")V", null, null);
mVisitor.visitEnd();
mVisitor = classWriter.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, VISIT_PARENT_NAME, "(" + elementTypeDesc + ")V", null, null);
mVisitor.visitEnd();
mVisitor = classWriter.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, "visitText", "(" + textTypeDesc + ")V", "<R:" + JAVA_OBJECT_DESC + ">(L" + textType + "<+" + elementTypeDesc + "TR;>;)V", null);
mVisitor.visitEnd();
mVisitor = classWriter.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, "visitComment", "(" + textTypeDesc + ")V", "<R:" + JAVA_OBJECT_DESC + ">(L" + textType + "<+" + elementTypeDesc + "TR;>;)V", null);
mVisitor.visitEnd();
mVisitor = classWriter.visitMethod(ACC_PUBLIC, "visitOpenDynamic", "()V", null, null);
mVisitor.visitCode();
mVisitor.visitInsn(RETURN);
mVisitor.visitMaxs(0, 1);
mVisitor.visitEnd();
mVisitor = classWriter.visitMethod(ACC_PUBLIC, "visitCloseDynamic", "()V", null, null);
mVisitor.visitCode();
mVisitor.visitInsn(RETURN);
mVisitor.visitMaxs(0, 1);
mVisitor.visitEnd();
elementNames.forEach(elementName -> addVisitorParentMethod(classWriter, elementName, apiName));
elementNames.forEach(elementName -> addVisitorElementMethod(classWriter, elementName, apiName));
attributes.forEach(attribute -> addVisitorAttributeMethod(classWriter, attribute));
writeClassToFile(ELEMENT_VISITOR, classWriter, apiName);
} | [
"private",
"static",
"void",
"generateVisitorInterface",
"(",
"Set",
"<",
"String",
">",
"elementNames",
",",
"List",
"<",
"XsdAttribute",
">",
"attributes",
",",
"String",
"apiName",
")",
"{",
"ClassWriter",
"classWriter",
"=",
"generateClass",
"(",
"ELEMENT_VISI... | Generates the visitor class for this fluent interface with methods for all elements in the element list.
Main methods:
void visitElement(Element element);
void visitAttribute(String attributeName, String attributeValue);
void visitParent(Element elementName);
<R> void visitText(Text<? extends Element, R> text);
<R> void visitComment(Text<? extends Element, R> comment);
@param elementNames The elements names list.
@param attributes The list of attributes to be generated.
@param apiName The name of the generated fluent interface. | [
"Generates",
"the",
"visitor",
"class",
"for",
"this",
"fluent",
"interface",
"with",
"methods",
"for",
"all",
"elements",
"in",
"the",
"element",
"list",
"."
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmVisitor.java#L51-L96 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/shape/EllipticalArc.java | EllipticalArc.prepare | @Override
protected boolean prepare(final Context2D context, final Attributes attr, final double alpha)
{
final double rx = attr.getRadiusX();
final double ry = attr.getRadiusY();
if ((rx > 0) && (ry > 0))
{
context.beginPath();
context.ellipse(0, 0, rx, ry, 0, attr.getStartAngle(), attr.getEndAngle(), attr.isCounterClockwise());
return true;
}
return false;
} | java | @Override
protected boolean prepare(final Context2D context, final Attributes attr, final double alpha)
{
final double rx = attr.getRadiusX();
final double ry = attr.getRadiusY();
if ((rx > 0) && (ry > 0))
{
context.beginPath();
context.ellipse(0, 0, rx, ry, 0, attr.getStartAngle(), attr.getEndAngle(), attr.isCounterClockwise());
return true;
}
return false;
} | [
"@",
"Override",
"protected",
"boolean",
"prepare",
"(",
"final",
"Context2D",
"context",
",",
"final",
"Attributes",
"attr",
",",
"final",
"double",
"alpha",
")",
"{",
"final",
"double",
"rx",
"=",
"attr",
".",
"getRadiusX",
"(",
")",
";",
"final",
"doubl... | Draws this arc.
@param context the {@link Context2D} used to draw this arc. | [
"Draws",
"this",
"arc",
"."
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/EllipticalArc.java#L86-L102 |
jbundle/jbundle | thin/opt/location/src/main/java/org/jbundle/thin/opt/location/NodeData.java | NodeData.init | public void init(BaseApplet baseApplet, RemoteSession remoteSession, String strDescription, String objID, String strRecordName)
{
m_baseApplet = baseApplet;
m_remoteSession = remoteSession;
m_strDescription = strDescription;
m_objID = objID;
m_strRecordName = strRecordName;
} | java | public void init(BaseApplet baseApplet, RemoteSession remoteSession, String strDescription, String objID, String strRecordName)
{
m_baseApplet = baseApplet;
m_remoteSession = remoteSession;
m_strDescription = strDescription;
m_objID = objID;
m_strRecordName = strRecordName;
} | [
"public",
"void",
"init",
"(",
"BaseApplet",
"baseApplet",
",",
"RemoteSession",
"remoteSession",
",",
"String",
"strDescription",
",",
"String",
"objID",
",",
"String",
"strRecordName",
")",
"{",
"m_baseApplet",
"=",
"baseApplet",
";",
"m_remoteSession",
"=",
"re... | Constructs a new instance of SampleData with the passed in arguments. | [
"Constructs",
"a",
"new",
"instance",
"of",
"SampleData",
"with",
"the",
"passed",
"in",
"arguments",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/opt/location/src/main/java/org/jbundle/thin/opt/location/NodeData.java#L52-L59 |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/Ekstazi.java | Ekstazi.endClassCoverage | public void endClassCoverage(String className, boolean isFailOrError) {
File testResultsDir = new File(Config.ROOT_DIR_V, Names.TEST_RESULTS_DIR_NAME);
File outcomeFile = new File(testResultsDir, className);
if (isFailOrError) {
// TODO: long names.
testResultsDir.mkdirs();
try {
outcomeFile.createNewFile();
} catch (IOException e) {
Log.e("Unable to create file for a failing test: " + className, e);
}
} else {
outcomeFile.delete();
}
endClassCoverage(className);
} | java | public void endClassCoverage(String className, boolean isFailOrError) {
File testResultsDir = new File(Config.ROOT_DIR_V, Names.TEST_RESULTS_DIR_NAME);
File outcomeFile = new File(testResultsDir, className);
if (isFailOrError) {
// TODO: long names.
testResultsDir.mkdirs();
try {
outcomeFile.createNewFile();
} catch (IOException e) {
Log.e("Unable to create file for a failing test: " + className, e);
}
} else {
outcomeFile.delete();
}
endClassCoverage(className);
} | [
"public",
"void",
"endClassCoverage",
"(",
"String",
"className",
",",
"boolean",
"isFailOrError",
")",
"{",
"File",
"testResultsDir",
"=",
"new",
"File",
"(",
"Config",
".",
"ROOT_DIR_V",
",",
"Names",
".",
"TEST_RESULTS_DIR_NAME",
")",
";",
"File",
"outcomeFil... | Saves info about the results of running the given test class. | [
"Saves",
"info",
"about",
"the",
"results",
"of",
"running",
"the",
"given",
"test",
"class",
"."
] | train | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/Ekstazi.java#L144-L159 |
PunchThrough/bean-sdk-android | sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java | Bean.programWithFirmware | public OADProfile.OADApproval programWithFirmware(FirmwareBundle bundle, OADProfile.OADListener listener) {
return gattClient.getOADProfile().programWithFirmware(bundle, listener);
} | java | public OADProfile.OADApproval programWithFirmware(FirmwareBundle bundle, OADProfile.OADListener listener) {
return gattClient.getOADProfile().programWithFirmware(bundle, listener);
} | [
"public",
"OADProfile",
".",
"OADApproval",
"programWithFirmware",
"(",
"FirmwareBundle",
"bundle",
",",
"OADProfile",
".",
"OADListener",
"listener",
")",
"{",
"return",
"gattClient",
".",
"getOADProfile",
"(",
")",
".",
"programWithFirmware",
"(",
"bundle",
",",
... | Programs the Bean with new firmware images.
@param bundle The firmware package holding A and B images to be sent to the Bean
@param listener OADListener to alert the client of OAD state | [
"Programs",
"the",
"Bean",
"with",
"new",
"firmware",
"images",
"."
] | train | https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L1141-L1143 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/http/HttpMessage.java | HttpMessage.addDateField | public void addDateField(String name, Date date)
{
if (_state!=__MSG_EDITABLE)
return;
_header.addDateField(name,date);
} | java | public void addDateField(String name, Date date)
{
if (_state!=__MSG_EDITABLE)
return;
_header.addDateField(name,date);
} | [
"public",
"void",
"addDateField",
"(",
"String",
"name",
",",
"Date",
"date",
")",
"{",
"if",
"(",
"_state",
"!=",
"__MSG_EDITABLE",
")",
"return",
";",
"_header",
".",
"addDateField",
"(",
"name",
",",
"date",
")",
";",
"}"
] | Adds the value of a date field.
Header or Trailer fields are set depending on message state.
@param name the field name
@param date the field date value | [
"Adds",
"the",
"value",
"of",
"a",
"date",
"field",
".",
"Header",
"or",
"Trailer",
"fields",
"are",
"set",
"depending",
"on",
"message",
"state",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/HttpMessage.java#L385-L390 |
headius/invokebinder | src/main/java/com/headius/invokebinder/transform/Transform.java | Transform.buildClassArgument | protected static void buildClassArgument(StringBuilder builder, Class cls) {
buildClass(builder, cls);
builder.append(".class");
} | java | protected static void buildClassArgument(StringBuilder builder, Class cls) {
buildClass(builder, cls);
builder.append(".class");
} | [
"protected",
"static",
"void",
"buildClassArgument",
"(",
"StringBuilder",
"builder",
",",
"Class",
"cls",
")",
"{",
"buildClass",
"(",
"builder",
",",
"cls",
")",
";",
"builder",
".",
"append",
"(",
"\".class\"",
")",
";",
"}"
] | Build Java code to represent a single .class reference.
This will be an argument of the form "pkg.Cls1.class" or "pkg.Cls2[].class" or "primtype.class"
@param builder the builder in which to build the argument
@param cls the type for the argument | [
"Build",
"Java",
"code",
"to",
"represent",
"a",
"single",
".",
"class",
"reference",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/transform/Transform.java#L82-L85 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/util/EncryptionUtil.java | EncryptionUtil.getInstance | public static EncryptionUtil getInstance(String key, String salt) throws NoSuchAlgorithmException,
UnsupportedEncodingException, InvalidKeySpecException {
if (instance == null) {
synchronized (EncryptionUtil.class) {
if (instance == null) {
instance = new EncryptionUtil();
generateKeyIfNotAvailable(key, salt);
}
}
}
return instance;
} | java | public static EncryptionUtil getInstance(String key, String salt) throws NoSuchAlgorithmException,
UnsupportedEncodingException, InvalidKeySpecException {
if (instance == null) {
synchronized (EncryptionUtil.class) {
if (instance == null) {
instance = new EncryptionUtil();
generateKeyIfNotAvailable(key, salt);
}
}
}
return instance;
} | [
"public",
"static",
"EncryptionUtil",
"getInstance",
"(",
"String",
"key",
",",
"String",
"salt",
")",
"throws",
"NoSuchAlgorithmException",
",",
"UnsupportedEncodingException",
",",
"InvalidKeySpecException",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"syn... | Gets the Encryptor.
@param key the key
@param salt the salt
@return the Encryptor
@throws NoSuchAlgorithmException the no such algorithm exception
@throws UnsupportedEncodingException the unsupported encoding exception
@throws InvalidKeySpecException the invalid key spec exception | [
"Gets",
"the",
"Encryptor",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/util/EncryptionUtil.java#L173-L184 |
igniterealtime/Smack | smack-experimental/src/main/java/org/jivesoftware/smackx/colors/ConsistentColor.java | ConsistentColor.applyColorDeficiencyCorrection | private static double applyColorDeficiencyCorrection(double angle, Deficiency deficiency) {
switch (deficiency) {
case none:
break;
case redGreenBlindness:
angle %= Math.PI;
break;
case blueBlindness:
angle -= Math.PI / 2;
angle %= Math.PI;
angle += Math.PI / 2;
break;
}
return angle;
} | java | private static double applyColorDeficiencyCorrection(double angle, Deficiency deficiency) {
switch (deficiency) {
case none:
break;
case redGreenBlindness:
angle %= Math.PI;
break;
case blueBlindness:
angle -= Math.PI / 2;
angle %= Math.PI;
angle += Math.PI / 2;
break;
}
return angle;
} | [
"private",
"static",
"double",
"applyColorDeficiencyCorrection",
"(",
"double",
"angle",
",",
"Deficiency",
"deficiency",
")",
"{",
"switch",
"(",
"deficiency",
")",
"{",
"case",
"none",
":",
"break",
";",
"case",
"redGreenBlindness",
":",
"angle",
"%=",
"Math",... | Apply correction for color vision deficiencies to an angle in the CbCr plane.
@see <a href="https://xmpp.org/extensions/xep-0392.html#algorithm-cvd">§5.2: Corrections for Color Vision Deficiencies</a>
@param angle angle in CbCr plane
@param deficiency type of vision deficiency
@return corrected angle in CbCr plane | [
"Apply",
"correction",
"for",
"color",
"vision",
"deficiencies",
"to",
"an",
"angle",
"in",
"the",
"CbCr",
"plane",
".",
"@see",
"<a",
"href",
"=",
"https",
":",
"//",
"xmpp",
".",
"org",
"/",
"extensions",
"/",
"xep",
"-",
"0392",
".",
"html#algorithm",... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/colors/ConsistentColor.java#L73-L87 |
pravega/pravega | segmentstore/storage/src/main/java/io/pravega/segmentstore/storage/rolling/RollingSegmentHandle.java | RollingSegmentHandle.addChunk | synchronized void addChunk(SegmentChunk segmentChunk, SegmentHandle activeChunkHandle) {
Preconditions.checkState(!this.sealed, "Cannot add SegmentChunks for a Sealed Handle.");
if (this.segmentChunks.size() > 0) {
long expectedOffset = this.segmentChunks.get(this.segmentChunks.size() - 1).getLastOffset();
Preconditions.checkArgument(segmentChunk.getStartOffset() == expectedOffset,
"Invalid SegmentChunk StartOffset. Expected %s, given %s.", expectedOffset, segmentChunk.getStartOffset());
}
// Update the SegmentChunk and its Handle atomically.
Preconditions.checkNotNull(activeChunkHandle, "activeChunkHandle");
Preconditions.checkArgument(!activeChunkHandle.isReadOnly(), "Active SegmentChunk handle cannot be readonly.");
Preconditions.checkArgument(activeChunkHandle.getSegmentName().equals(segmentChunk.getName()),
"Active SegmentChunk handle must be for the last SegmentChunk.");
this.activeChunkHandle = activeChunkHandle;
this.segmentChunks.add(segmentChunk);
} | java | synchronized void addChunk(SegmentChunk segmentChunk, SegmentHandle activeChunkHandle) {
Preconditions.checkState(!this.sealed, "Cannot add SegmentChunks for a Sealed Handle.");
if (this.segmentChunks.size() > 0) {
long expectedOffset = this.segmentChunks.get(this.segmentChunks.size() - 1).getLastOffset();
Preconditions.checkArgument(segmentChunk.getStartOffset() == expectedOffset,
"Invalid SegmentChunk StartOffset. Expected %s, given %s.", expectedOffset, segmentChunk.getStartOffset());
}
// Update the SegmentChunk and its Handle atomically.
Preconditions.checkNotNull(activeChunkHandle, "activeChunkHandle");
Preconditions.checkArgument(!activeChunkHandle.isReadOnly(), "Active SegmentChunk handle cannot be readonly.");
Preconditions.checkArgument(activeChunkHandle.getSegmentName().equals(segmentChunk.getName()),
"Active SegmentChunk handle must be for the last SegmentChunk.");
this.activeChunkHandle = activeChunkHandle;
this.segmentChunks.add(segmentChunk);
} | [
"synchronized",
"void",
"addChunk",
"(",
"SegmentChunk",
"segmentChunk",
",",
"SegmentHandle",
"activeChunkHandle",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"this",
".",
"sealed",
",",
"\"Cannot add SegmentChunks for a Sealed Handle.\"",
")",
";",
"if",
... | Adds a new SegmentChunk.
@param segmentChunk The SegmentChunk to add. This SegmentChunk must be in continuity of any existing SegmentChunks.
@param activeChunkHandle The newly added SegmentChunk's write handle. | [
"Adds",
"a",
"new",
"SegmentChunk",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/src/main/java/io/pravega/segmentstore/storage/rolling/RollingSegmentHandle.java#L179-L194 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.setContentType | public void setContentType(String photoId, String contentType) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_CONTENTTYPE);
parameters.put("photo_id", photoId);
parameters.put("content_type", contentType);
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | java | public void setContentType(String photoId, String contentType) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_CONTENTTYPE);
parameters.put("photo_id", photoId);
parameters.put("content_type", contentType);
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | [
"public",
"void",
"setContentType",
"(",
"String",
"photoId",
",",
"String",
"contentType",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
"... | Set the content type of a photo.
This method requires authentication with 'write' permission.
@see com.flickr4java.flickr.Flickr#CONTENTTYPE_PHOTO
@see com.flickr4java.flickr.Flickr#CONTENTTYPE_SCREENSHOT
@see com.flickr4java.flickr.Flickr#CONTENTTYPE_OTHER
@param photoId
The photo ID
@param contentType
The contentType to set
@throws FlickrException | [
"Set",
"the",
"content",
"type",
"of",
"a",
"photo",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1136-L1147 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java | MapMessage.forEach | public <CV, S> void forEach(final TriConsumer<String, ? super CV, S> action, final S state) {
data.forEach(action, state);
} | java | public <CV, S> void forEach(final TriConsumer<String, ? super CV, S> action, final S state) {
data.forEach(action, state);
} | [
"public",
"<",
"CV",
",",
"S",
">",
"void",
"forEach",
"(",
"final",
"TriConsumer",
"<",
"String",
",",
"?",
"super",
"CV",
",",
"S",
">",
"action",
",",
"final",
"S",
"state",
")",
"{",
"data",
".",
"forEach",
"(",
"action",
",",
"state",
")",
"... | Performs the given action for each key-value pair in this data structure
until all entries have been processed or the action throws an exception.
<p>
The third parameter lets callers pass in a stateful object to be modified with the key-value pairs,
so the TriConsumer implementation itself can be stateless and potentially reusable.
</p>
<p>
Some implementations may not support structural modifications (adding new elements or removing elements) while
iterating over the contents. In such implementations, attempts to add or remove elements from the
{@code TriConsumer}'s {@link TriConsumer#accept(Object, Object, Object) accept} method may cause a
{@code ConcurrentModificationException} to be thrown.
</p>
@param action The action to be performed for each key-value pair in this collection
@param state the object to be passed as the third parameter to each invocation on the specified
triconsumer
@param <CV> type of the consumer value
@param <S> type of the third parameter
@throws java.util.ConcurrentModificationException some implementations may not support structural modifications
to this data structure while iterating over the contents with {@link #forEach(BiConsumer)} or
{@link #forEach(TriConsumer, Object)}.
@see ReadOnlyStringMap#forEach(TriConsumer, Object)
@since 2.9 | [
"Performs",
"the",
"given",
"action",
"for",
"each",
"key",
"-",
"value",
"pair",
"in",
"this",
"data",
"structure",
"until",
"all",
"entries",
"have",
"been",
"processed",
"or",
"the",
"action",
"throws",
"an",
"exception",
".",
"<p",
">",
"The",
"third",... | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java#L298-L300 |
threerings/nenya | core/src/main/java/com/threerings/cast/ComponentClass.java | ComponentClass.getRenderPriority | public int getRenderPriority (String action, String component, int orientation)
{
// because we expect there to be relatively few priority overrides, we simply search
// linearly through the list for the closest match
int ocount = (_overrides != null) ? _overrides.size() : 0;
for (int ii = 0; ii < ocount; ii++) {
PriorityOverride over = _overrides.get(ii);
// based on the way the overrides are sorted, the first match
// is the most specific and the one we want
if (over.matches(action, component, orientation)) {
return over.renderPriority;
}
}
return renderPriority;
} | java | public int getRenderPriority (String action, String component, int orientation)
{
// because we expect there to be relatively few priority overrides, we simply search
// linearly through the list for the closest match
int ocount = (_overrides != null) ? _overrides.size() : 0;
for (int ii = 0; ii < ocount; ii++) {
PriorityOverride over = _overrides.get(ii);
// based on the way the overrides are sorted, the first match
// is the most specific and the one we want
if (over.matches(action, component, orientation)) {
return over.renderPriority;
}
}
return renderPriority;
} | [
"public",
"int",
"getRenderPriority",
"(",
"String",
"action",
",",
"String",
"component",
",",
"int",
"orientation",
")",
"{",
"// because we expect there to be relatively few priority overrides, we simply search",
"// linearly through the list for the closest match",
"int",
"ocou... | Returns the render priority appropriate for the specified action, orientation and
component. | [
"Returns",
"the",
"render",
"priority",
"appropriate",
"for",
"the",
"specified",
"action",
"orientation",
"and",
"component",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/ComponentClass.java#L159-L174 |
grails/grails-core | grails-core/src/main/groovy/org/grails/transaction/TransactionManagerPostProcessor.java | TransactionManagerPostProcessor.postProcessAfterInstantiation | @Override
public boolean postProcessAfterInstantiation(Object bean, String name) throws BeansException {
if (bean instanceof TransactionManagerAware) {
initialize();
if(transactionManager != null) {
TransactionManagerAware tma = (TransactionManagerAware) bean;
tma.setTransactionManager(transactionManager);
}
}
return true;
} | java | @Override
public boolean postProcessAfterInstantiation(Object bean, String name) throws BeansException {
if (bean instanceof TransactionManagerAware) {
initialize();
if(transactionManager != null) {
TransactionManagerAware tma = (TransactionManagerAware) bean;
tma.setTransactionManager(transactionManager);
}
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"postProcessAfterInstantiation",
"(",
"Object",
"bean",
",",
"String",
"name",
")",
"throws",
"BeansException",
"{",
"if",
"(",
"bean",
"instanceof",
"TransactionManagerAware",
")",
"{",
"initialize",
"(",
")",
";",
"if",
"(... | Injects the platform transaction manager into the given bean if
that bean implements the {@link grails.transaction.TransactionManagerAware} interface.
@param bean The bean to process.
@param name The name of the bean.
@return The bean after the transaction manager has been injected.
@throws BeansException | [
"Injects",
"the",
"platform",
"transaction",
"manager",
"into",
"the",
"given",
"bean",
"if",
"that",
"bean",
"implements",
"the",
"{"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/transaction/TransactionManagerPostProcessor.java#L64-L74 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/UsersApi.java | UsersApi.updateUserWithHttpInfo | public ApiResponse<ApiSuccessResponse> updateUserWithHttpInfo(String dbid, UpdateUserData updateUserData) throws ApiException {
com.squareup.okhttp.Call call = updateUserValidateBeforeCall(dbid, updateUserData, null, null);
Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType();
return apiClient.execute(call, localVarReturnType);
} | java | public ApiResponse<ApiSuccessResponse> updateUserWithHttpInfo(String dbid, UpdateUserData updateUserData) throws ApiException {
com.squareup.okhttp.Call call = updateUserValidateBeforeCall(dbid, updateUserData, null, null);
Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType();
return apiClient.execute(call, localVarReturnType);
} | [
"public",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"updateUserWithHttpInfo",
"(",
"String",
"dbid",
",",
"UpdateUserData",
"updateUserData",
")",
"throws",
"ApiException",
"{",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"updateUserValidat... | Update a user.
Update a user ([CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson)) with the specified attributes.
@param dbid The user's DBID. (required)
@param updateUserData Update user data (required)
@return ApiResponse<ApiSuccessResponse>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Update",
"a",
"user",
".",
"Update",
"a",
"user",
"(",
"[",
"CfgPerson",
"]",
"(",
"https",
":",
"//",
"docs",
".",
"genesys",
".",
"com",
"/",
"Documentation",
"/",
"PSDK",
"/",
"latest",
"/",
"ConfigLayerRef",
"/",
"CfgPerson",
"))",
"with",
"the",
... | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/UsersApi.java#L813-L817 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/maxsat/encodings/Encoding.java | Encoding.addBinaryClause | void addBinaryClause(final MiniSatStyleSolver s, int a, int b) {
this.addBinaryClause(s, a, b, LIT_UNDEF);
} | java | void addBinaryClause(final MiniSatStyleSolver s, int a, int b) {
this.addBinaryClause(s, a, b, LIT_UNDEF);
} | [
"void",
"addBinaryClause",
"(",
"final",
"MiniSatStyleSolver",
"s",
",",
"int",
"a",
",",
"int",
"b",
")",
"{",
"this",
".",
"addBinaryClause",
"(",
"s",
",",
"a",
",",
"b",
",",
"LIT_UNDEF",
")",
";",
"}"
] | Adds a binary clause to the given SAT solver.
@param s the sat solver
@param a the first literal
@param b the second literal | [
"Adds",
"a",
"binary",
"clause",
"to",
"the",
"given",
"SAT",
"solver",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoding.java#L107-L109 |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java | MSPDIReader.updateBaseCalendarNames | private static void updateBaseCalendarNames(List<Pair<ProjectCalendar, BigInteger>> baseCalendars, HashMap<BigInteger, ProjectCalendar> map)
{
for (Pair<ProjectCalendar, BigInteger> pair : baseCalendars)
{
ProjectCalendar cal = pair.getFirst();
BigInteger baseCalendarID = pair.getSecond();
ProjectCalendar baseCal = map.get(baseCalendarID);
if (baseCal != null)
{
cal.setParent(baseCal);
}
}
} | java | private static void updateBaseCalendarNames(List<Pair<ProjectCalendar, BigInteger>> baseCalendars, HashMap<BigInteger, ProjectCalendar> map)
{
for (Pair<ProjectCalendar, BigInteger> pair : baseCalendars)
{
ProjectCalendar cal = pair.getFirst();
BigInteger baseCalendarID = pair.getSecond();
ProjectCalendar baseCal = map.get(baseCalendarID);
if (baseCal != null)
{
cal.setParent(baseCal);
}
}
} | [
"private",
"static",
"void",
"updateBaseCalendarNames",
"(",
"List",
"<",
"Pair",
"<",
"ProjectCalendar",
",",
"BigInteger",
">",
">",
"baseCalendars",
",",
"HashMap",
"<",
"BigInteger",
",",
"ProjectCalendar",
">",
"map",
")",
"{",
"for",
"(",
"Pair",
"<",
... | The way calendars are stored in an MSPDI file means that there
can be forward references between the base calendar unique ID for a
derived calendar, and the base calendar itself. To get around this,
we initially populate the base calendar name attribute with the
base calendar unique ID, and now in this method we can convert those
ID values into the correct names.
@param baseCalendars list of calendars and base calendar IDs
@param map map of calendar ID values and calendar objects | [
"The",
"way",
"calendars",
"are",
"stored",
"in",
"an",
"MSPDI",
"file",
"means",
"that",
"there",
"can",
"be",
"forward",
"references",
"between",
"the",
"base",
"calendar",
"unique",
"ID",
"for",
"a",
"derived",
"calendar",
"and",
"the",
"base",
"calendar"... | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L422-L435 |
gallandarakhneorg/afc | core/text/src/main/java/org/arakhne/afc/text/TextUtil.java | TextUtil.equalsIgnoreAccents | @Pure
@Inline(value = "TextUtil.removeAccents($1, $3).equals(TextUtil.removeAccents($2, $3))", imported = {TextUtil.class})
public static boolean equalsIgnoreAccents(String s1, String s2, Map<Character, String> map) {
return removeAccents(s1, map).equals(removeAccents(s2, map));
} | java | @Pure
@Inline(value = "TextUtil.removeAccents($1, $3).equals(TextUtil.removeAccents($2, $3))", imported = {TextUtil.class})
public static boolean equalsIgnoreAccents(String s1, String s2, Map<Character, String> map) {
return removeAccents(s1, map).equals(removeAccents(s2, map));
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"TextUtil.removeAccents($1, $3).equals(TextUtil.removeAccents($2, $3))\"",
",",
"imported",
"=",
"{",
"TextUtil",
".",
"class",
"}",
")",
"public",
"static",
"boolean",
"equalsIgnoreAccents",
"(",
"String",
"s1",
",",
... | Compares this <code>String</code> to another <code>String</code>,
ignoring accent considerations. Two strings are considered equal
ignoring accents if they are of the same length, and corresponding
characters in the two strings are equal ignoring accents.
<p>This method is equivalent to:
<pre><code>
TextUtil.removeAccents(s1,map).equals(TextUtil.removeAccents(s2,map));
</code></pre>
@param s1 is the first string to compare.
@param s2 is the second string to compare.
@param map is the translation table from an accentuated character to an
unaccentuated character.
@return <code>true</code> if the argument is not <code>null</code>
and the <code>String</code>s are equal,
ignoring case; <code>false</code> otherwise.
@see #removeAccents(String, Map) | [
"Compares",
"this",
"<code",
">",
"String<",
"/",
"code",
">",
"to",
"another",
"<code",
">",
"String<",
"/",
"code",
">",
"ignoring",
"accent",
"considerations",
".",
"Two",
"strings",
"are",
"considered",
"equal",
"ignoring",
"accents",
"if",
"they",
"are"... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/TextUtil.java#L1350-L1354 |
apache/groovy | subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java | SwingGroovyMethods.leftShift | public static JMenu leftShift(JMenu self, Action action) {
self.add(action);
return self;
} | java | public static JMenu leftShift(JMenu self, Action action) {
self.add(action);
return self;
} | [
"public",
"static",
"JMenu",
"leftShift",
"(",
"JMenu",
"self",
",",
"Action",
"action",
")",
"{",
"self",
".",
"add",
"(",
"action",
")",
";",
"return",
"self",
";",
"}"
] | Overloads the left shift operator to provide an easy way to add
components to a menu.<p>
@param self a JMenu
@param action an action to be added to the menu.
@return same menu, after the value was added to it.
@since 1.6.4 | [
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"easy",
"way",
"to",
"add",
"components",
"to",
"a",
"menu",
".",
"<p",
">"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L767-L770 |
j256/ormlite-android | src/main/java/com/j256/ormlite/android/apptools/OpenHelperManager.java | OpenHelperManager.getHelper | @Deprecated
public static synchronized OrmLiteSqliteOpenHelper getHelper(Context context) {
if (helperClass == null) {
if (context == null) {
throw new IllegalArgumentException("context argument is null");
}
Context appContext = context.getApplicationContext();
innerSetHelperClass(lookupHelperClass(appContext, context.getClass()));
}
return loadHelper(context, helperClass);
} | java | @Deprecated
public static synchronized OrmLiteSqliteOpenHelper getHelper(Context context) {
if (helperClass == null) {
if (context == null) {
throw new IllegalArgumentException("context argument is null");
}
Context appContext = context.getApplicationContext();
innerSetHelperClass(lookupHelperClass(appContext, context.getClass()));
}
return loadHelper(context, helperClass);
} | [
"@",
"Deprecated",
"public",
"static",
"synchronized",
"OrmLiteSqliteOpenHelper",
"getHelper",
"(",
"Context",
"context",
")",
"{",
"if",
"(",
"helperClass",
"==",
"null",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgument... | <p>
Similar to {@link #getHelper(Context, Class)} (which is recommended) except we have to find the helper class
through other means. This method requires that the Context be a class that extends one of ORMLite's Android base
classes such as {@link OrmLiteBaseActivity}. Either that or the helper class needs to be set in the strings.xml.
</p>
<p>
To find the helper class, this does the following:
</p>
<ol>
<li>If the class has been set with a call to {@link #setOpenHelperClass(Class)}, it will be used to construct a
helper.</li>
<li>If the resource class name is configured in the strings.xml file it will be used.</li>
<li>The context class hierarchy is walked looking at the generic parameters for a class extending
OrmLiteSqliteOpenHelper. This is used by the {@link OrmLiteBaseActivity} and other base classes.</li>
<li>An exception is thrown saying that it was not able to set the helper class.</li>
</ol>
@deprecated Should use {@link #getHelper(Context, Class)} | [
"<p",
">",
"Similar",
"to",
"{",
"@link",
"#getHelper",
"(",
"Context",
"Class",
")",
"}",
"(",
"which",
"is",
"recommended",
")",
"except",
"we",
"have",
"to",
"find",
"the",
"helper",
"class",
"through",
"other",
"means",
".",
"This",
"method",
"requir... | train | https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OpenHelperManager.java#L103-L113 |
alibaba/ARouter | arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java | Postcard.withString | public Postcard withString(@Nullable String key, @Nullable String value) {
mBundle.putString(key, value);
return this;
} | java | public Postcard withString(@Nullable String key, @Nullable String value) {
mBundle.putString(key, value);
return this;
} | [
"public",
"Postcard",
"withString",
"(",
"@",
"Nullable",
"String",
"key",
",",
"@",
"Nullable",
"String",
"value",
")",
"{",
"mBundle",
".",
"putString",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a String value into the mapping of this Bundle, replacing
any existing value for the given key. Either key or value may be null.
@param key a String, or null
@param value a String, or null
@return current | [
"Inserts",
"a",
"String",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | train | https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L244-L247 |
RoaringBitmap/RoaringBitmap | jmh/src/main/java/org/roaringbitmap/bithacking/SelectBenchmark.java | SelectBenchmark.select | public static int select(short w, int j) {
int sumtotal = 0;
for (int counter = 0; counter < 16; ++counter) {
sumtotal += (w >> counter) & 1;
if (sumtotal > j)
return counter;
}
throw new IllegalArgumentException(
"cannot locate " + j + "th bit in " + w + " weight is " + Integer.bitCount(w));
} | java | public static int select(short w, int j) {
int sumtotal = 0;
for (int counter = 0; counter < 16; ++counter) {
sumtotal += (w >> counter) & 1;
if (sumtotal > j)
return counter;
}
throw new IllegalArgumentException(
"cannot locate " + j + "th bit in " + w + " weight is " + Integer.bitCount(w));
} | [
"public",
"static",
"int",
"select",
"(",
"short",
"w",
",",
"int",
"j",
")",
"{",
"int",
"sumtotal",
"=",
"0",
";",
"for",
"(",
"int",
"counter",
"=",
"0",
";",
"counter",
"<",
"16",
";",
"++",
"counter",
")",
"{",
"sumtotal",
"+=",
"(",
"w",
... | Given a word w, return the position of the jth true bit.
@param w word
@param j index
@return position of jth true bit in w | [
"Given",
"a",
"word",
"w",
"return",
"the",
"position",
"of",
"the",
"jth",
"true",
"bit",
"."
] | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/jmh/src/main/java/org/roaringbitmap/bithacking/SelectBenchmark.java#L155-L164 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsDynamicFunctionParser.java | CmsDynamicFunctionParser.getLocaleToUse | protected Locale getLocaleToUse(CmsObject cms, CmsXmlContent xmlContent) {
Locale contextLocale = cms.getRequestContext().getLocale();
if (xmlContent.hasLocale(contextLocale)) {
return contextLocale;
}
Locale defaultLocale = CmsLocaleManager.getDefaultLocale();
if (xmlContent.hasLocale(defaultLocale)) {
return defaultLocale;
}
if (!xmlContent.getLocales().isEmpty()) {
return xmlContent.getLocales().get(0);
} else {
return defaultLocale;
}
} | java | protected Locale getLocaleToUse(CmsObject cms, CmsXmlContent xmlContent) {
Locale contextLocale = cms.getRequestContext().getLocale();
if (xmlContent.hasLocale(contextLocale)) {
return contextLocale;
}
Locale defaultLocale = CmsLocaleManager.getDefaultLocale();
if (xmlContent.hasLocale(defaultLocale)) {
return defaultLocale;
}
if (!xmlContent.getLocales().isEmpty()) {
return xmlContent.getLocales().get(0);
} else {
return defaultLocale;
}
} | [
"protected",
"Locale",
"getLocaleToUse",
"(",
"CmsObject",
"cms",
",",
"CmsXmlContent",
"xmlContent",
")",
"{",
"Locale",
"contextLocale",
"=",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getLocale",
"(",
")",
";",
"if",
"(",
"xmlContent",
".",
"hasLocale... | Gets the locale to use for parsing the dynamic function.<p>
@param cms the current CMS context
@param xmlContent the xml content from which the dynamic function should be read
@return the locale from which the dynamic function should be read | [
"Gets",
"the",
"locale",
"to",
"use",
"for",
"parsing",
"the",
"dynamic",
"function",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsDynamicFunctionParser.java#L158-L173 |
apache/incubator-gobblin | gobblin-compaction/src/main/java/org/apache/gobblin/compaction/dataset/TimeBasedSubDirDatasetsFinder.java | TimeBasedSubDirDatasetsFinder.folderWithinAllowedPeriod | protected boolean folderWithinAllowedPeriod(Path inputFolder, DateTime folderTime) {
DateTime currentTime = new DateTime(this.timeZone);
PeriodFormatter periodFormatter = getPeriodFormatter();
DateTime earliestAllowedFolderTime = getEarliestAllowedFolderTime(currentTime, periodFormatter);
DateTime latestAllowedFolderTime = getLatestAllowedFolderTime(currentTime, periodFormatter);
if (folderTime.isBefore(earliestAllowedFolderTime)) {
log.info(String.format("Folder time for %s is %s, earlier than the earliest allowed folder time, %s. Skipping",
inputFolder, folderTime, earliestAllowedFolderTime));
return false;
} else if (folderTime.isAfter(latestAllowedFolderTime)) {
log.info(String.format("Folder time for %s is %s, later than the latest allowed folder time, %s. Skipping",
inputFolder, folderTime, latestAllowedFolderTime));
return false;
} else {
return true;
}
} | java | protected boolean folderWithinAllowedPeriod(Path inputFolder, DateTime folderTime) {
DateTime currentTime = new DateTime(this.timeZone);
PeriodFormatter periodFormatter = getPeriodFormatter();
DateTime earliestAllowedFolderTime = getEarliestAllowedFolderTime(currentTime, periodFormatter);
DateTime latestAllowedFolderTime = getLatestAllowedFolderTime(currentTime, periodFormatter);
if (folderTime.isBefore(earliestAllowedFolderTime)) {
log.info(String.format("Folder time for %s is %s, earlier than the earliest allowed folder time, %s. Skipping",
inputFolder, folderTime, earliestAllowedFolderTime));
return false;
} else if (folderTime.isAfter(latestAllowedFolderTime)) {
log.info(String.format("Folder time for %s is %s, later than the latest allowed folder time, %s. Skipping",
inputFolder, folderTime, latestAllowedFolderTime));
return false;
} else {
return true;
}
} | [
"protected",
"boolean",
"folderWithinAllowedPeriod",
"(",
"Path",
"inputFolder",
",",
"DateTime",
"folderTime",
")",
"{",
"DateTime",
"currentTime",
"=",
"new",
"DateTime",
"(",
"this",
".",
"timeZone",
")",
";",
"PeriodFormatter",
"periodFormatter",
"=",
"getPeriod... | Return true iff input folder time is between compaction.timebased.min.time.ago and
compaction.timebased.max.time.ago. | [
"Return",
"true",
"iff",
"input",
"folder",
"time",
"is",
"between",
"compaction",
".",
"timebased",
".",
"min",
".",
"time",
".",
"ago",
"and",
"compaction",
".",
"timebased",
".",
"max",
".",
"time",
".",
"ago",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/dataset/TimeBasedSubDirDatasetsFinder.java#L220-L237 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/pipeline/common/docker/DockerImage.java | DockerImage.checkAndSetManifestAndImagePathCandidates | private boolean checkAndSetManifestAndImagePathCandidates(String manifestPath, String candidateImagePath, ArtifactoryDependenciesClient dependenciesClient, TaskListener listener) throws IOException {
String candidateManifest = getManifestFromArtifactory(dependenciesClient, manifestPath);
if (candidateManifest == null) {
return false;
}
String imageDigest = DockerUtils.getConfigDigest(candidateManifest);
if (imageDigest.equals(imageId)) {
manifest = candidateManifest;
imagePath = candidateImagePath;
return true;
}
listener.getLogger().println(String.format("Found incorrect manifest.json file in Artifactory in the following path: %s\nExpecting: %s got: %s", manifestPath, imageId, imageDigest));
return false;
} | java | private boolean checkAndSetManifestAndImagePathCandidates(String manifestPath, String candidateImagePath, ArtifactoryDependenciesClient dependenciesClient, TaskListener listener) throws IOException {
String candidateManifest = getManifestFromArtifactory(dependenciesClient, manifestPath);
if (candidateManifest == null) {
return false;
}
String imageDigest = DockerUtils.getConfigDigest(candidateManifest);
if (imageDigest.equals(imageId)) {
manifest = candidateManifest;
imagePath = candidateImagePath;
return true;
}
listener.getLogger().println(String.format("Found incorrect manifest.json file in Artifactory in the following path: %s\nExpecting: %s got: %s", manifestPath, imageId, imageDigest));
return false;
} | [
"private",
"boolean",
"checkAndSetManifestAndImagePathCandidates",
"(",
"String",
"manifestPath",
",",
"String",
"candidateImagePath",
",",
"ArtifactoryDependenciesClient",
"dependenciesClient",
",",
"TaskListener",
"listener",
")",
"throws",
"IOException",
"{",
"String",
"ca... | Check if the provided manifestPath is correct.
Set the manifest and imagePath in case of the correct manifest.
@param manifestPath
@param candidateImagePath
@param dependenciesClient
@param listener
@return true if found the correct manifest
@throws IOException | [
"Check",
"if",
"the",
"provided",
"manifestPath",
"is",
"correct",
".",
"Set",
"the",
"manifest",
"and",
"imagePath",
"in",
"case",
"of",
"the",
"correct",
"manifest",
"."
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/DockerImage.java#L212-L227 |
liferay/com-liferay-commerce | commerce-tax-engine-fixed-service/src/main/java/com/liferay/commerce/tax/engine/fixed/service/persistence/impl/CommerceTaxFixedRatePersistenceImpl.java | CommerceTaxFixedRatePersistenceImpl.findAll | @Override
public List<CommerceTaxFixedRate> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceTaxFixedRate> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceTaxFixedRate",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce tax fixed rates.
@return the commerce tax fixed rates | [
"Returns",
"all",
"the",
"commerce",
"tax",
"fixed",
"rates",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-engine-fixed-service/src/main/java/com/liferay/commerce/tax/engine/fixed/service/persistence/impl/CommerceTaxFixedRatePersistenceImpl.java#L1953-L1956 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java | SheetResourcesImpl.importCsv | public Sheet importCsv(String file, String sheetName, Integer headerRowIndex, Integer primaryRowIndex) throws SmartsheetException {
return importFile("sheets/import", file,"text/csv", sheetName, headerRowIndex, primaryRowIndex);
} | java | public Sheet importCsv(String file, String sheetName, Integer headerRowIndex, Integer primaryRowIndex) throws SmartsheetException {
return importFile("sheets/import", file,"text/csv", sheetName, headerRowIndex, primaryRowIndex);
} | [
"public",
"Sheet",
"importCsv",
"(",
"String",
"file",
",",
"String",
"sheetName",
",",
"Integer",
"headerRowIndex",
",",
"Integer",
"primaryRowIndex",
")",
"throws",
"SmartsheetException",
"{",
"return",
"importFile",
"(",
"\"sheets/import\"",
",",
"file",
",",
"... | Imports a sheet.
It mirrors to the following Smartsheet REST API method: POST /sheets/import
@param file path to the CSV file
@param sheetName destination sheet name
@param headerRowIndex index (0 based) of row to be used for column names
@param primaryRowIndex index (0 based) of primary column
@return the created sheet
@throws IllegalArgumentException if any argument is null or empty string
@throws InvalidRequestException if there is any problem with the REST API request
@throws AuthorizationException if there is any problem with the REST API authorization (access token)
@throws ResourceNotFoundException if the resource cannot be found
@throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
@throws SmartsheetException if there is any other error during the operation | [
"Imports",
"a",
"sheet",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L435-L437 |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.handleKeyChange | public KeyChangeResult handleKeyChange(EntryChangeEvent event, boolean allLanguages) {
if (m_keyset.getKeySet().contains(event.getNewValue())) {
m_container.getItem(event.getItemId()).getItemProperty(TableProperty.KEY).setValue(event.getOldValue());
return KeyChangeResult.FAILED_DUPLICATED_KEY;
}
if (allLanguages && !renameKeyForAllLanguages(event.getOldValue(), event.getNewValue())) {
m_container.getItem(event.getItemId()).getItemProperty(TableProperty.KEY).setValue(event.getOldValue());
return KeyChangeResult.FAILED_FOR_OTHER_LANGUAGE;
}
return KeyChangeResult.SUCCESS;
} | java | public KeyChangeResult handleKeyChange(EntryChangeEvent event, boolean allLanguages) {
if (m_keyset.getKeySet().contains(event.getNewValue())) {
m_container.getItem(event.getItemId()).getItemProperty(TableProperty.KEY).setValue(event.getOldValue());
return KeyChangeResult.FAILED_DUPLICATED_KEY;
}
if (allLanguages && !renameKeyForAllLanguages(event.getOldValue(), event.getNewValue())) {
m_container.getItem(event.getItemId()).getItemProperty(TableProperty.KEY).setValue(event.getOldValue());
return KeyChangeResult.FAILED_FOR_OTHER_LANGUAGE;
}
return KeyChangeResult.SUCCESS;
} | [
"public",
"KeyChangeResult",
"handleKeyChange",
"(",
"EntryChangeEvent",
"event",
",",
"boolean",
"allLanguages",
")",
"{",
"if",
"(",
"m_keyset",
".",
"getKeySet",
"(",
")",
".",
"contains",
"(",
"event",
".",
"getNewValue",
"(",
")",
")",
")",
"{",
"m_cont... | Handles a key change.
@param event the key change event.
@param allLanguages <code>true</code> for changing the key for all languages, <code>false</code> if the key should be changed only for the current language.
@return result, indicating if the key change was successful. | [
"Handles",
"a",
"key",
"change",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L815-L826 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.intdiv | public static Number intdiv(Number left, Number right) {
return NumberMath.intdiv(left, right);
} | java | public static Number intdiv(Number left, Number right) {
return NumberMath.intdiv(left, right);
} | [
"public",
"static",
"Number",
"intdiv",
"(",
"Number",
"left",
",",
"Number",
"right",
")",
"{",
"return",
"NumberMath",
".",
"intdiv",
"(",
"left",
",",
"right",
")",
";",
"}"
] | Integer Divide two Numbers.
@param left a Number
@param right another Number
@return a Number (an Integer) resulting from the integer division operation
@since 1.0 | [
"Integer",
"Divide",
"two",
"Numbers",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15434-L15436 |
pravega/pravega | controller/src/main/java/io/pravega/controller/store/stream/PravegaTablesStoreHelper.java | PravegaTablesStoreHelper.invalidateCache | public void invalidateCache(String table, String key) {
cache.invalidateCache(new TableCacheKey<>(table, key, x -> null));
} | java | public void invalidateCache(String table, String key) {
cache.invalidateCache(new TableCacheKey<>(table, key, x -> null));
} | [
"public",
"void",
"invalidateCache",
"(",
"String",
"table",
",",
"String",
"key",
")",
"{",
"cache",
".",
"invalidateCache",
"(",
"new",
"TableCacheKey",
"<>",
"(",
"table",
",",
"key",
",",
"x",
"->",
"null",
")",
")",
";",
"}"
] | Method to invalidate cached value in the cache for the specified table.
@param table table name
@param key key to invalidate | [
"Method",
"to",
"invalidate",
"cached",
"value",
"in",
"the",
"cache",
"for",
"the",
"specified",
"table",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/PravegaTablesStoreHelper.java#L115-L117 |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/AbstractSubclassFactory.java | AbstractSubclassFactory.overrideHashcode | protected boolean overrideHashcode(MethodBodyCreator creator) {
Method hashCode = null;
ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(Object.class);
try {
hashCode = data.getMethod("hashCode", Integer.TYPE);
} catch (Exception e) {
throw new RuntimeException(e);
}
return overrideMethod(hashCode, MethodIdentifier.getIdentifierForMethod(hashCode), creator);
} | java | protected boolean overrideHashcode(MethodBodyCreator creator) {
Method hashCode = null;
ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(Object.class);
try {
hashCode = data.getMethod("hashCode", Integer.TYPE);
} catch (Exception e) {
throw new RuntimeException(e);
}
return overrideMethod(hashCode, MethodIdentifier.getIdentifierForMethod(hashCode), creator);
} | [
"protected",
"boolean",
"overrideHashcode",
"(",
"MethodBodyCreator",
"creator",
")",
"{",
"Method",
"hashCode",
"=",
"null",
";",
"ClassMetadataSource",
"data",
"=",
"reflectionMetadataSource",
".",
"getClassMetadata",
"(",
"Object",
".",
"class",
")",
";",
"try",
... | Override the hashCode method using the given {@link MethodBodyCreator}.
@param creator the method body creator to use
@return true if the method was not already overridden | [
"Override",
"the",
"hashCode",
"method",
"using",
"the",
"given",
"{",
"@link",
"MethodBodyCreator",
"}",
"."
] | train | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/AbstractSubclassFactory.java#L272-L282 |
aws/aws-sdk-java | aws-java-sdk-fms/src/main/java/com/amazonaws/services/fms/model/PolicyComplianceStatus.java | PolicyComplianceStatus.withIssueInfoMap | public PolicyComplianceStatus withIssueInfoMap(java.util.Map<String, String> issueInfoMap) {
setIssueInfoMap(issueInfoMap);
return this;
} | java | public PolicyComplianceStatus withIssueInfoMap(java.util.Map<String, String> issueInfoMap) {
setIssueInfoMap(issueInfoMap);
return this;
} | [
"public",
"PolicyComplianceStatus",
"withIssueInfoMap",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"issueInfoMap",
")",
"{",
"setIssueInfoMap",
"(",
"issueInfoMap",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Details about problems with dependent services, such as AWS WAF or AWS Config, that are causing a resource to be
non-compliant. The details include the name of the dependent service and the error message received that
indicates the problem with the service.
</p>
@param issueInfoMap
Details about problems with dependent services, such as AWS WAF or AWS Config, that are causing a resource
to be non-compliant. The details include the name of the dependent service and the error message received
that indicates the problem with the service.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Details",
"about",
"problems",
"with",
"dependent",
"services",
"such",
"as",
"AWS",
"WAF",
"or",
"AWS",
"Config",
"that",
"are",
"causing",
"a",
"resource",
"to",
"be",
"non",
"-",
"compliant",
".",
"The",
"details",
"include",
"the",
"name",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-fms/src/main/java/com/amazonaws/services/fms/model/PolicyComplianceStatus.java#L394-L397 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/imports/TypeUsageCollector.java | TypeUsageCollector.findPreferredType | protected PreferredType findPreferredType(EObject owner, EReference reference, String text) {
JvmIdentifiableElement referencedThing = getReferencedElement(owner, reference);
JvmDeclaredType referencedType = null;
if (referencedThing instanceof JvmDeclaredType) {
referencedType = (JvmDeclaredType) referencedThing;
} else if (referencedThing instanceof JvmMember) {
referencedType = ((JvmMember) referencedThing).getDeclaringType();
} else if(referencedThing instanceof JvmType) {
if (referencedThing.eIsProxy()) {
String importedName = getFirstNameSegment(owner, reference);
return new PreferredType(importedName);
}
return null;
}
return findPreferredType(referencedType, text);
} | java | protected PreferredType findPreferredType(EObject owner, EReference reference, String text) {
JvmIdentifiableElement referencedThing = getReferencedElement(owner, reference);
JvmDeclaredType referencedType = null;
if (referencedThing instanceof JvmDeclaredType) {
referencedType = (JvmDeclaredType) referencedThing;
} else if (referencedThing instanceof JvmMember) {
referencedType = ((JvmMember) referencedThing).getDeclaringType();
} else if(referencedThing instanceof JvmType) {
if (referencedThing.eIsProxy()) {
String importedName = getFirstNameSegment(owner, reference);
return new PreferredType(importedName);
}
return null;
}
return findPreferredType(referencedType, text);
} | [
"protected",
"PreferredType",
"findPreferredType",
"(",
"EObject",
"owner",
",",
"EReference",
"reference",
",",
"String",
"text",
")",
"{",
"JvmIdentifiableElement",
"referencedThing",
"=",
"getReferencedElement",
"(",
"owner",
",",
"reference",
")",
";",
"JvmDeclare... | Tries to locate the syntax for the type reference that the user used in the original code.
Especially interesting for nested types, where one could prefer the (arguably) more explicit (or verbose)
{@code Resource$Factory} with an import of {@code org.eclipse.emf.core.Resource} over the probably shorter
{@code Factory} with an import of {@code org.eclipse.emf.core.Resource$Factory}.
The function relies on a node model to be available. Otherwise the actually referenced type is
used as the preferred type.
@param owner the referrer to the JVM concept.
@param reference a reference to a {@link JvmType} or {@link JvmMember} that is declared in a type.
@return the referenced type or one of its containers. | [
"Tries",
"to",
"locate",
"the",
"syntax",
"for",
"the",
"type",
"reference",
"that",
"the",
"user",
"used",
"in",
"the",
"original",
"code",
".",
"Especially",
"interesting",
"for",
"nested",
"types",
"where",
"one",
"could",
"prefer",
"the",
"(",
"arguably"... | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/imports/TypeUsageCollector.java#L414-L429 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/carouselCaption/CarouselCaptionRenderer.java | CarouselCaptionRenderer.encodeBegin | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
ResponseWriter rw = context.getResponseWriter();
rw.startElement("div", component);
rw.writeAttribute("id", component.getId(), "id");
if (component instanceof CarouselCaption) {
Tooltip.generateTooltip(context, ((CarouselCaption) component), rw);
AJAXRenderer.generateBootsFacesAJAXAndJavaScript(context, ((CarouselCaption) component), rw, false);
rw.writeAttribute("style", ((CarouselCaption) component).getStyle(), "style");
}
String styleClass = null;
if (component instanceof CarouselCaption) {
styleClass = ((CarouselCaption) component).getStyleClass();
}
if (null == styleClass)
styleClass = "carousel-caption";
else
styleClass = "carousel-caption " + styleClass;
rw.writeAttribute("class", styleClass, "class");
} | java | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
ResponseWriter rw = context.getResponseWriter();
rw.startElement("div", component);
rw.writeAttribute("id", component.getId(), "id");
if (component instanceof CarouselCaption) {
Tooltip.generateTooltip(context, ((CarouselCaption) component), rw);
AJAXRenderer.generateBootsFacesAJAXAndJavaScript(context, ((CarouselCaption) component), rw, false);
rw.writeAttribute("style", ((CarouselCaption) component).getStyle(), "style");
}
String styleClass = null;
if (component instanceof CarouselCaption) {
styleClass = ((CarouselCaption) component).getStyleClass();
}
if (null == styleClass)
styleClass = "carousel-caption";
else
styleClass = "carousel-caption " + styleClass;
rw.writeAttribute("class", styleClass, "class");
} | [
"@",
"Override",
"public",
"void",
"encodeBegin",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"ResponseWriter",
"r... | This methods generates the HTML code of the current b:carouselCaption.
<code>encodeBegin</code> generates the start of the component. After the,
the JSF framework calls <code>encodeChildren()</code> to generate the
HTML code between the beginning and the end of the component. For
instance, in the case of a panel component the content of the panel is
generated by <code>encodeChildren()</code>. After that,
<code>encodeEnd()</code> is called to generate the rest of the HTML code.
@param context
the FacesContext.
@param component
the current b:carouselCaption.
@throws IOException
thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"carouselCaption",
".",
"<code",
">",
"encodeBegin<",
"/",
"code",
">",
"generates",
"the",
"start",
"of",
"the",
"component",
".",
"After",
"the",
"the",
"JSF",
"fram... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/carouselCaption/CarouselCaptionRenderer.java#L69-L94 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java | DistributedFileSystem.reportChecksumFailure | public boolean reportChecksumFailure(Path f,
FSDataInputStream in, long inPos,
FSDataInputStream sums, long sumsPos) {
LocatedBlock lblocks[] = new LocatedBlock[2];
// Find block in data stream.
DFSClient.DFSDataInputStream dfsIn = (DFSClient.DFSDataInputStream) in;
Block dataBlock = dfsIn.getCurrentBlock();
if (dataBlock == null) {
LOG.error("Error: Current block in data stream is null! ");
return false;
}
DatanodeInfo[] dataNode = {dfsIn.getCurrentDatanode()};
lblocks[0] = new LocatedBlock(dataBlock, dataNode);
LOG.info("Found checksum error in data stream at block="
+ dataBlock + " on datanode="
+ dataNode[0].getName());
// Find block in checksum stream
DFSClient.DFSDataInputStream dfsSums = (DFSClient.DFSDataInputStream) sums;
Block sumsBlock = dfsSums.getCurrentBlock();
if (sumsBlock == null) {
LOG.error("Error: Current block in checksum stream is null! ");
return false;
}
DatanodeInfo[] sumsNode = {dfsSums.getCurrentDatanode()};
lblocks[1] = new LocatedBlock(sumsBlock, sumsNode);
LOG.info("Found checksum error in checksum stream at block="
+ sumsBlock + " on datanode="
+ sumsNode[0].getName());
// Ask client to delete blocks.
dfs.reportChecksumFailure(f.toString(), lblocks);
return true;
} | java | public boolean reportChecksumFailure(Path f,
FSDataInputStream in, long inPos,
FSDataInputStream sums, long sumsPos) {
LocatedBlock lblocks[] = new LocatedBlock[2];
// Find block in data stream.
DFSClient.DFSDataInputStream dfsIn = (DFSClient.DFSDataInputStream) in;
Block dataBlock = dfsIn.getCurrentBlock();
if (dataBlock == null) {
LOG.error("Error: Current block in data stream is null! ");
return false;
}
DatanodeInfo[] dataNode = {dfsIn.getCurrentDatanode()};
lblocks[0] = new LocatedBlock(dataBlock, dataNode);
LOG.info("Found checksum error in data stream at block="
+ dataBlock + " on datanode="
+ dataNode[0].getName());
// Find block in checksum stream
DFSClient.DFSDataInputStream dfsSums = (DFSClient.DFSDataInputStream) sums;
Block sumsBlock = dfsSums.getCurrentBlock();
if (sumsBlock == null) {
LOG.error("Error: Current block in checksum stream is null! ");
return false;
}
DatanodeInfo[] sumsNode = {dfsSums.getCurrentDatanode()};
lblocks[1] = new LocatedBlock(sumsBlock, sumsNode);
LOG.info("Found checksum error in checksum stream at block="
+ sumsBlock + " on datanode="
+ sumsNode[0].getName());
// Ask client to delete blocks.
dfs.reportChecksumFailure(f.toString(), lblocks);
return true;
} | [
"public",
"boolean",
"reportChecksumFailure",
"(",
"Path",
"f",
",",
"FSDataInputStream",
"in",
",",
"long",
"inPos",
",",
"FSDataInputStream",
"sums",
",",
"long",
"sumsPos",
")",
"{",
"LocatedBlock",
"lblocks",
"[",
"]",
"=",
"new",
"LocatedBlock",
"[",
"2",... | We need to find the blocks that didn't match. Likely only one
is corrupt but we will report both to the namenode. In the future,
we can consider figuring out exactly which block is corrupt. | [
"We",
"need",
"to",
"find",
"the",
"blocks",
"that",
"didn",
"t",
"match",
".",
"Likely",
"only",
"one",
"is",
"corrupt",
"but",
"we",
"will",
"report",
"both",
"to",
"the",
"namenode",
".",
"In",
"the",
"future",
"we",
"can",
"consider",
"figuring",
"... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java#L780-L816 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/property/PropertyUtil.java | PropertyUtil.saveValue | public static void saveValue(String propertyName, String instanceName, boolean asGlobal, String value) {
getPropertyService().saveValue(propertyName, instanceName, asGlobal, value);
} | java | public static void saveValue(String propertyName, String instanceName, boolean asGlobal, String value) {
getPropertyService().saveValue(propertyName, instanceName, asGlobal, value);
} | [
"public",
"static",
"void",
"saveValue",
"(",
"String",
"propertyName",
",",
"String",
"instanceName",
",",
"boolean",
"asGlobal",
",",
"String",
"value",
")",
"{",
"getPropertyService",
"(",
")",
".",
"saveValue",
"(",
"propertyName",
",",
"instanceName",
",",
... | Saves a string value to the underlying property store.
@param propertyName Name of the property to be saved.
@param instanceName An optional instance name. Specify null to indicate the default instance.
@param asGlobal If true, save as a global property. If false, save as a user property.
@param value Value to be saved. If null, any existing value is removed.
@see IPropertyService#saveValue | [
"Saves",
"a",
"string",
"value",
"to",
"the",
"underlying",
"property",
"store",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/property/PropertyUtil.java#L119-L121 |
huahin/huahin-core | src/main/java/org/huahinframework/core/SimpleJob.java | SimpleJob.setSimpleJoin | public SimpleJob setSimpleJoin(String[] masterLabels, String masterColumn,
String dataColumn, String masterPath) {
String separator = conf.get(SEPARATOR);
return setSimpleJoin(masterLabels, masterColumn, dataColumn, masterPath, separator, false);
} | java | public SimpleJob setSimpleJoin(String[] masterLabels, String masterColumn,
String dataColumn, String masterPath) {
String separator = conf.get(SEPARATOR);
return setSimpleJoin(masterLabels, masterColumn, dataColumn, masterPath, separator, false);
} | [
"public",
"SimpleJob",
"setSimpleJoin",
"(",
"String",
"[",
"]",
"masterLabels",
",",
"String",
"masterColumn",
",",
"String",
"dataColumn",
",",
"String",
"masterPath",
")",
"{",
"String",
"separator",
"=",
"conf",
".",
"get",
"(",
"SEPARATOR",
")",
";",
"r... | Easily supports the Join. To use the setSimpleJoin,
you must be a size master data appear in the memory of the task.
@param masterLabels label of master data
@param masterColumn master column
@param dataColumn data column
@param masterPath master data HDFS path
@return this | [
"Easily",
"supports",
"the",
"Join",
".",
"To",
"use",
"the",
"setSimpleJoin",
"you",
"must",
"be",
"a",
"size",
"master",
"data",
"appear",
"in",
"the",
"memory",
"of",
"the",
"task",
"."
] | train | https://github.com/huahin/huahin-core/blob/a87921b5a12be92a822f753c075ab2431036e6f5/src/main/java/org/huahinframework/core/SimpleJob.java#L248-L252 |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newFactvalue | public Factvalue newFactvalue(WF wf, String prediction) {
Factvalue factuality = new Factvalue(wf, prediction);
annotationContainer.add(factuality, Layer.FACTUALITY_LAYER, AnnotationType.FACTVALUE);
return factuality;
} | java | public Factvalue newFactvalue(WF wf, String prediction) {
Factvalue factuality = new Factvalue(wf, prediction);
annotationContainer.add(factuality, Layer.FACTUALITY_LAYER, AnnotationType.FACTVALUE);
return factuality;
} | [
"public",
"Factvalue",
"newFactvalue",
"(",
"WF",
"wf",
",",
"String",
"prediction",
")",
"{",
"Factvalue",
"factuality",
"=",
"new",
"Factvalue",
"(",
"wf",
",",
"prediction",
")",
";",
"annotationContainer",
".",
"add",
"(",
"factuality",
",",
"Layer",
"."... | Creates a factualitylayer object and add it to the document
@param term the Term of the coreference.
@return a new factuality. | [
"Creates",
"a",
"factualitylayer",
"object",
"and",
"add",
"it",
"to",
"the",
"document"
] | train | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L877-L881 |
albfernandez/itext2 | src/main/java/com/lowagie/text/xml/SAXmyHandler.java | SAXmyHandler.endElement | public void endElement(String uri, String lname, String name) {
if (myTags.containsKey(name)) {
XmlPeer peer = (XmlPeer) myTags.get(name);
handleEndingTags(peer.getTag());
}
else {
handleEndingTags(name);
}
} | java | public void endElement(String uri, String lname, String name) {
if (myTags.containsKey(name)) {
XmlPeer peer = (XmlPeer) myTags.get(name);
handleEndingTags(peer.getTag());
}
else {
handleEndingTags(name);
}
} | [
"public",
"void",
"endElement",
"(",
"String",
"uri",
",",
"String",
"lname",
",",
"String",
"name",
")",
"{",
"if",
"(",
"myTags",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"XmlPeer",
"peer",
"=",
"(",
"XmlPeer",
")",
"myTags",
".",
"get",
"("... | This method gets called when an end tag is encountered.
@param uri the Uniform Resource Identifier
@param lname the local name (without prefix), or the empty string if Namespace processing is not being performed.
@param name the name of the tag that ends | [
"This",
"method",
"gets",
"called",
"when",
"an",
"end",
"tag",
"is",
"encountered",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/xml/SAXmyHandler.java#L111-L119 |
VoltDB/voltdb | src/frontend/org/voltdb/utils/VoltTrace.java | VoltTrace.beginDuration | public static TraceEvent beginDuration(String name, Object... args) {
return new TraceEvent(TraceEventType.DURATION_BEGIN, name, null, args);
} | java | public static TraceEvent beginDuration(String name, Object... args) {
return new TraceEvent(TraceEventType.DURATION_BEGIN, name, null, args);
} | [
"public",
"static",
"TraceEvent",
"beginDuration",
"(",
"String",
"name",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"TraceEvent",
"(",
"TraceEventType",
".",
"DURATION_BEGIN",
",",
"name",
",",
"null",
",",
"args",
")",
";",
"}"
] | Creates a begin duration trace event. This method does not queue the
event. Call {@link TraceEventBatch#add(Supplier)} to queue the event. | [
"Creates",
"a",
"begin",
"duration",
"trace",
"event",
".",
"This",
"method",
"does",
"not",
"queue",
"the",
"event",
".",
"Call",
"{"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/VoltTrace.java#L473-L475 |
protostuff/protostuff | protostuff-runtime/src/main/java/io/protostuff/runtime/RuntimeSchema.java | RuntimeSchema.getSchemaWrapper | static <T> HasSchema<T> getSchemaWrapper(Class<T> typeClass)
{
return getSchemaWrapper(typeClass, ID_STRATEGY);
} | java | static <T> HasSchema<T> getSchemaWrapper(Class<T> typeClass)
{
return getSchemaWrapper(typeClass, ID_STRATEGY);
} | [
"static",
"<",
"T",
">",
"HasSchema",
"<",
"T",
">",
"getSchemaWrapper",
"(",
"Class",
"<",
"T",
">",
"typeClass",
")",
"{",
"return",
"getSchemaWrapper",
"(",
"typeClass",
",",
"ID_STRATEGY",
")",
";",
"}"
] | Returns the schema wrapper.
<p>
Method overload for backwards compatibility. | [
"Returns",
"the",
"schema",
"wrapper",
".",
"<p",
">",
"Method",
"overload",
"for",
"backwards",
"compatibility",
"."
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-runtime/src/main/java/io/protostuff/runtime/RuntimeSchema.java#L157-L160 |
Azure/azure-sdk-for-java | containerinstance/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_10_01/implementation/ContainersInner.java | ContainersInner.listLogsAsync | public Observable<LogsInner> listLogsAsync(String resourceGroupName, String containerGroupName, String containerName) {
return listLogsWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName).map(new Func1<ServiceResponse<LogsInner>, LogsInner>() {
@Override
public LogsInner call(ServiceResponse<LogsInner> response) {
return response.body();
}
});
} | java | public Observable<LogsInner> listLogsAsync(String resourceGroupName, String containerGroupName, String containerName) {
return listLogsWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName).map(new Func1<ServiceResponse<LogsInner>, LogsInner>() {
@Override
public LogsInner call(ServiceResponse<LogsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LogsInner",
">",
"listLogsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerGroupName",
",",
"String",
"containerName",
")",
"{",
"return",
"listLogsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"containerGroupN... | Get the logs for a specified container instance.
Get the logs for a specified container instance in a specified resource group and container group.
@param resourceGroupName The name of the resource group.
@param containerGroupName The name of the container group.
@param containerName The name of the container instance.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the LogsInner object | [
"Get",
"the",
"logs",
"for",
"a",
"specified",
"container",
"instance",
".",
"Get",
"the",
"logs",
"for",
"a",
"specified",
"container",
"instance",
"in",
"a",
"specified",
"resource",
"group",
"and",
"container",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_10_01/implementation/ContainersInner.java#L109-L116 |
michael-rapp/AndroidMaterialPreferences | library/src/main/java/de/mrapp/android/preference/ListPreference.java | ListPreference.createListItemListener | private OnClickListener createListItemListener() {
return new OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int which) {
selectedIndex = which;
ListPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
dialog.dismiss();
}
};
} | java | private OnClickListener createListItemListener() {
return new OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int which) {
selectedIndex = which;
ListPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
dialog.dismiss();
}
};
} | [
"private",
"OnClickListener",
"createListItemListener",
"(",
")",
"{",
"return",
"new",
"OnClickListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onClick",
"(",
"final",
"DialogInterface",
"dialog",
",",
"final",
"int",
"which",
")",
"{",
"selectedIn... | Creates and returns a listener, which allows to persist the value a list item, which is
clicked by the user.
@return The listener, which has been created, as an instance of the type {@link
OnClickListener} | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"persist",
"the",
"value",
"a",
"list",
"item",
"which",
"is",
"clicked",
"by",
"the",
"user",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialPreferences/blob/73a7e449458313bd041fc8d6038e290506b68eb1/library/src/main/java/de/mrapp/android/preference/ListPreference.java#L134-L144 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/BasePrepareStatement.java | BasePrepareStatement.setTimestamp | public void setTimestamp(final int parameterIndex, final Timestamp timestamp)
throws SQLException {
if (timestamp == null) {
setNull(parameterIndex, ColumnType.DATETIME);
return;
}
setParameter(parameterIndex,
new TimestampParameter(timestamp, protocol.getTimeZone(), useFractionalSeconds));
} | java | public void setTimestamp(final int parameterIndex, final Timestamp timestamp)
throws SQLException {
if (timestamp == null) {
setNull(parameterIndex, ColumnType.DATETIME);
return;
}
setParameter(parameterIndex,
new TimestampParameter(timestamp, protocol.getTimeZone(), useFractionalSeconds));
} | [
"public",
"void",
"setTimestamp",
"(",
"final",
"int",
"parameterIndex",
",",
"final",
"Timestamp",
"timestamp",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"timestamp",
"==",
"null",
")",
"{",
"setNull",
"(",
"parameterIndex",
",",
"ColumnType",
".",
"DATE... | Sets the designated parameter to the given <code>java.sql.Timestamp</code> value. The driver
converts this to an SQL <code>TIMESTAMP</code> value when it sends it to the database.
@param parameterIndex the first parameter is 1, the second is 2, ...
@param timestamp the parameter value
@throws SQLException if parameterIndex does not correspond to a parameter marker in the SQL
statement; if a database access error occurs or this method is called on a
closed
<code>PreparedStatement</code> | [
"Sets",
"the",
"designated",
"parameter",
"to",
"the",
"given",
"<code",
">",
"java",
".",
"sql",
".",
"Timestamp<",
"/",
"code",
">",
"value",
".",
"The",
"driver",
"converts",
"this",
"to",
"an",
"SQL",
"<code",
">",
"TIMESTAMP<",
"/",
"code",
">",
"... | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/BasePrepareStatement.java#L615-L624 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/TransactionWitness.java | TransactionWitness.redeemP2WPKH | public static TransactionWitness redeemP2WPKH(@Nullable TransactionSignature signature, ECKey pubKey) {
checkArgument(pubKey.isCompressed(), "only compressed keys allowed");
TransactionWitness witness = new TransactionWitness(2);
witness.setPush(0, signature != null ? signature.encodeToBitcoin() : new byte[0]); // signature
witness.setPush(1, pubKey.getPubKey()); // pubkey
return witness;
} | java | public static TransactionWitness redeemP2WPKH(@Nullable TransactionSignature signature, ECKey pubKey) {
checkArgument(pubKey.isCompressed(), "only compressed keys allowed");
TransactionWitness witness = new TransactionWitness(2);
witness.setPush(0, signature != null ? signature.encodeToBitcoin() : new byte[0]); // signature
witness.setPush(1, pubKey.getPubKey()); // pubkey
return witness;
} | [
"public",
"static",
"TransactionWitness",
"redeemP2WPKH",
"(",
"@",
"Nullable",
"TransactionSignature",
"signature",
",",
"ECKey",
"pubKey",
")",
"{",
"checkArgument",
"(",
"pubKey",
".",
"isCompressed",
"(",
")",
",",
"\"only compressed keys allowed\"",
")",
";",
"... | Creates the stack pushes necessary to redeem a P2WPKH output. If given signature is null, an empty push will be
used as a placeholder. | [
"Creates",
"the",
"stack",
"pushes",
"necessary",
"to",
"redeem",
"a",
"P2WPKH",
"output",
".",
"If",
"given",
"signature",
"is",
"null",
"an",
"empty",
"push",
"will",
"be",
"used",
"as",
"a",
"placeholder",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/TransactionWitness.java#L36-L42 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java | SqlDateTimeUtils.internalToDate | public static java.sql.Date internalToDate(int v, TimeZone tz) {
// note that, in this case, can't handle Daylight Saving Time
final long t = v * MILLIS_PER_DAY;
return new java.sql.Date(t - tz.getOffset(t));
} | java | public static java.sql.Date internalToDate(int v, TimeZone tz) {
// note that, in this case, can't handle Daylight Saving Time
final long t = v * MILLIS_PER_DAY;
return new java.sql.Date(t - tz.getOffset(t));
} | [
"public",
"static",
"java",
".",
"sql",
".",
"Date",
"internalToDate",
"(",
"int",
"v",
",",
"TimeZone",
"tz",
")",
"{",
"// note that, in this case, can't handle Daylight Saving Time",
"final",
"long",
"t",
"=",
"v",
"*",
"MILLIS_PER_DAY",
";",
"return",
"new",
... | Converts the internal representation of a SQL DATE (int) to the Java
type used for UDF parameters ({@link java.sql.Date}) with the given TimeZone.
<p>The internal int represents the days since January 1, 1970. When we convert it
to {@link java.sql.Date} (time milliseconds since January 1, 1970, 00:00:00 GMT),
we need a TimeZone. | [
"Converts",
"the",
"internal",
"representation",
"of",
"a",
"SQL",
"DATE",
"(",
"int",
")",
"to",
"the",
"Java",
"type",
"used",
"for",
"UDF",
"parameters",
"(",
"{",
"@link",
"java",
".",
"sql",
".",
"Date",
"}",
")",
"with",
"the",
"given",
"TimeZone... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L133-L137 |
landawn/AbacusUtil | src/com/landawn/abacus/util/stream/Collectors.java | Collectors.minAll | public static <T> Collector<T, ?, List<T>> minAll(Comparator<? super T> comparator) {
return minAll(comparator, Integer.MAX_VALUE);
} | java | public static <T> Collector<T, ?, List<T>> minAll(Comparator<? super T> comparator) {
return minAll(comparator, Integer.MAX_VALUE);
} | [
"public",
"static",
"<",
"T",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"List",
"<",
"T",
">",
">",
"minAll",
"(",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
")",
"{",
"return",
"minAll",
"(",
"comparator",
",",
"Integer",
".",
"MAX_... | It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
<br />
Returns a {@code Collector} which finds all the elements which are equal
to each other and smaller than any other element according to the
specified {@link Comparator}. The found elements are collected to
{@link List}.
@param <T> the type of the input elements
@param comparator a {@code Comparator} to compare the elements
@return a {@code Collector} which finds all the minimal elements and
collects them to the {@code List}.
@see #minAll(Comparator, Collector)
@see #minAll() | [
"It",
"s",
"copied",
"from",
"StreamEx",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"amaembo",
"/",
"streamex",
"under",
"Apache",
"License",
"v2",
"and",
"may",
"be",
"modified",
".",
"<br",
"/",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/Collectors.java#L2527-L2529 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/FullDTDReader.java | FullDTDReader.readDTDQName | private PrefixedName readDTDQName(char firstChar)
throws XMLStreamException
{
String prefix, localName;
if (!mCfgNsEnabled) {
prefix = null;
localName = parseFullName(firstChar);
} else {
localName = parseLocalName(firstChar);
/* Hmmh. This is tricky; should only read from the current
* scope, but it is ok to hit end-of-block if it was a PE
* expansion...
*/
char c = dtdNextIfAvailable();
if (c == CHAR_NULL) { // end-of-block
// ok, that's it...
prefix = null;
} else {
if (c == ':') { // Ok, got namespace and local name
prefix = localName;
c = dtdNextFromCurr();
localName = parseLocalName(c);
} else {
prefix = null;
--mInputPtr;
}
}
}
return findSharedName(prefix, localName);
} | java | private PrefixedName readDTDQName(char firstChar)
throws XMLStreamException
{
String prefix, localName;
if (!mCfgNsEnabled) {
prefix = null;
localName = parseFullName(firstChar);
} else {
localName = parseLocalName(firstChar);
/* Hmmh. This is tricky; should only read from the current
* scope, but it is ok to hit end-of-block if it was a PE
* expansion...
*/
char c = dtdNextIfAvailable();
if (c == CHAR_NULL) { // end-of-block
// ok, that's it...
prefix = null;
} else {
if (c == ':') { // Ok, got namespace and local name
prefix = localName;
c = dtdNextFromCurr();
localName = parseLocalName(c);
} else {
prefix = null;
--mInputPtr;
}
}
}
return findSharedName(prefix, localName);
} | [
"private",
"PrefixedName",
"readDTDQName",
"(",
"char",
"firstChar",
")",
"throws",
"XMLStreamException",
"{",
"String",
"prefix",
",",
"localName",
";",
"if",
"(",
"!",
"mCfgNsEnabled",
")",
"{",
"prefix",
"=",
"null",
";",
"localName",
"=",
"parseFullName",
... | Method that will read an element or attribute name from DTD; depending
on namespace mode, it can have prefix as well.
<p>
Note: returned {@link PrefixedName} instances are canonicalized so that
all instances read during parsing of a single DTD subset so that
identity comparison can be used instead of calling <code>equals()</code>
method (but only within a single subset!). This also reduces memory
usage to some extent. | [
"Method",
"that",
"will",
"read",
"an",
"element",
"or",
"attribute",
"name",
"from",
"DTD",
";",
"depending",
"on",
"namespace",
"mode",
"it",
"can",
"have",
"prefix",
"as",
"well",
".",
"<p",
">",
"Note",
":",
"returned",
"{"
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/FullDTDReader.java#L1340-L1371 |
apereo/cas | core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/view/AbstractCasView.java | AbstractCasView.getServiceFrom | protected Service getServiceFrom(final Map<String, Object> model) {
return (Service) model.get(CasViewConstants.MODEL_ATTRIBUTE_NAME_SERVICE);
} | java | protected Service getServiceFrom(final Map<String, Object> model) {
return (Service) model.get(CasViewConstants.MODEL_ATTRIBUTE_NAME_SERVICE);
} | [
"protected",
"Service",
"getServiceFrom",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"model",
")",
"{",
"return",
"(",
"Service",
")",
"model",
".",
"get",
"(",
"CasViewConstants",
".",
"MODEL_ATTRIBUTE_NAME_SERVICE",
")",
";",
"}"
] | Gets validated service from the model.
@param model the model
@return the validated service from | [
"Gets",
"validated",
"service",
"from",
"the",
"model",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/view/AbstractCasView.java#L164-L166 |
lucee/Lucee | core/src/main/java/lucee/runtime/schedule/ScheduleTaskImpl.java | ScheduleTaskImpl.toURL | private static URL toURL(String url, int port) throws MalformedURLException {
URL u = HTTPUtil.toURL(url, true);
if (port == -1) return u;
return new URL(u.getProtocol(), u.getHost(), port, u.getFile());
} | java | private static URL toURL(String url, int port) throws MalformedURLException {
URL u = HTTPUtil.toURL(url, true);
if (port == -1) return u;
return new URL(u.getProtocol(), u.getHost(), port, u.getFile());
} | [
"private",
"static",
"URL",
"toURL",
"(",
"String",
"url",
",",
"int",
"port",
")",
"throws",
"MalformedURLException",
"{",
"URL",
"u",
"=",
"HTTPUtil",
".",
"toURL",
"(",
"url",
",",
"true",
")",
";",
"if",
"(",
"port",
"==",
"-",
"1",
")",
"return"... | translate a urlString and a port definition to a URL Object
@param url URL String
@param port URL Port Definition
@return returns a URL Object
@throws MalformedURLException | [
"translate",
"a",
"urlString",
"and",
"a",
"port",
"definition",
"to",
"a",
"URL",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/ScheduleTaskImpl.java#L169-L173 |
bluelinelabs/Conductor | conductor/src/main/java/com/bluelinelabs/conductor/changehandler/SharedElementTransitionChangeHandler.java | SharedElementTransitionChangeHandler.getExitTransitionCallback | @Nullable
public SharedElementCallback getExitTransitionCallback(@NonNull ViewGroup container, @Nullable View from, @Nullable View to, boolean isPush) {
return null;
} | java | @Nullable
public SharedElementCallback getExitTransitionCallback(@NonNull ViewGroup container, @Nullable View from, @Nullable View to, boolean isPush) {
return null;
} | [
"@",
"Nullable",
"public",
"SharedElementCallback",
"getExitTransitionCallback",
"(",
"@",
"NonNull",
"ViewGroup",
"container",
",",
"@",
"Nullable",
"View",
"from",
",",
"@",
"Nullable",
"View",
"to",
",",
"boolean",
"isPush",
")",
"{",
"return",
"null",
";",
... | Should return a callback that can be used to customize transition behavior of the shared element transition for the "from" view. | [
"Should",
"return",
"a",
"callback",
"that",
"can",
"be",
"used",
"to",
"customize",
"transition",
"behavior",
"of",
"the",
"shared",
"element",
"transition",
"for",
"the",
"from",
"view",
"."
] | train | https://github.com/bluelinelabs/Conductor/blob/94c9121bb16f93b481954513a8e3905846829fb2/conductor/src/main/java/com/bluelinelabs/conductor/changehandler/SharedElementTransitionChangeHandler.java#L525-L528 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java | SqlBuilderHelper.generateColumnCheckSet | public static String generateColumnCheckSet(TypeSpec.Builder builder, SQLiteModelMethod method, Set<String> columnNames) {
String columnNameSet = method.contentProviderMethodName + "ColumnSet";
StringBuilder initBuilder = new StringBuilder();
String temp = "";
for (String item : columnNames) {
initBuilder.append(temp + "\"" + item + "\"");
temp = ", ";
}
FieldSpec.Builder fieldBuilder = FieldSpec.builder(ParameterizedTypeName.get(Set.class, String.class), columnNameSet, Modifier.STATIC, Modifier.PRIVATE, Modifier.FINAL);
fieldBuilder.initializer("$T.asSet($T.class, $L)", CollectionUtils.class, String.class, initBuilder.toString());
builder.addField(fieldBuilder.build());
return columnNameSet;
} | java | public static String generateColumnCheckSet(TypeSpec.Builder builder, SQLiteModelMethod method, Set<String> columnNames) {
String columnNameSet = method.contentProviderMethodName + "ColumnSet";
StringBuilder initBuilder = new StringBuilder();
String temp = "";
for (String item : columnNames) {
initBuilder.append(temp + "\"" + item + "\"");
temp = ", ";
}
FieldSpec.Builder fieldBuilder = FieldSpec.builder(ParameterizedTypeName.get(Set.class, String.class), columnNameSet, Modifier.STATIC, Modifier.PRIVATE, Modifier.FINAL);
fieldBuilder.initializer("$T.asSet($T.class, $L)", CollectionUtils.class, String.class, initBuilder.toString());
builder.addField(fieldBuilder.build());
return columnNameSet;
} | [
"public",
"static",
"String",
"generateColumnCheckSet",
"(",
"TypeSpec",
".",
"Builder",
"builder",
",",
"SQLiteModelMethod",
"method",
",",
"Set",
"<",
"String",
">",
"columnNames",
")",
"{",
"String",
"columnNameSet",
"=",
"method",
".",
"contentProviderMethodName... | check used columns.
@param builder
the builder
@param method
the method
@param columnNames
the column names
@return name of column name set | [
"check",
"used",
"columns",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java#L74-L90 |
PunchThrough/bean-sdk-android | sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java | Bean.sendMessage | private void sendMessage(BeanMessageID type, Message message) {
Buffer buffer = new Buffer();
buffer.writeByte((type.getRawValue() >> 8) & 0xff);
buffer.writeByte(type.getRawValue() & 0xff);
buffer.write(message.toPayload());
GattSerialMessage serialMessage = GattSerialMessage.fromPayload(buffer.readByteArray());
gattClient.getSerialProfile().sendMessage(serialMessage.getBuffer());
} | java | private void sendMessage(BeanMessageID type, Message message) {
Buffer buffer = new Buffer();
buffer.writeByte((type.getRawValue() >> 8) & 0xff);
buffer.writeByte(type.getRawValue() & 0xff);
buffer.write(message.toPayload());
GattSerialMessage serialMessage = GattSerialMessage.fromPayload(buffer.readByteArray());
gattClient.getSerialProfile().sendMessage(serialMessage.getBuffer());
} | [
"private",
"void",
"sendMessage",
"(",
"BeanMessageID",
"type",
",",
"Message",
"message",
")",
"{",
"Buffer",
"buffer",
"=",
"new",
"Buffer",
"(",
")",
";",
"buffer",
".",
"writeByte",
"(",
"(",
"type",
".",
"getRawValue",
"(",
")",
">>",
"8",
")",
"&... | Send a message to Bean with a payload.
@param type The {@link com.punchthrough.bean.sdk.internal.BeanMessageID} for the message
@param message The message payload to send | [
"Send",
"a",
"message",
"to",
"Bean",
"with",
"a",
"payload",
"."
] | train | https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L716-L723 |
alipay/sofa-rpc | extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/server/bolt/BoltServerProcessor.java | BoltServerProcessor.clientTimeoutWhenReceiveRequest | private SofaRpcException clientTimeoutWhenReceiveRequest(String appName, String serviceName, String remoteAddress) {
String errorMsg = LogCodes.getLog(
LogCodes.ERROR_DISCARD_TIMEOUT_REQUEST, serviceName, remoteAddress);
if (LOGGER.isWarnEnabled(appName)) {
LOGGER.warnWithApp(appName, errorMsg);
}
return new SofaRpcException(RpcErrorType.SERVER_UNDECLARED_ERROR, errorMsg);
} | java | private SofaRpcException clientTimeoutWhenReceiveRequest(String appName, String serviceName, String remoteAddress) {
String errorMsg = LogCodes.getLog(
LogCodes.ERROR_DISCARD_TIMEOUT_REQUEST, serviceName, remoteAddress);
if (LOGGER.isWarnEnabled(appName)) {
LOGGER.warnWithApp(appName, errorMsg);
}
return new SofaRpcException(RpcErrorType.SERVER_UNDECLARED_ERROR, errorMsg);
} | [
"private",
"SofaRpcException",
"clientTimeoutWhenReceiveRequest",
"(",
"String",
"appName",
",",
"String",
"serviceName",
",",
"String",
"remoteAddress",
")",
"{",
"String",
"errorMsg",
"=",
"LogCodes",
".",
"getLog",
"(",
"LogCodes",
".",
"ERROR_DISCARD_TIMEOUT_REQUEST... | 客户端已经超时了(例如在队列里等待太久了),丢弃这个请求
@param appName 应用
@param serviceName 服务
@param remoteAddress 远程地址
@return 丢弃的异常 | [
"客户端已经超时了(例如在队列里等待太久了),丢弃这个请求"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/server/bolt/BoltServerProcessor.java#L277-L284 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/sequences/CoNLLDocumentReaderAndWriter.java | CoNLLDocumentReaderAndWriter.printAnswers | public void printAnswers(List<CoreLabel> doc, PrintWriter out) {
// boolean tagsMerged = flags.mergeTags;
// boolean useHead = flags.splitOnHead;
if ( ! "iob1".equalsIgnoreCase(flags.entitySubclassification)) {
deEndify(doc);
}
for (CoreLabel fl : doc) {
String word = fl.word();
if (word == BOUNDARY) { // Using == is okay, because it is set to constant
out.println();
} else {
String gold = fl.get(OriginalAnswerAnnotation.class);
if(gold == null) gold = "";
String guess = fl.get(AnswerAnnotation.class);
// System.err.println(fl.word() + "\t" + fl.get(AnswerAnnotation.class) + "\t" + fl.get(AnswerAnnotation.class));
String pos = fl.tag();
String chunk = (fl.get(ChunkAnnotation.class) == null ? "" : fl.get(ChunkAnnotation.class));
out.println(fl.word() + '\t' + pos + '\t' + chunk + '\t' +
gold + '\t' + guess);
}
}
} | java | public void printAnswers(List<CoreLabel> doc, PrintWriter out) {
// boolean tagsMerged = flags.mergeTags;
// boolean useHead = flags.splitOnHead;
if ( ! "iob1".equalsIgnoreCase(flags.entitySubclassification)) {
deEndify(doc);
}
for (CoreLabel fl : doc) {
String word = fl.word();
if (word == BOUNDARY) { // Using == is okay, because it is set to constant
out.println();
} else {
String gold = fl.get(OriginalAnswerAnnotation.class);
if(gold == null) gold = "";
String guess = fl.get(AnswerAnnotation.class);
// System.err.println(fl.word() + "\t" + fl.get(AnswerAnnotation.class) + "\t" + fl.get(AnswerAnnotation.class));
String pos = fl.tag();
String chunk = (fl.get(ChunkAnnotation.class) == null ? "" : fl.get(ChunkAnnotation.class));
out.println(fl.word() + '\t' + pos + '\t' + chunk + '\t' +
gold + '\t' + guess);
}
}
} | [
"public",
"void",
"printAnswers",
"(",
"List",
"<",
"CoreLabel",
">",
"doc",
",",
"PrintWriter",
"out",
")",
"{",
"// boolean tagsMerged = flags.mergeTags;\r",
"// boolean useHead = flags.splitOnHead;\r",
"if",
"(",
"!",
"\"iob1\"",
".",
"equalsIgnoreCase",
"(",
"flags"... | Write a standard CoNLL format output file.
@param doc The document: A List of CoreLabel
@param out Where to send the answers to | [
"Write",
"a",
"standard",
"CoNLL",
"format",
"output",
"file",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/sequences/CoNLLDocumentReaderAndWriter.java#L337-L360 |
riversun/finbin | src/main/java/org/riversun/finbin/BinarySearcher.java | BinarySearcher.searchBytes | public List<Integer> searchBytes(byte[] srcBytes, byte[] searchBytes) {
final int startIdx = 0;
final int endIdx = srcBytes.length - 1;
return searchBytes(srcBytes, searchBytes, startIdx, endIdx);
} | java | public List<Integer> searchBytes(byte[] srcBytes, byte[] searchBytes) {
final int startIdx = 0;
final int endIdx = srcBytes.length - 1;
return searchBytes(srcBytes, searchBytes, startIdx, endIdx);
} | [
"public",
"List",
"<",
"Integer",
">",
"searchBytes",
"(",
"byte",
"[",
"]",
"srcBytes",
",",
"byte",
"[",
"]",
"searchBytes",
")",
"{",
"final",
"int",
"startIdx",
"=",
"0",
";",
"final",
"int",
"endIdx",
"=",
"srcBytes",
".",
"length",
"-",
"1",
";... | Search bytes in byte array returns indexes within this byte-array of all
occurrences of the specified(search bytes) byte array.
@param srcBytes
@param searchBytes
@return result index list | [
"Search",
"bytes",
"in",
"byte",
"array",
"returns",
"indexes",
"within",
"this",
"byte",
"-",
"array",
"of",
"all",
"occurrences",
"of",
"the",
"specified",
"(",
"search",
"bytes",
")",
"byte",
"array",
"."
] | train | https://github.com/riversun/finbin/blob/d1db86a0d2966dcf47087340bbd0727a9d508b3e/src/main/java/org/riversun/finbin/BinarySearcher.java#L137-L141 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java | BackupLongTermRetentionVaultsInner.beginCreateOrUpdateAsync | public Observable<BackupLongTermRetentionVaultInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String recoveryServicesVaultResourceId) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, recoveryServicesVaultResourceId).map(new Func1<ServiceResponse<BackupLongTermRetentionVaultInner>, BackupLongTermRetentionVaultInner>() {
@Override
public BackupLongTermRetentionVaultInner call(ServiceResponse<BackupLongTermRetentionVaultInner> response) {
return response.body();
}
});
} | java | public Observable<BackupLongTermRetentionVaultInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String recoveryServicesVaultResourceId) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, recoveryServicesVaultResourceId).map(new Func1<ServiceResponse<BackupLongTermRetentionVaultInner>, BackupLongTermRetentionVaultInner>() {
@Override
public BackupLongTermRetentionVaultInner call(ServiceResponse<BackupLongTermRetentionVaultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BackupLongTermRetentionVaultInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"recoveryServicesVaultResourceId",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",... | Updates a server backup long term retention vault.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param recoveryServicesVaultResourceId The azure recovery services vault resource id
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the BackupLongTermRetentionVaultInner object | [
"Updates",
"a",
"server",
"backup",
"long",
"term",
"retention",
"vault",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java#L279-L286 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_udp_farm_farmId_server_POST | public OvhBackendUDPServer serviceName_udp_farm_farmId_server_POST(String serviceName, Long farmId, String address, String displayName, Long port, OvhBackendCustomerServerStatusEnum status) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/udp/farm/{farmId}/server";
StringBuilder sb = path(qPath, serviceName, farmId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "address", address);
addBody(o, "displayName", displayName);
addBody(o, "port", port);
addBody(o, "status", status);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhBackendUDPServer.class);
} | java | public OvhBackendUDPServer serviceName_udp_farm_farmId_server_POST(String serviceName, Long farmId, String address, String displayName, Long port, OvhBackendCustomerServerStatusEnum status) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/udp/farm/{farmId}/server";
StringBuilder sb = path(qPath, serviceName, farmId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "address", address);
addBody(o, "displayName", displayName);
addBody(o, "port", port);
addBody(o, "status", status);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhBackendUDPServer.class);
} | [
"public",
"OvhBackendUDPServer",
"serviceName_udp_farm_farmId_server_POST",
"(",
"String",
"serviceName",
",",
"Long",
"farmId",
",",
"String",
"address",
",",
"String",
"displayName",
",",
"Long",
"port",
",",
"OvhBackendCustomerServerStatusEnum",
"status",
")",
"throws"... | Add a server to an UDP Farm
REST: POST /ipLoadbalancing/{serviceName}/udp/farm/{farmId}/server
@param status [required] Enable or disable your server
@param address [required] Address of your server
@param port [required] Port attached to your server ([1..49151]). Inherited from farm if null
@param displayName [required] Human readable name for your server, this field is for you
@param serviceName [required] The internal name of your IP load balancing
@param farmId [required] Id of your farm
API beta | [
"Add",
"a",
"server",
"to",
"an",
"UDP",
"Farm"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1016-L1026 |
f2prateek/dart | henson/src/main/java/dart/henson/Bundler.java | Bundler.put | public Bundler put(String key, String[] value) {
delegate.putStringArray(key, value);
return this;
} | java | public Bundler put(String key, String[] value) {
delegate.putStringArray(key, value);
return this;
} | [
"public",
"Bundler",
"put",
"(",
"String",
"key",
",",
"String",
"[",
"]",
"value",
")",
"{",
"delegate",
".",
"putStringArray",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a String array value into the mapping of the underlying Bundle, replacing any existing
value for the given key. Either key or value may be null.
@param key a String, or null
@param value a String array object, or null
@return this bundler instance to chain method calls | [
"Inserts",
"a",
"String",
"array",
"value",
"into",
"the",
"mapping",
"of",
"the",
"underlying",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | train | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson/src/main/java/dart/henson/Bundler.java#L179-L182 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java | Client.menuRequest | @SuppressWarnings("SameParameterValue")
public Message menuRequest(Message.KnownType requestType, Message.MenuIdentifier targetMenu,
CdjStatus.TrackSourceSlot slot, Field... arguments)
throws IOException {
return menuRequestTyped(requestType, targetMenu, slot, CdjStatus.TrackType.REKORDBOX, arguments);
} | java | @SuppressWarnings("SameParameterValue")
public Message menuRequest(Message.KnownType requestType, Message.MenuIdentifier targetMenu,
CdjStatus.TrackSourceSlot slot, Field... arguments)
throws IOException {
return menuRequestTyped(requestType, targetMenu, slot, CdjStatus.TrackType.REKORDBOX, arguments);
} | [
"@",
"SuppressWarnings",
"(",
"\"SameParameterValue\"",
")",
"public",
"Message",
"menuRequest",
"(",
"Message",
".",
"KnownType",
"requestType",
",",
"Message",
".",
"MenuIdentifier",
"targetMenu",
",",
"CdjStatus",
".",
"TrackSourceSlot",
"slot",
",",
"Field",
"..... | Send a request for a menu that we will retrieve items from in subsequent requests. This variant works for
nearly all menus, but when you are trying to request metadata for an unanalyzed (non-rekordbox) track, you
need to use {@link #menuRequestTyped(Message.KnownType, Message.MenuIdentifier, CdjStatus.TrackSourceSlot, CdjStatus.TrackType, Field...)}
and specify the actual type of the track whose metadata you want to retrieve.
@param requestType identifies what kind of menu request to send
@param targetMenu the destination for the response to this query
@param slot the media library of interest for this query
@param arguments the additional arguments needed, if any, to complete the request
@return the {@link Message.KnownType#MENU_AVAILABLE} response reporting how many items are available in the menu
@throws IOException if there is a problem communicating, or if the requested menu is not available
@throws IllegalStateException if {@link #tryLockingForMenuOperations(long, TimeUnit)} was not called successfully
before attempting this call | [
"Send",
"a",
"request",
"for",
"a",
"menu",
"that",
"we",
"will",
"retrieve",
"items",
"from",
"in",
"subsequent",
"requests",
".",
"This",
"variant",
"works",
"for",
"nearly",
"all",
"menus",
"but",
"when",
"you",
"are",
"trying",
"to",
"request",
"metada... | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java#L380-L385 |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/problems/objectives/WeightedIndex.java | WeightedIndex.addObjective | public void addObjective(Objective<? super SolutionType, ? super DataType> objective, double weight) {
// check weight
if(weight > 0.0){
// add objective to map
weights.put(objective, weight);
} else {
throw new IllegalArgumentException("Error in weighted index: each objective's weight should be strictly positive.");
}
} | java | public void addObjective(Objective<? super SolutionType, ? super DataType> objective, double weight) {
// check weight
if(weight > 0.0){
// add objective to map
weights.put(objective, weight);
} else {
throw new IllegalArgumentException("Error in weighted index: each objective's weight should be strictly positive.");
}
} | [
"public",
"void",
"addObjective",
"(",
"Objective",
"<",
"?",
"super",
"SolutionType",
",",
"?",
"super",
"DataType",
">",
"objective",
",",
"double",
"weight",
")",
"{",
"// check weight",
"if",
"(",
"weight",
">",
"0.0",
")",
"{",
"// add objective to map",
... | Add an objective with corresponding weight. Any objective designed for the solution type and data type of this
multi-objective (or for more general solution or data types) can be added. The specified weight should be strictly
positive, if not, an exception will be thrown.
@param objective objective to be added
@param weight corresponding weight (strictly positive)
@throws IllegalArgumentException if the specified weight is not strictly positive | [
"Add",
"an",
"objective",
"with",
"corresponding",
"weight",
".",
"Any",
"objective",
"designed",
"for",
"the",
"solution",
"type",
"and",
"data",
"type",
"of",
"this",
"multi",
"-",
"objective",
"(",
"or",
"for",
"more",
"general",
"solution",
"or",
"data",... | train | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/problems/objectives/WeightedIndex.java#L58-L66 |
ktoso/janbanery | janbanery-core/src/main/java/pl/project13/janbanery/core/JanbaneryFactory.java | JanbaneryFactory.connectAndKeepUsing | public Janbanery connectAndKeepUsing(String user, String password) throws ServerCommunicationException {
DefaultConfiguration conf = new DefaultConfiguration(user, password);
RestClient restClient = getRestClient(conf);
return new Janbanery(conf, restClient);
} | java | public Janbanery connectAndKeepUsing(String user, String password) throws ServerCommunicationException {
DefaultConfiguration conf = new DefaultConfiguration(user, password);
RestClient restClient = getRestClient(conf);
return new Janbanery(conf, restClient);
} | [
"public",
"Janbanery",
"connectAndKeepUsing",
"(",
"String",
"user",
",",
"String",
"password",
")",
"throws",
"ServerCommunicationException",
"{",
"DefaultConfiguration",
"conf",
"=",
"new",
"DefaultConfiguration",
"(",
"user",
",",
"password",
")",
";",
"RestClient"... | This method will connect to kanbanery via basic user/pass authentication
<strong>and will keep using it until forced to switch modes!</strong>. This method is not encouraged,
you should use {@link JanbaneryFactory#connectUsing(String, String)} and allow Janbanery to switch to apiKey mode
as soon as it load's up to increase security over the wire.
@param user your kanbanery username (email)
@param password your kanbanery password for this user
@return an Janbanery instance setup using the API Key auth, which will be fetched during construction
@throws ServerCommunicationException | [
"This",
"method",
"will",
"connect",
"to",
"kanbanery",
"via",
"basic",
"user",
"/",
"pass",
"authentication",
"<strong",
">",
"and",
"will",
"keep",
"using",
"it",
"until",
"forced",
"to",
"switch",
"modes!<",
"/",
"strong",
">",
".",
"This",
"method",
"i... | train | https://github.com/ktoso/janbanery/blob/cd77b774814c7fbb2a0c9c55d4c3f7e76affa636/janbanery-core/src/main/java/pl/project13/janbanery/core/JanbaneryFactory.java#L115-L119 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/variant/css/CssSkinGenerator.java | CssSkinGenerator.getVariants | private Map<String, VariantSet> getVariants(ResourceBrowser rsBrowser, String rootDir, String defaultSkinName,
String defaultLocaleName, boolean mappingSkinLocale) {
Set<String> paths = rsBrowser.getResourceNames(rootDir);
Set<String> skinNames = new HashSet<>();
Set<String> localeVariants = new HashSet<>();
for (Iterator<String> itPath = paths.iterator(); itPath.hasNext();) {
String path = rootDir + itPath.next();
if (rsBrowser.isDirectory(path)) {
String dirName = PathNormalizer.getPathName(path);
if (mappingSkinLocale) {
skinNames.add(dirName);
// check if there are locale variants for this skin,
// and update the localeVariants if needed
updateLocaleVariants(rsBrowser, path, localeVariants);
} else {
if (LocaleUtils.LOCALE_SUFFIXES.contains(dirName)) {
localeVariants.add(dirName);
// check if there are skin variants for this locales,
// and update the skinVariants if needed
updateSkinVariants(rsBrowser, path, skinNames);
}
}
}
}
// Initialize the variant mapping for the skin root directory
return getVariants(defaultSkinName, skinNames, defaultLocaleName, localeVariants);
} | java | private Map<String, VariantSet> getVariants(ResourceBrowser rsBrowser, String rootDir, String defaultSkinName,
String defaultLocaleName, boolean mappingSkinLocale) {
Set<String> paths = rsBrowser.getResourceNames(rootDir);
Set<String> skinNames = new HashSet<>();
Set<String> localeVariants = new HashSet<>();
for (Iterator<String> itPath = paths.iterator(); itPath.hasNext();) {
String path = rootDir + itPath.next();
if (rsBrowser.isDirectory(path)) {
String dirName = PathNormalizer.getPathName(path);
if (mappingSkinLocale) {
skinNames.add(dirName);
// check if there are locale variants for this skin,
// and update the localeVariants if needed
updateLocaleVariants(rsBrowser, path, localeVariants);
} else {
if (LocaleUtils.LOCALE_SUFFIXES.contains(dirName)) {
localeVariants.add(dirName);
// check if there are skin variants for this locales,
// and update the skinVariants if needed
updateSkinVariants(rsBrowser, path, skinNames);
}
}
}
}
// Initialize the variant mapping for the skin root directory
return getVariants(defaultSkinName, skinNames, defaultLocaleName, localeVariants);
} | [
"private",
"Map",
"<",
"String",
",",
"VariantSet",
">",
"getVariants",
"(",
"ResourceBrowser",
"rsBrowser",
",",
"String",
"rootDir",
",",
"String",
"defaultSkinName",
",",
"String",
"defaultLocaleName",
",",
"boolean",
"mappingSkinLocale",
")",
"{",
"Set",
"<",
... | Initialize the skinMapping from the parent path
@param rsBrowser
the resource browser
@param rootDir
the skin root dir path
@param defaultSkinName
the default skin name
@param defaultLocaleName
the default locale name | [
"Initialize",
"the",
"skinMapping",
"from",
"the",
"parent",
"path"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/variant/css/CssSkinGenerator.java#L504-L531 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBMapperTableModel.java | DynamoDBMapperTableModel.createKey | public <H,R> T createKey(final H hashKey, final R rangeKey) {
final T key = StandardBeanProperties.DeclaringReflect.<T>newInstance(targetType);
if (hashKey != null) {
final DynamoDBMapperFieldModel<T,H> hk = hashKey();
hk.set(key, hashKey);
}
if (rangeKey != null) {
final DynamoDBMapperFieldModel<T,R> rk = rangeKey();
rk.set(key, rangeKey);
}
return key;
} | java | public <H,R> T createKey(final H hashKey, final R rangeKey) {
final T key = StandardBeanProperties.DeclaringReflect.<T>newInstance(targetType);
if (hashKey != null) {
final DynamoDBMapperFieldModel<T,H> hk = hashKey();
hk.set(key, hashKey);
}
if (rangeKey != null) {
final DynamoDBMapperFieldModel<T,R> rk = rangeKey();
rk.set(key, rangeKey);
}
return key;
} | [
"public",
"<",
"H",
",",
"R",
">",
"T",
"createKey",
"(",
"final",
"H",
"hashKey",
",",
"final",
"R",
"rangeKey",
")",
"{",
"final",
"T",
"key",
"=",
"StandardBeanProperties",
".",
"DeclaringReflect",
".",
"<",
"T",
">",
"newInstance",
"(",
"targetType",... | Creates a new object instance with the keys populated.
@param <H> The hash key type.
@param <R> The range key type.
@param hashKey The hash key.
@param rangeKey The range key (optional if not present on table).
@return The new instance. | [
"Creates",
"a",
"new",
"object",
"instance",
"with",
"the",
"keys",
"populated",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBMapperTableModel.java#L287-L298 |
landawn/AbacusUtil | src/com/landawn/abacus/util/TriIterator.java | TriIterator.forEachRemaining | @Override
@Deprecated
public void forEachRemaining(java.util.function.Consumer<? super Triple<A, B, C>> action) {
super.forEachRemaining(action);
} | java | @Override
@Deprecated
public void forEachRemaining(java.util.function.Consumer<? super Triple<A, B, C>> action) {
super.forEachRemaining(action);
} | [
"@",
"Override",
"@",
"Deprecated",
"public",
"void",
"forEachRemaining",
"(",
"java",
".",
"util",
".",
"function",
".",
"Consumer",
"<",
"?",
"super",
"Triple",
"<",
"A",
",",
"B",
",",
"C",
">",
">",
"action",
")",
"{",
"super",
".",
"forEachRemaini... | It's preferred to call <code>forEachRemaining(Try.TriConsumer)</code> to avoid the create the unnecessary <code>Triple</code> Objects.
@deprecated | [
"It",
"s",
"preferred",
"to",
"call",
"<code",
">",
"forEachRemaining",
"(",
"Try",
".",
"TriConsumer",
")",
"<",
"/",
"code",
">",
"to",
"avoid",
"the",
"create",
"the",
"unnecessary",
"<code",
">",
"Triple<",
"/",
"code",
">",
"Objects",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/TriIterator.java#L369-L373 |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/SummonerTeamService.java | SummonerTeamService.kickPlayer | public Team kickPlayer(long summonerId, TeamId teamId) {
return client.sendRpcAndWait(SERVICE, "kickPlayer", summonerId, teamId);
} | java | public Team kickPlayer(long summonerId, TeamId teamId) {
return client.sendRpcAndWait(SERVICE, "kickPlayer", summonerId, teamId);
} | [
"public",
"Team",
"kickPlayer",
"(",
"long",
"summonerId",
",",
"TeamId",
"teamId",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"kickPlayer\"",
",",
"summonerId",
",",
"teamId",
")",
";",
"}"
] | Kick a player from the target team
@param summonerId The id of the player
@param teamId The id of the team
@return The new team state | [
"Kick",
"a",
"player",
"from",
"the",
"target",
"team"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/SummonerTeamService.java#L115-L117 |
authlete/authlete-java-common | src/main/java/com/authlete/common/web/URLCoder.java | URLCoder.formUrlEncode | public static String formUrlEncode(Map<String, ?> parameters)
{
if (parameters == null)
{
return null;
}
StringBuilder sb = new StringBuilder();
// For each key-values pair.
for (Map.Entry<String, ?> entry : parameters.entrySet())
{
String key = entry.getKey();
Object values = entry.getValue();
if (values instanceof List)
{
List<?> list = (List<?>)values;
values = list.toArray(new String[list.size()]);
}
appendParameters(sb, key, (String[])values);
}
if (sb.length() != 0)
{
// Drop the last &.
sb.setLength(sb.length() - 1);
}
return sb.toString();
} | java | public static String formUrlEncode(Map<String, ?> parameters)
{
if (parameters == null)
{
return null;
}
StringBuilder sb = new StringBuilder();
// For each key-values pair.
for (Map.Entry<String, ?> entry : parameters.entrySet())
{
String key = entry.getKey();
Object values = entry.getValue();
if (values instanceof List)
{
List<?> list = (List<?>)values;
values = list.toArray(new String[list.size()]);
}
appendParameters(sb, key, (String[])values);
}
if (sb.length() != 0)
{
// Drop the last &.
sb.setLength(sb.length() - 1);
}
return sb.toString();
} | [
"public",
"static",
"String",
"formUrlEncode",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"parameters",
")",
"{",
"if",
"(",
"parameters",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
... | Convert the given map to a string in {@code x-www-form-urlencoded} format.
@param parameters
Pairs of key and values. The type of values must be either
{@code String[]} or {@code List<String>}.
@return
A string in {@code x-www-form-urlencoded} format.
{@code null} is returned if {@code parameters} is {@code null}.
@since 1.24 | [
"Convert",
"the",
"given",
"map",
"to",
"a",
"string",
"in",
"{",
"@code",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"}",
"format",
"."
] | train | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/web/URLCoder.java#L92-L123 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/DateField.java | DateField.moveSQLToField | public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException
{
java.util.Date dateResult = resultset.getDate(iColumn);
if (resultset.wasNull())
this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value
else
this.setValue((double)dateResult.getTime(), false, DBConstants.READ_MOVE);
} | java | public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException
{
java.util.Date dateResult = resultset.getDate(iColumn);
if (resultset.wasNull())
this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value
else
this.setValue((double)dateResult.getTime(), false, DBConstants.READ_MOVE);
} | [
"public",
"void",
"moveSQLToField",
"(",
"ResultSet",
"resultset",
",",
"int",
"iColumn",
")",
"throws",
"SQLException",
"{",
"java",
".",
"util",
".",
"Date",
"dateResult",
"=",
"resultset",
".",
"getDate",
"(",
"iColumn",
")",
";",
"if",
"(",
"resultset",
... | Move the physical binary data to this SQL parameter row.
@param resultset The resultset to get the SQL data from.
@param iColumn the column in the resultset that has my data.
@exception SQLException From SQL calls. | [
"Move",
"the",
"physical",
"binary",
"data",
"to",
"this",
"SQL",
"parameter",
"row",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateField.java#L173-L180 |
jparsec/jparsec | jparsec/src/main/java/org/jparsec/pattern/Patterns.java | Patterns.times | public static Pattern times(final int min, final int max, final CharPredicate predicate) {
Checks.checkMinMax(min, max);
return new Pattern() {
@Override
public int match(CharSequence src, int begin, int end) {
int minLen = RepeatCharPredicatePattern.matchRepeat(min, predicate, src, end, begin, 0);
if (minLen == MISMATCH)
return MISMATCH;
return matchSome(max - min, predicate, src, end, begin + minLen, minLen);
}
};
} | java | public static Pattern times(final int min, final int max, final CharPredicate predicate) {
Checks.checkMinMax(min, max);
return new Pattern() {
@Override
public int match(CharSequence src, int begin, int end) {
int minLen = RepeatCharPredicatePattern.matchRepeat(min, predicate, src, end, begin, 0);
if (minLen == MISMATCH)
return MISMATCH;
return matchSome(max - min, predicate, src, end, begin + minLen, minLen);
}
};
} | [
"public",
"static",
"Pattern",
"times",
"(",
"final",
"int",
"min",
",",
"final",
"int",
"max",
",",
"final",
"CharPredicate",
"predicate",
")",
"{",
"Checks",
".",
"checkMinMax",
"(",
"min",
",",
"max",
")",
";",
"return",
"new",
"Pattern",
"(",
")",
... | Returns a {@link Pattern} that matches at least {@code min} and up to {@code max} number of characters satisfying
{@code predicate},
@since 2.2 | [
"Returns",
"a",
"{",
"@link",
"Pattern",
"}",
"that",
"matches",
"at",
"least",
"{",
"@code",
"min",
"}",
"and",
"up",
"to",
"{",
"@code",
"max",
"}",
"number",
"of",
"characters",
"satisfying",
"{",
"@code",
"predicate",
"}"
] | train | https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/pattern/Patterns.java#L411-L422 |
spring-projects/spring-hateoas | src/main/java/org/springframework/hateoas/Link.java | Link.andAffordance | public Link andAffordance(String name, HttpMethod httpMethod, ResolvableType inputType,
List<QueryParameter> queryMethodParameters, ResolvableType outputType) {
return andAffordance(new Affordance(name, this, httpMethod, inputType, queryMethodParameters, outputType));
} | java | public Link andAffordance(String name, HttpMethod httpMethod, ResolvableType inputType,
List<QueryParameter> queryMethodParameters, ResolvableType outputType) {
return andAffordance(new Affordance(name, this, httpMethod, inputType, queryMethodParameters, outputType));
} | [
"public",
"Link",
"andAffordance",
"(",
"String",
"name",
",",
"HttpMethod",
"httpMethod",
",",
"ResolvableType",
"inputType",
",",
"List",
"<",
"QueryParameter",
">",
"queryMethodParameters",
",",
"ResolvableType",
"outputType",
")",
"{",
"return",
"andAffordance",
... | Convenience method when chaining an existing {@link Link}.
@param name
@param httpMethod
@param inputType
@param queryMethodParameters
@param outputType
@return | [
"Convenience",
"method",
"when",
"chaining",
"an",
"existing",
"{",
"@link",
"Link",
"}",
"."
] | train | https://github.com/spring-projects/spring-hateoas/blob/70ebff9309f086cd8d6a97daf67e0dc215c87d9c/src/main/java/org/springframework/hateoas/Link.java#L224-L227 |
mygreen/super-csv-annotation | src/main/java/com/github/mygreen/supercsv/cellprocessor/constraint/LengthBetween.java | LengthBetween.execute | @SuppressWarnings("unchecked")
public Object execute(final Object value, final CsvContext context) {
if(value == null) {
return next.execute(value, context);
}
final String stringValue = value.toString();
final int length = stringValue.length();
if( length < min || length > max ) {
throw createValidationException(context)
.messageFormat("the length (%d) of value '%s' does not lie between the min (%d) and max (%d) values (inclusive)",
length, stringValue, min, max)
.rejectedValue(stringValue)
.messageVariables("min", getMin())
.messageVariables("max", getMax())
.messageVariables("length", length)
.build();
}
return next.execute(stringValue, context);
} | java | @SuppressWarnings("unchecked")
public Object execute(final Object value, final CsvContext context) {
if(value == null) {
return next.execute(value, context);
}
final String stringValue = value.toString();
final int length = stringValue.length();
if( length < min || length > max ) {
throw createValidationException(context)
.messageFormat("the length (%d) of value '%s' does not lie between the min (%d) and max (%d) values (inclusive)",
length, stringValue, min, max)
.rejectedValue(stringValue)
.messageVariables("min", getMin())
.messageVariables("max", getMax())
.messageVariables("length", length)
.build();
}
return next.execute(stringValue, context);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Object",
"execute",
"(",
"final",
"Object",
"value",
",",
"final",
"CsvContext",
"context",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"next",
".",
"execute",
"(",
"value",... | {@inheritDoc}
@throws SuperCsvCellProcessorException
{@literal if value is null}
@throws SuperCsvConstraintViolationException
{@literal if length is < min or length > max} | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/cellprocessor/constraint/LengthBetween.java#L67-L89 |
overview/mime-types | src/main/java/org/overviewproject/mime_types/MimeTypeDetector.java | MimeTypeDetector.matchletMagicCompare | private boolean matchletMagicCompare(int offset, byte[] data) {
if (oneMatchletMagicEquals(offset, data)) {
int nChildren = content.getInt(offset + 24);
if (nChildren > 0) {
int firstChildOffset = content.getInt(offset + 28);
return matchletMagicCompareOr(nChildren, firstChildOffset, data);
} else {
return true;
}
} else {
return false;
}
} | java | private boolean matchletMagicCompare(int offset, byte[] data) {
if (oneMatchletMagicEquals(offset, data)) {
int nChildren = content.getInt(offset + 24);
if (nChildren > 0) {
int firstChildOffset = content.getInt(offset + 28);
return matchletMagicCompareOr(nChildren, firstChildOffset, data);
} else {
return true;
}
} else {
return false;
}
} | [
"private",
"boolean",
"matchletMagicCompare",
"(",
"int",
"offset",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"oneMatchletMagicEquals",
"(",
"offset",
",",
"data",
")",
")",
"{",
"int",
"nChildren",
"=",
"content",
".",
"getInt",
"(",
"offset",
... | Returns whether data satisfies the matchlet and its children. | [
"Returns",
"whether",
"data",
"satisfies",
"the",
"matchlet",
"and",
"its",
"children",
"."
] | train | https://github.com/overview/mime-types/blob/d5c45302049c0cd5e634a50954304d8ddeb9abb4/src/main/java/org/overviewproject/mime_types/MimeTypeDetector.java#L466-L479 |
zxing/zxing | core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java | Decoder.readCode | private static int readCode(boolean[] rawbits, int startIndex, int length) {
int res = 0;
for (int i = startIndex; i < startIndex + length; i++) {
res <<= 1;
if (rawbits[i]) {
res |= 0x01;
}
}
return res;
} | java | private static int readCode(boolean[] rawbits, int startIndex, int length) {
int res = 0;
for (int i = startIndex; i < startIndex + length; i++) {
res <<= 1;
if (rawbits[i]) {
res |= 0x01;
}
}
return res;
} | [
"private",
"static",
"int",
"readCode",
"(",
"boolean",
"[",
"]",
"rawbits",
",",
"int",
"startIndex",
",",
"int",
"length",
")",
"{",
"int",
"res",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"startIndex",
";",
"i",
"<",
"startIndex",
"+",
"length",... | Reads a code of given length and at given index in an array of bits | [
"Reads",
"a",
"code",
"of",
"given",
"length",
"and",
"at",
"given",
"index",
"in",
"an",
"array",
"of",
"bits"
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java#L330-L339 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/metadata/BaseMetadataHandler.java | BaseMetadataHandler.processCatalogName | private String processCatalogName(String dbProvideName, String userName, String catalogName) {
String result = null;
if (catalogName != null) {
result = catalogName.toUpperCase();
} else {
if ("Oracle".equals(dbProvideName) == true) {
// SPRING: Oracle uses catalog name for package name or an empty string if no package
result = "";
}
}
return result;
} | java | private String processCatalogName(String dbProvideName, String userName, String catalogName) {
String result = null;
if (catalogName != null) {
result = catalogName.toUpperCase();
} else {
if ("Oracle".equals(dbProvideName) == true) {
// SPRING: Oracle uses catalog name for package name or an empty string if no package
result = "";
}
}
return result;
} | [
"private",
"String",
"processCatalogName",
"(",
"String",
"dbProvideName",
",",
"String",
"userName",
",",
"String",
"catalogName",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"catalogName",
"!=",
"null",
")",
"{",
"result",
"=",
"catalogName",
... | Processes Catalog name so it would be compatible with database
@param dbProvideName short database name
@param userName user name
@param catalogName catalog name which would be processed
@return processed catalog name | [
"Processes",
"Catalog",
"name",
"so",
"it",
"would",
"be",
"compatible",
"with",
"database"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/metadata/BaseMetadataHandler.java#L229-L242 |
GCRC/nunaliit | nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java | SubmissionUtils.getSubmittedDocumentFromSubmission | static public JSONObject getSubmittedDocumentFromSubmission(JSONObject submissionDoc) throws Exception {
JSONObject submissionInfo = submissionDoc.getJSONObject("nunaliit_submission");
JSONObject doc = submissionInfo.getJSONObject("submitted_doc");
JSONObject reserved = submissionInfo.optJSONObject("submitted_reserved");
return recreateDocumentFromDocAndReserved(doc, reserved);
} | java | static public JSONObject getSubmittedDocumentFromSubmission(JSONObject submissionDoc) throws Exception {
JSONObject submissionInfo = submissionDoc.getJSONObject("nunaliit_submission");
JSONObject doc = submissionInfo.getJSONObject("submitted_doc");
JSONObject reserved = submissionInfo.optJSONObject("submitted_reserved");
return recreateDocumentFromDocAndReserved(doc, reserved);
} | [
"static",
"public",
"JSONObject",
"getSubmittedDocumentFromSubmission",
"(",
"JSONObject",
"submissionDoc",
")",
"throws",
"Exception",
"{",
"JSONObject",
"submissionInfo",
"=",
"submissionDoc",
".",
"getJSONObject",
"(",
"\"nunaliit_submission\"",
")",
";",
"JSONObject",
... | Re-creates the document submitted by the client from
the submission document.
@param submissionDoc Submission document from the submission database
@return Document submitted by user for update | [
"Re",
"-",
"creates",
"the",
"document",
"submitted",
"by",
"the",
"client",
"from",
"the",
"submission",
"document",
"."
] | train | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java#L45-L52 |
HiddenStage/divide | Server/src/main/java/io/divide/server/endpoints/PushEndpoint.java | PushEndpoint.register | @POST
@Consumes(MediaType.APPLICATION_JSON)
public Response register(@Context Session session,EncryptedEntity.Reader entity){
try{
Credentials credentials = session.getUser();
entity.setKey(keyManager.getPrivateKey());
credentials.setPushMessagingKey(entity.get("token"));
dao.save(credentials);
} catch (DAOException e) {
logger.severe(ExceptionUtils.getStackTrace(e));
return fromDAOExpection(e);
} catch (Exception e) {
logger.severe(ExceptionUtils.getStackTrace(e));
return Response.serverError().entity("Shit").build();
}
return Response.ok().build();
} | java | @POST
@Consumes(MediaType.APPLICATION_JSON)
public Response register(@Context Session session,EncryptedEntity.Reader entity){
try{
Credentials credentials = session.getUser();
entity.setKey(keyManager.getPrivateKey());
credentials.setPushMessagingKey(entity.get("token"));
dao.save(credentials);
} catch (DAOException e) {
logger.severe(ExceptionUtils.getStackTrace(e));
return fromDAOExpection(e);
} catch (Exception e) {
logger.severe(ExceptionUtils.getStackTrace(e));
return Response.serverError().entity("Shit").build();
}
return Response.ok().build();
} | [
"@",
"POST",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"public",
"Response",
"register",
"(",
"@",
"Context",
"Session",
"session",
",",
"EncryptedEntity",
".",
"Reader",
"entity",
")",
"{",
"try",
"{",
"Credentials",
"credentials",
"=",... | /*
currently failing as the decryption key is probably different | [
"/",
"*",
"currently",
"failing",
"as",
"the",
"decryption",
"key",
"is",
"probably",
"different"
] | train | https://github.com/HiddenStage/divide/blob/14e36598c50d92b4393e6649915e32b86141c598/Server/src/main/java/io/divide/server/endpoints/PushEndpoint.java#L53-L71 |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java | GenericTypeResolver.getRawType | static Type getRawType(Type genericType, Map<TypeVariable, Type> typeVariableMap) {
Type resolvedType = genericType;
if (genericType instanceof TypeVariable) {
TypeVariable tv = (TypeVariable) genericType;
resolvedType = typeVariableMap.get(tv);
if (resolvedType == null) {
resolvedType = extractBoundForTypeVariable(tv);
}
}
if (resolvedType instanceof ParameterizedType) {
return ((ParameterizedType) resolvedType).getRawType();
}
else {
return resolvedType;
}
} | java | static Type getRawType(Type genericType, Map<TypeVariable, Type> typeVariableMap) {
Type resolvedType = genericType;
if (genericType instanceof TypeVariable) {
TypeVariable tv = (TypeVariable) genericType;
resolvedType = typeVariableMap.get(tv);
if (resolvedType == null) {
resolvedType = extractBoundForTypeVariable(tv);
}
}
if (resolvedType instanceof ParameterizedType) {
return ((ParameterizedType) resolvedType).getRawType();
}
else {
return resolvedType;
}
} | [
"static",
"Type",
"getRawType",
"(",
"Type",
"genericType",
",",
"Map",
"<",
"TypeVariable",
",",
"Type",
">",
"typeVariableMap",
")",
"{",
"Type",
"resolvedType",
"=",
"genericType",
";",
"if",
"(",
"genericType",
"instanceof",
"TypeVariable",
")",
"{",
"Type... | Determine the raw type for the given generic parameter type.
@param genericType the generic type to resolve
@param typeVariableMap the TypeVariable Map to resolved against
@return the resolved raw type | [
"Determine",
"the",
"raw",
"type",
"for",
"the",
"given",
"generic",
"parameter",
"type",
"."
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java#L364-L379 |
alipay/sofa-rpc | extension-impl/registry-sofa/src/main/java/com/alipay/sofa/rpc/registry/sofa/SofaRegistry.java | SofaRegistry.addAttributes | private void addAttributes(SubscriberRegistration subscriberRegistration, String group) {
// if group == null; group = "DEFAULT_GROUP"
if (StringUtils.isNotEmpty(group)) {
subscriberRegistration.setGroup(group);
}
subscriberRegistration.setScopeEnum(ScopeEnum.global);
} | java | private void addAttributes(SubscriberRegistration subscriberRegistration, String group) {
// if group == null; group = "DEFAULT_GROUP"
if (StringUtils.isNotEmpty(group)) {
subscriberRegistration.setGroup(group);
}
subscriberRegistration.setScopeEnum(ScopeEnum.global);
} | [
"private",
"void",
"addAttributes",
"(",
"SubscriberRegistration",
"subscriberRegistration",
",",
"String",
"group",
")",
"{",
"// if group == null; group = \"DEFAULT_GROUP\"",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"group",
")",
")",
"{",
"subscriberRegistrati... | 添加额外的属性
@param subscriberRegistration 注册或者订阅对象
@param group 分组 | [
"添加额外的属性"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-sofa/src/main/java/com/alipay/sofa/rpc/registry/sofa/SofaRegistry.java#L319-L327 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/LockSet.java | LockSet.setLockCount | public void setLockCount(int valueNumber, int lockCount) {
int index = findIndex(valueNumber);
if (index < 0) {
addEntry(index, valueNumber, lockCount);
} else {
array[index + 1] = lockCount;
}
} | java | public void setLockCount(int valueNumber, int lockCount) {
int index = findIndex(valueNumber);
if (index < 0) {
addEntry(index, valueNumber, lockCount);
} else {
array[index + 1] = lockCount;
}
} | [
"public",
"void",
"setLockCount",
"(",
"int",
"valueNumber",
",",
"int",
"lockCount",
")",
"{",
"int",
"index",
"=",
"findIndex",
"(",
"valueNumber",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"addEntry",
"(",
"index",
",",
"valueNumber",
",",
"... | Set the lock count for a lock object.
@param valueNumber
value number of the lock object
@param lockCount
the lock count for the lock | [
"Set",
"the",
"lock",
"count",
"for",
"a",
"lock",
"object",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/LockSet.java#L103-L110 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.