repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
skyscreamer/JSONassert | src/main/java/org/skyscreamer/jsonassert/JSONAssert.java | JSONAssert.assertEquals | public static void assertEquals(String expectedStr, JSONObject actual, JSONCompareMode compareMode)
throws JSONException {
assertEquals("", expectedStr, actual, compareMode);
} | java | public static void assertEquals(String expectedStr, JSONObject actual, JSONCompareMode compareMode)
throws JSONException {
assertEquals("", expectedStr, actual, compareMode);
} | [
"public",
"static",
"void",
"assertEquals",
"(",
"String",
"expectedStr",
",",
"JSONObject",
"actual",
",",
"JSONCompareMode",
"compareMode",
")",
"throws",
"JSONException",
"{",
"assertEquals",
"(",
"\"\"",
",",
"expectedStr",
",",
"actual",
",",
"compareMode",
"... | Asserts that the JSONObject provided matches the expected string. If it isn't it throws an
{@link AssertionError}.
@param expectedStr Expected JSON string
@param actual JSONObject to compare
@param compareMode Specifies which comparison mode to use
@throws JSONException JSON parsing error | [
"Asserts",
"that",
"the",
"JSONObject",
"provided",
"matches",
"the",
"expected",
"string",
".",
"If",
"it",
"isn",
"t",
"it",
"throws",
"an",
"{",
"@link",
"AssertionError",
"}",
"."
] | train | https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONAssert.java#L126-L129 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java | CmsDomUtil.positionElement | public static void positionElement(Element elem, Element referenceElement, int dx, int dy) {
com.google.gwt.dom.client.Style style = elem.getStyle();
style.setLeft(0, Unit.PX);
style.setTop(0, Unit.PX);
int myX = elem.getAbsoluteLeft();
int myY = elem.getAbsoluteTop();
int refX = referenceElement.getAbsoluteLeft();
int refY = referenceElement.getAbsoluteTop();
int newX = (refX - myX) + dx;
int newY = (refY - myY) + dy;
style.setLeft(newX, Unit.PX);
style.setTop(newY, Unit.PX);
} | java | public static void positionElement(Element elem, Element referenceElement, int dx, int dy) {
com.google.gwt.dom.client.Style style = elem.getStyle();
style.setLeft(0, Unit.PX);
style.setTop(0, Unit.PX);
int myX = elem.getAbsoluteLeft();
int myY = elem.getAbsoluteTop();
int refX = referenceElement.getAbsoluteLeft();
int refY = referenceElement.getAbsoluteTop();
int newX = (refX - myX) + dx;
int newY = (refY - myY) + dy;
style.setLeft(newX, Unit.PX);
style.setTop(newY, Unit.PX);
} | [
"public",
"static",
"void",
"positionElement",
"(",
"Element",
"elem",
",",
"Element",
"referenceElement",
",",
"int",
"dx",
",",
"int",
"dy",
")",
"{",
"com",
".",
"google",
".",
"gwt",
".",
"dom",
".",
"client",
".",
"Style",
"style",
"=",
"elem",
".... | Positions an element in the DOM relative to another element.<p>
@param elem the element to position
@param referenceElement the element relative to which the first element should be positioned
@param dx the x offset relative to the reference element
@param dy the y offset relative to the reference element | [
"Positions",
"an",
"element",
"in",
"the",
"DOM",
"relative",
"to",
"another",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java#L1766-L1779 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.listMetricDefinitions | public MetricDefinitionInner listMetricDefinitions(String resourceGroupName, String name) {
return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | java | public MetricDefinitionInner listMetricDefinitions(String resourceGroupName, String name) {
return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | [
"public",
"MetricDefinitionInner",
"listMetricDefinitions",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"listMetricDefinitionsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"toBlocking",
"(",
")",
".",
"sin... | Get global metric definitions of an App Service Environment.
Get global metric definitions of an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@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 MetricDefinitionInner object if successful. | [
"Get",
"global",
"metric",
"definitions",
"of",
"an",
"App",
"Service",
"Environment",
".",
"Get",
"global",
"metric",
"definitions",
"of",
"an",
"App",
"Service",
"Environment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L1703-L1705 |
undertow-io/undertow | core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/ModClusterContainer.java | ModClusterContainer.addNode | public synchronized boolean addNode(final NodeConfig config, final Balancer.BalancerBuilder balancerConfig, final XnioIoThread ioThread, final ByteBufferPool bufferPool) {
final String jvmRoute = config.getJvmRoute();
final Node existing = nodes.get(jvmRoute);
if (existing != null) {
if (config.getConnectionURI().equals(existing.getNodeConfig().getConnectionURI())) {
// TODO better check if they are the same
existing.resetState();
return true;
} else {
existing.markRemoved();
removeNode(existing);
if (!existing.isInErrorState()) {
return false; // replies with MNODERM error
}
}
}
final String balancerRef = config.getBalancer();
Balancer balancer = balancers.get(balancerRef);
if (balancer != null) {
UndertowLogger.ROOT_LOGGER.debugf("Balancer %s already exists, replacing", balancerRef);
}
balancer = balancerConfig.build();
balancers.put(balancerRef, balancer);
final Node node = new Node(config, balancer, ioThread, bufferPool, this);
nodes.put(jvmRoute, node);
// Schedule the health check
scheduleHealthCheck(node, ioThread);
// Reset the load factor periodically
if (updateLoadTask.cancelKey == null) {
updateLoadTask.cancelKey = ioThread.executeAtInterval(updateLoadTask, modCluster.getHealthCheckInterval(), TimeUnit.MILLISECONDS);
}
// Remove from the failover groups
failoverDomains.remove(node.getJvmRoute());
UndertowLogger.ROOT_LOGGER.registeringNode(jvmRoute, config.getConnectionURI());
return true;
} | java | public synchronized boolean addNode(final NodeConfig config, final Balancer.BalancerBuilder balancerConfig, final XnioIoThread ioThread, final ByteBufferPool bufferPool) {
final String jvmRoute = config.getJvmRoute();
final Node existing = nodes.get(jvmRoute);
if (existing != null) {
if (config.getConnectionURI().equals(existing.getNodeConfig().getConnectionURI())) {
// TODO better check if they are the same
existing.resetState();
return true;
} else {
existing.markRemoved();
removeNode(existing);
if (!existing.isInErrorState()) {
return false; // replies with MNODERM error
}
}
}
final String balancerRef = config.getBalancer();
Balancer balancer = balancers.get(balancerRef);
if (balancer != null) {
UndertowLogger.ROOT_LOGGER.debugf("Balancer %s already exists, replacing", balancerRef);
}
balancer = balancerConfig.build();
balancers.put(balancerRef, balancer);
final Node node = new Node(config, balancer, ioThread, bufferPool, this);
nodes.put(jvmRoute, node);
// Schedule the health check
scheduleHealthCheck(node, ioThread);
// Reset the load factor periodically
if (updateLoadTask.cancelKey == null) {
updateLoadTask.cancelKey = ioThread.executeAtInterval(updateLoadTask, modCluster.getHealthCheckInterval(), TimeUnit.MILLISECONDS);
}
// Remove from the failover groups
failoverDomains.remove(node.getJvmRoute());
UndertowLogger.ROOT_LOGGER.registeringNode(jvmRoute, config.getConnectionURI());
return true;
} | [
"public",
"synchronized",
"boolean",
"addNode",
"(",
"final",
"NodeConfig",
"config",
",",
"final",
"Balancer",
".",
"BalancerBuilder",
"balancerConfig",
",",
"final",
"XnioIoThread",
"ioThread",
",",
"final",
"ByteBufferPool",
"bufferPool",
")",
"{",
"final",
"Stri... | Register a new node.
@param config the node configuration
@param balancerConfig the balancer configuration
@param ioThread the associated I/O thread
@param bufferPool the buffer pool
@return whether the node could be created or not | [
"Register",
"a",
"new",
"node",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/ModClusterContainer.java#L167-L205 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.between | public static long between(Date beginDate, Date endDate, DateUnit unit) {
return between(beginDate, endDate, unit, true);
} | java | public static long between(Date beginDate, Date endDate, DateUnit unit) {
return between(beginDate, endDate, unit, true);
} | [
"public",
"static",
"long",
"between",
"(",
"Date",
"beginDate",
",",
"Date",
"endDate",
",",
"DateUnit",
"unit",
")",
"{",
"return",
"between",
"(",
"beginDate",
",",
"endDate",
",",
"unit",
",",
"true",
")",
";",
"}"
] | 判断两个日期相差的时长,只保留绝对值
@param beginDate 起始日期
@param endDate 结束日期
@param unit 相差的单位:相差 天{@link DateUnit#DAY}、小时{@link DateUnit#HOUR} 等
@return 日期差 | [
"判断两个日期相差的时长,只保留绝对值"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1228-L1230 |
trellis-ldp/trellis | core/http/src/main/java/org/trellisldp/http/impl/HttpUtils.java | HttpUtils.closeInputStreamAsync | public static BiConsumer<Object, Throwable> closeInputStreamAsync(final InputStream input) {
return (val, err) -> {
try {
input.close();
} catch (final IOException ex) {
throw new UncheckedIOException("Error closing input stream", ex);
}
};
} | java | public static BiConsumer<Object, Throwable> closeInputStreamAsync(final InputStream input) {
return (val, err) -> {
try {
input.close();
} catch (final IOException ex) {
throw new UncheckedIOException("Error closing input stream", ex);
}
};
} | [
"public",
"static",
"BiConsumer",
"<",
"Object",
",",
"Throwable",
">",
"closeInputStreamAsync",
"(",
"final",
"InputStream",
"input",
")",
"{",
"return",
"(",
"val",
",",
"err",
")",
"->",
"{",
"try",
"{",
"input",
".",
"close",
"(",
")",
";",
"}",
"c... | Close an input stream in an async chain.
@param input the input stream
@return a bifunction that closes the stream | [
"Close",
"an",
"input",
"stream",
"in",
"an",
"async",
"chain",
"."
] | train | https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/core/http/src/main/java/org/trellisldp/http/impl/HttpUtils.java#L234-L242 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/geohash/LinearKeyAlgo.java | LinearKeyAlgo.encode | @Override
public final long encode(double lat, double lon) {
lat = Math.min(Math.max(lat, bounds.minLat), bounds.maxLat);
lon = Math.min(Math.max(lon, bounds.minLon), bounds.maxLon);
// introduce a minor correction to round to lower grid entry!
long latIndex = (long) ((lat - bounds.minLat) / latDelta * C);
long lonIndex = (long) ((lon - bounds.minLon) / lonDelta * C);
return latIndex * lonUnits + lonIndex;
} | java | @Override
public final long encode(double lat, double lon) {
lat = Math.min(Math.max(lat, bounds.minLat), bounds.maxLat);
lon = Math.min(Math.max(lon, bounds.minLon), bounds.maxLon);
// introduce a minor correction to round to lower grid entry!
long latIndex = (long) ((lat - bounds.minLat) / latDelta * C);
long lonIndex = (long) ((lon - bounds.minLon) / lonDelta * C);
return latIndex * lonUnits + lonIndex;
} | [
"@",
"Override",
"public",
"final",
"long",
"encode",
"(",
"double",
"lat",
",",
"double",
"lon",
")",
"{",
"lat",
"=",
"Math",
".",
"min",
"(",
"Math",
".",
"max",
"(",
"lat",
",",
"bounds",
".",
"minLat",
")",
",",
"bounds",
".",
"maxLat",
")",
... | Take latitude and longitude as input.
<p>
@return the linear key | [
"Take",
"latitude",
"and",
"longitude",
"as",
"input",
".",
"<p",
">"
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/geohash/LinearKeyAlgo.java#L80-L88 |
hypercube1024/firefly | firefly-db/src/main/java/com/firefly/db/init/ScriptUtils.java | ScriptUtils.splitSqlScript | public static void splitSqlScript(String script, String separator, List<String> statements) throws ScriptException {
splitSqlScript(null, script, separator, DEFAULT_COMMENT_PREFIX, DEFAULT_BLOCK_COMMENT_START_DELIMITER,
DEFAULT_BLOCK_COMMENT_END_DELIMITER, statements);
} | java | public static void splitSqlScript(String script, String separator, List<String> statements) throws ScriptException {
splitSqlScript(null, script, separator, DEFAULT_COMMENT_PREFIX, DEFAULT_BLOCK_COMMENT_START_DELIMITER,
DEFAULT_BLOCK_COMMENT_END_DELIMITER, statements);
} | [
"public",
"static",
"void",
"splitSqlScript",
"(",
"String",
"script",
",",
"String",
"separator",
",",
"List",
"<",
"String",
">",
"statements",
")",
"throws",
"ScriptException",
"{",
"splitSqlScript",
"(",
"null",
",",
"script",
",",
"separator",
",",
"DEFAU... | Split an SQL script into separate statements delimited by the provided
separator string. Each individual statement will be added to the provided
{@code List}.
<p>
Within the script, {@value #DEFAULT_COMMENT_PREFIX} will be used as the
comment prefix; any text beginning with the comment prefix and extending
to the end of the line will be omitted from the output. Similarly,
{@value #DEFAULT_BLOCK_COMMENT_START_DELIMITER} and
{@value #DEFAULT_BLOCK_COMMENT_END_DELIMITER} will be used as the
<em>start</em> and <em>end</em> block comment delimiters: any text
enclosed in a block comment will be omitted from the output. In addition,
multiple adjacent whitespace characters will be collapsed into a single
space.
@param script the SQL script
@param separator text separating each statement — typically a ';' or
newline character
@param statements the list that will contain the individual statements
@throws ScriptException if an error occurred while splitting the SQL script
@see #splitSqlScript(String, char, List)
@see #splitSqlScript(EncodedResource, String, String, String, String,
String, List) | [
"Split",
"an",
"SQL",
"script",
"into",
"separate",
"statements",
"delimited",
"by",
"the",
"provided",
"separator",
"string",
".",
"Each",
"individual",
"statement",
"will",
"be",
"added",
"to",
"the",
"provided",
"{",
"@code",
"List",
"}",
".",
"<p",
">",
... | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-db/src/main/java/com/firefly/db/init/ScriptUtils.java#L123-L126 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/BandwidthSchedulesInner.java | BandwidthSchedulesInner.createOrUpdateAsync | public Observable<BandwidthScheduleInner> createOrUpdateAsync(String deviceName, String name, String resourceGroupName, BandwidthScheduleInner parameters) {
return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, parameters).map(new Func1<ServiceResponse<BandwidthScheduleInner>, BandwidthScheduleInner>() {
@Override
public BandwidthScheduleInner call(ServiceResponse<BandwidthScheduleInner> response) {
return response.body();
}
});
} | java | public Observable<BandwidthScheduleInner> createOrUpdateAsync(String deviceName, String name, String resourceGroupName, BandwidthScheduleInner parameters) {
return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, parameters).map(new Func1<ServiceResponse<BandwidthScheduleInner>, BandwidthScheduleInner>() {
@Override
public BandwidthScheduleInner call(ServiceResponse<BandwidthScheduleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BandwidthScheduleInner",
">",
"createOrUpdateAsync",
"(",
"String",
"deviceName",
",",
"String",
"name",
",",
"String",
"resourceGroupName",
",",
"BandwidthScheduleInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsyn... | Creates or updates a bandwidth schedule.
@param deviceName The device name.
@param name The bandwidth schedule name which needs to be added/updated.
@param resourceGroupName The resource group name.
@param parameters The bandwidth schedule to be added or updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"a",
"bandwidth",
"schedule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/BandwidthSchedulesInner.java#L351-L358 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructor.java | MapperConstructor.isNullSetting | private boolean isNullSetting(boolean makeDest,MappingType mtd,MappingType mts,StringBuilder result){
if( makeDest
&& (mtd == ALL_FIELDS||mtd == ONLY_VALUED_FIELDS)
&& mts == ONLY_NULL_FIELDS){
result.append(" "+stringOfSetDestination+"(null);"+newLine);
return true;
}
return false;
} | java | private boolean isNullSetting(boolean makeDest,MappingType mtd,MappingType mts,StringBuilder result){
if( makeDest
&& (mtd == ALL_FIELDS||mtd == ONLY_VALUED_FIELDS)
&& mts == ONLY_NULL_FIELDS){
result.append(" "+stringOfSetDestination+"(null);"+newLine);
return true;
}
return false;
} | [
"private",
"boolean",
"isNullSetting",
"(",
"boolean",
"makeDest",
",",
"MappingType",
"mtd",
",",
"MappingType",
"mts",
",",
"StringBuilder",
"result",
")",
"{",
"if",
"(",
"makeDest",
"&&",
"(",
"mtd",
"==",
"ALL_FIELDS",
"||",
"mtd",
"==",
"ONLY_VALUED_FIEL... | if it is a null setting returns the null mapping
@param makeDest true if destination is a new instance
@param mtd mapping type of destination
@param mts mapping type of source
@param result StringBuilder used for mapping
@return true if operation is a null setting, false otherwise | [
"if",
"it",
"is",
"a",
"null",
"setting",
"returns",
"the",
"null",
"mapping"
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructor.java#L206-L214 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java | Preconditions.checkNotNull | public static <T> T checkNotNull(
T reference, String messageFormat, Object... messageArgs) {
if (reference == null) {
throw new NullPointerException(format(messageFormat, messageArgs));
}
return reference;
} | java | public static <T> T checkNotNull(
T reference, String messageFormat, Object... messageArgs) {
if (reference == null) {
throw new NullPointerException(format(messageFormat, messageArgs));
}
return reference;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"checkNotNull",
"(",
"T",
"reference",
",",
"String",
"messageFormat",
",",
"Object",
"...",
"messageArgs",
")",
"{",
"if",
"(",
"reference",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"form... | Checks that the given object reference is not {@code null} and throws a customized
{@link NullPointerException} if it is. Intended for doing parameter validation in methods and
constructors, e.g.:
<blockquote><pre>
public void foo(Bar bar, Baz baz) {
this.bar = Preconditions.checkNotNull(bar, "bar must not be null.");
Preconditions.checkNotBull(baz, "The %s must not be null.", "baz");
}
</pre></blockquote>
@param reference the object reference to check for being {@code null}
@param messageFormat a {@link Formatter format} string for the detail message to be used in
the event that an exception is thrown.
@param messageArgs the arguments referenced by the format specifiers in the
{@code messageFormat}
@param <T> the type of the reference
@return {@code reference} if not {@code null}
@throws NullPointerException if {@code reference} is {@code null} | [
"Checks",
"that",
"the",
"given",
"object",
"reference",
"is",
"not",
"{",
"@code",
"null",
"}",
"and",
"throws",
"a",
"customized",
"{",
"@link",
"NullPointerException",
"}",
"if",
"it",
"is",
".",
"Intended",
"for",
"doing",
"parameter",
"validation",
"in"... | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java#L137-L143 |
wanglinsong/testharness | src/main/java/com/tascape/qa/th/comm/MySqlCommunication.java | MySqlCommunication.replicateTable | public String replicateTable(String tableName, boolean toCopyData) throws SQLException {
String tempTableName = MySqlCommunication.getTempTableName(tableName);
LOG.debug("Replicate table {} into {}", tableName, tempTableName);
if (this.tableExists(tempTableName)) {
this.truncateTempTable(tempTableName);
} else {
this.createTempTable(tableName);
}
if (toCopyData) {
final String sql = "INSERT INTO " + tempTableName + " SELECT * FROM " + tableName + ";";
this.executeUpdate(sql);
}
return tempTableName;
} | java | public String replicateTable(String tableName, boolean toCopyData) throws SQLException {
String tempTableName = MySqlCommunication.getTempTableName(tableName);
LOG.debug("Replicate table {} into {}", tableName, tempTableName);
if (this.tableExists(tempTableName)) {
this.truncateTempTable(tempTableName);
} else {
this.createTempTable(tableName);
}
if (toCopyData) {
final String sql = "INSERT INTO " + tempTableName + " SELECT * FROM " + tableName + ";";
this.executeUpdate(sql);
}
return tempTableName;
} | [
"public",
"String",
"replicateTable",
"(",
"String",
"tableName",
",",
"boolean",
"toCopyData",
")",
"throws",
"SQLException",
"{",
"String",
"tempTableName",
"=",
"MySqlCommunication",
".",
"getTempTableName",
"(",
"tableName",
")",
";",
"LOG",
".",
"debug",
"(",... | Replicates table structure and data from source to temporary table.
@param tableName existing table name
@param toCopyData boolean
@return new table name
@throws SQLException for any issue | [
"Replicates",
"table",
"structure",
"and",
"data",
"from",
"source",
"to",
"temporary",
"table",
"."
] | train | https://github.com/wanglinsong/testharness/blob/76f3e4546648e0720f6f87a58cb91a09cd36dfca/src/main/java/com/tascape/qa/th/comm/MySqlCommunication.java#L118-L131 |
JadiraOrg/jadira | bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java | BasicBinder.registerMarshaller | public final <S, T> void registerMarshaller(Class<S> source, Class<T> target, ToMarshaller<S, T> converter) {
Class<? extends Annotation> scope = matchImplementationToScope(converter.getClass());
registerMarshaller(new ConverterKey<S,T>(source, target, scope == null ? DefaultBinding.class : scope), converter);
} | java | public final <S, T> void registerMarshaller(Class<S> source, Class<T> target, ToMarshaller<S, T> converter) {
Class<? extends Annotation> scope = matchImplementationToScope(converter.getClass());
registerMarshaller(new ConverterKey<S,T>(source, target, scope == null ? DefaultBinding.class : scope), converter);
} | [
"public",
"final",
"<",
"S",
",",
"T",
">",
"void",
"registerMarshaller",
"(",
"Class",
"<",
"S",
">",
"source",
",",
"Class",
"<",
"T",
">",
"target",
",",
"ToMarshaller",
"<",
"S",
",",
"T",
">",
"converter",
")",
"{",
"Class",
"<",
"?",
"extends... | Register a Marshaller with the given source and target class.
The marshaller is used as follows: Instances of the source can be marshalled into the target class.
@param source The source (input) class
@param target The target (output) class
@param converter The ToMarshaller to be registered | [
"Register",
"a",
"Marshaller",
"with",
"the",
"given",
"source",
"and",
"target",
"class",
".",
"The",
"marshaller",
"is",
"used",
"as",
"follows",
":",
"Instances",
"of",
"the",
"source",
"can",
"be",
"marshalled",
"into",
"the",
"target",
"class",
"."
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L568-L571 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Document.java | Document.addAuthor | public boolean addAuthor(String author) {
try {
return add(new Meta(Element.AUTHOR, author));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
} | java | public boolean addAuthor(String author) {
try {
return add(new Meta(Element.AUTHOR, author));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
} | [
"public",
"boolean",
"addAuthor",
"(",
"String",
"author",
")",
"{",
"try",
"{",
"return",
"add",
"(",
"new",
"Meta",
"(",
"Element",
".",
"AUTHOR",
",",
"author",
")",
")",
";",
"}",
"catch",
"(",
"DocumentException",
"de",
")",
"{",
"throw",
"new",
... | Adds the author to a Document.
@param author
the name of the author
@return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise | [
"Adds",
"the",
"author",
"to",
"a",
"Document",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Document.java#L576-L582 |
cdk/cdk | base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/AbstractVFState.java | AbstractVFState.nextM | @Override
final int nextM(int n, int m) {
if (size == 0) return m + 1;
// if the query vertex 'n' is in the terminal set (t1) then the
// target vertex must be in the terminal set (t2)
for (int i = m + 1; i < g2.length; i++)
if (m2[i] == UNMAPPED && (t1[n] == 0 || t2[i] > 0)) return i;
return mMax();
} | java | @Override
final int nextM(int n, int m) {
if (size == 0) return m + 1;
// if the query vertex 'n' is in the terminal set (t1) then the
// target vertex must be in the terminal set (t2)
for (int i = m + 1; i < g2.length; i++)
if (m2[i] == UNMAPPED && (t1[n] == 0 || t2[i] > 0)) return i;
return mMax();
} | [
"@",
"Override",
"final",
"int",
"nextM",
"(",
"int",
"n",
",",
"int",
"m",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"m",
"+",
"1",
";",
"// if the query vertex 'n' is in the terminal set (t1) then the",
"// target vertex must be in the terminal set (t... | Given the current target candidate (m), find the next candidate. The next
candidate is the next vertex > m (in some ordering) that is unmapped and
is adjacent to a mapped vertex (terminal). If there is no such vertex
(disconnected) the next unmapped vertex is returned. If there are no more
candidates m == |V| of G2.
@param m previous candidate m
@return the next value of m | [
"Given",
"the",
"current",
"target",
"candidate",
"(",
"m",
")",
"find",
"the",
"next",
"candidate",
".",
"The",
"next",
"candidate",
"is",
"the",
"next",
"vertex",
">",
"m",
"(",
"in",
"some",
"ordering",
")",
"that",
"is",
"unmapped",
"and",
"is",
"a... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/AbstractVFState.java#L104-L112 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java | CommercePriceEntryPersistenceImpl.fetchByC_ERC | @Override
public CommercePriceEntry fetchByC_ERC(long companyId,
String externalReferenceCode) {
return fetchByC_ERC(companyId, externalReferenceCode, true);
} | java | @Override
public CommercePriceEntry fetchByC_ERC(long companyId,
String externalReferenceCode) {
return fetchByC_ERC(companyId, externalReferenceCode, true);
} | [
"@",
"Override",
"public",
"CommercePriceEntry",
"fetchByC_ERC",
"(",
"long",
"companyId",
",",
"String",
"externalReferenceCode",
")",
"{",
"return",
"fetchByC_ERC",
"(",
"companyId",
",",
"externalReferenceCode",
",",
"true",
")",
";",
"}"
] | Returns the commerce price entry where companyId = ? and externalReferenceCode = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param companyId the company ID
@param externalReferenceCode the external reference code
@return the matching commerce price entry, or <code>null</code> if a matching commerce price entry could not be found | [
"Returns",
"the",
"commerce",
"price",
"entry",
"where",
"companyId",
"=",
"?",
";",
"and",
"externalReferenceCode",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"t... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java#L3912-L3916 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createOptionalNullableType | public JSType createOptionalNullableType(JSType type) {
return createUnionType(type, getNativeType(JSTypeNative.VOID_TYPE),
getNativeType(JSTypeNative.NULL_TYPE));
} | java | public JSType createOptionalNullableType(JSType type) {
return createUnionType(type, getNativeType(JSTypeNative.VOID_TYPE),
getNativeType(JSTypeNative.NULL_TYPE));
} | [
"public",
"JSType",
"createOptionalNullableType",
"(",
"JSType",
"type",
")",
"{",
"return",
"createUnionType",
"(",
"type",
",",
"getNativeType",
"(",
"JSTypeNative",
".",
"VOID_TYPE",
")",
",",
"getNativeType",
"(",
"JSTypeNative",
".",
"NULL_TYPE",
")",
")",
... | Creates a nullable and undefine-able value of the given type.
@return The union of the type and null and undefined. | [
"Creates",
"a",
"nullable",
"and",
"undefine",
"-",
"able",
"value",
"of",
"the",
"given",
"type",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1510-L1513 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/dynamic/support/ResolvableType.java | ResolvableType.forMethodReturnType | public static ResolvableType forMethodReturnType(Method method, Class<?> implementationClass) {
LettuceAssert.notNull(method, "Method must not be null");
MethodParameter methodParameter = new MethodParameter(method, -1);
methodParameter.setContainingClass(implementationClass);
return forMethodParameter(methodParameter);
} | java | public static ResolvableType forMethodReturnType(Method method, Class<?> implementationClass) {
LettuceAssert.notNull(method, "Method must not be null");
MethodParameter methodParameter = new MethodParameter(method, -1);
methodParameter.setContainingClass(implementationClass);
return forMethodParameter(methodParameter);
} | [
"public",
"static",
"ResolvableType",
"forMethodReturnType",
"(",
"Method",
"method",
",",
"Class",
"<",
"?",
">",
"implementationClass",
")",
"{",
"LettuceAssert",
".",
"notNull",
"(",
"method",
",",
"\"Method must not be null\"",
")",
";",
"MethodParameter",
"meth... | Return a {@link ResolvableType} for the specified {@link Method} return type. Use this variant when the class that
declares the method includes generic parameter variables that are satisfied by the implementation class.
@param method the source for the method return type
@param implementationClass the implementation class
@return a {@link ResolvableType} for the specified method return
@see #forMethodReturnType(Method) | [
"Return",
"a",
"{",
"@link",
"ResolvableType",
"}",
"for",
"the",
"specified",
"{",
"@link",
"Method",
"}",
"return",
"type",
".",
"Use",
"this",
"variant",
"when",
"the",
"class",
"that",
"declares",
"the",
"method",
"includes",
"generic",
"parameter",
"var... | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/support/ResolvableType.java#L933-L938 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/module/messagecenter/view/ApptentiveAvatarView.java | ApptentiveAvatarView.scaleImage | private ImageScale scaleImage(int imageX, int imageY, int containerX, int containerY) {
ImageScale ret = new ImageScale();
// Compare aspects faster by multiplying out the divisors.
if (imageX * containerY > imageY * containerX) {
// Image aspect wider than container
ret.scale = (float) containerX / imageX;
ret.deltaY = ((float) containerY - (ret.scale * imageY)) / 2.0f;
} else {
// Image aspect taller than container
ret.scale = (float) containerY / imageY;
ret.deltaX = ((float) containerX - (ret.scale * imageX)) / 2.0f;
}
return ret;
} | java | private ImageScale scaleImage(int imageX, int imageY, int containerX, int containerY) {
ImageScale ret = new ImageScale();
// Compare aspects faster by multiplying out the divisors.
if (imageX * containerY > imageY * containerX) {
// Image aspect wider than container
ret.scale = (float) containerX / imageX;
ret.deltaY = ((float) containerY - (ret.scale * imageY)) / 2.0f;
} else {
// Image aspect taller than container
ret.scale = (float) containerY / imageY;
ret.deltaX = ((float) containerX - (ret.scale * imageX)) / 2.0f;
}
return ret;
} | [
"private",
"ImageScale",
"scaleImage",
"(",
"int",
"imageX",
",",
"int",
"imageY",
",",
"int",
"containerX",
",",
"int",
"containerY",
")",
"{",
"ImageScale",
"ret",
"=",
"new",
"ImageScale",
"(",
")",
";",
"// Compare aspects faster by multiplying out the divisors.... | This scales the image so that it fits within the container. The container may have empty space
at the ends, but the entire image will be displayed. | [
"This",
"scales",
"the",
"image",
"so",
"that",
"it",
"fits",
"within",
"the",
"container",
".",
"The",
"container",
"may",
"have",
"empty",
"space",
"at",
"the",
"ends",
"but",
"the",
"entire",
"image",
"will",
"be",
"displayed",
"."
] | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/module/messagecenter/view/ApptentiveAvatarView.java#L261-L274 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLReentrantTypeResolver.java | SARLReentrantTypeResolver.createSarlCapacityExtensionProvider | protected XAbstractFeatureCall createSarlCapacityExtensionProvider(JvmIdentifiableElement thisFeature, JvmField field) {
// For capacity call redirection
if (thisFeature instanceof JvmDeclaredType) {
final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field,
ImportedCapacityFeature.class);
if (capacityAnnotation != null) {
final String methodName = Utils.createNameForHiddenCapacityImplementationCallingMethodFromFieldName(
field.getSimpleName());
final JvmOperation callerOperation = findOperation((JvmDeclaredType) thisFeature, methodName);
if (callerOperation != null) {
final XbaseFactory baseFactory = getXbaseFactory();
final XMemberFeatureCall extensionProvider = baseFactory.createXMemberFeatureCall();
extensionProvider.setFeature(callerOperation);
final XFeatureCall thisAccess = baseFactory.createXFeatureCall();
thisAccess.setFeature(thisFeature);
extensionProvider.setMemberCallTarget(thisAccess);
return extensionProvider;
}
}
}
return null;
} | java | protected XAbstractFeatureCall createSarlCapacityExtensionProvider(JvmIdentifiableElement thisFeature, JvmField field) {
// For capacity call redirection
if (thisFeature instanceof JvmDeclaredType) {
final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field,
ImportedCapacityFeature.class);
if (capacityAnnotation != null) {
final String methodName = Utils.createNameForHiddenCapacityImplementationCallingMethodFromFieldName(
field.getSimpleName());
final JvmOperation callerOperation = findOperation((JvmDeclaredType) thisFeature, methodName);
if (callerOperation != null) {
final XbaseFactory baseFactory = getXbaseFactory();
final XMemberFeatureCall extensionProvider = baseFactory.createXMemberFeatureCall();
extensionProvider.setFeature(callerOperation);
final XFeatureCall thisAccess = baseFactory.createXFeatureCall();
thisAccess.setFeature(thisFeature);
extensionProvider.setMemberCallTarget(thisAccess);
return extensionProvider;
}
}
}
return null;
} | [
"protected",
"XAbstractFeatureCall",
"createSarlCapacityExtensionProvider",
"(",
"JvmIdentifiableElement",
"thisFeature",
",",
"JvmField",
"field",
")",
"{",
"// For capacity call redirection",
"if",
"(",
"thisFeature",
"instanceof",
"JvmDeclaredType",
")",
"{",
"final",
"Jvm... | Create the extension provider dedicated to the access to the used capacity functions.
@param thisFeature the current object.
@param field the extension field.
@return the SARL capacity extension provider, or {@code null}. | [
"Create",
"the",
"extension",
"provider",
"dedicated",
"to",
"the",
"access",
"to",
"the",
"used",
"capacity",
"functions",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLReentrantTypeResolver.java#L161-L182 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/fastpath/Fastpath.java | Fastpath.getID | public int getID(String name) throws SQLException {
Integer id = func.get(name);
// may be we could add a lookup to the database here, and store the result
// in our lookup table, throwing the exception if that fails.
// We must, however, ensure that if we do, any existing ResultSet is
// unaffected, otherwise we could break user code.
//
// so, until we know we can do this (needs testing, on the TODO list)
// for now, we throw the exception and do no lookups.
if (id == null) {
throw new PSQLException(GT.tr("The fastpath function {0} is unknown.", name),
PSQLState.UNEXPECTED_ERROR);
}
return id;
} | java | public int getID(String name) throws SQLException {
Integer id = func.get(name);
// may be we could add a lookup to the database here, and store the result
// in our lookup table, throwing the exception if that fails.
// We must, however, ensure that if we do, any existing ResultSet is
// unaffected, otherwise we could break user code.
//
// so, until we know we can do this (needs testing, on the TODO list)
// for now, we throw the exception and do no lookups.
if (id == null) {
throw new PSQLException(GT.tr("The fastpath function {0} is unknown.", name),
PSQLState.UNEXPECTED_ERROR);
}
return id;
} | [
"public",
"int",
"getID",
"(",
"String",
"name",
")",
"throws",
"SQLException",
"{",
"Integer",
"id",
"=",
"func",
".",
"get",
"(",
"name",
")",
";",
"// may be we could add a lookup to the database here, and store the result",
"// in our lookup table, throwing the exceptio... | <p>This returns the function id associated by its name.</p>
<p>If addFunction() or addFunctions() have not been called for this name, then an SQLException is
thrown.</p>
@param name Function name to lookup
@return Function ID for fastpath call
@throws SQLException is function is unknown. | [
"<p",
">",
"This",
"returns",
"the",
"function",
"id",
"associated",
"by",
"its",
"name",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/fastpath/Fastpath.java#L286-L302 |
apache/groovy | src/main/groovy/groovy/lang/BenchmarkInterceptor.java | BenchmarkInterceptor.beforeInvoke | public Object beforeInvoke(Object object, String methodName, Object[] arguments) {
if (!calls.containsKey(methodName)) calls.put(methodName, new LinkedList());
((List) calls.get(methodName)).add(System.currentTimeMillis());
return null;
} | java | public Object beforeInvoke(Object object, String methodName, Object[] arguments) {
if (!calls.containsKey(methodName)) calls.put(methodName, new LinkedList());
((List) calls.get(methodName)).add(System.currentTimeMillis());
return null;
} | [
"public",
"Object",
"beforeInvoke",
"(",
"Object",
"object",
",",
"String",
"methodName",
",",
"Object",
"[",
"]",
"arguments",
")",
"{",
"if",
"(",
"!",
"calls",
".",
"containsKey",
"(",
"methodName",
")",
")",
"calls",
".",
"put",
"(",
"methodName",
",... | This code is executed before the method is called.
@param object receiver object for the method call
@param methodName name of the method to call
@param arguments arguments to the method call
@return null
relays this result. | [
"This",
"code",
"is",
"executed",
"before",
"the",
"method",
"is",
"called",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/BenchmarkInterceptor.java#L75-L80 |
openengsb/openengsb | components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/PropertyConnectionCalculator.java | PropertyConnectionCalculator.resolveTemporaryProperties | private void resolveTemporaryProperties(Map<String, Set<String>> map) {
boolean temporaryPresent = false;
do {
temporaryPresent = false;
for (Map.Entry<String, Set<String>> entry : map.entrySet()) {
Set<String> newProperties = new HashSet<String>();
Iterator<String> properties = entry.getValue().iterator();
while (properties.hasNext()) {
String property = properties.next();
if (isTemporaryProperty(property)) {
LOGGER.debug("Resolve temporary field {} for property {}", entry.getKey(), property);
temporaryPresent = true;
newProperties.addAll(map.get(property));
properties.remove();
}
}
entry.getValue().addAll(newProperties);
}
} while (temporaryPresent);
} | java | private void resolveTemporaryProperties(Map<String, Set<String>> map) {
boolean temporaryPresent = false;
do {
temporaryPresent = false;
for (Map.Entry<String, Set<String>> entry : map.entrySet()) {
Set<String> newProperties = new HashSet<String>();
Iterator<String> properties = entry.getValue().iterator();
while (properties.hasNext()) {
String property = properties.next();
if (isTemporaryProperty(property)) {
LOGGER.debug("Resolve temporary field {} for property {}", entry.getKey(), property);
temporaryPresent = true;
newProperties.addAll(map.get(property));
properties.remove();
}
}
entry.getValue().addAll(newProperties);
}
} while (temporaryPresent);
} | [
"private",
"void",
"resolveTemporaryProperties",
"(",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"map",
")",
"{",
"boolean",
"temporaryPresent",
"=",
"false",
";",
"do",
"{",
"temporaryPresent",
"=",
"false",
";",
"for",
"(",
"Map",
".",
... | Resolves the temporary properties of the given property map. It replaces the temporary properties in the values
of the given map with the values of the temporary property it replaces. This procedure is done until there are no
more temporary fields present in the values of the map. | [
"Resolves",
"the",
"temporary",
"properties",
"of",
"the",
"given",
"property",
"map",
".",
"It",
"replaces",
"the",
"temporary",
"properties",
"in",
"the",
"values",
"of",
"the",
"given",
"map",
"with",
"the",
"values",
"of",
"the",
"temporary",
"property",
... | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/PropertyConnectionCalculator.java#L119-L138 |
phax/ph-web | ph-httpclient/src/main/java/com/helger/httpclient/HttpDebugger.java | HttpDebugger.beforeRequest | public static void beforeRequest (@Nonnull final HttpUriRequest aRequest, @Nullable final HttpContext aHttpContext)
{
if (isEnabled ())
if (LOGGER.isInfoEnabled ())
LOGGER.info ("Before HTTP call: " +
aRequest.getMethod () +
" " +
aRequest.getURI () +
(aHttpContext != null ? " (with special HTTP context)" : ""));
} | java | public static void beforeRequest (@Nonnull final HttpUriRequest aRequest, @Nullable final HttpContext aHttpContext)
{
if (isEnabled ())
if (LOGGER.isInfoEnabled ())
LOGGER.info ("Before HTTP call: " +
aRequest.getMethod () +
" " +
aRequest.getURI () +
(aHttpContext != null ? " (with special HTTP context)" : ""));
} | [
"public",
"static",
"void",
"beforeRequest",
"(",
"@",
"Nonnull",
"final",
"HttpUriRequest",
"aRequest",
",",
"@",
"Nullable",
"final",
"HttpContext",
"aHttpContext",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
")",
"if",
"(",
"LOGGER",
".",
"isInfoEnabled",
... | Call before an invocation
@param aRequest
The request to be executed. May not be <code>null</code>.
@param aHttpContext
The special HTTP content for this call. May be <code>null</code>. | [
"Call",
"before",
"an",
"invocation"
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-httpclient/src/main/java/com/helger/httpclient/HttpDebugger.java#L66-L75 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java | RotationAxis.getJmolScript | public String getJmolScript(Atom[] atoms, int axisID){
final double width=.5;// width of JMol object
final String axisColor = "yellow"; //axis color
final String screwColor = "orange"; //screw translation color
Pair<Atom> endPoints = getAxisEnds(atoms);
Atom axisMin = endPoints.getFirst();
Atom axisMax = endPoints.getSecond();
StringWriter result = new StringWriter();
// set arrow heads to a reasonable length
result.append("set defaultDrawArrowScale 2.0;");
// draw axis of rotation
result.append(
String.format("draw ID rot"+axisID+" CYLINDER {%f,%f,%f} {%f,%f,%f} WIDTH %f COLOR %s ;",
axisMin.getX(),axisMin.getY(),axisMin.getZ(),
axisMax.getX(),axisMax.getY(),axisMax.getZ(), width, axisColor ));
// draw screw component
boolean positiveScrew = Math.signum(rotationAxis.getX()) == Math.signum(screwTranslation.getX());
if( positiveScrew ) {
// screw is in the same direction as the axis
result.append( String.format(
"draw ID screw"+axisID+" VECTOR {%f,%f,%f} {%f,%f,%f} WIDTH %f COLOR %s ;",
axisMax.getX(),axisMax.getY(),axisMax.getZ(),
screwTranslation.getX(),screwTranslation.getY(),screwTranslation.getZ(),
width, screwColor ));
} else {
// screw is in the opposite direction as the axis
result.append( String.format(
"draw ID screw"+axisID+" VECTOR {%f,%f,%f} {%f,%f,%f} WIDTH %f COLOR %s ;",
axisMin.getX(),axisMin.getY(),axisMin.getZ(),
screwTranslation.getX(),screwTranslation.getY(),screwTranslation.getZ(),
width, screwColor ));
}
// draw angle of rotation
if(rotationPos != null) {
result.append(System.getProperty("line.separator"));
result.append(String.format("draw ID rotArc"+axisID+" ARC {%f,%f,%f} {%f,%f,%f} {0,0,0} {0,%f,%d} SCALE 500 DIAMETER %f COLOR %s;",
axisMin.getX(),axisMin.getY(),axisMin.getZ(),
axisMax.getX(),axisMax.getY(),axisMax.getZ(),
Math.toDegrees(theta),
positiveScrew ? 0 : 1 , // draw at the opposite end from the screw arrow
width, axisColor ));
}
return result.toString();
} | java | public String getJmolScript(Atom[] atoms, int axisID){
final double width=.5;// width of JMol object
final String axisColor = "yellow"; //axis color
final String screwColor = "orange"; //screw translation color
Pair<Atom> endPoints = getAxisEnds(atoms);
Atom axisMin = endPoints.getFirst();
Atom axisMax = endPoints.getSecond();
StringWriter result = new StringWriter();
// set arrow heads to a reasonable length
result.append("set defaultDrawArrowScale 2.0;");
// draw axis of rotation
result.append(
String.format("draw ID rot"+axisID+" CYLINDER {%f,%f,%f} {%f,%f,%f} WIDTH %f COLOR %s ;",
axisMin.getX(),axisMin.getY(),axisMin.getZ(),
axisMax.getX(),axisMax.getY(),axisMax.getZ(), width, axisColor ));
// draw screw component
boolean positiveScrew = Math.signum(rotationAxis.getX()) == Math.signum(screwTranslation.getX());
if( positiveScrew ) {
// screw is in the same direction as the axis
result.append( String.format(
"draw ID screw"+axisID+" VECTOR {%f,%f,%f} {%f,%f,%f} WIDTH %f COLOR %s ;",
axisMax.getX(),axisMax.getY(),axisMax.getZ(),
screwTranslation.getX(),screwTranslation.getY(),screwTranslation.getZ(),
width, screwColor ));
} else {
// screw is in the opposite direction as the axis
result.append( String.format(
"draw ID screw"+axisID+" VECTOR {%f,%f,%f} {%f,%f,%f} WIDTH %f COLOR %s ;",
axisMin.getX(),axisMin.getY(),axisMin.getZ(),
screwTranslation.getX(),screwTranslation.getY(),screwTranslation.getZ(),
width, screwColor ));
}
// draw angle of rotation
if(rotationPos != null) {
result.append(System.getProperty("line.separator"));
result.append(String.format("draw ID rotArc"+axisID+" ARC {%f,%f,%f} {%f,%f,%f} {0,0,0} {0,%f,%d} SCALE 500 DIAMETER %f COLOR %s;",
axisMin.getX(),axisMin.getY(),axisMin.getZ(),
axisMax.getX(),axisMax.getY(),axisMax.getZ(),
Math.toDegrees(theta),
positiveScrew ? 0 : 1 , // draw at the opposite end from the screw arrow
width, axisColor ));
}
return result.toString();
} | [
"public",
"String",
"getJmolScript",
"(",
"Atom",
"[",
"]",
"atoms",
",",
"int",
"axisID",
")",
"{",
"final",
"double",
"width",
"=",
".5",
";",
"// width of JMol object",
"final",
"String",
"axisColor",
"=",
"\"yellow\"",
";",
"//axis color",
"final",
"String... | Returns a Jmol script which will display the axis of rotation. This
consists of a cyan arrow along the axis, plus an arc showing the angle
of rotation.
<p>
As the rotation angle gets smaller, the axis of rotation becomes poorly
defined and would need to get farther and farther away from the protein.
This is not particularly useful, so we arbitrarily draw it parallel to
the translation and omit the arc.
@param atoms Some atoms from the protein, used for determining the bounds
of the axis.
@param axisID in case of representing more than one axis in the same jmol
panel, indicate the ID number.
@return The Jmol script, suitable for calls to
{@link org.biojava.nbio.structure.align.gui.jmol.StructureAlignmentJmol#evalString() jmol.evalString()} | [
"Returns",
"a",
"Jmol",
"script",
"which",
"will",
"display",
"the",
"axis",
"of",
"rotation",
".",
"This",
"consists",
"of",
"a",
"cyan",
"arrow",
"along",
"the",
"axis",
"plus",
"an",
"arc",
"showing",
"the",
"angle",
"of",
"rotation",
".",
"<p",
">",
... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java#L447-L497 |
GerdHolz/TOVAL | src/de/invation/code/toval/misc/ListUtils.java | ListUtils.getRandomSublistMin | public static <T> List<T> getRandomSublistMin(List<T> list, int minCount) {
int count = RandomUtils.randomIntBetween(minCount, list.size());
return getRandomSublist(list, count);
} | java | public static <T> List<T> getRandomSublistMin(List<T> list, int minCount) {
int count = RandomUtils.randomIntBetween(minCount, list.size());
return getRandomSublist(list, count);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"getRandomSublistMin",
"(",
"List",
"<",
"T",
">",
"list",
",",
"int",
"minCount",
")",
"{",
"int",
"count",
"=",
"RandomUtils",
".",
"randomIntBetween",
"(",
"minCount",
",",
"list",
".",
"size... | Generates a random sublist of <code>list</code>, that contains at least
<code>maxCount</code> elements.
@param <T>
Type of list elements
@param list
Basic list for operation
@param minCount
Minimum number of items
@return A sublist with at least <code>minCount</code> elements | [
"Generates",
"a",
"random",
"sublist",
"of",
"<code",
">",
"list<",
"/",
"code",
">",
"that",
"contains",
"at",
"least",
"<code",
">",
"maxCount<",
"/",
"code",
">",
"elements",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/ListUtils.java#L501-L504 |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.putIntBigEndian | public final void putIntBigEndian(int index, int value) {
if (LITTLE_ENDIAN) {
putInt(index, Integer.reverseBytes(value));
} else {
putInt(index, value);
}
} | java | public final void putIntBigEndian(int index, int value) {
if (LITTLE_ENDIAN) {
putInt(index, Integer.reverseBytes(value));
} else {
putInt(index, value);
}
} | [
"public",
"final",
"void",
"putIntBigEndian",
"(",
"int",
"index",
",",
"int",
"value",
")",
"{",
"if",
"(",
"LITTLE_ENDIAN",
")",
"{",
"putInt",
"(",
"index",
",",
"Integer",
".",
"reverseBytes",
"(",
"value",
")",
")",
";",
"}",
"else",
"{",
"putInt"... | Writes the given int value (32bit, 4 bytes) to the given position in big endian
byte order. This method's speed depends on the system's native byte order, and it
is possibly slower than {@link #putInt(int, int)}. For most cases (such as
transient storage in memory or serialization for I/O and network),
it suffices to know that the byte order in which the value is written is the same as the
one in which it is read, and {@link #putInt(int, int)} is the preferable choice.
@param index The position at which the value will be written.
@param value The int value to be written.
@throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment
size minus 4. | [
"Writes",
"the",
"given",
"int",
"value",
"(",
"32bit",
"4",
"bytes",
")",
"to",
"the",
"given",
"position",
"in",
"big",
"endian",
"byte",
"order",
".",
"This",
"method",
"s",
"speed",
"depends",
"on",
"the",
"system",
"s",
"native",
"byte",
"order",
... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L812-L818 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java | AbstractService.bindProgressBar | private void bindProgressBar(final ServiceTaskBase<?> task, final ProgressBar progressBar) {
// Perform this binding into the JAT to respect widget and task API
JRebirth.runIntoJAT("Bind ProgressBar to " + task.getServiceHandlerName(),
() -> {
// Avoid the progress bar to display 100% at start up
task.updateProgress(0, 0);
// Bind the progress bar
progressBar.progressProperty().bind(task.workDoneProperty().divide(task.totalWorkProperty()));
});
} | java | private void bindProgressBar(final ServiceTaskBase<?> task, final ProgressBar progressBar) {
// Perform this binding into the JAT to respect widget and task API
JRebirth.runIntoJAT("Bind ProgressBar to " + task.getServiceHandlerName(),
() -> {
// Avoid the progress bar to display 100% at start up
task.updateProgress(0, 0);
// Bind the progress bar
progressBar.progressProperty().bind(task.workDoneProperty().divide(task.totalWorkProperty()));
});
} | [
"private",
"void",
"bindProgressBar",
"(",
"final",
"ServiceTaskBase",
"<",
"?",
">",
"task",
",",
"final",
"ProgressBar",
"progressBar",
")",
"{",
"// Perform this binding into the JAT to respect widget and task API",
"JRebirth",
".",
"runIntoJAT",
"(",
"\"Bind ProgressBar... | Bind a task to a progress bar widget to follow its progression.
@param task the service task that we need to follow the progression
@param progressBar graphical progress bar | [
"Bind",
"a",
"task",
"to",
"a",
"progress",
"bar",
"widget",
"to",
"follow",
"its",
"progression",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java#L205-L216 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsPreferences.java | CmsPreferences.buildSelectWorkplaceSearchResult | public String buildSelectWorkplaceSearchResult(String htmlAttributes) {
List<String> options = new ArrayList<String>(3);
List<String> values = new ArrayList<String>(3);
int checkedIndex = 0;
// add all styles to the select box
options.add(key(CmsSearchResultStyle.STYLE_EXPLORER.getKey()));
values.add(CmsSearchResultStyle.STYLE_EXPLORER.getMode());
if (getParamTabExWorkplaceSearchResult().equals(CmsSearchResultStyle.STYLE_EXPLORER.toString())) {
// mark the currently active locale
checkedIndex = 0;
}
options.add(key(CmsSearchResultStyle.STYLE_LIST_WITH_EXCERPTS.getKey()));
values.add(CmsSearchResultStyle.STYLE_LIST_WITH_EXCERPTS.getMode());
if (getParamTabExWorkplaceSearchResult().equals(CmsSearchResultStyle.STYLE_LIST_WITH_EXCERPTS.toString())) {
// mark the currently active locale
checkedIndex = 1;
}
options.add(key(CmsSearchResultStyle.STYLE_LIST_WITHOUT_EXCERPTS.getKey()));
values.add(CmsSearchResultStyle.STYLE_LIST_WITHOUT_EXCERPTS.getMode());
if (getParamTabExWorkplaceSearchResult().equals(CmsSearchResultStyle.STYLE_LIST_WITHOUT_EXCERPTS.toString())) {
// mark the currently active locale
checkedIndex = 2;
}
return buildSelect(htmlAttributes, options, values, checkedIndex);
} | java | public String buildSelectWorkplaceSearchResult(String htmlAttributes) {
List<String> options = new ArrayList<String>(3);
List<String> values = new ArrayList<String>(3);
int checkedIndex = 0;
// add all styles to the select box
options.add(key(CmsSearchResultStyle.STYLE_EXPLORER.getKey()));
values.add(CmsSearchResultStyle.STYLE_EXPLORER.getMode());
if (getParamTabExWorkplaceSearchResult().equals(CmsSearchResultStyle.STYLE_EXPLORER.toString())) {
// mark the currently active locale
checkedIndex = 0;
}
options.add(key(CmsSearchResultStyle.STYLE_LIST_WITH_EXCERPTS.getKey()));
values.add(CmsSearchResultStyle.STYLE_LIST_WITH_EXCERPTS.getMode());
if (getParamTabExWorkplaceSearchResult().equals(CmsSearchResultStyle.STYLE_LIST_WITH_EXCERPTS.toString())) {
// mark the currently active locale
checkedIndex = 1;
}
options.add(key(CmsSearchResultStyle.STYLE_LIST_WITHOUT_EXCERPTS.getKey()));
values.add(CmsSearchResultStyle.STYLE_LIST_WITHOUT_EXCERPTS.getMode());
if (getParamTabExWorkplaceSearchResult().equals(CmsSearchResultStyle.STYLE_LIST_WITHOUT_EXCERPTS.toString())) {
// mark the currently active locale
checkedIndex = 2;
}
return buildSelect(htmlAttributes, options, values, checkedIndex);
} | [
"public",
"String",
"buildSelectWorkplaceSearchResult",
"(",
"String",
"htmlAttributes",
")",
"{",
"List",
"<",
"String",
">",
"options",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"3",
")",
";",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"Ar... | Builds the html for the workplace search result list type select box.<p>
@param htmlAttributes optional html attributes for the &lgt;select> tag
@return the html for the workplace search result list type select box | [
"Builds",
"the",
"html",
"for",
"the",
"workplace",
"search",
"result",
"list",
"type",
"select",
"box",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPreferences.java#L1013-L1040 |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.postDoNotUseArtifact | public void postDoNotUseArtifact(final String gavc, final Boolean doNotUse, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getDoNotUseArtifact(gavc));
final ClientResponse response = resource.queryParam(ServerAPI.DO_NOT_USE, doNotUse.toString())
.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to post do not use artifact";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | java | public void postDoNotUseArtifact(final String gavc, final Boolean doNotUse, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getDoNotUseArtifact(gavc));
final ClientResponse response = resource.queryParam(ServerAPI.DO_NOT_USE, doNotUse.toString())
.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to post do not use artifact";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | [
"public",
"void",
"postDoNotUseArtifact",
"(",
"final",
"String",
"gavc",
",",
"final",
"Boolean",
"doNotUse",
",",
"final",
"String",
"user",
",",
"final",
"String",
"password",
")",
"throws",
"GrapesCommunicationException",
",",
"AuthenticationException",
"{",
"fi... | Post boolean flag "DO_NOT_USE" to an artifact
@param gavc
@param doNotUse
@param user
@param password
@throws GrapesCommunicationException | [
"Post",
"boolean",
"flag",
"DO_NOT_USE",
"to",
"an",
"artifact"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L513-L527 |
mapsforge/mapsforge | mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/logging/LoggerWrapper.java | LoggerWrapper.getLogger | public static LoggerWrapper getLogger(String name, ProgressManager pm) {
LoggerWrapper ret = getLogger(name);
if (ret.getProgressManager() == null
|| ret.getProgressManager() == LoggerWrapper.defaultProgressManager) {
ret.setProgressManager(pm);
}
return ret;
} | java | public static LoggerWrapper getLogger(String name, ProgressManager pm) {
LoggerWrapper ret = getLogger(name);
if (ret.getProgressManager() == null
|| ret.getProgressManager() == LoggerWrapper.defaultProgressManager) {
ret.setProgressManager(pm);
}
return ret;
} | [
"public",
"static",
"LoggerWrapper",
"getLogger",
"(",
"String",
"name",
",",
"ProgressManager",
"pm",
")",
"{",
"LoggerWrapper",
"ret",
"=",
"getLogger",
"(",
"name",
")",
";",
"if",
"(",
"ret",
".",
"getProgressManager",
"(",
")",
"==",
"null",
"||",
"re... | Returns or creates a logger that forwards messages to a {@link ProgressManager}. If the
logger does not yet have any progress manager assigned, the given one will be used.
@param name The logger's unique name. By default the calling class' name is used.
@param pm The logger's progress manager. This value is only used if a logger object has to
be created or a logger with a given name does not yet have any progress manager
assigned or if the default progress manager is used.
@return A logger that forwards messages to a {@link ProgressManager}. | [
"Returns",
"or",
"creates",
"a",
"logger",
"that",
"forwards",
"messages",
"to",
"a",
"{",
"@link",
"ProgressManager",
"}",
".",
"If",
"the",
"logger",
"does",
"not",
"yet",
"have",
"any",
"progress",
"manager",
"assigned",
"the",
"given",
"one",
"will",
"... | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/logging/LoggerWrapper.java#L68-L77 |
riversun/d6 | src/main/java/org/riversun/d6/core/D6Crud.java | D6Crud.setObject | private void setObject(int parameterIndex, PreparedStatement preparedStmt, Object value) throws SQLException {
preparedStmt.setObject(parameterIndex, value);
} | java | private void setObject(int parameterIndex, PreparedStatement preparedStmt, Object value) throws SQLException {
preparedStmt.setObject(parameterIndex, value);
} | [
"private",
"void",
"setObject",
"(",
"int",
"parameterIndex",
",",
"PreparedStatement",
"preparedStmt",
",",
"Object",
"value",
")",
"throws",
"SQLException",
"{",
"preparedStmt",
".",
"setObject",
"(",
"parameterIndex",
",",
"value",
")",
";",
"}"
] | Set object to the preparedStatement
@param parameterIndex
@param preparedStmt
@param value
@throws SQLException | [
"Set",
"object",
"to",
"the",
"preparedStatement"
] | train | https://github.com/riversun/d6/blob/2798bd876b9380dbfea8182d11ad306cb1b0e114/src/main/java/org/riversun/d6/core/D6Crud.java#L1004-L1007 |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/PersistentExecutorImpl.java | PersistentExecutorImpl.notificationCreated | @Override
public void notificationCreated(RuntimeUpdateManager updateManager, RuntimeUpdateNotification notification) {
class MyCompletionListener implements CompletionListener<Boolean> {
String notificationName;
public MyCompletionListener(String name) {
notificationName = name;
}
@Override
public void successfulCompletion(Future<Boolean> future, Boolean result) {
// The configuration update for which we were monitoring is now complete.
// Update our awareness to the update and perform any deferred actions.
configUpdateCompleted(notificationName);
}
@Override
public void failedCompletion(Future<Boolean> future, Throwable t) {
// The configuration update failed, but we still want to resume functions.
// Update our awareness to the update and perform any deferred actions.
configUpdateCompleted(notificationName);
}
}
if (deactivated)
return;
int prevCnt = configUpdateInProgress();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(PersistentExecutorImpl.this, tc, "Notified of \"" + notification.getName() + "\" previous configUpdatesInProgress: " + prevCnt);
FutureMonitor futureMonitor = _futureMonitor;
if (futureMonitor != null) {
MyCompletionListener newListener = new MyCompletionListener(notification.getName());
futureMonitor.onCompletion(notification.getFuture(), newListener);
}
} | java | @Override
public void notificationCreated(RuntimeUpdateManager updateManager, RuntimeUpdateNotification notification) {
class MyCompletionListener implements CompletionListener<Boolean> {
String notificationName;
public MyCompletionListener(String name) {
notificationName = name;
}
@Override
public void successfulCompletion(Future<Boolean> future, Boolean result) {
// The configuration update for which we were monitoring is now complete.
// Update our awareness to the update and perform any deferred actions.
configUpdateCompleted(notificationName);
}
@Override
public void failedCompletion(Future<Boolean> future, Throwable t) {
// The configuration update failed, but we still want to resume functions.
// Update our awareness to the update and perform any deferred actions.
configUpdateCompleted(notificationName);
}
}
if (deactivated)
return;
int prevCnt = configUpdateInProgress();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(PersistentExecutorImpl.this, tc, "Notified of \"" + notification.getName() + "\" previous configUpdatesInProgress: " + prevCnt);
FutureMonitor futureMonitor = _futureMonitor;
if (futureMonitor != null) {
MyCompletionListener newListener = new MyCompletionListener(notification.getName());
futureMonitor.onCompletion(notification.getFuture(), newListener);
}
} | [
"@",
"Override",
"public",
"void",
"notificationCreated",
"(",
"RuntimeUpdateManager",
"updateManager",
",",
"RuntimeUpdateNotification",
"notification",
")",
"{",
"class",
"MyCompletionListener",
"implements",
"CompletionListener",
"<",
"Boolean",
">",
"{",
"String",
"no... | This method is driven for various RuntimeUpdateNotification's. When we receive a
notification we will bump our count of active configuration updates in progress. A non-zero count value
signifies configuration update(s) are in progress.
We monitor the completion of the Futures related to the notifications. When we
are driven for their completion we decrement our configuration update in progress count.
@see com.ibm.ws.runtime.update.RuntimeUpdateListener#notificationCreated(com.ibm.ws.runtime.update.RuntimeUpdateManager, com.ibm.ws.runtime.update.RuntimeUpdateNotification) | [
"This",
"method",
"is",
"driven",
"for",
"various",
"RuntimeUpdateNotification",
"s",
".",
"When",
"we",
"receive",
"a",
"notification",
"we",
"will",
"bump",
"our",
"count",
"of",
"active",
"configuration",
"updates",
"in",
"progress",
".",
"A",
"non",
"-",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/PersistentExecutorImpl.java#L1975-L2014 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java | MapUtils.isPointNearMultiLatLng | public static boolean isPointNearMultiLatLng(LatLng point, MultiLatLng multiLatLng, double tolerance) {
boolean near = false;
for (LatLng multiPoint : multiLatLng.getLatLngs()) {
near = isPointNearPoint(point, multiPoint, tolerance);
if (near) {
break;
}
}
return near;
} | java | public static boolean isPointNearMultiLatLng(LatLng point, MultiLatLng multiLatLng, double tolerance) {
boolean near = false;
for (LatLng multiPoint : multiLatLng.getLatLngs()) {
near = isPointNearPoint(point, multiPoint, tolerance);
if (near) {
break;
}
}
return near;
} | [
"public",
"static",
"boolean",
"isPointNearMultiLatLng",
"(",
"LatLng",
"point",
",",
"MultiLatLng",
"multiLatLng",
",",
"double",
"tolerance",
")",
"{",
"boolean",
"near",
"=",
"false",
";",
"for",
"(",
"LatLng",
"multiPoint",
":",
"multiLatLng",
".",
"getLatLn... | Is the point near any points in the multi lat lng
@param point point
@param multiLatLng multi lat lng
@param tolerance distance tolerance
@return true if near | [
"Is",
"the",
"point",
"near",
"any",
"points",
"in",
"the",
"multi",
"lat",
"lng"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java#L305-L314 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java | DateFormat.getDateTimeInstance | public final static DateFormat getDateTimeInstance()
{
return get(DEFAULT, DEFAULT, 3, Locale.getDefault(Locale.Category.FORMAT));
} | java | public final static DateFormat getDateTimeInstance()
{
return get(DEFAULT, DEFAULT, 3, Locale.getDefault(Locale.Category.FORMAT));
} | [
"public",
"final",
"static",
"DateFormat",
"getDateTimeInstance",
"(",
")",
"{",
"return",
"get",
"(",
"DEFAULT",
",",
"DEFAULT",
",",
"3",
",",
"Locale",
".",
"getDefault",
"(",
"Locale",
".",
"Category",
".",
"FORMAT",
")",
")",
";",
"}"
] | Gets the date/time formatter with the default formatting style
for the default locale.
@return a date/time formatter. | [
"Gets",
"the",
"date",
"/",
"time",
"formatter",
"with",
"the",
"default",
"formatting",
"style",
"for",
"the",
"default",
"locale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java#L518-L521 |
GoogleCloudPlatform/appengine-mapreduce | java/src/main/java/com/google/appengine/tools/mapreduce/bigqueryjobs/BigQueryLoadFileSetJob.java | BigQueryLoadFileSetJob.triggerBigQueryLoadJob | private BigQueryLoadJobReference triggerBigQueryLoadJob() {
Job job = createJob();
// Set up Bigquery Insert
try {
Insert insert =
BigQueryLoadGoogleCloudStorageFilesJob.getBigquery().jobs().insert(projectId, job);
Job executedJob = insert.execute();
log.info("Triggered the bigQuery load job for files " + fileSet + " . Job Id = "
+ executedJob.getId());
return new BigQueryLoadJobReference(projectId, executedJob.getJobReference());
} catch (IOException e) {
throw new RuntimeException("Error in triggering BigQuery load job for files " + fileSet, e);
}
} | java | private BigQueryLoadJobReference triggerBigQueryLoadJob() {
Job job = createJob();
// Set up Bigquery Insert
try {
Insert insert =
BigQueryLoadGoogleCloudStorageFilesJob.getBigquery().jobs().insert(projectId, job);
Job executedJob = insert.execute();
log.info("Triggered the bigQuery load job for files " + fileSet + " . Job Id = "
+ executedJob.getId());
return new BigQueryLoadJobReference(projectId, executedJob.getJobReference());
} catch (IOException e) {
throw new RuntimeException("Error in triggering BigQuery load job for files " + fileSet, e);
}
} | [
"private",
"BigQueryLoadJobReference",
"triggerBigQueryLoadJob",
"(",
")",
"{",
"Job",
"job",
"=",
"createJob",
"(",
")",
";",
"// Set up Bigquery Insert",
"try",
"{",
"Insert",
"insert",
"=",
"BigQueryLoadGoogleCloudStorageFilesJob",
".",
"getBigquery",
"(",
")",
"."... | Triggers a bigquery load {@link Job} request and returns the job Id for the same. | [
"Triggers",
"a",
"bigquery",
"load",
"{"
] | train | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/bigqueryjobs/BigQueryLoadFileSetJob.java#L54-L67 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/metadata/StaticFunctionNamespace.java | StaticFunctionNamespace.isMoreSpecificThan | private boolean isMoreSpecificThan(ApplicableFunction left, ApplicableFunction right)
{
List<TypeSignatureProvider> resolvedTypes = fromTypeSignatures(left.getBoundSignature().getArgumentTypes());
Optional<BoundVariables> boundVariables = new SignatureBinder(typeManager, right.getDeclaredSignature(), true)
.bindVariables(resolvedTypes);
return boundVariables.isPresent();
} | java | private boolean isMoreSpecificThan(ApplicableFunction left, ApplicableFunction right)
{
List<TypeSignatureProvider> resolvedTypes = fromTypeSignatures(left.getBoundSignature().getArgumentTypes());
Optional<BoundVariables> boundVariables = new SignatureBinder(typeManager, right.getDeclaredSignature(), true)
.bindVariables(resolvedTypes);
return boundVariables.isPresent();
} | [
"private",
"boolean",
"isMoreSpecificThan",
"(",
"ApplicableFunction",
"left",
",",
"ApplicableFunction",
"right",
")",
"{",
"List",
"<",
"TypeSignatureProvider",
">",
"resolvedTypes",
"=",
"fromTypeSignatures",
"(",
"left",
".",
"getBoundSignature",
"(",
")",
".",
... | One method is more specific than another if invocation handled by the first method could be passed on to the other one | [
"One",
"method",
"is",
"more",
"specific",
"than",
"another",
"if",
"invocation",
"handled",
"by",
"the",
"first",
"method",
"could",
"be",
"passed",
"on",
"to",
"the",
"other",
"one"
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/metadata/StaticFunctionNamespace.java#L1178-L1184 |
openbase/jul | extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/IdentifiableMessage.java | IdentifiableMessage.setMessage | public IdentifiableMessage<KEY, M, MB> setMessage(final M message) throws CouldNotPerformException {
return setMessage(message, this);
} | java | public IdentifiableMessage<KEY, M, MB> setMessage(final M message) throws CouldNotPerformException {
return setMessage(message, this);
} | [
"public",
"IdentifiableMessage",
"<",
"KEY",
",",
"M",
",",
"MB",
">",
"setMessage",
"(",
"final",
"M",
"message",
")",
"throws",
"CouldNotPerformException",
"{",
"return",
"setMessage",
"(",
"message",
",",
"this",
")",
";",
"}"
] | Updates the message of this instance.
@param message the new message.
@return the updated message is returned.
@throws CouldNotPerformException in thrown in case something went wrong during message processing.
@deprecated since v2.0 and will be removed in v3.0. Please please use setMessage(final M message, final Object source) instead. | [
"Updates",
"the",
"message",
"of",
"this",
"instance",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/IdentifiableMessage.java#L271-L273 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.restartWebApps | public void restartWebApps(String resourceGroupName, String name) {
restartWebAppsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | java | public void restartWebApps(String resourceGroupName, String name) {
restartWebAppsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | [
"public",
"void",
"restartWebApps",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"restartWebAppsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",... | Restart all apps in an App Service plan.
Restart all apps in an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@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 | [
"Restart",
"all",
"apps",
"in",
"an",
"App",
"Service",
"plan",
".",
"Restart",
"all",
"apps",
"in",
"an",
"App",
"Service",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L2195-L2197 |
stephenc/java-iso-tools | loop-fs-spi/src/main/java/com/github/stephenc/javaisotools/loopfs/spi/AbstractBlockFileSystem.java | AbstractBlockFileSystem.readData | protected final synchronized int readData(final long startPos, final byte[] buffer, final int offset,
final int len)
throws IOException {
seek(startPos);
return read(buffer, offset, len);
} | java | protected final synchronized int readData(final long startPos, final byte[] buffer, final int offset,
final int len)
throws IOException {
seek(startPos);
return read(buffer, offset, len);
} | [
"protected",
"final",
"synchronized",
"int",
"readData",
"(",
"final",
"long",
"startPos",
",",
"final",
"byte",
"[",
"]",
"buffer",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"len",
")",
"throws",
"IOException",
"{",
"seek",
"(",
"startPos",
")",... | Read file data, starting at the specified position.
@return the number of bytes read into the buffer | [
"Read",
"file",
"data",
"starting",
"at",
"the",
"specified",
"position",
"."
] | train | https://github.com/stephenc/java-iso-tools/blob/828c50b02eb311a14dde0dab43462a0d0c9dfb06/loop-fs-spi/src/main/java/com/github/stephenc/javaisotools/loopfs/spi/AbstractBlockFileSystem.java#L108-L113 |
alibaba/transmittable-thread-local | src/main/java/com/alibaba/ttl/TtlCallable.java | TtlCallable.get | public static <T> TtlCallable<T> get(Callable<T> callable) {
return get(callable, false);
} | java | public static <T> TtlCallable<T> get(Callable<T> callable) {
return get(callable, false);
} | [
"public",
"static",
"<",
"T",
">",
"TtlCallable",
"<",
"T",
">",
"get",
"(",
"Callable",
"<",
"T",
">",
"callable",
")",
"{",
"return",
"get",
"(",
"callable",
",",
"false",
")",
";",
"}"
] | Factory method, wrap input {@link Callable} to {@link TtlCallable}.
<p>
This method is idempotent.
@param callable input {@link Callable}
@return Wrapped {@link Callable} | [
"Factory",
"method",
"wrap",
"input",
"{",
"@link",
"Callable",
"}",
"to",
"{",
"@link",
"TtlCallable",
"}",
".",
"<p",
">",
"This",
"method",
"is",
"idempotent",
"."
] | train | https://github.com/alibaba/transmittable-thread-local/blob/30b4d99cdb7064b4c1797d2e40bfa07adce8e7f9/src/main/java/com/alibaba/ttl/TtlCallable.java#L93-L95 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.debugf | public void debugf(Throwable t, String format, Object... params) {
doLogf(Level.DEBUG, FQCN, format, params, t);
} | java | public void debugf(Throwable t, String format, Object... params) {
doLogf(Level.DEBUG, FQCN, format, params, t);
} | [
"public",
"void",
"debugf",
"(",
"Throwable",
"t",
",",
"String",
"format",
",",
"Object",
"...",
"params",
")",
"{",
"doLogf",
"(",
"Level",
".",
"DEBUG",
",",
"FQCN",
",",
"format",
",",
"params",
",",
"t",
")",
";",
"}"
] | Issue a formatted log message with a level of DEBUG.
@param t the throwable
@param format the format string, as per {@link String#format(String, Object...)}
@param params the parameters | [
"Issue",
"a",
"formatted",
"log",
"message",
"with",
"a",
"level",
"of",
"DEBUG",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L750-L752 |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.transformMardownLinks | protected String transformMardownLinks(String content, ReferenceContext references) {
if (!isMarkdownToHtmlReferenceTransformation()) {
return content;
}
// Prepare replacement data structures
final Map<BasedSequence, String> replacements = new TreeMap<>((cmp1, cmp2) -> {
final int cmp = Integer.compare(cmp2.getStartOffset(), cmp1.getStartOffset());
if (cmp != 0) {
return cmp;
}
return Integer.compare(cmp2.getEndOffset(), cmp1.getEndOffset());
});
// Visit the links and record the transformations
final MutableDataSet options = new MutableDataSet();
final Parser parser = Parser.builder(options).build();
final Node document = parser.parse(content);
final NodeVisitor visitor = new NodeVisitor(
new VisitHandler<>(Link.class, it -> {
URL url = FileSystem.convertStringToURL(it.getUrl().toString(), true);
url = transformURL(url, references);
if (url != null) {
replacements.put(it.getUrl(), convertURLToString(url));
}
}));
visitor.visitChildren(document);
// Apply the replacements
if (!replacements.isEmpty()) {
final StringBuilder buffer = new StringBuilder(content);
for (final Entry<BasedSequence, String> entry : replacements.entrySet()) {
final BasedSequence seq = entry.getKey();
buffer.replace(seq.getStartOffset(), seq.getEndOffset(), entry.getValue());
}
return buffer.toString();
}
return content;
} | java | protected String transformMardownLinks(String content, ReferenceContext references) {
if (!isMarkdownToHtmlReferenceTransformation()) {
return content;
}
// Prepare replacement data structures
final Map<BasedSequence, String> replacements = new TreeMap<>((cmp1, cmp2) -> {
final int cmp = Integer.compare(cmp2.getStartOffset(), cmp1.getStartOffset());
if (cmp != 0) {
return cmp;
}
return Integer.compare(cmp2.getEndOffset(), cmp1.getEndOffset());
});
// Visit the links and record the transformations
final MutableDataSet options = new MutableDataSet();
final Parser parser = Parser.builder(options).build();
final Node document = parser.parse(content);
final NodeVisitor visitor = new NodeVisitor(
new VisitHandler<>(Link.class, it -> {
URL url = FileSystem.convertStringToURL(it.getUrl().toString(), true);
url = transformURL(url, references);
if (url != null) {
replacements.put(it.getUrl(), convertURLToString(url));
}
}));
visitor.visitChildren(document);
// Apply the replacements
if (!replacements.isEmpty()) {
final StringBuilder buffer = new StringBuilder(content);
for (final Entry<BasedSequence, String> entry : replacements.entrySet()) {
final BasedSequence seq = entry.getKey();
buffer.replace(seq.getStartOffset(), seq.getEndOffset(), entry.getValue());
}
return buffer.toString();
}
return content;
} | [
"protected",
"String",
"transformMardownLinks",
"(",
"String",
"content",
",",
"ReferenceContext",
"references",
")",
"{",
"if",
"(",
"!",
"isMarkdownToHtmlReferenceTransformation",
"(",
")",
")",
"{",
"return",
"content",
";",
"}",
"// Prepare replacement data structur... | Apply link transformation on the Markdown links.
@param content the original content.
@param references the references into the document.
@return the result of the transformation. | [
"Apply",
"link",
"transformation",
"on",
"the",
"Markdown",
"links",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L608-L646 |
bramp/objectgraph | src/main/java/net/bramp/objectgraph/ObjectGraph.java | ObjectGraph.addIfNotVisited | private void addIfNotVisited(Object object, Class<?> clazz) {
if (object != null && !visited.containsKey(object)) {
toVisit.add(object);
visited.put(object, clazz);
}
} | java | private void addIfNotVisited(Object object, Class<?> clazz) {
if (object != null && !visited.containsKey(object)) {
toVisit.add(object);
visited.put(object, clazz);
}
} | [
"private",
"void",
"addIfNotVisited",
"(",
"Object",
"object",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"if",
"(",
"object",
"!=",
"null",
"&&",
"!",
"visited",
".",
"containsKey",
"(",
"object",
")",
")",
"{",
"toVisit",
".",
"add",
"(",
"obj... | Add this object to be visited if it has not already been visited, or scheduled to be.
@param object The object
@param clazz The type of the field | [
"Add",
"this",
"object",
"to",
"be",
"visited",
"if",
"it",
"has",
"not",
"already",
"been",
"visited",
"or",
"scheduled",
"to",
"be",
"."
] | train | https://github.com/bramp/objectgraph/blob/99be3a76db934f5fb33c0dccd974592cab5761d1/src/main/java/net/bramp/objectgraph/ObjectGraph.java#L161-L166 |
basho/riak-java-client | src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java | AnnotationUtil.populateLinks | public static <T> T populateLinks(RiakLinks links, T domainObject)
{
return AnnotationHelper.getInstance().setLinks(links, domainObject);
} | java | public static <T> T populateLinks(RiakLinks links, T domainObject)
{
return AnnotationHelper.getInstance().setLinks(links, domainObject);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"populateLinks",
"(",
"RiakLinks",
"links",
",",
"T",
"domainObject",
")",
"{",
"return",
"AnnotationHelper",
".",
"getInstance",
"(",
")",
".",
"setLinks",
"(",
"links",
",",
"domainObject",
")",
";",
"}"
] | Attempts to populate a domain object with riak links by looking for a
{@literal @RiakLinks} annotated member.
@param <T> the type of the domain object
@param links a collection of RiakLink objects
@param domainObject the domain object
@return the domain object | [
"Attempts",
"to",
"populate",
"a",
"domain",
"object",
"with",
"riak",
"links",
"by",
"looking",
"for",
"a",
"{",
"@literal",
"@RiakLinks",
"}",
"annotated",
"member",
"."
] | train | https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java#L251-L254 |
phax/ph-css | ph-css/src/main/java/com/helger/css/utils/CSSColorHelper.java | CSSColorHelper.getRGBColorValue | @Nonnull
@Nonempty
public static String getRGBColorValue (final int nRed, final int nGreen, final int nBlue)
{
return new StringBuilder (16).append (CCSSValue.PREFIX_RGB_OPEN)
.append (getRGBValue (nRed))
.append (',')
.append (getRGBValue (nGreen))
.append (',')
.append (getRGBValue (nBlue))
.append (CCSSValue.SUFFIX_RGB_CLOSE)
.toString ();
} | java | @Nonnull
@Nonempty
public static String getRGBColorValue (final int nRed, final int nGreen, final int nBlue)
{
return new StringBuilder (16).append (CCSSValue.PREFIX_RGB_OPEN)
.append (getRGBValue (nRed))
.append (',')
.append (getRGBValue (nGreen))
.append (',')
.append (getRGBValue (nBlue))
.append (CCSSValue.SUFFIX_RGB_CLOSE)
.toString ();
} | [
"@",
"Nonnull",
"@",
"Nonempty",
"public",
"static",
"String",
"getRGBColorValue",
"(",
"final",
"int",
"nRed",
",",
"final",
"int",
"nGreen",
",",
"final",
"int",
"nBlue",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
"16",
")",
".",
"append",
"(",
"... | Get the passed values as CSS RGB color value
@param nRed
Red - is scaled to 0-255
@param nGreen
Green - is scaled to 0-255
@param nBlue
Blue - is scaled to 0-255
@return The CSS string to use | [
"Get",
"the",
"passed",
"values",
"as",
"CSS",
"RGB",
"color",
"value"
] | train | https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/utils/CSSColorHelper.java#L365-L377 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/query/Criteria.java | Criteria.addLessOrEqualThan | public void addLessOrEqualThan(Object attribute, Object value)
{
// PAW
// addSelectionCriteria(ValueCriteria.buildNotGreaterCriteria(attribute, value, getAlias()));
addSelectionCriteria(ValueCriteria.buildNotGreaterCriteria(attribute, value, getUserAlias(attribute)));
} | java | public void addLessOrEqualThan(Object attribute, Object value)
{
// PAW
// addSelectionCriteria(ValueCriteria.buildNotGreaterCriteria(attribute, value, getAlias()));
addSelectionCriteria(ValueCriteria.buildNotGreaterCriteria(attribute, value, getUserAlias(attribute)));
} | [
"public",
"void",
"addLessOrEqualThan",
"(",
"Object",
"attribute",
",",
"Object",
"value",
")",
"{",
"// PAW\r",
"// addSelectionCriteria(ValueCriteria.buildNotGreaterCriteria(attribute, value, getAlias()));\r",
"addSelectionCriteria",
"(",
"ValueCriteria",
".",
"buildNotGreaterCr... | Adds LessOrEqual Than (<=) criteria,
customer_id <= 10034
@param attribute The field name to be used
@param value An object representing the value of the field | [
"Adds",
"LessOrEqual",
"Than",
"(",
"<",
"=",
")",
"criteria",
"customer_id",
"<",
"=",
"10034"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/Criteria.java#L435-L440 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/ReferenceField.java | ReferenceField.moveFieldToThis | public int moveFieldToThis(BaseField field, boolean bDisplayOption, int iMoveMode)
{ // Save the record and datarecord.
if (field == null)
return DBConstants.NORMAL_RETURN;
if (field instanceof CounterField)
{
if (this.getReferenceRecord(null, false) == null)
if (field.getRecord().getListener(ClearFieldReferenceOnCloseHandler.class) == null) // While it is okay to have two fields reference on record, don't default it.
this.setReferenceRecord(field.getRecord());
}
else if (field instanceof ReferenceField)
{
//x no this.setReferenceRecord(((ReferenceField)field).getReferenceRecord());
}
else
this.setReferenceRecord(null);
return super.moveFieldToThis(field, bDisplayOption, iMoveMode);
} | java | public int moveFieldToThis(BaseField field, boolean bDisplayOption, int iMoveMode)
{ // Save the record and datarecord.
if (field == null)
return DBConstants.NORMAL_RETURN;
if (field instanceof CounterField)
{
if (this.getReferenceRecord(null, false) == null)
if (field.getRecord().getListener(ClearFieldReferenceOnCloseHandler.class) == null) // While it is okay to have two fields reference on record, don't default it.
this.setReferenceRecord(field.getRecord());
}
else if (field instanceof ReferenceField)
{
//x no this.setReferenceRecord(((ReferenceField)field).getReferenceRecord());
}
else
this.setReferenceRecord(null);
return super.moveFieldToThis(field, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"moveFieldToThis",
"(",
"BaseField",
"field",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"// Save the record and datarecord.",
"if",
"(",
"field",
"==",
"null",
")",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"if... | Move data to this field from another field.
If these isn't a reference record yet, figures out the reference record.
@param field The source field.
@return The error code (or NORMAL_RETURN). | [
"Move",
"data",
"to",
"this",
"field",
"from",
"another",
"field",
".",
"If",
"these",
"isn",
"t",
"a",
"reference",
"record",
"yet",
"figures",
"out",
"the",
"reference",
"record",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ReferenceField.java#L83-L100 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/Dictionary.java | Dictionary.getValue | @Override
public Object getValue(@NonNull String key) {
if (key == null) { throw new IllegalArgumentException("key cannot be null."); }
synchronized (lock) {
return getMValue(internalDict, key).asNative(internalDict);
}
} | java | @Override
public Object getValue(@NonNull String key) {
if (key == null) { throw new IllegalArgumentException("key cannot be null."); }
synchronized (lock) {
return getMValue(internalDict, key).asNative(internalDict);
}
} | [
"@",
"Override",
"public",
"Object",
"getValue",
"(",
"@",
"NonNull",
"String",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"key cannot be null.\"",
")",
";",
"}",
"synchronized",
"(",
"lock",... | Gets a property's value as an object. The object types are Blob, Array,
Dictionary, Number, or String based on the underlying data type; or nil if the
property value is null or the property doesn't exist.
@param key the key.
@return the object value or nil. | [
"Gets",
"a",
"property",
"s",
"value",
"as",
"an",
"object",
".",
"The",
"object",
"types",
"are",
"Blob",
"Array",
"Dictionary",
"Number",
"or",
"String",
"based",
"on",
"the",
"underlying",
"data",
"type",
";",
"or",
"nil",
"if",
"the",
"property",
"va... | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Dictionary.java#L114-L121 |
redkale/redkale | src/org/redkale/net/http/HttpRequest.java | HttpRequest.getFlipper | public org.redkale.source.Flipper getFlipper(boolean needcreate, int maxLimit) {
return getFlipper("flipper", needcreate, maxLimit);
} | java | public org.redkale.source.Flipper getFlipper(boolean needcreate, int maxLimit) {
return getFlipper("flipper", needcreate, maxLimit);
} | [
"public",
"org",
".",
"redkale",
".",
"source",
".",
"Flipper",
"getFlipper",
"(",
"boolean",
"needcreate",
",",
"int",
"maxLimit",
")",
"{",
"return",
"getFlipper",
"(",
"\"flipper\"",
",",
"needcreate",
",",
"maxLimit",
")",
";",
"}"
] | 获取翻页对象 同 getFlipper("flipper", needcreate, maxLimit)
@param needcreate 无参数时是否创建新Flipper对象
@param maxLimit 最大行数, 小于1则值为Flipper.DEFAULT_LIMIT
@return Flipper翻页对象 | [
"获取翻页对象",
"同",
"getFlipper",
"(",
"flipper",
"needcreate",
"maxLimit",
")"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpRequest.java#L1478-L1480 |
Viascom/groundwork | foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/placeholder/DefaultPlaceholderStrategy.java | DefaultPlaceholderStrategy.addPlaceholder | @Override
public void addPlaceholder(String placeholder, String value) {
placeholderMap.put(placeholder, value);
} | java | @Override
public void addPlaceholder(String placeholder, String value) {
placeholderMap.put(placeholder, value);
} | [
"@",
"Override",
"public",
"void",
"addPlaceholder",
"(",
"String",
"placeholder",
",",
"String",
"value",
")",
"{",
"placeholderMap",
".",
"put",
"(",
"placeholder",
",",
"value",
")",
";",
"}"
] | Add a placeholder to the strategy
@param placeholder name of the placholder
@param value value of the placeholder | [
"Add",
"a",
"placeholder",
"to",
"the",
"strategy"
] | train | https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/placeholder/DefaultPlaceholderStrategy.java#L46-L49 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/WordUtils.java | WordUtils.isDelimiter | private static boolean isDelimiter(final char ch, final char[] delimiters) {
if (delimiters == null) {
return CharUtils.isWhitespace(ch);
}
for (final char delimiter : delimiters) {
if (ch == delimiter) {
return true;
}
}
return false;
} | java | private static boolean isDelimiter(final char ch, final char[] delimiters) {
if (delimiters == null) {
return CharUtils.isWhitespace(ch);
}
for (final char delimiter : delimiters) {
if (ch == delimiter) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"isDelimiter",
"(",
"final",
"char",
"ch",
",",
"final",
"char",
"[",
"]",
"delimiters",
")",
"{",
"if",
"(",
"delimiters",
"==",
"null",
")",
"{",
"return",
"CharUtils",
".",
"isWhitespace",
"(",
"ch",
")",
";",
"}",
"f... | Is the character a delimiter.
@param ch the character to check
@param delimiters the delimiters
@return true if it is a delimiter | [
"Is",
"the",
"character",
"a",
"delimiter",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/WordUtils.java#L743-L753 |
jenkinsci/jenkins | core/src/main/java/hudson/FilePath.java | FilePath.act | public <T> T act(final FileCallable<T> callable) throws IOException, InterruptedException {
return act(callable,callable.getClass().getClassLoader());
} | java | public <T> T act(final FileCallable<T> callable) throws IOException, InterruptedException {
return act(callable,callable.getClass().getClassLoader());
} | [
"public",
"<",
"T",
">",
"T",
"act",
"(",
"final",
"FileCallable",
"<",
"T",
">",
"callable",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"return",
"act",
"(",
"callable",
",",
"callable",
".",
"getClass",
"(",
")",
".",
"getClassLoader... | Executes some program on the machine that this {@link FilePath} exists,
so that one can perform local file operations. | [
"Executes",
"some",
"program",
"on",
"the",
"machine",
"that",
"this",
"{"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/FilePath.java#L1057-L1059 |
landawn/AbacusUtil | src/com/landawn/abacus/hash/BloomFilter.java | BloomFilter.optimalNumOfHashFunctions | static int optimalNumOfHashFunctions(long n, long m) {
// (m / n) * log(2), but avoid truncation due to division!
return Math.max(1, (int) Math.round((double) m / n * Math.log(2)));
} | java | static int optimalNumOfHashFunctions(long n, long m) {
// (m / n) * log(2), but avoid truncation due to division!
return Math.max(1, (int) Math.round((double) m / n * Math.log(2)));
} | [
"static",
"int",
"optimalNumOfHashFunctions",
"(",
"long",
"n",
",",
"long",
"m",
")",
"{",
"// (m / n) * log(2), but avoid truncation due to division!",
"return",
"Math",
".",
"max",
"(",
"1",
",",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"(",
"double",
")... | Computes the optimal k (number of hashes per element inserted in Bloom filter), given the
expected insertions and total number of bits in the Bloom filter.
See http://en.wikipedia.org/wiki/File:Bloom_filter_fp_probability.svg for the formula.
@param n expected insertions (must be positive)
@param m total number of bits in Bloom filter (must be positive) | [
"Computes",
"the",
"optimal",
"k",
"(",
"number",
"of",
"hashes",
"per",
"element",
"inserted",
"in",
"Bloom",
"filter",
")",
"given",
"the",
"expected",
"insertions",
"and",
"total",
"number",
"of",
"bits",
"in",
"the",
"Bloom",
"filter",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/hash/BloomFilter.java#L386-L389 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java | SqlFunctionUtils.regexpReplace | public static String regexpReplace(String str, String regex, String replacement) {
if (regex.isEmpty()) {
return str;
}
try {
// we should use StringBuffer here because Matcher only accept it
StringBuffer sb = new StringBuffer();
Matcher m = REGEXP_PATTERN_CACHE.get(regex).matcher(str);
while (m.find()) {
m.appendReplacement(sb, replacement);
}
m.appendTail(sb);
return sb.toString();
} catch (Exception e) {
LOG.error(
String.format("Exception in regexpReplace('%s', '%s', '%s')", str, regex, replacement),
e);
// return null if exception in regex replace
return null;
}
} | java | public static String regexpReplace(String str, String regex, String replacement) {
if (regex.isEmpty()) {
return str;
}
try {
// we should use StringBuffer here because Matcher only accept it
StringBuffer sb = new StringBuffer();
Matcher m = REGEXP_PATTERN_CACHE.get(regex).matcher(str);
while (m.find()) {
m.appendReplacement(sb, replacement);
}
m.appendTail(sb);
return sb.toString();
} catch (Exception e) {
LOG.error(
String.format("Exception in regexpReplace('%s', '%s', '%s')", str, regex, replacement),
e);
// return null if exception in regex replace
return null;
}
} | [
"public",
"static",
"String",
"regexpReplace",
"(",
"String",
"str",
",",
"String",
"regex",
",",
"String",
"replacement",
")",
"{",
"if",
"(",
"regex",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"str",
";",
"}",
"try",
"{",
"// we should use StringBuff... | Returns a string resulting from replacing all substrings that match the regular
expression with replacement. | [
"Returns",
"a",
"string",
"resulting",
"from",
"replacing",
"all",
"substrings",
"that",
"match",
"the",
"regular",
"expression",
"with",
"replacement",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java#L346-L366 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java | GVRAvatar.animate | public GVRAnimator animate(int animIndex, float timeInSec)
{
if ((animIndex < 0) || (animIndex >= mAnimations.size()))
{
throw new IndexOutOfBoundsException("Animation index out of bounds");
}
GVRAnimator anim = mAnimations.get(animIndex);
anim.animate(timeInSec);
return anim;
} | java | public GVRAnimator animate(int animIndex, float timeInSec)
{
if ((animIndex < 0) || (animIndex >= mAnimations.size()))
{
throw new IndexOutOfBoundsException("Animation index out of bounds");
}
GVRAnimator anim = mAnimations.get(animIndex);
anim.animate(timeInSec);
return anim;
} | [
"public",
"GVRAnimator",
"animate",
"(",
"int",
"animIndex",
",",
"float",
"timeInSec",
")",
"{",
"if",
"(",
"(",
"animIndex",
"<",
"0",
")",
"||",
"(",
"animIndex",
">=",
"mAnimations",
".",
"size",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IndexOutOf... | Evaluates the animation with the given index at the specified time.
@param animIndex 0-based index of {@link GVRAnimator} to start
@param timeInSec time to evaluate the animation at
@see GVRAvatar#stop()
@see #start(String) | [
"Evaluates",
"the",
"animation",
"with",
"the",
"given",
"index",
"at",
"the",
"specified",
"time",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java#L449-L458 |
anotheria/moskito | moskito-integration/moskito-cdi/src/main/java/net/anotheria/moskito/integration/cdi/AbstractInterceptor.java | AbstractInterceptor.createMethodLevelAccumulators | private void createMethodLevelAccumulators(OnDemandStatsProducer<T> producer, Method method) {
//several @Accumulators in accumulators holder
String methodName = getMethodName(method);
Accumulates accAnnotationHolderMethods = (Accumulates) method.getAnnotation(Accumulates.class);
if (accAnnotationHolderMethods != null) {
Accumulate[] accAnnotations = accAnnotationHolderMethods.value();
for (Accumulate accAnnotation : accAnnotations) {
createAccumulator(
producer.getProducerId(),
accAnnotation,
formAccumulatorNameForMethod(producer, accAnnotation, method),
methodName
);
}
}
//If there is no @Accumulates annotation but @Accumulate is present
createAccumulator(
producer.getProducerId(),
method.getAnnotation(Accumulate.class),
formAccumulatorNameForMethod(producer, method.getAnnotation(Accumulate.class), method),
methodName
);
} | java | private void createMethodLevelAccumulators(OnDemandStatsProducer<T> producer, Method method) {
//several @Accumulators in accumulators holder
String methodName = getMethodName(method);
Accumulates accAnnotationHolderMethods = (Accumulates) method.getAnnotation(Accumulates.class);
if (accAnnotationHolderMethods != null) {
Accumulate[] accAnnotations = accAnnotationHolderMethods.value();
for (Accumulate accAnnotation : accAnnotations) {
createAccumulator(
producer.getProducerId(),
accAnnotation,
formAccumulatorNameForMethod(producer, accAnnotation, method),
methodName
);
}
}
//If there is no @Accumulates annotation but @Accumulate is present
createAccumulator(
producer.getProducerId(),
method.getAnnotation(Accumulate.class),
formAccumulatorNameForMethod(producer, method.getAnnotation(Accumulate.class), method),
methodName
);
} | [
"private",
"void",
"createMethodLevelAccumulators",
"(",
"OnDemandStatsProducer",
"<",
"T",
">",
"producer",
",",
"Method",
"method",
")",
"{",
"//several @Accumulators in accumulators holder",
"String",
"methodName",
"=",
"getMethodName",
"(",
"method",
")",
";",
"Accu... | Create method level accumulators.
@param producer {@link OnDemandStatsProducer}
@param method annotated method | [
"Create",
"method",
"level",
"accumulators",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-integration/moskito-cdi/src/main/java/net/anotheria/moskito/integration/cdi/AbstractInterceptor.java#L150-L173 |
aws/aws-sdk-java | aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/UpdateRouteResponseResult.java | UpdateRouteResponseResult.withResponseModels | public UpdateRouteResponseResult withResponseModels(java.util.Map<String, String> responseModels) {
setResponseModels(responseModels);
return this;
} | java | public UpdateRouteResponseResult withResponseModels(java.util.Map<String, String> responseModels) {
setResponseModels(responseModels);
return this;
} | [
"public",
"UpdateRouteResponseResult",
"withResponseModels",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"responseModels",
")",
"{",
"setResponseModels",
"(",
"responseModels",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Represents the response models of a route response.
</p>
@param responseModels
Represents the response models of a route response.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Represents",
"the",
"response",
"models",
"of",
"a",
"route",
"response",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/UpdateRouteResponseResult.java#L127-L130 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/TasksInner.java | TasksInner.createAsync | public Observable<TaskInner> createAsync(String resourceGroupName, String registryName, String taskName, TaskInner taskCreateParameters) {
return createWithServiceResponseAsync(resourceGroupName, registryName, taskName, taskCreateParameters).map(new Func1<ServiceResponse<TaskInner>, TaskInner>() {
@Override
public TaskInner call(ServiceResponse<TaskInner> response) {
return response.body();
}
});
} | java | public Observable<TaskInner> createAsync(String resourceGroupName, String registryName, String taskName, TaskInner taskCreateParameters) {
return createWithServiceResponseAsync(resourceGroupName, registryName, taskName, taskCreateParameters).map(new Func1<ServiceResponse<TaskInner>, TaskInner>() {
@Override
public TaskInner call(ServiceResponse<TaskInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"TaskInner",
">",
"createAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"taskName",
",",
"TaskInner",
"taskCreateParameters",
")",
"{",
"return",
"createWithServiceResponseAsync",
"(",
"resourceGrou... | Creates a task for a container registry with the specified parameters.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param taskName The name of the container registry task.
@param taskCreateParameters The parameters for creating a task.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"a",
"task",
"for",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/TasksInner.java#L362-L369 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/MemcachedClient.java | MemcachedClient.getVersions | @Override
public Map<SocketAddress, String> getVersions() {
final Map<SocketAddress, String> rv =
new ConcurrentHashMap<SocketAddress, String>();
CountDownLatch blatch = broadcastOp(new BroadcastOpFactory() {
@Override
public Operation newOp(final MemcachedNode n,
final CountDownLatch latch) {
final SocketAddress sa = n.getSocketAddress();
return opFact.version(new OperationCallback() {
@Override
public void receivedStatus(OperationStatus s) {
rv.put(sa, s.getMessage());
}
@Override
public void complete() {
latch.countDown();
}
});
}
});
try {
blatch.await(operationTimeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted waiting for versions", e);
}
return rv;
} | java | @Override
public Map<SocketAddress, String> getVersions() {
final Map<SocketAddress, String> rv =
new ConcurrentHashMap<SocketAddress, String>();
CountDownLatch blatch = broadcastOp(new BroadcastOpFactory() {
@Override
public Operation newOp(final MemcachedNode n,
final CountDownLatch latch) {
final SocketAddress sa = n.getSocketAddress();
return opFact.version(new OperationCallback() {
@Override
public void receivedStatus(OperationStatus s) {
rv.put(sa, s.getMessage());
}
@Override
public void complete() {
latch.countDown();
}
});
}
});
try {
blatch.await(operationTimeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted waiting for versions", e);
}
return rv;
} | [
"@",
"Override",
"public",
"Map",
"<",
"SocketAddress",
",",
"String",
">",
"getVersions",
"(",
")",
"{",
"final",
"Map",
"<",
"SocketAddress",
",",
"String",
">",
"rv",
"=",
"new",
"ConcurrentHashMap",
"<",
"SocketAddress",
",",
"String",
">",
"(",
")",
... | Get the versions of all of the connected memcacheds.
@return a Map of SocketAddress to String for connected servers
@throws IllegalStateException in the rare circumstance where queue is too
full to accept any more requests | [
"Get",
"the",
"versions",
"of",
"all",
"of",
"the",
"connected",
"memcacheds",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L1658-L1687 |
phax/ph-bdve | ph-bdve-ebinterface/src/main/java/com/helger/bdve/ebinterface/EbInterfaceValidation.java | EbInterfaceValidation.initEbInterface | public static void initEbInterface (@Nonnull final ValidationExecutorSetRegistry aRegistry)
{
ValueEnforcer.notNull (aRegistry, "Registry");
final boolean bNotDeprecated = false;
// No Schematrons here
for (final EEbInterfaceDocumentType e : EEbInterfaceDocumentType.values ())
{
final String sVersion = e.name ().charAt (3) + "." + e.name ().substring (4);
final VESID aVESID = new VESID (GROUP_ID, "invoice", sVersion);
// No Schematrons here
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (aVESID,
"ebInterface " + sVersion,
bNotDeprecated,
ValidationExecutorXSD.create (e)));
}
} | java | public static void initEbInterface (@Nonnull final ValidationExecutorSetRegistry aRegistry)
{
ValueEnforcer.notNull (aRegistry, "Registry");
final boolean bNotDeprecated = false;
// No Schematrons here
for (final EEbInterfaceDocumentType e : EEbInterfaceDocumentType.values ())
{
final String sVersion = e.name ().charAt (3) + "." + e.name ().substring (4);
final VESID aVESID = new VESID (GROUP_ID, "invoice", sVersion);
// No Schematrons here
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (aVESID,
"ebInterface " + sVersion,
bNotDeprecated,
ValidationExecutorXSD.create (e)));
}
} | [
"public",
"static",
"void",
"initEbInterface",
"(",
"@",
"Nonnull",
"final",
"ValidationExecutorSetRegistry",
"aRegistry",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aRegistry",
",",
"\"Registry\"",
")",
";",
"final",
"boolean",
"bNotDeprecated",
"=",
"false",... | Register all standard TEAPPS validation execution sets to the provided
registry.
@param aRegistry
The registry to add the artefacts. May not be <code>null</code>. | [
"Register",
"all",
"standard",
"TEAPPS",
"validation",
"execution",
"sets",
"to",
"the",
"provided",
"registry",
"."
] | train | https://github.com/phax/ph-bdve/blob/2438f491174cd8989567fcdf129b273bd217e89f/ph-bdve-ebinterface/src/main/java/com/helger/bdve/ebinterface/EbInterfaceValidation.java#L57-L75 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.metrics/src/com/ibm/ws/microprofile/metrics/impl/MetricRegistryImpl.java | MetricRegistryImpl.getHistograms | @Override
public SortedMap<String, Histogram> getHistograms(MetricFilter filter) {
return getMetrics(Histogram.class, filter);
} | java | @Override
public SortedMap<String, Histogram> getHistograms(MetricFilter filter) {
return getMetrics(Histogram.class, filter);
} | [
"@",
"Override",
"public",
"SortedMap",
"<",
"String",
",",
"Histogram",
">",
"getHistograms",
"(",
"MetricFilter",
"filter",
")",
"{",
"return",
"getMetrics",
"(",
"Histogram",
".",
"class",
",",
"filter",
")",
";",
"}"
] | Returns a map of all the histograms in the registry and their names which match the given
filter.
@param filter the metric filter to match
@return all the histograms in the registry | [
"Returns",
"a",
"map",
"of",
"all",
"the",
"histograms",
"in",
"the",
"registry",
"and",
"their",
"names",
"which",
"match",
"the",
"given",
"filter",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.metrics/src/com/ibm/ws/microprofile/metrics/impl/MetricRegistryImpl.java#L384-L387 |
Asana/java-asana | src/main/java/com/asana/resources/Attachments.java | Attachments.createOnTask | public ItemRequest<Attachment> createOnTask(String task, InputStream fileContent, String fileName, String fileType) {
MultipartContent.Part part = new MultipartContent.Part()
.setContent(new InputStreamContent(fileType, fileContent))
.setHeaders(new HttpHeaders().set(
"Content-Disposition",
String.format("form-data; name=\"file\"; filename=\"%s\"", fileName) // TODO: escape fileName?
));
MultipartContent content = new MultipartContent()
.setMediaType(new HttpMediaType("multipart/form-data").setParameter("boundary", UUID.randomUUID().toString()))
.addPart(part);
String path = String.format("/tasks/%s/attachments", task);
return new ItemRequest<Attachment>(this, Attachment.class, path, "POST")
.data(content);
} | java | public ItemRequest<Attachment> createOnTask(String task, InputStream fileContent, String fileName, String fileType) {
MultipartContent.Part part = new MultipartContent.Part()
.setContent(new InputStreamContent(fileType, fileContent))
.setHeaders(new HttpHeaders().set(
"Content-Disposition",
String.format("form-data; name=\"file\"; filename=\"%s\"", fileName) // TODO: escape fileName?
));
MultipartContent content = new MultipartContent()
.setMediaType(new HttpMediaType("multipart/form-data").setParameter("boundary", UUID.randomUUID().toString()))
.addPart(part);
String path = String.format("/tasks/%s/attachments", task);
return new ItemRequest<Attachment>(this, Attachment.class, path, "POST")
.data(content);
} | [
"public",
"ItemRequest",
"<",
"Attachment",
">",
"createOnTask",
"(",
"String",
"task",
",",
"InputStream",
"fileContent",
",",
"String",
"fileName",
",",
"String",
"fileType",
")",
"{",
"MultipartContent",
".",
"Part",
"part",
"=",
"new",
"MultipartContent",
".... | Upload a file and attach it to a task
@param task Globally unique identifier for the task.
@param fileContent Content of the file to be uploaded
@param fileName Name of the file to be uploaded
@param fileType MIME type of the file to be uploaded
@return Request object | [
"Upload",
"a",
"file",
"and",
"attach",
"it",
"to",
"a",
"task"
] | train | https://github.com/Asana/java-asana/blob/abeea92fd5a71260a5d804db4da94e52fd7a15a7/src/main/java/com/asana/resources/Attachments.java#L29-L43 |
grails/grails-core | grails-core/src/main/groovy/grails/util/GrailsClassUtils.java | GrailsClassUtils.findPropertyNameForValue | public static String findPropertyNameForValue(Object target, Object obj) {
MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(target.getClass());
List<MetaProperty> metaProperties = mc.getProperties();
for (MetaProperty metaProperty : metaProperties) {
if (isAssignableOrConvertibleFrom(metaProperty.getType(), obj.getClass())) {
Object val = metaProperty.getProperty(target);
if (val != null && val.equals(obj)) {
return metaProperty.getName();
}
}
}
return null;
} | java | public static String findPropertyNameForValue(Object target, Object obj) {
MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(target.getClass());
List<MetaProperty> metaProperties = mc.getProperties();
for (MetaProperty metaProperty : metaProperties) {
if (isAssignableOrConvertibleFrom(metaProperty.getType(), obj.getClass())) {
Object val = metaProperty.getProperty(target);
if (val != null && val.equals(obj)) {
return metaProperty.getName();
}
}
}
return null;
} | [
"public",
"static",
"String",
"findPropertyNameForValue",
"(",
"Object",
"target",
",",
"Object",
"obj",
")",
"{",
"MetaClass",
"mc",
"=",
"GroovySystem",
".",
"getMetaClassRegistry",
"(",
")",
".",
"getMetaClass",
"(",
"target",
".",
"getClass",
"(",
")",
")"... | Locates the name of a property for the given value on the target object using Groovy's meta APIs.
Note that this method uses the reference so the incorrect result could be returned for two properties
that refer to the same reference. Use with caution.
@param target The target
@param obj The property value
@return The property name or null | [
"Locates",
"the",
"name",
"of",
"a",
"property",
"for",
"the",
"given",
"value",
"on",
"the",
"target",
"object",
"using",
"Groovy",
"s",
"meta",
"APIs",
".",
"Note",
"that",
"this",
"method",
"uses",
"the",
"reference",
"so",
"the",
"incorrect",
"result",... | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L848-L860 |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/HalRepresentation.java | HalRepresentation.withEmbedded | protected HalRepresentation withEmbedded(final String rel, final List<? extends HalRepresentation> embeddedItems) {
embedded = copyOf(embedded).with(rel, embeddedItems).using(curies).build();
return this;
} | java | protected HalRepresentation withEmbedded(final String rel, final List<? extends HalRepresentation> embeddedItems) {
embedded = copyOf(embedded).with(rel, embeddedItems).using(curies).build();
return this;
} | [
"protected",
"HalRepresentation",
"withEmbedded",
"(",
"final",
"String",
"rel",
",",
"final",
"List",
"<",
"?",
"extends",
"HalRepresentation",
">",
"embeddedItems",
")",
"{",
"embedded",
"=",
"copyOf",
"(",
"embedded",
")",
".",
"with",
"(",
"rel",
",",
"e... | Adds embedded items for a link-relation type to the HalRepresentation.
<p>
If {@code rel} is already present, it is replaced by the new embedded items.
</p>
@param rel the link-relation type of the embedded items that are added or replaced
@param embeddedItems the new values for the specified link-relation type
@return this
@since 0.5.0 | [
"Adds",
"embedded",
"items",
"for",
"a",
"link",
"-",
"relation",
"type",
"to",
"the",
"HalRepresentation",
".",
"<p",
">",
"If",
"{",
"@code",
"rel",
"}",
"is",
"already",
"present",
"it",
"is",
"replaced",
"by",
"the",
"new",
"embedded",
"items",
".",
... | train | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/HalRepresentation.java#L206-L209 |
JOML-CI/JOML | src/org/joml/Intersectiond.java | Intersectiond.intersectRayCircle | public static boolean intersectRayCircle(Vector2dc origin, Vector2dc dir, Vector2dc center, double radiusSquared, Vector2d result) {
return intersectRayCircle(origin.x(), origin.y(), dir.x(), dir.y(), center.x(), center.y(), radiusSquared, result);
} | java | public static boolean intersectRayCircle(Vector2dc origin, Vector2dc dir, Vector2dc center, double radiusSquared, Vector2d result) {
return intersectRayCircle(origin.x(), origin.y(), dir.x(), dir.y(), center.x(), center.y(), radiusSquared, result);
} | [
"public",
"static",
"boolean",
"intersectRayCircle",
"(",
"Vector2dc",
"origin",
",",
"Vector2dc",
"dir",
",",
"Vector2dc",
"center",
",",
"double",
"radiusSquared",
",",
"Vector2d",
"result",
")",
"{",
"return",
"intersectRayCircle",
"(",
"origin",
".",
"x",
"(... | Test whether the ray with the given <code>origin</code> and direction <code>dir</code>
intersects the circle with the given <code>center</code> and square radius <code>radiusSquared</code>,
and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near
and far) of intersections into the given <code>result</code> vector.
<p>
This method returns <code>true</code> for a ray whose origin lies inside the circle.
<p>
Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a>
@param origin
the ray's origin
@param dir
the ray's direction
@param center
the circle's center
@param radiusSquared
the circle radius squared
@param result
a vector that will contain the values of the parameter <i>t</i> in the ray equation
<i>p(t) = origin + t * dir</i> for both points (near, far) of intersections with the circle
@return <code>true</code> if the ray intersects the circle; <code>false</code> otherwise | [
"Test",
"whether",
"the",
"ray",
"with",
"the",
"given",
"<code",
">",
"origin<",
"/",
"code",
">",
"and",
"direction",
"<code",
">",
"dir<",
"/",
"code",
">",
"intersects",
"the",
"circle",
"with",
"the",
"given",
"<code",
">",
"center<",
"/",
"code",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectiond.java#L4267-L4269 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/tiles/user/TileDaoUtils.java | TileDaoUtils.getMaxLength | public static double getMaxLength(double[] widths, double[] heights) {
double maxWidth = getMaxLength(widths);
double maxHeight = getMaxLength(heights);
double maxLength = Math.min(maxWidth, maxHeight);
return maxLength;
} | java | public static double getMaxLength(double[] widths, double[] heights) {
double maxWidth = getMaxLength(widths);
double maxHeight = getMaxLength(heights);
double maxLength = Math.min(maxWidth, maxHeight);
return maxLength;
} | [
"public",
"static",
"double",
"getMaxLength",
"(",
"double",
"[",
"]",
"widths",
",",
"double",
"[",
"]",
"heights",
")",
"{",
"double",
"maxWidth",
"=",
"getMaxLength",
"(",
"widths",
")",
";",
"double",
"maxHeight",
"=",
"getMaxLength",
"(",
"heights",
"... | Get the max distance length that matches the tile widths and heights
@param widths
sorted tile matrix widths
@param heights
sorted tile matrix heights
@return max length
@since 1.2.0 | [
"Get",
"the",
"max",
"distance",
"length",
"that",
"matches",
"the",
"tile",
"widths",
"and",
"heights"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/user/TileDaoUtils.java#L415-L420 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/inline/InlineRendition.java | InlineRendition.buildScaledMediaUrl | private String buildScaledMediaUrl(Dimension dimension, CropDimension cropDimension) {
String resourcePath = this.resource.getPath();
// if parent resource is a nt:file resource, use this one as path for scaled image
Resource parentResource = this.resource.getParent();
if (JcrBinary.isNtFile(parentResource)) {
resourcePath = parentResource.getPath();
}
// URL to render scaled image via {@link InlineRenditionServlet}
String path = resourcePath + "." + ImageFileServlet.SELECTOR
+ "." + dimension.getWidth() + "." + dimension.getHeight()
+ (cropDimension != null ? "." + cropDimension.getCropString() : "")
+ (this.mediaArgs.isContentDispositionAttachment() ? "." + MediaFileServlet.SELECTOR_DOWNLOAD : "")
+ "." + MediaFileServlet.EXTENSION + "/"
// replace extension based on the format supported by ImageFileServlet for rendering for this rendition
+ ImageFileServlet.getImageFileName(getFileName());
// build externalized URL
UrlHandler urlHandler = AdaptTo.notNull(this.adaptable, UrlHandler.class);
return urlHandler.get(path).urlMode(this.mediaArgs.getUrlMode()).buildExternalResourceUrl(this.resource);
} | java | private String buildScaledMediaUrl(Dimension dimension, CropDimension cropDimension) {
String resourcePath = this.resource.getPath();
// if parent resource is a nt:file resource, use this one as path for scaled image
Resource parentResource = this.resource.getParent();
if (JcrBinary.isNtFile(parentResource)) {
resourcePath = parentResource.getPath();
}
// URL to render scaled image via {@link InlineRenditionServlet}
String path = resourcePath + "." + ImageFileServlet.SELECTOR
+ "." + dimension.getWidth() + "." + dimension.getHeight()
+ (cropDimension != null ? "." + cropDimension.getCropString() : "")
+ (this.mediaArgs.isContentDispositionAttachment() ? "." + MediaFileServlet.SELECTOR_DOWNLOAD : "")
+ "." + MediaFileServlet.EXTENSION + "/"
// replace extension based on the format supported by ImageFileServlet for rendering for this rendition
+ ImageFileServlet.getImageFileName(getFileName());
// build externalized URL
UrlHandler urlHandler = AdaptTo.notNull(this.adaptable, UrlHandler.class);
return urlHandler.get(path).urlMode(this.mediaArgs.getUrlMode()).buildExternalResourceUrl(this.resource);
} | [
"private",
"String",
"buildScaledMediaUrl",
"(",
"Dimension",
"dimension",
",",
"CropDimension",
"cropDimension",
")",
"{",
"String",
"resourcePath",
"=",
"this",
".",
"resource",
".",
"getPath",
"(",
")",
";",
"// if parent resource is a nt:file resource, use this one as... | Builds URL to rescaled version of the binary image.
@return Media URL | [
"Builds",
"URL",
"to",
"rescaled",
"version",
"of",
"the",
"binary",
"image",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/inline/InlineRendition.java#L259-L280 |
apache/groovy | src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java | BytecodeHelper.visitClassLiteral | public static void visitClassLiteral(MethodVisitor mv, ClassNode classNode) {
if (ClassHelper.isPrimitiveType(classNode)) {
mv.visitFieldInsn(
GETSTATIC,
getClassInternalName(ClassHelper.getWrapper(classNode)),
"TYPE",
"Ljava/lang/Class;");
} else {
mv.visitLdcInsn(org.objectweb.asm.Type.getType(getTypeDescription(classNode)));
}
} | java | public static void visitClassLiteral(MethodVisitor mv, ClassNode classNode) {
if (ClassHelper.isPrimitiveType(classNode)) {
mv.visitFieldInsn(
GETSTATIC,
getClassInternalName(ClassHelper.getWrapper(classNode)),
"TYPE",
"Ljava/lang/Class;");
} else {
mv.visitLdcInsn(org.objectweb.asm.Type.getType(getTypeDescription(classNode)));
}
} | [
"public",
"static",
"void",
"visitClassLiteral",
"(",
"MethodVisitor",
"mv",
",",
"ClassNode",
"classNode",
")",
"{",
"if",
"(",
"ClassHelper",
".",
"isPrimitiveType",
"(",
"classNode",
")",
")",
"{",
"mv",
".",
"visitFieldInsn",
"(",
"GETSTATIC",
",",
"getCla... | Visits a class literal. If the type of the classnode is a primitive type,
the generated bytecode will be a GETSTATIC Integer.TYPE.
If the classnode is not a primitive type, we will generate a LDC instruction. | [
"Visits",
"a",
"class",
"literal",
".",
"If",
"the",
"type",
"of",
"the",
"classnode",
"is",
"a",
"primitive",
"type",
"the",
"generated",
"bytecode",
"will",
"be",
"a",
"GETSTATIC",
"Integer",
".",
"TYPE",
".",
"If",
"the",
"classnode",
"is",
"not",
"a"... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java#L532-L542 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Model.java | Model.dateFormat | protected static void dateFormat(DateFormat format, String... attributeNames) {
ModelDelegate.dateFormat(modelClass(), format, attributeNames);
} | java | protected static void dateFormat(DateFormat format, String... attributeNames) {
ModelDelegate.dateFormat(modelClass(), format, attributeNames);
} | [
"protected",
"static",
"void",
"dateFormat",
"(",
"DateFormat",
"format",
",",
"String",
"...",
"attributeNames",
")",
"{",
"ModelDelegate",
".",
"dateFormat",
"(",
"modelClass",
"(",
")",
",",
"format",
",",
"attributeNames",
")",
";",
"}"
] | Registers date format for specified attributes. This format will be used to convert between
Date -> String -> java.sql.Date when using the appropriate getters and setters.
<p>See example in {@link #dateFormat(String, String...)}.
@param format format to use for conversion
@param attributeNames attribute names | [
"Registers",
"date",
"format",
"for",
"specified",
"attributes",
".",
"This",
"format",
"will",
"be",
"used",
"to",
"convert",
"between",
"Date",
"-",
">",
"String",
"-",
">",
"java",
".",
"sql",
".",
"Date",
"when",
"using",
"the",
"appropriate",
"getters... | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L2139-L2141 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLBuilder.java | JQLBuilder.isInSet | private static boolean isInSet(String value, Set<JQLPlaceHolder> parametersUsedInWhereConditions) {
for (JQLPlaceHolder ph : parametersUsedInWhereConditions) {
if (ph.value.equals(value))
return true;
}
return false;
} | java | private static boolean isInSet(String value, Set<JQLPlaceHolder> parametersUsedInWhereConditions) {
for (JQLPlaceHolder ph : parametersUsedInWhereConditions) {
if (ph.value.equals(value))
return true;
}
return false;
} | [
"private",
"static",
"boolean",
"isInSet",
"(",
"String",
"value",
",",
"Set",
"<",
"JQLPlaceHolder",
">",
"parametersUsedInWhereConditions",
")",
"{",
"for",
"(",
"JQLPlaceHolder",
"ph",
":",
"parametersUsedInWhereConditions",
")",
"{",
"if",
"(",
"ph",
".",
"v... | Checks if is in set.
@param value
the value
@param parametersUsedInWhereConditions
the parameters used in where conditions
@return true, if is in set | [
"Checks",
"if",
"is",
"in",
"set",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLBuilder.java#L876-L882 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/flow/DenseFlowPyramidBase.java | DenseFlowPyramidBase.warpImageTaylor | protected void warpImageTaylor(GrayF32 before, GrayF32 flowX , GrayF32 flowY , GrayF32 after) {
interp.setBorder(FactoryImageBorder.single(before.getImageType().getImageClass(), BorderType.EXTENDED));
interp.setImage(before);
for( int y = 0; y < before.height; y++ ) {
int pixelIndex = y*before.width;
for (int x = 0; x < before.width; x++, pixelIndex++ ) {
float u = flowX.data[pixelIndex];
float v = flowY.data[pixelIndex];
float wx = x + u;
float wy = y + v;
after.data[pixelIndex] = interp.get(wx, wy);
}
}
} | java | protected void warpImageTaylor(GrayF32 before, GrayF32 flowX , GrayF32 flowY , GrayF32 after) {
interp.setBorder(FactoryImageBorder.single(before.getImageType().getImageClass(), BorderType.EXTENDED));
interp.setImage(before);
for( int y = 0; y < before.height; y++ ) {
int pixelIndex = y*before.width;
for (int x = 0; x < before.width; x++, pixelIndex++ ) {
float u = flowX.data[pixelIndex];
float v = flowY.data[pixelIndex];
float wx = x + u;
float wy = y + v;
after.data[pixelIndex] = interp.get(wx, wy);
}
}
} | [
"protected",
"void",
"warpImageTaylor",
"(",
"GrayF32",
"before",
",",
"GrayF32",
"flowX",
",",
"GrayF32",
"flowY",
",",
"GrayF32",
"after",
")",
"{",
"interp",
".",
"setBorder",
"(",
"FactoryImageBorder",
".",
"single",
"(",
"before",
".",
"getImageType",
"("... | Takes the flow from the previous lower resolution layer and uses it to initialize the flow
in the current layer. Adjusts for change in image scale. | [
"Takes",
"the",
"flow",
"from",
"the",
"previous",
"lower",
"resolution",
"layer",
"and",
"uses",
"it",
"to",
"initialize",
"the",
"flow",
"in",
"the",
"current",
"layer",
".",
"Adjusts",
"for",
"change",
"in",
"image",
"scale",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/flow/DenseFlowPyramidBase.java#L122-L138 |
facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/raid/RaidHistogram.java | RaidHistogram.put | public synchronized void put(String path, long value, String taskId) {
Point p;
int last = windowNum - 1;
if (value == RECOVERY_FAIL) {
p = new Point(value, path, System.currentTimeMillis(), taskId);
AtomicInteger counter = failedRecoveredFiles.get(path);
if (counter == null) {
counter = new AtomicInteger(0);
failedRecoveredFiles.put(path, counter);
}
if (counter.incrementAndGet() == 1) {
totalFailedPaths.get(last).incrementAndGet();
}
} else {
value /= dividend;
p = new Point(value, path, System.currentTimeMillis(), taskId);
CounterArray counters = histo.get(value);
if (counters == null) {
counters = new CounterArray(windowNum);
histo.put(value, counters);
}
counters.incrementAndGet(last);
totalPoints.incrementAndGet(last);
}
points.add(p);
InjectionHandler.processEvent(InjectionEvent.RAID_SEND_RECOVERY_TIME, this, path,
value, taskId);
} | java | public synchronized void put(String path, long value, String taskId) {
Point p;
int last = windowNum - 1;
if (value == RECOVERY_FAIL) {
p = new Point(value, path, System.currentTimeMillis(), taskId);
AtomicInteger counter = failedRecoveredFiles.get(path);
if (counter == null) {
counter = new AtomicInteger(0);
failedRecoveredFiles.put(path, counter);
}
if (counter.incrementAndGet() == 1) {
totalFailedPaths.get(last).incrementAndGet();
}
} else {
value /= dividend;
p = new Point(value, path, System.currentTimeMillis(), taskId);
CounterArray counters = histo.get(value);
if (counters == null) {
counters = new CounterArray(windowNum);
histo.put(value, counters);
}
counters.incrementAndGet(last);
totalPoints.incrementAndGet(last);
}
points.add(p);
InjectionHandler.processEvent(InjectionEvent.RAID_SEND_RECOVERY_TIME, this, path,
value, taskId);
} | [
"public",
"synchronized",
"void",
"put",
"(",
"String",
"path",
",",
"long",
"value",
",",
"String",
"taskId",
")",
"{",
"Point",
"p",
";",
"int",
"last",
"=",
"windowNum",
"-",
"1",
";",
"if",
"(",
"value",
"==",
"RECOVERY_FAIL",
")",
"{",
"p",
"=",... | /*
If value is RECOVERY_FAIL, we consider it as recovery failure | [
"/",
"*",
"If",
"value",
"is",
"RECOVERY_FAIL",
"we",
"consider",
"it",
"as",
"recovery",
"failure"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/RaidHistogram.java#L183-L210 |
mikepenz/MaterialDrawer | library/src/main/java/com/mikepenz/materialdrawer/DrawerUtils.java | DrawerUtils.processDrawerLayoutParams | public static DrawerLayout.LayoutParams processDrawerLayoutParams(DrawerBuilder drawer, DrawerLayout.LayoutParams params) {
if (params != null) {
if (drawer.mDrawerGravity != null && (drawer.mDrawerGravity == Gravity.RIGHT || drawer.mDrawerGravity == Gravity.END)) {
params.rightMargin = 0;
if (Build.VERSION.SDK_INT >= 17) {
params.setMarginEnd(0);
}
params.leftMargin = drawer.mActivity.getResources().getDimensionPixelSize(R.dimen.material_drawer_margin);
if (Build.VERSION.SDK_INT >= 17) {
params.setMarginEnd(drawer.mActivity.getResources().getDimensionPixelSize(R.dimen.material_drawer_margin));
}
}
if (drawer.mDrawerWidth > -1) {
params.width = drawer.mDrawerWidth;
} else {
params.width = DrawerUIUtils.getOptimalDrawerWidth(drawer.mActivity);
}
}
return params;
} | java | public static DrawerLayout.LayoutParams processDrawerLayoutParams(DrawerBuilder drawer, DrawerLayout.LayoutParams params) {
if (params != null) {
if (drawer.mDrawerGravity != null && (drawer.mDrawerGravity == Gravity.RIGHT || drawer.mDrawerGravity == Gravity.END)) {
params.rightMargin = 0;
if (Build.VERSION.SDK_INT >= 17) {
params.setMarginEnd(0);
}
params.leftMargin = drawer.mActivity.getResources().getDimensionPixelSize(R.dimen.material_drawer_margin);
if (Build.VERSION.SDK_INT >= 17) {
params.setMarginEnd(drawer.mActivity.getResources().getDimensionPixelSize(R.dimen.material_drawer_margin));
}
}
if (drawer.mDrawerWidth > -1) {
params.width = drawer.mDrawerWidth;
} else {
params.width = DrawerUIUtils.getOptimalDrawerWidth(drawer.mActivity);
}
}
return params;
} | [
"public",
"static",
"DrawerLayout",
".",
"LayoutParams",
"processDrawerLayoutParams",
"(",
"DrawerBuilder",
"drawer",
",",
"DrawerLayout",
".",
"LayoutParams",
"params",
")",
"{",
"if",
"(",
"params",
"!=",
"null",
")",
"{",
"if",
"(",
"drawer",
".",
"mDrawerGra... | helper to extend the layoutParams of the drawer
@param params
@return | [
"helper",
"to",
"extend",
"the",
"layoutParams",
"of",
"the",
"drawer"
] | train | https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/DrawerUtils.java#L424-L446 |
threerings/narya | core/src/main/java/com/threerings/crowd/server/PlaceRegistry.java | PlaceRegistry.createPlace | public PlaceManager createPlace (PlaceConfig config, List<PlaceManagerDelegate> delegates)
throws InstantiationException, InvocationException
{
return createPlace(config, delegates, null);
} | java | public PlaceManager createPlace (PlaceConfig config, List<PlaceManagerDelegate> delegates)
throws InstantiationException, InvocationException
{
return createPlace(config, delegates, null);
} | [
"public",
"PlaceManager",
"createPlace",
"(",
"PlaceConfig",
"config",
",",
"List",
"<",
"PlaceManagerDelegate",
">",
"delegates",
")",
"throws",
"InstantiationException",
",",
"InvocationException",
"{",
"return",
"createPlace",
"(",
"config",
",",
"delegates",
",",
... | Creates and registers a new place manager along with the place object to be managed. The
registry takes care of tracking the creation of the object and informing the manager when it
is created.
@param config the configuration object for the place to be created. The {@link PlaceManager}
derived class that should be instantiated to manage the place will be determined from the
config object.
@param delegates a list of {@link PlaceManagerDelegate} instances to be registered with the
manager prior to it being initialized and started up. <em>Note:</em> these delegates will
have dependencies injected into them prior to registering them with the manager.
@return a reference to the place manager, which will have been configured with its place
object and started up (via a call to {@link PlaceManager#startup}.
@exception InstantiationException thrown if an error occurs trying to instantiate and
initialize the place manager.
@exception InvocationException thrown if the place manager returns failure from the call to
{@link PlaceManager#checkPermissions}. The error string returned by that call will be
provided as in the exception. | [
"Creates",
"and",
"registers",
"a",
"new",
"place",
"manager",
"along",
"with",
"the",
"place",
"object",
"to",
"be",
"managed",
".",
"The",
"registry",
"takes",
"care",
"of",
"tracking",
"the",
"creation",
"of",
"the",
"object",
"and",
"informing",
"the",
... | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/server/PlaceRegistry.java#L109-L113 |
google/closure-compiler | src/com/google/javascript/jscomp/CrossChunkCodeMotion.java | CrossChunkCodeMotion.isInstanceofFor | private boolean isInstanceofFor(Node expression, Node reference) {
return expression.isInstanceOf() && expression.getLastChild().isEquivalentTo(reference);
} | java | private boolean isInstanceofFor(Node expression, Node reference) {
return expression.isInstanceOf() && expression.getLastChild().isEquivalentTo(reference);
} | [
"private",
"boolean",
"isInstanceofFor",
"(",
"Node",
"expression",
",",
"Node",
"reference",
")",
"{",
"return",
"expression",
".",
"isInstanceOf",
"(",
")",
"&&",
"expression",
".",
"getLastChild",
"(",
")",
".",
"isEquivalentTo",
"(",
"reference",
")",
";",... | Is the expression of the form {@code x instanceof Ref}?
@param expression
@param reference Ref node must be equivalent to this node | [
"Is",
"the",
"expression",
"of",
"the",
"form",
"{",
"@code",
"x",
"instanceof",
"Ref",
"}",
"?"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CrossChunkCodeMotion.java#L761-L763 |
weld/core | modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeanImpl.java | SessionBeanImpl.of | public static <T> SessionBean<T> of(BeanAttributes<T> attributes, InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl beanManager, EnhancedAnnotatedType<T> type) {
return new SessionBeanImpl<T>(attributes, type, ejbDescriptor, new StringBeanIdentifier(SessionBeans.createIdentifier(type, ejbDescriptor)), beanManager);
} | java | public static <T> SessionBean<T> of(BeanAttributes<T> attributes, InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl beanManager, EnhancedAnnotatedType<T> type) {
return new SessionBeanImpl<T>(attributes, type, ejbDescriptor, new StringBeanIdentifier(SessionBeans.createIdentifier(type, ejbDescriptor)), beanManager);
} | [
"public",
"static",
"<",
"T",
">",
"SessionBean",
"<",
"T",
">",
"of",
"(",
"BeanAttributes",
"<",
"T",
">",
"attributes",
",",
"InternalEjbDescriptor",
"<",
"T",
">",
"ejbDescriptor",
",",
"BeanManagerImpl",
"beanManager",
",",
"EnhancedAnnotatedType",
"<",
"... | Creates a simple, annotation defined Enterprise Web Bean using the annotations specified on type
@param <T> The type
@param beanManager the current manager
@param type the AnnotatedType to use
@return An Enterprise Web Bean | [
"Creates",
"a",
"simple",
"annotation",
"defined",
"Enterprise",
"Web",
"Bean",
"using",
"the",
"annotations",
"specified",
"on",
"type"
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeanImpl.java#L76-L78 |
SimiaCryptus/utilities | java-util/src/main/java/com/simiacryptus/util/binary/BitOutputStream.java | BitOutputStream.writeBoundedLong | public Bits writeBoundedLong(final long value, final long max)
throws IOException {
final int bits = 0 >= max ? 0 : (int) (Math
.floor(Math.log(max) / Math.log(2)) + 1);
if (0 < bits) {
Bits toWrite = new Bits(value, bits);
this.write(toWrite);
return toWrite;
}
else {
return Bits.NULL;
}
} | java | public Bits writeBoundedLong(final long value, final long max)
throws IOException {
final int bits = 0 >= max ? 0 : (int) (Math
.floor(Math.log(max) / Math.log(2)) + 1);
if (0 < bits) {
Bits toWrite = new Bits(value, bits);
this.write(toWrite);
return toWrite;
}
else {
return Bits.NULL;
}
} | [
"public",
"Bits",
"writeBoundedLong",
"(",
"final",
"long",
"value",
",",
"final",
"long",
"max",
")",
"throws",
"IOException",
"{",
"final",
"int",
"bits",
"=",
"0",
">=",
"max",
"?",
"0",
":",
"(",
"int",
")",
"(",
"Math",
".",
"floor",
"(",
"Math"... | Write bounded long bits.
@param value the value
@param max the max
@return the bits
@throws IOException the io exception | [
"Write",
"bounded",
"long",
"bits",
"."
] | train | https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/binary/BitOutputStream.java#L180-L192 |
kiegroup/droolsjbpm-integration | kie-server-parent/kie-server-remote/kie-server-client/src/main/java/org/kie/server/client/KieServicesFactory.java | KieServicesFactory.newRestConfiguration | public static KieServicesConfiguration newRestConfiguration( String serverUrl, String login, String password, long timeout ) {
return new KieServicesConfigurationImpl( serverUrl, login, password, timeout );
} | java | public static KieServicesConfiguration newRestConfiguration( String serverUrl, String login, String password, long timeout ) {
return new KieServicesConfigurationImpl( serverUrl, login, password, timeout );
} | [
"public",
"static",
"KieServicesConfiguration",
"newRestConfiguration",
"(",
"String",
"serverUrl",
",",
"String",
"login",
",",
"String",
"password",
",",
"long",
"timeout",
")",
"{",
"return",
"new",
"KieServicesConfigurationImpl",
"(",
"serverUrl",
",",
"login",
... | Creates a new configuration object for REST based service
@param serverUrl the URL to the server (e.g.: "http://localhost:8080")
@param login user login
@param password user password
@param timeout the maximum timeout in milliseconds
@return configuration instance | [
"Creates",
"a",
"new",
"configuration",
"object",
"for",
"REST",
"based",
"service"
] | train | https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-remote/kie-server-client/src/main/java/org/kie/server/client/KieServicesFactory.java#L47-L49 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.toSorted | public static <K, V> Map<K, V> toSorted(Map<K, V> self, @ClosureParams(value=FromString.class, options={"Map.Entry<K,V>","Map.Entry<K,V>,Map.Entry<K,V>"}) Closure condition) {
Comparator<Map.Entry<K,V>> comparator = (condition.getMaximumNumberOfParameters() == 1) ? new OrderBy<Map.Entry<K,V>>(condition) : new ClosureComparator<Map.Entry<K,V>>(condition);
return toSorted(self, comparator);
} | java | public static <K, V> Map<K, V> toSorted(Map<K, V> self, @ClosureParams(value=FromString.class, options={"Map.Entry<K,V>","Map.Entry<K,V>,Map.Entry<K,V>"}) Closure condition) {
Comparator<Map.Entry<K,V>> comparator = (condition.getMaximumNumberOfParameters() == 1) ? new OrderBy<Map.Entry<K,V>>(condition) : new ClosureComparator<Map.Entry<K,V>>(condition);
return toSorted(self, comparator);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"toSorted",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"self",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"{",
"\"Map.Entry... | Sorts the elements from the given map into a new ordered map using
the supplied Closure condition as a comparator to determine the ordering. The original map is unchanged.
<p>
If the closure has two parameters it is used like a traditional Comparator. I.e. it should compare
its two entry parameters for order, returning a negative integer, zero, or a positive integer when the
first parameter is less than, equal to, or greater than the second respectively. Otherwise,
the Closure is assumed to take a single entry parameter and return a Comparable (typically an Integer)
which is then used for further comparison.
<pre class="groovyTestCase">
def map = [a:5, b:3, c:6, d:4].toSorted { a, b {@code ->} a.value {@code <=>} b.value }
assert map.toString() == '[b:3, d:4, a:5, c:6]'
</pre>
@param self the original unsorted map
@param condition a Closure used as a comparator
@return the sorted map
@since 2.4.0 | [
"Sorts",
"the",
"elements",
"from",
"the",
"given",
"map",
"into",
"a",
"new",
"ordered",
"map",
"using",
"the",
"supplied",
"Closure",
"condition",
"as",
"a",
"comparator",
"to",
"determine",
"the",
"ordering",
".",
"The",
"original",
"map",
"is",
"unchange... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L9621-L9624 |
milaboratory/milib | src/main/java/com/milaboratory/core/sequence/SequenceQuality.java | SequenceQuality.encodeTo | public void encodeTo(QualityFormat format, byte[] buffer, int offset) {
byte vo = format.getOffset();
for (int i = 0; i < data.length; ++i)
buffer[offset++] = (byte) (data[i] + vo);
}
/**
* Encodes current quality line with given offset. Common values for offset are 33 and 64.
*
* @param offset offset
* @return bytes encoded quality values
*/
public byte[] encode(int offset) {
if (offset < 0 || offset > 70)
throw new IllegalArgumentException();
byte[] copy = new byte[data.length];
for (int i = copy.length - 1; i >= 0; --i)
copy[i] += data[i] + offset;
return copy;
} | java | public void encodeTo(QualityFormat format, byte[] buffer, int offset) {
byte vo = format.getOffset();
for (int i = 0; i < data.length; ++i)
buffer[offset++] = (byte) (data[i] + vo);
}
/**
* Encodes current quality line with given offset. Common values for offset are 33 and 64.
*
* @param offset offset
* @return bytes encoded quality values
*/
public byte[] encode(int offset) {
if (offset < 0 || offset > 70)
throw new IllegalArgumentException();
byte[] copy = new byte[data.length];
for (int i = copy.length - 1; i >= 0; --i)
copy[i] += data[i] + offset;
return copy;
} | [
"public",
"void",
"encodeTo",
"(",
"QualityFormat",
"format",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
")",
"{",
"byte",
"vo",
"=",
"format",
".",
"getOffset",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"data",
... | Encodes current quality line with given offset. Common values for offset are 33 and 64.
@param offset offset
@return bytes encoded quality values | [
"Encodes",
"current",
"quality",
"line",
"with",
"given",
"offset",
".",
"Common",
"values",
"for",
"offset",
"are",
"33",
"and",
"64",
"."
] | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/sequence/SequenceQuality.java#L246-L266 |
google/closure-templates | java/src/com/google/template/soy/sharedpasses/render/EvalVisitor.java | EvalVisitor.maybeMarkBadProtoAccess | private static void maybeMarkBadProtoAccess(ExprNode expr, SoyValue value) {
if (value instanceof SoyProtoValue) {
((SoyProtoValue) value).setAccessLocationKey(expr.getSourceLocation());
}
} | java | private static void maybeMarkBadProtoAccess(ExprNode expr, SoyValue value) {
if (value instanceof SoyProtoValue) {
((SoyProtoValue) value).setAccessLocationKey(expr.getSourceLocation());
}
} | [
"private",
"static",
"void",
"maybeMarkBadProtoAccess",
"(",
"ExprNode",
"expr",
",",
"SoyValue",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"SoyProtoValue",
")",
"{",
"(",
"(",
"SoyProtoValue",
")",
"value",
")",
".",
"setAccessLocationKey",
"(",
"e... | If the value is a proto, then set the current access location since we are about to access it
incorrectly. | [
"If",
"the",
"value",
"is",
"a",
"proto",
"then",
"set",
"the",
"current",
"access",
"location",
"since",
"we",
"are",
"about",
"to",
"access",
"it",
"incorrectly",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/sharedpasses/render/EvalVisitor.java#L481-L485 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/table/GenericTableModel.java | GenericTableModel.insertRow | public void insertRow(int index, Object element)
{
elements.add(index, element);
fireTableRowsInserted(index, index);
} | java | public void insertRow(int index, Object element)
{
elements.add(index, element);
fireTableRowsInserted(index, index);
} | [
"public",
"void",
"insertRow",
"(",
"int",
"index",
",",
"Object",
"element",
")",
"{",
"elements",
".",
"add",
"(",
"index",
",",
"element",
")",
";",
"fireTableRowsInserted",
"(",
"index",
",",
"index",
")",
";",
"}"
] | Add the given element as one row of the table
@param index The row index
@param element The element | [
"Add",
"the",
"given",
"element",
"as",
"one",
"row",
"of",
"the",
"table"
] | train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/table/GenericTableModel.java#L203-L207 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenuItem.java | WMenuItem.handleRequest | @Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
if (isMenuPresent(request)) {
String requestValue = request.getParameter(getId());
if (requestValue != null) {
// Only process on a POST
if (!"POST".equals(request.getMethod())) {
LOG.warn("Menu item on a request that is not a POST. Will be ignored.");
return;
}
// Execute associated action, if set
final Action action = getAction();
if (action != null) {
final ActionEvent event = new ActionEvent(this, this.getActionCommand(), this.
getActionObject());
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
}
}
}
} | java | @Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
if (isMenuPresent(request)) {
String requestValue = request.getParameter(getId());
if (requestValue != null) {
// Only process on a POST
if (!"POST".equals(request.getMethod())) {
LOG.warn("Menu item on a request that is not a POST. Will be ignored.");
return;
}
// Execute associated action, if set
final Action action = getAction();
if (action != null) {
final ActionEvent event = new ActionEvent(this, this.getActionCommand(), this.
getActionObject());
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"handleRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"if",
"(",
"isDisabled",
"(",
")",
")",
"{",
"// Protect against client-side tampering of disabled/read-only fields.",
"return",
";",
"}",
"if",
"(",
"isMenuPresent",
"... | Override handleRequest in order to perform processing for this component. This implementation checks for
selection of the menu item, and executes the associated action if it has been set.
@param request the request being responded to. | [
"Override",
"handleRequest",
"in",
"order",
"to",
"perform",
"processing",
"for",
"this",
"component",
".",
"This",
"implementation",
"checks",
"for",
"selection",
"of",
"the",
"menu",
"item",
"and",
"executes",
"the",
"associated",
"action",
"if",
"it",
"has",
... | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenuItem.java#L428-L463 |
google/closure-compiler | src/com/google/javascript/jscomp/parsing/parser/FeatureSet.java | FeatureSet.with | public FeatureSet with(Feature feature) {
if (features.contains(feature)) {
return this;
}
return new FeatureSet(add(features, feature));
} | java | public FeatureSet with(Feature feature) {
if (features.contains(feature)) {
return this;
}
return new FeatureSet(add(features, feature));
} | [
"public",
"FeatureSet",
"with",
"(",
"Feature",
"feature",
")",
"{",
"if",
"(",
"features",
".",
"contains",
"(",
"feature",
")",
")",
"{",
"return",
"this",
";",
"}",
"return",
"new",
"FeatureSet",
"(",
"add",
"(",
"features",
",",
"feature",
")",
")"... | Returns a feature set combining all the features from {@code this} and {@code feature}. | [
"Returns",
"a",
"feature",
"set",
"combining",
"all",
"the",
"features",
"from",
"{"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/parser/FeatureSet.java#L359-L364 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newRuleException | public static RuleException newRuleException(Throwable cause, String message, Object... args) {
return new RuleException(format(message, args), cause);
} | java | public static RuleException newRuleException(Throwable cause, String message, Object... args) {
return new RuleException(format(message, args), cause);
} | [
"public",
"static",
"RuleException",
"newRuleException",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"RuleException",
"(",
"format",
"(",
"message",
",",
"args",
")",
",",
"cause",
")",
";",
... | Constructs and initializes a new {@link RuleException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link RuleException} was thrown.
@param message {@link String} describing the {@link RuleException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link RuleException} with the given {@link Throwable cause} and {@link String message}.
@see org.cp.elements.biz.rules.RuleException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"RuleException",
"}",
"with",
"the",
"given",
"{",
"@link",
"Throwable",
"cause",
"}",
"and",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",
... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L107-L109 |
mikepenz/FastAdapter | app/src/main/java/com/mikepenz/fastadapter/app/items/ImageItem.java | ImageItem.bindView | @Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
//get the context
Context ctx = viewHolder.itemView.getContext();
//define our data for the view
viewHolder.imageName.setText(mName);
viewHolder.imageDescription.setText(mDescription);
viewHolder.imageView.setImageBitmap(null);
//we pre-style our heart :D
style(viewHolder.imageLovedOn, mStarred ? 1 : 0);
style(viewHolder.imageLovedOff, mStarred ? 0 : 1);
//load glide
Glide.with(ctx).load(mImageUrl).animate(R.anim.alpha_on).into(viewHolder.imageView);
} | java | @Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
//get the context
Context ctx = viewHolder.itemView.getContext();
//define our data for the view
viewHolder.imageName.setText(mName);
viewHolder.imageDescription.setText(mDescription);
viewHolder.imageView.setImageBitmap(null);
//we pre-style our heart :D
style(viewHolder.imageLovedOn, mStarred ? 1 : 0);
style(viewHolder.imageLovedOff, mStarred ? 0 : 1);
//load glide
Glide.with(ctx).load(mImageUrl).animate(R.anim.alpha_on).into(viewHolder.imageView);
} | [
"@",
"Override",
"public",
"void",
"bindView",
"(",
"ViewHolder",
"viewHolder",
",",
"List",
"<",
"Object",
">",
"payloads",
")",
"{",
"super",
".",
"bindView",
"(",
"viewHolder",
",",
"payloads",
")",
";",
"//get the context",
"Context",
"ctx",
"=",
"viewHo... | binds the data of this item onto the viewHolder
@param viewHolder the viewHolder of this item | [
"binds",
"the",
"data",
"of",
"this",
"item",
"onto",
"the",
"viewHolder"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/items/ImageItem.java#L85-L103 |
rythmengine/rythmengine | src/main/java/org/rythmengine/toString/ToStringOption.java | ToStringOption.setUpToClass | public ToStringOption setUpToClass(Class<?> c) {
ToStringOption op = this;
if (this == DEFAULT_OPTION) {
op = new ToStringOption(this.appendStatic, this.appendTransient);
}
op.upToClass = c;
return op;
} | java | public ToStringOption setUpToClass(Class<?> c) {
ToStringOption op = this;
if (this == DEFAULT_OPTION) {
op = new ToStringOption(this.appendStatic, this.appendTransient);
}
op.upToClass = c;
return op;
} | [
"public",
"ToStringOption",
"setUpToClass",
"(",
"Class",
"<",
"?",
">",
"c",
")",
"{",
"ToStringOption",
"op",
"=",
"this",
";",
"if",
"(",
"this",
"==",
"DEFAULT_OPTION",
")",
"{",
"op",
"=",
"new",
"ToStringOption",
"(",
"this",
".",
"appendStatic",
"... | Return a <code>ToStringOption</code> instance with {@link #upToClass} option set.
if the current instance is not {@link #DEFAULT_OPTION default instance} then set
on the current instance and return the current instance. Otherwise, clone the default
instance and set on the clone and return the clone
@param c
@return this option instance or clone if this is the {@link #DEFAULT_OPTION} | [
"Return",
"a",
"<code",
">",
"ToStringOption<",
"/",
"code",
">",
"instance",
"with",
"{",
"@link",
"#upToClass",
"}",
"option",
"set",
".",
"if",
"the",
"current",
"instance",
"is",
"not",
"{",
"@link",
"#DEFAULT_OPTION",
"default",
"instance",
"}",
"then",... | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/toString/ToStringOption.java#L125-L132 |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/util/BooleanTerm.java | BooleanTerm.resolveWith | public BooleanTerm resolveWith(Features features, boolean coerceUndefinedToFalse) {
if (isEmpty()) {
return this;
}
Set<BooleanVar> term = new HashSet<BooleanVar>();
for (BooleanVar var : this) {
if (features.contains(var.name) || coerceUndefinedToFalse) {
boolean featureState = features.isFeature(var.name);
if (featureState && var.state || !featureState && !var.state) {
// The var is true. Don't add to term
} else {
return BooleanTerm.FALSE;
}
} else {
term.add(var);
}
}
return term.isEmpty() ? BooleanTerm.TRUE : new BooleanTerm(term);
} | java | public BooleanTerm resolveWith(Features features, boolean coerceUndefinedToFalse) {
if (isEmpty()) {
return this;
}
Set<BooleanVar> term = new HashSet<BooleanVar>();
for (BooleanVar var : this) {
if (features.contains(var.name) || coerceUndefinedToFalse) {
boolean featureState = features.isFeature(var.name);
if (featureState && var.state || !featureState && !var.state) {
// The var is true. Don't add to term
} else {
return BooleanTerm.FALSE;
}
} else {
term.add(var);
}
}
return term.isEmpty() ? BooleanTerm.TRUE : new BooleanTerm(term);
} | [
"public",
"BooleanTerm",
"resolveWith",
"(",
"Features",
"features",
",",
"boolean",
"coerceUndefinedToFalse",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"Set",
"<",
"BooleanVar",
">",
"term",
"=",
"new",
"HashSet",
"<"... | Applies the feature values specified in <code>features</code> to the term
and returns a new term with the resolved result. A result of null
indicates the term is false. An empty term indicates the the term is true
@param features
the varialbe names and values to resolve with
@param coerceUndefinedToFalse
if true, undefined features will be treated as false
@return the result | [
"Applies",
"the",
"feature",
"values",
"specified",
"in",
"<code",
">",
"features<",
"/",
"code",
">",
"to",
"the",
"term",
"and",
"returns",
"a",
"new",
"term",
"with",
"the",
"resolved",
"result",
".",
"A",
"result",
"of",
"null",
"indicates",
"the",
"... | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/BooleanTerm.java#L127-L145 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java | DPathUtils.getValue | public static JsonNode getValue(JsonNode node, String dPath) {
String[] paths = splitDpath(dPath);
Object result = node;
for (String path : paths) {
result = extractValue(result, path);
}
if (result instanceof POJONode) {
result = extractValue((POJONode) result);
}
return result != null
? result instanceof JsonNode ? ((JsonNode) result) : JacksonUtils.toJson(result)
: null;
} | java | public static JsonNode getValue(JsonNode node, String dPath) {
String[] paths = splitDpath(dPath);
Object result = node;
for (String path : paths) {
result = extractValue(result, path);
}
if (result instanceof POJONode) {
result = extractValue((POJONode) result);
}
return result != null
? result instanceof JsonNode ? ((JsonNode) result) : JacksonUtils.toJson(result)
: null;
} | [
"public",
"static",
"JsonNode",
"getValue",
"(",
"JsonNode",
"node",
",",
"String",
"dPath",
")",
"{",
"String",
"[",
"]",
"paths",
"=",
"splitDpath",
"(",
"dPath",
")",
";",
"Object",
"result",
"=",
"node",
";",
"for",
"(",
"String",
"path",
":",
"pat... | Extract a value from the target {@link JsonNode} using DPath expression.
@param node
@param dPath
@since 0.6.2 | [
"Extract",
"a",
"value",
"from",
"the",
"target",
"{",
"@link",
"JsonNode",
"}",
"using",
"DPath",
"expression",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java#L491-L503 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java | ByteBuffer.checkOffsetLength | static protected void checkOffsetLength(int bytesLength, int offset, int length)
throws IllegalArgumentException {
// offset cannot be negative
if (offset < 0) {
throw new IllegalArgumentException("The byte[] offset parameter cannot be negative");
}
// length cannot be negative either
if (length < 0) {
throw new IllegalArgumentException("The byte[] length parameter cannot be negative");
}
// is it a valid offset? Must be < bytes.length if non-zero
// if its zero, then the check below will validate if it would cause
// a read past the length of the byte array
if (offset != 0 && offset >= bytesLength) {
throw new IllegalArgumentException("The byte[] offset (" + offset + ") must be < the length of the byte[] length (" + bytesLength + ")");
}
if (offset+length > bytesLength) {
throw new IllegalArgumentException("The offset+length (" + (offset+length) + ") would read past the end of the byte[] (length=" + bytesLength + ")");
}
} | java | static protected void checkOffsetLength(int bytesLength, int offset, int length)
throws IllegalArgumentException {
// offset cannot be negative
if (offset < 0) {
throw new IllegalArgumentException("The byte[] offset parameter cannot be negative");
}
// length cannot be negative either
if (length < 0) {
throw new IllegalArgumentException("The byte[] length parameter cannot be negative");
}
// is it a valid offset? Must be < bytes.length if non-zero
// if its zero, then the check below will validate if it would cause
// a read past the length of the byte array
if (offset != 0 && offset >= bytesLength) {
throw new IllegalArgumentException("The byte[] offset (" + offset + ") must be < the length of the byte[] length (" + bytesLength + ")");
}
if (offset+length > bytesLength) {
throw new IllegalArgumentException("The offset+length (" + (offset+length) + ") would read past the end of the byte[] (length=" + bytesLength + ")");
}
} | [
"static",
"protected",
"void",
"checkOffsetLength",
"(",
"int",
"bytesLength",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IllegalArgumentException",
"{",
"// offset cannot be negative",
"if",
"(",
"offset",
"<",
"0",
")",
"{",
"throw",
"new",
"I... | Helper method for validating if an offset and length are valid for a given
byte array. Checks if the offset or length is negative or if the offset+length
would cause a read past the end of the byte array.
@param bytesLength The length of the byte array to validate against
@param offset The offset within the byte array
@param length The length to read starting from the offset
@throws java.lang.IllegalArgumentException If any of the above conditions
are violated. | [
"Helper",
"method",
"for",
"validating",
"if",
"an",
"offset",
"and",
"length",
"are",
"valid",
"for",
"a",
"given",
"byte",
"array",
".",
"Checks",
"if",
"the",
"offset",
"or",
"length",
"is",
"negative",
"or",
"if",
"the",
"offset",
"+",
"length",
"wou... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java#L400-L419 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.getParent | public static String getParent(String filePath, int level) {
final File parent = getParent(file(filePath), level);
try {
return null == parent ? null : parent.getCanonicalPath();
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | public static String getParent(String filePath, int level) {
final File parent = getParent(file(filePath), level);
try {
return null == parent ? null : parent.getCanonicalPath();
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"String",
"getParent",
"(",
"String",
"filePath",
",",
"int",
"level",
")",
"{",
"final",
"File",
"parent",
"=",
"getParent",
"(",
"file",
"(",
"filePath",
")",
",",
"level",
")",
";",
"try",
"{",
"return",
"null",
"==",
"parent",
"... | 获取指定层级的父路径
<pre>
getParent("d:/aaa/bbb/cc/ddd", 0) -> "d:/aaa/bbb/cc/ddd"
getParent("d:/aaa/bbb/cc/ddd", 2) -> "d:/aaa/bbb"
getParent("d:/aaa/bbb/cc/ddd", 4) -> "d:/"
getParent("d:/aaa/bbb/cc/ddd", 5) -> null
</pre>
@param filePath 目录或文件路径
@param level 层级
@return 路径File,如果不存在返回null
@since 4.1.2 | [
"获取指定层级的父路径"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3333-L3340 |
jbundle/jbundle | main/db/src/main/java/org/jbundle/main/db/Company.java | Company.addListeners | public void addListeners()
{
super.addListeners();
this.getField(Person.NAME).removeListener(this.getField(Person.NAME).getListener(CopyLastHandler.class), true); // Only if dest is null (ie., company name is null)
this.getField(Person.NAME).addListener(new CopyFieldHandler(this.getField(Person.NAME_SORT)));
this.getField(Company.NAME_SORT).addListener(new CheckForTheHandler(null));
CopyLastHandler listener = new CopyLastHandler(this.getField(Company.NAME_SORT));
this.getField(Company.CONTACT).addListener(listener); // Only if dest is null (ie., company name is null)
listener.setOnlyIfDestNull(true);
} | java | public void addListeners()
{
super.addListeners();
this.getField(Person.NAME).removeListener(this.getField(Person.NAME).getListener(CopyLastHandler.class), true); // Only if dest is null (ie., company name is null)
this.getField(Person.NAME).addListener(new CopyFieldHandler(this.getField(Person.NAME_SORT)));
this.getField(Company.NAME_SORT).addListener(new CheckForTheHandler(null));
CopyLastHandler listener = new CopyLastHandler(this.getField(Company.NAME_SORT));
this.getField(Company.CONTACT).addListener(listener); // Only if dest is null (ie., company name is null)
listener.setOnlyIfDestNull(true);
} | [
"public",
"void",
"addListeners",
"(",
")",
"{",
"super",
".",
"addListeners",
"(",
")",
";",
"this",
".",
"getField",
"(",
"Person",
".",
"NAME",
")",
".",
"removeListener",
"(",
"this",
".",
"getField",
"(",
"Person",
".",
"NAME",
")",
".",
"getListe... | Add all standard file & field behaviors.
Override this to add record listeners and filters. | [
"Add",
"all",
"standard",
"file",
"&",
"field",
"behaviors",
".",
"Override",
"this",
"to",
"add",
"record",
"listeners",
"and",
"filters",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/db/Company.java#L130-L141 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java | ElasticPoolsInner.beginCreateOrUpdate | public ElasticPoolInner beginCreateOrUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body();
} | java | public ElasticPoolInner beginCreateOrUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body();
} | [
"public",
"ElasticPoolInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"elasticPoolName",
",",
"ElasticPoolInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGrou... | Creates a new elastic pool or updates an existing elastic pool.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param elasticPoolName The name of the elastic pool to be operated on (updated or created).
@param parameters The required parameters for creating or updating an elastic pool.
@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 ElasticPoolInner object if successful. | [
"Creates",
"a",
"new",
"elastic",
"pool",
"or",
"updates",
"an",
"existing",
"elastic",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java#L195-L197 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/SortOrderHandler.java | SortOrderHandler.fieldChanged | public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
int iErrorCode = this.setupGridOrder();
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode;
return super.fieldChanged(bDisplayOption, iMoveMode);
} | java | public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
int iErrorCode = this.setupGridOrder();
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode;
return super.fieldChanged(bDisplayOption, iMoveMode);
} | [
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"int",
"iErrorCode",
"=",
"this",
".",
"setupGridOrder",
"(",
")",
";",
"if",
"(",
"iErrorCode",
"!=",
"DBConstants",
".",
"NORMAL_RETURN",
")",
"return",
"... | The Field has Changed.
Change the key order to match this field's value.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay). | [
"The",
"Field",
"has",
"Changed",
".",
"Change",
"the",
"key",
"order",
"to",
"match",
"this",
"field",
"s",
"value",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/SortOrderHandler.java#L272-L278 |
NessComputing/components-ness-core | src/main/java/com/nesscomputing/util/Sizes.java | Sizes.formatRate | public static String formatRate(long count, long time, TimeUnit units)
{
double rate = count * 1000.0;
rate /= TimeUnit.MILLISECONDS.convert(time, units);
return formatSize((long) rate) + "/s";
} | java | public static String formatRate(long count, long time, TimeUnit units)
{
double rate = count * 1000.0;
rate /= TimeUnit.MILLISECONDS.convert(time, units);
return formatSize((long) rate) + "/s";
} | [
"public",
"static",
"String",
"formatRate",
"(",
"long",
"count",
",",
"long",
"time",
",",
"TimeUnit",
"units",
")",
"{",
"double",
"rate",
"=",
"count",
"*",
"1000.0",
";",
"rate",
"/=",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"time",
","... | Given a size in bytes and a duration, format as a pretty
throughput string. The output will look like "15.4 MB/s". | [
"Given",
"a",
"size",
"in",
"bytes",
"and",
"a",
"duration",
"format",
"as",
"a",
"pretty",
"throughput",
"string",
".",
"The",
"output",
"will",
"look",
"like",
"15",
".",
"4",
"MB",
"/",
"s",
"."
] | train | https://github.com/NessComputing/components-ness-core/blob/980db2925e5f9085c75ad3682d5314a973209297/src/main/java/com/nesscomputing/util/Sizes.java#L40-L45 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.zone_zoneName_dynHost_login_GET | public ArrayList<String> zone_zoneName_dynHost_login_GET(String zoneName, String login, String subDomain) throws IOException {
String qPath = "/domain/zone/{zoneName}/dynHost/login";
StringBuilder sb = path(qPath, zoneName);
query(sb, "login", login);
query(sb, "subDomain", subDomain);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<String> zone_zoneName_dynHost_login_GET(String zoneName, String login, String subDomain) throws IOException {
String qPath = "/domain/zone/{zoneName}/dynHost/login";
StringBuilder sb = path(qPath, zoneName);
query(sb, "login", login);
query(sb, "subDomain", subDomain);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"zone_zoneName_dynHost_login_GET",
"(",
"String",
"zoneName",
",",
"String",
"login",
",",
"String",
"subDomain",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/zone/{zoneName}/dynHost/login\"",
";",
"S... | DynHost' logins
REST: GET /domain/zone/{zoneName}/dynHost/login
@param login [required] Filter the value of login property (like)
@param subDomain [required] Filter the value of subDomain property (like)
@param zoneName [required] The internal name of your zone | [
"DynHost",
"logins"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L496-L503 |
michaelquigley/zabbixj | zabbixj-core/src/main/java/com/quigley/zabbixj/metrics/MetricsContainer.java | MetricsContainer.addProvider | public void addProvider(String name, MetricsProvider provider) {
if(log.isInfoEnabled()) {
log.info("Adding Provider: " + provider.getClass().getName() + "=" + name);
}
container.put(name, provider);
} | java | public void addProvider(String name, MetricsProvider provider) {
if(log.isInfoEnabled()) {
log.info("Adding Provider: " + provider.getClass().getName() + "=" + name);
}
container.put(name, provider);
} | [
"public",
"void",
"addProvider",
"(",
"String",
"name",
",",
"MetricsProvider",
"provider",
")",
"{",
"if",
"(",
"log",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"Adding Provider: \"",
"+",
"provider",
".",
"getClass",
"(",
")",
... | Add a MetricsProvider to this container.
@param name the name of the MetricsProvider.
@param provider the MetricsProvider instance. | [
"Add",
"a",
"MetricsProvider",
"to",
"this",
"container",
"."
] | train | https://github.com/michaelquigley/zabbixj/blob/15cfe46e45750b3857bec7eecc75ff5e5a3d774d/zabbixj-core/src/main/java/com/quigley/zabbixj/metrics/MetricsContainer.java#L52-L58 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/formula/MassToFormulaTool.java | MassToFormulaTool.getMaxOccurence | private int getMaxOccurence(double massTo, int element_pos, int[] matrix, List<IIsotope> isoToCond_new) {
double massIn = isoToCond_new.get(element_pos).getExactMass();
double massToM = massTo;
for (int i = 0; i < matrix.length; i++)
if (i != element_pos) if (matrix[i] != 0) massToM -= isoToCond_new.get(i).getExactMass() * matrix[i];
int value = (int) ((massToM + 1) / massIn);
return value;
} | java | private int getMaxOccurence(double massTo, int element_pos, int[] matrix, List<IIsotope> isoToCond_new) {
double massIn = isoToCond_new.get(element_pos).getExactMass();
double massToM = massTo;
for (int i = 0; i < matrix.length; i++)
if (i != element_pos) if (matrix[i] != 0) massToM -= isoToCond_new.get(i).getExactMass() * matrix[i];
int value = (int) ((massToM + 1) / massIn);
return value;
} | [
"private",
"int",
"getMaxOccurence",
"(",
"double",
"massTo",
",",
"int",
"element_pos",
",",
"int",
"[",
"]",
"matrix",
",",
"List",
"<",
"IIsotope",
">",
"isoToCond_new",
")",
"{",
"double",
"massIn",
"=",
"isoToCond_new",
".",
"get",
"(",
"element_pos",
... | Get the maximal occurrence of this List.
@param massTo
@param element_pos
@param matrix
@param elemToCond_new
@return The occurrence value | [
"Get",
"the",
"maximal",
"occurrence",
"of",
"this",
"List",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/formula/MassToFormulaTool.java#L469-L477 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.getEmbeddedIPv4AddressSection | public IPv4AddressSection getEmbeddedIPv4AddressSection(int startIndex, int endIndex) {
if(startIndex == ((IPv6Address.MIXED_ORIGINAL_SEGMENT_COUNT - this.addressSegmentIndex) << 1) && endIndex == (getSegmentCount() << 1)) {
return getEmbeddedIPv4AddressSection();
}
IPv4AddressCreator creator = getIPv4Network().getAddressCreator();
IPv4AddressSegment[] segments = creator.createSegmentArray((endIndex - startIndex) >> 1);
int i = startIndex, j = 0;
if(i % IPv6Address.BYTES_PER_SEGMENT == 1) {
IPv6AddressSegment ipv6Segment = getSegment(i >> 1);
i++;
ipv6Segment.getSplitSegments(segments, j - 1, creator);
j++;
}
for(; i < endIndex; i <<= 1, j <<= 1) {
IPv6AddressSegment ipv6Segment = getSegment(i >> 1);
ipv6Segment.getSplitSegments(segments, j, creator);
}
return createEmbeddedSection(creator, segments, this);
} | java | public IPv4AddressSection getEmbeddedIPv4AddressSection(int startIndex, int endIndex) {
if(startIndex == ((IPv6Address.MIXED_ORIGINAL_SEGMENT_COUNT - this.addressSegmentIndex) << 1) && endIndex == (getSegmentCount() << 1)) {
return getEmbeddedIPv4AddressSection();
}
IPv4AddressCreator creator = getIPv4Network().getAddressCreator();
IPv4AddressSegment[] segments = creator.createSegmentArray((endIndex - startIndex) >> 1);
int i = startIndex, j = 0;
if(i % IPv6Address.BYTES_PER_SEGMENT == 1) {
IPv6AddressSegment ipv6Segment = getSegment(i >> 1);
i++;
ipv6Segment.getSplitSegments(segments, j - 1, creator);
j++;
}
for(; i < endIndex; i <<= 1, j <<= 1) {
IPv6AddressSegment ipv6Segment = getSegment(i >> 1);
ipv6Segment.getSplitSegments(segments, j, creator);
}
return createEmbeddedSection(creator, segments, this);
} | [
"public",
"IPv4AddressSection",
"getEmbeddedIPv4AddressSection",
"(",
"int",
"startIndex",
",",
"int",
"endIndex",
")",
"{",
"if",
"(",
"startIndex",
"==",
"(",
"(",
"IPv6Address",
".",
"MIXED_ORIGINAL_SEGMENT_COUNT",
"-",
"this",
".",
"addressSegmentIndex",
")",
"<... | Produces an IPv4 address section from any sequence of bytes in this IPv6 address section
@param startIndex the byte index in this section to start from
@param endIndex the byte index in this section to end at
@throws IndexOutOfBoundsException
@return
@see #getEmbeddedIPv4AddressSection()
@see #getMixedAddressSection() | [
"Produces",
"an",
"IPv4",
"address",
"section",
"from",
"any",
"sequence",
"of",
"bytes",
"in",
"this",
"IPv6",
"address",
"section"
] | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L1258-L1276 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.