repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java | QrCodeUtil.encode | public static BitMatrix encode(String content, BarcodeFormat format, int width, int height) {
return encode(content, format, new QrConfig(width, height));
} | java | public static BitMatrix encode(String content, BarcodeFormat format, int width, int height) {
return encode(content, format, new QrConfig(width, height));
} | [
"public",
"static",
"BitMatrix",
"encode",
"(",
"String",
"content",
",",
"BarcodeFormat",
"format",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"return",
"encode",
"(",
"content",
",",
"format",
",",
"new",
"QrConfig",
"(",
"width",
",",
"height"... | 将文本内容编码为条形码或二维码
@param content 文本内容
@param format 格式枚举
@param width 宽度
@param height 高度
@return {@link BitMatrix} | [
"将文本内容编码为条形码或二维码"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L234-L236 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/model/PropertyHelper.java | PropertyHelper.toBoolean | public static boolean toBoolean(String value, boolean defaultValue)
{
return "true".equals(value) ? true : ("false".equals(value) ? false : defaultValue);
} | java | public static boolean toBoolean(String value, boolean defaultValue)
{
return "true".equals(value) ? true : ("false".equals(value) ? false : defaultValue);
} | [
"public",
"static",
"boolean",
"toBoolean",
"(",
"String",
"value",
",",
"boolean",
"defaultValue",
")",
"{",
"return",
"\"true\"",
".",
"equals",
"(",
"value",
")",
"?",
"true",
":",
"(",
"\"false\"",
".",
"equals",
"(",
"value",
")",
"?",
"false",
":",... | Determines whether the boolean value of the given string value.
@param value The value
@param defaultValue The boolean value to use if the string value is neither 'true' nor 'false'
@return The boolean value of the string | [
"Determines",
"whether",
"the",
"boolean",
"value",
"of",
"the",
"given",
"string",
"value",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/PropertyHelper.java#L256-L259 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java | SegmentAggregator.aggregateAppendOperation | private void aggregateAppendOperation(CachedStreamSegmentAppendOperation operation, AggregatedAppendOperation aggregatedAppend) {
long remainingLength = operation.getLength();
if (operation.getStreamSegmentOffset() < aggregatedAppend.getLastStreamSegmentOffset()) {
// The given operation begins before the AggregatedAppendOperation. This is likely due to it having been
// partially written to Storage prior to some recovery event. We must make sure we only include the part that
// has not yet been written.
long delta = aggregatedAppend.getLastStreamSegmentOffset() - operation.getStreamSegmentOffset();
remainingLength -= delta;
log.debug("{}: Skipping {} bytes from the beginning of '{}' since it has already been partially written to Storage.", this.traceObjectId, delta, operation);
}
// We only include the attributes in the first AggregatedAppend of an Append (it makes no difference if we had
// chosen to do so in the last one, as long as we are consistent).
aggregatedAppend.includeAttributes(getExtendedAttributes(operation));
while (remainingLength > 0) {
// All append lengths are integers, so it's safe to cast here.
int lengthToAdd = (int) Math.min(this.config.getMaxFlushSizeBytes() - aggregatedAppend.getLength(), remainingLength);
aggregatedAppend.increaseLength(lengthToAdd);
remainingLength -= lengthToAdd;
if (remainingLength > 0) {
// We still have data to add, which means we filled up the current AggregatedAppend; make a new one.
aggregatedAppend = new AggregatedAppendOperation(this.metadata.getId(), aggregatedAppend.getLastStreamSegmentOffset(), operation.getSequenceNumber());
this.operations.add(aggregatedAppend);
}
}
} | java | private void aggregateAppendOperation(CachedStreamSegmentAppendOperation operation, AggregatedAppendOperation aggregatedAppend) {
long remainingLength = operation.getLength();
if (operation.getStreamSegmentOffset() < aggregatedAppend.getLastStreamSegmentOffset()) {
// The given operation begins before the AggregatedAppendOperation. This is likely due to it having been
// partially written to Storage prior to some recovery event. We must make sure we only include the part that
// has not yet been written.
long delta = aggregatedAppend.getLastStreamSegmentOffset() - operation.getStreamSegmentOffset();
remainingLength -= delta;
log.debug("{}: Skipping {} bytes from the beginning of '{}' since it has already been partially written to Storage.", this.traceObjectId, delta, operation);
}
// We only include the attributes in the first AggregatedAppend of an Append (it makes no difference if we had
// chosen to do so in the last one, as long as we are consistent).
aggregatedAppend.includeAttributes(getExtendedAttributes(operation));
while (remainingLength > 0) {
// All append lengths are integers, so it's safe to cast here.
int lengthToAdd = (int) Math.min(this.config.getMaxFlushSizeBytes() - aggregatedAppend.getLength(), remainingLength);
aggregatedAppend.increaseLength(lengthToAdd);
remainingLength -= lengthToAdd;
if (remainingLength > 0) {
// We still have data to add, which means we filled up the current AggregatedAppend; make a new one.
aggregatedAppend = new AggregatedAppendOperation(this.metadata.getId(), aggregatedAppend.getLastStreamSegmentOffset(), operation.getSequenceNumber());
this.operations.add(aggregatedAppend);
}
}
} | [
"private",
"void",
"aggregateAppendOperation",
"(",
"CachedStreamSegmentAppendOperation",
"operation",
",",
"AggregatedAppendOperation",
"aggregatedAppend",
")",
"{",
"long",
"remainingLength",
"=",
"operation",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"operation",
"... | Aggregates the given operation by recording the fact that it exists in the current Aggregated Append.
An Aggregated Append cannot exceed a certain size, so if the given operation doesn't fit, it will need to
span multiple AggregatedAppends.
When aggregating, the SequenceNumber of the AggregatedAppend is the sequence number of the operation
that occupies its first byte. As such, getLowestUncommittedSequenceNumber() will always return the SeqNo
of that first operation that hasn't yet been fully flushed.
@param operation The operation to aggregate.
@param aggregatedAppend The AggregatedAppend to add to. | [
"Aggregates",
"the",
"given",
"operation",
"by",
"recording",
"the",
"fact",
"that",
"it",
"exists",
"in",
"the",
"current",
"Aggregated",
"Append",
".",
"An",
"Aggregated",
"Append",
"cannot",
"exceed",
"a",
"certain",
"size",
"so",
"if",
"the",
"given",
"o... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java#L463-L488 |
Erudika/para | para-client/src/main/java/com/erudika/para/client/ParaClient.java | ParaClient.getCount | public Long getCount(String type, Map<String, ?> terms) {
if (terms == null) {
return 0L;
}
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
LinkedList<String> list = new LinkedList<>();
for (Map.Entry<String, ? extends Object> term : terms.entrySet()) {
String key = term.getKey();
Object value = term.getValue();
if (value != null) {
list.add(key.concat(Config.SEPARATOR).concat(value.toString()));
}
}
if (!terms.isEmpty()) {
params.put("terms", list);
}
params.putSingle(Config._TYPE, type);
params.putSingle("count", "true");
Pager pager = new Pager();
getItems(find("terms", params), pager);
return pager.getCount();
} | java | public Long getCount(String type, Map<String, ?> terms) {
if (terms == null) {
return 0L;
}
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
LinkedList<String> list = new LinkedList<>();
for (Map.Entry<String, ? extends Object> term : terms.entrySet()) {
String key = term.getKey();
Object value = term.getValue();
if (value != null) {
list.add(key.concat(Config.SEPARATOR).concat(value.toString()));
}
}
if (!terms.isEmpty()) {
params.put("terms", list);
}
params.putSingle(Config._TYPE, type);
params.putSingle("count", "true");
Pager pager = new Pager();
getItems(find("terms", params), pager);
return pager.getCount();
} | [
"public",
"Long",
"getCount",
"(",
"String",
"type",
",",
"Map",
"<",
"String",
",",
"?",
">",
"terms",
")",
"{",
"if",
"(",
"terms",
"==",
"null",
")",
"{",
"return",
"0L",
";",
"}",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"params",
"... | Counts indexed objects matching a set of terms/values.
@param type the type of object to search for. See {@link com.erudika.para.core.ParaObject#getType()}
@param terms a list of terms (property values)
@return the number of results found | [
"Counts",
"indexed",
"objects",
"matching",
"a",
"set",
"of",
"terms",
"/",
"values",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L888-L909 |
geomajas/geomajas-project-client-gwt | plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/MultiFeatureListGrid.java | MultiFeatureListGrid.addFeatures | public void addFeatures(Map<VectorLayer, List<Feature>> featureMap, Criterion criterion) {
if (showDetailsOnSingleResult && featureMap.size() == 1) {
// sorting is never needed if only 1 entry
List<Feature> features = featureMap.values().iterator().next();
if (features.size() == 1) {
showFeatureDetailWindow(map, features.get(0));
}
}
//Add feature tabs in map order
for (VectorLayer layer : map.getMapModel().getVectorLayers()) {
if (featureMap.containsKey(layer)) {
addFeatures(layer, featureMap.get(layer), criterion);
}
}
tabset.selectTab(0);
} | java | public void addFeatures(Map<VectorLayer, List<Feature>> featureMap, Criterion criterion) {
if (showDetailsOnSingleResult && featureMap.size() == 1) {
// sorting is never needed if only 1 entry
List<Feature> features = featureMap.values().iterator().next();
if (features.size() == 1) {
showFeatureDetailWindow(map, features.get(0));
}
}
//Add feature tabs in map order
for (VectorLayer layer : map.getMapModel().getVectorLayers()) {
if (featureMap.containsKey(layer)) {
addFeatures(layer, featureMap.get(layer), criterion);
}
}
tabset.selectTab(0);
} | [
"public",
"void",
"addFeatures",
"(",
"Map",
"<",
"VectorLayer",
",",
"List",
"<",
"Feature",
">",
">",
"featureMap",
",",
"Criterion",
"criterion",
")",
"{",
"if",
"(",
"showDetailsOnSingleResult",
"&&",
"featureMap",
".",
"size",
"(",
")",
"==",
"1",
")"... | Add features in the widget for several layers.
@param featureMap map of features per layer
@param criterion the original request for this search | [
"Add",
"features",
"in",
"the",
"widget",
"for",
"several",
"layers",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/MultiFeatureListGrid.java#L168-L184 |
micronaut-projects/micronaut-core | core/src/main/java/io/micronaut/core/async/publisher/Publishers.java | Publishers.convertPublisher | public static <T> T convertPublisher(Object object, Class<T> publisherType) {
Objects.requireNonNull(object, "Invalid argument [object]: " + object);
Objects.requireNonNull(object, "Invalid argument [publisherType]: " + publisherType);
if (object instanceof CompletableFuture) {
@SuppressWarnings("unchecked") Publisher<T> futurePublisher = (Publisher<T>) Publishers.fromCompletableFuture(() -> ((CompletableFuture) object));
return ConversionService.SHARED.convert(futurePublisher, publisherType)
.orElseThrow(() -> new IllegalArgumentException("Unsupported Reactive type: " + object.getClass()));
} else {
return ConversionService.SHARED.convert(object, publisherType)
.orElseThrow(() -> new IllegalArgumentException("Unsupported Reactive type: " + object.getClass()));
}
} | java | public static <T> T convertPublisher(Object object, Class<T> publisherType) {
Objects.requireNonNull(object, "Invalid argument [object]: " + object);
Objects.requireNonNull(object, "Invalid argument [publisherType]: " + publisherType);
if (object instanceof CompletableFuture) {
@SuppressWarnings("unchecked") Publisher<T> futurePublisher = (Publisher<T>) Publishers.fromCompletableFuture(() -> ((CompletableFuture) object));
return ConversionService.SHARED.convert(futurePublisher, publisherType)
.orElseThrow(() -> new IllegalArgumentException("Unsupported Reactive type: " + object.getClass()));
} else {
return ConversionService.SHARED.convert(object, publisherType)
.orElseThrow(() -> new IllegalArgumentException("Unsupported Reactive type: " + object.getClass()));
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"convertPublisher",
"(",
"Object",
"object",
",",
"Class",
"<",
"T",
">",
"publisherType",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"object",
",",
"\"Invalid argument [object]: \"",
"+",
"object",
")",
";",
"Ob... | Attempts to convert the publisher to the given type.
@param object The object to convert
@param publisherType The publisher type
@param <T> The generic type
@return The Resulting in publisher | [
"Attempts",
"to",
"convert",
"the",
"publisher",
"to",
"the",
"given",
"type",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/async/publisher/Publishers.java#L287-L298 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java | AbstractMastersListener.relaunchOperation | public HandleErrorResult relaunchOperation(Method method, Object[] args)
throws IllegalAccessException, InvocationTargetException {
HandleErrorResult handleErrorResult = new HandleErrorResult(true);
if (method != null) {
switch (method.getName()) {
case "executeQuery":
if (args[2] instanceof String) {
String query = ((String) args[2]).toUpperCase(Locale.ROOT);
if (!"ALTER SYSTEM CRASH".equals(query)
&& !query.startsWith("KILL")) {
logger.debug("relaunch query to new connection {}",
((currentProtocol != null) ? "(conn=" + currentProtocol.getServerThreadId() + ")"
: ""));
handleErrorResult.resultObject = method.invoke(currentProtocol, args);
handleErrorResult.mustThrowError = false;
}
}
break;
case "executePreparedQuery":
//the statementId has been discarded with previous session
try {
boolean mustBeOnMaster = (Boolean) args[0];
ServerPrepareResult oldServerPrepareResult = (ServerPrepareResult) args[1];
ServerPrepareResult serverPrepareResult = currentProtocol
.prepare(oldServerPrepareResult.getSql(), mustBeOnMaster);
oldServerPrepareResult.failover(serverPrepareResult.getStatementId(), currentProtocol);
logger.debug("relaunch query to new connection "
+ ((currentProtocol != null) ? "server thread id " + currentProtocol
.getServerThreadId() : ""));
handleErrorResult.resultObject = method.invoke(currentProtocol, args);
handleErrorResult.mustThrowError = false;
} catch (Exception e) {
//if retry prepare fail, discard error. execution error will indicate the error.
}
break;
default:
handleErrorResult.resultObject = method.invoke(currentProtocol, args);
handleErrorResult.mustThrowError = false;
break;
}
}
return handleErrorResult;
} | java | public HandleErrorResult relaunchOperation(Method method, Object[] args)
throws IllegalAccessException, InvocationTargetException {
HandleErrorResult handleErrorResult = new HandleErrorResult(true);
if (method != null) {
switch (method.getName()) {
case "executeQuery":
if (args[2] instanceof String) {
String query = ((String) args[2]).toUpperCase(Locale.ROOT);
if (!"ALTER SYSTEM CRASH".equals(query)
&& !query.startsWith("KILL")) {
logger.debug("relaunch query to new connection {}",
((currentProtocol != null) ? "(conn=" + currentProtocol.getServerThreadId() + ")"
: ""));
handleErrorResult.resultObject = method.invoke(currentProtocol, args);
handleErrorResult.mustThrowError = false;
}
}
break;
case "executePreparedQuery":
//the statementId has been discarded with previous session
try {
boolean mustBeOnMaster = (Boolean) args[0];
ServerPrepareResult oldServerPrepareResult = (ServerPrepareResult) args[1];
ServerPrepareResult serverPrepareResult = currentProtocol
.prepare(oldServerPrepareResult.getSql(), mustBeOnMaster);
oldServerPrepareResult.failover(serverPrepareResult.getStatementId(), currentProtocol);
logger.debug("relaunch query to new connection "
+ ((currentProtocol != null) ? "server thread id " + currentProtocol
.getServerThreadId() : ""));
handleErrorResult.resultObject = method.invoke(currentProtocol, args);
handleErrorResult.mustThrowError = false;
} catch (Exception e) {
//if retry prepare fail, discard error. execution error will indicate the error.
}
break;
default:
handleErrorResult.resultObject = method.invoke(currentProtocol, args);
handleErrorResult.mustThrowError = false;
break;
}
}
return handleErrorResult;
} | [
"public",
"HandleErrorResult",
"relaunchOperation",
"(",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"HandleErrorResult",
"handleErrorResult",
"=",
"new",
"HandleErrorResult",
"(",
... | After a failover that has bean done, relaunch the operation that was in progress. In case of
special operation that crash server, doesn't relaunched it;
@param method the methode accessed
@param args the parameters
@return An object that indicate the result or that the exception as to be thrown
@throws IllegalAccessException if the initial call is not permit
@throws InvocationTargetException if there is any error relaunching initial method | [
"After",
"a",
"failover",
"that",
"has",
"bean",
"done",
"relaunch",
"the",
"operation",
"that",
"was",
"in",
"progress",
".",
"In",
"case",
"of",
"special",
"operation",
"that",
"crash",
"server",
"doesn",
"t",
"relaunched",
"it",
";"
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java#L306-L351 |
liferay/com-liferay-commerce | commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPOptionValueWrapper.java | CPOptionValueWrapper.getName | @Override
public String getName(String languageId, boolean useDefault) {
return _cpOptionValue.getName(languageId, useDefault);
} | java | @Override
public String getName(String languageId, boolean useDefault) {
return _cpOptionValue.getName(languageId, useDefault);
} | [
"@",
"Override",
"public",
"String",
"getName",
"(",
"String",
"languageId",
",",
"boolean",
"useDefault",
")",
"{",
"return",
"_cpOptionValue",
".",
"getName",
"(",
"languageId",
",",
"useDefault",
")",
";",
"}"
] | Returns the localized name of this cp option value in the language, optionally using the default language if no localization exists for the requested language.
@param languageId the ID of the language
@param useDefault whether to use the default language if no localization exists for the requested language
@return the localized name of this cp option value | [
"Returns",
"the",
"localized",
"name",
"of",
"this",
"cp",
"option",
"value",
"in",
"the",
"language",
"optionally",
"using",
"the",
"default",
"language",
"if",
"no",
"localization",
"exists",
"for",
"the",
"requested",
"language",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPOptionValueWrapper.java#L341-L344 |
census-instrumentation/opencensus-java | contrib/dropwizard/src/main/java/io/opencensus/contrib/dropwizard/DropWizardMetrics.java | DropWizardMetrics.collectMeter | private Metric collectMeter(String dropwizardName, Meter meter) {
String metricName = DropWizardUtils.generateFullMetricName(dropwizardName, "meter");
String metricDescription = DropWizardUtils.generateFullMetricDescription(dropwizardName, meter);
MetricDescriptor metricDescriptor =
MetricDescriptor.create(
metricName,
metricDescription,
DEFAULT_UNIT,
Type.CUMULATIVE_INT64,
Collections.<LabelKey>emptyList());
TimeSeries timeSeries =
TimeSeries.createWithOnePoint(
Collections.<LabelValue>emptyList(),
Point.create(Value.longValue(meter.getCount()), clock.now()),
cumulativeStartTimestamp);
return Metric.createWithOneTimeSeries(metricDescriptor, timeSeries);
} | java | private Metric collectMeter(String dropwizardName, Meter meter) {
String metricName = DropWizardUtils.generateFullMetricName(dropwizardName, "meter");
String metricDescription = DropWizardUtils.generateFullMetricDescription(dropwizardName, meter);
MetricDescriptor metricDescriptor =
MetricDescriptor.create(
metricName,
metricDescription,
DEFAULT_UNIT,
Type.CUMULATIVE_INT64,
Collections.<LabelKey>emptyList());
TimeSeries timeSeries =
TimeSeries.createWithOnePoint(
Collections.<LabelValue>emptyList(),
Point.create(Value.longValue(meter.getCount()), clock.now()),
cumulativeStartTimestamp);
return Metric.createWithOneTimeSeries(metricDescriptor, timeSeries);
} | [
"private",
"Metric",
"collectMeter",
"(",
"String",
"dropwizardName",
",",
"Meter",
"meter",
")",
"{",
"String",
"metricName",
"=",
"DropWizardUtils",
".",
"generateFullMetricName",
"(",
"dropwizardName",
",",
"\"meter\"",
")",
";",
"String",
"metricDescription",
"=... | Returns a {@code Metric} collected from {@link Meter}.
@param dropwizardName the metric name.
@param meter the meter object to collect
@return a {@code Metric}. | [
"Returns",
"a",
"{",
"@code",
"Metric",
"}",
"collected",
"from",
"{",
"@link",
"Meter",
"}",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/dropwizard/src/main/java/io/opencensus/contrib/dropwizard/DropWizardMetrics.java#L168-L186 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/edge/GradientToEdgeFeatures.java | GradientToEdgeFeatures.direction | static public void direction(GrayF32 derivX , GrayF32 derivY , GrayF32 angle )
{
InputSanityCheck.checkSameShape(derivX,derivY);
angle.reshape(derivX.width,derivX.height);
if(BoofConcurrency.USE_CONCURRENT ) {
ImplGradientToEdgeFeatures_MT.direction(derivX,derivY,angle);
} else {
ImplGradientToEdgeFeatures.direction(derivX,derivY,angle);
}
} | java | static public void direction(GrayF32 derivX , GrayF32 derivY , GrayF32 angle )
{
InputSanityCheck.checkSameShape(derivX,derivY);
angle.reshape(derivX.width,derivX.height);
if(BoofConcurrency.USE_CONCURRENT ) {
ImplGradientToEdgeFeatures_MT.direction(derivX,derivY,angle);
} else {
ImplGradientToEdgeFeatures.direction(derivX,derivY,angle);
}
} | [
"static",
"public",
"void",
"direction",
"(",
"GrayF32",
"derivX",
",",
"GrayF32",
"derivY",
",",
"GrayF32",
"angle",
")",
"{",
"InputSanityCheck",
".",
"checkSameShape",
"(",
"derivX",
",",
"derivY",
")",
";",
"angle",
".",
"reshape",
"(",
"derivX",
".",
... | Computes the edge orientation using the {@link Math#atan} function.
@param derivX Derivative along x-axis. Not modified.
@param derivY Derivative along y-axis. Not modified.
@param angle Edge orientation in radians (-pi/2 to pi/2). | [
"Computes",
"the",
"edge",
"orientation",
"using",
"the",
"{",
"@link",
"Math#atan",
"}",
"function",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/edge/GradientToEdgeFeatures.java#L99-L109 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/CreateApplicationRequest.java | CreateApplicationRequest.withTags | public CreateApplicationRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public CreateApplicationRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"CreateApplicationRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | The Tags for the app.
@param tags
The Tags for the app.
@return Returns a reference to this object so that method calls can be chained together. | [
"The",
"Tags",
"for",
"the",
"app",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/CreateApplicationRequest.java#L97-L100 |
twilio/twilio-java | src/main/java/com/twilio/rest/voice/v1/dialingpermissions/CountryReader.java | CountryReader.previousPage | @Override
public Page<Country> previousPage(final Page<Country> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getPreviousPageUrl(
Domains.VOICE.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | java | @Override
public Page<Country> previousPage(final Page<Country> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getPreviousPageUrl(
Domains.VOICE.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | [
"@",
"Override",
"public",
"Page",
"<",
"Country",
">",
"previousPage",
"(",
"final",
"Page",
"<",
"Country",
">",
"page",
",",
"final",
"TwilioRestClient",
"client",
")",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"HttpMethod",
".",
"GET",
","... | Retrieve the previous page from the Twilio API.
@param page current page
@param client TwilioRestClient with which to make the request
@return Previous Page | [
"Retrieve",
"the",
"previous",
"page",
"from",
"the",
"Twilio",
"API",
"."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/voice/v1/dialingpermissions/CountryReader.java#L190-L201 |
linkhub-sdk/popbill.sdk.java | src/main/java/com/popbill/api/cashbill/CashbillServiceImp.java | CashbillServiceImp.sendSMS | @Override
public Response sendSMS(String CorpNum, String MgtKey, String Sender,
String Receiver, String Contents)
throws PopbillException {
if (MgtKey == null || MgtKey.isEmpty())
throw new PopbillException(-99999999, "관리번호가 입력되지 않았습니다.");
return sendSMS(CorpNum, MgtKey, Sender, Receiver, Contents, null);
} | java | @Override
public Response sendSMS(String CorpNum, String MgtKey, String Sender,
String Receiver, String Contents)
throws PopbillException {
if (MgtKey == null || MgtKey.isEmpty())
throw new PopbillException(-99999999, "관리번호가 입력되지 않았습니다.");
return sendSMS(CorpNum, MgtKey, Sender, Receiver, Contents, null);
} | [
"@",
"Override",
"public",
"Response",
"sendSMS",
"(",
"String",
"CorpNum",
",",
"String",
"MgtKey",
",",
"String",
"Sender",
",",
"String",
"Receiver",
",",
"String",
"Contents",
")",
"throws",
"PopbillException",
"{",
"if",
"(",
"MgtKey",
"==",
"null",
"||... | /* (non-Javadoc)
@see com.popbill.api.CashbillService#sendSMS(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/linkhub-sdk/popbill.sdk.java/blob/63a341fefe96d60a368776638f3d4c81888238b7/src/main/java/com/popbill/api/cashbill/CashbillServiceImp.java#L262-L270 |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.addEntry | public Jar addEntry(String path, byte[] content) throws IOException {
beginWriting();
addEntry(jos, path, content);
return this;
} | java | public Jar addEntry(String path, byte[] content) throws IOException {
beginWriting();
addEntry(jos, path, content);
return this;
} | [
"public",
"Jar",
"addEntry",
"(",
"String",
"path",
",",
"byte",
"[",
"]",
"content",
")",
"throws",
"IOException",
"{",
"beginWriting",
"(",
")",
";",
"addEntry",
"(",
"jos",
",",
"path",
",",
"content",
")",
";",
"return",
"this",
";",
"}"
] | Adds an entry to this JAR.
@param path the entry's path within the JAR
@param content the entry's content
@return {@code this} | [
"Adds",
"an",
"entry",
"to",
"this",
"JAR",
"."
] | train | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L308-L312 |
kuali/ojb-1.0.4 | src/ejb/org/apache/ojb/ejb/pb/RollbackBean.java | RollbackBean.rollbackClientWrongInput | public void rollbackClientWrongInput(List articles, List persons)
{
log.info("rollbackClientWrongInput method was called");
ArticleManagerPBLocal am = getArticleManager();
PersonManagerPBLocal pm = getPersonManager();
am.storeArticles(articles);
pm.storePersons(persons);
} | java | public void rollbackClientWrongInput(List articles, List persons)
{
log.info("rollbackClientWrongInput method was called");
ArticleManagerPBLocal am = getArticleManager();
PersonManagerPBLocal pm = getPersonManager();
am.storeArticles(articles);
pm.storePersons(persons);
} | [
"public",
"void",
"rollbackClientWrongInput",
"(",
"List",
"articles",
",",
"List",
"persons",
")",
"{",
"log",
".",
"info",
"(",
"\"rollbackClientWrongInput method was called\"",
")",
";",
"ArticleManagerPBLocal",
"am",
"=",
"getArticleManager",
"(",
")",
";",
"Per... | This test method expect an invalid object in the person list,
so that OJB cause an internal error.
@ejb:interface-method | [
"This",
"test",
"method",
"expect",
"an",
"invalid",
"object",
"in",
"the",
"person",
"list",
"so",
"that",
"OJB",
"cause",
"an",
"internal",
"error",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/ejb/org/apache/ojb/ejb/pb/RollbackBean.java#L132-L139 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/ModuleInitDataFactory.java | ModuleInitDataFactory.getManagedBeansInternalEJBName | private String getManagedBeansInternalEJBName(ClassInfo classInfo, AnnotationInfo managedBeanAnn) {
String name = getStringValue(managedBeanAnn, "value");
if (name == null) {
name = '$' + classInfo.getName();
}
return name;
} | java | private String getManagedBeansInternalEJBName(ClassInfo classInfo, AnnotationInfo managedBeanAnn) {
String name = getStringValue(managedBeanAnn, "value");
if (name == null) {
name = '$' + classInfo.getName();
}
return name;
} | [
"private",
"String",
"getManagedBeansInternalEJBName",
"(",
"ClassInfo",
"classInfo",
",",
"AnnotationInfo",
"managedBeanAnn",
")",
"{",
"String",
"name",
"=",
"getStringValue",
"(",
"managedBeanAnn",
",",
"\"value\"",
")",
";",
"if",
"(",
"name",
"==",
"null",
")... | Return the ManagedBean name to be used internally by the EJBContainer.
The internal ManagedBean name is the value on the annotation (which
must be unique even compared to EJBs in the module) or the class name
of the ManagedBean with a $ prefix. This is done for two reasons:
1 - when a name is not specified, our internal derived name cannot
conflict with other EJB names that happen to be the same.
2 - when a name is not specified, the managed bean is not supposed
to be bound into naming... the '$' will tip off the binding code.
'$' is used for consistency with JDK synthesized names. | [
"Return",
"the",
"ManagedBean",
"name",
"to",
"be",
"used",
"internally",
"by",
"the",
"EJBContainer",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/ModuleInitDataFactory.java#L882-L888 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/platforms/PlatformSybaseASAImpl.java | PlatformSybaseASAImpl.initializeJdbcConnection | public void initializeJdbcConnection(JdbcConnectionDescriptor jcd, Connection conn) throws PlatformException
{
// Do origial init
super.initializeJdbcConnection(jcd, conn);
// Execute a statement setting the tempory option
try
{
Statement stmt = conn.createStatement();
stmt.executeUpdate("set temporary option RETURN_DATE_TIME_AS_STRING = On");
}
catch (SQLException e)
{
throw new PlatformException(e);
}
} | java | public void initializeJdbcConnection(JdbcConnectionDescriptor jcd, Connection conn) throws PlatformException
{
// Do origial init
super.initializeJdbcConnection(jcd, conn);
// Execute a statement setting the tempory option
try
{
Statement stmt = conn.createStatement();
stmt.executeUpdate("set temporary option RETURN_DATE_TIME_AS_STRING = On");
}
catch (SQLException e)
{
throw new PlatformException(e);
}
} | [
"public",
"void",
"initializeJdbcConnection",
"(",
"JdbcConnectionDescriptor",
"jcd",
",",
"Connection",
"conn",
")",
"throws",
"PlatformException",
"{",
"// Do origial init\r",
"super",
".",
"initializeJdbcConnection",
"(",
"jcd",
",",
"conn",
")",
";",
"// Execute a s... | Sybase Adaptive Server Enterprise (ASE) support timestamp to a precision of 1/300th of second.
Adaptive Server Anywhere (ASA) support timestamp to a precision of 1/1000000tho of second.
Sybase JDBC driver (JConnect) retrieving timestamp always rounds to 1/300th sec., causing rounding
problems with ASA when retrieving Timestamp fields.
This work around was suggested by Sybase Support. Unfortunately it works only with ASA.
<br/>
author Lorenzo Nicora | [
"Sybase",
"Adaptive",
"Server",
"Enterprise",
"(",
"ASE",
")",
"support",
"timestamp",
"to",
"a",
"precision",
"of",
"1",
"/",
"300th",
"of",
"second",
".",
"Adaptive",
"Server",
"Anywhere",
"(",
"ASA",
")",
"support",
"timestamp",
"to",
"a",
"precision",
... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/platforms/PlatformSybaseASAImpl.java#L47-L61 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/xspec/SS.java | SS.ifNotExists | public IfNotExistsFunction<SS> ifNotExists(String... defaultValue) {
return new IfNotExistsFunction<SS>(this, new LiteralOperand(
new LinkedHashSet<String>(Arrays.asList(defaultValue))));
} | java | public IfNotExistsFunction<SS> ifNotExists(String... defaultValue) {
return new IfNotExistsFunction<SS>(this, new LiteralOperand(
new LinkedHashSet<String>(Arrays.asList(defaultValue))));
} | [
"public",
"IfNotExistsFunction",
"<",
"SS",
">",
"ifNotExists",
"(",
"String",
"...",
"defaultValue",
")",
"{",
"return",
"new",
"IfNotExistsFunction",
"<",
"SS",
">",
"(",
"this",
",",
"new",
"LiteralOperand",
"(",
"new",
"LinkedHashSet",
"<",
"String",
">",
... | Returns an <code>IfNotExistsFunction</code> object which represents an <a href=
"http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Modifying.html"
>if_not_exists(path, operand)</a> function call where path refers to that
of the current path operand; used for building expressions.
<pre>
"if_not_exists (path, operand) – If the item does not contain an attribute
at the specified path, then if_not_exists evaluates to operand; otherwise,
it evaluates to path. You can use this function to avoid overwriting an
attribute already present in the item."
</pre>
@param defaultValue
the default value that will be used as the operand to the
if_not_exists function call. | [
"Returns",
"an",
"<code",
">",
"IfNotExistsFunction<",
"/",
"code",
">",
"object",
"which",
"represents",
"an",
"<a",
"href",
"=",
"http",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"amazondynamodb",
"/",
"latest",
"/",
"developerguide"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/xspec/SS.java#L190-L193 |
mikepenz/FastAdapter | library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java | FastAdapterDialog.withPositiveButton | public FastAdapterDialog<Item> withPositiveButton(@StringRes int textRes, OnClickListener listener) {
return withButton(BUTTON_POSITIVE, textRes, listener);
} | java | public FastAdapterDialog<Item> withPositiveButton(@StringRes int textRes, OnClickListener listener) {
return withButton(BUTTON_POSITIVE, textRes, listener);
} | [
"public",
"FastAdapterDialog",
"<",
"Item",
">",
"withPositiveButton",
"(",
"@",
"StringRes",
"int",
"textRes",
",",
"OnClickListener",
"listener",
")",
"{",
"return",
"withButton",
"(",
"BUTTON_POSITIVE",
",",
"textRes",
",",
"listener",
")",
";",
"}"
] | Set a listener to be invoked when the positive button of the dialog is pressed.
@param textRes The resource id of the text to display in the positive button
@param listener The {@link DialogInterface.OnClickListener} to use.
@return This Builder object to allow for chaining of calls to set methods | [
"Set",
"a",
"listener",
"to",
"be",
"invoked",
"when",
"the",
"positive",
"button",
"of",
"the",
"dialog",
"is",
"pressed",
"."
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java#L142-L144 |
lucee/Lucee | core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java | CFMLEngineImpl.getInstance | public static synchronized CFMLEngine getInstance(CFMLEngineFactory factory, BundleCollection bc) {
if (engine == null) {
if (SystemUtil.getLoaderVersion() < 6.0D) {
// windows needs 6.0 because restart is not working with older versions
if (SystemUtil.isWindows())
throw new RuntimeException("You need to update a newer lucee.jar to run this version, you can download the latest jar from http://download.lucee.org.");
else if (SystemUtil.getLoaderVersion() < 5.8D)
throw new RuntimeException("You need to update your lucee.jar to run this version, you can download the latest jar from http://download.lucee.org.");
else if (SystemUtil.getLoaderVersion() < 5.9D)
SystemOut.printDate("To use all features Lucee provides, you need to update your lucee.jar, you can download the latest jar from http://download.lucee.org.");
}
engine = new CFMLEngineImpl(factory, bc);
}
return engine;
} | java | public static synchronized CFMLEngine getInstance(CFMLEngineFactory factory, BundleCollection bc) {
if (engine == null) {
if (SystemUtil.getLoaderVersion() < 6.0D) {
// windows needs 6.0 because restart is not working with older versions
if (SystemUtil.isWindows())
throw new RuntimeException("You need to update a newer lucee.jar to run this version, you can download the latest jar from http://download.lucee.org.");
else if (SystemUtil.getLoaderVersion() < 5.8D)
throw new RuntimeException("You need to update your lucee.jar to run this version, you can download the latest jar from http://download.lucee.org.");
else if (SystemUtil.getLoaderVersion() < 5.9D)
SystemOut.printDate("To use all features Lucee provides, you need to update your lucee.jar, you can download the latest jar from http://download.lucee.org.");
}
engine = new CFMLEngineImpl(factory, bc);
}
return engine;
} | [
"public",
"static",
"synchronized",
"CFMLEngine",
"getInstance",
"(",
"CFMLEngineFactory",
"factory",
",",
"BundleCollection",
"bc",
")",
"{",
"if",
"(",
"engine",
"==",
"null",
")",
"{",
"if",
"(",
"SystemUtil",
".",
"getLoaderVersion",
"(",
")",
"<",
"6.0D",... | get singelton instance of the CFML Engine
@param factory
@return CFMLEngine | [
"get",
"singelton",
"instance",
"of",
"the",
"CFML",
"Engine"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java#L592-L607 |
jeremylong/DependencyCheck | maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java | BaseDependencyCheckMojo.scanArtifacts | protected ExceptionCollection scanArtifacts(MavenProject project, Engine engine) {
return scanArtifacts(project, engine, false);
} | java | protected ExceptionCollection scanArtifacts(MavenProject project, Engine engine) {
return scanArtifacts(project, engine, false);
} | [
"protected",
"ExceptionCollection",
"scanArtifacts",
"(",
"MavenProject",
"project",
",",
"Engine",
"engine",
")",
"{",
"return",
"scanArtifacts",
"(",
"project",
",",
"engine",
",",
"false",
")",
";",
"}"
] | Scans the project's artifacts and adds them to the engine's dependency
list.
@param project the project to scan the dependencies of
@param engine the engine to use to scan the dependencies
@return a collection of exceptions that may have occurred while resolving
and scanning the dependencies | [
"Scans",
"the",
"project",
"s",
"artifacts",
"and",
"adds",
"them",
"to",
"the",
"engine",
"s",
"dependency",
"list",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java#L829-L831 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/bcp/OneVariableInstruction.java | OneVariableInstruction.addOrCheckDefinition | protected MatchResult addOrCheckDefinition(Variable variable, BindingSet bindingSet) {
bindingSet = addOrCheckDefinition(varName, variable, bindingSet);
return bindingSet != null ? new MatchResult(this, bindingSet) : null;
} | java | protected MatchResult addOrCheckDefinition(Variable variable, BindingSet bindingSet) {
bindingSet = addOrCheckDefinition(varName, variable, bindingSet);
return bindingSet != null ? new MatchResult(this, bindingSet) : null;
} | [
"protected",
"MatchResult",
"addOrCheckDefinition",
"(",
"Variable",
"variable",
",",
"BindingSet",
"bindingSet",
")",
"{",
"bindingSet",
"=",
"addOrCheckDefinition",
"(",
"varName",
",",
"variable",
",",
"bindingSet",
")",
";",
"return",
"bindingSet",
"!=",
"null",... | Add a variable definition to the given BindingSet, or if there is an
existing definition, make sure it is consistent with the new definition.
@param variable
the Variable which should be added or checked for consistency
@param bindingSet
the existing set of bindings
@return a MatchResult containing the updated BindingSet (if the variable
is consistent with the previous bindings), or null if the new
variable is inconsistent with the previous bindings | [
"Add",
"a",
"variable",
"definition",
"to",
"the",
"given",
"BindingSet",
"or",
"if",
"there",
"is",
"an",
"existing",
"definition",
"make",
"sure",
"it",
"is",
"consistent",
"with",
"the",
"new",
"definition",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/bcp/OneVariableInstruction.java#L53-L56 |
hsiafan/requests | src/main/java/net/dongliu/requests/utils/CookieDateUtil.java | CookieDateUtil.parseDate | @Nullable
public static Date parseDate(String dateValue, Collection<String> dateFormats, Date startDate) {
// trim single quotes around date if present
// see issue #5279
if (dateValue.length() > 1 && dateValue.startsWith("'") && dateValue.endsWith("'")) {
dateValue = dateValue.substring(1, dateValue.length() - 1);
}
SimpleDateFormat dateParser = null;
for (String format : dateFormats) {
if (dateParser == null) {
dateParser = new SimpleDateFormat(format, Locale.US);
dateParser.setTimeZone(TimeZone.getTimeZone("GMT"));
dateParser.set2DigitYearStart(startDate);
} else {
dateParser.applyPattern(format);
}
try {
return dateParser.parse(dateValue);
} catch (ParseException pe) {
// ignore this exception, we will try the next format
}
}
// we were unable to parse the date
return null;
} | java | @Nullable
public static Date parseDate(String dateValue, Collection<String> dateFormats, Date startDate) {
// trim single quotes around date if present
// see issue #5279
if (dateValue.length() > 1 && dateValue.startsWith("'") && dateValue.endsWith("'")) {
dateValue = dateValue.substring(1, dateValue.length() - 1);
}
SimpleDateFormat dateParser = null;
for (String format : dateFormats) {
if (dateParser == null) {
dateParser = new SimpleDateFormat(format, Locale.US);
dateParser.setTimeZone(TimeZone.getTimeZone("GMT"));
dateParser.set2DigitYearStart(startDate);
} else {
dateParser.applyPattern(format);
}
try {
return dateParser.parse(dateValue);
} catch (ParseException pe) {
// ignore this exception, we will try the next format
}
}
// we were unable to parse the date
return null;
} | [
"@",
"Nullable",
"public",
"static",
"Date",
"parseDate",
"(",
"String",
"dateValue",
",",
"Collection",
"<",
"String",
">",
"dateFormats",
",",
"Date",
"startDate",
")",
"{",
"// trim single quotes around date if present",
"// see issue #5279",
"if",
"(",
"dateValue"... | Parses the date value using the given date formats.
@param dateValue the date value to parse
@param dateFormats the date formats to use
@param startDate During parsing, two digit years will be placed in the range
<code>startDate</code> to <code>startDate + 100 years</code>. This value may
be <code>null</code>. When <code>null</code> is given as a parameter, year
<code>2000</code> will be used.
@return the parsed date | [
"Parses",
"the",
"date",
"value",
"using",
"the",
"given",
"date",
"formats",
"."
] | train | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/utils/CookieDateUtil.java#L86-L113 |
google/closure-templates | java/src/com/google/template/soy/pysrc/restricted/PyExprUtils.java | PyExprUtils.wrapAsSanitizedContent | @Deprecated
public static PyExpr wrapAsSanitizedContent(ContentKind contentKind, PyExpr pyExpr) {
String sanitizer =
NodeContentKinds.toPySanitizedContentOrdainer(
SanitizedContentKind.valueOf(contentKind.name()));
String approval =
"sanitize.IActuallyUnderstandSoyTypeSafetyAndHaveSecurityApproval("
+ "'Internally created Sanitization.')";
return new PyExpr(
sanitizer + "(" + pyExpr.getText() + ", approval=" + approval + ")", Integer.MAX_VALUE);
} | java | @Deprecated
public static PyExpr wrapAsSanitizedContent(ContentKind contentKind, PyExpr pyExpr) {
String sanitizer =
NodeContentKinds.toPySanitizedContentOrdainer(
SanitizedContentKind.valueOf(contentKind.name()));
String approval =
"sanitize.IActuallyUnderstandSoyTypeSafetyAndHaveSecurityApproval("
+ "'Internally created Sanitization.')";
return new PyExpr(
sanitizer + "(" + pyExpr.getText() + ", approval=" + approval + ")", Integer.MAX_VALUE);
} | [
"@",
"Deprecated",
"public",
"static",
"PyExpr",
"wrapAsSanitizedContent",
"(",
"ContentKind",
"contentKind",
",",
"PyExpr",
"pyExpr",
")",
"{",
"String",
"sanitizer",
"=",
"NodeContentKinds",
".",
"toPySanitizedContentOrdainer",
"(",
"SanitizedContentKind",
".",
"value... | Wraps an expression with the proper SanitizedContent constructor.
<p>NOTE: The pyExpr provided must be properly escaped for the given ContentKind. Please talk to
ISE (ise@) for any questions or concerns.
@param contentKind The kind of sanitized content.
@param pyExpr The expression to wrap.
@deprecated this method is not safe to use without a security review. Do not use it. | [
"Wraps",
"an",
"expression",
"with",
"the",
"proper",
"SanitizedContent",
"constructor",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/restricted/PyExprUtils.java#L174-L184 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/doc/DocClient.java | DocClient.createDocumentFromBos | public CreateDocumentFromBosResponse createDocumentFromBos(CreateDocumentFromBosRequest request) {
checkNotNull(request, "request should not be null.");
checkNotNull(request.getBucket(), "bucket should not be null.");
checkNotNull(request.getObject(), "object should not be null.");
checkNotNull(request.getTitle(), "title should not be null.");
checkNotNull(request.getFormat(), "format should not be null.");
InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, DOC);
internalRequest.addParameter("source", "bos");
String strJson = JsonUtils.toJsonString(request);
byte[] requestJson = null;
try {
requestJson = strJson.getBytes(DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Unsupported encode.", e);
}
internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(requestJson.length));
internalRequest.addHeader(Headers.CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
internalRequest.setContent(RestartableInputStream.wrap(requestJson));
return invokeHttpClient(internalRequest, CreateDocumentFromBosResponse.class);
} | java | public CreateDocumentFromBosResponse createDocumentFromBos(CreateDocumentFromBosRequest request) {
checkNotNull(request, "request should not be null.");
checkNotNull(request.getBucket(), "bucket should not be null.");
checkNotNull(request.getObject(), "object should not be null.");
checkNotNull(request.getTitle(), "title should not be null.");
checkNotNull(request.getFormat(), "format should not be null.");
InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, DOC);
internalRequest.addParameter("source", "bos");
String strJson = JsonUtils.toJsonString(request);
byte[] requestJson = null;
try {
requestJson = strJson.getBytes(DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Unsupported encode.", e);
}
internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(requestJson.length));
internalRequest.addHeader(Headers.CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
internalRequest.setContent(RestartableInputStream.wrap(requestJson));
return invokeHttpClient(internalRequest, CreateDocumentFromBosResponse.class);
} | [
"public",
"CreateDocumentFromBosResponse",
"createDocumentFromBos",
"(",
"CreateDocumentFromBosRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkNotNull",
"(",
"request",
".",
"getBucket",
"(",
")",
",",... | Create a Document.
@param request The request object containing all the parameters to upload a new doc.
@return A CreateDocumentResponse object containing the information returned by Document. | [
"Create",
"a",
"Document",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/doc/DocClient.java#L376-L396 |
thymeleaf/thymeleaf | src/main/java/org/thymeleaf/util/TextUtils.java | TextUtils.compareTo | public static int compareTo(final boolean caseSensitive, final CharSequence text1, final CharSequence text2) {
if (text1 == null) {
throw new IllegalArgumentException("First text being compared cannot be null");
}
if (text2 == null) {
throw new IllegalArgumentException("Second text being compared cannot be null");
}
if (text1 instanceof String && text2 instanceof String) {
return (caseSensitive ? ((String)text1).compareTo((String)text2) : ((String)text1).compareToIgnoreCase((String)text2));
}
return compareTo(caseSensitive, text1, 0, text1.length(), text2, 0, text2.length());
} | java | public static int compareTo(final boolean caseSensitive, final CharSequence text1, final CharSequence text2) {
if (text1 == null) {
throw new IllegalArgumentException("First text being compared cannot be null");
}
if (text2 == null) {
throw new IllegalArgumentException("Second text being compared cannot be null");
}
if (text1 instanceof String && text2 instanceof String) {
return (caseSensitive ? ((String)text1).compareTo((String)text2) : ((String)text1).compareToIgnoreCase((String)text2));
}
return compareTo(caseSensitive, text1, 0, text1.length(), text2, 0, text2.length());
} | [
"public",
"static",
"int",
"compareTo",
"(",
"final",
"boolean",
"caseSensitive",
",",
"final",
"CharSequence",
"text1",
",",
"final",
"CharSequence",
"text2",
")",
"{",
"if",
"(",
"text1",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(... | <p>
Compares two texts lexicographically.
</p>
<p>
The comparison is based on the Unicode value of each character in the CharSequences. The character sequence
represented by the first text object is compared lexicographically to the character sequence represented
by the second text.
</p>
<p>
The result is a negative integer if the first text lexicographically precedes the second text. The
result is a positive integer if the first text lexicographically follows the second text. The result
is zero if the texts are equal.
</p>
<p>
This method works in a way equivalent to that of the {@link java.lang.String#compareTo(String)}
and {@link java.lang.String#compareToIgnoreCase(String)} methods.
</p>
@param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way.
@param text1 the first text to be compared.
@param text2 the second text to be compared.
@return the value {@code 0} if both texts are equal; a value less than {@code 0} if the first text
is lexicographically less than the second text; and a value greater than {@code 0} if the
first text is lexicographically greater than the second text. | [
"<p",
">",
"Compares",
"two",
"texts",
"lexicographically",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"comparison",
"is",
"based",
"on",
"the",
"Unicode",
"value",
"of",
"each",
"character",
"in",
"the",
"CharSequences",
".",
"The",
"character",
"sequence... | train | https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/util/TextUtils.java#L1455-L1470 |
tvesalainen/util | util/src/main/java/org/vesalainen/ui/AbstractView.java | AbstractView.setMargin | public void setMargin(Rectangle2D bounds, Direction... dirs)
{
for (Direction dir : dirs)
{
switch (dir)
{
case BOTTOM:
combinedTransform.transform(userBounds.getCenterX(), userBounds.getMinY(), (x,y)->
{
inverse.transform(x, y+bounds.getHeight(), this::updatePoint);
});
break;
case LEFT:
combinedTransform.transform(userBounds.getMinX(), userBounds.getCenterY(), (x,y)->
{
inverse.transform(x-bounds.getWidth(), y, this::updatePoint);
});
break;
case RIGHT:
combinedTransform.transform(userBounds.getMaxX(), userBounds.getCenterY(), (x,y)->
{
inverse.transform(x+bounds.getWidth(), y, this::updatePoint);
});
break;
case TOP:
combinedTransform.transform(userBounds.getCenterX(), userBounds.getMaxY(), (x,y)->
{
inverse.transform(x, y-bounds.getHeight(), this::updatePoint);
});
break;
}
}
} | java | public void setMargin(Rectangle2D bounds, Direction... dirs)
{
for (Direction dir : dirs)
{
switch (dir)
{
case BOTTOM:
combinedTransform.transform(userBounds.getCenterX(), userBounds.getMinY(), (x,y)->
{
inverse.transform(x, y+bounds.getHeight(), this::updatePoint);
});
break;
case LEFT:
combinedTransform.transform(userBounds.getMinX(), userBounds.getCenterY(), (x,y)->
{
inverse.transform(x-bounds.getWidth(), y, this::updatePoint);
});
break;
case RIGHT:
combinedTransform.transform(userBounds.getMaxX(), userBounds.getCenterY(), (x,y)->
{
inverse.transform(x+bounds.getWidth(), y, this::updatePoint);
});
break;
case TOP:
combinedTransform.transform(userBounds.getCenterX(), userBounds.getMaxY(), (x,y)->
{
inverse.transform(x, y-bounds.getHeight(), this::updatePoint);
});
break;
}
}
} | [
"public",
"void",
"setMargin",
"(",
"Rectangle2D",
"bounds",
",",
"Direction",
"...",
"dirs",
")",
"{",
"for",
"(",
"Direction",
"dir",
":",
"dirs",
")",
"{",
"switch",
"(",
"dir",
")",
"{",
"case",
"BOTTOM",
":",
"combinedTransform",
".",
"transform",
"... | Enlarges margin in screen coordinates to given directions
@param bounds
@param dirs | [
"Enlarges",
"margin",
"in",
"screen",
"coordinates",
"to",
"given",
"directions"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/AbstractView.java#L109-L141 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java | BoxApiFile.getPromoteVersionRequest | public BoxRequestsFile.PromoteFileVersion getPromoteVersionRequest(String id, String versionId) {
BoxRequestsFile.PromoteFileVersion request = new BoxRequestsFile.PromoteFileVersion(id, versionId, getPromoteFileVersionUrl(id), mSession);
return request;
} | java | public BoxRequestsFile.PromoteFileVersion getPromoteVersionRequest(String id, String versionId) {
BoxRequestsFile.PromoteFileVersion request = new BoxRequestsFile.PromoteFileVersion(id, versionId, getPromoteFileVersionUrl(id), mSession);
return request;
} | [
"public",
"BoxRequestsFile",
".",
"PromoteFileVersion",
"getPromoteVersionRequest",
"(",
"String",
"id",
",",
"String",
"versionId",
")",
"{",
"BoxRequestsFile",
".",
"PromoteFileVersion",
"request",
"=",
"new",
"BoxRequestsFile",
".",
"PromoteFileVersion",
"(",
"id",
... | Gets a request that promotes a version to the top of the version stack for a file.
This will create a copy of the old version to put on top of the version stack. The file will have the exact same contents, the same SHA1/etag, and the same name as the original.
Other properties such as comments do not get updated to their former values.
@param id id of the file to promote the version of
@param versionId id of the file version to promote to the top
@return request to promote a version of a file | [
"Gets",
"a",
"request",
"that",
"promotes",
"a",
"version",
"to",
"the",
"top",
"of",
"the",
"version",
"stack",
"for",
"a",
"file",
".",
"This",
"will",
"create",
"a",
"copy",
"of",
"the",
"old",
"version",
"to",
"put",
"on",
"top",
"of",
"the",
"ve... | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L521-L524 |
hsiafan/requests | src/main/java/net/dongliu/requests/RequestBuilder.java | RequestBuilder.forms | @Deprecated
@SafeVarargs
public final RequestBuilder forms(Map.Entry<String, ?>... formBody) {
return forms(Lists.of(formBody));
} | java | @Deprecated
@SafeVarargs
public final RequestBuilder forms(Map.Entry<String, ?>... formBody) {
return forms(Lists.of(formBody));
} | [
"@",
"Deprecated",
"@",
"SafeVarargs",
"public",
"final",
"RequestBuilder",
"forms",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"?",
">",
"...",
"formBody",
")",
"{",
"return",
"forms",
"(",
"Lists",
".",
"of",
"(",
"formBody",
")",
")",
";",
"}"
] | Set www-form-encoded body. Only for Post
@deprecated use {@link #body(Map.Entry[])} instead | [
"Set",
"www",
"-",
"form",
"-",
"encoded",
"body",
".",
"Only",
"for",
"Post"
] | train | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RequestBuilder.java#L218-L222 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java | EnvironmentsInner.claimAsync | public Observable<Void> claimAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName) {
return claimWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> claimAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName) {
return claimWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"claimAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"labName",
",",
"String",
"environmentSettingName",
",",
"String",
"environmentName",
")",
"{",
"return",
"claimWithServiceRespo... | Claims the environment and assigns it to the user.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param environmentSettingName The name of the environment Setting.
@param environmentName The name of the environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Claims",
"the",
"environment",
"and",
"assigns",
"it",
"to",
"the",
"user",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L1103-L1110 |
amaembo/streamex | src/main/java/one/util/streamex/LongStreamEx.java | LongStreamEx.pairMap | public LongStreamEx pairMap(LongBinaryOperator mapper) {
return delegate(new PairSpliterator.PSOfLong(mapper, null, spliterator(), PairSpliterator.MODE_PAIRS));
} | java | public LongStreamEx pairMap(LongBinaryOperator mapper) {
return delegate(new PairSpliterator.PSOfLong(mapper, null, spliterator(), PairSpliterator.MODE_PAIRS));
} | [
"public",
"LongStreamEx",
"pairMap",
"(",
"LongBinaryOperator",
"mapper",
")",
"{",
"return",
"delegate",
"(",
"new",
"PairSpliterator",
".",
"PSOfLong",
"(",
"mapper",
",",
"null",
",",
"spliterator",
"(",
")",
",",
"PairSpliterator",
".",
"MODE_PAIRS",
")",
... | Returns a stream consisting of the results of applying the given function
to the every adjacent pair of elements of this stream.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate
operation</a>.
<p>
The output stream will contain one element less than this stream. If this
stream contains zero or one element the output stream will be empty.
@param mapper a non-interfering, stateless function to apply to each
adjacent pair of this stream elements.
@return the new stream
@since 0.2.1 | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"results",
"of",
"applying",
"the",
"given",
"function",
"to",
"the",
"every",
"adjacent",
"pair",
"of",
"elements",
"of",
"this",
"stream",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/LongStreamEx.java#L1383-L1385 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/Blob.java | Blob.copyTo | public CopyWriter copyTo(String targetBucket, BlobSourceOption... options) {
return copyTo(targetBucket, getName(), options);
} | java | public CopyWriter copyTo(String targetBucket, BlobSourceOption... options) {
return copyTo(targetBucket, getName(), options);
} | [
"public",
"CopyWriter",
"copyTo",
"(",
"String",
"targetBucket",
",",
"BlobSourceOption",
"...",
"options",
")",
"{",
"return",
"copyTo",
"(",
"targetBucket",
",",
"getName",
"(",
")",
",",
"options",
")",
";",
"}"
] | Sends a copy request for the current blob to the target bucket, preserving its name. Possibly
copying also some of the metadata (e.g. content-type).
<p>Example of copying the blob to a different bucket, keeping the original name.
<pre>{@code
String bucketName = "my_unique_bucket";
CopyWriter copyWriter = blob.copyTo(bucketName);
Blob copiedBlob = copyWriter.getResult();
}</pre>
@param targetBucket target bucket's name
@param options source blob options
@return a {@link CopyWriter} object that can be used to get information on the newly created
blob or to complete the copy if more than one RPC request is needed
@throws StorageException upon failure | [
"Sends",
"a",
"copy",
"request",
"for",
"the",
"current",
"blob",
"to",
"the",
"target",
"bucket",
"preserving",
"its",
"name",
".",
"Possibly",
"copying",
"also",
"some",
"of",
"the",
"metadata",
"(",
"e",
".",
"g",
".",
"content",
"-",
"type",
")",
"... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/Blob.java#L606-L608 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/StringUtilities.java | StringUtilities.joinStrings | public static String joinStrings( String separator, String... strings ) {
if (separator == null) {
separator = "";
}
StringBuilder sb = new StringBuilder();
for( int i = 0; i < strings.length; i++ ) {
sb.append(strings[i]);
if (i < strings.length - 1) {
sb.append(separator);
}
}
return sb.toString();
} | java | public static String joinStrings( String separator, String... strings ) {
if (separator == null) {
separator = "";
}
StringBuilder sb = new StringBuilder();
for( int i = 0; i < strings.length; i++ ) {
sb.append(strings[i]);
if (i < strings.length - 1) {
sb.append(separator);
}
}
return sb.toString();
} | [
"public",
"static",
"String",
"joinStrings",
"(",
"String",
"separator",
",",
"String",
"...",
"strings",
")",
"{",
"if",
"(",
"separator",
"==",
"null",
")",
"{",
"separator",
"=",
"\"\"",
";",
"}",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",... | Join strings through {@link StringBuilder}.
@param separator separator to use or <code>null</code>.
@param strings strings to join.
@return the joined string. | [
"Join",
"strings",
"through",
"{",
"@link",
"StringBuilder",
"}",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/StringUtilities.java#L77-L89 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/AbstractBpmnActivityBehavior.java | AbstractBpmnActivityBehavior.propagateException | protected void propagateException(ActivityExecution execution, Exception ex) throws Exception {
BpmnError bpmnError = checkIfCauseOfExceptionIsBpmnError(ex);
if (bpmnError != null) {
propagateBpmnError(bpmnError, execution);
} else {
propagateExceptionAsError(ex, execution);
}
} | java | protected void propagateException(ActivityExecution execution, Exception ex) throws Exception {
BpmnError bpmnError = checkIfCauseOfExceptionIsBpmnError(ex);
if (bpmnError != null) {
propagateBpmnError(bpmnError, execution);
} else {
propagateExceptionAsError(ex, execution);
}
} | [
"protected",
"void",
"propagateException",
"(",
"ActivityExecution",
"execution",
",",
"Exception",
"ex",
")",
"throws",
"Exception",
"{",
"BpmnError",
"bpmnError",
"=",
"checkIfCauseOfExceptionIsBpmnError",
"(",
"ex",
")",
";",
"if",
"(",
"bpmnError",
"!=",
"null",... | Decides how to propagate the exception properly, e.g. as bpmn error or "normal" error.
@param execution the current execution
@param ex the exception to propagate
@throws Exception if no error handler could be found | [
"Decides",
"how",
"to",
"propagate",
"the",
"exception",
"properly",
"e",
".",
"g",
".",
"as",
"bpmn",
"error",
"or",
"normal",
"error",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/AbstractBpmnActivityBehavior.java#L138-L145 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.extractElementType | public SemanticType extractElementType(SemanticType.Array type, SyntacticItem item) {
if (type == null) {
return null;
} else {
return type.getElement();
}
} | java | public SemanticType extractElementType(SemanticType.Array type, SyntacticItem item) {
if (type == null) {
return null;
} else {
return type.getElement();
}
} | [
"public",
"SemanticType",
"extractElementType",
"(",
"SemanticType",
".",
"Array",
"type",
",",
"SyntacticItem",
"item",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"type",
".",
"getElement",
"(",... | Extract the element type from an array. The array type can be null if some
earlier part of type checking generated an error message and we are just
continuing after that.
@param type
@param item
@return | [
"Extract",
"the",
"element",
"type",
"from",
"an",
"array",
".",
"The",
"array",
"type",
"can",
"be",
"null",
"if",
"some",
"earlier",
"part",
"of",
"type",
"checking",
"generated",
"an",
"error",
"message",
"and",
"we",
"are",
"just",
"continuing",
"after... | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1896-L1902 |
actorapp/actor-platform | actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java | Messenger.bindRawUploadFile | @ObjectiveCName("bindRawUploadFileWithRid:withCallback:")
public void bindRawUploadFile(long rid, UploadFileCallback callback) {
modules.getFilesModule().bindUploadFile(rid, callback);
} | java | @ObjectiveCName("bindRawUploadFileWithRid:withCallback:")
public void bindRawUploadFile(long rid, UploadFileCallback callback) {
modules.getFilesModule().bindUploadFile(rid, callback);
} | [
"@",
"ObjectiveCName",
"(",
"\"bindRawUploadFileWithRid:withCallback:\"",
")",
"public",
"void",
"bindRawUploadFile",
"(",
"long",
"rid",
",",
"UploadFileCallback",
"callback",
")",
"{",
"modules",
".",
"getFilesModule",
"(",
")",
".",
"bindUploadFile",
"(",
"rid",
... | Raw Bind Upload File
@param rid randomId of uploading file
@param callback file state callback | [
"Raw",
"Bind",
"Upload",
"File"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L1953-L1956 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_reach.java | DZcs_reach.cs_reach | public static int cs_reach(DZcs G, DZcs B, int k, int[] xi, int[] pinv)
{
int p, n, top, Bp[], Bi[], Gp[] ;
if (!CS_CSC (G) || !CS_CSC (B) || xi == null)
return (-1) ; /* check inputs */
n = G.n ; Bp = B.p ; Bi = B.i ; Gp = G.p ;
top = n ;
for (p = Bp [k] ; p < Bp [k+1] ; p++)
{
if (!CS_MARKED (Gp, Bi [p])) /* start a dfs at unmarked node i */
{
top = cs_dfs (Bi [p], G, top, xi, 0, xi, n, pinv, 0) ;
}
}
for (p = top ; p < n ; p++) CS_MARK (Gp, xi [p]) ; /* restore G */
return (top) ;
} | java | public static int cs_reach(DZcs G, DZcs B, int k, int[] xi, int[] pinv)
{
int p, n, top, Bp[], Bi[], Gp[] ;
if (!CS_CSC (G) || !CS_CSC (B) || xi == null)
return (-1) ; /* check inputs */
n = G.n ; Bp = B.p ; Bi = B.i ; Gp = G.p ;
top = n ;
for (p = Bp [k] ; p < Bp [k+1] ; p++)
{
if (!CS_MARKED (Gp, Bi [p])) /* start a dfs at unmarked node i */
{
top = cs_dfs (Bi [p], G, top, xi, 0, xi, n, pinv, 0) ;
}
}
for (p = top ; p < n ; p++) CS_MARK (Gp, xi [p]) ; /* restore G */
return (top) ;
} | [
"public",
"static",
"int",
"cs_reach",
"(",
"DZcs",
"G",
",",
"DZcs",
"B",
",",
"int",
"k",
",",
"int",
"[",
"]",
"xi",
",",
"int",
"[",
"]",
"pinv",
")",
"{",
"int",
"p",
",",
"n",
",",
"top",
",",
"Bp",
"[",
"]",
",",
"Bi",
"[",
"]",
",... | Finds a nonzero pattern of x=L\b for sparse L and b.
@param G
graph to search (G.p modified, then restored)
@param B
right hand side, b = B(:,k)
@param k
use kth column of B
@param xi
size 2*n, output in xi[top..n-1]
@param pinv
mapping of rows to columns of G, ignored if null
@return top, -1 on error | [
"Finds",
"a",
"nonzero",
"pattern",
"of",
"x",
"=",
"L",
"\\",
"b",
"for",
"sparse",
"L",
"and",
"b",
"."
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_reach.java#L59-L75 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java | AbstractHibernateCriteriaBuilder.sizeEq | public org.grails.datastore.mapping.query.api.Criteria sizeEq(String propertyName, int size) {
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [sizeEq] with propertyName [" +
propertyName + "] and size [" + size + "] not allowed here."));
}
propertyName = calculatePropertyName(propertyName);
addToCriteria(Restrictions.sizeEq(propertyName, size));
return this;
} | java | public org.grails.datastore.mapping.query.api.Criteria sizeEq(String propertyName, int size) {
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [sizeEq] with propertyName [" +
propertyName + "] and size [" + size + "] not allowed here."));
}
propertyName = calculatePropertyName(propertyName);
addToCriteria(Restrictions.sizeEq(propertyName, size));
return this;
} | [
"public",
"org",
".",
"grails",
".",
"datastore",
".",
"mapping",
".",
"query",
".",
"api",
".",
"Criteria",
"sizeEq",
"(",
"String",
"propertyName",
",",
"int",
"size",
")",
"{",
"if",
"(",
"!",
"validateSimpleExpression",
"(",
")",
")",
"{",
"throwRunt... | Creates a Criterion that contrains a collection property by size
@param propertyName The property name
@param size The size to constrain by
@return A Criterion instance | [
"Creates",
"a",
"Criterion",
"that",
"contrains",
"a",
"collection",
"property",
"by",
"size"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java#L1414-L1423 |
micronaut-projects/micronaut-core | inject-java/src/main/java/io/micronaut/annotation/processing/GenericUtils.java | GenericUtils.interfaceGenericTypeFor | protected TypeMirror interfaceGenericTypeFor(TypeElement element, String interfaceName) {
List<? extends TypeMirror> typeMirrors = interfaceGenericTypesFor(element, interfaceName);
return typeMirrors.isEmpty() ? null : typeMirrors.get(0);
} | java | protected TypeMirror interfaceGenericTypeFor(TypeElement element, String interfaceName) {
List<? extends TypeMirror> typeMirrors = interfaceGenericTypesFor(element, interfaceName);
return typeMirrors.isEmpty() ? null : typeMirrors.get(0);
} | [
"protected",
"TypeMirror",
"interfaceGenericTypeFor",
"(",
"TypeElement",
"element",
",",
"String",
"interfaceName",
")",
"{",
"List",
"<",
"?",
"extends",
"TypeMirror",
">",
"typeMirrors",
"=",
"interfaceGenericTypesFor",
"(",
"element",
",",
"interfaceName",
")",
... | Finds the generic type for the given interface for the given class element.
<p>
For example, for <code>class AProvider implements Provider<A></code>
element = AProvider
interfaceName = interface javax.inject.Provider
return A
@param element The class element
@param interfaceName The interface
@return The generic type or null | [
"Finds",
"the",
"generic",
"type",
"for",
"the",
"given",
"interface",
"for",
"the",
"given",
"class",
"element",
".",
"<p",
">",
"For",
"example",
"for",
"<code",
">",
"class",
"AProvider",
"implements",
"Provider<",
";",
"A>",
";",
"<",
"/",
"code",
... | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/GenericUtils.java#L96-L99 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java | ExpressionUtils.predicateTemplate | public static PredicateTemplate predicateTemplate(Template template, Object... args) {
return predicateTemplate(template, ImmutableList.copyOf(args));
} | java | public static PredicateTemplate predicateTemplate(Template template, Object... args) {
return predicateTemplate(template, ImmutableList.copyOf(args));
} | [
"public",
"static",
"PredicateTemplate",
"predicateTemplate",
"(",
"Template",
"template",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"predicateTemplate",
"(",
"template",
",",
"ImmutableList",
".",
"copyOf",
"(",
"args",
")",
")",
";",
"}"
] | Create a new Template expression
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L176-L178 |
sebastiangraf/perfidix | src/main/java/org/perfidix/element/AbstractMethodArrangement.java | AbstractMethodArrangement.getMethodArrangement | public static AbstractMethodArrangement getMethodArrangement(final List<BenchmarkElement> elements, final KindOfArrangement kind) {
AbstractMethodArrangement arrang = null;
switch (kind) {
case NoArrangement:
arrang = new NoMethodArrangement(elements);
break;
case ShuffleArrangement:
arrang = new ShuffleMethodArrangement(elements);
break;
case SequentialMethodArrangement:
arrang = new SequentialMethodArrangement(elements);
break;
default:
throw new IllegalArgumentException("Kind not known!");
}
return arrang;
} | java | public static AbstractMethodArrangement getMethodArrangement(final List<BenchmarkElement> elements, final KindOfArrangement kind) {
AbstractMethodArrangement arrang = null;
switch (kind) {
case NoArrangement:
arrang = new NoMethodArrangement(elements);
break;
case ShuffleArrangement:
arrang = new ShuffleMethodArrangement(elements);
break;
case SequentialMethodArrangement:
arrang = new SequentialMethodArrangement(elements);
break;
default:
throw new IllegalArgumentException("Kind not known!");
}
return arrang;
} | [
"public",
"static",
"AbstractMethodArrangement",
"getMethodArrangement",
"(",
"final",
"List",
"<",
"BenchmarkElement",
">",
"elements",
",",
"final",
"KindOfArrangement",
"kind",
")",
"{",
"AbstractMethodArrangement",
"arrang",
"=",
"null",
";",
"switch",
"(",
"kind"... | Factory method to get the method arrangement for a given set of classes. The kind of arrangement is set by an
instance of the enum {@link KindOfArrangement}.
@param elements to be benched
@param kind for the method arrangement
@return the arrangement, mainly an iterator | [
"Factory",
"method",
"to",
"get",
"the",
"method",
"arrangement",
"for",
"a",
"given",
"set",
"of",
"classes",
".",
"The",
"kind",
"of",
"arrangement",
"is",
"set",
"by",
"an",
"instance",
"of",
"the",
"enum",
"{",
"@link",
"KindOfArrangement",
"}",
"."
] | train | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/element/AbstractMethodArrangement.java#L60-L77 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAvailabilityEstimatePersistenceImpl.java | CommerceAvailabilityEstimatePersistenceImpl.findByGroupId | @Override
public List<CommerceAvailabilityEstimate> findByGroupId(long groupId,
int start, int end) {
return findByGroupId(groupId, start, end, null);
} | java | @Override
public List<CommerceAvailabilityEstimate> findByGroupId(long groupId,
int start, int end) {
return findByGroupId(groupId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceAvailabilityEstimate",
">",
"findByGroupId",
"(",
"long",
"groupId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"start",
",",
"end",
",",
"null",
")",
"... | Returns a range of all the commerce availability estimates where groupId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceAvailabilityEstimateModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param start the lower bound of the range of commerce availability estimates
@param end the upper bound of the range of commerce availability estimates (not inclusive)
@return the range of matching commerce availability estimates | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"availability",
"estimates",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAvailabilityEstimatePersistenceImpl.java#L1556-L1560 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java | SqlQueryStatement.getSubQuerySQL | private String getSubQuerySQL(Query subQuery)
{
ClassDescriptor cld = getRoot().cld.getRepository().getDescriptorFor(subQuery.getSearchClass());
String sql;
if (subQuery instanceof QueryBySQL)
{
sql = ((QueryBySQL) subQuery).getSql();
}
else
{
sql = new SqlSelectStatement(this, m_platform, cld, subQuery, m_logger).getStatement();
}
return sql;
} | java | private String getSubQuerySQL(Query subQuery)
{
ClassDescriptor cld = getRoot().cld.getRepository().getDescriptorFor(subQuery.getSearchClass());
String sql;
if (subQuery instanceof QueryBySQL)
{
sql = ((QueryBySQL) subQuery).getSql();
}
else
{
sql = new SqlSelectStatement(this, m_platform, cld, subQuery, m_logger).getStatement();
}
return sql;
} | [
"private",
"String",
"getSubQuerySQL",
"(",
"Query",
"subQuery",
")",
"{",
"ClassDescriptor",
"cld",
"=",
"getRoot",
"(",
")",
".",
"cld",
".",
"getRepository",
"(",
")",
".",
"getDescriptorFor",
"(",
"subQuery",
".",
"getSearchClass",
"(",
")",
")",
";",
... | Convert subQuery to SQL
@param subQuery the subQuery value of SelectionCriteria | [
"Convert",
"subQuery",
"to",
"SQL"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L982-L997 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/StackTraceHelper.java | StackTraceHelper.getStackAsString | @Nonnull
public static String getStackAsString (@Nullable final Throwable t, final boolean bOmitCommonStackTraceElements)
{
if (t == null)
return "";
// convert call stack to string
final StringBuilder aCallStack = _getRecursiveStackAsStringBuilder (t,
null,
null,
1,
bOmitCommonStackTraceElements);
// avoid having a separator at the end -> remove the last char
if (StringHelper.getLastChar (aCallStack) == STACKELEMENT_LINESEP)
aCallStack.deleteCharAt (aCallStack.length () - 1);
// no changes
return aCallStack.toString ();
} | java | @Nonnull
public static String getStackAsString (@Nullable final Throwable t, final boolean bOmitCommonStackTraceElements)
{
if (t == null)
return "";
// convert call stack to string
final StringBuilder aCallStack = _getRecursiveStackAsStringBuilder (t,
null,
null,
1,
bOmitCommonStackTraceElements);
// avoid having a separator at the end -> remove the last char
if (StringHelper.getLastChar (aCallStack) == STACKELEMENT_LINESEP)
aCallStack.deleteCharAt (aCallStack.length () - 1);
// no changes
return aCallStack.toString ();
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getStackAsString",
"(",
"@",
"Nullable",
"final",
"Throwable",
"t",
",",
"final",
"boolean",
"bOmitCommonStackTraceElements",
")",
"{",
"if",
"(",
"t",
"==",
"null",
")",
"return",
"\"\"",
";",
"// convert call stac... | Get the stack trace of a throwable as string.
@param t
The throwable to be converted. May be <code>null</code>.
@param bOmitCommonStackTraceElements
If <code>true</code> the stack trace is cut after certain class
names occurring. If <code>false</code> the complete stack trace is
returned.
@return the stack trace as newline separated string. If the passed
Throwable is <code>null</code> an empty string is returned. | [
"Get",
"the",
"stack",
"trace",
"of",
"a",
"throwable",
"as",
"string",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/StackTraceHelper.java#L207-L226 |
joniles/mpxj | src/main/java/net/sf/mpxj/RecurringData.java | RecurringData.getYearlyRelativeDates | private void getYearlyRelativeDates(Calendar calendar, List<Date> dates)
{
long startDate = calendar.getTimeInMillis();
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.MONTH, NumberHelper.getInt(m_monthNumber) - 1);
int dayNumber = NumberHelper.getInt(m_dayNumber);
while (moreDates(calendar, dates))
{
if (dayNumber > 4)
{
setCalendarToLastRelativeDay(calendar);
}
else
{
setCalendarToOrdinalRelativeDay(calendar, dayNumber);
}
if (calendar.getTimeInMillis() > startDate)
{
dates.add(calendar.getTime());
if (!moreDates(calendar, dates))
{
break;
}
}
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.add(Calendar.YEAR, 1);
}
} | java | private void getYearlyRelativeDates(Calendar calendar, List<Date> dates)
{
long startDate = calendar.getTimeInMillis();
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.MONTH, NumberHelper.getInt(m_monthNumber) - 1);
int dayNumber = NumberHelper.getInt(m_dayNumber);
while (moreDates(calendar, dates))
{
if (dayNumber > 4)
{
setCalendarToLastRelativeDay(calendar);
}
else
{
setCalendarToOrdinalRelativeDay(calendar, dayNumber);
}
if (calendar.getTimeInMillis() > startDate)
{
dates.add(calendar.getTime());
if (!moreDates(calendar, dates))
{
break;
}
}
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.add(Calendar.YEAR, 1);
}
} | [
"private",
"void",
"getYearlyRelativeDates",
"(",
"Calendar",
"calendar",
",",
"List",
"<",
"Date",
">",
"dates",
")",
"{",
"long",
"startDate",
"=",
"calendar",
".",
"getTimeInMillis",
"(",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"DAY_OF_MON... | Calculate start dates for a yearly relative recurrence.
@param calendar current date
@param dates array of start dates | [
"Calculate",
"start",
"dates",
"for",
"a",
"yearly",
"relative",
"recurrence",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L569-L598 |
lessthanoptimal/ddogleg | src/org/ddogleg/solver/PolynomialSolver.java | PolynomialSolver.polynomialRootsEVD | @SuppressWarnings("ToArrayCallWithZeroLengthArrayArgument")
public static Complex_F64[] polynomialRootsEVD(double... coefficients) {
PolynomialRoots alg = new RootFinderCompanion();
if( !alg.process( Polynomial.wrap(coefficients)) )
throw new IllegalArgumentException("Algorithm failed, was the input bad?");
List<Complex_F64> coefs = alg.getRoots();
return coefs.toArray(new Complex_F64[0]);
} | java | @SuppressWarnings("ToArrayCallWithZeroLengthArrayArgument")
public static Complex_F64[] polynomialRootsEVD(double... coefficients) {
PolynomialRoots alg = new RootFinderCompanion();
if( !alg.process( Polynomial.wrap(coefficients)) )
throw new IllegalArgumentException("Algorithm failed, was the input bad?");
List<Complex_F64> coefs = alg.getRoots();
return coefs.toArray(new Complex_F64[0]);
} | [
"@",
"SuppressWarnings",
"(",
"\"ToArrayCallWithZeroLengthArrayArgument\"",
")",
"public",
"static",
"Complex_F64",
"[",
"]",
"polynomialRootsEVD",
"(",
"double",
"...",
"coefficients",
")",
"{",
"PolynomialRoots",
"alg",
"=",
"new",
"RootFinderCompanion",
"(",
")",
"... | Finds real and imaginary roots in a polynomial using the companion matrix and
Eigenvalue decomposition. The coefficients order is specified from smallest to largest.
Example, 5 + 6*x + 7*x^2 + 8*x^3 = [5,6,7,8]
@param coefficients Polynomial coefficients from smallest to largest.
@return The found roots. | [
"Finds",
"real",
"and",
"imaginary",
"roots",
"in",
"a",
"polynomial",
"using",
"the",
"companion",
"matrix",
"and",
"Eigenvalue",
"decomposition",
".",
"The",
"coefficients",
"order",
"is",
"specified",
"from",
"smallest",
"to",
"largest",
".",
"Example",
"5",
... | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/PolynomialSolver.java#L66-L77 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF5.java | CommonOps_DDF5.extractRow | public static DMatrix5 extractRow( DMatrix5x5 a , int row , DMatrix5 out ) {
if( out == null) out = new DMatrix5();
switch( row ) {
case 0:
out.a1 = a.a11;
out.a2 = a.a12;
out.a3 = a.a13;
out.a4 = a.a14;
out.a5 = a.a15;
break;
case 1:
out.a1 = a.a21;
out.a2 = a.a22;
out.a3 = a.a23;
out.a4 = a.a24;
out.a5 = a.a25;
break;
case 2:
out.a1 = a.a31;
out.a2 = a.a32;
out.a3 = a.a33;
out.a4 = a.a34;
out.a5 = a.a35;
break;
case 3:
out.a1 = a.a41;
out.a2 = a.a42;
out.a3 = a.a43;
out.a4 = a.a44;
out.a5 = a.a45;
break;
case 4:
out.a1 = a.a51;
out.a2 = a.a52;
out.a3 = a.a53;
out.a4 = a.a54;
out.a5 = a.a55;
break;
default:
throw new IllegalArgumentException("Out of bounds row. row = "+row);
}
return out;
} | java | public static DMatrix5 extractRow( DMatrix5x5 a , int row , DMatrix5 out ) {
if( out == null) out = new DMatrix5();
switch( row ) {
case 0:
out.a1 = a.a11;
out.a2 = a.a12;
out.a3 = a.a13;
out.a4 = a.a14;
out.a5 = a.a15;
break;
case 1:
out.a1 = a.a21;
out.a2 = a.a22;
out.a3 = a.a23;
out.a4 = a.a24;
out.a5 = a.a25;
break;
case 2:
out.a1 = a.a31;
out.a2 = a.a32;
out.a3 = a.a33;
out.a4 = a.a34;
out.a5 = a.a35;
break;
case 3:
out.a1 = a.a41;
out.a2 = a.a42;
out.a3 = a.a43;
out.a4 = a.a44;
out.a5 = a.a45;
break;
case 4:
out.a1 = a.a51;
out.a2 = a.a52;
out.a3 = a.a53;
out.a4 = a.a54;
out.a5 = a.a55;
break;
default:
throw new IllegalArgumentException("Out of bounds row. row = "+row);
}
return out;
} | [
"public",
"static",
"DMatrix5",
"extractRow",
"(",
"DMatrix5x5",
"a",
",",
"int",
"row",
",",
"DMatrix5",
"out",
")",
"{",
"if",
"(",
"out",
"==",
"null",
")",
"out",
"=",
"new",
"DMatrix5",
"(",
")",
";",
"switch",
"(",
"row",
")",
"{",
"case",
"0... | Extracts the row from the matrix a.
@param a Input matrix
@param row Which row is to be extracted
@param out output. Storage for the extracted row. If null then a new vector will be returned.
@return The extracted row. | [
"Extracts",
"the",
"row",
"from",
"the",
"matrix",
"a",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF5.java#L1953-L1995 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/ui/CmsCategoriesTab.java | CmsCategoriesTab.addChildren | private void addChildren(CmsTreeItem parent, List<CmsCategoryTreeEntry> children, List<String> selectedCategories) {
if (children != null) {
for (CmsCategoryTreeEntry child : children) {
// set the category tree item and add to parent tree item
CmsTreeItem treeItem = buildTreeItem(child, selectedCategories);
if ((selectedCategories != null) && selectedCategories.contains(child.getPath())) {
parent.setOpen(true);
openParents(parent);
}
parent.addChild(treeItem);
addChildren(treeItem, child.getChildren(), selectedCategories);
}
}
} | java | private void addChildren(CmsTreeItem parent, List<CmsCategoryTreeEntry> children, List<String> selectedCategories) {
if (children != null) {
for (CmsCategoryTreeEntry child : children) {
// set the category tree item and add to parent tree item
CmsTreeItem treeItem = buildTreeItem(child, selectedCategories);
if ((selectedCategories != null) && selectedCategories.contains(child.getPath())) {
parent.setOpen(true);
openParents(parent);
}
parent.addChild(treeItem);
addChildren(treeItem, child.getChildren(), selectedCategories);
}
}
} | [
"private",
"void",
"addChildren",
"(",
"CmsTreeItem",
"parent",
",",
"List",
"<",
"CmsCategoryTreeEntry",
">",
"children",
",",
"List",
"<",
"String",
">",
"selectedCategories",
")",
"{",
"if",
"(",
"children",
"!=",
"null",
")",
"{",
"for",
"(",
"CmsCategor... | Adds children item to the category tree and select the categories.<p>
@param parent the parent item
@param children the list of children
@param selectedCategories the list of categories to select | [
"Adds",
"children",
"item",
"to",
"the",
"category",
"tree",
"and",
"select",
"the",
"categories",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsCategoriesTab.java#L334-L348 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.translationRotateScaleMul | public Matrix4x3f translationRotateScaleMul(Vector3fc translation, Quaternionfc quat, Vector3fc scale, Matrix4x3f m) {
return translationRotateScaleMul(translation.x(), translation.y(), translation.z(), quat.x(), quat.y(), quat.z(), quat.w(), scale.x(), scale.y(), scale.z(), m);
} | java | public Matrix4x3f translationRotateScaleMul(Vector3fc translation, Quaternionfc quat, Vector3fc scale, Matrix4x3f m) {
return translationRotateScaleMul(translation.x(), translation.y(), translation.z(), quat.x(), quat.y(), quat.z(), quat.w(), scale.x(), scale.y(), scale.z(), m);
} | [
"public",
"Matrix4x3f",
"translationRotateScaleMul",
"(",
"Vector3fc",
"translation",
",",
"Quaternionfc",
"quat",
",",
"Vector3fc",
"scale",
",",
"Matrix4x3f",
"m",
")",
"{",
"return",
"translationRotateScaleMul",
"(",
"translation",
".",
"x",
"(",
")",
",",
"tra... | Set <code>this</code> matrix to <code>T * R * S * M</code>, where <code>T</code> is the given <code>translation</code>,
<code>R</code> is a rotation transformation specified by the given quaternion, <code>S</code> is a scaling transformation
which scales the axes by <code>scale</code>.
<p>
When transforming a vector by the resulting matrix the transformation described by <code>M</code> will be applied first, then the scaling, then rotation and
at last the translation.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
This method is equivalent to calling: <code>translation(translation).rotate(quat).scale(scale).mul(m)</code>
@see #translation(Vector3fc)
@see #rotate(Quaternionfc)
@param translation
the translation
@param quat
the quaternion representing a rotation
@param scale
the scaling factors
@param m
the matrix to multiply by
@return this | [
"Set",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"to",
"<code",
">",
"T",
"*",
"R",
"*",
"S",
"*",
"M<",
"/",
"code",
">",
"where",
"<code",
">",
"T<",
"/",
"code",
">",
"is",
"the",
"given",
"<code",
">",
"translation<",
"/",
"code",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L2871-L2873 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/VirtualFile.java | VirtualFile.asDirectoryURI | public URI asDirectoryURI() throws URISyntaxException {
final String pathName = getPathName(false);
return new URI(VFSUtils.VFS_PROTOCOL, "", parent == null ? pathName : pathName + "/", null);
} | java | public URI asDirectoryURI() throws URISyntaxException {
final String pathName = getPathName(false);
return new URI(VFSUtils.VFS_PROTOCOL, "", parent == null ? pathName : pathName + "/", null);
} | [
"public",
"URI",
"asDirectoryURI",
"(",
")",
"throws",
"URISyntaxException",
"{",
"final",
"String",
"pathName",
"=",
"getPathName",
"(",
"false",
")",
";",
"return",
"new",
"URI",
"(",
"VFSUtils",
".",
"VFS_PROTOCOL",
",",
"\"\"",
",",
"parent",
"==",
"null... | Get file's URI as a directory. There will always be a trailing {@code "/"} character.
@return the uri
@throws URISyntaxException if the URI is somehow malformed | [
"Get",
"file",
"s",
"URI",
"as",
"a",
"directory",
".",
"There",
"will",
"always",
"be",
"a",
"trailing",
"{",
"@code",
"/",
"}",
"character",
"."
] | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFile.java#L558-L561 |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/ui/CmsContainerPageElementPanel.java | CmsContainerPageElementPanel.isOptionbarIFrameCollision | private boolean isOptionbarIFrameCollision(int optionTop, int optionWidth) {
if (RootPanel.getBodyElement().isOrHasChild(getElement())) {
NodeList<Element> frames = getElement().getElementsByTagName(CmsDomUtil.Tag.iframe.name());
for (int i = 0; i < frames.getLength(); i++) {
int frameTop = frames.getItem(i).getAbsoluteTop();
int frameHeight = frames.getItem(i).getOffsetHeight();
int frameRight = frames.getItem(i).getAbsoluteRight();
if (((frameTop - optionTop) < 25)
&& (((frameTop + frameHeight) - optionTop) > 0)
&& ((frameRight - getElement().getAbsoluteRight()) < optionWidth)) {
return true;
}
}
}
return false;
} | java | private boolean isOptionbarIFrameCollision(int optionTop, int optionWidth) {
if (RootPanel.getBodyElement().isOrHasChild(getElement())) {
NodeList<Element> frames = getElement().getElementsByTagName(CmsDomUtil.Tag.iframe.name());
for (int i = 0; i < frames.getLength(); i++) {
int frameTop = frames.getItem(i).getAbsoluteTop();
int frameHeight = frames.getItem(i).getOffsetHeight();
int frameRight = frames.getItem(i).getAbsoluteRight();
if (((frameTop - optionTop) < 25)
&& (((frameTop + frameHeight) - optionTop) > 0)
&& ((frameRight - getElement().getAbsoluteRight()) < optionWidth)) {
return true;
}
}
}
return false;
} | [
"private",
"boolean",
"isOptionbarIFrameCollision",
"(",
"int",
"optionTop",
",",
"int",
"optionWidth",
")",
"{",
"if",
"(",
"RootPanel",
".",
"getBodyElement",
"(",
")",
".",
"isOrHasChild",
"(",
"getElement",
"(",
")",
")",
")",
"{",
"NodeList",
"<",
"Elem... | Returns if the option bar position collides with any iframe child elements.<p>
@param optionTop the option bar absolute top
@param optionWidth the option bar width
@return <code>true</code> if there are iframe child elements located no less than 25px below the upper edge of the element | [
"Returns",
"if",
"the",
"option",
"bar",
"position",
"collides",
"with",
"any",
"iframe",
"child",
"elements",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/ui/CmsContainerPageElementPanel.java#L1252-L1269 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.email_pro_email_changePassword_POST | public net.minidev.ovh.api.xdsl.email.pro.OvhTask email_pro_email_changePassword_POST(String email, String password) throws IOException {
String qPath = "/xdsl/email/pro/{email}/changePassword";
StringBuilder sb = path(qPath, email);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "password", password);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, net.minidev.ovh.api.xdsl.email.pro.OvhTask.class);
} | java | public net.minidev.ovh.api.xdsl.email.pro.OvhTask email_pro_email_changePassword_POST(String email, String password) throws IOException {
String qPath = "/xdsl/email/pro/{email}/changePassword";
StringBuilder sb = path(qPath, email);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "password", password);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, net.minidev.ovh.api.xdsl.email.pro.OvhTask.class);
} | [
"public",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"xdsl",
".",
"email",
".",
"pro",
".",
"OvhTask",
"email_pro_email_changePassword_POST",
"(",
"String",
"email",
",",
"String",
"password",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=... | Change the email password
REST: POST /xdsl/email/pro/{email}/changePassword
@param password [required] New email password
@param email [required] The email address if the XDSL Email Pro | [
"Change",
"the",
"email",
"password"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1949-L1956 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java | EffectUtil.colorValue | static public Value colorValue(String name, Color currentValue) {
return new DefaultValue(name, EffectUtil.toString(currentValue)) {
public void showDialog () {
Color newColor = JColorChooser.showDialog(null, "Choose a color", EffectUtil.fromString(value));
if (newColor != null) value = EffectUtil.toString(newColor);
}
public Object getObject () {
return EffectUtil.fromString(value);
}
};
} | java | static public Value colorValue(String name, Color currentValue) {
return new DefaultValue(name, EffectUtil.toString(currentValue)) {
public void showDialog () {
Color newColor = JColorChooser.showDialog(null, "Choose a color", EffectUtil.fromString(value));
if (newColor != null) value = EffectUtil.toString(newColor);
}
public Object getObject () {
return EffectUtil.fromString(value);
}
};
} | [
"static",
"public",
"Value",
"colorValue",
"(",
"String",
"name",
",",
"Color",
"currentValue",
")",
"{",
"return",
"new",
"DefaultValue",
"(",
"name",
",",
"EffectUtil",
".",
"toString",
"(",
"currentValue",
")",
")",
"{",
"public",
"void",
"showDialog",
"(... | Prompts the user for a colour value
@param name Thename of the value being configured
@param currentValue The default value that should be selected
@return The value selected | [
"Prompts",
"the",
"user",
"for",
"a",
"colour",
"value"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java#L64-L75 |
OwlPlatform/java-owl-worldmodel | src/main/java/com/owlplatform/worldmodel/client/ClientWorldConnection.java | ClientWorldConnection.getRangeRequest | public synchronized StepResponse getRangeRequest(final String idRegex,
final long start, final long end, String... attributes) {
RangeRequestMessage req = new RangeRequestMessage();
req.setIdRegex(idRegex);
req.setBeginTimestamp(start);
req.setEndTimestamp(end);
if (attributes != null) {
req.setAttributeRegexes(attributes);
}
StepResponse resp = new StepResponse(this, 0);
try {
while (!this.isReady) {
log.debug("Trying to wait until connection is ready.");
synchronized (this) {
try {
this.wait();
} catch (InterruptedException ie) {
// Ignored
}
}
}
long reqId = this.wmi.sendMessage(req);
resp.setTicketNumber(reqId);
this.outstandingSteps.put(Long.valueOf(reqId), resp);
log.info("Binding Tix #{} to {}", Long.valueOf(reqId), resp);
return resp;
} catch (Exception e) {
resp.setError(e);
return resp;
}
} | java | public synchronized StepResponse getRangeRequest(final String idRegex,
final long start, final long end, String... attributes) {
RangeRequestMessage req = new RangeRequestMessage();
req.setIdRegex(idRegex);
req.setBeginTimestamp(start);
req.setEndTimestamp(end);
if (attributes != null) {
req.setAttributeRegexes(attributes);
}
StepResponse resp = new StepResponse(this, 0);
try {
while (!this.isReady) {
log.debug("Trying to wait until connection is ready.");
synchronized (this) {
try {
this.wait();
} catch (InterruptedException ie) {
// Ignored
}
}
}
long reqId = this.wmi.sendMessage(req);
resp.setTicketNumber(reqId);
this.outstandingSteps.put(Long.valueOf(reqId), resp);
log.info("Binding Tix #{} to {}", Long.valueOf(reqId), resp);
return resp;
} catch (Exception e) {
resp.setError(e);
return resp;
}
} | [
"public",
"synchronized",
"StepResponse",
"getRangeRequest",
"(",
"final",
"String",
"idRegex",
",",
"final",
"long",
"start",
",",
"final",
"long",
"end",
",",
"String",
"...",
"attributes",
")",
"{",
"RangeRequestMessage",
"req",
"=",
"new",
"RangeRequestMessage... | Sends a range request to the world model for the specified Identifier
regular expression, Attribute regular expressions, between the start and
end times.
@param idRegex
regular expression for matching the identifier.
@param start
the beginning of the range..
@param end
the end of the range.
@param attributes
the attribute regular expressions to request
@return a {@code StepResponse} for the request. | [
"Sends",
"a",
"range",
"request",
"to",
"the",
"world",
"model",
"for",
"the",
"specified",
"Identifier",
"regular",
"expression",
"Attribute",
"regular",
"expressions",
"between",
"the",
"start",
"and",
"end",
"times",
"."
] | train | https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/client/ClientWorldConnection.java#L348-L379 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java | GoogleMapShapeConverter.toPoint | public Point toPoint(LatLng latLng, boolean hasZ, boolean hasM) {
double y = latLng.latitude;
double x = latLng.longitude;
Point point = new Point(hasZ, hasM, x, y);
point = toProjection(point);
return point;
} | java | public Point toPoint(LatLng latLng, boolean hasZ, boolean hasM) {
double y = latLng.latitude;
double x = latLng.longitude;
Point point = new Point(hasZ, hasM, x, y);
point = toProjection(point);
return point;
} | [
"public",
"Point",
"toPoint",
"(",
"LatLng",
"latLng",
",",
"boolean",
"hasZ",
",",
"boolean",
"hasM",
")",
"{",
"double",
"y",
"=",
"latLng",
".",
"latitude",
";",
"double",
"x",
"=",
"latLng",
".",
"longitude",
";",
"Point",
"point",
"=",
"new",
"Poi... | Convert a {@link LatLng} to a {@link Point}
@param latLng lat lng
@param hasZ has z flag
@param hasM has m flag
@return point | [
"Convert",
"a",
"{",
"@link",
"LatLng",
"}",
"to",
"a",
"{",
"@link",
"Point",
"}"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L247-L253 |
google/closure-templates | java/src/com/google/template/soy/i18ndirectives/I18nUtils.java | I18nUtils.parseLocale | public static Locale parseLocale(String localeString) {
if (localeString == null) {
return Locale.US;
}
String[] groups = localeString.split("[-_]");
switch (groups.length) {
case 1:
return new Locale(groups[0]);
case 2:
return new Locale(groups[0], Ascii.toUpperCase(groups[1]));
case 3:
return new Locale(groups[0], Ascii.toUpperCase(groups[1]), groups[2]);
default:
throw new IllegalArgumentException("Malformed localeString: " + localeString);
}
} | java | public static Locale parseLocale(String localeString) {
if (localeString == null) {
return Locale.US;
}
String[] groups = localeString.split("[-_]");
switch (groups.length) {
case 1:
return new Locale(groups[0]);
case 2:
return new Locale(groups[0], Ascii.toUpperCase(groups[1]));
case 3:
return new Locale(groups[0], Ascii.toUpperCase(groups[1]), groups[2]);
default:
throw new IllegalArgumentException("Malformed localeString: " + localeString);
}
} | [
"public",
"static",
"Locale",
"parseLocale",
"(",
"String",
"localeString",
")",
"{",
"if",
"(",
"localeString",
"==",
"null",
")",
"{",
"return",
"Locale",
".",
"US",
";",
"}",
"String",
"[",
"]",
"groups",
"=",
"localeString",
".",
"split",
"(",
"\"[-_... | Given a string representing a Locale, returns the Locale object for that string.
@return A Locale object built from the string provided | [
"Given",
"a",
"string",
"representing",
"a",
"Locale",
"returns",
"the",
"Locale",
"object",
"for",
"that",
"string",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/i18ndirectives/I18nUtils.java#L37-L52 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java | ServicesInner.beginStopAsync | public Observable<Void> beginStopAsync(String groupName, String serviceName) {
return beginStopWithServiceResponseAsync(groupName, serviceName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginStopAsync(String groupName, String serviceName) {
return beginStopWithServiceResponseAsync(groupName, serviceName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginStopAsync",
"(",
"String",
"groupName",
",",
"String",
"serviceName",
")",
"{",
"return",
"beginStopWithServiceResponseAsync",
"(",
"groupName",
",",
"serviceName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"Servi... | Stop service.
The services resource is the top-level resource that represents the Data Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped.
@param groupName Name of the resource group
@param serviceName Name of the service
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Stop",
"service",
".",
"The",
"services",
"resource",
"is",
"the",
"top",
"-",
"level",
"resource",
"that",
"represents",
"the",
"Data",
"Migration",
"Service",
".",
"This",
"action",
"stops",
"the",
"service",
"and",
"the",
"service",
"cannot",
"be",
"used... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L1290-L1297 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/UpdateItemRequest.java | UpdateItemRequest.withAttributeUpdates | public UpdateItemRequest withAttributeUpdates(java.util.Map<String, AttributeValueUpdate> attributeUpdates) {
setAttributeUpdates(attributeUpdates);
return this;
} | java | public UpdateItemRequest withAttributeUpdates(java.util.Map<String, AttributeValueUpdate> attributeUpdates) {
setAttributeUpdates(attributeUpdates);
return this;
} | [
"public",
"UpdateItemRequest",
"withAttributeUpdates",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"AttributeValueUpdate",
">",
"attributeUpdates",
")",
"{",
"setAttributeUpdates",
"(",
"attributeUpdates",
")",
";",
"return",
"this",
";",
"}"
] | <p>
This is a legacy parameter. Use <code>UpdateExpression</code> instead. For more information, see <a href=
"https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributeUpdates.html"
>AttributeUpdates</a> in the <i>Amazon DynamoDB Developer Guide</i>.
</p>
@param attributeUpdates
This is a legacy parameter. Use <code>UpdateExpression</code> instead. For more information, see <a href=
"https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributeUpdates.html"
>AttributeUpdates</a> in the <i>Amazon DynamoDB Developer Guide</i>.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"This",
"is",
"a",
"legacy",
"parameter",
".",
"Use",
"<code",
">",
"UpdateExpression<",
"/",
"code",
">",
"instead",
".",
"For",
"more",
"information",
"see",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/UpdateItemRequest.java#L724-L727 |
antopen/alipay-sdk-java | src/main/java/com/alipay/api/internal/util/XmlUtils.java | XmlUtils.nodeToString | public static String nodeToString(Node node) throws AlipayApiException {
String payload = null;
try {
Transformer tf = TransformerFactory.newInstance().newTransformer();
Properties props = tf.getOutputProperties();
props.setProperty(OutputKeys.INDENT, LOGIC_YES);
props.setProperty(OutputKeys.ENCODING, DEFAULT_ENCODE);
tf.setOutputProperties(props);
StringWriter writer = new StringWriter();
tf.transform(new DOMSource(node), new StreamResult(writer));
payload = writer.toString();
payload = payload.replaceAll(REG_INVALID_CHARS, " ");
} catch (TransformerException e) {
throw new AlipayApiException("XML_TRANSFORM_ERROR", e);
}
return payload;
} | java | public static String nodeToString(Node node) throws AlipayApiException {
String payload = null;
try {
Transformer tf = TransformerFactory.newInstance().newTransformer();
Properties props = tf.getOutputProperties();
props.setProperty(OutputKeys.INDENT, LOGIC_YES);
props.setProperty(OutputKeys.ENCODING, DEFAULT_ENCODE);
tf.setOutputProperties(props);
StringWriter writer = new StringWriter();
tf.transform(new DOMSource(node), new StreamResult(writer));
payload = writer.toString();
payload = payload.replaceAll(REG_INVALID_CHARS, " ");
} catch (TransformerException e) {
throw new AlipayApiException("XML_TRANSFORM_ERROR", e);
}
return payload;
} | [
"public",
"static",
"String",
"nodeToString",
"(",
"Node",
"node",
")",
"throws",
"AlipayApiException",
"{",
"String",
"payload",
"=",
"null",
";",
"try",
"{",
"Transformer",
"tf",
"=",
"TransformerFactory",
".",
"newInstance",
"(",
")",
".",
"newTransformer",
... | Converts the Node/Document/Element instance to XML payload.
@param node the node/document/element instance to convert
@return the XML payload representing the node/document/element
@throws ApiException problem converting XML to string | [
"Converts",
"the",
"Node",
"/",
"Document",
"/",
"Element",
"instance",
"to",
"XML",
"payload",
"."
] | train | https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/XmlUtils.java#L436-L456 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/APIKeysInner.java | APIKeysInner.getAsync | public Observable<ApplicationInsightsComponentAPIKeyInner> getAsync(String resourceGroupName, String resourceName, String keyId) {
return getWithServiceResponseAsync(resourceGroupName, resourceName, keyId).map(new Func1<ServiceResponse<ApplicationInsightsComponentAPIKeyInner>, ApplicationInsightsComponentAPIKeyInner>() {
@Override
public ApplicationInsightsComponentAPIKeyInner call(ServiceResponse<ApplicationInsightsComponentAPIKeyInner> response) {
return response.body();
}
});
} | java | public Observable<ApplicationInsightsComponentAPIKeyInner> getAsync(String resourceGroupName, String resourceName, String keyId) {
return getWithServiceResponseAsync(resourceGroupName, resourceName, keyId).map(new Func1<ServiceResponse<ApplicationInsightsComponentAPIKeyInner>, ApplicationInsightsComponentAPIKeyInner>() {
@Override
public ApplicationInsightsComponentAPIKeyInner call(ServiceResponse<ApplicationInsightsComponentAPIKeyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationInsightsComponentAPIKeyInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"keyId",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceN... | Get the API Key for this key id.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param keyId The API Key ID. This is unique within a Application Insights component.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationInsightsComponentAPIKeyInner object | [
"Get",
"the",
"API",
"Key",
"for",
"this",
"key",
"id",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/APIKeysInner.java#L394-L401 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/RevisionHistoryHelper.java | RevisionHistoryHelper.revisionHistoryToJson | public static Map<String, Object> revisionHistoryToJson(List<InternalDocumentRevision> history) {
return revisionHistoryToJson(history, null, false, 0);
} | java | public static Map<String, Object> revisionHistoryToJson(List<InternalDocumentRevision> history) {
return revisionHistoryToJson(history, null, false, 0);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"revisionHistoryToJson",
"(",
"List",
"<",
"InternalDocumentRevision",
">",
"history",
")",
"{",
"return",
"revisionHistoryToJson",
"(",
"history",
",",
"null",
",",
"false",
",",
"0",
")",
";",
"... | Serialise a branch's revision history, without attachments.
See {@link #revisionHistoryToJson(java.util.List, java.util.List, boolean, int)} for details.
@param history list of {@code InternalDocumentRevision}s.
@return JSON-serialised {@code String} suitable for sending to CouchDB's
_bulk_docs endpoint. | [
"Serialise",
"a",
"branch",
"s",
"revision",
"history",
"without",
"attachments",
".",
"See",
"{"
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/RevisionHistoryHelper.java#L121-L123 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java | JavaTokenizer.scanHexFractionAndSuffix | private void scanHexFractionAndSuffix(int pos, boolean seendigit) {
radix = 16;
Assert.check(reader.ch == '.');
reader.putChar(true);
skipIllegalUnderscores();
if (reader.digit(pos, 16) >= 0) {
seendigit = true;
scanDigits(pos, 16);
}
if (!seendigit)
lexError(pos, "invalid.hex.number");
else
scanHexExponentAndSuffix(pos);
} | java | private void scanHexFractionAndSuffix(int pos, boolean seendigit) {
radix = 16;
Assert.check(reader.ch == '.');
reader.putChar(true);
skipIllegalUnderscores();
if (reader.digit(pos, 16) >= 0) {
seendigit = true;
scanDigits(pos, 16);
}
if (!seendigit)
lexError(pos, "invalid.hex.number");
else
scanHexExponentAndSuffix(pos);
} | [
"private",
"void",
"scanHexFractionAndSuffix",
"(",
"int",
"pos",
",",
"boolean",
"seendigit",
")",
"{",
"radix",
"=",
"16",
";",
"Assert",
".",
"check",
"(",
"reader",
".",
"ch",
"==",
"'",
"'",
")",
";",
"reader",
".",
"putChar",
"(",
"true",
")",
... | Read fractional part and 'd' or 'f' suffix of floating point number. | [
"Read",
"fractional",
"part",
"and",
"d",
"or",
"f",
"suffix",
"of",
"floating",
"point",
"number",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java#L280-L293 |
samskivert/samskivert | src/main/java/com/samskivert/util/RandomUtil.java | RandomUtil.pickRandom | public static <T> T pickRandom (Iterator<T> iter, int count)
{
return pickRandom(iter, count, rand);
} | java | public static <T> T pickRandom (Iterator<T> iter, int count)
{
return pickRandom(iter, count, rand);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"pickRandom",
"(",
"Iterator",
"<",
"T",
">",
"iter",
",",
"int",
"count",
")",
"{",
"return",
"pickRandom",
"(",
"iter",
",",
"count",
",",
"rand",
")",
";",
"}"
] | Picks a random object from the supplied iterator (which must iterate over exactly
<code>count</code> objects.
@return a randomly selected item.
@exception NoSuchElementException thrown if the iterator provides fewer than
<code>count</code> elements. | [
"Picks",
"a",
"random",
"object",
"from",
"the",
"supplied",
"iterator",
"(",
"which",
"must",
"iterate",
"over",
"exactly",
"<code",
">",
"count<",
"/",
"code",
">",
"objects",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/RandomUtil.java#L390-L393 |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ServiceExtensionLoader.java | ServiceExtensionLoader.loadExtensionClass | @SuppressWarnings("unchecked")
private <T extends Assignable> Class<T> loadExtensionClass(String extensionClassName) {
try {
return (Class<T>) ClassLoaderSearchUtilDelegator.findClassFromClassLoaders(extensionClassName,
getClassLoaders());
} catch (final ClassNotFoundException e) {
throw new RuntimeException("Could not load class " + extensionClassName, e);
}
} | java | @SuppressWarnings("unchecked")
private <T extends Assignable> Class<T> loadExtensionClass(String extensionClassName) {
try {
return (Class<T>) ClassLoaderSearchUtilDelegator.findClassFromClassLoaders(extensionClassName,
getClassLoaders());
} catch (final ClassNotFoundException e) {
throw new RuntimeException("Could not load class " + extensionClassName, e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
"extends",
"Assignable",
">",
"Class",
"<",
"T",
">",
"loadExtensionClass",
"(",
"String",
"extensionClassName",
")",
"{",
"try",
"{",
"return",
"(",
"Class",
"<",
"T",
">",
")",
"Cla... | Delegates class loading of <code>extensionClassName</code> to
{@link ClassLoaderSearchUtilDelegator#findClassFromClassLoaders(String, Iterable)} passing the
<code>extensionClassName</code> and the instance's <code>classLoaders</code>.
@param <T>
@param extensionClassName
@return | [
"Delegates",
"class",
"loading",
"of",
"<code",
">",
"extensionClassName<",
"/",
"code",
">",
"to",
"{",
"@link",
"ClassLoaderSearchUtilDelegator#findClassFromClassLoaders",
"(",
"String",
"Iterable",
")",
"}",
"passing",
"the",
"<code",
">",
"extensionClassName<",
"/... | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ServiceExtensionLoader.java#L325-L333 |
elastic/elasticsearch-hadoop | mr/src/main/java/org/elasticsearch/hadoop/serialization/bulk/AbstractBulkFactory.java | AbstractBulkFactory.addExtractorOrDynamicValue | private boolean addExtractorOrDynamicValue(List<Object> list, Object extractor, String header, boolean commaMightBeNeeded) {
if (extractor != null) {
if (commaMightBeNeeded) {
list.add(",");
}
list.add(header);
list.add(extractor);
return true;
}
return commaMightBeNeeded;
} | java | private boolean addExtractorOrDynamicValue(List<Object> list, Object extractor, String header, boolean commaMightBeNeeded) {
if (extractor != null) {
if (commaMightBeNeeded) {
list.add(",");
}
list.add(header);
list.add(extractor);
return true;
}
return commaMightBeNeeded;
} | [
"private",
"boolean",
"addExtractorOrDynamicValue",
"(",
"List",
"<",
"Object",
">",
"list",
",",
"Object",
"extractor",
",",
"String",
"header",
",",
"boolean",
"commaMightBeNeeded",
")",
"{",
"if",
"(",
"extractor",
"!=",
"null",
")",
"{",
"if",
"(",
"comm... | If extractor is present, this will add the header to the template, followed by the extractor.
If a comma is needed, the comma will be inserted before the header.
@return true if a comma may be needed on the next call. | [
"If",
"extractor",
"is",
"present",
"this",
"will",
"add",
"the",
"header",
"to",
"the",
"template",
"followed",
"by",
"the",
"extractor",
".",
"If",
"a",
"comma",
"is",
"needed",
"the",
"comma",
"will",
"be",
"inserted",
"before",
"the",
"header",
"."
] | train | https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/serialization/bulk/AbstractBulkFactory.java#L451-L461 |
greenrobot/essentials | java-essentials/src/main/java/org/greenrobot/essentials/DateUtils.java | DateUtils.setTime | public static void setTime(Calendar calendar, int hourOfDay, int minute, int second, int millisecond) {
calendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, second);
calendar.set(Calendar.MILLISECOND, millisecond);
} | java | public static void setTime(Calendar calendar, int hourOfDay, int minute, int second, int millisecond) {
calendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, second);
calendar.set(Calendar.MILLISECOND, millisecond);
} | [
"public",
"static",
"void",
"setTime",
"(",
"Calendar",
"calendar",
",",
"int",
"hourOfDay",
",",
"int",
"minute",
",",
"int",
"second",
",",
"int",
"millisecond",
")",
"{",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"hourOfDay",
")"... | Sets hour, minutes, seconds and milliseconds to the given values. Leaves date info untouched. | [
"Sets",
"hour",
"minutes",
"seconds",
"and",
"milliseconds",
"to",
"the",
"given",
"values",
".",
"Leaves",
"date",
"info",
"untouched",
"."
] | train | https://github.com/greenrobot/essentials/blob/31eaaeb410174004196c9ef9c9469e0d02afd94b/java-essentials/src/main/java/org/greenrobot/essentials/DateUtils.java#L51-L56 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.updateExistingColumnFamily | private void updateExistingColumnFamily(TableInfo tableInfo, KsDef ksDef, InvalidRequestException irex)
throws Exception
{
StringBuilder builder = new StringBuilder("^Cannot add already existing (?:column family|table) .*$");
if (irex.getWhy() != null && irex.getWhy().matches(builder.toString()))
{
SchemaOperationType operationType = SchemaOperationType.getInstance(operation);
switch (operationType)
{
case create:
handleCreate(tableInfo, ksDef);
break;
case createdrop:
handleCreate(tableInfo, ksDef);
break;
case update:
if (isCql3Enabled(tableInfo))
{
for (ColumnInfo column : tableInfo.getColumnMetadatas())
{
addColumnToTable(tableInfo, column);
}
createIndexUsingCql(tableInfo);
}
else
{
updateTable(ksDef, tableInfo);
}
break;
default:
break;
}
}
else
{
log.error("Error occurred while creating table {}, Caused by: {}.", tableInfo.getTableName(), irex);
throw new SchemaGenerationException("Error occurred while creating table " + tableInfo.getTableName(),
irex, "Cassandra", databaseName);
}
} | java | private void updateExistingColumnFamily(TableInfo tableInfo, KsDef ksDef, InvalidRequestException irex)
throws Exception
{
StringBuilder builder = new StringBuilder("^Cannot add already existing (?:column family|table) .*$");
if (irex.getWhy() != null && irex.getWhy().matches(builder.toString()))
{
SchemaOperationType operationType = SchemaOperationType.getInstance(operation);
switch (operationType)
{
case create:
handleCreate(tableInfo, ksDef);
break;
case createdrop:
handleCreate(tableInfo, ksDef);
break;
case update:
if (isCql3Enabled(tableInfo))
{
for (ColumnInfo column : tableInfo.getColumnMetadatas())
{
addColumnToTable(tableInfo, column);
}
createIndexUsingCql(tableInfo);
}
else
{
updateTable(ksDef, tableInfo);
}
break;
default:
break;
}
}
else
{
log.error("Error occurred while creating table {}, Caused by: {}.", tableInfo.getTableName(), irex);
throw new SchemaGenerationException("Error occurred while creating table " + tableInfo.getTableName(),
irex, "Cassandra", databaseName);
}
} | [
"private",
"void",
"updateExistingColumnFamily",
"(",
"TableInfo",
"tableInfo",
",",
"KsDef",
"ksDef",
",",
"InvalidRequestException",
"irex",
")",
"throws",
"Exception",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"\"^Cannot add already existing (?... | Update existing column family.
@param tableInfo
the table info
@param ksDef
the ks def
@param irex
the irex
@throws Exception
the exception | [
"Update",
"existing",
"column",
"family",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L546-L589 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/cql3/statements/CreateKeyspaceStatement.java | CreateKeyspaceStatement.validate | public void validate(ClientState state) throws RequestValidationException
{
ThriftValidation.validateKeyspaceNotSystem(name);
// keyspace name
if (!name.matches("\\w+"))
throw new InvalidRequestException(String.format("\"%s\" is not a valid keyspace name", name));
if (name.length() > Schema.NAME_LENGTH)
throw new InvalidRequestException(String.format("Keyspace names shouldn't be more than %s characters long (got \"%s\")", Schema.NAME_LENGTH, name));
attrs.validate();
if (attrs.getReplicationStrategyClass() == null)
throw new ConfigurationException("Missing mandatory replication strategy class");
// The strategy is validated through KSMetaData.validate() in announceNewKeyspace below.
// However, for backward compatibility with thrift, this doesn't validate unexpected options yet,
// so doing proper validation here.
AbstractReplicationStrategy.validateReplicationStrategy(name,
AbstractReplicationStrategy.getClass(attrs.getReplicationStrategyClass()),
StorageService.instance.getTokenMetadata(),
DatabaseDescriptor.getEndpointSnitch(),
attrs.getReplicationOptions());
} | java | public void validate(ClientState state) throws RequestValidationException
{
ThriftValidation.validateKeyspaceNotSystem(name);
// keyspace name
if (!name.matches("\\w+"))
throw new InvalidRequestException(String.format("\"%s\" is not a valid keyspace name", name));
if (name.length() > Schema.NAME_LENGTH)
throw new InvalidRequestException(String.format("Keyspace names shouldn't be more than %s characters long (got \"%s\")", Schema.NAME_LENGTH, name));
attrs.validate();
if (attrs.getReplicationStrategyClass() == null)
throw new ConfigurationException("Missing mandatory replication strategy class");
// The strategy is validated through KSMetaData.validate() in announceNewKeyspace below.
// However, for backward compatibility with thrift, this doesn't validate unexpected options yet,
// so doing proper validation here.
AbstractReplicationStrategy.validateReplicationStrategy(name,
AbstractReplicationStrategy.getClass(attrs.getReplicationStrategyClass()),
StorageService.instance.getTokenMetadata(),
DatabaseDescriptor.getEndpointSnitch(),
attrs.getReplicationOptions());
} | [
"public",
"void",
"validate",
"(",
"ClientState",
"state",
")",
"throws",
"RequestValidationException",
"{",
"ThriftValidation",
".",
"validateKeyspaceNotSystem",
"(",
"name",
")",
";",
"// keyspace name",
"if",
"(",
"!",
"name",
".",
"matches",
"(",
"\"\\\\w+\"",
... | The <code>CqlParser</code> only goes as far as extracting the keyword arguments
from these statements, so this method is responsible for processing and
validating.
@throws InvalidRequestException if arguments are missing or unacceptable | [
"The",
"<code",
">",
"CqlParser<",
"/",
"code",
">",
"only",
"goes",
"as",
"far",
"as",
"extracting",
"the",
"keyword",
"arguments",
"from",
"these",
"statements",
"so",
"this",
"method",
"is",
"responsible",
"for",
"processing",
"and",
"validating",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cql3/statements/CreateKeyspaceStatement.java#L75-L98 |
bramp/unsafe | unsafe-helper/src/main/java/net/bramp/unsafe/UnsafeHelper.java | UnsafeHelper.toAddress | public static long toAddress(Object obj) {
Object[] array = new Object[] {obj};
long baseOffset = unsafe.arrayBaseOffset(Object[].class);
return normalize(unsafe.getInt(array, baseOffset));
} | java | public static long toAddress(Object obj) {
Object[] array = new Object[] {obj};
long baseOffset = unsafe.arrayBaseOffset(Object[].class);
return normalize(unsafe.getInt(array, baseOffset));
} | [
"public",
"static",
"long",
"toAddress",
"(",
"Object",
"obj",
")",
"{",
"Object",
"[",
"]",
"array",
"=",
"new",
"Object",
"[",
"]",
"{",
"obj",
"}",
";",
"long",
"baseOffset",
"=",
"unsafe",
".",
"arrayBaseOffset",
"(",
"Object",
"[",
"]",
".",
"cl... | Returns the address the object is located at
<p>WARNING: This does not return a pointer, so be warned pointer arithmetic will not work.
@param obj The object
@return the address of the object | [
"Returns",
"the",
"address",
"the",
"object",
"is",
"located",
"at"
] | train | https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-helper/src/main/java/net/bramp/unsafe/UnsafeHelper.java#L55-L59 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.location_pccZone_stock_host_GET | public ArrayList<OvhHostStockProfile> location_pccZone_stock_host_GET(String pccZone, Long minYear) throws IOException {
String qPath = "/dedicatedCloud/location/{pccZone}/stock/host";
StringBuilder sb = path(qPath, pccZone);
query(sb, "minYear", minYear);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
} | java | public ArrayList<OvhHostStockProfile> location_pccZone_stock_host_GET(String pccZone, Long minYear) throws IOException {
String qPath = "/dedicatedCloud/location/{pccZone}/stock/host";
StringBuilder sb = path(qPath, pccZone);
query(sb, "minYear", minYear);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
} | [
"public",
"ArrayList",
"<",
"OvhHostStockProfile",
">",
"location_pccZone_stock_host_GET",
"(",
"String",
"pccZone",
",",
"Long",
"minYear",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicatedCloud/location/{pccZone}/stock/host\"",
";",
"StringBuilder",... | Available host stock
REST: GET /dedicatedCloud/location/{pccZone}/stock/host
@param minYear [required] Minimum reference year
@param pccZone [required] Name of pccZone | [
"Available",
"host",
"stock"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L3038-L3044 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.attributeInexistent | public static void attributeInexistent(String attributeName, Class<?> aClass){
throw new IllegalArgumentException(MSG.INSTANCE.message(malformedBeanException2,attributeName,aClass.getSimpleName()));
} | java | public static void attributeInexistent(String attributeName, Class<?> aClass){
throw new IllegalArgumentException(MSG.INSTANCE.message(malformedBeanException2,attributeName,aClass.getSimpleName()));
} | [
"public",
"static",
"void",
"attributeInexistent",
"(",
"String",
"attributeName",
",",
"Class",
"<",
"?",
">",
"aClass",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"MSG",
".",
"INSTANCE",
".",
"message",
"(",
"malformedBeanException2",
",",
"att... | Thrown if attributes isn't present in the xml file.
@param attributeName attribute name
@param aClass class analyzed | [
"Thrown",
"if",
"attributes",
"isn",
"t",
"present",
"in",
"the",
"xml",
"file",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L278-L280 |
lucee/Lucee | core/src/main/java/lucee/runtime/jsr223/AbstractScriptEngine.java | AbstractScriptEngine.setBindings | public void setBindings(Bindings bindings, int scope) {
if (scope == ScriptContext.GLOBAL_SCOPE) {
context.setBindings(bindings, ScriptContext.GLOBAL_SCOPE);
;
}
else if (scope == ScriptContext.ENGINE_SCOPE) {
context.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
;
}
else {
throw new IllegalArgumentException("Invalid scope value.");
}
} | java | public void setBindings(Bindings bindings, int scope) {
if (scope == ScriptContext.GLOBAL_SCOPE) {
context.setBindings(bindings, ScriptContext.GLOBAL_SCOPE);
;
}
else if (scope == ScriptContext.ENGINE_SCOPE) {
context.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
;
}
else {
throw new IllegalArgumentException("Invalid scope value.");
}
} | [
"public",
"void",
"setBindings",
"(",
"Bindings",
"bindings",
",",
"int",
"scope",
")",
"{",
"if",
"(",
"scope",
"==",
"ScriptContext",
".",
"GLOBAL_SCOPE",
")",
"{",
"context",
".",
"setBindings",
"(",
"bindings",
",",
"ScriptContext",
".",
"GLOBAL_SCOPE",
... | Sets the <code>Bindings</code> with the corresponding scope value in the <code>context</code>
field.
@param bindings The specified <code>Bindings</code>.
@param scope The specified scope.
@throws IllegalArgumentException if the value of scope is invalid for the type the
<code>context</code> field.
@throws NullPointerException if the bindings is null and the scope is
<code>ScriptContext.ENGINE_SCOPE</code> | [
"Sets",
"the",
"<code",
">",
"Bindings<",
"/",
"code",
">",
"with",
"the",
"corresponding",
"scope",
"value",
"in",
"the",
"<code",
">",
"context<",
"/",
"code",
">",
"field",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/jsr223/AbstractScriptEngine.java#L114-L127 |
facebookarchive/hive-dwrf | hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java | Slice.setBytes | public void setBytes(int index, Slice source, int sourceIndex, int length)
{
checkIndexLength(index, length);
checkPositionIndexes(sourceIndex, sourceIndex + length, source.length());
copyMemory(source.base, source.address + sourceIndex, base, address + index, length);
} | java | public void setBytes(int index, Slice source, int sourceIndex, int length)
{
checkIndexLength(index, length);
checkPositionIndexes(sourceIndex, sourceIndex + length, source.length());
copyMemory(source.base, source.address + sourceIndex, base, address + index, length);
} | [
"public",
"void",
"setBytes",
"(",
"int",
"index",
",",
"Slice",
"source",
",",
"int",
"sourceIndex",
",",
"int",
"length",
")",
"{",
"checkIndexLength",
"(",
"index",
",",
"length",
")",
";",
"checkPositionIndexes",
"(",
"sourceIndex",
",",
"sourceIndex",
"... | Transfers data from the specified slice into this buffer starting at
the specified absolute {@code index}.
@param sourceIndex the first index of the source
@param length the number of bytes to transfer
@throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0},
if the specified {@code sourceIndex} is less than {@code 0},
if {@code index + length} is greater than
{@code this.length()}, or
if {@code sourceIndex + length} is greater than
{@code source.length()} | [
"Transfers",
"data",
"from",
"the",
"specified",
"slice",
"into",
"this",
"buffer",
"starting",
"at",
"the",
"specified",
"absolute",
"{",
"@code",
"index",
"}",
"."
] | train | https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java#L503-L509 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/Ser.java | Ser.writeEpochSec | static void writeEpochSec(long epochSec, DataOutput out) throws IOException {
if (epochSec >= -4575744000L && epochSec < 10413792000L && epochSec % 900 == 0) { // quarter hours between 1825 and 2300
int store = (int) ((epochSec + 4575744000L) / 900);
out.writeByte((store >>> 16) & 255);
out.writeByte((store >>> 8) & 255);
out.writeByte(store & 255);
} else {
out.writeByte(255);
out.writeLong(epochSec);
}
} | java | static void writeEpochSec(long epochSec, DataOutput out) throws IOException {
if (epochSec >= -4575744000L && epochSec < 10413792000L && epochSec % 900 == 0) { // quarter hours between 1825 and 2300
int store = (int) ((epochSec + 4575744000L) / 900);
out.writeByte((store >>> 16) & 255);
out.writeByte((store >>> 8) & 255);
out.writeByte(store & 255);
} else {
out.writeByte(255);
out.writeLong(epochSec);
}
} | [
"static",
"void",
"writeEpochSec",
"(",
"long",
"epochSec",
",",
"DataOutput",
"out",
")",
"throws",
"IOException",
"{",
"if",
"(",
"epochSec",
">=",
"-",
"4575744000L",
"&&",
"epochSec",
"<",
"10413792000L",
"&&",
"epochSec",
"%",
"900",
"==",
"0",
")",
"... | Writes the state to the stream.
@param epochSec the epoch seconds, not null
@param out the output stream, not null
@throws IOException if an error occurs | [
"Writes",
"the",
"state",
"to",
"the",
"stream",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/Ser.java#L250-L260 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/DPTXlatorDateTime.java | DPTXlatorDateTime.setDateTimeFlag | public final void setDateTimeFlag(int field, boolean value)
{
if (field == CLOCK_SYNC) {
setBitEx(0, QUALITY, value);
return;
}
final int f = field - WORKDAY;
if (f < 0 || f >= FLAG_MASKS.length)
throw new KNXIllegalArgumentException("illegal field");
setBit(0, FLAG_MASKS[f], value);
} | java | public final void setDateTimeFlag(int field, boolean value)
{
if (field == CLOCK_SYNC) {
setBitEx(0, QUALITY, value);
return;
}
final int f = field - WORKDAY;
if (f < 0 || f >= FLAG_MASKS.length)
throw new KNXIllegalArgumentException("illegal field");
setBit(0, FLAG_MASKS[f], value);
} | [
"public",
"final",
"void",
"setDateTimeFlag",
"(",
"int",
"field",
",",
"boolean",
"value",
")",
"{",
"if",
"(",
"field",
"==",
"CLOCK_SYNC",
")",
"{",
"setBitEx",
"(",
"0",
",",
"QUALITY",
",",
"value",
")",
";",
"return",
";",
"}",
"final",
"int",
... | Sets date/time information for the given field of the first date/time item.
<p>
Allowed fields are {@link #CLOCK_FAULT}, {@link #CLOCK_SYNC}, {@link #WORKDAY}
and {@link #DAYLIGHT}.<br>
This method does not reset other item data or discard other translation items.
@param field field number
@param value <code>true</code> to set the information flag, <code>false</code>
to clear | [
"Sets",
"date",
"/",
"time",
"information",
"for",
"the",
"given",
"field",
"of",
"the",
"first",
"date",
"/",
"time",
"item",
".",
"<p",
">",
"Allowed",
"fields",
"are",
"{",
"@link",
"#CLOCK_FAULT",
"}",
"{",
"@link",
"#CLOCK_SYNC",
"}",
"{",
"@link",
... | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/DPTXlatorDateTime.java#L489-L499 |
apache/groovy | subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java | XmlUtil.newSAXParser | public static SAXParser newSAXParser(String schemaLanguage, File schema) throws SAXException, ParserConfigurationException {
return newSAXParser(schemaLanguage, true, false, schema);
} | java | public static SAXParser newSAXParser(String schemaLanguage, File schema) throws SAXException, ParserConfigurationException {
return newSAXParser(schemaLanguage, true, false, schema);
} | [
"public",
"static",
"SAXParser",
"newSAXParser",
"(",
"String",
"schemaLanguage",
",",
"File",
"schema",
")",
"throws",
"SAXException",
",",
"ParserConfigurationException",
"{",
"return",
"newSAXParser",
"(",
"schemaLanguage",
",",
"true",
",",
"false",
",",
"schema... | Factory method to create a SAXParser configured to validate according to a particular schema language and
a File containing the schema to validate against.
The created SAXParser will be namespace-aware and not validate against DTDs.
@param schemaLanguage the schema language used, e.g. XML Schema or RelaxNG (as per the String representation in javax.xml.XMLConstants)
@param schema a file containing the schema to validate against
@return the created SAXParser
@throws SAXException
@throws ParserConfigurationException
@see #newSAXParser(String, boolean, boolean, File)
@since 1.8.7 | [
"Factory",
"method",
"to",
"create",
"a",
"SAXParser",
"configured",
"to",
"validate",
"according",
"to",
"a",
"particular",
"schema",
"language",
"and",
"a",
"File",
"containing",
"the",
"schema",
"to",
"validate",
"against",
".",
"The",
"created",
"SAXParser",... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java#L274-L276 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/UsersInner.java | UsersInner.update | public UserInner update(String resourceGroupName, String labAccountName, String labName, String userName, UserFragment user) {
return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, userName, user).toBlocking().single().body();
} | java | public UserInner update(String resourceGroupName, String labAccountName, String labName, String userName, UserFragment user) {
return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, userName, user).toBlocking().single().body();
} | [
"public",
"UserInner",
"update",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"labName",
",",
"String",
"userName",
",",
"UserFragment",
"user",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",... | Modify properties of users.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param userName The name of the user.
@param user The User registered to a lab
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the UserInner object if successful. | [
"Modify",
"properties",
"of",
"users",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/UsersInner.java#L877-L879 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfAction.java | PdfAction.gotoLocalPage | public static PdfAction gotoLocalPage(int page, PdfDestination dest, PdfWriter writer) {
PdfIndirectReference ref = writer.getPageReference(page);
dest.addPage(ref);
PdfAction action = new PdfAction();
action.put(PdfName.S, PdfName.GOTO);
action.put(PdfName.D, dest);
return action;
} | java | public static PdfAction gotoLocalPage(int page, PdfDestination dest, PdfWriter writer) {
PdfIndirectReference ref = writer.getPageReference(page);
dest.addPage(ref);
PdfAction action = new PdfAction();
action.put(PdfName.S, PdfName.GOTO);
action.put(PdfName.D, dest);
return action;
} | [
"public",
"static",
"PdfAction",
"gotoLocalPage",
"(",
"int",
"page",
",",
"PdfDestination",
"dest",
",",
"PdfWriter",
"writer",
")",
"{",
"PdfIndirectReference",
"ref",
"=",
"writer",
".",
"getPageReference",
"(",
"page",
")",
";",
"dest",
".",
"addPage",
"("... | Creates a GoTo action to an internal page.
@param page the page to go. First page is 1
@param dest the destination for the page
@param writer the writer for this action
@return a GoTo action | [
"Creates",
"a",
"GoTo",
"action",
"to",
"an",
"internal",
"page",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfAction.java#L455-L462 |
mangstadt/biweekly | src/main/java/biweekly/io/TimezoneInfo.java | TimezoneInfo.removeIdentity | private static <T> void removeIdentity(List<T> list, T object) {
Iterator<T> it = list.iterator();
while (it.hasNext()) {
if (object == it.next()) {
it.remove();
}
}
} | java | private static <T> void removeIdentity(List<T> list, T object) {
Iterator<T> it = list.iterator();
while (it.hasNext()) {
if (object == it.next()) {
it.remove();
}
}
} | [
"private",
"static",
"<",
"T",
">",
"void",
"removeIdentity",
"(",
"List",
"<",
"T",
">",
"list",
",",
"T",
"object",
")",
"{",
"Iterator",
"<",
"T",
">",
"it",
"=",
"list",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",... | Removes an object from a list using reference equality.
@param list the list
@param object the object to remove | [
"Removes",
"an",
"object",
"from",
"a",
"list",
"using",
"reference",
"equality",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/TimezoneInfo.java#L282-L289 |
groupon/odo | common/src/main/java/com/groupon/odo/common/Common.java | Common.set_json_value | @ResponseOverride(
description = "Set a JSON value.",
parameters = {"name", "value", "path"}
)
public static void set_json_value(PluginArguments args, String name, String value, String path) throws Exception {
HttpServletResponse response = args.getResponse();
String content = PluginHelper.readResponseContent(response);
JSONObject jsonContent = new JSONObject(content);
process_json_value(jsonContent, name, value, path, true);
PluginHelper.writeResponseContent(response, jsonContent.toString());
} | java | @ResponseOverride(
description = "Set a JSON value.",
parameters = {"name", "value", "path"}
)
public static void set_json_value(PluginArguments args, String name, String value, String path) throws Exception {
HttpServletResponse response = args.getResponse();
String content = PluginHelper.readResponseContent(response);
JSONObject jsonContent = new JSONObject(content);
process_json_value(jsonContent, name, value, path, true);
PluginHelper.writeResponseContent(response, jsonContent.toString());
} | [
"@",
"ResponseOverride",
"(",
"description",
"=",
"\"Set a JSON value.\"",
",",
"parameters",
"=",
"{",
"\"name\"",
",",
"\"value\"",
",",
"\"path\"",
"}",
")",
"public",
"static",
"void",
"set_json_value",
"(",
"PluginArguments",
"args",
",",
"String",
"name",
... | Set a JSON value. You can access array elements by including regex index in the path. Ex: root.objectArray[0] or root.objectArray[\d]
@param args
@param name
@param value
@param path
@throws Exception | [
"Set",
"a",
"JSON",
"value",
".",
"You",
"can",
"access",
"array",
"elements",
"by",
"including",
"regex",
"index",
"in",
"the",
"path",
".",
"Ex",
":",
"root",
".",
"objectArray",
"[",
"0",
"]",
"or",
"root",
".",
"objectArray",
"[",
"\\",
"d",
"]"
... | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/common/src/main/java/com/groupon/odo/common/Common.java#L176-L187 |
di2e/Argo | CommonUtils/src/main/java/ws/argo/common/config/ResolvingXMLConfiguration.java | ResolvingXMLConfiguration.ipAddressFromURL | private String ipAddressFromURL(String url, String name) {
String ipAddr = null;
if (_urlValidator.isValid(url)) {
WebTarget resolver = ClientBuilder.newClient().target(url);
try {
ipAddr = resolver.request().get(String.class);
} catch (Exception e) {
warn("URL Cannot Resolve for resolveIP named [" + name + "]. The requested URL is invalid [" + url + "].");
}
} else {
warn("The requested URL for resolveIP named [" + name + "] is invalid [" + url + "].");
}
return ipAddr;
} | java | private String ipAddressFromURL(String url, String name) {
String ipAddr = null;
if (_urlValidator.isValid(url)) {
WebTarget resolver = ClientBuilder.newClient().target(url);
try {
ipAddr = resolver.request().get(String.class);
} catch (Exception e) {
warn("URL Cannot Resolve for resolveIP named [" + name + "]. The requested URL is invalid [" + url + "].");
}
} else {
warn("The requested URL for resolveIP named [" + name + "] is invalid [" + url + "].");
}
return ipAddr;
} | [
"private",
"String",
"ipAddressFromURL",
"(",
"String",
"url",
",",
"String",
"name",
")",
"{",
"String",
"ipAddr",
"=",
"null",
";",
"if",
"(",
"_urlValidator",
".",
"isValid",
"(",
"url",
")",
")",
"{",
"WebTarget",
"resolver",
"=",
"ClientBuilder",
".",... | Resolve the IP address from a URL.
@param url and URL that will return an IP address
@param name the name of the variable
@return the result from the HTTP GET operations or null of an error | [
"Resolve",
"the",
"IP",
"address",
"from",
"a",
"URL",
"."
] | train | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CommonUtils/src/main/java/ws/argo/common/config/ResolvingXMLConfiguration.java#L145-L159 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/StringUtils.java | StringUtils.endsWithIgnoreCase | public static boolean endsWithIgnoreCase(final String source, final String target) {
if (source.endsWith(target)) {
return true;
}
if (source.length() < target.length()) {
return false;
}
return source.substring(source.length() - target.length()).equalsIgnoreCase(target);
} | java | public static boolean endsWithIgnoreCase(final String source, final String target) {
if (source.endsWith(target)) {
return true;
}
if (source.length() < target.length()) {
return false;
}
return source.substring(source.length() - target.length()).equalsIgnoreCase(target);
} | [
"public",
"static",
"boolean",
"endsWithIgnoreCase",
"(",
"final",
"String",
"source",
",",
"final",
"String",
"target",
")",
"{",
"if",
"(",
"source",
".",
"endsWith",
"(",
"target",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"source",
".",
... | Returns true if given source string end with target string ignore case
sensitive; false otherwise.
@param source string to be tested.
@param target string to be tested.
@return true if given source string end with target string ignore case
sensitive; false otherwise. | [
"Returns",
"true",
"if",
"given",
"source",
"string",
"end",
"with",
"target",
"string",
"ignore",
"case",
"sensitive",
";",
"false",
"otherwise",
"."
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/StringUtils.java#L331-L340 |
samskivert/samskivert | src/main/java/com/samskivert/util/Config.java | Config.getValue | public float getValue (String name, float defval)
{
String val = _props.getProperty(name);
if (val != null) {
try {
defval = Float.parseFloat(val);
} catch (NumberFormatException nfe) {
log.warning("Malformed float property", "name", name, "value", val);
}
}
return defval;
} | java | public float getValue (String name, float defval)
{
String val = _props.getProperty(name);
if (val != null) {
try {
defval = Float.parseFloat(val);
} catch (NumberFormatException nfe) {
log.warning("Malformed float property", "name", name, "value", val);
}
}
return defval;
} | [
"public",
"float",
"getValue",
"(",
"String",
"name",
",",
"float",
"defval",
")",
"{",
"String",
"val",
"=",
"_props",
".",
"getProperty",
"(",
"name",
")",
";",
"if",
"(",
"val",
"!=",
"null",
")",
"{",
"try",
"{",
"defval",
"=",
"Float",
".",
"p... | Fetches and returns the value for the specified configuration property. If the value is not
specified in the associated properties file, the supplied default value is returned instead.
If the property specified in the file is poorly formatted (not and integer, not in proper
array specification), a warning message will be logged and the default value will be
returned.
@param name name of the property.
@param defval the value to return if the property is not specified in the config file.
@return the value of the requested property. | [
"Fetches",
"and",
"returns",
"the",
"value",
"for",
"the",
"specified",
"configuration",
"property",
".",
"If",
"the",
"value",
"is",
"not",
"specified",
"in",
"the",
"associated",
"properties",
"file",
"the",
"supplied",
"default",
"value",
"is",
"returned",
... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Config.java#L160-L171 |
carrotsearch/hppc | hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayDeque.java | KTypeArrayDeque.forEach | private void forEach(KTypeProcedure<? super KType> procedure, int fromIndex, final int toIndex) {
final KType[] buffer = Intrinsics.<KType[]> cast(this.buffer);
for (int i = fromIndex; i != toIndex; i = oneRight(i, buffer.length)) {
procedure.apply(buffer[i]);
}
} | java | private void forEach(KTypeProcedure<? super KType> procedure, int fromIndex, final int toIndex) {
final KType[] buffer = Intrinsics.<KType[]> cast(this.buffer);
for (int i = fromIndex; i != toIndex; i = oneRight(i, buffer.length)) {
procedure.apply(buffer[i]);
}
} | [
"private",
"void",
"forEach",
"(",
"KTypeProcedure",
"<",
"?",
"super",
"KType",
">",
"procedure",
",",
"int",
"fromIndex",
",",
"final",
"int",
"toIndex",
")",
"{",
"final",
"KType",
"[",
"]",
"buffer",
"=",
"Intrinsics",
".",
"<",
"KType",
"[",
"]",
... | Applies <code>procedure</code> to a slice of the deque,
<code>fromIndex</code>, inclusive, to <code>toIndex</code>, exclusive. | [
"Applies",
"<code",
">",
"procedure<",
"/",
"code",
">",
"to",
"a",
"slice",
"of",
"the",
"deque",
"<code",
">",
"fromIndex<",
"/",
"code",
">",
"inclusive",
"to",
"<code",
">",
"toIndex<",
"/",
"code",
">",
"exclusive",
"."
] | train | https://github.com/carrotsearch/hppc/blob/e359e9da358e846fcbffc64a765611df954ba3f6/hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayDeque.java#L682-L687 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Matth.java | Matth.powExact | public static int powExact(int b, int k) {
checkNonNegative("exponent", k);
switch (b) {
case 0:
return (k == 0) ? 1 : 0;
case 1:
return 1;
case (-1):
return ((k & 1) == 0) ? 1 : -1;
case 2:
checkNoOverflow(k < Integer.SIZE - 1);
return 1 << k;
case (-2):
checkNoOverflow(k < Integer.SIZE);
return ((k & 1) == 0) ? 1 << k : -1 << k;
default:
// continue below to handle the general case
}
int accum = 1;
while (true) {
switch (k) {
case 0:
return accum;
case 1:
return multiplyExact(accum, b);
default:
if ((k & 1) != 0) {
accum = multiplyExact(accum, b);
}
k >>= 1;
if (k > 0) {
checkNoOverflow(-FLOOR_SQRT_MAX_INT <= b & b <= FLOOR_SQRT_MAX_INT);
b *= b;
}
}
}
} | java | public static int powExact(int b, int k) {
checkNonNegative("exponent", k);
switch (b) {
case 0:
return (k == 0) ? 1 : 0;
case 1:
return 1;
case (-1):
return ((k & 1) == 0) ? 1 : -1;
case 2:
checkNoOverflow(k < Integer.SIZE - 1);
return 1 << k;
case (-2):
checkNoOverflow(k < Integer.SIZE);
return ((k & 1) == 0) ? 1 << k : -1 << k;
default:
// continue below to handle the general case
}
int accum = 1;
while (true) {
switch (k) {
case 0:
return accum;
case 1:
return multiplyExact(accum, b);
default:
if ((k & 1) != 0) {
accum = multiplyExact(accum, b);
}
k >>= 1;
if (k > 0) {
checkNoOverflow(-FLOOR_SQRT_MAX_INT <= b & b <= FLOOR_SQRT_MAX_INT);
b *= b;
}
}
}
} | [
"public",
"static",
"int",
"powExact",
"(",
"int",
"b",
",",
"int",
"k",
")",
"{",
"checkNonNegative",
"(",
"\"exponent\"",
",",
"k",
")",
";",
"switch",
"(",
"b",
")",
"{",
"case",
"0",
":",
"return",
"(",
"k",
"==",
"0",
")",
"?",
"1",
":",
"... | Returns the {@code b} to the {@code k}th power, provided it does not overflow.
<p>{@link #pow} may be faster, but does not check for overflow.
@throws ArithmeticException if {@code b} to the {@code k}th power overflows in signed
{@code int} arithmetic | [
"Returns",
"the",
"{",
"@code",
"b",
"}",
"to",
"the",
"{",
"@code",
"k",
"}",
"th",
"power",
"provided",
"it",
"does",
"not",
"overflow",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Matth.java#L1457-L1493 |
cdk/cdk | descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/ChiIndexUtils.java | ChiIndexUtils.evalSimpleIndex | public static double evalSimpleIndex(IAtomContainer atomContainer, List<List<Integer>> fragLists) {
double sum = 0;
for (List<Integer> fragList : fragLists) {
double prod = 1.0;
for (Integer atomSerial : fragList) {
IAtom atom = atomContainer.getAtom(atomSerial);
int nconnected = atomContainer.getConnectedBondsCount(atom);
prod = prod * nconnected;
}
if (prod != 0) sum += 1.0 / Math.sqrt(prod);
}
return sum;
} | java | public static double evalSimpleIndex(IAtomContainer atomContainer, List<List<Integer>> fragLists) {
double sum = 0;
for (List<Integer> fragList : fragLists) {
double prod = 1.0;
for (Integer atomSerial : fragList) {
IAtom atom = atomContainer.getAtom(atomSerial);
int nconnected = atomContainer.getConnectedBondsCount(atom);
prod = prod * nconnected;
}
if (prod != 0) sum += 1.0 / Math.sqrt(prod);
}
return sum;
} | [
"public",
"static",
"double",
"evalSimpleIndex",
"(",
"IAtomContainer",
"atomContainer",
",",
"List",
"<",
"List",
"<",
"Integer",
">",
">",
"fragLists",
")",
"{",
"double",
"sum",
"=",
"0",
";",
"for",
"(",
"List",
"<",
"Integer",
">",
"fragList",
":",
... | Evaluates the simple chi index for a set of fragments.
@param atomContainer The target <code>AtomContainer</code>
@param fragLists A list of fragments
@return The simple chi index | [
"Evaluates",
"the",
"simple",
"chi",
"index",
"for",
"a",
"set",
"of",
"fragments",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/ChiIndexUtils.java#L107-L119 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiUser.java | BoxApiUser.getCreateEnterpriseUserRequest | public BoxRequestsUser.CreateEnterpriseUser getCreateEnterpriseUserRequest(String login, String name) {
BoxRequestsUser.CreateEnterpriseUser request = new BoxRequestsUser.CreateEnterpriseUser(getUsersUrl(), mSession, login, name);
return request;
} | java | public BoxRequestsUser.CreateEnterpriseUser getCreateEnterpriseUserRequest(String login, String name) {
BoxRequestsUser.CreateEnterpriseUser request = new BoxRequestsUser.CreateEnterpriseUser(getUsersUrl(), mSession, login, name);
return request;
} | [
"public",
"BoxRequestsUser",
".",
"CreateEnterpriseUser",
"getCreateEnterpriseUserRequest",
"(",
"String",
"login",
",",
"String",
"name",
")",
"{",
"BoxRequestsUser",
".",
"CreateEnterpriseUser",
"request",
"=",
"new",
"BoxRequestsUser",
".",
"CreateEnterpriseUser",
"(",... | Gets a request that creates an enterprise user
The session provided must be associated with an enterprise admin user
@param login the login (email) of the user to create
@param name name of the user to create
@return request to create an enterprise user | [
"Gets",
"a",
"request",
"that",
"creates",
"an",
"enterprise",
"user",
"The",
"session",
"provided",
"must",
"be",
"associated",
"with",
"an",
"enterprise",
"admin",
"user"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiUser.java#L92-L95 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java | Utils.compareVersions | public static int compareVersions(String v1, String v2) {
// Remove the SNAPSHOT version.
//final String fixedv1 = v1.replaceFirst("-SNAPSHOT$", ""); //$NON-NLS-1$ //$NON-NLS-2$
//final String fixedv2 = v2.replaceFirst("-SNAPSHOT$", ""); //$NON-NLS-1$ //$NON-NLS-2$
//final Version vobject1 = Version.parseVersion(fixedv1);
//final Version vobject2 = Version.parseVersion(fixedv2);
final Version vobject1 = Version.parseVersion(v1);
final Version vobject2 = Version.parseVersion(v2);
return vobject1.compareTo(vobject2);
} | java | public static int compareVersions(String v1, String v2) {
// Remove the SNAPSHOT version.
//final String fixedv1 = v1.replaceFirst("-SNAPSHOT$", ""); //$NON-NLS-1$ //$NON-NLS-2$
//final String fixedv2 = v2.replaceFirst("-SNAPSHOT$", ""); //$NON-NLS-1$ //$NON-NLS-2$
//final Version vobject1 = Version.parseVersion(fixedv1);
//final Version vobject2 = Version.parseVersion(fixedv2);
final Version vobject1 = Version.parseVersion(v1);
final Version vobject2 = Version.parseVersion(v2);
return vobject1.compareTo(vobject2);
} | [
"public",
"static",
"int",
"compareVersions",
"(",
"String",
"v1",
",",
"String",
"v2",
")",
"{",
"// Remove the SNAPSHOT version.",
"//final String fixedv1 = v1.replaceFirst(\"-SNAPSHOT$\", \"\"); //$NON-NLS-1$ //$NON-NLS-2$",
"//final String fixedv2 = v2.replaceFirst(\"-SNAPSHOT$\", \"... | Compare the two strings as they are version numbers.
@param v1 - first version to compare.
@param v2 - second version to compare.
@return Negative integer of <code>v1</code> is lower than <code>v2</code>;
positive integer of <code>v1</code> is greater than <code>v2</code>;
{@code 0} if they are strictly equal. | [
"Compare",
"the",
"two",
"strings",
"as",
"they",
"are",
"version",
"numbers",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java#L662-L671 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.getAt | @SuppressWarnings("unchecked")
public static List<Byte> getAt(byte[] array, Range range) {
return primitiveArrayGet(array, range);
} | java | @SuppressWarnings("unchecked")
public static List<Byte> getAt(byte[] array, Range range) {
return primitiveArrayGet(array, range);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Byte",
">",
"getAt",
"(",
"byte",
"[",
"]",
"array",
",",
"Range",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] | Support the subscript operator with a range for a byte array
@param array a byte array
@param range a range indicating the indices for the items to retrieve
@return list of the retrieved bytes
@since 1.0 | [
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"range",
"for",
"a",
"byte",
"array"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13610-L13613 |
looly/hutool | hutool-captcha/src/main/java/cn/hutool/captcha/CaptchaUtil.java | CaptchaUtil.createLineCaptcha | public static LineCaptcha createLineCaptcha(int width, int height, int codeCount, int lineCount) {
return new LineCaptcha(width, height, codeCount, lineCount);
} | java | public static LineCaptcha createLineCaptcha(int width, int height, int codeCount, int lineCount) {
return new LineCaptcha(width, height, codeCount, lineCount);
} | [
"public",
"static",
"LineCaptcha",
"createLineCaptcha",
"(",
"int",
"width",
",",
"int",
"height",
",",
"int",
"codeCount",
",",
"int",
"lineCount",
")",
"{",
"return",
"new",
"LineCaptcha",
"(",
"width",
",",
"height",
",",
"codeCount",
",",
"lineCount",
")... | 创建线干扰的验证码
@param width 图片宽
@param height 图片高
@param codeCount 字符个数
@param lineCount 干扰线条数
@return {@link LineCaptcha} | [
"创建线干扰的验证码"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-captcha/src/main/java/cn/hutool/captcha/CaptchaUtil.java#L31-L33 |
apache/groovy | subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java | AstBuilder.visitBuiltInType | @Override
public VariableExpression visitBuiltInType(BuiltInTypeContext ctx) {
String text;
if (asBoolean(ctx.VOID())) {
text = ctx.VOID().getText();
} else if (asBoolean(ctx.BuiltInPrimitiveType())) {
text = ctx.BuiltInPrimitiveType().getText();
} else {
throw createParsingFailedException("Unsupported built-in type: " + ctx, ctx);
}
return configureAST(new VariableExpression(text), ctx);
} | java | @Override
public VariableExpression visitBuiltInType(BuiltInTypeContext ctx) {
String text;
if (asBoolean(ctx.VOID())) {
text = ctx.VOID().getText();
} else if (asBoolean(ctx.BuiltInPrimitiveType())) {
text = ctx.BuiltInPrimitiveType().getText();
} else {
throw createParsingFailedException("Unsupported built-in type: " + ctx, ctx);
}
return configureAST(new VariableExpression(text), ctx);
} | [
"@",
"Override",
"public",
"VariableExpression",
"visitBuiltInType",
"(",
"BuiltInTypeContext",
"ctx",
")",
"{",
"String",
"text",
";",
"if",
"(",
"asBoolean",
"(",
"ctx",
".",
"VOID",
"(",
")",
")",
")",
"{",
"text",
"=",
"ctx",
".",
"VOID",
"(",
")",
... | /*
@Override
public VariableExpression visitIdentifier(IdentifierContext ctx) {
return this.configureAST(new VariableExpression(ctx.getText()), ctx);
} | [
"/",
"*"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java#L3437-L3449 |
Domo42/saga-lib | saga-lib-guice/src/main/java/com/codebullets/sagalib/guice/FirstSagaToHandle.java | FirstSagaToHandle.firstExecute | public NextSagaToHandle firstExecute(final Class<? extends Saga> first) {
orderedTypes.add(0, first);
return new NextSagaToHandle(orderedTypes, builder);
} | java | public NextSagaToHandle firstExecute(final Class<? extends Saga> first) {
orderedTypes.add(0, first);
return new NextSagaToHandle(orderedTypes, builder);
} | [
"public",
"NextSagaToHandle",
"firstExecute",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Saga",
">",
"first",
")",
"{",
"orderedTypes",
".",
"add",
"(",
"0",
",",
"first",
")",
";",
"return",
"new",
"NextSagaToHandle",
"(",
"orderedTypes",
",",
"builder",
... | Define the first saga type to execute in case a message matches multiple ones. | [
"Define",
"the",
"first",
"saga",
"type",
"to",
"execute",
"in",
"case",
"a",
"message",
"matches",
"multiple",
"ones",
"."
] | train | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib-guice/src/main/java/com/codebullets/sagalib/guice/FirstSagaToHandle.java#L41-L44 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/SamlSettingsApi.java | SamlSettingsApi.sendMetadata | public SendMetadataResponse sendMetadata(File metadataFile, String location) throws ApiException {
ApiResponse<SendMetadataResponse> resp = sendMetadataWithHttpInfo(metadataFile, location);
return resp.getData();
} | java | public SendMetadataResponse sendMetadata(File metadataFile, String location) throws ApiException {
ApiResponse<SendMetadataResponse> resp = sendMetadataWithHttpInfo(metadataFile, location);
return resp.getData();
} | [
"public",
"SendMetadataResponse",
"sendMetadata",
"(",
"File",
"metadataFile",
",",
"String",
"location",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"SendMetadataResponse",
">",
"resp",
"=",
"sendMetadataWithHttpInfo",
"(",
"metadataFile",
",",
"location",
... | Upload new metadata.
Adds or updates the specified metadata.
@param metadataFile The metadata as xml file. (optional)
@param location The region where send metadata. (optional)
@return SendMetadataResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Upload",
"new",
"metadata",
".",
"Adds",
"or",
"updates",
"the",
"specified",
"metadata",
"."
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/SamlSettingsApi.java#L1118-L1121 |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getRuneList | public Future<RuneList> getRuneList(ItemData data, String version, String locale) {
return new DummyFuture<>(handler.getRuneList(data, version, locale));
} | java | public Future<RuneList> getRuneList(ItemData data, String version, String locale) {
return new DummyFuture<>(handler.getRuneList(data, version, locale));
} | [
"public",
"Future",
"<",
"RuneList",
">",
"getRuneList",
"(",
"ItemData",
"data",
",",
"String",
"version",
",",
"String",
"locale",
")",
"{",
"return",
"new",
"DummyFuture",
"<>",
"(",
"handler",
".",
"getRuneList",
"(",
"data",
",",
"version",
",",
"loca... | <p>
Get a list of all runes
</p>
This method does not count towards the rate limit and is not affected by the throttle
@param data Additional information to retrieve
@param version Data dragon version for returned data
@param locale Locale code for returned data
@return All runes
@see <a href=https://developer.riotgames.com/api/methods#!/649/2172>Official API documentation</a> | [
"<p",
">",
"Get",
"a",
"list",
"of",
"all",
"runes",
"<",
"/",
"p",
">",
"This",
"method",
"does",
"not",
"count",
"towards",
"the",
"rate",
"limit",
"and",
"is",
"not",
"affected",
"by",
"the",
"throttle"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L657-L659 |
actorapp/actor-platform | actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java | Messenger.sendMessage | @ObjectiveCName("sendMessageWithPeer:withText:withMentions:")
public void sendMessage(@NotNull Peer peer, @NotNull String text, @Nullable ArrayList<Integer> mentions) {
sendMessage(peer, text, null, mentions, false);
} | java | @ObjectiveCName("sendMessageWithPeer:withText:withMentions:")
public void sendMessage(@NotNull Peer peer, @NotNull String text, @Nullable ArrayList<Integer> mentions) {
sendMessage(peer, text, null, mentions, false);
} | [
"@",
"ObjectiveCName",
"(",
"\"sendMessageWithPeer:withText:withMentions:\"",
")",
"public",
"void",
"sendMessage",
"(",
"@",
"NotNull",
"Peer",
"peer",
",",
"@",
"NotNull",
"String",
"text",
",",
"@",
"Nullable",
"ArrayList",
"<",
"Integer",
">",
"mentions",
")",... | Send Text Message with mentions
@param peer destination peer
@param text message text
@param mentions user's mentions | [
"Send",
"Text",
"Message",
"with",
"mentions"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L806-L809 |
JodaOrg/joda-time | src/main/java/org/joda/time/PeriodType.java | PeriodType.getIndexedField | int getIndexedField(ReadablePeriod period, int index) {
int realIndex = iIndices[index];
return (realIndex == -1 ? 0 : period.getValue(realIndex));
} | java | int getIndexedField(ReadablePeriod period, int index) {
int realIndex = iIndices[index];
return (realIndex == -1 ? 0 : period.getValue(realIndex));
} | [
"int",
"getIndexedField",
"(",
"ReadablePeriod",
"period",
",",
"int",
"index",
")",
"{",
"int",
"realIndex",
"=",
"iIndices",
"[",
"index",
"]",
";",
"return",
"(",
"realIndex",
"==",
"-",
"1",
"?",
"0",
":",
"period",
".",
"getValue",
"(",
"realIndex",... | Gets the indexed field part of the period.
@param period the period to query
@param index the index to use
@return the value of the field, zero if unsupported | [
"Gets",
"the",
"indexed",
"field",
"part",
"of",
"the",
"period",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/PeriodType.java#L673-L676 |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByCreatedBy | public Iterable<DContact> queryByCreatedBy(Object parent, java.lang.String createdBy) {
return queryByField(parent, DContactMapper.Field.CREATEDBY.getFieldName(), createdBy);
} | java | public Iterable<DContact> queryByCreatedBy(Object parent, java.lang.String createdBy) {
return queryByField(parent, DContactMapper.Field.CREATEDBY.getFieldName(), createdBy);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByCreatedBy",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"createdBy",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"CREATEDBY",
".",
"get... | query-by method for field createdBy
@param createdBy the specified attribute
@return an Iterable of DContacts for the specified createdBy | [
"query",
"-",
"by",
"method",
"for",
"field",
"createdBy"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L133-L135 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java | BaseProfile.writeIronjacamarXml | private void writeIronjacamarXml(Definition def, String outputDir) throws IOException
{
FileWriter ijfw = Utils.createFile("ironjacamar.xml", outputDir + File.separatorChar + "META-INF");
IronjacamarXmlGen ijxGen = new IronjacamarXmlGen();
ijxGen.generate(def, ijfw);
ijfw.close();
} | java | private void writeIronjacamarXml(Definition def, String outputDir) throws IOException
{
FileWriter ijfw = Utils.createFile("ironjacamar.xml", outputDir + File.separatorChar + "META-INF");
IronjacamarXmlGen ijxGen = new IronjacamarXmlGen();
ijxGen.generate(def, ijfw);
ijfw.close();
} | [
"private",
"void",
"writeIronjacamarXml",
"(",
"Definition",
"def",
",",
"String",
"outputDir",
")",
"throws",
"IOException",
"{",
"FileWriter",
"ijfw",
"=",
"Utils",
".",
"createFile",
"(",
"\"ironjacamar.xml\"",
",",
"outputDir",
"+",
"File",
".",
"separatorChar... | writeIronjacamarXml
@param def Definition
@param outputDir output directory
@throws IOException output exception | [
"writeIronjacamarXml"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java#L496-L502 |
moparisthebest/beehive | beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultRowSetResultSetMapper.java | DefaultRowSetResultSetMapper.mapToResultType | public RowSet mapToResultType(ControlBeanContext context, Method m, ResultSet resultSet, Calendar cal) {
final SQL methodSQL = (SQL) context.getMethodPropertySet(m, SQL.class);
final int maxrows = methodSQL.maxRows();
try {
CachedRowSetImpl rows = new CachedRowSetImpl();
if (maxrows > 0) {
rows.setMaxRows(maxrows);
}
rows.populate(resultSet);
return rows;
} catch (SQLException e) {
throw new ControlException(e.getMessage(), e);
}
} | java | public RowSet mapToResultType(ControlBeanContext context, Method m, ResultSet resultSet, Calendar cal) {
final SQL methodSQL = (SQL) context.getMethodPropertySet(m, SQL.class);
final int maxrows = methodSQL.maxRows();
try {
CachedRowSetImpl rows = new CachedRowSetImpl();
if (maxrows > 0) {
rows.setMaxRows(maxrows);
}
rows.populate(resultSet);
return rows;
} catch (SQLException e) {
throw new ControlException(e.getMessage(), e);
}
} | [
"public",
"RowSet",
"mapToResultType",
"(",
"ControlBeanContext",
"context",
",",
"Method",
"m",
",",
"ResultSet",
"resultSet",
",",
"Calendar",
"cal",
")",
"{",
"final",
"SQL",
"methodSQL",
"=",
"(",
"SQL",
")",
"context",
".",
"getMethodPropertySet",
"(",
"m... | Map a ResultSet to a RowSet. Type of RowSet is defined by the SQL annotation for the method.
@param context A ControlBeanContext instance.
@param m Method assoicated with this call.
@param resultSet Result set to map.
@param cal A Calendar instance for resolving date/time values.
@return A RowSet object. | [
"Map",
"a",
"ResultSet",
"to",
"a",
"RowSet",
".",
"Type",
"of",
"RowSet",
"is",
"defined",
"by",
"the",
"SQL",
"annotation",
"for",
"the",
"method",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultRowSetResultSetMapper.java#L47-L63 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MPIO.java | MPIO.getOrCreateNewMPConnection | public MPConnection getOrCreateNewMPConnection(SIBUuid8 remoteUuid,
MEConnection conn)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getOrCreateNewMPConnection", new Object[] {remoteUuid, conn });
MPConnection mpConn;
synchronized(_mpConnectionsByMEConnection)
{
//look up the connection in the cache
mpConn = _mpConnectionsByMEConnection.get(conn);
//if it is not in the cache
if(mpConn == null)
{
//make sure we know the cellule
if(remoteUuid == null)
{
remoteUuid = new SIBUuid8(conn.getMessagingEngine().getUuid());
}
//create a new MPConnection for this MEConnection
mpConn = new MPConnection(this,conn,remoteUuid);
//put it in the cache
_mpConnectionsByMEConnection.put(conn, mpConn);
_mpConnectionsByMEUuid.put(remoteUuid, mpConn);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getOrCreateNewMPConnection", mpConn);
//return the MPConnection
return mpConn;
} | java | public MPConnection getOrCreateNewMPConnection(SIBUuid8 remoteUuid,
MEConnection conn)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getOrCreateNewMPConnection", new Object[] {remoteUuid, conn });
MPConnection mpConn;
synchronized(_mpConnectionsByMEConnection)
{
//look up the connection in the cache
mpConn = _mpConnectionsByMEConnection.get(conn);
//if it is not in the cache
if(mpConn == null)
{
//make sure we know the cellule
if(remoteUuid == null)
{
remoteUuid = new SIBUuid8(conn.getMessagingEngine().getUuid());
}
//create a new MPConnection for this MEConnection
mpConn = new MPConnection(this,conn,remoteUuid);
//put it in the cache
_mpConnectionsByMEConnection.put(conn, mpConn);
_mpConnectionsByMEUuid.put(remoteUuid, mpConn);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getOrCreateNewMPConnection", mpConn);
//return the MPConnection
return mpConn;
} | [
"public",
"MPConnection",
"getOrCreateNewMPConnection",
"(",
"SIBUuid8",
"remoteUuid",
",",
"MEConnection",
"conn",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entr... | Get a MPConnection from the cache and if there isn't one, create a new one and
put it in the cache.
@param cellule The cellule to find a MPConnection for (optional)
@param conn The MEConnection to find a MPConnection for
@return the MPConnection | [
"Get",
"a",
"MPConnection",
"from",
"the",
"cache",
"and",
"if",
"there",
"isn",
"t",
"one",
"create",
"a",
"new",
"one",
"and",
"put",
"it",
"in",
"the",
"cache",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MPIO.java#L231-L264 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.