repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.escapeUriPathSegment
public static void escapeUriPathSegment(final Reader reader, final Writer writer) throws IOException { escapeUriPathSegment(reader, writer, DEFAULT_ENCODING); }
java
public static void escapeUriPathSegment(final Reader reader, final Writer writer) throws IOException { escapeUriPathSegment(reader, writer, DEFAULT_ENCODING); }
[ "public", "static", "void", "escapeUriPathSegment", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeUriPathSegment", "(", "reader", ",", "writer", ",", "DEFAULT_ENCODING", ")", ";", "}" ]
<p> Perform am URI path segment <strong>escape</strong> operation on a <tt>Reader</tt> input using <tt>UTF-8</tt> as encoding, writing results to a <tt>Writer</tt>. </p> <p> The following are the only allowed chars in an URI path segment (will not be escaped): </p> <ul> <li><tt>A-Z a-z 0-9</tt></li> <li><tt>- . _ ~</tt></li> <li><tt>! $ &amp; ' ( ) * + , ; =</tt></li> <li><tt>: @</tt></li> </ul> <p> All other chars will be escaped by converting them to the sequence of bytes that represents them in the <tt>UTF-8</tt> and then representing each byte in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "am", "URI", "path", "segment", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "using", "<tt", ">", "UTF", "-", "8<", "/", "tt", ">", "as", "encoding", "w...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L883-L886
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/fs/watcher/DirectoryWatcher.java
DirectoryWatcher.stopWatching
public void stopWatching() { try { _watchService.close(); _watchService = null; _watchedDirectories = null; } catch (IOException e) { throw new RuntimeException("Could not stop watching directories!", e); } }
java
public void stopWatching() { try { _watchService.close(); _watchService = null; _watchedDirectories = null; } catch (IOException e) { throw new RuntimeException("Could not stop watching directories!", e); } }
[ "public", "void", "stopWatching", "(", ")", "{", "try", "{", "_watchService", ".", "close", "(", ")", ";", "_watchService", "=", "null", ";", "_watchedDirectories", "=", "null", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "Runti...
Close the watch service. Releases resources. After calling, this instance becomes invalid and can't be used any more.
[ "Close", "the", "watch", "service", ".", "Releases", "resources", ".", "After", "calling", "this", "instance", "becomes", "invalid", "and", "can", "t", "be", "used", "any", "more", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/fs/watcher/DirectoryWatcher.java#L45-L53
Wikidata/Wikidata-Toolkit
wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/Datamodel.java
Datamodel.makeLexemeIdValue
public static LexemeIdValue makeLexemeIdValue(String id, String siteIri) { return factory.getLexemeIdValue(id, siteIri); }
java
public static LexemeIdValue makeLexemeIdValue(String id, String siteIri) { return factory.getLexemeIdValue(id, siteIri); }
[ "public", "static", "LexemeIdValue", "makeLexemeIdValue", "(", "String", "id", ",", "String", "siteIri", ")", "{", "return", "factory", ".", "getLexemeIdValue", "(", "id", ",", "siteIri", ")", ";", "}" ]
Creates an {@link LexemeIdValue}. @param id a string of the form Ln... where n... is the string representation of a positive integer number @param siteIri IRI to identify the site, usually the first part of the entity IRI of the site this belongs to, e.g., "http://www.wikidata.org/entity/" @return an {@link LexemeIdValue} corresponding to the input
[ "Creates", "an", "{", "@link", "LexemeIdValue", "}", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/Datamodel.java#L114-L116
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.beginCreateOrUpdate
public VirtualNetworkGatewayInner beginCreateOrUpdate(String resourceGroupName, String virtualNetworkGatewayName, VirtualNetworkGatewayInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, parameters).toBlocking().single().body(); }
java
public VirtualNetworkGatewayInner beginCreateOrUpdate(String resourceGroupName, String virtualNetworkGatewayName, VirtualNetworkGatewayInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, parameters).toBlocking().single().body(); }
[ "public", "VirtualNetworkGatewayInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ",", "VirtualNetworkGatewayInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName...
Creates or updates a virtual network gateway in the specified resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @param parameters Parameters supplied to create or update virtual network gateway operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualNetworkGatewayInner object if successful.
[ "Creates", "or", "updates", "a", "virtual", "network", "gateway", "in", "the", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L284-L286
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java
IntegrationAccountsInner.createOrUpdateAsync
public Observable<IntegrationAccountInner> createOrUpdateAsync(String resourceGroupName, String integrationAccountName, IntegrationAccountInner integrationAccount) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, integrationAccount).map(new Func1<ServiceResponse<IntegrationAccountInner>, IntegrationAccountInner>() { @Override public IntegrationAccountInner call(ServiceResponse<IntegrationAccountInner> response) { return response.body(); } }); }
java
public Observable<IntegrationAccountInner> createOrUpdateAsync(String resourceGroupName, String integrationAccountName, IntegrationAccountInner integrationAccount) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, integrationAccount).map(new Func1<ServiceResponse<IntegrationAccountInner>, IntegrationAccountInner>() { @Override public IntegrationAccountInner call(ServiceResponse<IntegrationAccountInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "IntegrationAccountInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "IntegrationAccountInner", "integrationAccount", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "...
Creates or updates an integration account. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param integrationAccount The integration account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IntegrationAccountInner object
[ "Creates", "or", "updates", "an", "integration", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java#L690-L697
casbin/jcasbin
src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java
ManagementEnforcer.getFilteredGroupingPolicy
public List<List<String>> getFilteredGroupingPolicy(int fieldIndex, String... fieldValues) { return getFilteredNamedGroupingPolicy("g", fieldIndex, fieldValues); }
java
public List<List<String>> getFilteredGroupingPolicy(int fieldIndex, String... fieldValues) { return getFilteredNamedGroupingPolicy("g", fieldIndex, fieldValues); }
[ "public", "List", "<", "List", "<", "String", ">", ">", "getFilteredGroupingPolicy", "(", "int", "fieldIndex", ",", "String", "...", "fieldValues", ")", "{", "return", "getFilteredNamedGroupingPolicy", "(", "\"g\"", ",", "fieldIndex", ",", "fieldValues", ")", ";...
getFilteredGroupingPolicy gets all the role inheritance rules in the policy, field filters can be specified. @param fieldIndex the policy rule's start index to be matched. @param fieldValues the field values to be matched, value "" means not to match this field. @return the filtered "g" policy rules.
[ "getFilteredGroupingPolicy", "gets", "all", "the", "role", "inheritance", "rules", "in", "the", "policy", "field", "filters", "can", "be", "specified", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java#L187-L189
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TraceComponent.java
TraceComponent.setTraceSpec
@Deprecated protected void setTraceSpec(String s) { if (s != null) { TraceSpecification ts = new TraceSpecification(s, null, false); setTraceSpec(ts); } }
java
@Deprecated protected void setTraceSpec(String s) { if (s != null) { TraceSpecification ts = new TraceSpecification(s, null, false); setTraceSpec(ts); } }
[ "@", "Deprecated", "protected", "void", "setTraceSpec", "(", "String", "s", ")", "{", "if", "(", "s", "!=", "null", ")", "{", "TraceSpecification", "ts", "=", "new", "TraceSpecification", "(", "s", ",", "null", ",", "false", ")", ";", "setTraceSpec", "("...
Update the active trace settings for this component based on the provided string. Protected: Not an SPI method. @param ts TraceSpecification
[ "Update", "the", "active", "trace", "settings", "for", "this", "component", "based", "on", "the", "provided", "string", ".", "Protected", ":", "Not", "an", "SPI", "method", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TraceComponent.java#L236-L242
ziccardi/jnrpe
jnrpe-plugins/src/main/java/it/jnrpe/plugin/CCheckOracle.java
CCheckOracle.checkCache
private List<Metric> checkCache(final Connection c, final ICommandLine cl) throws BadThresholdException, SQLException { List<Metric> metricList = new ArrayList<Metric>(); // Metrics cache_buf, cache_lib String sQry1 = "select (1-(pr.value/(dbg.value+cg.value)))*100" + " from v$sysstat pr, v$sysstat dbg, v$sysstat cg" + " where pr.name='physical reads'" + " and dbg.name='db block gets'" + " and cg.name='consistent gets'"; String sQry2 = "select sum(lc.pins)/(sum(lc.pins)" + "+sum(lc.reloads))*100 from v$librarycache lc"; Statement stmt = null; ResultSet rs = null; try { stmt = c.createStatement(); rs = stmt.executeQuery(sQry1); rs.next(); BigDecimal buf_hr = rs.getBigDecimal(1); rs = stmt.executeQuery(sQry2); rs.next(); BigDecimal lib_hr = rs.getBigDecimal(1); String libHitRate = "Cache Hit Rate {1,number,0.#}% Lib"; String buffHitRate = "Cache Hit Rate {1,number,0.#}% Buff"; metricList.add(new Metric("cache_buf", MessageFormat.format(buffHitRate, buf_hr), buf_hr, new BigDecimal(0), new BigDecimal(100))); metricList.add(new Metric("cache_lib", MessageFormat.format(libHitRate, lib_hr), lib_hr, new BigDecimal(0), new BigDecimal(100))); return metricList; } finally { DBUtils.closeQuietly(rs); DBUtils.closeQuietly(stmt); } }
java
private List<Metric> checkCache(final Connection c, final ICommandLine cl) throws BadThresholdException, SQLException { List<Metric> metricList = new ArrayList<Metric>(); // Metrics cache_buf, cache_lib String sQry1 = "select (1-(pr.value/(dbg.value+cg.value)))*100" + " from v$sysstat pr, v$sysstat dbg, v$sysstat cg" + " where pr.name='physical reads'" + " and dbg.name='db block gets'" + " and cg.name='consistent gets'"; String sQry2 = "select sum(lc.pins)/(sum(lc.pins)" + "+sum(lc.reloads))*100 from v$librarycache lc"; Statement stmt = null; ResultSet rs = null; try { stmt = c.createStatement(); rs = stmt.executeQuery(sQry1); rs.next(); BigDecimal buf_hr = rs.getBigDecimal(1); rs = stmt.executeQuery(sQry2); rs.next(); BigDecimal lib_hr = rs.getBigDecimal(1); String libHitRate = "Cache Hit Rate {1,number,0.#}% Lib"; String buffHitRate = "Cache Hit Rate {1,number,0.#}% Buff"; metricList.add(new Metric("cache_buf", MessageFormat.format(buffHitRate, buf_hr), buf_hr, new BigDecimal(0), new BigDecimal(100))); metricList.add(new Metric("cache_lib", MessageFormat.format(libHitRate, lib_hr), lib_hr, new BigDecimal(0), new BigDecimal(100))); return metricList; } finally { DBUtils.closeQuietly(rs); DBUtils.closeQuietly(stmt); } }
[ "private", "List", "<", "Metric", ">", "checkCache", "(", "final", "Connection", "c", ",", "final", "ICommandLine", "cl", ")", "throws", "BadThresholdException", ",", "SQLException", "{", "List", "<", "Metric", ">", "metricList", "=", "new", "ArrayList", "<", ...
Checks cache hit rates. @param c The connection to the database @param cl The command line as received from JNRPE @return The result of the plugin @throws BadThresholdException -
[ "Checks", "cache", "hit", "rates", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-plugins/src/main/java/it/jnrpe/plugin/CCheckOracle.java#L190-L228
mgormley/prim
src/main/java/edu/jhu/prim/arrays/DoubleArrays.java
DoubleArrays.lastIndexOf
public static int lastIndexOf(double[] array, double val) { for (int i=array.length-1; i >= 0; i--) { if (array[i] == val) { return i; } } return -1; }
java
public static int lastIndexOf(double[] array, double val) { for (int i=array.length-1; i >= 0; i--) { if (array[i] == val) { return i; } } return -1; }
[ "public", "static", "int", "lastIndexOf", "(", "double", "[", "]", "array", ",", "double", "val", ")", "{", "for", "(", "int", "i", "=", "array", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "array", "[", ...
Gets the last index of a given value in an array or -1 if not present.
[ "Gets", "the", "last", "index", "of", "a", "given", "value", "in", "an", "array", "or", "-", "1", "if", "not", "present", "." ]
train
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/DoubleArrays.java#L524-L531
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.patchAsync
public <T> CompletableFuture<T> patchAsync(final Class<T> type, final Consumer<HttpConfig> configuration) { return CompletableFuture.supplyAsync(() -> patch(type, configuration), getExecutor()); }
java
public <T> CompletableFuture<T> patchAsync(final Class<T> type, final Consumer<HttpConfig> configuration) { return CompletableFuture.supplyAsync(() -> patch(type, configuration), getExecutor()); }
[ "public", "<", "T", ">", "CompletableFuture", "<", "T", ">", "patchAsync", "(", "final", "Class", "<", "T", ">", "type", ",", "final", "Consumer", "<", "HttpConfig", ">", "configuration", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(...
Executes asynchronous PATCH request on the configured URI (alias for the `patch(Class, Consumer)` method), with additional configuration provided by the configuration function. The result will be cast to the specified `type`. This method is generally meant for use with standard Java. [source,groovy] ---- HttpBuilder http = HttpBuilder.configure(config -> { config.getRequest().setUri("http://localhost:10101"); }); String result = http.patch(String.class, config -> { config.getRequest().getUri().setPath("/foo"); }); ---- @param type the type of the response content @param configuration the additional configuration function (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} for the resulting content cast to the specified type
[ "Executes", "asynchronous", "PATCH", "request", "on", "the", "configured", "URI", "(", "alias", "for", "the", "patch", "(", "Class", "Consumer", ")", "method", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", "function", ".",...
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1740-L1742
auth0/auth0-spring-security-api
lib/src/main/java/com/auth0/spring/security/api/JwtWebSecurityConfigurer.java
JwtWebSecurityConfigurer.forRS256
@SuppressWarnings({"WeakerAccess", "SameParameterValue"}) public static JwtWebSecurityConfigurer forRS256(String audience, String issuer, AuthenticationProvider provider) { return new JwtWebSecurityConfigurer(audience, issuer, provider); }
java
@SuppressWarnings({"WeakerAccess", "SameParameterValue"}) public static JwtWebSecurityConfigurer forRS256(String audience, String issuer, AuthenticationProvider provider) { return new JwtWebSecurityConfigurer(audience, issuer, provider); }
[ "@", "SuppressWarnings", "(", "{", "\"WeakerAccess\"", ",", "\"SameParameterValue\"", "}", ")", "public", "static", "JwtWebSecurityConfigurer", "forRS256", "(", "String", "audience", ",", "String", "issuer", ",", "AuthenticationProvider", "provider", ")", "{", "return...
Configures application authorization for JWT signed with RS256 Will try to validate the token using the public key downloaded from "$issuer/.well-known/jwks.json" and matched by the value of {@code kid} of the JWT header @param audience identifier of the API and must match the {@code aud} value in the token @param issuer of the token for this API and must match the {@code iss} value in the token @param provider of Spring Authentication objects that can validate a {@link com.auth0.spring.security.api.authentication.PreAuthenticatedAuthenticationJsonWebToken} @return JwtWebSecurityConfigurer for further configuration
[ "Configures", "application", "authorization", "for", "JWT", "signed", "with", "RS256", "Will", "try", "to", "validate", "the", "token", "using", "the", "public", "key", "downloaded", "from", "$issuer", "/", ".", "well", "-", "known", "/", "jwks", ".", "json"...
train
https://github.com/auth0/auth0-spring-security-api/blob/cebd4daa0125efd4da9e651cf29aa5ebdb147e2b/lib/src/main/java/com/auth0/spring/security/api/JwtWebSecurityConfigurer.java#L48-L51
hawkular/hawkular-inventory
hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/Traversal.java
Traversal.inTxWithNotifications
protected <R> ResultWithNofifications<R, BE> inTxWithNotifications(TransactionPayload<R, BE> payload) { return inCommittableTxWithNotifications(context, TransactionPayload.Committing.committing(payload)); }
java
protected <R> ResultWithNofifications<R, BE> inTxWithNotifications(TransactionPayload<R, BE> payload) { return inCommittableTxWithNotifications(context, TransactionPayload.Committing.committing(payload)); }
[ "protected", "<", "R", ">", "ResultWithNofifications", "<", "R", ",", "BE", ">", "inTxWithNotifications", "(", "TransactionPayload", "<", "R", ",", "BE", ">", "payload", ")", "{", "return", "inCommittableTxWithNotifications", "(", "context", ",", "TransactionPaylo...
Identical to {@link #inTx(TransactionPayload)} but also returns the notifications emitted from the transaction. The list of notifications is final and they have already been sent. The caller should NOT send them again. @param payload the payload to run within a transaction @param <R> the type of the result returned from the payload @return the result of the payload together with the notifications sent as a result of the transaction
[ "Identical", "to", "{", "@link", "#inTx", "(", "TransactionPayload", ")", "}", "but", "also", "returns", "the", "notifications", "emitted", "from", "the", "transaction", ".", "The", "list", "of", "notifications", "is", "final", "and", "they", "have", "already"...
train
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/Traversal.java#L90-L92
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/jboss/logging/Logger.java
Logger.fatalv
public void fatalv(Throwable t, String format, Object... params) { doLog(Level.FATAL, FQCN, format, params, t); }
java
public void fatalv(Throwable t, String format, Object... params) { doLog(Level.FATAL, FQCN, format, params, t); }
[ "public", "void", "fatalv", "(", "Throwable", "t", ",", "String", "format", ",", "Object", "...", "params", ")", "{", "doLog", "(", "Level", ".", "FATAL", ",", "FQCN", ",", "format", ",", "params", ",", "t", ")", ";", "}" ]
Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting. @param t the throwable @param format the message format string @param params the parameters
[ "Issue", "a", "log", "message", "with", "a", "level", "of", "FATAL", "using", "{", "@link", "java", ".", "text", ".", "MessageFormat", "}", "-", "style", "formatting", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1885-L1887
aws/aws-sdk-java
aws-java-sdk-lex/src/main/java/com/amazonaws/services/lexruntime/model/PostTextResult.java
PostTextResult.withSlots
public PostTextResult withSlots(java.util.Map<String, String> slots) { setSlots(slots); return this; }
java
public PostTextResult withSlots(java.util.Map<String, String> slots) { setSlots(slots); return this; }
[ "public", "PostTextResult", "withSlots", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "slots", ")", "{", "setSlots", "(", "slots", ")", ";", "return", "this", ";", "}" ]
<p> The intent slots that Amazon Lex detected from the user input in the conversation. </p> <p> Amazon Lex creates a resolution list containing likely values for a slot. The value that it returns is determined by the <code>valueSelectionStrategy</code> selected when the slot type was created or updated. If <code>valueSelectionStrategy</code> is set to <code>ORIGINAL_VALUE</code>, the value provided by the user is returned, if the user value is similar to the slot values. If <code>valueSelectionStrategy</code> is set to <code>TOP_RESOLUTION</code> Amazon Lex returns the first value in the resolution list or, if there is no resolution list, null. If you don't specify a <code>valueSelectionStrategy</code>, the default is <code>ORIGINAL_VALUE</code>. </p> @param slots The intent slots that Amazon Lex detected from the user input in the conversation. </p> <p> Amazon Lex creates a resolution list containing likely values for a slot. The value that it returns is determined by the <code>valueSelectionStrategy</code> selected when the slot type was created or updated. If <code>valueSelectionStrategy</code> is set to <code>ORIGINAL_VALUE</code>, the value provided by the user is returned, if the user value is similar to the slot values. If <code>valueSelectionStrategy</code> is set to <code>TOP_RESOLUTION</code> Amazon Lex returns the first value in the resolution list or, if there is no resolution list, null. If you don't specify a <code>valueSelectionStrategy</code>, the default is <code>ORIGINAL_VALUE</code>. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "intent", "slots", "that", "Amazon", "Lex", "detected", "from", "the", "user", "input", "in", "the", "conversation", ".", "<", "/", "p", ">", "<p", ">", "Amazon", "Lex", "creates", "a", "resolution", "list", "containing", "likely", "val...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-lex/src/main/java/com/amazonaws/services/lexruntime/model/PostTextResult.java#L307-L310
orhanobut/dialogplus
dialogplus/src/main/java/com/orhanobut/dialogplus/Utils.java
Utils.getView
@Nullable static View getView(Context context, int resourceId, View view) { LayoutInflater inflater = LayoutInflater.from(context); if (view != null) { return view; } if (resourceId != INVALID) { view = inflater.inflate(resourceId, null); } return view; }
java
@Nullable static View getView(Context context, int resourceId, View view) { LayoutInflater inflater = LayoutInflater.from(context); if (view != null) { return view; } if (resourceId != INVALID) { view = inflater.inflate(resourceId, null); } return view; }
[ "@", "Nullable", "static", "View", "getView", "(", "Context", "context", ",", "int", "resourceId", ",", "View", "view", ")", "{", "LayoutInflater", "inflater", "=", "LayoutInflater", ".", "from", "(", "context", ")", ";", "if", "(", "view", "!=", "null", ...
This will be called in order to create view, if the given view is not null, it will be used directly, otherwise it will check the resourceId @return null if both resourceId and view is not set
[ "This", "will", "be", "called", "in", "order", "to", "create", "view", "if", "the", "given", "view", "is", "not", "null", "it", "will", "be", "used", "directly", "otherwise", "it", "will", "check", "the", "resourceId" ]
train
https://github.com/orhanobut/dialogplus/blob/291bf4daaa3c81bf5537125f547913beb8ee2c17/dialogplus/src/main/java/com/orhanobut/dialogplus/Utils.java#L45-L54
chen0040/java-moea
src/main/java/com/github/chen0040/moea/problems/SYMPART.java
SYMPART.findTileSYMPART
public int findTileSYMPART(double x1, double x2) { int dim; double[] x = new double[2]; double h1; double omega = Math.PI / 4.0; double si = Math.sin(omega); double co = Math.cos(omega); x[0] = x1; x[1] = x2; //rotate( 2, x ); for( dim=0; dim+1 < 2; dim+=2 ) { h1 = x[dim]; x[dim] = co * h1 - si * x[dim+1]; x[dim+1] = si * h1 + co * x[dim+1]; } TupleTwo<Integer, Integer> tt = findTile(x[0], x[1]); int i = tt._1(); int j = tt._2(); // restrict to 9 tiles if (Math.abs(i) > 1 || Math.abs(j) > 1) return -1; return (i + 1) * 3 + (j + 1); }
java
public int findTileSYMPART(double x1, double x2) { int dim; double[] x = new double[2]; double h1; double omega = Math.PI / 4.0; double si = Math.sin(omega); double co = Math.cos(omega); x[0] = x1; x[1] = x2; //rotate( 2, x ); for( dim=0; dim+1 < 2; dim+=2 ) { h1 = x[dim]; x[dim] = co * h1 - si * x[dim+1]; x[dim+1] = si * h1 + co * x[dim+1]; } TupleTwo<Integer, Integer> tt = findTile(x[0], x[1]); int i = tt._1(); int j = tt._2(); // restrict to 9 tiles if (Math.abs(i) > 1 || Math.abs(j) > 1) return -1; return (i + 1) * 3 + (j + 1); }
[ "public", "int", "findTileSYMPART", "(", "double", "x1", ",", "double", "x2", ")", "{", "int", "dim", ";", "double", "[", "]", "x", "=", "new", "double", "[", "2", "]", ";", "double", "h1", ";", "double", "omega", "=", "Math", ".", "PI", "/", "4....
/* returns tile number between 0 and 8 returns - 1 if out of any tile, function does not depend on objFct!
[ "/", "*", "returns", "tile", "number", "between", "0", "and", "8", "returns", "-", "1", "if", "out", "of", "any", "tile", "function", "does", "not", "depend", "on", "objFct!" ]
train
https://github.com/chen0040/java-moea/blob/2d865b5ba5a333f44883333efe590460aad7d545/src/main/java/com/github/chen0040/moea/problems/SYMPART.java#L167-L190
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/collect/Range.java
Range.encloseAll
public static <C extends Comparable<?>> Range<C> encloseAll(Iterable<C> values) { checkNotNull(values); if (values instanceof ContiguousSet) { return ((ContiguousSet<C>) values).range(); } Iterator<C> valueIterator = values.iterator(); C min = checkNotNull(valueIterator.next()); C max = min; while (valueIterator.hasNext()) { C value = checkNotNull(valueIterator.next()); min = Ordering.natural().min(min, value); max = Ordering.natural().max(max, value); } return closed(min, max); }
java
public static <C extends Comparable<?>> Range<C> encloseAll(Iterable<C> values) { checkNotNull(values); if (values instanceof ContiguousSet) { return ((ContiguousSet<C>) values).range(); } Iterator<C> valueIterator = values.iterator(); C min = checkNotNull(valueIterator.next()); C max = min; while (valueIterator.hasNext()) { C value = checkNotNull(valueIterator.next()); min = Ordering.natural().min(min, value); max = Ordering.natural().max(max, value); } return closed(min, max); }
[ "public", "static", "<", "C", "extends", "Comparable", "<", "?", ">", ">", "Range", "<", "C", ">", "encloseAll", "(", "Iterable", "<", "C", ">", "values", ")", "{", "checkNotNull", "(", "values", ")", ";", "if", "(", "values", "instanceof", "Contiguous...
Returns the minimal range that {@linkplain Range#contains(Comparable) contains} all of the given values. The returned range is {@linkplain BoundType#CLOSED closed} on both ends. @throws ClassCastException if the parameters are not <i>mutually comparable</i> @throws NoSuchElementException if {@code values} is empty @throws NullPointerException if any of {@code values} is null @since 14.0
[ "Returns", "the", "minimal", "range", "that", "{", "@linkplain", "Range#contains", "(", "Comparable", ")", "contains", "}", "all", "of", "the", "given", "values", ".", "The", "returned", "range", "is", "{", "@linkplain", "BoundType#CLOSED", "closed", "}", "on"...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/Range.java#L327-L341
wcm-io/wcm-io-handler
media/src/main/java/io/wcm/handler/media/spi/MediaSource.java
MediaSource.getMediaCropProperty
@Deprecated protected final @NotNull String getMediaCropProperty(@NotNull MediaRequest mediaRequest) { return getMediaCropProperty(mediaRequest, null); }
java
@Deprecated protected final @NotNull String getMediaCropProperty(@NotNull MediaRequest mediaRequest) { return getMediaCropProperty(mediaRequest, null); }
[ "@", "Deprecated", "protected", "final", "@", "NotNull", "String", "getMediaCropProperty", "(", "@", "NotNull", "MediaRequest", "mediaRequest", ")", "{", "return", "getMediaCropProperty", "(", "mediaRequest", ",", "null", ")", ";", "}" ]
Get property name containing the cropping parameters @param mediaRequest Media request @return Property name @deprecated Use {@link #getMediaCropProperty(MediaRequest, MediaHandlerConfig)}
[ "Get", "property", "name", "containing", "the", "cropping", "parameters" ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/spi/MediaSource.java#L228-L231
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.updateIteration
public Iteration updateIteration(UUID projectId, UUID iterationId, Iteration updatedIteration) { return updateIterationWithServiceResponseAsync(projectId, iterationId, updatedIteration).toBlocking().single().body(); }
java
public Iteration updateIteration(UUID projectId, UUID iterationId, Iteration updatedIteration) { return updateIterationWithServiceResponseAsync(projectId, iterationId, updatedIteration).toBlocking().single().body(); }
[ "public", "Iteration", "updateIteration", "(", "UUID", "projectId", ",", "UUID", "iterationId", ",", "Iteration", "updatedIteration", ")", "{", "return", "updateIterationWithServiceResponseAsync", "(", "projectId", ",", "iterationId", ",", "updatedIteration", ")", ".", ...
Update a specific iteration. @param projectId Project id @param iterationId Iteration id @param updatedIteration The updated iteration model @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 Iteration object if successful.
[ "Update", "a", "specific", "iteration", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L1792-L1794
srikalyc/Sql4D
IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/actors/MainActor.java
MainActor.scheduleCron
private Cancellable scheduleCron(int initialDelay, int interval, MessageTypes message) { return scheduler.schedule(secs(initialDelay), secs(interval), getSelf(), message, getContext().dispatcher(), null); }
java
private Cancellable scheduleCron(int initialDelay, int interval, MessageTypes message) { return scheduler.schedule(secs(initialDelay), secs(interval), getSelf(), message, getContext().dispatcher(), null); }
[ "private", "Cancellable", "scheduleCron", "(", "int", "initialDelay", ",", "int", "interval", ",", "MessageTypes", "message", ")", "{", "return", "scheduler", ".", "schedule", "(", "secs", "(", "initialDelay", ")", ",", "secs", "(", "interval", ")", ",", "ge...
Schedules messages ever interval seconds. @param initialDelay @param interval @param message @return
[ "Schedules", "messages", "ever", "interval", "seconds", "." ]
train
https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/actors/MainActor.java#L120-L123
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java
GeneratedDConnectionDaoImpl.queryByProviderId
public Iterable<DConnection> queryByProviderId(java.lang.String providerId) { return queryByField(null, DConnectionMapper.Field.PROVIDERID.getFieldName(), providerId); }
java
public Iterable<DConnection> queryByProviderId(java.lang.String providerId) { return queryByField(null, DConnectionMapper.Field.PROVIDERID.getFieldName(), providerId); }
[ "public", "Iterable", "<", "DConnection", ">", "queryByProviderId", "(", "java", ".", "lang", ".", "String", "providerId", ")", "{", "return", "queryByField", "(", "null", ",", "DConnectionMapper", ".", "Field", ".", "PROVIDERID", ".", "getFieldName", "(", ")"...
query-by method for field providerId @param providerId the specified attribute @return an Iterable of DConnections for the specified providerId
[ "query", "-", "by", "method", "for", "field", "providerId" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L115-L117
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyAssertionAxiomImpl_CustomFieldSerializer.java
OWLObjectPropertyAssertionAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectPropertyAssertionAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectPropertyAssertionAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLObjectPropertyAssertionAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", ...
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyAssertionAxiomImpl_CustomFieldSerializer.java#L101-L104
aol/cyclops
cyclops/src/main/java/cyclops/companion/Functions.java
Functions.mapDoubles
public static Function<? super ReactiveSeq<Double>, ? extends ReactiveSeq<Double>> mapDoubles(DoubleUnaryOperator b){ return a->a.doubles(i->i,s->s.map(b)); }
java
public static Function<? super ReactiveSeq<Double>, ? extends ReactiveSeq<Double>> mapDoubles(DoubleUnaryOperator b){ return a->a.doubles(i->i,s->s.map(b)); }
[ "public", "static", "Function", "<", "?", "super", "ReactiveSeq", "<", "Double", ">", ",", "?", "extends", "ReactiveSeq", "<", "Double", ">", ">", "mapDoubles", "(", "DoubleUnaryOperator", "b", ")", "{", "return", "a", "->", "a", ".", "doubles", "(", "i"...
/* Fluent transform operation using primitive types e.g. <pre> {@code import static cyclops.ReactiveSeq.mapDoubles; ReactiveSeq.ofDoubles(1d,2d,3d) .to(mapDoubles(i->i*2)); //[2d,4d,6d] } </pre>
[ "/", "*", "Fluent", "transform", "operation", "using", "primitive", "types", "e", ".", "g", ".", "<pre", ">", "{", "@code", "import", "static", "cyclops", ".", "ReactiveSeq", ".", "mapDoubles", ";" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Functions.java#L499-L502
calimero-project/calimero-core
src/tuwien/auto/calimero/knxnetip/util/Srp.java
Srp.withService
public static Srp withService(final int familyId, final int familyVersion) { return new Srp(Type.SelectByService, true, (byte) familyId, (byte) familyVersion); }
java
public static Srp withService(final int familyId, final int familyVersion) { return new Srp(Type.SelectByService, true, (byte) familyId, (byte) familyVersion); }
[ "public", "static", "Srp", "withService", "(", "final", "int", "familyId", ",", "final", "int", "familyVersion", ")", "{", "return", "new", "Srp", "(", "Type", ".", "SelectByService", ",", "true", ",", "(", "byte", ")", "familyId", ",", "(", "byte", ")",...
Creates a search request parameter block to limit the extended search request to KNXnet/IP router or server devices with the given service family and corresponding family version. The mandatory flag of the SRP is not set. @param familyId the family ID used in the in the search request parameter block @param familyVersion the family version used in the in the search request parameter block @return search request parameter block for devices with a given service family and version
[ "Creates", "a", "search", "request", "parameter", "block", "to", "limit", "the", "extended", "search", "request", "to", "KNXnet", "/", "IP", "router", "or", "server", "devices", "with", "the", "given", "service", "family", "and", "corresponding", "family", "ve...
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/knxnetip/util/Srp.java#L213-L215
lightblue-platform/lightblue-migrator
jiff/src/main/java/jcmp/DocCompare.java
DocCompare.addArrayIdentity
public void addArrayIdentity(String array, String... identities) { arrayIdentities.put(array, new ArrayIdentityFields(identities)); }
java
public void addArrayIdentity(String array, String... identities) { arrayIdentities.put(array, new ArrayIdentityFields(identities)); }
[ "public", "void", "addArrayIdentity", "(", "String", "array", ",", "String", "...", "identities", ")", "{", "arrayIdentities", ".", "put", "(", "array", ",", "new", "ArrayIdentityFields", "(", "identities", ")", ")", ";", "}" ]
Adds a group of fields that can uniquely identify array elements for object arrays @param array The name of the array field @param identities The fields of the array element that can identiy an element In the following document: <pre> { ... "aField": [ { "_id":1,"field":...}, { "_id":2,"field":...} ] } <pre> the call looks like <pre> jsonCompare.addArrayIdentity(new Path("aField"),new Path("_id")); </pre> If there are more than one fields that uniquely identify an eleent, list those in the argument list.
[ "Adds", "a", "group", "of", "fields", "that", "can", "uniquely", "identify", "array", "elements", "for", "object", "arrays" ]
train
https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/jiff/src/main/java/jcmp/DocCompare.java#L464-L466
davidcarboni/restolino
src/main/java/com/github/davidcarboni/restolino/Configuration.java
Configuration.configureClassesReloadable
void configureClassesReloadable(String path) { try { // Set up reloading: Path classesPath = FileSystems.getDefault().getPath(path); classesUrl = classesPath.toUri().toURL(); } catch (IOException e) { throw new RuntimeException("Error starting class reloader", e); } }
java
void configureClassesReloadable(String path) { try { // Set up reloading: Path classesPath = FileSystems.getDefault().getPath(path); classesUrl = classesPath.toUri().toURL(); } catch (IOException e) { throw new RuntimeException("Error starting class reloader", e); } }
[ "void", "configureClassesReloadable", "(", "String", "path", ")", "{", "try", "{", "// Set up reloading:", "Path", "classesPath", "=", "FileSystems", ".", "getDefault", "(", ")", ".", "getPath", "(", "path", ")", ";", "classesUrl", "=", "classesPath", ".", "to...
Configures dynamic class reloading. This is most useful for development (rather than deployment). This typically reloads classes from the <code>target/classes/...</code> directory of your development project. <p/> NB This provides an efficient development workflow, allowing you to see code changes without having to redeploy. It also supports stateless webapp design because the entire classes classloader is replaced every time there is a change (so you'll lose stuff like static variable values).
[ "Configures", "dynamic", "class", "reloading", ".", "This", "is", "most", "useful", "for", "development", "(", "rather", "than", "deployment", ")", ".", "This", "typically", "reloads", "classes", "from", "the", "<code", ">", "target", "/", "classes", "/", "....
train
https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/Configuration.java#L342-L351
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/util/Resource.java
Resource.resourceExist
private static boolean resourceExist(ExternalContext externalContext, String path) { if ("/".equals(path)) { // The root context exists always return true; } Object ctx = externalContext.getContext(); if (ctx instanceof ServletContext) { ServletContext servletContext = (ServletContext) ctx; InputStream stream = servletContext.getResourceAsStream(path); if (stream != null) { try { stream.close(); } catch (IOException e) { // Ignore here, since we donnot wanted to read from this // resource anyway } return true; } } return false; }
java
private static boolean resourceExist(ExternalContext externalContext, String path) { if ("/".equals(path)) { // The root context exists always return true; } Object ctx = externalContext.getContext(); if (ctx instanceof ServletContext) { ServletContext servletContext = (ServletContext) ctx; InputStream stream = servletContext.getResourceAsStream(path); if (stream != null) { try { stream.close(); } catch (IOException e) { // Ignore here, since we donnot wanted to read from this // resource anyway } return true; } } return false; }
[ "private", "static", "boolean", "resourceExist", "(", "ExternalContext", "externalContext", ",", "String", "path", ")", "{", "if", "(", "\"/\"", ".", "equals", "(", "path", ")", ")", "{", "// The root context exists always", "return", "true", ";", "}", "Object",...
doesnt exist. Otherwise, the URL will fail on the first access.
[ "doesnt", "exist", ".", "Otherwise", "the", "URL", "will", "fail", "on", "the", "first", "access", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/util/Resource.java#L89-L116
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackUtility.java
FastTrackUtility.getDouble
public static final Double getDouble(byte[] data, int offset) { Double result = null; long longValue = getLong(data, offset); if (longValue != NULL_DOUBLE) { double doubleValue = Double.longBitsToDouble(longValue); if (!Double.isNaN(doubleValue)) { result = Double.valueOf(doubleValue); } } return result; }
java
public static final Double getDouble(byte[] data, int offset) { Double result = null; long longValue = getLong(data, offset); if (longValue != NULL_DOUBLE) { double doubleValue = Double.longBitsToDouble(longValue); if (!Double.isNaN(doubleValue)) { result = Double.valueOf(doubleValue); } } return result; }
[ "public", "static", "final", "Double", "getDouble", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "Double", "result", "=", "null", ";", "long", "longValue", "=", "getLong", "(", "data", ",", "offset", ")", ";", "if", "(", "longValue", ...
This method reads an eight byte double from the input array. @param data the input array @param offset offset of double data in the array @return double value
[ "This", "method", "reads", "an", "eight", "byte", "double", "from", "the", "input", "array", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackUtility.java#L131-L144
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java
CmsForm.updateFieldValidationStatus
protected void updateFieldValidationStatus(String fieldId, CmsValidationResult result) { I_CmsFormField field = m_fields.get(fieldId); updateFieldValidationStatus(field, result); }
java
protected void updateFieldValidationStatus(String fieldId, CmsValidationResult result) { I_CmsFormField field = m_fields.get(fieldId); updateFieldValidationStatus(field, result); }
[ "protected", "void", "updateFieldValidationStatus", "(", "String", "fieldId", ",", "CmsValidationResult", "result", ")", "{", "I_CmsFormField", "field", "=", "m_fields", ".", "get", "(", "fieldId", ")", ";", "updateFieldValidationStatus", "(", "field", ",", "result"...
Applies a validation result to a form field.<p> @param fieldId the field id to which the validation result should be applied @param result the result of the validation operation
[ "Applies", "a", "validation", "result", "to", "a", "form", "field", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java#L520-L524
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java
MathBindings.copySign
public static DoubleBinding copySign(final ObservableDoubleValue magnitude, double sign) { return createDoubleBinding(() -> Math.copySign(magnitude.get(), sign), magnitude); }
java
public static DoubleBinding copySign(final ObservableDoubleValue magnitude, double sign) { return createDoubleBinding(() -> Math.copySign(magnitude.get(), sign), magnitude); }
[ "public", "static", "DoubleBinding", "copySign", "(", "final", "ObservableDoubleValue", "magnitude", ",", "double", "sign", ")", "{", "return", "createDoubleBinding", "(", "(", ")", "->", "Math", ".", "copySign", "(", "magnitude", ".", "get", "(", ")", ",", ...
Binding for {@link java.lang.Math#copySign(double, double)} @param magnitude the parameter providing the magnitude of the result @param sign the parameter providing the sign of the result @return a value with the magnitude of {@code magnitude} and the sign of {@code sign}.
[ "Binding", "for", "{", "@link", "java", ".", "lang", ".", "Math#copySign", "(", "double", "double", ")", "}" ]
train
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java#L287-L289
xcesco/kripton
kripton-core/src/main/java/com/abubusoft/kripton/common/PrimitiveUtils.java
PrimitiveUtils.readShort
public static Short readShort(String value, Short defaultValue) { if (!StringUtils.hasText(value)) return defaultValue; return Short.valueOf(value); }
java
public static Short readShort(String value, Short defaultValue) { if (!StringUtils.hasText(value)) return defaultValue; return Short.valueOf(value); }
[ "public", "static", "Short", "readShort", "(", "String", "value", ",", "Short", "defaultValue", ")", "{", "if", "(", "!", "StringUtils", ".", "hasText", "(", "value", ")", ")", "return", "defaultValue", ";", "return", "Short", ".", "valueOf", "(", "value",...
Read short. @param value the value @param defaultValue the default value @return the short
[ "Read", "short", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/PrimitiveUtils.java#L104-L108
craigwblake/redline
src/main/java/org/redline_rpm/Builder.java
Builder.setPackage
public void setPackage( final CharSequence name, final CharSequence version, final CharSequence release, final int epoch) { checkVariableContainsIllegalChars(ILLEGAL_CHARS_NAME, name, "name"); checkVariableContainsIllegalChars(ILLEGAL_CHARS_VARIABLE, version, "version"); checkVariableContainsIllegalChars(ILLEGAL_CHARS_VARIABLE, release, "release"); format.getLead().setName( name + "-" + version + "-" + release); format.getHeader().createEntry( NAME, name); format.getHeader().createEntry( VERSION, version); format.getHeader().createEntry( RELEASE, release); format.getHeader().createEntry( EPOCH, epoch); this.provides.clear(); addProvides(String.valueOf(name), "" + epoch + ":" + version + "-" + release); }
java
public void setPackage( final CharSequence name, final CharSequence version, final CharSequence release, final int epoch) { checkVariableContainsIllegalChars(ILLEGAL_CHARS_NAME, name, "name"); checkVariableContainsIllegalChars(ILLEGAL_CHARS_VARIABLE, version, "version"); checkVariableContainsIllegalChars(ILLEGAL_CHARS_VARIABLE, release, "release"); format.getLead().setName( name + "-" + version + "-" + release); format.getHeader().createEntry( NAME, name); format.getHeader().createEntry( VERSION, version); format.getHeader().createEntry( RELEASE, release); format.getHeader().createEntry( EPOCH, epoch); this.provides.clear(); addProvides(String.valueOf(name), "" + epoch + ":" + version + "-" + release); }
[ "public", "void", "setPackage", "(", "final", "CharSequence", "name", ",", "final", "CharSequence", "version", ",", "final", "CharSequence", "release", ",", "final", "int", "epoch", ")", "{", "checkVariableContainsIllegalChars", "(", "ILLEGAL_CHARS_NAME", ",", "name...
<b>Required Field</b>. Sets the package information, such as the rpm name, the version, and the release number. @param name the name of the RPM package. @param version the version of the new package. @param release the release number, specified after the version, of the new RPM. @param epoch the epoch number of the new RPM @throws IllegalArgumentException if version or release contain dashes, as they are explicitly disallowed by RPM file format.
[ "<b", ">", "Required", "Field<", "/", "b", ">", ".", "Sets", "the", "package", "information", "such", "as", "the", "rpm", "name", "the", "version", "and", "the", "release", "number", "." ]
train
https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L342-L353
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java
PluginDefinition.initElement
public void initElement(ElementBase element, IPropertyProvider propertyProvider) { if (propertyProvider != null) { for (PropertyInfo propInfo : getProperties()) { String key = propInfo.getId(); if (propertyProvider.hasProperty(key)) { String value = propertyProvider.getProperty(key); propInfo.setPropertyValue(element, value); } } } }
java
public void initElement(ElementBase element, IPropertyProvider propertyProvider) { if (propertyProvider != null) { for (PropertyInfo propInfo : getProperties()) { String key = propInfo.getId(); if (propertyProvider.hasProperty(key)) { String value = propertyProvider.getProperty(key); propInfo.setPropertyValue(element, value); } } } }
[ "public", "void", "initElement", "(", "ElementBase", "element", ",", "IPropertyProvider", "propertyProvider", ")", "{", "if", "(", "propertyProvider", "!=", "null", ")", "{", "for", "(", "PropertyInfo", "propInfo", ":", "getProperties", "(", ")", ")", "{", "St...
Initialize the element's properties using the specified property provider. @param element Element to initialize. @param propertyProvider Provider of property values.
[ "Initialize", "the", "element", "s", "properties", "using", "the", "specified", "property", "provider", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java#L655-L666
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/RegistriesInner.java
RegistriesInner.listUsages
public RegistryUsageListResultInner listUsages(String resourceGroupName, String registryName) { return listUsagesWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body(); }
java
public RegistryUsageListResultInner listUsages(String resourceGroupName, String registryName) { return listUsagesWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body(); }
[ "public", "RegistryUsageListResultInner", "listUsages", "(", "String", "resourceGroupName", ",", "String", "registryName", ")", "{", "return", "listUsagesWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ")", ".", "toBlocking", "(", ")", ".", "si...
Gets the quota usages for the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @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 RegistryUsageListResultInner object if successful.
[ "Gets", "the", "quota", "usages", "for", "the", "specified", "container", "registry", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/RegistriesInner.java#L1214-L1216
landawn/AbacusUtil
src/com/landawn/abacus/util/DateUtil.java
DateUtil.addYears
public static <T extends Calendar> T addYears(final T calendar, final int amount) { return roll(calendar, amount, CalendarUnit.YEAR); }
java
public static <T extends Calendar> T addYears(final T calendar, final int amount) { return roll(calendar, amount, CalendarUnit.YEAR); }
[ "public", "static", "<", "T", "extends", "Calendar", ">", "T", "addYears", "(", "final", "T", "calendar", ",", "final", "int", "amount", ")", "{", "return", "roll", "(", "calendar", ",", "amount", ",", "CalendarUnit", ".", "YEAR", ")", ";", "}" ]
Adds a number of years to a calendar returning a new object. The original {@code Date} is unchanged. @param calendar the calendar, not null @param amount the amount to add, may be negative @return the new {@code Date} with the amount added @throws IllegalArgumentException if the calendar is null
[ "Adds", "a", "number", "of", "years", "to", "a", "calendar", "returning", "a", "new", "object", ".", "The", "original", "{", "@code", "Date", "}", "is", "unchanged", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L1063-L1065
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java
Util.forwardExecutionControlAndIO
public static void forwardExecutionControlAndIO(ExecutionControl ec, InputStream inStream, OutputStream outStream, Map<String, Consumer<OutputStream>> outputStreamMap, Map<String, Consumer<InputStream>> inputStreamMap) throws IOException { for (Entry<String, Consumer<OutputStream>> e : outputStreamMap.entrySet()) { e.getValue().accept(multiplexingOutputStream(e.getKey(), outStream)); } ObjectOutputStream cmdOut = new ObjectOutputStream(multiplexingOutputStream("$command", outStream)); PipeInputStream cmdInPipe = new PipeInputStream(); Map<String, OutputStream> inputs = new HashMap<>(); inputs.put("$command", cmdInPipe.createOutput()); for (Entry<String, Consumer<InputStream>> e : inputStreamMap.entrySet()) { OutputStream inputSignal = multiplexingOutputStream("$" + e.getKey() + "-input-requested", outStream); PipeInputStream inputPipe = new PipeInputStream() { @Override protected void inputNeeded() throws IOException { inputSignal.write('1'); inputSignal.flush(); } @Override public synchronized int read() throws IOException { int tag = super.read(); switch (tag) { case TAG_DATA: return super.read(); case TAG_CLOSED: close(); return -1; case TAG_EXCEPTION: int len = (super.read() << 0) + (super.read() << 8) + (super.read() << 16) + (super.read() << 24); byte[] message = new byte[len]; for (int i = 0; i < len; i++) { message[i] = (byte) super.read(); } throw new IOException(new String(message, "UTF-8")); case -1: return -1; default: throw new IOException("Internal error: unrecognized message tag: " + tag); } } }; inputs.put(e.getKey(), inputPipe.createOutput()); e.getValue().accept(inputPipe); } new DemultiplexInput(inStream, inputs, inputs.values()).start(); ObjectInputStream cmdIn = new ObjectInputStream(cmdInPipe); forwardExecutionControl(ec, cmdIn, cmdOut); }
java
public static void forwardExecutionControlAndIO(ExecutionControl ec, InputStream inStream, OutputStream outStream, Map<String, Consumer<OutputStream>> outputStreamMap, Map<String, Consumer<InputStream>> inputStreamMap) throws IOException { for (Entry<String, Consumer<OutputStream>> e : outputStreamMap.entrySet()) { e.getValue().accept(multiplexingOutputStream(e.getKey(), outStream)); } ObjectOutputStream cmdOut = new ObjectOutputStream(multiplexingOutputStream("$command", outStream)); PipeInputStream cmdInPipe = new PipeInputStream(); Map<String, OutputStream> inputs = new HashMap<>(); inputs.put("$command", cmdInPipe.createOutput()); for (Entry<String, Consumer<InputStream>> e : inputStreamMap.entrySet()) { OutputStream inputSignal = multiplexingOutputStream("$" + e.getKey() + "-input-requested", outStream); PipeInputStream inputPipe = new PipeInputStream() { @Override protected void inputNeeded() throws IOException { inputSignal.write('1'); inputSignal.flush(); } @Override public synchronized int read() throws IOException { int tag = super.read(); switch (tag) { case TAG_DATA: return super.read(); case TAG_CLOSED: close(); return -1; case TAG_EXCEPTION: int len = (super.read() << 0) + (super.read() << 8) + (super.read() << 16) + (super.read() << 24); byte[] message = new byte[len]; for (int i = 0; i < len; i++) { message[i] = (byte) super.read(); } throw new IOException(new String(message, "UTF-8")); case -1: return -1; default: throw new IOException("Internal error: unrecognized message tag: " + tag); } } }; inputs.put(e.getKey(), inputPipe.createOutput()); e.getValue().accept(inputPipe); } new DemultiplexInput(inStream, inputs, inputs.values()).start(); ObjectInputStream cmdIn = new ObjectInputStream(cmdInPipe); forwardExecutionControl(ec, cmdIn, cmdOut); }
[ "public", "static", "void", "forwardExecutionControlAndIO", "(", "ExecutionControl", "ec", ",", "InputStream", "inStream", ",", "OutputStream", "outStream", ",", "Map", "<", "String", ",", "Consumer", "<", "OutputStream", ">", ">", "outputStreamMap", ",", "Map", "...
Forward commands from the input to the specified {@link ExecutionControl} instance, then responses back on the output. @param ec the direct instance of {@link ExecutionControl} to process commands @param inStream the stream from which to create the command input @param outStream the stream that will carry any specified auxiliary channels (like {@code System.out} and {@code System.err}), and the command response output. @param outputStreamMap a map between names of additional streams to carry and setters for the stream. Names starting with '$' are reserved for internal use. @param inputStreamMap a map between names of additional streams to carry and setters for the stream. Names starting with '$' are reserved for internal use. @throws IOException if there are errors using the passed streams
[ "Forward", "commands", "from", "the", "input", "to", "the", "specified", "{" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java#L92-L138
CloudSlang/cs-actions
cs-commons/src/main/java/io/cloudslang/content/utils/NumberUtilities.java
NumberUtilities.isValidDouble
public static boolean isValidDouble(@Nullable final String doubleStr, double lowerBound, double upperBound) { return isValidDouble(doubleStr, lowerBound, upperBound, true, false); }
java
public static boolean isValidDouble(@Nullable final String doubleStr, double lowerBound, double upperBound) { return isValidDouble(doubleStr, lowerBound, upperBound, true, false); }
[ "public", "static", "boolean", "isValidDouble", "(", "@", "Nullable", "final", "String", "doubleStr", ",", "double", "lowerBound", ",", "double", "upperBound", ")", "{", "return", "isValidDouble", "(", "doubleStr", ",", "lowerBound", ",", "upperBound", ",", "tru...
Given an double string, it checks if it's a valid double (base on apaches NumberUtils.createDouble) and if it's between the lowerBound and upperBound (including the lower bound and excluding the upper one) @param doubleStr the integer string to check @param lowerBound the lower bound of the interval @param upperBound the upper bound of the interval @return true if the integer string is valid and in between the lowerBound and upperBound, false otherwise @throws IllegalArgumentException if the lowerBound is not less than the upperBound
[ "Given", "an", "double", "string", "it", "checks", "if", "it", "s", "a", "valid", "double", "(", "base", "on", "apaches", "NumberUtils", ".", "createDouble", ")", "and", "if", "it", "s", "between", "the", "lowerBound", "and", "upperBound", "(", "including"...
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-commons/src/main/java/io/cloudslang/content/utils/NumberUtilities.java#L237-L239
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationtacacspolicy_binding.java
authenticationtacacspolicy_binding.get
public static authenticationtacacspolicy_binding get(nitro_service service, String name) throws Exception{ authenticationtacacspolicy_binding obj = new authenticationtacacspolicy_binding(); obj.set_name(name); authenticationtacacspolicy_binding response = (authenticationtacacspolicy_binding) obj.get_resource(service); return response; }
java
public static authenticationtacacspolicy_binding get(nitro_service service, String name) throws Exception{ authenticationtacacspolicy_binding obj = new authenticationtacacspolicy_binding(); obj.set_name(name); authenticationtacacspolicy_binding response = (authenticationtacacspolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "authenticationtacacspolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "authenticationtacacspolicy_binding", "obj", "=", "new", "authenticationtacacspolicy_binding", "(", ")", ";", "obj", ...
Use this API to fetch authenticationtacacspolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "authenticationtacacspolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationtacacspolicy_binding.java#L136-L141
CycloneDX/cyclonedx-core-java
src/main/java/org/cyclonedx/util/BomUtils.java
BomUtils.calculateHashes
public static List<Hash> calculateHashes(File file) throws IOException { if (file == null || !file.exists() || !file.canRead()) { return null; } final List<Hash> hashes = new ArrayList<>(); try (InputStream fis = Files.newInputStream(file.toPath())) { hashes.add(new Hash(Hash.Algorithm.MD5, DigestUtils.md5Hex(fis))); } try (InputStream fis = Files.newInputStream(file.toPath())) { hashes.add(new Hash(Hash.Algorithm.SHA1, DigestUtils.sha1Hex(fis))); } try (InputStream fis = Files.newInputStream(file.toPath())) { hashes.add(new Hash(Hash.Algorithm.SHA_256, DigestUtils.sha256Hex(fis))); } try (InputStream fis = Files.newInputStream(file.toPath())) { hashes.add(new Hash(Hash.Algorithm.SHA_384, DigestUtils.sha384Hex(fis))); } try (InputStream fis = Files.newInputStream(file.toPath())) { hashes.add(new Hash(Hash.Algorithm.SHA_512, DigestUtils.sha512Hex(fis))); } return hashes; }
java
public static List<Hash> calculateHashes(File file) throws IOException { if (file == null || !file.exists() || !file.canRead()) { return null; } final List<Hash> hashes = new ArrayList<>(); try (InputStream fis = Files.newInputStream(file.toPath())) { hashes.add(new Hash(Hash.Algorithm.MD5, DigestUtils.md5Hex(fis))); } try (InputStream fis = Files.newInputStream(file.toPath())) { hashes.add(new Hash(Hash.Algorithm.SHA1, DigestUtils.sha1Hex(fis))); } try (InputStream fis = Files.newInputStream(file.toPath())) { hashes.add(new Hash(Hash.Algorithm.SHA_256, DigestUtils.sha256Hex(fis))); } try (InputStream fis = Files.newInputStream(file.toPath())) { hashes.add(new Hash(Hash.Algorithm.SHA_384, DigestUtils.sha384Hex(fis))); } try (InputStream fis = Files.newInputStream(file.toPath())) { hashes.add(new Hash(Hash.Algorithm.SHA_512, DigestUtils.sha512Hex(fis))); } return hashes; }
[ "public", "static", "List", "<", "Hash", ">", "calculateHashes", "(", "File", "file", ")", "throws", "IOException", "{", "if", "(", "file", "==", "null", "||", "!", "file", ".", "exists", "(", ")", "||", "!", "file", ".", "canRead", "(", ")", ")", ...
Calculates the hashes of the specified file. @param file the File to calculate hashes on @return a List of Hash objets @throws IOException an IOException @since 1.0.0
[ "Calculates", "the", "hashes", "of", "the", "specified", "file", "." ]
train
https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/util/BomUtils.java#L41-L62
meertensinstituut/mtas
src/main/java/mtas/solr/handler/component/util/MtasSolrCollectionResult.java
MtasSolrCollectionResult.setCreate
public void setCreate(long now, SimpleOrderedMap<Object> status) throws IOException { if (action.equals(ComponentCollection.ACTION_CREATE)) { this.now = now; this.status = status; } else { throw new IOException("not allowed with action '" + action + "'"); } }
java
public void setCreate(long now, SimpleOrderedMap<Object> status) throws IOException { if (action.equals(ComponentCollection.ACTION_CREATE)) { this.now = now; this.status = status; } else { throw new IOException("not allowed with action '" + action + "'"); } }
[ "public", "void", "setCreate", "(", "long", "now", ",", "SimpleOrderedMap", "<", "Object", ">", "status", ")", "throws", "IOException", "{", "if", "(", "action", ".", "equals", "(", "ComponentCollection", ".", "ACTION_CREATE", ")", ")", "{", "this", ".", "...
Sets the create. @param now the now @param status the status @throws IOException Signals that an I/O exception has occurred.
[ "Sets", "the", "create", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/component/util/MtasSolrCollectionResult.java#L181-L189
hal/core
gui/src/main/java/org/jboss/as/console/client/shared/flow/TimeoutOperation.java
TimeoutOperation.start
public final void start(final Command command, final Callback callback) { this.start = System.currentTimeMillis(); this.conditionSatisfied = false; command.execute(); new Async().whilst(new KeepGoing(), new Finish(callback), checker(), 500); }
java
public final void start(final Command command, final Callback callback) { this.start = System.currentTimeMillis(); this.conditionSatisfied = false; command.execute(); new Async().whilst(new KeepGoing(), new Finish(callback), checker(), 500); }
[ "public", "final", "void", "start", "(", "final", "Command", "command", ",", "final", "Callback", "callback", ")", "{", "this", ".", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "this", ".", "conditionSatisfied", "=", "false", ";", "com...
Executes {@code command} until {@link #setConditionSatisfied(boolean)} was called with {@code true} or the timeout is reached. @param command the command which should be executed @param callback the final callback
[ "Executes", "{", "@code", "command", "}", "until", "{", "@link", "#setConditionSatisfied", "(", "boolean", ")", "}", "was", "called", "with", "{", "@code", "true", "}", "or", "the", "timeout", "is", "reached", "." ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/shared/flow/TimeoutOperation.java#L81-L86
jmxtrans/embedded-jmxtrans
src/main/java/org/jmxtrans/embedded/output/AbstractOutputWriter.java
AbstractOutputWriter.getLongSetting
protected long getLongSetting(String name, long defaultValue) throws IllegalArgumentException { if (settings.containsKey(name)) { String value = settings.get(name).toString(); try { return Long.parseLong(value); } catch (Exception e) { throw new IllegalArgumentException("Setting '" + name + "=" + value + "' is not a long on " + this.toString()); } } else { return defaultValue; } }
java
protected long getLongSetting(String name, long defaultValue) throws IllegalArgumentException { if (settings.containsKey(name)) { String value = settings.get(name).toString(); try { return Long.parseLong(value); } catch (Exception e) { throw new IllegalArgumentException("Setting '" + name + "=" + value + "' is not a long on " + this.toString()); } } else { return defaultValue; } }
[ "protected", "long", "getLongSetting", "(", "String", "name", ",", "long", "defaultValue", ")", "throws", "IllegalArgumentException", "{", "if", "(", "settings", ".", "containsKey", "(", "name", ")", ")", "{", "String", "value", "=", "settings", ".", "get", ...
Convert value of this setting to a Java <b>long</b>. If the property is not found, the <code>defaultValue</code> is returned. If the property is not a long, an exception is thrown. @param name name of the property @param defaultValue default value if the property is not defined. @return int value of the property or <code>defaultValue</code> if the property is not defined. @throws IllegalArgumentException if setting is not is not a long.
[ "Convert", "value", "of", "this", "setting", "to", "a", "Java", "<b", ">", "long<", "/", "b", ">", "." ]
train
https://github.com/jmxtrans/embedded-jmxtrans/blob/17224389e7d8323284cabc2a5167fc03bed6d223/src/main/java/org/jmxtrans/embedded/output/AbstractOutputWriter.java#L131-L143
h2oai/h2o-2
src/main/java/hex/deeplearning/DeepLearningTask2.java
DeepLearningTask2.lcompute
@Override public void lcompute() { _res = new DeepLearningTask(_model_info, _sync_fraction); _res.setCompleter(this); _res.asyncExec(0, _fr, true /*run_local*/); }
java
@Override public void lcompute() { _res = new DeepLearningTask(_model_info, _sync_fraction); _res.setCompleter(this); _res.asyncExec(0, _fr, true /*run_local*/); }
[ "@", "Override", "public", "void", "lcompute", "(", ")", "{", "_res", "=", "new", "DeepLearningTask", "(", "_model_info", ",", "_sync_fraction", ")", ";", "_res", ".", "setCompleter", "(", "this", ")", ";", "_res", ".", "asyncExec", "(", "0", ",", "_fr",...
Do the local computation: Perform one DeepLearningTask (with run_local=true) iteration. Pass over all the data (will be replicated in dfork() here), and use _sync_fraction random rows. This calls DeepLearningTask's reduce() between worker threads that update the same local model_info via Hogwild! Once the computation is done, reduce() will be called
[ "Do", "the", "local", "computation", ":", "Perform", "one", "DeepLearningTask", "(", "with", "run_local", "=", "true", ")", "iteration", ".", "Pass", "over", "all", "the", "data", "(", "will", "be", "replicated", "in", "dfork", "()", "here", ")", "and", ...
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/deeplearning/DeepLearningTask2.java#L43-L48
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsInner.java
JobStepsInner.listByVersionAsync
public Observable<Page<JobStepInner>> listByVersionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { return listByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion) .map(new Func1<ServiceResponse<Page<JobStepInner>>, Page<JobStepInner>>() { @Override public Page<JobStepInner> call(ServiceResponse<Page<JobStepInner>> response) { return response.body(); } }); }
java
public Observable<Page<JobStepInner>> listByVersionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { return listByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion) .map(new Func1<ServiceResponse<Page<JobStepInner>>, Page<JobStepInner>>() { @Override public Page<JobStepInner> call(ServiceResponse<Page<JobStepInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "JobStepInner", ">", ">", "listByVersionAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "serverName", ",", "final", "String", "jobAgentName", ",", "final", "String", "jobName", ",", "final", ...
Gets all job steps in the specified job version. @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 jobAgentName The name of the job agent. @param jobName The name of the job to get. @param jobVersion The version of the job to get. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;JobStepInner&gt; object
[ "Gets", "all", "job", "steps", "in", "the", "specified", "job", "version", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsInner.java#L156-L164
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/validate/ObjectComparator.java
ObjectComparator.areEqual
public static boolean areEqual(Object value1, Object value2) { if (value1 == null && value2 == null) return true; if (value1 == null || value2 == null) return false; return value1.equals(value2); }
java
public static boolean areEqual(Object value1, Object value2) { if (value1 == null && value2 == null) return true; if (value1 == null || value2 == null) return false; return value1.equals(value2); }
[ "public", "static", "boolean", "areEqual", "(", "Object", "value1", ",", "Object", "value2", ")", "{", "if", "(", "value1", "==", "null", "&&", "value2", "==", "null", ")", "return", "true", ";", "if", "(", "value1", "==", "null", "||", "value2", "==",...
Checks if two values are equal. The operation can be performed over values of any type. @param value1 the first value to compare @param value2 the second value to compare @return true if values are equal and false otherwise
[ "Checks", "if", "two", "values", "are", "equal", ".", "The", "operation", "can", "be", "performed", "over", "values", "of", "any", "type", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/validate/ObjectComparator.java#L59-L65
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/translate/OcniExtractor.java
OcniExtractor.extractNativeCode
private OcniBlock extractNativeCode(TreeNode node) { int offset = node.getStartPosition(); String text = unit.getSource().substring(offset, offset + node.getLength()); Matcher m = OCNI_PATTERN.matcher(text); if (m.find()) { String typeStr = m.group(1); try { OcniType type = OcniType.fromString(typeStr); return new OcniBlock(type, m.group(2).trim()); } catch (IllegalArgumentException e) { ErrorUtil.warning(node, "Unknown OCNI type: " + typeStr); return null; } } if (options.jsniWarnings() && hasJsni(text)) { ErrorUtil.warning(node, "JSNI comment found"); } return null; }
java
private OcniBlock extractNativeCode(TreeNode node) { int offset = node.getStartPosition(); String text = unit.getSource().substring(offset, offset + node.getLength()); Matcher m = OCNI_PATTERN.matcher(text); if (m.find()) { String typeStr = m.group(1); try { OcniType type = OcniType.fromString(typeStr); return new OcniBlock(type, m.group(2).trim()); } catch (IllegalArgumentException e) { ErrorUtil.warning(node, "Unknown OCNI type: " + typeStr); return null; } } if (options.jsniWarnings() && hasJsni(text)) { ErrorUtil.warning(node, "JSNI comment found"); } return null; }
[ "private", "OcniBlock", "extractNativeCode", "(", "TreeNode", "node", ")", "{", "int", "offset", "=", "node", ".", "getStartPosition", "(", ")", ";", "String", "text", "=", "unit", ".", "getSource", "(", ")", ".", "substring", "(", "offset", ",", "offset",...
Returns text from within a source code range, where that text is surrounded by OCNI-like tokens ("/&#42;-[" and "]-&#42;/"), warning if JSNI delimiters are found instead. @param node The node in which to extract the native code. @return the extracted text between the OCNI delimiters, or null if a pair of JSNI delimiters aren't in the specified text range
[ "Returns", "text", "from", "within", "a", "source", "code", "range", "where", "that", "text", "is", "surrounded", "by", "OCNI", "-", "like", "tokens", "(", "/", "&#42", ";", "-", "[", "and", "]", "-", "&#42", ";", "/", ")", "warning", "if", "JSNI", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/OcniExtractor.java#L292-L310
dashbuilder/dashbuilder
dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/DisplayerLocator.java
DisplayerLocator.lookupDisplayer
public Displayer lookupDisplayer(DisplayerSettings target) { RendererLibrary renderer = rendererManager.getRendererForDisplayer(target); Displayer displayer = renderer.lookupDisplayer(target); if (displayer == null) { String rendererUuid = target.getRenderer(); if (StringUtils.isBlank(rendererUuid)) throw new RuntimeException(CommonConstants.INSTANCE.displayerlocator_default_renderer_undeclared(target.getType().toString())); throw new RuntimeException(CommonConstants.INSTANCE.displayerlocator_unsupported_displayer_renderer(target.getType().toString(), rendererUuid)); } displayer.setDisplayerSettings(target); // Check if a DataSet has been set instead of a DataSetLookup. DataSetLookup dataSetLookup = target.getDataSetLookup(); if (target.getDataSet() != null) { DataSet dataSet = target.getDataSet(); clientDataSetManager.registerDataSet(dataSet); dataSetLookup = new DataSetLookup(dataSet.getUUID()); } DataSetHandler handler = new DataSetHandlerImpl(clientServices, dataSetLookup); displayer.setDataSetHandler(handler); setValueFormatters(displayer); return displayer; }
java
public Displayer lookupDisplayer(DisplayerSettings target) { RendererLibrary renderer = rendererManager.getRendererForDisplayer(target); Displayer displayer = renderer.lookupDisplayer(target); if (displayer == null) { String rendererUuid = target.getRenderer(); if (StringUtils.isBlank(rendererUuid)) throw new RuntimeException(CommonConstants.INSTANCE.displayerlocator_default_renderer_undeclared(target.getType().toString())); throw new RuntimeException(CommonConstants.INSTANCE.displayerlocator_unsupported_displayer_renderer(target.getType().toString(), rendererUuid)); } displayer.setDisplayerSettings(target); // Check if a DataSet has been set instead of a DataSetLookup. DataSetLookup dataSetLookup = target.getDataSetLookup(); if (target.getDataSet() != null) { DataSet dataSet = target.getDataSet(); clientDataSetManager.registerDataSet(dataSet); dataSetLookup = new DataSetLookup(dataSet.getUUID()); } DataSetHandler handler = new DataSetHandlerImpl(clientServices, dataSetLookup); displayer.setDataSetHandler(handler); setValueFormatters(displayer); return displayer; }
[ "public", "Displayer", "lookupDisplayer", "(", "DisplayerSettings", "target", ")", "{", "RendererLibrary", "renderer", "=", "rendererManager", ".", "getRendererForDisplayer", "(", "target", ")", ";", "Displayer", "displayer", "=", "renderer", ".", "lookupDisplayer", "...
Get the displayer component for the specified data displayer (with no data set attached).
[ "Get", "the", "displayer", "component", "for", "the", "specified", "data", "displayer", "(", "with", "no", "data", "set", "attached", ")", "." ]
train
https://github.com/dashbuilder/dashbuilder/blob/50ef88210726b4f2f33f1a82eaf0f542e38dedd9/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/DisplayerLocator.java#L61-L83
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/PathBuilder.java
PathBuilder.get
@SuppressWarnings("unchecked") public <A> SimplePath<A> get(Path<A> path) { SimplePath<A> newPath = getSimple(toString(path), (Class<A>) path.getType()); return addMetadataOf(newPath, path); }
java
@SuppressWarnings("unchecked") public <A> SimplePath<A> get(Path<A> path) { SimplePath<A> newPath = getSimple(toString(path), (Class<A>) path.getType()); return addMetadataOf(newPath, path); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "A", ">", "SimplePath", "<", "A", ">", "get", "(", "Path", "<", "A", ">", "path", ")", "{", "SimplePath", "<", "A", ">", "newPath", "=", "getSimple", "(", "toString", "(", "path", ")"...
Create a new Simple path @param <A> @param path existing path @return property path
[ "Create", "a", "new", "Simple", "path" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/PathBuilder.java#L452-L456
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.isMethodDirectlyExists
public static boolean isMethodDirectlyExists(Object object, String methodName, Class<?>... params) { try { Method method = object.getClass().getDeclaredMethod(methodName, params); return true; } catch (NoSuchMethodException e) { return false; } catch (SecurityException e) { throw new RuntimeException(e); } }
java
public static boolean isMethodDirectlyExists(Object object, String methodName, Class<?>... params) { try { Method method = object.getClass().getDeclaredMethod(methodName, params); return true; } catch (NoSuchMethodException e) { return false; } catch (SecurityException e) { throw new RuntimeException(e); } }
[ "public", "static", "boolean", "isMethodDirectlyExists", "(", "Object", "object", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "params", ")", "{", "try", "{", "Method", "method", "=", "object", ".", "getClass", "(", ")", ".", "getDeclar...
Checks if is method directly exists. @param object the object @param methodName the method name @param params the params @return true, if is method directly exists
[ "Checks", "if", "is", "method", "directly", "exists", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L367-L376
GoogleCloudPlatform/appengine-plugins-core
src/main/java/com/google/cloud/tools/io/FileUtil.java
FileUtil.copyDirectory
public static void copyDirectory(final Path source, final Path destination, List<Path> excludes) throws IOException { Preconditions.checkNotNull(source); Preconditions.checkNotNull(destination); Preconditions.checkArgument(Files.isDirectory(source), "Source is not a directory"); Preconditions.checkArgument(Files.isDirectory(destination), "Destination is not a directory"); Preconditions.checkArgument( !Files.isSameFile(source, destination), "Source and destination are the same"); Preconditions.checkArgument( !destination.toAbsolutePath().startsWith(source.toAbsolutePath()), "destination is child of source"); Files.walkFileTree( source, new SimpleFileVisitor<Path>() { final CopyOption[] copyOptions = new CopyOption[] {StandardCopyOption.COPY_ATTRIBUTES}; @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (dir.equals(source)) { return FileVisitResult.CONTINUE; } if (excludes.contains(dir)) { return FileVisitResult.SKIP_SUBTREE; } Files.copy(dir, destination.resolve(source.relativize(dir)), copyOptions); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (excludes.contains(file)) { return FileVisitResult.CONTINUE; } Files.copy(file, destination.resolve(source.relativize(file)), copyOptions); return FileVisitResult.CONTINUE; } }); }
java
public static void copyDirectory(final Path source, final Path destination, List<Path> excludes) throws IOException { Preconditions.checkNotNull(source); Preconditions.checkNotNull(destination); Preconditions.checkArgument(Files.isDirectory(source), "Source is not a directory"); Preconditions.checkArgument(Files.isDirectory(destination), "Destination is not a directory"); Preconditions.checkArgument( !Files.isSameFile(source, destination), "Source and destination are the same"); Preconditions.checkArgument( !destination.toAbsolutePath().startsWith(source.toAbsolutePath()), "destination is child of source"); Files.walkFileTree( source, new SimpleFileVisitor<Path>() { final CopyOption[] copyOptions = new CopyOption[] {StandardCopyOption.COPY_ATTRIBUTES}; @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (dir.equals(source)) { return FileVisitResult.CONTINUE; } if (excludes.contains(dir)) { return FileVisitResult.SKIP_SUBTREE; } Files.copy(dir, destination.resolve(source.relativize(dir)), copyOptions); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (excludes.contains(file)) { return FileVisitResult.CONTINUE; } Files.copy(file, destination.resolve(source.relativize(file)), copyOptions); return FileVisitResult.CONTINUE; } }); }
[ "public", "static", "void", "copyDirectory", "(", "final", "Path", "source", ",", "final", "Path", "destination", ",", "List", "<", "Path", ">", "excludes", ")", "throws", "IOException", "{", "Preconditions", ".", "checkNotNull", "(", "source", ")", ";", "Pr...
Implementation of recursive directory copy, does NOT overwrite. @param source an existing source directory to copy from @param destination an existing destination directory to copy to @param excludes a list of paths in "source" to exclude @throws IllegalArgumentException if source directory is same destination directory, either source or destination is not a directory, or destination is inside source
[ "Implementation", "of", "recursive", "directory", "copy", "does", "NOT", "overwrite", "." ]
train
https://github.com/GoogleCloudPlatform/appengine-plugins-core/blob/d22e9fa1103522409ab6fdfbf68c4a5a0bc5b97d/src/main/java/com/google/cloud/tools/io/FileUtil.java#L57-L102
acromusashi/acromusashi-stream
src/main/java/acromusashi/stream/bolt/AmBaseBolt.java
AmBaseBolt.emitWithOnlyAnchorAndGrouping
protected void emitWithOnlyAnchorAndGrouping(StreamMessage message, String groupingKey) { getCollector().emit(this.getExecutingTuple(), new Values(groupingKey, message)); }
java
protected void emitWithOnlyAnchorAndGrouping(StreamMessage message, String groupingKey) { getCollector().emit(this.getExecutingTuple(), new Values(groupingKey, message)); }
[ "protected", "void", "emitWithOnlyAnchorAndGrouping", "(", "StreamMessage", "message", ",", "String", "groupingKey", ")", "{", "getCollector", "(", ")", ".", "emit", "(", "this", ".", "getExecutingTuple", "(", ")", ",", "new", "Values", "(", "groupingKey", ",", ...
Use anchor function(child message failed. notify fail to parent message.), and not use this class's key history function.<br> Send message to downstream component with grouping key.<br> Use following situation. <ol> <li>Not use this class's key history function.</li> <li>Use storm's fault detect function.</li> </ol> @param message sending message @param groupingKey grouping key
[ "Use", "anchor", "function", "(", "child", "message", "failed", ".", "notify", "fail", "to", "parent", "message", ".", ")", "and", "not", "use", "this", "class", "s", "key", "history", "function", ".", "<br", ">", "Send", "message", "to", "downstream", "...
train
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/bolt/AmBaseBolt.java#L688-L691
alkacon/opencms-core
src/org/opencms/ui/components/CmsInfoButton.java
CmsInfoButton.replaceData
public void replaceData(Map<String, String> data) { removeClickListener(m_clickListener); m_clickListener = getClickListener(getHtmlLines(data), m_additionalElements); addClickListener(m_clickListener); }
java
public void replaceData(Map<String, String> data) { removeClickListener(m_clickListener); m_clickListener = getClickListener(getHtmlLines(data), m_additionalElements); addClickListener(m_clickListener); }
[ "public", "void", "replaceData", "(", "Map", "<", "String", ",", "String", ">", "data", ")", "{", "removeClickListener", "(", "m_clickListener", ")", ";", "m_clickListener", "=", "getClickListener", "(", "getHtmlLines", "(", "data", ")", ",", "m_additionalElemen...
Replaces current Map with new map.<p> @param data to replace the old map
[ "Replaces", "current", "Map", "with", "new", "map", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsInfoButton.java#L191-L197
landawn/AbacusUtil
src/com/landawn/abacus/util/ExceptionalStream.java
ExceptionalStream.distinctBy
public ExceptionalStream<T, E> distinctBy(final Try.Function<? super T, ?, ? extends E> keyMapper) { checkArgNotNull(keyMapper, "keyMapper"); final Set<Object> set = new HashSet<>(); return filter(new Try.Predicate<T, E>() { @Override public boolean test(T value) throws E { return set.add(hashKey(keyMapper.apply(value))); } }); }
java
public ExceptionalStream<T, E> distinctBy(final Try.Function<? super T, ?, ? extends E> keyMapper) { checkArgNotNull(keyMapper, "keyMapper"); final Set<Object> set = new HashSet<>(); return filter(new Try.Predicate<T, E>() { @Override public boolean test(T value) throws E { return set.add(hashKey(keyMapper.apply(value))); } }); }
[ "public", "ExceptionalStream", "<", "T", ",", "E", ">", "distinctBy", "(", "final", "Try", ".", "Function", "<", "?", "super", "T", ",", "?", ",", "?", "extends", "E", ">", "keyMapper", ")", "{", "checkArgNotNull", "(", "keyMapper", ",", "\"keyMapper\"",...
Distinct by the value mapped from <code>keyMapper</code> @param keyMapper don't change value of the input parameter. @return
[ "Distinct", "by", "the", "value", "mapped", "from", "<code", ">", "keyMapper<", "/", "code", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/ExceptionalStream.java#L1002-L1013
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/RequireExpansionCompilerPass.java
RequireExpansionCompilerPass.createRequireExpansionPlaceHolderNode
private Node createRequireExpansionPlaceHolderNode(int index) { String varName = JavaScriptModuleBuilder.EXPDEPS_VARNAME + getPadding(index); Node nameNode = Node.newString(Token.NAME, varName); nameNode.putProp(Node.ORIGINALNAME_PROP, varName); return new Node(Token.GETELEM, new Node(Token.GETELEM, nameNode, Node.newNumber(0)), Node.newNumber(index)); }
java
private Node createRequireExpansionPlaceHolderNode(int index) { String varName = JavaScriptModuleBuilder.EXPDEPS_VARNAME + getPadding(index); Node nameNode = Node.newString(Token.NAME, varName); nameNode.putProp(Node.ORIGINALNAME_PROP, varName); return new Node(Token.GETELEM, new Node(Token.GETELEM, nameNode, Node.newNumber(0)), Node.newNumber(index)); }
[ "private", "Node", "createRequireExpansionPlaceHolderNode", "(", "int", "index", ")", "{", "String", "varName", "=", "JavaScriptModuleBuilder", ".", "EXPDEPS_VARNAME", "+", "getPadding", "(", "index", ")", ";", "Node", "nameNode", "=", "Node", ".", "newString", "(...
Creates a var reference node for the require expansion place holder variable with the given index. The node will correspond to javascript source similar to <code>_&&JAGGR_DEPS___[0][3]</code>, where 3 is the specified index. <p> The underscores preceding the first array index are of variable length for the purpose of keeping the source code representation of the reference constant length. For example, if index is 125, then the reference will be <code>_&&JAGGR_DEPS_[0][125]</code>. Index values greater than 999 will throw error. <p> This is done so that when the module relative index is replace with a layer relative index by the layer builder, the length of the source code index value can change without changing the code size of the reference. This is necessary to avoid invalidating source maps @param index the index value @throws IllegalArgumentException if index >= 999 @return a node for the place holder reference.
[ "Creates", "a", "var", "reference", "node", "for", "the", "require", "expansion", "place", "holder", "variable", "with", "the", "given", "index", ".", "The", "node", "will", "correspond", "to", "javascript", "source", "similar", "to", "<code", ">", "_&&JAGGR_D...
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/RequireExpansionCompilerPass.java#L479-L484
line/armeria
spring/boot-webflux-autoconfigure/src/main/java/com/linecorp/armeria/spring/web/reactive/ArmeriaClientAutoConfiguration.java
ArmeriaClientAutoConfiguration.clientHttpConnector
@Bean public ClientHttpConnector clientHttpConnector( List<ArmeriaClientConfigurator> customizer, DataBufferFactoryWrapper<?> factoryWrapper) { return new ArmeriaClientHttpConnector(customizer, factoryWrapper); }
java
@Bean public ClientHttpConnector clientHttpConnector( List<ArmeriaClientConfigurator> customizer, DataBufferFactoryWrapper<?> factoryWrapper) { return new ArmeriaClientHttpConnector(customizer, factoryWrapper); }
[ "@", "Bean", "public", "ClientHttpConnector", "clientHttpConnector", "(", "List", "<", "ArmeriaClientConfigurator", ">", "customizer", ",", "DataBufferFactoryWrapper", "<", "?", ">", "factoryWrapper", ")", "{", "return", "new", "ArmeriaClientHttpConnector", "(", "custom...
Returns a {@link ClientHttpConnector} which is configured by a list of {@link ArmeriaClientConfigurator}s.
[ "Returns", "a", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/spring/boot-webflux-autoconfigure/src/main/java/com/linecorp/armeria/spring/web/reactive/ArmeriaClientAutoConfiguration.java#L44-L49
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_responder_account_GET
public OvhResponder domain_responder_account_GET(String domain, String account) throws IOException { String qPath = "/email/domain/{domain}/responder/{account}"; StringBuilder sb = path(qPath, domain, account); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhResponder.class); }
java
public OvhResponder domain_responder_account_GET(String domain, String account) throws IOException { String qPath = "/email/domain/{domain}/responder/{account}"; StringBuilder sb = path(qPath, domain, account); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhResponder.class); }
[ "public", "OvhResponder", "domain_responder_account_GET", "(", "String", "domain", ",", "String", "account", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/responder/{account}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath...
Get this object properties REST: GET /email/domain/{domain}/responder/{account} @param domain [required] Name of your domain name @param account [required] Name of account
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L950-L955
wildfly-swarm-archive/ARCHIVE-wildfly-swarm
logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java
LoggingFraction.consoleHandler
public LoggingFraction consoleHandler(Level level, String formatter) { consoleHandler(new ConsoleHandler(CONSOLE) .level(level) .namedFormatter(formatter)); return this; }
java
public LoggingFraction consoleHandler(Level level, String formatter) { consoleHandler(new ConsoleHandler(CONSOLE) .level(level) .namedFormatter(formatter)); return this; }
[ "public", "LoggingFraction", "consoleHandler", "(", "Level", "level", ",", "String", "formatter", ")", "{", "consoleHandler", "(", "new", "ConsoleHandler", "(", "CONSOLE", ")", ".", "level", "(", "level", ")", ".", "namedFormatter", "(", "formatter", ")", ")",...
Add a ConsoleHandler to the list of handlers for this logger. @param level The logging level @param formatter A pattern string for the console's formatter @return This fraction
[ "Add", "a", "ConsoleHandler", "to", "the", "list", "of", "handlers", "for", "this", "logger", "." ]
train
https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java#L194-L199
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/recovery/RecoveryHelper.java
RecoveryHelper.persistFile
public boolean persistFile(State state, CopyableFile file, Path path) throws IOException { if (!this.persistDir.isPresent()) { return false; } String guid = computeGuid(state, file); Path guidPath = new Path(this.persistDir.get(), guid); if (!this.fs.exists(guidPath)) { this.fs.mkdirs(guidPath, new FsPermission(FsAction.ALL, FsAction.READ, FsAction.NONE)); } Path targetPath = new Path(guidPath, shortenPathName(file.getOrigin().getPath(), 250 - guid.length())); log.info(String.format("Persisting file %s with guid %s to location %s.", path, guid, targetPath)); if (this.fs.rename(path, targetPath)) { this.fs.setTimes(targetPath, System.currentTimeMillis(), -1); return true; } return false; }
java
public boolean persistFile(State state, CopyableFile file, Path path) throws IOException { if (!this.persistDir.isPresent()) { return false; } String guid = computeGuid(state, file); Path guidPath = new Path(this.persistDir.get(), guid); if (!this.fs.exists(guidPath)) { this.fs.mkdirs(guidPath, new FsPermission(FsAction.ALL, FsAction.READ, FsAction.NONE)); } Path targetPath = new Path(guidPath, shortenPathName(file.getOrigin().getPath(), 250 - guid.length())); log.info(String.format("Persisting file %s with guid %s to location %s.", path, guid, targetPath)); if (this.fs.rename(path, targetPath)) { this.fs.setTimes(targetPath, System.currentTimeMillis(), -1); return true; } return false; }
[ "public", "boolean", "persistFile", "(", "State", "state", ",", "CopyableFile", "file", ",", "Path", "path", ")", "throws", "IOException", "{", "if", "(", "!", "this", ".", "persistDir", ".", "isPresent", "(", ")", ")", "{", "return", "false", ";", "}", ...
Moves a copied path into a persistent location managed by gobblin-distcp. This method is used when an already copied file cannot be successfully published. In future runs, instead of re-copying the file, distcp will use the persisted file. @param state {@link State} containing job information. @param file {@link org.apache.gobblin.data.management.copy.CopyEntity} from which input {@link Path} originated. @param path {@link Path} to persist. @return true if persist was successful. @throws IOException
[ "Moves", "a", "copied", "path", "into", "a", "persistent", "location", "managed", "by", "gobblin", "-", "distcp", ".", "This", "method", "is", "used", "when", "an", "already", "copied", "file", "cannot", "be", "successfully", "published", ".", "In", "future"...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/recovery/RecoveryHelper.java#L88-L108
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java
AppServiceCertificateOrdersInner.resendRequestEmails
public void resendRequestEmails(String resourceGroupName, String certificateOrderName) { resendRequestEmailsWithServiceResponseAsync(resourceGroupName, certificateOrderName).toBlocking().single().body(); }
java
public void resendRequestEmails(String resourceGroupName, String certificateOrderName) { resendRequestEmailsWithServiceResponseAsync(resourceGroupName, certificateOrderName).toBlocking().single().body(); }
[ "public", "void", "resendRequestEmails", "(", "String", "resourceGroupName", ",", "String", "certificateOrderName", ")", "{", "resendRequestEmailsWithServiceResponseAsync", "(", "resourceGroupName", ",", "certificateOrderName", ")", ".", "toBlocking", "(", ")", ".", "sing...
Verify domain ownership for this certificate order. Verify domain ownership for this certificate order. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @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
[ "Verify", "domain", "ownership", "for", "this", "certificate", "order", ".", "Verify", "domain", "ownership", "for", "this", "certificate", "order", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L1866-L1868
pravega/pravega
common/src/main/java/io/pravega/common/util/HashedArray.java
HashedArray.arrayEquals
public static boolean arrayEquals(ArrayView av1, ArrayView av2) { int len = av1.getLength(); if (len != av2.getLength()) { return false; } byte[] a1 = av1.array(); int o1 = av1.arrayOffset(); byte[] a2 = av2.array(); int o2 = av2.arrayOffset(); for (int i = 0; i < len; i++) { if (a1[o1 + i] != a2[o2 + i]) { return false; } } return true; }
java
public static boolean arrayEquals(ArrayView av1, ArrayView av2) { int len = av1.getLength(); if (len != av2.getLength()) { return false; } byte[] a1 = av1.array(); int o1 = av1.arrayOffset(); byte[] a2 = av2.array(); int o2 = av2.arrayOffset(); for (int i = 0; i < len; i++) { if (a1[o1 + i] != a2[o2 + i]) { return false; } } return true; }
[ "public", "static", "boolean", "arrayEquals", "(", "ArrayView", "av1", ",", "ArrayView", "av2", ")", "{", "int", "len", "=", "av1", ".", "getLength", "(", ")", ";", "if", "(", "len", "!=", "av2", ".", "getLength", "(", ")", ")", "{", "return", "false...
Determines if the given {@link ArrayView} instances contain the same data. @param av1 The first instance. @param av2 The second instance. @return True if both instances have the same length and contain the same data.
[ "Determines", "if", "the", "given", "{", "@link", "ArrayView", "}", "instances", "contain", "the", "same", "data", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/HashedArray.java#L78-L95
mfornos/humanize
humanize-slim/src/main/java/humanize/Humanize.java
Humanize.decimalFormat
public static DecimalFormat decimalFormat(final String pattern, final Locale locale) { return withinLocale(new Callable<DecimalFormat>() { public DecimalFormat call() throws Exception { return decimalFormat(pattern); } }, locale); }
java
public static DecimalFormat decimalFormat(final String pattern, final Locale locale) { return withinLocale(new Callable<DecimalFormat>() { public DecimalFormat call() throws Exception { return decimalFormat(pattern); } }, locale); }
[ "public", "static", "DecimalFormat", "decimalFormat", "(", "final", "String", "pattern", ",", "final", "Locale", "locale", ")", "{", "return", "withinLocale", "(", "new", "Callable", "<", "DecimalFormat", ">", "(", ")", "{", "public", "DecimalFormat", "call", ...
<p> Same as {@link #decimalFormat(String)} for the specified locale. </p> @param pattern Format pattern that follows the conventions of {@link java.text.DecimalFormat DecimalFormat} @param locale Target locale @return a DecimalFormat instance for the current thread
[ "<p", ">", "Same", "as", "{", "@link", "#decimalFormat", "(", "String", ")", "}", "for", "the", "specified", "locale", ".", "<", "/", "p", ">" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L692-L705
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/dataconversion/StandardConversions.java
StandardConversions.convertJavaToText
public static byte[] convertJavaToText(Object source, MediaType sourceMediaType, MediaType destinationMediaType) { if (source == null) return null; if (sourceMediaType == null || destinationMediaType == null) { throw new NullPointerException("sourceMediaType and destinationMediaType cannot be null!"); } Object decoded = decodeObjectContent(source, sourceMediaType); if (decoded instanceof byte[]) { return convertCharset(source, StandardCharsets.UTF_8, destinationMediaType.getCharset()); } else { String asString = decoded.toString(); return asString.getBytes(destinationMediaType.getCharset()); } }
java
public static byte[] convertJavaToText(Object source, MediaType sourceMediaType, MediaType destinationMediaType) { if (source == null) return null; if (sourceMediaType == null || destinationMediaType == null) { throw new NullPointerException("sourceMediaType and destinationMediaType cannot be null!"); } Object decoded = decodeObjectContent(source, sourceMediaType); if (decoded instanceof byte[]) { return convertCharset(source, StandardCharsets.UTF_8, destinationMediaType.getCharset()); } else { String asString = decoded.toString(); return asString.getBytes(destinationMediaType.getCharset()); } }
[ "public", "static", "byte", "[", "]", "convertJavaToText", "(", "Object", "source", ",", "MediaType", "sourceMediaType", ",", "MediaType", "destinationMediaType", ")", "{", "if", "(", "source", "==", "null", ")", "return", "null", ";", "if", "(", "sourceMediaT...
Converts a java object to a text/plain representation. @param source Object to convert. @param sourceMediaType The MediaType for the source object. @param destinationMediaType The required text/plain specification. @return byte[] with the text/plain representation of the object with the requested charset.
[ "Converts", "a", "java", "object", "to", "a", "text", "/", "plain", "representation", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/dataconversion/StandardConversions.java#L182-L195
googleads/googleads-java-lib
examples/adwords_axis/src/main/java/adwords/axis/v201809/advancedoperations/UsePortfolioBiddingStrategy.java
UsePortfolioBiddingStrategy.createSharedBudget
private static Budget createSharedBudget( AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException { // Get the BudgetService, which loads the required classes. BudgetServiceInterface budgetService = adWordsServices.get(session, BudgetServiceInterface.class); // Create a shared budget. Budget budget = new Budget(); budget.setName("Shared Interplanetary Budget #" + System.currentTimeMillis()); budget.setAmount(new Money(null, 50000000L)); budget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD); budget.setIsExplicitlyShared(true); BudgetOperation operation = new BudgetOperation(); operation.setOperand(budget); operation.setOperator(Operator.ADD); BudgetOperation[] operations = new BudgetOperation[] {operation}; // Make the mutate request. BudgetReturnValue result = budgetService.mutate(operations); Budget newBudget = result.getValue(0); System.out.printf("Budget with name '%s', ID %d was created.%n", newBudget.getName(), newBudget.getBudgetId()); return newBudget; }
java
private static Budget createSharedBudget( AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException { // Get the BudgetService, which loads the required classes. BudgetServiceInterface budgetService = adWordsServices.get(session, BudgetServiceInterface.class); // Create a shared budget. Budget budget = new Budget(); budget.setName("Shared Interplanetary Budget #" + System.currentTimeMillis()); budget.setAmount(new Money(null, 50000000L)); budget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD); budget.setIsExplicitlyShared(true); BudgetOperation operation = new BudgetOperation(); operation.setOperand(budget); operation.setOperator(Operator.ADD); BudgetOperation[] operations = new BudgetOperation[] {operation}; // Make the mutate request. BudgetReturnValue result = budgetService.mutate(operations); Budget newBudget = result.getValue(0); System.out.printf("Budget with name '%s', ID %d was created.%n", newBudget.getName(), newBudget.getBudgetId()); return newBudget; }
[ "private", "static", "Budget", "createSharedBudget", "(", "AdWordsServicesInterface", "adWordsServices", ",", "AdWordsSession", "session", ")", "throws", "RemoteException", "{", "// Get the BudgetService, which loads the required classes.", "BudgetServiceInterface", "budgetService", ...
Creates an explicit budget to be used only to create the Campaign. @param adWordsServices the user to run the example with @param session the AdWordsSession @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Creates", "an", "explicit", "budget", "to", "be", "used", "only", "to", "create", "the", "Campaign", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/adwords_axis/src/main/java/adwords/axis/v201809/advancedoperations/UsePortfolioBiddingStrategy.java#L195-L222
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/RepositoryTags.java
RepositoryTags.getAttribute
public String getAttribute(int elementId, String value) { return table.getKeyByValue(new Integer(elementId)) + "=\"" + value + "\""; }
java
public String getAttribute(int elementId, String value) { return table.getKeyByValue(new Integer(elementId)) + "=\"" + value + "\""; }
[ "public", "String", "getAttribute", "(", "int", "elementId", ",", "String", "value", ")", "{", "return", "table", ".", "getKeyByValue", "(", "new", "Integer", "(", "elementId", ")", ")", "+", "\"=\\\"\"", "+", "value", "+", "\"\\\"\"", ";", "}" ]
returns the opening but non-closing xml-tag associated with the repository element with id <code>elementId</code>. @return the resulting tag
[ "returns", "the", "opening", "but", "non", "-", "closing", "xml", "-", "tag", "associated", "with", "the", "repository", "element", "with", "id", "<code", ">", "elementId<", "/", "code", ">", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/RepositoryTags.java#L242-L245
looly/hutool
hutool-db/src/main/java/cn/hutool/db/Db.java
Db.tx
public Db tx(TransactionLevel transactionLevel, VoidFunc1<Db> func) throws SQLException { final Connection conn = getConnection(); // 检查是否支持事务 checkTransactionSupported(conn); // 设置事务级别 if (null != transactionLevel) { final int level = transactionLevel.getLevel(); if (conn.getTransactionIsolation() < level) { // 用户定义的事务级别如果比默认级别更严格,则按照严格的级别进行 conn.setTransactionIsolation(level); } } // 开始事务 boolean autoCommit = conn.getAutoCommit(); if (autoCommit) { conn.setAutoCommit(false); } // 执行事务 try { func.call(this); // 提交 conn.commit(); } catch (Throwable e) { quietRollback(conn); throw (e instanceof SQLException) ? (SQLException) e : new SQLException(e); } finally { // 还原事务状态 quietSetAutoCommit(conn, autoCommit); // 关闭连接或将连接归还连接池 closeConnection(conn); } return this; }
java
public Db tx(TransactionLevel transactionLevel, VoidFunc1<Db> func) throws SQLException { final Connection conn = getConnection(); // 检查是否支持事务 checkTransactionSupported(conn); // 设置事务级别 if (null != transactionLevel) { final int level = transactionLevel.getLevel(); if (conn.getTransactionIsolation() < level) { // 用户定义的事务级别如果比默认级别更严格,则按照严格的级别进行 conn.setTransactionIsolation(level); } } // 开始事务 boolean autoCommit = conn.getAutoCommit(); if (autoCommit) { conn.setAutoCommit(false); } // 执行事务 try { func.call(this); // 提交 conn.commit(); } catch (Throwable e) { quietRollback(conn); throw (e instanceof SQLException) ? (SQLException) e : new SQLException(e); } finally { // 还原事务状态 quietSetAutoCommit(conn, autoCommit); // 关闭连接或将连接归还连接池 closeConnection(conn); } return this; }
[ "public", "Db", "tx", "(", "TransactionLevel", "transactionLevel", ",", "VoidFunc1", "<", "Db", ">", "func", ")", "throws", "SQLException", "{", "final", "Connection", "conn", "=", "getConnection", "(", ")", ";", "// 检查是否支持事务\r", "checkTransactionSupported", "(", ...
执行事务<br> 在同一事务中,所有对数据库操作都是原子的,同时提交或者同时回滚 @param transactionLevel 事务级别枚举,null表示使用JDBC默认事务 @param func 事务函数,所有操作应在同一函数下执行,确保在同一事务中 @return this @throws SQLException SQL异常
[ "执行事务<br", ">", "在同一事务中,所有对数据库操作都是原子的,同时提交或者同时回滚" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Db.java#L167-L204
alipay/sofa-rpc
extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperConfigObserver.java
ZookeeperConfigObserver.addConfigListener
public void addConfigListener(AbstractInterfaceConfig config, ConfigListener listener) { if (listener != null) { RegistryUtils.initOrAddList(configListenerMap, config, listener); } }
java
public void addConfigListener(AbstractInterfaceConfig config, ConfigListener listener) { if (listener != null) { RegistryUtils.initOrAddList(configListenerMap, config, listener); } }
[ "public", "void", "addConfigListener", "(", "AbstractInterfaceConfig", "config", ",", "ConfigListener", "listener", ")", "{", "if", "(", "listener", "!=", "null", ")", "{", "RegistryUtils", ".", "initOrAddList", "(", "configListenerMap", ",", "config", ",", "liste...
Add config listener. @param config the config @param listener the listener
[ "Add", "config", "listener", "." ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperConfigObserver.java#L57-L61
teatrove/teatrove
build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/teadoc/ClassDoc.java
ClassDoc.findMatchingMethod
public MethodDoc findMatchingMethod(MethodDoc method, MethodFinder mf) { // Look in this class's interface set MethodDoc md = findMatchingInterfaceMethod(method, mf); if (md != null) { return md; } // Look in this class's superclass ancestry ClassDoc superClass = getSuperclass(); if (superClass != null) { md = superClass.getMatchingMethod(method, mf); if (md != null) { return md; } return superClass.findMatchingMethod(method, mf); } return null; }
java
public MethodDoc findMatchingMethod(MethodDoc method, MethodFinder mf) { // Look in this class's interface set MethodDoc md = findMatchingInterfaceMethod(method, mf); if (md != null) { return md; } // Look in this class's superclass ancestry ClassDoc superClass = getSuperclass(); if (superClass != null) { md = superClass.getMatchingMethod(method, mf); if (md != null) { return md; } return superClass.findMatchingMethod(method, mf); } return null; }
[ "public", "MethodDoc", "findMatchingMethod", "(", "MethodDoc", "method", ",", "MethodFinder", "mf", ")", "{", "// Look in this class's interface set", "MethodDoc", "md", "=", "findMatchingInterfaceMethod", "(", "method", ",", "mf", ")", ";", "if", "(", "md", "!=", ...
Find a MethodDoc with a name and signature matching that of the specified MethodDoc and accepted by the specified MethodFinder. This method searches the interfaces and super class ancestry of the class represented by this ClassDoc for a matching method.
[ "Find", "a", "MethodDoc", "with", "a", "name", "and", "signature", "matching", "that", "of", "the", "specified", "MethodDoc", "and", "accepted", "by", "the", "specified", "MethodFinder", ".", "This", "method", "searches", "the", "interfaces", "and", "super", "...
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/teadoc/ClassDoc.java#L277-L299
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.unionWorkSheetsRowJoin
static public WorkSheet unionWorkSheetsRowJoin(String w1FileName, String w2FileName, char delimitter, boolean secondSheetMetaData) throws Exception { WorkSheet w1 = WorkSheet.readCSV(w1FileName, delimitter); WorkSheet w2 = WorkSheet.readCSV(w2FileName, delimitter); return unionWorkSheetsRowJoin(w1, w2, secondSheetMetaData); }
java
static public WorkSheet unionWorkSheetsRowJoin(String w1FileName, String w2FileName, char delimitter, boolean secondSheetMetaData) throws Exception { WorkSheet w1 = WorkSheet.readCSV(w1FileName, delimitter); WorkSheet w2 = WorkSheet.readCSV(w2FileName, delimitter); return unionWorkSheetsRowJoin(w1, w2, secondSheetMetaData); }
[ "static", "public", "WorkSheet", "unionWorkSheetsRowJoin", "(", "String", "w1FileName", ",", "String", "w2FileName", ",", "char", "delimitter", ",", "boolean", "secondSheetMetaData", ")", "throws", "Exception", "{", "WorkSheet", "w1", "=", "WorkSheet", ".", "readCSV...
Combine two work sheets where you join based on rows. Rows that are found in one but not the other are removed. If the second sheet is meta data then a meta data column will be added between the two joined columns @param w1FileName @param w2FileName @param delimitter @param secondSheetMetaData @return @throws Exception
[ "Combine", "two", "work", "sheets", "where", "you", "join", "based", "on", "rows", ".", "Rows", "that", "are", "found", "in", "one", "but", "not", "the", "other", "are", "removed", ".", "If", "the", "second", "sheet", "is", "meta", "data", "then", "a",...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1358-L1363
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java
Instance.setTags
public Operation setTags(Tags tags, OperationOption... options) { return compute.setTags(getInstanceId(), tags, options); }
java
public Operation setTags(Tags tags, OperationOption... options) { return compute.setTags(getInstanceId(), tags, options); }
[ "public", "Operation", "setTags", "(", "Tags", "tags", ",", "OperationOption", "...", "options", ")", "{", "return", "compute", ".", "setTags", "(", "getInstanceId", "(", ")", ",", "tags", ",", "options", ")", ";", "}" ]
Sets the tags for this instance. @return a zone operation if the set request was issued correctly, {@code null} if the instance was not found @throws ComputeException upon failure
[ "Sets", "the", "tags", "for", "this", "instance", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L393-L395
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PlainChangesLogImpl.java
PlainChangesLogImpl.createCopy
public static PlainChangesLogImpl createCopy(List<ItemState> items, PlainChangesLog originalLog) { return createCopy(items, originalLog.getPairId(), originalLog); }
java
public static PlainChangesLogImpl createCopy(List<ItemState> items, PlainChangesLog originalLog) { return createCopy(items, originalLog.getPairId(), originalLog); }
[ "public", "static", "PlainChangesLogImpl", "createCopy", "(", "List", "<", "ItemState", ">", "items", ",", "PlainChangesLog", "originalLog", ")", "{", "return", "createCopy", "(", "items", ",", "originalLog", ".", "getPairId", "(", ")", ",", "originalLog", ")", ...
Creates a new instance of {@link PlainChangesLogImpl} by copying metadata from originalLog instance with Items provided. @param items @param originalLog @return
[ "Creates", "a", "new", "instance", "of", "{", "@link", "PlainChangesLogImpl", "}", "by", "copying", "metadata", "from", "originalLog", "instance", "with", "Items", "provided", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PlainChangesLogImpl.java#L335-L338
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/Utils.java
Utils.getImpl
protected static Object getImpl(String className, Class[] types, Object[] args) { // No tracing as this is used to load the trace factory. Object Impl; // For return. try { Class classToInstantiate = Class.forName(className); java.lang.reflect.Constructor constructor = classToInstantiate.getDeclaredConstructor(types); constructor.setAccessible(true); Impl = constructor.newInstance(args); } catch (Exception exception) { // No FFDC Code Needed. // We may not have any FFDC instantiated so simply print the stack. exception.printStackTrace(new java.io.PrintWriter(System.out, true)); // Assume we have no chained exception support. throw new Error(exception.toString()); } // catch. return Impl; }
java
protected static Object getImpl(String className, Class[] types, Object[] args) { // No tracing as this is used to load the trace factory. Object Impl; // For return. try { Class classToInstantiate = Class.forName(className); java.lang.reflect.Constructor constructor = classToInstantiate.getDeclaredConstructor(types); constructor.setAccessible(true); Impl = constructor.newInstance(args); } catch (Exception exception) { // No FFDC Code Needed. // We may not have any FFDC instantiated so simply print the stack. exception.printStackTrace(new java.io.PrintWriter(System.out, true)); // Assume we have no chained exception support. throw new Error(exception.toString()); } // catch. return Impl; }
[ "protected", "static", "Object", "getImpl", "(", "String", "className", ",", "Class", "[", "]", "types", ",", "Object", "[", "]", "args", ")", "{", "// No tracing as this is used to load the trace factory.", "Object", "Impl", ";", "// For return.", "try", "{", "Cl...
Create a platform specific instance of a utils class. @param className the simple name of the class whois implementation is to be found. @param types used to select the constructor. @param args used to invoke the constructor. @return Object the utils class loaded.
[ "Create", "a", "platform", "specific", "instance", "of", "a", "utils", "class", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/Utils.java#L34-L53
alkacon/opencms-core
src/org/opencms/file/collectors/CmsSubscriptionCollector.java
CmsSubscriptionCollector.getCalculatedTime
private long getCalculatedTime(long baseTime, String deltaDays, String key, long defaultTime) { try { long days = Long.parseLong(deltaDays); long delta = 1000L * 60L * 60L * 24L * days; long result = baseTime - delta; if (result >= 0) { // result is a valid time stamp return result; } } catch (NumberFormatException e) { LOG.error(Messages.get().getBundle().key(Messages.ERR_COLLECTOR_PARAM_INVALID_1, key + "=" + deltaDays)); } return defaultTime; }
java
private long getCalculatedTime(long baseTime, String deltaDays, String key, long defaultTime) { try { long days = Long.parseLong(deltaDays); long delta = 1000L * 60L * 60L * 24L * days; long result = baseTime - delta; if (result >= 0) { // result is a valid time stamp return result; } } catch (NumberFormatException e) { LOG.error(Messages.get().getBundle().key(Messages.ERR_COLLECTOR_PARAM_INVALID_1, key + "=" + deltaDays)); } return defaultTime; }
[ "private", "long", "getCalculatedTime", "(", "long", "baseTime", ",", "String", "deltaDays", ",", "String", "key", ",", "long", "defaultTime", ")", "{", "try", "{", "long", "days", "=", "Long", ".", "parseLong", "(", "deltaDays", ")", ";", "long", "delta",...
Returns the calculated time with the days delta using the base time.<p> @param baseTime the base time to calculate the returned time from @param deltaDays the number of days which should be subtracted from the base time @param key the parameter key name used for error messages @param defaultTime the default time is used if there were errors calculating the resulting time @return the calculated time
[ "Returns", "the", "calculated", "time", "with", "the", "days", "delta", "using", "the", "base", "time", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/collectors/CmsSubscriptionCollector.java#L381-L395
tzaeschke/zoodb
src/org/zoodb/internal/util/BucketTreeStack.java
BucketTreeStack.set
public E set(int index, E e) { rangeCheck(index); return addElement(bucket, bucketDepth, index, e); }
java
public E set(int index, E e) { rangeCheck(index); return addElement(bucket, bucketDepth, index, e); }
[ "public", "E", "set", "(", "int", "index", ",", "E", "e", ")", "{", "rangeCheck", "(", "index", ")", ";", "return", "addElement", "(", "bucket", ",", "bucketDepth", ",", "index", ",", "e", ")", ";", "}" ]
Replaces the element at the specified position in this list with the specified element. @param index index of the element to replace @param e element to be stored at the specified position @return the element previously at the specified position @throws IndexOutOfBoundsException If the index exceed the index size
[ "Replaces", "the", "element", "at", "the", "specified", "position", "in", "this", "list", "with", "the", "specified", "element", "." ]
train
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/BucketTreeStack.java#L167-L171
apache/groovy
src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
IOGroovyMethods.withObjectOutputStream
public static <T> T withObjectOutputStream(OutputStream outputStream, @ClosureParams(value=SimpleType.class, options="java.io.ObjectOutputStream") Closure<T> closure) throws IOException { return withStream(newObjectOutputStream(outputStream), closure); }
java
public static <T> T withObjectOutputStream(OutputStream outputStream, @ClosureParams(value=SimpleType.class, options="java.io.ObjectOutputStream") Closure<T> closure) throws IOException { return withStream(newObjectOutputStream(outputStream), closure); }
[ "public", "static", "<", "T", ">", "T", "withObjectOutputStream", "(", "OutputStream", "outputStream", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.ObjectOutputStream\"", ")", "Closure", "<", "T", ">",...
Create a new ObjectOutputStream for this output stream and then pass it to the closure. This method ensures the stream is closed after the closure returns. @param outputStream am output stream @param closure a closure @return the value returned by the closure @throws IOException if an IOException occurs. @see #withStream(java.io.OutputStream, groovy.lang.Closure) @since 1.5.0
[ "Create", "a", "new", "ObjectOutputStream", "for", "this", "output", "stream", "and", "then", "pass", "it", "to", "the", "closure", ".", "This", "method", "ensures", "the", "stream", "is", "closed", "after", "the", "closure", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L255-L257
Javacord/Javacord
javacord-api/src/main/java/org/javacord/api/entity/emoji/CustomEmojiBuilder.java
CustomEmojiBuilder.setImage
public CustomEmojiBuilder setImage(InputStream image, String type) { delegate.setImage(image, type); return this; }
java
public CustomEmojiBuilder setImage(InputStream image, String type) { delegate.setImage(image, type); return this; }
[ "public", "CustomEmojiBuilder", "setImage", "(", "InputStream", "image", ",", "String", "type", ")", "{", "delegate", ".", "setImage", "(", "image", ",", "type", ")", ";", "return", "this", ";", "}" ]
Sets the image of the emoji. @param image The image of the emoji. @param type The type of the image, e.g. "png", "jpg" or "gif". @return The current instance in order to chain call methods.
[ "Sets", "the", "image", "of", "the", "emoji", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/emoji/CustomEmojiBuilder.java#L157-L160
VoltDB/voltdb
third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java
DoubleHistogram.copyCorrectedForCoordinatedOmission
public DoubleHistogram copyCorrectedForCoordinatedOmission(final double expectedIntervalBetweenValueSamples) { final DoubleHistogram targetHistogram = new DoubleHistogram(configuredHighestToLowestValueRatio, getNumberOfSignificantValueDigits()); targetHistogram.setTrackableValueRange(currentLowestValueInAutoRange, currentHighestValueLimitInAutoRange); targetHistogram.addWhileCorrectingForCoordinatedOmission(this, expectedIntervalBetweenValueSamples); return targetHistogram; }
java
public DoubleHistogram copyCorrectedForCoordinatedOmission(final double expectedIntervalBetweenValueSamples) { final DoubleHistogram targetHistogram = new DoubleHistogram(configuredHighestToLowestValueRatio, getNumberOfSignificantValueDigits()); targetHistogram.setTrackableValueRange(currentLowestValueInAutoRange, currentHighestValueLimitInAutoRange); targetHistogram.addWhileCorrectingForCoordinatedOmission(this, expectedIntervalBetweenValueSamples); return targetHistogram; }
[ "public", "DoubleHistogram", "copyCorrectedForCoordinatedOmission", "(", "final", "double", "expectedIntervalBetweenValueSamples", ")", "{", "final", "DoubleHistogram", "targetHistogram", "=", "new", "DoubleHistogram", "(", "configuredHighestToLowestValueRatio", ",", "getNumberOf...
Get a copy of this histogram, corrected for coordinated omission. <p> To compensate for the loss of sampled values when a recorded value is larger than the expected interval between value samples, the new histogram will include an auto-generated additional series of decreasingly-smaller (down to the expectedIntervalBetweenValueSamples) value records for each count found in the current histogram that is larger than the expectedIntervalBetweenValueSamples. Note: This is a post-correction method, as opposed to the at-recording correction method provided by {@link #recordValueWithExpectedInterval(double, double) recordValueWithExpectedInterval}. The two methods are mutually exclusive, and only one of the two should be be used on a given data set to correct for the same coordinated omission issue. by <p> See notes in the description of the Histogram calls for an illustration of why this corrective behavior is important. @param expectedIntervalBetweenValueSamples If expectedIntervalBetweenValueSamples is larger than 0, add auto-generated value records as appropriate if value is larger than expectedIntervalBetweenValueSamples @return a copy of this histogram, corrected for coordinated omission.
[ "Get", "a", "copy", "of", "this", "histogram", "corrected", "for", "coordinated", "omission", ".", "<p", ">", "To", "compensate", "for", "the", "loss", "of", "sampled", "values", "when", "a", "recorded", "value", "is", "larger", "than", "the", "expected", ...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java#L613-L619
square/dagger
core/src/main/java/dagger/internal/Linker.java
Linker.requestBinding
public Binding<?> requestBinding(String key, Object requiredBy, ClassLoader classLoader) { return requestBinding(key, requiredBy, classLoader, true, true); }
java
public Binding<?> requestBinding(String key, Object requiredBy, ClassLoader classLoader) { return requestBinding(key, requiredBy, classLoader, true, true); }
[ "public", "Binding", "<", "?", ">", "requestBinding", "(", "String", "key", ",", "Object", "requiredBy", ",", "ClassLoader", "classLoader", ")", "{", "return", "requestBinding", "(", "key", ",", "requiredBy", ",", "classLoader", ",", "true", ",", "true", ")"...
Returns the binding if it exists immediately. Otherwise this returns null. If the returned binding didn't exist or was unlinked, it will be enqueued to be linked.
[ "Returns", "the", "binding", "if", "it", "exists", "immediately", ".", "Otherwise", "this", "returns", "null", ".", "If", "the", "returned", "binding", "didn", "t", "exist", "or", "was", "unlinked", "it", "will", "be", "enqueued", "to", "be", "linked", "."...
train
https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/core/src/main/java/dagger/internal/Linker.java#L249-L251
mgormley/pacaya
src/main/java/edu/jhu/pacaya/sch/util/dist/TruncatedNormal.java
TruncatedNormal.probabilityTruncZero
public static double probabilityTruncZero(double a, double b, double mu, double sigma) { // clip at zero a = Math.max(a, 0.0); b = Math.max(b, 0.0); final double denom = sigma * SQRT2; final double scaledSDA = (a - mu) / denom; final double scaledSDB = (b - mu) / denom; // compute prob final double probNormTimes2 = Erf.erf(scaledSDA, scaledSDB); // renormalize final double scaledSD0 = -mu / denom; final double reZTimes2 = Erf.erfc(scaledSD0); return probNormTimes2 / reZTimes2; }
java
public static double probabilityTruncZero(double a, double b, double mu, double sigma) { // clip at zero a = Math.max(a, 0.0); b = Math.max(b, 0.0); final double denom = sigma * SQRT2; final double scaledSDA = (a - mu) / denom; final double scaledSDB = (b - mu) / denom; // compute prob final double probNormTimes2 = Erf.erf(scaledSDA, scaledSDB); // renormalize final double scaledSD0 = -mu / denom; final double reZTimes2 = Erf.erfc(scaledSD0); return probNormTimes2 / reZTimes2; }
[ "public", "static", "double", "probabilityTruncZero", "(", "double", "a", ",", "double", "b", ",", "double", "mu", ",", "double", "sigma", ")", "{", "// clip at zero", "a", "=", "Math", ".", "max", "(", "a", ",", "0.0", ")", ";", "b", "=", "Math", "....
returns the probability of x falling within the range of a to b under a normal distribution with mean mu and standard deviation sigma if the distribution is truncated below 0 and renormalized a and b should both be greater than or equal to 0 but this is not checked
[ "returns", "the", "probability", "of", "x", "falling", "within", "the", "range", "of", "a", "to", "b", "under", "a", "normal", "distribution", "with", "mean", "mu", "and", "standard", "deviation", "sigma", "if", "the", "distribution", "is", "truncated", "bel...
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/sch/util/dist/TruncatedNormal.java#L89-L102
lite2073/email-validator
src/com/dominicsayers/isemail/dns/DNSLookup.java
DNSLookup.hasRecords
public static boolean hasRecords(String hostName, String dnsType) throws DNSLookupException { return DNSLookup.doLookup(hostName, dnsType) > 0; }
java
public static boolean hasRecords(String hostName, String dnsType) throws DNSLookupException { return DNSLookup.doLookup(hostName, dnsType) > 0; }
[ "public", "static", "boolean", "hasRecords", "(", "String", "hostName", ",", "String", "dnsType", ")", "throws", "DNSLookupException", "{", "return", "DNSLookup", ".", "doLookup", "(", "hostName", ",", "dnsType", ")", ">", "0", ";", "}" ]
Checks if a host name has a valid record. @param hostName The hostname @param dnsType The kind of record (A, AAAA, MX, ...) @return Whether the record is available or not @throws DNSLookupException Appears on a fatal error like dnsType invalid or initial context error.
[ "Checks", "if", "a", "host", "name", "has", "a", "valid", "record", "." ]
train
https://github.com/lite2073/email-validator/blob/cfdda77ed630854b44d62def0d5b7228d5c4e712/src/com/dominicsayers/isemail/dns/DNSLookup.java#L29-L32
OpenTSDB/opentsdb
src/meta/Annotation.java
Annotation.getStorageJSON
@VisibleForTesting byte[] getStorageJSON() { // TODO - precalculate size final ByteArrayOutputStream output = new ByteArrayOutputStream(); try { final JsonGenerator json = JSON.getFactory().createGenerator(output); json.writeStartObject(); if (tsuid != null && !tsuid.isEmpty()) { json.writeStringField("tsuid", tsuid); } json.writeNumberField("startTime", start_time); json.writeNumberField("endTime", end_time); json.writeStringField("description", description); json.writeStringField("notes", notes); if (custom == null) { json.writeNullField("custom"); } else { final TreeMap<String, String> sorted_custom = new TreeMap<String, String>(custom); json.writeObjectField("custom", sorted_custom); } json.writeEndObject(); json.close(); return output.toByteArray(); } catch (IOException e) { throw new RuntimeException("Unable to serialize Annotation", e); } }
java
@VisibleForTesting byte[] getStorageJSON() { // TODO - precalculate size final ByteArrayOutputStream output = new ByteArrayOutputStream(); try { final JsonGenerator json = JSON.getFactory().createGenerator(output); json.writeStartObject(); if (tsuid != null && !tsuid.isEmpty()) { json.writeStringField("tsuid", tsuid); } json.writeNumberField("startTime", start_time); json.writeNumberField("endTime", end_time); json.writeStringField("description", description); json.writeStringField("notes", notes); if (custom == null) { json.writeNullField("custom"); } else { final TreeMap<String, String> sorted_custom = new TreeMap<String, String>(custom); json.writeObjectField("custom", sorted_custom); } json.writeEndObject(); json.close(); return output.toByteArray(); } catch (IOException e) { throw new RuntimeException("Unable to serialize Annotation", e); } }
[ "@", "VisibleForTesting", "byte", "[", "]", "getStorageJSON", "(", ")", "{", "// TODO - precalculate size", "final", "ByteArrayOutputStream", "output", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "try", "{", "final", "JsonGenerator", "json", "=", "JSON", "...
Serializes the object in a uniform matter for storage. Needed for successful CAS calls @return The serialized object as a byte array
[ "Serializes", "the", "object", "in", "a", "uniform", "matter", "for", "storage", ".", "Needed", "for", "successful", "CAS", "calls" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/Annotation.java#L517-L545
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/attributes/AttributesColumn.java
AttributesColumn.createColumn
public static AttributesColumn createColumn(int index, String name, GeoPackageDataType type, boolean notNull, Object defaultValue) { return createColumn(index, name, type, null, notNull, defaultValue); }
java
public static AttributesColumn createColumn(int index, String name, GeoPackageDataType type, boolean notNull, Object defaultValue) { return createColumn(index, name, type, null, notNull, defaultValue); }
[ "public", "static", "AttributesColumn", "createColumn", "(", "int", "index", ",", "String", "name", ",", "GeoPackageDataType", "type", ",", "boolean", "notNull", ",", "Object", "defaultValue", ")", "{", "return", "createColumn", "(", "index", ",", "name", ",", ...
Create a new column @param index index @param name name @param type data type @param notNull not null flag @param defaultValue default value @return attributes column
[ "Create", "a", "new", "column" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/attributes/AttributesColumn.java#L43-L46
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/A_CmsSelectBox.java
A_CmsSelectBox.setFormValue
public void setFormValue(Object value, boolean fireEvents) { if (value == null) { value = ""; } if (!"".equals(value) && !m_selectCells.containsKey(value)) { OPTION option = createUnknownOption((String)value); if (option != null) { addOption(option); } } if (value instanceof String) { String strValue = (String)value; onValueSelect(strValue, fireEvents); } }
java
public void setFormValue(Object value, boolean fireEvents) { if (value == null) { value = ""; } if (!"".equals(value) && !m_selectCells.containsKey(value)) { OPTION option = createUnknownOption((String)value); if (option != null) { addOption(option); } } if (value instanceof String) { String strValue = (String)value; onValueSelect(strValue, fireEvents); } }
[ "public", "void", "setFormValue", "(", "Object", "value", ",", "boolean", "fireEvents", ")", "{", "if", "(", "value", "==", "null", ")", "{", "value", "=", "\"\"", ";", "}", "if", "(", "!", "\"\"", ".", "equals", "(", "value", ")", "&&", "!", "m_se...
Sets the form value of this select box.<p> @param value the new value @param fireEvents true if change events should be fired
[ "Sets", "the", "form", "value", "of", "this", "select", "box", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/A_CmsSelectBox.java#L431-L446
Stratio/deep-spark
deep-core/src/main/java/com/stratio/deep/core/context/DeepSparkContext.java
DeepSparkContext.createHDFSRDD
public RDD<Cells> createHDFSRDD(ExtractorConfig<Cells> config) { Serializable host = config.getValues().get(ExtractorConstants.HOST); Serializable port = config.getValues().get(ExtractorConstants.PORT); Serializable path = config.getValues().get(ExtractorConstants.FS_FILE_PATH); final TextFileDataTable textFileDataTable = UtilFS.createTextFileMetaDataFromConfig(config, this); String filePath = path.toString(); if (config.getExtractorImplClassName().equals(ExtractorConstants.HDFS)) { filePath = ExtractorConstants.HDFS_PREFIX + host.toString() + ":" + port + path.toString(); } return createRDDFromFilePath(filePath, textFileDataTable); }
java
public RDD<Cells> createHDFSRDD(ExtractorConfig<Cells> config) { Serializable host = config.getValues().get(ExtractorConstants.HOST); Serializable port = config.getValues().get(ExtractorConstants.PORT); Serializable path = config.getValues().get(ExtractorConstants.FS_FILE_PATH); final TextFileDataTable textFileDataTable = UtilFS.createTextFileMetaDataFromConfig(config, this); String filePath = path.toString(); if (config.getExtractorImplClassName().equals(ExtractorConstants.HDFS)) { filePath = ExtractorConstants.HDFS_PREFIX + host.toString() + ":" + port + path.toString(); } return createRDDFromFilePath(filePath, textFileDataTable); }
[ "public", "RDD", "<", "Cells", ">", "createHDFSRDD", "(", "ExtractorConfig", "<", "Cells", ">", "config", ")", "{", "Serializable", "host", "=", "config", ".", "getValues", "(", ")", ".", "get", "(", "ExtractorConstants", ".", "HOST", ")", ";", "Serializab...
Returns a Cells RDD from HDFS. @param config HDFS ExtractorConfig. @return Cells RDD.
[ "Returns", "a", "Cells", "RDD", "from", "HDFS", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-core/src/main/java/com/stratio/deep/core/context/DeepSparkContext.java#L277-L291
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/RationalQuadraticKernel.java
RationalQuadraticKernel.setC
public void setC(double c) { if(c <= 0 || Double.isNaN(c) || Double.isInfinite(c)) throw new IllegalArgumentException("coefficient must be in (0, Inf), not " + c); this.c = c; }
java
public void setC(double c) { if(c <= 0 || Double.isNaN(c) || Double.isInfinite(c)) throw new IllegalArgumentException("coefficient must be in (0, Inf), not " + c); this.c = c; }
[ "public", "void", "setC", "(", "double", "c", ")", "{", "if", "(", "c", "<=", "0", "||", "Double", ".", "isNaN", "(", "c", ")", "||", "Double", ".", "isInfinite", "(", "c", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"coefficient must ...
Sets the positive additive coefficient @param c the positive additive coefficient
[ "Sets", "the", "positive", "additive", "coefficient" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/RationalQuadraticKernel.java#L36-L41
PinaeOS/nala
src/main/java/org/pinae/nala/xb/util/ResourceReader.java
ResourceReader.getFileStream
public InputStreamReader getFileStream(File file, String encoding) throws NoSuchPathException, UnmarshalException{ try { return new InputStreamReader(new FileInputStream(file), encoding); } catch (FileNotFoundException e) { throw new NoSuchPathException(e); } catch (UnsupportedEncodingException e){ throw new UnmarshalException(e); } }
java
public InputStreamReader getFileStream(File file, String encoding) throws NoSuchPathException, UnmarshalException{ try { return new InputStreamReader(new FileInputStream(file), encoding); } catch (FileNotFoundException e) { throw new NoSuchPathException(e); } catch (UnsupportedEncodingException e){ throw new UnmarshalException(e); } }
[ "public", "InputStreamReader", "getFileStream", "(", "File", "file", ",", "String", "encoding", ")", "throws", "NoSuchPathException", ",", "UnmarshalException", "{", "try", "{", "return", "new", "InputStreamReader", "(", "new", "FileInputStream", "(", "file", ")", ...
将文件读出为输出流 @param file 需要读取的文件 @param encoding 文件编码 @return 文件内容输出流 @throws NoSuchPathException 无法找到对应的文件或者路径 @throws UnmarshalException 解组失败(通常由于编码问题引起)
[ "将文件读出为输出流" ]
train
https://github.com/PinaeOS/nala/blob/2047ade4af197cec938278d300d111ea94af6fbf/src/main/java/org/pinae/nala/xb/util/ResourceReader.java#L120-L129
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/cpnl/CpnlElFunctions.java
CpnlElFunctions.unmappedUrl
public static String unmappedUrl(SlingHttpServletRequest request, String path) { return LinkUtil.getUnmappedUrl(request, path); }
java
public static String unmappedUrl(SlingHttpServletRequest request, String path) { return LinkUtil.getUnmappedUrl(request, path); }
[ "public", "static", "String", "unmappedUrl", "(", "SlingHttpServletRequest", "request", ",", "String", "path", ")", "{", "return", "LinkUtil", ".", "getUnmappedUrl", "(", "request", ",", "path", ")", ";", "}" ]
Builds the URL for a repository path using the LinkUtil.getUnmappedURL() method. @param request the current request (domain host hint) @param path the repository path @return the URL built in the context of the requested domain host
[ "Builds", "the", "URL", "for", "a", "repository", "path", "using", "the", "LinkUtil", ".", "getUnmappedURL", "()", "method", "." ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/cpnl/CpnlElFunctions.java#L198-L200
google/closure-compiler
src/com/google/javascript/jscomp/TemplateAstMatcher.java
TemplateAstMatcher.createTemplateParameterNode
private Node createTemplateParameterNode(int index, JSType type, boolean isStringLiteral) { checkState(index >= 0); checkNotNull(type); Node n = Node.newNumber(index); if (isStringLiteral) { n.setToken(TEMPLATE_STRING_LITERAL); } else { n.setToken(TEMPLATE_TYPE_PARAM); } n.setJSType(type); return n; }
java
private Node createTemplateParameterNode(int index, JSType type, boolean isStringLiteral) { checkState(index >= 0); checkNotNull(type); Node n = Node.newNumber(index); if (isStringLiteral) { n.setToken(TEMPLATE_STRING_LITERAL); } else { n.setToken(TEMPLATE_TYPE_PARAM); } n.setJSType(type); return n; }
[ "private", "Node", "createTemplateParameterNode", "(", "int", "index", ",", "JSType", "type", ",", "boolean", "isStringLiteral", ")", "{", "checkState", "(", "index", ">=", "0", ")", ";", "checkNotNull", "(", "type", ")", ";", "Node", "n", "=", "Node", "."...
Creates a template parameter or string literal template node.
[ "Creates", "a", "template", "parameter", "or", "string", "literal", "template", "node", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TemplateAstMatcher.java#L293-L304
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/initialization/KMeansPlusPlusInitialMeans.java
KMeansPlusPlusInitialMeans.initialWeights
static double initialWeights(WritableDoubleDataStore weights, DBIDs ids, NumberVector first, DistanceQuery<? super NumberVector> distQ) { double weightsum = 0.; for(DBIDIter it = ids.iter(); it.valid(); it.advance()) { // Distance will usually already be squared double weight = distQ.distance(first, it); weights.putDouble(it, weight); weightsum += weight; } return weightsum; }
java
static double initialWeights(WritableDoubleDataStore weights, DBIDs ids, NumberVector first, DistanceQuery<? super NumberVector> distQ) { double weightsum = 0.; for(DBIDIter it = ids.iter(); it.valid(); it.advance()) { // Distance will usually already be squared double weight = distQ.distance(first, it); weights.putDouble(it, weight); weightsum += weight; } return weightsum; }
[ "static", "double", "initialWeights", "(", "WritableDoubleDataStore", "weights", ",", "DBIDs", "ids", ",", "NumberVector", "first", ",", "DistanceQuery", "<", "?", "super", "NumberVector", ">", "distQ", ")", "{", "double", "weightsum", "=", "0.", ";", "for", "...
Initialize the weight list. @param weights Weight list @param ids IDs @param first Added ID @param distQ Distance query @return Weight sum
[ "Initialize", "the", "weight", "list", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/initialization/KMeansPlusPlusInitialMeans.java#L119-L128
yoojia/NextInputs-Android
inputs/src/main/java/com/github/yoojia/inputs/NextInputs.java
NextInputs.add
public NextInputs add(Input input, Scheme... schemes) { if (schemes == null || schemes.length == 0) { throw new IllegalArgumentException("Test schemes is required !"); } Arrays.sort(schemes, ORDERING); mInputSpecs.add(new InputSpec(input, schemes)); return this; }
java
public NextInputs add(Input input, Scheme... schemes) { if (schemes == null || schemes.length == 0) { throw new IllegalArgumentException("Test schemes is required !"); } Arrays.sort(schemes, ORDERING); mInputSpecs.add(new InputSpec(input, schemes)); return this; }
[ "public", "NextInputs", "add", "(", "Input", "input", ",", "Scheme", "...", "schemes", ")", "{", "if", "(", "schemes", "==", "null", "||", "schemes", ".", "length", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Test schemes is requ...
添加输入条目及测试模式。 @param input 输入条目 @param schemes 测试模式 @return NextInputs
[ "添加输入条目及测试模式。" ]
train
https://github.com/yoojia/NextInputs-Android/blob/9ca90cf47e84c41ac226d04694194334d2923252/inputs/src/main/java/com/github/yoojia/inputs/NextInputs.java#L74-L81
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/Buckets.java
Buckets.initializeState
void initializeState(final ListState<byte[]> bucketStates, final ListState<Long> partCounterState) throws Exception { initializePartCounter(partCounterState); LOG.info("Subtask {} initializing its state (max part counter={}).", subtaskIndex, maxPartCounter); initializeActiveBuckets(bucketStates); }
java
void initializeState(final ListState<byte[]> bucketStates, final ListState<Long> partCounterState) throws Exception { initializePartCounter(partCounterState); LOG.info("Subtask {} initializing its state (max part counter={}).", subtaskIndex, maxPartCounter); initializeActiveBuckets(bucketStates); }
[ "void", "initializeState", "(", "final", "ListState", "<", "byte", "[", "]", ">", "bucketStates", ",", "final", "ListState", "<", "Long", ">", "partCounterState", ")", "throws", "Exception", "{", "initializePartCounter", "(", "partCounterState", ")", ";", "LOG",...
Initializes the state after recovery from a failure. <p>During this process: <ol> <li>we set the initial value for part counter to the maximum value used before across all tasks and buckets. This guarantees that we do not overwrite valid data,</li> <li>we commit any pending files for previous checkpoints (previous to the last successful one from which we restore),</li> <li>we resume writing to the previous in-progress file of each bucket, and</li> <li>if we receive multiple states for the same bucket, we merge them.</li> </ol> @param bucketStates the state holding recovered state about active buckets. @param partCounterState the state holding the max previously used part counters. @throws Exception if anything goes wrong during retrieving the state or restoring/committing of any in-progress/pending part files
[ "Initializes", "the", "state", "after", "recovery", "from", "a", "failure", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/Buckets.java#L143-L150
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/spec/AbstractSpecWithPrimaryKey.java
AbstractSpecWithPrimaryKey.withPrimaryKey
public AbstractSpecWithPrimaryKey<T> withPrimaryKey(String hashKeyName, Object hashKeyValue) { if (hashKeyName == null) throw new IllegalArgumentException(); withPrimaryKey(new PrimaryKey(hashKeyName, hashKeyValue)); return this; }
java
public AbstractSpecWithPrimaryKey<T> withPrimaryKey(String hashKeyName, Object hashKeyValue) { if (hashKeyName == null) throw new IllegalArgumentException(); withPrimaryKey(new PrimaryKey(hashKeyName, hashKeyValue)); return this; }
[ "public", "AbstractSpecWithPrimaryKey", "<", "T", ">", "withPrimaryKey", "(", "String", "hashKeyName", ",", "Object", "hashKeyValue", ")", "{", "if", "(", "hashKeyName", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "withPrimaryKey"...
Sets the primary key with the specified hash-only key name and value.
[ "Sets", "the", "primary", "key", "with", "the", "specified", "hash", "-", "only", "key", "name", "and", "value", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/spec/AbstractSpecWithPrimaryKey.java#L68-L73
SG-O/miIO
src/main/java/de/sg_o/app/miio/base/Device.java
Device.sendOk
public boolean sendOk(String method, Object params) throws CommandExecutionException { return sendToArray(method, params).optString(0).toLowerCase().equals("ok"); }
java
public boolean sendOk(String method, Object params) throws CommandExecutionException { return sendToArray(method, params).optString(0).toLowerCase().equals("ok"); }
[ "public", "boolean", "sendOk", "(", "String", "method", ",", "Object", "params", ")", "throws", "CommandExecutionException", "{", "return", "sendToArray", "(", "method", ",", "params", ")", ".", "optString", "(", "0", ")", ".", "toLowerCase", "(", ")", ".", ...
Send a command to a device. If no IP has been specified, this will try do discover a device on the network. @param method The method to execute on the device. @param params The command to execute on the device. Must be a JSONArray or JSONObject. @return True if a ok was received from the device. @throws CommandExecutionException When there has been a error during the communication or the response was invalid.
[ "Send", "a", "command", "to", "a", "device", ".", "If", "no", "IP", "has", "been", "specified", "this", "will", "try", "do", "discover", "a", "device", "on", "the", "network", "." ]
train
https://github.com/SG-O/miIO/blob/f352dbd2a699d2cdb1b412ca5e6cbb0c38ca779b/src/main/java/de/sg_o/app/miio/base/Device.java#L402-L404
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.servlet.4.0/src/com/ibm/ws/webcontainer40/osgi/webapp/WebApp40.java
WebApp40.setInitParameter
@Override public boolean setInitParameter(String name, String value) throws IllegalStateException, IllegalArgumentException { if (name == null) { logger.logp(Level.SEVERE, CLASS_NAME, "setInitParameter", servlet40NLS.getString("name.is.null")); throw new java.lang.NullPointerException(servlet40NLS.getString("name.is.null")); } return super.setInitParameter(name, value); }
java
@Override public boolean setInitParameter(String name, String value) throws IllegalStateException, IllegalArgumentException { if (name == null) { logger.logp(Level.SEVERE, CLASS_NAME, "setInitParameter", servlet40NLS.getString("name.is.null")); throw new java.lang.NullPointerException(servlet40NLS.getString("name.is.null")); } return super.setInitParameter(name, value); }
[ "@", "Override", "public", "boolean", "setInitParameter", "(", "String", "name", ",", "String", "value", ")", "throws", "IllegalStateException", ",", "IllegalArgumentException", "{", "if", "(", "name", "==", "null", ")", "{", "logger", ".", "logp", "(", "Level...
/* Throw NPE if name is null @see com.ibm.ws.webcontainer.webapp.WebApp#setInitParameter(java.lang.String, java.lang.String)
[ "/", "*", "Throw", "NPE", "if", "name", "is", "null" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.servlet.4.0/src/com/ibm/ws/webcontainer40/osgi/webapp/WebApp40.java#L140-L148
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/opengl/InternalTextureLoader.java
InternalTextureLoader.getTexture
public Texture getTexture(File source, boolean flipped,int filter) throws IOException { String resourceName = source.getAbsolutePath(); InputStream in = new FileInputStream(source); return getTexture(in, resourceName, flipped, filter, null); }
java
public Texture getTexture(File source, boolean flipped,int filter) throws IOException { String resourceName = source.getAbsolutePath(); InputStream in = new FileInputStream(source); return getTexture(in, resourceName, flipped, filter, null); }
[ "public", "Texture", "getTexture", "(", "File", "source", ",", "boolean", "flipped", ",", "int", "filter", ")", "throws", "IOException", "{", "String", "resourceName", "=", "source", ".", "getAbsolutePath", "(", ")", ";", "InputStream", "in", "=", "new", "Fi...
Get a texture from a specific file @param source The file to load the texture from @param flipped True if we should flip the texture on the y axis while loading @param filter The filter to use @return The texture loaded @throws IOException Indicates a failure to load the image
[ "Get", "a", "texture", "from", "a", "specific", "file" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/InternalTextureLoader.java#L135-L140
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/RepositoryManager.java
RepositoryManager.addRepository
private void addRepository(String repositoryId, RepositoryWrapper repositoryHolder) { repositories.put(repositoryId, repositoryHolder); try { numRepos = getNumberOfRepositories(); } catch (WIMException e) { // okay } }
java
private void addRepository(String repositoryId, RepositoryWrapper repositoryHolder) { repositories.put(repositoryId, repositoryHolder); try { numRepos = getNumberOfRepositories(); } catch (WIMException e) { // okay } }
[ "private", "void", "addRepository", "(", "String", "repositoryId", ",", "RepositoryWrapper", "repositoryHolder", ")", "{", "repositories", ".", "put", "(", "repositoryId", ",", "repositoryHolder", ")", ";", "try", "{", "numRepos", "=", "getNumberOfRepositories", "("...
Pair adding to the repositories map and resetting the numRepos int. @param repositoryId @param repositoryHolder
[ "Pair", "adding", "to", "the", "repositories", "map", "and", "resetting", "the", "numRepos", "int", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/RepositoryManager.java#L77-L84
agmip/ace-core
src/main/java/org/agmip/ace/io/AceGenerator.java
AceGenerator.generateACEB
public static void generateACEB(File dest, String json) throws IOException { FileOutputStream fos = new FileOutputStream(dest); GZIPOutputStream gos = new GZIPOutputStream(fos); gos.write(json.getBytes("UTF-8")); gos.close(); fos.close(); }
java
public static void generateACEB(File dest, String json) throws IOException { FileOutputStream fos = new FileOutputStream(dest); GZIPOutputStream gos = new GZIPOutputStream(fos); gos.write(json.getBytes("UTF-8")); gos.close(); fos.close(); }
[ "public", "static", "void", "generateACEB", "(", "File", "dest", ",", "String", "json", ")", "throws", "IOException", "{", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "dest", ")", ";", "GZIPOutputStream", "gos", "=", "new", "GZIPOutputStream"...
Write a GZIP compressed string to a file. <p> This method GZIP compresses a string and writes it to a file. This method automatically closes the OutputStream used to create the file. @param dest Destination {@link File} @param json String to GZIP compress and write. @throws IOException if there is an I/O error
[ "Write", "a", "GZIP", "compressed", "string", "to", "a", "file", ".", "<p", ">", "This", "method", "GZIP", "compresses", "a", "string", "and", "writes", "it", "to", "a", "file", ".", "This", "method", "automatically", "closes", "the", "OutputStream", "used...
train
https://github.com/agmip/ace-core/blob/51957e79b4567d0083c52d0720f4a268c3a02f44/src/main/java/org/agmip/ace/io/AceGenerator.java#L127-L134
looly/hutool
hutool-core/src/main/java/cn/hutool/core/bean/copier/BeanCopier.java
BeanCopier.mappingKey
private static String mappingKey(Map<String, String> mapping, String fieldName) { if (MapUtil.isEmpty(mapping)) { return fieldName; } return ObjectUtil.defaultIfNull(mapping.get(fieldName), fieldName); }
java
private static String mappingKey(Map<String, String> mapping, String fieldName) { if (MapUtil.isEmpty(mapping)) { return fieldName; } return ObjectUtil.defaultIfNull(mapping.get(fieldName), fieldName); }
[ "private", "static", "String", "mappingKey", "(", "Map", "<", "String", ",", "String", ">", "mapping", ",", "String", "fieldName", ")", "{", "if", "(", "MapUtil", ".", "isEmpty", "(", "mapping", ")", ")", "{", "return", "fieldName", ";", "}", "return", ...
获取指定字段名对应的映射值 @param mapping 反向映射Map @param fieldName 字段名 @return 映射值,无对应值返回字段名 @since 4.1.10
[ "获取指定字段名对应的映射值" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/copier/BeanCopier.java#L294-L299
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
StrBuilder.indexOf
public int indexOf(final char ch, int startIndex) { startIndex = (startIndex < 0 ? 0 : startIndex); if (startIndex >= size) { return -1; } final char[] thisBuf = buffer; for (int i = startIndex; i < size; i++) { if (thisBuf[i] == ch) { return i; } } return -1; }
java
public int indexOf(final char ch, int startIndex) { startIndex = (startIndex < 0 ? 0 : startIndex); if (startIndex >= size) { return -1; } final char[] thisBuf = buffer; for (int i = startIndex; i < size; i++) { if (thisBuf[i] == ch) { return i; } } return -1; }
[ "public", "int", "indexOf", "(", "final", "char", "ch", ",", "int", "startIndex", ")", "{", "startIndex", "=", "(", "startIndex", "<", "0", "?", "0", ":", "startIndex", ")", ";", "if", "(", "startIndex", ">=", "size", ")", "{", "return", "-", "1", ...
Searches the string builder to find the first reference to the specified char. @param ch the character to find @param startIndex the index to start at, invalid index rounded to edge @return the first index of the character, or -1 if not found
[ "Searches", "the", "string", "builder", "to", "find", "the", "first", "reference", "to", "the", "specified", "char", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2417-L2429
Jasig/uPortal
uPortal-layout/uPortal-layout-core/src/main/java/org/apereo/portal/layout/PortletTabIdResolver.java
PortletTabIdResolver.containsElmentWithId
private boolean containsElmentWithId(Node node, String id) { String nodeName = node.getNodeName(); if ("channel".equals(nodeName) || "folder".equals(nodeName)) { Element e = (Element) node; if (id.equals(e.getAttribute("ID"))) { return true; } if ("folder".equals(nodeName)) { for (Node child = e.getFirstChild(); child != null; child = child.getNextSibling()) { if (containsElmentWithId(child, id)) { return true; } } } } return false; }
java
private boolean containsElmentWithId(Node node, String id) { String nodeName = node.getNodeName(); if ("channel".equals(nodeName) || "folder".equals(nodeName)) { Element e = (Element) node; if (id.equals(e.getAttribute("ID"))) { return true; } if ("folder".equals(nodeName)) { for (Node child = e.getFirstChild(); child != null; child = child.getNextSibling()) { if (containsElmentWithId(child, id)) { return true; } } } } return false; }
[ "private", "boolean", "containsElmentWithId", "(", "Node", "node", ",", "String", "id", ")", "{", "String", "nodeName", "=", "node", ".", "getNodeName", "(", ")", ";", "if", "(", "\"channel\"", ".", "equals", "(", "nodeName", ")", "||", "\"folder\"", ".", ...
Recursevly find out whether node contains a folder or channel with given identifier. @param node Where to search. @param id Identifier to search for. @return true if node or any of its descendats contain an element with given identifier, false otherwise.
[ "Recursevly", "find", "out", "whether", "node", "contains", "a", "folder", "or", "channel", "with", "given", "identifier", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-core/src/main/java/org/apereo/portal/layout/PortletTabIdResolver.java#L79-L97
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.wikimachine/src/main/java/de/tudarmstadt/ukp/wikipedia/wikimachine/util/UTFDataInputStream.java
UTFDataInputStream.readUTFAsArray
public String readUTFAsArray() throws IOException { byte[] buffer = new byte[super.readInt()]; super.read(buffer, 0, buffer.length); return new String(buffer, "UTF-8"); }
java
public String readUTFAsArray() throws IOException { byte[] buffer = new byte[super.readInt()]; super.read(buffer, 0, buffer.length); return new String(buffer, "UTF-8"); }
[ "public", "String", "readUTFAsArray", "(", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "super", ".", "readInt", "(", ")", "]", ";", "super", ".", "read", "(", "buffer", ",", "0", ",", "buffer", ".", "length...
Read a byte array formed UTF-8 String @return a String written with {@link UTFDataOutputStream#writeUTFAsArray(String)} @throws IOException @see UTFDataOutputStream#writeUTFAsArray(String)
[ "Read", "a", "byte", "array", "formed", "UTF", "-", "8", "String" ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.wikimachine/src/main/java/de/tudarmstadt/ukp/wikipedia/wikimachine/util/UTFDataInputStream.java#L72-L76